mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 15:20:34 +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 => {
|
protected discountAmountFormatted = (credit): string => {
|
||||||
return formatNumber(credit.discountAmount, {
|
return formatNumber(credit.discountAmount, {
|
||||||
currencyCode: credit.currencyCode,
|
currencyCode: credit.currencyCode,
|
||||||
|
excerptZero: true,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -118,6 +119,7 @@ export class CreditNoteTransformer extends Transformer {
|
|||||||
protected adjustmentFormatted = (credit): string => {
|
protected adjustmentFormatted = (credit): string => {
|
||||||
return this.formatMoney(credit.adjustment, {
|
return this.formatMoney(credit.adjustment, {
|
||||||
currencyCode: credit.currencyCode,
|
currencyCode: credit.currencyCode,
|
||||||
|
excerptZero: true,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -171,6 +171,7 @@ export class PurchaseInvoiceTransformer extends Transformer {
|
|||||||
protected discountAmountFormatted = (bill): string => {
|
protected discountAmountFormatted = (bill): string => {
|
||||||
return formatNumber(bill.discountAmount, {
|
return formatNumber(bill.discountAmount, {
|
||||||
currencyCode: bill.currencyCode,
|
currencyCode: bill.currencyCode,
|
||||||
|
excerptZero: true,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -193,6 +194,7 @@ export class PurchaseInvoiceTransformer extends Transformer {
|
|||||||
protected adjustmentFormatted = (bill): string => {
|
protected adjustmentFormatted = (bill): string => {
|
||||||
return formatNumber(bill.adjustment, {
|
return formatNumber(bill.adjustment, {
|
||||||
currencyCode: bill.currencyCode,
|
currencyCode: bill.currencyCode,
|
||||||
|
excerptZero: true,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ export class VendorCreditTransformer extends Transformer {
|
|||||||
protected discountAmountFormatted = (credit): string => {
|
protected discountAmountFormatted = (credit): string => {
|
||||||
return formatNumber(credit.discountAmount, {
|
return formatNumber(credit.discountAmount, {
|
||||||
currencyCode: credit.currencyCode,
|
currencyCode: credit.currencyCode,
|
||||||
|
excerptZero: true,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -102,6 +103,7 @@ export class VendorCreditTransformer extends Transformer {
|
|||||||
protected adjustmentFormatted = (credit): string => {
|
protected adjustmentFormatted = (credit): string => {
|
||||||
return formatNumber(credit.adjustment, {
|
return formatNumber(credit.adjustment, {
|
||||||
currencyCode: credit.currencyCode,
|
currencyCode: credit.currencyCode,
|
||||||
|
excerptZero: true,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ export class SaleEstimateTransfromer extends Transformer {
|
|||||||
protected discountAmountFormatted = (estimate: ISaleEstimate): string => {
|
protected discountAmountFormatted = (estimate: ISaleEstimate): string => {
|
||||||
return formatNumber(estimate.discountAmount, {
|
return formatNumber(estimate.discountAmount, {
|
||||||
currencyCode: estimate.currencyCode,
|
currencyCode: estimate.currencyCode,
|
||||||
|
excerptZero: true,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -133,6 +134,7 @@ export class SaleEstimateTransfromer extends Transformer {
|
|||||||
protected adjustmentFormatted = (estimate: ISaleEstimate): string => {
|
protected adjustmentFormatted = (estimate: ISaleEstimate): string => {
|
||||||
return this.formatMoney(estimate.adjustment, {
|
return this.formatMoney(estimate.adjustment, {
|
||||||
currencyCode: estimate.currencyCode,
|
currencyCode: estimate.currencyCode,
|
||||||
|
excerptZero: true,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -170,6 +170,7 @@ export class SaleInvoiceTransformer extends Transformer {
|
|||||||
protected discountAmountFormatted = (invoice): string => {
|
protected discountAmountFormatted = (invoice): string => {
|
||||||
return formatNumber(invoice.discountAmount, {
|
return formatNumber(invoice.discountAmount, {
|
||||||
currencyCode: invoice.currencyCode,
|
currencyCode: invoice.currencyCode,
|
||||||
|
excerptZero: true,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -192,8 +193,9 @@ export class SaleInvoiceTransformer extends Transformer {
|
|||||||
protected adjustmentFormatted = (invoice): string => {
|
protected adjustmentFormatted = (invoice): string => {
|
||||||
return this.formatMoney(invoice.adjustment, {
|
return this.formatMoney(invoice.adjustment, {
|
||||||
currencyCode: invoice.currencyCode,
|
currencyCode: invoice.currencyCode,
|
||||||
})
|
excerptZero: true,
|
||||||
}
|
});
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves formatted total in foreign currency.
|
* Retrieves formatted total in foreign currency.
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ export class SaleReceiptTransformer extends Transformer {
|
|||||||
protected discountAmountFormatted = (receipt: ISaleReceipt): string => {
|
protected discountAmountFormatted = (receipt: ISaleReceipt): string => {
|
||||||
return formatNumber(receipt.discountAmount, {
|
return formatNumber(receipt.discountAmount, {
|
||||||
currencyCode: receipt.currencyCode,
|
currencyCode: receipt.currencyCode,
|
||||||
|
excerptZero: true,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -135,6 +136,7 @@ export class SaleReceiptTransformer extends Transformer {
|
|||||||
protected adjustmentFormatted = (receipt: ISaleReceipt): string => {
|
protected adjustmentFormatted = (receipt: ISaleReceipt): string => {
|
||||||
return this.formatMoney(receipt.adjustment, {
|
return this.formatMoney(receipt.adjustment, {
|
||||||
currencyCode: receipt.currencyCode,
|
currencyCode: receipt.currencyCode,
|
||||||
|
excerptZero: true,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ export default function EstimateDetailHeader() {
|
|||||||
<CommercialDocTopHeader>
|
<CommercialDocTopHeader>
|
||||||
<DetailsMenu>
|
<DetailsMenu>
|
||||||
<AmountEstimateDetail label={intl.get('amount')}>
|
<AmountEstimateDetail label={intl.get('amount')}>
|
||||||
<span class="big-number">{estimate.formatted_amount}</span>
|
<span class="big-number">{estimate.total_formatted}</span>
|
||||||
</AmountEstimateDetail>
|
</AmountEstimateDetail>
|
||||||
|
|
||||||
<EstimateStatusDetail>
|
<EstimateStatusDetail>
|
||||||
|
|||||||
@@ -25,11 +25,11 @@ export default function EstimateDetailTableFooter() {
|
|||||||
value={estimate.formatted_subtotal}
|
value={estimate.formatted_subtotal}
|
||||||
borderStyle={TotalLineBorderStyle.SingleDark}
|
borderStyle={TotalLineBorderStyle.SingleDark}
|
||||||
/>
|
/>
|
||||||
{estimate.discount_amount > 0 && (
|
{estimate?.discount_amount > 0 && (
|
||||||
<TotalLine
|
<TotalLine
|
||||||
title={
|
title={
|
||||||
estimate.discount_percentage_formatted
|
estimate.discount_percentage_formatted
|
||||||
? `Discount [${invoice.discount_percentage_formatted}]`
|
? `Discount [${estimate.discount_percentage_formatted}]`
|
||||||
: 'Discount'
|
: 'Discount'
|
||||||
}
|
}
|
||||||
value={estimate.discount_amount_formatted}
|
value={estimate.discount_amount_formatted}
|
||||||
@@ -38,7 +38,7 @@ export default function EstimateDetailTableFooter() {
|
|||||||
)}
|
)}
|
||||||
<TotalLine
|
<TotalLine
|
||||||
title={<T id={'estimate.details.total'} />}
|
title={<T id={'estimate.details.total'} />}
|
||||||
value={estimate.formatted_amount}
|
value={estimate.total_formatted}
|
||||||
borderStyle={TotalLineBorderStyle.DoubleDark}
|
borderStyle={TotalLineBorderStyle.DoubleDark}
|
||||||
textStyle={TotalLineTextStyle.Bold}
|
textStyle={TotalLineTextStyle.Bold}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export function InvoiceDetailTableFooter() {
|
|||||||
value={invoice.subtotal_formatted}
|
value={invoice.subtotal_formatted}
|
||||||
borderStyle={TotalLineBorderStyle.SingleDark}
|
borderStyle={TotalLineBorderStyle.SingleDark}
|
||||||
/>
|
/>
|
||||||
{invoice.discount_amount > 0 && (
|
{invoice?.discount_amount > 0 && (
|
||||||
<TotalLine
|
<TotalLine
|
||||||
title={
|
title={
|
||||||
invoice.discount_percentage_formatted
|
invoice.discount_percentage_formatted
|
||||||
@@ -37,14 +37,14 @@ export function InvoiceDetailTableFooter() {
|
|||||||
textStyle={TotalLineTextStyle.Regular}
|
textStyle={TotalLineTextStyle.Regular}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{invoice.adjustment > 0 && (
|
{invoice?.adjustment > 0 && (
|
||||||
<TotalLine
|
<TotalLine
|
||||||
title="Adjustment"
|
title="Adjustment"
|
||||||
value={invoice.adjustment_formatted}
|
value={invoice.adjustment_formatted}
|
||||||
textStyle={TotalLineTextStyle.Regular}
|
textStyle={TotalLineTextStyle.Regular}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{invoice.taxes.map((taxRate) => (
|
{invoice?.taxes?.map((taxRate) => (
|
||||||
<TotalLine
|
<TotalLine
|
||||||
key={taxRate.id}
|
key={taxRate.id}
|
||||||
title={`${taxRate.name} [${taxRate.tax_rate}%]`}
|
title={`${taxRate.name} [${taxRate.tax_rate}%]`}
|
||||||
|
|||||||
@@ -25,11 +25,11 @@ export default function VendorCreditDetailDrawerFooter() {
|
|||||||
value={vendorCredit.formatted_subtotal}
|
value={vendorCredit.formatted_subtotal}
|
||||||
borderStyle={TotalLineBorderStyle.SingleDark}
|
borderStyle={TotalLineBorderStyle.SingleDark}
|
||||||
/>
|
/>
|
||||||
{vendorCredit.discount_amount > 0 && (
|
{vendorCredit.discount_amount_formatted && (
|
||||||
<TotalLine
|
<TotalLine
|
||||||
title={
|
title={
|
||||||
bill.discount_percentage_formatted
|
vendorCredit.discount_percentage_formatted
|
||||||
? `Discount [${bill.discount_percentage_formatted}]`
|
? `Discount [${vendorCredit.discount_percentage_formatted}]`
|
||||||
: 'Discount'
|
: 'Discount'
|
||||||
}
|
}
|
||||||
value={vendorCredit.discount_amount_formatted}
|
value={vendorCredit.discount_amount_formatted}
|
||||||
|
|||||||
Reference in New Issue
Block a user