mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 21:00:31 +00:00
fix: display adjustment in minues
This commit is contained in:
@@ -136,7 +136,7 @@ export default class Bill extends mixin(TenantModel, [
|
||||
|
||||
return R.compose(
|
||||
R.add(adjustmentAmount),
|
||||
R.subtract(this.discountAmount),
|
||||
R.subtract(R.__, this.discountAmount),
|
||||
R.when(R.always(this.isInclusiveTax), R.add(this.taxAmountWithheld))
|
||||
)(this.subtotal);
|
||||
}
|
||||
|
||||
@@ -49,6 +49,9 @@ export default class SaleReceipt extends mixin(TenantModel, [
|
||||
'total',
|
||||
'totalLocal',
|
||||
|
||||
'adjustment',
|
||||
'adjustmentLocal',
|
||||
|
||||
'discountAmount',
|
||||
'discountPercentage',
|
||||
|
||||
@@ -119,6 +122,14 @@ export default class SaleReceipt extends mixin(TenantModel, [
|
||||
return this.total * this.exchangeRate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjustment amount in local currency.
|
||||
* @returns {number}
|
||||
*/
|
||||
get adjustmentLocal() {
|
||||
return this.adjustment * this.exchangeRate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detarmine whether the sale receipt closed.
|
||||
* @return {boolean}
|
||||
|
||||
@@ -20,6 +20,7 @@ export class VendorCreditTransformer extends Transformer {
|
||||
'discountAmountFormatted',
|
||||
'discountPercentageFormatted',
|
||||
'adjustmentFormatted',
|
||||
'totalFormatted',
|
||||
'entries',
|
||||
'attachments',
|
||||
];
|
||||
@@ -118,6 +119,15 @@ export class VendorCreditTransformer extends Transformer {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the formatted total.
|
||||
* @param {IVendorCredit} credit
|
||||
* @returns {string}
|
||||
*/
|
||||
protected totalFormatted = (credit) => {
|
||||
return formatNumber(credit.total, { currencyCode: credit.currencyCode });
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the entries of the bill.
|
||||
* @param {IVendorCredit} vendorCredit
|
||||
|
||||
@@ -42,7 +42,7 @@ export function BillDetailTableFooter() {
|
||||
textStyle={TotalLineTextStyle.Regular}
|
||||
/>
|
||||
)}
|
||||
{bill.adjustment > 0 && (
|
||||
{bill.adjustment_formatted && (
|
||||
<TotalLine
|
||||
title={'Adjustment'}
|
||||
value={bill.adjustment_formatted}
|
||||
|
||||
@@ -33,7 +33,7 @@ export default function CreditNoteDetailTableFooter() {
|
||||
value={creditNote.discount_amount_formatted}
|
||||
/>
|
||||
)}
|
||||
{creditNote.adjustment > 0 && (
|
||||
{creditNote.adjustment_formatted && (
|
||||
<TotalLine
|
||||
title={'Adjustment'}
|
||||
value={creditNote.adjustment_formatted}
|
||||
|
||||
@@ -36,7 +36,7 @@ export default function ReceiptDetailTableFooter() {
|
||||
textStyle={TotalLineTextStyle.Regular}
|
||||
/>
|
||||
)}
|
||||
{receipt.adjustment > 0 && (
|
||||
{receipt.adjustment_formatted && (
|
||||
<TotalLine
|
||||
title={'Adjustment'}
|
||||
value={receipt.adjustment_formatted}
|
||||
|
||||
@@ -45,7 +45,7 @@ export default function VendorCreditDetailDrawerFooter() {
|
||||
)}
|
||||
<TotalLine
|
||||
title={<T id={'vendor_credit.drawer.label_total'} />}
|
||||
value={vendorCredit.formatted_amount}
|
||||
value={vendorCredit.total_formatted}
|
||||
borderStyle={TotalLineBorderStyle.DoubleDark}
|
||||
textStyle={TotalLineTextStyle.Bold}
|
||||
/>
|
||||
|
||||
@@ -5,7 +5,6 @@ import styled from 'styled-components';
|
||||
import { defaultTo } from 'lodash';
|
||||
|
||||
import {
|
||||
FormatDate,
|
||||
T,
|
||||
Row,
|
||||
Col,
|
||||
@@ -29,13 +28,14 @@ export default function VendorCreditDetailHeader() {
|
||||
<CommercialDocTopHeader>
|
||||
<DetailsMenu>
|
||||
<AmountItem label={intl.get('amount')}>
|
||||
<span class="big-number">{vendorCredit.formatted_amount}</span>
|
||||
<span class="big-number">{vendorCredit.total_formatted}</span>
|
||||
</AmountItem>
|
||||
<StatusItem>
|
||||
<VendorCreditDetailsStatus vendorCredit={vendorCredit} />
|
||||
</StatusItem>
|
||||
</DetailsMenu>
|
||||
</CommercialDocTopHeader>
|
||||
|
||||
<Row>
|
||||
<Col xs={6}>
|
||||
<DetailsMenu direction={'horizantal'} minLabelSize={'180px'}>
|
||||
|
||||
@@ -455,7 +455,7 @@ export const useInvoiceTotal = () => {
|
||||
return R.compose(
|
||||
R.when(R.always(isExclusiveTax), R.add(totalTaxAmount)),
|
||||
R.subtract(R.__, discountAmount),
|
||||
R.add(R.__, adjustmentAmount),
|
||||
R.add(adjustmentAmount),
|
||||
)(subtotal);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user