{{:admin_header title="Gestion des amortissements" custom_css=$custom_css current="module_amortissement"}} {{* barre de navigation *}} {{:include file="_nav.html" current="amortissements"}} {{* récupérer les infos de l'immobilisation *}} {{#load type="immo" assign="info_immo" where="$$.line = :line_id" :line_id=$_GET.line|intval}} {{else}} {{:assign message="Immobilisation %s non trouvée"|args:$_GET.line}} {{:error message=$message}} {{/load}} {{* ["info_immo"]=> array(5) { ["id"]=> int(3) ["key"]=> string(36) "e0b5a8ab-b123-48ca-9a4c-8f623315818b" ["type"]=> string(4) "immo" ["line"]=> int(3890) ["duration"]=> int(5) } *}} {{#select line.id as line_id, trans.id as trans_id, line.debit as montant, trans.label as label, trans.date as date_achat, y.end_date as date_fin from acc_transactions_lines as line inner join acc_transactions as trans on line.id_transaction = trans.id inner join acc_years as y on trans.id_year = y.id where line.id = :line_id; :line_id = $_GET.line|intval assign=ligne_immo }}

Amortissement de « {{$label}} » d'un montant de {{"%f"|math:$montant|money_currency}} en date du {{$date_achat|date_short}}

{{else}} {{:assign message="Immobilisation %s non trouvée"|args:$_GET.line}} {{:error message=$message}} {{/select}} {{* calculer les amortissements *}} {{* :debug montant=$ligne_immo.montant *}} {{* montant de l'annuité normale *}} {{:assign montant="%d"|math:$ligne_immo.montant|money}} {{:assign annuite="%d/%d"|math:$montant:$info_immo.duration|intval}} {{* :debug annuite=$annuite *}} {{* première annuité *}} {{:assign date_achat=$ligne_immo.date_achat|date_short}} {{:assign date_fin=$ligne_immo.date_fin|date_short}} {{:include file="_calcul_dates.html" date_debut=$date_achat date_fin=$date_fin keep="nbjours"}} {{:assign annuite_1="%d/360*%d"|math:$annuite:$nbjours|intval}} {{* :debug annuite1=$annuite_1 *}} {{:assign date_immo=$date_fin}} {{:assign annuite_courante=$annuite_1}} {{:assign solde=$montant}} {{#foreach count="%d+1"|math:$info_immo.duration|intval key="num"}} {{:assign solde="%d-%d"|math:$solde:$annuite_courante}} {{:assign annuite_courante="min(%d,%d)"|math:$annuite:$solde}} {{:assign jour=$date_immo|date:"d"}} {{:assign mois=$date_immo|date:"m"}} {{:assign annee=$date_immo|date:"Y"}} {{:assign annee="%d+1"|math:$annee}} {{:assign date_immo="%s/%s/%s"|args:$jour:$mois:$annee|parse_date|date_short}} {{* :debug date_immo=$date_immo *}} {{/foreach}}
Date Annuité Solde
{{"%d+1"|math:$num}} {{$date_immo}} {{"%f*100"|math:$annuite_courante|money}} {{"%f*100"|math:$solde|money}}

Liste des amortissements

{{#select line.id as l_immo, line2.debit as montant, line2.label as libelle, links.id_transaction as t_amort, line2.id as l_amort, line2.id_transaction as trans_id, line2.id_project as projet, line2.id_account as compte, trans.date as date_achat, acc.code, acc.label as nom_compte, acc.id_chart as PC from acc_transactions_lines as line inner JOIN acc_transactions_links as links on line.id_transaction = links.id_related inner JOIN acc_transactions_lines as line2 on links.id_transaction = line2.id_transaction inner join acc_accounts as acc on line2.id_account = acc.id inner join acc_transactions as trans on line2.id_transaction = trans.id where line.id = :line_id and line2.debit <> 0 order by trans.date; :line_id = $info_immo.line|intval assign=lines. }} {{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$trans_id}} {{/select}}
Date Montant Libellé ligne amort Compte Nom compte
#{{$trans_id}} {{$date_achat|date_short}} {{"%f"|math:$montant|money}} {{$libelle}} {{$l_amort}} {{$compte}} {{$nom_compte}}
{{* :debug lines=$lines *}} {{* :form_errors *}} {{:admin_footer}}