2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 15:50:56 +00:00
books/reports/index.js

71 lines
2.1 KiB
JavaScript
Raw Normal View History

2018-04-19 14:31:35 +00:00
const frappe = require('frappejs');
const GeneralLedger = require('./GeneralLedger/GeneralLedger');
const ProfitAndLoss = require('./ProfitAndLoss/ProfitAndLoss');
const BalanceSheet = require('./BalanceSheet/BalanceSheet');
2018-04-27 11:33:36 +00:00
const TrialBalance = require('./TrialBalance/TrialBalance');
const SalesRegister = require('./SalesRegister/SalesRegister');
const PurchaseRegister = require('./PurchaseRegister/PurchaseRegister');
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-19 14:31:35 +00:00
// called on server side
function registerReportMethods() {
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
},
{
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
});
frappe.registerMethod({
2018-04-29 09:07:59 +00:00
method: 'accounts-receivable',
handler: args => new AccountsReceivablePayable().run('Receivable', args)
});
frappe.registerMethod({
2018-04-29 09:07:59 +00:00
method: 'accounts-payable',
handler: args => new AccountsReceivablePayable().run('Payable', args)
});
2018-04-19 14:31:35 +00:00
}
function getReportData(ReportClass) {
return args => new ReportClass().run(args);
2018-04-19 14:31:35 +00:00
}
module.exports = registerReportMethods