Update spzvtbg

This commit is contained in:
Stoyan Zlatev 2023-04-21 10:45:08 +00:00
parent c22184ab96
commit 4ab64937c8

View File

@ -1,25 +1,388 @@
strSQL = " SELECT [AuftragPosition].* "
strSQL = strSQL & " , [Kunde].[Ort] AS [Kundenort]"
strSQL = strSQL & " , [Kunde].[Name]"
strSQL = strSQL & " , [Identnr].[KurzBez]"
strSQL = strSQL & " , [Identnr].[Typ]"
strSQL = strSQL & " , [Identnr].[Typzusatz]"
strSQL = strSQL & " , [Identnr].[Nennweite]"
strSQL = strSQL & " , [Identnr].[Temperatur]"
strSQL = strSQL & " , [Identnr].[Druck]"
strSQL = strSQL & " , [Identnr].[Baulaenge]"
strSQL = strSQL & " , [Identnr].[IdentNrString]"
strSQL = strSQL & " , [Identnr].[VakoCode]"
strSQL = strSQL & " , [Identnr].[SAP_Nummer]"
strSQL = strSQL & " , [Identnr].[Bestellgruppe]"
strSQL = strSQL & " , CASE WHEN [VakoMerkmal].[Charcode] IS NULL OR [VakoMerkmal].[Charcode] = 'X'"
strSQL = strSQL & " THEN 'x'"
strSQL = strSQL & " ELSE 'o' END AS [DruckSensor]"
strSQL = strSQL & " FROM [AuftragPosition]"
strSQL = strSQL & " JOIN [Kunde] ON [Kunde].[KundenNr] = [AuftragPosition].[KundenNr]"
strSQL = strSQL & " JOIN [Identnr] ON [Identnr].[IdentNr] = [AuftragPosition].[IdentNr]"
strSQL = strSQL & " LEFT JOIN (SELECT [Stelle], [Laenge], [Charcode]"
strSQL = strSQL & " FROM [Auftrag].[dbo].[VAKO_Merkmale]"
strSQL = strSQL & " WHERE [Basis] = 'GNS' AND [Name] = 'C_GEN_GEHAEUSEOPTION')"
strSQL = strSQL & " AS [VakoMerkmal]"
strSQL = strSQL & " ON [VakoMerkmal].[Charcode] = SUBSTRING([Identnr].[VakoCode], [VakoMerkmal].[Stelle], [VakoMerkmal].[Laenge])"
Private Sub FinePrintGrid()
Dim strTemp As String
Dim dblX As Double
Dim dblY As Double
Dim Seite As Integer
Dim i As Integer
Dim strAusblenden As String
Dim ZeileAufBlatt As Integer
Dim dblLastFontSize As Double
Dim lngFarbe As Long
Dim strLinie As String
Dim strAlteLinie As String
Dim lngSummeMenge As Long
Dim dblYstart As Double
Dim dblYende As Double
lngSummeMenge = Val(lblSumme)
strAusblenden = m_strAusblenden
Printer.ColorMode = 2
Printer.Copies = Val(cmbAnzahlKopien.Text)
Printer.Font = "Arial"
Printer.ScaleMode = vbMillimeters
Printer.ScaleLeft = -6 ' Rand
Printer.ScaleTop = -1 ' Rand
'''''''''''''''''Seiten Kopf
Seite = 1
Printer.CurrentY = 5
Printer.Line (0, Int(Printer.CurrentY))-(Tabs(20), Int(Printer.CurrentY))
Printer.CurrentY = Printer.CurrentY + 1
Printer.Line (0, Printer.CurrentY)-(Tabs(20), Printer.CurrentY)
Printer.CurrentY = Printer.CurrentY + 1
Printer.CurrentX = 5
Printer.Font.Size = 15
Printer.Font.Bold = True
Printer.FontTransparent = True
dblY = Printer.CurrentY
Printer.Print GetUeberschrift(strAusblenden)
Printer.Font.Size = SCHRIFTTABELLE
Printer.Font.Bold = False
Printer.CurrentY = dblY
Printer.CurrentX = 135
Printer.Print "Ausdruck vom " & Format(Now(), "dd.mm.yyyy hh:mm:ss")
Printer.CurrentY = Printer.CurrentY + 15 - SCHRIFTTABELLE
Printer.CurrentY = Printer.CurrentY + 1
Printer.CurrentX = 10
strTemp = "Auswahl vom: " & Format(DTPickerVon.Value, "dd.mm.yyyy") & " bis: " & Format(DTPickerBis.Value, "dd.mm.yyyy")
Printer.Print strTemp
strTemp = "Ort: " & GetFertOrtText()
If txtFilterKunde.Text <> "" Then
strTemp = strTemp & ", Kunde:" & txtFilterKunde.Text & " "
End If
If cmbKurzBez.Text <> TEXTALLEKURZBEZ Then
Printer.FontBold = True
If strTemp <> "" Then strTemp = strTemp & ", nur "
strTemp = strTemp & cmbKurzBez.Text
End If
If lstFilterTyp.Text <> TEXTALLETYPEN Then
Printer.FontBold = True
If strTemp <> "" Then strTemp = strTemp & ", "
For i = 0 To lstFilterTyp.ListCount - 1
If lstFilterTyp.Selected(i) = True Then
strTemp = strTemp & lstFilterTyp.List(i) & ", "
End If
Next
End If
If cmbFilterNennweite.Text <> TEXTALLE Then
Printer.FontBold = True
strTemp = strTemp & " DN " & cmbFilterNennweite.Text
End If
If cmbFilterTemp.Text <> TEXTALLE Then
Printer.FontBold = True
strTemp = strTemp & " " & cmbFilterTemp.Text & "<22>C "
End If
If cmbFilterDruck.Text <> TEXTALLE Then
Printer.FontBold = True
strTemp = strTemp & " PN " & cmbFilterDruck.Text & " "
End If
If cmbFilterBaulaenge.Text <> TEXTALLE Then
Printer.FontBold = True
strTemp = strTemp & " L" & cmbFilterBaulaenge.Text & " "
End If
If cmbFilterMetrolog.Text <> TEXTALLE Then
Printer.FontBold = True
strTemp = strTemp & ", Metrolog:" & cmbFilterMetrolog.Text & " "
End If
If chkNurCKD.Value = vbChecked Then
strTemp = strTemp & ", nur CKD "
End If
If ChkOhnePlus.Value = vbChecked Then
strTemp = strTemp & ", kein PLUS "
End If
If chkPlus.Value = vbChecked Then
strTemp = strTemp & ", nur PLUS "
End If
If chkNoMoskauBadger.Value = vbChecked Then
strTemp = strTemp & ", ohne Moskau/Badger "
End If
If strAusblenden = "P" Then
strTemp = strTemp & ", keine FK u. FE "
End If
If strAusblenden = "R" Then
strTemp = strTemp & ", nur PFL u. PSE "
End If
Printer.CurrentX = 10
Printer.Print strTemp
Printer.FontBold = False
Printer.CurrentY = Printer.CurrentY + 3
Printer.Line (0, Printer.CurrentY)-(Tabs(20), Printer.CurrentY)
Printer.CurrentY = Printer.CurrentY + 1
Printer.Line (0, Printer.CurrentY)-(Tabs(20), Printer.CurrentY)
Dim Zeile As Integer
''''''''''''' Tabellenkopf
Printer.CurrentY = Printer.CurrentY + 3
Call Tabellenkopf
' Obere Kante der Tabelle merken
dblY = Printer.CurrentY + 8
dblYstart = dblY - 12
ZeileAufBlatt = 0
Printer.CurrentY = dblY - 8
For Zeile = 1 To mlngRecordsFound
ZeileAufBlatt = ZeileAufBlatt + 1
If Printer.CurrentY > 270 Then
' Zeile passt nicht mehr aufs Blatt
PrintSenkrechteLinien dblYstart, Printer.CurrentY
ZeileAufBlatt = 1
Call SeitenFuss(strAusblenden, Seite)
Printer.NewPage
Printer.Font.Size = SCHRIFTTABELLE
Seite = Seite + 1
StatusBar1.SimpleText = "Drucke Seite " & Seite
DoEvents
Printer.CurrentY = 5
Call Tabellenkopf
' Obere Kante der Tabelle
dblY = Printer.CurrentY + 8
dblYstart = dblY - 12
End If
Printer.CurrentY = dblY
For i = 0 To MSFlexGrid1.cols - 1
Printer.CurrentY = dblY + (ZeileAufBlatt - 2) * 5
If MSFlexGrid1.Rows <= Zeile Then
MSFlexGrid1.Rows = MSFlexGrid1.Rows + 1
End If
MSFlexGrid1.row = Zeile
MSFlexGrid1.col = i
strTemp = Trim(MSFlexGrid1.Text)
Printer.Font.Size = 8
Printer.Font.Bold = False
Select Case i
Case 0
'Versanddatum
Printer.Font.Bold = True
If strTemp <> "" Then
strTemp = Format(CDate(strTemp), "dd.mm")
End If
Case 1
' AuftragNr/Pos
Printer.Font.Bold = True
Case 2
'Kunden Ort
Printer.Font.Size = 6
strTemp = Textformat(strTemp, i)
Case 3
'IdentNr
If Len(strTemp) > 7 Then
Printer.FontSize = 6
End If
Printer.Font.Bold = True
Case 4
'Menge
Printer.Font.Bold = True
Case 5
' Bezeichnung
'Printer.Font.Size = 6
'strTemp = Textformat(strTemp, i)
Printer.Font.Size = getFontSizeFromText(Printer, Tabs(i), Tabs(i + 1), strTemp & "*", 7)
Case 6
' Bohrung
strTemp = Textformat(strTemp, i)
Printer.Font.Size = 6
Case 7
Printer.Font.Size = 5
Case 8, 9, 10, 11, 12, 13, 14, 15 ' QLAVEMPRD
Printer.Font.Size = 6
Printer.Font.Bold = True
Case 16 ' Anzeige
Printer.Font.Size = 6
strTemp = Textformat(strTemp, i)
Case 17 ' Bemerkung
Printer.Font.Size = 6
strTemp = Textformat(strTemp, i)
Case 18
'ort
Case 19
' FA Nr
Printer.Font.Size = 8
End Select
If chkVersuch.Value = vbChecked Then
Select Case i
Case 6, 7
' SerienNrVon
Printer.Font.Size = 8
Printer.Font.Bold = True
Case 8 ' Anzeige
Printer.Font.Size = 6
strTemp = Textformat(strTemp, i)
Case 9 ' Bemerkung
Printer.Font.Size = 6
strTemp = Textformat(strTemp, i)
Case 10
Printer.Font.Size = 6
strTemp = Textformat(strTemp, i)
Printer.CurrentY = Printer.CurrentY + 1
End Select
End If
Printer.CurrentX = Tabs(i)
Select Case i
Case 1, 3
' rechtsb<73>ndig
Printer.CurrentX = Tabs(i + 1) - Printer.TextWidth(strTemp) - 1
Case 0, 4
' rechtsb<73>ndig
Printer.CurrentX = Tabs(i + 1) - Printer.TextWidth(strTemp) - 2
End Select
Select Case i
Case 17
' Bemerkung
Printer.CurrentY = Printer.CurrentY - 2
Printer.CurrentX = Tabs(i)
Printer.Print Left(strTemp, 10)
Printer.CurrentX = Tabs(i)
Printer.Print Mid(strTemp, 11)
Printer.CurrentY = Printer.CurrentY + 1
Case Else
Printer.Print strTemp
End Select
dblLastFontSize = Printer.Font.Size
Printer.Font.Size = 8
Next
' da letzte Spalte eine kleinere Schriftgroesse haben k<>nnte
'Printer.CurrentY = Printer.CurrentY + 2
Printer.DrawWidth = 3
If Zeile < mlngRecordsFound Then
If strAusblenden <> "VF" Then
Printer.DrawStyle = vbDashDot
lngFarbe = RGB(224, 224, 224)
Else
If MSFlexGrid1.cols > 14 Then
' es gibt Spalte Linie
strLinie = MSFlexGrid1.TextMatrix(Zeile + 1, 14)
If Zeile > 1 Then
strAlteLinie = MSFlexGrid1.TextMatrix(Zeile, 14)
Else
strAlteLinie = strLinie
End If
If strAlteLinie <> strLinie Then
Printer.DrawStyle = vbSolid
lngFarbe = RGB(0, 0, 0)
Else
Printer.DrawStyle = vbDashDot
lngFarbe = RGB(224, 224, 224)
End If
Else
Printer.DrawStyle = vbDashDot
lngFarbe = RGB(224, 224, 224)
End If
End If
Printer.Line (0, Printer.CurrentY)-(Tabs(20), Printer.CurrentY), lngFarbe
Else
Printer.DrawStyle = vbSolid
Printer.Line (0, Printer.CurrentY)-(Tabs(20), Printer.CurrentY)
Printer.CurrentY = Printer.CurrentY + 2
Dim dblTempHoehe As Double
dblTempHoehe = Printer.CurrentY
Printer.Font.Bold = True
strTemp = "Summe: " & lngSummeMenge
Printer.CurrentX = Tabs(4 + 1) - Printer.TextWidth(strTemp) - 2
Printer.Print strTemp
Printer.CurrentY = dblTempHoehe
strTemp = "davon gepr<70>ft: " & lblGeprueft.Caption
Printer.CurrentX = Tabs(5 + 1) - Printer.TextWidth(strTemp) - 2
Printer.Print strTemp
dblTempHoehe = Printer.CurrentY
'Printer.CurrentY = dblTempHoehe
strTemp = "nicht zu pr<70>fende ME, FE, FK: " & Val(lblNichtZuPruefende)
Printer.CurrentX = Tabs(4 + 1) - Printer.TextWidth(strTemp) - 2
Printer.Print strTemp
Printer.CurrentY = dblTempHoehe
strTemp = "noch zu pr<70>fen: " & lngSummeMenge - Val(lblGeprueft.Caption) - Val(lblNichtZuPruefende)
Printer.CurrentX = Tabs(5 + 1) - Printer.TextWidth(strTemp) - 2
Printer.Print strTemp
End If
DoEvents
If m_blnAbbruch Then
Call Abbruch
Exit Sub
End If
Next
PrintSenkrechteLinien dblYstart, Printer.CurrentY
Printer.CurrentY = Printer.CurrentY + 3
If Printer.CurrentY < 278 Then
Printer.Line (0, Printer.CurrentY)-(Tabs(20), Printer.CurrentY)
Printer.Line (0, Printer.CurrentY + 1)-(Tabs(20), Printer.CurrentY + 1)
End If
SeitenFuss strAusblenden, Seite, " von " & Seite & " Seiten"
If m_blnAbbruch Then
Call Abbruch
Exit Sub
End If
Printer.EndDoc
End Sub