feat: enhance discount and adjustment formatting

This commit is contained in:
Ahmed Bouhuolia
2024-12-04 12:00:22 +02:00
parent fabc88c81a
commit 6ab461a212
10 changed files with 24 additions and 12 deletions

View File

@@ -96,6 +96,7 @@ export class CreditNoteTransformer extends Transformer {
protected discountAmountFormatted = (credit): string => {
return formatNumber(credit.discountAmount, {
currencyCode: credit.currencyCode,
excerptZero: true,
});
};
@@ -118,6 +119,7 @@ export class CreditNoteTransformer extends Transformer {
protected adjustmentFormatted = (credit): string => {
return this.formatMoney(credit.adjustment, {
currencyCode: credit.currencyCode,
excerptZero: true,
});
};

View File

@@ -171,6 +171,7 @@ export class PurchaseInvoiceTransformer extends Transformer {
protected discountAmountFormatted = (bill): string => {
return formatNumber(bill.discountAmount, {
currencyCode: bill.currencyCode,
excerptZero: true,
});
};
@@ -193,6 +194,7 @@ export class PurchaseInvoiceTransformer extends Transformer {
protected adjustmentFormatted = (bill): string => {
return formatNumber(bill.adjustment, {
currencyCode: bill.currencyCode,
excerptZero: true,
});
};

View File

@@ -82,6 +82,7 @@ export class VendorCreditTransformer extends Transformer {
protected discountAmountFormatted = (credit): string => {
return formatNumber(credit.discountAmount, {
currencyCode: credit.currencyCode,
excerptZero: true,
});
};
@@ -102,6 +103,7 @@ export class VendorCreditTransformer extends Transformer {
protected adjustmentFormatted = (credit): string => {
return formatNumber(credit.adjustment, {
currencyCode: credit.currencyCode,
excerptZero: true,
});
};

View File

@@ -111,6 +111,7 @@ export class SaleEstimateTransfromer extends Transformer {
protected discountAmountFormatted = (estimate: ISaleEstimate): string => {
return formatNumber(estimate.discountAmount, {
currencyCode: estimate.currencyCode,
excerptZero: true,
});
};
@@ -133,6 +134,7 @@ export class SaleEstimateTransfromer extends Transformer {
protected adjustmentFormatted = (estimate: ISaleEstimate): string => {
return this.formatMoney(estimate.adjustment, {
currencyCode: estimate.currencyCode,
excerptZero: true,
});
};

View File

@@ -170,6 +170,7 @@ export class SaleInvoiceTransformer extends Transformer {
protected discountAmountFormatted = (invoice): string => {
return formatNumber(invoice.discountAmount, {
currencyCode: invoice.currencyCode,
excerptZero: true,
});
};
@@ -192,8 +193,9 @@ export class SaleInvoiceTransformer extends Transformer {
protected adjustmentFormatted = (invoice): string => {
return this.formatMoney(invoice.adjustment, {
currencyCode: invoice.currencyCode,
})
}
excerptZero: true,
});
};
/**
* Retrieves formatted total in foreign currency.

View File

@@ -113,6 +113,7 @@ export class SaleReceiptTransformer extends Transformer {
protected discountAmountFormatted = (receipt: ISaleReceipt): string => {
return formatNumber(receipt.discountAmount, {
currencyCode: receipt.currencyCode,
excerptZero: true,
});
};
@@ -135,6 +136,7 @@ export class SaleReceiptTransformer extends Transformer {
protected adjustmentFormatted = (receipt: ISaleReceipt): string => {
return this.formatMoney(receipt.adjustment, {
currencyCode: receipt.currencyCode,
excerptZero: true,
});
};