mirror of
https://github.com/frappe/books.git
synced 2024-09-20 11:29:00 +00:00
30 lines
672 B
JavaScript
30 lines
672 B
JavaScript
const frappe = require('frappejs');
|
|
const { getData } = require('../financialStatements');
|
|
|
|
class ProfitAndLoss {
|
|
async run({ fromDate, toDate, periodicity }) {
|
|
|
|
let income = await getData({
|
|
rootType: 'Income',
|
|
balanceMustBe: 'Credit',
|
|
fromDate,
|
|
toDate,
|
|
periodicity
|
|
});
|
|
|
|
let expense = await getData({
|
|
rootType: 'Expense',
|
|
balanceMustBe: 'Debit',
|
|
fromDate,
|
|
toDate,
|
|
periodicity
|
|
});
|
|
|
|
return { income, expense };
|
|
}
|
|
}
|
|
|
|
module.exports = function execute(params) {
|
|
return new ProfitAndLoss().run(params);
|
|
}
|