mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 04:40:32 +00:00
feat: Receivable and payable aging summary financial statement.
This commit is contained in:
@@ -8,11 +8,10 @@ import {
|
||||
} from '@/lib/ViewRolesBuilder';
|
||||
import CachableQueryBuilder from '@/lib/Cachable/CachableQueryBuilder';
|
||||
import CachableModel from '@/lib/Cachable/CachableModel';
|
||||
import DateSession from '@/models/DateSession';
|
||||
import { flatToNestedArray } from '@/utils';
|
||||
import DependencyGraph from '@/lib/DependencyGraph';
|
||||
|
||||
export default class Account extends mixin(TenantModel, [CachableModel, DateSession]) {
|
||||
export default class Account extends mixin(TenantModel, [CachableModel]) {
|
||||
/**
|
||||
* Table name
|
||||
*/
|
||||
@@ -20,6 +19,13 @@ export default class Account extends mixin(TenantModel, [CachableModel, DateSess
|
||||
return 'accounts';
|
||||
}
|
||||
|
||||
/**
|
||||
* Timestamps columns.
|
||||
*/
|
||||
static get timestamps() {
|
||||
return ['createdAt', 'updatedAt'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Extend query builder model.
|
||||
*/
|
||||
|
||||
@@ -3,10 +3,9 @@ import moment from 'moment';
|
||||
import TenantModel from '@/models/TenantModel';
|
||||
import CachableQueryBuilder from '@/lib/Cachable/CachableQueryBuilder';
|
||||
import CachableModel from '@/lib/Cachable/CachableModel';
|
||||
import DateSession from '@/models/DateSession';
|
||||
|
||||
|
||||
export default class AccountTransaction extends mixin(TenantModel, [CachableModel, DateSession]) {
|
||||
export default class AccountTransaction extends mixin(TenantModel, [CachableModel]) {
|
||||
/**
|
||||
* Table name
|
||||
*/
|
||||
@@ -14,6 +13,13 @@ export default class AccountTransaction extends mixin(TenantModel, [CachableMode
|
||||
return 'accounts_transactions';
|
||||
}
|
||||
|
||||
/**
|
||||
* Timestamps columns.
|
||||
*/
|
||||
static get timestamps() {
|
||||
return ['createdAt'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Extend query builder model.
|
||||
*/
|
||||
@@ -69,6 +75,12 @@ export default class AccountTransaction extends mixin(TenantModel, [CachableMode
|
||||
query.sum('debit as debit');
|
||||
query.groupBy('account_id');
|
||||
},
|
||||
filterContactType(query, contactType) {
|
||||
query.where('contact_type', contactType);
|
||||
},
|
||||
filterContactIds(query, contactIds) {
|
||||
query.whereIn('contact_id', contactIds);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
// import path from 'path';
|
||||
import { Model } from 'objection';
|
||||
import { Model, mixin } from 'objection';
|
||||
import TenantModel from '@/models/TenantModel';
|
||||
import CachableModel from '@/lib/Cachable/CachableModel';
|
||||
|
||||
export default class AccountType extends TenantModel {
|
||||
export default class AccountType extends mixin(TenantModel, [CachableModel]) {
|
||||
/**
|
||||
* Table name
|
||||
*/
|
||||
|
||||
@@ -7,4 +7,11 @@ export default class Currency extends TenantModel {
|
||||
static get tableName() {
|
||||
return 'currencies';
|
||||
}
|
||||
|
||||
/**
|
||||
* Timestamps columns.
|
||||
*/
|
||||
static get timestamps() {
|
||||
return ['createdAt', 'updatedAt'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,4 +8,22 @@ export default class Customer extends TenantModel {
|
||||
static get tableName() {
|
||||
return 'customers';
|
||||
}
|
||||
|
||||
/**
|
||||
* Model timestamps.
|
||||
*/
|
||||
static get timestamps() {
|
||||
return ['createdAt', 'updatedAt'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Model modifiers.
|
||||
*/
|
||||
static get modifiers() {
|
||||
return {
|
||||
filterCustomerIds(query, customerIds) {
|
||||
query.whereIn('id', customerIds);
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,4 +9,11 @@ export default class ExchangeRate extends TenantModel {
|
||||
static get tableName() {
|
||||
return 'exchange_rates';
|
||||
}
|
||||
|
||||
/**
|
||||
* Timestamps columns.
|
||||
*/
|
||||
static get timestamps() {
|
||||
return ['createdAt', 'updatedAt'];
|
||||
}
|
||||
}
|
||||
@@ -10,10 +10,20 @@ export default class Expense extends TenantModel {
|
||||
return 'expenses_transactions';
|
||||
}
|
||||
|
||||
/**
|
||||
* Account transaction reference type.
|
||||
*/
|
||||
static get referenceType() {
|
||||
return 'Expense';
|
||||
}
|
||||
|
||||
/**
|
||||
* Model timestamps.
|
||||
*/
|
||||
static get timestamps() {
|
||||
return ['createdAt', 'updatedAt'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Model modifiers.
|
||||
*/
|
||||
|
||||
@@ -12,6 +12,13 @@ export default class Item extends TenantModel {
|
||||
return 'items';
|
||||
}
|
||||
|
||||
/**
|
||||
* Model timestamps.
|
||||
*/
|
||||
static get timestamps() {
|
||||
return ['createdAt', 'updatedAt'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Model modifiers.
|
||||
*/
|
||||
|
||||
@@ -9,6 +9,13 @@ export default class ManualJournal extends TenantModel {
|
||||
return 'manual_journals';
|
||||
}
|
||||
|
||||
/**
|
||||
* Model timestamps.
|
||||
*/
|
||||
static get timestamps() {
|
||||
return ['createdAt', 'updatedAt'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Relationship mapping.
|
||||
*/
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
import { Model } from 'objection';
|
||||
import { Model, mixin } from 'objection';
|
||||
import { snakeCase } from 'lodash';
|
||||
import { mapKeysDeep } from '@/utils';
|
||||
import PaginationQueryBuilder from '@/models/Pagination';
|
||||
import DateSession from '@/models/DateSession';
|
||||
|
||||
export default class ModelBase extends Model {
|
||||
export default class ModelBase extends mixin(Model, [DateSession]) {
|
||||
|
||||
static get timestamps() {
|
||||
return [];
|
||||
}
|
||||
|
||||
static get knexBinded() {
|
||||
return this.knexBindInstance;
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import bcrypt from 'bcryptjs';
|
||||
import { Model, mixin } from 'objection';
|
||||
import { Model } from 'objection';
|
||||
import TenantModel from '@/models/TenantModel';
|
||||
import DateSession from '@/models/DateSession';
|
||||
// import PermissionsService from '@/services/PermissionsService';
|
||||
|
||||
export default class TenantUser extends mixin(TenantModel, [DateSession]) {
|
||||
export default class TenantUser extends TenantModel {
|
||||
/**
|
||||
* Virtual attributes.
|
||||
*/
|
||||
@@ -19,6 +18,13 @@ export default class TenantUser extends mixin(TenantModel, [DateSession]) {
|
||||
return 'users';
|
||||
}
|
||||
|
||||
/**
|
||||
* Timestamps columns.
|
||||
*/
|
||||
static get timestamps() {
|
||||
return ['createdAt', 'updatedAt'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Relationship mapping.
|
||||
*/
|
||||
|
||||
@@ -8,4 +8,11 @@ export default class Vendor extends TenantModel {
|
||||
static get tableName() {
|
||||
return 'vendors';
|
||||
}
|
||||
|
||||
/**
|
||||
* Model timestamps.
|
||||
*/
|
||||
static get timestamps() {
|
||||
return ['createdAt', 'updatedAt'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,13 @@ export default class View extends mixin(TenantModel, [CachableModel]) {
|
||||
return 'views';
|
||||
}
|
||||
|
||||
/**
|
||||
* Model timestamps.
|
||||
*/
|
||||
static get timestamps() {
|
||||
return ['createdAt', 'updatedAt'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Extend query builder model.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user