Amélioration détection amortissements orphelins
This commit is contained in:
parent
a358858575
commit
d9fa180be8
3 changed files with 43 additions and 10 deletions
26
_nav.html
26
_nav.html
|
|
@ -5,13 +5,31 @@
|
||||||
<aside>
|
<aside>
|
||||||
{{:linkbutton label="Ajouter une immobilisation" shape="plus" href="add_asset.html"}}
|
{{:linkbutton label="Ajouter une immobilisation" shape="plus" href="add_asset.html"}}
|
||||||
</aside>
|
</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"}}
|
{{elseif $subsubcurrent == "amortization" && $type_immo == null || $type_immo == "managed" || $type_immo == "other"}}
|
||||||
<aside>
|
<aside>
|
||||||
{{if $autres_amort}}
|
{{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}}
|
{{/if}}
|
||||||
{{:linkbutton label="Enregistrer un amortissement" shape="plus"
|
{{:linkbutton
|
||||||
href="save_amort.html?immo_line_id=%s"|args:$_GET.immo_line_id}}
|
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>
|
</aside>
|
||||||
{{/if}}
|
{{/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 == "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 == "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 == "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>
|
<li {{if $current == "config"}} class="current"{{/if}}><a href="config.html">Configuration</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -101,27 +101,40 @@
|
||||||
{{/select}}
|
{{/select}}
|
||||||
{{/load}}
|
{{/load}}
|
||||||
|
|
||||||
{{:assign autres_amortissements=false}}
|
|
||||||
{{if $valeur_residuelle > 0}}
|
{{if $valeur_residuelle > 0}}
|
||||||
{{* Chercher des amortissements non rattachés à une immo *}}
|
{{* Chercher des amortissements non rattachés à une immo *}}
|
||||||
{{#select
|
{{#select
|
||||||
line.id as amort_line_id,
|
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
|
FROM acc_transactions_lines AS line
|
||||||
INNER JOIN acc_accounts AS account ON account.id = line.id_account
|
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_transactions AS trans ON trans.id = line.id_transaction
|
||||||
INNER JOIN acc_years AS y ON y.id = trans.id_year
|
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)
|
WHERE account.code LIKE "28%" AND credit > 0 AND (NOT trans.status & 16)
|
||||||
ORDER BY trans.date, trans.label;
|
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"
|
{{#load type="amort_link"
|
||||||
where="$$.amort_line_id = :amort_line_id"
|
where="$$.amort_line_id = :amort_line_id"
|
||||||
: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}}
|
{{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}}
|
{{/load}}
|
||||||
|
{{if $keep_amort && $amort_amount < $amort.amort_amount}}
|
||||||
|
{{:assign var="free_amort_lines." value=$amort}}
|
||||||
|
{{/if}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
|
@ -144,7 +157,7 @@
|
||||||
subcurrent="%s"|args:$subcurrent
|
subcurrent="%s"|args:$subcurrent
|
||||||
subsubcurrent="amortization"
|
subsubcurrent="amortization"
|
||||||
type_immo=$_GET.type_immo
|
type_immo=$_GET.type_immo
|
||||||
autres_amort=$autres_amortissements
|
autres_amort=$free_amort_lines
|
||||||
}}
|
}}
|
||||||
|
|
||||||
{{if $_GET.ok}}
|
{{if $_GET.ok}}
|
||||||
|
|
@ -263,7 +276,7 @@
|
||||||
<p class="block alert">Aucun amortissement enregistré pour cette immobilisation</p>
|
<p class="block alert">Aucun amortissement enregistré pour cette immobilisation</p>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{if $autres_amortissements}}
|
{{if $free_amort_lines}}
|
||||||
<p class="block alert">
|
<p class="block alert">
|
||||||
Il y a des écritures d'amortissement qui ne sont pas rattachées à une immobilisation ! <br />
|
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.
|
Utilisez le bouton « Rattacher un amortissement » pour les afficher ; vous pourrez choisir d'en attacher certaines à cette immobilisation.
|
||||||
|
|
|
||||||
|
|
@ -145,6 +145,8 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</section>
|
</section>
|
||||||
|
{{else}}
|
||||||
|
<p class="block alert">Aucun amortissement à rattacher</p>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:form_errors}}
|
{{:form_errors}}
|
||||||
{{:admin_footer}}
|
{{:admin_footer}}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue