update export invoice function for accounts mapping

This commit is contained in:
edmondlang
2023-07-09 22:06:06 +08:00
parent 96a4e35091
commit b1f5ab492c
3 changed files with 26 additions and 26 deletions
@@ -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.');
@@ -99,19 +99,17 @@ class ExportsInvoiceTransactions implements FromQuery, WithHeadings, WithHeading
'with_company' => true,
])[0];
$order = $row['order'];
$company_module = $order['company_module'];
return [
'<<New>>',
$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),
+6 -1
View File
@@ -175,7 +175,12 @@
<td class="right middle">Total</td>
<td class="total right middle">
@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