Sortie de bilan : cas où les amortissements sont dans des comptes différents
This commit is contained in:
parent
d0807b2c9c
commit
7ddbf4748d
4 changed files with 75 additions and 49 deletions
107
write_exit.html
107
write_exit.html
|
|
@ -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
|
||||
}}
|
||||
{{:assign
|
||||
var="lines."
|
||||
account=$amort_account_code
|
||||
debit="(%f-%f)/100"|math:$ligne_immo.amount:$valeur_nette
|
||||
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=$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,24 +496,32 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
{{:input
|
||||
type="list"
|
||||
name="amort_sortie_account"
|
||||
target="!acc/charts/accounts/selector.php?codes=%s&id_chart=%s"|args:"28*":$chart_id
|
||||
readonly=true
|
||||
default=$amort_account
|
||||
}}
|
||||
</td>
|
||||
{{if $montant_cession == 0}}
|
||||
{{:assign montant=$ligne_immo.amount}}
|
||||
{{else}}
|
||||
{{:assign montant="%f+%f"|math:$_GET.amort_amount:$amort_comp}}
|
||||
{{/if}}
|
||||
<td>{{$montant|money_currency_html:false|raw}}</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
{{#foreach from=$sommes_amort key="code" item="montant"}}
|
||||
{{:assign var="account.%s"|args:$code from="amort_account.%s"|args:$code}}
|
||||
<tr>
|
||||
<td>
|
||||
{{:input
|
||||
type="list"
|
||||
name="amort_sortie_account"
|
||||
target="!acc/charts/accounts/selector.php?codes=%s&id_chart=%s"|args:"28*":$chart_id
|
||||
readonly=true
|
||||
default=$account
|
||||
}}
|
||||
</td>
|
||||
{{if $montant_cession == 0}}
|
||||
{{if $code == $code_amort}}
|
||||
{{:assign montant="%f+%f+%f"|math:$montant:$amort_comp:$amort_except}}
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{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