2
0
mirror of https://github.com/frappe/books.git synced 2024-09-20 11:29:00 +00:00
books/reports/ProfitAndLoss/ProfitAndLoss.js

30 lines
672 B
JavaScript
Raw Normal View History

2018-04-18 09:02:05 +00:00
const frappe = require('frappejs');
const { getData } = require('../financialStatements');
class ProfitAndLoss {
2018-04-19 14:31:35 +00:00
async run({ fromDate, toDate, periodicity }) {
2018-04-18 09:02:05 +00:00
let income = await getData({
rootType: 'Income',
2018-04-19 14:31:35 +00:00
balanceMustBe: 'Credit',
fromDate,
toDate,
periodicity
2018-04-18 09:02:05 +00:00
});
let expense = await getData({
rootType: 'Expense',
2018-04-19 14:31:35 +00:00
balanceMustBe: 'Debit',
fromDate,
toDate,
periodicity
2018-04-18 09:02:05 +00:00
});
2018-04-19 14:31:35 +00:00
return { income, expense };
2018-04-18 09:02:05 +00:00
}
}
module.exports = function execute(params) {
return new ProfitAndLoss().run(params);
}