Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Updated code.
James Cole86d454987437
diff --git a/app/Support/Http/Api/ConvertsExchangeRates.php b/app/Support/Http/Api/ConvertsExchangeRates.phpindex e56c64a909..a4c6a04f8d 100644--- a/app/Support/Http/Api/ConvertsExchangeRates.php+++ b/app/Support/Http/Api/ConvertsExchangeRates.php@@ -260,7 +260,7 @@ trait ConvertsExchangeRates*/private function getPreference(): void{- $this->enabled = false;+ $this->enabled = true;}}diff --git a/frontend/src/components/dashboard/AccountChart.vue b/frontend/src/components/dashboard/AccountChart.vueindex 89cf6a4172..d48b45589f 100644--- a/frontend/src/components/dashboard/AccountChart.vue+++ b/frontend/src/components/dashboard/AccountChart.vue@@ -19,7 +19,6 @@--><template>- <!-- --><div class="q-mt-sm q-mr-sm"><q-card bordered><q-item>@@ -31,9 +30,7 @@<ApexChart ref="chart" height="350" type="line" :options="options" :series="series"></ApexChart></q-card></div>-<div>-</div></template>@@ -110,8 +107,15 @@ export default {},methods: {numberFormatter: function (value, index) {- let currencyCode = this.currencies[index] ?? 'EUR';- return Intl.NumberFormat(this.locale, {style: 'currency', currency: currencyCode}).format(value);+ if(index instanceof Object) {+ let currencyCode = this.currencies[index.seriesIndex] ?? 'EUR';+ return Intl.NumberFormat(this.locale, {style: 'currency', currency: currencyCode}).format(value);+ }+ if(Number.isInteger(index)) {+ let currencyCode = this.currencies[index] ?? 'EUR';+ return Intl.NumberFormat(this.locale, {style: 'currency', currency: currencyCode}).format(value);+ }+ return 'x';},buildChart: function () {console.log('buildChart');@@ -130,6 +134,7 @@ export default {}},generateSeries: function (data) {+ console.log('generateSeries');this.series = [];let series;for (let i in data) {@@ -137,7 +142,12 @@ export default {series = {};series.name = data[i].label;series.data = [];- this.currencies.push(data[i].currency_code);+ if(!data[i].converted) {+ this.currencies.push(data[i].currency_code);+ }+ if(data[i].converted) {+ this.currencies.push(data[i].native_code);+ }for (let ii in data[i].entries) {series.data.push(data[i].entries[ii]);}diff --git a/frontend/src/components/dashboard/BillInsightBox.vue b/frontend/src/components/dashboard/BillInsightBox.vueindex 69192c6083..664cdba1fe 100644--- a/frontend/src/components/dashboard/BillInsightBox.vue+++ b/frontend/src/components/dashboard/BillInsightBox.vue@@ -130,19 +130,22 @@ export default {for (let i in data) {if (data.hasOwnProperty(i)) {const current = data[i];- const hasNative = current.native_id !== current.id && current.native_sum !== '0';+ const hasNative = current.converted && current.native_id !== current.id && parseFloat(current.native_sum) !== 0.0;this.unpaid.push({sum: current.sum,code: current.code,- native_sum: current.native_sum,- native_code: current.native_code,+ native_sum: current.converted ? current.native_sum : current.sum,+ native_code: current.converted ? current.native_code : current.code,native: hasNative,});- if (hasNative || current.native_id === current.id) {+ if (current.converted && (hasNative || current.native_id === current.id)) {this.unpaidAmount = this.unpaidAmount + parseFloat(current.native_sum);}+ if (!current.converted) {+ this.unpaidAmount = this.unpaidAmount + parseFloat(current.sum);+ }}}},@@ -150,19 +153,22 @@ export default {for (let i in data) {if (data.hasOwnProperty(i)) {const current = data[i];- const hasNative = current.native_id !== current.id && parseFloat(current.native_sum) !== 0.0;+ const hasNative = current.converted && current.native_id !== current.id && parseFloat(current.native_sum) !== 0.0;this.paid.push({sum: current.sum,code: current.code,- native_sum: current.native_sum,- native_code: current.native_code,+ native_sum: current.converted ? current.native_sum : current.sum,+ native_code: current.converted ? current.native_code : current.code,native: hasNative,});- if (hasNative || current.native_id === current.id) {+ if (current.converted && (hasNative || current.native_id === current.id)) {this.paidAmount = this.paidAmount + (parseFloat(current.native_sum) * -1);}+ if (!current.converted) {+ this.paidAmount = this.paidAmount + (parseFloat(current.sum) * -1);+ }}}}diff --git a/frontend/src/components/dashboard/NetWorthInsightBox.vue b/frontend/src/components/dashboard/NetWorthInsightBox.vueindex 2b9ba204ef..9a837c5e58 100644--- a/frontend/src/components/dashboard/NetWorthInsightBox.vue+++ b/frontend/src/components/dashboard/NetWorthInsightBox.vue@@ -101,17 +101,20 @@ export default {continue;}- const hasNative = current.native_id !== current.id && current.native_sum !== '0';- if (hasNative || current.native_id === current.id) {+ const hasNative = current.converted && current.native_id !== current.id && parseFloat(current.native_sum) !== 0.0;+ if (current.converted && (hasNative || current.native_id === current.id)) {this.primary = this.primary + parseFloat(current.native_sum);}+ if (!current.converted) {+ this.primary = this.primary + parseFloat(current.sum);+ }this.netWorth.push({sum: current.sum,code: current.code,- native_sum: current.native_sum,- native_code: current.native_code,+ native_sum: current.converted ? current.native_sum : current.sum,+ native_code: current.converted ? current.native_code : current.code,native: hasNative,});diff --git a/frontend/src/components/dashboard/SpendInsightBox.vue b/frontend/src/components/dashboard/SpendInsightBox.vueindex 94b76b897a..3b624a34d2 100644--- a/frontend/src/components/dashboard/SpendInsightBox.vue+++ b/frontend/src/components/dashboard/SpendInsightBox.vue@@ -131,19 +131,22 @@ export default {for (let i in data) {if (data.hasOwnProperty(i)) {const current = data[i];- const hasNative = current.native_id !== current.id && parseFloat(current.native_sum) !== 0.0;+ const hasNative = current.converted && current.native_id !== current.id && parseFloat(current.native_sum) !== 0.0;this.budgeted.push({sum: current.sum,code: current.code,- native_sum: current.native_sum,- native_code: current.native_code,+ native_sum: current.converted ? current.native_sum : current.sum,+ native_code: current.converted ? current.native_code : current.code,native: hasNative});- if (hasNative || current.native_id === current.id) {+ if (current.converted && (hasNative || current.native_id === current.id)) {this.budgetedAmount = this.budgetedAmount + parseFloat(current.native_sum);}+ if (!current.converted) {+ this.budgetedAmount = this.budgetedAmount + parseFloat(current.sum);+ }}}},@@ -151,19 +154,22 @@ export default {for (let i in data) {if (data.hasOwnProperty(i)) {const current = data[i];- const hasNative = current.native_id !== current.id && parseFloat(current.native_sum) !== 0.0;+ const hasNative = current.converted && current.native_id !== current.id && parseFloat(current.native_sum) !== 0.0;this.spent.push({sum: current.sum,code: current.code,- native_sum: current.native_sum,- native_code: current.native_code,+ native_sum: current.converted ? current.native_sum : current.sum,+ native_code: current.converted ? current.native_code : current.code,native: hasNative});- if (hasNative || current.native_id === current.id) {+ if (current.converted && (hasNative || current.native_id === current.id)) {this.spentAmount = this.spentAmount + (parseFloat(current.native_sum) * -1);}+ if (!current.converted) {+ this.spentAmount = this.spentAmount + (parseFloat(current.sum) * -1);+ }}}},diff --git a/frontend/src/pages/dashboard/Dashboard.vue b/frontend/src/pages/dashboard/Dashboard.vueindex c7d0cf5699..27b807acd1 100644--- a/frontend/src/pages/dashboard/Dashboard.vue+++ b/frontend/src/pages/dashboard/Dashboard.vue@@ -94,7 +94,7 @@ export default {name: "Dashboard",components: {AccountChart: defineAsyncComponent(() => import('../../components/dashboard/AccountChart.vue')),- NetWorthInsightBox: defineAsyncComponent(() => import('../../components/dashboard/BillInsightBox.vue')),+ NetWorthInsightBox: defineAsyncComponent(() => import('../../components/dashboard/NetWorthInsightBox.vue')),BillInsightBox: defineAsyncComponent(() => import('../../components/dashboard/BillInsightBox.vue')),SpendInsightBox: defineAsyncComponent(() => import('../../components/dashboard/SpendInsightBox.vue')),}