From 12b226a828d2d0deb6071f884e24f2b461ed867f Mon Sep 17 00:00:00 2001 From: omair saleh Date: Thu, 10 Nov 2022 12:04:18 +0800 Subject: [PATCH 1/6] hide smc and khc from incomplete po --- .../Eloquent/Filters/CompanyIdNotIn.php | 20 +++++++++++++++++++ .../views/pages/purchase_orders.blade.php | 8 ++++---- 2 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 app/Classes/General/Eloquent/Filters/CompanyIdNotIn.php diff --git a/app/Classes/General/Eloquent/Filters/CompanyIdNotIn.php b/app/Classes/General/Eloquent/Filters/CompanyIdNotIn.php new file mode 100644 index 00000000..bde6e0ea --- /dev/null +++ b/app/Classes/General/Eloquent/Filters/CompanyIdNotIn.php @@ -0,0 +1,20 @@ +whereNotIn('company_id', $value); + } + +} diff --git a/resources/views/pages/purchase_orders.blade.php b/resources/views/pages/purchase_orders.blade.php index c8786537..c3783022 100644 --- a/resources/views/pages/purchase_orders.blade.php +++ b/resources/views/pages/purchase_orders.blade.php @@ -93,28 +93,28 @@
- +
- +
- +
- + From 62657e511cb878f3723d130971cd592c3ae7d914 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Thu, 10 Nov 2022 17:42:14 +0800 Subject: [PATCH 2/6] fix wallet insufficient balance when amount is below 0.01 --- .../Bookings/ControllersLogic/CreateBookingPaymentLogic.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Classes/Modules/Bookings/ControllersLogic/CreateBookingPaymentLogic.php b/app/Classes/Modules/Bookings/ControllersLogic/CreateBookingPaymentLogic.php index d4ba9807..0f6a8525 100644 --- a/app/Classes/Modules/Bookings/ControllersLogic/CreateBookingPaymentLogic.php +++ b/app/Classes/Modules/Bookings/ControllersLogic/CreateBookingPaymentLogic.php @@ -129,7 +129,7 @@ class CreateBookingPaymentLogic extends AbstractControllerLogic /** @var Wallet $wallet */ $wallet = $booking->company->wallets()->first(); - if(round($wallet->amount) < round($amount, 2)){ + if(($wallet->amount - $amount) < 0.01){ throw new MalformedRequestException('Insufficient wallet balance. Please Top up your wallet.'); } @@ -161,4 +161,4 @@ class CreateBookingPaymentLogic extends AbstractControllerLogic } -} \ No newline at end of file +} From f8ec4815a703871c5ec4a925d80be8bf502466fc Mon Sep 17 00:00:00 2001 From: omair saleh Date: Thu, 10 Nov 2022 17:48:47 +0800 Subject: [PATCH 3/6] fix wallet insufficient balance when amount is below 0.01 --- .../Bookings/ControllersLogic/CreateBookingPaymentLogic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Classes/Modules/Bookings/ControllersLogic/CreateBookingPaymentLogic.php b/app/Classes/Modules/Bookings/ControllersLogic/CreateBookingPaymentLogic.php index 0f6a8525..1140ecd9 100644 --- a/app/Classes/Modules/Bookings/ControllersLogic/CreateBookingPaymentLogic.php +++ b/app/Classes/Modules/Bookings/ControllersLogic/CreateBookingPaymentLogic.php @@ -129,7 +129,7 @@ class CreateBookingPaymentLogic extends AbstractControllerLogic /** @var Wallet $wallet */ $wallet = $booking->company->wallets()->first(); - if(($wallet->amount - $amount) < 0.01){ + if((float) number_format(($wallet->amount - $amount),2) < 0){ throw new MalformedRequestException('Insufficient wallet balance. Please Top up your wallet.'); } From e6b977ee4627871952c440a0ed17b27b2d32832b Mon Sep 17 00:00:00 2001 From: omair saleh Date: Fri, 11 Nov 2022 15:54:28 +0800 Subject: [PATCH 4/6] show wallets with negative amounts in wallet audit --- routes/web.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routes/web.php b/routes/web.php index 38a61cec..578711fd 100644 --- a/routes/web.php +++ b/routes/web.php @@ -349,7 +349,7 @@ Route::get('/wallet/audit', function (Request $request) { if((int) $transaction->type === TransactionType::PAYMENT) $payments += (float) $transaction->amount; if((int) $transaction->type === TransactionType::DEBIT_NOTE) $debit += (float) $transaction->amount; } - if(round((float) $wallet->amount - (($topups + $credit) - ($payments + $debit)), 2) == 0) continue; + if((round((float) $wallet->amount - (($topups + $credit) - ($payments + $debit)), 2) == 0) || $wallet->amount < 0) continue; $i++; From 2931246e772637760a1706fb95daaafecc96d178 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Fri, 11 Nov 2022 15:56:15 +0800 Subject: [PATCH 5/6] show wallets with negative amounts in wallet audit --- routes/web.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routes/web.php b/routes/web.php index 578711fd..aede88b6 100644 --- a/routes/web.php +++ b/routes/web.php @@ -349,7 +349,7 @@ Route::get('/wallet/audit', function (Request $request) { if((int) $transaction->type === TransactionType::PAYMENT) $payments += (float) $transaction->amount; if((int) $transaction->type === TransactionType::DEBIT_NOTE) $debit += (float) $transaction->amount; } - if((round((float) $wallet->amount - (($topups + $credit) - ($payments + $debit)), 2) == 0) || $wallet->amount < 0) continue; + if((round((float) $wallet->amount - (($topups + $credit) - ($payments + $debit)), 2) == 0) AND $wallet->amount > 0) continue; $i++; From d14812b5c4e0954046ae7e63d16e5cc483a65f84 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Fri, 11 Nov 2022 15:56:54 +0800 Subject: [PATCH 6/6] show wallets with negative amounts in wallet audit --- routes/web.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routes/web.php b/routes/web.php index aede88b6..a8ad44ba 100644 --- a/routes/web.php +++ b/routes/web.php @@ -349,7 +349,7 @@ Route::get('/wallet/audit', function (Request $request) { if((int) $transaction->type === TransactionType::PAYMENT) $payments += (float) $transaction->amount; if((int) $transaction->type === TransactionType::DEBIT_NOTE) $debit += (float) $transaction->amount; } - if((round((float) $wallet->amount - (($topups + $credit) - ($payments + $debit)), 2) == 0) AND $wallet->amount > 0) continue; + if((round((float) $wallet->amount - (($topups + $credit) - ($payments + $debit)), 2) == 0) AND $wallet->amount > -0.01) continue; $i++;