Exemple avec l'interface TransGL
2 participants
- ebradette
- Nombre de messages : 3
Date d'inscription : 06/08/2009
Exemple avec l'interface TransGL
Ven 12 Jan 2018 - 10:28
Est-ce quelqu'un aurais un exemple de transaction avec TransAP ?
Merci
Merci
Majid_QC aime ce message
- Majid_QC
- Nombre de messages : 6
Date d'inscription : 02/06/2021
Re: Exemple avec l'interface TransGL
Mar 28 Sep 2021 - 15:11
Function AddNewSupplierInvoice(ByVal strNoFournisseur As String, ByVal strNoFacture As String, ByVal strDescrCAP As String, ByVal decSubTotal As Double, ByVal decTPS As Double, ByVal decTVQ As Double, ByVal decGtotal As Double) As Integer
Dim dblTPS, dblTVQ, dblsubTotal, dblGTotal As Decimal
Dim strNoFournisseurAco, NoFactureCG, strdescCAP As String
strNoFournisseurAco = strNoFournisseur
dblsubTotal = decSubTotal
dblTPS = decTPS
dblTVQ = decTVQ
dblGTotal = decGtotal
strdescCAP = strDescrCAP
'Déclarations
Dim Erreur As Long
'Dim FreeIt As Long
Dim SupplierInt As New AcoSDK.Supplier
Dim TransAPData As New AcoSDK.TransAP
Dim PayablesData As New AcoSDK.Payables
Dim CharterData As New AcoSDK.Charter
Const noIndex = 1
TransAPData.BlankCard()
SupplierInt.BlankKey()
SupplierInt.PKey_SuNumber = strNoFournisseurAco
Erreur = SupplierInt.FindKey(noIndex, False)
If Erreur = 0 Then
'Initialisation des propriétés composant la clé primaire
TransAPData.PKey_InInvoiceNumber = strNoFacture
TransAPData.PKey_InSupplierCP = SupplierInt.Key_SuCardPos
TransAPData.PKey_InSupplierPaidToCP = 0
'Réservation de la clé primaire
Erreur = TransAPData.ReserveCardNumber
If Erreur = 0 Then
'Initialisation des propriétés de TransAPData
TransAPData.InInvoiceNumber = TransAPData.PKey_InInvoiceNumber
TransAPData.InSupplierCP = TransAPData.PKey_InSupplierCP
TransAPData.InPaidToCP = TransAPData.PKey_InSupplierPaidToCP
TransAPData.InType = IT_Invoice
TransAPData.InAmount = dblGTotal
TransAPData.InSubTotal = dblsubTotal
TransAPData.InDate = Date.Today
TransAPData.InDescription = strdescCAP
TransAPData.InPayable = 0
TransAPData.InCurrentDay = -1
'************************Informations sur les termes de paiement / Optionnel
'TransAPData.PTType = TT_PaymentSchedule
'TransAPData.PTNumberOfSchedules = 2
'TransAPData.PTScheduleDate(1) = #9/30/2021#
'TransAPData.PTSchedulePercent(1) = 50
'TransAPData.PTScheduleDate(2) = #10/30/2021#
'TransAPData.PTSchedulePercent(2) = 50
'***********************************************************************************
'Nombre d'affectations de la transaction (dans cet exemple la facture compte 4 lignes )
TransAPData.TANumPosts = 4
'Consultation de la fiche du fournisseur pour obtenir le compte payable qui lui est associé
Erreur = SupplierInt.GetCard(TransAPData.InSupplierCP)
If Erreur = 0 Then
'Chargement de la fiche des comptes payables
Erreur = PayablesData.GetCard(PayablesData.CardPos)
If Erreur = 0 Then
'Initialisation des propriétés concernant les 4 affectations (lignes) de la facture
TransAPData.PACharterCP(1) = PayablesData.PaAccountPayableCP(SupplierInt.SuAccountPayable)
TransAPData.PADescription(1) = "Compte à payer"
TransAPData.PAAmount(1) = dblGTotal
TransAPData.PAIsTax(1) = 0
'Recherche du compte pour obtenir son CardPos
TransAPData.PACharterCP(2) = GetCharterCardPos(7120)
TransAPData.PADescription(2) = "Installation - Sous-traitants"
TransAPData.PAAmount(2) = dblsubTotal * -1
TransAPData.PAIsTax(2) = 0
TransAPData.PACharterCP(3) = GetCharterCardPos(1201)
TransAPData.PADescription(3) = "T.P.S. à recevoir"
TransAPData.PAAmount(3) = dblTPS * -1
TransAPData.PAIsTax(3) = 1
TransAPData.PACharterCP(4) = GetCharterCardPos(1202)
TransAPData.PADescription(4) = "TVQ à recevoir"
TransAPData.PAAmount(4) = dblTVQ * -1
TransAPData.PAIsTax(4) = 1
Erreur = TransAPData.AddCard
If Erreur = 0 Then
MsgBox("L'exportation de la facture vers Acomba est complétée avec succès.")
Else
MsgBox("Erreur: " & Acomba.GetErrorMessage(Erreur))
End If
End If
End If
If Erreur <> 0 Then
MsgBox("Erreur: " & Acomba.GetErrorMessage(Erreur))
'Libération de la clé primaire si l'ajout n'est pas complété avec succès
Erreur = TransAPData.FreeCardNumber()
If Erreur <> 0 Then
MsgBox("Erreur: " & Acomba.GetErrorMessage(Erreur))
End If
End If
Else
MsgBox("Erreur: " & Acomba.GetErrorMessage(Erreur))
End If
Else
MsgBox("Erreur: " & Acomba.GetErrorMessage(Erreur))
End If
Return Erreur
End Function
Function GetCharterCardPos(Numero As Long) As Long
Dim CharterInt As New AcoSDK.Charter
Dim Erreur, noIndex, CP As Long
noIndex = 1
'Initialisation de la propriété ChNumber
CharterInt.PKey_ChNumber = Numero
'Recherche du compte pour obtenir son CardPos
Erreur = CharterInt.FindKey(noIndex, False)
If Erreur = 0 Then
GetCharterCardPos = CharterInt.Key_ChCardPos
CP = CharterInt.Key_ChCardPos
Else
GetCharterCardPos = 0
End If
Return CP
End Function
Dim dblTPS, dblTVQ, dblsubTotal, dblGTotal As Decimal
Dim strNoFournisseurAco, NoFactureCG, strdescCAP As String
strNoFournisseurAco = strNoFournisseur
dblsubTotal = decSubTotal
dblTPS = decTPS
dblTVQ = decTVQ
dblGTotal = decGtotal
strdescCAP = strDescrCAP
'Déclarations
Dim Erreur As Long
'Dim FreeIt As Long
Dim SupplierInt As New AcoSDK.Supplier
Dim TransAPData As New AcoSDK.TransAP
Dim PayablesData As New AcoSDK.Payables
Dim CharterData As New AcoSDK.Charter
Const noIndex = 1
TransAPData.BlankCard()
SupplierInt.BlankKey()
SupplierInt.PKey_SuNumber = strNoFournisseurAco
Erreur = SupplierInt.FindKey(noIndex, False)
If Erreur = 0 Then
'Initialisation des propriétés composant la clé primaire
TransAPData.PKey_InInvoiceNumber = strNoFacture
TransAPData.PKey_InSupplierCP = SupplierInt.Key_SuCardPos
TransAPData.PKey_InSupplierPaidToCP = 0
'Réservation de la clé primaire
Erreur = TransAPData.ReserveCardNumber
If Erreur = 0 Then
'Initialisation des propriétés de TransAPData
TransAPData.InInvoiceNumber = TransAPData.PKey_InInvoiceNumber
TransAPData.InSupplierCP = TransAPData.PKey_InSupplierCP
TransAPData.InPaidToCP = TransAPData.PKey_InSupplierPaidToCP
TransAPData.InType = IT_Invoice
TransAPData.InAmount = dblGTotal
TransAPData.InSubTotal = dblsubTotal
TransAPData.InDate = Date.Today
TransAPData.InDescription = strdescCAP
TransAPData.InPayable = 0
TransAPData.InCurrentDay = -1
'************************Informations sur les termes de paiement / Optionnel
'TransAPData.PTType = TT_PaymentSchedule
'TransAPData.PTNumberOfSchedules = 2
'TransAPData.PTScheduleDate(1) = #9/30/2021#
'TransAPData.PTSchedulePercent(1) = 50
'TransAPData.PTScheduleDate(2) = #10/30/2021#
'TransAPData.PTSchedulePercent(2) = 50
'***********************************************************************************
'Nombre d'affectations de la transaction (dans cet exemple la facture compte 4 lignes )
TransAPData.TANumPosts = 4
'Consultation de la fiche du fournisseur pour obtenir le compte payable qui lui est associé
Erreur = SupplierInt.GetCard(TransAPData.InSupplierCP)
If Erreur = 0 Then
'Chargement de la fiche des comptes payables
Erreur = PayablesData.GetCard(PayablesData.CardPos)
If Erreur = 0 Then
'Initialisation des propriétés concernant les 4 affectations (lignes) de la facture
TransAPData.PACharterCP(1) = PayablesData.PaAccountPayableCP(SupplierInt.SuAccountPayable)
TransAPData.PADescription(1) = "Compte à payer"
TransAPData.PAAmount(1) = dblGTotal
TransAPData.PAIsTax(1) = 0
'Recherche du compte pour obtenir son CardPos
TransAPData.PACharterCP(2) = GetCharterCardPos(7120)
TransAPData.PADescription(2) = "Installation - Sous-traitants"
TransAPData.PAAmount(2) = dblsubTotal * -1
TransAPData.PAIsTax(2) = 0
TransAPData.PACharterCP(3) = GetCharterCardPos(1201)
TransAPData.PADescription(3) = "T.P.S. à recevoir"
TransAPData.PAAmount(3) = dblTPS * -1
TransAPData.PAIsTax(3) = 1
TransAPData.PACharterCP(4) = GetCharterCardPos(1202)
TransAPData.PADescription(4) = "TVQ à recevoir"
TransAPData.PAAmount(4) = dblTVQ * -1
TransAPData.PAIsTax(4) = 1
Erreur = TransAPData.AddCard
If Erreur = 0 Then
MsgBox("L'exportation de la facture vers Acomba est complétée avec succès.")
Else
MsgBox("Erreur: " & Acomba.GetErrorMessage(Erreur))
End If
End If
End If
If Erreur <> 0 Then
MsgBox("Erreur: " & Acomba.GetErrorMessage(Erreur))
'Libération de la clé primaire si l'ajout n'est pas complété avec succès
Erreur = TransAPData.FreeCardNumber()
If Erreur <> 0 Then
MsgBox("Erreur: " & Acomba.GetErrorMessage(Erreur))
End If
End If
Else
MsgBox("Erreur: " & Acomba.GetErrorMessage(Erreur))
End If
Else
MsgBox("Erreur: " & Acomba.GetErrorMessage(Erreur))
End If
Return Erreur
End Function
Function GetCharterCardPos(Numero As Long) As Long
Dim CharterInt As New AcoSDK.Charter
Dim Erreur, noIndex, CP As Long
noIndex = 1
'Initialisation de la propriété ChNumber
CharterInt.PKey_ChNumber = Numero
'Recherche du compte pour obtenir son CardPos
Erreur = CharterInt.FindKey(noIndex, False)
If Erreur = 0 Then
GetCharterCardPos = CharterInt.Key_ChCardPos
CP = CharterInt.Key_ChCardPos
Else
GetCharterCardPos = 0
End If
Return CP
End Function
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum