Merge branch 'reorg_sdb'
This commit is contained in:
commit
c24e57e490
4 changed files with 75 additions and 49 deletions
|
|
@ -4,6 +4,7 @@
|
|||
lister les lignes d'amortissement liées à la ligne d'immobilisation
|
||||
@param immo_doc_id : id du doc associé à l'immobilisation
|
||||
@result linked_amort : lignes d'amortissement liées à la ligne d'immobilisation
|
||||
@result sommes_amort : montant des amortissements par compte d'amortissement
|
||||
@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
|
||||
*}}
|
||||
|
|
@ -39,6 +40,8 @@
|
|||
{{: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="montant" from="sommes_amort.%s"|args:$account_code}}
|
||||
{{:assign var="sommes_amort.%s"|args:$account_code value="%d+%d"|math:$montant:$amort_line.amount}}
|
||||
{{:assign total_amort="%d+%d"|math:$total_amort:$amort_line.amount}}
|
||||
{{/select}}
|
||||
{{/load}}
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@
|
|||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{:redirect to="compute_exit_data.html?immo_doc_id=%s&amort_amount=%s&year=%s&date_debut=%s&exit_date=%s"|args:$_GET.immo_doc_id:$total_amort:$selected_year:$ts_debut:$ts_exit}}
|
||||
{{:redirect to="compute_exit_data.html?immo_doc_id=%s&year=%s&date_debut=%s&exit_date=%s"|args:$_GET.immo_doc_id:$selected_year:$ts_debut:$ts_exit}}
|
||||
{{/form}}
|
||||
|
||||
{{:admin_header title="Sortie de bilan" custom_css="./style.css" current="module_amortization"}}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
Calculer les valeurs de la sortie et saisir le montant de la cession (optionnel)
|
||||
paramètres :
|
||||
@param immo_doc_id : id du doc associé à l'immo
|
||||
@param amort_amount : montant des amortissements
|
||||
@param year : exercice de la date de sortie de l'immobilisation
|
||||
@param date_debut : date de début de la période d'amortissement complémentaire
|
||||
@param exit_date : date de sortie de l'immobilisation
|
||||
|
|
@ -35,7 +34,10 @@
|
|||
{{* 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"}}
|
||||
{{:assign var="ligne_immo.amount" value="%d-%d"|math:$ligne_immo.amount:$total_credits}}
|
||||
{{:assign valeur_nette="%f-%f"|math:$ligne_immo.amount:$_GET.amort_amount}}
|
||||
|
||||
{{* 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"}}
|
||||
{{:assign valeur_nette="%f-%f"|math:$ligne_immo.amount:$total_amort}}
|
||||
|
||||
{{:assign amort_comp=0}} {{* amortissement complémentaire jqà date sortie *}}
|
||||
{{if $valeur_nette > 0}}
|
||||
|
|
@ -53,7 +55,7 @@
|
|||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{:redirect to="write_exit.html?immo_doc_id=%s&amort_amount=%s&year=%s&date_debut=%s&exit_date=%s&cession=%s"|args:$_GET.immo_doc_id:$_GET.amort_amount:$_GET.year:$_GET.date_debut:$_GET.exit_date:$_POST.montant_cession}}
|
||||
{{:redirect to="write_exit.html?immo_doc_id=%s&year=%s&date_debut=%s&exit_date=%s&cession=%s"|args:$_GET.immo_doc_id:$_GET.year:$_GET.date_debut:$_GET.exit_date:$_POST.montant_cession}}
|
||||
|
||||
{{/form}}
|
||||
{{:admin_header title="Sortie du bilan" custom_css="./style.css" current="module_amortization"}}
|
||||
|
|
@ -87,7 +89,7 @@
|
|||
<dt>Durée de l'amortissement</dt>
|
||||
<dd id="duree_amort" class="num">{{$info_immo.duration}} ans</dd>
|
||||
<dt>Montant des amortissements</dt>
|
||||
<dd id="montant_amort" class="money">{{$_GET.amort_amount|money_currency_html:false|raw}} <span class="help">(à la date de début de l'exercice)</span></dd>
|
||||
<dd id="montant_amort" class="money">{{$total_amort|money_currency_html:false|raw}} <span class="help">(à la date de début de l'exercice)</span></dd>
|
||||
<dt>Valeur nette résiduelle</dt>
|
||||
<dd class="money">{{$valeur_nette|money_currency_html:false|raw}} <span class="help">(à la date de début de l'exercice)</span></dd>
|
||||
<dt>Date de sortie</dt>
|
||||
|
|
@ -96,7 +98,7 @@
|
|||
<dt>Amortissement complémentaire</dt>
|
||||
<dd class="money">{{$amort_comp|money_currency_html:false|raw}} <span class="help">(jusqu'à la date de sortie)</span></dd>
|
||||
<dt>Total des amortissements</dt>
|
||||
<dd class="money">{{"%f+%f"|math:$_GET.amort_amount:$amort_comp|money_currency_html:false|raw}} <span class="help">(à la date de sortie)</span></dd>
|
||||
<dd class="money">{{"%f+%f"|math:$total_amort:$amort_comp|money_currency_html:false|raw}} <span class="help">(à la date de sortie)</span></dd>
|
||||
<dt>Valeur nette résiduelle</dt>
|
||||
<dd class="money">{{"%f-%f"|math:$valeur_nette:$amort_comp|money_currency_html:false|raw}} <span class="help">(à la date de sortie)</span></dd>
|
||||
{{/if}}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
Enregistrer les écritures de sortie du bilan
|
||||
paramètres :
|
||||
- immo_doc_id : id du doc associé à l'immobilisation
|
||||
- amort_amount : montant des amortissements
|
||||
- year : exercice de la date de sortie de l'immobilisation
|
||||
- date_debut : date de début de la période d'amortissement complémentaire
|
||||
- exit_date : date de sortie de l'immobilisation
|
||||
|
|
@ -34,7 +33,10 @@
|
|||
{{* 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"}}
|
||||
{{:assign var="ligne_immo.amount" value="%d-%d"|math:$ligne_immo.amount:$total_credits}}
|
||||
{{:assign valeur_nette="%f-%f"|math:$ligne_immo.amount:$_GET.amort_amount}}
|
||||
|
||||
{{* lister les amortissements liés à l'immobilisation *}}
|
||||
{{:include file="./_get_amort_lines.html" immo_doc_id=$_GET.immo_doc_id keep="linked_amort, sommes_amort, total_amort"}}
|
||||
{{:assign valeur_nette="%f-%f"|math:$ligne_immo.amount:$total_amort}}
|
||||
|
||||
{{:assign amort_comp=0}} {{* amortissement complémentaire jqà date sortie *}}
|
||||
{{:assign amort_except=0}} {{* amortissement exceptionnel jqà date fin amortissement *}}
|
||||
|
|
@ -45,7 +47,7 @@
|
|||
{{:assign amort_comp="min(%f, %f)"|math:$valeur_nette:$amort_comp}}
|
||||
|
||||
{{if $_GET.cession == null}}
|
||||
{{:assign amort_except="%f-%f-%f"|math:$ligne_immo.amount:$_GET.amort_amount:$amort_comp}}
|
||||
{{:assign amort_except="%f-%f-%f"|math:$ligne_immo.amount:$total_amort:$amort_comp}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
|
|
@ -58,6 +60,11 @@
|
|||
{{* numéros de comptes ; voir info.org *}}
|
||||
{{:assign vnc_code="652"}}
|
||||
{{:assign cession_code="757"}}
|
||||
{{:include
|
||||
file="./_get_amort_code.html"
|
||||
code_immo=$ligne_immo.account_code
|
||||
keep="code_amort"
|
||||
}}
|
||||
|
||||
{{* Traiter l'envoi du formulaire *}}
|
||||
{{#form on="save"}}
|
||||
|
|
@ -92,7 +99,7 @@
|
|||
{{:assign
|
||||
var="lines."
|
||||
credit="%f/100"|math:$amort_comp
|
||||
account=$amort_account_code
|
||||
account=$code_amort|intval
|
||||
id_project=$ligne_immo.id_project
|
||||
label=$libelle
|
||||
}}
|
||||
|
|
@ -117,7 +124,7 @@
|
|||
{{:assign
|
||||
var="lines."
|
||||
credit="%f/100"|math:$amort_except
|
||||
account=$amort_account_code
|
||||
account=$code_amort|intval
|
||||
id_project=$ligne_immo.id_project
|
||||
label=$libelle
|
||||
}}
|
||||
|
|
@ -139,7 +146,7 @@
|
|||
|
||||
{{* liaisons lignes d'amortissement *}}
|
||||
{{#foreach from=$result.lines item="line"}}
|
||||
{{if $line.account_code == $amort_account_code}}
|
||||
{{if $line.account_code == $code_amort}}
|
||||
{{:save
|
||||
key=""|uuid
|
||||
type="amort_link"
|
||||
|
|
@ -167,13 +174,20 @@
|
|||
id_project=$ligne_immo.id_project
|
||||
label=$libelle
|
||||
}}
|
||||
{{* amortissements *}}
|
||||
{{#foreach from=$sommes_amort key="code" item="montant"}}
|
||||
{{if $code == $code_amort}}
|
||||
{{* amortissements complémentaire et exceptionnel *}}
|
||||
{{:assign montant="(%d+%d+%d)"|math:$montant:$amort_comp:$amort_except}}
|
||||
{{/if}}
|
||||
{{:assign
|
||||
var="lines."
|
||||
account=$amort_account_code
|
||||
debit="(%f-%f)/100"|math:$ligne_immo.amount:$valeur_nette
|
||||
account=$code
|
||||
debit="%d/100"|math:$montant
|
||||
id_project=$ligne_immo.id_project
|
||||
label=$libelle
|
||||
}}
|
||||
{{/foreach}}
|
||||
{{if $valeur_nette > 0}}
|
||||
{{:include
|
||||
file="_get_codes.html"
|
||||
|
|
@ -286,16 +300,12 @@
|
|||
déterminer les comptes pour les différentes écritures
|
||||
*}}
|
||||
|
||||
{{:include
|
||||
file="./_get_amort_code.html"
|
||||
code_immo=$ligne_immo.account_code
|
||||
keep="code_amort"
|
||||
}}
|
||||
|
||||
{{:assign var="liste_codes.6811" name="comp_account"}}
|
||||
{{:assign var="liste_codes.687" name="except_account"}}
|
||||
{{:assign var="liste_codes.462" name="creance_account"}}
|
||||
{{:assign var="liste_codes.%s"|args:$code_amort name="amort_account"}}
|
||||
{{#foreach from=$sommes_amort key="code"}}
|
||||
{{:assign var="liste_codes.%s"|args:$code name="amort_account"}}
|
||||
{{/foreach}}
|
||||
{{:assign var="liste_codes.%s"|args:$ligne_immo.account_code name="immo_account"}}
|
||||
{{:assign var="liste_codes.%s"|args:$vnc_code name="vnc_account"}}
|
||||
{{:assign var="liste_codes.%s"|args:$cession_code name="cession_account"}}
|
||||
|
|
@ -338,7 +348,6 @@
|
|||
|
||||
<h3>Sortir l'immobilisation « {{$label_immo}} » du bilan</h3>
|
||||
<form method="post" action="">
|
||||
|
||||
<div class="informations">
|
||||
<legend>Données de l'imobilisation</legend>
|
||||
<dl class="describe">
|
||||
|
|
@ -353,7 +362,7 @@
|
|||
<dt>Durée de l'amortissement</dt>
|
||||
<dd class="num">{{$info_immo.duration}} ans</dd>
|
||||
<dt>Montant des amortissements</dt>
|
||||
<dd class="money">{{$_GET.amort_amount|money_currency_html:false|raw}} <span class="help">(à la date de début de l'exercice)</span></dd>
|
||||
<dd class="money">{{$total_amort|money_currency_html:false|raw}} <span class="help">(à la date de début de l'exercice)</span></dd>
|
||||
<dt>Valeur nette résiduelle</dt>
|
||||
<dd class="money">{{$valeur_nette|money_currency_html:false|raw}} <span class="help">(à la date de début de l'exercice)</span></dd>
|
||||
<dt>Date de sortie</dt>
|
||||
|
|
@ -363,7 +372,7 @@
|
|||
<dt>Amortissement complémentaire</dt>
|
||||
<dd class="money">{{$amort_comp|money_currency_html:false|raw}} <span class="help">(jusqu'à la date de sortie)</span></dd>
|
||||
<dt>Total des amortissements</dt>
|
||||
<dd class="money">{{"%f+%f"|math:$_GET.amort_amount:$amort_comp|money_currency_html:false|raw}} <span class="help">(à la date de sortie)</span></dd>
|
||||
<dd class="money">{{"%f+%f"|math:$total_amort:$amort_comp|money_currency_html:false|raw}} <span class="help">(à la date de sortie)</span></dd>
|
||||
<dt>Valeur nette résiduelle</dt>
|
||||
<dd class="money">{{$valeur_nette|money_currency_html:false|raw}} <span class="help">(à la date de sortie)</span></dd>
|
||||
{{/if}}
|
||||
|
|
@ -383,6 +392,7 @@
|
|||
<legend>Écritures de sortie du bilan</legend>
|
||||
{{* Amortissement complémentaire *}}
|
||||
{{if $amort_comp > 0}}
|
||||
{{:assign var="account.%s"|args:$code from="amort_account.%s"|args:$code_amort}}
|
||||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
|
|
@ -417,7 +427,7 @@
|
|||
name="amort_comp_account"
|
||||
target="!acc/charts/accounts/selector.php?codes=%s&id_chart=%s"|args:"28*":$chart_id
|
||||
readonly=true
|
||||
default=$amort_account
|
||||
default=$account
|
||||
}}
|
||||
</td>
|
||||
<td></td>
|
||||
|
|
@ -425,10 +435,12 @@
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
{{:assign account=null}}
|
||||
{{/if}}
|
||||
|
||||
{{* Amortissement exceptionnel *}}
|
||||
{{if $montant_cession == 0 && $amort_except > 0}}
|
||||
{{:assign var="account.%s"|args:$code from="amort_account.%s"|args:$code_amort}}
|
||||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
|
|
@ -463,7 +475,7 @@
|
|||
name="amort_except_account"
|
||||
target="!acc/charts/accounts/selector.php?codes=%s&id_chart=%s"|args:"28*":$chart_id
|
||||
readonly=true
|
||||
default=$amort_account
|
||||
default=$account
|
||||
}}
|
||||
</td>
|
||||
<td></td>
|
||||
|
|
@ -471,6 +483,7 @@
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
{{:assign account=null}}
|
||||
{{/if}}
|
||||
|
||||
{{* Sortie du bilan *}}
|
||||
|
|
@ -483,6 +496,8 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#foreach from=$sommes_amort key="code" item="montant"}}
|
||||
{{:assign var="account.%s"|args:$code from="amort_account.%s"|args:$code}}
|
||||
<tr>
|
||||
<td>
|
||||
{{:input
|
||||
|
|
@ -490,17 +505,23 @@
|
|||
name="amort_sortie_account"
|
||||
target="!acc/charts/accounts/selector.php?codes=%s&id_chart=%s"|args:"28*":$chart_id
|
||||
readonly=true
|
||||
default=$amort_account
|
||||
default=$account
|
||||
}}
|
||||
</td>
|
||||
{{if $montant_cession == 0}}
|
||||
{{:assign montant=$ligne_immo.amount}}
|
||||
{{if $code == $code_amort}}
|
||||
{{:assign montant="%f+%f+%f"|math:$montant:$amort_comp:$amort_except}}
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{:assign montant="%f+%f"|math:$_GET.amort_amount:$amort_comp}}
|
||||
{{if $code == $code_amort}}
|
||||
{{:assign montant="%f+%f"|math:$montant:$amort_comp}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
<td>{{$montant|money_currency_html:false|raw}}</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
{{:assign account=null}}
|
||||
{{/foreach}}
|
||||
{{if $montant_cession > 0 && $valeur_nette > 0}}
|
||||
<tr>
|
||||
<td>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue