Compare commits
No commits in common. "main" and "v0.33" have entirely different histories.
12 changed files with 114 additions and 162 deletions
|
|
@ -7,7 +7,7 @@
|
||||||
*}}
|
*}}
|
||||||
|
|
||||||
{{* données de l'immobilisation *}}
|
{{* données de l'immobilisation *}}
|
||||||
{{:include file="_get_immo_data.html" immo_doc_id=$immo_doc_id|intval keep="info_immo, ligne_immo, message"}}
|
{{:include file="_get_immo_data.html" immo_doc_id=$immo_doc_id|intval keep="ligne_immo, message"}}
|
||||||
{{if $message != null}}
|
{{if $message != null}}
|
||||||
{{:error message=$message}}
|
{{:error message=$message}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,14 @@
|
||||||
{{:assign montant_affecte=0}}
|
{{:assign montant_affecte=0}}
|
||||||
{{#load type="immo" where="$$.line = :line_id" :line_id=$_GET.immo_line_id|intval assign="info_immo"}}
|
{{#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}}
|
{{:assign montant_affecte="%d+%d"|math:$montant_affecte:$amount}}
|
||||||
{{:assign choix_defaut=$info_immo.status}}
|
|
||||||
{{/load}}
|
{{/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}}
|
||||||
|
|
||||||
{{#select
|
{{#select
|
||||||
trans.id as immo_trans_id,
|
trans.id as immo_trans_id,
|
||||||
|
|
@ -31,12 +37,6 @@
|
||||||
{{:error message="Immobilisation non trouvée"}}
|
{{:error message="Immobilisation non trouvée"}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
{{:assign reste="%d-%d"|math:$ligne_immo.montant:$montant_affecte}}
|
{{: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"}}
|
{{#form on="save"}}
|
||||||
{{if $_POST.classify == null}}
|
{{if $_POST.classify == null}}
|
||||||
|
|
@ -177,9 +177,7 @@
|
||||||
<div class="informations">
|
<div class="informations">
|
||||||
<dl class="describe">
|
<dl class="describe">
|
||||||
<dt>Immobilisation</dt>
|
<dt>Immobilisation</dt>
|
||||||
<dd>
|
<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>
|
||||||
<span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.immo_trans_id}}</a> </span>{{$immo_label}}
|
|
||||||
</dd>
|
|
||||||
<dt>Montant</dt>
|
<dt>Montant</dt>
|
||||||
<dd class="money strong">{{"%f"|math:$ligne_immo.montant|money_currency_html:false|raw}}</dd>
|
<dd class="money strong">{{"%f"|math:$ligne_immo.montant|money_currency_html:false|raw}}</dd>
|
||||||
{{if $montant_affecte > 0}}
|
{{if $montant_affecte > 0}}
|
||||||
|
|
@ -213,9 +211,9 @@
|
||||||
<dl>
|
<dl>
|
||||||
{{:input type="number" name="duree" label="Durée d'amortissement" required=true min=1 suffix="année(s)"}}
|
{{: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="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" default=$date_achat_defaut help="à modifier si nécessaire"}}
|
{{: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" default=$date_mes_defaut help="à modifier si différente de la date d'acquisition"}}
|
{{: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é" default=$immo_label help="à modifier si nécessaire"}}
|
{{:input type="text" name="libelle" label="Libellé" help="à renseigner uniquement si différent du libellé de l'écriture d'immobilisation"}}
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -148,14 +148,12 @@
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{if $valeur_residuelle > 0 || $linked_immos != null}}
|
<h3 class="ruler">Avoirs</h3>
|
||||||
<h3 class="ruler">Avoirs</h3>
|
<nav class="actions">
|
||||||
<nav class="actions">
|
{{if $total_amort == 0 || ! $created_amort}}
|
||||||
{{if $total_amort == 0 || ! $created_amort}}
|
{{:linkbutton label="Attacher une écriture d'avoir" href="link_immo.html?immo_doc_id=%s"|args:$_GET.immo_doc_id shape="link" target="_dialog"}}
|
||||||
{{: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}}
|
||||||
{{/if}}
|
</nav>
|
||||||
</nav>
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{if $linked_immos != null}}
|
{{if $linked_immos != null}}
|
||||||
<table class="list">
|
<table class="list">
|
||||||
|
|
|
||||||
33
config.html
33
config.html
|
|
@ -46,7 +46,6 @@
|
||||||
{{/form}}
|
{{/form}}
|
||||||
|
|
||||||
{{:admin_header title="Configuration" custom_css="./style.css" current="module_amortization"}}
|
{{:admin_header title="Configuration" custom_css="./style.css" current="module_amortization"}}
|
||||||
|
|
||||||
{{:include file="_nav.html" current="config"}}
|
{{:include file="_nav.html" current="config"}}
|
||||||
{{if $_GET.ok == 1}}
|
{{if $_GET.ok == 1}}
|
||||||
<p class="block confirm">Configuration enregistrée.</p>
|
<p class="block confirm">Configuration enregistrée.</p>
|
||||||
|
|
@ -155,14 +154,13 @@
|
||||||
}}
|
}}
|
||||||
</td>
|
</td>
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
{{if ! $code|in:$config_defaut.prefixes}}
|
{{:button
|
||||||
{{:button
|
label="Enlever"
|
||||||
label="Enlever"
|
title="Enlever une ligne"
|
||||||
shape="minus"
|
shape="minus"
|
||||||
min="1"
|
min="1"
|
||||||
name="remove_line"
|
name="remove_line"
|
||||||
}}
|
}}
|
||||||
{{/if}}
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
|
@ -189,7 +187,6 @@
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
||||||
{{:assign unfinished_lines=$config_defaut.unfinished|map:implode:"-"|implode:","}}
|
|
||||||
{{#foreach from=$unfinished_accounts key=code item=elem}}
|
{{#foreach from=$unfinished_accounts key=code item=elem}}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
|
|
@ -203,15 +200,13 @@
|
||||||
}}
|
}}
|
||||||
</td>
|
</td>
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
{{if $unfinished_lines|strpos:$code === false}}
|
{{:button
|
||||||
{{:button
|
label="Enlever"
|
||||||
label="Enlever"
|
title="Enlever une ligne"
|
||||||
title="Enlever une ligne"
|
shape="minus"
|
||||||
shape="minus"
|
min="1"
|
||||||
min="1"
|
name="remove_line"
|
||||||
name="remove_line"
|
}}
|
||||||
}}
|
|
||||||
{{/if}}
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,8 @@
|
||||||
@param amort_line_id : id de la ligne d'amortissement
|
@param amort_line_id : id de la ligne d'amortissement
|
||||||
*}}
|
*}}
|
||||||
|
|
||||||
{{:include file="_common_detach.html" immo_doc_id=$_GET.immo_doc_id line_id=$_GET.amort_line_id keep="info_immo"}}
|
{{:include file="_common_detach.html" immo_doc_id=$_GET.immo_doc_id line_id=$_GET.amort_line_id}}
|
||||||
|
|
||||||
{{* supprimer le doc de liaison entre les lignes *}}
|
{{* supprimer le doc de liaison entre les lignes *}}
|
||||||
{{#load type="amort_link"
|
{{#load type="amort_link"
|
||||||
where="$$.immo_doc_id = :immo_doc_id AND $$.amort_line_id = :amort_line_id"
|
where="$$.immo_doc_id = :immo_doc_id AND $$.amort_line_id = :amort_line_id"
|
||||||
|
|
@ -18,12 +19,11 @@
|
||||||
{{/load}}
|
{{/load}}
|
||||||
|
|
||||||
{{* marquer immo non soldée *}}
|
{{* marquer immo non soldée *}}
|
||||||
{{if $info_immo.status == "amortized"}}
|
{{* TODO : À VÉRIFIER *}}
|
||||||
{{:save
|
{{:save
|
||||||
key=$info_immo.key
|
key=$info_immo.key
|
||||||
status="managed"
|
status="managed"
|
||||||
}}
|
}}
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{if $_GET.from == "exit"}}
|
{{if $_GET.from == "exit"}}
|
||||||
{{:redirect force="exit_step2.html?immo_doc_id=%s&ok=1&msg=detach_amort"|args:$_GET.immo_doc_id}}
|
{{:redirect force="exit_step2.html?immo_doc_id=%s&ok=1&msg=detach_amort"|args:$_GET.immo_doc_id}}
|
||||||
|
|
|
||||||
|
|
@ -44,24 +44,6 @@
|
||||||
{{* lister les amortissements liés à l'immobilisation *}}
|
{{* lister les amortissements liés à l'immobilisation *}}
|
||||||
{{:include file="./_get_amort_lines.html" immo_doc_id=$_GET.immo_doc_id keep="linked_amort, total_amort"}}
|
{{:include file="./_get_amort_lines.html" immo_doc_id=$_GET.immo_doc_id keep="linked_amort, total_amort"}}
|
||||||
|
|
||||||
{{* chercher une écriture de cession associée *}}
|
|
||||||
{{#load type="cession_link"
|
|
||||||
where="$$.immo_doc_id = :immo_doc_id"
|
|
||||||
:immo_doc_id = $_GET.immo_doc_id|intval
|
|
||||||
}}
|
|
||||||
{{if $amount == null || $amount == 0}}
|
|
||||||
{{#select credit
|
|
||||||
FROM acc_transactions_lines
|
|
||||||
WHERE id = :cession_line_id;
|
|
||||||
:cession_line_id = $cession_line_id
|
|
||||||
}}
|
|
||||||
{{:assign montant_cession=$credit}}
|
|
||||||
{{/select}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign montant_cession=$amount}}
|
|
||||||
{{/if}}
|
|
||||||
{{/load}}
|
|
||||||
|
|
||||||
{{* chercher une écriture de sortie de bilan associée *}}
|
{{* chercher une écriture de sortie de bilan associée *}}
|
||||||
{{#load type="exit_link" where="$$.immo_doc_id = :immo_doc_id" :immo_doc_id=$info_immo.id assign="exit_info"}}
|
{{#load type="exit_link" where="$$.immo_doc_id = :immo_doc_id" :immo_doc_id=$info_immo.id assign="exit_info"}}
|
||||||
{{/load}}
|
{{/load}}
|
||||||
|
|
@ -218,10 +200,6 @@
|
||||||
<dt>Valeur nette résiduelle</dt>
|
<dt>Valeur nette résiduelle</dt>
|
||||||
<dd>{{"%d-%d"|math:$solde:$total_amort|money_currency_html:false|raw}}</dd>
|
<dd>{{"%d-%d"|math:$solde:$total_amort|money_currency_html:false|raw}}</dd>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{if $montant_cession > 0}}
|
|
||||||
<dt>Montant de la cession</dt>
|
|
||||||
<dd>{{$montant_cession|money_currency_html:false|raw}}</dd>
|
|
||||||
{{/if}}
|
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,7 @@
|
||||||
{{*
|
{{*
|
||||||
lister les écritures au crédit du compte de l'immobilisation
|
lister les écritures au crédit du compte de l'immobilisation
|
||||||
*}}
|
*}}
|
||||||
{{if $_GET.filter}}
|
{{:assign account_code=$ligne_immo.account_code|cat:"%"}}
|
||||||
{{:assign account_code=$ligne_immo.account_code|cat:"%"}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign account_code=$ligne_immo.account_code|substr:0:2|cat:"%"}}
|
|
||||||
{{/if}}
|
|
||||||
{{#select
|
{{#select
|
||||||
line.id as credit_line_id,
|
line.id as credit_line_id,
|
||||||
line.id_transaction as credit_trans_id,
|
line.id_transaction as credit_trans_id,
|
||||||
|
|
@ -65,32 +61,23 @@
|
||||||
}}
|
}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
<nav class="tabs">
|
|
||||||
<ul>
|
|
||||||
<li {{if $_GET.filter}}class="current"{{/if}}>
|
|
||||||
<a href="link_immo.html?immo_doc_id={{$_GET.immo_doc_id}}{{if $dialog}}&_dialog{{/if}}&filter=true">
|
|
||||||
Compte {{$ligne_immo.account_code}} et sous-comptes
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li {{if ! $_GET.filter}}class="current"{{/if}}>
|
|
||||||
<a href="link_immo.html?immo_doc_id={{$_GET.immo_doc_id}}{{if $dialog}}&_dialog{{/if}}">
|
|
||||||
Compte {{$ligne_immo.account_code|substr:0:2}} et sous-comptes
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<section class="immobilisation">
|
<section class="immobilisation">
|
||||||
|
<fieldset>
|
||||||
|
<legend>
|
||||||
|
Écritures au crédit du compte d'immobilisation « {{$ligne_immo.account_code}} » et sous-comptes
|
||||||
|
</legend>
|
||||||
|
|
||||||
<div class="informations">
|
<div class="informations">
|
||||||
<dl class="describe">
|
<dl class="describe">
|
||||||
<dt>Immobilisation</dt>
|
<dt>Immobilisation</dt>
|
||||||
<dd><span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.trans_id}}</a></span> {{$label_immo}}</dd>
|
<dd><span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.trans_id}}</a></span> {{$label_immo}}</dd>
|
||||||
<dt>Montant</dt>
|
<dt>Montant</dt>
|
||||||
<dd class="money strong">{{"%f"|math:$ligne_immo.amount|money_currency_html:false|raw}}</dd>
|
<dd class="money strong">{{"%f"|math:$ligne_immo.amount|money_currency_html:false|raw}}</dd>
|
||||||
<dt>Date de l'immobilisation</dt>
|
<dt>Date de l'écriture d'immobilisation</dt>
|
||||||
<dd>{{$ligne_immo.date_achat|date_short}}</dd>
|
<dd>{{$ligne_immo.date_achat|date_short}}</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
{{if $other_immos != null}}
|
{{if $other_immos != null}}
|
||||||
<table class="list">
|
<table class="list">
|
||||||
|
|
@ -124,8 +111,8 @@
|
||||||
</tr>
|
</tr>
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
</tbody>
|
</tbody>
|
||||||
<p class="help">Sélectionner une écriture d'avoir ou autre réduction du montant de l'acquisition pour l'associer à l'immobilisation</p>
|
|
||||||
</table>
|
</table>
|
||||||
|
<p class="help">Sélectionner une écriture d'avoir ou autre réduction du montant de l'acquisition pour l'associer à l'immobilisation</p>
|
||||||
{{else}}
|
{{else}}
|
||||||
<p class="block alert">Aucune écriture au crédit du compte « {{$ligne_immo.account_code}} »</p>
|
<p class="block alert">Aucune écriture au crédit du compte « {{$ligne_immo.account_code}} »</p>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,6 @@
|
||||||
{{if $ligne_immo.line_label != null && $ligne_immo.line_label != $immo_label}}
|
{{if $ligne_immo.line_label != null && $ligne_immo.line_label != $immo_label}}
|
||||||
{{:assign immo_label=$immo_label|cat:" — "|cat:$ligne_immo.line_label}}
|
{{:assign immo_label=$immo_label|cat:" — "|cat:$ligne_immo.line_label}}
|
||||||
{{/if}}
|
{{/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 *}}
|
{{* 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"}}
|
{{: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"}}
|
{{: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 *}}
|
{{* enregistrer les infos de l'immobilisation *}}
|
||||||
{{:save
|
{{:save
|
||||||
key=$info_immo.key
|
key=$info_immo.key
|
||||||
|
|
@ -112,6 +148,7 @@
|
||||||
|
|
||||||
{{:assign type_immo="managed"}}
|
{{: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}}
|
{{:redirect force="amortization.html?immo_doc_id=%s&type_immo=%s&ok=1&msg=modif"|args:$_GET.immo_doc_id:$type_immo}}
|
||||||
|
|
||||||
{{/form}}
|
{{/form}}
|
||||||
|
|
||||||
{{:admin_header title="Modifier l'immobilisation" custom_css="./style.css" current="module_amortization"}}
|
{{:admin_header title="Modifier l'immobilisation" custom_css="./style.css" current="module_amortization"}}
|
||||||
|
|
@ -149,16 +186,16 @@
|
||||||
|
|
||||||
<form method="post" action="">
|
<form method="post" action="">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Informations</legend>
|
<legend>Paramètres de l'amortissement</legend>
|
||||||
<dl>
|
<dl>
|
||||||
{{:input type="number" name="duree" label="Durée d'amortissement" min=1 default=$info_immo.duration suffix="année(s)"}}
|
{{: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}}
|
{{if $info_immo.amount != null}}
|
||||||
{{:assign max_aff="%f"|math:$max_disponible|money_currency:false}}
|
{{: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}}
|
{{:input type="money" name="montant" label="Montant de l'immobilisation" default=$montant_immo help="Montant maximum : %s"|args:$max_aff}}
|
||||||
{{/if}}
|
{{/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_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=$date_mes_defaut help="si différente de la date d'acquisition"}}
|
{{: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=$immo_label help="si différent du libellé de l'écriture d'immobilisation"}}
|
{{:input type="text" name="libelle" label="Libellé" default=$info_immo.label help="si différent du libellé de l'écriture d'immobilisation"}}
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<p class="submit">
|
<p class="submit">
|
||||||
|
|
|
||||||
|
|
@ -11,16 +11,10 @@
|
||||||
{{:error message=$message}}
|
{{:error message=$message}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{:assign montant_immo=$info_immo.amount|or:$ligne_immo.amount}}
|
|
||||||
{{:assign label_immo=$info_immo.label|or:$ligne_immo.trans_label}}
|
{{:assign label_immo=$info_immo.label|or:$ligne_immo.trans_label}}
|
||||||
{{if $ligne_immo.line_label != null && $ligne_immo.line_label != $label_immo}}
|
{{if $ligne_immo.line_label != null && $ligne_immo.line_label != $label_immo}}
|
||||||
{{:assign label_immo=$label_immo|cat:" — "|cat:$ligne_immo.line_label}}
|
{{:assign label_immo=$label_immo|cat:" — "|cat:$ligne_immo.line_label}}
|
||||||
{{/if}}
|
{{/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}}
|
{{if $_GET.filter}}
|
||||||
{{* déterminer le compte d'amortissement en fonction du compte d'immobilisation *}}
|
{{* déterminer le compte d'amortissement en fonction du compte d'immobilisation *}}
|
||||||
|
|
@ -66,20 +60,9 @@
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$ligne_immo.trans_id}}
|
{{if $free_amort_lines != null}}
|
||||||
<section class="amortissement">
|
<section class="amortissement">
|
||||||
<div class="informations">
|
<h3 class="ruler">Immobilisation « {{$label_immo}} »</h3>
|
||||||
<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>
|
|
||||||
</dl>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{if $free_amort_lines != null}}
|
|
||||||
<table class="list">
|
<table class="list">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
@ -94,6 +77,11 @@
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{{#foreach from=$free_amort_lines item="line"}}
|
{{#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 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}}
|
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$line.account_id:$line.year}}
|
||||||
<tr>
|
<tr>
|
||||||
|
|
@ -118,12 +106,11 @@
|
||||||
</tr>
|
</tr>
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
</tbody>
|
</tbody>
|
||||||
<p class="help">Sélectionner une écriture d'amortissement pour l'associer à l'immobilisation</p>
|
|
||||||
</table>
|
</table>
|
||||||
{{else}}
|
</section>
|
||||||
<p class="block alert">Aucun amortissement pour le compte {{$code_amort}}</p>
|
{{else}}
|
||||||
{{/if}}
|
<p class="block alert">Aucun amortissement pour le compte {{$code_amort}}</p>
|
||||||
</section>
|
{{/if}}
|
||||||
|
|
||||||
|
|
||||||
{{:form_errors}}
|
{{:form_errors}}
|
||||||
|
|
|
||||||
46
scripts.js
46
scripts.js
|
|
@ -145,21 +145,19 @@ function setSelectorYear(button_names, f_years_selector)
|
||||||
|
|
||||||
// Associer au bouton « Enlever » de chaque ligne l'action de suppression de la ligne
|
// Associer au bouton « Enlever » de chaque ligne l'action de suppression de la ligne
|
||||||
function initLine(row) {
|
function initLine(row) {
|
||||||
let removeBtn = row.querySelector('button[name="remove_line"]');
|
var removeBtn = row.querySelector('button[name="remove_line"]');
|
||||||
if (removeBtn != null) {
|
removeBtn.onclick = () => {
|
||||||
removeBtn.onclick = () => {
|
let count = removeBtn.closest("table").querySelectorAll('tbody tr').length;
|
||||||
let count = removeBtn.closest("table").querySelectorAll('tbody tr').length;
|
var min = removeBtn.getAttribute('min');
|
||||||
var min = removeBtn.getAttribute('min');
|
|
||||||
|
|
||||||
if (count <= min) {
|
if (count <= min) {
|
||||||
alert("Il n'est pas possible d'avoir moins de " + min + " ligne(s).");
|
alert("Il n'est pas possible d'avoir moins de " + min + " ligne(s).");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
row.parentNode.removeChild(row);
|
row.parentNode.removeChild(row);
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Associer au bouton « Ajouter » de chaque table l'action d'ajouter une ligne
|
// Associer au bouton « Ajouter » de chaque table l'action d'ajouter une ligne
|
||||||
|
|
@ -187,28 +185,6 @@ function addLine(button, codes) {
|
||||||
let lib = newNode.querySelector('.input-list span.label');
|
let lib = newNode.querySelector('.input-list span.label');
|
||||||
lib.innerText = '';
|
lib.innerText = '';
|
||||||
|
|
||||||
// si besoin, ajouter le bouton de suppression
|
|
||||||
let action_cell = newNode.querySelector('td.actions');
|
|
||||||
let removeBtn = newNode.querySelector('button[name="remove_line"]');
|
|
||||||
if (removeBtn == null) {
|
|
||||||
const attributs = {
|
|
||||||
"title" : "Enlever une ligne",
|
|
||||||
"min": "1",
|
|
||||||
"name": "remove_line",
|
|
||||||
"data-icon": "➖",
|
|
||||||
"type": "button",
|
|
||||||
"class": "icn-btn",
|
|
||||||
"value": "1",
|
|
||||||
"aria-label": "Enlever une ligne"
|
|
||||||
};
|
|
||||||
let new_button = document.createElement("button");
|
|
||||||
new_button.appendChild(document.createTextNode("Enlever"));
|
|
||||||
for (let attr in attributs) {
|
|
||||||
new_button.setAttribute(attr, attributs[attr]);
|
|
||||||
}
|
|
||||||
action_cell.appendChild(new_button);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ajouter la nouvelle ligne
|
// ajouter la nouvelle ligne
|
||||||
line.parentNode.appendChild(newNode);
|
line.parentNode.appendChild(newNode);
|
||||||
initLine(newNode);
|
initLine(newNode);
|
||||||
|
|
|
||||||
|
|
@ -181,7 +181,6 @@
|
||||||
duration=$duration
|
duration=$duration
|
||||||
date_mes=null
|
date_mes=null
|
||||||
status=$status
|
status=$status
|
||||||
created=true
|
|
||||||
}}
|
}}
|
||||||
{{if $_POST.amortir}}
|
{{if $_POST.amortir}}
|
||||||
{{:assign type_immo="managed"}}
|
{{:assign type_immo="managed"}}
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,6 @@
|
||||||
type="amort_link"
|
type="amort_link"
|
||||||
immo_doc_id=$info_immo.id
|
immo_doc_id=$info_immo.id
|
||||||
amort_line_id=$line.id
|
amort_line_id=$line.id
|
||||||
created=true
|
|
||||||
}}
|
}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
|
@ -208,7 +207,6 @@
|
||||||
type="exit_link"
|
type="exit_link"
|
||||||
immo_doc_id=$info_immo.id
|
immo_doc_id=$info_immo.id
|
||||||
exit_line_id=$line.id
|
exit_line_id=$line.id
|
||||||
created=true
|
|
||||||
}}
|
}}
|
||||||
{{:break}}
|
{{:break}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
@ -254,7 +252,6 @@
|
||||||
type="cession_link"
|
type="cession_link"
|
||||||
immo_doc_id=$info_immo.id
|
immo_doc_id=$info_immo.id
|
||||||
cession_line_id=$line.id
|
cession_line_id=$line.id
|
||||||
created=true
|
|
||||||
}}
|
}}
|
||||||
{{:break}}
|
{{:break}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue