From 88119b4f956aaa331cef1e0a66fdc8c99744a5c4 Mon Sep 17 00:00:00 2001 From: JiaSheng Date: Tue, 12 Sep 2023 19:55:14 +0800 Subject: [PATCH] solve duplicate statement transaction created upon import bank statement --- .../Accounting/ControllersLogic/ImportBankStatementLogic.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/Classes/Modules/Accounting/ControllersLogic/ImportBankStatementLogic.php b/app/Classes/Modules/Accounting/ControllersLogic/ImportBankStatementLogic.php index 0355c554..33d9df75 100644 --- a/app/Classes/Modules/Accounting/ControllersLogic/ImportBankStatementLogic.php +++ b/app/Classes/Modules/Accounting/ControllersLogic/ImportBankStatementLogic.php @@ -98,7 +98,7 @@ class ImportBankStatementLogic extends AbstractControllerLogic $tellerId = $row[19]; $branchChannel = $row[20]; $transactionCode = $row[21]; - $endBalance = $row[22]; + $endBalance = ((float) str_replace(',', '', $row[22])); $description2 = $row[25]; $description3 = $row[26]; $description4 = $row[27]; @@ -123,11 +123,10 @@ class ImportBankStatementLogic extends AbstractControllerLogic $existingTransaction = StatementTransaction::where('transaction_ref', $transactionRef) ->where('posting_date', $postingDate) ->where('amount', $amount) - ->where('transaction_description', $transactionDescription) ->where('teller_id', $tellerId) ->where('branch_channel', $branchChannel) ->where('transaction_code', $transactionCode) - ->where('end_balance', $endBalance) + ->whereRaw("CAST(REPLACE(end_balance,',','') AS DECIMAL(15,2)) = ?",[$endBalance]) ->first(); if (!$existingTransaction) {