2
0
mirror of https://github.com/frappe/books.git synced 2024-11-14 17:34:04 +00:00
books/reports/TrialBalance/TrialBalance.js

19 lines
565 B
JavaScript
Raw Normal View History

2018-04-27 11:33:36 +00:00
const frappe = require('frappejs');
const { getTrialBalance } = require('../FinancialStatements/FinancialStatements');
module.exports = class TrialBalance {
async run({ fromDate, toDate }) {
const promises = ['Asset', 'Expense', 'Income', 'Liability', 'Equity'].map(rootType => {
return getTrialBalance({ rootType, fromDate, toDate });
});
const values = await Promise.all(promises);
let rows = values.reduce((acc, curr) => {
return [...acc, ...curr];
}, []);
return { rows };
}
}