Exemple transaction Fournisseur en VB
3 participants
- DANCO911
- Nombre de messages : 1
Date d'inscription : 13/07/2018
Exemple transaction Fournisseur en VB
Mar 28 Avr 2020 - 15:17
Bonjour, Je recherche un exemple d'une transaction pour un fournisseur en VB. L'aide du SDK que j'ai n'est pas répertoriée. J'ai l'aide pour un SDK de 2010 mais ne fonctionne pas avec mon Acomba.
Les SDK de mon Acomba sont de 2019. Merci une aide serais grandement appréciée.
Les SDK de mon Acomba sont de 2019. Merci une aide serais grandement appréciée.
Majid_QC aime ce message
- mgaudet@vertvertpc.com
- Nombre de messages : 9
Ville : Rouyn-Noranda
Date d'inscription : 02/03/2021
Fiche d'Entreprise
Nom de l'entreprise:
exemple de code en vb
Ven 5 Mar 2021 - 9:21
le fichier d'aide de 2010 est aussi valide pour faire la référence mais souvent le code n'est pas complet c'est juste un aide pour donner une idée le plus simple envoi une copie du code qui marche pas vais pouvoir dire ce qui va pas
- Majid_QC
- Nombre de messages : 6
Date d'inscription : 02/06/2021
Re: Exemple transaction Fournisseur en VB
Mar 28 Sep 2021 - 15:07
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