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
1 changed files with 36 additions and 3 deletions

View File

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