diff --git a/app/Http/Controllers/Wallets/WalletReportController.php b/app/Http/Controllers/Wallets/WalletReportController.php new file mode 100644 index 00000000..998bba53 --- /dev/null +++ b/app/Http/Controllers/Wallets/WalletReportController.php @@ -0,0 +1,29 @@ + [ + 'walletSum' => (float) Wallet::all()->sum('amount'), + 'outgoingSum' => (float) Transaction::where('type', TransactionType::PAYMENT)->where('owner_type', Wallet::class)->sum('amount'), + 'incomingSum' => (float) Transaction::whereIn('type', [TransactionType::TOP_UP, TransactionType::CREDIT_NOTE])->where('owner_type', Wallet::class)->sum('amount'), + ]] + ))->handler(); + } +} diff --git a/resources/assets/vue/components/wallets/elements/WalletsComponent.vue b/resources/assets/vue/components/wallets/elements/WalletsComponent.vue index 8f0daa9c..c37f0fba 100644 --- a/resources/assets/vue/components/wallets/elements/WalletsComponent.vue +++ b/resources/assets/vue/components/wallets/elements/WalletsComponent.vue @@ -1,122 +1,127 @@