mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 20:30:33 +00:00
Merge pull request #289 from bigcapitalhq/big-80-entering-decimal-amount-in-salepurchase-transactions
fix(server): allow decimal amount in sale/purchase transactions.
This commit is contained in:
@@ -122,7 +122,7 @@ export default class BillsController extends BaseController {
|
||||
check('entries.*.index').exists().isNumeric().toInt(),
|
||||
check('entries.*.item_id').exists().isNumeric().toInt(),
|
||||
check('entries.*.rate').exists().isNumeric().toFloat(),
|
||||
check('entries.*.quantity').exists().isNumeric().toFloat(),
|
||||
check('entries.*.quantity').exists().isNumeric().toInt(),
|
||||
check('entries.*.discount')
|
||||
.optional({ nullable: true })
|
||||
.isNumeric()
|
||||
|
||||
@@ -121,7 +121,7 @@ export default class BillsPayments extends BaseController {
|
||||
check('entries').exists().isArray({ min: 1 }),
|
||||
check('entries.*.index').optional().isNumeric().toInt(),
|
||||
check('entries.*.bill_id').exists().isNumeric().toInt(),
|
||||
check('entries.*.payment_amount').exists().isNumeric().toInt(),
|
||||
check('entries.*.payment_amount').exists().isNumeric().toFloat(),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ export default class VendorCreditController extends BaseController {
|
||||
check('entries.*.index').exists().isNumeric().toInt(),
|
||||
check('entries.*.item_id').exists().isNumeric().toInt(),
|
||||
check('entries.*.rate').exists().isNumeric().toFloat(),
|
||||
check('entries.*.quantity').exists().isNumeric().toFloat(),
|
||||
check('entries.*.quantity').exists().isNumeric().toInt(),
|
||||
check('entries.*.discount')
|
||||
.optional({ nullable: true })
|
||||
.isNumeric()
|
||||
@@ -211,12 +211,11 @@ export default class VendorCreditController extends BaseController {
|
||||
check('branch_id').optional({ nullable: true }).isNumeric().toInt(),
|
||||
|
||||
check('entries').isArray({ min: 1 }),
|
||||
|
||||
check('entries.*.id').optional().isNumeric().toInt(),
|
||||
check('entries.*.index').exists().isNumeric().toInt(),
|
||||
check('entries.*.item_id').exists().isNumeric().toInt(),
|
||||
check('entries.*.rate').exists().isNumeric().toFloat(),
|
||||
check('entries.*.quantity').exists().isNumeric().toFloat(),
|
||||
check('entries.*.quantity').exists().isNumeric().toInt(),
|
||||
check('entries.*.discount')
|
||||
.optional({ nullable: true })
|
||||
.isNumeric()
|
||||
|
||||
@@ -222,7 +222,7 @@ export default class PaymentReceivesController extends BaseController {
|
||||
check('entries.*.index').exists().isNumeric().toInt(),
|
||||
check('entries.*.item_id').exists().isNumeric().toInt(),
|
||||
check('entries.*.rate').exists().isNumeric().toFloat(),
|
||||
check('entries.*.quantity').exists().isNumeric().toFloat(),
|
||||
check('entries.*.quantity').exists().isNumeric().toInt(),
|
||||
check('entries.*.discount')
|
||||
.optional({ nullable: true })
|
||||
.isNumeric()
|
||||
|
||||
@@ -142,7 +142,7 @@ export default class PaymentReceivesController extends BaseController {
|
||||
check('entries.*.id').optional({ nullable: true }).isNumeric().toInt(),
|
||||
check('entries.*.index').optional().isNumeric().toInt(),
|
||||
check('entries.*.invoice_id').exists().isNumeric().toInt(),
|
||||
check('entries.*.payment_amount').exists().isNumeric().toInt(),
|
||||
check('entries.*.payment_amount').exists().isNumeric().toFloat(),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ export default class SalesReceiptsController extends BaseController {
|
||||
check('entries.*.index').exists().isNumeric().toInt(),
|
||||
check('entries.*.item_id').exists().isNumeric().toInt(),
|
||||
check('entries.*.quantity').exists().isNumeric().toInt(),
|
||||
check('entries.*.rate').exists().isNumeric().toInt(),
|
||||
check('entries.*.rate').exists().isNumeric().toFloat(),
|
||||
check('entries.*.discount')
|
||||
.optional({ nullable: true })
|
||||
.isNumeric()
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
exports.up = function (knex) {
|
||||
return knex.schema.alterTable('items_entries', (table) => {
|
||||
table.decimal('rate', 15, 5).alter();
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
return knex.table('items_entries', (table) => {});
|
||||
};
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Knex } from 'knex';
|
||||
import { Ability, RawRuleOf, ForcedSubject } from '@casl/ability';
|
||||
import Knex from 'knex';
|
||||
|
||||
export const actions = [
|
||||
'manage',
|
||||
@@ -96,7 +96,8 @@ export enum AbilitySubject {
|
||||
Preferences = 'Preferences',
|
||||
CreditNote = 'CreditNode',
|
||||
VendorCredit = 'VendorCredit',
|
||||
Project = 'Project'
|
||||
Project = 'Project',
|
||||
TaxRate = 'TaxRate'
|
||||
}
|
||||
|
||||
export interface IRoleCreatedPayload {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { Transformer } from '@/lib/Transformer/Transformer';
|
||||
import { formatNumber } from 'utils';
|
||||
import { ItemEntryTransformer } from '../Sales/Invoices/ItemEntryTransformer';
|
||||
import { ICreditNote } from '@/interfaces';
|
||||
|
||||
export class CreditNoteTransformer extends Transformer {
|
||||
/**
|
||||
@@ -11,7 +13,8 @@ export class CreditNoteTransformer extends Transformer {
|
||||
'formattedCreditsRemaining',
|
||||
'formattedCreditNoteDate',
|
||||
'formattedAmount',
|
||||
'formattedCreditsUsed'
|
||||
'formattedCreditsUsed',
|
||||
'entries',
|
||||
];
|
||||
};
|
||||
|
||||
@@ -51,9 +54,20 @@ export class CreditNoteTransformer extends Transformer {
|
||||
* @param {ICreditNote} credit
|
||||
* @returns {string}
|
||||
*/
|
||||
protected formattedCreditsUsed = (credit) => {
|
||||
protected formattedCreditsUsed = (credit) => {
|
||||
return formatNumber(credit.creditsUsed, {
|
||||
currencyCode: credit.currencyCode,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the entries of the credit note.
|
||||
* @param {ICreditNote} credit
|
||||
* @returns {}
|
||||
*/
|
||||
protected entries = (credit) => {
|
||||
return this.item(credit.entries, new ItemEntryTransformer(), {
|
||||
currencyCode: credit.currencyCode,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
import { Transformer } from '@/lib/Transformer/Transformer';
|
||||
import { formatNumber } from '@/utils';
|
||||
|
||||
export class BillPaymentEntryTransformer extends Transformer {
|
||||
/**
|
||||
* Include these attributes to bill payment object.
|
||||
* @returns {Array}
|
||||
*/
|
||||
public includeAttributes = (): string[] => {
|
||||
return ['paymentAmountFormatted'];
|
||||
};
|
||||
|
||||
/**
|
||||
* Retreives the payment amount formatted.
|
||||
* @returns {string}
|
||||
*/
|
||||
protected paymentAmountFormatted(entry) {
|
||||
return formatNumber(entry.paymentAmount, { money: false });
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import { IBillPayment } from '@/interfaces';
|
||||
import { Transformer } from '@/lib/Transformer/Transformer';
|
||||
import { formatNumber } from 'utils';
|
||||
import { BillPaymentEntryTransformer } from './BillPaymentEntryTransformer';
|
||||
|
||||
export class BillPaymentTransformer extends Transformer {
|
||||
/**
|
||||
@@ -8,7 +9,7 @@ export class BillPaymentTransformer extends Transformer {
|
||||
* @returns {Array}
|
||||
*/
|
||||
public includeAttributes = (): string[] => {
|
||||
return ['formattedPaymentDate', 'formattedAmount'];
|
||||
return ['formattedPaymentDate', 'formattedAmount', 'entries'];
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -30,4 +31,11 @@ export class BillPaymentTransformer extends Transformer {
|
||||
currencyCode: billPayment.currencyCode,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Retreives the bill payment entries.
|
||||
*/
|
||||
protected entries = (billPayment) => {
|
||||
return this.item(billPayment.entries, new BillPaymentEntryTransformer());
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { IBill } from '@/interfaces';
|
||||
import { Transformer } from '@/lib/Transformer/Transformer';
|
||||
import { ItemEntryTransformer } from '@/services/Sales/Invoices/ItemEntryTransformer';
|
||||
import { SaleInvoiceTaxEntryTransformer } from '@/services/Sales/Invoices/SaleInvoiceTaxEntryTransformer';
|
||||
import { formatNumber } from 'utils';
|
||||
|
||||
@@ -23,6 +24,7 @@ export class PurchaseInvoiceTransformer extends Transformer {
|
||||
'totalFormatted',
|
||||
'totalLocalFormatted',
|
||||
'taxes',
|
||||
'entries',
|
||||
];
|
||||
};
|
||||
|
||||
@@ -178,4 +180,15 @@ export class PurchaseInvoiceTransformer extends Transformer {
|
||||
currencyCode: bill.currencyCode,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the entries of the bill.
|
||||
* @param {Bill} credit
|
||||
* @returns {}
|
||||
*/
|
||||
protected entries = (bill) => {
|
||||
return this.item(bill.entries, new ItemEntryTransformer(), {
|
||||
currencyCode: bill.currencyCode,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import { IVendorCredit } from '@/interfaces';
|
||||
import { Transformer } from '@/lib/Transformer/Transformer';
|
||||
import { ItemEntryTransformer } from '@/services/Sales/Invoices/ItemEntryTransformer';
|
||||
import { formatNumber } from 'utils';
|
||||
|
||||
export class VendorCreditTransformer extends Transformer {
|
||||
@@ -8,9 +10,10 @@ export class VendorCreditTransformer extends Transformer {
|
||||
*/
|
||||
public includeAttributes = (): string[] => {
|
||||
return [
|
||||
'formattedVendorCreditDate',
|
||||
'formattedAmount',
|
||||
'formattedVendorCreditDate',
|
||||
'formattedCreditsRemaining',
|
||||
'entries',
|
||||
];
|
||||
};
|
||||
|
||||
@@ -44,4 +47,15 @@ export class VendorCreditTransformer extends Transformer {
|
||||
currencyCode: credit.currencyCode,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the entries of the bill.
|
||||
* @param {IVendorCredit} vendorCredit
|
||||
* @returns {}
|
||||
*/
|
||||
protected entries = (vendorCredit) => {
|
||||
return this.item(vendorCredit.entries, new ItemEntryTransformer(), {
|
||||
currencyCode: vendorCredit.currencyCode,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Service } from 'typedi';
|
||||
import { ISaleEstimate } from '@/interfaces';
|
||||
import { Transformer } from '@/lib/Transformer/Transformer';
|
||||
import { formatNumber } from 'utils';
|
||||
import { ItemEntryTransformer } from '../Invoices/ItemEntryTransformer';
|
||||
|
||||
export class SaleEstimateTransfromer extends Transformer {
|
||||
/**
|
||||
@@ -16,6 +16,7 @@ export class SaleEstimateTransfromer extends Transformer {
|
||||
'formattedDeliveredAtDate',
|
||||
'formattedApprovedAtDate',
|
||||
'formattedRejectedAtDate',
|
||||
'entries',
|
||||
];
|
||||
};
|
||||
|
||||
@@ -74,4 +75,15 @@ export class SaleEstimateTransfromer extends Transformer {
|
||||
currencyCode: estimate.currencyCode,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the entries of the sale estimate.
|
||||
* @param {ISaleEstimate} estimate
|
||||
* @returns {}
|
||||
*/
|
||||
protected entries = (estimate) => {
|
||||
return this.item(estimate.entries, new ItemEntryTransformer(), {
|
||||
currencyCode: estimate.currencyCode,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
import { IItemEntry } from '@/interfaces';
|
||||
import { Transformer } from '@/lib/Transformer/Transformer';
|
||||
import { formatNumber } from '@/utils';
|
||||
|
||||
export class ItemEntryTransformer extends Transformer {
|
||||
/**
|
||||
* Include these attributes to item entry object.
|
||||
* @returns {Array}
|
||||
*/
|
||||
public includeAttributes = (): string[] => {
|
||||
return ['rateFormatted', 'totalFormatted'];
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the formatted rate of item entry.
|
||||
* @param {IItemEntry} itemEntry -
|
||||
* @returns {string}
|
||||
*/
|
||||
protected rateFormatted = (entry: IItemEntry): string => {
|
||||
return formatNumber(entry.rate, {
|
||||
currencyCode: this.context.currencyCode,
|
||||
money: false,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the formatted total of item entry.
|
||||
* @param {IItemEntry} entry
|
||||
* @returns {string}
|
||||
*/
|
||||
protected totalFormatted = (entry: IItemEntry): string => {
|
||||
return formatNumber(entry.total, {
|
||||
currencyCode: this.context.currencyCode,
|
||||
money: false,
|
||||
});
|
||||
};
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Transformer } from '@/lib/Transformer/Transformer';
|
||||
import { formatNumber } from 'utils';
|
||||
import { SaleInvoiceTaxEntryTransformer } from './SaleInvoiceTaxEntryTransformer';
|
||||
import { ItemEntryTransformer } from './ItemEntryTransformer';
|
||||
|
||||
export class SaleInvoiceTransformer extends Transformer {
|
||||
/**
|
||||
@@ -23,6 +24,7 @@ export class SaleInvoiceTransformer extends Transformer {
|
||||
'totalFormatted',
|
||||
'totalLocalFormatted',
|
||||
'taxes',
|
||||
'entries',
|
||||
];
|
||||
};
|
||||
|
||||
@@ -95,6 +97,7 @@ export class SaleInvoiceTransformer extends Transformer {
|
||||
protected subtotalFormatted = (invoice): string => {
|
||||
return formatNumber(invoice.subtotal, {
|
||||
currencyCode: this.context.organization.baseCurrency,
|
||||
money: false,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -176,4 +179,15 @@ export class SaleInvoiceTransformer extends Transformer {
|
||||
currencyCode: invoice.currencyCode,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the entries of the sale invoice.
|
||||
* @param {ISaleInvoice} invoice
|
||||
* @returns {}
|
||||
*/
|
||||
protected entries = (invoice) => {
|
||||
return this.item(invoice.entries, new ItemEntryTransformer(), {
|
||||
currencyCode: invoice.currencyCode,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import HasTenancyService from '@/services/Tenancy/TenancyService';
|
||||
import { Inject, Service } from 'typedi';
|
||||
import HasTenancyService from '@/services/Tenancy/TenancyService';
|
||||
import { PaymentReceiveValidators } from './PaymentReceiveValidators';
|
||||
|
||||
@Service()
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
import { Transformer } from '@/lib/Transformer/Transformer';
|
||||
import { SaleInvoiceTransformer } from '../Invoices/SaleInvoiceTransformer';
|
||||
import { formatNumber } from '@/utils';
|
||||
|
||||
export class PaymentReceiveEntryTransfromer extends Transformer {
|
||||
/**
|
||||
* Include these attributes to payment receive entry object.
|
||||
* @returns {Array}
|
||||
*/
|
||||
public includeAttributes = (): string[] => {
|
||||
return ['paymentAmountFormatted', 'entry'];
|
||||
};
|
||||
|
||||
/**
|
||||
* Retreives the payment amount formatted.
|
||||
* @param entry
|
||||
* @returns {string}
|
||||
*/
|
||||
protected paymentAmountFormatted(entry) {
|
||||
return formatNumber(entry.paymentAmount, { money: false });
|
||||
}
|
||||
|
||||
/**
|
||||
* Retreives the transformed invoice.
|
||||
*/
|
||||
protected invoice(entry) {
|
||||
return this.item(entry.invoice, new SaleInvoiceTransformer());
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ import { IPaymentReceive, IPaymentReceiveEntry } from '@/interfaces';
|
||||
import { Transformer } from '@/lib/Transformer/Transformer';
|
||||
import { formatNumber } from 'utils';
|
||||
import { SaleInvoiceTransformer } from '../Invoices/SaleInvoiceTransformer';
|
||||
import { PaymentReceiveEntryTransfromer } from './PaymentReceiveEntryTransformer';
|
||||
|
||||
export class PaymentReceiveTransfromer extends Transformer {
|
||||
/**
|
||||
@@ -45,14 +46,11 @@ export class PaymentReceiveTransfromer extends Transformer {
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the
|
||||
* @param {IPaymentReceive} payment
|
||||
* Retrieves the payment entries.
|
||||
* @param {IPaymentReceive} payment
|
||||
* @returns {IPaymentReceiveEntry[]}
|
||||
*/
|
||||
protected entries = (payment: IPaymentReceive): IPaymentReceiveEntry[] => {
|
||||
return payment?.entries?.map((entry) => ({
|
||||
...entry,
|
||||
invoice: this.item(entry.invoice, new SaleInvoiceTransformer()),
|
||||
}));
|
||||
return this.item(payment.entries, new PaymentReceiveEntryTransfromer());
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import { Service } from 'typedi';
|
||||
import { ISaleReceipt } from '@/interfaces';
|
||||
import { Transformer } from '@/lib/Transformer/Transformer';
|
||||
import { formatNumber } from 'utils';
|
||||
import { ItemEntryTransformer } from '../Invoices/ItemEntryTransformer';
|
||||
|
||||
@Service()
|
||||
export class SaleReceiptTransformer extends Transformer {
|
||||
@@ -10,7 +11,12 @@ export class SaleReceiptTransformer extends Transformer {
|
||||
* @returns {Array}
|
||||
*/
|
||||
public includeAttributes = (): string[] => {
|
||||
return ['formattedAmount', 'formattedReceiptDate', 'formattedClosedAtDate'];
|
||||
return [
|
||||
'formattedAmount',
|
||||
'formattedReceiptDate',
|
||||
'formattedClosedAtDate',
|
||||
'entries',
|
||||
];
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -41,4 +47,15 @@ export class SaleReceiptTransformer extends Transformer {
|
||||
currencyCode: receipt.currencyCode,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the entries of the credit note.
|
||||
* @param {ISaleReceipt} credit
|
||||
* @returns {}
|
||||
*/
|
||||
protected entries = (receipt) => {
|
||||
return this.item(receipt.entries, new ItemEntryTransformer(), {
|
||||
currencyCode: receipt.currencyCode,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
@@ -63,8 +63,7 @@ export const useBillReadonlyEntriesTableColumns = () => {
|
||||
},
|
||||
{
|
||||
Header: intl.get('rate'),
|
||||
accessor: 'rate',
|
||||
Cell: FormatNumberCell,
|
||||
accessor: 'rate_formatted',
|
||||
width: getColumnWidth(entries, 'rate', {
|
||||
minWidth: 60,
|
||||
magicSpacing: 5,
|
||||
@@ -75,9 +74,8 @@ export const useBillReadonlyEntriesTableColumns = () => {
|
||||
},
|
||||
{
|
||||
Header: intl.get('amount'),
|
||||
accessor: 'amount',
|
||||
Cell: FormatNumberCell,
|
||||
width: getColumnWidth(entries, 'amount', {
|
||||
accessor: 'total_formatted',
|
||||
width: getColumnWidth(entries, 'total_formatted', {
|
||||
minWidth: 60,
|
||||
magicSpacing: 5,
|
||||
}),
|
||||
|
||||
@@ -60,9 +60,8 @@ export const useCreditNoteReadOnlyEntriesColumns = () => {
|
||||
},
|
||||
{
|
||||
Header: intl.get('rate'),
|
||||
accessor: 'rate',
|
||||
Cell: FormatNumberCell,
|
||||
width: getColumnWidth(entries, 'rate', {
|
||||
accessor: 'rate_formatted',
|
||||
width: getColumnWidth(entries, 'rate_formatted', {
|
||||
minWidth: 60,
|
||||
magicSpacing: 5,
|
||||
}),
|
||||
@@ -72,9 +71,8 @@ export const useCreditNoteReadOnlyEntriesColumns = () => {
|
||||
},
|
||||
{
|
||||
Header: intl.get('amount'),
|
||||
accessor: 'amount',
|
||||
Cell: FormatNumberCell,
|
||||
width: getColumnWidth(entries, 'amount', {
|
||||
accessor: 'total_formatted',
|
||||
width: getColumnWidth(entries, 'total_formatted', {
|
||||
minWidth: 60,
|
||||
magicSpacing: 5,
|
||||
}),
|
||||
|
||||
@@ -47,9 +47,8 @@ export const useEstimateReadonlyEntriesColumns = () => {
|
||||
},
|
||||
{
|
||||
Header: intl.get('rate'),
|
||||
accessor: 'rate',
|
||||
Cell: FormatNumberCell,
|
||||
width: getColumnWidth(entries, 'rate', {
|
||||
accessor: 'rate_formatted',
|
||||
width: getColumnWidth(entries, 'rate_formatted', {
|
||||
minWidth: 60,
|
||||
magicSpacing: 5,
|
||||
}),
|
||||
@@ -59,9 +58,9 @@ export const useEstimateReadonlyEntriesColumns = () => {
|
||||
},
|
||||
{
|
||||
Header: intl.get('amount'),
|
||||
accessor: 'amount',
|
||||
accessor: 'total_formatted',
|
||||
Cell: FormatNumberCell,
|
||||
width: getColumnWidth(entries, 'amount', {
|
||||
width: getColumnWidth(entries, 'total_formatted', {
|
||||
minWidth: 60,
|
||||
magicSpacing: 5,
|
||||
}),
|
||||
|
||||
@@ -23,7 +23,7 @@ export function InvoiceDetailTableFooter() {
|
||||
<InvoiceTotalLines labelColWidth={'180px'} amountColWidth={'180px'}>
|
||||
<TotalLine
|
||||
title={<T id={'invoice.details.subtotal'} />}
|
||||
value={<FormatNumber value={invoice.subtotal_formatted} />}
|
||||
value={invoice.subtotal_formatted}
|
||||
borderStyle={TotalLineBorderStyle.SingleDark}
|
||||
/>
|
||||
{invoice.taxes.map((taxRate) => (
|
||||
|
||||
@@ -64,24 +64,22 @@ export const useInvoiceReadonlyEntriesColumns = () => {
|
||||
},
|
||||
{
|
||||
Header: intl.get('rate'),
|
||||
accessor: 'rate',
|
||||
Cell: FormatNumberCell,
|
||||
accessor: 'rate_formatted',
|
||||
align: 'right',
|
||||
disableSortBy: true,
|
||||
textOverview: true,
|
||||
width: getColumnWidth(entries, 'rate', {
|
||||
width: getColumnWidth(entries, 'rate_formatted', {
|
||||
minWidth: 60,
|
||||
magicSpacing: 5,
|
||||
}),
|
||||
},
|
||||
{
|
||||
Header: intl.get('amount'),
|
||||
accessor: 'amount',
|
||||
Cell: FormatNumberCell,
|
||||
accessor: 'total_formatted',
|
||||
align: 'right',
|
||||
disableSortBy: true,
|
||||
textOverview: true,
|
||||
width: getColumnWidth(entries, 'amount', {
|
||||
width: getColumnWidth(entries, 'total_formatted', {
|
||||
minWidth: 60,
|
||||
magicSpacing: 5,
|
||||
}),
|
||||
|
||||
@@ -52,9 +52,8 @@ export const usePaymentMadeEntriesColumns = () => {
|
||||
},
|
||||
{
|
||||
Header: intl.get('payment_amount'),
|
||||
accessor: 'payment_amount',
|
||||
Cell: FormatNumberCell,
|
||||
width: getColumnWidth(entries, 'payment_amount', {
|
||||
accessor: 'payment_amount_formatted',
|
||||
width: getColumnWidth(entries, 'payment_amount_formatted', {
|
||||
minWidth: 60,
|
||||
magicSpacing: 5,
|
||||
}),
|
||||
|
||||
@@ -63,10 +63,9 @@ export const usePaymentReceiveEntriesColumns = () => {
|
||||
},
|
||||
{
|
||||
Header: intl.get('payment_amount'),
|
||||
accessor: 'invoice.payment_amount',
|
||||
Cell: FormatNumberCell,
|
||||
accessor: 'payment_amount_formatted',
|
||||
align: 'right',
|
||||
width: getColumnWidth(entries, 'invoice.payment_amount', {
|
||||
width: getColumnWidth(entries, 'payment_amount_formatted', {
|
||||
minWidth: 60,
|
||||
magicSpacing: 5,
|
||||
}),
|
||||
|
||||
@@ -18,12 +18,9 @@ function ReceiptDetailDrawerProvider({ receiptId, ...props }) {
|
||||
const { featureCan } = useFeatureCan();
|
||||
|
||||
// Fetch sale receipt details.
|
||||
const { data: receipt, isFetching: isReceiptLoading } = useReceipt(
|
||||
receiptId,
|
||||
{
|
||||
enabled: !!receiptId,
|
||||
},
|
||||
);
|
||||
const { data: receipt, isLoading: isReceiptLoading } = useReceipt(receiptId, {
|
||||
enabled: !!receiptId,
|
||||
});
|
||||
|
||||
// Provider.
|
||||
const provider = {
|
||||
|
||||
@@ -23,7 +23,7 @@ export default function ReceiptDetailTableFooter() {
|
||||
<ReceiptTotalLines labelColWidth={'180px'} amountColWidth={'180px'}>
|
||||
<TotalLine
|
||||
title={<T id={'receipt.details.subtotal'} />}
|
||||
value={<FormatNumber value={receipt.amount} />}
|
||||
value={receipt.formatted_amount}
|
||||
/>
|
||||
<TotalLine
|
||||
title={<T id={'receipt.details.total'} />}
|
||||
|
||||
@@ -43,8 +43,7 @@ export const useReceiptReadonlyEntriesTableColumns = () => {
|
||||
{
|
||||
Header: intl.get('rate'),
|
||||
accessor: 'rate',
|
||||
Cell: FormatNumberCell,
|
||||
width: getColumnWidth(entries, 'rate', {
|
||||
width: getColumnWidth(entries, 'rate_formatted', {
|
||||
minWidth: 60,
|
||||
magicSpacing: 5,
|
||||
}),
|
||||
@@ -55,8 +54,7 @@ export const useReceiptReadonlyEntriesTableColumns = () => {
|
||||
{
|
||||
Header: intl.get('amount'),
|
||||
accessor: 'amount',
|
||||
Cell: FormatNumberCell,
|
||||
width: getColumnWidth(entries, 'amount', {
|
||||
width: getColumnWidth(entries, 'total_formatted', {
|
||||
minWidth: 60,
|
||||
magicSpacing: 5,
|
||||
}),
|
||||
|
||||
@@ -23,7 +23,7 @@ export default function VendorCreditDetailDrawerFooter() {
|
||||
<VendorCreditTotalLines labelColWidth={'180px'} amountColWidth={'180px'}>
|
||||
<TotalLine
|
||||
title={<T id={'vendor_credit.drawer.label_subtotal'} />}
|
||||
value={<FormatNumber value={vendorCredit.formatted_amount} />}
|
||||
value={vendorCredit.formatted_amount}
|
||||
borderStyle={TotalLineBorderStyle.SingleDark}
|
||||
/>
|
||||
<TotalLine
|
||||
|
||||
@@ -61,9 +61,8 @@ export const useVendorCreditReadonlyEntriesTableColumns = () => {
|
||||
},
|
||||
{
|
||||
Header: intl.get('rate'),
|
||||
accessor: 'rate',
|
||||
Cell: FormatNumberCell,
|
||||
width: getColumnWidth(entries, 'rate', {
|
||||
accessor: 'rate_formatted',
|
||||
width: getColumnWidth(entries, 'rate_formatted', {
|
||||
minWidth: 60,
|
||||
magicSpacing: 5,
|
||||
}),
|
||||
@@ -73,9 +72,8 @@ export const useVendorCreditReadonlyEntriesTableColumns = () => {
|
||||
},
|
||||
{
|
||||
Header: intl.get('amount'),
|
||||
accessor: 'amount',
|
||||
Cell: FormatNumberCell,
|
||||
width: getColumnWidth(entries, 'amount', {
|
||||
accessor: 'total_formatted',
|
||||
width: getColumnWidth(entries, 'total_formatted', {
|
||||
minWidth: 60,
|
||||
magicSpacing: 5,
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user