mirror of
https://github.com/frappe/books.git
synced 2024-11-14 01:14:03 +00:00
1a8a23d2a2
- refactor Common Js imports to ES6
77 lines
1.9 KiB
JavaScript
77 lines
1.9 KiB
JavaScript
import frappe from 'frappejs';
|
|
import GeneralLedger from './GeneralLedger/GeneralLedger';
|
|
import ProfitAndLoss from './ProfitAndLoss/ProfitAndLoss';
|
|
import BalanceSheet from './BalanceSheet/BalanceSheet';
|
|
import TrialBalance from './TrialBalance/TrialBalance';
|
|
import SalesRegister from './SalesRegister/SalesRegister';
|
|
import PurchaseRegister from './PurchaseRegister/PurchaseRegister';
|
|
import BankReconciliation from './BankReconciliation/BankReconciliation';
|
|
import GSTR1 from './GoodsAndServiceTax/GSTR1';
|
|
import GSTR2 from './GoodsAndServiceTax/GSTR2';
|
|
import AccountsReceivablePayable from './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);
|
|
}
|
|
|
|
export default registerReportMethods;
|