2
0
mirror of https://github.com/frappe/books.git synced 2024-11-14 01:14:03 +00:00
books/reports/GoodsAndServiceTax/GSTR1.js

33 lines
985 B
JavaScript
Raw Normal View History

import BaseGSTR from './BaseGSTR';
class GSTR1 extends BaseGSTR {
async run(params) {
2019-08-14 07:43:49 +00:00
if (!Object.keys(params).length) return [];
let filters = {};
filters.cancelled = 0;
if (params.toDate || params.fromDate) {
filters.date = [];
2021-12-30 09:49:54 +00:00
if (params.place) filters.place = params.place;
if (params.toDate) filters.date.push('<=', params.toDate);
if (params.fromDate) filters.date.push('>=', params.fromDate);
}
const data = await this.getCompleteReport('GSTR-1', filters);
// prettier-ignore
const conditions = {
2021-12-09 14:12:18 +00:00
'B2B': row => row.gstin,
'B2CL': row => !row.gstin && !row.inState && row.invAmt >= 250000,
'B2CS': row => !row.gstin && (row.inState || row.invAmt < 250000),
'NR': row => (row.rate === 0), // this takes care of both nil rated, exempted goods
};
if (!params.transferType) return data;
return data.filter((row) => conditions[params.transferType](row));
}
}
export default GSTR1;