Replace frmRuecklaeuferanalyse.frm

This commit is contained in:
Stoyan Zlatev
2023-05-15 12:04:28 +00:00
parent 7cbc0b36b2
commit 6db10618da
+103 -96
View File
@@ -262,7 +262,7 @@ Begin VB.Form frmRuecklaeuferanalyse
Begin VB.ListBox lstAusfallgrund Begin VB.ListBox lstAusfallgrund
Height = 1410 Height = 1410
Left = 240 Left = 240
Style = 1 'Kontrollkästchen Style = 1 'Kontrollkästchen
TabIndex = 48 TabIndex = 48
Top = 1680 Top = 1680
Width = 7995 Width = 7995
@@ -502,9 +502,9 @@ Dim mcol_IDs As Collection
Const NEU = "(neu)" Const NEU = "(neu)"
Const TXT_BITTEAUSWAEHLEN = "(Bitte auswählen!)" Const TXT_BITTEAUSWAEHLEN = "(Bitte auswählen!)"
Const TXT_ERFOLGREICH = "Zähler erfolgreich geprüft" Const TXT_ERFOLGREICH = "Zähler erfolgreich geprüft"
Const TXT_ERNEUTAUSGEFALLEN = "Zähler erneut ausgefallen" Const TXT_ERNEUTAUSGEFALLEN = "Zähler erneut ausgefallen"
Private m_lngID As Long Private m_lngID As Long
@@ -525,7 +525,7 @@ Private Sub cmdBeenden_Click()
Dim lngReturn As Long Dim lngReturn As Long
If cmdSave.Enabled = True Then If cmdSave.Enabled = True Then
lngReturn = MsgBox("Sollen Ihre Änderungen gespeichert werden?", vbYesNoCancel Or vbDefaultButton1 Or vbExclamation, Me.caption) lngReturn = MsgBox("Sollen Ihre Änderungen gespeichert werden?", vbYesNoCancel Or vbDefaultButton1 Or vbExclamation, Me.caption)
Select Case lngReturn Select Case lngReturn
Case vbYes Case vbYes
If speichern() = True Then If speichern() = True Then
@@ -596,13 +596,13 @@ Private Sub Form_Load()
If m_Pruefzaehler Is Nothing Then If m_Pruefzaehler Is Nothing Then
Set m_Pruefzaehler = New CPruefzaehler Set m_Pruefzaehler = New CPruefzaehler
strSearch = InputBox("Bitte geben Sie die SerienNr, kundeneigene SNr oder Gerätenummer des Zählers an", "Rückläufer Analyse") strSearch = InputBox("Bitte geben Sie die SerienNr, kundeneigene SNr oder Gerätenummer des Zählers an", "Rückläufer Analyse")
lngSerienNr = val(strSearch) lngSerienNr = val(strSearch)
If strSearch <> "" Then If strSearch <> "" Then
Screen.MousePointer = vbHourglass Screen.MousePointer = vbHourglass
If m_Pruefzaehler.loadForSerienOrFabNummerOrKundeneigene(strSearch) = False Then If m_Pruefzaehler.loadForSerienOrFabNummerOrKundeneigene(strSearch) = False Then
Call MsgBox("Prüfzählerdaten konnten für Nr. " & lngSerienNr & " nicht geladen werden", vbCritical, "Rückläufer Analyse") Call MsgBox("Prüfzählerdaten konnten für Nr. " & lngSerienNr & " nicht geladen werden", vbCritical, "Rückläufer Analyse")
Set m_Pruefzaehler = Nothing Set m_Pruefzaehler = Nothing
Screen.MousePointer = vbNormal Screen.MousePointer = vbNormal
Exit Sub Exit Sub
@@ -631,7 +631,7 @@ Private Sub Form_Load()
lblAuftragPosNr.caption = m_objAuftrag.getNr & " / " & m_objAuftragPosition.getNr lblAuftragPosNr.caption = m_objAuftrag.getNr & " / " & m_objAuftragPosition.getNr
lblSerienNr.caption = FormatSerienNr(m_Pruefzaehler.getSerienNr) lblSerienNr.caption = FormatSerienNr(m_Pruefzaehler.getSerienNr)
lblKunde.caption = m_objAuftrag.getKunde.getName & ", " & m_objAuftrag.getKunde.getOrt lblKunde.caption = m_objAuftrag.getKunde.getName & ", " & m_objAuftrag.getKunde.getOrt
lblBezeichnung.caption = m_objIdentNr.getTyp & " " & m_objIdentNr.getTypzusatz & " DN" & m_objIdentNr.getNennweite & " " & m_objIdentNr.GetTemperatur & "°C/PN " & m_objIdentNr.getDruck & " (" & m_objAuftragPosition.getAnzeige & ")" lblBezeichnung.caption = m_objIdentNr.getTyp & " " & m_objIdentNr.getTypzusatz & " DN" & m_objIdentNr.getNennweite & " " & m_objIdentNr.GetTemperatur & "°C/PN " & m_objIdentNr.getDruck & " (" & m_objAuftragPosition.getAnzeige & ")"
lblFabNr.caption = m_Pruefzaehler.getAuftragPositionSerienNr.getFabNr lblFabNr.caption = m_Pruefzaehler.getAuftragPositionSerienNr.getFabNr
lblKundeneigeneSNr.caption = m_Pruefzaehler.getAuftragPositionSerienNr.getKundeneigeneSerienNr lblKundeneigeneSNr.caption = m_Pruefzaehler.getAuftragPositionSerienNr.getKundeneigeneSerienNr
@@ -653,7 +653,7 @@ Private Sub Form_Load()
cmdSave.Enabled = False cmdSave.Enabled = False
Exit Sub Exit Sub
Errorhandler: Errorhandler:
MsgBox "Fehler " & Err.Number & " in Rückläuferanalye (Form_Load):" & Err.Description MsgBox "Fehler " & Err.Number & " in Rückläuferanalye (Form_Load):" & Err.Description
End Sub End Sub
Private Sub clearPruefpunkteFlexgrid() Private Sub clearPruefpunkteFlexgrid()
@@ -662,7 +662,7 @@ Private Sub clearPruefpunkteFlexgrid()
msfgPruefpunkte.Font.Bold = True msfgPruefpunkte.Font.Bold = True
msfgPruefpunkte.col = 0 msfgPruefpunkte.col = 0
msfgPruefpunkte.row = 0 msfgPruefpunkte.row = 0
msfgPruefpunkte.text = "Q [m³/h]" msfgPruefpunkte.text = "Q [m³/h]"
msfgPruefpunkte.row = 1 msfgPruefpunkte.row = 1
msfgPruefpunkte.text = "Fehler [%]" msfgPruefpunkte.text = "Fehler [%]"
@@ -681,7 +681,7 @@ Private Sub fillPrueffehler()
For i = 1 To 10 For i = 1 To 10
strTemp = "PP" & i & "_Fehler" strTemp = "PP" & i & "_Fehler"
If rs.isFieldNull(strTemp) Then Exit For If rs.isFieldNull(strTemp) Then Exit For
msfgPruefpunkte.Cols = i + 1 msfgPruefpunkte.cols = i + 1
' Fehler vorhanden ' Fehler vorhanden
Fehler = Round(rs.getDoubleValue(strTemp), 2) Fehler = Round(rs.getDoubleValue(strTemp), 2)
@@ -775,8 +775,8 @@ End Sub
Public Function getStatusFertigung(intStatus As Integer) As String Public Function getStatusFertigung(intStatus As Integer) As String
Select Case intStatus Select Case intStatus
'0=ohne Bearbeitung, 10=Vorfertigung OK, 20=Montage,22=Prüfung abgebrochen, '0=ohne Bearbeitung, 10=Vorfertigung OK, 20=Montage,22=Prüfung abgebrochen,
'25=Grenzwertüberschreitung Prüfstation, 30=Prüfstation geprüft, 40=dieser Zähler ausgeliefert,45= Lagerauftrag an Lager geliefert, 50=Auftrag ausgeliefert '25=Grenzwertüberschreitung Prüfstation, 30=Prüfstation geprüft, 40=dieser Zähler ausgeliefert,45= Lagerauftrag an Lager geliefert, 50=Auftrag ausgeliefert
Case 0 Case 0
getStatusFertigung = "ohne Bearbeitung" getStatusFertigung = "ohne Bearbeitung"
Case 10 Case 10
@@ -784,13 +784,13 @@ Public Function getStatusFertigung(intStatus As Integer) As String
Case 20 Case 20
getStatusFertigung = "Montage" getStatusFertigung = "Montage"
Case 22 Case 22
getStatusFertigung = "Prüfung abgebrochen" getStatusFertigung = "Prüfung abgebrochen"
Case 25 Case 25
getStatusFertigung = "Grenzwertüberschreitung" getStatusFertigung = "Grenzwertüberschreitung"
Case 30 Case 30
getStatusFertigung = "Prüfstation geprüft" getStatusFertigung = "Prüfstation geprüft"
Case 40 Case 40
getStatusFertigung = "Zähler ausgeliefert" getStatusFertigung = "Zähler ausgeliefert"
Case 45 Case 45
getStatusFertigung = "Lagerauftrag an Lager geliefert" getStatusFertigung = "Lagerauftrag an Lager geliefert"
Case 50 Case 50
@@ -804,7 +804,7 @@ Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Dim lngReturn As Long Dim lngReturn As Long
If UnloadMode = 0 And cmdSave.Enabled = True Then If UnloadMode = 0 And cmdSave.Enabled = True Then
' Benutzer hat auf [X] rechts oben geklickt ' Benutzer hat auf [X] rechts oben geklickt
lngReturn = MsgBox("Sollen Ihre Änderungen gespeichert werden?", vbYesNoCancel Or vbDefaultButton1 Or vbExclamation, Me.caption) lngReturn = MsgBox("Sollen Ihre Änderungen gespeichert werden?", vbYesNoCancel Or vbDefaultButton1 Or vbExclamation, Me.caption)
Select Case lngReturn Select Case lngReturn
Case vbCancel Case vbCancel
Cancel = 1 Cancel = 1
@@ -836,7 +836,7 @@ Private Function speichern() As Boolean
rs.openRS "Ruecklaeuferanalyse", False rs.openRS "Ruecklaeuferanalyse", False
rs.addNew rs.addNew
' Felder für die Neuanlage ' Felder für die Neuanlage
Call rs.setValue("AuftragNr", m_Pruefzaehler.getAuftrag.getNr) Call rs.setValue("AuftragNr", m_Pruefzaehler.getAuftrag.getNr)
Call rs.setValue("PositionNr", m_Pruefzaehler.getAuftragPosition.getNr) Call rs.setValue("PositionNr", m_Pruefzaehler.getAuftragPosition.getNr)
@@ -866,7 +866,7 @@ Private Function speichern() As Boolean
Call rs.setValue("Bezeichnung", lblBezeichnung.caption) Call rs.setValue("Bezeichnung", lblBezeichnung.caption)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''' Prüfpunkte speichern '''' Prüfpunkte speichern
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim strQ As String Dim strQ As String
Dim strFehler As String Dim strFehler As String
@@ -877,7 +877,7 @@ Private Function speichern() As Boolean
strQ = "" strQ = ""
strFehler = "" strFehler = ""
For i = 1 To msfgPruefpunkte.Cols - 1 For i = 1 To msfgPruefpunkte.cols - 1
msfgPruefpunkte.col = i msfgPruefpunkte.col = i
msfgPruefpunkte.row = 0 msfgPruefpunkte.row = 0
strQ = strQ & strTrenner & msfgPruefpunkte.text strQ = strQ & strTrenner & msfgPruefpunkte.text
@@ -916,7 +916,7 @@ Private Function speichern() As Boolean
Call rs.setValue("Befund", txtReparaturmassnahme.text) Call rs.setValue("Befund", txtReparaturmassnahme.text)
End If End If
If cmbBefund.text = TXT_BITTEAUSWAEHLEN Then If cmbBefund.text = TXT_BITTEAUSWAEHLEN Then
' nichts ausgewählt ' nichts ausgewählt
ElseIf cmbBefund.text = TXT_ERFOLGREICH Then ElseIf cmbBefund.text = TXT_ERFOLGREICH Then
rs.setValue "ReparaturErfolgreich", True rs.setValue "ReparaturErfolgreich", True
ElseIf cmbBefund.text = TXT_ERNEUTAUSGEFALLEN Then ElseIf cmbBefund.text = TXT_ERNEUTAUSGEFALLEN Then
@@ -926,7 +926,7 @@ Private Function speichern() As Boolean
rs.update rs.update
If m_lngID = 0 Then If m_lngID = 0 Then
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Die ID des eben gespeicherten Rückläufers ' Die ID des eben gespeicherten Rückläufers
Set rs = New CRecordset Set rs = New CRecordset
rs.openRS "SELECT newID = @@IDENTITY", True rs.openRS "SELECT newID = @@IDENTITY", True
m_lngID = rs.getIntValue("newID") m_lngID = rs.getIntValue("newID")
@@ -940,7 +940,7 @@ Private Function speichern() As Boolean
speichern = True speichern = True
Exit Function Exit Function
Errorhandler: Errorhandler:
ErrorMsg "Fehler " & Err.Number & " beim Speichern des Rückläufers: " & Err.Description ErrorMsg "Fehler " & Err.Number & " beim Speichern des Rückläufers: " & Err.Description
End Function End Function
Private Sub lstAusfallgrund_Click() Private Sub lstAusfallgrund_Click()
@@ -989,12 +989,12 @@ Private Sub AktualisiereVonHistorie(lngIndex As Long)
txtZeitaufwand = "" txtZeitaufwand = ""
Fill_lstAusfallgrund Fill_lstAusfallgrund
' RH 31.07.2007: nichts auswählen ' RH 31.07.2007: nichts auswählen
'lstAusfallgrund.Selected(0) = True ' erster Eintrag ist selektiert 'lstAusfallgrund.Selected(0) = True ' erster Eintrag ist selektiert
FelderEingabenZulassen FelderEingabenZulassen
Call fillPruefgangFelder Call fillPruefgangFelder
msfgPruefpunkte.Cols = 1 msfgPruefpunkte.cols = 1
If Not m_Pruefgang Is Nothing Then If Not m_Pruefgang Is Nothing Then
Call fillPrueffehler Call fillPrueffehler
End If End If
@@ -1064,8 +1064,8 @@ Private Sub AktualisiereVonHistorie(lngIndex As Long)
strDurchfluesse = rs.getStringValue("Pruefpunkte") strDurchfluesse = rs.getStringValue("Pruefpunkte")
strFehler = rs.getStringValue("Fehler") strFehler = rs.getStringValue("Fehler")
msfgPruefpunkte.Cols = UBound(Split(strDurchfluesse, "|")) + 2 msfgPruefpunkte.cols = UBound(Split(strDurchfluesse, "|")) + 2
For i = 1 To msfgPruefpunkte.Cols - 1 For i = 1 To msfgPruefpunkte.cols - 1
msfgPruefpunkte.col = i msfgPruefpunkte.col = i
msfgPruefpunkte.row = 0 msfgPruefpunkte.row = 0
msfgPruefpunkte.text = Split(strDurchfluesse, "|")(i - 1) msfgPruefpunkte.text = Split(strDurchfluesse, "|")(i - 1)
@@ -1083,7 +1083,7 @@ Private Sub AktualisiereVonHistorie(lngIndex As Long)
Exit Sub Exit Sub
Errorhandler: Errorhandler:
ErrorMsg "Fehler " & Err.Number & " beim Anzeigen des Rückläufers: " & Err.Description ErrorMsg "Fehler " & Err.Number & " beim Anzeigen des Rückläufers: " & Err.Description
End Sub End Sub
Private Sub TestAufAusfallgrund() Private Sub TestAufAusfallgrund()
@@ -1111,7 +1111,7 @@ Private Function PruefeAufPflichtfelder() As Boolean
Next Next
If blnAusgewaehlt = False Then If blnAusgewaehlt = False Then
MsgBox "Bitte wählen Sie mindestens einen Ausfallgrund!", vbCritical MsgBox "Bitte wählen Sie mindestens einen Ausfallgrund!", vbCritical
If lstAusfallgrund.Enabled = True Then If lstAusfallgrund.Enabled = True Then
lstAusfallgrund.SetFocus lstAusfallgrund.SetFocus
End If End If
@@ -1120,7 +1120,7 @@ Private Function PruefeAufPflichtfelder() As Boolean
End If End If
' If Trim(txtAusfallgrund.text) = "" Then ' If Trim(txtAusfallgrund.text) = "" Then
' MsgBox "Bitte füllen Sie das Feld 'sonstiges' aus!", vbCritical ' MsgBox "Bitte füllen Sie das Feld 'sonstiges' aus!", vbCritical
' If txtAusfallgrund.Enabled = True Then ' If txtAusfallgrund.Enabled = True Then
' txtAusfallgrund.SetFocus ' txtAusfallgrund.SetFocus
' End If ' End If
@@ -1128,7 +1128,7 @@ Private Function PruefeAufPflichtfelder() As Boolean
' Exit Function ' Exit Function
' End If ' End If
' If Trim(txtReparaturmassnahme.text) = "" Then ' If Trim(txtReparaturmassnahme.text) = "" Then
' MsgBox "Bitte füllen Sie das Feld 'Reparaturmaßnahmen' aus!", vbCritical ' MsgBox "Bitte füllen Sie das Feld 'Reparaturmaßnahmen' aus!", vbCritical
' If txtReparaturmassnahme.Enabled = True Then ' If txtReparaturmassnahme.Enabled = True Then
' txtReparaturmassnahme.SetFocus ' txtReparaturmassnahme.SetFocus
' End If ' End If
@@ -1137,7 +1137,7 @@ Private Function PruefeAufPflichtfelder() As Boolean
' End If ' End If
If Trim(txtZeitaufwand.text) = "" Then If Trim(txtZeitaufwand.text) = "" Then
MsgBox "Bitte füllen Sie das Feld 'Zeitaufwand' aus!", vbCritical MsgBox "Bitte füllen Sie das Feld 'Zeitaufwand' aus!", vbCritical
If txtZeitaufwand.Enabled = True Then If txtZeitaufwand.Enabled = True Then
txtZeitaufwand.SetFocus txtZeitaufwand.SetFocus
End If End If
@@ -1255,7 +1255,7 @@ Private Sub PrintProtokoll(ByRef PrintObjekt As Object)
lngSeite = lngSeite + 1 lngSeite = lngSeite + 1
' neue Seite ' neue Seite
If Not rs.EOF Then If Not rs.EOF Then
' es gibt noch weitere Blöcke für weitere Seiten ' es gibt noch weitere Blöcke für weitere Seiten
If TypeName(PrintObjekt) = "Printer" Then If TypeName(PrintObjekt) = "Printer" Then
Printer.NewPage Printer.NewPage
Else Else
@@ -1267,16 +1267,20 @@ Private Sub PrintProtokoll(ByRef PrintObjekt As Object)
End If End If
Loop Loop
Else Else
MsgBox "Es gibt keine Rückläuferdaten zu diesem Zähler" MsgBox "Es gibt keine Rückläuferdaten zu diesem Zähler"
Printer.KillDoc Printer.KillDoc
Exit Sub Exit Sub
End If End If
' ===================================================================================================================================
' === Prüfgang & Prüffehler =========================================================================================================
' ===================================================================================================================================
Dim recordset As CRecordset Dim recordset As CRecordset
Dim evaluationsQuery As String Dim evaluationsQuery As String
Set recordset = New CRecordset Set recordset = New CRecordset
evaluationsQuery = " SELECT ROW_NUMBER() OVER (ORDER BY [PG].[Datum] DESC) AS [Id]" evaluationsQuery = " SELECT ROW_NUMBER() OVER (ORDER BY [PG].[Datum]) AS [Id]"
evaluationsQuery = evaluationsQuery & " , [PG].[PruefgangNr] AS [Nr]"
evaluationsQuery = evaluationsQuery & " , [PG].[PP1_Soll] AS [P1]" evaluationsQuery = evaluationsQuery & " , [PG].[PP1_Soll] AS [P1]"
evaluationsQuery = evaluationsQuery & " , [PF].[PP1_Fehler] AS [E1]" evaluationsQuery = evaluationsQuery & " , [PF].[PP1_Fehler] AS [E1]"
evaluationsQuery = evaluationsQuery & " , [PG].[PP2_Soll] AS [P2]" evaluationsQuery = evaluationsQuery & " , [PG].[PP2_Soll] AS [P2]"
@@ -1310,10 +1314,11 @@ Private Sub PrintProtokoll(ByRef PrintObjekt As Object)
Dim x As Integer Dim x As Integer
Dim p As Double Dim p As Double
Dim e As Double Dim e As Double
Dim cols(10) As Double
Dim soll(10) As String Dim soll(10) As String
Dim evaluations() As Variant Dim evaluations() As Variant
Dim length As Integer Dim length As Integer
Dim mw As Double Const offsetX = 0.5
length = recordset.RecordCount length = recordset.RecordCount
ReDim evaluations(length) ReDim evaluations(length)
@@ -1325,27 +1330,28 @@ Private Sub PrintProtokoll(ByRef PrintObjekt As Object)
Do While Not recordset.EOF Do While Not recordset.EOF
Dim ist(10) As String Dim ist(10) As String
id = recordset.getIntValue("Id") id = recordset.getIntValue("Id")
x = 0 ist(0) = recordset.getLongValue("Nr")
If cols(0) < Printer.textWidth(ist(0)) + 2 * offsetX Then
cols(0) = Printer.textWidth(ist(0)) + 2 * offsetX
End If
soll(0) = "Püfgang"
For col = 1 To 10 For col = 1 To 10
p = recordset.getDoubleValue("P" & col) p = recordset.getDoubleValue("P" & col)
If p <> 0 Then
soll(x) = Format(p, "#,##0.000") & ""
End If
e = recordset.getDoubleValue("E" & col) e = recordset.getDoubleValue("E" & col)
If e <> 0 Then If p <> 0 Then
ist(x) = Format(e, "#,##0.000") & "%" soll(col) = Format(p, "#,##0.000") & ""
If Printer.TextWidth(ist(x)) > mw Then
mw = Printer.TextWidth(ist(x))
End If
End If End If
If p <> 0 Or e <> 0 Then If e <> 0 Then
x = x + 1 ist(col) = Format(e, "#,##0.000") & "%"
If cols(col) < Printer.textWidth(ist(col)) Then
cols(col) = Printer.textWidth(ist(col)) + 2 * offsetX
End If
End If End If
Next Next
@@ -1356,7 +1362,6 @@ Private Sub PrintProtokoll(ByRef PrintObjekt As Object)
evaluations(0) = soll evaluations(0) = soll
If length > 0 Then If length > 0 Then
Dim offsetX As Double
Dim offsetY As Double Dim offsetY As Double
Dim initX As Double Dim initX As Double
Dim initY As Double Dim initY As Double
@@ -1367,10 +1372,8 @@ Private Sub PrintProtokoll(ByRef PrintObjekt As Object)
Dim text As String Dim text As String
Dim h As Double Dim h As Double
Dim tw As Double Dim tw As Double
Dim mw As Double
Printer.FontSize = 10
offsetX = 0.75
offsetY = 0.75 offsetY = 0.75
initX = 22 + 5 ' is the left border X coordinate of the previous element initX = 22 + 5 ' is the left border X coordinate of the previous element
initY = mdblCurrentY ' is the bottom border Y coordinate of the previous element initY = mdblCurrentY ' is the bottom border Y coordinate of the previous element
@@ -1379,7 +1382,6 @@ Private Sub PrintProtokoll(ByRef PrintObjekt As Object)
width = Printer.ScaleWidth - 9.7 ' width between inner frames width = Printer.ScaleWidth - 9.7 ' width between inner frames
lineH = Printer.TextHeight("|") lineH = Printer.TextHeight("|")
h = initY + lineH * (length + 2) + 0.4 h = initY + lineH * (length + 2) + 0.4
x = x - 1
Printer.Line (initX, initY)-(width, initY), vbActiveBorder Printer.Line (initX, initY)-(width, initY), vbActiveBorder
@@ -1392,13 +1394,14 @@ Private Sub PrintProtokoll(ByRef PrintObjekt As Object)
Printer.FontBold = False Printer.FontBold = False
End If End If
For col = 0 To x For col = 0 To 10
text = evaluations(row)(col) text = evaluations(row)(col)
tw = Printer.TextWidth(text) tw = Printer.textWidth(text)
px = px + offsetX + 0.1 px = px + offsetX + 0.1
mw = cols(col)
Printer.currentX = px + ((mw - tw) / 2) Printer.CurrentX = px + ((mw - tw) / 2)
Printer.currentY = py Printer.CurrentY = py
Printer.Print text Printer.Print text
px = px + mw + offsetX px = px + mw + offsetX
@@ -1409,20 +1412,24 @@ Private Sub PrintProtokoll(ByRef PrintObjekt As Object)
Printer.Line (initX, py)-(width, py), vbActiveBorder Printer.Line (initX, py)-(width, py), vbActiveBorder
Next Next
x = x + 1
px = initX px = initX
For col = 0 To x For col = 0 To 10
Printer.Line (px, initY)-(px, h), vbActiveBorder On Error Resume Next
text = evaluations(0)(col)
px = px + offsetX + mw + offsetX + 0.1 If text <> "" Then
Printer.Line (px, initY)-(px, h), vbActiveBorder
px = px + cols(col) + offsetX * 2 + 0.1
End If
Next Next
Printer.Line (width, initY)-(width, h), vbActiveBorder Printer.Line (width, initY)-(width, h), vbActiveBorder
mdblCurrentY = py mdblCurrentY = py
End If End If
' ===================================================================================================================================
' === Ende Prüfgang & Prüffehler ====================================================================================================
' ===================================================================================================================================
mdblCurrentY = mdblCurrentY + PrintObjekt.TextHeight("X") * 1.5 mdblCurrentY = mdblCurrentY + PrintObjekt.TextHeight("X") * 1.5
PrintObjekt.FontSize = 10 PrintObjekt.FontSize = 10
@@ -1431,17 +1438,17 @@ Private Sub PrintProtokoll(ByRef PrintObjekt As Object)
PrintText PrintObjekt, mdblLinkerRand + 52, mdblCurrentY, lngGesZeit & " min", , False PrintText PrintObjekt, mdblLinkerRand + 52, mdblCurrentY, lngGesZeit & " min", , False
mdblCurrentY = mdblCurrentY + PrintObjekt.TextHeight("X") * 1.5 * 2 mdblCurrentY = mdblCurrentY + PrintObjekt.TextHeight("X") * 1.5 * 2
PrintWithLinie PrintObjekt, "Befund / Reparatur-Maßnahme:" PrintWithLinie PrintObjekt, "Befund / Reparatur-Maßnahme:"
mdblCurrentY = mdblCurrentY + PrintObjekt.TextHeight("X") * 1.5 * 2 mdblCurrentY = mdblCurrentY + PrintObjekt.TextHeight("X") * 1.5 * 2
PrintWithLinie PrintObjekt, "" PrintWithLinie PrintObjekt, ""
mdblCurrentY = mdblUntererRand - 20 mdblCurrentY = mdblUntererRand - 20
PrintText PrintObjekt, mdblLinkerRand + 10, mdblCurrentY, "Unterschrift:", , True PrintText PrintObjekt, mdblLinkerRand + 10, mdblCurrentY, "Unterschrift:", , True
PrintObjekt.Line (mdblLinkerRand + 10 + PrintObjekt.TextWidth("Unterschrift:"), mdblCurrentY + PrintObjekt.TextHeight("X"))-(mdblLinkerRand + 10 + PrintObjekt.TextWidth("Unterschrift:") + 50, mdblCurrentY + PrintObjekt.TextHeight("X")) PrintObjekt.Line (mdblLinkerRand + 10 + PrintObjekt.textWidth("Unterschrift:"), mdblCurrentY + PrintObjekt.TextHeight("X"))-(mdblLinkerRand + 10 + PrintObjekt.textWidth("Unterschrift:") + 50, mdblCurrentY + PrintObjekt.TextHeight("X"))
PrintText PrintObjekt, mdblLinkerRand + 100, mdblCurrentY, "Datum:", , True PrintText PrintObjekt, mdblLinkerRand + 100, mdblCurrentY, "Datum:", , True
PrintObjekt.Line (mdblLinkerRand + 100 + PrintObjekt.TextWidth("Datum:"), mdblCurrentY + PrintObjekt.TextHeight("X"))-(mdblRechterRand - 20, mdblCurrentY + PrintObjekt.TextHeight("X")) PrintObjekt.Line (mdblLinkerRand + 100 + PrintObjekt.textWidth("Datum:"), mdblCurrentY + PrintObjekt.TextHeight("X"))-(mdblRechterRand - 20, mdblCurrentY + PrintObjekt.TextHeight("X"))
If TypeName(PrintObjekt) = "Printer" Then If TypeName(PrintObjekt) = "Printer" Then
Printer.EndDoc Printer.EndDoc
@@ -1455,16 +1462,16 @@ Errorhandler:
'End If 'End If
End Sub End Sub
Private Sub PrintWithLinie(PrintObjekt As Object, strText As String, Optional MaxWidth As Variant) Private Sub PrintWithLinie(PrintObjekt As Object, strText As String, Optional maxWidth As Variant)
If IsMissing(MaxWidth) Then If IsMissing(maxWidth) Then
MaxWidth = mdblRechterRand - 10 maxWidth = mdblRechterRand - 10
Else Else
MaxWidth = MaxWidth + mdblLinkerRand + 10 + PrintObjekt.TextWidth(strText) maxWidth = maxWidth + mdblLinkerRand + 10 + PrintObjekt.textWidth(strText)
End If End If
PrintText PrintObjekt, mdblLinkerRand + 10, mdblCurrentY, strText, , True PrintText PrintObjekt, mdblLinkerRand + 10, mdblCurrentY, strText, , True
PrintObjekt.Line (mdblLinkerRand + 10 + PrintObjekt.TextWidth(strText), mdblCurrentY + PrintObjekt.TextHeight(strText))-(MaxWidth, mdblCurrentY + PrintObjekt.TextHeight(strText)) PrintObjekt.Line (mdblLinkerRand + 10 + PrintObjekt.textWidth(strText), mdblCurrentY + PrintObjekt.TextHeight(strText))-(maxWidth, mdblCurrentY + PrintObjekt.TextHeight(strText))
End Sub End Sub
Private Sub PrintRahmen(ByRef PrintObjekt As Object, Optional lngSeitenNr As Long = 1, Optional lngAnzahlSeiten As Long = 1) Private Sub PrintRahmen(ByRef PrintObjekt As Object, Optional lngSeitenNr As Long = 1, Optional lngAnzahlSeiten As Long = 1)
@@ -1487,27 +1494,27 @@ Private Sub PrintRahmen(ByRef PrintObjekt As Object, Optional lngSeitenNr As Lon
Dim dblBildhoehe As Double Dim dblBildhoehe As Double
dblBildbreite = 45 dblBildbreite = 45
dblBildhoehe = dblBildbreite * ImgLogo.Height / ImgLogo.width dblBildhoehe = dblBildbreite * ImgLogo.height / ImgLogo.width
PrintObjekt.PaintPicture ImgLogo.Picture, mdblLinkerRand + 2, mdblObererRand + 5, dblBildbreite, dblBildhoehe PrintObjekt.PaintPicture ImgLogo.Picture, mdblLinkerRand + 2, mdblObererRand + 5, dblBildbreite, dblBildhoehe
' Linie Vertikal rechts vom Bild ' Linie Vertikal rechts vom Bild
PrintObjekt.Line (mdblLinkerRand + dblBildbreite + 4, mdblObererRand)-(mdblLinkerRand + dblBildbreite + 4, mdblLinie1top) PrintObjekt.Line (mdblLinkerRand + dblBildbreite + 4, mdblObererRand)-(mdblLinkerRand + dblBildbreite + 4, mdblLinie1top)
' Linie horizontal halbe Höhe ' Linie horizontal halbe Höhe
PrintObjekt.Line (mdblLinkerRand + dblBildbreite + 4, mdblObererRand + 13)-(mdblRechterRand, mdblObererRand + 13) PrintObjekt.Line (mdblLinkerRand + dblBildbreite + 4, mdblObererRand + 13)-(mdblRechterRand, mdblObererRand + 13)
PrintObjekt.FontSize = 12 PrintObjekt.FontSize = 12
' PrintText PrintObjekt, mdblLinkerRand + 75, mdblLinie1top - 18, "Anlage 2 zur", , False ' PrintText PrintObjekt, mdblLinkerRand + 75, mdblLinie1top - 18, "Anlage 2 zur", , False
' PrintText PrintObjekt, mdblLinkerRand + 65, mdblLinie1top - 12, "Arbeits- und Prüfanweisung", , True ' PrintText PrintObjekt, mdblLinkerRand + 65, mdblLinie1top - 12, "Arbeits- und Prüfanweisung", , True
' '
PrintObjekt.FontSize = 12 PrintObjekt.FontSize = 12
'PrintText PrintObjekt, mdblLinkerRand + 95, mdblLinie1top - 6, "Rückläuferanalyse", , True 'PrintText PrintObjekt, mdblLinkerRand + 95, mdblLinie1top - 6, "Rückläuferanalyse", , True
PrintObjekt.Font.Bold = False PrintObjekt.Font.Bold = False
PrintTextAligned PrintObjekt, "Anlage 2 zur", mdblLinkerRand + dblBildbreite + 4, mdblLinkerRand + dblBildbreite + 100, mdblLinie1top - 18, vbCenter PrintTextAligned PrintObjekt, "Anlage 2 zur", mdblLinkerRand + dblBildbreite + 4, mdblLinkerRand + dblBildbreite + 100, mdblLinie1top - 18, vbCenter
PrintObjekt.Font.Bold = True PrintObjekt.Font.Bold = True
PrintTextAligned PrintObjekt, "ARBEITS- UND PRÜFANWEISUNG", mdblLinkerRand + dblBildbreite + 4, mdblLinkerRand + dblBildbreite + 100, mdblLinie1top - 12, vbCenter PrintTextAligned PrintObjekt, "ARBEITS- UND PRÜFANWEISUNG", mdblLinkerRand + dblBildbreite + 4, mdblLinkerRand + dblBildbreite + 100, mdblLinie1top - 12, vbCenter
PrintTextAligned PrintObjekt, "Rückläuferanalyse", mdblLinkerRand + dblBildbreite + 4, mdblLinkerRand + dblBildbreite + 100, mdblLinie1top - 6, vbCenter PrintTextAligned PrintObjekt, "Rückläuferanalyse", mdblLinkerRand + dblBildbreite + 4, mdblLinkerRand + dblBildbreite + 100, mdblLinie1top - 6, vbCenter
' vertikale Linie rechts , links neben Dokument-Nr ' vertikale Linie rechts , links neben Dokument-Nr
PrintObjekt.Line (mdblLinkerRand + dblBildbreite + 100, mdblObererRand)-(mdblLinkerRand + dblBildbreite + 100, mdblLinie1top) PrintObjekt.Line (mdblLinkerRand + dblBildbreite + 100, mdblObererRand)-(mdblLinkerRand + dblBildbreite + 100, mdblLinie1top)
@@ -1523,8 +1530,8 @@ Private Sub PrintRahmen(ByRef PrintObjekt As Object, Optional lngSeitenNr As Lon
mdblCurrentY = mdblLinie1top mdblCurrentY = mdblLinie1top
PrintObjekt.currentX = mdblLinkerRand PrintObjekt.CurrentX = mdblLinkerRand
PrintObjekt.currentY = mdblUntererRand + 1 PrintObjekt.CurrentY = mdblUntererRand + 1
PrintObjekt.Font.Size = 8 PrintObjekt.Font.Size = 8
PrintObjekt.Print "gedruckt am " & Format(Now, "dd.mm.yyyy hh:mm:ss") & " von " & g_App.Mitarbeiter.getVorname & " " & g_App.Mitarbeiter.getName PrintObjekt.Print "gedruckt am " & Format(Now, "dd.mm.yyyy hh:mm:ss") & " von " & g_App.Mitarbeiter.getVorname & " " & g_App.Mitarbeiter.getName
PrintObjekt.Font.Size = 12 PrintObjekt.Font.Size = 12
@@ -1543,10 +1550,10 @@ Private Sub PrintKopfdaten(ByRef PrintObjekt As Object)
PrintText PrintObjekt, mdblLinkerRand + 10 + 75, mdblCurrentY, m_objAuftrag.getKunde.getOrt PrintText PrintObjekt, mdblLinkerRand + 10 + 75, mdblCurrentY, m_objAuftrag.getKunde.getOrt
mdblCurrentY = mdblCurrentY + 10 mdblCurrentY = mdblCurrentY + 10
PrintText PrintObjekt, mdblLinkerRand + 10, mdblCurrentY, "Zählertyp:", , True PrintText PrintObjekt, mdblLinkerRand + 10, mdblCurrentY, "Zählertyp:", , True
PrintText PrintObjekt, mdblLinkerRand + 10 + 25, mdblCurrentY, lblBezeichnung.caption PrintText PrintObjekt, mdblLinkerRand + 10 + 25, mdblCurrentY, lblBezeichnung.caption
mdblCurrentY = mdblCurrentY + 10 mdblCurrentY = mdblCurrentY + 10
PrintText PrintObjekt, mdblLinkerRand + 10, mdblCurrentY, "Zählernummer:", , True PrintText PrintObjekt, mdblLinkerRand + 10, mdblCurrentY, "Zählernummer:", , True
PrintText PrintObjekt, mdblLinkerRand + 10 + 35, mdblCurrentY, FormatSerienNr(lblSerienNr.caption), , True PrintText PrintObjekt, mdblLinkerRand + 10 + 35, mdblCurrentY, FormatSerienNr(lblSerienNr.caption), , True
If m_objAuftragPositionSerienNr.getKundeneigeneSerienNr <> "" Then If m_objAuftragPositionSerienNr.getKundeneigeneSerienNr <> "" Then
@@ -1575,19 +1582,19 @@ Private Sub PrintAusfallBlock(rs As CRecordset, ByRef PrintObjekt As Object)
PrintObjekt.Line (dblLinksOben, mdblCurrentY)-(dblRechtsOben, mdblCurrentY) PrintObjekt.Line (dblLinksOben, mdblCurrentY)-(dblRechtsOben, mdblCurrentY)
PrintObjekt.Font.Size = 10 PrintObjekt.Font.Size = 10
mdblCurrentY = mdblCurrentY + PrintObjekt.TextHeight("X") mdblCurrentY = mdblCurrentY + PrintObjekt.TextHeight("X")
PrintText PrintObjekt, mdblLinkerRand + 12, mdblCurrentY, "Prüfstation: ", , True PrintText PrintObjekt, mdblLinkerRand + 12, mdblCurrentY, "Prüfstation: ", , True
PrintText PrintObjekt, mdblLinkerRand + 35, mdblCurrentY, rs.getIntValue("Pruefstation") PrintText PrintObjekt, mdblLinkerRand + 35, mdblCurrentY, rs.getIntValue("Pruefstation")
PrintText PrintObjekt, mdblLinkerRand + 50, mdblCurrentY, "Zählerposition: ", , True PrintText PrintObjekt, mdblLinkerRand + 50, mdblCurrentY, "Zählerposition: ", , True
PrintText PrintObjekt, mdblLinkerRand + 80, mdblCurrentY, rs.getIntValue("Einbauplatz") PrintText PrintObjekt, mdblLinkerRand + 80, mdblCurrentY, rs.getIntValue("Einbauplatz")
PrintText PrintObjekt, mdblLinkerRand + 90, mdblCurrentY, "Prüfer: ", , True PrintText PrintObjekt, mdblLinkerRand + 90, mdblCurrentY, "Prüfer: ", , True
PrintText PrintObjekt, mdblLinkerRand + 107, mdblCurrentY, rs.getStringValue("Pruefer") & " (" & rs.getStringValue("PrueferNr") & ")" PrintText PrintObjekt, mdblLinkerRand + 107, mdblCurrentY, rs.getStringValue("Pruefer") & " (" & rs.getStringValue("PrueferNr") & ")"
mdblCurrentY = mdblCurrentY + PrintObjekt.TextHeight("X") * 1.5 mdblCurrentY = mdblCurrentY + PrintObjekt.TextHeight("X") * 1.5
If rs.getLongValue("PruefgangNr") <> 0 Then If rs.getLongValue("PruefgangNr") <> 0 Then
PrintText PrintObjekt, mdblLinkerRand + 10, mdblCurrentY, "Prüfgang: ", , True PrintText PrintObjekt, mdblLinkerRand + 10, mdblCurrentY, "Prüfgang: ", , True
PrintText PrintObjekt, mdblLinkerRand + 30, mdblCurrentY, rs.getLongValue("PruefgangNr") PrintText PrintObjekt, mdblLinkerRand + 30, mdblCurrentY, rs.getLongValue("PruefgangNr")
blnHasPruefgang = True blnHasPruefgang = True
End If End If
@@ -1599,7 +1606,7 @@ Private Sub PrintAusfallBlock(rs As CRecordset, ByRef PrintObjekt As Object)
Dim varTmp As Variant Dim varTmp As Variant
Dim i As Integer Dim i As Integer
i = 1 i = 1
PrintText PrintObjekt, mdblLinkerRand + 80, mdblCurrentY, "Q [m³/h]" PrintText PrintObjekt, mdblLinkerRand + 80, mdblCurrentY, "Q [m³/h]"
PrintObjekt.Line (mdblLinkerRand + 80, mdblCurrentY + 5)-(mdblLinkerRand + 80 + 15, mdblCurrentY + 5) PrintObjekt.Line (mdblLinkerRand + 80, mdblCurrentY + 5)-(mdblLinkerRand + 80 + 15, mdblCurrentY + 5)
PrintText PrintObjekt, mdblLinkerRand + 68, mdblCurrentY + 6, "Abweichung [%]" PrintText PrintObjekt, mdblLinkerRand + 68, mdblCurrentY + 6, "Abweichung [%]"
@@ -1622,7 +1629,7 @@ Private Sub PrintAusfallBlock(rs As CRecordset, ByRef PrintObjekt As Object)
End If End If
If rs.getLongValue("FabNr") Then If rs.getLongValue("FabNr") Then
PrintText PrintObjekt, mdblLinkerRand + 10, mdblCurrentY, "Geräte-Nr.:", True PrintText PrintObjekt, mdblLinkerRand + 10, mdblCurrentY, "Geräte-Nr.:", True
PrintText PrintObjekt, mdblLinkerRand + 30, mdblCurrentY, rs.getLongValue("FabNr") PrintText PrintObjekt, mdblLinkerRand + 30, mdblCurrentY, rs.getLongValue("FabNr")
mdblCurrentY = mdblCurrentY + Printer.TextHeight("X") * 1.5 mdblCurrentY = mdblCurrentY + Printer.TextHeight("X") * 1.5
End If End If
@@ -1639,7 +1646,7 @@ Private Sub PrintAusfallBlock(rs As CRecordset, ByRef PrintObjekt As Object)
strSQL = strSQL & "WHERE (Ruecklaeufer_Ausfallgrund.Ruecklaufer_ID = " & rs.getIntValue("ID") & ") ORDER BY Ausfallgruende.Sortorder" strSQL = strSQL & "WHERE (Ruecklaeufer_Ausfallgrund.Ruecklaufer_ID = " & rs.getIntValue("ID") & ") ORDER BY Ausfallgruende.Sortorder"
rsAusfall.openRS strSQL, True rsAusfall.openRS strSQL, True
If Not rs.EOF Then If Not rs.EOF Then
PrintText PrintObjekt, mdblLinkerRand + 10, mdblCurrentY, "Ausfallgründe: ", , True PrintText PrintObjekt, mdblLinkerRand + 10, mdblCurrentY, "Ausfallgründe: ", , True
Do While Not rsAusfall.EOF Do While Not rsAusfall.EOF
PrintText PrintObjekt, mdblLinkerRand + 40, mdblCurrentY, rsAusfall.getStringValue("Text") PrintText PrintObjekt, mdblLinkerRand + 40, mdblCurrentY, rsAusfall.getStringValue("Text")
@@ -1658,7 +1665,7 @@ Private Sub PrintAusfallBlock(rs As CRecordset, ByRef PrintObjekt As Object)
For Each varZeile In Split(strTemp, vbCrLf) For Each varZeile In Split(strTemp, vbCrLf)
ymax = mdblCurrentY + 40 ymax = mdblCurrentY + 40
WrapText PrintObjekt, Trim(varZeile), mdblLinkerRand + 20, mdblRechterRand - 10, mdblCurrentY, ymax, False WrapText PrintObjekt, Trim(varZeile), mdblLinkerRand + 20, mdblRechterRand - 10, mdblCurrentY, ymax, False
mdblCurrentY = PrintObjekt.currentY mdblCurrentY = PrintObjekt.CurrentY
Next Next
End If End If
@@ -1672,7 +1679,7 @@ Private Sub PrintAusfallBlock(rs As CRecordset, ByRef PrintObjekt As Object)
For Each varZeile In Split(strTemp, vbCrLf) For Each varZeile In Split(strTemp, vbCrLf)
ymax = mdblCurrentY + 40 ymax = mdblCurrentY + 40
WrapText PrintObjekt, Trim(varZeile), mdblLinkerRand + 20, mdblRechterRand - 10, mdblCurrentY, ymax, False WrapText PrintObjekt, Trim(varZeile), mdblLinkerRand + 20, mdblRechterRand - 10, mdblCurrentY, ymax, False
mdblCurrentY = PrintObjekt.currentY mdblCurrentY = PrintObjekt.CurrentY
Next Next
End If End If
@@ -1703,21 +1710,21 @@ Private Sub SaveAusfallgruende(RuecklaeuferID As Long)
If rs.EOF Then If rs.EOF Then
' kein Datensatz vorhanden ' kein Datensatz vorhanden
If lstAusfallgrund.Selected(i) = True Then If lstAusfallgrund.Selected(i) = True Then
' ist ausgewählt ? Dann als neu hinzufügen ' ist ausgewählt ? Dann als neu hinzufügen
rs.addNew rs.addNew
rs.setValue "Ruecklaufer_ID", RuecklaeuferID rs.setValue "Ruecklaufer_ID", RuecklaeuferID
rs.setValue "Ausfallgrund_ID", lngAusfallgrundID rs.setValue "Ausfallgrund_ID", lngAusfallgrundID
Debug.Print RuecklaeuferID & "/" & lngAusfallgrundID & " neu" Debug.Print RuecklaeuferID & "/" & lngAusfallgrundID & " neu"
rs.update rs.update
Else Else
'Debug.Print RuecklaeuferID & "/" & lngAusfallgrundID & " bleibt draußen" 'Debug.Print RuecklaeuferID & "/" & lngAusfallgrundID & " bleibt draußen"
End If End If
Else Else
' Datensatz vorhanden ' Datensatz vorhanden
If lstAusfallgrund.Selected(i) = True Then If lstAusfallgrund.Selected(i) = True Then
Else Else
Debug.Print RuecklaeuferID & "/" & lngAusfallgrundID & " wird gelöscht" Debug.Print RuecklaeuferID & "/" & lngAusfallgrundID & " wird gelöscht"
rs.delete rs.delete
rs.update rs.update
End If End If