2
0
mirror of https://github.com/frappe/books.git synced 2024-09-20 11:29:00 +00:00
books/reports/GeneralLedger/viewConfig.js
thefalconx33 e4c2bd3dda * New Account defaults & filters based on rootType
* Trial Balance: Parent accounts assumes child data
* Trial Balance: Tree View
2019-07-18 16:15:44 +05:30

124 lines
2.4 KiB
JavaScript

let title = 'General Ledger';
let filterFields = [
{
fieldtype: 'Select',
options: ['', 'Invoice', 'Payment'],
label: 'Reference Type',
fieldname: 'referenceType'
},
{
fieldtype: 'DynamicLink',
references: 'referenceType',
label: 'Reference Name',
fieldname: 'referenceName'
},
{
fieldtype: 'Link',
target: 'Account',
label: 'Account',
fieldname: 'account'
},
{
fieldtype: 'Link',
target: 'Party',
label: 'Party',
fieldname: 'party'
},
{
fieldtype: 'Date',
label: 'From Date',
fieldname: 'fromDate'
},
{
fieldtype: 'Date',
label: 'To Date',
fieldname: 'toDate'
}
];
const viewConfig = {
title,
filterFields,
method: 'general-ledger',
linkFields: [
{
label: 'Export',
type: 'primary',
action: async report => {
async function getReportDetails() {
let [rows, columns] = await report.getReportData(filterFields);
let columnData = columns.map(column => {
return {
id: column.id,
content: column.content,
checked: true
};
});
return {
title: title,
rows: rows,
columnData: columnData
};
}
report.$modal.show({
modalProps: {
title: `Export ${title}`,
noFooter: true
},
component: require('../../src/components/ExportWizard').default,
props: await getReportDetails()
});
}
},
{
label: 'Clear Filters',
type: 'secondary',
action: async report => {
await report.getReportData({});
}
}
],
getColumns() {
return [
{
label: 'Date',
fieldtype: 'Date'
},
{
label: 'Account',
fieldtype: 'Link'
},
{
label: 'Debit',
fieldtype: 'Currency'
},
{
label: 'Credit',
fieldtype: 'Currency'
},
{
label: 'Balance',
fieldtype: 'Currency'
},
{
label: 'Reference Type',
fieldtype: 'Data'
},
{
label: 'Reference Name',
fieldtype: 'Data'
},
{
label: 'Party',
fieldtype: 'Link'
},
{
label: 'Description',
fieldtype: 'Data'
}
];
}
};
module.exports = viewConfig;