mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 04:40:32 +00:00
fix: discount and adjustment fields
This commit is contained in:
@@ -153,7 +153,7 @@ export default class BillsController extends BaseController {
|
||||
check('discount_type')
|
||||
.default(DiscountType.Amount)
|
||||
.isIn([DiscountType.Amount, DiscountType.Percentage]),
|
||||
check('discount').optional().isDecimal().toFloat(),
|
||||
check('discount').optional({ nullable: true }).isDecimal().toFloat(),
|
||||
|
||||
// # Adjustment
|
||||
check('adjustment').optional({ nullable: true }).isNumeric().toFloat(),
|
||||
@@ -204,7 +204,7 @@ export default class BillsController extends BaseController {
|
||||
check('discount_type')
|
||||
.default(DiscountType.Amount)
|
||||
.isIn([DiscountType.Amount, DiscountType.Percentage]),
|
||||
check('discount').optional().isDecimal().toFloat(),
|
||||
check('discount').optional({ nullable: true }).isDecimal().toFloat(),
|
||||
|
||||
// # Adjustment
|
||||
check('adjustment').optional({ nullable: true }).isNumeric().toFloat(),
|
||||
|
||||
@@ -204,13 +204,13 @@ export default class SalesEstimatesController extends BaseController {
|
||||
check('pdf_template_id').optional({ nullable: true }).isNumeric().toInt(),
|
||||
|
||||
// # Discount
|
||||
check('discount').optional().isNumeric().toFloat(),
|
||||
check('discount').optional({ nullable: true }).isNumeric().toFloat(),
|
||||
check('discount_type')
|
||||
.default(DiscountType.Amount)
|
||||
.isIn([DiscountType.Amount, DiscountType.Percentage]),
|
||||
|
||||
// # Adjustment
|
||||
check('adjustment').optional().isNumeric().toFloat(),
|
||||
check('adjustment').optional({ nullable: true }).isNumeric().toFloat(),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ export default function EstimateDetailTableFooter() {
|
||||
value={estimate.formatted_subtotal}
|
||||
borderStyle={TotalLineBorderStyle.SingleDark}
|
||||
/>
|
||||
{estimate?.discount_amount > 0 && (
|
||||
{estimate?.discount_amount_formatted && (
|
||||
<TotalLine
|
||||
title={
|
||||
estimate.discount_percentage_formatted
|
||||
@@ -36,6 +36,13 @@ export default function EstimateDetailTableFooter() {
|
||||
textStyle={TotalLineTextStyle.Regular}
|
||||
/>
|
||||
)}
|
||||
{estimate?.adjustment_formatted && (
|
||||
<TotalLine
|
||||
title="Adjustment"
|
||||
value={estimate.adjustment_formatted}
|
||||
textStyle={TotalLineTextStyle.Regular}
|
||||
/>
|
||||
)}
|
||||
<TotalLine
|
||||
title={<T id={'estimate.details.total'} />}
|
||||
value={estimate.total_formatted}
|
||||
|
||||
@@ -37,7 +37,7 @@ export function InvoiceDetailTableFooter() {
|
||||
textStyle={TotalLineTextStyle.Regular}
|
||||
/>
|
||||
)}
|
||||
{invoice?.adjustment > 0 && (
|
||||
{invoice?.adjustment_formatted && (
|
||||
<TotalLine
|
||||
title="Adjustment"
|
||||
value={invoice.adjustment_formatted}
|
||||
|
||||
@@ -25,7 +25,7 @@ export default function VendorCreditDetailDrawerFooter() {
|
||||
value={vendorCredit.formatted_subtotal}
|
||||
borderStyle={TotalLineBorderStyle.SingleDark}
|
||||
/>
|
||||
{vendorCredit.discount_amount_formatted && (
|
||||
{vendorCredit?.discount_amount_formatted && (
|
||||
<TotalLine
|
||||
title={
|
||||
vendorCredit.discount_percentage_formatted
|
||||
@@ -36,6 +36,13 @@ export default function VendorCreditDetailDrawerFooter() {
|
||||
textStyle={TotalLineTextStyle.Regular}
|
||||
/>
|
||||
)}
|
||||
{vendorCredit?.adjustment_formatted && (
|
||||
<TotalLine
|
||||
title={'Adjustment'}
|
||||
value={vendorCredit.adjustment_formatted}
|
||||
textStyle={TotalLineTextStyle.Regular}
|
||||
/>
|
||||
)}
|
||||
<TotalLine
|
||||
title={<T id={'vendor_credit.drawer.label_total'} />}
|
||||
value={vendorCredit.formatted_amount}
|
||||
|
||||
Reference in New Issue
Block a user