2022-02-16 06:19:16 +00:00
|
|
|
import frappe, { t } from 'frappe';
|
2021-12-21 09:21:13 +00:00
|
|
|
import getCommonExportActions from '../commonExporter';
|
2019-11-19 19:14:15 +00:00
|
|
|
|
2021-11-04 10:31:26 +00:00
|
|
|
export default {
|
2019-08-20 08:57:27 +00:00
|
|
|
title: 'Balance Sheet',
|
|
|
|
method: 'balance-sheet',
|
|
|
|
filterFields: [
|
|
|
|
{
|
|
|
|
fieldtype: 'Date',
|
|
|
|
fieldname: 'toDate',
|
|
|
|
size: 'small',
|
|
|
|
placeholder: 'ToDate',
|
2022-02-16 06:19:16 +00:00
|
|
|
label: t`To Date`,
|
2019-11-19 19:14:15 +00:00
|
|
|
required: 1,
|
|
|
|
default: async () => {
|
|
|
|
return (await frappe.getSingle('AccountingSettings')).fiscalYearEnd;
|
2021-12-16 11:15:31 +00:00
|
|
|
},
|
2019-08-20 08:57:27 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
fieldtype: 'Select',
|
2021-12-16 11:15:31 +00:00
|
|
|
placeholder: 'Select Period',
|
2019-08-20 08:57:27 +00:00
|
|
|
size: 'small',
|
2021-12-16 11:15:31 +00:00
|
|
|
options: ['Monthly', 'Quarterly', 'Half Yearly', 'Yearly'],
|
2022-02-16 06:19:16 +00:00
|
|
|
label: t`Periodicity`,
|
2019-08-20 08:57:27 +00:00
|
|
|
fieldname: 'periodicity',
|
2021-12-16 11:15:31 +00:00
|
|
|
default: 'Monthly',
|
|
|
|
},
|
2019-08-20 08:57:27 +00:00
|
|
|
],
|
2021-12-21 09:21:13 +00:00
|
|
|
actions: getCommonExportActions('balance-sheet'),
|
2021-12-29 05:22:31 +00:00
|
|
|
getColumns({ data }) {
|
2019-08-20 08:57:27 +00:00
|
|
|
const columns = [
|
2022-02-16 06:19:16 +00:00
|
|
|
{ label: t`Account`, fieldtype: 'Data', fieldname: 'account', width: 2 },
|
2019-08-20 08:57:27 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
if (data && data.columns) {
|
|
|
|
const currencyColumns = data.columns;
|
2021-12-16 11:15:31 +00:00
|
|
|
const columnDefs = currencyColumns.map((name) => ({
|
2019-08-20 08:57:27 +00:00
|
|
|
label: name,
|
|
|
|
fieldname: name,
|
2021-12-16 11:15:31 +00:00
|
|
|
fieldtype: 'Currency',
|
2019-08-20 08:57:27 +00:00
|
|
|
}));
|
|
|
|
|
|
|
|
columns.push(...columnDefs);
|
|
|
|
}
|
|
|
|
|
|
|
|
return columns;
|
2021-12-16 11:15:31 +00:00
|
|
|
},
|
2019-08-20 08:57:27 +00:00
|
|
|
};
|