mirror of
https://github.com/frappe/books.git
synced 2025-01-24 15:48:25 +00:00
Separate client and server files for report
This commit is contained in:
parent
9fed2fbb19
commit
a5b4b81051
@ -1,5 +1,5 @@
|
|||||||
const frappe = require('frappejs');
|
const frappe = require('frappejs');
|
||||||
const { registerReportRoutes } = require('../reports');
|
const registerReportRoutes = require('../reports/view');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
start() {
|
start() {
|
||||||
|
@ -1,22 +1,10 @@
|
|||||||
const frappe = require('frappejs');
|
const frappe = require('frappejs');
|
||||||
|
|
||||||
const GeneralLedger = require('./GeneralLedger/GeneralLedger');
|
const GeneralLedger = require('./GeneralLedger/GeneralLedger');
|
||||||
const GeneralLedgerView = require('../reports/generalLedger/GeneralLedgerView');
|
|
||||||
|
|
||||||
const ProfitAndLoss = require('./ProfitAndLoss/ProfitAndLoss');
|
const ProfitAndLoss = require('./ProfitAndLoss/ProfitAndLoss');
|
||||||
const ProfitAndLossView = require('./ProfitAndLoss/ProfitAndLossView');
|
|
||||||
|
|
||||||
const BalanceSheet = require('./BalanceSheet/BalanceSheet');
|
const BalanceSheet = require('./BalanceSheet/BalanceSheet');
|
||||||
const BalanceSheetView = require('./BalanceSheet/BalanceSheetView');
|
|
||||||
|
|
||||||
const TrialBalance = require('./TrialBalance/TrialBalance');
|
const TrialBalance = require('./TrialBalance/TrialBalance');
|
||||||
const TrialBalanceView = require('./TrialBalance/TrialBalanceView');
|
|
||||||
|
|
||||||
const SalesRegister = require('./SalesRegister/SalesRegister');
|
const SalesRegister = require('./SalesRegister/SalesRegister');
|
||||||
const SalesRegisterView = require('./SalesRegister/SalesRegisterView');
|
|
||||||
|
|
||||||
const PurchaseRegister = require('./PurchaseRegister/PurchaseRegister');
|
const PurchaseRegister = require('./PurchaseRegister/PurchaseRegister');
|
||||||
const PurchaseRegisterView = require('./PurchaseRegister/PurchaseRegisterView');
|
|
||||||
|
|
||||||
// called on server side
|
// called on server side
|
||||||
function registerReportMethods() {
|
function registerReportMethods() {
|
||||||
@ -51,56 +39,8 @@ function registerReportMethods() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// called on client side
|
|
||||||
function registerReportRoutes() {
|
|
||||||
frappe.router.add('report/general-ledger', async (params) => {
|
|
||||||
if (!frappe.views.GeneralLedger) {
|
|
||||||
frappe.views.GeneralLedger = new GeneralLedgerView();
|
|
||||||
}
|
|
||||||
await frappe.views.GeneralLedger.show(params);
|
|
||||||
});
|
|
||||||
|
|
||||||
frappe.router.add('report/profit-and-loss', async (params) => {
|
|
||||||
if (!frappe.views.ProfitAndLoss) {
|
|
||||||
frappe.views.ProfitAndLoss = new ProfitAndLossView();
|
|
||||||
}
|
|
||||||
await frappe.views.ProfitAndLoss.show(params);
|
|
||||||
});
|
|
||||||
|
|
||||||
frappe.router.add('report/balance-sheet', async (params) => {
|
|
||||||
if (!frappe.views.BalanceSheet) {
|
|
||||||
frappe.views.BalanceSheet = new BalanceSheetView();
|
|
||||||
}
|
|
||||||
await frappe.views.BalanceSheet.show(params);
|
|
||||||
});
|
|
||||||
|
|
||||||
frappe.router.add('report/trial-balance', async (params) => {
|
|
||||||
if (!frappe.views.TrialBalance) {
|
|
||||||
frappe.views.TrialBalance = new TrialBalanceView();
|
|
||||||
}
|
|
||||||
await frappe.views.TrialBalance.show(params);
|
|
||||||
});
|
|
||||||
|
|
||||||
frappe.router.add('report/sales-register', async (params) => {
|
|
||||||
if (!frappe.views.SalesRegister) {
|
|
||||||
frappe.views.SalesRegister = new SalesRegisterView();
|
|
||||||
}
|
|
||||||
await frappe.views.SalesRegister.show(params);
|
|
||||||
});
|
|
||||||
|
|
||||||
frappe.router.add('report/purchase-register', async (params) => {
|
|
||||||
if (!frappe.views.PurchaseRegister) {
|
|
||||||
frappe.views.PurchaseRegister = new PurchaseRegisterView();
|
|
||||||
}
|
|
||||||
await frappe.views.PurchaseRegister.show(params);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getReportData(ReportClass) {
|
function getReportData(ReportClass) {
|
||||||
return args => new ReportClass().run(args);
|
return args => new ReportClass().run(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = registerReportMethods
|
||||||
registerReportMethods,
|
|
||||||
registerReportRoutes
|
|
||||||
}
|
|
||||||
|
54
reports/view.js
Normal file
54
reports/view.js
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
const frappe = require('frappejs');
|
||||||
|
const GeneralLedgerView = require('../reports/generalLedger/GeneralLedgerView');
|
||||||
|
const ProfitAndLossView = require('./ProfitAndLoss/ProfitAndLossView');
|
||||||
|
const BalanceSheetView = require('./BalanceSheet/BalanceSheetView');
|
||||||
|
const TrialBalanceView = require('./TrialBalance/TrialBalanceView');
|
||||||
|
const SalesRegisterView = require('./SalesRegister/SalesRegisterView');
|
||||||
|
const PurchaseRegisterView = require('./PurchaseRegister/PurchaseRegisterView');
|
||||||
|
|
||||||
|
// called on client side
|
||||||
|
function registerReportRoutes() {
|
||||||
|
frappe.router.add('report/general-ledger', async (params) => {
|
||||||
|
if (!frappe.views.GeneralLedger) {
|
||||||
|
frappe.views.GeneralLedger = new GeneralLedgerView();
|
||||||
|
}
|
||||||
|
await frappe.views.GeneralLedger.show(params);
|
||||||
|
});
|
||||||
|
|
||||||
|
frappe.router.add('report/profit-and-loss', async (params) => {
|
||||||
|
if (!frappe.views.ProfitAndLoss) {
|
||||||
|
frappe.views.ProfitAndLoss = new ProfitAndLossView();
|
||||||
|
}
|
||||||
|
await frappe.views.ProfitAndLoss.show(params);
|
||||||
|
});
|
||||||
|
|
||||||
|
frappe.router.add('report/balance-sheet', async (params) => {
|
||||||
|
if (!frappe.views.BalanceSheet) {
|
||||||
|
frappe.views.BalanceSheet = new BalanceSheetView();
|
||||||
|
}
|
||||||
|
await frappe.views.BalanceSheet.show(params);
|
||||||
|
});
|
||||||
|
|
||||||
|
frappe.router.add('report/trial-balance', async (params) => {
|
||||||
|
if (!frappe.views.TrialBalance) {
|
||||||
|
frappe.views.TrialBalance = new TrialBalanceView();
|
||||||
|
}
|
||||||
|
await frappe.views.TrialBalance.show(params);
|
||||||
|
});
|
||||||
|
|
||||||
|
frappe.router.add('report/sales-register', async (params) => {
|
||||||
|
if (!frappe.views.SalesRegister) {
|
||||||
|
frappe.views.SalesRegister = new SalesRegisterView();
|
||||||
|
}
|
||||||
|
await frappe.views.SalesRegister.show(params);
|
||||||
|
});
|
||||||
|
|
||||||
|
frappe.router.add('report/purchase-register', async (params) => {
|
||||||
|
if (!frappe.views.PurchaseRegister) {
|
||||||
|
frappe.views.PurchaseRegister = new PurchaseRegisterView();
|
||||||
|
}
|
||||||
|
await frappe.views.PurchaseRegister.show(params);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = registerReportRoutes;
|
@ -5,7 +5,7 @@ global.rootRequire = function(name) {
|
|||||||
const server = require('frappejs/server');
|
const server = require('frappejs/server');
|
||||||
const frappe = require('frappejs');
|
const frappe = require('frappejs');
|
||||||
const naming = require('frappejs/model/naming');
|
const naming = require('frappejs/model/naming');
|
||||||
const { registerReportMethods } = require('../reports');
|
const registerReportMethods = require('../reports');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
async start() {
|
async start() {
|
||||||
|
1192
www/dist/js/bundle.js
vendored
1192
www/dist/js/bundle.js
vendored
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user