2
0
mirror of https://github.com/frappe/books.git synced 2024-12-23 11:29:03 +00:00
books/reports/ProfitAndLoss/viewConfig.js
2018-10-26 02:27:34 +05:30

32 lines
874 B
JavaScript

const title = 'Profit and Loss';
module.exports = {
title: title,
method: 'profit-and-loss',
filterFields: [
{ fieldtype: 'Date', fieldname: 'fromDate', label: 'From Date', required: 1 },
{ fieldtype: 'Date', fieldname: 'toDate', label: 'To Date', required: 1 },
{
fieldtype: 'Select', options: ['Monthly', 'Quarterly', 'Half Yearly', 'Yearly'],
label: 'Periodicity', fieldname: 'periodicity', default: 'Monthly'
}
],
getColumns(data) {
const columns = [
{ label: 'Account', fieldtype: 'Data', fieldname: 'account', width: 340 }
];
if (data && data.columns) {
const currencyColumns = data.columns;
const columnDefs = currencyColumns.map(name => ({
label: name,
fieldname: name,
fieldtype: 'Currency'
}));
columns.push(...columnDefs);
}
return columns;
}
};