mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 20:30:33 +00:00
feat: add discount to sale and purchase transactions
This commit is contained in:
@@ -281,6 +281,13 @@ export default class SaleInvoicesController extends BaseController {
|
||||
check('payment_methods').optional({ nullable: true }).isArray(),
|
||||
check('payment_methods.*.payment_integration_id').exists().toInt(),
|
||||
check('payment_methods.*.enable').exists().isBoolean(),
|
||||
|
||||
// Discount
|
||||
check('discount').optional({ nullable: true }).isNumeric().toFloat(),
|
||||
check('discount_type').optional({ nullable: true }).isString().trim(),
|
||||
|
||||
// Adjustments
|
||||
check('adjustment').optional({ nullable: true }).isArray(),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* @param { import("knex").Knex } knex
|
||||
* @returns { Promise<void> }
|
||||
*/
|
||||
exports.up = function (knex) {
|
||||
return knex.schema.alterTable('sales_invoices', (table) => {
|
||||
table.decimal('discount', 10, 2).nullable().after('credited_amount');
|
||||
table.string('discount_type').nullable().after('discount');
|
||||
table.decimal('adjustments', 10, 2).nullable().after('discount_type');
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param { import("knex").Knex } knex
|
||||
* @returns { Promise<void> }
|
||||
*/
|
||||
exports.down = function (knex) {
|
||||
return knex.schema.alterTable('sale_invoices', (table) => {
|
||||
table.dropColumn('discount');
|
||||
table.dropColumn('discount_type');
|
||||
table.dropColumn('adjustments');
|
||||
});
|
||||
};
|
||||
@@ -102,6 +102,13 @@ export interface ISaleInvoiceDTO {
|
||||
isInclusiveTax?: boolean;
|
||||
|
||||
attachments?: AttachmentLinkDTO[];
|
||||
|
||||
// # Discount
|
||||
discount?: number;
|
||||
discountType?: string;
|
||||
|
||||
// # Adjustments
|
||||
adjustments?: string;
|
||||
}
|
||||
|
||||
export interface ISaleInvoiceCreateDTO extends ISaleInvoiceDTO {
|
||||
|
||||
Reference in New Issue
Block a user