% my $id = stash 'id'; % title $id ? "Change debit $id" : "Enter new debit";

Essentials

% my %r; % $r{billId} = begin % end % $r{date} = begin (Format: YYYY-MM-DD) % end % $r{purpose} = begin % end % $r{value} = begin Cent % end % $r{targetCredit} = begin % if ( !@$targets ) {

There are no target credits available. Target credits are credits of other accounts that either still have a value of 0, or which have already been targetted. Please create a target credit record first, because all debits must refer to one so settlements can be fulfilled.

% $targets = [ ['', '', ''] ]; oops % } % my $cmpacc = $targets->[0][1]; % my $target = $debit->targetCredit // ''; % end % $r{debtor} = begin % my $g = param 'group'; debtor %>"> % end
% for my $f ( $debit->result_source->columns ) { % my $renderer = $r{$f} // do { % my $value = $debit->$f // next; % begin <%= $value %> % end % };
<%= $renderer->() %>
% }
% if ( $debit->in_storage ) { % my $i = $debit->incomings; % if ( $i->count() ) {

Incomings

If you want to revoke any incomings, just check those.

% while ( my $t = $i->next ) { % my $c = $t->credit; % }
Rtimestamppaidvaluenote
<%= $t->timestamp %> <%== nl2br $c->purpose %> <%== money $t->amount %> <%= $t->note %>
% } % else {

Debit not paid, yet.

% } % } % my $account = stash('account'); % if ( $account ||= $debit->debtor ) {

Pay with credits

% my $credits = app->db->resultset("Account")->find($account)->available_credits; % if ( $credits->count() ) {

Check credits you want to pay this debit with.

% while ( my $d = $credits->next ) { % }
Sdatepurposeto spend
<%= $d->date %> <%== nl2br $d->purpose %> <%== money $d->difference %>
% } % else {

Currently no credits available.

% } % }