Compare commits
No commits in common. "3738ea07219e5b787d19f9157a39f4a639403a82" and "f76c243b8c6c721d78f36ee8f0b3e714fff6608f" have entirely different histories.
3738ea0721
...
f76c243b8c
@ -6,16 +6,23 @@
|
|||||||
- date_fin
|
- date_fin
|
||||||
résultat : nbjours
|
résultat : nbjours
|
||||||
*}}
|
*}}
|
||||||
|
{{* pour simplifier : 30 jours par mois et 360 jours par an *}}
|
||||||
|
|
||||||
{{:assign ts_debut=$date_debut|strtotime}}
|
{{:assign jour_debut=$date_debut|date:"d"}}
|
||||||
{{:assign ts_fin=$date_fin|strtotime}}
|
{{:assign jour_debut="min(%d, 30)"|math:$jour_debut}}
|
||||||
{{:assign nbjours="1+(%d-%d)/(60*60*24)"|math:$ts_fin:$ts_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 ... *}}
|
{{* au cas où les deux dates seraient inversées ... *}}
|
||||||
{{if $nbjours < 0}}
|
{{if $nbjours < 0}}
|
||||||
{{:assign nbjours="-1*%d"|math:$nbjours}}
|
{{:assign nbjours="-1*%d"|math:$nbjours}}
|
||||||
{{/if}}
|
{{/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}}
|
{{:error message="Erreur : la date de mise en service (%s) ne peut être antérieure à la date d'acquisition (%s)"|args:$dd:$da}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:assign duration=$_POST.duree|intval}}
|
{{:assign duration=$_POST.duree|intval}}
|
||||||
{{if $duration <= 0}}
|
|
||||||
{{:error message="Erreur : la durée d'amortissement doit être strictement positive"}}
|
|
||||||
{{/if}}
|
|
||||||
{{:assign noamort=false}}
|
{{:assign noamort=false}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
@ -78,7 +75,7 @@
|
|||||||
<dl>
|
<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 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="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>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
{{:error message="Pas d'info concernant l'immobilisation %s"|args:$_GET.immo_id}}
|
{{:error message="Pas d'info concernant l'immobilisation %s"|args:$_GET.immo_id}}
|
||||||
{{/load}}
|
{{/load}}
|
||||||
{{:assign var="duree" from="info_immo.duration"|args:$_GET.immo_id}}
|
{{: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
|
{{#select
|
||||||
line.id as immo_id,
|
line.id as immo_id,
|
||||||
@ -48,8 +48,8 @@
|
|||||||
where line.id = :line_id;
|
where line.id = :line_id;
|
||||||
:line_id = $_GET.immo_id|intval
|
:line_id = $_GET.immo_id|intval
|
||||||
assign=ligne_immo
|
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}}
|
{{else}}
|
||||||
{{:error message="Immobilisation %s non trouvée"|args:$_GET.immo_id}}
|
{{:error message="Immobilisation %s non trouvée"|args:$_GET.immo_id}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
@ -95,15 +95,12 @@
|
|||||||
{{* montant de l'annuité théorique *}}
|
{{* montant de l'annuité théorique *}}
|
||||||
{{:assign montant="%f"|math:$ligne_immo.montant}}
|
{{:assign montant="%f"|math:$ligne_immo.montant}}
|
||||||
{{:assign annuite="%f/%f"|math:$montant:$duree}}
|
{{:assign annuite="%f/%f"|math:$montant:$duree}}
|
||||||
|
|
||||||
{{* première annuité *}}
|
{{* première annuité *}}
|
||||||
{{:assign date_amort=$ligne_immo.date_amort}}
|
{{:assign date_amort=$ligne_immo.date_amort|date_short}}
|
||||||
{{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}}
|
|
||||||
{{:include file="_calcul_dates.html" date_debut=$date_debut date_fin=$date_amort keep="nbjours"}}
|
{{: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_1="%f/360*%d"|math:$annuite:$nbjours|intval}}
|
||||||
|
|
||||||
{{:assign annuite_courante=$annuite_1}}
|
{{:assign annuite_courante=$annuite_1}}
|
||||||
{{:assign current_year=$ligne_immo.year_id}}
|
{{:assign current_year=$ligne_immo.year_id}}
|
||||||
{{:assign solde=$ligne_immo.montant}}
|
{{:assign solde=$ligne_immo.montant}}
|
||||||
@ -115,7 +112,7 @@
|
|||||||
Amortissements attachés à « <a class="num"
|
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>
|
href={{"%s/acc/transactions/details.php?id=%s"|args:$admin_url:$ligne_immo.trans_id}}>{{$ligne_immo.trans_id}}</a>
|
||||||
{{$ligne_immo.label}} »
|
{{$ligne_immo.label}} »
|
||||||
({{"%f"|math:$ligne_immo.montant|money_currency}}, {{$date_debut|date_short}})
|
({{"%f"|math:$ligne_immo.montant|money_currency}}, {{$date_debut}})
|
||||||
</h3>
|
</h3>
|
||||||
<table class="list">
|
<table class="list">
|
||||||
<thead>
|
<thead>
|
||||||
@ -157,7 +154,11 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{:assign annuite_courante=$annuite}}
|
{{: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}}
|
{{:assign nbamort="%d+1"|math:$nbamort}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -195,7 +196,7 @@
|
|||||||
{{/select}}
|
{{/select}}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="num">{{"%d+1"|math:$num}}</td>
|
<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">{{"%f"|math:$annuite_courante|money}}</td>
|
||||||
<td class="money">{{if $solde == 0}}0,00{{else}}{{"%f"|math:$solde|money}}{{/if}}</td>
|
<td class="money">{{if $solde == 0}}0,00{{else}}{{"%f"|math:$solde|money}}{{/if}}</td>
|
||||||
<td>
|
<td>
|
||||||
@ -215,7 +216,11 @@
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</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}}
|
{{:assign annuite_courante="min(%f,%f)"|math:$annuite:$solde}}
|
||||||
{{if $solde == 0}}{{:break}}{{/if}}
|
{{if $solde == 0}}{{:break}}{{/if}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
@ -68,19 +68,6 @@
|
|||||||
{{if $amortissable == "non"}}
|
{{if $amortissable == "non"}}
|
||||||
{{:continue}}
|
{{:continue}}
|
||||||
{{/if}}
|
{{/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>
|
<tr>
|
||||||
<td class="num"><a href={{$trans_url}}>#{{$trans_id}}</a></td>
|
<td class="num"><a href={{$trans_url}}>#{{$trans_id}}</a></td>
|
||||||
<td>{{$trans_date|date_short}}</td>
|
<td>{{$trans_date|date_short}}</td>
|
||||||
@ -92,26 +79,18 @@
|
|||||||
<td>{{$project_label}}</td>
|
<td>{{$project_label}}</td>
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
{{if $duration == null}}
|
{{if $duration == null}}
|
||||||
{{:linkbutton
|
{{:linkbutton
|
||||||
label="Ajouter infos"
|
label="Ajouter infos"
|
||||||
href="add_infos.html?immo_id=%s&amort=1"|args:$immo_id
|
href="add_infos.html?immo_id=%s&amort=1"|args:$immo_id
|
||||||
shape="help"
|
shape="help"
|
||||||
target="_dialog"
|
target="_dialog"
|
||||||
}}
|
}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{if ! $exist_amort}}
|
{{:linkbutton
|
||||||
{{:linkbutton
|
label="Amortissements"
|
||||||
label="Modifier infos"
|
href="amortization.html?immo_id=%s"|args:$immo_id
|
||||||
href="modif_infos.html?immo_id=%s&amort=1"|args:$immo_id
|
shape="table"
|
||||||
shape="help"
|
}}
|
||||||
target="_dialog"
|
|
||||||
}}
|
|
||||||
{{/if}}
|
|
||||||
{{:linkbutton
|
|
||||||
label="Amortissements"
|
|
||||||
href="amortization.html?immo_id=%s"|args:$immo_id
|
|
||||||
shape="table"
|
|
||||||
}}
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -125,10 +104,10 @@
|
|||||||
<legend>Ajouter une immobilisation</legend>
|
<legend>Ajouter une immobilisation</legend>
|
||||||
<p class="submit">
|
<p class="submit">
|
||||||
{{:linkbutton
|
{{:linkbutton
|
||||||
label="Ajouter une immobilisation"
|
label="Ajouter une immobilisation"
|
||||||
shape="plus"
|
shape="plus"
|
||||||
href="add_asset.html"
|
href="add_asset.html"
|
||||||
target="_dialog"
|
target="_dialog"
|
||||||
}}
|
}}
|
||||||
</p>
|
</p>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
@ -7,15 +7,11 @@
|
|||||||
{{:include file="_nav.html" current="index"}}
|
{{:include file="_nav.html" current="index"}}
|
||||||
{{/if}}
|
{{/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 *}}
|
{{* Traiter l'envoi du formulaire *}}
|
||||||
{{#form on="change"}}
|
{{#form on="change"}}
|
||||||
|
|
||||||
{{* chercher la date d'acquisition de l'immobilisation *}}
|
{{* chercher la date d'acquisition de l'immobilisation *}}
|
||||||
|
{{:assign var="immo_id" value=$_GET.immo_id|intval}}
|
||||||
{{#select
|
{{#select
|
||||||
trans.date as date_achat
|
trans.date as date_achat
|
||||||
from acc_transactions_lines as line
|
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}}
|
{{:error message="Erreur : la date de mise en service (%s) ne peut être antérieure à la date d'acquisition (%s)"|args:$dd:$da}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:assign duration=$_POST.duree|intval}}
|
{{:assign duration=$_POST.duree|intval}}
|
||||||
{{if $duration <= 0}}
|
|
||||||
{{:error message="Erreur : la durée d'amortissement doit être strictement positive"}}
|
|
||||||
{{/if}}
|
|
||||||
{{:assign noamort=false}}
|
{{:assign noamort=false}}
|
||||||
{{/if}}
|
{{/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 *}}
|
{{* enregistrer les infos modifiées de l'immobilisation *}}
|
||||||
|
{{*:assign key=""|uuid*}}
|
||||||
{{:save
|
{{:save
|
||||||
key=$info_immo.key
|
key=$key
|
||||||
validate_schema="schema.json"
|
validate_schema="schema.json"
|
||||||
type="immo"
|
type="immo"
|
||||||
line=$immo_id
|
line=$immo_id
|
||||||
@ -67,8 +64,7 @@
|
|||||||
{{:form_errors}}
|
{{:form_errors}}
|
||||||
{{/form}}
|
{{/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}}
|
{{if $_GET.amort == 0}}
|
||||||
{{:assign checked=1}}
|
{{:assign checked=1}}
|
||||||
{{:assign disabled=1}}
|
{{:assign disabled=1}}
|
||||||
@ -76,14 +72,13 @@
|
|||||||
{{:assign checked=0}}
|
{{:assign checked=0}}
|
||||||
{{:assign disabled=0}}
|
{{:assign disabled=0}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
<form method="post" action="">
|
<form method="post" action="">
|
||||||
<fieldset id="infos_immo">
|
<fieldset id="infos_immo">
|
||||||
<legend></legend>
|
<legend></legend>
|
||||||
<dl>
|
<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 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="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" default=$info_immo.duration required=true min=1 disabled=$disabled}}
|
{{:input type="number" name="duree" label="Durée d'amortissement" required=true min=0 default=1 disabled=$disabled}}
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user