feat: Financial statements enhancement.

This commit is contained in:
Ahmed Bouhuolia
2020-06-17 22:06:33 +02:00
parent 5c43f902e3
commit 3e15cd42c8
75 changed files with 1308 additions and 593 deletions

View File

@@ -336,7 +336,7 @@ export default {
}
const expenses = await Expense.query().onBuild((builder) => {
builder.withGraphFetched('paymentAccount');
builder.withGraphFetched('categories');
builder.withGraphFetched('categories.expenseAccount');
builder.withGraphFetched('user');
dynamicFilter.buildQuery()(builder);
}).pagination(filter.page - 1, filter.page_size);;

View File

@@ -106,11 +106,12 @@ export default class ReceivableAgingSummary extends AgingReport {
}
const storedCustomers = await Customer.query().onBuild((builder) => {
if (filter.customer_ids) {
if (filter.customer_ids.length > 0) {
builder.modify('filterCustomerIds', filter.customer_ids);
}
return builder;
});
const accountsReceivableType = await AccountType.query()
.where('key', 'accounts_receivable')
.first();

View File

@@ -22,7 +22,7 @@ export default class Account extends mixin(TenantModel, [CachableModel]) {
/**
* Timestamps columns.
*/
static get timestamps() {
get timestamps() {
return ['createdAt', 'updatedAt'];
}

View File

@@ -16,7 +16,7 @@ export default class AccountTransaction extends mixin(TenantModel, [CachableMode
/**
* Timestamps columns.
*/
static get timestamps() {
get timestamps() {
return ['createdAt'];
}

View File

@@ -12,7 +12,7 @@ export default class Customer extends TenantModel {
/**
* Model timestamps.
*/
static get timestamps() {
get timestamps() {
return ['createdAt', 'updatedAt'];
}

View File

@@ -3,7 +3,7 @@ import moment from 'moment';
export default (Model) => {
return class DateSession extends Model {
static get timestamps() {
get timestamps() {
return ['createdAt', 'updatedAt'];
}
@@ -11,8 +11,8 @@ export default (Model) => {
const maybePromise = super.$beforeUpdate(opt, context);
return Promise.resolve(maybePromise).then(() => {
if (DateSession.timestamps[1]) {
this[DateSession.timestamps[1]] = moment().format('YYYY/MM/DD HH:mm:ss');
if (this.timestamps[1]) {
this[this.timestamps[1]] = moment().format('YYYY/MM/DD HH:mm:ss');
}
});
}
@@ -21,8 +21,8 @@ export default (Model) => {
const maybePromise = super.$beforeInsert(context);
return Promise.resolve(maybePromise).then(() => {
if (DateSession.timestamps[0]) {
this[DateSession.timestamps[0]] = moment().format('YYYY/MM/DD HH:mm:ss');
if (this.timestamps[0]) {
this[this.timestamps[0]] = moment().format('YYYY/MM/DD HH:mm:ss');
}
});
}