fix: discount transactions GL entries

This commit is contained in:
Ahmed Bouhuolia
2024-12-08 14:20:11 +02:00
parent 14ae978bde
commit 46719ef361
17 changed files with 375 additions and 58 deletions

View File

@@ -415,7 +415,7 @@ export const useBillTotal = () => {
return R.compose(
R.when(R.always(isExclusiveTax), R.add(totalTaxAmount)),
R.subtract(R.__, discountAmount),
R.subtract(R.__, adjustmentAmount),
R.add(R.__, adjustmentAmount),
)(subtotal);
};

View File

@@ -259,7 +259,10 @@ export const useVendorCreditTotal = () => {
const discountAmount = useVendorCreditDiscountAmount();
const adjustment = useVendorCreditAdjustment();
return subtotal - discountAmount - adjustment;
return R.compose(
R.subtract(R.__, discountAmount),
R.add(R.__, adjustment),
)(subtotal);
};
/**

View File

@@ -263,7 +263,10 @@ export const useCreditNoteTotal = () => {
const discountAmount = useCreditNoteDiscountAmount();
const adjustmentAmount = useCreditNoteAdjustmentAmount();
return subtotal - discountAmount - adjustmentAmount;
return R.compose(
R.subtract(R.__, discountAmount),
R.add(R.__, adjustmentAmount),
)(subtotal);
};
/**

View File

@@ -299,7 +299,10 @@ export const useEstimateTotal = () => {
const discount = useEstimateDiscount();
const adjustment = useEstimateAdjustment();
return subtotal - discount - adjustment;
return R.compose(
R.subtract(R.__, discount),
R.add(R.__, adjustment),
)(subtotal);
};
/**

View File

@@ -455,7 +455,7 @@ export const useInvoiceTotal = () => {
return R.compose(
R.when(R.always(isExclusiveTax), R.add(totalTaxAmount)),
R.subtract(R.__, discountAmount),
R.subtract(R.__, adjustmentAmount),
R.add(R.__, adjustmentAmount),
)(subtotal);
};

View File

@@ -284,7 +284,10 @@ export const useReceiptTotal = () => {
const adjustmentAmount = useReceiptAdjustmentAmount();
const discountAmount = useReceiptDiscountAmount();
return subtotal - discountAmount - adjustmentAmount;
return R.compose(
R.add(R.__, adjustmentAmount),
R.subtract(R.__, discountAmount),
)(subtotal);
};
/**