Compare commits
2 commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
e0cf555851 | ||
![]() |
ab9b2a37ff |
11 changed files with 208 additions and 108 deletions
|
@ -5,7 +5,7 @@
|
|||
<section class="immobilisation">
|
||||
{{if $type_immo == "encours"}}
|
||||
<h2 class="ruler">Immobilisations en cours</h2>
|
||||
{{elseif $type_immo == "fini"}}
|
||||
{{elseif $type_immo == "amortie"}}
|
||||
<h2 class="ruler">Immobilisations amorties</h2>
|
||||
{{/if}}
|
||||
{{:assign nb_immo=0}}
|
||||
|
@ -134,7 +134,7 @@
|
|||
|
||||
{{* classement par onglet *}}
|
||||
{{if $type_immo == "encours" && $amort_amount >= $debit ||
|
||||
$type_immo == "fini" && $amort_amount < $debit ||
|
||||
$type_immo == "amortie" && $amort_amount < $debit ||
|
||||
$amortissable == "nsp" && ! $exist_amort
|
||||
}}
|
||||
{{:continue}}
|
||||
|
|
|
@ -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"
|
||||
|
|
26
_nav.html
26
_nav.html
|
@ -5,21 +5,21 @@
|
|||
<aside>
|
||||
{{:linkbutton label="Ajouter une immobilisation" shape="plus" href="add_asset.html" target="_dialog"}}
|
||||
</aside>
|
||||
{{elseif $subsubcurrent == "amortization" && $type_immo == null || $type_immo == "encours" || $type_immo == "autres"}}
|
||||
<aside>
|
||||
{{if $autres_amort != null}}
|
||||
{{:linkbutton label="Attacher un amortissement" href="other_amortizations.html?immo_id=%s"|args:$_GET.immo_id shape="plus" target="_dialog"}}
|
||||
{{/if}}
|
||||
{{: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">*}}
|
||||
{{if $current == 'index'}} {{* && $subsubcurrent != 'balance_exit' *}}
|
||||
<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 == 'amortie'}}class="current"{{/if}}><a href="index.html?type_immo=amortie">Amorties</a></li>
|
||||
<li {{if $subcurrent == 'sortie'}}class="current"{{/if}}><a href="index.html?type_immo=sortie">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 +29,8 @@
|
|||
<li class="title"><strong>Amortissements</strong></li>
|
||||
</ul>
|
||||
{{elseif $subsubcurrent == 'balance_exit'}}
|
||||
{{*
|
||||
<ul class="sub">
|
||||
<li class="title"><strong>Sortie du bilan</strong></li>
|
||||
<li class="title"><strong>Sortie de bilan</strong></li>
|
||||
</ul>
|
||||
*}}
|
||||
{{/if}}
|
||||
</nav>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
@param immo_id
|
||||
@param amort = 1 si immo amortissable, 0 si non
|
||||
@param op = new ou modif
|
||||
@param type_immo : encours, archive, fini, autre
|
||||
@param type_immo : encours, sortie, amortie, autre
|
||||
*}}
|
||||
|
||||
{{if $_GET.op == "modif"}}
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{*
|
||||
Lister les écritures d'amortissement associées à une immobilisation
|
||||
@param immo_id : id de la ligne d'immo
|
||||
@param type_immo : encours, amortie, sortie, autres
|
||||
*}}
|
||||
|
||||
{{* récupérer les infos de l'immobilisation *}}
|
||||
{{#select
|
||||
line.id as immo_id,
|
||||
|
@ -65,19 +71,60 @@
|
|||
{{:assign valeur_residuelle="%d-%d"|math:$valeur_residuelle:$amort_amount}}
|
||||
{{/foreach}}
|
||||
|
||||
{{* Autres amortissements non rattachés *}}
|
||||
{{#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="Liste des amortissements" custom_css="./style.css" current="module_amortissement"}}
|
||||
|
||||
{{* barre de navigation *}}
|
||||
{{if $_GET.type_immo == "fini" || $valeur_residuelle== 0 }}
|
||||
{{:assign subcurrent="fini"}}
|
||||
{{elseif $_GET.type_immo == "archive"}}
|
||||
{{:assign subcurrent="archive"}}
|
||||
{{if $_GET.type_immo == "amortie" || $valeur_residuelle== 0 }}
|
||||
{{:assign subcurrent="amortie"}}
|
||||
{{elseif $_GET.type_immo == "sortie"}}
|
||||
{{:assign subcurrent="sortie"}}
|
||||
{{elseif $_GET.type_immo == null || $_GET.type_immo == "encours"}}
|
||||
{{:assign subcurrent="encours"}}
|
||||
{{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
|
||||
autres_amort=$autres_amortissements
|
||||
}}
|
||||
|
||||
{{if $_GET.ok}}
|
||||
{{if $_GET.msg|match:"attach"}}
|
||||
|
@ -97,21 +144,13 @@
|
|||
<p class="block error">{{$msg}}</p>
|
||||
{{/if}}
|
||||
|
||||
{{if $valeur_residuelle > 0}}
|
||||
<nav class="tabs amort">
|
||||
<aside>
|
||||
{{:linkbutton label="Enregistrer un amortissement" shape="plus" href="save_amort.html?immo_id=%s"|args:$_GET.immo_id target="_dialog"}}
|
||||
</aside>
|
||||
</nav>
|
||||
{{/if}}
|
||||
|
||||
<form method="post" action="">
|
||||
<fieldset>
|
||||
<legend>Sortir l'immobilisation du bilan ?</legend>
|
||||
<p class="submit">
|
||||
{{:linkbutton
|
||||
label="Sortir du bilan"
|
||||
href="balance_sheet_exit.html?immo_id=%s"|args:$_GET.immo_id
|
||||
href="balance_sheet_exit.html?immo_id=%s&type_immo=%s"|args:$_GET.immo_id:$_GET.type_immo
|
||||
shape="export"
|
||||
class="main"
|
||||
}}
|
||||
|
@ -135,6 +174,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>
|
||||
|
@ -185,79 +234,15 @@
|
|||
<p class="block alert">Aucun amortissement enregistré pour cette immobilisation</p>
|
||||
{{/if}}
|
||||
|
||||
{{if $_GET.type_immo == null || $_GET.type_immo != "fini"}}
|
||||
{{if $_GET.type_immo == null || $_GET.type_immo != "amortie"}}
|
||||
|
||||
{{* Autres amortissements non rattachés *}}
|
||||
{{#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}}
|
||||
|
||||
{{if $autres_amortissements != null}}
|
||||
<section class="amortissement">
|
||||
<h3 class="center-block ruler">Amortissements non rattachés</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:$ligne_immo.immo_id shape="plus"}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/foreach}}
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<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>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{:form_errors}}
|
||||
|
|
|
@ -53,4 +53,4 @@
|
|||
assign_code="result_code"
|
||||
transactions=$linked_transactions
|
||||
}}
|
||||
{{:redirect to="amortization.html?immo_id=%s&ok=1&msg=attach&trans_id=%s"|args:$_GET.immo_id:$amort_id}}
|
||||
{{:redirect force="amortization.html?immo_id=%s&ok=1&msg=attach&trans_id=%s"|args:$_GET.immo_id:$amort_id}}
|
||||
|
|
|
@ -158,9 +158,10 @@
|
|||
{{/form}}
|
||||
|
||||
{{:admin_header title="Sortie de bilan" custom_css="./style.css" current="module_amortissement"}}
|
||||
|
||||
{{* barre de navigation *}}
|
||||
{{if ! $dialog}}
|
||||
{{:include file="_nav.html" current="index" subcurrent="balance_exit"}}
|
||||
{{:include file="_nav.html" current="index" subcurrent="%s"|args:$_GET.type_immo subsubcurrent="balance_exit"}}
|
||||
{{/if}}
|
||||
{{:form_errors}}
|
||||
|
||||
|
|
|
@ -36,9 +36,9 @@
|
|||
|
||||
{{if $type_immo == "autres"}}
|
||||
{{:include file="_immobilisations_autres.html"}}
|
||||
{{elseif $type_immo == "archive"}}
|
||||
{{elseif $type_immo == "sortie"}}
|
||||
{{:include file="_archives.html"}}
|
||||
{{elseif $type_immo == "encours" || $type_immo == "fini"}}
|
||||
{{elseif $type_immo == "encours" || $type_immo == "amortie"}}
|
||||
{{:include file="_immobilisations.html"}}
|
||||
{{/if}}
|
||||
|
||||
|
|
112
other_amortizations.html
Normal file
112
other_amortizations.html
Normal file
|
@ -0,0 +1,112 @@
|
|||
{{* -*- 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"
|
||||
type_immo="autres"
|
||||
autres_amort=$autres_amortissements
|
||||
}}
|
||||
{{/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: ' :';
|
||||
}
|
||||
|
|
|
@ -260,7 +260,7 @@
|
|||
}}
|
||||
{{/if}}
|
||||
|
||||
{{:redirect to="index.html?amort=archive"}}
|
||||
{{:redirect to="index.html?amort=sortie"}}
|
||||
{{/form}}
|
||||
|
||||
{{:admin_header title="Sortie du bilan" custom_css="./style.css" current="module_amortissement"}}
|
||||
|
|
Loading…
Add table
Reference in a new issue