mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 13:20:31 +00:00
feat: enhance discount and adjustment formatting
This commit is contained in:
@@ -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,
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ export default function EstimateDetailHeader() {
|
||||
<CommercialDocTopHeader>
|
||||
<DetailsMenu>
|
||||
<AmountEstimateDetail label={intl.get('amount')}>
|
||||
<span class="big-number">{estimate.formatted_amount}</span>
|
||||
<span class="big-number">{estimate.total_formatted}</span>
|
||||
</AmountEstimateDetail>
|
||||
|
||||
<EstimateStatusDetail>
|
||||
|
||||
@@ -25,11 +25,11 @@ export default function EstimateDetailTableFooter() {
|
||||
value={estimate.formatted_subtotal}
|
||||
borderStyle={TotalLineBorderStyle.SingleDark}
|
||||
/>
|
||||
{estimate.discount_amount > 0 && (
|
||||
{estimate?.discount_amount > 0 && (
|
||||
<TotalLine
|
||||
title={
|
||||
estimate.discount_percentage_formatted
|
||||
? `Discount [${invoice.discount_percentage_formatted}]`
|
||||
? `Discount [${estimate.discount_percentage_formatted}]`
|
||||
: 'Discount'
|
||||
}
|
||||
value={estimate.discount_amount_formatted}
|
||||
@@ -38,7 +38,7 @@ export default function EstimateDetailTableFooter() {
|
||||
)}
|
||||
<TotalLine
|
||||
title={<T id={'estimate.details.total'} />}
|
||||
value={estimate.formatted_amount}
|
||||
value={estimate.total_formatted}
|
||||
borderStyle={TotalLineBorderStyle.DoubleDark}
|
||||
textStyle={TotalLineTextStyle.Bold}
|
||||
/>
|
||||
|
||||
@@ -26,7 +26,7 @@ export function InvoiceDetailTableFooter() {
|
||||
value={invoice.subtotal_formatted}
|
||||
borderStyle={TotalLineBorderStyle.SingleDark}
|
||||
/>
|
||||
{invoice.discount_amount > 0 && (
|
||||
{invoice?.discount_amount > 0 && (
|
||||
<TotalLine
|
||||
title={
|
||||
invoice.discount_percentage_formatted
|
||||
@@ -37,14 +37,14 @@ export function InvoiceDetailTableFooter() {
|
||||
textStyle={TotalLineTextStyle.Regular}
|
||||
/>
|
||||
)}
|
||||
{invoice.adjustment > 0 && (
|
||||
{invoice?.adjustment > 0 && (
|
||||
<TotalLine
|
||||
title="Adjustment"
|
||||
value={invoice.adjustment_formatted}
|
||||
textStyle={TotalLineTextStyle.Regular}
|
||||
/>
|
||||
)}
|
||||
{invoice.taxes.map((taxRate) => (
|
||||
{invoice?.taxes?.map((taxRate) => (
|
||||
<TotalLine
|
||||
key={taxRate.id}
|
||||
title={`${taxRate.name} [${taxRate.tax_rate}%]`}
|
||||
|
||||
@@ -25,11 +25,11 @@ export default function VendorCreditDetailDrawerFooter() {
|
||||
value={vendorCredit.formatted_subtotal}
|
||||
borderStyle={TotalLineBorderStyle.SingleDark}
|
||||
/>
|
||||
{vendorCredit.discount_amount > 0 && (
|
||||
{vendorCredit.discount_amount_formatted && (
|
||||
<TotalLine
|
||||
title={
|
||||
bill.discount_percentage_formatted
|
||||
? `Discount [${bill.discount_percentage_formatted}]`
|
||||
vendorCredit.discount_percentage_formatted
|
||||
? `Discount [${vendorCredit.discount_percentage_formatted}]`
|
||||
: 'Discount'
|
||||
}
|
||||
value={vendorCredit.discount_amount_formatted}
|
||||
|
||||
Reference in New Issue
Block a user