2
0
mirror of https://github.com/frappe/books.git synced 2024-12-23 11:29:03 +00:00
books/reports/ProfitAndLoss/viewConfig.js

32 lines
874 B
JavaScript
Raw Normal View History

2018-10-25 20:57:34 +00:00
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;
}
};