mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 20:30:33 +00:00
fix: discount and adjustment fields across financial forms
This commit is contained in:
@@ -4,6 +4,7 @@ import { Inject, Service } from 'typedi';
|
||||
import {
|
||||
AbilitySubject,
|
||||
CreditNoteAction,
|
||||
DiscountType,
|
||||
ICreditNoteEditDTO,
|
||||
ICreditNoteNewDTO,
|
||||
} from '@/interfaces';
|
||||
@@ -253,7 +254,10 @@ export default class PaymentReceivesController extends BaseController {
|
||||
|
||||
// Discount.
|
||||
check('discount').optional({ nullable: true }).isNumeric().toFloat(),
|
||||
check('discount_type').optional({ nullable: true }).isString().trim(),
|
||||
check('discount_type')
|
||||
.optional({ nullable: true })
|
||||
.isString()
|
||||
.isIn([DiscountType.Percentage, DiscountType.Amount]),
|
||||
|
||||
// Adjustment.
|
||||
check('adjustment').optional({ nullable: true }).isNumeric().toFloat(),
|
||||
@@ -763,8 +767,9 @@ export default class PaymentReceivesController extends BaseController {
|
||||
const { tenantId } = req;
|
||||
|
||||
try {
|
||||
const data =
|
||||
await this.getCreditNoteStateService.getCreditNoteState(tenantId);
|
||||
const data = await this.getCreditNoteStateService.getCreditNoteState(
|
||||
tenantId
|
||||
);
|
||||
return res.status(200).send({ data });
|
||||
} catch (error) {
|
||||
next(error);
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
SaleInvoiceAction,
|
||||
AbilitySubject,
|
||||
SendInvoiceMailDTO,
|
||||
DiscountType,
|
||||
} from '@/interfaces';
|
||||
import CheckPolicies from '@/api/middleware/CheckPolicies';
|
||||
import { SaleInvoiceApplication } from '@/services/Sales/Invoices/SaleInvoicesApplication';
|
||||
@@ -284,10 +285,13 @@ export default class SaleInvoicesController extends BaseController {
|
||||
|
||||
// Discount
|
||||
check('discount').optional({ nullable: true }).isNumeric().toFloat(),
|
||||
check('discount_type').optional({ nullable: true }).isString().trim(),
|
||||
check('discount_type')
|
||||
.optional({ nullable: true })
|
||||
.isString()
|
||||
.isIn([DiscountType.Percentage, DiscountType.Amount]),
|
||||
|
||||
// Adjustments
|
||||
check('adjustment').optional({ nullable: true }).isArray(),
|
||||
check('adjustment').optional({ nullable: true }).isNumeric().toFloat(),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -176,14 +176,18 @@ export default class SalesReceiptsController extends BaseController {
|
||||
check('attachments').isArray().optional(),
|
||||
check('attachments.*.key').exists().isString(),
|
||||
|
||||
// Pdf template id.
|
||||
// # Pdf template
|
||||
check('pdf_template_id').optional({ nullable: true }).isNumeric().toInt(),
|
||||
|
||||
// # Discount
|
||||
check('discount').optional({ nullable: true }).isNumeric().toFloat(),
|
||||
check('discount_type')
|
||||
.optional({ nullable: true })
|
||||
.isString()
|
||||
.isIn([DiscountType.Percentage, DiscountType.Amount]),
|
||||
|
||||
// # Adjustment
|
||||
check('adjustment').optional({ nullable: true }).isNumeric().toFloat(),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user