2019-07-30 12:02:49 +00:00
|
|
|
const title = 'GSTR 1';
|
2022-02-16 06:19:16 +00:00
|
|
|
import { t } from 'frappe';
|
|
|
|
import { generateGstr1Csv, generateGstr1Json } from '../../accounting/gst';
|
2021-11-04 10:31:26 +00:00
|
|
|
import baseConfig from './BaseViewConfig';
|
2021-12-29 10:44:35 +00:00
|
|
|
|
2022-01-10 13:24:32 +00:00
|
|
|
const transferTypeMap = {
|
|
|
|
B2B: 'B2B',
|
|
|
|
B2CL: 'B2C-Large',
|
|
|
|
B2CS: 'B2C-Small',
|
|
|
|
NR: 'Nil Rated, Exempted and Non GST supplies',
|
|
|
|
};
|
|
|
|
|
|
|
|
const transferType = {
|
|
|
|
fieldtype: 'Select',
|
2022-02-16 06:19:16 +00:00
|
|
|
label: t`Transfer Type`,
|
2022-01-10 13:24:32 +00:00
|
|
|
placeholder: 'Transfer Type',
|
|
|
|
fieldname: 'transferType',
|
|
|
|
options: Object.keys(transferTypeMap),
|
|
|
|
map: transferTypeMap,
|
|
|
|
default: 'B2B',
|
|
|
|
size: 'small',
|
|
|
|
};
|
|
|
|
|
2021-12-29 10:44:35 +00:00
|
|
|
const actions = [
|
|
|
|
{
|
|
|
|
group: 'Export',
|
2022-02-16 06:19:16 +00:00
|
|
|
label: t`JSON`,
|
2021-12-29 10:44:35 +00:00
|
|
|
type: 'primary',
|
|
|
|
action: async (report, filters) => {
|
|
|
|
generateGstr1Json(report, filters);
|
|
|
|
},
|
|
|
|
},
|
2022-01-12 16:56:40 +00:00
|
|
|
{
|
|
|
|
group: 'Export',
|
2022-02-16 06:19:16 +00:00
|
|
|
label: t`CSV`,
|
2022-01-12 16:56:40 +00:00
|
|
|
type: 'primary',
|
|
|
|
action: async (report, filters) => {
|
|
|
|
generateGstr1Csv(report, filters);
|
|
|
|
},
|
|
|
|
},
|
2022-02-16 06:19:16 +00:00
|
|
|
];
|
2021-12-08 18:43:19 +00:00
|
|
|
|
2021-11-04 10:31:26 +00:00
|
|
|
export default {
|
2019-07-30 12:02:49 +00:00
|
|
|
title: title,
|
|
|
|
method: 'gstr-1',
|
2022-01-10 13:24:32 +00:00
|
|
|
filterFields: [ transferType, ...baseConfig.filterFields],
|
2021-12-29 10:44:35 +00:00
|
|
|
actions: actions,
|
2021-12-08 18:43:19 +00:00
|
|
|
getColumns: baseConfig.getColumns,
|
2019-07-30 12:02:49 +00:00
|
|
|
};
|