diff --git a/app/Classes/Modules/Accounting/Processors/ListShippingPortalTransactions.php b/app/Classes/Modules/Accounting/Processors/ListShippingPortalTransactions.php index 7bc0e29d..86a032b5 100644 --- a/app/Classes/Modules/Accounting/Processors/ListShippingPortalTransactions.php +++ b/app/Classes/Modules/Accounting/Processors/ListShippingPortalTransactions.php @@ -11,26 +11,23 @@ class ListShippingPortalTransactions { public function execute($filters) { - try { - $url = 'https://izyim.cief-malaysia.com/public/api/v1/transactions/query'; - $client = new \GuzzleHttp\Client(['verify' => false]); - $response = $client->request('GET', $url . '?api-key=510acd13d8d24375cf038ad626c282565451461a9c2399357e0b65365300787e&filters=' . json_encode($filters)); - $body = $response->getBody(); - $data = json_decode($body, true); - $payload = $data['payload']; - return $data['payload']['data']; + 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'; + $client = new \GuzzleHttp\Client(['verify' => false]); + $response = $client->request('GET', $url . '?api-key=510acd13d8d24375cf038ad626c282565451461a9c2399357e0b65365300787e&filters=' . json_encode($filters)); + $body = $response->getBody(); + $data = json_decode($body, true); + $payload = $data['payload']; + return $data['payload']['data']; - // return $payload['data']; - // $return_data = Collection::hydrate($payload['data']); - // return $return_data; - - } catch (\Exception $exception) { - dd($exception->getMessage()); -// preg_match('/\{.*\}/s', $exception->getMessage(), $matches); -// $jsonError = json_decode($matches[0]); - // Retrieved Transactions failed -// throw new MalformedRequestException($jsonError->title); - } + } catch (\Exception $exception) { + dd($exception->getMessage()); + // preg_match('/\{.*\}/s', $exception->getMessage(), $matches); + // $jsonError = json_decode($matches[0]); + // Retrieved Transactions failed + // throw new MalformedRequestException($jsonError->title); + } // if not found throw new MalformedRequestException('Bill Number Not Found.'); diff --git a/app/Classes/Modules/Exports/Services/ExportsInvoiceTransactions.php b/app/Classes/Modules/Exports/Services/ExportsInvoiceTransactions.php index c9237880..0f46ae6c 100644 --- a/app/Classes/Modules/Exports/Services/ExportsInvoiceTransactions.php +++ b/app/Classes/Modules/Exports/Services/ExportsInvoiceTransactions.php @@ -99,19 +99,17 @@ class ExportsInvoiceTransactions implements FromQuery, WithHeadings, WithHeading 'with_company' => true, ])[0]; - $order = $row['order']; - $company_module = $order['company_module']; return [ '<>', $row['updated_at'], - $company_module['debtor'], - $row['type'] === ShippingTransactionType::PAYMENT ? $order['reference'] : $company_module['marking'], + $row['debtor_code'], + $row['type'] === ShippingTransactionType::PAYMENT ? $row['order_reference'] : $row['marking'], '', 'MYR', - $row['type'] === ShippingTransactionType::PAYMENT ? $order['reference'] : $row['bill_no'], + $row['type'] === ShippingTransactionType::PAYMENT ? $row['order_reference'] : $row['bill_no'], $row['type'] === ShippingTransactionType::PAYMENT ? '' : 'W1', - $row['type'] === ShippingTransactionType::PAYMENT ? 'PLEASE REFER TO THE ATTACHED APPENDIX REF `' . $order['reference'] : 'CREDIT SALES', + $row['type'] === ShippingTransactionType::PAYMENT ? 'PLEASE REFER TO THE ATTACHED APPENDIX REF `' . $row['order_reference'] : 'CREDIT SALES', '', 1, round($row['amount'], 2), diff --git a/resources/views/pages/pdfs/invoice.blade.php b/resources/views/pages/pdfs/invoice.blade.php index 1a12df38..92e42b83 100644 --- a/resources/views/pages/pdfs/invoice.blade.php +++ b/resources/views/pages/pdfs/invoice.blade.php @@ -175,7 +175,12 @@ Total @if($transaction->booking()->first()->fix_currency_id !== 1) - {{ number_format($subtotal + $transaction->service_charge + $transaction->tax + $voucher_discount, 2) }} + @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 + {{ number_format($subtotal + $service_charge + $tax + $rounded_voucher, 2) }} @else {{ number_format($transaction->amount + $transaction->service_charge + $transaction->tax + $voucher_discount, 2) }} @endif