Modification interaction amortissements à rattacher
This commit is contained in:
parent
fd1397bd5c
commit
ab9b2a37ff
5 changed files with 137 additions and 18 deletions
|
@ -109,14 +109,14 @@
|
|||
<td class="actions">
|
||||
{{if $status == "nsp"}}
|
||||
{{:linkbutton
|
||||
label="Paramètres"
|
||||
label="Amortir"
|
||||
href="add_infos.html?immo_id=%s&amort=0&op=new&type_immo=autres"|args:$immo_id
|
||||
shape="settings"
|
||||
target="_dialog"
|
||||
}}
|
||||
{{else}}
|
||||
{{:linkbutton
|
||||
label="Paramètres"
|
||||
label="Amortir"
|
||||
href="add_infos.html?immo_id=%s&amort=0&op=modif&type_immo=autres"|args:$immo_id
|
||||
shape="settings"
|
||||
target="_dialog"
|
||||
|
|
23
_nav.html
23
_nav.html
|
@ -5,21 +5,19 @@
|
|||
<aside>
|
||||
{{:linkbutton label="Ajouter une immobilisation" shape="plus" href="add_asset.html" target="_dialog"}}
|
||||
</aside>
|
||||
{{elseif $subsubcurrent == "amortization" && $type_immo == null || $type_immo == "encours"}}
|
||||
<aside>
|
||||
{{:linkbutton label="Attacher un amortissement" href="other_amortizations.html?immo_id=%s"|args:$_GET.immo_id shape="plus" target="_dialog"}}
|
||||
{{:linkbutton label="Enregistrer un amortissement" shape="plus"
|
||||
href="save_amort.html?immo_id=%s"|args:$_GET.immo_id target="_dialog"}}
|
||||
</aside>
|
||||
{{/if}}
|
||||
|
||||
{{*
|
||||
<ul>
|
||||
<li {{if $current == 'index'}} class="current"{{/if}}><a href="{{$module.url}}index.html">Immobilisations</a></li>
|
||||
<li {{if $current == 'aide'}} class="current"{{/if}}><a href="{{$module.url}}aide.html">Aide</a></li>
|
||||
</ul>
|
||||
*}}
|
||||
|
||||
{{if $current == 'index' && $subsubcurrent != 'balance_exit'}}
|
||||
{{* <ul class="sub">*}}
|
||||
<ul>
|
||||
<li {{if $subcurrent == 'encours'}}class="current"{{/if}}><a href="index.html?type_immo=encours">En cours</a></li>
|
||||
<li {{if $subcurrent == 'fini'}}class="current"{{/if}}><a href="index.html?type_immo=fini">Terminées</a></li>
|
||||
<li {{if $subcurrent == 'archive'}}class="current"{{/if}}><a href="index.html?type_immo=archive">Archivées</a></li>
|
||||
<li {{if $subcurrent == 'fini'}}class="current"{{/if}}><a href="index.html?type_immo=fini">Amorties</a></li>
|
||||
<li {{if $subcurrent == 'archive'}}class="current"{{/if}}><a href="index.html?type_immo=archive">Sorties du bilan</a></li>
|
||||
<li {{if $subcurrent == 'autres'}}class="current"{{/if}}><a href="index.html?type_immo=autres">Autres</a></li>
|
||||
</ul>
|
||||
{{/if}}
|
||||
|
@ -29,10 +27,5 @@
|
|||
<li class="title"><strong>Amortissements</strong></li>
|
||||
</ul>
|
||||
{{elseif $subsubcurrent == 'balance_exit'}}
|
||||
{{*
|
||||
<ul class="sub">
|
||||
<li class="title"><strong>Sortie du bilan</strong></li>
|
||||
</ul>
|
||||
*}}
|
||||
{{/if}}
|
||||
</nav>
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
{{else}}
|
||||
{{:assign subcurrent="autres"}}
|
||||
{{/if}}
|
||||
{{:include file="_nav.html" current="index" subcurrent="%s"|args:$subcurrent subsubcurrent="amortization"}}
|
||||
{{:include file="_nav.html" current="index" subcurrent="%s"|args:$subcurrent subsubcurrent="amortization" type_immo=$_GET.type_immo}}
|
||||
|
||||
{{if $_GET.ok}}
|
||||
{{if $_GET.msg|match:"attach"}}
|
||||
|
@ -97,6 +97,7 @@
|
|||
<p class="block error">{{$msg}}</p>
|
||||
{{/if}}
|
||||
|
||||
{{*
|
||||
{{if $valeur_residuelle > 0}}
|
||||
<nav class="tabs amort">
|
||||
<aside>
|
||||
|
@ -104,6 +105,7 @@
|
|||
</aside>
|
||||
</nav>
|
||||
{{/if}}
|
||||
*}}
|
||||
|
||||
<form method="post" action="">
|
||||
<fieldset>
|
||||
|
@ -135,6 +137,16 @@
|
|||
<dt>Durée</dt>
|
||||
<dd>{{$duree}} ans</dd>
|
||||
{{/if}}
|
||||
{{if $valeur_residuelle > 0}}
|
||||
<dt>Montant déjà amorti</dt>
|
||||
<dd>{{"%d-%d"|math:$ligne_immo.montant:$valeur_residuelle|money_currency:false}}</dd>
|
||||
<dt>Valeur résiduelle</dt>
|
||||
<dd>{{$valeur_residuelle|money_currency}}</dd>
|
||||
{{/if}}
|
||||
{{if $duree != null && $valeur_residuelle > 0}}
|
||||
<dt>Annuité estimée</dt>
|
||||
<dd>{{"%f/%d"|math:$ligne_immo.montant:$duree|money_currency}}</dd>
|
||||
{{/if}}
|
||||
</dl>
|
||||
|
||||
<h3 class="center-block ruler">Amortissements enregistrés</h3>
|
||||
|
@ -220,6 +232,11 @@
|
|||
{{/select}}
|
||||
|
||||
{{if $autres_amortissements != null}}
|
||||
<p class="block alert">
|
||||
Il existe des écritures d'amortissement qui ne sont pas rattachés à une immobilisation ! <br />
|
||||
Utilisez le bouton « Attacher un amortissement » pour les afficher ; vous pourrez choisir d'en attacher certaines à cette immobilisation.
|
||||
</p>
|
||||
{{*
|
||||
<section class="amortissement">
|
||||
<h3 class="center-block ruler">Amortissements non rattachés</h3>
|
||||
<table class="list">
|
||||
|
@ -258,6 +275,7 @@
|
|||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
*}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{:form_errors}}
|
||||
|
|
104
other_amortizations.html
Normal file
104
other_amortizations.html
Normal file
|
@ -0,0 +1,104 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{*
|
||||
Lister les écritures d'amortissement indépendantes
|
||||
et proposer des les attacher à l'immo sélectionnée
|
||||
@param immo_id = id de la ligne d'immo
|
||||
*}}
|
||||
|
||||
{{* récupérer les infos de l'immobilisation *}}
|
||||
{{#select
|
||||
line.id as immo_id,
|
||||
line.debit as montant,
|
||||
trans.id as trans_id,
|
||||
trans.label as label,
|
||||
trans.date
|
||||
FROM acc_transactions_lines AS line
|
||||
INNER JOIN acc_transactions AS trans ON line.id_transaction = trans.id
|
||||
WHERE line.id = :line_id;
|
||||
:line_id = $_GET.immo_id|intval
|
||||
assign=ligne_immo
|
||||
}}
|
||||
{{else}}
|
||||
{{:error message="Immobilisation %s non trouvée"|args:$_GET.immo_id}}
|
||||
{{/select}}
|
||||
|
||||
{{#select
|
||||
line.id as l_id,
|
||||
line.id_transaction as t_id,
|
||||
line.credit as amort_amount,
|
||||
line.label as l_label,
|
||||
trans.date as t_date,
|
||||
trans.label as t_label,
|
||||
trans.id_year as amort_year,
|
||||
account.id as account_id,
|
||||
account.code as account_code,
|
||||
account.label as account_label
|
||||
FROM acc_transactions_lines AS line
|
||||
INNER JOIN acc_accounts AS account ON account.id = line.id_account
|
||||
INNER JOIN acc_transactions AS trans ON trans.id = line.id_transaction
|
||||
INNER JOIN acc_years AS y ON y.id = trans.id_year
|
||||
WHERE account.code LIKE "28%" AND credit > 0 AND (NOT trans.status & 16)
|
||||
ORDER BY trans.date, trans.label;
|
||||
assign=autre_amort
|
||||
}}
|
||||
{{#select
|
||||
id_transaction,
|
||||
id_related
|
||||
FROM acc_transactions_links
|
||||
WHERE id_transaction = :id_amort OR id_related = :id_amort;
|
||||
:id_amort=$t_id
|
||||
}}
|
||||
{{else}}
|
||||
{{:assign var="autres_amortissements." value=$autre_amort}}
|
||||
{{/select}}
|
||||
{{/select}}
|
||||
|
||||
{{:admin_header title="Amortissements non rattachés" custom_css="./style.css" current="module_amortissement"}}
|
||||
{{* barre de navigation *}}
|
||||
{{if ! $dialog}}
|
||||
{{:include file="_nav.html" current="index" subcurrent="autres" subsubcurrent="amortization"}}
|
||||
{{/if}}
|
||||
|
||||
{{if $autres_amortissements != null}}
|
||||
<section class="amortissement">
|
||||
<h3 class="center-block ruler">Immobilisation « {{$ligne_immo.label}} »</h3>
|
||||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>N°</th>
|
||||
<th>Date</th>
|
||||
<th class="nombre">Montant</th>
|
||||
<th>Libellé</th>
|
||||
<th>N° compte</th>
|
||||
<th>Compte</th>
|
||||
<th class="actions"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#foreach from=$autres_amortissements item="line"}}
|
||||
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.t_id}}
|
||||
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$line.account_id:$line.amort_year}}
|
||||
<tr>
|
||||
<td class="num"><a href={{$trans_url}}>#{{$line.t_id}}</a></td>
|
||||
<td>{{$line.t_date|date_short}}</td>
|
||||
<td class="money">{{"%f"|math:$line.amort_amount|money}}</td>
|
||||
<td>{{if $line.l_label == null}}
|
||||
{{$line.t_label}}
|
||||
{{else}}
|
||||
{{$line.l_label}}
|
||||
{{/if}}
|
||||
</td>
|
||||
<td><a href={{$compte_url}}>{{$line.account_code}}</a></td>
|
||||
<td>{{$line.account_label}}</td>
|
||||
<td>
|
||||
{{:linkbutton label="Attacher" href="attach_amort.html?amort_id=%d&immo_id=%d"|args:$line.l_id:$_GET.immo_id shape="plus"}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/foreach}}
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
{{/if}}
|
||||
{{:form_errors}}
|
||||
{{:admin_footer}}
|
|
@ -41,3 +41,7 @@ h2[class="aide"], h3[class="aide"] {
|
|||
nav.amort aside {
|
||||
margin-top : 0;
|
||||
}
|
||||
|
||||
.describe dt::after {
|
||||
content: ' :';
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue