2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 15:50:56 +00:00
books/reports/ProfitAndLoss/viewConfig.js

65 lines
1.4 KiB
JavaScript
Raw Normal View History

const frappe = require('frappejs');
2018-10-25 20:57:34 +00:00
const title = 'Profit and Loss';
module.exports = {
title: title,
method: 'profit-and-loss',
treeView: true,
2018-10-25 20:57:34 +00:00
filterFields: [
{
fieldtype: 'Date',
fieldname: 'fromDate',
size: 'small',
placeholder: 'From Date',
label: 'From Date',
required: 1,
default: async () => {
return (await frappe.getSingle('AccountingSettings')).fiscalYearStart;
}
},
{
fieldtype: 'Date',
fieldname: 'toDate',
size: 'small',
placeholder: 'To Date',
label: 'To Date',
required: 1,
default: async () => {
return (await frappe.getSingle('AccountingSettings')).fiscalYearEnd;
}
},
{
fieldtype: 'Select',
size: 'small',
options: [
'Select Period...',
'Monthly',
'Quarterly',
'Half Yearly',
'Yearly'
],
default: 'Monthly',
label: 'Periodicity',
fieldname: 'periodicity'
2018-10-25 20:57:34 +00:00
}
],
getColumns(data) {
const columns = [
{ label: 'Account', fieldtype: 'Data', fieldname: 'account', width: 2 }
2018-10-25 20:57:34 +00:00
];
if (data && data.columns) {
const currencyColumns = data.columns;
const columnDefs = currencyColumns.map(name => ({
label: name,
fieldname: name,
fieldtype: 'Currency'
}));
columns.push(...columnDefs);
}
return columns;
}
};