Merge branch 'main' into upgrade
This commit is contained in:
commit
79c704a76a
4 changed files with 37 additions and 63 deletions
|
|
@ -9,14 +9,8 @@
|
|||
{{:assign montant_affecte=0}}
|
||||
{{#load type="immo" where="$$.line = :line_id" :line_id=$_GET.immo_line_id|intval assign="info_immo"}}
|
||||
{{:assign montant_affecte="%d+%d"|math:$montant_affecte:$amount}}
|
||||
{{/load}}
|
||||
{{if $info_immo != null}}
|
||||
{{:assign date_defaut=$info_immo.date}}
|
||||
{{:assign duree_defaut=$info_immo.duration}}
|
||||
{{:assign choix_defaut=$info_immo.status}}
|
||||
{{else}}
|
||||
{{:assign duree_defaut=null}}
|
||||
{{/if}}
|
||||
{{/load}}
|
||||
|
||||
{{#select
|
||||
trans.id as immo_trans_id,
|
||||
|
|
@ -37,6 +31,12 @@
|
|||
{{:error message="Immobilisation non trouvée"}}
|
||||
{{/select}}
|
||||
{{:assign reste="%d-%d"|math:$ligne_immo.montant:$montant_affecte}}
|
||||
{{:assign date_achat_defaut=$info_immo.date_achat|or:$ligne_immo.date_achat}}
|
||||
{{:assign date_mes_defaut=$info_immo.date_mes|or:$info_immo.date_achat|or:$ligne_immo.date_achat}}
|
||||
{{:assign immo_label=$ligne_immo.trans_label}}
|
||||
{{if $ligne_immo.line_label != null && $ligne_immo.line_label != $ligne_immo.trans_label}}
|
||||
{{:assign immo_label=$immo_label|cat:" — "|cat:$ligne_immo.line_label}}
|
||||
{{/if}}
|
||||
|
||||
{{#form on="save"}}
|
||||
{{if $_POST.classify == null}}
|
||||
|
|
@ -177,7 +177,9 @@
|
|||
<div class="informations">
|
||||
<dl class="describe">
|
||||
<dt>Immobilisation</dt>
|
||||
<dd><span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.immo_trans_id}}</a></span> {{$ligne_immo.trans_label}}{{if $ligne_immo.line_label != null && $ligne_immo.line_label != $ligne_immo.trans_label}} — {{$ligne_immo.line_label}}{{/if}}</dd>
|
||||
<dd>
|
||||
<span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.immo_trans_id}}</a> </span>{{$immo_label}}
|
||||
</dd>
|
||||
<dt>Montant</dt>
|
||||
<dd class="money strong">{{"%f"|math:$ligne_immo.montant|money_currency_html:false|raw}}</dd>
|
||||
{{if $montant_affecte > 0}}
|
||||
|
|
@ -211,9 +213,9 @@
|
|||
<dl>
|
||||
{{:input type="number" name="duree" label="Durée d'amortissement" required=true min=1 suffix="année(s)"}}
|
||||
{{:input type="money" name="montant" label="Montant de l'immobilisation" required=true default=$reste help="à modifier si différent du montant de l'écriture d'immobilisation"}}
|
||||
{{:input type="date" name="date_achat" label="Date d'acquisition" help="à renseigner uniquement si différente de la date de l'écriture d'immobilisation"}}
|
||||
{{:input type="date" name="date_mes" label="Date de mise en service" help="à renseigner uniquement si différente de la date d'acquisition"}}
|
||||
{{:input type="text" name="libelle" label="Libellé" help="à renseigner uniquement si différent du libellé de l'écriture d'immobilisation"}}
|
||||
{{:input type="date" name="date_achat" label="Date d'acquisition" default=$date_achat_defaut help="à modifier si nécessaire"}}
|
||||
{{:input type="date" name="date_mes" label="Date de mise en service" default=$date_mes_defaut help="à modifier si différente de la date d'acquisition"}}
|
||||
{{:input type="text" name="libelle" label="Libellé" default=$immo_label help="à modifier si nécessaire"}}
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
|
|
|
|||
|
|
@ -148,12 +148,14 @@
|
|||
</dl>
|
||||
</div>
|
||||
|
||||
<h3 class="ruler">Avoirs</h3>
|
||||
<nav class="actions">
|
||||
{{if $valeur_residuelle > 0 || $linked_immos != null}}
|
||||
<h3 class="ruler">Avoirs</h3>
|
||||
<nav class="actions">
|
||||
{{if $total_amort == 0 || ! $created_amort}}
|
||||
{{:linkbutton label="Attacher une écriture d'avoir" href="link_immo.html?immo_doc_id=%s&filter=true"|args:$_GET.immo_doc_id shape="link" target="_dialog"}}
|
||||
{{/if}}
|
||||
</nav>
|
||||
</nav>
|
||||
{{/if}}
|
||||
|
||||
{{if $linked_immos != null}}
|
||||
<table class="list">
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@
|
|||
{{if $ligne_immo.line_label != null && $ligne_immo.line_label != $immo_label}}
|
||||
{{:assign immo_label=$immo_label|cat:" — "|cat:$ligne_immo.line_label}}
|
||||
{{/if}}
|
||||
{{:assign date_achat_defaut=$info_immo.date_achat|or:$ligne_immo.date_achat}}
|
||||
{{:assign date_mes_defaut=$info_immo.date_mes|or:$info_immo.date_achat|or:$ligne_immo.date_achat}}
|
||||
|
||||
{{* déduire le montant des écritures liées à l'immo courante au crédit du même compte *}}
|
||||
{{:include file="_get_credit_lines.html" immo_doc_id=$_GET.immo_doc_id keep="linked_immos, total_credits"}}
|
||||
|
|
@ -93,44 +95,6 @@
|
|||
|
||||
{{:assign status="managed"}}
|
||||
|
||||
{{* écritures de crédit *}}
|
||||
{{#foreach from=$linked_immos item="line"}}
|
||||
{{if ! $_POST.credit_id|has:$line.trans_id}}
|
||||
{{:assign var="docs_to_remove." value=$line.doc}}
|
||||
{{:assign var="links_to_remove." value=$line.trans_id}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
|
||||
{{if $docs_to_remove != null}}
|
||||
{{:assign remove_set=$docs_to_remove|implode:","}}
|
||||
{{:assign remove_set="("|cat:$remove_set|cat:")"}}
|
||||
{{:delete where="id IN %s"|args:$remove_set}}
|
||||
|
||||
{{* idem avec acc_transactions_links *}}
|
||||
{{#select
|
||||
CASE links.id_related = :immo_trans_id
|
||||
WHEN true THEN links.id_transaction
|
||||
WHEN false THEN links.id_related
|
||||
END as linked_id
|
||||
FROM acc_transactions_links as links
|
||||
WHERE id_transaction = :immo_trans_id or id_related = :immo_trans_id;
|
||||
:immo_trans_id = $ligne_immo.trans_id
|
||||
}}
|
||||
{{if ! $linked_id|in:$links_to_remove}}
|
||||
{{:assign var="linked_transactions." value=$linked_id}}
|
||||
{{/if}}
|
||||
{{/select}}
|
||||
|
||||
{{* Enregistrer les liaisons *}}
|
||||
{{:api
|
||||
method="POST"
|
||||
path="accounting/transaction/%s/transactions"|args:$ligne_immo.trans_id
|
||||
assign="result"
|
||||
assign_code="result_code"
|
||||
transactions=$linked_transactions
|
||||
}}
|
||||
{{/if}}
|
||||
|
||||
{{* enregistrer les infos de l'immobilisation *}}
|
||||
{{:save
|
||||
key=$info_immo.key
|
||||
|
|
@ -148,7 +112,6 @@
|
|||
|
||||
{{:assign type_immo="managed"}}
|
||||
{{:redirect force="amortization.html?immo_doc_id=%s&type_immo=%s&ok=1&msg=modif"|args:$_GET.immo_doc_id:$type_immo}}
|
||||
|
||||
{{/form}}
|
||||
|
||||
{{:admin_header title="Modifier l'immobilisation" custom_css="./style.css" current="module_amortization"}}
|
||||
|
|
@ -186,16 +149,16 @@
|
|||
|
||||
<form method="post" action="">
|
||||
<fieldset>
|
||||
<legend>Paramètres de l'amortissement</legend>
|
||||
<legend>Informations</legend>
|
||||
<dl>
|
||||
{{:input type="number" name="duree" label="Durée d'amortissement" min=1 default=$info_immo.duration suffix="année(s)"}}
|
||||
{{if $info_immo.amount != null}}
|
||||
{{:assign max_aff="%f"|math:$max_disponible|money_currency:false}}
|
||||
{{:input type="money" name="montant" label="Montant de l'immobilisation" default=$montant_immo help="Montant maximum : %s"|args:$max_aff}}
|
||||
{{/if}}
|
||||
{{:input type="date" name="date_achat" label="Date d'acquisition" default=$info_immo.date_achat help="si différente de la date de l'écriture d'immobilisation"}}
|
||||
{{:input type="date" name="date_mes" label="Date de mise en service" default=$info_immo.date_mes help="si différente de la date d'acquisition"}}
|
||||
{{:input type="text" name="libelle" label="Libellé" default=$info_immo.label help="si différent du libellé de l'écriture d'immobilisation"}}
|
||||
{{:input type="date" name="date_achat" label="Date d'acquisition" default=$date_achat_defaut help="si différente de la date de l'écriture d'immobilisation"}}
|
||||
{{:input type="date" name="date_mes" label="Date de mise en service" default=$date_mes_defaut help="si différente de la date d'acquisition"}}
|
||||
{{:input type="text" name="libelle" label="Libellé" default=$immo_label help="si différent du libellé de l'écriture d'immobilisation"}}
|
||||
</dl>
|
||||
</fieldset>
|
||||
<p class="submit">
|
||||
|
|
|
|||
|
|
@ -11,10 +11,16 @@
|
|||
{{:error message=$message}}
|
||||
{{/if}}
|
||||
|
||||
{{:assign montant_immo=$info_immo.amount|or:$ligne_immo.amount}}
|
||||
{{:assign label_immo=$info_immo.label|or:$ligne_immo.trans_label}}
|
||||
{{if $ligne_immo.line_label != null && $ligne_immo.line_label != $label_immo}}
|
||||
{{:assign label_immo=$label_immo|cat:" — "|cat:$ligne_immo.line_label}}
|
||||
{{/if}}
|
||||
{{:assign date_mes=$info_immo.date_mes|or:$info_immo.date_achat|or:$ligne_immo.date_achat}}
|
||||
|
||||
{{* déduire le montant des écritures liées à l'immo courante au crédit du même compte *}}
|
||||
{{:include file="_get_credit_lines.html" immo_doc_id=$_GET.immo_doc_id keep="linked_immos, total_credits"}}
|
||||
{{:assign montant_immo="%d-%d"|math:$montant_immo:$total_credits}}
|
||||
|
||||
{{if $_GET.filter}}
|
||||
{{* déterminer le compte d'amortissement en fonction du compte d'immobilisation *}}
|
||||
|
|
@ -60,15 +66,16 @@
|
|||
</ul>
|
||||
</nav>
|
||||
|
||||
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$ligne_immo.trans_id}}
|
||||
<section class="amortissement">
|
||||
<div class="informations">
|
||||
<dl class="describe">
|
||||
<dt>Immobilisation</dt>
|
||||
<dd><span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.trans_id}}</a></span> {{$label_immo}}</dd>
|
||||
<dt>Montant</dt>
|
||||
<dd class="money strong">{{"%f"|math:$ligne_immo.amount|money_currency_html:false|raw}}</dd>
|
||||
<dt>Date de l'immobilisation</dt>
|
||||
<dd>{{$ligne_immo.date_achat|date_short}}</dd>
|
||||
<dd class="money strong">{{"%f"|math:$montant_immo|money_currency_html:false|raw}}</dd>
|
||||
<dt>Début d'amortissement</dt>
|
||||
<dd>{{$date_mes|date_short}}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue