mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
working on data matching
This commit is contained in:
parent
3b1d0e07e2
commit
de33548908
@ -48,38 +48,61 @@ class BankService implements ShouldQueue
|
||||
->where('is_deleted', 0)
|
||||
->get();
|
||||
|
||||
$this->match();
|
||||
}
|
||||
|
||||
public function match($transactions): array
|
||||
private function match()
|
||||
{
|
||||
BankTransaction::where('company_id', $this->company->id)
|
||||
->where('is_matched', false)
|
||||
->cursor()
|
||||
->each(function ($bt){
|
||||
|
||||
foreach($transactions as $transaction)
|
||||
{
|
||||
$this->matchIncome($transaction);
|
||||
}
|
||||
$invoice = $this->invoices->first(function ($value, $key) use ($bt){
|
||||
|
||||
return $transactions;
|
||||
return str_contains($value->number, $bt->description);
|
||||
|
||||
});
|
||||
|
||||
if($invoice)
|
||||
{
|
||||
$bt->invoice_id = $invoice->id;
|
||||
$bt->save();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private function matchExpense()
|
||||
{
|
||||
// public function match($transactions): array
|
||||
// {
|
||||
|
||||
}
|
||||
// foreach($transactions as $transaction)
|
||||
// {
|
||||
// $this->matchIncome($transaction);
|
||||
// }
|
||||
|
||||
private function matchIncome($transaction)
|
||||
{
|
||||
$description = str_replace(" ", "", $transaction->description);
|
||||
// return $transactions;
|
||||
// }
|
||||
|
||||
$invoice = $this->invoices->first(function ($value, $key) use ($description){
|
||||
// private function matchExpense()
|
||||
// {
|
||||
|
||||
return str_contains($value->number, $description);
|
||||
// }
|
||||
|
||||
});
|
||||
// private function matchIncome($transaction)
|
||||
// {
|
||||
// $description = str_replace(" ", "", $transaction->description);
|
||||
|
||||
if($invoice)
|
||||
$transaction['invocie_id'] = $invoice->hashed_id;
|
||||
// $invoice = $this->invoices->first(function ($value, $key) use ($description){
|
||||
|
||||
return $transaction;
|
||||
}
|
||||
// return str_contains($value->number, $description);
|
||||
|
||||
// });
|
||||
|
||||
// if($invoice)
|
||||
// $transaction['invocie_id'] = $invoice->hashed_id;
|
||||
|
||||
// return $transaction;
|
||||
// }
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user