mirror of
https://github.com/frappe/books.git
synced 2024-12-23 19:39:07 +00:00
1a8a23d2a2
- refactor Common Js imports to ES6
66 lines
1.4 KiB
JavaScript
66 lines
1.4 KiB
JavaScript
import frappe from 'frappejs';
|
|
|
|
const title = 'Profit and Loss';
|
|
|
|
export default {
|
|
title: title,
|
|
method: 'profit-and-loss',
|
|
treeView: true,
|
|
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'
|
|
}
|
|
],
|
|
getColumns(data) {
|
|
const columns = [
|
|
{ label: 'Account', fieldtype: 'Data', fieldname: 'account', width: 2 }
|
|
];
|
|
|
|
if (data && data.columns) {
|
|
const currencyColumns = data.columns;
|
|
const columnDefs = currencyColumns.map(name => ({
|
|
label: name,
|
|
fieldname: name,
|
|
fieldtype: 'Currency'
|
|
}));
|
|
|
|
columns.push(...columnDefs);
|
|
}
|
|
|
|
return columns;
|
|
}
|
|
};
|