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