mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 06:10:31 +00:00
feat: discount formatted attributes of sale transactions
This commit is contained in:
@@ -18,6 +18,9 @@ export class SaleEstimateTransfromer extends Transformer {
|
||||
'formattedDeliveredAtDate',
|
||||
'formattedApprovedAtDate',
|
||||
'formattedRejectedAtDate',
|
||||
'discountAmountFormatted',
|
||||
'discountPercentageFormatted',
|
||||
'adjustmentFormatted',
|
||||
'formattedCreatedAt',
|
||||
'entries',
|
||||
'attachments',
|
||||
@@ -98,6 +101,39 @@ export class SaleEstimateTransfromer extends Transformer {
|
||||
return formatNumber(estimate.amount, { money: false });
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves formatted discount amount.
|
||||
* @param estimate
|
||||
* @returns {string}
|
||||
*/
|
||||
protected discountAmountFormatted = (estimate: ISaleEstimate): string => {
|
||||
return formatNumber(estimate.discountAmount, {
|
||||
currencyCode: estimate.currencyCode,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves formatted discount percentage.
|
||||
* @param estimate
|
||||
* @returns {string}
|
||||
*/
|
||||
protected discountPercentageFormatted = (estimate: ISaleEstimate): string => {
|
||||
return estimate.discountPercentage
|
||||
? `${estimate.discountPercentage}%`
|
||||
: '';
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves formatted adjustment amount.
|
||||
* @param estimate
|
||||
* @returns {string}
|
||||
*/
|
||||
protected adjustmentFormatted = (estimate: ISaleEstimate): string => {
|
||||
return this.formatMoney(estimate.adjustment, {
|
||||
currencyCode: estimate.currencyCode,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the entries of the sale estimate.
|
||||
* @param {ISaleEstimate} estimate
|
||||
|
||||
Reference in New Issue
Block a user