mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 20:30:33 +00:00
feat: add discount functionality to sales and purchase transactions
- Introduced discount_type and discount fields in Bills and SalesReceipts controllers. - Updated database migrations to include discount and discount_type in estimates and credit notes tables. - Enhanced SaleReceipt and SaleEstimate models to support discount attributes. - Implemented formatting for discount amounts in transformers and PDF templates. - Updated email templates to display discount information. This commit enhances the handling of discounts across various transaction types, improving the overall functionality and user experience.
This commit is contained in:
@@ -21,6 +21,8 @@ export class CreditNoteTransformer extends Transformer {
|
||||
'discountAmountFormatted',
|
||||
'discountPercentageFormatted',
|
||||
'adjustmentFormatted',
|
||||
'totalFormatted',
|
||||
'totalLocalFormatted',
|
||||
'entries',
|
||||
'attachments',
|
||||
];
|
||||
@@ -86,7 +88,6 @@ export class CreditNoteTransformer extends Transformer {
|
||||
return formatNumber(credit.amount, { money: false });
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves formatted discount amount.
|
||||
* @param credit
|
||||
@@ -120,6 +121,28 @@ export class CreditNoteTransformer extends Transformer {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the formatted total.
|
||||
* @param credit
|
||||
* @returns {string}
|
||||
*/
|
||||
protected totalFormatted = (credit): string => {
|
||||
return formatNumber(credit.total, {
|
||||
currencyCode: credit.currencyCode,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the formatted total in local currency.
|
||||
* @param credit
|
||||
* @returns {string}
|
||||
*/
|
||||
protected totalLocalFormatted = (credit): string => {
|
||||
return formatNumber(credit.totalLocal, {
|
||||
currencyCode: credit.currencyCode,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the entries of the credit note.
|
||||
* @param {ICreditNote} credit
|
||||
|
||||
Reference in New Issue
Block a user