Function DoSearchCompte (TypeId As Integer) As Integer
Dim sData$
Dim Ret%
Dim s1$
Dim s2$
Dim i%
Dim j%
Ret = DoGrid(GridList, 100)
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 Top 500 RaisonSociale, Name, prenom, adresse, cp, ville,CodeEnseigne "
sData = sData + " FROM maitre.dbo.Enseigne "
sData = sData + " WHERE CodeEnseigne.xxKey != 0.0"
sData = sData + " AND NumCompta.string ='" + GlobPU.XasGroupe + "'"
If s1 <> "" Then
sData = sData + " AND RaisonSociale Like '*" + s1 + "*' "
End If
If s2 <> "" Then
sData = sData + " AND numcompta Like '*" + s2 + "*' "
End If
i = 1
Ret = pTmpExecute(sData)
If Ret = True Then
While (Ret = True)
GridList.Row = i
For j = 0 To 6
GridList.Col = j + 1
GridList.Text = pTmpGetItem(j)
Next j
i = i + 1
If i > MaxGridRow Then
MaxGridRow = i
GridList.Rows = i
Exit Function
End If
If i > 2 Then
Cel(2).Visible = False
Cel(1).Visible = True
End If
Ret = pTmpMoveNext(0)
Wend
MaxRow = i
GridList.Rows = i
Else
LabMsg(0).Caption = "Aucun Compte ne correspond à votre recherche ..."
LabMsg(1).Caption = "Aucun Compte ne correspond à votre recherche ..."
LabMsg(0).ForeColor = 255
LabMsg(1).ForeColor = 255
End If
End Function
|