From 32e4bc85a5b65cec1ec94985bc9229117dfdbeee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=BCneyt=20=C5=9Eent=C3=BCrk?= Date: Thu, 20 Oct 2022 14:22:44 +0300 Subject: [PATCH] close #2679 Fixed: Reconciliation started an ended date get wrong data --- app/Jobs/Banking/CreateReconciliation.php | 10 +++++++++- app/Models/Banking/Reconciliation.php | 2 +- resources/assets/js/views/banking/reconciliations.js | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/Jobs/Banking/CreateReconciliation.php b/app/Jobs/Banking/CreateReconciliation.php index 595446798..396e58809 100644 --- a/app/Jobs/Banking/CreateReconciliation.php +++ b/app/Jobs/Banking/CreateReconciliation.php @@ -8,16 +8,24 @@ use App\Interfaces\Job\HasSource; use App\Interfaces\Job\ShouldCreate; use App\Models\Banking\Reconciliation; use App\Models\Banking\Transaction; +use App\Utilities\Date; class CreateReconciliation extends Job implements HasOwner, HasSource, ShouldCreate { public function handle(): Reconciliation { \DB::transaction(function () { + $started_at = Date::parse($this->request->get('started_at'))->startOfDay(); + $ended_at = Date::parse($this->request->get('ended_at'))->endOfDay(); + $reconcile = (int) $this->request->get('reconcile'); $transactions = $this->request->get('transactions'); - $this->request->merge(['reconciled' => $reconcile]); + $this->request->merge([ + 'started_at' => $started_at, + 'ended_at' => $ended_at, + 'reconciled' => $reconcile, + ]); $this->model = Reconciliation::create($this->request->all()); diff --git a/app/Models/Banking/Reconciliation.php b/app/Models/Banking/Reconciliation.php index c8d2fd87f..2026dc95d 100644 --- a/app/Models/Banking/Reconciliation.php +++ b/app/Models/Banking/Reconciliation.php @@ -18,7 +18,7 @@ class Reconciliation extends Model * * @var array */ - protected $fillable = ['company_id', 'account_id', 'started_at', 'ended_at', 'closing_balance', 'reconciled', 'created_from', 'created_by']; + protected $fillable = ['company_id', 'account_id', 'started_at', 'ended_at', 'closing_balance', 'transactions', 'reconciled', 'created_from', 'created_by']; /** * The attributes that should be cast. diff --git a/resources/assets/js/views/banking/reconciliations.js b/resources/assets/js/views/banking/reconciliations.js index 8fb684bd9..249076ce8 100644 --- a/resources/assets/js/views/banking/reconciliations.js +++ b/resources/assets/js/views/banking/reconciliations.js @@ -50,7 +50,7 @@ const app = new Vue({ } }, - methods:{ + methods: { setDueMinDate(date) { this.min_due_date = date; },