2
0
mirror of https://github.com/frappe/books.git synced 2024-12-23 03:19:01 +00:00
books/reports/BalanceSheet/viewConfig.js
18alantom 27aed52044 incr: type some files, frappe -> fyo
- get books to serve albiet broken
- one step at a time
2022-05-23 16:18:22 +05:30

57 lines
1.3 KiB
JavaScript

import { t } from 'fyo';
import getCommonExportActions from '../commonExporter';
import { fyo } from 'src/initFyo';
const periodicityMap = {
Monthly: t`Monthly`,
Quarterly: t`Quarterly`,
'Half Yearly': t`Half Yearly`,
Yearly: t`Yearly`,
};
export default {
title: t`Balance Sheet`,
method: 'balance-sheet',
filterFields: [
{
fieldtype: 'Date',
fieldname: 'toDate',
size: 'small',
placeholder: t`To Date`,
label: t`To Date`,
required: 1,
default: async () => {
return (await fyo.doc.getSingle('AccountingSettings')).fiscalYearEnd;
},
},
{
fieldtype: 'Select',
placeholder: t`Select Period`,
size: 'small',
options: Object.keys(periodicityMap),
map: periodicityMap,
label: t`Periodicity`,
fieldname: 'periodicity',
default: 'Monthly',
},
],
actions: getCommonExportActions('balance-sheet'),
getColumns({ data }) {
const columns = [
{ label: t`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;
},
};