fix: due Amount on edit page is calculated wrong with "Exclusive of Tax" Invoice mode

This commit is contained in:
Sachin
2024-08-03 23:56:02 +05:30
parent 940b4f9175
commit 8cab012324
2 changed files with 4 additions and 4 deletions

View File

@@ -8,7 +8,7 @@ import InvoiceFormHeaderFields from './InvoiceFormHeaderFields';
import { CLASSES } from '@/constants/classes'; import { CLASSES } from '@/constants/classes';
import { PageFormBigNumber } from '@/components'; import { PageFormBigNumber } from '@/components';
import { useInvoiceSubtotal } from './utils'; import { useInvoiceDueAmount } from './utils';
/** /**
* Invoice form header section. * Invoice form header section.
@@ -32,7 +32,7 @@ function InvoiceFormBigTotal() {
} = useFormikContext(); } = useFormikContext();
// Calculate the total due amount of invoice entries. // Calculate the total due amount of invoice entries.
const totalDueAmount = useInvoiceSubtotal(); const totalDueAmount = useInvoiceDueAmount();
return ( return (
<PageFormBigNumber <PageFormBigNumber

View File

@@ -302,8 +302,8 @@ export const useInvoiceTotals = () => {
); );
// Retrieves the formatted due total. // Retrieves the formatted due total.
const dueTotal = React.useMemo( const dueTotal = React.useMemo(
() => total - paymentTotal, () => total_ - paymentTotal,
[total, paymentTotal], [total_, paymentTotal],
); );
// Retrieves the formatted due total. // Retrieves the formatted due total.
const formattedDueTotal = React.useMemo( const formattedDueTotal = React.useMemo(