diff --git a/amortization.html b/amortization.html index 63d54ad..f8d9e0d 100644 --- a/amortization.html +++ b/amortization.html @@ -172,139 +172,148 @@ {{/if}} -{{:assign project_id=$ligne_immo.project_id}} -{{:assign project_label=$ligne_immo.project_label}} -{{:assign nbamort="%d-%d"|math:$duree:$nbamort}} - -
-

Amortissements à enregistrer

- - - - - - - - - - - - - {{#foreach count="%d+1"|math:$nbamort key="num"}} - {{:assign solde="%f-%d"|math:$solde:$annuite_courante}} - {{#select id from acc_years where :amort_date >= start_date and :amort_date <= end_date and closed = 0; :amort_date=$date_amort|parse_date}} - {{:assign enregistrer=1}} - {{:assign current_year=$id}} - {{else}} - {{:assign enregistrer=0}} - {{/select}} +{{if $solde > 0}} + {{:assign project_id=$ligne_immo.project_id}} + {{:assign project_label=$ligne_immo.project_label}} + {{:assign nbamort="%d-%d"|math:$duree:$nbamort}} + {{:assign annuite_courante="min(%f,%f)"|math:$annuite:$solde}} +
+

Amortissements à enregistrer

+
DateMontantSoldeLibellé
+ - - - - - - + + + + + + - {{:assign jour=$date_amort|date:"d"}} - {{:assign mois=$date_amort|date:"m"}} - {{:assign annee=$date_amort|date:"Y"}} - {{:assign annee="%d+1"|math:$annee}} - {{:assign date_amort="%s/%s/%s"|args:$jour:$mois:$annee|parse_date|date_short}} - {{:assign annuite_courante="min(%f,%f)"|math:$annuite:$solde}} - {{if $solde == 0}}{{:break}}{{/if}} - {{/foreach}} - -
{{"%d+1"|math:$num}}{{$date_amort}}{{"%f"|math:$annuite_courante|money}}{{if $solde == 0}}0,00{{else}}{{"%f"|math:$solde|money}}{{/if}} - {{if $libelle == null}} - {{:assign libelle="Amortissement "|cat:$ligne_immo.label}} - {{/if}} - {{$libelle}} - - {{if $enregistrer == 1}} - {{:linkbutton - label="Enregistrer" - href="save_amort.html?amount=%d&account=%s&year=%s&trans_id=%d&immo_id=%s&project_id=%d&label=%s"|args:$annuite_courante:$ligne_immo.account_id:$current_year:$ligne_immo.trans_id:$_GET.immo_id:$project_id:$libelle - shape="right" - target="_dialog" - }} - {{else}} - {{:linkbutton label="Enregistrer" href="" shape="lock" class="disabled"}} - {{/if}} - DateMontantSoldeLibellé
-
- -
-

Autres amortissements non rattachés

- - - - - - - - - - - - - - - {{#select - li.id as l_id, - li.id_transaction as t_id, - li.credit as montant, - li.reference, - li.label as l_label, - trans.date as t_date, - trans.label as t_label, - acc.code as a_code, - acc.label as a_label, - y.label as y_label - from acc_transactions_lines as li - inner join acc_accounts as acc on acc.id = li.id_account - inner join acc_transactions as trans on trans.id = li.id_transaction - inner join acc_years as y on y.id = trans.id_year - where acc.code like "28%" - order by trans.date, trans.label - }} - {{:assign linked="false"}} - {{#select - id_transaction, - id_related - from acc_transactions_links - where id_transaction = :id_amort or id_related = :id_amort; - :id_amort=$t_id}} - {{:assign linked="true"}} - {{/select}} - - {{if $linked != "true"}} - {{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$t_id}} + + + {{#foreach count="%d+1"|math:$nbamort key="num"}} + {{:assign solde="%f-%d"|math:$solde:$annuite_courante}} + {{#select id from acc_years where :amort_date >= start_date and :amort_date <= end_date and closed = 0; :amort_date=$date_amort|parse_date}} + {{:assign enregistrer=1}} + {{:assign current_year=$id}} + {{else}} + {{:assign enregistrer=0}} + {{/select}} - - - - + + + + + + + {{:assign jour=$date_amort|date:"d"}} + {{:assign mois=$date_amort|date:"m"}} + {{:assign annee=$date_amort|date:"Y"}} + {{:assign annee="%d+1"|math:$annee}} + {{:assign date_amort="%s/%s/%s"|args:$jour:$mois:$annee|parse_date|date_short}} + {{:assign annuite_courante="min(%f,%f)"|math:$annuite:$solde}} + {{if $solde == 0}}{{:break}}{{/if}} + {{/foreach}} + +
DateMontantLibelléN° compteCompte
#{{$t_id}}{{$t_date|date_short}}{{"%f"|math:$montant|money}}{{if $l_label == null}} - {{$t_label}} + {{"%d+1"|math:$num}}{{$date_amort}}{{"%f"|math:$annuite_courante|money}}{{if $solde == 0}}0,00{{else}}{{"%f"|math:$solde|money}}{{/if}} + {{if $libelle == null}} + {{:assign libelle="Amortissement "|cat:$ligne_immo.label}} + {{/if}} + {{$libelle}} + + {{if $enregistrer == 1}} + {{:linkbutton + label="Enregistrer" + href="save_amort.html?amount=%d&account=%s&year=%s&trans_id=%d&immo_id=%s&project_id=%d&label=%s"|args:$annuite_courante:$ligne_immo.account_id:$current_year:$ligne_immo.trans_id:$_GET.immo_id:$project_id:$libelle + shape="right" + target="_dialog" + }} + {{else}} + {{:linkbutton label="Enregistrer" href="" shape="lock" class="disabled"}} + {{/if}} +
+
+{{/if}} + +{{* Autres amortissements non rattachés *}} +{{#select + li.id as l_id, + li.id_transaction as t_id, + li.credit as montant, + li.reference, + li.label as l_label, + trans.date as t_date, + trans.label as t_label, + acc.code as a_code, + acc.label as a_label, + y.label as y_label + from acc_transactions_lines as li + inner join acc_accounts as acc on acc.id = li.id_account + inner join acc_transactions as trans on trans.id = li.id_transaction + inner join acc_years as y on y.id = trans.id_year + where acc.code like "28%" + order by trans.date, trans.label; + assign=autre_amort +}} + {{:assign linked="false"}} + {{#select + id_transaction, + id_related + from acc_transactions_links + where id_transaction = :id_amort or id_related = :id_amort; + :id_amort=$t_id + }} + {{:assign var=autre_amort.linked value="true"}} + {{else}} + {{:assign var="autres_amortissements." value=$autre_amort}} + {{/select}} +{{/select}} + +{{if $autres_amortissements != null}} +
+

Autres amortissements non rattachés

+ + + + + + + + + + + + + + + {{#foreach from=$autres_amortissements item="line"}} + {{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.t_id}} + + + + + - - + + - {{/if}} - {{/select}} - -
DateMontantLibelléN° compteCompte
#{{$line.t_id}}{{$line.t_date|date_short}}{{"%f"|math:$line.montant|money}}{{if $line.l_label == null}} + {{$line.t_label}} {{else}} - {{$l_label}} + {{$line.l_label}} {{/if}} {{$a_code}}{{$a_label}}{{$line.a_code}}{{$line.a_label}} {{if $linked != "true"}} - {{:linkbutton label="Attacher" href="attach_amort.html?amort_id=%d&immo_id=%d"|args:$l_id:$ligne_immo.immo_id shape="plus"}} + {{:linkbutton label="Attacher" href="attach_amort.html?amort_id=%d&immo_id=%d"|args:$line.l_id:$ligne_immo.immo_id shape="plus"}} {{else}} {{:linkbutton label="Attacher" href="" shape="lock" class="disabled"}} {{/if}}
-
+ {{/foreach}} + + + +{{/if}} {{:form_errors}} {{:admin_footer}}