From f26feb68bfd1fd85e8dc449b5b1473ff445edfee Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 22 Oct 2024 16:24:25 +1100 Subject: [PATCH] Roll back matching rules --- app/Services/Bank/ProcessBankRules.php | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/app/Services/Bank/ProcessBankRules.php b/app/Services/Bank/ProcessBankRules.php index 61bef394c30..98c22195e14 100644 --- a/app/Services/Bank/ProcessBankRules.php +++ b/app/Services/Bank/ProcessBankRules.php @@ -54,6 +54,26 @@ public function run() } } + private function matchCredit() + { + $this->invoices = Invoice::query()->where('company_id', $this->bank_transaction->company_id) + ->whereIn('status_id', [1,2,3]) + ->where('is_deleted', 0) + ->get(); + + $invoice = $this->invoices->first(function ($value, $key) { + return str_contains($this->bank_transaction->description, $value->number) || str_contains(str_replace("\n", "", $this->bank_transaction->description), $value->number); + }); + + if ($invoice) { + $this->bank_transaction->invoice_ids = $invoice->hashed_id; + $this->bank_transaction->status_id = BankTransaction::STATUS_MATCHED; + $this->bank_transaction->save(); + return; + } + + } + // $payment.amount // $payment.transaction_reference // $payment.custom1 @@ -73,7 +93,7 @@ public function run() // $client.custom2 // $client.custom3 // $client.custom4 - private function matchCredit() + private function matchCreditXX() { $match_set = [];