From 163a25529bef4cec98fd10be296b1de9bc2f5ee7 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Fri, 26 Oct 2018 02:27:34 +0530 Subject: [PATCH] Add viewConfig for PnL and TB --- reports/ProfitAndLoss/viewConfig.js | 31 +++++++++++++++++++++++++++++ reports/TrialBalance/viewConfig.js | 22 ++++++++++++++++++++ reports/view.js | 4 +++- src/pages/Report.vue | 10 ++++++++-- 4 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 reports/ProfitAndLoss/viewConfig.js create mode 100644 reports/TrialBalance/viewConfig.js diff --git a/reports/ProfitAndLoss/viewConfig.js b/reports/ProfitAndLoss/viewConfig.js new file mode 100644 index 00000000..4ace5200 --- /dev/null +++ b/reports/ProfitAndLoss/viewConfig.js @@ -0,0 +1,31 @@ +const title = 'Profit and Loss'; +module.exports = { + title: title, + method: 'profit-and-loss', + filterFields: [ + { fieldtype: 'Date', fieldname: 'fromDate', label: 'From Date', required: 1 }, + { fieldtype: 'Date', fieldname: 'toDate', label: 'To Date', required: 1 }, + { + fieldtype: 'Select', options: ['Monthly', 'Quarterly', 'Half Yearly', 'Yearly'], + label: 'Periodicity', fieldname: 'periodicity', default: 'Monthly' + } + ], + 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; + } +}; diff --git a/reports/TrialBalance/viewConfig.js b/reports/TrialBalance/viewConfig.js new file mode 100644 index 00000000..239b1141 --- /dev/null +++ b/reports/TrialBalance/viewConfig.js @@ -0,0 +1,22 @@ +const title = 'Trial Balance'; +module.exports = { + title: title, + method: 'trial-balance', + filterFields: [ + { fieldtype: 'Date', fieldname: 'fromDate', label: 'From Date', required: 1 }, + { fieldtype: 'Date', fieldname: 'toDate', label: 'To Date', required: 1 } + ], + getColumns(data) { + const columns = [ + { label: 'Account', fieldtype: 'Data', fieldname: 'account', width: 340 }, + { label: 'Opening (Dr)', fieldtype: 'Currency', fieldname: 'openingDebit' }, + { label: 'Opening (Cr)', fieldtype: 'Currency', fieldname: 'openingCredit' }, + { label: 'Debit', fieldtype: 'Currency', fieldname: 'debit' }, + { label: 'Credit', fieldtype: 'Currency', fieldname: 'credit' }, + { label: 'Closing (Dr)', fieldtype: 'Currency', fieldname: 'closingDebit' }, + { label: 'Closing (Cr)', fieldtype: 'Currency', fieldname: 'closingCredit' } + ]; + + return columns; + } +}; diff --git a/reports/view.js b/reports/view.js index 1e14badf..fed283d4 100644 --- a/reports/view.js +++ b/reports/view.js @@ -1,4 +1,6 @@ module.exports = { 'general-ledger': require('./GeneralLedger/viewConfig'), - 'sales-register': require('./SalesRegister/viewConfig') + 'sales-register': require('./SalesRegister/viewConfig'), + 'profit-and-loss': require('./ProfitAndLoss/viewConfig'), + 'trial-balance': require('./TrialBalance/viewConfig') } diff --git a/src/pages/Report.vue b/src/pages/Report.vue index df67a75a..9be95544 100644 --- a/src/pages/Report.vue +++ b/src/pages/Report.vue @@ -9,16 +9,22 @@ description="List of all ledger entries booked against all accounts" @click="routeTo('general-ledger', { 'referenceType': 'Invoice' })" /> +