mirror of
https://github.com/frappe/books.git
synced 2024-11-09 23:30:56 +00:00
fix: GSTR reports, cashflow
This commit is contained in:
parent
b69505bdbb
commit
3d0e91d3f5
@ -1,6 +1,6 @@
|
|||||||
import frappe from 'frappejs';
|
import frappe from 'frappejs';
|
||||||
import { isPesa } from 'frappejs/utils';
|
|
||||||
import { DateTime } from 'luxon';
|
import { DateTime } from 'luxon';
|
||||||
|
import { convertPesaValuesToFloat } from '../../src/utils';
|
||||||
|
|
||||||
export async function getData({
|
export async function getData({
|
||||||
rootType,
|
rootType,
|
||||||
@ -65,8 +65,8 @@ export async function getData({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
convertToFloat(totalRow);
|
convertPesaValuesToFloat(totalRow);
|
||||||
accounts.forEach(convertToFloat);
|
accounts.forEach(convertPesaValuesToFloat);
|
||||||
|
|
||||||
return { accounts, totalRow, periodList };
|
return { accounts, totalRow, periodList };
|
||||||
}
|
}
|
||||||
@ -145,7 +145,7 @@ export async function getTrialBalance({ rootType, fromDate, toDate }) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
accounts.forEach(convertToFloat);
|
accounts.forEach(convertPesaValuesToFloat);
|
||||||
return accounts;
|
return accounts;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -299,14 +299,6 @@ async function getFiscalYear() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function convertToFloat(obj) {
|
|
||||||
Object.keys(obj).forEach((key) => {
|
|
||||||
if (!isPesa(obj[key])) return;
|
|
||||||
|
|
||||||
obj[key] = obj[key].float;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
getData,
|
getData,
|
||||||
getTrialBalance,
|
getTrialBalance,
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import frappe from 'frappejs';
|
import frappe from 'frappejs';
|
||||||
import { stateCodeMap } from '../../accounting/gst';
|
import { stateCodeMap } from '../../accounting/gst';
|
||||||
|
import { convertPesaValuesToFloat } from '../../src/utils';
|
||||||
|
|
||||||
class BaseGSTR {
|
class BaseGSTR {
|
||||||
async getCompleteReport(gstrType, filters) {
|
async getCompleteReport(gstrType, filters) {
|
||||||
@ -30,6 +31,7 @@ class BaseGSTR {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tableData.forEach(convertPesaValuesToFloat);
|
||||||
return tableData;
|
return tableData;
|
||||||
} else {
|
} else {
|
||||||
return [];
|
return [];
|
||||||
@ -63,7 +65,7 @@ class BaseGSTR {
|
|||||||
|
|
||||||
ledgerEntry.taxes?.forEach((tax) => {
|
ledgerEntry.taxes?.forEach((tax) => {
|
||||||
row.rate += tax.rate;
|
row.rate += tax.rate;
|
||||||
const taxAmt = (tax.rate * ledgerEntry.netTotal) / 100;
|
const taxAmt = ledgerEntry.netTotal.percent(tax.rate);
|
||||||
|
|
||||||
switch (tax.account) {
|
switch (tax.account) {
|
||||||
case 'IGST': {
|
case 'IGST': {
|
||||||
|
@ -143,7 +143,7 @@ export default {
|
|||||||
heatLine: 1,
|
heatLine: 1,
|
||||||
},
|
},
|
||||||
tooltipOptions: {
|
tooltipOptions: {
|
||||||
formatTooltipY: (value) => frappe.format(value, 'Currency'),
|
formatTooltipY: (value) => frappe.format(value ?? 0, 'Currency'),
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
labels: periodList.map((p) => p.split(' ')[0]),
|
labels: periodList.map((p) => p.split(' ')[0]),
|
||||||
|
10
src/utils.js
10
src/utils.js
@ -3,7 +3,7 @@ import Toast from '@/components/Toast';
|
|||||||
import router from '@/router';
|
import router from '@/router';
|
||||||
import { ipcRenderer } from 'electron';
|
import { ipcRenderer } from 'electron';
|
||||||
import frappe from 'frappejs';
|
import frappe from 'frappejs';
|
||||||
import { _ } from 'frappejs/utils';
|
import { isPesa, _ } from 'frappejs/utils';
|
||||||
import lodash from 'lodash';
|
import lodash from 'lodash';
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import { IPC_ACTIONS, IPC_MESSAGES } from './messages';
|
import { IPC_ACTIONS, IPC_MESSAGES } from './messages';
|
||||||
@ -387,3 +387,11 @@ export async function callInitializeMoneyMaker(currency) {
|
|||||||
}
|
}
|
||||||
await frappe.initializeMoneyMaker(currency);
|
await frappe.initializeMoneyMaker(currency);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function convertPesaValuesToFloat(obj) {
|
||||||
|
Object.keys(obj).forEach((key) => {
|
||||||
|
if (!isPesa(obj[key])) return;
|
||||||
|
|
||||||
|
obj[key] = obj[key].float;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user