Function IMPInsertLICMD (IdXml As Integer, iIndice As Integer, sCreation As String) As Integer
Dim Ret%
Dim sData$
Dim j%
Dim s$
Dim sDesi$
Dim sTarif$
IMPInsertLICMD = False
sData = "select tranid "
sData = sData + " FROM TransacArticle "
sData = sData + " WHERE TransacArticle.tranid.xxKey=" + CStr(CurNumPiece)
sData = sData + " AND TransacArticle.codeproduit.xxKey=" + CStr(CurCodeProduit)
Ret = pExecute(sData)
If Ret = False Then
Ret = pExecute("Select designation,tarifbase From Produit WHERE codeproduit.xxKey=" + CurCodeProduit)
If Ret <> False Then
sDesi = OnSQLGetItem(0)
sTarif = OnSQLGetItem(1)
Ret = pExecute("CLEAR")
Ret = pExecute("Select Id From Transaction WHERE id.xxKey=" + CurNumPiece)
If Ret = True Then
sData = " INSERT INTO Transaction.TransacArticle (type,Creation,Maj,tranid,CodeProduit,"
For j = 1 To CurMaxChamp(iIndice)
If CurNomChamp(iIndice, j) <> "" Then
sData = sData + CurNomChamp(iIndice, j) + ","
End If
Next j
sData = sData + "statut ) VALUES ("
sData = sData + "'" + CStr(CurXmlType(iIndice)) + "',"
sData = sData + "'" + sCreation + "',"
sData = sData + "'" + sCreation + "',"
sData = sData + "'" + CurNumPiece + "',"
sData = sData + "'" + CurCodeProduit + "',"
For j = 1 To CurMaxChamp(iIndice)
Ret = XasXMLGetAttributbyName(IdXml, CurNomChamp(iIndice, j), s)
If CurNomChamp(iIndice, j) <> "" Then
sData = sData + "'" + XasSetChar(s, "'", "''", 0, 0) + "',"
End If
Next j
sData = sData + "'1' )"
Ret = pExecute(sData)
IMPInsertLICMD = Ret
End If
End If
End If
End Function
|