mirror of
https://github.com/frappe/books.git
synced 2024-11-14 09:24:04 +00:00
42 lines
1.0 KiB
JavaScript
42 lines
1.0 KiB
JavaScript
|
const ReportPage = require('frappejs/client/desk/reportpage');
|
||
|
const frappe = require('frappejs');
|
||
|
const { unique } = require('frappejs/utils');
|
||
|
|
||
|
module.exports = class FinancialStatementsView extends ReportPage {
|
||
|
constructor(opts) {
|
||
|
super({
|
||
|
title: opts.title,
|
||
|
filterFields: opts.filterFields
|
||
|
});
|
||
|
|
||
|
this.method = opts.method;
|
||
|
this.datatableOptions = {
|
||
|
treeView: true,
|
||
|
layout: 'fixed'
|
||
|
}
|
||
|
}
|
||
|
|
||
|
getRowsForDataTable(data) {
|
||
|
return data.rows || [];
|
||
|
}
|
||
|
|
||
|
getColumns(data) {
|
||
|
const columns = [
|
||
|
{ label: 'Account', fieldtype: 'Data', fieldname: 'account', width: 340 }
|
||
|
];
|
||
|
|
||
|
if (data && data.columns) {
|
||
|
const currencyColumns = data.columns;
|
||
|
const columnDefs = currencyColumns.map(name => ({
|
||
|
label: name,
|
||
|
fieldname: name,
|
||
|
fieldtype: 'Currency'
|
||
|
}));
|
||
|
|
||
|
columns.push(...columnDefs);
|
||
|
}
|
||
|
|
||
|
return columns;
|
||
|
}
|
||
|
}
|