fix: Decimal amounts are rounded when create a new transaction on some transactions types

This commit is contained in:
Ahmed Bouhuolia
2024-02-06 20:31:48 +02:00
parent 374f1acf8a
commit 0f678e61c5
12 changed files with 62 additions and 19 deletions

View File

@@ -1,12 +1,9 @@
// @ts-nocheck
import React from 'react';
import styled from 'styled-components';
import {
T,
TotalLines,
TotalLine,
FormatNumber,
TotalLineBorderStyle,
TotalLineTextStyle,
} from '@/components';
@@ -23,7 +20,7 @@ export default function CreditNoteDetailTableFooter() {
<CreditNoteTotalLines labelColWidth={'180px'} amountColWidth={'180px'}>
<TotalLine
title={<T id={'credit_note.drawer.label_subtotal'} />}
value={<FormatNumber value={creditNote.formatted_amount} />}
value={creditNote.formatted_subtotal}
/>
<TotalLine
title={<T id={'credit_note.drawer.label_total'} />}

View File

@@ -8,7 +8,6 @@ import {
TotalLine,
TotalLineBorderStyle,
TotalLineTextStyle,
FormatNumber,
} from '@/components';
import { useEstimateDetailDrawerContext } from './EstimateDetailDrawerProvider';
@@ -23,7 +22,7 @@ export default function EstimateDetailTableFooter() {
<EstimateTotalLines labelColWidth={'180px'} amountColWidth={'180px'}>
<TotalLine
title={<T id={'estimate.details.subtotal'} />}
value={<FormatNumber value={estimate.amount} />}
value={estimate.formatted_subtotal}
borderStyle={TotalLineBorderStyle.SingleDark}
/>
<TotalLine

View File

@@ -35,9 +35,9 @@ export const useEstimateReadonlyEntriesColumns = () => {
},
{
Header: intl.get('quantity'),
accessor: 'quantity',
accessor: 'quantity_formatted',
Cell: FormatNumberCell,
width: getColumnWidth(entries, 'quantity', {
width: getColumnWidth(entries, 'quantity_formatted', {
minWidth: 60,
magicSpacing: 5,
}),
@@ -59,7 +59,6 @@ export const useEstimateReadonlyEntriesColumns = () => {
{
Header: intl.get('amount'),
accessor: 'total_formatted',
Cell: FormatNumberCell,
width: getColumnWidth(entries, 'total_formatted', {
minWidth: 60,
magicSpacing: 5,

View File

@@ -23,7 +23,7 @@ export default function ReceiptDetailTableFooter() {
<ReceiptTotalLines labelColWidth={'180px'} amountColWidth={'180px'}>
<TotalLine
title={<T id={'receipt.details.subtotal'} />}
value={receipt.formatted_amount}
value={receipt.formatted_subtotal}
/>
<TotalLine
title={<T id={'receipt.details.total'} />}

View File

@@ -13,7 +13,6 @@ export const useJournalEntriesTransactionsColumns = () => {
() => [
{
Header: intl.get('date'),
accessor: 'date',
accessor: 'formatted_date',
Cell: FormatDateCell,
width: 140,
@@ -34,15 +33,17 @@ export const useJournalEntriesTransactionsColumns = () => {
},
{
Header: intl.get('credit'),
accessor: ({ credit }) => credit.formatted_amount,
accessor: 'credit.formatted_amount',
width: 100,
className: 'credit',
align: 'right',
},
{
Header: intl.get('debit'),
accessor: ({ debit }) => debit.formatted_amount,
accessor: 'debit.formatted_amount',
width: 100,
className: 'debit',
align: 'right',
},
],
[],

View File

@@ -8,7 +8,6 @@ import {
TotalLine,
TotalLineBorderStyle,
TotalLineTextStyle,
FormatNumber,
} from '@/components';
import { useVendorCreditDetailDrawerContext } from './VendorCreditDetailDrawerProvider';
@@ -23,7 +22,7 @@ export default function VendorCreditDetailDrawerFooter() {
<VendorCreditTotalLines labelColWidth={'180px'} amountColWidth={'180px'}>
<TotalLine
title={<T id={'vendor_credit.drawer.label_subtotal'} />}
value={vendorCredit.formatted_amount}
value={vendorCredit.formatted_subtotal}
borderStyle={TotalLineBorderStyle.SingleDark}
/>
<TotalLine

View File

@@ -49,9 +49,8 @@ export const useVendorCreditReadonlyEntriesTableColumns = () => {
},
{
Header: intl.get('quantity'),
accessor: 'quantity',
Cell: FormatNumberCell,
width: getColumnWidth(entries, 'quantity', {
accessor: 'quantity_formatted',
width: getColumnWidth(entries, 'quantity_formatted', {
minWidth: 60,
magicSpacing: 5,
}),