mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 12:50:38 +00:00
feat: retrieve all due invoices and bills or for specific customer/vendor.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Model, mixin } from 'objection';
|
||||
import { Model, raw } from 'objection';
|
||||
import moment from 'moment';
|
||||
import TenantModel from 'models/TenantModel';
|
||||
|
||||
@@ -33,6 +33,10 @@ export default class SaleInvoice extends TenantModel {
|
||||
*/
|
||||
static get modifiers() {
|
||||
return {
|
||||
dueInvoices(query) {
|
||||
query.where(raw('BALANCE - PAYMENT_AMOUNT > 0'));
|
||||
},
|
||||
|
||||
filterDateRange(query, startDate, endDate, type = 'day') {
|
||||
const dateFormat = 'YYYY-MM-DD HH:mm:ss';
|
||||
const fromDate = moment(startDate).startOf(type).format(dateFormat);
|
||||
|
||||
Reference in New Issue
Block a user