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' })" /> +