Ajout enregistrement écriture d'amortissement

This commit is contained in:
Jean-Christophe Engel 2024-02-17 19:01:04 +01:00
parent 5e081c4f23
commit 5e8026e09b

View File

@ -6,6 +6,40 @@
{{/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=%s"|args:$_GET.line_id}}
{{/form}}
{{* Préparer les infos pour le formulaire *}}
{{:assign var="debit_account.6811" value="6811 — Dot. aux amortissements des immobilisations"}}
@ -21,7 +55,6 @@
{{: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}}
{{*:debug year.id=$year.id year.end_date=$year.end_date|date_short*}}
{{#years closed=false}}
{{:assign var="open_years.%d"|args:$id value=$label}}
@ -45,7 +78,7 @@
}}
{{:input
type="list"
name="credi_account"
name="credit_account"
label="Compte d'amortissement (280xx ou 281xx)"
required=true
target="!acc/charts/accounts/selector.php?key=code&year=%d"|args:$year.id
@ -55,7 +88,7 @@
</fieldset>
<p class="submit">
{{:button type="submit" name="add" label="Enregistrer" shape="right" class="main"}}
{{:button type="submit" name="save" label="Enregistrer" shape="right" class="main"}}
</p>
</form>
{{:admin_footer}}