2
0
mirror of https://github.com/frappe/books.git synced 2024-11-14 01:14:03 +00:00
books/reports/generalLedger/GeneralLedger.js
Faris Ansari 1c1f72281e wip
2018-04-18 14:32:05 +05:30

26 lines
879 B
JavaScript

const frappe = require('frappejs');
class GeneralLedger {
async run(params) {
const filters = {};
if (params.account) filters.account = params.account;
if (params.party) filters.party = params.party;
if (params.referenceType) filters.referenceType = params.referenceType;
if (params.referenceName) filters.referenceName = params.referenceName;
if (params.fromDate) filters.date = ['>=', params.fromDate];
if (params.toDate) filters.date = ['<=', params.toDate];
let data = await frappe.db.getAll({
doctype: 'AccountingLedgerEntry',
fields: ['date', 'account', 'party', 'referenceType', 'referenceName', 'debit', 'credit'],
filters: filters
});
return data;
}
}
module.exports = function execute(params) {
return new GeneralLedger().run(params);
}