feat: wip line-level discount

This commit is contained in:
Ahmed Bouhuolia
2024-12-11 12:37:15 +02:00
parent 6323e2ffec
commit 5a8d9cc7e8
8 changed files with 67 additions and 14 deletions

View File

@@ -140,7 +140,7 @@ export class BillGLEntries {
(bill: IBill, entry: IItemEntry, index: number): ILedgerEntry => {
const commonJournalMeta = this.getBillCommonEntry(bill);
const localAmount = bill.exchangeRate * entry.amountExludingTax;
const localAmount = bill.exchangeRate * entry.subtotalExcludingTax;
const landedCostAmount = sumBy(entry.allocatedCostEntries, 'cost');
return {

View File

@@ -154,6 +154,6 @@ export class CommandSaleInvoiceDTOTransformer {
* @returns {number}
*/
private getDueBalanceItemEntries = (entries: ItemEntry[]) => {
return sumBy(entries, (e) => e.amount);
return sumBy(entries, (e) => e.total);
};
}

View File

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

View File

@@ -2,7 +2,7 @@ import { Inject, Service } from 'typedi';
import { keyBy, sumBy } from 'lodash';
import { ItemEntry } from '@/models';
import HasTenancyService from '../Tenancy/TenancyService';
import { IItem, IItemEntry, IItemEntryDTO } from '@/interfaces';
import { IItemEntry } from '@/interfaces';
@Service()
export class ItemEntriesTaxTransactions {