mirror of
https://github.com/frappe/books.git
synced 2024-12-23 11:29:03 +00:00
32 lines
874 B
JavaScript
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;
|
||
|
}
|
||
|
};
|