2022-04-21 13:08:36 +00:00
|
|
|
import { t } from 'fyo';
|
2021-12-21 09:21:13 +00:00
|
|
|
import getCommonExportActions from '../commonExporter';
|
2022-04-21 13:08:36 +00:00
|
|
|
import { fyo } from 'src/initFyo';
|
2019-11-19 19:14:15 +00:00
|
|
|
|
2022-03-30 10:57:45 +00:00
|
|
|
const periodicityMap = {
|
|
|
|
Monthly: t`Monthly`,
|
|
|
|
Quarterly: t`Quarterly`,
|
|
|
|
'Half Yearly': t`Half Yearly`,
|
|
|
|
Yearly: t`Yearly`,
|
|
|
|
};
|
2021-11-04 10:31:26 +00:00
|
|
|
export default {
|
2022-03-30 10:57:45 +00:00
|
|
|
title: t`Balance Sheet`,
|
2019-08-20 08:57:27 +00:00
|
|
|
method: 'balance-sheet',
|
|
|
|
filterFields: [
|
|
|
|
{
|
|
|
|
fieldtype: 'Date',
|
|
|
|
fieldname: 'toDate',
|
|
|
|
size: 'small',
|
2022-03-30 10:57:45 +00:00
|
|
|
placeholder: t`To Date`,
|
2022-02-16 06:19:16 +00:00
|
|
|
label: t`To Date`,
|
2019-11-19 19:14:15 +00:00
|
|
|
required: 1,
|
|
|
|
default: async () => {
|
2022-04-21 13:08:36 +00:00
|
|
|
return (await fyo.doc.getSingle('AccountingSettings')).fiscalYearEnd;
|
2021-12-16 11:15:31 +00:00
|
|
|
},
|
2019-08-20 08:57:27 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
fieldtype: 'Select',
|
2022-03-30 10:57:45 +00:00
|
|
|
placeholder: t`Select Period`,
|
2019-08-20 08:57:27 +00:00
|
|
|
size: 'small',
|
2022-03-30 10:57:45 +00:00
|
|
|
options: Object.keys(periodicityMap),
|
|
|
|
map: periodicityMap,
|
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
|
|
|
};
|