2019-11-19 19:14:15 +00:00
|
|
|
const frappe = require('frappejs');
|
|
|
|
|
2019-08-20 08:57:27 +00:00
|
|
|
module.exports = {
|
|
|
|
title: 'Balance Sheet',
|
|
|
|
method: 'balance-sheet',
|
|
|
|
filterFields: [
|
|
|
|
{
|
|
|
|
fieldtype: 'Date',
|
|
|
|
fieldname: 'toDate',
|
|
|
|
size: 'small',
|
|
|
|
placeholder: 'ToDate',
|
|
|
|
label: 'To Date',
|
2019-11-19 19:14:15 +00:00
|
|
|
required: 1,
|
|
|
|
default: async () => {
|
|
|
|
return (await frappe.getSingle('AccountingSettings')).fiscalYearEnd;
|
|
|
|
}
|
2019-08-20 08:57:27 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
fieldtype: 'Select',
|
|
|
|
size: 'small',
|
|
|
|
options: [
|
|
|
|
'Select Period...',
|
|
|
|
'Monthly',
|
|
|
|
'Quarterly',
|
|
|
|
'Half Yearly',
|
|
|
|
'Yearly'
|
|
|
|
],
|
|
|
|
label: 'Periodicity',
|
|
|
|
fieldname: 'periodicity',
|
|
|
|
default: 'Monthly'
|
|
|
|
}
|
|
|
|
],
|
|
|
|
getColumns(data) {
|
|
|
|
const columns = [
|
2019-12-03 12:15:10 +00:00
|
|
|
{ label: 'Account', fieldtype: 'Data', fieldname: 'account', width: 2 }
|
2019-08-20 08:57:27 +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;
|
|
|
|
}
|
|
|
|
};
|