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');
|
2019-07-30 12:02:49 +00:00
|
|
|
const GSTR1 = require('./GoodsAndServiceTax/GSTR1');
|
|
|
|
const GSTR2 = require('./GoodsAndServiceTax/GSTR2');
|
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-07-30 12:02:49 +00:00
|
|
|
const reports = [
|
|
|
|
{
|
|
|
|
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
|
|
|
|
},
|
|
|
|
{
|
|
|
|
method: 'bank-reconciliation',
|
|
|
|
class: BankReconciliation
|
|
|
|
},
|
|
|
|
{
|
|
|
|
method: 'gstr-1',
|
|
|
|
class: GSTR1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
method: 'gstr-2',
|
|
|
|
class: GSTR2
|
|
|
|
}
|
|
|
|
];
|
2018-04-27 11:33:36 +00:00
|
|
|
|
2019-07-30 12:02:49 +00:00
|
|
|
reports.forEach(report => {
|
2018-04-26 10:23:27 +00:00
|
|
|
frappe.registerMethod({
|
2019-07-30 12:02:49 +00:00
|
|
|
method: report.method,
|
|
|
|
handler: getReportData(report.class)
|
2018-04-26 10:23:27 +00:00
|
|
|
});
|
2019-07-30 12:02:49 +00:00
|
|
|
});
|
2018-04-26 10:23:27 +00:00
|
|
|
|
2019-07-30 12:02:49 +00:00
|
|
|
frappe.registerMethod({
|
|
|
|
method: 'accounts-receivable',
|
|
|
|
handler: args => new AccountsReceivablePayable().run('Receivable', args)
|
|
|
|
});
|
|
|
|
|
|
|
|
frappe.registerMethod({
|
|
|
|
method: 'accounts-payable',
|
|
|
|
handler: args => new AccountsReceivablePayable().run('Payable', args)
|
|
|
|
});
|
2018-04-19 14:31:35 +00:00
|
|
|
}
|
|
|
|
|
2018-04-26 10:23:27 +00:00
|
|
|
function getReportData(ReportClass) {
|
2019-07-30 12:02:49 +00:00
|
|
|
return args => new ReportClass().run(args);
|
2018-04-19 14:31:35 +00:00
|
|
|
}
|
|
|
|
|
2019-07-30 12:02:49 +00:00
|
|
|
module.exports = registerReportMethods;
|