2
0
mirror of https://github.com/frappe/books.git synced 2025-02-02 12:08:27 +00:00

Created the initial setup for GSTR-2 Report exporting as csv

This commit is contained in:
Piyush Singhania 2021-12-29 16:14:35 +05:30
parent 50a71749ee
commit 51b05adf44
5 changed files with 50 additions and 14 deletions

View File

@ -253,3 +253,22 @@ async function generateB2csData(invoices) {
return b2cs;
}
export async function generateGstr2Csv(getReportData) {
const { gstin } = frappe.AccountingSettings;
if (!gstin) {
showMessageDialog({
message: _('Export Failed'),
description: _('Please set GSTIN in General Settings.'),
});
return;
}
const {
rows,
filters: { transferType, toDate },
} = getReportData();
const { filePath, canceled } = await getSavePath('gstr-2', 'csv');
if (canceled || !filePath) return;
}

View File

@ -1,5 +1,4 @@
import { DateTime } from 'luxon';
import { generateGstr1Json } from '../../accounting/gst';
const transferTypeMap = {
B2B: 'B2B',
@ -44,17 +43,6 @@ export default {
default: () => DateTime.local().toISODate(),
},
],
actions: [
{
group: 'Export',
label: 'JSON',
type: 'primary',
action: async (report, filters) => {
generateGstr1Json(report, filters);
},
},
],
getColumns({ filters }) {
const columns = [
{

View File

@ -1,10 +1,22 @@
const title = 'GSTR 1';
import baseConfig from './BaseViewConfig';
import { generateGstr1Json } from '../../accounting/gst';
const actions = [
{
group: 'Export',
label: 'JSON',
type: 'primary',
action: async (report, filters) => {
generateGstr1Json(report, filters);
},
},
]
export default {
title: title,
method: 'gstr-1',
filterFields: baseConfig.filterFields,
actions: baseConfig.actions,
actions: actions,
getColumns: baseConfig.getColumns,
};

View File

@ -1,10 +1,22 @@
const title = 'GSTR 2';
import baseConfig from './BaseViewConfig';
import { generateGstr2Csv } from '../../accounting/gst';
const actions = [
{
group: 'Export',
label: 'CSV',
type: 'primary',
action: async (report, filters) => {
generateGstr2Csv(report, filters);
},
},
]
export default {
title: title,
method: 'gstr-2',
filterFields: baseConfig.filterFields,
actions: baseConfig.actions,
actions: actions,
getColumns: baseConfig.getColumns,
};

View File

@ -99,6 +99,11 @@ const config = {
label: _('GSTR1'),
route: '/report/gstr-1',
hidden: () => frappe.AccountingSettings.country !== 'India',
},
{
label: _('GSTR2'),
route: '/report/gstr-2',
hidden: () => frappe.AccountingSettings.country !== 'India',
}
],
},