diff --git a/TrsrDB/HTTP.pm b/TrsrDB/HTTP.pm index c74fec2..254ef9f 100644 --- a/TrsrDB/HTTP.pm +++ b/TrsrDB/HTTP.pm @@ -88,7 +88,7 @@ sub startup { $check->get('/bankStatement' => sub { my $c = shift; my $records = $c->app->db->resultset("ReconstructedBankStatement") - ->search( process_table_filter_widget($c) ); + ->search( process_table_filter_widget($c, {}, { order => 'date' }) ); $c->stash( records => $records ); $c->render('bankStatement'); }); @@ -339,7 +339,7 @@ sub process_table_filter_widget { sub _get_trace_placeholder { \<<'EOF' In this area, the server can trace SQL commands executed to fulfill your request. If the admin wants that, they can run the server with environment variable DBIC_TRACE=1. -All substantial logic of Treasure DB is done in the scope of the database itself. In consequence, you could do without this HTTP interface and input all SQL commands shown here directly in a general-purpose SQLite3 user interface. Thus you will get roughly the same results. +All substantial logic of Treasure DB is realized as triggers and views right in the database file. In consequence, you could do without this HTTP interface and input all SQL commands directly in a general-purpose SQLite3 user interface. Thus you would get essentially the same results, except they do not look as nice. EOF } 1; diff --git a/TrsrDB/HTTP/Account.pm b/TrsrDB/HTTP/Account.pm index 224c7e1..8051589 100644 --- a/TrsrDB/HTTP/Account.pm +++ b/TrsrDB/HTTP/Account.pm @@ -43,7 +43,7 @@ sub upsert { if ( $self->req->method eq 'POST' ) { my $p = $self->req->params->to_hash; - if ( $p->{IBAN} eq q{*} ) { + if ( ($p->{IBAN}//q{}) eq q{*} ) { $p->{IBAN} = q{}; } elsif ( !$iban ) { diff --git a/site/style.css b/site/style.css index 4d40e9a..957e7ab 100644 --- a/site/style.css +++ b/site/style.css @@ -15,10 +15,17 @@ h1 { table { border-collapse: collapse; + width:100%; } table td, table th { border: 1px solid darkgrey; + vertical-align: top; +} + +table.accounts tr.group-heading th { + border:none; + vertical-align:middle; } table tr:nth-child(even) { @@ -44,12 +51,22 @@ table td.number { text-align: right; font-family: monospace, monospace; /* Hack to prevent browser default size reduction of monospace font */ font-size:1em; + vertical-align: bottom; } table td.mark { background-color:rgba(255,0,0,0.1); } +table td input { + width:100%; + box-sizing: border-box; +} + +form { + margin: 1em 0; +} + a.transfer-btn { background-color:rgba(224,32,0,0.4); font-weight: bold; @@ -73,6 +90,9 @@ input, textarea { border: 1px solid #ddd; padding: 2px; } +input[type=checkbox], input[type=radio] { + border: none; +} dl dt { float: left; @@ -117,3 +137,17 @@ img.icon { color: darkgrey; text-align: center; } + +a.add-item-btn:link, +a.add-item-btn:visited { + display: block; + float: right; + font-variant: small-caps; + background-color: #eee; + border: 2px outset grey; + padding: 3px; + border-radius: 3px; + text-decoration: none; + color: inherit; + font-weight:normal; +} diff --git a/templates/account/history.html.ep b/templates/account/history.html.ep index b7addb1..9befb03 100644 --- a/templates/account/history.html.ep +++ b/templates/account/history.html.ep @@ -9,12 +9,15 @@ % my $that = $hr->that_credit; % my $this = $hr->this_credit; % my $credit_ref = begin -%== sprintf q{%s%d}, shift() ? ($that->account->ID.q{.}, $that->credId) : (q{}, $this->credId) +% my $that_acc = $that && $that->account; +% my $that_account_id = $that ? $that_acc->ID : q{(out)}; +% my $that_credit_id = $that ? $that->credId : ""; +%== sprintf q{%s%d}, shift() ? ($that_account_id.q{:}, $that_credit_id) : (q{}, $this->credId) % end -

<%= $hr->billId %>: <%= $hr->purpose %> → <%== $credit_ref->($hr->debit) %>

-

from <%= $credit_ref->($hr->credit) %>, <%= $hr->credit ? $that->purpose : $this->purpose %> +

<%= $hr->billId %>: <%== nl2br $hr->purpose %> → <%== $credit_ref->($hr->debit) %>

+

↑ <%= $credit_ref->($hr->credit) =%>, <%= $hr->credit ? $that->purpose : $this->purpose %> % if ( $hr->note ) { -
Note: <%= $hr->note %> +
Note: <%= $hr->note %> % }

<%== money $hr->debit %><%== money $hr->credit %> diff --git a/templates/account/list.html.ep b/templates/account/list.html.ep index e0aa604..5cd646f 100644 --- a/templates/account/list.html.ep +++ b/templates/account/list.html.ep @@ -6,8 +6,8 @@ % my ($type) = q{}; % my $inter_header = begin % my $group = shift; -<%= $group || 'Club management accounts' %> -Charge all at once +<%= $group || 'Club management accounts' %> +Charge all at once % end % while ( my $account = $accounts->next ) { % my $bal = $account->balance; @@ -22,36 +22,35 @@ % my $which = ($bal->arrears && 1) + ($bal->available && 1); % if ( $which == 2 ) { - › ‹ + › ready ‹ % } % elsif ( $which ) { <%== $bal->arrears ? q{›} : q{ } %> - + wait <%== $bal->available ? q{‹} : q{ } %> % } % else { - + even % } <%== money $bal->available %>ListCredit<%== money $bal->earned %><%== money $bal->promised %>HistoryReport % } # while % stash links => [ '/account' => "Create account", '/bankStatement' => "Reconstructed bank statement" ]; -% my $help = begin +% stash help => $_ for begin

Column explanation

-
Even till:
-

Date of debt up to and including which all is settled.

-
Arrears:
-

Unpaid debits

-
Transfer:
-

Link to a view where you can match credit and debit and have the software transfer money in between automatically. Yellow "N/A" means there is no money to transfer as either credit or debit is 0. Green "N/A" means there is no money to transfer because the account is even.

-
Available:
-

Credits that have not been used or not to full extent, yet

-
Earned:
-

Paid debits targetting credits of that account.

-
Promised:
-

Unpaid or not fully paid debits targetting credits of that account.

+
Even until
+
Date of the debt/bill up to and including which all is settled. Within each group (i.e. account type), accounts are ordered by this ascending date.
+
Arrears
+
Debits or partial amounts of which are still outstanding
+
Transfer
+
View of credit and debit for you to match and have the software transfer money in between automatically. ready means you need to take action. wait means there is no money to transfer as either credit or debit is 0, or even if the account is even.
+
Available
+
Credits that have not been used or not to full extent, yet
+
Earned
+
Paid debits targetting credits of that account.
+
Promised
+
Unpaid or not fully paid debits targetting credits of that account.
% end -% stash help => $help; diff --git a/templates/account/report.html.ep b/templates/account/report.html.ep index 2583fe5..8fbeb19 100644 --- a/templates/account/report.html.ep +++ b/templates/account/report.html.ep @@ -7,5 +7,5 @@ % $total += $record->value; <%= $record->date %><%== money $record->value %><%== nl2br $record->purpose %> % } -In total:<%== money $total %> +In total:<%== money $total %> diff --git a/templates/account/upsert.html.ep b/templates/account/upsert.html.ep index 4a2b086..de610a6 100644 --- a/templates/account/upsert.html.ep +++ b/templates/account/upsert.html.ep @@ -17,7 +17,7 @@ (may also be empty or '*' – s. help) % end -
+
% for my $f ( $account->result_source->columns ) { diff --git a/templates/bankStatement.html.ep b/templates/bankStatement.html.ep index 7dbd3cb..eb9567c 100644 --- a/templates/bankStatement.html.ep +++ b/templates/bankStatement.html.ep @@ -6,9 +6,17 @@ % while ( my $record = $records->next ) { % $total_credit += $record->credit; % $total_debit += $record->debit; -<%= $record->date %><%= $record->purpose %><%= $record->account %><%== money $record->debit %><%== money $record->credit %> +% $total_credit -= $total_debit; +% if ( $total_credit > 0 ) { +% $total_debit = 0; +% } +% if ( $total_credit < 0 ) { +% $total_debit = abs $total_credit; +% $total_credit = 0; +% } +<%= $record->date %><%== nl2br $record->purpose %><%= $record->account %><%== money $record->debit %><%== money $record->credit %> % } -Current balance:<%== $total_debit ? money $total_debit : '' %><%== $total_credit ? money $total_credit : '' %> +Current balance:<%== $total_debit ? money $total_debit : '' %><%== $total_credit ? money $total_credit : '' %> %= include 'filter-widget' diff --git a/templates/credit/list.html.ep b/templates/credit/list.html.ep index 661b0b4..2e9dbbe 100644 --- a/templates/credit/list.html.ep +++ b/templates/credit/list.html.ep @@ -1,5 +1,6 @@ % title 'Income of ' . $account; + Add credit

Listed in reverse order:

diff --git a/templates/credit/upsert.html.ep b/templates/credit/upsert.html.ep index 82cf7f9..62575bc 100644 --- a/templates/credit/upsert.html.ep +++ b/templates/credit/upsert.html.ep @@ -1,7 +1,7 @@ % my $id = stash 'id'; % title $id ? "Change credit $id" : "Enter new credit"; - +

Essentials

% my %r; @@ -23,7 +23,7 @@ % end % $r{value} = begin - Cent (declare target credit with "0") + Cent (target credit? See help) % end % $r{account} = begin <%= $credit->account->ID %> @@ -95,3 +95,8 @@

+ +% stash help => $_ for begin +

How to declare a target credit?

+

A target credit can be declared by assigning it an initial value of 0 (zero).

+% end diff --git a/templates/debit/list.html.ep b/templates/debit/list.html.ep index de6ef01..37354c2 100644 --- a/templates/debit/list.html.ep +++ b/templates/debit/list.html.ep @@ -1,5 +1,6 @@ % title 'Outcome of ' . $account; + Add debit

Listed in reverse order:

diff --git a/templates/debit/upsert.html.ep b/templates/debit/upsert.html.ep index a1b3ed7..57c8c3d 100644 --- a/templates/debit/upsert.html.ep +++ b/templates/debit/upsert.html.ep @@ -1,7 +1,7 @@ % my $id = stash 'id'; % title $id ? "Change debit $id" : "Enter new debit"; - +

Essentials

% my %r; diff --git a/templates/layouts/default.html.ep b/templates/layouts/default.html.ep index 15885da..00a2bd1 100644 --- a/templates/layouts/default.html.ep +++ b/templates/layouts/default.html.ep @@ -39,7 +39,7 @@ % } % if ( defined $sql ) {
-

Please note that, to run the SQL commands directly in another tool, you might need to resolve the prepared statements manually. Just replace all question marks by the values listed after the colon in each line.

+

Please note that if you want to run the SQL commands directly in another tool, you might need to resolve the prepared statements manually. Just replace all question marks by the values listed after the colon in each line.