Compare commits
No commits in common. "c427e8900f3b1c8e1864dadc49ec885ea32ed701" and "91ec943e6d7a920a9229f513eca6c492401518f0" have entirely different histories.
c427e8900f
...
91ec943e6d
6 changed files with 131 additions and 167 deletions
|
|
@ -185,7 +185,7 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:input id="amortir" type="checkbox" value=1 name="amortir" label="Amortir cette immobilisation sur une ou plusieurs années" checked="%s"|args:$checked help="Dé-cocher pour ne pas amortir"}}
|
{{:input id="amortir" type="checkbox" value=1 name="amortir" label="Amortir cette immobilisation sur une ou plusieurs années" checked="%s"|args:$checked help="Dé-cocher pour ne pas amortir"}}
|
||||||
<div class="masquable">
|
<div class="masquable">
|
||||||
{{: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}}
|
||||||
</div>
|
</div>
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
|
||||||
|
|
@ -190,12 +190,6 @@
|
||||||
<dd><span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.immo_trans_id}}</a></span> {{$label_immo}}</dd>
|
<dd><span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.immo_trans_id}}</a></span> {{$label_immo}}</dd>
|
||||||
<dt>Compte d'immobilisation</dt>
|
<dt>Compte d'immobilisation</dt>
|
||||||
<dd>{{$ligne_immo.account_code}} — {{$ligne_immo.account_label}}</dd>
|
<dd>{{$ligne_immo.account_code}} — {{$ligne_immo.account_label}}</dd>
|
||||||
<dt>Début d'amortissement</dt>
|
|
||||||
<dd>{{$date_debut|date_short}}</dd>
|
|
||||||
{{if $info_immo.duration != null}}
|
|
||||||
<dt>Durée</dt>
|
|
||||||
<dd>{{$info_immo.duration}} ans</dd>
|
|
||||||
{{/if}}
|
|
||||||
<dt>Montant de l'immobilisation</dt>
|
<dt>Montant de l'immobilisation</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 $total_credits > 0}}
|
{{if $total_credits > 0}}
|
||||||
|
|
@ -204,10 +198,16 @@
|
||||||
<dt>Montant à amortir</dt>
|
<dt>Montant à amortir</dt>
|
||||||
<dd class="money strong">{{"%f"|math:$solde|money_currency_html:false|raw}}</dd>
|
<dd class="money strong">{{"%f"|math:$solde|money_currency_html:false|raw}}</dd>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
<dt>Début d'amortissement</dt>
|
||||||
|
<dd>{{$date_debut|date_short}}</dd>
|
||||||
|
{{if $info_immo.duration != null}}
|
||||||
|
<dt>Durée</dt>
|
||||||
|
<dd>{{$info_immo.duration}} ans</dd>
|
||||||
|
{{/if}}
|
||||||
{{if $valeur_residuelle > 0}}
|
{{if $valeur_residuelle > 0}}
|
||||||
<dt>Montant des amortissements</dt>
|
<dt>Montant des amortissements</dt>
|
||||||
<dd>{{"%d-%d"|math:$solde:$valeur_residuelle|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 comptable</dt>
|
||||||
<dd>{{$valeur_residuelle|money_currency_html:false|raw}}</dd>
|
<dd>{{$valeur_residuelle|money_currency_html:false|raw}}</dd>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{if $info_immo.duration != null && $valeur_residuelle > 0}}
|
{{if $info_immo.duration != null && $valeur_residuelle > 0}}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
{{*
|
{{*
|
||||||
Sortir une immobilisation du bilan
|
Sortir une immobilisation du bilan
|
||||||
@param immo_line_id : id de la ligne d'immobilisation
|
@param immo_line_id : id de la ligne d'immobilisation
|
||||||
@param immo_doc_id : id du doc associé à l'immo
|
|
||||||
*}}
|
*}}
|
||||||
|
|
||||||
{{* Infos de l'immobilisation *}}
|
{{* Infos de l'immobilisation *}}
|
||||||
|
|
@ -21,120 +20,110 @@
|
||||||
assign="ligne_immo"
|
assign="ligne_immo"
|
||||||
}}
|
}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:error message="Immobilisation non trouvée"}}
|
{{:error message="Immobilisation %s non trouvée"|args:$_GET.immo_line_id}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
|
|
||||||
{{:assign date_debut=$ligne_immo.date_achat}}
|
{{:assign date_debut=$ligne_immo.date_achat}}
|
||||||
{{:assign ts_mes=$ligne_immo.date_achat|strtotime}}
|
{{:assign ts_mes=$ligne_immo.date_achat|strtotime}}
|
||||||
|
|
||||||
{{* TODO : traiter le cas des immos sans doc *}}
|
{{#load type="immo" assign="info_immo" where="$$.line = :line_id" :line_id=$_GET.immo_line_id|intval}}
|
||||||
{{#load id=$_GET.immo_doc_id|intval assign="info_immo"}}
|
{{:assign ts_mes=$date|strtotime}}
|
||||||
{{:assign ts_mes=$date_mes|strtotime}}
|
{{:assign date_debut=$date}}
|
||||||
{{if $date_mes != null}}
|
|
||||||
{{:assign date_debut=$date_mes}}
|
|
||||||
{{/if}}
|
|
||||||
{{:assign duree_amort=$duration}}
|
{{:assign duree_amort=$duration}}
|
||||||
{{if $amount != null}}
|
|
||||||
{{:assign var="ligne_immo.montant" value=$amount}}
|
|
||||||
{{/if}}
|
|
||||||
{{else}}
|
|
||||||
{{* TODO *}}
|
|
||||||
{{:error message="Immobilisation non trouvée"}}
|
|
||||||
{{/load}}
|
{{/load}}
|
||||||
|
|
||||||
{{* chercher des écritures liées à l'immo courante au crédit du même compte
|
{{* chercher des écritures liées à l'immo courante au crédit du même compte
|
||||||
et déduire leur montant de celui de l'immo
|
et déduire leur montant de celui de l'immo
|
||||||
*}}
|
*}}
|
||||||
{{:assign total_credits=0}}
|
{{:assign total_credits=0}}
|
||||||
{{#load
|
{{#select
|
||||||
type="credit_link"
|
CASE links.id_related = :immo_trans_id
|
||||||
where="$$.immo_doc_id = :immo_doc_id"
|
WHEN true THEN links.id_transaction
|
||||||
:immo_doc_id = $info_immo.id
|
WHEN false THEN links.id_related
|
||||||
assign="credit_link"
|
END as other_id,
|
||||||
|
line.credit
|
||||||
|
FROM acc_transactions AS trans
|
||||||
|
INNER JOIN acc_transactions_links as links
|
||||||
|
ON (trans.id = links.id_transaction OR trans.id = links.id_related)
|
||||||
|
INNER JOIN acc_transactions_lines AS line on line.id_transaction = other_id
|
||||||
|
INNER JOIN acc_accounts AS acc ON line.id_account = acc.id
|
||||||
|
WHERE trans.id = :immo_trans_id AND line.credit > 0 AND acc.code = :account;
|
||||||
|
:immo_trans_id=$ligne_immo.trans_id
|
||||||
|
:account=$ligne_immo.account_code
|
||||||
}}
|
}}
|
||||||
{{if $amount == null}}
|
{{:assign total_credits="%d+%d"|math:$total_credits:$credit}}
|
||||||
{{#select credit FROM acc_transactions_lines WHERE id = :credit_line_id;
|
{{/select}}
|
||||||
:credit_line_id=$credit_line_id
|
|
||||||
}}
|
|
||||||
{{:assign total_credits="%d+%d"|math:$total_credits:$credit}}
|
|
||||||
{{/select}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign total_credits="%d+%d"|math:$total_credits:$amount}}
|
|
||||||
{{/if}}
|
|
||||||
{{else}}
|
|
||||||
{{* pas de doc => voir liaison écritures *}}
|
|
||||||
{{#select
|
|
||||||
CASE links.id_related = :immo_trans_id
|
|
||||||
WHEN true THEN links.id_transaction
|
|
||||||
WHEN false THEN links.id_related
|
|
||||||
END as other_id,
|
|
||||||
line.credit
|
|
||||||
FROM acc_transactions AS trans
|
|
||||||
INNER JOIN acc_transactions_links as links
|
|
||||||
ON (trans.id = links.id_transaction OR trans.id = links.id_related)
|
|
||||||
INNER JOIN acc_transactions_lines AS line on line.id_transaction = other_id
|
|
||||||
INNER JOIN acc_accounts AS acc ON line.id_account = acc.id
|
|
||||||
WHERE trans.id = :immo_trans_id AND line.credit > 0 AND acc.code = :account;
|
|
||||||
:immo_trans_id=$ligne_immo.trans_id
|
|
||||||
:account=$ligne_immo.account_code
|
|
||||||
}}
|
|
||||||
{{:assign total_credits="%d+%d"|math:$total_credits:$credit}}
|
|
||||||
{{/select}}
|
|
||||||
{{/load}}
|
|
||||||
{{:assign var="ligne_immo.montant" value="%d-%d"|math:$ligne_immo.montant:$total_credits}}
|
{{:assign var="ligne_immo.montant" value="%d-%d"|math:$ligne_immo.montant:$total_credits}}
|
||||||
|
|
||||||
|
{{* chercher des écritures d'amortissement liées à l'immobilisation *}}
|
||||||
{{:assign total_amort=0}}
|
{{:assign total_amort=0}}
|
||||||
{{#load type="amort_link"
|
{{:assign amort_number=0}}
|
||||||
where="$$.immo_doc_id = :immo_doc_id"
|
{{#select
|
||||||
:immo_doc_id = $_GET.immo_doc_id|intval
|
l_amort.credit as amort_amount,
|
||||||
|
l_amort.id as amort_line_id,
|
||||||
|
CASE
|
||||||
|
WHEN links.id_related = t_immo.id
|
||||||
|
THEN links.id_transaction
|
||||||
|
ELSE links.id_related
|
||||||
|
END as amort_trans_id,
|
||||||
|
trans.date
|
||||||
|
FROM acc_transactions_lines as l_immo
|
||||||
|
INNER JOIN acc_transactions as t_immo on t_immo.id = l_immo.id_transaction
|
||||||
|
INNER JOIN acc_transactions_links as links
|
||||||
|
ON (t_immo.id = links.id_transaction OR t_immo.id = links.id_related)
|
||||||
|
INNER JOIN acc_transactions_lines as l_amort on amort_trans_id = l_amort.id_transaction
|
||||||
|
INNER join acc_transactions as trans on l_amort.id_transaction = trans.id
|
||||||
|
INNER JOIN acc_accounts AS account ON l_amort.id_account = account.id
|
||||||
|
WHERE l_immo.id = :line_id AND account.code LIKE '28%'
|
||||||
|
;
|
||||||
|
:line_id = $_GET.immo_line_id|intval
|
||||||
|
assign="amort_line"
|
||||||
}}
|
}}
|
||||||
{{#select
|
|
||||||
line.id as amort_line_id,
|
|
||||||
line.credit,
|
|
||||||
line.label as amort_line_label,
|
|
||||||
trans.id as amort_trans_id,
|
|
||||||
trans.label as amort_trans_label,
|
|
||||||
trans.date as amort_date,
|
|
||||||
trans.id_year as amort_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_transactions AS trans ON line.id_transaction = trans.id
|
|
||||||
INNER join acc_accounts AS account on line.id_account = account.id
|
|
||||||
WHERE line.id = :amort_line_id
|
|
||||||
;
|
|
||||||
:amort_line_id = $amort_line_id
|
|
||||||
assign="amort_line"
|
|
||||||
}}
|
|
||||||
{{:assign var="amort_line.amort_amount" value=$amount|or:$credit}}
|
|
||||||
{{:assign total_amort="%d+%d"|math:$total_amort:$amort_line.amort_amount}}
|
|
||||||
{{:assign var="linked_amort.%s_%d"|args:$amort_date:$id value=$amort_line}}
|
|
||||||
{{/select}}
|
|
||||||
{{/load}}
|
|
||||||
{{:assign amort_number=$linked_amort|count}}
|
|
||||||
|
|
||||||
{{#foreach from=$linked_amort|ksort item="line"}}
|
{{#load type="link"
|
||||||
{{if $first_amort_date == null}}
|
where="$$.immo_line_id = :immo_line_id AND $$.amort_trans_id = :amort_trans_id"
|
||||||
{{:assign first_amort_date=$line.amort_date}}
|
assign="line"
|
||||||
{{/if}}
|
:immo_line_id=$_GET.immo_line_id|intval :amort_trans_id=$amort_line.amort_trans_id
|
||||||
{{if $last_amort_date == null}}
|
}}
|
||||||
{{:assign last_amort_date=$line.amort_date}}
|
{{if $line.amort_line_id == $amort_line.amort_line_id}}
|
||||||
{{elseif $line.amort_date > $last_amort_date}}
|
{{:assign amort_number="%d+1"|math:$amort_number}}
|
||||||
{{:assign last_amort_date=$line.amort_date}}
|
{{:assign total_amort="%d+%d"|math:$total_amort:$amort_line.amort_amount}}
|
||||||
{{/if}}
|
{{if $first_amort_date == null}}
|
||||||
{{/foreach}}
|
{{:assign first_amort_date=$amort_line.date}}
|
||||||
|
{{elseif $amort_line.date < $first_amort_date}}
|
||||||
|
{{:assign first_amort_date=$amort_line.date}}
|
||||||
|
{{/if}}
|
||||||
|
{{if $last_amort_date == null}}
|
||||||
|
{{:assign last_amort_date=$amort_line.date}}
|
||||||
|
{{elseif $amort_line.date > $last_amort_date}}
|
||||||
|
{{:assign last_amort_date=$amort_line.date}}
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign amort_number="%d+1"|math:$amort_number}}
|
||||||
|
{{:assign total_amort="%d+%d"|math:$total_amort:$amort_line.amort_amount}}
|
||||||
|
{{if $first_amort_date == null}}
|
||||||
|
{{:assign first_amort_date=$amort_line.date}}
|
||||||
|
{{elseif $amort_line.date < $first_amort_date}}
|
||||||
|
{{:assign first_amort_date=$amort_line.date}}
|
||||||
|
{{/if}}
|
||||||
|
{{if $last_amort_date == null}}
|
||||||
|
{{:assign last_amort_date=$amort_line.date}}
|
||||||
|
{{elseif $amort_line.date > $last_amort_date}}
|
||||||
|
{{:assign last_amort_date=$amort_line.date}}
|
||||||
|
{{/if}}
|
||||||
|
{{/load}}
|
||||||
|
{{/select}}
|
||||||
|
|
||||||
{{if $total_amort == 0}}
|
{{if $total_amort == 0}}
|
||||||
{{if $info_immo.status == "amortized"}}
|
{{if $info_immo.status == "amortized"}}
|
||||||
{{:assign total_amort=$ligne_immo.montant}}
|
{{:assign total_amort=$ligne_immo.montant}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign date_debut=$last_amort_date}}
|
{{:assign date_debut=$last_amort_date|strtotime}}
|
||||||
|
{{:assign date_debut="%d+(60*60*24)"|math:$date_debut|date:"Y-m-d"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:assign ts_debut=$date_debut|strtotime}}
|
{{:assign ts_debut=$date_debut|strtotime}}
|
||||||
{{:assign ts_debut="%d+(60*60*24)"|math:$ts_debut}}
|
|
||||||
{{:assign date_debut=$ts_debut|date:"Y-m-d"}}
|
|
||||||
{{:assign valeur_nette="%f-%f"|math:$ligne_immo.montant:$total_amort}}
|
{{:assign valeur_nette="%f-%f"|math:$ligne_immo.montant:$total_amort}}
|
||||||
|
|
||||||
{{*
|
{{*
|
||||||
|
|
@ -150,8 +139,7 @@
|
||||||
{{:assign fin=$end_date|date_short}}
|
{{:assign fin=$end_date|date_short}}
|
||||||
{{: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}}
|
{{:error message="Aucun exercice ouvert pour enregistrer un amortissement"}}
|
||||||
{{: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}}
|
||||||
|
|
@ -190,9 +178,9 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{* vérifier la validité de la date de sortie *}}
|
{{* vérifier la validité de la date de sortie *}}
|
||||||
{{if $info_immo.date_mes != null}}
|
{{if $info_immo.date != null}}
|
||||||
{{if $_POST.date_sortie|parse_date < $info_immo.date_mes}}
|
{{if $_POST.date_sortie|parse_date < $info_immo.date}}
|
||||||
{{:assign immo_date=$info_immo.date_mes|date_short}}
|
{{:assign immo_date=$info_immo.date|date_short}}
|
||||||
{{:error message="La date de sortie doit être postérieure à la date de mise en service de l'immobilisation (%s)"|args:$immo_date}}
|
{{:error message="La date de sortie doit être postérieure à la date de mise en service de l'immobilisation (%s)"|args:$immo_date}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{elseif $_POST.date_mes != null}}
|
{{elseif $_POST.date_mes != null}}
|
||||||
|
|
@ -208,34 +196,31 @@
|
||||||
{{:error message="La date de sortie doit être postérieure à la date du dernier amortissement (%s)"|args:$last_amort_date}}
|
{{:error message="La date de sortie doit être postérieure à la date du dernier amortissement (%s)"|args:$last_amort_date}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
{{* vérifier que la date de sortie est située dans un exercice ouvert *}}
|
||||||
{{:assign ts_exit = $_POST.date_sortie|parse_date|strtotime}}
|
{{:assign ts_exit = $_POST.date_sortie|parse_date|strtotime}}
|
||||||
{{:assign exercice_ok=false}}
|
{{:assign ok=false}}
|
||||||
{{* vérifier que la date de sortie est dans l'exercice choisi *}}
|
{{:assign msg_amort=""}}
|
||||||
{{#foreach from=$years item="current_year"}}
|
{{#foreach from=$years}}
|
||||||
{{if $current_year.id == $_POST.id_year}}
|
{{if $id == $_POST.id_year}}
|
||||||
{{:assign selected_year=$current_year.id}}
|
{{:assign selected_year=$id}}
|
||||||
{{if $start_date|strtotime <= $ts_exit && $ts_exit <= $end_date|strtotime}}
|
{{if $start_date|strtotime <= $ts_exit && $ts_exit <= $end_date|strtotime}}
|
||||||
{{:assign current_year=$current_year}}
|
{{:assign ok=true}}
|
||||||
{{:assign exercice_ok=true}}
|
|
||||||
{{:break}}
|
{{:break}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
{{* voir si des amortissements ont été oubliés *}}
|
||||||
|
{{if $valeur_nette > 0 && $info_immo.status != "amortized" && $start_date|strtotime > $last_amort_date|strtotime && $end_date|strtotime < $now}}
|
||||||
|
{{:assign debut=$start_date|date_short}}
|
||||||
|
{{:assign fin=$end_date|date_short}}
|
||||||
|
{{:assign msg_amort=$msg_amort|cat:"\n"|cat:" - "|cat:$label|cat:" : du "|cat:$debut|cat:" au "|cat:$fin}}
|
||||||
|
{{/if}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
{{if ! $exercice_ok}}
|
{{if ! $ok}}
|
||||||
{{:error message="La date choisie n'est pas dans l'exercice sélectionné !"}}
|
{{:error message="La date choisie n'est pas dans l'exercice sélectionné !"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{if $msg_amort != ""}}
|
||||||
{{* voir si des amortissements ont été oubliés *}}
|
{{:error message="Vous devez d'abord enregistrer les amortissements des exercices suivants : %s"|args:$msg_amort}}
|
||||||
{{if $valeur_nette > 0 && $info_immo.status != "amortized"}}
|
|
||||||
{{if $current_year.start_date <= $date_debut && $date_debut <= $current_year.end_date}}
|
|
||||||
{{:assign amort_ok=true}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign amort_ok=false}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{if ! $amort_ok}}
|
|
||||||
{{:error message="Vous devez d'abord enregistrer les amortissements des exercices précédents"}}
|
|
||||||
{{/if}}
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{:redirect to="compute_exit_data.html?immo_line_id=%s&amort_amount=%s&year=%s&date_mes=%s&date_debut=%s&exit_date=%s&duree_amort=%s"|args:$_GET.immo_line_id:$total_amort:$selected_year:$ts_mes:$ts_debut:$ts_exit:$duree_amort}}
|
{{:redirect to="compute_exit_data.html?immo_line_id=%s&amort_amount=%s&year=%s&date_mes=%s&date_debut=%s&exit_date=%s&duree_amort=%s"|args:$_GET.immo_line_id:$total_amort:$selected_year:$ts_mes:$ts_debut:$ts_exit:$duree_amort}}
|
||||||
|
|
@ -258,10 +243,10 @@
|
||||||
<dt>Montant</dt>
|
<dt>Montant</dt>
|
||||||
<dd id="montant_immo" class="money">{{$ligne_immo.montant|money_currency_html:false|raw}}</dd>
|
<dd id="montant_immo" class="money">{{$ligne_immo.montant|money_currency_html:false|raw}}</dd>
|
||||||
<dt>Date d'acquisition</dt>
|
<dt>Date d'acquisition</dt>
|
||||||
<dd>{{$info_immo.date_achat|or:$ligne_immo.date_achat|date_short}}</dd>
|
<dd >{{$ligne_immo.date_achat|date_short}}</dd>
|
||||||
{{if $info_immo.date_mes != null && $info_immo.date_mes != $ligne_immo.date_achat}}
|
{{if $info_immo.date != null && $info_immo.date != $ligne_immo.date_achat}}
|
||||||
<dt>Date de mise en service</dt>
|
<dt>Date de mise en service</dt>
|
||||||
<dd>{{$info_immo.date_mes|date_short}}</dd>
|
<dd>{{$info_immo.date|date_short}}</dd>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{if $info_immo.duration != null}}
|
{{if $info_immo.duration != null}}
|
||||||
<dt>Durée de l'amortissement</dt>
|
<dt>Durée de l'amortissement</dt>
|
||||||
|
|
@ -271,23 +256,23 @@
|
||||||
<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>
|
<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>
|
<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>
|
<dd class="money">{{$valeur_nette|money_currency_html:false|raw}} <span class="help">(à la date de début de l'exercice)</span></dd>
|
||||||
{{if $last_amort_date != null}}
|
|
||||||
<dt>Date du dernier amortissement</dt>
|
|
||||||
<dd>{{$last_amort_date|date_short}}</dd>
|
|
||||||
{{/if}}
|
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
{{if $valeur_nette > 0}}
|
||||||
{{if $info_immo == null && $total_amort == 0 }}
|
{{if $info_immo.date == null || $info_immo.duration == null}}
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Autres informations</legend>
|
<legend>Informations sur l'immobilisation</legend>
|
||||||
<dl>
|
<dl>
|
||||||
{{: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"}}
|
{{if $info_immo.date == null}}
|
||||||
{{:input type="number" name="duree" label="Durée d'amortissement" required=true min=1 help="La durée est nécessaire pour calculer l'amortissement complémentaire"}}
|
{{: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"}}
|
||||||
</dl>
|
{{/if}}
|
||||||
</fieldset>
|
{{if $info_immo.duration == null}}
|
||||||
|
{{:input type="number" name="duree" label="Durée d'amortissement" required=true min=1 help="La durée est nécessaire pour calculer l'amortissement complémentaire"}}
|
||||||
|
{{/if}}
|
||||||
|
</dl>
|
||||||
|
</fieldset>
|
||||||
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Informations de sortie</legend>
|
<legend>Informations de sortie</legend>
|
||||||
<dl>
|
<dl>
|
||||||
|
|
|
||||||
|
|
@ -200,7 +200,7 @@
|
||||||
{{if $total_amort > 0}}
|
{{if $total_amort > 0}}
|
||||||
<dt>Montant des amortissements</dt>
|
<dt>Montant des amortissements</dt>
|
||||||
<dd>{{$total_amort|money_currency_html:false|raw}}</dd>
|
<dd>{{$total_amort|money_currency_html:false|raw}}</dd>
|
||||||
<dt>Valeur nette résiduelle</dt>
|
<dt>Valeur nette comptable</dt>
|
||||||
<dd>{{"%d-%d-%d"|math:$info_immo.amount:$total_credits:$total_amort|money_currency_html:false|raw}}</dd>
|
<dd>{{"%d-%d-%d"|math:$info_immo.amount:$total_credits:$total_amort|money_currency_html:false|raw}}</dd>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</dl>
|
</dl>
|
||||||
|
|
|
||||||
|
|
@ -102,3 +102,8 @@ span.input-list.avoirs label {
|
||||||
aside.right {
|
aside.right {
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
span.label {
|
||||||
|
font-size : 120%;
|
||||||
|
font-weight : bold;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
{{*
|
{{*
|
||||||
Enregistrer les écritures de sortie du bilan
|
Enregistrer les écritures de sortie du bilan
|
||||||
paramètres :
|
paramètres :
|
||||||
- immo_line_id : numéro de ligne de l'écriture d'immobilisation
|
- immo_line_id : numéro de ligne de l'écriture d'immobilisation
|
||||||
- amort_amount : montant des amortissements
|
- amort_amount : montant des amortissements
|
||||||
- year : exercice de la date de sortie de l'immobilisation
|
- year : exercice de la date de sortie de l'immobilisation
|
||||||
- date_mes : date de mise en service de l'immobilisation
|
- date_mes : date de mise en service de l'immobilisation
|
||||||
|
|
@ -30,9 +30,6 @@
|
||||||
}}
|
}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
|
|
||||||
{{#load type="immo" assign="info_immo" where="$$.line = :line_id" :line_id=$_GET.immo_line_id|intval}}
|
|
||||||
{{/load}}
|
|
||||||
|
|
||||||
{{* chercher des écritures liées à l'immo courante au crédit du même compte
|
{{* chercher des écritures liées à l'immo courante au crédit du même compte
|
||||||
et déduire leur montant de celui de l'immo
|
et déduire leur montant de celui de l'immo
|
||||||
*}}
|
*}}
|
||||||
|
|
@ -164,18 +161,6 @@
|
||||||
lines=$lines
|
lines=$lines
|
||||||
linked_transactions=$ligne_immo.id_transaction
|
linked_transactions=$ligne_immo.id_transaction
|
||||||
}}
|
}}
|
||||||
{{#foreach from=$result.lines item="line"}}
|
|
||||||
{{* TODO : cas où pas de doc ? (info_immo = null) *}}
|
|
||||||
{{if $line.account_code == $amort_account_code}}
|
|
||||||
{{:save
|
|
||||||
key=""|uuid
|
|
||||||
type="amort_link"
|
|
||||||
immo_doc_id=$info_immo.id
|
|
||||||
amort_line_id=$line.id
|
|
||||||
}}
|
|
||||||
{{:break}}
|
|
||||||
{{/if}}
|
|
||||||
{{/foreach}}
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{* écriture de sortie du bilan *}}
|
{{* écriture de sortie du bilan *}}
|
||||||
|
|
@ -229,17 +214,6 @@
|
||||||
lines=$lines
|
lines=$lines
|
||||||
linked_transactions=$ligne_immo.id_transaction
|
linked_transactions=$ligne_immo.id_transaction
|
||||||
}}
|
}}
|
||||||
{{#foreach from=$result.lines item="line"}}
|
|
||||||
{{if $line.account_code == $immo_account_code}}
|
|
||||||
{{:save
|
|
||||||
key=""|uuid
|
|
||||||
type="exit_link"
|
|
||||||
immo_doc_id=$info_immo.id
|
|
||||||
exit_line_id=$line.id
|
|
||||||
}}
|
|
||||||
{{:break}}
|
|
||||||
{{/if}}
|
|
||||||
{{/foreach}}
|
|
||||||
|
|
||||||
{{if $montant_cession > 0}}
|
{{if $montant_cession > 0}}
|
||||||
{{* Cession de l'immobilisation *}}
|
{{* Cession de l'immobilisation *}}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue