2
0
mirror of https://github.com/frappe/books.git synced 2025-01-23 07:08:36 +00:00
books/reports/ProfitAndLoss/viewConfig.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

71 lines
1.6 KiB
JavaScript
Raw Normal View History

import frappe, { t } from 'fyo';
2021-12-21 14:51:13 +05:30
import getCommonExportActions from '../commonExporter';
2022-03-30 16:27:45 +05:30
const title = t`Profit and Loss`;
2022-03-30 16:27:45 +05:30
const periodicityMap = {
Monthly: t`Monthly`,
Quarterly: t`Quarterly`,
'Half Yearly': t`Half Yearly`,
Yearly: t`Yearly`,
};
export default {
2018-10-26 02:27:34 +05:30
title: title,
method: 'profit-and-loss',
treeView: true,
2018-10-26 02:27:34 +05:30
filterFields: [
{
fieldtype: 'Date',
fieldname: 'fromDate',
size: 'small',
2022-03-30 16:27:45 +05:30
placeholder: t`From Date`,
2022-02-16 11:49:16 +05:30
label: t`From Date`,
required: 1,
default: async () => {
return (await frappe.getSingle('AccountingSettings')).fiscalYearStart;
},
},
{
fieldtype: 'Date',
fieldname: 'toDate',
size: 'small',
2022-03-30 16:27:45 +05:30
placeholder: t`To Date`,
2022-02-16 11:49:16 +05:30
label: t`To Date`,
required: 1,
default: async () => {
return (await frappe.getSingle('AccountingSettings')).fiscalYearEnd;
},
},
{
fieldtype: 'Select',
size: 'small',
2022-03-30 16:27:45 +05:30
options: Object.keys(periodicityMap),
map: periodicityMap,
default: 'Monthly',
2022-02-16 11:49:16 +05:30
label: t`Periodicity`,
2022-03-30 16:27:45 +05:30
placeholder: t`Select Period...`,
fieldname: 'periodicity',
},
2018-10-26 02:27:34 +05:30
],
2021-12-21 14:51:13 +05:30
actions: getCommonExportActions('profit-and-loss'),
getColumns({ data }) {
2018-10-26 02:27:34 +05:30
const columns = [
2022-02-16 11:49:16 +05:30
{ label: t`Account`, fieldtype: 'Data', fieldname: 'account', width: 2 },
2018-10-26 02:27:34 +05:30
];
if (data && data.columns) {
const currencyColumns = data.columns;
const columnDefs = currencyColumns.map((name) => ({
2018-10-26 02:27:34 +05:30
label: name,
fieldname: name,
fieldtype: 'Currency',
width: 1,
2018-10-26 02:27:34 +05:30
}));
columns.push(...columnDefs);
}
return columns;
},
2018-10-26 02:27:34 +05:30
};