Amélioration détection amortissements orphelins
This commit is contained in:
parent
a358858575
commit
2e8492b025
4 changed files with 50 additions and 12 deletions
28
_nav.html
28
_nav.html
|
|
@ -1,17 +1,35 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
<nav class="tabs">
|
||||
{{if $current == "index" && $subsubcurrent == null}}
|
||||
{{if $current == "index" && $subcurrent != "unfinished" && $subsubcurrent == null}}
|
||||
<aside>
|
||||
{{:linkbutton label="Ajouter une immobilisation" shape="plus" href="add_asset.html"}}
|
||||
</aside>
|
||||
{{elseif $current == "index" && $subcurrent == "details"}}
|
||||
<aside>
|
||||
{{if $subsubcurrent|match:"credit"}}
|
||||
{{:linkbutton label="Rattacher une écriture d'immobilisation" href="link_immo.html?immo_doc_id=%s"|args:$_GET.immo_doc_id shape="link" target="_dialog"}}
|
||||
{{/if}}
|
||||
{{if $subsubcurrent|match:"modif"}}
|
||||
{{:linkbutton label="Modifier" href="modify_infos.html?immo_doc_id=%s"|args:$_GET.immo_doc_id shape="edit" target="_dialog"}}
|
||||
{{/if}}
|
||||
</aside>
|
||||
{{elseif $subsubcurrent == "amortization" && $type_immo == null || $type_immo == "managed" || $type_immo == "other"}}
|
||||
<aside>
|
||||
{{if $autres_amort}}
|
||||
{{:linkbutton label="Rattacher une écriture" href="other_amortizations.html?immo_line_id=%s"|args:$_GET.immo_line_id shape="link" target="_dialog"}}
|
||||
{{:linkbutton
|
||||
label="Rattacher un amortissement"
|
||||
title="Rattacher un amortissement existant"
|
||||
href="other_amortizations.html?immo_doc_id=%s"|args:$_GET.immo_doc_id
|
||||
shape="link"
|
||||
target="_dialog"}}
|
||||
{{/if}}
|
||||
{{:linkbutton label="Enregistrer un amortissement" shape="plus"
|
||||
href="save_amort.html?immo_line_id=%s"|args:$_GET.immo_line_id}}
|
||||
{{: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>
|
||||
{{/if}}
|
||||
|
||||
|
|
@ -20,7 +38,7 @@
|
|||
<li {{if $subcurrent == "amortized"}}class="current"{{/if}}><a href="index.html?type_immo=amortized">Amorties</a></li>
|
||||
<li {{if $subcurrent == "archived"}}class="current"{{/if}}><a href="index.html?type_immo=archived">Sorties du bilan</a></li>
|
||||
<li {{if $subcurrent == "unfinished"}}class="current"{{/if}}><a href="index.html?type_immo=unfinished">En cours</a></li>
|
||||
<li {{if $subcurrent == "other"}}class="current"{{/if}}><a href="index.html?type_immo=other">Autres</a></li>
|
||||
<li {{if $subcurrent == "other"}}class="current"{{/if}}><a href="index.html?type_immo=other">À classer</a></li>
|
||||
<li {{if $current == "config"}} class="current"{{/if}}><a href="config.html">Configuration</a></li>
|
||||
</ul>
|
||||
|
||||
|
|
|
|||
|
|
@ -101,27 +101,40 @@
|
|||
{{/select}}
|
||||
{{/load}}
|
||||
|
||||
{{:assign autres_amortissements=false}}
|
||||
{{if $valeur_residuelle > 0}}
|
||||
{{* Chercher des amortissements non rattachés à une immo *}}
|
||||
{{#select
|
||||
line.id as amort_line_id,
|
||||
line.id_transaction AS amort_trans_id
|
||||
line.id_transaction AS amort_trans_id,
|
||||
line.credit as amort_amount
|
||||
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="amort"
|
||||
}}
|
||||
{{* cette ligne d'amortissement a-t-elle un doc associé ? *}}
|
||||
{{* voir s'il existe des lignes d'immo liées à cette ligne d'amortissement *}}
|
||||
{{:assign amort_amount=0}}
|
||||
{{:assign keep_amort=true}}
|
||||
{{#load type="amort_link"
|
||||
where="$$.amort_line_id = :amort_line_id"
|
||||
:amort_line_id = $amort_line_id
|
||||
assign="amort_link"
|
||||
}}
|
||||
{{if $amort_link.amount == null || $amort_link.amount == 0}}
|
||||
{{:assign amort_amount=$amort.amort_amount}}
|
||||
{{:assign keep_amort=false}}
|
||||
{{else}}
|
||||
{{:assign autres_amortissements=true}}
|
||||
{{:assign amort_amount="%d+%d"|math:$amort_amount:$amort_link.amount}}
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{* pas de ligne d'immo liée à cette ligne d'amort => garder cette ligne d'amortissement *}}
|
||||
{{/load}}
|
||||
{{if $keep_amort && $amort_amount < $amort.amort_amount}}
|
||||
{{:assign var="free_amort_lines." value=$amort}}
|
||||
{{/if}}
|
||||
{{/select}}
|
||||
{{/if}}
|
||||
|
||||
|
|
@ -144,7 +157,7 @@
|
|||
subcurrent="%s"|args:$subcurrent
|
||||
subsubcurrent="amortization"
|
||||
type_immo=$_GET.type_immo
|
||||
autres_amort=$autres_amortissements
|
||||
autres_amort=$free_amort_lines
|
||||
}}
|
||||
|
||||
{{if $_GET.ok}}
|
||||
|
|
@ -263,7 +276,7 @@
|
|||
<p class="block alert">Aucun amortissement enregistré pour cette immobilisation</p>
|
||||
{{/if}}
|
||||
|
||||
{{if $autres_amortissements}}
|
||||
{{if $free_amort_lines}}
|
||||
<p class="block alert">
|
||||
Il y a des écritures d'amortissement qui ne sont pas rattachées à une immobilisation ! <br />
|
||||
Utilisez le bouton « Rattacher un amortissement » pour les afficher ; vous pourrez choisir d'en attacher certaines à cette immobilisation.
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
{{elseif $type_immo == "other"}}
|
||||
{{:admin_header title="Autres immobilisations" custom_css="./style.css" current="module_amortization"}}
|
||||
{{elseif $type_immo == "unfinished"}}
|
||||
{{:admin_header title="Immobilisations en cours de constitution" custom_css="./style.css" current="module_amortization"}}
|
||||
{{:admin_header title="Immobilisations en cours de constitution" custom_css="./style.css" current="module_amortization" subcurrent="unfinished"}}
|
||||
{{/if}}
|
||||
|
||||
{{:include file="_nav.html" current="index" subcurrent="%s"|args:$type_immo}}
|
||||
|
|
@ -24,6 +24,8 @@
|
|||
{{if $_GET.ok}}
|
||||
{{if $_GET.msg|match:"immobilisation"}}
|
||||
{{:assign msg="Immobilisation enregistrée"}}
|
||||
{{elseif $_GET.msg|match:"suppr_infos"}}
|
||||
{{:assign msg="Informations supprimées"}}
|
||||
{{elseif $_GET.msg|match:"infos"}}
|
||||
{{:assign msg="Informations enregistrées"}}
|
||||
{{/if}}
|
||||
|
|
@ -45,6 +47,9 @@
|
|||
{{/select}}
|
||||
{{/load}}
|
||||
|
||||
{{* chercher des immos antérieures à la date de début du 1er exercice *}}
|
||||
{{*:include file="_old_assets.html"*}}
|
||||
|
||||
{{if $type_immo == "other"}}
|
||||
{{:include file="_immobilisations_autres.html"}}
|
||||
{{elseif $type_immo == "archived"}}
|
||||
|
|
|
|||
|
|
@ -145,6 +145,8 @@
|
|||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
{{else}}
|
||||
<p class="block alert">Aucun amortissement à rattacher</p>
|
||||
{{/if}}
|
||||
{{:form_errors}}
|
||||
{{:admin_footer}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue