mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 15:20:34 +00:00
fix: Decimal amounts are rounded when create a new transaction on some transactions types
This commit is contained in:
@@ -14,6 +14,7 @@ export class CreditNoteTransformer extends Transformer {
|
|||||||
'formattedCreditNoteDate',
|
'formattedCreditNoteDate',
|
||||||
'formattedAmount',
|
'formattedAmount',
|
||||||
'formattedCreditsUsed',
|
'formattedCreditsUsed',
|
||||||
|
'formattedSubtotal',
|
||||||
'entries',
|
'entries',
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
@@ -60,6 +61,15 @@ export class CreditNoteTransformer extends Transformer {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the formatted subtotal.
|
||||||
|
* @param {ICreditNote} credit
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
protected formattedSubtotal = (credit): string => {
|
||||||
|
return formatNumber(credit.amount, { money: false });
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the entries of the credit note.
|
* Retrieves the entries of the credit note.
|
||||||
* @param {ICreditNote} credit
|
* @param {ICreditNote} credit
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ export class VendorCreditTransformer extends Transformer {
|
|||||||
public includeAttributes = (): string[] => {
|
public includeAttributes = (): string[] => {
|
||||||
return [
|
return [
|
||||||
'formattedAmount',
|
'formattedAmount',
|
||||||
|
'formattedSubtotal',
|
||||||
'formattedVendorCreditDate',
|
'formattedVendorCreditDate',
|
||||||
'formattedCreditsRemaining',
|
'formattedCreditsRemaining',
|
||||||
'entries',
|
'entries',
|
||||||
@@ -37,6 +38,15 @@ export class VendorCreditTransformer extends Transformer {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the vendor credit formatted subtotal.
|
||||||
|
* @param {IVendorCredit} vendorCredit
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
protected formattedSubtotal = (vendorCredit): string => {
|
||||||
|
return formatNumber(vendorCredit.amount, { money: false });
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve formatted credits remaining.
|
* Retrieve formatted credits remaining.
|
||||||
* @param {IVendorCredit} credit
|
* @param {IVendorCredit} credit
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ export class SaleEstimateTransfromer extends Transformer {
|
|||||||
*/
|
*/
|
||||||
public includeAttributes = (): string[] => {
|
public includeAttributes = (): string[] => {
|
||||||
return [
|
return [
|
||||||
|
'formattedSubtotal',
|
||||||
'formattedAmount',
|
'formattedAmount',
|
||||||
'formattedEstimateDate',
|
'formattedEstimateDate',
|
||||||
'formattedExpirationDate',
|
'formattedExpirationDate',
|
||||||
@@ -76,6 +77,15 @@ export class SaleEstimateTransfromer extends Transformer {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the formatted invoice subtotal.
|
||||||
|
* @param {ISaleEstimate} estimate
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
protected formattedSubtotal = (estimate: ISaleEstimate): string => {
|
||||||
|
return formatNumber(estimate.amount, { money: false });
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the entries of the sale estimate.
|
* Retrieves the entries of the sale estimate.
|
||||||
* @param {ISaleEstimate} estimate
|
* @param {ISaleEstimate} estimate
|
||||||
|
|||||||
@@ -8,7 +8,16 @@ export class ItemEntryTransformer extends Transformer {
|
|||||||
* @returns {Array}
|
* @returns {Array}
|
||||||
*/
|
*/
|
||||||
public includeAttributes = (): string[] => {
|
public includeAttributes = (): string[] => {
|
||||||
return ['rateFormatted', 'totalFormatted'];
|
return ['quantityFormatted', 'rateFormatted', 'totalFormatted'];
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the formatted quantitty of item entry.
|
||||||
|
* @param {IItemEntry} entry
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
protected quantityFormatted = (entry: IItemEntry): string => {
|
||||||
|
return formatNumber(entry.quantity, { money: false });
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ export class SaleReceiptTransformer extends Transformer {
|
|||||||
*/
|
*/
|
||||||
public includeAttributes = (): string[] => {
|
public includeAttributes = (): string[] => {
|
||||||
return [
|
return [
|
||||||
|
'formattedSubtotal',
|
||||||
'formattedAmount',
|
'formattedAmount',
|
||||||
'formattedReceiptDate',
|
'formattedReceiptDate',
|
||||||
'formattedClosedAtDate',
|
'formattedClosedAtDate',
|
||||||
@@ -37,6 +38,15 @@ export class SaleReceiptTransformer extends Transformer {
|
|||||||
return this.formatDate(receipt.closedAt);
|
return this.formatDate(receipt.closedAt);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the estimate formatted subtotal.
|
||||||
|
* @param {ISaleReceipt} receipt
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
protected formattedSubtotal = (receipt: ISaleReceipt): string => {
|
||||||
|
return formatNumber(receipt.amount, { money: false });
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve formatted invoice amount.
|
* Retrieve formatted invoice amount.
|
||||||
* @param {ISaleReceipt} estimate
|
* @param {ISaleReceipt} estimate
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import React from 'react';
|
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
T,
|
T,
|
||||||
TotalLines,
|
TotalLines,
|
||||||
TotalLine,
|
TotalLine,
|
||||||
FormatNumber,
|
|
||||||
TotalLineBorderStyle,
|
TotalLineBorderStyle,
|
||||||
TotalLineTextStyle,
|
TotalLineTextStyle,
|
||||||
} from '@/components';
|
} from '@/components';
|
||||||
@@ -23,7 +20,7 @@ export default function CreditNoteDetailTableFooter() {
|
|||||||
<CreditNoteTotalLines labelColWidth={'180px'} amountColWidth={'180px'}>
|
<CreditNoteTotalLines labelColWidth={'180px'} amountColWidth={'180px'}>
|
||||||
<TotalLine
|
<TotalLine
|
||||||
title={<T id={'credit_note.drawer.label_subtotal'} />}
|
title={<T id={'credit_note.drawer.label_subtotal'} />}
|
||||||
value={<FormatNumber value={creditNote.formatted_amount} />}
|
value={creditNote.formatted_subtotal}
|
||||||
/>
|
/>
|
||||||
<TotalLine
|
<TotalLine
|
||||||
title={<T id={'credit_note.drawer.label_total'} />}
|
title={<T id={'credit_note.drawer.label_total'} />}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import {
|
|||||||
TotalLine,
|
TotalLine,
|
||||||
TotalLineBorderStyle,
|
TotalLineBorderStyle,
|
||||||
TotalLineTextStyle,
|
TotalLineTextStyle,
|
||||||
FormatNumber,
|
|
||||||
} from '@/components';
|
} from '@/components';
|
||||||
import { useEstimateDetailDrawerContext } from './EstimateDetailDrawerProvider';
|
import { useEstimateDetailDrawerContext } from './EstimateDetailDrawerProvider';
|
||||||
|
|
||||||
@@ -23,7 +22,7 @@ export default function EstimateDetailTableFooter() {
|
|||||||
<EstimateTotalLines labelColWidth={'180px'} amountColWidth={'180px'}>
|
<EstimateTotalLines labelColWidth={'180px'} amountColWidth={'180px'}>
|
||||||
<TotalLine
|
<TotalLine
|
||||||
title={<T id={'estimate.details.subtotal'} />}
|
title={<T id={'estimate.details.subtotal'} />}
|
||||||
value={<FormatNumber value={estimate.amount} />}
|
value={estimate.formatted_subtotal}
|
||||||
borderStyle={TotalLineBorderStyle.SingleDark}
|
borderStyle={TotalLineBorderStyle.SingleDark}
|
||||||
/>
|
/>
|
||||||
<TotalLine
|
<TotalLine
|
||||||
|
|||||||
@@ -35,9 +35,9 @@ export const useEstimateReadonlyEntriesColumns = () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
Header: intl.get('quantity'),
|
Header: intl.get('quantity'),
|
||||||
accessor: 'quantity',
|
accessor: 'quantity_formatted',
|
||||||
Cell: FormatNumberCell,
|
Cell: FormatNumberCell,
|
||||||
width: getColumnWidth(entries, 'quantity', {
|
width: getColumnWidth(entries, 'quantity_formatted', {
|
||||||
minWidth: 60,
|
minWidth: 60,
|
||||||
magicSpacing: 5,
|
magicSpacing: 5,
|
||||||
}),
|
}),
|
||||||
@@ -59,7 +59,6 @@ export const useEstimateReadonlyEntriesColumns = () => {
|
|||||||
{
|
{
|
||||||
Header: intl.get('amount'),
|
Header: intl.get('amount'),
|
||||||
accessor: 'total_formatted',
|
accessor: 'total_formatted',
|
||||||
Cell: FormatNumberCell,
|
|
||||||
width: getColumnWidth(entries, 'total_formatted', {
|
width: getColumnWidth(entries, 'total_formatted', {
|
||||||
minWidth: 60,
|
minWidth: 60,
|
||||||
magicSpacing: 5,
|
magicSpacing: 5,
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export default function ReceiptDetailTableFooter() {
|
|||||||
<ReceiptTotalLines labelColWidth={'180px'} amountColWidth={'180px'}>
|
<ReceiptTotalLines labelColWidth={'180px'} amountColWidth={'180px'}>
|
||||||
<TotalLine
|
<TotalLine
|
||||||
title={<T id={'receipt.details.subtotal'} />}
|
title={<T id={'receipt.details.subtotal'} />}
|
||||||
value={receipt.formatted_amount}
|
value={receipt.formatted_subtotal}
|
||||||
/>
|
/>
|
||||||
<TotalLine
|
<TotalLine
|
||||||
title={<T id={'receipt.details.total'} />}
|
title={<T id={'receipt.details.total'} />}
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ export const useJournalEntriesTransactionsColumns = () => {
|
|||||||
() => [
|
() => [
|
||||||
{
|
{
|
||||||
Header: intl.get('date'),
|
Header: intl.get('date'),
|
||||||
accessor: 'date',
|
|
||||||
accessor: 'formatted_date',
|
accessor: 'formatted_date',
|
||||||
Cell: FormatDateCell,
|
Cell: FormatDateCell,
|
||||||
width: 140,
|
width: 140,
|
||||||
@@ -34,15 +33,17 @@ export const useJournalEntriesTransactionsColumns = () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
Header: intl.get('credit'),
|
Header: intl.get('credit'),
|
||||||
accessor: ({ credit }) => credit.formatted_amount,
|
accessor: 'credit.formatted_amount',
|
||||||
width: 100,
|
width: 100,
|
||||||
className: 'credit',
|
className: 'credit',
|
||||||
|
align: 'right',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Header: intl.get('debit'),
|
Header: intl.get('debit'),
|
||||||
accessor: ({ debit }) => debit.formatted_amount,
|
accessor: 'debit.formatted_amount',
|
||||||
width: 100,
|
width: 100,
|
||||||
className: 'debit',
|
className: 'debit',
|
||||||
|
align: 'right',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[],
|
[],
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import {
|
|||||||
TotalLine,
|
TotalLine,
|
||||||
TotalLineBorderStyle,
|
TotalLineBorderStyle,
|
||||||
TotalLineTextStyle,
|
TotalLineTextStyle,
|
||||||
FormatNumber,
|
|
||||||
} from '@/components';
|
} from '@/components';
|
||||||
import { useVendorCreditDetailDrawerContext } from './VendorCreditDetailDrawerProvider';
|
import { useVendorCreditDetailDrawerContext } from './VendorCreditDetailDrawerProvider';
|
||||||
|
|
||||||
@@ -23,7 +22,7 @@ export default function VendorCreditDetailDrawerFooter() {
|
|||||||
<VendorCreditTotalLines labelColWidth={'180px'} amountColWidth={'180px'}>
|
<VendorCreditTotalLines labelColWidth={'180px'} amountColWidth={'180px'}>
|
||||||
<TotalLine
|
<TotalLine
|
||||||
title={<T id={'vendor_credit.drawer.label_subtotal'} />}
|
title={<T id={'vendor_credit.drawer.label_subtotal'} />}
|
||||||
value={vendorCredit.formatted_amount}
|
value={vendorCredit.formatted_subtotal}
|
||||||
borderStyle={TotalLineBorderStyle.SingleDark}
|
borderStyle={TotalLineBorderStyle.SingleDark}
|
||||||
/>
|
/>
|
||||||
<TotalLine
|
<TotalLine
|
||||||
|
|||||||
@@ -49,9 +49,8 @@ export const useVendorCreditReadonlyEntriesTableColumns = () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
Header: intl.get('quantity'),
|
Header: intl.get('quantity'),
|
||||||
accessor: 'quantity',
|
accessor: 'quantity_formatted',
|
||||||
Cell: FormatNumberCell,
|
width: getColumnWidth(entries, 'quantity_formatted', {
|
||||||
width: getColumnWidth(entries, 'quantity', {
|
|
||||||
minWidth: 60,
|
minWidth: 60,
|
||||||
magicSpacing: 5,
|
magicSpacing: 5,
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user