Skip to content

Commit

Permalink
fixed reconciliation jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
denisdulici committed Jun 17, 2021
1 parent 873d25c commit af685b6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
13 changes: 4 additions & 9 deletions app/Jobs/Banking/CreateReconciliation.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,12 @@ public function __construct($request)
public function handle()
{
\DB::transaction(function () {
$reconcile = $this->request->get('reconcile');
$reconcile = (int) $this->request->get('reconcile');
$transactions = $this->request->get('transactions');

$this->reconciliation = Reconciliation::create([
'company_id' => $this->request['company_id'],
'account_id' => $this->request->get('account_id'),
'started_at' => $this->request->get('started_at'),
'ended_at' => $this->request->get('ended_at'),
'closing_balance' => $this->request->get('closing_balance'),
'reconciled' => $reconcile ? 1 : 0,
]);
$this->request->merge(['reconciled' => $reconcile]);

$this->reconciliation = Reconciliation::create($this->request->all());

if ($reconcile && $transactions) {
foreach ($transactions as $key => $value) {
Expand Down
6 changes: 3 additions & 3 deletions app/Jobs/Banking/UpdateReconciliation.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ public function __construct($reconciliation, $request)
public function handle()
{
\DB::transaction(function () {
$reconcile = $this->request->get('reconcile');
$reconcile = (int) $this->request->get('reconcile');
$transactions = $this->request->get('transactions');

$this->reconciliation->reconciled = $reconcile ? 1 : 0;
$this->reconciliation->reconciled = $reconcile;
$this->reconciliation->save();

if ($transactions) {
Expand All @@ -47,7 +47,7 @@ public function handle()
$t = explode('_', $key);

$transaction = Transaction::find($t[1]);
$transaction->reconciled = $reconcile ? 1 : 0;
$transaction->reconciled = $reconcile;
$transaction->save();
}
}
Expand Down

0 comments on commit af685b6

Please sign in to comment.