Skip to content

Commit

Permalink
fix: correct debit and credit calculations for local adjustments in B…
Browse files Browse the repository at this point in the history
…illGLEntries
  • Loading branch information
abouolia committed Dec 8, 2024
1 parent 477da0e commit 1d54947
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/server/src/services/Purchases/Bills/BillGLEntries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export class BillGLEntries {
return {
debit: 0,
credit: 0,

currencyCode: bill.currencyCode,
exchangeRate: bill.exchangeRate || 1,

Expand Down Expand Up @@ -281,11 +282,12 @@ export class BillGLEntries {
otherExpensesAccountId: number
) => {
const commonEntry = this.getBillCommonEntry(bill);
const adjustmentAmount = Math.abs(bill.adjustmentLocal);

return {
...commonEntry,
debit: bill.adjustmentLocal < 0 ? bill.adjustmentLocal : 0,
credit: bill.adjustmentLocal > 0 ? bill.adjustmentLocal : 0,
debit: bill.adjustmentLocal > 0 ? adjustmentAmount : 0,
credit: bill.adjustmentLocal < 0 ? adjustmentAmount : 0,
accountId: otherExpensesAccountId,
accountNormal: AccountNormal.DEBIT,
index: 1,
Expand Down

0 comments on commit 1d54947

Please sign in to comment.