Compare commits
No commits in common. "main" and "variante" have entirely different histories.
42 changed files with 1056 additions and 1138 deletions
|
|
@ -4,14 +4,15 @@ Ce module permet de gérer les écritures d'amortissements pour les immobilisati
|
||||||
|
|
||||||
- lister les immobilisations
|
- lister les immobilisations
|
||||||
- ajouter une nouvelle immobilisation
|
- ajouter une nouvelle immobilisation
|
||||||
- lister les amortissements d'une immobilisation
|
- lister les amortissements d'une immobilisation :
|
||||||
|
- amortissements déjà enregistrés
|
||||||
|
- amortissements à venir
|
||||||
|
- associer une écriture d'amortissement à une immobilisation
|
||||||
- enregistrer un nouvel amortissement
|
- enregistrer un nouvel amortissement
|
||||||
- incorporer d'anciennes immobilisations et leurs amortisements
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
- télécharger [l'archive zip](https://link.infini.fr/amortissement)
|
- télécharger [l'archive zip](https://link.infini.fr/amortissement)
|
||||||
- cliquer « Configuration » puis « Extensions »
|
- cliquer « Configuration » puis « Extensions »
|
||||||
- en bas de la page, cliquer « Importer un module »
|
- en bas de la page, cliquer « Importer un module »
|
||||||
- sélectionner l'archive téléchargée ci-dessus
|
- sélectionner l'archive téléchargée ci-dessus
|
||||||
- activer le module
|
- activer le module qui est maintenant présent dans la liste des extensions inactives
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@
|
||||||
<td><a href="{{$compte_url}}">{{$account_code}}</a></td>
|
<td><a href="{{$compte_url}}">{{$account_code}}</a></td>
|
||||||
<td>{{$account_label}}</td>
|
<td>{{$account_label}}</td>
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
{{:linkbutton label="Modifier" href="exit_step1.html?immo_doc_id=%s"|args:$info_immo.id shape="edit"}}
|
{{:linkbutton label="Modifier" href="exit_step3.html?immo_doc_id=%s"|args:$info_immo.id shape="edit"}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/select}}
|
{{/select}}
|
||||||
|
|
@ -172,6 +172,7 @@
|
||||||
<td class="money">{{$value|money_html:false|raw}}</td>
|
<td class="money">{{$value|money_html:false|raw}}</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
|
<td></td>
|
||||||
<td class="actions"></td>
|
<td class="actions"></td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
|
@ -183,6 +184,7 @@
|
||||||
<td class="money strong">{{$total_immo|money_html:false|raw}}</td>
|
<td class="money strong">{{$total_immo|money_html:false|raw}}</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
|
<td></td>
|
||||||
<td class="actions"></td>
|
<td class="actions"></td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
@ -199,6 +201,7 @@
|
||||||
<td class="money">{{$value|money_html:false|raw}}</td>
|
<td class="money">{{$value|money_html:false|raw}}</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
|
<td></td>
|
||||||
<td class="actions"></td>
|
<td class="actions"></td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
|
@ -210,6 +213,7 @@
|
||||||
<td class="money strong">{{$total_cessions|money_html:false|raw}}</td>
|
<td class="money strong">{{$total_cessions|money_html:false|raw}}</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
|
<td></td>
|
||||||
<td class="actions"></td>
|
<td class="actions"></td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
||||||
{{* -*- brindille -*- *}}
|
|
||||||
|
|
||||||
{{*
|
|
||||||
Enregistrer l'association entre une ligne d'immo et une autre ligne (amort, credit, cession, sortie)
|
|
||||||
@param immo_doc_id : id du doc associé à la ligne d'immobilisation
|
|
||||||
@param trans_id : id de l'écriture à attacher
|
|
||||||
*}}
|
|
||||||
{{* données de l'immobilisation *}}
|
|
||||||
{{:include file="_get_immo_data.html" immo_doc_id=$immo_doc_id|intval keep="ligne_immo, message"}}
|
|
||||||
{{if $message != null}}
|
|
||||||
{{:error message=$message}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{* chercher les liaisons de l'écriture d'immobilisation *}}
|
|
||||||
{{#select
|
|
||||||
CASE links.id_related = :immo_trans_id
|
|
||||||
WHEN true THEN links.id_transaction
|
|
||||||
WHEN false THEN links.id_related
|
|
||||||
END as linked_id
|
|
||||||
FROM acc_transactions_links as links
|
|
||||||
WHERE id_transaction = :immo_trans_id or id_related = :immo_trans_id;
|
|
||||||
:immo_trans_id = $ligne_immo.trans_id
|
|
||||||
}}
|
|
||||||
{{:assign var="linked_transactions." value=$linked_id}}
|
|
||||||
{{/select}}
|
|
||||||
|
|
||||||
{{* ajouter la nouvelle liaison *}}
|
|
||||||
{{:assign var="linked_transactions." value=$trans_id}}
|
|
||||||
{{* Enregistrer les liaisons *}}
|
|
||||||
{{:api
|
|
||||||
method="POST"
|
|
||||||
path="accounting/transaction/%s/transactions"|args:$ligne_immo.trans_id
|
|
||||||
assign="result"
|
|
||||||
assign_code="result_code"
|
|
||||||
transactions=$linked_transactions
|
|
||||||
}}
|
|
||||||
|
|
||||||
|
|
@ -1,13 +1,12 @@
|
||||||
{{* -*- brindille -*- *}}
|
{{* -*- brindille -*- *}}
|
||||||
|
|
||||||
{{*
|
{{*
|
||||||
Supprimer l'association entre une ligne d'immo et une autre ligne (amort, credit, cession, sortie)
|
Supprimer l'association entre deux lignes
|
||||||
@param immo_doc_id : id du doc associé à la ligne d'immobilisation
|
@param immo_doc_id : id du doc associé à la ligne d'immobilisation
|
||||||
@param line_id : id de la ligne à détacher
|
@param line_id : id de la ligne à détacher
|
||||||
*}}
|
*}}
|
||||||
|
|
||||||
{{* données de l'immobilisation *}}
|
{{* données de l'immobilisation *}}
|
||||||
{{:include file="_get_immo_data.html" immo_doc_id=$immo_doc_id|intval keep="info_immo, ligne_immo, message"}}
|
{{:include file="_get_immo_data.html" immo_doc_id=$immo_doc_id|intval keep="ligne_immo, message"}}
|
||||||
{{if $message != null}}
|
{{if $message != null}}
|
||||||
{{:error message=$message}}
|
{{:error message=$message}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@
|
||||||
@param immo_doc_id : id du doc associé à l'immobilisation
|
@param immo_doc_id : id du doc associé à l'immobilisation
|
||||||
@result linked_amort : lignes d'amortissement liées à la ligne d'immobilisation
|
@result linked_amort : lignes d'amortissement liées à la ligne d'immobilisation
|
||||||
@result total_amort : montant total des amortissements de l'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}}
|
{{:assign total_amort=0}}
|
||||||
|
|
@ -34,10 +33,6 @@
|
||||||
assign="amort_line"
|
assign="amort_line"
|
||||||
}}
|
}}
|
||||||
{{:assign var="amort_line.amount" value=$amort_info.amount|or:$amort_line.amount}}
|
{{: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 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}}
|
{{:assign total_amort="%d+%d"|math:$total_amort:$amort_line.amount}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
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
|
||||||
WHERE credit > 0 AND (NOT trans.status & 16) AND !filter_condition
|
WHERE account.code LIKE "28%" AND credit > 0 AND (NOT trans.status & 16) AND !filter_condition
|
||||||
ORDER BY trans.date, trans.label;
|
ORDER BY trans.date, trans.label;
|
||||||
!filter_condition=$filter_condition
|
!filter_condition=$filter_condition
|
||||||
assign="amort_line"
|
assign="amort_line"
|
||||||
|
|
@ -41,7 +41,6 @@
|
||||||
{{* pas de ligne d'immo liée à cette ligne d'amort => garder cette ligne d'amortissement *}}
|
{{* pas de ligne d'immo liée à cette ligne d'amort => garder cette ligne d'amortissement *}}
|
||||||
{{/load}}
|
{{/load}}
|
||||||
{{if $keep_amort && $amort_amount < $amort_line.amount}}
|
{{if $keep_amort && $amort_amount < $amort_line.amount}}
|
||||||
{{:assign var="amort_line.amount" value="%d-%d"|math:$amort_line.amount:$amort_amount}}
|
|
||||||
{{:assign var="free_amort_lines." value=$amort_line}}
|
{{:assign var="free_amort_lines." value=$amort_line}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
|
|
|
||||||
|
|
@ -68,9 +68,6 @@
|
||||||
!table=$module.table
|
!table=$module.table
|
||||||
!condition=$condition
|
!condition=$condition
|
||||||
}}
|
}}
|
||||||
{{if $status != "managed" && $status != "amortized"}}
|
|
||||||
{{:continue}}
|
|
||||||
{{/if}}
|
|
||||||
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$immo_trans_id}}
|
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$immo_trans_id}}
|
||||||
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$account_id:$trans_id_year}}
|
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$account_id:$trans_id_year}}
|
||||||
{{:assign montant_immo=$doc_amount|or:$debit}}
|
{{:assign montant_immo=$doc_amount|or:$debit}}
|
||||||
|
|
@ -96,8 +93,9 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/load}}
|
{{/load}}
|
||||||
|
|
||||||
|
{{* Immobilisation soldée ? *}}
|
||||||
|
{{* TODO ¿ marquer archivée ? *}}
|
||||||
{{if $montant_immo == 0}}
|
{{if $montant_immo == 0}}
|
||||||
{{* Immobilisation soldée *}}
|
|
||||||
{{:continue}}
|
{{:continue}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
|
@ -123,9 +121,17 @@
|
||||||
<td class="money">{{"%d-%d"|math:$montant_immo:$amort_amount|money_html:false|raw}}</td>
|
<td class="money">{{"%d-%d"|math:$montant_immo:$amort_amount|money_html:false|raw}}</td>
|
||||||
<td><a href="{{$compte_url}}">{{$account_code}}</a></td>
|
<td><a href="{{$compte_url}}">{{$account_code}}</a></td>
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
|
{{*if $amort_amount == 0*}}
|
||||||
{{:linkbutton
|
{{:linkbutton
|
||||||
label="Détails"
|
label="Détails"
|
||||||
href="amortization.html?immo_doc_id=%s&type_immo=%s"|args:$immo_doc_id:$type_immo shape="eye"
|
href="details_immo.html?immo_doc_id=%s"|args:$immo_doc_id
|
||||||
|
shape="eye"
|
||||||
|
}}
|
||||||
|
{{* target="_dialog"*}}
|
||||||
|
{{*/if*}}
|
||||||
|
{{:linkbutton
|
||||||
|
label="Amortissements"
|
||||||
|
href="amortization.html?immo_doc_id=%s&type_immo=%s"|args:$immo_doc_id:$type_immo shape="table"
|
||||||
}}
|
}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@
|
||||||
!table_join
|
!table_join
|
||||||
WHERE !condition
|
WHERE !condition
|
||||||
GROUP BY immo_line_id
|
GROUP BY immo_line_id
|
||||||
ORDER BY trans.date;
|
ORDER BY trans.date DESC;
|
||||||
!columns=$columns
|
!columns=$columns
|
||||||
!table_join=$table_join
|
!table_join=$table_join
|
||||||
!table=$module.table
|
!table=$module.table
|
||||||
|
|
@ -114,6 +114,7 @@
|
||||||
|
|
||||||
{{:assign var="immo_lines." value=$immo_line}}
|
{{:assign var="immo_lines." value=$immo_line}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
|
{{*:debug lines=$immo_lines nb_lines=$immo_lines|count nb_null=$nb_null nb_managed=$nb_managed nb_ignored=$nb_ignored nb_other=$nb_other unhide=$unhide*}}
|
||||||
|
|
||||||
<form method="post" action="">
|
<form method="post" action="">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
|
|
@ -147,7 +148,7 @@
|
||||||
{{else}}
|
{{else}}
|
||||||
{{* vérifier si le libellé aurait pu être filtré *}}
|
{{* vérifier si le libellé aurait pu être filtré *}}
|
||||||
{{#foreach from=$module.config.filters item="filter"}}
|
{{#foreach from=$module.config.filters item="filter"}}
|
||||||
{{if $trans_label|strpos:$filter !== false}}
|
{{if $filter|strpos:$trans_label !== false}}
|
||||||
{{:assign status="ignored"}}
|
{{:assign status="ignored"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
|
|
||||||
50
_nav.html
50
_nav.html
|
|
@ -1,31 +1,55 @@
|
||||||
{{* -*- brindille -*- *}}
|
{{* -*- brindille -*- *}}
|
||||||
|
|
||||||
<nav class="tabs">
|
<nav class="tabs">
|
||||||
{{if $subcurrent == null}}
|
{{if $current == "index" && $subcurrent != "unfinished" && $subsubcurrent == null}}
|
||||||
{{if $current == "managed" || $current == "amortized" || $current == "archived"}}
|
|
||||||
<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}}
|
||||||
|
{{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 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"
|
||||||
|
title="Enregistrer un nouvel amortissement"
|
||||||
|
href="save_amort.html?immo_doc_id=%s"|args:$_GET.immo_doc_id target="_dialog"
|
||||||
|
shape="plus"
|
||||||
|
}}
|
||||||
|
</aside>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li {{if $current == "managed"}}class="current"{{/if}}><a href="index.html?type_immo=managed">Amortissables</a></li>
|
<li {{if $subcurrent == "managed"}}class="current"{{/if}}><a href="index.html?type_immo=managed">Amortissables</a></li>
|
||||||
<li {{if $current == "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 $current == "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 $current == "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 $current == "other"}}class="current"{{/if}}><a href="index.html?type_immo=other">À classer</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>
|
||||||
|
|
||||||
{{if $subcurrent != null}}
|
{{if $subsubcurrent != null}}
|
||||||
<ul class="sub">
|
<ul class="sub">
|
||||||
{{if $subcurrent == "transfer"}}
|
{{if $subsubcurrent == "amortization"}}
|
||||||
<li class="title strong">Transfert d'immobilisations</li>
|
<li class="title strong">Amortissements</li>
|
||||||
{{elseif $subcurrent == "balance_exit"}}
|
{{elseif $subsubcurrent == "balance_exit"}}
|
||||||
<li class="title strong">Sortie de bilan</li>
|
<li class="title strong">Sortie de bilan</li>
|
||||||
{{elseif $subcurrent == "details"}}
|
{{elseif $subsubcurrent == "transfer"}}
|
||||||
<li class="title strong">Détails</li>
|
<li class="title strong">Transfert d'immobilisations</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</ul>
|
</ul>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
||||||
|
|
@ -1,45 +0,0 @@
|
||||||
{{* -*- brindille -*- *}}
|
|
||||||
|
|
||||||
{{if $module.table}}
|
|
||||||
{{* supprimer les documents sans écriture associée *}}
|
|
||||||
{{:assign var="docs." type="amort_link" field="amort_line_id"}}
|
|
||||||
{{:assign var="docs." type="credit_link" field="credit_line_id"}}
|
|
||||||
{{:assign var="docs." type="cession_link" field="cession_line_id"}}
|
|
||||||
{{:assign var="docs." type="exit_link" field="exit_line_id"}}
|
|
||||||
{{:assign var="docs." type="immo" field="line"}}
|
|
||||||
|
|
||||||
{{#foreach from=$docs}}
|
|
||||||
|
|
||||||
{{:assign join_field="$$."|cat:$field}}
|
|
||||||
{{:assign type_name=$type|quote_sql}}
|
|
||||||
{{:assign type_cond="$$.type"|cat:" = "|cat:$type_name}}
|
|
||||||
|
|
||||||
{{* vérifier existence écriture associée au doc *}}
|
|
||||||
{{#select
|
|
||||||
info.id as info_id,
|
|
||||||
$$.immo_doc_id as immo_doc_id,
|
|
||||||
line.id as line_id
|
|
||||||
FROM !table AS info
|
|
||||||
LEFT JOIN acc_transactions_lines as line ON !join_field = line.id
|
|
||||||
WHERE !type_cond
|
|
||||||
;
|
|
||||||
!table=$module.table
|
|
||||||
!type_cond = $type_cond
|
|
||||||
!join_field = $join_field
|
|
||||||
assign="line"
|
|
||||||
}}
|
|
||||||
{{if $line.line_id == null}}
|
|
||||||
{{:delete id=$line.info_id}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{* vérifier existence doc immo *}}
|
|
||||||
{{if $type != "immo"}}
|
|
||||||
{{#load id=$immo_doc_id assign="immo_doc"}}
|
|
||||||
{{else}}
|
|
||||||
{{:delete id=$line.info_id}}
|
|
||||||
{{/load}}
|
|
||||||
{{/if}}
|
|
||||||
{{/select}}
|
|
||||||
|
|
||||||
{{/foreach}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
@ -93,7 +93,12 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
|
||||||
{{if $status != "unfinished"}}
|
{{if $status != "unfinished" && ! $_POST.amortir}}
|
||||||
|
{{* ne pas amortir *}}
|
||||||
|
{{:assign duration=0}}
|
||||||
|
{{:assign date_debut=$_POST.date_achat|parse_date}}
|
||||||
|
{{:assign status="ignored"}}
|
||||||
|
{{elseif $status != "unfinished"}}
|
||||||
{{* vérifier que la date d'acquisition est antérieure à la date de mise en service *}}
|
{{* vérifier que la date d'acquisition est antérieure à la date de mise en service *}}
|
||||||
{{:assign date_debut=$_POST.date_mes|or:$_POST.date_achat|parse_date}}
|
{{:assign date_debut=$_POST.date_mes|or:$_POST.date_achat|parse_date}}
|
||||||
{{if $date_debut|strtotime < $_POST.date_achat|parse_date|strtotime}}
|
{{if $date_debut|strtotime < $_POST.date_achat|parse_date|strtotime}}
|
||||||
|
|
@ -106,7 +111,7 @@
|
||||||
{{if $_POST.date_mes == null || $_POST.date_mes == $_POST.date_achat}}
|
{{if $_POST.date_mes == null || $_POST.date_mes == $_POST.date_achat}}
|
||||||
{{:assign date_mes=null}}
|
{{:assign date_mes=null}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign date_mes=$_POST.date_mes|parse_date}}
|
{{:assign date_mes=$_POST.date_mes|date_short}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
|
@ -137,19 +142,18 @@
|
||||||
{{* enregistrer les infos de l'immobilisation *}}
|
{{* enregistrer les infos de l'immobilisation *}}
|
||||||
{{:save
|
{{:save
|
||||||
key=$key
|
key=$key
|
||||||
validate_schema="asset.schema.json"
|
validate_schema="schema.json"
|
||||||
type="immo"
|
type="immo"
|
||||||
line=$immo_line_id
|
line=$immo_line_id
|
||||||
duration=$duration
|
duration=$duration
|
||||||
date_mes=$date_mes
|
date_mes=$date_mes
|
||||||
status=$status
|
status=$status
|
||||||
created=true
|
|
||||||
}}
|
}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{if $status == "unfinished"}}
|
{{if $status == "unfinished"}}
|
||||||
{{:assign type_immo="unfinished"}}
|
{{:assign type_immo="unfinished"}}
|
||||||
{{elseif $status == "managed"}}
|
{{elseif $_POST.amortir}}
|
||||||
{{:assign type_immo="managed"}}
|
{{:assign type_immo="managed"}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign type_immo="other"}}
|
{{:assign type_immo="other"}}
|
||||||
|
|
@ -161,7 +165,7 @@
|
||||||
{{:admin_header title="Ajout immobilisation" current="module_amortization"}}
|
{{:admin_header title="Ajout immobilisation" current="module_amortization"}}
|
||||||
{{* barre de navigation *}}
|
{{* barre de navigation *}}
|
||||||
{{if ! $dialog}}
|
{{if ! $dialog}}
|
||||||
{{:include file="_nav.html" current="managed" subcurrent="add_asset"}}
|
{{:include file="_nav.html" current="index" subcurrent="managed"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{:form_errors}}
|
{{:form_errors}}
|
||||||
|
|
@ -202,7 +206,7 @@
|
||||||
name="credit_account"
|
name="credit_account"
|
||||||
label="Compte de décaissement"
|
label="Compte de décaissement"
|
||||||
required=true
|
required=true
|
||||||
target="!acc/charts/accounts/selector.php?codes=%s&id_year=%d"|args:"512*|530*|404*":$selected_year
|
target="!acc/charts/accounts/selector.php?types=%s&id_year=%d"|args:"1|2|3|4":$selected_year
|
||||||
}}
|
}}
|
||||||
{{:input
|
{{:input
|
||||||
type="list"
|
type="list"
|
||||||
|
|
@ -222,6 +226,7 @@
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Amortissement</legend>
|
<legend>Amortissement</legend>
|
||||||
<dl>
|
<dl>
|
||||||
|
{{:input id="amortir" type="checkbox" value=1 name="amortir" label="Amortir cette immobilisation sur une ou plusieurs années" checked="checked" help="Dé-cocher pour ne pas amortir"}}
|
||||||
<div id="div_amort">
|
<div id="div_amort">
|
||||||
{{:input type="number" name="duree" label="Durée d'amortissement" required=true min=0 default=1 suffix="année(s)"}}
|
{{:input type="number" name="duree" label="Durée d'amortissement" required=true min=0 default=1 suffix="année(s)"}}
|
||||||
{{:input type="date" name="date_mes" label="Date de mise en service" help="C'est la date de première utilisation ; à renseigner uniquement si différente de la date d'acquisition"}}
|
{{:input type="date" name="date_mes" label="Date de mise en service" help="C'est la date de première utilisation ; à renseigner uniquement si différente de la date d'acquisition"}}
|
||||||
|
|
@ -243,7 +248,13 @@ function changeYear(evt, f_accounts = ['credit_account', 'debit_account'], f_yea
|
||||||
setSelectorYear(f_accounts, f_years_select);
|
setSelectorYear(f_accounts, f_years_select);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function changeVisibility(evt, idcheck = 'f_amortir_1', iddiv = 'div_amort')
|
||||||
|
{
|
||||||
|
toggleVisibility(idcheck, document.querySelectorAll('#' + iddiv));
|
||||||
|
}
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
document.getElementById('f_id_year').onchange = changeYear;
|
document.getElementById('f_id_year').onchange = changeYear;
|
||||||
|
document.getElementById('f_amortir_1').onclick = changeVisibility;
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,14 @@
|
||||||
{{:assign montant_affecte=0}}
|
{{:assign montant_affecte=0}}
|
||||||
{{#load type="immo" where="$$.line = :line_id" :line_id=$_GET.immo_line_id|intval assign="info_immo"}}
|
{{#load type="immo" where="$$.line = :line_id" :line_id=$_GET.immo_line_id|intval assign="info_immo"}}
|
||||||
{{:assign montant_affecte="%d+%d"|math:$montant_affecte:$amount}}
|
{{:assign montant_affecte="%d+%d"|math:$montant_affecte:$amount}}
|
||||||
{{:assign choix_defaut=$info_immo.status}}
|
|
||||||
{{/load}}
|
{{/load}}
|
||||||
|
{{if $info_immo != null}}
|
||||||
|
{{:assign date_defaut=$info_immo.date}}
|
||||||
|
{{:assign duree_defaut=$info_immo.duration}}
|
||||||
|
{{:assign choix_defaut=$info_immo.status}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign duree_defaut=null}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{#select
|
{{#select
|
||||||
trans.id as immo_trans_id,
|
trans.id as immo_trans_id,
|
||||||
|
|
@ -31,12 +37,7 @@
|
||||||
{{:error message="Immobilisation non trouvée"}}
|
{{:error message="Immobilisation non trouvée"}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
{{:assign reste="%d-%d"|math:$ligne_immo.montant:$montant_affecte}}
|
{{:assign reste="%d-%d"|math:$ligne_immo.montant:$montant_affecte}}
|
||||||
{{:assign date_achat_defaut=$info_immo.date_achat|or:$ligne_immo.date_achat}}
|
|
||||||
{{:assign date_mes_defaut=$info_immo.date_mes|or:$info_immo.date_achat|or:$ligne_immo.date_achat}}
|
|
||||||
{{:assign immo_label=$ligne_immo.trans_label}}
|
|
||||||
{{if $ligne_immo.line_label != null && $ligne_immo.line_label != $ligne_immo.trans_label}}
|
|
||||||
{{:assign immo_label=$immo_label|cat:" — "|cat:$ligne_immo.line_label}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{#form on="save"}}
|
{{#form on="save"}}
|
||||||
{{if $_POST.classify == null}}
|
{{if $_POST.classify == null}}
|
||||||
|
|
@ -52,25 +53,17 @@
|
||||||
{{:assign date_mes=null}}
|
{{:assign date_mes=null}}
|
||||||
{{:assign status="ignored"}}
|
{{:assign status="ignored"}}
|
||||||
{{elseif $_POST.classify == "archived"}}
|
{{elseif $_POST.classify == "archived"}}
|
||||||
{{* voir s'il y a déjà un doc associé à cette immo *}}
|
|
||||||
{{#load type="immo" where="$$.line = :immo_line_id" :immo_line_id=$_GET.immo_line_id|intval}}
|
|
||||||
{{:assign uuid=$key}}
|
|
||||||
{{:assign immo_doc_id=$id}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign uuid=""|uuid}}
|
|
||||||
{{/load}}
|
|
||||||
|
|
||||||
{{* immobilisation sortie du bilan *}}
|
{{* immobilisation sortie du bilan *}}
|
||||||
{{:save
|
{{:save
|
||||||
key=$uuid
|
key=""|uuid
|
||||||
validate_schema="asset.schema.json"
|
validate_schema="schema.json"
|
||||||
type="immo"
|
type="immo"
|
||||||
line=$_GET.immo_line_id|intval
|
line=$_GET.immo_line_id|intval
|
||||||
duration=0
|
duration=0
|
||||||
status=null
|
status="managed"
|
||||||
assign_new_id="immo_doc_id"
|
assign_new_id="immo_doc_id"
|
||||||
}}
|
}}
|
||||||
{{:redirect force="exit_step1.html?immo_doc_id=%s&from=exit"|args:$immo_doc_id}}
|
{{:redirect force="exit_step1.html?immo_doc_id=%s"|args:$immo_doc_id}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{* immobilisation amortissable *}}
|
{{* immobilisation amortissable *}}
|
||||||
{{if $_POST.date_achat|parse_date > $ligne_immo.date_achat}}
|
{{if $_POST.date_achat|parse_date > $ligne_immo.date_achat}}
|
||||||
|
|
@ -136,7 +129,7 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:save
|
{{:save
|
||||||
key=$key
|
key=$key
|
||||||
validate_schema="asset.schema.json"
|
validate_schema="schema.json"
|
||||||
type="immo"
|
type="immo"
|
||||||
line=$_GET.immo_line_id|intval
|
line=$_GET.immo_line_id|intval
|
||||||
duration=$duration
|
duration=$duration
|
||||||
|
|
@ -158,15 +151,10 @@
|
||||||
{{:admin_header title="Classer l'immobilisation" custom_css="./style.css" current="module_amortization"}}
|
{{:admin_header title="Classer l'immobilisation" custom_css="./style.css" current="module_amortization"}}
|
||||||
{{* barre de navigation *}}
|
{{* barre de navigation *}}
|
||||||
{{if ! $dialog}}
|
{{if ! $dialog}}
|
||||||
{{:include file="_nav.html" current="other" subcurrent="parameter"}}
|
{{:include file="_nav.html" current="index" subcurrent="other" subsubcurrent="parameter"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:form_errors}}
|
{{:form_errors}}
|
||||||
|
|
||||||
{{* date de début du 1er exercice dans paheko *}}
|
|
||||||
{{#years order="start_date" limit=1}}
|
|
||||||
{{:assign first_date=$start_date}}
|
|
||||||
{{/years}}
|
|
||||||
|
|
||||||
{{*
|
{{*
|
||||||
- classer l'immobilisation
|
- classer l'immobilisation
|
||||||
- renseigner ou modifier la date de mise en service, les écritures associées ou la durée d'amortissement
|
- renseigner ou modifier la date de mise en service, les écritures associées ou la durée d'amortissement
|
||||||
|
|
@ -177,9 +165,7 @@
|
||||||
<div class="informations">
|
<div class="informations">
|
||||||
<dl class="describe">
|
<dl class="describe">
|
||||||
<dt>Immobilisation</dt>
|
<dt>Immobilisation</dt>
|
||||||
<dd>
|
<dd><span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.immo_trans_id}}</a></span> {{$ligne_immo.trans_label}}{{if $ligne_immo.line_label != null && $ligne_immo.line_label != $ligne_immo.trans_label}} — {{$ligne_immo.line_label}}{{/if}}</dd>
|
||||||
<span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.immo_trans_id}}</a> </span>{{$immo_label}}
|
|
||||||
</dd>
|
|
||||||
<dt>Montant</dt>
|
<dt>Montant</dt>
|
||||||
<dd class="money strong">{{"%f"|math:$ligne_immo.montant|money_currency_html:false|raw}}</dd>
|
<dd class="money strong">{{"%f"|math:$ligne_immo.montant|money_currency_html:false|raw}}</dd>
|
||||||
{{if $montant_affecte > 0}}
|
{{if $montant_affecte > 0}}
|
||||||
|
|
@ -200,11 +186,9 @@
|
||||||
<legend>Classement</legend>
|
<legend>Classement</legend>
|
||||||
<dl id="classement_immo">
|
<dl id="classement_immo">
|
||||||
<dt><label>Faites un choix</label> <b>(obligatoire)</b></dt>
|
<dt><label>Faites un choix</label> <b>(obligatoire)</b></dt>
|
||||||
{{:input type="radio-btn" name="classify" value="managed" label="Immobilisation à amortir" help="L'immobilisation sera classée parmi les immobilisations amortissables" default=$choix_defaut}}
|
{{:input type="radio-btn" name="classify" value="managed" label="Immobilisation à amortir" help="Cette immobilisation sera classée parmi les immobilisations amortissables" default=$choix_defaut}}
|
||||||
{{if $ligne_immo.date_achat > $first_date}}
|
{{:input type="radio-btn" name="classify" value="archived" label="Immobilisation sortie du bilan" help="Cette immobilisation sera classée parmi les immobilisations sorties du bilan" default=$choix_defaut}}
|
||||||
{{:input type="radio-btn" name="classify" value="archived" label="Immobilisation sortie du bilan" help="L'immobilisation sera classée parmi les immobilisations sorties du bilan" default=$choix_defaut}}
|
{{:input type="radio-btn" name="classify" value="ignored" label="Immobilisation à ignorer" help="Cette écriture n'apparaitra plus dans la liste des immobilisations" default=$choix_defaut}}
|
||||||
{{/if}}
|
|
||||||
{{:input type="radio-btn" name="classify" value="ignored" label="Immobilisation à ignorer" help="L'écriture n'apparaitra plus dans la liste des immobilisations" default=$choix_defaut}}
|
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
|
@ -213,9 +197,9 @@
|
||||||
<dl>
|
<dl>
|
||||||
{{:input type="number" name="duree" label="Durée d'amortissement" required=true min=1 suffix="année(s)"}}
|
{{:input type="number" name="duree" label="Durée d'amortissement" required=true min=1 suffix="année(s)"}}
|
||||||
{{:input type="money" name="montant" label="Montant de l'immobilisation" required=true default=$reste help="à modifier si différent du montant de l'écriture d'immobilisation"}}
|
{{:input type="money" name="montant" label="Montant de l'immobilisation" required=true default=$reste help="à modifier si différent du montant de l'écriture d'immobilisation"}}
|
||||||
{{:input type="date" name="date_achat" label="Date d'acquisition" default=$date_achat_defaut help="à modifier si nécessaire"}}
|
{{:input type="date" name="date_achat" label="Date d'acquisition" help="à renseigner uniquement si différente de la date de l'écriture d'immobilisation"}}
|
||||||
{{:input type="date" name="date_mes" label="Date de mise en service" default=$date_mes_defaut help="à modifier si différente de la date d'acquisition"}}
|
{{:input type="date" name="date_mes" label="Date de mise en service" help="à renseigner uniquement si différente de la date d'acquisition"}}
|
||||||
{{:input type="text" name="libelle" label="Libellé" default=$immo_label help="à modifier si nécessaire"}}
|
{{:input type="text" name="libelle" label="Libellé" help="à renseigner uniquement si différent du libellé de l'écriture d'immobilisation"}}
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
|
|
||||||
163
aide.html
Normal file
163
aide.html
Normal file
|
|
@ -0,0 +1,163 @@
|
||||||
|
{{* -*- brindille -*- *}}
|
||||||
|
|
||||||
|
{{:admin_header title="Aide" custom_css="./style.css" current="module_amortization"}}
|
||||||
|
|
||||||
|
{{* barre de navigation *}}
|
||||||
|
{{:include file="_nav.html" current="aide"}}
|
||||||
|
|
||||||
|
<p class="aide">
|
||||||
|
Ce module gère l'amortissement linéaire des immobilisations.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h2 class="aide">Immobilisations</h2>
|
||||||
|
Elles sont classées dans plusieurs onglets :
|
||||||
|
|
||||||
|
<ul class="aide">
|
||||||
|
<li><strong>En cours</strong> : immobilisations en cours d'amortissement.</li>
|
||||||
|
<li><strong>Terminées</strong> : immobilisations dont l'amortissement est terminé.</li>
|
||||||
|
<li><strong>Archivées</strong> : immobilisations qui ont été sortie du bilan.</li>
|
||||||
|
<li><strong>Autres</strong> : immobilisations pour lesquelles le module n'a pas
|
||||||
|
d'information ou qui ont été marquées non amortissables.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h3 class="aide">Ajouter une immobilisation</h3>
|
||||||
|
|
||||||
|
<div class="aide">
|
||||||
|
<p class="aide">
|
||||||
|
Il faut renseigner les informations de l'immobilisation.
|
||||||
|
On peut indiquer qu'il s'agit d'une immobilisation qui ne doit
|
||||||
|
pas être amortie ; dans le cas contraire, il faut renseigner
|
||||||
|
les différents paramètres de l'immobilisation
|
||||||
|
</p>
|
||||||
|
<!--
|
||||||
|
<ul class="aide">
|
||||||
|
<li>Date d'acquisition du bien</li>
|
||||||
|
<li>Date d'acquisition du bien</li>
|
||||||
|
<li>Date de mise en service du bien : uniquement si différente de la précédente</li>
|
||||||
|
<li>Libellé de l'immobilisation</li>
|
||||||
|
<li>Montant</li>
|
||||||
|
<li>Durée d'amortissement en années</li>
|
||||||
|
<li>Compte de décaissement : à choisir dans la liste</li>
|
||||||
|
<li>Compte d'immobilisation : doit débuter par <b>20</b>, <b>21</b> ou <b>27</b></li>
|
||||||
|
<li>Projet analytique (optionnel)</li>
|
||||||
|
</ul>
|
||||||
|
<p>
|
||||||
|
Après ajout, on se retrouve sur la page d'accueil des immobilisations.
|
||||||
|
</p>
|
||||||
|
-->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h3 class="aide">Amortissements</h2>
|
||||||
|
|
||||||
|
<div class="infos">
|
||||||
|
<p class="aide">
|
||||||
|
Le calcul de l'amortissement se fait par la <em>méthode linéaire</em>.
|
||||||
|
</p>
|
||||||
|
<p class="aide">
|
||||||
|
La date de début du calcul est par défaut la <em>date d'achat</em> ; si la
|
||||||
|
date de mise en service est <em>postérieure</em> à la date d'achat, c'est
|
||||||
|
celle-ci qui est prise en compte.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h3 class="aide">Liste des amortissements</h3>
|
||||||
|
|
||||||
|
<div class="aide">
|
||||||
|
On trouve ici de une à trois listes, selon la situation :
|
||||||
|
<ul class="aide">
|
||||||
|
<li>
|
||||||
|
<b>Amortissements enregistrés</b>
|
||||||
|
<p>
|
||||||
|
Ce sont des écritures d'amortissement déjà
|
||||||
|
enregistrées et liées à l'écriture de
|
||||||
|
l'immobilisation courante.
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<b>Amortissements futurs</b>
|
||||||
|
<p>
|
||||||
|
Ce sont les écritures amortissement de
|
||||||
|
l'immobilisation courante qui n'ont pas encore été
|
||||||
|
enregistrées ; seuls les amortissements d'un
|
||||||
|
exercice ouvert peuvent être enregistrés ; les
|
||||||
|
autres sont présents pour information et pourront
|
||||||
|
être enregistrés quand l'exercice correspondant
|
||||||
|
aura été ouvert.
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<b>Autres amortissement non rattachés</b>
|
||||||
|
<p>
|
||||||
|
Ce sont des écritures passées sur un compte
|
||||||
|
d'amortissement (<b>28xx</b>) qui ne sont
|
||||||
|
associées à aucune écriture d'immobilisation ; en
|
||||||
|
cliquant le bouton « Attacher », on peut rattacher
|
||||||
|
l'écriture d'amortissement sélectionnée à
|
||||||
|
l'immobilisation courante.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Si on a rattaché par erreur une écriture
|
||||||
|
d'amortissement à une immobilisation, le bouton «
|
||||||
|
Détacher » en face de l'écriture permettra de
|
||||||
|
défaire l'opération.
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h3 class="aide">Créer une écriture d'amortissement</h3>
|
||||||
|
|
||||||
|
<div class="aide">
|
||||||
|
<p class=aide">
|
||||||
|
Il faut renseigner les différents paramètres de l'amortissement :
|
||||||
|
<ul class="aide">
|
||||||
|
<li>Date ; par défaut, il s'agit de la date de fin d'exercice</li>
|
||||||
|
<li>Libellé : déterminé à partir du libellé de l'immobilisation< ; il peut être modifié/li>
|
||||||
|
<li>Montant : sa valeur est calculée par le module ; elle peut être modifiée</li>
|
||||||
|
<li>
|
||||||
|
Compte de débit : à choisir dans la liste ; par défaut
|
||||||
|
c'est le compte <em>6811 : Dotation aux amortissements
|
||||||
|
des immobilisations</em>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Compte d'amortissement : à choisir dans la liste ; par
|
||||||
|
défaut c'est le compte formé en intercalant un 8 après
|
||||||
|
le 2 initial du compte d'immobilisation (exemple :
|
||||||
|
2183 => 28183)
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<!--
|
||||||
|
<p class="aide">
|
||||||
|
Après enregistrement, on se retrouve sur la page des amortissements
|
||||||
|
</p>
|
||||||
|
-->
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h2 class="aide">Remarques</h2>
|
||||||
|
|
||||||
|
<ul class="aide">
|
||||||
|
<li>
|
||||||
|
Les écritures d'immobilisation et d'amortissement créées en
|
||||||
|
dehors du module ne peuvent être associées automatiquement que
|
||||||
|
si leurs écritures ont été liées ; dans le cas contraire, il
|
||||||
|
faudra renseigner manuellement les infos de l'immobilisation.
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
<p class="aide">
|
||||||
|
Dans le deuxième cas, il faut cliquer sur le bouton « Ajouter
|
||||||
|
infos » puis :
|
||||||
|
<ul class="aide">
|
||||||
|
<li>soit indiquer que l'immobilisation ne doit pas être amortie</li>
|
||||||
|
<li>soit fournir la date de mise en service du bien (si différente de la date d'acquisition) ainsi
|
||||||
|
que la durée en années de l'amortissement</li>
|
||||||
|
</ul>
|
||||||
|
</p>
|
||||||
|
<p class="aide">
|
||||||
|
Tant qu'une immobilisation ne possède pas d'amortissement, il est
|
||||||
|
possible de modifier ses informations à l'aide du bouton «
|
||||||
|
Modifier infos ».
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
@ -29,36 +29,41 @@
|
||||||
{{* déduire le montant des écritures liées à l'immo courante au crédit du même compte *}}
|
{{* déduire le montant des écritures liées à l'immo courante au crédit du même compte *}}
|
||||||
{{:include file="_get_credit_lines.html" immo_doc_id=$_GET.immo_doc_id keep="linked_immos, total_credits"}}
|
{{:include file="_get_credit_lines.html" immo_doc_id=$_GET.immo_doc_id keep="linked_immos, total_credits"}}
|
||||||
{{:assign solde="%d-%d"|math:$ligne_immo.amount:$total_credits}}
|
{{:assign solde="%d-%d"|math:$ligne_immo.amount:$total_credits}}
|
||||||
{{:assign valeur_residuelle=$solde}}
|
|
||||||
|
{{if $info_immo.status == "amortized"}}
|
||||||
|
{{:assign amort_amount=$solde}}
|
||||||
|
{{:assign valeur_residuelle=0}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign valeur_residuelle=$solde}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{* lister les amortissements liés à l'immobilisation *}}
|
{{* 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, created_amort"}}
|
{{:include file="./_get_amort_lines.html" immo_doc_id=$_GET.immo_doc_id keep="linked_amort, total_amort"}}
|
||||||
{{:assign valeur_residuelle="%d-%d"|math:$valeur_residuelle:$total_amort}}
|
{{:assign valeur_residuelle="%d-%d"|math:$valeur_residuelle:$total_amort}}
|
||||||
|
|
||||||
{{if $valeur_residuelle > 0}}
|
{{if $valeur_residuelle > 0}}
|
||||||
{{* lister les amortissements non attachés à une immo *}}
|
{{* lister les amortissements non attachés à une immo *}}
|
||||||
{{:assign account_filter="28%"|quote_sql}}
|
{{:include file="./_get_free_amort.html" filter_condition="1" keep="free_amort_lines"}}
|
||||||
{{:assign filter_condition="account.code LIKE "|cat:$account_filter}}
|
|
||||||
{{:include file="./_get_free_amort.html" filter_condition=$filter_condition keep="free_amort_lines"}}
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{:admin_header title="Détails de l'immobilisation" custom_css="./style.css" current="module_amortization"}}
|
{{:admin_header title="Liste des amortissements" custom_css="./style.css" current="module_amortization"}}
|
||||||
|
|
||||||
{{* barre de navigation *}}
|
{{* barre de navigation *}}
|
||||||
{{if $_GET.type_immo == "amortized" && $valeur_residuelle == 0}}
|
{{if $_GET.type_immo == "amortized" || $valeur_residuelle== 0 }}
|
||||||
{{:assign current="amortized"}}
|
{{:assign subcurrent="amortized"}}
|
||||||
{{elseif $_GET.type_immo == "archived"}}
|
{{elseif $_GET.type_immo == "archived"}}
|
||||||
{{:assign current="archived"}}
|
{{:assign subcurrent="archived"}}
|
||||||
{{elseif $_GET.type_immo == null || $_GET.type_immo == "managed" || $valeur_residuelle > 0}}
|
{{elseif $_GET.type_immo == null || $_GET.type_immo == "managed"}}
|
||||||
{{:assign current="managed"}}
|
{{:assign subcurrent="managed"}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign current="other"}}
|
{{:assign subcurrent="other"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{:include
|
{{:include
|
||||||
file="_nav.html"
|
file="_nav.html"
|
||||||
current="%s"|args:$current
|
current="index"
|
||||||
subcurrent="details"
|
subcurrent="%s"|args:$subcurrent
|
||||||
|
subsubcurrent="amortization"
|
||||||
type_immo=$_GET.type_immo
|
type_immo=$_GET.type_immo
|
||||||
autres_amort=$free_amort_lines
|
autres_amort=$free_amort_lines
|
||||||
}}
|
}}
|
||||||
|
|
@ -74,8 +79,6 @@
|
||||||
{{:assign msg="Détachement avoir affectué"}}
|
{{:assign msg="Détachement avoir affectué"}}
|
||||||
{{elseif $_GET.msg|match:"amortissement"}}
|
{{elseif $_GET.msg|match:"amortissement"}}
|
||||||
{{:assign msg="Amortissement enregistré"}}
|
{{:assign msg="Amortissement enregistré"}}
|
||||||
{{elseif $_GET.msg|match:"modif"}}
|
|
||||||
{{:assign msg="Modifications enregistrées"}}
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<p class="block confirm">{{$msg}}</p>
|
<p class="block confirm">{{$msg}}</p>
|
||||||
{{elseif $_GET.err}}
|
{{elseif $_GET.err}}
|
||||||
|
|
@ -105,16 +108,52 @@
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<h3 class="ruler">Immobilisation</h3>
|
<nav style="margin-bottom: 1em;">
|
||||||
<nav class="actions">
|
<aside> {{* class="right">*}}
|
||||||
{{if $total_amort == 0}}
|
{{if $total_amort == 0}}
|
||||||
{{:linkbutton label="Modifier les paramètres" href="modify_infos.html?immo_doc_id=%s"|args:$_GET.immo_doc_id shape="edit" target="_dialog"}}
|
{{:linkbutton label="Modifier les paramètres" href="modify_infos.html?immo_doc_id=%s"|args:$_GET.immo_doc_id shape="edit" target="_dialog"}}
|
||||||
{{if ! $info_immo.created}}
|
|
||||||
{{:linkbutton label="Supprimer les paramètres" href="delete_infos.html?immo_doc_id=%s"|args:$_GET.immo_doc_id shape="delete" target="_dialog"}}
|
{{:linkbutton label="Supprimer les paramètres" href="delete_infos.html?immo_doc_id=%s"|args:$_GET.immo_doc_id shape="delete" target="_dialog"}}
|
||||||
|
{{:linkbutton label="Attacher une écriture d'avoir" href="link_immo.html?immo_doc_id=%s"|args:$_GET.immo_doc_id shape="link" target="_dialog"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{if $free_amort_lines}}
|
||||||
|
{{:linkbutton
|
||||||
|
label="Attacher un amortissement"
|
||||||
|
title="Attacher 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"
|
||||||
|
title="Enregistrer un nouvel amortissement"
|
||||||
|
href="save_amort.html?immo_doc_id=%s"|args:$_GET.immo_doc_id target="_dialog"
|
||||||
|
shape="plus"
|
||||||
|
}}
|
||||||
|
</aside>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
|
{{if $linked_immos != null}}
|
||||||
|
<aside class="right">
|
||||||
|
<table class="list">
|
||||||
|
<caption>Écritures d'avoir liées</caption>
|
||||||
|
<tbody>
|
||||||
|
{{#foreach from=$linked_immos item="line"}}
|
||||||
|
{{:assign url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.trans_id}}
|
||||||
|
<tr>
|
||||||
|
<td class="num"><a href="{{$url}}">#{{$line.trans_id}}</a></td>
|
||||||
|
<td>{{$line.label}}</td>
|
||||||
|
<td>{{$line.date|date_short}}</td>
|
||||||
|
<td class="money">{{"%f"|math:$line.amount|money_currency_html:false|raw}}</td>
|
||||||
|
<td>
|
||||||
|
{{:linkbutton label="Détacher" href="detach_credit.html?immo_doc_id=%s&credit_line_id=%s"|args:$_GET.immo_doc_id:$line.credit_line_id shape="minus"}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{{/foreach}}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</aside>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
<div class="informations">
|
<div class="informations">
|
||||||
<dl class="describe">
|
<dl class="describe">
|
||||||
<dt>Immobilisation</dt>
|
<dt>Immobilisation</dt>
|
||||||
|
|
@ -137,7 +176,7 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{if $valeur_residuelle > 0}}
|
{{if $valeur_residuelle > 0}}
|
||||||
<dt>Montant des amortissements</dt>
|
<dt>Montant des amortissements</dt>
|
||||||
<dd>{{$total_amort|money_currency_html:false|raw}}</dd>
|
<dd>{{"%d-%d"|math:$solde:$valeur_residuelle|money_currency_html:false|raw}}</dd>
|
||||||
<dt>Valeur nette résiduelle</dt>
|
<dt>Valeur nette résiduelle</dt>
|
||||||
<dd>{{$valeur_residuelle|money_currency_html:false|raw}}</dd>
|
<dd>{{$valeur_residuelle|money_currency_html:false|raw}}</dd>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
@ -148,63 +187,7 @@
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{if $valeur_residuelle > 0 || $linked_immos != null}}
|
<h3 class="ruler">Amortissements enregistrés</h3>
|
||||||
<h3 class="ruler">Avoirs</h3>
|
|
||||||
<nav class="actions">
|
|
||||||
{{if $total_amort == 0 || ! $created_amort}}
|
|
||||||
{{:linkbutton label="Attacher une écriture d'avoir" href="link_immo.html?immo_doc_id=%s&filter=true"|args:$_GET.immo_doc_id shape="link" target="_dialog"}}
|
|
||||||
{{/if}}
|
|
||||||
</nav>
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{if $linked_immos != null}}
|
|
||||||
<table class="list">
|
|
||||||
<thead>
|
|
||||||
<th class="num">N°</th>
|
|
||||||
<th>Date</th>
|
|
||||||
<th>Libellé</th>
|
|
||||||
<th class="nombre">Montant</th>
|
|
||||||
<th class="actions"></th>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{{#foreach from=$linked_immos item="line"}}
|
|
||||||
{{:assign url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.trans_id}}
|
|
||||||
<tr>
|
|
||||||
<td class="num"><a href="{{$url}}">#{{$line.trans_id}}</a></td>
|
|
||||||
<td>{{$line.date|date_short}}</td>
|
|
||||||
<td>{{$line.label}}</td>
|
|
||||||
<td class="money">{{"%f"|math:$line.amount|money_currency_html:false|raw}}</td>
|
|
||||||
<td>
|
|
||||||
{{if $total_amort == 0}}
|
|
||||||
{{:linkbutton label="Détacher" href="detach_credit.html?immo_doc_id=%s&credit_line_id=%s"|args:$_GET.immo_doc_id:$line.credit_line_id shape="minus"}}
|
|
||||||
{{/if}}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{{/foreach}}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
<h3 class="ruler">Amortissements</h3>
|
|
||||||
<nav class="actions">
|
|
||||||
{{if $free_amort_lines && ! $created_amort}}
|
|
||||||
{{:linkbutton
|
|
||||||
label="Attacher un amortissement"
|
|
||||||
title="Attacher un amortissement existant"
|
|
||||||
href="other_amortizations.html?immo_doc_id=%s&filter=true"|args:$_GET.immo_doc_id
|
|
||||||
shape="link"
|
|
||||||
target="_dialog"}}
|
|
||||||
{{/if}}
|
|
||||||
{{if $valeur_residuelle > 0}}
|
|
||||||
{{: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"
|
|
||||||
}}
|
|
||||||
{{/if}}
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
{{if $linked_amort != null}}
|
{{if $linked_amort != null}}
|
||||||
<section class="amortissement">
|
<section class="amortissement">
|
||||||
<table class="list">
|
<table class="list">
|
||||||
|
|
@ -240,9 +223,7 @@
|
||||||
<td><a href="{{$compte_url}}">{{$line.account_code}}</a></td>
|
<td><a href="{{$compte_url}}">{{$line.account_code}}</a></td>
|
||||||
<td>{{$line.account_label}}</td>
|
<td>{{$line.account_label}}</td>
|
||||||
<td>
|
<td>
|
||||||
{{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"}}
|
{{: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>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
|
@ -251,7 +232,7 @@
|
||||||
</section>
|
</section>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{if $free_amort_lines && ! $created_amort}}
|
{{if $free_amort_lines}}
|
||||||
<p class="block alert">
|
<p class="block alert">
|
||||||
Il y a des écritures d'amortissement qui ne sont pas attachées à une immobilisation ! <br />
|
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.
|
Utilisez le bouton « Attacher un amortissement » pour les afficher ; vous pourrez choisir d'en attacher certaines à cette immobilisation.
|
||||||
|
|
@ -261,6 +242,5 @@
|
||||||
{{if $linked_amort == null}}
|
{{if $linked_amort == null}}
|
||||||
<p class="block alert">Aucun amortissement enregistré pour cette immobilisation ; utilisez le bouton « Enregistrer un amortissement » pour enregistrer un nouvel amortissement</p>
|
<p class="block alert">Aucun amortissement enregistré pour cette immobilisation ; utilisez le bouton « Enregistrer un amortissement » pour enregistrer un nouvel amortissement</p>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{:form_errors}}
|
{{:form_errors}}
|
||||||
{{:admin_footer}}
|
{{:admin_footer}}
|
||||||
|
|
|
||||||
|
|
@ -93,14 +93,28 @@
|
||||||
{{:error message="Le montant de l'amortissement (%s) dépasse la valeur résiduelle de l'immobilisation (%s)"|args:$ma:$vnc}}
|
{{:error message="Le montant de l'amortissement (%s) dépasse la valeur résiduelle de l'immobilisation (%s)"|args:$ma:$vnc}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{*
|
{{* chercher les liaisons de l'écriture d'immobilisation *}}
|
||||||
supprimer les documents qui pointent sur une ligne d'amortissement absente
|
{{#select
|
||||||
cas de la suppression manuelle d'un amortissement
|
CASE links.id_related = :immo_trans_id
|
||||||
*}}
|
WHEN true THEN links.id_transaction
|
||||||
{{:include file="_remove_orphan_docs.tpl"}}
|
WHEN false THEN links.id_related
|
||||||
|
END as linked_id
|
||||||
|
FROM acc_transactions_links as links
|
||||||
|
WHERE id_transaction = :immo_trans_id or id_related = :immo_trans_id;
|
||||||
|
:immo_trans_id = $ligne_immo.trans_id
|
||||||
|
}}
|
||||||
|
{{:assign var="linked_transactions." value=$linked_id}}
|
||||||
|
{{/select}}
|
||||||
|
|
||||||
{{* Lier l'écriture d'amortissement à l'écriture d'immobilisation *}}
|
{{* ajouter la nouvelle liaison *}}
|
||||||
{{:include file="_common_attach.html" immo_doc_id=$_GET.immo_doc_id trans_id=$amort_line.trans_id}}
|
{{:assign var="linked_transactions." value=$amort_line.trans_id}}
|
||||||
|
{{:api
|
||||||
|
method="POST"
|
||||||
|
path="accounting/transaction/%s/transactions"|args:$ligne_immo.trans_id
|
||||||
|
assign="result"
|
||||||
|
assign_code="result_code"
|
||||||
|
transactions=$linked_transactions
|
||||||
|
}}
|
||||||
|
|
||||||
{{* vérifier si cette liaison est déjà présente dans les documents pour éviter les doublons *}}
|
{{* vérifier si cette liaison est déjà présente dans les documents pour éviter les doublons *}}
|
||||||
{{* TODO voir si nécessaire ? *}}
|
{{* TODO voir si nécessaire ? *}}
|
||||||
|
|
@ -121,7 +135,7 @@
|
||||||
{{/load}}
|
{{/load}}
|
||||||
|
|
||||||
{{* immo soldée ? *}}
|
{{* immo soldée ? *}}
|
||||||
{{if $total_amort == $montant_immo && $_GET.from != "exit"}}
|
{{if $total_amort == $montant_immo}}
|
||||||
{{:assign status="amortized"}}
|
{{:assign status="amortized"}}
|
||||||
{{:save
|
{{:save
|
||||||
key=$info_immo.key
|
key=$info_immo.key
|
||||||
|
|
@ -140,7 +154,7 @@
|
||||||
|
|
||||||
{{* barre de navigation *}}
|
{{* barre de navigation *}}
|
||||||
{{if ! $dialog}}
|
{{if ! $dialog}}
|
||||||
{{:include file="_nav.html" current="managed" subcurrent="attach_amort"}}
|
{{:include file="_nav.html" current="config" subcurrent="init" subsubcurrent="parameter"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:form_errors}}
|
{{:form_errors}}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
||||||
{{* -*- brindille -*- *}}
|
|
||||||
|
|
||||||
{{*
|
|
||||||
Enregistrer la liaison entre une écriture d'immobilisation et
|
|
||||||
une écriture de cession
|
|
||||||
@param immo_doc_id : id du document associé à l'immobilisation
|
|
||||||
@param cession_line_id : ligne de l'écriture de cession
|
|
||||||
*}}
|
|
||||||
|
|
||||||
{{* données de l'immobilisation *}}
|
|
||||||
{{:include file="_get_immo_data.html" immo_doc_id=$_GET.immo_doc_id keep="info_immo, ligne_immo, message"}}
|
|
||||||
{{if $message != null}}
|
|
||||||
{{:error message=$message}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{* chercher l'écriture de cession de l'immobilisation *}}
|
|
||||||
{{#select
|
|
||||||
id_transaction
|
|
||||||
FROM acc_transactions_lines
|
|
||||||
WHERE id = :line_id;
|
|
||||||
:line_id = $_GET.cession_line_id|intval
|
|
||||||
}}
|
|
||||||
{{:assign cession_id=$id_transaction}}
|
|
||||||
{{else}}
|
|
||||||
{{:error message="Impossible de trouver l'écriture de cession de l'immobilisation"}}
|
|
||||||
{{/select}}
|
|
||||||
|
|
||||||
{{* Lier l'écriture de cession à l'écriture d'immobilisation *}}
|
|
||||||
{{:include file="_common_attach.html" immo_doc_id=$_GET.immo_doc_id trans_id=$cession_id}}
|
|
||||||
|
|
||||||
{{* enregistrer la liaison de l'écriture de cession *}}
|
|
||||||
{{:save
|
|
||||||
key=""|uuid
|
|
||||||
type="cession_link"
|
|
||||||
immo_doc_id=$info_immo.id
|
|
||||||
cession_line_id=$_GET.cession_line_id|intval
|
|
||||||
}}
|
|
||||||
|
|
||||||
{{:redirect force="exit_step3.html?immo_doc_id=%s&ok=1&msg=attach_cession"|args:$_GET.immo_doc_id}}
|
|
||||||
|
|
@ -79,8 +79,30 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{* Lier l'écriture de crédit à l'écriture d'immobilisation *}}
|
{{* chercher les liaisons de l'écriture d'immobilisation *}}
|
||||||
{{:include file="_common_attach.html" immo_doc_id=$_GET.immo_doc_id trans_id=$credit_line.trans_id}}
|
{{#select
|
||||||
|
CASE links.id_related = :immo_trans_id
|
||||||
|
WHEN true THEN links.id_transaction
|
||||||
|
WHEN false THEN links.id_related
|
||||||
|
END as linked_id
|
||||||
|
FROM acc_transactions_links as links
|
||||||
|
WHERE id_transaction = :immo_trans_id or id_related = :immo_trans_id;
|
||||||
|
:immo_trans_id = $ligne_immo.trans_id
|
||||||
|
}}
|
||||||
|
{{:assign var="linked_transactions." value=$linked_id}}
|
||||||
|
{{/select}}
|
||||||
|
|
||||||
|
{{* ajouter la nouvelle liaison *}}
|
||||||
|
{{:assign var="linked_transactions." value=$credit_line.trans_id}}
|
||||||
|
|
||||||
|
{{* Enregistrer les liaisons *}}
|
||||||
|
{{:api
|
||||||
|
method="POST"
|
||||||
|
path="accounting/transaction/%s/transactions"|args:$ligne_immo.trans_id
|
||||||
|
assign="result"
|
||||||
|
assign_code="result_code"
|
||||||
|
transactions=$linked_transactions
|
||||||
|
}}
|
||||||
|
|
||||||
{{*
|
{{*
|
||||||
TODO ? vérifier le succès avant d'enregistrer le doc ?
|
TODO ? vérifier le succès avant d'enregistrer le doc ?
|
||||||
|
|
@ -95,28 +117,28 @@
|
||||||
amount=$saved_credit
|
amount=$saved_credit
|
||||||
}}
|
}}
|
||||||
|
|
||||||
{{*
|
|
||||||
{{if $montant_credit == $solde_immo}}
|
{{if $montant_credit == $solde_immo}}
|
||||||
{{:save
|
{{:save
|
||||||
id=$_GET.immo_doc_id
|
id=$_GET.immo_doc_id
|
||||||
status="archived"
|
status="archived"
|
||||||
}}
|
}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
*}}
|
|
||||||
|
|
||||||
{{if $_GET.from == "exit"}}
|
{{if $_GET.from == "exit"}}
|
||||||
{{:redirect force="exit_step1.html?immo_doc_id=%s&ok=1&msg=attach_avoir"|args:$_GET.immo_doc_id}}
|
{{:redirect force="exit_step1.html?immo_doc_id=%s&ok=1&msg=attach_avoir"|args:$_GET.immo_doc_id}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:redirect force="amortization.html?immo_doc_id=%s&ok=1&msg=attach_avoir"|args:$_GET.immo_doc_id}}
|
{{:redirect force="amortization.html?immo_doc_id=%s&ok=1&msg=attach_avoir"|args:$_GET.immo_doc_id}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{*:redirect to="details_immo.html?immo_doc_id=%s&ok=1&msg=attach_credit"|args:$_GET.immo_doc_id*}}
|
||||||
{{/form}}
|
{{/form}}
|
||||||
|
|
||||||
{{:admin_header title="Écritures au crédit du compte d'immobilisation" custom_css="./style.css" current="module_amortization"}}
|
{{:admin_header title="Écritures au crédit du compte d'immobilisation" custom_css="./style.css" current="module_amortization"}}
|
||||||
{{if ! $dialog}}
|
{{if ! $dialog}}
|
||||||
{{:include
|
{{:include
|
||||||
file="_nav.html"
|
file="_nav.html"
|
||||||
current="managed"
|
current="config"
|
||||||
subcurrent="attach_credit"
|
subcurrent="other"
|
||||||
|
subsubcurrent="immo"
|
||||||
type_immo="other"
|
type_immo="other"
|
||||||
}}
|
}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,30 @@
|
||||||
{{:error message="Impossible de trouver l'écriture de sortie d'immobilisation"}}
|
{{:error message="Impossible de trouver l'écriture de sortie d'immobilisation"}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
|
|
||||||
{{* Lier l'écriture de sortie à l'écriture d'immobilisation *}}
|
{{* chercher les liaisons de l'écriture d'immobilisation *}}
|
||||||
{{:include file="_common_attach.html" immo_doc_id=$_GET.immo_doc_id trans_id=$rebut_id}}
|
{{#select
|
||||||
|
CASE links.id_related = :immo_trans_id
|
||||||
|
WHEN true THEN links.id_transaction
|
||||||
|
WHEN false THEN links.id_related
|
||||||
|
END as linked_id
|
||||||
|
FROM acc_transactions_links as links
|
||||||
|
WHERE id_transaction = :immo_trans_id or id_related = :immo_trans_id;
|
||||||
|
:immo_trans_id = $ligne_immo.trans_id
|
||||||
|
}}
|
||||||
|
{{:assign var="linked_transactions." value=$linked_id}}
|
||||||
|
{{/select}}
|
||||||
|
|
||||||
|
{{* ajouter la nouvelle liaison *}}
|
||||||
|
{{:assign var="linked_transactions." value=$rebut_id}}
|
||||||
|
|
||||||
|
{{* Enregistrer les liaisons *}}
|
||||||
|
{{:api
|
||||||
|
method="POST"
|
||||||
|
path="accounting/transaction/%s/transactions"|args:$ligne_immo.trans_id
|
||||||
|
assign="result"
|
||||||
|
assign_code="result_code"
|
||||||
|
transactions=$linked_transactions
|
||||||
|
}}
|
||||||
|
|
||||||
{{* enregistrer la liaison de l'écriture de sortie *}}
|
{{* enregistrer la liaison de l'écriture de sortie *}}
|
||||||
{{:save
|
{{:save
|
||||||
|
|
@ -36,4 +58,4 @@
|
||||||
exit_line_id=$_GET.exit_line_id|intval
|
exit_line_id=$_GET.exit_line_id|intval
|
||||||
}}
|
}}
|
||||||
|
|
||||||
{{:redirect to="exit_step4.html?immo_doc_id=%s&ok=1&msg=attach_exit"|args:$_GET.immo_doc_id}}
|
{{:redirect to="exit_step3.html?immo_doc_id=%s&ok=1&msg=attach_exit"|args:$_GET.immo_doc_id}}
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,6 @@
|
||||||
{{if $message != null}}
|
{{if $message != null}}
|
||||||
{{:error message=$message}}
|
{{:error message=$message}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{* TODO VÉRIFIER SI UTILE *}}
|
|
||||||
{{*
|
|
||||||
{{if $info_immo.duration == null || $info_immo.duration == 0}}
|
|
||||||
{{:error message="Vous devez renseigner la durée d'amortissement au préalable"}}
|
|
||||||
{{/if}}
|
|
||||||
*}}
|
|
||||||
|
|
||||||
{{:assign label_immo=$info_immo.label|or:$ligne_immo.trans_label}}
|
{{:assign label_immo=$info_immo.label|or:$ligne_immo.trans_label}}
|
||||||
{{if $ligne_immo.line_label != null && $ligne_immo.line_label != $label_immo}}
|
{{if $ligne_immo.line_label != null && $ligne_immo.line_label != $label_immo}}
|
||||||
|
|
@ -77,7 +71,7 @@
|
||||||
{{:assign var="open_years.%d"|args:$id value=$label|cat:" (du "|cat:$debut|cat:" au "|cat:$fin|cat:")"}}
|
{{:assign var="open_years.%d"|args:$id value=$label|cat:" (du "|cat:$debut|cat:" au "|cat:$fin|cat:")"}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign debut=$date_debut|date_short}}
|
{{:assign debut=$date_debut|date_short}}
|
||||||
{{:error message="Aucun exercice ouvert pour enregistrer la sortie de bilan à partir du %s"|args:$debut}}
|
{{:error message="Aucun exercice ouvert pour enregistrer un amortissement à partir du %s"|args:$debut}}
|
||||||
{{/years}}
|
{{/years}}
|
||||||
{{if $years|count == 1}}
|
{{if $years|count == 1}}
|
||||||
{{:assign default_year=$years.0.id}}
|
{{:assign default_year=$years.0.id}}
|
||||||
|
|
@ -141,7 +135,7 @@
|
||||||
|
|
||||||
{{:admin_header title="Sortie de bilan" custom_css="./style.css" current="module_amortization"}}
|
{{:admin_header title="Sortie de bilan" custom_css="./style.css" current="module_amortization"}}
|
||||||
{{if ! $dialog}}
|
{{if ! $dialog}}
|
||||||
{{:include file="_nav.html" current="%s"|args:$_GET.type_immo subcurrent="balance_exit"}}
|
{{:include file="_nav.html" current="index" subcurrent="%s"|args:$_GET.type_immo subsubcurrent="balance_exit"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:form_errors}}
|
{{:form_errors}}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,7 @@
|
||||||
@param date_debut : date de début de la période d'amortissement complémentaire
|
@param date_debut : date de début de la période d'amortissement complémentaire
|
||||||
@param exit_date : date de sortie de l'immobilisation
|
@param exit_date : date de sortie de l'immobilisation
|
||||||
*}}
|
*}}
|
||||||
|
{{* TODO *}}
|
||||||
{{* TODO boutons de navigation avant-arrière*}}
|
|
||||||
|
|
||||||
{{* données de l'immobilisation *}}
|
{{* 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"}}
|
{{:include file="_get_immo_data.html" immo_doc_id=$_GET.immo_doc_id|intval keep="info_immo, ligne_immo, message"}}
|
||||||
{{if $message != null}}
|
{{if $message != null}}
|
||||||
|
|
@ -60,12 +58,7 @@
|
||||||
|
|
||||||
{{* barre de navigation *}}
|
{{* barre de navigation *}}
|
||||||
{{if ! $dialog}}
|
{{if ! $dialog}}
|
||||||
{{if $valeur_nette > 0}}
|
{{:include file="_nav.html" current="index" subcurrent="balance_exit"}}
|
||||||
{{:assign type_immo="managed"}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign type_immo="amortized"}}
|
|
||||||
{{/if}}
|
|
||||||
{{:include file="_nav.html" current="%s"|args:$type_immo subcurrent="balance_exit"}}
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{:form_errors}}
|
{{:form_errors}}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,6 @@
|
||||||
{{/form}}
|
{{/form}}
|
||||||
|
|
||||||
{{:admin_header title="Configuration" custom_css="./style.css" current="module_amortization"}}
|
{{:admin_header title="Configuration" custom_css="./style.css" current="module_amortization"}}
|
||||||
|
|
||||||
{{:include file="_nav.html" current="config"}}
|
{{:include file="_nav.html" current="config"}}
|
||||||
{{if $_GET.ok == 1}}
|
{{if $_GET.ok == 1}}
|
||||||
<p class="block confirm">Configuration enregistrée.</p>
|
<p class="block confirm">Configuration enregistrée.</p>
|
||||||
|
|
@ -155,14 +154,13 @@
|
||||||
}}
|
}}
|
||||||
</td>
|
</td>
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
{{if ! $code|in:$config_defaut.prefixes}}
|
|
||||||
{{:button
|
{{:button
|
||||||
label="Enlever"
|
label="Enlever"
|
||||||
|
title="Enlever une ligne"
|
||||||
shape="minus"
|
shape="minus"
|
||||||
min="1"
|
min="1"
|
||||||
name="remove_line"
|
name="remove_line"
|
||||||
}}
|
}}
|
||||||
{{/if}}
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
|
@ -189,7 +187,6 @@
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
||||||
{{:assign unfinished_lines=$config_defaut.unfinished|map:implode:"-"|implode:","}}
|
|
||||||
{{#foreach from=$unfinished_accounts key=code item=elem}}
|
{{#foreach from=$unfinished_accounts key=code item=elem}}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
|
|
@ -203,7 +200,6 @@
|
||||||
}}
|
}}
|
||||||
</td>
|
</td>
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
{{if $unfinished_lines|strpos:$code === false}}
|
|
||||||
{{:button
|
{{:button
|
||||||
label="Enlever"
|
label="Enlever"
|
||||||
title="Enlever une ligne"
|
title="Enlever une ligne"
|
||||||
|
|
@ -211,7 +207,6 @@
|
||||||
min="1"
|
min="1"
|
||||||
name="remove_line"
|
name="remove_line"
|
||||||
}}
|
}}
|
||||||
{{/if}}
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,8 @@
|
||||||
@param amort_line_id : id de la ligne d'amortissement
|
@param amort_line_id : id de la ligne d'amortissement
|
||||||
*}}
|
*}}
|
||||||
|
|
||||||
{{:include file="_common_detach.html" immo_doc_id=$_GET.immo_doc_id line_id=$_GET.amort_line_id keep="info_immo"}}
|
{{:include file="_common_detach.html" immo_doc_id=$_GET.immo_doc_id line_id=$_GET.amort_line_id}}
|
||||||
|
|
||||||
{{* supprimer le doc de liaison entre les lignes *}}
|
{{* supprimer le doc de liaison entre les lignes *}}
|
||||||
{{#load type="amort_link"
|
{{#load type="amort_link"
|
||||||
where="$$.immo_doc_id = :immo_doc_id AND $$.amort_line_id = :amort_line_id"
|
where="$$.immo_doc_id = :immo_doc_id AND $$.amort_line_id = :amort_line_id"
|
||||||
|
|
@ -18,12 +19,11 @@
|
||||||
{{/load}}
|
{{/load}}
|
||||||
|
|
||||||
{{* marquer immo non soldée *}}
|
{{* marquer immo non soldée *}}
|
||||||
{{if $info_immo.status == "amortized"}}
|
{{* TODO : À VÉRIFIER *}}
|
||||||
{{:save
|
{{:save
|
||||||
key=$info_immo.key
|
key=$info_immo.key
|
||||||
status="managed"
|
status="managed"
|
||||||
}}
|
}}
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{if $_GET.from == "exit"}}
|
{{if $_GET.from == "exit"}}
|
||||||
{{:redirect force="exit_step2.html?immo_doc_id=%s&ok=1&msg=detach_amort"|args:$_GET.immo_doc_id}}
|
{{:redirect force="exit_step2.html?immo_doc_id=%s&ok=1&msg=detach_amort"|args:$_GET.immo_doc_id}}
|
||||||
|
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
{{* -*- brindille -*- *}}
|
|
||||||
|
|
||||||
{{*
|
|
||||||
Supprimer l'association entre une écriture d'immobilisation et
|
|
||||||
une écriture de cession
|
|
||||||
@param immo_doc_id : id du doc associé à l'immo
|
|
||||||
@param cession_line_id : id de la ligne de cession
|
|
||||||
*}}
|
|
||||||
|
|
||||||
{{:include file="_common_detach.html" immo_doc_id=$_GET.immo_doc_id line_id=$_GET.cession_line_id}}
|
|
||||||
|
|
||||||
{{* supprimer le doc de liaison entre les lignes *}}
|
|
||||||
{{#load type="cession_link"
|
|
||||||
where="$$.immo_doc_id = :immo_doc_id AND $$.cession_line_id = :cession_line_id"
|
|
||||||
:immo_doc_id=$_GET.immo_doc_id|intval
|
|
||||||
:cession_line_id = $_GET.cession_line_id|intval
|
|
||||||
}}
|
|
||||||
{{:delete id=$id}}
|
|
||||||
{{/load}}
|
|
||||||
|
|
||||||
{{:redirect to="exit_step3.html?immo_doc_id=%s&ok=1&msg=detach_cession"|args:$_GET.immo_doc_id}}
|
|
||||||
|
|
@ -18,8 +18,15 @@
|
||||||
{{:delete id=$id}}
|
{{:delete id=$id}}
|
||||||
{{/load}}
|
{{/load}}
|
||||||
|
|
||||||
|
{{* TODO : À VÉRIFIER *}}
|
||||||
|
{{:save
|
||||||
|
id=$_GET.immo_doc_id|intval
|
||||||
|
status="managed"
|
||||||
|
}}
|
||||||
|
|
||||||
{{if $_GET.from == "exit"}}
|
{{if $_GET.from == "exit"}}
|
||||||
{{:redirect force="exit_step1.html?immo_doc_id=%s&ok=1&msg=detach_avoir"|args:$_GET.immo_doc_id}}
|
{{:redirect force="exit_step1.html?immo_doc_id=%s&ok=1&msg=detach_avoir"|args:$_GET.immo_doc_id}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:redirect force="amortization.html?immo_doc_id=%s&ok=1&msg=detach_avoir"|args:$_GET.immo_doc_id}}
|
{{:redirect force="amortization.html?immo_doc_id=%s&ok=1&msg=detach_avoir"|args:$_GET.immo_doc_id}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{*:redirect to="details_immo.html?immo_doc_id=%s&ok=1&msg=detach&"|args:$_GET.immo_doc_id*}}
|
||||||
|
|
|
||||||
|
|
@ -18,4 +18,4 @@
|
||||||
{{:delete id=$id}}
|
{{:delete id=$id}}
|
||||||
{{/load}}
|
{{/load}}
|
||||||
|
|
||||||
{{:redirect to="exit_step4.html?immo_doc_id=%s&ok=1&msg=detach_exit"|args:$_GET.immo_doc_id}}
|
{{:redirect to="exit_step3.html?immo_doc_id=%s&ok=1&msg=detach_exit"|args:$_GET.immo_doc_id}}
|
||||||
|
|
|
||||||
148
details_immo.html
Normal file
148
details_immo.html
Normal file
|
|
@ -0,0 +1,148 @@
|
||||||
|
{{* -*- brindille -*- *}}
|
||||||
|
|
||||||
|
|
||||||
|
{{*
|
||||||
|
Afficher les détails d'une immmo
|
||||||
|
- permettre l'association d'une immo au crédit du compte de l'immo
|
||||||
|
- permettre de modifier les paramètres de l'immo
|
||||||
|
@param immo_doc_id : numéro du doc d'immo
|
||||||
|
*}}
|
||||||
|
|
||||||
|
{{* 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}}
|
||||||
|
{{:error message=$message}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{:assign var="info_immo.amount" value=$info_immo.amount|or:$ligne_immo.amount}}
|
||||||
|
{{:assign var="info_immo.date_achat" value=$info_immo.date_achat|or:$ligne_immo.date_achat}}
|
||||||
|
{{:assign var="info_immo.date_mes" value=$info_immo.date_mes|or:$info_immo.date_achat|or:$ligne_immo.date_achat}}
|
||||||
|
{{:assign var="info_immo.label" value=$info_immo.label|or:$ligne_immo.trans_label}}
|
||||||
|
{{if $ligne_immo.line_label != null && $ligne_immo.line_label != $info_immo.label}}
|
||||||
|
{{:assign var="info_immo.label" value=$info_immo.label|cat:" — "|cat:$ligne_immo.line_label}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{* déduire le montant des écritures liées à l'immo courante au crédit du même compte *}}
|
||||||
|
{{:include file="_get_credit_lines.html" immo_doc_id=$_GET.immo_doc_id keep="linked_immos, total_credits"}}
|
||||||
|
{{:assign solde="%d-%d"|math:$info_immo.amount:$total_credits}}
|
||||||
|
|
||||||
|
{{* lister les amortissements liés à l'immobilisation *}}
|
||||||
|
{{:include file="./_get_amort_lines.html" immo_doc_id=$_GET.immo_doc_id keep="total_amort"}}
|
||||||
|
|
||||||
|
{{:admin_header title="Détails de l'immobilisation" custom_css="./style.css" current="module_amortization"}}
|
||||||
|
|
||||||
|
{{*
|
||||||
|
{{if ! $dialog}}
|
||||||
|
{{:assign subsubcurrent=null}}
|
||||||
|
{{if $total_credits == 0 && $total_amort == 0}}
|
||||||
|
{{:assign subsubcurrent="credit"}}
|
||||||
|
{{/if}}
|
||||||
|
{{if $total_amort == 0}}
|
||||||
|
{{:assign subsubcurrent=$subsubcurrent|cat:"-modif"}}
|
||||||
|
{{/if}}
|
||||||
|
{{:include file="_nav.html" current="index" subcurrent="details" subsubcurrent=$subsubcurrent}}
|
||||||
|
{{/if}}
|
||||||
|
*}}
|
||||||
|
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$ligne_immo.trans_id}}
|
||||||
|
|
||||||
|
<nav class="tabs">
|
||||||
|
<aside>
|
||||||
|
{{*if $total_credits == 0*}}
|
||||||
|
{{:linkbutton label="Rattacher une écriture d'avoir" href="link_immo.html?immo_doc_id=%s"|args:$_GET.immo_doc_id shape="link" target="_dialog"}}
|
||||||
|
{{*/if*}}
|
||||||
|
</aside>
|
||||||
|
<nav style="margin-bottom: 1em;">
|
||||||
|
{{:linkbutton shape="left" label="Retour à la liste des immobilisations" href="index.html}}
|
||||||
|
{{if $total_amort == 0}}
|
||||||
|
{{:linkbutton label="Modifier les paramètres" href="modify_infos.html?immo_doc_id=%s"|args:$_GET.immo_doc_id shape="edit" target="_dialog"}}
|
||||||
|
{{:linkbutton label="Supprimer les paramètres" href="delete_infos.html?immo_doc_id=%s"|args:$_GET.immo_doc_id shape="delete" target="_dialog"}}
|
||||||
|
{{/if}}
|
||||||
|
</nav>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
{{if $_GET.ok}}
|
||||||
|
{{if $_GET.msg|match:"attach_amort"}}
|
||||||
|
{{:assign msg="Écriture d'amortissement attachée"}}
|
||||||
|
{{elseif $_GET.msg|match:"attach_credit"}}
|
||||||
|
{{:assign msg="Écriture au crédit attachée"}}
|
||||||
|
{{elseif $_GET.msg|match:"info"}}
|
||||||
|
{{:assign msg="Données de l'immobilisation enregistrées"}}
|
||||||
|
{{elseif $_GET.msg|match:"detach"}}
|
||||||
|
{{:assign msg="Écriture au crédit détachée"}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign msg="Opération effectuée avec succès"}}
|
||||||
|
{{/if}}
|
||||||
|
<p class="block confirm">{{$msg}}</p>
|
||||||
|
{{elseif $_GET.err}}
|
||||||
|
{{:assign msg="L'opération a échoué"}}
|
||||||
|
<p class="block error">{{$msg}}</p>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
<h3 class="ruler">
|
||||||
|
Immobilisation
|
||||||
|
<span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.trans_id}}</a></span>
|
||||||
|
{{$info_immo.label}}
|
||||||
|
</h3>
|
||||||
|
{{if $linked_immos != null}}
|
||||||
|
<aside class="right">
|
||||||
|
<table class="list">
|
||||||
|
<caption>Écritures d'avoir liées</caption>
|
||||||
|
<tbody>
|
||||||
|
{{#foreach from=$linked_immos item="line"}}
|
||||||
|
{{:assign url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.trans_id}}
|
||||||
|
<tr>
|
||||||
|
<td class="num"><a href="{{$url}}">#{{$line.trans_id}}</a></td>
|
||||||
|
<td>{{$line.label}}</td>
|
||||||
|
<td>{{$line.date|date_short}}</td>
|
||||||
|
<td class="money">{{"%f"|math:$line.amount|money_currency_html:false|raw}}</td>
|
||||||
|
<td>
|
||||||
|
{{:linkbutton label="Détacher" href="detach_credit.html?immo_doc_id=%s&credit_line_id=%s"|args:$_GET.immo_doc_id:$line.credit_line_id shape="minus"}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{{/foreach}}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</aside>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
<div class="informations">
|
||||||
|
<dl class="describe">
|
||||||
|
{{*
|
||||||
|
<dt>Immobilisation</dt>
|
||||||
|
<dd><span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.trans_id}}</a></span><span class="label"> {{$info_immo.label}}</span></dd>
|
||||||
|
*}}
|
||||||
|
<dt>Compte d'immobilisation</dt>
|
||||||
|
<dd>{{$ligne_immo.account_code}} — {{$ligne_immo.account_label}}</dd>
|
||||||
|
<dt>Date d'acquisition</dt>
|
||||||
|
<dd>{{$info_immo.date_achat|date_short}}</dd>
|
||||||
|
{{if $info_immo.date_mes != null && $info_immo.date_mes != $info_immo.date_achat}}
|
||||||
|
<dt>Date de mise en service</dt>
|
||||||
|
<dd>{{$info_immo.date_mes|date_short}}</dd>
|
||||||
|
{{/if}}
|
||||||
|
<dt>Durée d'amortissement</dt>
|
||||||
|
<dd>{{$info_immo.duration}} ans</dd>
|
||||||
|
<dt>Montant de l'immobilisation</dt>
|
||||||
|
<dd class="money">{{"%f"|math:$info_immo.amount|money_currency_html:false|raw}}</dd>
|
||||||
|
{{if $total_credits > 0}}
|
||||||
|
<dt>Montant des avoirs</dt>
|
||||||
|
<dd class="money">{{"%f"|math:$total_credits|money_currency_html:false|raw}}</dd>
|
||||||
|
{{*
|
||||||
|
<dt>Écritures d'avoir</dt>
|
||||||
|
<dd>
|
||||||
|
{{#foreach from=$linked_immos item="line"}}
|
||||||
|
{{:assign url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.id}}
|
||||||
|
<span class="num"><a href="{{$url}}">#{{$line.id}}</a></span>
|
||||||
|
{{/foreach}}
|
||||||
|
</dd>
|
||||||
|
*}}
|
||||||
|
<dt>Montant à amortir</dt>
|
||||||
|
<dd class="money">{{"%f"|math:$solde|money_currency_html:false|raw}}</dd>
|
||||||
|
{{/if}}
|
||||||
|
{{if $total_amort > 0}}
|
||||||
|
<dt>Montant des amortissements</dt>
|
||||||
|
<dd>{{$total_amort|money_currency_html:false|raw}}</dd>
|
||||||
|
<dt>Valeur nette résiduelle</dt>
|
||||||
|
<dd>{{"%d-%d-%d"|math:$info_immo.amount:$total_credits:$total_amort|money_currency_html:false|raw}}</dd>
|
||||||
|
{{/if}}
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{{* -*- brindille -*- *}}
|
{{* -*- brindille -*- *}}
|
||||||
|
|
||||||
{{*
|
{{*
|
||||||
Associer des écritures de crédit à une immo créée et sortie du
|
Associer les différentes écritures à une immo créée et sortie du
|
||||||
bilan avant la mise en service du module
|
bilan avant la mise en service du module
|
||||||
@param immo_doc_id : id du doc associé à l'immobilisation
|
@param immo_doc_id : id du doc associé à l'immobilisation
|
||||||
*}}
|
*}}
|
||||||
|
|
@ -32,7 +32,6 @@
|
||||||
- line.credit < ligne_immo.amount => peut-être un avoir
|
- line.credit < ligne_immo.amount => peut-être un avoir
|
||||||
- line.credit = ligne_immo.amount - avoirs => écriture de sortie du bilan
|
- line.credit = ligne_immo.amount - avoirs => écriture de sortie du bilan
|
||||||
*}}
|
*}}
|
||||||
{{:assign account_code=$ligne_immo.account_code|cat:"%"}}
|
|
||||||
{{#select
|
{{#select
|
||||||
trans.id as trans_id,
|
trans.id as trans_id,
|
||||||
trans.label as trans_label,
|
trans.label as trans_label,
|
||||||
|
|
@ -41,15 +40,15 @@
|
||||||
line.id as credit_line_id,
|
line.id as credit_line_id,
|
||||||
line.label as line_label,
|
line.label as line_label,
|
||||||
line.credit as amount,
|
line.credit as amount,
|
||||||
account.id as account_id,
|
acc.id as account_id,
|
||||||
account.code as account_code,
|
acc.code as account_code,
|
||||||
account.label as account_label
|
acc.label as account_label
|
||||||
FROM acc_transactions AS trans
|
FROM acc_transactions AS trans
|
||||||
INNER JOIN acc_transactions_lines AS line ON line.id_transaction = trans.id
|
INNER JOIN acc_transactions_lines AS line ON line.id_transaction = trans.id
|
||||||
INNER JOIN acc_accounts AS account ON line.id_account = account.id
|
INNER JOIN acc_accounts AS acc ON line.id_account = acc.id
|
||||||
LEFT JOIN module_data_amortization AS mda ON json_extract(mda.document, '$.amort_line_id') = line.id
|
LEFT JOIN module_data_amortization AS mda ON json_extract(mda.document, '$.amort_line_id') = line.id
|
||||||
WHERE
|
WHERE
|
||||||
account.code LIKE :account_code
|
acc.code = :acc_code
|
||||||
AND line.credit > 0
|
AND line.credit > 0
|
||||||
AND credit_line_id NOT IN (
|
AND credit_line_id NOT IN (
|
||||||
SELECT json_extract(credit_link.document, '$.credit_line_id') AS line_id FROM !table as credit_link
|
SELECT json_extract(credit_link.document, '$.credit_line_id') AS line_id FROM !table as credit_link
|
||||||
|
|
@ -59,7 +58,7 @@
|
||||||
WHERE json_extract(exit_link.document, '$.type') == "exit_link"
|
WHERE json_extract(exit_link.document, '$.type') == "exit_link"
|
||||||
)
|
)
|
||||||
;
|
;
|
||||||
:account_code=$account_code
|
:acc_code=$ligne_immo.account_code
|
||||||
!table =$module.table
|
!table =$module.table
|
||||||
assign="credit_line"
|
assign="credit_line"
|
||||||
}}
|
}}
|
||||||
|
|
@ -76,6 +75,7 @@
|
||||||
}}
|
}}
|
||||||
|
|
||||||
{{* chercher des écritures d'amortissement correspondant au compte d'une immo sans doc associé *}}
|
{{* chercher des écritures d'amortissement correspondant au compte d'une immo sans doc associé *}}
|
||||||
|
{{* TODO écritures d'amort pas entièrement affectées *}}
|
||||||
{{#select
|
{{#select
|
||||||
line.id as amort_line_id,
|
line.id as amort_line_id,
|
||||||
line.credit as amort_amount,
|
line.credit as amort_amount,
|
||||||
|
|
@ -105,7 +105,7 @@
|
||||||
{{:assign keep_amort=true}}
|
{{: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.amort_line_id
|
:amort_line_id=$amort_line.amort_line_id|intval
|
||||||
assign="amort_link"
|
assign="amort_link"
|
||||||
}}
|
}}
|
||||||
{{if $amort_link.amount == null || $amort_link.amount == 0}}
|
{{if $amort_link.amount == null || $amort_link.amount == 0}}
|
||||||
|
|
@ -123,12 +123,6 @@
|
||||||
{{/select}}
|
{{/select}}
|
||||||
|
|
||||||
{{:admin_header title="Immobilisation sortie du bilan" custom_css="./style.css" current="module_amortization"}}
|
{{:admin_header title="Immobilisation sortie du bilan" custom_css="./style.css" current="module_amortization"}}
|
||||||
{{if $_GET.from == "exit"}}
|
|
||||||
{{:assign current="other"}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign current="archived"}}
|
|
||||||
{{/if}}
|
|
||||||
{{:include file="_nav.html" current=$current subcurrent="exit"}}
|
|
||||||
|
|
||||||
{{if $_GET.ok}}
|
{{if $_GET.ok}}
|
||||||
{{if $_GET.msg|match:"attach_avoir"}}
|
{{if $_GET.msg|match:"attach_avoir"}}
|
||||||
|
|
@ -203,7 +197,7 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{if $credit_lines}}
|
{{if $credit_lines}}
|
||||||
<h3 class="ruler">Autres écritures au crédit du compte d'immobilisation</h3>
|
<h3 class="ruler">Écritures au crédit du compte d'immobilisation</h3>
|
||||||
<table class="list">
|
<table class="list">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
@ -238,7 +232,7 @@
|
||||||
</table>
|
</table>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
<form method="post" action="exit_step2.html?immo_doc_id={{$_GET.immo_doc_id}}&from={{$_GET.from}}">
|
<form method="post" action="exit_step2.html?immo_doc_id={{$_GET.immo_doc_id}}">
|
||||||
<p class="submit">
|
<p class="submit">
|
||||||
{{:button type="submit" name="proceed" label="Poursuivre" shape="right" class="main"}}
|
{{:button type="submit" name="proceed" label="Poursuivre" shape="right" class="main"}}
|
||||||
</p>
|
</p>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{{* -*- brindille -*- *}}
|
{{* -*- brindille -*- *}}
|
||||||
|
|
||||||
{{*
|
{{*
|
||||||
Associer des écritures d'amortissement à une immo créée et sortie du
|
Associer les différentes écritures à une immo créée et sortie du
|
||||||
bilan avant la mise en service du module
|
bilan avant la mise en service du module
|
||||||
@param immo_doc_id : id du doc associé à l'immobilisation
|
@param immo_doc_id : id du doc associé à l'immobilisation
|
||||||
*}}
|
*}}
|
||||||
|
|
@ -13,11 +13,11 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#form on="backward"}}
|
{{#form on="backward"}}
|
||||||
{{:redirect to="exit_step1.html?immo_doc_id=%s&from=%s"|args:$_GET.immo_doc_id:$_GET.from}}
|
{{:redirect to="exit_step1.html?immo_doc_id=%s"|args:$_GET.immo_doc_id}}
|
||||||
{{/form}}
|
{{/form}}
|
||||||
|
|
||||||
{{#form on="forward"}}
|
{{#form on="forward"}}
|
||||||
{{:redirect to="exit_step3.html?immo_doc_id=%s&from=%s"|args:$_GET.immo_doc_id:$_GET.from}}
|
{{:redirect to="exit_step3.html?immo_doc_id=%s"|args:$_GET.immo_doc_id}}
|
||||||
{{/form}}
|
{{/form}}
|
||||||
|
|
||||||
{{:assign label_immo=$info_immo.label|or:$ligne_immo.trans_label}}
|
{{:assign label_immo=$info_immo.label|or:$ligne_immo.trans_label}}
|
||||||
|
|
@ -43,6 +43,7 @@
|
||||||
}}
|
}}
|
||||||
|
|
||||||
{{* chercher des écritures d'amortissement correspondant au compte d'une immo sans doc associé *}}
|
{{* chercher des écritures d'amortissement correspondant au compte d'une immo sans doc associé *}}
|
||||||
|
{{* TODO écritures d'amort pas entièrement affectées *}}
|
||||||
{{#select
|
{{#select
|
||||||
line.id as amort_line_id,
|
line.id as amort_line_id,
|
||||||
line.credit as amort_amount,
|
line.credit as amort_amount,
|
||||||
|
|
@ -90,12 +91,6 @@
|
||||||
{{/select}}
|
{{/select}}
|
||||||
|
|
||||||
{{:admin_header title="Immobilisation sortie du bilan" custom_css="./style.css" current="module_amortization"}}
|
{{:admin_header title="Immobilisation sortie du bilan" custom_css="./style.css" current="module_amortization"}}
|
||||||
{{if $_GET.from == "exit"}}
|
|
||||||
{{:assign current="other"}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign current="archived"}}
|
|
||||||
{{/if}}
|
|
||||||
{{:include file="_nav.html" current=$current subcurrent="exit"}}
|
|
||||||
|
|
||||||
{{if $_GET.ok}}
|
{{if $_GET.ok}}
|
||||||
{{if $_GET.msg|match:"attach_amort"}}
|
{{if $_GET.msg|match:"attach_amort"}}
|
||||||
|
|
|
||||||
247
exit_step3.html
247
exit_step3.html
|
|
@ -1,7 +1,7 @@
|
||||||
{{* -*- brindille -*- *}}
|
{{* -*- brindille -*- *}}
|
||||||
|
|
||||||
{{*
|
{{*
|
||||||
Associer une écriture de cession à une immo créée et sortie du
|
Associer les différentes écritures à une immo créée et sortie du
|
||||||
bilan avant la mise en service du module
|
bilan avant la mise en service du module
|
||||||
@param immo_doc_id : id du doc associé à l'immobilisation
|
@param immo_doc_id : id du doc associé à l'immobilisation
|
||||||
*}}
|
*}}
|
||||||
|
|
@ -13,11 +13,20 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#form on="backward"}}
|
{{#form on="backward"}}
|
||||||
{{:redirect to="exit_step2.html?immo_doc_id=%s&from=%s"|args:$_GET.immo_doc_id:$_GET.from}}
|
{{:redirect to="exit_step2.html?immo_doc_id=%s"|args:$_GET.immo_doc_id}}
|
||||||
{{/form}}
|
{{/form}}
|
||||||
|
|
||||||
{{#form on="forward"}}
|
{{#form on="validate"}}
|
||||||
{{:redirect to="exit_step4.html?immo_doc_id=%s&from=%s"|args:$_GET.immo_doc_id:$_GET.from}}
|
{{* mettre à jour l'état de l'immobilisation *}}
|
||||||
|
{{:save
|
||||||
|
key=$info_immo.key
|
||||||
|
status="archived"
|
||||||
|
}}
|
||||||
|
{{:redirect to="index.html?type_immo=archived"}}
|
||||||
|
{{/form}}
|
||||||
|
|
||||||
|
{{#form on="finish"}}
|
||||||
|
{{:redirect to="index.html?type_immo=managed"}}
|
||||||
{{/form}}
|
{{/form}}
|
||||||
|
|
||||||
{{:assign label_immo=$info_immo.label|or:$ligne_immo.trans_label}}
|
{{:assign label_immo=$info_immo.label|or:$ligne_immo.trans_label}}
|
||||||
|
|
@ -35,13 +44,84 @@
|
||||||
{{* lister les amortissements liés à l'immobilisation *}}
|
{{* 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"}}
|
||||||
|
|
||||||
{{* chercher des écritures de cession *}}
|
{{* chercher une écriture de sortie de bilan associée *}}
|
||||||
{{:assign total_cession=0}}
|
{{#load type="exit_link" where="$$.immo_doc_id = :immo_doc_id" :immo_doc_id=$info_immo.id assign="exit_info"}}
|
||||||
{{#select
|
{{/load}}
|
||||||
line.id as line_id,
|
{{if $exit_info != null}}
|
||||||
line.credit as amount,
|
{{#select
|
||||||
line.label as line_label,
|
|
||||||
trans.id as trans_id,
|
trans.id as trans_id,
|
||||||
|
trans.label as trans_label,
|
||||||
|
trans.date as date,
|
||||||
|
line.id as line_id,
|
||||||
|
line.label as line_label,
|
||||||
|
line.credit as amount,
|
||||||
|
acc.id as account_id,
|
||||||
|
acc.code as account_code,
|
||||||
|
acc.label as account_label
|
||||||
|
FROM acc_transactions AS trans
|
||||||
|
INNER JOIN acc_transactions_lines AS line ON line.id_transaction = trans.id
|
||||||
|
INNER JOIN acc_accounts AS acc ON line.id_account = acc.id
|
||||||
|
WHERE line.id = :exit_line_id;
|
||||||
|
:exit_line_id = $exit_info.exit_line_id
|
||||||
|
assign="exit_line"
|
||||||
|
}}
|
||||||
|
{{/select}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{*
|
||||||
|
chercher des écritures au crédit du compte de l'immo sans doc associé
|
||||||
|
- line.credit < ligne_immo.amount => peut-être un avoir
|
||||||
|
- line.credit = ligne_immo.amount - avoirs => écriture de sortie du bilan
|
||||||
|
*}}
|
||||||
|
{{#select
|
||||||
|
trans.id as trans_id,
|
||||||
|
trans.label as trans_label,
|
||||||
|
trans.date as date,
|
||||||
|
trans.id_year as year,
|
||||||
|
line.id as credit_line_id,
|
||||||
|
line.label as line_label,
|
||||||
|
line.credit as amount,
|
||||||
|
acc.id as account_id,
|
||||||
|
acc.code as account_code,
|
||||||
|
acc.label as account_label
|
||||||
|
FROM acc_transactions AS trans
|
||||||
|
INNER JOIN acc_transactions_lines AS line ON line.id_transaction = trans.id
|
||||||
|
INNER JOIN acc_accounts AS acc ON line.id_account = acc.id
|
||||||
|
LEFT JOIN module_data_amortization AS mda ON json_extract(mda.document, '$.amort_line_id') = line.id
|
||||||
|
WHERE
|
||||||
|
acc.code = :acc_code
|
||||||
|
AND line.credit > 0
|
||||||
|
AND credit_line_id NOT IN (
|
||||||
|
SELECT json_extract(credit_link.document, '$.credit_line_id') AS line_id FROM !table as credit_link
|
||||||
|
WHERE json_extract(credit_link.document, '$.type') == "credit_link"
|
||||||
|
UNION
|
||||||
|
SELECT json_extract(exit_link.document, '$.exit_line_id') AS line_id FROM !table as exit_link
|
||||||
|
WHERE json_extract(exit_link.document, '$.type') == "exit_link"
|
||||||
|
)
|
||||||
|
;
|
||||||
|
:acc_code=$ligne_immo.account_code
|
||||||
|
!table =$module.table
|
||||||
|
assign="credit_line"
|
||||||
|
}}
|
||||||
|
{{if $credit_line.amount == $solde}}
|
||||||
|
{{:assign var="exit_lines." value=$credit_line}}
|
||||||
|
{{/if}}
|
||||||
|
{{/select}}
|
||||||
|
|
||||||
|
{{* 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"
|
||||||
|
}}
|
||||||
|
|
||||||
|
{{* chercher des écritures d'amortissement correspondant au compte d'une immo sans doc associé *}}
|
||||||
|
{{* TODO écritures d'amort pas entièrement affectées *}}
|
||||||
|
{{#select
|
||||||
|
line.id as amort_line_id,
|
||||||
|
line.credit as amort_amount,
|
||||||
|
line.label as line_label,
|
||||||
|
trans.id as amort_trans_id,
|
||||||
trans.date as date,
|
trans.date as date,
|
||||||
trans.label as trans_label,
|
trans.label as trans_label,
|
||||||
trans.id_year as year,
|
trans.id_year as year,
|
||||||
|
|
@ -51,62 +131,45 @@
|
||||||
FROM acc_transactions_lines AS line
|
FROM acc_transactions_lines AS line
|
||||||
INNER JOIN acc_accounts AS account ON line.id_account = account.id
|
INNER JOIN acc_accounts AS account ON line.id_account = account.id
|
||||||
INNER JOIN acc_transactions AS trans ON line.id_transaction = trans.id
|
INNER JOIN acc_transactions AS trans ON line.id_transaction = trans.id
|
||||||
WHERE account.code LIKE :code_cession_new OR account.code LIKE :code_cession_old
|
WHERE
|
||||||
|
account.code = :code_amort
|
||||||
|
AND line.credit > 0
|
||||||
|
AND (NOT trans.status & 16)
|
||||||
|
AND trans.date >= :immo_date
|
||||||
;
|
;
|
||||||
:code_cession_new = "757%"
|
:code_amort = $code_amort
|
||||||
:code_cession_old = "775%"
|
:immo_date=$date_immo
|
||||||
assign="line"
|
assign="amort_line"
|
||||||
}}
|
}}
|
||||||
{{* voir si l'écriture de cession est déjà liée à une immo *}}
|
{{* voir s'il existe des lignes d'immo liées à cette ligne d'amortissement *}}
|
||||||
{{* TODO VOIR SI UTILE
|
{{:assign amort_amount=0}}
|
||||||
{{#load type="cession_link"
|
{{:assign keep_amort=true}}
|
||||||
where="$$.cession_line_id = :cession_line_id"
|
{{#load type="amort_link"
|
||||||
:cession_line_id = $line.line_id
|
where="$$.amort_line_id = :amort_line_id"
|
||||||
assign="cession_link"
|
:amort_line_id=$amort_line.amort_line_id|intval
|
||||||
|
assign="amort_link"
|
||||||
}}
|
}}
|
||||||
{{:debug line=$line cession_link=$cession_link}}
|
{{if $amort_link.amount == null || $amort_link.amount == 0}}
|
||||||
{{:assign total_cession="%d+%d"|math:$total_cession:$line.amount}}
|
{{:assign amort_amount=$amort_line.amort_amount}}
|
||||||
{{:assign var="line.linked_id" value=$linked_id}}
|
{{:assign keep_amort=false}}
|
||||||
{{:assign var="linked_cessions." value=$line}}
|
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign var="free_cessions." value=$line}}
|
{{:assign amort_amount="%d+%d"|math:$amort_amount:$amort_link.amount}}
|
||||||
{{/load}}
|
|
||||||
*}}
|
|
||||||
|
|
||||||
{{#select
|
|
||||||
CASE WHEN links.id_related = :trans_id
|
|
||||||
THEN links.id_transaction
|
|
||||||
ELSE links.id_related
|
|
||||||
END as linked_id
|
|
||||||
FROM acc_transactions_links as links
|
|
||||||
WHERE links.id_transaction = :trans_id OR links.id_related = :trans_id
|
|
||||||
;
|
|
||||||
:trans_id = $line.trans_id
|
|
||||||
}}
|
|
||||||
{{if $linked_id == $ligne_immo.trans_id}}
|
|
||||||
{{:assign total_cession="%d+%d"|math:$total_cession:$line.amount}}
|
|
||||||
{{:assign var="line.linked_id" value=$linked_id}}
|
|
||||||
{{:assign var="linked_cessions." value=$line}}
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign var="free_cessions." value=$line}}
|
{{* pas de ligne d'immo liée à cette ligne d'amort => garder cette ligne d'amortissement *}}
|
||||||
{{/select}}
|
{{/load}}
|
||||||
|
{{if $keep_amort && $amort_amount < $amort_line.amort_amount}}
|
||||||
|
{{:assign var="free_amort_lines." value=$amort_line}}
|
||||||
|
{{/if}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
{{*:debug linked_cessions=$linked_cessions free_cessions=$free_cessions total_cession=$total_cession*}}
|
|
||||||
|
|
||||||
{{:admin_header title="Immobilisation sortie du bilan" custom_css="./style.css" current="module_amortization"}}
|
{{:admin_header title="Immobilisation sortie du bilan" custom_css="./style.css" current="module_amortization"}}
|
||||||
{{if $_GET.from == "exit"}}
|
|
||||||
{{:assign current="other"}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign current="archived"}}
|
|
||||||
{{/if}}
|
|
||||||
{{:include file="_nav.html" current=$current subcurrent="exit"}}
|
|
||||||
|
|
||||||
{{if $_GET.ok}}
|
{{if $_GET.ok}}
|
||||||
{{if $_GET.msg|match:"attach_cession"}}
|
{{if $_GET.msg|match:"attach_exit"}}
|
||||||
{{:assign msg="Écriture de cession attachée"}}
|
{{:assign msg="Écriture de sortie de bilan attachée"}}
|
||||||
{{elseif $_GET.msg|match:"detach_cession"}}
|
{{elseif $_GET.msg|match:"detach_exit"}}
|
||||||
{{:assign msg="Écriture de cession détachée"}}
|
{{:assign msg="Écriture de sortie de bilan détachée"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<p class="block confirm">{{$msg}}</p>
|
<p class="block confirm">{{$msg}}</p>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
@ -131,15 +194,11 @@
|
||||||
<dt>Valeur nette résiduelle</dt>
|
<dt>Valeur nette résiduelle</dt>
|
||||||
<dd>{{"%d-%d"|math:$solde:$total_amort|money_currency_html:false|raw}}</dd>
|
<dd>{{"%d-%d"|math:$solde:$total_amort|money_currency_html:false|raw}}</dd>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{if $total_cession > 0}}
|
|
||||||
<dt>Montant de la cession</dt>
|
|
||||||
<dd>{{$total_cession|money_currency_html:false|raw}}</dd>
|
|
||||||
{{/if}}
|
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{if $linked_cessions != null}}
|
{{if $exit_line != null}}
|
||||||
<h3 class="ruler">Écriture de cession attachée à l'immobilisation</h3>
|
<h3 class="ruler">Écriture de sortie du bilan attachée à l'immobilisation</h3>
|
||||||
<table class="list">
|
<table class="list">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
@ -153,46 +212,33 @@
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{{#foreach from=$linked_cessions item="line"}}
|
|
||||||
{{* données de l'écriture *}}
|
|
||||||
{{: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>
|
<tr>
|
||||||
<td class="num"><a href="{{$trans_url}}">#{{$line.trans_id}}</a></td>
|
<td class="num"><a href="{{$trans_url}}">#{{$exit_line.trans_id}}</a></td>
|
||||||
<td>{{$line.date|date_short}}</td>
|
<td>{{$exit_line.date|date_short}}</td>
|
||||||
<td>
|
<td>
|
||||||
{{if $line.line_label != null}}
|
{{if $exit_line.line_label != null}}
|
||||||
{{$line.line_label}}
|
{{$exit_line.line_label}}
|
||||||
{{if $line.trans_label != $line.line_label}}
|
|
||||||
— {{$line.trans_label}}
|
|
||||||
{{/if}}
|
|
||||||
{{else}}
|
{{else}}
|
||||||
{{$line.trans_label}}
|
{{$exit_line.trans_label}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</td>
|
</td>
|
||||||
<td class="money">{{"%f"|math:$line.amount|money_html:false|raw}}</td>
|
<td class="money">{{"%f"|math:$exit_line.amount|money_html:false|raw}}</td>
|
||||||
<td><a href="{{$compte_url}}">{{$line.account_code}}</a></td>
|
<td><a href="{{$compte_url}}">{{$exit_line.account_code}}</a></td>
|
||||||
<td>{{$line.account_label}}</td>
|
<td>{{$exit_line.account_label}}</td>
|
||||||
<td>
|
<td>
|
||||||
{{:linkbutton label="Détacher" href="detach_cession.html?immo_doc_id=%s&cession_line_id=%s&from=exit"|args:$_GET.immo_doc_id:$line.line_id shape="minus"}}
|
{{:linkbutton label="Détacher" href="detach_exit.html?immo_doc_id=%s&exit_line_id=%s&from=exit"|args:$_GET.immo_doc_id:$exit_line.line_id shape="minus"}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/foreach}}
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
{{elseif $free_cessions}}
|
{{elseif $exit_lines}}
|
||||||
<p class="block alert">
|
<p class="block alert">
|
||||||
Vous pouvez attacher une écriture de cession à l'immobilisation
|
Vous pouvez attacher une écriture de sortie du bilan à l'immobilisation
|
||||||
</p>
|
|
||||||
{{else}}
|
|
||||||
<p class="block alert">
|
|
||||||
Aucune écriture de cession... que faire ?
|
|
||||||
</p>
|
</p>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
{{if $exit_lines}}
|
||||||
{{if $free_cessions}}
|
<h3 class="ruler">Écritures non rattachées</h3>
|
||||||
<h3 class="ruler">Autres écritures de cession</h3>
|
|
||||||
<table class="list">
|
<table class="list">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
@ -207,37 +253,36 @@
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
||||||
{{#foreach from=$free_cessions item="line"}}
|
{{#foreach from=$exit_lines item="line"}}
|
||||||
{{:assign cession_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.trans_id}}
|
{{:assign exit_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}}
|
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$line.account_id:$line.year}}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="num"><a href="{{$cession_url}}">#{{$line.trans_id}}</a></td>
|
<td class="num"><a href="{{$exit_url}}">#{{$line.trans_id}}</a></td>
|
||||||
<td>{{$line.date|date_short}}</td>
|
<td>{{$line.date|date_short}}</td>
|
||||||
<td>
|
<td>{{$line.trans_label}}
|
||||||
{{if $line.line_label != null}}
|
{{if $line.line_label != null && $line.line_label != $line.trans_label}} — {{$line.line_label}}{{/if}}
|
||||||
{{$line.line_label}}
|
|
||||||
{{if $line.trans_label != $line.line_label}}
|
|
||||||
— {{$line.trans_label}}
|
|
||||||
{{/if}}
|
|
||||||
{{else}}
|
|
||||||
{{$line.trans_label}}
|
|
||||||
{{/if}}
|
|
||||||
</td>
|
</td>
|
||||||
<td class="money">{{"%f"|math:$line.amount|money_html:false|raw}}</td>
|
<td class="money">{{"%f"|math:$line.amount|money_html:false|raw}}</td>
|
||||||
<td><a href="{{$compte_url}}">{{$line.account_code}}</a></td>
|
<td><a href="{{$compte_url}}">{{$line.account_code}}</a></td>
|
||||||
<td>{{$line.account_label}}</td>
|
<td>{{$line.account_label}}</td>
|
||||||
<td>
|
<td>
|
||||||
{{:linkbutton label="Attacher" href="attach_cession.html?immo_doc_id=%s&cession_line_id=%s&from=exit"|args:$_GET.immo_doc_id:$line.line_id shape="plus"}}
|
{{:linkbutton label="Attacher" href="attach_exit.html?immo_doc_id=%s&exit_line_id=%s&from=exit"|args:$_GET.immo_doc_id:$line.credit_line_id shape="plus"}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
{{elseif $exit_line == null}}
|
||||||
|
<p class="block alert">Aucune écriture de sortie du bilan. Vérifiez l'attachement d'écriture d'avoir.</p>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
<form method="post" action="">
|
<form method="post" action="">
|
||||||
<p class="submit">
|
<p class="submit">
|
||||||
{{:button type="submit" name="backward" label="Revenir à l'étape précédente" shape="left" class="main"}}
|
{{:button type="submit" name="backward" label="Revenir à l'étape précédente" shape="left" class="main"}}
|
||||||
{{:button type="submit" name="forward" label="Poursuivre" shape="right" class="main"}}
|
{{if $exit_line}}
|
||||||
|
{{:button type="submit" name="validate" label="Terminer" shape="check" class="main"}}
|
||||||
|
{{else}}
|
||||||
|
{{:button type="submit" name="finish" label="Terminer" shape="export" class="main"}}
|
||||||
|
{{/if}}
|
||||||
</p>
|
</p>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
||||||
316
exit_step4.html
316
exit_step4.html
|
|
@ -1,316 +0,0 @@
|
||||||
{{* -*- brindille -*- *}}
|
|
||||||
|
|
||||||
{{*
|
|
||||||
Associer les différentes écritures à une immo créée et sortie du
|
|
||||||
bilan avant la mise en service du module
|
|
||||||
@param immo_doc_id : id du doc associé à l'immobilisation
|
|
||||||
*}}
|
|
||||||
|
|
||||||
{{* données de l'immobilisation *}}
|
|
||||||
{{:include file="_get_immo_data.html" immo_doc_id=$_GET.immo_doc_id keep="info_immo, ligne_immo, message"}}
|
|
||||||
{{if $message != null}}
|
|
||||||
{{:error message=$message}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{#form on="backward"}}
|
|
||||||
{{:redirect to="exit_step3.html?immo_doc_id=%s&from=%s"|args:$_GET.immo_doc_id:$_GET.from}}
|
|
||||||
{{/form}}
|
|
||||||
|
|
||||||
{{#form on="validate"}}
|
|
||||||
{{* mettre à jour l'état de l'immobilisation *}}
|
|
||||||
{{:save
|
|
||||||
key=$info_immo.key
|
|
||||||
status="archived"
|
|
||||||
}}
|
|
||||||
{{:redirect to="index.html?type_immo=archived"}}
|
|
||||||
{{/form}}
|
|
||||||
|
|
||||||
{{#form on="finish"}}
|
|
||||||
{{:redirect to="index.html?type_immo=managed"}}
|
|
||||||
{{/form}}
|
|
||||||
|
|
||||||
{{:assign label_immo=$info_immo.label|or:$ligne_immo.trans_label}}
|
|
||||||
{{if $ligne_immo.line_label != null && $ligne_immo.line_label != $label_immo}}
|
|
||||||
{{:assign label_immo=$label_immo|cat:" — "|cat:$ligne_immo.line_label}}
|
|
||||||
{{/if}}
|
|
||||||
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$ligne_immo.trans_id}}
|
|
||||||
{{:assign date_immo=$info_immo.date_mes|or:$info_immo.date_achat|or:$ligne_immo.date_achat}}
|
|
||||||
{{:assign montant_immo=$info_immo.amount|or:$ligne_immo.amount}}
|
|
||||||
|
|
||||||
{{* déduire le montant des écritures liées à l'immo courante au crédit du même compte *}}
|
|
||||||
{{:include file="_get_credit_lines.html" immo_doc_id=$_GET.immo_doc_id keep="linked_immos, total_credits"}}
|
|
||||||
{{:assign solde="%d-%d"|math:$montant_immo:$total_credits}}
|
|
||||||
|
|
||||||
{{* 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"}}
|
|
||||||
|
|
||||||
{{* chercher une écriture de cession associée *}}
|
|
||||||
{{#load type="cession_link"
|
|
||||||
where="$$.immo_doc_id = :immo_doc_id"
|
|
||||||
:immo_doc_id = $_GET.immo_doc_id|intval
|
|
||||||
}}
|
|
||||||
{{if $amount == null || $amount == 0}}
|
|
||||||
{{#select credit
|
|
||||||
FROM acc_transactions_lines
|
|
||||||
WHERE id = :cession_line_id;
|
|
||||||
:cession_line_id = $cession_line_id
|
|
||||||
}}
|
|
||||||
{{:assign montant_cession=$credit}}
|
|
||||||
{{/select}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign montant_cession=$amount}}
|
|
||||||
{{/if}}
|
|
||||||
{{/load}}
|
|
||||||
|
|
||||||
{{* chercher une écriture de sortie de bilan associée *}}
|
|
||||||
{{#load type="exit_link" where="$$.immo_doc_id = :immo_doc_id" :immo_doc_id=$info_immo.id assign="exit_info"}}
|
|
||||||
{{/load}}
|
|
||||||
{{if $exit_info != null}}
|
|
||||||
{{#select
|
|
||||||
trans.id as trans_id,
|
|
||||||
trans.label as trans_label,
|
|
||||||
trans.date as date,
|
|
||||||
line.id as line_id,
|
|
||||||
line.label as line_label,
|
|
||||||
line.credit as amount,
|
|
||||||
acc.id as account_id,
|
|
||||||
acc.code as account_code,
|
|
||||||
acc.label as account_label
|
|
||||||
FROM acc_transactions AS trans
|
|
||||||
INNER JOIN acc_transactions_lines AS line ON line.id_transaction = trans.id
|
|
||||||
INNER JOIN acc_accounts AS acc ON line.id_account = acc.id
|
|
||||||
WHERE line.id = :exit_line_id;
|
|
||||||
:exit_line_id = $exit_info.exit_line_id
|
|
||||||
assign="exit_line"
|
|
||||||
}}
|
|
||||||
{{/select}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{*
|
|
||||||
chercher des écritures au crédit du compte de l'immo sans doc associé
|
|
||||||
- line.credit < ligne_immo.amount => peut-être un avoir
|
|
||||||
- line.credit = ligne_immo.amount - avoirs => écriture de sortie du bilan
|
|
||||||
*}}
|
|
||||||
{{#select
|
|
||||||
trans.id as trans_id,
|
|
||||||
trans.label as trans_label,
|
|
||||||
trans.date as date,
|
|
||||||
trans.id_year as year,
|
|
||||||
line.id as credit_line_id,
|
|
||||||
line.label as line_label,
|
|
||||||
line.credit as amount,
|
|
||||||
acc.id as account_id,
|
|
||||||
acc.code as account_code,
|
|
||||||
acc.label as account_label
|
|
||||||
FROM acc_transactions AS trans
|
|
||||||
INNER JOIN acc_transactions_lines AS line ON line.id_transaction = trans.id
|
|
||||||
INNER JOIN acc_accounts AS acc ON line.id_account = acc.id
|
|
||||||
LEFT JOIN module_data_amortization AS mda ON json_extract(mda.document, '$.amort_line_id') = line.id
|
|
||||||
WHERE
|
|
||||||
acc.code = :acc_code
|
|
||||||
AND line.credit > 0
|
|
||||||
AND credit_line_id NOT IN (
|
|
||||||
SELECT json_extract(credit_link.document, '$.credit_line_id') AS line_id FROM !table as credit_link
|
|
||||||
WHERE json_extract(credit_link.document, '$.type') == "credit_link"
|
|
||||||
UNION
|
|
||||||
SELECT json_extract(exit_link.document, '$.exit_line_id') AS line_id FROM !table as exit_link
|
|
||||||
WHERE json_extract(exit_link.document, '$.type') == "exit_link"
|
|
||||||
)
|
|
||||||
;
|
|
||||||
:acc_code=$ligne_immo.account_code
|
|
||||||
!table =$module.table
|
|
||||||
assign="credit_line"
|
|
||||||
}}
|
|
||||||
{{if $credit_line.amount == $solde}}
|
|
||||||
{{:assign var="exit_lines." value=$credit_line}}
|
|
||||||
{{/if}}
|
|
||||||
{{/select}}
|
|
||||||
|
|
||||||
{{* 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"
|
|
||||||
}}
|
|
||||||
|
|
||||||
{{* chercher des écritures d'amortissement correspondant au compte d'une immo sans doc associé *}}
|
|
||||||
{{* TODO écritures d'amort pas entièrement affectées *}}
|
|
||||||
{{#select
|
|
||||||
line.id as amort_line_id,
|
|
||||||
line.credit as amort_amount,
|
|
||||||
line.label as line_label,
|
|
||||||
trans.id as amort_trans_id,
|
|
||||||
trans.date as date,
|
|
||||||
trans.label as trans_label,
|
|
||||||
trans.id_year as 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 line.id_account = account.id
|
|
||||||
INNER JOIN acc_transactions AS trans ON line.id_transaction = trans.id
|
|
||||||
WHERE
|
|
||||||
account.code = :code_amort
|
|
||||||
AND line.credit > 0
|
|
||||||
AND (NOT trans.status & 16)
|
|
||||||
AND trans.date >= :immo_date
|
|
||||||
;
|
|
||||||
:code_amort = $code_amort
|
|
||||||
:immo_date=$date_immo
|
|
||||||
assign="amort_line"
|
|
||||||
}}
|
|
||||||
{{* 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.amort_line_id|intval
|
|
||||||
assign="amort_link"
|
|
||||||
}}
|
|
||||||
{{if $amort_link.amount == null || $amort_link.amount == 0}}
|
|
||||||
{{:assign amort_amount=$amort_line.amort_amount}}
|
|
||||||
{{:assign keep_amort=false}}
|
|
||||||
{{else}}
|
|
||||||
{{: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_line.amort_amount}}
|
|
||||||
{{:assign var="free_amort_lines." value=$amort_line}}
|
|
||||||
{{/if}}
|
|
||||||
{{/select}}
|
|
||||||
|
|
||||||
{{:admin_header title="Immobilisation sortie du bilan" custom_css="./style.css" current="module_amortization"}}
|
|
||||||
{{if $_GET.from == "exit"}}
|
|
||||||
{{:assign current="other"}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign current="archived"}}
|
|
||||||
{{/if}}
|
|
||||||
{{:include file="_nav.html" current=$current subcurrent="exit"}}
|
|
||||||
|
|
||||||
{{if $_GET.ok}}
|
|
||||||
{{if $_GET.msg|match:"attach_exit"}}
|
|
||||||
{{:assign msg="Écriture de sortie de bilan attachée"}}
|
|
||||||
{{elseif $_GET.msg|match:"detach_exit"}}
|
|
||||||
{{:assign msg="Écriture de sortie de bilan détachée"}}
|
|
||||||
{{/if}}
|
|
||||||
<p class="block confirm">{{$msg}}</p>
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
<div class="informations">
|
|
||||||
<dl class="describe">
|
|
||||||
<dt>Immobilisation</dt>
|
|
||||||
<dd><span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.trans_id}}</a></span> {{$label_immo}}</dd>
|
|
||||||
<dt>Compte d'immobilisation</dt>
|
|
||||||
<dd>{{$ligne_immo.account_code}} — {{$ligne_immo.account_label}}</dd>
|
|
||||||
<dt>Montant de l'immobilisation</dt>
|
|
||||||
<dd><span class="money">{{$ligne_immo.amount|money_html|raw}}</dd>
|
|
||||||
{{if $total_credits > 0}}
|
|
||||||
<dt>Montant des avoirs</dt>
|
|
||||||
<dd class="money">{{"%f"|math:$total_credits|money_currency_html:false|raw}}</dd>
|
|
||||||
<dt>Montant à amortir</dt>
|
|
||||||
<dd class="money">{{"%f"|math:$solde|money_currency_html:false|raw}}</dd>
|
|
||||||
{{/if}}
|
|
||||||
{{if $total_amort > 0}}
|
|
||||||
<dt>Montant des amortissements</dt>
|
|
||||||
<dd>{{$total_amort|money_currency_html:false|raw}}</dd>
|
|
||||||
<dt>Valeur nette résiduelle</dt>
|
|
||||||
<dd>{{"%d-%d"|math:$solde:$total_amort|money_currency_html:false|raw}}</dd>
|
|
||||||
{{/if}}
|
|
||||||
{{if $montant_cession > 0}}
|
|
||||||
<dt>Montant de la cession</dt>
|
|
||||||
<dd>{{$montant_cession|money_currency_html:false|raw}}</dd>
|
|
||||||
{{/if}}
|
|
||||||
</dl>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{if $exit_line != null}}
|
|
||||||
<h3 class="ruler">Écriture de sortie du bilan attachée à l'immobilisation</h3>
|
|
||||||
<table class="list">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<td class="num">N°</td>
|
|
||||||
<td>Date</td>
|
|
||||||
<td>Libellé</td>
|
|
||||||
<td class="nombre">Montant</td>
|
|
||||||
<td>N° compte</td>
|
|
||||||
<td>Compte</td>
|
|
||||||
<td class="actions"></td>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td class="num"><a href="{{$trans_url}}">#{{$exit_line.trans_id}}</a></td>
|
|
||||||
<td>{{$exit_line.date|date_short}}</td>
|
|
||||||
<td>
|
|
||||||
{{if $exit_line.line_label != null}}
|
|
||||||
{{$exit_line.line_label}}
|
|
||||||
{{else}}
|
|
||||||
{{$exit_line.trans_label}}
|
|
||||||
{{/if}}
|
|
||||||
</td>
|
|
||||||
<td class="money">{{"%f"|math:$exit_line.amount|money_html:false|raw}}</td>
|
|
||||||
<td><a href="{{$compte_url}}">{{$exit_line.account_code}}</a></td>
|
|
||||||
<td>{{$exit_line.account_label}}</td>
|
|
||||||
<td>
|
|
||||||
{{:linkbutton label="Détacher" href="detach_exit.html?immo_doc_id=%s&exit_line_id=%s&from=exit"|args:$_GET.immo_doc_id:$exit_line.line_id shape="minus"}}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
{{elseif $exit_lines}}
|
|
||||||
<p class="block alert">
|
|
||||||
Vous pouvez attacher une écriture de sortie du bilan à l'immobilisation
|
|
||||||
</p>
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{if $exit_lines}}
|
|
||||||
<h3 class="ruler">Écritures non rattachées</h3>
|
|
||||||
<table class="list">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<td class="num">N°</td>
|
|
||||||
<td>Date</td>
|
|
||||||
<td>Libellé</td>
|
|
||||||
<td class="nombre">Montant</td>
|
|
||||||
<td>N° compte</td>
|
|
||||||
<td>Compte</td>
|
|
||||||
<td class="actions"></td>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
|
|
||||||
{{#foreach from=$exit_lines item="line"}}
|
|
||||||
{{:assign exit_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>
|
|
||||||
<td class="num"><a href="{{$exit_url}}">#{{$line.trans_id}}</a></td>
|
|
||||||
<td>{{$line.date|date_short}}</td>
|
|
||||||
<td>{{$line.trans_label}}
|
|
||||||
{{if $line.line_label != null && $line.line_label != $line.trans_label}} — {{$line.line_label}}{{/if}}
|
|
||||||
</td>
|
|
||||||
<td class="money">{{"%f"|math:$line.amount|money_html:false|raw}}</td>
|
|
||||||
<td><a href="{{$compte_url}}">{{$line.account_code}}</a></td>
|
|
||||||
<td>{{$line.account_label}}</td>
|
|
||||||
<td>
|
|
||||||
{{:linkbutton label="Attacher" href="attach_exit.html?immo_doc_id=%s&exit_line_id=%s&from=exit"|args:$_GET.immo_doc_id:$line.credit_line_id shape="plus"}}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{{/foreach}}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
{{elseif $exit_line == null}}
|
|
||||||
<p class="block alert">Aucune écriture de sortie du bilan. Vérifiez l'attachement d'écriture d'avoir.</p>
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
<form method="post" action="">
|
|
||||||
<p class="submit">
|
|
||||||
{{:button type="submit" name="backward" label="Revenir à l'étape précédente" shape="left" class="main"}}
|
|
||||||
{{if $exit_line}}
|
|
||||||
{{:button type="submit" name="validate" label="Terminer" shape="check" class="main"}}
|
|
||||||
{{else}}
|
|
||||||
{{:button type="submit" name="finish" label="Terminer" shape="export" class="main"}}
|
|
||||||
{{/if}}
|
|
||||||
</p>
|
|
||||||
</form>
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
{{:assign status="ignored"}}
|
{{:assign status="ignored"}}
|
||||||
{{:save
|
{{:save
|
||||||
key=""|uuid
|
key=""|uuid
|
||||||
validate_schema="asset.schema.json"
|
validate_schema="schema.json"
|
||||||
type="immo"
|
type="immo"
|
||||||
line=$_GET.immo_line_id|intval
|
line=$_GET.immo_line_id|intval
|
||||||
duration=$duration
|
duration=$duration
|
||||||
|
|
|
||||||
19
index.html
19
index.html
|
|
@ -19,7 +19,7 @@
|
||||||
{{:admin_header title="Immobilisations en cours de constitution" custom_css="./style.css" current="module_amortization" subcurrent="unfinished"}}
|
{{:admin_header title="Immobilisations en cours de constitution" custom_css="./style.css" current="module_amortization" subcurrent="unfinished"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{:include file="_nav.html" current=$type_immo}}
|
{{:include file="_nav.html" current="index" subcurrent="%s"|args:$type_immo}}
|
||||||
|
|
||||||
{{if $_GET.ok}}
|
{{if $_GET.ok}}
|
||||||
{{if $_GET.msg|match:"immobilisation"}}
|
{{if $_GET.msg|match:"immobilisation"}}
|
||||||
|
|
@ -34,8 +34,21 @@
|
||||||
<p class="block error">Échec enregistrement immobilisation</p>
|
<p class="block error">Échec enregistrement immobilisation</p>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{* supprimer les documents sans écriture associée *}}
|
{{#load type="immo"}}
|
||||||
{{:include file="_remove_orphan_docs.tpl"}}
|
{{* supprimer les documents sans écriture associée *}}
|
||||||
|
{{#select
|
||||||
|
line.id as line_id
|
||||||
|
FROM acc_transactions_lines as line
|
||||||
|
WHERE line.id = :line_id;
|
||||||
|
:line_id = $line
|
||||||
|
}}
|
||||||
|
{{else}}
|
||||||
|
{{:delete key=$key}}
|
||||||
|
{{/select}}
|
||||||
|
{{/load}}
|
||||||
|
|
||||||
|
{{* chercher des immos antérieures à la date de début du 1er exercice *}}
|
||||||
|
{{*:include file="_old_assets.html"*}}
|
||||||
|
|
||||||
{{if $type_immo == "other"}}
|
{{if $type_immo == "other"}}
|
||||||
{{:include file="_immobilisations_autres.html"}}
|
{{:include file="_immobilisations_autres.html"}}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
{
|
{
|
||||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
"description": "Schéma des liens entre écritures",
|
"description": "Schéma des liens entre documents",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"type": {
|
"type": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["amort_link", "credit_link", "cession_link", "exit_link"]
|
"enum": ["amort_link", "credit_link", "exit_link"]
|
||||||
},
|
},
|
||||||
"immo_doc_id" : {
|
"immo_doc_id" : {
|
||||||
"description": "identifiant du document d'immobilisation associé",
|
"description": "identifiant du document d'immobilisation associé",
|
||||||
|
|
@ -23,22 +23,13 @@
|
||||||
"exclusiveMinimum": 0
|
"exclusiveMinimum": 0
|
||||||
},
|
},
|
||||||
"exit_line_id": {
|
"exit_line_id": {
|
||||||
"description": "ligne de sortie du bilan de l'immobilisation",
|
"description": "ligne d'amortissement de sortie du bilan de l'immobilisation",
|
||||||
"type": "integer",
|
|
||||||
"exclusiveMinimum": 0
|
|
||||||
},
|
|
||||||
"cession_line_id": {
|
|
||||||
"description": "ligne de cession de l'immobilisation",
|
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"exclusiveMinimum": 0
|
"exclusiveMinimum": 0
|
||||||
},
|
},
|
||||||
"amount": {
|
"amount": {
|
||||||
"description": "montant de la ligne d'amortissement ou de crédit",
|
"description": "montant de la ligne d'amortissement ou de crédit",
|
||||||
"type": ["number", "null"]
|
"type": ["number", "null"]
|
||||||
},
|
|
||||||
"created" : {
|
|
||||||
"description" : "vrai si amortissement créé dans le module",
|
|
||||||
"type" : ["boolean", "null"]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": ["type", "immo_doc_id"],
|
"required": ["type", "immo_doc_id"],
|
||||||
|
|
@ -48,9 +39,6 @@
|
||||||
"if": {"properties": {"type": {"const": "credit_link"}}, "required": ["type"]},
|
"if": {"properties": {"type": {"const": "credit_link"}}, "required": ["type"]},
|
||||||
"then": {"required": ["credit_line_id"]},
|
"then": {"required": ["credit_line_id"]},
|
||||||
"else":
|
"else":
|
||||||
"if": {"properties": {"type": {"const": "cession_link"}}, "required": ["type"]},
|
|
||||||
"then": {"required": ["cession_line_id"]},
|
|
||||||
"else":
|
|
||||||
"if": {"properties": {"type": {"const": "exit_link"}}, "required": ["type"]},
|
"if": {"properties": {"type": {"const": "exit_link"}}, "required": ["type"]},
|
||||||
"then": {"required": ["exit_line_id"]},
|
"then": {"required": ["exit_line_id"]},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,19 +10,10 @@
|
||||||
{{if $message != null}}
|
{{if $message != null}}
|
||||||
{{:error message=$message}}
|
{{:error message=$message}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:assign label_immo=$ligne_immo.trans_label}}
|
|
||||||
{{if $ligne_immo.line_label != null && $ligne_immo.line_label != $label_immo}}
|
|
||||||
{{:assign label_immo=$label_immo|cat:" — "|cat:$ligne_immo.line_label}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{*
|
{{*
|
||||||
lister les écritures au crédit du compte de l'immobilisation
|
lister les écritures au crédit du compte de l'immobilisation
|
||||||
*}}
|
*}}
|
||||||
{{if $_GET.filter}}
|
|
||||||
{{:assign account_code=$ligne_immo.account_code|cat:"%"}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign account_code=$ligne_immo.account_code|substr:0:2|cat:"%"}}
|
|
||||||
{{/if}}
|
|
||||||
{{#select
|
{{#select
|
||||||
line.id as credit_line_id,
|
line.id as credit_line_id,
|
||||||
line.id_transaction as credit_trans_id,
|
line.id_transaction as credit_trans_id,
|
||||||
|
|
@ -39,15 +30,12 @@
|
||||||
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_accounts AS account ON account.id = line.id_account
|
INNER JOIN acc_accounts AS account ON account.id = line.id_account
|
||||||
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 :account_code AND credit > 0
|
WHERE account.code = :account_code AND credit > 0
|
||||||
AND credit_line_id NOT IN (
|
AND credit_line_id NOT IN (
|
||||||
SELECT json_extract(link.document, '$.credit_line_id') AS credit_line_id FROM !table as link
|
SELECT json_extract(link.document, '$.credit_line_id') AS credit_line_id FROM !table as link
|
||||||
WHERE json_extract(link.document, '$.type') == "credit_link"
|
WHERE json_extract(link.document, '$.type') == "credit_link")
|
||||||
UNION
|
|
||||||
SELECT json_extract(exit_link.document, '$.exit_line_id') AS line_id FROM !table as exit_link
|
|
||||||
WHERE json_extract(exit_link.document, '$.type') == "exit_link")
|
|
||||||
ORDER BY trans.date, trans.label;
|
ORDER BY trans.date, trans.label;
|
||||||
:account_code = $account_code
|
:account_code = $ligne_immo.account_code
|
||||||
!table =$module.table
|
!table =$module.table
|
||||||
assign="other_immos."
|
assign="other_immos."
|
||||||
}}
|
}}
|
||||||
|
|
@ -59,38 +47,30 @@
|
||||||
{{if ! $dialog}}
|
{{if ! $dialog}}
|
||||||
{{:include
|
{{:include
|
||||||
file="_nav.html"
|
file="_nav.html"
|
||||||
current="managed"
|
current="config"
|
||||||
subcurrent="link_immo"
|
subcurrent="other"
|
||||||
|
subsubcurrent="immo"
|
||||||
type_immo="other"
|
type_immo="other"
|
||||||
}}
|
}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
<nav class="tabs">
|
|
||||||
<ul>
|
|
||||||
<li {{if $_GET.filter}}class="current"{{/if}}>
|
|
||||||
<a href="link_immo.html?immo_doc_id={{$_GET.immo_doc_id}}{{if $dialog}}&_dialog{{/if}}&filter=true">
|
|
||||||
Compte {{$ligne_immo.account_code}} et sous-comptes
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li {{if ! $_GET.filter}}class="current"{{/if}}>
|
|
||||||
<a href="link_immo.html?immo_doc_id={{$_GET.immo_doc_id}}{{if $dialog}}&_dialog{{/if}}">
|
|
||||||
Compte {{$ligne_immo.account_code|substr:0:2}} et sous-comptes
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<section class="immobilisation">
|
<section class="immobilisation">
|
||||||
|
<fieldset>
|
||||||
|
<legend>
|
||||||
|
Écritures au crédit du compte d'immobilisation « {{$ligne_immo.account_code}} »
|
||||||
|
</legend>
|
||||||
|
|
||||||
<div class="informations">
|
<div class="informations">
|
||||||
<dl class="describe">
|
<dl class="describe">
|
||||||
<dt>Immobilisation</dt>
|
<dt>Immobilisation</dt>
|
||||||
<dd><span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.trans_id}}</a></span> {{$label_immo}}</dd>
|
<dd><span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.trans_id}}</a></span> {{$label_immo}}</dd>
|
||||||
<dt>Montant</dt>
|
<dt>Montant</dt>
|
||||||
<dd class="money strong">{{"%f"|math:$ligne_immo.amount|money_currency_html:false|raw}}</dd>
|
<dd class="money strong">{{"%f"|math:$ligne_immo.amount|money_currency_html:false|raw}}</dd>
|
||||||
<dt>Date de l'immobilisation</dt>
|
<dt>Date de l'écriture d'immobilisation</dt>
|
||||||
<dd>{{$ligne_immo.date_achat|date_short}}</dd>
|
<dd>{{$ligne_immo.date_achat|date_short}}</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
{{if $other_immos != null}}
|
{{if $other_immos != null}}
|
||||||
<table class="list">
|
<table class="list">
|
||||||
|
|
@ -124,8 +104,8 @@
|
||||||
</tr>
|
</tr>
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
</tbody>
|
</tbody>
|
||||||
<p class="help">Sélectionner une écriture d'avoir ou autre réduction du montant de l'acquisition pour l'associer à l'immobilisation</p>
|
|
||||||
</table>
|
</table>
|
||||||
|
<p class="help">Sélectionner une écriture d'avoir ou autre réduction du montant de l'acquisition pour l'associer à l'immobilisation</p>
|
||||||
{{else}}
|
{{else}}
|
||||||
<p class="block alert">Aucune écriture au crédit du compte « {{$ligne_immo.account_code}} »</p>
|
<p class="block alert">Aucune écriture au crédit du compte « {{$ligne_immo.account_code}} »</p>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,13 @@
|
||||||
|
|
||||||
{{*
|
{{*
|
||||||
@param immo_doc_id
|
@param immo_doc_id
|
||||||
|
|
||||||
|
TODO ? :
|
||||||
|
- séparer les cas des immo simples et complexes (BOI)
|
||||||
|
par exemple pour la durée d'amort par défaut {{:input ...}}
|
||||||
|
- prise en charge immo => param = immo_line_id
|
||||||
|
- modif param immo => param = immo_doc_id
|
||||||
|
- DONE possibilité supprimer liaison écriture avoir
|
||||||
*}}
|
*}}
|
||||||
|
|
||||||
{{:include file="_get_immo_data.html" immo_doc_id=$_GET.immo_doc_id|intval keep="info_immo, ligne_immo, message"}}
|
{{:include file="_get_immo_data.html" immo_doc_id=$_GET.immo_doc_id|intval keep="info_immo, ligne_immo, message"}}
|
||||||
|
|
@ -14,8 +21,6 @@
|
||||||
{{if $ligne_immo.line_label != null && $ligne_immo.line_label != $immo_label}}
|
{{if $ligne_immo.line_label != null && $ligne_immo.line_label != $immo_label}}
|
||||||
{{:assign immo_label=$immo_label|cat:" — "|cat:$ligne_immo.line_label}}
|
{{:assign immo_label=$immo_label|cat:" — "|cat:$ligne_immo.line_label}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:assign date_achat_defaut=$info_immo.date_achat|or:$ligne_immo.date_achat}}
|
|
||||||
{{:assign date_mes_defaut=$info_immo.date_mes|or:$info_immo.date_achat|or:$ligne_immo.date_achat}}
|
|
||||||
|
|
||||||
{{* déduire le montant des écritures liées à l'immo courante au crédit du même compte *}}
|
{{* déduire le montant des écritures liées à l'immo courante au crédit du même compte *}}
|
||||||
{{:include file="_get_credit_lines.html" immo_doc_id=$_GET.immo_doc_id keep="linked_immos, total_credits"}}
|
{{:include file="_get_credit_lines.html" immo_doc_id=$_GET.immo_doc_id keep="linked_immos, total_credits"}}
|
||||||
|
|
@ -34,6 +39,15 @@
|
||||||
|
|
||||||
{{* traiter la saisie *}}
|
{{* traiter la saisie *}}
|
||||||
{{#form on="save"}}
|
{{#form on="save"}}
|
||||||
|
{{if ! $_POST.amortir}}
|
||||||
|
{{* ne pas amortir *}}
|
||||||
|
{{:assign duration=0}}
|
||||||
|
{{:assign libelle=null}}
|
||||||
|
{{:assign montant=null}}
|
||||||
|
{{:assign date_achat=null}}
|
||||||
|
{{:assign date_mes=null}}
|
||||||
|
{{:assign status="ignored"}}
|
||||||
|
{{else}}
|
||||||
{{if $_POST.date_achat|parse_date > $ligne_immo.date_achat}}
|
{{if $_POST.date_achat|parse_date > $ligne_immo.date_achat}}
|
||||||
{{:assign da=$ligne_immo.date_achat|date_short}}
|
{{:assign da=$ligne_immo.date_achat|date_short}}
|
||||||
{{:error message="Erreur : la date d'achat (%s) ne peut être postérieure à la date de l'écriture d'immobilisation (%s)"|args:$_POST.date_achat:$da}}
|
{{:error message="Erreur : la date d'achat (%s) ne peut être postérieure à la date de l'écriture d'immobilisation (%s)"|args:$_POST.date_achat:$da}}
|
||||||
|
|
@ -94,11 +108,50 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{:assign status="managed"}}
|
{{:assign status="managed"}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{* écritures de crédit *}}
|
||||||
|
{{#foreach from=$linked_immos item="line"}}
|
||||||
|
{{if ! $_POST.credit_id|has:$line.trans_id}}
|
||||||
|
{{:assign var="docs_to_remove." value=$line.doc}}
|
||||||
|
{{:assign var="links_to_remove." value=$line.trans_id}}
|
||||||
|
{{/if}}
|
||||||
|
{{/foreach}}
|
||||||
|
|
||||||
|
{{if $docs_to_remove != null}}
|
||||||
|
{{:assign remove_set=$docs_to_remove|implode:","}}
|
||||||
|
{{:assign remove_set="("|cat:$remove_set|cat:")"}}
|
||||||
|
{{:delete where="id IN %s"|args:$remove_set}}
|
||||||
|
|
||||||
|
{{* idem avec acc_transactions_links *}}
|
||||||
|
{{#select
|
||||||
|
CASE links.id_related = :immo_trans_id
|
||||||
|
WHEN true THEN links.id_transaction
|
||||||
|
WHEN false THEN links.id_related
|
||||||
|
END as linked_id
|
||||||
|
FROM acc_transactions_links as links
|
||||||
|
WHERE id_transaction = :immo_trans_id or id_related = :immo_trans_id;
|
||||||
|
:immo_trans_id = $ligne_immo.trans_id
|
||||||
|
}}
|
||||||
|
{{if ! $linked_id|in:$links_to_remove}}
|
||||||
|
{{:assign var="linked_transactions." value=$linked_id}}
|
||||||
|
{{/if}}
|
||||||
|
{{/select}}
|
||||||
|
|
||||||
|
{{* Enregistrer les liaisons *}}
|
||||||
|
{{:api
|
||||||
|
method="POST"
|
||||||
|
path="accounting/transaction/%s/transactions"|args:$ligne_immo.trans_id
|
||||||
|
assign="result"
|
||||||
|
assign_code="result_code"
|
||||||
|
transactions=$linked_transactions
|
||||||
|
}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{* enregistrer les infos de l'immobilisation *}}
|
{{* enregistrer les infos de l'immobilisation *}}
|
||||||
{{:save
|
{{:save
|
||||||
key=$info_immo.key
|
key=$info_immo.key
|
||||||
validate_schema="asset.schema.json"
|
validate_schema="schema.json"
|
||||||
type="immo"
|
type="immo"
|
||||||
line=$info_immo.line
|
line=$info_immo.line
|
||||||
duration=$duration
|
duration=$duration
|
||||||
|
|
@ -110,13 +163,18 @@
|
||||||
assign_new_id="new_id"
|
assign_new_id="new_id"
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
{{if $_POST.amortir}}
|
||||||
{{:assign type_immo="managed"}}
|
{{:assign type_immo="managed"}}
|
||||||
{{:redirect force="amortization.html?immo_doc_id=%s&type_immo=%s&ok=1&msg=modif"|args:$_GET.immo_doc_id:$type_immo}}
|
{{else}}
|
||||||
|
{{:assign type_immo="other"}}
|
||||||
|
{{/if}}
|
||||||
|
{{:redirect force="index.html?ok=1&msg=infos&type_immo=%s"|args:$type_immo}}
|
||||||
|
|
||||||
{{/form}}
|
{{/form}}
|
||||||
|
|
||||||
{{:admin_header title="Modifier l'immobilisation" custom_css="./style.css" current="module_amortization"}}
|
{{:admin_header title="Modifier l'immobilisation" custom_css="./style.css" current="module_amortization"}}
|
||||||
{{if ! $dialog}}
|
{{if ! $dialog}}
|
||||||
{{:include file="_nav.html" current="managed" subcurrent="modify_infos"}}
|
{{:include file="_nav.html" current="index" subcurrent="%s"|args:$_GET.type_immo subsubcurrent="parameter"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:form_errors}}
|
{{:form_errors}}
|
||||||
|
|
||||||
|
|
@ -149,16 +207,33 @@
|
||||||
|
|
||||||
<form method="post" action="">
|
<form method="post" action="">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Informations</legend>
|
<legend>Paramètres de l'amortissement</legend>
|
||||||
<dl>
|
<dl>
|
||||||
{{:input type="number" name="duree" label="Durée d'amortissement" min=1 default=$info_immo.duration suffix="année(s)"}}
|
{{:input id="amortir" type="checkbox" value=1 name="amortir" label="Amortir cette immobilisation sur une ou plusieurs années" checked="checked" help="Dé-cocher pour ne pas amortir"}}
|
||||||
|
<div class="masquable">
|
||||||
|
{{:input type="number" name="duree" label="Durée d'amortissement" min=1 default=$info_immo.duration}}
|
||||||
|
{{:input type="text" name="libelle" label="Libellé" default=$info_immo.label}}
|
||||||
{{if $info_immo.amount != null}}
|
{{if $info_immo.amount != null}}
|
||||||
{{:assign max_aff="%f"|math:$max_disponible|money_currency:false}}
|
{{:assign max_aff="%f"|math:$max_disponible|money_currency:false}}
|
||||||
{{:input type="money" name="montant" label="Montant de l'immobilisation" default=$montant_immo help="Montant maximum : %s"|args:$max_aff}}
|
{{:input type="money" name="montant" label="Montant de l'immobilisation" default=$montant_immo help="Montant maximum : %s"|args:$max_aff}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:input type="date" name="date_achat" label="Date d'acquisition" default=$date_achat_defaut help="si différente de la date de l'écriture d'immobilisation"}}
|
{{:input type="date" name="date_achat" label="Date d'acquisition" default=$info_immo.date_achat}}
|
||||||
{{:input type="date" name="date_mes" label="Date de mise en service" default=$date_mes_defaut help="si différente de la date d'acquisition"}}
|
{{:input type="date" name="date_mes" label="Date de mise en service" default=$info_immo.date_mes}}
|
||||||
{{:input type="text" name="libelle" label="Libellé" default=$immo_label help="si différent du libellé de l'écriture d'immobilisation"}}
|
{{if $linked_immos != null}}
|
||||||
|
<dt><label>Écritures d'avoir liées à l'immobilisation</label></dt>
|
||||||
|
<dd>
|
||||||
|
<span class="input-list avoirs">
|
||||||
|
<label for="credit_id">Écritures :</label>
|
||||||
|
{{#foreach from=$linked_immos item="line"}}
|
||||||
|
<span class="label">
|
||||||
|
<input type="hidden" name="credit_id[]" value="{{$line.trans_id}}">{{$line.trans_id}}
|
||||||
|
<button data-icon="✘" type="button" class=" icn-btn" title="Cliquer pour supprimer la liaison"></button>
|
||||||
|
</span>
|
||||||
|
{{/foreach}}
|
||||||
|
</span>
|
||||||
|
</dd>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<p class="submit">
|
<p class="submit">
|
||||||
|
|
@ -167,3 +242,17 @@
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{{:admin_footer}}
|
{{:admin_footer}}
|
||||||
|
|
||||||
|
<script type="text/javascript" src="scripts.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
function changeVisibility(evt, idcheck = 'f_amortir_1', hiddenclass = 'masquable')
|
||||||
|
{
|
||||||
|
toggleVisibility(idcheck, document.querySelectorAll('.' + hiddenclass));
|
||||||
|
}
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
document.getElementById('f_amortir_1').onclick = changeVisibility;
|
||||||
|
})();
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
name="Amortissements"
|
name="Amortissements"
|
||||||
description="Immobilisations et amortissements\nversion 0.33"
|
description="Immobilisations et amortissements\nversion 0.32"
|
||||||
author="Jean-Christophe Engel"
|
author="Jean-Christophe Engel"
|
||||||
author_url="https://gitea.zaclys.com/lesanges"
|
author_url="https://gitea.zaclys.com/lesanges"
|
||||||
home_button=false
|
home_button=false
|
||||||
|
|
|
||||||
|
|
@ -4,82 +4,67 @@
|
||||||
Lister les écritures d'amortissement indépendantes
|
Lister les écritures d'amortissement indépendantes
|
||||||
et proposer des les attacher à l'immo sélectionnée
|
et proposer des les attacher à l'immo sélectionnée
|
||||||
@param immo_doc_id id du doc d'immo associé
|
@param immo_doc_id id du doc d'immo associé
|
||||||
*}}
|
*}}
|
||||||
|
|
||||||
{{* données de l'immobilisation *}}
|
{{* 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"}}
|
{{:include file="_get_immo_data.html" immo_doc_id=$_GET.immo_doc_id|intval keep="info_immo, ligne_immo, message"}}
|
||||||
{{if $message != null}}
|
{{if $message != null}}
|
||||||
{{:error message=$message}}
|
{{:error message=$message}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{:assign montant_immo=$info_immo.amount|or:$ligne_immo.amount}}
|
|
||||||
{{:assign label_immo=$info_immo.label|or:$ligne_immo.trans_label}}
|
{{:assign label_immo=$info_immo.label|or:$ligne_immo.trans_label}}
|
||||||
{{if $ligne_immo.line_label != null && $ligne_immo.line_label != $label_immo}}
|
{{if $ligne_immo.line_label != null && $ligne_immo.line_label != $label_immo}}
|
||||||
{{:assign label_immo=$label_immo|cat:" — "|cat:$ligne_immo.line_label}}
|
{{:assign label_immo=$label_immo|cat:" — "|cat:$ligne_immo.line_label}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:assign date_mes=$info_immo.date_mes|or:$info_immo.date_achat|or:$ligne_immo.date_achat}}
|
|
||||||
|
|
||||||
{{* déduire le montant des écritures liées à l'immo courante au crédit du même compte *}}
|
{{:include file="_get_config.html" keep="module.config"}}
|
||||||
{{:include file="_get_credit_lines.html" immo_doc_id=$_GET.immo_doc_id keep="linked_immos, total_credits"}}
|
{{if $_POST.unhide == null}}
|
||||||
{{:assign montant_immo="%d-%d"|math:$montant_immo:$total_credits}}
|
{{:assign filter_condition=" NOT ("}}
|
||||||
|
{{#foreach from=$module.config.filters item="filter"}}
|
||||||
{{if $_GET.filter}}
|
{{:assign filter="%"|cat:$filter|cat:"%"|quote_sql}}
|
||||||
{{* déterminer le compte d'amortissement en fonction du compte d'immobilisation *}}
|
{{:assign filter_condition=$filter_condition|cat:" trans.label LIKE "|cat:$filter|cat:" OR "}}
|
||||||
{{:include
|
{{/foreach}}
|
||||||
file="./_get_amort_code.html"
|
{{:assign filter_condition=$filter_condition|cat:"0)"}}
|
||||||
code_immo=$ligne_immo.account_code
|
|
||||||
keep="code_amort"
|
|
||||||
}}
|
|
||||||
{{:assign filter_condition="account.code = "|cat:$code_amort}}
|
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign account_filter="28%"|quote_sql}}
|
{{:assign filter_condition="1"}}
|
||||||
{{:assign filter_condition="account.code LIKE "|cat:$account_filter}}
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{* lister les amortissements non rattachés à une immo *}}
|
{{* lister les amortissements non rattachés à une immo *}}
|
||||||
{{:include file="./_get_free_amort.html" filter_condition=$filter_condition keep="free_amort_lines"}}
|
{{: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"}}
|
{{:admin_header title="Amortissements non rattachés" custom_css="./style.css" current="module_amortization"}}
|
||||||
|
|
||||||
{{* barre de navigation *}}
|
{{* barre de navigation *}}
|
||||||
{{if ! $dialog}}
|
{{if ! $dialog}}
|
||||||
{{:include
|
{{:include
|
||||||
file="_nav.html"
|
file="_nav.html"
|
||||||
current="managed"
|
current="index"
|
||||||
subcurrent="amortization"
|
subcurrent="other"
|
||||||
type_immo="managed"
|
subsubcurrent="amortization"
|
||||||
|
type_immo="other"
|
||||||
autres_amort=$free_amort_lines
|
autres_amort=$free_amort_lines
|
||||||
}}
|
}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
<nav class="tabs">
|
{{if $_POST.unhide != null}}
|
||||||
<ul>
|
{{:assign checked="checked"}}
|
||||||
<li {{if $_GET.filter}}class="current"{{/if}}>
|
{{/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>
|
|
||||||
|
|
||||||
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$ligne_immo.trans_id}}
|
<form method="post" action="">
|
||||||
<section class="amortissement">
|
<fieldset>
|
||||||
<div class="informations">
|
{{:input type="checkbox" value=1 name="unhide" checked="%s"|args:$checked label="Afficher toutes les écritures"}}
|
||||||
<dl class="describe">
|
</fieldset>
|
||||||
<dt>Immobilisation</dt>
|
</form>
|
||||||
<dd><span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.trans_id}}</a></span> {{$label_immo}}</dd>
|
|
||||||
<dt>Montant</dt>
|
|
||||||
<dd class="money strong">{{"%f"|math:$montant_immo|money_currency_html:false|raw}}</dd>
|
|
||||||
<dt>Début d'amortissement</dt>
|
|
||||||
<dd>{{$date_mes|date_short}}</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{if $free_amort_lines != null}}
|
{{if $free_amort_lines != null}}
|
||||||
|
<section class="amortissement">
|
||||||
|
<h3 class="ruler">Immobilisation « {{$label_immo}} »</h3>
|
||||||
<table class="list">
|
<table class="list">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
@ -94,6 +79,9 @@
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{{#foreach from=$free_amort_lines item="line"}}
|
{{#foreach from=$free_amort_lines item="line"}}
|
||||||
|
{{if $_POST.unhide == null && $line.account_code != $code_amort}}
|
||||||
|
{{:continue}}
|
||||||
|
{{/if}}
|
||||||
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.trans_id}}
|
{{: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}}
|
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$line.account_id:$line.year}}
|
||||||
<tr>
|
<tr>
|
||||||
|
|
@ -118,14 +106,11 @@
|
||||||
</tr>
|
</tr>
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
</tbody>
|
</tbody>
|
||||||
<p class="help">Sélectionner une écriture d'amortissement pour l'associer à l'immobilisation</p>
|
|
||||||
</table>
|
</table>
|
||||||
{{else}}
|
</section>
|
||||||
<p class="block alert">Aucun amortissement pour le compte {{$code_amort}}</p>
|
{{else}}
|
||||||
{{/if}}
|
<p class="block alert">Aucun amortissement à rattacher</p>
|
||||||
</section>
|
{{/if}}
|
||||||
|
|
||||||
|
|
||||||
{{:form_errors}}
|
{{:form_errors}}
|
||||||
{{:admin_footer}}
|
{{:admin_footer}}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,10 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:assign var="amort_label" value="Amortissement %s"|args:$amort_label}}
|
{{:assign var="amort_label" value="Amortissement %s"|args:$amort_label}}
|
||||||
|
|
||||||
|
{{if $info_immo.status == "amortized" || $info_immo.status == "archived"}}
|
||||||
|
{{:error message="Cette immobilisation est complètement amortie ; il est impossible d'ajouter une écriture d'amortissement"}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{* déduire le montant des écritures liées à l'immo courante au crédit du même compte *}}
|
{{* déduire le montant des écritures liées à l'immo courante au crédit du même compte *}}
|
||||||
{{:include file="_get_credit_lines.html" immo_doc_id=$_GET.immo_doc_id keep="total_credits"}}
|
{{:include file="_get_credit_lines.html" immo_doc_id=$_GET.immo_doc_id keep="total_credits"}}
|
||||||
{{:assign var="ligne_immo.amount" value="%d-%d"|math:$ligne_immo.amount:$total_credits}}
|
{{:assign var="ligne_immo.amount" value="%d-%d"|math:$ligne_immo.amount:$total_credits}}
|
||||||
|
|
@ -65,7 +69,7 @@
|
||||||
*}}
|
*}}
|
||||||
{{:assign msg_years=""}}
|
{{:assign msg_years=""}}
|
||||||
{{#years closed=false order="start_date" where="start_date <= :debut AND :debut <= end_date"
|
{{#years closed=false order="start_date" where="start_date <= :debut AND :debut <= end_date"
|
||||||
:debut=$date_debut assign="years."}}
|
:debut=$date_debut assign=years.}}
|
||||||
{{if $total_amort == 0}}
|
{{if $total_amort == 0}}
|
||||||
{{:assign ts_debut=$date_debut|strtotime}}
|
{{:assign ts_debut=$date_debut|strtotime}}
|
||||||
{{else}}
|
{{else}}
|
||||||
|
|
@ -78,9 +82,7 @@
|
||||||
{{:assign var="years_data.%d"|args:$id value=$ts_debut|cat:" "|cat:$ts_fin}}
|
{{:assign var="years_data.%d"|args:$id value=$ts_debut|cat:" "|cat:$ts_fin}}
|
||||||
{{:assign msg_years=$msg_years|cat:"\n"|cat:" - "|cat:$label|cat:" : "|cat:$debut|cat:" à "|cat:$fin}}
|
{{:assign msg_years=$msg_years|cat:"\n"|cat:" - "|cat:$label|cat:" : "|cat:$debut|cat:" à "|cat:$fin}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign date_debut=$date_debut|date_short}}
|
{{:error message="Aucun exercice ouvert pour enregistrer un amortissement"}}
|
||||||
{{:assign msg="Pas d'exercice ouvert pour enregistrer un amortissement à partir du %s"|args:$date_debut}}
|
|
||||||
{{:error message=$msg}}
|
|
||||||
{{/years}}
|
{{/years}}
|
||||||
|
|
||||||
{{* Traiter l'envoi du formulaire *}}
|
{{* Traiter l'envoi du formulaire *}}
|
||||||
|
|
@ -148,12 +150,6 @@
|
||||||
{{:error message="Le montant indiqué « %s » dépasse le solde à amortir « %s »"|args:$montant:$solde}}
|
{{:error message="Le montant indiqué « %s » dépasse le solde à amortir « %s »"|args:$montant:$solde}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{*
|
|
||||||
supprimer les documents qui pointent sur une ligne d'amortissement absente
|
|
||||||
cas de la suppression manuelle d'un amortissement
|
|
||||||
*}}
|
|
||||||
{{:include file="_remove_orphan_docs.tpl"}}
|
|
||||||
|
|
||||||
{{* enregistrer l'écriture *}}
|
{{* enregistrer l'écriture *}}
|
||||||
{{:assign
|
{{:assign
|
||||||
var="lines."
|
var="lines."
|
||||||
|
|
@ -167,6 +163,7 @@
|
||||||
account=$credit_account|keys|value:0
|
account=$credit_account|keys|value:0
|
||||||
id_project=$ligne_immo.id_project
|
id_project=$ligne_immo.id_project
|
||||||
}}
|
}}
|
||||||
|
|
||||||
{{:api
|
{{:api
|
||||||
method="POST"
|
method="POST"
|
||||||
path="accounting/transaction"
|
path="accounting/transaction"
|
||||||
|
|
@ -188,7 +185,6 @@
|
||||||
type="amort_link"
|
type="amort_link"
|
||||||
immo_doc_id=$_GET.immo_doc_id|intval
|
immo_doc_id=$_GET.immo_doc_id|intval
|
||||||
amort_line_id=$line.id
|
amort_line_id=$line.id
|
||||||
created=true
|
|
||||||
}}
|
}}
|
||||||
{{:break}}
|
{{:break}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
@ -196,30 +192,26 @@
|
||||||
|
|
||||||
{{* immo soldée ? *}}
|
{{* immo soldée ? *}}
|
||||||
{{if $_POST.montant|trim|money_int == $solde}}
|
{{if $_POST.montant|trim|money_int == $solde}}
|
||||||
{{:assign status="amortized"}}
|
{{:assign var="info_immo.status" value="amortized"}}
|
||||||
{{:save
|
{{:save
|
||||||
key=$info_immo.key
|
key=$info_immo.key
|
||||||
status=$status
|
status=$info_immo.status
|
||||||
}}
|
}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{:redirect force="amortization.html?immo_doc_id=%s&type_immo=%s&ok=1&msg=amortissement"|args:$_GET.immo_doc_id:$status}}
|
{{:redirect force="amortization.html?immo_doc_id=%s&type_immo=%s&ok=1&msg=amortissement"|args:$_GET.immo_doc_id:$info_immo.status}}
|
||||||
{{/form}}
|
{{/form}}
|
||||||
|
|
||||||
{{:assign label_immo=$info_immo.label|or:$ligne_immo.trans_label}}
|
{{:admin_header title="Ajout amortissement" custom_css="./style.css" current="module_amortization"}}
|
||||||
|
|
||||||
{{:admin_header title="Amortissement pour « %s »"|args:$label_immo custom_css="./style.css" current="module_amortization"}}
|
|
||||||
|
|
||||||
{{* barre de navigation *}}
|
{{* barre de navigation *}}
|
||||||
{{if ! $dialog}}
|
{{if ! $dialog}}
|
||||||
{{:include file="_nav.html" current="managed" subcurrent="amortization"}}
|
{{:include file="_nav.html" current="index" subcurrent="managed" subsubcurrent="amortization"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{:form_errors}}
|
{{:form_errors}}
|
||||||
|
|
||||||
{{if $years|count == 1}}
|
{{:assign var=selected_year value=$years.0.id}}
|
||||||
{{:assign var=selected_year value=$years.0.id}}
|
|
||||||
{{/if}}
|
|
||||||
{{:assign var=date_amort value=$years.0.end_date}}
|
{{:assign var=date_amort value=$years.0.end_date}}
|
||||||
{{:include file="_calcul_dates.html" date_debut=$date_debut date_fin=$date_amort keep="nbjours"}}
|
{{:include file="_calcul_dates.html" date_debut=$date_debut date_fin=$date_amort keep="nbjours"}}
|
||||||
|
|
||||||
|
|
@ -248,7 +240,6 @@
|
||||||
name="debit_account"
|
name="debit_account"
|
||||||
label="Compte de débit"
|
label="Compte de débit"
|
||||||
required=true
|
required=true
|
||||||
readonly=true
|
|
||||||
target="!acc/charts/accounts/selector.php?codes=%s&id_year=%d"|args:"68*":$selected_year
|
target="!acc/charts/accounts/selector.php?codes=%s&id_year=%d"|args:"68*":$selected_year
|
||||||
default=$debit_account
|
default=$debit_account
|
||||||
}}
|
}}
|
||||||
|
|
@ -257,7 +248,6 @@
|
||||||
name="credit_account"
|
name="credit_account"
|
||||||
label="Compte d'amortissement (28xx)"
|
label="Compte d'amortissement (28xx)"
|
||||||
required=true
|
required=true
|
||||||
readonly=true
|
|
||||||
target="!acc/charts/accounts/selector.php?codes=%s&id_year=%d"|args:"28*":$selected_year
|
target="!acc/charts/accounts/selector.php?codes=%s&id_year=%d"|args:"28*":$selected_year
|
||||||
default=$credit_account
|
default=$credit_account
|
||||||
}}
|
}}
|
||||||
|
|
@ -296,8 +286,8 @@ function redisplayData(evt,
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
setDateEnd(f_years_select, f_date, f_years_data);
|
setDateEnd(f_years_select, f_date, f_years_data);
|
||||||
displayAmort(f_immo, f_duree, f_amort, f_years_data, f_years_select, f_montant, f_erreur);
|
|
||||||
setSelectorYear(['credit_account', 'debit_account'], f_years_select);
|
setSelectorYear(['credit_account', 'debit_account'], f_years_select);
|
||||||
|
displayAmort(f_immo, f_duree, f_amort, f_years_data, f_years_select, f_montant, f_erreur);
|
||||||
}
|
}
|
||||||
|
|
||||||
function redisplayAmort(evt,
|
function redisplayAmort(evt,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
{
|
{
|
||||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
"description": "Donnée d'une immobilisation",
|
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"type": {
|
"type": {
|
||||||
|
|
@ -36,10 +35,6 @@
|
||||||
"status" : {
|
"status" : {
|
||||||
"type" : ["string", "null"],
|
"type" : ["string", "null"],
|
||||||
"enum" : ["managed", "amortized", "archived", "ignored"]
|
"enum" : ["managed", "amortized", "archived", "ignored"]
|
||||||
},
|
|
||||||
"created" : {
|
|
||||||
"description" : "vrai si immobilisation créée dans le module",
|
|
||||||
"type" : ["boolean", "null"]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": ["type", "line", "duration", "status"]
|
"required": ["type", "line", "duration", "status"]
|
||||||
39
scripts.js
39
scripts.js
|
|
@ -12,10 +12,9 @@ function toggleInputs(idcb, idfields) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleVisibility(id_check, fields) {
|
function toggleVisibility(idcheck, fields) {
|
||||||
const elem = document.getElementById(id_check);
|
const elem = document.getElementById(idcheck);
|
||||||
fields.forEach(function (id_field) {
|
fields.forEach(function (field) {
|
||||||
const field = document.getElementById(id_field);
|
|
||||||
if (elem.checked) {
|
if (elem.checked) {
|
||||||
field.classList.remove('hidden');
|
field.classList.remove('hidden');
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -28,12 +27,10 @@ function toggleVisibility(id_check, fields) {
|
||||||
function setAccountYear(button_names, id_year) {
|
function setAccountYear(button_names, id_year) {
|
||||||
for (const name of button_names) {
|
for (const name of button_names) {
|
||||||
const button = document.querySelector("button[data-name=" + name + "]");
|
const button = document.querySelector("button[data-name=" + name + "]");
|
||||||
if (button != null) {
|
|
||||||
const b_value = button.value;
|
const b_value = button.value;
|
||||||
const new_value = b_value.replace(/id_year=\d+/, 'id_year=' + id_year);
|
const new_value = b_value.replace(/id_year=\d+/, 'id_year=' + id_year);
|
||||||
button.setAttribute('value', new_value);
|
button.setAttribute('value', new_value);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -134,9 +131,7 @@ function displayAmort(id_immo, id_duree, id_amort, id_years, id_exercices, id_mo
|
||||||
case_montant.innerText = montant_amort;
|
case_montant.innerText = montant_amort;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setSelectorYear(button_names, f_years_selector)
|
function setSelectorYear(button_names, f_years_selector) {
|
||||||
{
|
|
||||||
const selector = document.getElementById(f_years_selector);
|
|
||||||
const selected_year = document.getElementById(f_years_selector).value;
|
const selected_year = document.getElementById(f_years_selector).value;
|
||||||
setAccountYear(button_names, selected_year);
|
setAccountYear(button_names, selected_year);
|
||||||
}
|
}
|
||||||
|
|
@ -145,8 +140,7 @@ function setSelectorYear(button_names, f_years_selector)
|
||||||
|
|
||||||
// Associer au bouton « Enlever » de chaque ligne l'action de suppression de la ligne
|
// Associer au bouton « Enlever » de chaque ligne l'action de suppression de la ligne
|
||||||
function initLine(row) {
|
function initLine(row) {
|
||||||
let removeBtn = row.querySelector('button[name="remove_line"]');
|
var removeBtn = row.querySelector('button[name="remove_line"]');
|
||||||
if (removeBtn != null) {
|
|
||||||
removeBtn.onclick = () => {
|
removeBtn.onclick = () => {
|
||||||
let count = removeBtn.closest("table").querySelectorAll('tbody tr').length;
|
let count = removeBtn.closest("table").querySelectorAll('tbody tr').length;
|
||||||
var min = removeBtn.getAttribute('min');
|
var min = removeBtn.getAttribute('min');
|
||||||
|
|
@ -159,7 +153,6 @@ function initLine(row) {
|
||||||
row.parentNode.removeChild(row);
|
row.parentNode.removeChild(row);
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Associer au bouton « Ajouter » de chaque table l'action d'ajouter une ligne
|
// Associer au bouton « Ajouter » de chaque table l'action d'ajouter une ligne
|
||||||
|
|
@ -187,28 +180,6 @@ function addLine(button, codes) {
|
||||||
let lib = newNode.querySelector('.input-list span.label');
|
let lib = newNode.querySelector('.input-list span.label');
|
||||||
lib.innerText = '';
|
lib.innerText = '';
|
||||||
|
|
||||||
// si besoin, ajouter le bouton de suppression
|
|
||||||
let action_cell = newNode.querySelector('td.actions');
|
|
||||||
let removeBtn = newNode.querySelector('button[name="remove_line"]');
|
|
||||||
if (removeBtn == null) {
|
|
||||||
const attributs = {
|
|
||||||
"title" : "Enlever une ligne",
|
|
||||||
"min": "1",
|
|
||||||
"name": "remove_line",
|
|
||||||
"data-icon": "➖",
|
|
||||||
"type": "button",
|
|
||||||
"class": "icn-btn",
|
|
||||||
"value": "1",
|
|
||||||
"aria-label": "Enlever une ligne"
|
|
||||||
};
|
|
||||||
let new_button = document.createElement("button");
|
|
||||||
new_button.appendChild(document.createTextNode("Enlever"));
|
|
||||||
for (let attr in attributs) {
|
|
||||||
new_button.setAttribute(attr, attributs[attr]);
|
|
||||||
}
|
|
||||||
action_cell.appendChild(new_button);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ajouter la nouvelle ligne
|
// ajouter la nouvelle ligne
|
||||||
line.parentNode.appendChild(newNode);
|
line.parentNode.appendChild(newNode);
|
||||||
initLine(newNode);
|
initLine(newNode);
|
||||||
|
|
|
||||||
|
|
@ -175,13 +175,12 @@
|
||||||
{{* enregistrer les infos de l'immobilisation *}}
|
{{* enregistrer les infos de l'immobilisation *}}
|
||||||
{{:save
|
{{:save
|
||||||
key=""|uuid
|
key=""|uuid
|
||||||
validate_schema="asset.schema.json"
|
validate_schema="schema.json"
|
||||||
type="immo"
|
type="immo"
|
||||||
line=$immo_line_id
|
line=$immo_line_id
|
||||||
duration=$duration
|
duration=$duration
|
||||||
date_mes=null
|
date_mes=null
|
||||||
status=$status
|
status=$status
|
||||||
created=true
|
|
||||||
}}
|
}}
|
||||||
{{if $_POST.amortir}}
|
{{if $_POST.amortir}}
|
||||||
{{:assign type_immo="managed"}}
|
{{:assign type_immo="managed"}}
|
||||||
|
|
@ -193,7 +192,7 @@
|
||||||
|
|
||||||
{{:admin_header title="Transfert d'immobilisation en cours" custom_css="./style.css" current="module_amortization"}}
|
{{:admin_header title="Transfert d'immobilisation en cours" custom_css="./style.css" current="module_amortization"}}
|
||||||
{{if ! $dialog}}
|
{{if ! $dialog}}
|
||||||
{{:include file="_nav.html" current="unfinished" subcurrent="transfer"}}
|
{{:include file="_nav.html" current="index" subcurrent="unfinished" subsubcurrent="transfer"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{:form_errors}}
|
{{:form_errors}}
|
||||||
|
|
@ -258,7 +257,6 @@
|
||||||
type="list"
|
type="list"
|
||||||
name="credit_accounts[]"
|
name="credit_accounts[]"
|
||||||
required=true
|
required=true
|
||||||
readonly=true
|
|
||||||
target="!acc/charts/accounts/selector.php?codes=%s&id_year=%d"|args:$code:$selected_year
|
target="!acc/charts/accounts/selector.php?codes=%s&id_year=%d"|args:$code:$selected_year
|
||||||
default=$current_account
|
default=$current_account
|
||||||
}}
|
}}
|
||||||
|
|
|
||||||
|
|
@ -41,10 +41,6 @@
|
||||||
{{:assign montant_cession="%f*100"|math:$_GET.cession}}
|
{{:assign montant_cession="%f*100"|math:$_GET.cession}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{* numéros de comptes ; voir info.org *}}
|
|
||||||
{{:assign vnc_code="652"}}
|
|
||||||
{{:assign cession_code="757"}}
|
|
||||||
|
|
||||||
{{* TODO : faut-il forcer les 3 sélecteurs de compte d'amortissement à avoir toujours la même valeur ? *}}
|
{{* TODO : faut-il forcer les 3 sélecteurs de compte d'amortissement à avoir toujours la même valeur ? *}}
|
||||||
|
|
||||||
{{* Traiter l'envoi du formulaire *}}
|
{{* Traiter l'envoi du formulaire *}}
|
||||||
|
|
@ -142,7 +138,6 @@
|
||||||
type="amort_link"
|
type="amort_link"
|
||||||
immo_doc_id=$info_immo.id
|
immo_doc_id=$info_immo.id
|
||||||
amort_line_id=$line.id
|
amort_line_id=$line.id
|
||||||
created=true
|
|
||||||
}}
|
}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
|
@ -208,7 +203,6 @@
|
||||||
type="exit_link"
|
type="exit_link"
|
||||||
immo_doc_id=$info_immo.id
|
immo_doc_id=$info_immo.id
|
||||||
exit_line_id=$line.id
|
exit_line_id=$line.id
|
||||||
created=true
|
|
||||||
}}
|
}}
|
||||||
{{:break}}
|
{{:break}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
@ -246,36 +240,18 @@
|
||||||
}}
|
}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{* liaison écriture de cession *}}
|
|
||||||
{{#foreach from=$result.lines item="line"}}
|
|
||||||
{{if $line.account_code == $cession_code}}
|
|
||||||
{{:save
|
|
||||||
key=""|uuid
|
|
||||||
type="cession_link"
|
|
||||||
immo_doc_id=$info_immo.id
|
|
||||||
cession_line_id=$line.id
|
|
||||||
created=true
|
|
||||||
}}
|
|
||||||
{{:break}}
|
|
||||||
{{/if}}
|
|
||||||
{{/foreach}}
|
|
||||||
|
|
||||||
{{* mettre à jour l'état de l'immobilisation *}}
|
{{* mettre à jour l'état de l'immobilisation *}}
|
||||||
{{:save
|
{{:save
|
||||||
key=$info_immo.key
|
key=$info_immo.key
|
||||||
status="archived"
|
status="archived"
|
||||||
}}
|
}}
|
||||||
|
|
||||||
{{:redirect to="index.html?type_immo=archived"}}
|
{{:redirect to="index.html?type_immo=archived"}}
|
||||||
{{/form}}
|
{{/form}}
|
||||||
|
|
||||||
{{:admin_header title="Sortie du bilan" custom_css="./style.css" current="module_amortization"}}
|
{{:admin_header title="Sortie du bilan" custom_css="./style.css" current="module_amortization"}}
|
||||||
{{if ! $dialog}}
|
{{if ! $dialog}}
|
||||||
{{if $valeur_nette > 0}}
|
{{:include file="_nav.html" current="index" subcurrent="balance_exit"}}
|
||||||
{{:assign type_immo="managed"}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign type_immo="amortized"}}
|
|
||||||
{{/if}}
|
|
||||||
{{:include file="_nav.html" current="%s"|args:$type_immo subcurrent="balance_exit"}}
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{*
|
{{*
|
||||||
|
|
@ -289,6 +265,10 @@
|
||||||
keep="code_amort"
|
keep="code_amort"
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
{{* numéros de comptes ; voir info.org *}}
|
||||||
|
{{:assign vnc_code="652"}}
|
||||||
|
{{:assign cession_code="757"}}
|
||||||
|
|
||||||
{{:assign var="liste_codes.6811" name="comp_account"}}
|
{{:assign var="liste_codes.6811" name="comp_account"}}
|
||||||
{{:assign var="liste_codes.687" name="except_account"}}
|
{{:assign var="liste_codes.687" name="except_account"}}
|
||||||
{{:assign var="liste_codes.462" name="creance_account"}}
|
{{:assign var="liste_codes.462" name="creance_account"}}
|
||||||
|
|
@ -400,7 +380,6 @@
|
||||||
type="list"
|
type="list"
|
||||||
name="comp_account"
|
name="comp_account"
|
||||||
target="!acc/charts/accounts/selector.php?codes=%s&id_chart=%s"|args:"68*":$chart_id
|
target="!acc/charts/accounts/selector.php?codes=%s&id_chart=%s"|args:"68*":$chart_id
|
||||||
readonly=true
|
|
||||||
default=$comp_account
|
default=$comp_account
|
||||||
}}
|
}}
|
||||||
</td>
|
</td>
|
||||||
|
|
@ -413,7 +392,6 @@
|
||||||
type="list"
|
type="list"
|
||||||
name="amort_comp_account"
|
name="amort_comp_account"
|
||||||
target="!acc/charts/accounts/selector.php?codes=%s&id_chart=%s"|args:"28*":$chart_id
|
target="!acc/charts/accounts/selector.php?codes=%s&id_chart=%s"|args:"28*":$chart_id
|
||||||
readonly=true
|
|
||||||
default=$amort_account
|
default=$amort_account
|
||||||
}}
|
}}
|
||||||
</td>
|
</td>
|
||||||
|
|
@ -446,7 +424,6 @@
|
||||||
type="list"
|
type="list"
|
||||||
name="except_account"
|
name="except_account"
|
||||||
target="!acc/charts/accounts/selector.php?codes=%s&id_chart=%s"|args:"687*":$chart_id
|
target="!acc/charts/accounts/selector.php?codes=%s&id_chart=%s"|args:"687*":$chart_id
|
||||||
readonly=true
|
|
||||||
default=$except_account
|
default=$except_account
|
||||||
}}
|
}}
|
||||||
</td>
|
</td>
|
||||||
|
|
@ -459,7 +436,6 @@
|
||||||
type="list"
|
type="list"
|
||||||
name="amort_except_account"
|
name="amort_except_account"
|
||||||
target="!acc/charts/accounts/selector.php?codes=%s&id_chart=%s"|args:"28*":$chart_id
|
target="!acc/charts/accounts/selector.php?codes=%s&id_chart=%s"|args:"28*":$chart_id
|
||||||
readonly=true
|
|
||||||
default=$amort_account
|
default=$amort_account
|
||||||
}}
|
}}
|
||||||
</td>
|
</td>
|
||||||
|
|
@ -486,7 +462,6 @@
|
||||||
type="list"
|
type="list"
|
||||||
name="amort_sortie_account"
|
name="amort_sortie_account"
|
||||||
target="!acc/charts/accounts/selector.php?codes=%s&id_chart=%s"|args:"28*":$chart_id
|
target="!acc/charts/accounts/selector.php?codes=%s&id_chart=%s"|args:"28*":$chart_id
|
||||||
readonly=true
|
|
||||||
default=$amort_account
|
default=$amort_account
|
||||||
}}
|
}}
|
||||||
</td>
|
</td>
|
||||||
|
|
@ -505,7 +480,6 @@
|
||||||
type="list"
|
type="list"
|
||||||
name="vnc_account"
|
name="vnc_account"
|
||||||
target="!acc/charts/accounts/selector.php?codes=%s*&id_chart=%s"|args:$vnc_code:$chart_id
|
target="!acc/charts/accounts/selector.php?codes=%s*&id_chart=%s"|args:$vnc_code:$chart_id
|
||||||
readonly=true
|
|
||||||
default=$vnc_account
|
default=$vnc_account
|
||||||
}}
|
}}
|
||||||
</td>
|
</td>
|
||||||
|
|
@ -519,7 +493,6 @@
|
||||||
type="list"
|
type="list"
|
||||||
name="immo_account"
|
name="immo_account"
|
||||||
target="!acc/charts/accounts/selector.php?codes=%s&id_chart=%s"|args:$patterns:$chart_id
|
target="!acc/charts/accounts/selector.php?codes=%s&id_chart=%s"|args:$patterns:$chart_id
|
||||||
readonly=true
|
|
||||||
default=$immo_account
|
default=$immo_account
|
||||||
}}
|
}}
|
||||||
</td>
|
</td>
|
||||||
|
|
@ -546,7 +519,6 @@
|
||||||
type="list"
|
type="list"
|
||||||
name="creance_account"
|
name="creance_account"
|
||||||
target="!acc/charts/accounts/selector.php?codes=%s&id_chart=%s"|args:"462*":$chart_id
|
target="!acc/charts/accounts/selector.php?codes=%s&id_chart=%s"|args:"462*":$chart_id
|
||||||
readonly=true
|
|
||||||
default=$creance_account
|
default=$creance_account
|
||||||
}}
|
}}
|
||||||
</td>
|
</td>
|
||||||
|
|
@ -559,7 +531,6 @@
|
||||||
type="list"
|
type="list"
|
||||||
name="cession_account"
|
name="cession_account"
|
||||||
target="!acc/charts/accounts/selector.php?codes=%s*&id_chart=%s"|args:$cession_code:$chart_id
|
target="!acc/charts/accounts/selector.php?codes=%s*&id_chart=%s"|args:$cession_code:$chart_id
|
||||||
readonly=true
|
|
||||||
default=$cession_account
|
default=$cession_account
|
||||||
}}
|
}}
|
||||||
</td>
|
</td>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue