{{:admin_header title="Ajout immobilisation" current="module_amortissement"}} {{* barre de navigation *}} {{if ! $dialog}} {{:include file="_nav.html" current="index"}} {{/if}} {{* Traiter l'envoi du formulaire *}} {{#form on="add"}} {{* enregistrer l'écriture *}} {{:assign var="credit_accounts" value=$_POST.credit_account|keys}} {{:assign var="credit_account" value=$credit_accounts.0}} {{:assign var="debit_accounts" value=$_POST.debit_account|keys}} {{:assign var="debit_account" value=$debit_accounts.0}} {{:api method="POST" path="accounting/transaction" assign="result" id_year=$_POST.id_year type="revenue" date=$_POST.date label=$_POST.designation amount=$_POST.montant debit=$debit_account credit=$credit_account id_project=$_POST.id_project }} {{* enregistrer les infos de l'immobilisation *}} {{:assign var="line_id" value=$result.lines.1.id}} {{:assign key=""|uuid}} {{:save key=$key validate_schema="schema.json" type="immo" line=$line_id duration=$_POST.duree|intval }} {{:redirect to="index.html?ok=1"}} {{/form}} {{* Préparer les infos pour le formulaire *}} {{:assign var="bank_account.512A" value="512A — Compte courant"}} {{#years closed=false}} {{:assign var="open_years.%d"|args:$id value=$label}} {{if $start_date|strtotime <= $now && $end_date|strtotime >= $now}} {{:assign best_year=$id}} {{/if}} {{/years}} {{* formulaire d'ajout d'immobilisation *}} {{* TODO - ajouter autres rubriques selon besoin *}} {{#select id,label FROM acc_projects WHERE archived = 0;}} {{:assign var="projects.%d"|args:$id value=$label}} {{/select}}
{{:admin_footer}}