Compare commits
No commits in common. "3738ea07219e5b787d19f9157a39f4a639403a82" and "f76c243b8c6c721d78f36ee8f0b3e714fff6608f" have entirely different histories.
3738ea0721
...
f76c243b8c
@ -6,16 +6,23 @@
|
||||
- date_fin
|
||||
résultat : nbjours
|
||||
*}}
|
||||
{{* pour simplifier : 30 jours par mois et 360 jours par an *}}
|
||||
|
||||
{{:assign ts_debut=$date_debut|strtotime}}
|
||||
{{:assign ts_fin=$date_fin|strtotime}}
|
||||
{{:assign nbjours="1+(%d-%d)/(60*60*24)"|math:$ts_fin:$ts_debut}}
|
||||
{{:assign jour_debut=$date_debut|date:"d"}}
|
||||
{{:assign jour_debut="min(%d, 30)"|math:$jour_debut}}
|
||||
{{:assign mois_debut=$date_debut|date:"m"}}
|
||||
{{:assign annee_debut=$date_debut|date:"Y"}}
|
||||
|
||||
{{:assign jour_fin=$date_fin|date:"d"}}
|
||||
{{:assign jour_fin="min(%d, 30)"|math:$jour_fin}}
|
||||
{{:assign mois_fin=$date_fin|date:"m"}}
|
||||
{{:assign annee_fin=$date_fin|date:"Y"}}
|
||||
|
||||
{{:assign nbjours="%d-%d"|math:$jour_fin:$jour_debut}}
|
||||
{{:assign nbjours="%d+(%d-%d)*30"|math:$nbjours:$mois_fin:$mois_debut}}
|
||||
{{:assign nbjours="%d+(%d-%d)*360"|math:$nbjours:$annee_fin:$annee_debut}}
|
||||
|
||||
{{* au cas où les deux dates seraient inversées ... *}}
|
||||
{{if $nbjours < 0}}
|
||||
{{:assign nbjours="-1*%d"|math:$nbjours}}
|
||||
{{/if}}
|
||||
{{* pour simplifier : 360 jours par an *}}
|
||||
{{if $nbjours > 360}}
|
||||
{{:assign nbjours=360}}
|
||||
{{/if}}
|
||||
|
@ -1,13 +0,0 @@
|
||||
{{* -*- brindille -*- *}}
|
||||
{{*
|
||||
Rend une date située un an après la date paramètre
|
||||
paramètres :
|
||||
- date
|
||||
résultat : date_amort
|
||||
*}}
|
||||
|
||||
{{:assign jour=$date|date:"d"}}
|
||||
{{:assign mois=$date|date:"m"}}
|
||||
{{:assign annee=$date|date:"Y"}}
|
||||
{{:assign annee="%d+1"|math:$annee}}
|
||||
{{:assign date_amort="%s/%s/%s"|args:$jour:$mois:$annee}}
|
@ -36,9 +36,6 @@
|
||||
{{:error message="Erreur : la date de mise en service (%s) ne peut être antérieure à la date d'acquisition (%s)"|args:$dd:$da}}
|
||||
{{/if}}
|
||||
{{:assign duration=$_POST.duree|intval}}
|
||||
{{if $duration <= 0}}
|
||||
{{:error message="Erreur : la durée d'amortissement doit être strictement positive"}}
|
||||
{{/if}}
|
||||
{{:assign noamort=false}}
|
||||
{{/if}}
|
||||
|
||||
@ -78,7 +75,7 @@
|
||||
<dl>
|
||||
{{:input id="no_amort" type="checkbox" value=1 name="no_amort" label="Ne pas amortir" default=$checked help="Cocher pour ne pas amortir" onclick="toggleInputs('infos_immo','f_no_amort_1')"}}
|
||||
{{:input type="date" name="date_mes" label="Date de mise en service" disabled=$disabled help="à renseigner uniquement si différente de la date d'acquisition"}}
|
||||
{{:input type="number" name="duree" label="Durée d'amortissement" required=true min=1 default=1 disabled=$disabled}}
|
||||
{{:input type="number" name="duree" label="Durée d'amortissement" required=true min=0 default=1 disabled=$disabled}}
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
{{:error message="Pas d'info concernant l'immobilisation %s"|args:$_GET.immo_id}}
|
||||
{{/load}}
|
||||
{{:assign var="duree" from="info_immo.duration"|args:$_GET.immo_id}}
|
||||
{{:assign date_debut=$info_immo.date}}
|
||||
{{:assign date_debut=$info_immo.date|date_short}}
|
||||
|
||||
{{#select
|
||||
line.id as immo_id,
|
||||
@ -48,8 +48,8 @@
|
||||
where line.id = :line_id;
|
||||
:line_id = $_GET.immo_id|intval
|
||||
assign=ligne_immo
|
||||
}}
|
||||
<h2>Amortissement de « {{$label}} » d'un montant de {{"%f"|math:$montant|money_currency}} en date du {{$date_debut|date_short}} sur {{$duree}} ans</h2>
|
||||
}}
|
||||
<h2>Amortissement de « {{$label}} » d'un montant de {{"%f"|math:$montant|money_currency}} en date du {{$date_debut}} sur {{$duree}} ans</h2>
|
||||
{{else}}
|
||||
{{:error message="Immobilisation %s non trouvée"|args:$_GET.immo_id}}
|
||||
{{/select}}
|
||||
@ -95,15 +95,12 @@
|
||||
{{* montant de l'annuité théorique *}}
|
||||
{{:assign montant="%f"|math:$ligne_immo.montant}}
|
||||
{{:assign annuite="%f/%f"|math:$montant:$duree}}
|
||||
|
||||
{{* première annuité *}}
|
||||
{{:assign date_amort=$ligne_immo.date_amort}}
|
||||
{{if $date_amort|strtotime < $date_debut|strtotime}}
|
||||
{{* changer d'exercice *}}
|
||||
{{:include file="_next_year.html" date=$date_amort keep="date_amort"}}
|
||||
{{:assign date_amort=$date_amort|parse_date}}
|
||||
{{/if}}
|
||||
{{:assign date_amort=$ligne_immo.date_amort|date_short}}
|
||||
{{:include file="_calcul_dates.html" date_debut=$date_debut date_fin=$date_amort keep="nbjours"}}
|
||||
{{:assign annuite_1="%f/360*%d"|math:$annuite:$nbjours|intval}}
|
||||
|
||||
{{:assign annuite_courante=$annuite_1}}
|
||||
{{:assign current_year=$ligne_immo.year_id}}
|
||||
{{:assign solde=$ligne_immo.montant}}
|
||||
@ -115,7 +112,7 @@
|
||||
Amortissements attachés à « <a class="num"
|
||||
href={{"%s/acc/transactions/details.php?id=%s"|args:$admin_url:$ligne_immo.trans_id}}>{{$ligne_immo.trans_id}}</a>
|
||||
{{$ligne_immo.label}} »
|
||||
({{"%f"|math:$ligne_immo.montant|money_currency}}, {{$date_debut|date_short}})
|
||||
({{"%f"|math:$ligne_immo.montant|money_currency}}, {{$date_debut}})
|
||||
</h3>
|
||||
<table class="list">
|
||||
<thead>
|
||||
@ -157,7 +154,11 @@
|
||||
</td>
|
||||
</tr>
|
||||
{{:assign annuite_courante=$annuite}}
|
||||
{{:include file="_next_year.html" date=$date_amort keep="date_amort"}}
|
||||
{{: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 nbamort="%d+1"|math:$nbamort}}
|
||||
{{/foreach}}
|
||||
</tbody>
|
||||
@ -195,7 +196,7 @@
|
||||
{{/select}}
|
||||
<tr>
|
||||
<td class="num">{{"%d+1"|math:$num}}</td>
|
||||
<td>{{$date_amort|date_short}}</td>
|
||||
<td>{{$date_amort}}</td>
|
||||
<td class="money">{{"%f"|math:$annuite_courante|money}}</td>
|
||||
<td class="money">{{if $solde == 0}}0,00{{else}}{{"%f"|math:$solde|money}}{{/if}}</td>
|
||||
<td>
|
||||
@ -215,7 +216,11 @@
|
||||
{{/if}}
|
||||
</td>
|
||||
</tr>
|
||||
{{:include file="_next_year.html" date=$date_amort keep="date_amort"}}
|
||||
{{: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}}
|
||||
|
@ -68,19 +68,6 @@
|
||||
{{if $amortissable == "non"}}
|
||||
{{:continue}}
|
||||
{{/if}}
|
||||
{{* voir s'il existe des écritures d'amortissement associées *}}
|
||||
{{#select
|
||||
links.id_transaction,
|
||||
links.id_related
|
||||
FROM acc_transactions_links AS links
|
||||
WHERE links.id_transaction = :trans_id OR links.id_related = :trans_id;
|
||||
:trans_id=$trans_id
|
||||
}}
|
||||
{{:assign exist_amort=true}}
|
||||
{{else}}
|
||||
{{:assign exist_amort=false}}
|
||||
{{/select}}
|
||||
{{*:debug trans_id=$trans_id trans_label=$trans_label exist_amort=$exist_amort*}}
|
||||
<tr>
|
||||
<td class="num"><a href={{$trans_url}}>#{{$trans_id}}</a></td>
|
||||
<td>{{$trans_date|date_short}}</td>
|
||||
@ -99,14 +86,6 @@
|
||||
target="_dialog"
|
||||
}}
|
||||
{{else}}
|
||||
{{if ! $exist_amort}}
|
||||
{{:linkbutton
|
||||
label="Modifier infos"
|
||||
href="modif_infos.html?immo_id=%s&amort=1"|args:$immo_id
|
||||
shape="help"
|
||||
target="_dialog"
|
||||
}}
|
||||
{{/if}}
|
||||
{{:linkbutton
|
||||
label="Amortissements"
|
||||
href="amortization.html?immo_id=%s"|args:$immo_id
|
||||
|
@ -7,15 +7,11 @@
|
||||
{{:include file="_nav.html" current="index"}}
|
||||
{{/if}}
|
||||
|
||||
{{* infos de l'immobilisation *}}
|
||||
{{:assign var="immo_id" value=$_GET.immo_id|intval}}
|
||||
{{#load type="immo" assign="info_immo" where="$$.line = :line_id" :line_id=$immo_id|intval}}
|
||||
{{/load}}
|
||||
|
||||
{{* Traiter l'envoi du formulaire *}}
|
||||
{{#form on="change"}}
|
||||
|
||||
{{* chercher la date d'acquisition de l'immobilisation *}}
|
||||
{{:assign var="immo_id" value=$_GET.immo_id|intval}}
|
||||
{{#select
|
||||
trans.date as date_achat
|
||||
from acc_transactions_lines as line
|
||||
@ -40,15 +36,16 @@
|
||||
{{:error message="Erreur : la date de mise en service (%s) ne peut être antérieure à la date d'acquisition (%s)"|args:$dd:$da}}
|
||||
{{/if}}
|
||||
{{:assign duration=$_POST.duree|intval}}
|
||||
{{if $duration <= 0}}
|
||||
{{:error message="Erreur : la durée d'amortissement doit être strictement positive"}}
|
||||
{{/if}}
|
||||
{{:assign noamort=false}}
|
||||
{{/if}}
|
||||
|
||||
{{#load type="immo" where="$$.line = :line_id" :line_id=$immo_id|intval}}
|
||||
{{:assign key=$key}}
|
||||
{{/load}}
|
||||
{{* enregistrer les infos modifiées de l'immobilisation *}}
|
||||
{{*:assign key=""|uuid*}}
|
||||
{{:save
|
||||
key=$info_immo.key
|
||||
key=$key
|
||||
validate_schema="schema.json"
|
||||
type="immo"
|
||||
line=$immo_id
|
||||
@ -67,8 +64,7 @@
|
||||
{{:form_errors}}
|
||||
{{/form}}
|
||||
|
||||
{{* modifier la date de mise en service et durée d'amortissement *}}
|
||||
|
||||
{{* renseigner la date de mise en service et durée d'amortissement *}}
|
||||
{{if $_GET.amort == 0}}
|
||||
{{:assign checked=1}}
|
||||
{{:assign disabled=1}}
|
||||
@ -76,14 +72,13 @@
|
||||
{{:assign checked=0}}
|
||||
{{:assign disabled=0}}
|
||||
{{/if}}
|
||||
|
||||
<form method="post" action="">
|
||||
<fieldset id="infos_immo">
|
||||
<legend></legend>
|
||||
<dl>
|
||||
{{:input id="no_amort" type="checkbox" value=1 name="no_amort" label="Ne pas amortir" default=$checked help="Cocher pour ne pas amortir" onclick="toggleInputs('infos_immo','f_no_amort_1')"}}
|
||||
{{:input type="date" name="date_mes" label="Date de mise en service" default=$info_immo.date disabled=$disabled help="à renseigner uniquement si différente de la date d'acquisition"}}
|
||||
{{:input type="number" name="duree" label="Durée d'amortissement" default=$info_immo.duration required=true min=1 disabled=$disabled}}
|
||||
{{:input type="date" name="date_mes" label="Date de mise en service" disabled=$disabled help="à renseigner uniquement si différente de la date d'acquisition"}}
|
||||
{{:input type="number" name="duree" label="Durée d'amortissement" required=true min=0 default=1 disabled=$disabled}}
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user