Function IMPCheckDatabase (IdXml As Integer, iIndice As Integer) As Integer
Dim Ret%
Dim s$
Dim s2$
Dim sData$
Dim IsMode%
IMPCheckDatabase = False
Ret = XasXMLGetAttributbyName(IdXml, CurXmlChamp(iIndice), s)
Select Case CurXmlTable(iIndice)
Case "CLIENT"
IsMode = 1
Ret = Val(Right$(s, 3))
If CurIdFormat = 15 And Ret >= 100 Then
Ret = False
Else
Ret = pExecute("Select numcompta,CodeClient,type,adresse,adressesuite,cp,ville from " + CurXmlTable(iIndice) + " Where NumCompta.String='" + s + "'")
End If
Case "TRANSACTION"
sData = "SELECT numcompta,Id FROM " + CurXmlTable(iIndice) + " WHERE NumCompta.String='" + s + "'"
If CurIdFormat = 15 Then
Ret = XasXMLGetAttributbyName(IdXml, Date, s2)
sData = sData + " AND date.datetime='" + s2 + "'"
End If
Ret = pExecute(sData)
Case "TRANSACARTICLE"
Ret = False
Case "PIEDCMD"
Ret = False
Case "SITE"
Ret = pExecute("Select numcompta,CodeClient FROM CLIENT Where NumCompta.String='SITE" + s + "'")
If Ret = True Then
Ret = pExecute("Select numcompta," + CurXmlChamp(iIndice) + " from " + CurXmlTable(iIndice) + " Where NumCompta.String='" + s + "'")
End If
Case Else
Ret = pExecute("Select numcompta," + CurXmlChamp(iIndice) + " from " + CurXmlTable(iIndice) + " Where NumCompta.String='" + s + "'")
End Select
If Ret = True Then
Ret = IMPSetxxKey(CurXmlChamp(iIndice), OnSQLGetItem(1))
IMPCheckDatabase = True
If IsMode = 1 And Val(OnSQLGetItem(2)) = 2 Then
Ret = IMPClientIfUpdate(IdXml, iIndice)
If Ret = True Then
IMPCheckDatabase = False
End If
End If
End If
End Function
|