{{* -*- brindille -*- *}} {{:admin_header title="Ajout amortissement" current="module_amortissement"}} {{* barre de navigation *}} {{if ! $dialog}} {{:include file="_nav.html" current="amortization"}} {{/if}} {{* Traiter l'envoi du formulaire *}} {{#form on="save"}} {{* enregistrer l'écriture *}} {{:assign var="linked_transactions." value=$_GET.trans_id}} {{:assign var="lines." debit=$_POST.montant account=$_POST.debit_account|keys|key:0 id_project=$_GET.project_id label=$_POST.designation }} {{:assign var="lines." credit=$_POST.montant account=$_POST.credit_account|keys|key:0 id_project=$_GET.project_id label=$_POST.designation }} {{:api method="POST" path="accounting/transaction" assign="result" assign_code="result_code" id_year=$_POST.id_year|intval type="advanced" date=$_POST.date label=$_POST.designation lines=$lines linked_transactions=$_GET.trans_id|intval }} {{:redirect to="amortization.html?line_id=%s&ok=1"|args:$_GET.line_id}} {{/form}} {{* Préparer les infos pour le formulaire *}} {{:assign var="debit_account.6811" value="6811 — Dot. aux amortissements des immobilisations"}} {{* déterminer le compte d'amortissement en fonction du compte d'immobilisation => ajouter un 8 après le 2 de tête *}} {{#select code, label from acc_accounts where id = :id; :id=$_GET.account assign=amort_account}}{{/select}} {{:assign c1=$amort_account.code|substr:0:1}} {{:assign reste=$amort_account.code|substr:1}} {{:assign amort_code=$c1|cat:8|cat:$reste}} {{:assign var="credit_account.%s"|args:$amort_code value="%s — Amortissements "|args:$amort_code|cat:$amort_account.label}} {{#select id, label, end_date from acc_years where id=:id; :id=$_GET.year assign=year}}{{/select}} {{#years closed=false}} {{:assign var="open_years.%d"|args:$id value=$label}} {{/years}}
{{:admin_footer}}