DrCr/drcr/templates/statement_line_edit_transac...

92 lines
3.0 KiB
HTML

{# DrCr: Web-based double-entry bookkeeping framework
Copyright (C) 2022 Lee Yingtong Li (RunasSudo)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
#}
{% extends 'base.html' %}
{% block title %}Edit statement line charge{% endblock %}
{% block body %}
<div class="container">
<h1 class="h2 mt-4 mb-4">Statement line</h1>
<table class="table">
<thead>
<tr>
<th>Source account</th>
<th>Date</th>
<th>Description</th>
<th>Dr</th>
<th>Cr</th>
<th>Balance</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{ statement_line.source_account }}</td>
<td>{{ statement_line.dt.strftime('%Y-%m-%d') }}</td>
<td>{{ statement_line.description }}</td>
<td>{{ statement_line.amount().format() if statement_line.quantity >= 0 else '' }}</td>
<td>{{ (statement_line.amount()|abs).format() if statement_line.quantity < 0 else '' }}</td>
<td>{{ statement_line.balance or '' }}</td>
</tr>
</tbody>
</table>
<h1 class="h2 mt-4 mb-4">Transaction</h1>
<form method="POST">
<table class="table">
<thead>
<tr>
<th>Date</th>
<th colspan="2">Description</th>
<th>Dr</th>
<th>Cr</th>
</tr>
</thead>
<tbody>
{# FIXME: Customise date, etc. #}
{# FIXME: Complex transactions #}
<tr>
<td>{{ statement_line.dt.strftime('%Y-%m-%d') }}</td>
<td colspan="2"><input type="text" name="description" value="{{ statement_line.description }}" class="w-100"></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td><i>{{ 'Dr' if statement_line.quantity >= 0 else 'Cr' }}</i> {{ statement_line.source_account }}</td>
<td>{{ statement_line.amount().format() if statement_line.quantity >= 0 else '' }}</td>
<td>{{ (statement_line.amount()|abs).format() if statement_line.quantity < 0 else '' }}</td>
</tr>
<tr>
<td></td>
<td></td>
<td><i>{{ 'Cr' if statement_line.quantity >= 0 else 'Dr' }}</i> <input type="text" name="charge-account"></td>
<td>{{ (statement_line.amount()|abs).format() if statement_line.quantity < 0 else '' }}</td>
<td>{{ statement_line.amount().format() if statement_line.quantity >= 0 else '' }}</td>
</tr>
</tbody>
</table>
<div class="d-flex justify-content-end">
<button type="submit" class="btn btn-primary">Save</button>
</div>
</form>
</div>
{% endblock %}