feat: add totalExcludingTax property and update GL entry calculations

This commit is contained in:
Ahmed Bouhuolia
2024-12-12 12:49:52 +02:00
parent 8cd1b36a02
commit d640dc1f40
8 changed files with 24 additions and 14 deletions

View File

@@ -199,7 +199,7 @@ export class SaleInvoiceGLEntries {
index: number
): ILedgerEntry => {
const commonEntry = this.getInvoiceGLCommonEntry(saleInvoice);
const localAmount = entry.total * saleInvoice.exchangeRate;
const localAmount = entry.totalExcludingTax * saleInvoice.exchangeRate;
return {
...commonEntry,

View File

@@ -143,10 +143,10 @@ export class SaleReceiptGLEntries {
};
/**
* Retrieve receipt income item GL entry.
* @param {ISaleReceipt} saleReceipt -
* @param {IItemEntry} entry -
* @param {number} index -
* Retrieve receipt income item G/L entry.
* @param {ISaleReceipt} saleReceipt -
* @param {IItemEntry} entry -
* @param {number} index -
* @returns {ILedgerEntry}
*/
private getReceiptIncomeItemEntry = R.curry(
@@ -156,11 +156,11 @@ export class SaleReceiptGLEntries {
index: number
): ILedgerEntry => {
const commonEntry = this.getIncomeGLCommonEntry(saleReceipt);
const itemIncome = entry.amount * saleReceipt.exchangeRate;
const totalLocal = entry.totalExcludingTax * saleReceipt.exchangeRate;
return {
...commonEntry,
credit: itemIncome,
credit: totalLocal,
accountId: entry.item.sellAccountId,
note: entry.description,
index: index + 2,