Function DoSearchLot (sid As String) As Integer
Dim sdata$
Dim Ret%
Dim s1$
Dim s2$
Dim i%
Dim j%
Dim iTmp%
Ret = DoGrid(GridList, 13)
Ret = DoClearAll(0)
LabMsg(0).ForeColor = 0
LabMsg(0).Caption = ""
LabMsg(1).ForeColor = 0
LabMsg(1).Caption = ""
s1 = TxR(0).Text
s2 = TxR(1).Text
PicBtn(7).Visible = False
sdata = "SELECT Lotcarte.debcarte,lotcarte.fincarte,lotcarte.debcarte,lotcarte.maj,lotcarte.id "
sdata = sdata + " FROM programme, lotcarte "
sdata = sdata + " WHERE programme.codeprogramme.xxKey = " + CStr(sid)
sdata = sdata + " AND lotcarte.Id.xxKey != 0.0"
If s1 <> "" Then
sdata = sdata + " AND lotcarte.debcarte.integer < " + s1 + " AND lotcarte.fincarte.integer > " + s1
End If
If s2 <> "" Then
sdata = sdata + " AND lotcarte.id.xxKey = " + s2
End If
i = 1
Ret = pTmpExecute(sdata)
If Ret = True Then
While (Ret = True)
GridList.Row = i
For j = 0 To 4
GridList.Col = j + 1
If j = 2 Then
s1 = pTmpGetItem(j)
s2 = pTmpGetItem(j - 1)
iTmp = Val(s2) - Val(s1)
GridList.Text = CStr(iTmp)
Else
GridList.Text = pTmpGetItem(j)
End If
Next j
i = i + 1
If i > 2 Then
Cel(2).Visible = False
Cel(1).Visible = True
PicBtn(3).Visible = False
PicBtn(5).Visible = False
PicBtn(6).Visible = False
PicBtn(7).Visible = False
End If
If i > MaxGridRow Then
MaxGridRow = i
GridList.Rows = i
End If
Ret = pTmpMoveNext(0)
Wend
MaxRow = i
Else
LabMsg(0).Caption = "Aucun Lot ne correspond à votre recherche ..."
LabMsg(1).Caption = "Aucun Lot ne correspond à votre recherche ..."
LabMsg(0).ForeColor = 255
LabMsg(1).ForeColor = 255
End If
End Function
|