2
0
mirror of https://github.com/frappe/books.git synced 2024-11-08 23:00:56 +00:00

fix: GSTR reports, cashflow

This commit is contained in:
18alantom 2021-12-31 12:23:05 +05:30
parent b69505bdbb
commit 3d0e91d3f5
4 changed files with 17 additions and 15 deletions

View File

@ -1,6 +1,6 @@
import frappe from 'frappejs';
import { isPesa } from 'frappejs/utils';
import { DateTime } from 'luxon';
import { convertPesaValuesToFloat } from '../../src/utils';
export async function getData({
rootType,
@ -65,8 +65,8 @@ export async function getData({
}
});
convertToFloat(totalRow);
accounts.forEach(convertToFloat);
convertPesaValuesToFloat(totalRow);
accounts.forEach(convertPesaValuesToFloat);
return { accounts, totalRow, periodList };
}
@ -145,7 +145,7 @@ export async function getTrialBalance({ rootType, fromDate, toDate }) {
}
}
accounts.forEach(convertToFloat);
accounts.forEach(convertPesaValuesToFloat);
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 {
getData,
getTrialBalance,

View File

@ -1,5 +1,6 @@
import frappe from 'frappejs';
import { stateCodeMap } from '../../accounting/gst';
import { convertPesaValuesToFloat } from '../../src/utils';
class BaseGSTR {
async getCompleteReport(gstrType, filters) {
@ -30,6 +31,7 @@ class BaseGSTR {
});
}
tableData.forEach(convertPesaValuesToFloat);
return tableData;
} else {
return [];
@ -63,7 +65,7 @@ class BaseGSTR {
ledgerEntry.taxes?.forEach((tax) => {
row.rate += tax.rate;
const taxAmt = (tax.rate * ledgerEntry.netTotal) / 100;
const taxAmt = ledgerEntry.netTotal.percent(tax.rate);
switch (tax.account) {
case 'IGST': {

View File

@ -143,7 +143,7 @@ export default {
heatLine: 1,
},
tooltipOptions: {
formatTooltipY: (value) => frappe.format(value, 'Currency'),
formatTooltipY: (value) => frappe.format(value ?? 0, 'Currency'),
},
data: {
labels: periodList.map((p) => p.split(' ')[0]),

View File

@ -3,7 +3,7 @@ import Toast from '@/components/Toast';
import router from '@/router';
import { ipcRenderer } from 'electron';
import frappe from 'frappejs';
import { _ } from 'frappejs/utils';
import { isPesa, _ } from 'frappejs/utils';
import lodash from 'lodash';
import Vue from 'vue';
import { IPC_ACTIONS, IPC_MESSAGES } from './messages';
@ -387,3 +387,11 @@ export async function callInitializeMoneyMaker(currency) {
}
await frappe.initializeMoneyMaker(currency);
}
export function convertPesaValuesToFloat(obj) {
Object.keys(obj).forEach((key) => {
if (!isPesa(obj[key])) return;
obj[key] = obj[key].float;
});
}