Réorganisation présentation page amortissements
This commit is contained in:
parent
54603e9142
commit
6495737428
6 changed files with 72 additions and 209 deletions
|
|
@ -23,11 +23,9 @@
|
|||
}}
|
||||
{{:assign var="linked_transactions." value=$linked_id}}
|
||||
{{/select}}
|
||||
{{:debug immo_doc_id=$immo_doc_id trans_id=$trans_id linked_transactions=$linked_transactions}}
|
||||
|
||||
{{* ajouter la nouvelle liaison *}}
|
||||
{{:assign var="linked_transactions." value=$trans_id}}
|
||||
{{:debug ligne_immo=$ligne_immo linked_transactions=$linked_transactions}}
|
||||
{{* Enregistrer les liaisons *}}
|
||||
{{:api
|
||||
method="POST"
|
||||
|
|
|
|||
|
|
@ -68,6 +68,9 @@
|
|||
!table=$module.table
|
||||
!condition=$condition
|
||||
}}
|
||||
{{if $status != "managed" && $status != "amortized"}}
|
||||
{{:continue}}
|
||||
{{/if}}
|
||||
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$immo_trans_id}}
|
||||
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$account_id:$trans_id_year}}
|
||||
{{:assign montant_immo=$doc_amount|or:$debit}}
|
||||
|
|
@ -93,9 +96,8 @@
|
|||
{{/if}}
|
||||
{{/load}}
|
||||
|
||||
{{* Immobilisation soldée ? *}}
|
||||
{{* TODO ¿ marquer archivée ? *}}
|
||||
{{if $montant_immo == 0}}
|
||||
{{* Immobilisation soldée *}}
|
||||
{{:continue}}
|
||||
{{/if}}
|
||||
|
||||
|
|
@ -121,17 +123,9 @@
|
|||
<td class="money">{{"%d-%d"|math:$montant_immo:$amort_amount|money_html:false|raw}}</td>
|
||||
<td><a href="{{$compte_url}}">{{$account_code}}</a></td>
|
||||
<td class="actions">
|
||||
{{*if $amort_amount == 0*}}
|
||||
{{:linkbutton
|
||||
label="Détails"
|
||||
href="details_immo.html?immo_doc_id=%s"|args:$immo_doc_id
|
||||
shape="eye"
|
||||
}}
|
||||
{{* target="_dialog"*}}
|
||||
{{*/if*}}
|
||||
{{:linkbutton
|
||||
label="Amortissements"
|
||||
href="amortization.html?immo_doc_id=%s&type_immo=%s"|args:$immo_doc_id:$type_immo shape="table"
|
||||
label="Voir"
|
||||
href="amortization.html?immo_doc_id=%s&type_immo=%s"|args:$immo_doc_id:$type_immo shape="eye"
|
||||
}}
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -81,6 +81,8 @@
|
|||
{{:assign msg="Détachement avoir affectué"}}
|
||||
{{elseif $_GET.msg|match:"amortissement"}}
|
||||
{{:assign msg="Amortissement enregistré"}}
|
||||
{{elseif $_GET.msg|match:"modif"}}
|
||||
{{:assign msg="Modifications enregistrées"}}
|
||||
{{/if}}
|
||||
<p class="block confirm">{{$msg}}</p>
|
||||
{{elseif $_GET.err}}
|
||||
|
|
@ -110,48 +112,16 @@
|
|||
</fieldset>
|
||||
</form>
|
||||
|
||||
<nav style="margin-bottom: 1em;">
|
||||
<aside> {{* class="right">*}}
|
||||
{{if $free_amort_lines && ! $created_amort}}
|
||||
{{:linkbutton
|
||||
label="Attacher un amortissement"
|
||||
title="Attacher un amortissement existant"
|
||||
href="other_amortizations.html?immo_doc_id=%s&filter=true"|args:$_GET.immo_doc_id
|
||||
shape="link"
|
||||
target="_dialog"}}
|
||||
<h3 class="ruler">Immobilisation</h3>
|
||||
<p class="actions-center">
|
||||
{{if $total_amort == 0}}
|
||||
{{:linkbutton label="Modifier les paramètres" href="modify_infos.html?immo_doc_id=%s"|args:$_GET.immo_doc_id shape="edit" target="_dialog"}}
|
||||
{{if ! $info_immo.created}}
|
||||
{{:linkbutton label="Supprimer les paramètres" href="delete_infos.html?immo_doc_id=%s"|args:$_GET.immo_doc_id shape="delete" target="_dialog"}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{:linkbutton
|
||||
label="Enregistrer un amortissement"
|
||||
title="Enregistrer un nouvel amortissement"
|
||||
href="save_amort.html?immo_doc_id=%s"|args:$_GET.immo_doc_id target="_dialog"
|
||||
shape="plus"
|
||||
}}
|
||||
</aside>
|
||||
</nav>
|
||||
</p>
|
||||
|
||||
{{if $linked_immos != null}}
|
||||
<aside class="right">
|
||||
<table class="list">
|
||||
<caption>Écritures d'avoir liées</caption>
|
||||
<tbody>
|
||||
{{#foreach from=$linked_immos item="line"}}
|
||||
{{:assign url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.trans_id}}
|
||||
<tr>
|
||||
<td class="num"><a href="{{$url}}">#{{$line.trans_id}}</a></td>
|
||||
<td>{{$line.label}}</td>
|
||||
<td>{{$line.date|date_short}}</td>
|
||||
<td class="money">{{"%f"|math:$line.amount|money_currency_html:false|raw}}</td>
|
||||
<td>
|
||||
{{if $total_amort == 0}}
|
||||
{{:linkbutton label="Détacher" href="detach_credit.html?immo_doc_id=%s&credit_line_id=%s"|args:$_GET.immo_doc_id:$line.credit_line_id shape="minus"}}
|
||||
{{/if}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/foreach}}
|
||||
</tbody>
|
||||
</table>
|
||||
</aside>
|
||||
{{/if}}
|
||||
|
||||
<div class="informations">
|
||||
<dl class="describe">
|
||||
|
|
@ -186,7 +156,24 @@
|
|||
</dl>
|
||||
</div>
|
||||
|
||||
<h3 class="ruler">Amortissements enregistrés</h3>
|
||||
<h3 class="ruler">Amortissements</h3>
|
||||
<p class="actions-center">
|
||||
{{if $free_amort_lines && ! $created_amort}}
|
||||
{{:linkbutton
|
||||
label="Attacher un amortissement"
|
||||
title="Attacher un amortissement existant"
|
||||
href="other_amortizations.html?immo_doc_id=%s&filter=true"|args:$_GET.immo_doc_id
|
||||
shape="link"
|
||||
target="_dialog"}}
|
||||
{{/if}}
|
||||
{{:linkbutton
|
||||
label="Enregistrer un amortissement"
|
||||
title="Enregistrer un nouvel amortissement"
|
||||
href="save_amort.html?immo_doc_id=%s"|args:$_GET.immo_doc_id target="_dialog"
|
||||
shape="plus"
|
||||
}}
|
||||
</p>
|
||||
|
||||
{{if $linked_amort != null}}
|
||||
<section class="amortissement">
|
||||
<table class="list">
|
||||
|
|
@ -243,5 +230,41 @@
|
|||
{{if $linked_amort == null}}
|
||||
<p class="block alert">Aucun amortissement enregistré pour cette immobilisation ; utilisez le bouton « Enregistrer un amortissement » pour enregistrer un nouvel amortissement</p>
|
||||
{{/if}}
|
||||
|
||||
<h3 class="ruler">Avoirs</h3>
|
||||
<p class="actions-center">
|
||||
{{if $total_amort == 0}}
|
||||
{{:linkbutton label="Attacher une écriture d'avoir" href="link_immo.html?immo_doc_id=%s"|args:$_GET.immo_doc_id shape="link" target="_dialog"}}
|
||||
{{/if}}
|
||||
</p>
|
||||
|
||||
{{if $linked_immos != null}}
|
||||
<table class="list">
|
||||
<thead>
|
||||
<th class="num">N°</th>
|
||||
<th>Date</th>
|
||||
<th>Libellé</th>
|
||||
<th class="nombre">Montant</th>
|
||||
<th class="actions"></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#foreach from=$linked_immos item="line"}}
|
||||
{{:assign url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.trans_id}}
|
||||
<tr>
|
||||
<td class="num"><a href="{{$url}}">#{{$line.trans_id}}</a></td>
|
||||
<td>{{$line.date|date_short}}</td>
|
||||
<td>{{$line.label}}</td>
|
||||
<td class="money">{{"%f"|math:$line.amount|money_currency_html:false|raw}}</td>
|
||||
<td>
|
||||
{{if $total_amort == 0}}
|
||||
{{:linkbutton label="Détacher" href="detach_credit.html?immo_doc_id=%s&credit_line_id=%s"|args:$_GET.immo_doc_id:$line.credit_line_id shape="minus"}}
|
||||
{{/if}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/foreach}}
|
||||
</tbody>
|
||||
</table>
|
||||
{{/if}}
|
||||
|
||||
{{:form_errors}}
|
||||
{{:admin_footer}}
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@
|
|||
{{if $_GET.from == "exit"}}
|
||||
{{:redirect force="exit_step1.html?immo_doc_id=%s&ok=1&msg=attach_avoir"|args:$_GET.immo_doc_id}}
|
||||
{{else}}
|
||||
{{:redirect force="details_immo.html?immo_doc_id=%s&ok=1&msg=attach_credit"|args:$_GET.immo_doc_id}}
|
||||
{{:redirect force="amortization.html?immo_doc_id=%s&ok=1&msg=attach_credit"|args:$_GET.immo_doc_id}}
|
||||
{{/if}}
|
||||
{{/form}}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,15 +18,8 @@
|
|||
{{:delete id=$id}}
|
||||
{{/load}}
|
||||
|
||||
{{* TODO : À VÉRIFIER *}}
|
||||
{{:save
|
||||
id=$_GET.immo_doc_id|intval
|
||||
status="managed"
|
||||
}}
|
||||
|
||||
{{if $_GET.from == "exit"}}
|
||||
{{:redirect force="exit_step1.html?immo_doc_id=%s&ok=1&msg=detach_avoir"|args:$_GET.immo_doc_id}}
|
||||
{{else}}
|
||||
{{:redirect force="details_immo.html?immo_doc_id=%s&ok=1&msg=detach&"|args:$_GET.immo_doc_id}}
|
||||
{{*:redirect force="amortization.html?immo_doc_id=%s&ok=1&msg=detach_avoir"|args:$_GET.immo_doc_id*}}
|
||||
{{:redirect force="amortization.html?immo_doc_id=%s&ok=1&msg=detach_avoir"|args:$_GET.immo_doc_id}}
|
||||
{{/if}}
|
||||
|
|
|
|||
|
|
@ -1,145 +0,0 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
|
||||
{{*
|
||||
Afficher les détails d'une immmo
|
||||
- permettre l'association d'une immo au crédit du compte de l'immo
|
||||
- permettre de modifier les paramètres de l'immo
|
||||
@param immo_doc_id : numéro du doc d'immo
|
||||
*}}
|
||||
|
||||
{{* données de l'immobilisation *}}
|
||||
{{:include file="_get_immo_data.html" immo_doc_id=$_GET.immo_doc_id|intval keep="info_immo, ligne_immo, message"}}
|
||||
{{if $message != null}}
|
||||
{{:error message=$message}}
|
||||
{{/if}}
|
||||
|
||||
{{:assign var="info_immo.amount" value=$info_immo.amount|or:$ligne_immo.amount}}
|
||||
{{:assign var="info_immo.date_achat" value=$info_immo.date_achat|or:$ligne_immo.date_achat}}
|
||||
{{:assign var="info_immo.date_mes" value=$info_immo.date_mes|or:$info_immo.date_achat|or:$ligne_immo.date_achat}}
|
||||
{{:assign var="info_immo.label" value=$info_immo.label|or:$ligne_immo.trans_label}}
|
||||
{{if $ligne_immo.line_label != null && $ligne_immo.line_label != $info_immo.label}}
|
||||
{{:assign var="info_immo.label" value=$info_immo.label|cat:" — "|cat:$ligne_immo.line_label}}
|
||||
{{/if}}
|
||||
|
||||
{{* 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 solde="%d-%d"|math:$info_immo.amount:$total_credits}}
|
||||
|
||||
{{* lister les amortissements liés à l'immobilisation *}}
|
||||
{{:include file="./_get_amort_lines.html" immo_doc_id=$_GET.immo_doc_id keep="total_amort"}}
|
||||
|
||||
{{:admin_header title="Détails de l'immobilisation" custom_css="./style.css" current="module_amortization"}}
|
||||
|
||||
{{if ! $dialog}}
|
||||
{{:assign subsubcurrent=null}}
|
||||
{{if $total_amort == 0}}
|
||||
{{:assign subsubcurrent="credit"}}
|
||||
{{/if}}
|
||||
{{:include file="_nav.html" current="index" subcurrent="details" subsubcurrent=$subsubcurrent}}
|
||||
{{/if}}
|
||||
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$ligne_immo.trans_id}}
|
||||
|
||||
{{*
|
||||
<nav class="tabs">
|
||||
<aside>
|
||||
{{:linkbutton label="Rattacher une écriture d'avoir" href="link_immo.html?immo_doc_id=%s"|args:$_GET.immo_doc_id shape="link" target="_dialog"}}
|
||||
</aside>
|
||||
<nav style="margin-bottom: 1em;">
|
||||
{{:linkbutton shape="left" label="Retour à la liste des immobilisations" href="index.html}}
|
||||
{{if $total_amort == 0}}
|
||||
{{:linkbutton label="Modifier les paramètres" href="modify_infos.html?immo_doc_id=%s"|args:$_GET.immo_doc_id shape="edit" target="_dialog"}}
|
||||
{{:linkbutton label="Supprimer les paramètres" href="delete_infos.html?immo_doc_id=%s"|args:$_GET.immo_doc_id shape="delete" target="_dialog"}}
|
||||
{{/if}}
|
||||
</nav>
|
||||
</nav>
|
||||
*}}
|
||||
|
||||
{{if $_GET.ok}}
|
||||
{{if $_GET.msg|match:"attach_amort"}}
|
||||
{{:assign msg="Écriture d'amortissement attachée"}}
|
||||
{{elseif $_GET.msg|match:"attach_credit"}}
|
||||
{{:assign msg="Écriture au crédit attachée"}}
|
||||
{{elseif $_GET.msg|match:"info"}}
|
||||
{{:assign msg="Données de l'immobilisation enregistrées"}}
|
||||
{{elseif $_GET.msg|match:"detach"}}
|
||||
{{:assign msg="Écriture au crédit détachée"}}
|
||||
{{else}}
|
||||
{{:assign msg="Opération effectuée avec succès"}}
|
||||
{{/if}}
|
||||
<p class="block confirm">{{$msg}}</p>
|
||||
{{elseif $_GET.err}}
|
||||
{{:assign msg="L'opération a échoué"}}
|
||||
<p class="block error">{{$msg}}</p>
|
||||
{{/if}}
|
||||
|
||||
<h3 class="ruler">
|
||||
Immobilisation
|
||||
<span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.trans_id}}</a></span>
|
||||
{{$info_immo.label}}
|
||||
</h3>
|
||||
{{if $linked_immos != null}}
|
||||
<aside class="right">
|
||||
<table class="list">
|
||||
<caption>Écritures d'avoir liées</caption>
|
||||
<tbody>
|
||||
{{#foreach from=$linked_immos item="line"}}
|
||||
{{:assign url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.trans_id}}
|
||||
<tr>
|
||||
<td class="num"><a href="{{$url}}">#{{$line.trans_id}}</a></td>
|
||||
<td>{{$line.label}}</td>
|
||||
<td>{{$line.date|date_short}}</td>
|
||||
<td class="money">{{"%f"|math:$line.amount|money_currency_html:false|raw}}</td>
|
||||
<td>
|
||||
{{if $total_amort == 0}}
|
||||
{{:linkbutton label="Détacher" href="detach_credit.html?immo_doc_id=%s&credit_line_id=%s"|args:$_GET.immo_doc_id:$line.credit_line_id shape="minus"}}
|
||||
{{/if}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/foreach}}
|
||||
</tbody>
|
||||
</table>
|
||||
</aside>
|
||||
{{/if}}
|
||||
|
||||
<div class="informations">
|
||||
<dl class="describe">
|
||||
{{*
|
||||
<dt>Immobilisation</dt>
|
||||
<dd><span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.trans_id}}</a></span><span class="label"> {{$info_immo.label}}</span></dd>
|
||||
*}}
|
||||
<dt>Compte d'immobilisation</dt>
|
||||
<dd>{{$ligne_immo.account_code}} — {{$ligne_immo.account_label}}</dd>
|
||||
<dt>Date d'acquisition</dt>
|
||||
<dd>{{$info_immo.date_achat|date_short}}</dd>
|
||||
{{if $info_immo.date_mes != null && $info_immo.date_mes != $info_immo.date_achat}}
|
||||
<dt>Date de mise en service</dt>
|
||||
<dd>{{$info_immo.date_mes|date_short}}</dd>
|
||||
{{/if}}
|
||||
<dt>Durée d'amortissement</dt>
|
||||
<dd>{{$info_immo.duration}} ans</dd>
|
||||
<dt>Montant de l'immobilisation</dt>
|
||||
<dd class="money">{{"%f"|math:$info_immo.amount|money_currency_html:false|raw}}</dd>
|
||||
{{if $total_credits > 0}}
|
||||
<dt>Montant des avoirs</dt>
|
||||
<dd class="money">{{"%f"|math:$total_credits|money_currency_html:false|raw}}</dd>
|
||||
{{*
|
||||
<dt>Écritures d'avoir</dt>
|
||||
<dd>
|
||||
{{#foreach from=$linked_immos item="line"}}
|
||||
{{:assign url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.id}}
|
||||
<span class="num"><a href="{{$url}}">#{{$line.id}}</a></span>
|
||||
{{/foreach}}
|
||||
</dd>
|
||||
*}}
|
||||
<dt>Montant à amortir</dt>
|
||||
<dd class="money">{{"%f"|math:$solde|money_currency_html:false|raw}}</dd>
|
||||
{{/if}}
|
||||
{{if $total_amort > 0}}
|
||||
<dt>Montant des amortissements</dt>
|
||||
<dd>{{$total_amort|money_currency_html:false|raw}}</dd>
|
||||
<dt>Valeur nette résiduelle</dt>
|
||||
<dd>{{"%d-%d-%d"|math:$info_immo.amount:$total_credits:$total_amort|money_currency_html:false|raw}}</dd>
|
||||
{{/if}}
|
||||
</dl>
|
||||
</div>
|
||||
Loading…
Add table
Add a link
Reference in a new issue