2
0
mirror of https://github.com/frappe/books.git synced 2024-09-20 03:29:00 +00:00
books/reports/GoodsAndServiceTax/GSTR2.js
thefalconx33 ed164a492e - GSTR1, GSTR2, GSTR3B Reports
- Message Dialog
- Handle Error in Form Submit and Revert
- Report Filter Custom Doc
2019-07-30 17:32:49 +05:30

27 lines
778 B
JavaScript

const BaseGSTR = require('./BaseGSTR');
class GSTR2 extends BaseGSTR {
async run(params) {
let filters = {};
if (params.toDate || params.fromDate) {
filters.date = [];
if (params.toDate) filters.date.push('<=', params.toDate);
if (params.fromDate) filters.date.push('>=', params.fromDate);
}
const data = await this.getCompleteReport('GSTR-2', filters);
const conditions = {
B2B: row => row.gstin,
'B2C-Large': row => !row.gstin && !row.inState && row.invAmt >= 250000,
'B2C-Small': row =>
!row.gstin && (row.inState || (row.inState && row.invAmt < 250000))
};
if (!params.transferType) return data;
return data.filter(row => conditions[params.transferType](row));
}
}
module.exports = GSTR2;