2
0
mirror of https://github.com/frappe/books.git synced 2024-12-26 04:17:36 +00:00
books/reports/ProfitAndLoss/ProfitAndLossView.js

27 lines
1.1 KiB
JavaScript
Raw Normal View History

2018-04-19 14:31:35 +00:00
const frappe = require('frappejs');
const FinancialStatementsView = require('../FinancialStatements/FinancialStatementsView');
2018-04-19 14:31:35 +00:00
module.exports = class ProfitAndLossView extends FinancialStatementsView {
2018-04-19 14:31:35 +00:00
constructor() {
super({
title: frappe._('Profit and Loss'),
method: 'profit-and-loss',
2018-04-19 14:31:35 +00:00
filterFields: [
{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'],
label: 'Periodicity', fieldname: 'periodicity', default: 'Monthly'}
2018-04-19 14:31:35 +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
}