Compare commits

...

3 commits

Author SHA1 Message Date
Jean-Christophe Engel
afbf036796 Ajout compte immobilisation 23 2025-06-17 13:41:15 +02:00
Jean-Christophe Engel
0688ad0fec Ajout cas amortissements « oubliés » 2025-06-17 13:40:29 +02:00
Jean-Christophe Engel
dc823c90e2 Amélioration cosmétique 2025-06-17 13:39:27 +02:00
3 changed files with 22 additions and 8 deletions

View file

@ -24,6 +24,7 @@
{{/select}}
{{:assign date_debut=$ligne_immo.date}}
{{:assign solde=$ligne_immo.montant}}
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$ligne_immo.trans_id}}
{{#load type="immo" where="$$.line = :line_id" :line_id=$_GET.immo_id|intval}}
{{:assign duree=$duration}}
@ -164,8 +165,8 @@
</form>
<dl class="describe">
<dt>Libellé</dt>
<dd>{{$ligne_immo.label}}</dd>
<dt>Immobilisation</dt>
<dd><span class="num"><a href={{$trans_url}}>#{{$ligne_immo.trans_id}}</a></span> {{$ligne_immo.label}}</dd>
<dt>Montant</dt>
<dd><strong class="money">{{"%f"|math:$ligne_immo.montant|money_currency}}</strong></dd>
<dt>Début d'amortissement</dt>

View file

@ -67,19 +67,22 @@
{{:assign valeur_nette="%f-%f"|math:$ligne_immo.montant:$amort_amount}}
{{*
lister les exercices qui englobent la date de début du prochain amortissement
lister les exercices ouverts :
- dont la date de fin est postérieure à la date du dernier amortissment
- dont la date de début est antérieure ou égale à la date du jour
*}}
{{:assign default_exit_date=""}}
{{#years closed=false order="start_date" where="start_date <= :debut AND :debut <= end_date"
:debut=$date_debut assign=years.}}
{{#years closed=false order="start_date" where=":debut <= end_date" :debut=$date_debut}}
{{if $start_date|strtotime <= $now && $now <= $end_date|strtotime}}
{{:assign default_exit_date=$now|date_short}}
{{/if}}
{{:assign ts_fin=$end_date|strtotime}}
{{if $start_date|strtotime > $now}}
{{:break}}
{{/if}}
{{:assign var="years." id=$id label=$label start_date=$start_date end_date=$end_date}}
{{:assign debut=$start_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="years_data.%d"|args:$id value=$ts_debut|cat:" "|cat:$ts_fin}}
{{else}}
{{:error message="Aucun exercice ouvert pour enregistrer un amortissement"}}
{{/years}}
@ -141,6 +144,7 @@
{{* vérifier que la date de sortie est située dans un exercice ouvert *}}
{{:assign ts_exit = $_POST.date_sortie|parse_date|strtotime}}
{{:assign ok=false}}
{{:assign msg_amort=""}}
{{#foreach from=$years}}
{{if $id == $_POST.id_year}}
{{:assign selected_year=$id}}
@ -149,16 +153,24 @@
{{:break}}
{{/if}}
{{/if}}
{{* voir si des amortissements ont été oubliés *}}
{{if $start_date|strtotime > $amort_line.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}}
{{if ! $ok}}
{{:error message="La date choisie n'est pas dans l'exercice sélectionné !"}}
{{/if}}
{{if $msg_amort != ""}}
{{:error message="Vous devez d'abord enregistrer les amortissements des exercices suivants : %s"|args:$msg_amort}}
{{/if}}
{{:redirect to="compute_exit_data.html?immo_id=%s&amort_amount=%s&year=%s&date_mes=%s&date_debut=%s&exit_date=%s&duree_amort=%s"|args:$_GET.immo_id:$amort_amount:$selected_year:$ts_mes:$ts_debut:$ts_exit:$duree_amort}}
{{/form}}
{{:admin_header title="Sortie de bilan" custom_css="./style.css" current="module_amortissement"}}
{{* barre de navigation *}}
{{if ! $dialog}}
{{:include file="_nav.html" current="index" subcurrent="%s"|args:$_GET.type_immo subsubcurrent="balance_exit"}}

View file

@ -3,6 +3,7 @@
"prefixes": {
"20": "Immobilisations incorporelles",
"21": "Immobilisations corporelles",
"23": "Immobilisations en cours",
"27": "Immobilisations financières"
}
}