Compare commits
No commits in common. "main" and "val_defaut" have entirely different histories.
main
...
val_defaut
3 changed files with 57 additions and 24 deletions
|
|
@ -148,14 +148,12 @@
|
|||
</dl>
|
||||
</div>
|
||||
|
||||
{{if $valeur_residuelle > 0 || $linked_immos != null}}
|
||||
<h3 class="ruler">Avoirs</h3>
|
||||
<nav class="actions">
|
||||
<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>
|
||||
{{/if}}
|
||||
</nav>
|
||||
|
||||
{{if $linked_immos != null}}
|
||||
<table class="list">
|
||||
|
|
|
|||
|
|
@ -14,8 +14,6 @@
|
|||
{{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"}}
|
||||
|
|
@ -95,6 +93,44 @@
|
|||
|
||||
{{: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
|
||||
|
|
@ -112,6 +148,7 @@
|
|||
|
||||
{{: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"}}
|
||||
|
|
@ -149,16 +186,16 @@
|
|||
|
||||
<form method="post" action="">
|
||||
<fieldset>
|
||||
<legend>Informations</legend>
|
||||
<legend>Paramètres de l'amortissement</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=$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"}}
|
||||
{{: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"}}
|
||||
</dl>
|
||||
</fieldset>
|
||||
<p class="submit">
|
||||
|
|
|
|||
|
|
@ -11,16 +11,10 @@
|
|||
{{: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 *}}
|
||||
|
|
@ -66,16 +60,15 @@
|
|||
</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:$montant_immo|money_currency_html:false|raw}}</dd>
|
||||
<dt>Début d'amortissement</dt>
|
||||
<dd>{{$date_mes|date_short}}</dd>
|
||||
<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>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
|
|
@ -94,6 +87,11 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
{{#foreach from=$free_amort_lines item="line"}}
|
||||
{{*
|
||||
{{if $_GET.filter && $line.account_code != $code_amort}}
|
||||
{{:continue}}
|
||||
{{/if}}
|
||||
*}}
|
||||
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.trans_id}}
|
||||
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$line.account_id:$line.year}}
|
||||
<tr>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue