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\Interfaces\Job\ShouldCreate;
use App\Models\Banking\Reconciliation; use App\Models\Banking\Reconciliation;
use App\Models\Banking\Transaction; use App\Models\Banking\Transaction;
use App\Utilities\Date;
class CreateReconciliation extends Job implements HasOwner, HasSource, ShouldCreate class CreateReconciliation extends Job implements HasOwner, HasSource, ShouldCreate
{ {
public function handle(): Reconciliation public function handle(): Reconciliation
{ {
\DB::transaction(function () { \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'); $reconcile = (int) $this->request->get('reconcile');
$transactions = $this->request->get('transactions'); $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()); $this->model = Reconciliation::create($this->request->all());

View File

@ -18,7 +18,7 @@ class Reconciliation extends Model
* *
* @var array * @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. * The attributes that should be cast.

View File

@ -50,7 +50,7 @@ const app = new Vue({
} }
}, },
methods:{ methods: {
setDueMinDate(date) { setDueMinDate(date) {
this.min_due_date = date; this.min_due_date = date;
}, },