From 20905a4996db49b132cb3f5cdeab9cadf311ea6e Mon Sep 17 00:00:00 2001 From: edmondlang Date: Sun, 9 Jul 2023 22:08:08 +0800 Subject: [PATCH 1/3] update export invoice function for accounts mapping --- .../Accounting/Processors/ListShippingPortalTransactions.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/Classes/Modules/Accounting/Processors/ListShippingPortalTransactions.php b/app/Classes/Modules/Accounting/Processors/ListShippingPortalTransactions.php index 86a032b5..5e0d4756 100644 --- a/app/Classes/Modules/Accounting/Processors/ListShippingPortalTransactions.php +++ b/app/Classes/Modules/Accounting/Processors/ListShippingPortalTransactions.php @@ -12,8 +12,7 @@ class ListShippingPortalTransactions public function execute($filters) { try { - // $url = 'https://izyim.cief-malaysia.com/public/api/v1/transactions/mappable/query/with-details'; - $url = 'http://127.0.0.1:8000/public/api/v1/transactions/mappable/query/with-details'; + $url = 'https://izyim.cief-malaysia.com/public/api/v1/transactions/mappable/query/with-details'; $client = new \GuzzleHttp\Client(['verify' => false]); $response = $client->request('GET', $url . '?api-key=510acd13d8d24375cf038ad626c282565451461a9c2399357e0b65365300787e&filters=' . json_encode($filters)); $body = $response->getBody(); From 74cf3acd3ec04539a8c16809d2557efd5b5872ed Mon Sep 17 00:00:00 2001 From: edmondlang Date: Mon, 10 Jul 2023 20:59:01 +0800 Subject: [PATCH 2/3] update accounting mapping --- .../UpdateBankStatementDetailLogic.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/app/Classes/Modules/Accounting/ControllersLogic/UpdateBankStatementDetailLogic.php b/app/Classes/Modules/Accounting/ControllersLogic/UpdateBankStatementDetailLogic.php index 63338ace..71e8ba41 100644 --- a/app/Classes/Modules/Accounting/ControllersLogic/UpdateBankStatementDetailLogic.php +++ b/app/Classes/Modules/Accounting/ControllersLogic/UpdateBankStatementDetailLogic.php @@ -7,13 +7,16 @@ use App\Classes\Exceptions\MalformedRequestException; use App\Classes\General\Abstracts\AbstractControllerLogic; use App\Classes\Modules\Accounting\Services\CreatesBankStatementTransactionOwner; use App\Classes\Modules\Accounting\Services\FetchesBankStatementTransaction; +use App\Classes\Modules\Accounting\Processors\ListShippingPortalTransactions; use App\Classes\ValueObjects\Constants\StatementTransactionOwnerType; use App\Classes\ValueObjects\Constants\SystemType; use App\Classes\Modules\Accounting\Processors\ChecksBillNumber; +use App\Classes\ValueObjects\Constants\ShippingTransactionType; use App\Classes\ValueObjects\Constants\TransactionType; use App\Models\Booking; use App\Models\Transaction; use App\Models\Wallet; +use Exception; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; @@ -104,10 +107,18 @@ class UpdateBankStatementDetailLogic extends AbstractControllerLogic } if($systemReference === 'izyim') { - $transaction = $transaction[0]; - $owner_type = Transaction::class; - $owner_id = $transaction['owner_id']; - $owner_reference = $transaction['owner_reference']; + $transaction = $transaction[0]; + $payFor = $request->input('pay_for'); + $transactionType = $transaction['type']; + + if (($payFor === 'sales' && !in_array($transactionType, [ShippingTransactionType::PAYMENT, ShippingTransactionType::GROUP_PAYMENT])) + || ($payFor === 'top_up' && !in_array($transactionType, [ShippingTransactionType::TOP_UP]))) { + throw new Exception("Transaction Type does not match"); + } + + $owner_type = Transaction::class; + $owner_id = $transaction['owner_id']; + $owner_reference = $transaction['owner_reference']; } } From 46ae50b569a7d5f5b25461fa3a94adf0ba2bd153 Mon Sep 17 00:00:00 2001 From: edmondlang Date: Mon, 10 Jul 2023 21:59:08 +0800 Subject: [PATCH 3/3] fix invoice decimals bug --- resources/views/pages/pdfs/invoice.blade.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/resources/views/pages/pdfs/invoice.blade.php b/resources/views/pages/pdfs/invoice.blade.php index 92e42b83..d6b2383d 100644 --- a/resources/views/pages/pdfs/invoice.blade.php +++ b/resources/views/pages/pdfs/invoice.blade.php @@ -174,15 +174,21 @@ Total + @php + $service_charge = (float)number_format($transaction->service_charge, 2,'.',''); + $tax = (float)number_format($transaction->tax, 2,'.',''); + $rounded_voucher = (float)number_format($voucher_discount, 2,'.',''); + @endphp @if($transaction->booking()->first()->fix_currency_id !== 1) @php - $service_charge = (float)number_format($transaction->service_charge, 2,'.',''); - $tax = (float)number_format($transaction->tax, 2,'.',''); - $rounded_voucher = (float)number_format($voucher_discount, 2,'.',''); + $rounded_subtotal = (float)number_format($subtotal, 2,'.',''); @endphp - {{ number_format($subtotal + $service_charge + $tax + $rounded_voucher, 2) }} + {{ number_format($rounded_subtotal + $service_charge + $tax + $rounded_voucher, 2) }} @else - {{ number_format($transaction->amount + $transaction->service_charge + $transaction->tax + $voucher_discount, 2) }} + @php + $rounded_transaction_amount = (float)number_format($transaction->amount, 2,'.',''); + @endphp + {{ number_format($rounded_transaction_amount + $service_charge + $tax + $rounded_voucher, 2) }} @endif