fixed reconciliation jobs
This commit is contained in:
parent
873d25c742
commit
af685b6c17
@ -31,17 +31,12 @@ class CreateReconciliation extends Job
|
|||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
\DB::transaction(function () {
|
\DB::transaction(function () {
|
||||||
$reconcile = $this->request->get('reconcile');
|
$reconcile = (int) $this->request->get('reconcile');
|
||||||
$transactions = $this->request->get('transactions');
|
$transactions = $this->request->get('transactions');
|
||||||
|
|
||||||
$this->reconciliation = Reconciliation::create([
|
$this->request->merge(['reconciled' => $reconcile]);
|
||||||
'company_id' => $this->request['company_id'],
|
|
||||||
'account_id' => $this->request->get('account_id'),
|
$this->reconciliation = Reconciliation::create($this->request->all());
|
||||||
'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,
|
|
||||||
]);
|
|
||||||
|
|
||||||
if ($reconcile && $transactions) {
|
if ($reconcile && $transactions) {
|
||||||
foreach ($transactions as $key => $value) {
|
foreach ($transactions as $key => $value) {
|
||||||
|
@ -32,10 +32,10 @@ class UpdateReconciliation extends Job
|
|||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
\DB::transaction(function () {
|
\DB::transaction(function () {
|
||||||
$reconcile = $this->request->get('reconcile');
|
$reconcile = (int) $this->request->get('reconcile');
|
||||||
$transactions = $this->request->get('transactions');
|
$transactions = $this->request->get('transactions');
|
||||||
|
|
||||||
$this->reconciliation->reconciled = $reconcile ? 1 : 0;
|
$this->reconciliation->reconciled = $reconcile;
|
||||||
$this->reconciliation->save();
|
$this->reconciliation->save();
|
||||||
|
|
||||||
if ($transactions) {
|
if ($transactions) {
|
||||||
@ -47,7 +47,7 @@ class UpdateReconciliation extends Job
|
|||||||
$t = explode('_', $key);
|
$t = explode('_', $key);
|
||||||
|
|
||||||
$transaction = Transaction::find($t[1]);
|
$transaction = Transaction::find($t[1]);
|
||||||
$transaction->reconciled = $reconcile ? 1 : 0;
|
$transaction->reconciled = $reconcile;
|
||||||
$transaction->save();
|
$transaction->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user