Ajout gestion messages plus améliorations mineures

This commit is contained in:
Jean-Christophe Engel 2024-02-27 11:26:08 +01:00
parent 406408d47e
commit 7e6eb4ea12
4 changed files with 59 additions and 32 deletions

View File

@ -40,7 +40,7 @@
duration=$_POST.duree|intval
}}
{{:redirect to="index.html?ok=1"}}
{{:redirect to="index.html?ok=1&msg=immobilisation"}}
{{/form}}
{{* Préparer les infos pour le formulaire *}}

View File

@ -1,13 +1,20 @@
{{* -*- brindille -*- *}}
{{:admin_header title="Gestion des amortissements" custom_css=$custom_css current="module_amortissement"}}
{{:admin_header title="Liste des amortissements" custom_css="./style.css" current="module_amortissement"}}
{{* barre de navigation *}}
{{:include file="_nav.html" current="amortization"}}
{{if $_GET.ok}}
<p class="block confirm">Amortissement enregistré</p>
{{elseif $_GET.err}}
<p class="block error">Échec enregistrement amortissement</p>
{{/if}}
{{* récupérer les infos de l'immobilisation *}}
{{#load type="immo" assign="info_immo" where="$$.line = :line_id" :line_id=$_GET.line|intval}}
{{#load type="immo" assign="info_immo" where="$$.line = :line_id" :line_id=$_GET.line_id|intval}}
{{else}}
{{:assign message="Immobilisation %s non trouvée"|args:$_GET.line}}
{{:assign message="Pas d'info concernant l'immobilisation %s"|args:$_GET.line_id}}
{{:error message=$message}}
{{/load}}
@ -27,12 +34,12 @@
inner join acc_years as y on trans.id_year = y.id
left join acc_projects AS project ON line.id_project = project.id
where line.id = :line_id;
:line_id = $_GET.line|intval
:line_id = $_GET.line_id|intval
assign=ligne_immo
}}
<h2>Amortissement de « {{$label}} » d'un montant de {{"%f"|math:$montant|money_currency}} en date du {{$date_achat|date_short}} sur {{$info_immo.duration}} ans</h2>
{{else}}
{{:assign message="Immobilisation %s non trouvée"|args:$_GET.line}}
{{:assign message="Immobilisation %s non trouvée"|args:$_GET.line_id}}
{{:error message=$message}}
{{/select}}
@ -64,7 +71,7 @@
:line_id = $info_immo.line|intval
assign=lines.
}}
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$trans_id}}
{{*:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$trans_id*}}
{{/select}}
{{* calculer les amortissements *}}
@ -167,11 +174,11 @@
{{if $all_years|keys|has:$current_year}}
{{:linkbutton
label="Enregistrer"
href="save_amort.html?amount=%d&account=%s&year=%s&trans_id=%d&line_id=%s&project_id=%d&label=%s"|args:$annuite_courante:$ligne_immo.account_id:$current_year:$ligne_immo.trans_id:$_GET.line:$project_id:$libelle
href="save_amort.html?amount=%d&account=%s&year=%s&trans_id=%d&line_id=%s&project_id=%d&label=%s"|args:$annuite_courante:$ligne_immo.account_id:$current_year:$ligne_immo.trans_id:$_GET.line_id:$project_id:$libelle
shape="right"
}}
{{else}}
{{:linkbutton label="Enregistrer" href="" shape="alert"}}
{{:linkbutton label="Enregistrer" href="" shape="lock" class="disabled"}}
{{/if}}
</td>
</tr>

View File

@ -5,9 +5,14 @@
{{:include file="_nav.html" current="index"}}
{{if $_GET.ok}}
<p class="block confirm">Immobilisation enregistrée</p>
{{if $_GET.msg|match:"immobilisation"}}
{{:assign msg="Immobilisation enregistrée"}}
{{elseif $_GET.msg|match:"durée"}}
{{:assign msg="Durée enregistrée"}}
{{/if}}
<p class="block confirm">{{$msg}}</p>
{{elseif $_GET.err}}
<p class="block error">Enregistrement immobilisation refusée</p>
<p class="block error">Échec enregistrement immobilisation</p>
{{/if}}
{{* lister les immobilisations *}}
@ -51,25 +56,40 @@
(account.code LIKE '21%' OR account.code LIKE '22%')
ORDER BY trans.date DESC
}}
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$trans_id}}
{{#load type="immo" assign="info_immo" where="$$.line = :line_id" :line_id=$line_id|intval}}{{/load}}
<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="num">{{$info_immo.duration}}</td>
<td>{{$account_code}}</td>
<td>{{$account_label}}</td>
<td>{{$project_label}}</td>
<td class="actions">
{{:linkbutton
label="Amortissements"
href="amortization.html?line=%s"|args:$line_id
shape="table"
}}
</td>
</tr>
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$trans_id}}
{{#load type="immo" where="$$.line = :line_id" :line_id=$line_id|intval}}
{{*:debug info_immo=$info_immo*}}
{{:assign duration=$duration}}
{{else}}
{{:assign duration=null}}
{{/load}}
{{*:debug duration=$duration*}}
<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="num">{{if $duration != null}}{{$duration}}{{/if}}</td>
<td>{{$account_code}}</td>
<td>{{$account_label}}</td>
<td>{{$project_label}}</td>
<td class="actions">
{{if $duration == null}}
{{:linkbutton
label="Ajouter durée"
href="add_duration.html?line_id=%s"|args:$line_id
shape="help"
target="_dialog"
}}
{{else}}
{{:linkbutton
label="Amortissements"
href="amortization.html?line_id=%s"|args:$line_id
shape="table"
}}
{{/if}}
</td>
</tr>
{{/select}}
</tbody>
</table>

View File

@ -39,7 +39,7 @@
linked_transactions=$_GET.trans_id|intval
}}
{{:redirect to="amortization.html?line=%s"|args:$_GET.line_id}}
{{:redirect to="amortization.html?line_id=%s&ok=1"|args:$_GET.line_id}}
{{/form}}
{{* Préparer les infos pour le formulaire *}}