Séparation amortissements à rattacher en deux onglets (compte, tous)
This commit is contained in:
parent
33c65388f9
commit
54603e9142
4 changed files with 51 additions and 32 deletions
|
|
@ -5,6 +5,7 @@
|
|||
@param immo_doc_id : id du doc associé à l'immobilisation
|
||||
@result linked_amort : lignes d'amortissement liées à la ligne d'immobilisation
|
||||
@result total_amort : montant total des amortissements de l'immobilisation
|
||||
@result created_amort : vrai s'il y a au moins un amortissement créé par le module dans la liste
|
||||
*}}
|
||||
|
||||
{{:assign total_amort=0}}
|
||||
|
|
@ -33,6 +34,10 @@
|
|||
assign="amort_line"
|
||||
}}
|
||||
{{:assign var="amort_line.amount" value=$amort_info.amount|or:$amort_line.amount}}
|
||||
{{if $amort_info.created}}
|
||||
{{:assign var="amort_line.created" value=true}}
|
||||
{{:assign var="created_amort" value=true}}
|
||||
{{/if}}
|
||||
{{:assign var="linked_amort.%s_%d"|args:$amort_line.date:$amort_info.id value=$amort_line}}
|
||||
{{:assign total_amort="%d+%d"|math:$total_amort:$amort_line.amount}}
|
||||
{{/select}}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
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
|
||||
WHERE account.code LIKE "28%" AND credit > 0 AND (NOT trans.status & 16) AND !filter_condition
|
||||
WHERE credit > 0 AND (NOT trans.status & 16) AND !filter_condition
|
||||
ORDER BY trans.date, trans.label;
|
||||
!filter_condition=$filter_condition
|
||||
assign="amort_line"
|
||||
|
|
|
|||
|
|
@ -38,12 +38,14 @@
|
|||
{{/if}}
|
||||
|
||||
{{* 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, created_amort"}}
|
||||
{{:assign valeur_residuelle="%d-%d"|math:$valeur_residuelle:$total_amort}}
|
||||
|
||||
{{if $valeur_residuelle > 0}}
|
||||
{{* lister les amortissements non attachés à une immo *}}
|
||||
{{:include file="./_get_free_amort.html" filter_condition="1" keep="free_amort_lines"}}
|
||||
{{:assign account_filter="28%"|quote_sql}}
|
||||
{{:assign filter_condition="account.code LIKE "|cat:$account_filter}}
|
||||
{{:include file="./_get_free_amort.html" filter_condition=$filter_condition keep="free_amort_lines"}}
|
||||
{{/if}}
|
||||
|
||||
{{:admin_header title="Liste des amortissements" custom_css="./style.css" current="module_amortization"}}
|
||||
|
|
@ -110,11 +112,11 @@
|
|||
|
||||
<nav style="margin-bottom: 1em;">
|
||||
<aside> {{* class="right">*}}
|
||||
{{if $free_amort_lines}}
|
||||
{{if $free_amort_lines && ! $created_amort}}
|
||||
{{:linkbutton
|
||||
label="Attacher un amortissement"
|
||||
title="Attacher un amortissement existant"
|
||||
href="other_amortizations.html?immo_doc_id=%s"|args:$_GET.immo_doc_id
|
||||
href="other_amortizations.html?immo_doc_id=%s&filter=true"|args:$_GET.immo_doc_id
|
||||
shape="link"
|
||||
target="_dialog"}}
|
||||
{{/if}}
|
||||
|
|
@ -220,7 +222,9 @@
|
|||
<td><a href="{{$compte_url}}">{{$line.account_code}}</a></td>
|
||||
<td>{{$line.account_label}}</td>
|
||||
<td>
|
||||
{{:linkbutton label="Détacher" href="detach_amort.html?immo_doc_id=%s&amort_line_id=%s"|args:$_GET.immo_doc_id:$line.line_id shape="minus"}}
|
||||
{{if ! $created_amort}}
|
||||
{{:linkbutton label="Détacher" href="detach_amort.html?immo_doc_id=%s&amort_line_id=%s"|args:$_GET.immo_doc_id:$line.line_id shape="minus"}}
|
||||
{{/if}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/foreach}}
|
||||
|
|
@ -229,7 +233,7 @@
|
|||
</section>
|
||||
{{/if}}
|
||||
|
||||
{{if $free_amort_lines}}
|
||||
{{if $free_amort_lines && ! $created_amort}}
|
||||
<p class="block alert">
|
||||
Il y a des écritures d'amortissement qui ne sont pas attachées à une immobilisation ! <br />
|
||||
Utilisez le bouton « Attacher un amortissement » pour les afficher ; vous pourrez choisir d'en attacher certaines à cette immobilisation.
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@
|
|||
Lister les écritures d'amortissement indépendantes
|
||||
et proposer des les attacher à l'immo sélectionnée
|
||||
@param immo_doc_id id du doc d'immo associé
|
||||
*}}
|
||||
|
||||
*}}
|
||||
{{* 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}}
|
||||
|
|
@ -17,27 +16,29 @@
|
|||
{{:assign label_immo=$label_immo|cat:" — "|cat:$ligne_immo.line_label}}
|
||||
{{/if}}
|
||||
|
||||
{{:include file="_get_config.html" keep="module.config"}}
|
||||
{{if $_POST.unhide == null}}
|
||||
{{:assign filter_condition=" NOT ("}}
|
||||
{{if $_GET.filter}}
|
||||
{{* déterminer le compte d'amortissement en fonction du compte d'immobilisation *}}
|
||||
{{:include
|
||||
file="./_get_amort_code.html"
|
||||
code_immo=$ligne_immo.account_code
|
||||
keep="code_amort"
|
||||
}}
|
||||
{{:include file="_get_config.html" keep="module.config"}}
|
||||
{{:assign account_condition="account.code = "|cat:$code_amort}}
|
||||
{{:assign filter_condition=$account_condition|cat:" AND NOT ("}}
|
||||
{{#foreach from=$module.config.filters item="filter"}}
|
||||
{{:assign filter="%"|cat:$filter|cat:"%"|quote_sql}}
|
||||
{{:assign filter_condition=$filter_condition|cat:" trans.label LIKE "|cat:$filter|cat:" OR "}}
|
||||
{{/foreach}}
|
||||
{{:assign filter_condition=$filter_condition|cat:"0)"}}
|
||||
{{else}}
|
||||
{{:assign filter_condition="1"}}
|
||||
{{:assign account_filter="28%"|quote_sql}}
|
||||
{{:assign filter_condition="account.code LIKE "|cat:$account_filter}}
|
||||
{{/if}}
|
||||
|
||||
{{* lister les amortissements non rattachés à une immo *}}
|
||||
{{:include file="./_get_free_amort.html" filter_condition=$filter_condition keep="free_amort_lines"}}
|
||||
|
||||
{{* déterminer le compte d'amortissement en fonction du compte d'immobilisation *}}
|
||||
{{:include
|
||||
file="./_get_amort_code.html"
|
||||
code_immo=$ligne_immo.account_code
|
||||
keep="code_amort"
|
||||
}}
|
||||
{{:admin_header title="Amortissements non rattachés" custom_css="./style.css" current="module_amortization"}}
|
||||
|
||||
{{* barre de navigation *}}
|
||||
|
|
@ -45,22 +46,27 @@
|
|||
{{:include
|
||||
file="_nav.html"
|
||||
current="index"
|
||||
subcurrent="other"
|
||||
subcurrent="managed"
|
||||
subsubcurrent="amortization"
|
||||
type_immo="other"
|
||||
type_immo="managed"
|
||||
autres_amort=$free_amort_lines
|
||||
}}
|
||||
{{/if}}
|
||||
|
||||
{{if $_POST.unhide != null}}
|
||||
{{:assign checked="checked"}}
|
||||
{{/if}}
|
||||
|
||||
<form method="post" action="">
|
||||
<fieldset>
|
||||
{{:input type="checkbox" value=1 name="unhide" checked="%s"|args:$checked label="Afficher toutes les écritures"}}
|
||||
</fieldset>
|
||||
</form>
|
||||
<nav class="tabs">
|
||||
<ul>
|
||||
<li {{if $_GET.filter}}class="current"{{/if}}>
|
||||
<a href="other_amortizations.html?immo_doc_id={{$_GET.immo_doc_id}}{{if $dialog}}&_dialog{{/if}}&filter=true">
|
||||
Amortissements du compte {{$code_amort}}
|
||||
</a>
|
||||
</li>
|
||||
<li {{if ! $_GET.filter}}class="current"{{/if}}>
|
||||
<a href="other_amortizations.html?immo_doc_id={{$_GET.immo_doc_id}}{{if $dialog}}&_dialog{{/if}}">
|
||||
Tous les amortissements
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
{{if $free_amort_lines != null}}
|
||||
<section class="amortissement">
|
||||
|
|
@ -79,9 +85,11 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
{{#foreach from=$free_amort_lines item="line"}}
|
||||
{{if $_POST.unhide == null && $line.account_code != $code_amort}}
|
||||
{{*
|
||||
{{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>
|
||||
|
|
@ -109,8 +117,10 @@
|
|||
</table>
|
||||
</section>
|
||||
{{else}}
|
||||
<p class="block alert">Aucun amortissement à rattacher</p>
|
||||
<p class="block alert">Aucun amortissement pour le compte {{$code_amort}}</p>
|
||||
{{/if}}
|
||||
|
||||
|
||||
{{:form_errors}}
|
||||
{{:admin_footer}}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue