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