Suppression paramètre ligne immobilisation
This commit is contained in:
parent
3d1109018e
commit
9649d6af0e
9 changed files with 63 additions and 74 deletions
|
|
@ -2,11 +2,15 @@
|
|||
|
||||
{{*
|
||||
Créer une écriture d'amortissement
|
||||
@param immo_line_id : id de la ligne d'immobilisation
|
||||
@param immo_doc_id : id du doc associé à l'immo
|
||||
*}}
|
||||
|
||||
{{* Infos de l'immobilisation *}}
|
||||
{{#load id=$_GET.immo_doc_id|intval assign="info_immo"}}
|
||||
{{else}}
|
||||
{{:error message="Immobilisation non trouvée"}}
|
||||
{{/load}}
|
||||
|
||||
{{#select
|
||||
line.id_account as account_id,
|
||||
line.debit as montant,
|
||||
|
|
@ -21,37 +25,24 @@
|
|||
INNER JOIN acc_accounts AS account ON line.id_account = account.id
|
||||
LEFT JOIN acc_projects AS project ON line.id_project = project.id
|
||||
WHERE line.id = :line_id;
|
||||
:line_id = $_GET.immo_line_id|intval
|
||||
:line_id = $info_immo.line
|
||||
assign="ligne_immo"
|
||||
}}
|
||||
{{else}}
|
||||
{{:error message="Immobilisation non trouvée"}}
|
||||
{{/select}}
|
||||
{{:assign date_debut=$ligne_immo.date}}
|
||||
|
||||
{{#load id=$_GET.immo_doc_id|intval assign="info_immo"}}
|
||||
{{:assign duree=$duration}}
|
||||
{{if $date_achat != null}}
|
||||
{{:assign date_debut=$date_achat}}
|
||||
{{/if}}
|
||||
{{if $date_mes != null}}
|
||||
{{:assign date_debut=$date_mes}}
|
||||
{{/if}}
|
||||
{{:assign status=$status}}
|
||||
{{:assign amort_label=$label|or:$ligne_immo.label}}
|
||||
{{if $amount != null}}
|
||||
{{:assign var="ligne_immo.montant" value=$amount}}
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{:error message="Informations de l'immobilisation « %s » non trouvées ; vous devez d'abord les renseigner"|args:$ligne_immo.label}}
|
||||
{{/load}}
|
||||
{{if $info_immo.amount != null}}
|
||||
{{:assign var="ligne_immo.montant" value=$info_immo.amount}}
|
||||
{{/if}}
|
||||
{{:assign date_debut=$info_immo.date_mes|or:$info_immo.date_achat|or:$ligne_immo.date}}
|
||||
{{:assign amort_label=$info_immo.label|or:$ligne_immo.label}}
|
||||
|
||||
{{if $ligne_immo.line_label != null && $ligne_immo.line_label != $amort_label}}
|
||||
{{:assign amort_label=$amort_label|cat:" — "|cat:$ligne_immo.line_label}}
|
||||
{{/if}}
|
||||
{{:assign var="amort_label" value="Amortissement %s"|args:$amort_label}}
|
||||
|
||||
{{if $status == "amortized" || $status == "archived"}}
|
||||
{{if $info_immo.status == "amortized" || $info_immo.status == "archived"}}
|
||||
{{:error message="Cette immobilisation est complètement amortie ; il est impossible d'ajouter une écriture d'amortissement"}}
|
||||
{{/if}}
|
||||
|
||||
|
|
@ -264,14 +255,14 @@
|
|||
|
||||
{{* immo soldée ? *}}
|
||||
{{if $_POST.montant|trim|money_int == $solde}}
|
||||
{{:assign status="amortized"}}
|
||||
{{:assign var="info_immo.status" value="amortized"}}
|
||||
{{:save
|
||||
key=$info_immo.key
|
||||
status=$status
|
||||
status=$info_immo.status
|
||||
}}
|
||||
{{/if}}
|
||||
|
||||
{{:redirect force="amortization.html?immo_line_id=%s&immo_doc_id=%s&type_immo=%s&ok=1&msg=amortissement"|args:$_GET.immo_line_id:$_GET.immo_doc_id:$status}}
|
||||
{{:redirect force="amortization.html?immo_doc_id=%s&type_immo=%s&ok=1&msg=amortissement"|args:$_GET.immo_doc_id:$info_immo.status}}
|
||||
{{/form}}
|
||||
|
||||
{{:admin_header title="Ajout amortissement" custom_css="./style.css" current="module_amortization"}}
|
||||
|
|
@ -288,7 +279,7 @@
|
|||
{{:include file="_calcul_dates.html" date_debut=$date_debut date_fin=$date_amort keep="nbjours"}}
|
||||
|
||||
{{* montant de l'amortissement *}}
|
||||
{{:assign montant_amort="%f/%f/365*%d"|math:$ligne_immo.montant:$duree:$nbjours|intval}}
|
||||
{{:assign montant_amort="%f/%f/365*%d"|math:$ligne_immo.montant:$info_immo.duration:$nbjours|intval}}
|
||||
{{:assign montant_amort="min(%f, %d-%d)"|math:$montant_amort:$ligne_immo.montant:$total_amort}}
|
||||
{{:assign var="debit_account.6811" value="6811 — Dot. aux amortissements des immobilisations"}}
|
||||
{{:assign var="credit_account.%s"|args:$code_amort value="%s — "|args:$code_amort|cat:$amort_account_label}}
|
||||
|
|
@ -325,7 +316,7 @@
|
|||
}}
|
||||
<div id="donnees" class="hidden">
|
||||
{{:input type="text" name="montant_immo" default=$ligne_immo.montant}}
|
||||
{{:input type="text" name="duree_amort" default=$duree}}
|
||||
{{:input type="text" name="duree_amort" default=$info_immo.duration}}
|
||||
{{:input type="text" name="somme_amort" default=$total_amort}}
|
||||
{{:input type="select" name="years_data" options=$years_data}}
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue