laatzen/Pruef2000/source/frmRZFehler.frm
2021-10-01 11:11:04 +02:00

185 lines
5.4 KiB
Plaintext

VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "msflxgrd.ocx"
Begin VB.Form frmRZFehler
Caption = "Referenzzähler Fehler"
ClientHeight = 3495
ClientLeft = 60
ClientTop = 345
ClientWidth = 10215
LinkTopic = "Form1"
ScaleHeight = 3495
ScaleWidth = 10215
StartUpPosition = 3 'Windows-Standard
Begin MSComctlLib.StatusBar StatusBar1
Align = 2 'Unten ausrichten
Height = 285
Left = 0
TabIndex = 3
Top = 3210
Width = 10215
_ExtentX = 18018
_ExtentY = 503
Style = 1
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 1
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
EndProperty
EndProperty
End
Begin VB.CommandButton cmdPrint
Caption = "Drucken"
Height = 345
Left = 7320
TabIndex = 2
Top = 2790
Width = 1215
End
Begin VB.CommandButton cmdClose
Caption = "Schliessen"
Height = 375
Left = 8880
TabIndex = 1
Top = 2790
Width = 1215
End
Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1
Height = 2625
Left = 90
TabIndex = 0
Top = 90
Width = 10035
_ExtentX = 17701
_ExtentY = 4630
_Version = 393216
End
Begin VB.Label lblAutosize
BorderStyle = 1 'Fest Einfach
Caption = "Label1"
Height = 315
Left = 2100
TabIndex = 4
Top = 2850
Width = 1185
End
End
Attribute VB_Name = "frmRZFehler"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub Form_Load()
fillFlexgrid
End Sub
Private Sub Form_Resize()
MSFlexGrid1.Top = 0
MSFlexGrid1.Left = 0
'MSFlexGrid1.Width = Me.ScaleWidth
MSFlexGrid1.Height = Me.ScaleHeight - 1.5 * cmdClose.Height - StatusBar1.Height
cmdClose.Top = MSFlexGrid1.Top + MSFlexGrid1.Height + 0.25 * cmdClose.Height
cmdPrint.Top = cmdClose.Top
cmdClose.Left = Me.ScaleWidth - 1.1 * cmdClose.Width
cmdPrint.Left = cmdClose.Left - 1.5 * cmdPrint.Width
End Sub
Private Function GetTemperatur() As Double
On Error GoTo Errorhandler
Dim objSPS As CSPS
Set objSPS = g_App.getSPS
GetTemperatur = objSPS.GetEinlaufTemperatur
Exit Function
Errorhandler:
MsgBox "GetTemperatur(): " & Err.Description
End Function
Private Sub fillFlexgrid()
Dim dblDurchflussSoll As Double
Dim dblFehler As Double
Dim EinbauplatzNr As Integer
Dim rs As CRecordset
Dim Temperatur As Double
Dim StrangB As Integer
Dim Zeile As Integer
Dim maxspalte As Integer
If Not g_ohneSPS Then
Temperatur = GetTemperatur()
Else
Temperatur = Val(InputBox("Bezugstemperatur", "", "21"))
End If
Zeile = 0
MSFlexGrid1.FormatString = "RZ|Datum|"
For i = 1 To 10
'MSFlexGrid1.FormatString = MSFlexGrid1.FormatString & "Q " & i & "_Soll_Q|PP" & i & "_Fehler|"
MSFlexGrid1.FormatString = MSFlexGrid1.FormatString & "Q " & i & "|F " & i & "|"
Next
MSFlexGrid1.FixedCols = 2
' für alle Stränge
For EinbauplatzNr = 1 To 8 Step 2
Zeile = Zeile + 1
Set rs = RZFehlerRecordset(g_App.PruefstationNr, EinbauplatzNr + StrangB, Temperatur, 4)
MSFlexGrid1.Rows = 5
MSFlexGrid1.Cols = 120
If Not rs.EOF Then
MSFlexGrid1.TextMatrix(Zeile, 0) = rs.getStringValue("Nennweite") & "-" & rs.getStringValue("MIDGruppe")
MSFlexGrid1.TextMatrix(Zeile, 1) = Format(rs.getLongValue("Datum"), "dd.mm.yyyy")
For i = 1 To 10
If Not rs.isFieldNull("PP" & i & "_Soll_Q") Then
MSFlexGrid1.TextMatrix(Zeile, 2 + (i - 1) * 2) = Round(rs.getDoubleValue("PP" & i & "_Soll_Q"), 3)
If maxspalte < 2 + (i - 1) * 2 + 1 Then
maxspalte = 2 + (i - 1) * 2 + 1
End If
End If
If Not rs.isFieldNull("PP" & i & "_Fehler") Then
MSFlexGrid1.TextMatrix(Zeile, 2 + (i - 1) * 2 + 1) = Round(rs.GetVariantValue("PP" & i & "_Fehler"), 2)
If maxspalte < 2 + (i - 1) * 2 + 1 Then
maxspalte = 2 + (i - 1) * 2 + 1
End If
End If
Next
DoEvents
End If
Next
MSFlexGrid1.Cols = maxspalte + 1
AutoSpaltenBreite MSFlexGrid1, lblAutosize
Dim lngBreite As Long
lngBreite = 0
For i = 1 To MSFlexGrid1.Cols - 1
lngBreite = lngBreite + MSFlexGrid1.ColWidth(i)
Next
If Me.Width < lngBreite * 1.1 Then
Me.Width = lngBreite * 1.1
End If
MSFlexGrid1.Width = Me.ScaleWidth
End Sub