Commit 31042706 authored by Krophil's avatar Krophil
Browse files

Few changes in accounting design

parent 43f51813
Pipeline #1347 passed with stage
in 5 minutes and 48 seconds
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<div id="accounting">
<p> <p>
<a href="{{ url('accounting:bank_list') }}">{% trans %}Accounting{% endtrans %}</a> > <a href="{{ url('accounting:bank_list') }}">{% trans %}Accounting{% endtrans %}</a> >
{% trans %}Accounting types{% endtrans %} {% trans %}Accounting types{% endtrans %}
...@@ -21,5 +22,6 @@ ...@@ -21,5 +22,6 @@
{% else %} {% else %}
{% trans %}There is no types in this website.{% endtrans %} {% trans %}There is no types in this website.{% endtrans %}
{% endif %} {% endif %}
</div>
{% endblock %} {% endblock %}
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<div id="accounting">
<p> <p>
<a href="{{ url('accounting:bank_list') }}">{% trans %}Accounting{% endtrans %}</a> > <a href="{{ url('accounting:bank_list') }}">{% trans %}Accounting{% endtrans %}</a> >
{{ object.name }} {{ object.name }}
...@@ -30,7 +31,7 @@ ...@@ -30,7 +31,7 @@
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
</div>
{% endblock %} {% endblock %}
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<div id="accounting">
<h4> <h4>
{% trans %}Accounting{% endtrans %} {% trans %}Accounting{% endtrans %}
</h4> </h4>
...@@ -25,6 +26,7 @@ ...@@ -25,6 +26,7 @@
{% else %} {% else %}
{% trans %}There is no accounts in this website.{% endtrans %} {% trans %}There is no accounts in this website.{% endtrans %}
{% endif %} {% endif %}
</div>
{% endblock %} {% endblock %}
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<div id="accounting">
<p> <p>
<a href="{{ url('accounting:bank_list') }}">{% trans %}Accounting{% endtrans %}</a> > <a href="{{ url('accounting:bank_list') }}">{% trans %}Accounting{% endtrans %}</a> >
<a href="{{ url('accounting:bank_details', b_account_id=object.bank_account.id) }}">{{object.bank_account }}</a> > <a href="{{ url('accounting:bank_details', b_account_id=object.bank_account.id) }}">{{object.bank_account }}</a> >
...@@ -63,4 +64,5 @@ ...@@ -63,4 +64,5 @@
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
</div>
{% endblock %} {% endblock %}
...@@ -5,12 +5,13 @@ ...@@ -5,12 +5,13 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
{% if user.is_in_group(settings.SITH_GROUP_ACCOUNTING_ADMIN_ID) or user.is_root %} <div id="accounting">
<p><a href="{{ url('accounting:co_new') }}">{% trans %}Create new company{% endtrans %}</a></p> {% if user.is_in_group(settings.SITH_GROUP_ACCOUNTING_ADMIN_ID) or user.is_root %}
{% endif %} <p><a href="{{ url('accounting:co_new') }}">{% trans %}Create new company{% endtrans %}</a></p>
{% endif %}
</br> </br>
<table> <table>
<thead> <thead>
<tr> <tr>
<td>{% trans %}Companies{% endtrans %}</td> <td>{% trans %}Companies{% endtrans %}</td>
...@@ -23,6 +24,6 @@ ...@@ -23,6 +24,6 @@
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
</div>
{% endblock %} {% endblock %}
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<div id="accounting">
<p> <p>
<a href="{{ url('accounting:bank_list') }}">{% trans %}Accounting{% endtrans %}</a> > <a href="{{ url('accounting:bank_list') }}">{% trans %}Accounting{% endtrans %}</a> >
<a href="{{ url('accounting:bank_details', b_account_id=object.club_account.bank_account.id) }}">{{object.club_account.bank_account }}</a> > <a href="{{ url('accounting:bank_details', b_account_id=object.club_account.bank_account.id) }}">{{object.club_account.bank_account }}</a> >
...@@ -24,6 +25,7 @@ ...@@ -24,6 +25,7 @@
<p><a href="{{ url('accounting:op_new', j_id=object.id) }}">{% trans %}New operation{% endtrans %}</a></p> <p><a href="{{ url('accounting:op_new', j_id=object.id) }}">{% trans %}New operation{% endtrans %}</a></p>
</br> </br>
{% endif %} {% endif %}
<div class="journal-table">
<table> <table>
<thead> <thead>
<tr> <tr>
...@@ -48,7 +50,11 @@ ...@@ -48,7 +50,11 @@
<td>{{ o.number }}</td> <td>{{ o.number }}</td>
<td>{{ o.date }}</td> <td>{{ o.date }}</td>
<td>{{ o.label or "" }}</td> <td>{{ o.label or "" }}</td>
<td>{{ o.amount }}</td> {% if o.accounting_type.movement_type == "DEBIT" %}
<td class="neg-amount">&nbsp;{{ o.amount }}&nbsp;</td>
{% else %}
<td class="pos-amount">&nbsp;{{ o.amount }}&nbsp;</td>
{% endif %}
<td>{{ o.get_mode_display() }}</td> <td>{{ o.get_mode_display() }}</td>
{% if o.target_type == "OTHER" %} {% if o.target_type == "OTHER" %}
<td>{{ o.target_label }}</td> <td>{{ o.target_label }}</td>
...@@ -65,10 +71,10 @@ ...@@ -65,10 +71,10 @@
<td>{{ o.remark }} <td>{{ o.remark }}
{% if not o.linked_operation and o.target_type == "ACCOUNT" and not o.target.has_open_journal() %} {% if not o.linked_operation and o.target_type == "ACCOUNT" and not o.target.has_open_journal() %}
<p><strong> <p><strong>
{% trans %}Warning: this operation has no linked operation because the targeted club account has no opened journal.{% endtrans %} {% trans %}Warning: this operation has no linked operation because the targeted club account has no opened journal.{% endtrans %}
</strong></p> </strong></p>
<p><strong> <p><strong>
{% trans url=o.target.get_absolute_url() %}Open a journal in <a href="{{ url }}">this club account</a>, then save this operation again to make the linked operation.{% endtrans %} {% trans url=o.target.get_absolute_url() %}Open a journal in <a href="{{ url }}">this club account</a>, then save this operation again to make the linked operation.{% endtrans %}
</strong></p> </strong></p>
{% endif %} {% endif %}
</td> </td>
...@@ -89,4 +95,6 @@ ...@@ -89,4 +95,6 @@
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
</div>
</div>
{% endblock %} {% endblock %}
...@@ -6,9 +6,10 @@ ...@@ -6,9 +6,10 @@
{% block content %} {% block content %}
<h3>{% trans %}Accounting statement: {% endtrans %} {{ object.name }}</h3> <div id="accounting">
<h3>{% trans %}Accounting statement: {% endtrans %} {{ object.name }}</h3>
<table> <table>
<thead> <thead>
<tr> <tr>
<td>{% trans %}Operation type{% endtrans %}</td> <td>{% trans %}Operation type{% endtrans %}</td>
...@@ -24,9 +25,9 @@ ...@@ -24,9 +25,9 @@
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
<p><strong>{% trans %}Amount: {% endtrans %}</strong>{{ object.amount }}</p>
<p><strong>{% trans %}Effective amount: {% endtrans %}</strong>{{ object.effective_amount }}</p>
<p><strong>{% trans %}Amount: {% endtrans %}</strong>{{ object.amount }}</p>
<p><strong>{% trans %}Effective amount: {% endtrans %}</strong>{{ object.effective_amount }}</p>
</div>
{% endblock %} {% endblock %}
...@@ -5,8 +5,9 @@ ...@@ -5,8 +5,9 @@
{% endblock %} {% endblock %}
{% macro display_tables(dict) %} {% macro display_tables(dict) %}
<h6>{% trans %}Credit{% endtrans %}</h6> <div id="accounting">
<table> <h6>{% trans %}Credit{% endtrans %}</h6>
<table>
<thead> <thead>
<tr> <tr>
<td>{% trans %}Nature of operation{% endtrans %}</td> <td>{% trans %}Nature of operation{% endtrans %}</td>
...@@ -21,11 +22,11 @@ ...@@ -21,11 +22,11 @@
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
{% trans %}Total: {% endtrans %}{{ dict['CREDIT_sum'] }} {% trans %}Total: {% endtrans %}{{ dict['CREDIT_sum'] }}
<h6>{% trans %}Debit{% endtrans %}</h6> <h6>{% trans %}Debit{% endtrans %}</h6>
<table> <table>
<thead> <thead>
<tr> <tr>
<td>{% trans %}Nature of operation{% endtrans %}</td> <td>{% trans %}Nature of operation{% endtrans %}</td>
...@@ -40,17 +41,17 @@ ...@@ -40,17 +41,17 @@
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
{% trans %}Total: {% endtrans %}{{ dict['DEBIT_sum'] }} {% trans %}Total: {% endtrans %}{{ dict['DEBIT_sum'] }}
{% endmacro %} {% endmacro %}
{% block content %} {% block content %}
<h3>{% trans %}Statement by nature: {% endtrans %} {{ object.name }}</h3> <h3>{% trans %}Statement by nature: {% endtrans %} {{ object.name }}</h3>
{% for k,v in statement.items() %} {% for k,v in statement.items() %}
<h4 style="background: lightblue; padding: 4px;">{{ k }} : {{ v['CREDIT_sum'] - v['DEBIT_sum'] }}</h4> <h4 style="background: lightblue; padding: 4px;">{{ k }} : {{ v['CREDIT_sum'] - v['DEBIT_sum'] }}</h4>
{{ display_tables(v) }} {{ display_tables(v) }}
<hr> <hr>
{% endfor %} {% endfor %}
</div>
{% endblock %} {% endblock %}
...@@ -6,11 +6,12 @@ ...@@ -6,11 +6,12 @@
{% block content %} {% block content %}
<h3>{% trans %}Statement by person: {% endtrans %} {{ object.name }}</h3> <div id="accounting">
<h3>{% trans %}Statement by person: {% endtrans %} {{ object.name }}</h3>
<h4>{% trans %}Credit{% endtrans %}</h4> <h4>{% trans %}Credit{% endtrans %}</h4>
<table> <table>
<thead> <thead>
<tr> <tr>
<td>{% trans %}Target of the operation{% endtrans %}</td> <td>{% trans %}Target of the operation{% endtrans %}</td>
...@@ -32,13 +33,13 @@ ...@@ -32,13 +33,13 @@
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
<p>Total : {{ total_credit }}</p> <p>Total : {{ total_credit }}</p>
<h4>{% trans %}Debit{% endtrans %}</h4> <h4>{% trans %}Debit{% endtrans %}</h4>
<table> <table>
<thead> <thead>
<tr> <tr>
<td>{% trans %}Target of the operation{% endtrans %}</td> <td>{% trans %}Target of the operation{% endtrans %}</td>
...@@ -60,8 +61,8 @@ ...@@ -60,8 +61,8 @@
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
<p>Total : {{ total_debit }}</p>
<p>Total : {{ total_debit }}</p>
</div>
{% endblock %} {% endblock %}
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<div id="accounting">
<p> <p>
<a href="{{ url('accounting:bank_list') }}">{% trans %}Accounting{% endtrans %}</a> > <a href="{{ url('accounting:bank_list') }}">{% trans %}Accounting{% endtrans %}</a> >
<a href="{{ url('accounting:bank_details', b_account_id=object.bank_account.id) }}">{{object.bank_account }}</a> > <a href="{{ url('accounting:bank_details', b_account_id=object.bank_account.id) }}">{{object.bank_account }}</a> >
...@@ -30,5 +31,6 @@ ...@@ -30,5 +31,6 @@
{% else %} {% else %}
{% trans %}There is no label in this club account.{% endtrans %} {% trans %}There is no label in this club account.{% endtrans %}
{% endif %} {% endif %}
</div>
{% endblock %} {% endblock %}
...@@ -5,22 +5,25 @@ ...@@ -5,22 +5,25 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<p> <div id="accounting">
<a href="{{ url('accounting:bank_list') }}">{% trans %}Accounting{% endtrans %}</a> > <p>
<a href="{{ url('accounting:bank_details', b_account_id=object.club_account.bank_account.id) }}">{{object.club_account.bank_account }}</a> > <a href="{{ url('accounting:bank_list') }}">{% trans %}Accounting{% endtrans %}</a> >
<a href="{{ url('accounting:club_details', c_account_id=object.club_account.id) }}">{{ object.club_account }}</a> > <a href="{{ url('accounting:bank_details', b_account_id=object.club_account.bank_account.id) }}">{{object.club_account.bank_account }}</a> >
<a href="{{ url('accounting:journal_details', j_id=object.id) }}">{{ object.name }}</a> > <a href="{{ url('accounting:club_details', c_account_id=object.club_account.id) }}">{{ object.club_account }}</a> >
{% trans %}Edit operation{% endtrans %} <a href="{{ url('accounting:journal_details', j_id=object.id) }}">{{ object.name }}</a> >
</p> {% trans %}Edit operation{% endtrans %}
<hr> </p>
<h2>{% trans %}Edit operation{% endtrans %}</h2> <hr>
<form action="" method="post"> <h2>{% trans %}Edit operation{% endtrans %}</h2>
<form action="" method="post">
{% csrf_token %} {% csrf_token %}
{{ form.non_field_errors() }} {{ form.non_field_errors() }}
{{ form.journal }} {{ form.journal }}
{{ form.target_id }} {{ form.target_id }}
<p>{{ form.amount.errors }}<label for="{{ form.amount.name }}">{{ form.amount.label }}</label> {{ form.amount }}</p> <p>{{ form.amount.errors }}<label for="{{ form.amount.name }}">{{ form.amount.label }}</label> {{ form.amount }}</p>
<p>{{ form.remark.errors }}<label for="{{ form.remark.name }}">{{ form.remark.label }}</label> {{ form.remark }}</p> <p>{{ form.remark.errors }}<label for="{{ form.remark.name }}">{{ form.remark.label }}</label> {{ form.remark }}</p>
<br />
<strong>{% trans %}Warning: if you select <em>Account</em>, the opposite operation will be created in the target account. If you don't want that, select <em>Club</em> instead of <em>Account</em>.{% endtrans %}</strong>
<p>{{ form.target_type.errors }}<label for="{{ form.target_type.name }}">{{ form.target_type.label }}</label> {{ form.target_type }}</p> <p>{{ form.target_type.errors }}<label for="{{ form.target_type.name }}">{{ form.target_type.label }}</label> {{ form.target_type }}</p>
{{ form.user }} {{ form.user }}
{{ form.club }} {{ form.club }}
...@@ -49,13 +52,13 @@ ...@@ -49,13 +52,13 @@
</p> </p>
{% endif %} {% endif %}
<p><input type="submit" value="{% trans %}Save{% endtrans %}" /></p> <p><input type="submit" value="{% trans %}Save{% endtrans %}" /></p>
</form> </form>
{% endblock %} {% endblock %}
{% block script %} {% block script %}
{{ super() }} {{ super() }}
<script> <script>
$( function() { $( function() {
var target_type = $('#id_target_type'); var target_type = $('#id_target_type');
var user = $('#id_user_wrapper'); var user = $('#id_user_wrapper');
var club = $('#id_club_wrapper'); var club = $('#id_club_wrapper');
...@@ -105,7 +108,8 @@ $( function() { ...@@ -105,7 +108,8 @@ $( function() {
update_targets(); update_targets();
target_type.change(update_targets); target_type.change(update_targets);
} ); } );
</script> </script>
</div>
{% endblock %} {% endblock %}
...@@ -5,10 +5,12 @@ ...@@ -5,10 +5,12 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<div id="accounting">
<h3>{% trans %}Refound account{% endtrans %}</h3> <h3>{% trans %}Refound account{% endtrans %}</h3>
<form action="" method="post"> <form action="" method="post">
{% csrf_token %} {% csrf_token %}
{{ form.as_p() }} {{ form.as_p() }}
<p><input type="submit" value="{% trans %}Refound{% endtrans %}" /></p> <p><input type="submit" value="{% trans %}Refound{% endtrans %}" /></p>
</form> </form>
</div>
{% endblock %} {% endblock %}
\ No newline at end of file
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<div id="accounting">
<p> <p>
<a href="{{ url('accounting:bank_list') }}">{% trans %}Accounting{% endtrans %}</a> > <a href="{{ url('accounting:bank_list') }}">{% trans %}Accounting{% endtrans %}</a> >
{% trans %}Simplified types{% endtrans %} {% trans %}Simplified types{% endtrans %}
...@@ -21,5 +22,6 @@ ...@@ -21,5 +22,6 @@
{% else %} {% else %}
{% trans %}There is no types in this website.{% endtrans %} {% trans %}There is no types in this website.{% endtrans %}
{% endif %} {% endif %}
</div>
{% endblock %} {% endblock %}
...@@ -213,9 +213,9 @@ class OperationTest(TestCase): ...@@ -213,9 +213,9 @@ class OperationTest(TestCase):
def test_person_statement(self): def test_person_statement(self):
self.client.login(username='comptable', password='plop') self.client.login(username='comptable', password='plop')
response_get = self.client.get(reverse("accounting:journal_person_statement", args=[self.journal.id])) response_get = self.client.get(reverse("accounting:journal_person_statement", args=[self.journal.id]))
self.assertTrue("S&#39; Kia</a></td>\\n \\n <td>3.00</td>" in str(response_get.content)) self.assertTrue("<td>3.00</td>" in str(response_get.content) and '<td><a href="/user/1/">S&#39; Kia</a></td>' in str(response_get.content))
def test_accounting_statement(self): def test_accounting_statement(self):
self.client.login(username='comptable', password='plop') self.client.login(username='comptable', password='plop')
response_get = self.client.get(reverse("accounting:journal_accounting_statement", args=[self.journal.id])) response_get = self.client.get(reverse("accounting:journal_accounting_statement", args=[self.journal.id]))
self.assertTrue("<td>443 - Cr\\xc3\\xa9dit - Ce code n&#39;existe pas</td>\\n <td>3.00</td>" in str(response_get.content)) self.assertTrue("<td>443 - Cr\\xc3\\xa9dit - Ce code n&#39;existe pas</td>" in str(response_get.content))
...@@ -642,6 +642,31 @@ header { ...@@ -642,6 +642,31 @@ header {
display: block; display: block;
} }
/*---------------------------ACCOUNTING----------------------------*/
#accounting {
.journal-table {
tbody {
.neg-amount {
color: red;
&:before {
font-family: FontAwesome;
font-size: 1em;
content: "\f063";
}
}
.pos-amount {
color: green;
&:before {
font-family: FontAwesome;
font-size: 1em;
content: "\f062";
}
}
}
}
}
/*-----------------------------GENERAL-----------------------------*/
h1, h2, h3, h4, h5, h6 { h1, h2, h3, h4, h5, h6 {
font-weight: bold; font-weight: bold;
margin-top: 0.5em; margin-top: 0.5em;
......
This diff is collapsed.