close #2679 Fixed: Reconciliation started an ended date get wrong data

This commit is contained in:
Cüneyt Şentürk
2022-10-20 14:22:44 +03:00
parent 417f82b4a5
commit 32e4bc85a5
3 changed files with 11 additions and 3 deletions

View File

@@ -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());