From db88edabfe8116c4685ea862515d3d1de6377d90 Mon Sep 17 00:00:00 2001 From: Steve Ng Date: Sat, 4 Nov 2023 10:45:41 +0800 Subject: [PATCH] fix bug unmapped invoice --- .../Services/ExportsInvoiceTransactions.php | 19 ++++++++++++++++++- .../ImportStatementInvoiceController.php | 9 +-------- .../ImportStatementReceiptsController.php | 9 +-------- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/app/Classes/Modules/Exports/Services/ExportsInvoiceTransactions.php b/app/Classes/Modules/Exports/Services/ExportsInvoiceTransactions.php index 796ec19d..a7041b1c 100644 --- a/app/Classes/Modules/Exports/Services/ExportsInvoiceTransactions.php +++ b/app/Classes/Modules/Exports/Services/ExportsInvoiceTransactions.php @@ -127,7 +127,24 @@ class ExportsInvoiceTransactions implements FromQuery, WithHeadings, WithHeading Log::info('Error in Exports Invoice Transactions ' . $this->counter); - return []; + return [ + 'Transaction Not Found', + $transaction->posting_date->format('m/d/Y H:m'), + $transaction->transaction_description.' - '.$transaction->transaction_description_2, + $statementTransactionOwner->system, + '', + '', + '', + '', + '', + '', + 0, + $transaction->amount, + '', + '', + '', + '' + ]; } $row = $row[0]; diff --git a/app/Http/Controllers/Imports/ImportStatementInvoiceController.php b/app/Http/Controllers/Imports/ImportStatementInvoiceController.php index 6cfdec08..8d2b920b 100644 --- a/app/Http/Controllers/Imports/ImportStatementInvoiceController.php +++ b/app/Http/Controllers/Imports/ImportStatementInvoiceController.php @@ -55,7 +55,7 @@ class ImportStatementInvoiceController foreach ($excelRows as $row) { $row['mapped_result_reference'] = null; $row['mapped_status'] = 'failed'; - $row['date'] = $this->changeExcelDate($row['date']); + $row['date'] = date('Y-m-d', strtotime($row['date'])); // Shipping Info // TOPUP -> map with transaction.bill_no @@ -162,11 +162,4 @@ class ImportStatementInvoiceController } return false; } - - public function changeExcelDate($date) - { - $unixTime = (($date - 25569) * 86400); - $date = new DateTime("@$unixTime"); - return $date->format('Y-m-d'); // Change the format to 'Y-m-d' - } } diff --git a/app/Http/Controllers/Imports/ImportStatementReceiptsController.php b/app/Http/Controllers/Imports/ImportStatementReceiptsController.php index 3c919376..4006e130 100644 --- a/app/Http/Controllers/Imports/ImportStatementReceiptsController.php +++ b/app/Http/Controllers/Imports/ImportStatementReceiptsController.php @@ -53,7 +53,7 @@ class ImportStatementReceiptsController foreach ($excelRows as $row) { $row['mapped_result_reference'] = null; $row['mapped_status'] = 'failed'; - $row['date'] = $this->changeExcelDate($row['doc_date']); + $row['date'] = date('Y-m-d', strtotime($row['doc_date'])); $returnReference = $this->mappingExchange($row); if ($returnReference) { @@ -104,11 +104,4 @@ class ImportStatementReceiptsController } return false; } - - public function changeExcelDate($date) - { - $unixTime = (($date - 25569) * 86400); - $date = new DateTime("@$unixTime"); - return $date->format('Y-m-d'); // Change the format to 'Y-m-d' - } }