SDK ajout de facture avec code de projet
2 participants
- NickV
- Nombre de messages : 1
Date d'inscription : 12/05/2014
SDK ajout de facture avec code de projet
Lun 12 Mai 2014 - 14:16
Bonjour je recherche comment pouvoir ajouter le code de projet lorsque j'ajoute une facture.
j'ai le code suivant mais il me manque toujouts le code pour le projet
TransactionInt>>BlankCard()
TransactionInt>>InInvoiceType = pInHdr:InvoiceType
TransactionInt>>InInvoiceNumber = pInHdr:InvcNbr
TransactionInt>>InReference = pInHdr:InvcNbr//pInHdr:PO
TransactionInt>>InDescription = pInHdr:PO
TransactionInt>>InDate = :FmtDt(pInHdr:InvcDt)
la variable utilise pour le code de projet est laquelle? je n'ai malheureusement pas mis le doigt dessus.
merci d'avance
j'ai le code suivant mais il me manque toujouts le code pour le projet
TransactionInt>>BlankCard()
TransactionInt>>InInvoiceType = pInHdr:InvoiceType
TransactionInt>>InInvoiceNumber = pInHdr:InvcNbr
TransactionInt>>InReference = pInHdr:InvcNbr//pInHdr:PO
TransactionInt>>InDescription = pInHdr:PO
TransactionInt>>InDate = :FmtDt(pInHdr:InvcDt)
la variable utilise pour le code de projet est laquelle? je n'ai malheureusement pas mis le doigt dessus.
merci d'avance
- will
- Nombre de messages : 9
Date d'inscription : 29/09/2021
Fiche d'Entreprise
Nom de l'entreprise:
Re: SDK ajout de facture avec code de projet
Mar 19 Oct 2021 - 15:27
Sûrement trop tard, mais si jamais qqn se demande... Espérant cela aider.
Pas en C++, mais C#.
Pas en C++, mais C#.
- Code:
private ITransAP CreateAccountPayableTransactionFrom(SupplierInvoice source) {
if (source == null) return null;
if (!SupplierIsFound())
throw new AcombaException($"Supplier '{source.Supplier}' could not be found.");
var destination = new TransAP {
PKey_InInvoiceNumber = source.Number,
PKey_InSupplierCP = _supplier.Key_SuCardPos,
PKey_InSupplierPaidToCP = _supplier.SuPaidToCP,
InInvoiceNumber = source.Number,
InSupplierCP = _supplier.Key_SuCardPos,
InPaidToCP = _supplier.SuPaidToCP,
InType = InvoiceAPType.IT_Invoice,
InAmount = source.Total,
InSubTotal = source.Subtotal,
InDate = source.InvoiceDate,
InDescription = $"Facture {source.Number}.",
InPayable = 0,
InCurrentDay = -1,
TANumPosts = 4
};
if (!IsFoundWithinChartOfAccount(source.Account))
throw new AcombaException($"Account '{source.Account}' could not be found.");
WriteTransactionLine(lineNumber: 1, amount: source.Total, isTax: false);
if (!IsFoundWithinChartOfAccount(_supplier.SuPurchaseAccountNumber))
throw new AcombaException($"Account '{_supplier.SuPurchaseAccountNumber}' could not be found.");
WriteTransactionLine(lineNumber: 2, amount: -source.Subtotal, isTax: false);
if (!IsFoundWithinChartOfAccount(_acombaAccountsConfiguration.InputTaxCreditAccountGST))
throw new AcombaException($"Account '{_acombaAccountsConfiguration.InputTaxCreditAccountGST}' could not be found.");
WriteTransactionLine(lineNumber: 3, amount: -source.GST, isTax: true);
if (!IsFoundWithinChartOfAccount(_acombaAccountsConfiguration.InputTaxRefundAccountPST))
throw new AcombaException($"Account '{_acombaAccountsConfiguration.InputTaxRefundAccountPST}' could not be found.");
WriteTransactionLine(lineNumber: 4, amount: -source.PST, isTax: true);
return destination;
bool IsFoundWithinChartOfAccount(int accountNumber) {
_charter.BlankCard();
_charter.PKey_ChNumber = accountNumber;
return 0 == _charter.FindKey(1, true);
}
bool SupplierIsFound() {
const int AcombaSortKeyMaxLength = 15;
_supplier.BlankCard();
_supplier.Key_SuSortKey = source.Supplier.Substring(startIndex: 0, length: AcombaSortKeyMaxLength);
var found = 0 == _supplier.SearchKey((int)SearchKeys.SortKey, true);
return found;
}
void WriteTransactionLine(int lineNumber, double amount, bool isTax) {
destination.PACharterCP[lineNumber] = _charter.Key_ChCardPos;
destination.PADescription[lineNumber] = _charter.ChDescription;
destination.PAAmount[lineNumber] = amount;
destination.PAIsTax[lineNumber] = isTax ? 1 : 0;
destination.PAProjectNumber[lineNumber] = source.Project;
}
}
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum