mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-25 23:43:58 +00:00
import bank record
This commit is contained in:
@@ -24,6 +24,7 @@ class ImportsBankRecord implements ToModel, WithHeadingRow, WithBatchInserts, Wi
|
||||
{
|
||||
$date = Date::excelToDateTimeObject($row['date']);
|
||||
$credit = (float) $row['credit'];
|
||||
$systemReference = null;
|
||||
|
||||
$transaction = Transaction::whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])
|
||||
->where('type', TransactionType::PAYMENT)->where('owner_type', Booking::class)
|
||||
@@ -31,13 +32,25 @@ class ImportsBankRecord implements ToModel, WithHeadingRow, WithBatchInserts, Wi
|
||||
->where('amount', '>=', $credit)->where('amount', '<', ($credit + 0.01))
|
||||
->get();
|
||||
|
||||
if(!count($transaction)) return;
|
||||
if(count($transaction)) {
|
||||
$systemReference = $transaction->pluck('owner.marking')->flatten()->implode(', ');
|
||||
}
|
||||
|
||||
|
||||
echo '<tr>
|
||||
<td>'.$date->format('d-m-Y').'</td>
|
||||
<td>'.$row['description'].'</td>
|
||||
<td>'.$credit.'</td>
|
||||
<td>'.$systemReference.'</td>
|
||||
<td>'.$row['remarkreferences'].'</td>
|
||||
<td>'.($systemReference === $row['remarkreferences']) ? 'true':'false'.'</td>
|
||||
</tr>';
|
||||
// dump([
|
||||
// 'date' => $date->format('d-m-Y'),
|
||||
// 'credit' => $credit,
|
||||
// 'payments' =>
|
||||
// ]);
|
||||
|
||||
dump([
|
||||
'date' => $date->format('d-m-Y'),
|
||||
'credit' => $credit,
|
||||
'payments' => $transaction->pluck('owner.marking')->flatten()->implode(', ')
|
||||
]);
|
||||
|
||||
// try {
|
||||
// preg_match_all('/([0-9]{3,4}[a-zA-Z]{3,4})/', $row['desc2'], $matches);
|
||||
|
||||
Reference in New Issue
Block a user