Skip to content

Commit

Permalink
refs #2611 Reconciliation edit added transaction list..
Browse files Browse the repository at this point in the history
  • Loading branch information
cuneytsenturk committed Sep 5, 2022
1 parent ba762c0 commit 2421bd9
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
1 change: 1 addition & 0 deletions app/Jobs/Banking/UpdateReconciliation.php
Expand Up @@ -15,6 +15,7 @@ public function handle(): Reconciliation
$reconcile = (int) $this->request->get('reconcile');
$transactions = $this->request->get('transactions');

$this->model->transactions = $transactions;
$this->model->reconciled = $reconcile;
$this->model->save();

Expand Down
1 change: 1 addition & 0 deletions app/Models/Banking/Reconciliation.php
Expand Up @@ -28,6 +28,7 @@ class Reconciliation extends Model
protected $casts = [
'closing_balance' => 'double',
'reconciled' => 'boolean',
'transactions' => 'array',
];

/**
Expand Down
8 changes: 7 additions & 1 deletion database/migrations/2022_08_29_000000_core_v307.php
Expand Up @@ -18,10 +18,16 @@ public function up()
if (! Type::hasType('double')) {
Type::addType('double', FloatType::class);
}


// Document Items
Schema::table('document_items', function(Blueprint $table) {
$table->double('quantity', 12, 2)->change();
});

// Reconciliations
Schema::table('reconciliations', function (Blueprint $table) {
$table->text('transactions')->nullable()->after('closing_balance');
});
}

/**
Expand Down
13 changes: 11 additions & 2 deletions resources/views/banking/reconciliations/edit.blade.php
Expand Up @@ -83,13 +83,22 @@
@endif

<td class="ltr:pl-6 rtl:pr-6 py-4 text-center text-sm font-medium">
@php $type = $item->isIncome() ? 'income' : 'expense'; @endphp
@php
$type = $item->isIncome() ? 'income' : 'expense';
$name = $type . '_' . $item->id;
$checked = $item->reconciled;
if (! $reconciliation->reconciled && array_key_exists($name, $reconciliation->transactions)) {
$checked = $reconciliation->transactions[$name];
}
@endphp

<x-form.input.checkbox name="{{ $type . '_' . $item->id }}"
label=""
id="transaction-{{ $item->id . '-'. $type }}"
:value="$item->amount_for_account"
:checked="$item->reconciled"
:checked="$checked"
data-field="transactions"
v-model="form.transactions.{{ $type . '_' . $item->id }}"
class="text-purple focus:outline-none focus:ring-purple focus:border-purple"
Expand Down

0 comments on commit 2421bd9

Please sign in to comment.