diff --git a/reports/BalanceSheet/viewConfig.js b/reports/BalanceSheet/viewConfig.js index 82b7792f..2c01b7d5 100644 --- a/reports/BalanceSheet/viewConfig.js +++ b/reports/BalanceSheet/viewConfig.js @@ -1,3 +1,5 @@ +const frappe = require('frappejs'); + module.exports = { title: 'Balance Sheet', method: 'balance-sheet', @@ -8,7 +10,10 @@ module.exports = { size: 'small', placeholder: 'ToDate', label: 'To Date', - required: 1 + required: 1, + default: async () => { + return (await frappe.getSingle('AccountingSettings')).fiscalYearEnd; + } }, { fieldtype: 'Select', diff --git a/reports/GeneralLedger/GeneralLedger.js b/reports/GeneralLedger/GeneralLedger.js index 9531ec3c..874f463c 100644 --- a/reports/GeneralLedger/GeneralLedger.js +++ b/reports/GeneralLedger/GeneralLedger.js @@ -2,8 +2,6 @@ const frappe = require('frappejs'); class GeneralLedger { async run(params) { - if (!Object.keys(params).length) return []; - const filters = {}; if (params.account) filters.account = params.account; if (params.party) filters.party = params.party; @@ -39,7 +37,7 @@ class GeneralLedger { glEntries.push({ date: '', - account: 'Opening', + account: { template: 'Opening' }, party: '', debit: 0, credit: 0, @@ -56,7 +54,7 @@ class GeneralLedger { } glEntries.push({ date: '', - account: 'Total', + account: { template: 'Total' }, party: '', debit: debitTotal, credit: creditTotal, @@ -66,7 +64,7 @@ class GeneralLedger { }); glEntries.push({ date: '', - account: 'Closing', + account: { template: 'Closing' }, party: '', debit: debitTotal, credit: creditTotal, diff --git a/reports/GeneralLedger/viewConfig.js b/reports/GeneralLedger/viewConfig.js index bb2ffa5c..8263f10d 100644 --- a/reports/GeneralLedger/viewConfig.js +++ b/reports/GeneralLedger/viewConfig.js @@ -5,10 +5,16 @@ const viewConfig = { filterFields: [ { fieldtype: 'Select', - options: ['Select...', 'SalesInvoice', 'Payment', 'PurchaseInvoice'], + options: [ + { label: '', value: '' }, + { label: 'Sales Invoice', value: 'SalesInvoice' }, + { label: 'Payment', value: 'Payment' }, + { label: 'Purchase Invoice', value: 'PurchaseInvoice' } + ], size: 'small', label: 'Reference Type', - fieldname: 'referenceType' + fieldname: 'referenceType', + placeholder: 'Reference Type' }, { fieldtype: 'DynamicLink', diff --git a/reports/ProfitAndLoss/viewConfig.js b/reports/ProfitAndLoss/viewConfig.js index d8619397..b5c4be50 100644 --- a/reports/ProfitAndLoss/viewConfig.js +++ b/reports/ProfitAndLoss/viewConfig.js @@ -1,3 +1,5 @@ +const frappe = require('frappejs'); + const title = 'Profit and Loss'; module.exports = { title: title, @@ -10,7 +12,10 @@ module.exports = { size: 'small', placeholder: 'From Date', label: 'From Date', - required: 1 + required: 1, + default: async () => { + return (await frappe.getSingle('AccountingSettings')).fiscalYearStart; + } }, { fieldtype: 'Date', @@ -18,7 +23,10 @@ module.exports = { size: 'small', placeholder: 'To Date', label: 'To Date', - required: 1 + required: 1, + default: async () => { + return (await frappe.getSingle('AccountingSettings')).fiscalYearEnd; + } }, { fieldtype: 'Select', @@ -30,6 +38,7 @@ module.exports = { 'Half Yearly', 'Yearly' ], + default: 'Monthly', label: 'Periodicity', fieldname: 'periodicity' } diff --git a/reports/TrialBalance/viewConfig.js b/reports/TrialBalance/viewConfig.js index ee6eef6f..4da28909 100644 --- a/reports/TrialBalance/viewConfig.js +++ b/reports/TrialBalance/viewConfig.js @@ -1,3 +1,5 @@ +const frappe = require('frappejs'); + const title = 'Trial Balance'; module.exports = { title: title, @@ -10,7 +12,10 @@ module.exports = { label: 'From Date', size: 'small', placeholder: 'From Date', - required: 1 + required: 1, + default: async () => { + return (await frappe.getSingle('AccountingSettings')).fiscalYearStart; + } }, { fieldtype: 'Date', @@ -18,7 +23,10 @@ module.exports = { placeholder: 'To Date', fieldname: 'toDate', label: 'To Date', - required: 1 + required: 1, + default: async () => { + return (await frappe.getSingle('AccountingSettings')).fiscalYearEnd; + } } ], linkFields: [ diff --git a/src/pages/Report.vue b/src/pages/Report.vue index 01689cfa..519fac77 100644 --- a/src/pages/Report.vue +++ b/src/pages/Report.vue @@ -1,19 +1,39 @@