2018-04-19 14:31:35 +00:00
|
|
|
const frappe = require('frappejs');
|
2018-04-24 07:58:57 +00:00
|
|
|
const FinancialStatementsView = require('../FinancialStatements/FinancialStatementsView');
|
2018-04-19 14:31:35 +00:00
|
|
|
|
2018-04-24 07:58:57 +00:00
|
|
|
module.exports = class ProfitAndLossView extends FinancialStatementsView {
|
2018-04-19 14:31:35 +00:00
|
|
|
constructor() {
|
|
|
|
super({
|
|
|
|
title: frappe._('Profit and Loss'),
|
2018-04-24 07:58:57 +00:00
|
|
|
method: 'profit-and-loss',
|
2018-04-19 14:31:35 +00:00
|
|
|
filterFields: [
|
2018-04-26 10:23:27 +00:00
|
|
|
{fieldtype: 'Date', fieldname: 'fromDate', label: 'From Date', required: 1},
|
|
|
|
{fieldtype: 'Date', fieldname: 'toDate', label: 'To Date', required: 1},
|
2018-04-19 14:31:35 +00:00
|
|
|
{fieldtype: 'Select', options: ['Monthly', 'Quarterly', 'Half Yearly', 'Yearly'],
|
2018-04-24 07:58:57 +00:00
|
|
|
label: 'Periodicity', fieldname: 'periodicity', default: 'Monthly'}
|
2018-04-19 14:31:35 +00:00
|
|
|
]
|
|
|
|
});
|
|
|
|
}
|
2018-04-26 10:23:27 +00:00
|
|
|
|
|
|
|
async setDefaultFilterValues() {
|
|
|
|
const accountingSettings = await frappe.getSingle('AccountingSettings');
|
|
|
|
this.filters.setValue('fromDate', accountingSettings.fiscalYearStart);
|
|
|
|
this.filters.setValue('toDate', accountingSettings.fiscalYearEnd);
|
|
|
|
this.filters.setValue('periodicity', 'Monthly');
|
|
|
|
|
|
|
|
this.run();
|
|
|
|
}
|
2018-04-19 14:31:35 +00:00
|
|
|
}
|