2018-04-19 14:31:35 +00:00
|
|
|
const frappe = require('frappejs');
|
|
|
|
const GeneralLedger = require('./GeneralLedger/GeneralLedger');
|
|
|
|
const ProfitAndLoss = require('./ProfitAndLoss/ProfitAndLoss');
|
2018-04-24 07:58:57 +00:00
|
|
|
const BalanceSheet = require('./BalanceSheet/BalanceSheet');
|
2018-04-27 11:33:36 +00:00
|
|
|
const TrialBalance = require('./TrialBalance/TrialBalance');
|
2018-04-26 10:23:27 +00:00
|
|
|
const SalesRegister = require('./SalesRegister/SalesRegister');
|
|
|
|
const PurchaseRegister = require('./PurchaseRegister/PurchaseRegister');
|
2019-02-18 05:42:04 +00:00
|
|
|
const BankReconciliation = require('./BankReconciliation/BankReconciliation');
|
|
|
|
const GoodsAndServiceTax = require('./GoodsAndServiceTax/GoodsAndServiceTax');
|
2018-04-29 09:07:59 +00:00
|
|
|
const AccountsReceivablePayable = require('./AccountsReceivablePayable/AccountsReceivablePayable');
|
2018-04-26 10:23:27 +00:00
|
|
|
|
2018-04-19 14:31:35 +00:00
|
|
|
// called on server side
|
|
|
|
function registerReportMethods() {
|
2019-02-18 05:42:04 +00:00
|
|
|
const reports = [{
|
2018-04-29 09:07:59 +00:00
|
|
|
method: 'general-ledger',
|
|
|
|
class: GeneralLedger
|
|
|
|
},
|
|
|
|
{
|
|
|
|
method: 'profit-and-loss',
|
|
|
|
class: ProfitAndLoss
|
|
|
|
},
|
|
|
|
{
|
|
|
|
method: 'balance-sheet',
|
|
|
|
class: BalanceSheet
|
|
|
|
},
|
|
|
|
{
|
|
|
|
method: 'trial-balance',
|
|
|
|
class: TrialBalance
|
|
|
|
},
|
|
|
|
{
|
|
|
|
method: 'sales-register',
|
|
|
|
class: SalesRegister
|
|
|
|
},
|
|
|
|
{
|
|
|
|
method: 'purchase-register',
|
|
|
|
class: PurchaseRegister
|
2019-02-18 05:42:04 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
method: 'bank-reconciliation',
|
|
|
|
class: BankReconciliation
|
|
|
|
},
|
|
|
|
{
|
|
|
|
method: 'gst-taxes',
|
|
|
|
class: GoodsAndServiceTax
|
|
|
|
},
|
2018-04-29 09:07:59 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
reports.forEach(report => {
|
|
|
|
frappe.registerMethod({
|
|
|
|
method: report.method,
|
|
|
|
handler: getReportData(report.class)
|
|
|
|
});
|
2018-04-27 11:33:36 +00:00
|
|
|
});
|
|
|
|
|
2018-04-26 10:23:27 +00:00
|
|
|
frappe.registerMethod({
|
2018-04-29 09:07:59 +00:00
|
|
|
method: 'accounts-receivable',
|
|
|
|
handler: args => new AccountsReceivablePayable().run('Receivable', args)
|
2018-04-26 10:23:27 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
frappe.registerMethod({
|
2018-04-29 09:07:59 +00:00
|
|
|
method: 'accounts-payable',
|
|
|
|
handler: args => new AccountsReceivablePayable().run('Payable', args)
|
2018-04-24 07:58:57 +00:00
|
|
|
});
|
2018-04-19 14:31:35 +00:00
|
|
|
}
|
|
|
|
|
2018-04-26 10:23:27 +00:00
|
|
|
function getReportData(ReportClass) {
|
|
|
|
return args => new ReportClass().run(args);
|
2018-04-19 14:31:35 +00:00
|
|
|
}
|
|
|
|
|
2018-04-28 14:53:30 +00:00
|
|
|
module.exports = registerReportMethods
|