2
0
mirror of https://github.com/frappe/books.git synced 2024-11-14 01:14:03 +00:00
books/reports/index.js
thefalconx33 ed164a492e - GSTR1, GSTR2, GSTR3B Reports
- Message Dialog
- Handle Error in Form Submit and Revert
- Report Filter Custom Doc
2019-07-30 17:32:49 +05:30

77 lines
1.9 KiB
JavaScript

const frappe = require('frappejs');
const GeneralLedger = require('./GeneralLedger/GeneralLedger');
const ProfitAndLoss = require('./ProfitAndLoss/ProfitAndLoss');
const BalanceSheet = require('./BalanceSheet/BalanceSheet');
const TrialBalance = require('./TrialBalance/TrialBalance');
const SalesRegister = require('./SalesRegister/SalesRegister');
const PurchaseRegister = require('./PurchaseRegister/PurchaseRegister');
const BankReconciliation = require('./BankReconciliation/BankReconciliation');
const GSTR1 = require('./GoodsAndServiceTax/GSTR1');
const GSTR2 = require('./GoodsAndServiceTax/GSTR2');
const AccountsReceivablePayable = require('./AccountsReceivablePayable/AccountsReceivablePayable');
// called on server side
function registerReportMethods() {
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
}
];
reports.forEach(report => {
frappe.registerMethod({
method: report.method,
handler: getReportData(report.class)
});
});
frappe.registerMethod({
method: 'accounts-receivable',
handler: args => new AccountsReceivablePayable().run('Receivable', args)
});
frappe.registerMethod({
method: 'accounts-payable',
handler: args => new AccountsReceivablePayable().run('Payable', args)
});
}
function getReportData(ReportClass) {
return args => new ReportClass().run(args);
}
module.exports = registerReportMethods;