Compare commits

...

7 commits
v0.22 ... main

Author SHA1 Message Date
Jean-Christophe Engel
b8ff213645 Complément filtrage des libellés 2025-12-02 16:51:20 +01:00
Jean-Christophe Engel
b4096821e7 Mise-à-jour numéro version 2025-12-02 14:47:24 +01:00
Jean-Christophe Engel
c6e344fb80 Sortie du bilan : utilisation comptes PC 2025 2025-12-02 14:44:12 +01:00
Jean-Christophe Engel
a9fdb1a195 Modification présentation totaux (fin tableau) 2025-12-02 14:43:10 +01:00
Jean-Christophe Engel
018ee5583c Ajout colonnes Amortissements et Valeur nette dans tables des immos 2025-11-28 14:04:23 +01:00
Jean-Christophe Engel
79d5afc147 module.ini : ajout numéro version 2025-11-26 12:04:11 +01:00
Jean-Christophe Engel
3e9f215816 Ajout totaux dans les onglets Amortissables, Amorties et En cours 2025-11-26 12:03:52 +01:00
8 changed files with 178 additions and 18 deletions

View file

@ -8,13 +8,21 @@
{{* Immobilisation avec une écriture de sortie de bilan *}}
{{:include file="_get_config.html" keep="module.config"}}
{{:assign condition="("}}
{{:assign accounts_condition="("}}
{{#foreach from=$module.config.prefixes item="code"}}
{{:assign code=$code|cat:"%"|quote_sql}}
{{:assign condition=$condition|cat:"account.code LIKE "|cat:$code|cat:" OR "}}
{{:assign accounts_condition=$accounts_condition|cat:"account.code LIKE "|cat:$code|cat:" OR "}}
{{/foreach}}
{{:assign condition=$condition|cat:"0)"}}
{{:assign condition=$condition|cat:" AND acc2.code = account.code AND line.debit > 0 AND line.debit = line2.credit AND NOT (trans.status & 16)"}}
{{:assign accounts_condition=$accounts_condition|cat:"0)"}}
{{:assign condition=$accounts_condition|cat:" AND acc2.code = account.code AND line.debit > 0 AND line.debit = line2.credit AND NOT (trans.status & 16)"}}
{{:assign filter_condition=" NOT ("}}
{{#foreach from=$module.config.filters item="filter"}}
{{:assign filter="%"|cat:$filter|cat:"%"|quote_sql}}
{{:assign filter_condition=$filter_condition|cat:" trans_label LIKE "|cat:$filter|cat:" OR "}}
{{/foreach}}
{{:assign filter_condition=$filter_condition|cat:"0)"}}
{{:assign condition=$condition|cat:" AND "|cat:$filter_condition}}
{{#select
trans.id as trans_id,
@ -31,7 +39,6 @@
FROM acc_transactions AS trans
INNER JOIN acc_transactions_lines AS line ON line.id_transaction = trans.id
INNER JOIN acc_accounts AS account ON line.id_account = account.id
INNER JOIN acc_years AS years ON trans.id_year = years.id
INNER JOIN acc_transactions_lines AS line2 ON line.debit = line2.credit
INNER JOIN acc_transactions AS trans2 ON trans2.id = line2.id_transaction
INNER JOIN acc_accounts AS acc2 ON acc2.id = line2.id_account
@ -61,10 +68,15 @@
</thead>
<tbody>
{{:assign nb_immo=0}}
{{:assign total_immo = 0}}
{{:assign total_cessions = 0}}
{{#foreach from=$immo_archivees}}
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$trans_id}}
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$account_id:$trans_id_year}}
{{:assign nb_immo="%d+1"|math:$nb_immo}}
{{:assign total_immo="%d+%d"|math:$total_immo:$debit}}
{{:assign var="montant" from="sommes_immo.%s"|args:$account_code}}
{{:assign var="sommes_immo.%s"|args:$account_code value="%d+%d"|math:$montant:$debit}}
<tr>
<td class="num"><a href={{$trans_url}}>#{{$trans_id}}</a></td>
<td>{{$trans_date|date_short}}</td>
@ -77,8 +89,90 @@
<td class="actions">
</td>
</tr>
{{* voir s'il y a une écriture de cession associée à cette immo *}}
{{#select
trans.id,
trans.label,
trans.date,
line.id,
line.debit,
acc.code,
acc.label
FROM acc_transactions_links AS link
INNER JOIN acc_transactions AS trans ON (CASE
WHEN link.id_transaction = :trans_id THEN link.id_related
WHEN link.id_related = :trans_id THEN link.id_transaction
END) = trans.id
INNER JOIN acc_transactions_lines AS line ON line.id_transaction = trans.id
INNER JOIN acc_accounts AS acc ON line.id_account = acc.id
WHERE (link.id_transaction = :trans_id OR link.id_related = :trans_id) AND acc.code = 462
;
:trans_id = $trans_id
}}
{{:assign var="montant" from="montant_cessions.%d"|args:$account_code}}
{{:assign var="montant_cessions.%d"|args:$account_code value="%d+%d"|math:$montant:$debit}}
{{:assign total_cessions="%d+%d"|math:$total_cessions:$debit}}
{{/select}}
{{/foreach}}
</tbody>
</tbody>
<tfoot>
{{if $total_immo != 0}}
{{#foreach from=$sommes_immo|ksort key="code" item="value"}}
<tr>
<td></td>
<td></td>
<td></td>
<td>Total du compte {{$code}}</td>
<td class="money">{{$value|money}}</td>
<td></td>
<td></td>
<td></td>
<td class="actions"></td>
</tr>
{{/foreach}}
<tr>
<td></td>
<td></td>
<td></td>
<td>Total des immobilisations</td>
<td class="money"><span class="strong">{{$total_immo|money}}</span></td>
<td></td>
<td></td>
<td></td>
<td class="actions"></td>
</tr>
{{/if}}
{{if $total_cessions != 0}}
<tr>
<td colspan="9">
</tr>
{{#foreach from=$montant_cessions|ksort key="code" item="value"}}
<tr>
<td></td>
<td></td>
<td></td>
<td>Cessions du compte {{$code}}</td>
<td class="money">{{$value|money}}</td>
<td></td>
<td></td>
<td></td>
<td class="actions"></td>
</tr>
{{/foreach}}
<tr>
<td></td>
<td></td>
<td></td>
<td>Total des cessions</td>
<td class="money"><span class="strong">{{$total_cessions|money}}</span></td>
<td></td>
<td></td>
<td></td>
<td class="actions"></td>
</tr>
{{/if}}
</tfoot>
</table>
{{if $nb_immo == 0}}
<p class="block alert">Aucune immobilisation</p>

View file

@ -15,13 +15,14 @@
<table class="list">
<thead>
<tr>
<th></th>
<th class="num"></th>
<th>Date</th>
<th>Libellé</th>
<th class="nombre">Montant</th>
<th class="nombre">Durée</th>
<th class="nombre">Amortissements</th>
<th class="nombre">Valeur nette</th>
<th>N° compte</th>
<th>Compte</th>
<th class="actions"></th>
</tr>
</thead>
@ -47,6 +48,7 @@
{{:assign condition=$condition|cat:" AND "|cat:$filter_condition}}
{{:assign nb_immo=0}}
{{:assign total_immo = 0}}
{{#select
trans.id as trans_id,
trans.label as trans_label,
@ -148,14 +150,18 @@
{{if $type_immo == "amortized" && $amort_amount < $debit && $status != "amortized"}}{{:continue}}{{/if}}
{{:assign nb_immo="%d+1"|math:$nb_immo}}
{{:assign total_immo="%d+%d"|math:$total_immo:$debit}}
{{:assign var="montant" from="sommes_immo.%s"|args:$account_code}}
{{:assign var="sommes_immo.%s"|args:$account_code value="%d+%d"|math:$montant:$debit}}
<tr>
<td class="num"><a href={{$trans_url}}>#{{$trans_id}}</a></td>
<td>{{$trans_date|date_short}}</td>
<td>{{$trans_label}}</td>
<td class="money">{{"%f"|math:$debit|money}}</td>
<td class="money">{{$debit|money}}</td>
<td class="money">{{if $duration != null}}{{$duration}}{{/if}}</td>
<td class="money">{{$amort_amount|money|or:"0,00"}}</td>
<td class="money">{{"%d-%d"|math:$debit:$amort_amount|money|or:"0,00"}}</td>
<td><a href={{$compte_url}}>{{$account_code}}</a></td>
<td>{{$account_label}}</td>
<td class="actions">
{{if ! $exist_amort}}
{{:linkbutton
@ -181,6 +187,34 @@
</tr>
{{/select}}
</tbody>
<tfoot>
{{if $total_immo != 0}}
{{#foreach from=$sommes_immo|ksort key="code" item="value"}}
<tr>
<td></td>
<td></td>
<td>Total du compte {{$code}}</td>
<td class="money">{{$value|money}}</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td class="actions"></td>
</tr>
{{/foreach}}
<tr>
<td></td>
<td></td>
<td>Total des immobilisations</td>
<td class="money"><span class="strong">{{$total_immo|money}}</span></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td class="actions"></td>
</tr>
{{/if}}
</tfoot>
</table>
{{if $nb_immo == 0}}
<p class="block alert">Aucune immobilisation</p>

View file

@ -37,7 +37,6 @@
{{if $current == "config"}}
<ul class="sub">
<li {{if $subcurrent == null}} class="current"{{/if}}><a href="config.html">Comptes d'immobilisation</a></li>
<li {{if $subcurrent == "create_accounts"}} class="current"{{/if}}><a href="create_accounts.html">Comptes de sortie du bilan</a></li>
<li {{if $subcurrent == "filters"}} class="current"{{/if}}><a href="filters.html">Filtres de libellés</a></li>
</ul>
{{/if}}

View file

@ -43,7 +43,7 @@
<th class="num"></th>
<th>Date</th>
<th>Libellé</th>
<th class="money">Montant</th>
<th class="nombre">Montant</th>
<th>N° compte</th>
<th>Compte</th>
<th class="actions"></th>
@ -72,6 +72,7 @@
{{*:debug condition=$condition*}}
{{:assign nb_immo=0}}
{{:assign total_immo = 0}}
{{#select
trans.id as trans_id,
trans.label as trans_label,
@ -122,6 +123,9 @@
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$trans_id}}
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$account_id:$trans_id_year}}
{{:assign nb_immo="%d+1"|math:$nb_immo}}
{{:assign total_immo="%d+%d"|math:$total_immo:$debit}}
{{:assign var="montant" from="sommes_immo.%s"|args:$account_code}}
{{:assign var="sommes_immo.%s"|args:$account_code value="%d+%d"|math:$montant:$debit}}
<tr>
<td class="check">{{:input type="checkbox" name="selected[]" value=$trans_id}}</td>
@ -142,6 +146,32 @@
</tr>
{{/select}}
</tbody>
<tfoot>
{{if $total_immo != 0}}
{{#foreach from=$sommes_immo|ksort key="code" item="value"}}
<tr>
<td></td>
<td></td>
<td></td>
<td>Total du compte {{$code}}</td>
<td class="money">{{$value|money}}</td>
<td></td>
<td></td>
<td class="actions"></td>
</tr>
{{/foreach}}
<tr>
<td></td>
<td></td>
<td></td>
<td>Total des immobilisations</td>
<td class="money"><span class="strong">{{$total_immo|money}}</span></td>
<td></td>
<td></td>
<td class="actions"></td>
</tr>
{{/if}}
</tfoot>
</table>
{{if $nb_immo == 0}}
<p class="block alert">Aucune immobilisation</p>

View file

@ -192,9 +192,9 @@
<dd>{{$duree}} ans</dd>
{{/if}}
{{if $valeur_residuelle > 0}}
<dt>Montant déjà amorti</dt>
<dt>Montant des amortissements</dt>
<dd>{{"%d-%d"|math:$ligne_immo.montant:$valeur_residuelle|money_currency:false}}</dd>
<dt>Valeur résiduelle</dt>
<dt>Valeur nette comptable</dt>
<dd>{{$valeur_residuelle|money_currency}}</dd>
{{/if}}
{{if $duree != null && $valeur_residuelle > 0}}

View file

@ -1,5 +1,5 @@
name="Amortissements"
description="Immobilisations et amortissements"
description="Immobilisations et amortissements\nversion 0.24"
author="Jean-Christophe Engel"
author_url="https://gitea.zaclys.com/lesanges"
home_button=false

View file

@ -31,7 +31,7 @@ h2[class="aide"], h3[class="aide"] {
}
.informations dt::after {
content: ' :';
content: ' : ';
}
.informations dl.describe > dt {
@ -39,7 +39,6 @@ h2[class="aide"], h3[class="aide"] {
}
.informations dl.describe > dd {
margin-left: 0;
margin-right: 0;
}
@ -52,3 +51,7 @@ fieldset.shortFormLeft div.informations {
background: rgba(var(--gSecondColor), 0.2);
border-radius: .5em;
}
span.strong {
font-weight: bold;
}

View file

@ -270,8 +270,8 @@
Utilisation des « anciens » numéros de comptes because conflit
avec les nouveaux numéros ; voir info.org
*}}
{{:assign vnc_code="675"}}
{{:assign cession_code="775"}}
{{:assign vnc_code="652"}}
{{:assign cession_code="757"}}
{{:assign var="liste_codes.6811" name="comp_account"}}
{{:assign var="liste_codes.687" name="except_account"}}