mirror of
https://github.com/frappe/books.git
synced 2024-11-10 07:40:55 +00:00
Removed extra indentation layer
This commit is contained in:
parent
65c4faf135
commit
94c350195c
@ -62,34 +62,36 @@ const IGST = {
|
|||||||
export async function generateGstr1Json(report, { transferType, toDate }) {
|
export async function generateGstr1Json(report, { transferType, toDate }) {
|
||||||
const printSettings = await frappe.getSingle('PrintSettings');
|
const printSettings = await frappe.getSingle('PrintSettings');
|
||||||
|
|
||||||
if (!printSettings.gstin) promptWhenGstUnavailable();
|
if (!printSettings.gstin) {
|
||||||
else {
|
promptWhenGstUnavailable();
|
||||||
const savePath = await getSavePath();
|
return;
|
||||||
if (!savePath) return;
|
|
||||||
|
|
||||||
const gstData = {
|
|
||||||
version: 'GST3.0.4',
|
|
||||||
hash: 'hash',
|
|
||||||
gstin: printSettings.gstin,
|
|
||||||
// fp is the the MMYYYY for the last month of the report
|
|
||||||
// for example if you are extracting report for 1st July 2020 to 31st September 2020 then
|
|
||||||
// fb = 092020
|
|
||||||
fp: DateTime.fromISO(toDate).toFormat('MMyyyy'),
|
|
||||||
};
|
|
||||||
|
|
||||||
// based condition we need to triggered different methods
|
|
||||||
if (transferType === 'B2B') {
|
|
||||||
gstData.b2b = await getB2bData(report.rows);
|
|
||||||
} else if (transferType === 'B2CL') {
|
|
||||||
gstData.b2cl = await getB2clData(report.rows);
|
|
||||||
} else if (transferType === 'B2CS') {
|
|
||||||
gstData.b2cs = await getB2csData(report.rows);
|
|
||||||
}
|
|
||||||
|
|
||||||
await sleep(1);
|
|
||||||
const jsonData = JSON.stringify(gstData);
|
|
||||||
makeJSON(jsonData, savePath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const savePath = await getSavePath();
|
||||||
|
if (!savePath) return;
|
||||||
|
|
||||||
|
const gstData = {
|
||||||
|
version: 'GST3.0.4',
|
||||||
|
hash: 'hash',
|
||||||
|
gstin: printSettings.gstin,
|
||||||
|
// fp is the the MMYYYY for the last month of the report
|
||||||
|
// for example if you are extracting report for 1st July 2020 to 31st September 2020 then
|
||||||
|
// fb = 092020
|
||||||
|
fp: DateTime.fromISO(toDate).toFormat('MMyyyy'),
|
||||||
|
};
|
||||||
|
|
||||||
|
// based condition we need to triggered different methods
|
||||||
|
if (transferType === 'B2B') {
|
||||||
|
gstData.b2b = await getB2bData(report.rows);
|
||||||
|
} else if (transferType === 'B2CL') {
|
||||||
|
gstData.b2cl = await getB2clData(report.rows);
|
||||||
|
} else if (transferType === 'B2CS') {
|
||||||
|
gstData.b2cs = await getB2csData(report.rows);
|
||||||
|
}
|
||||||
|
|
||||||
|
await sleep(1);
|
||||||
|
const jsonData = JSON.stringify(gstData);
|
||||||
|
makeJSON(jsonData, savePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getB2bData(invoices) {
|
async function getB2bData(invoices) {
|
||||||
|
Loading…
Reference in New Issue
Block a user