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 duration=$_POST.duree|intval
}} }}
{{:redirect to="index.html?ok=1"}} {{:redirect to="index.html?ok=1&msg=immobilisation"}}
{{/form}} {{/form}}
{{* Préparer les infos pour le formulaire *}} {{* Préparer les infos pour le formulaire *}}

View File

@ -1,13 +1,20 @@
{{* -*- brindille -*- *}} {{* -*- 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 *}} {{* barre de navigation *}}
{{:include file="_nav.html" current="amortization"}} {{: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 *}} {{* 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}} {{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}} {{:error message=$message}}
{{/load}} {{/load}}
@ -27,12 +34,12 @@
inner join acc_years as y on trans.id_year = y.id inner join acc_years as y on trans.id_year = y.id
left join acc_projects AS project ON line.id_project = project.id left join acc_projects AS project ON line.id_project = project.id
where line.id = :line_id; where line.id = :line_id;
:line_id = $_GET.line|intval :line_id = $_GET.line_id|intval
assign=ligne_immo 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> <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}} {{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}} {{:error message=$message}}
{{/select}} {{/select}}
@ -64,7 +71,7 @@
:line_id = $info_immo.line|intval :line_id = $info_immo.line|intval
assign=lines. 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}} {{/select}}
{{* calculer les amortissements *}} {{* calculer les amortissements *}}
@ -167,11 +174,11 @@
{{if $all_years|keys|has:$current_year}} {{if $all_years|keys|has:$current_year}}
{{:linkbutton {{:linkbutton
label="Enregistrer" 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" shape="right"
}} }}
{{else}} {{else}}
{{:linkbutton label="Enregistrer" href="" shape="alert"}} {{:linkbutton label="Enregistrer" href="" shape="lock" class="disabled"}}
{{/if}} {{/if}}
</td> </td>
</tr> </tr>

View File

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

View File

@ -39,7 +39,7 @@
linked_transactions=$_GET.trans_id|intval 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}} {{/form}}
{{* Préparer les infos pour le formulaire *}} {{* Préparer les infos pour le formulaire *}}