fusion branche variante_ajout_immo
This commit is contained in:
commit
2e51d768d3
20 changed files with 1727 additions and 350 deletions
|
@ -9,12 +9,4 @@
|
||||||
|
|
||||||
{{:assign ts_debut=$date_debut|strtotime}}
|
{{:assign ts_debut=$date_debut|strtotime}}
|
||||||
{{:assign ts_fin=$date_fin|strtotime}}
|
{{:assign ts_fin=$date_fin|strtotime}}
|
||||||
|
{{:assign nbjours="1+abs(%d-%d)/(60*60*24)"|math:$ts_fin:$ts_debut}}
|
||||||
{{if $ts_debut <= $ts_fin}}
|
|
||||||
{{:assign nbjours="(%d-%d)/(60*60*24)"|math:$ts_fin:$ts_debut}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign nbjours="(%d-%d)/(60*60*24)"|math:$ts_debut:$ts_fin}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{* pour simplifier : 360 jours par an *}}
|
|
||||||
{{:assign nbjours="round(%f/365*360)"|math:$nbjours}}
|
|
||||||
|
|
|
@ -24,11 +24,10 @@
|
||||||
select="code"
|
select="code"
|
||||||
tables="acc_accounts"
|
tables="acc_accounts"
|
||||||
where="id_chart = :id_chart %s"|args:$condition
|
where="id_chart = :id_chart %s"|args:$condition
|
||||||
:id_chart = $selected_chart|intval
|
:id_chart = $chart_id|intval
|
||||||
}}
|
}}
|
||||||
{{if $account_code == $code}}
|
{{if $account_code == $code}}
|
||||||
{{:assign account_ok=1}}
|
{{:assign account_ok=1}}
|
||||||
{{:break}}
|
{{:break}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/sql}}
|
{{/sql}}
|
||||||
|
|
||||||
|
|
|
@ -8,11 +8,7 @@
|
||||||
*}}
|
*}}
|
||||||
|
|
||||||
{{:assign open_years=""}}
|
{{:assign open_years=""}}
|
||||||
{{#years status=false order="start_date"}}
|
{{#years closed=false order="start_date" assign="open_years."}}
|
||||||
{{:assign open_years=$open_years|cat:"\n"|cat:" - "|cat:$label|cat:" : "}}
|
|
||||||
{{:assign debut=$start_date|date_short}}
|
|
||||||
{{:assign fin=$end_date|date_short}}
|
|
||||||
{{:assign open_years=$open_years|cat:$debut|cat:" à "|cat:$fin}}
|
|
||||||
{{if
|
{{if
|
||||||
$start_date|strtotime <= $date|parse_date|strtotime &&
|
$start_date|strtotime <= $date|parse_date|strtotime &&
|
||||||
$end_date|strtotime >= $date|parse_date|strtotime
|
$end_date|strtotime >= $date|parse_date|strtotime
|
||||||
|
|
13
_nav.html
13
_nav.html
|
@ -12,17 +12,22 @@
|
||||||
<li {{if $current == 'aide'}} class="current"{{/if}}><a href="{{$module.url}}aide.html">Aide</a></li>
|
<li {{if $current == 'aide'}} class="current"{{/if}}><a href="{{$module.url}}aide.html">Aide</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
{{if $current == 'index'}}
|
{{if $current == 'index' && $subsubcurrent != 'balance_exit'}}
|
||||||
<ul class="sub">
|
<ul class="sub">
|
||||||
<li {{if $subcurrent == 'amort'}}class="current"{{/if}}><a href="index.html?amort=amort">Amortissables</a></li>
|
<li {{if $subcurrent == 'encours'}}class="current"{{/if}}><a href="index.html?amort=encours">En cours</a></li>
|
||||||
<li {{if $subcurrent == 'fini'}}class="current"{{/if}}><a href="index.html?amort=fini">Terminées</a></li>
|
<li {{if $subcurrent == 'fini'}}class="current"{{/if}}><a href="index.html?amort=fini">Terminées</a></li>
|
||||||
<li {{if $subcurrent == 'no_amort'}}class="current"{{/if}}><a href="index.html?amort=no_amort">Non amortissables</a></li>
|
<li {{if $subcurrent == 'archive'}}class="current"{{/if}}><a href="index.html?amort=archive">Archivées</a></li>
|
||||||
|
<li {{if $subcurrent == 'autres'}}class="current"{{/if}}><a href="index.html?amort=autres">Autres</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{if $subsubcurrent == 'amortization'}}
|
{{if $subsubcurrent == 'amortization'}}
|
||||||
<ul class="sub">
|
<ul class="sub">
|
||||||
<li class="title"><strong>Amortissements</strong></li>
|
<li class="title"><strong>Amortissements</strong></li>
|
||||||
</ul>
|
</ul>
|
||||||
{{/if}}
|
{{elseif $subsubcurrent == 'balance_exit'}}
|
||||||
|
<ul class="sub">
|
||||||
|
<li class="title"><strong>Sortie du bilan</strong></li>
|
||||||
|
</ul>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</nav>
|
</nav>
|
||||||
|
|
147
add_asset.html
147
add_asset.html
|
@ -1,33 +1,44 @@
|
||||||
{{* -*- brindille -*- *}}
|
{{* -*- brindille -*- *}}
|
||||||
{{:admin_header title="Ajout immobilisation" current="module_amortissement"}}
|
|
||||||
|
|
||||||
{{* barre de navigation *}}
|
|
||||||
{{if ! $dialog}}
|
|
||||||
{{:include file="_nav.html" current="index"}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{:read file="./defaut.json" assign="config_json"}}
|
{{:read file="./defaut.json" assign="config_json"}}
|
||||||
{{:assign config_defaut=$config_json|json_decode}}
|
{{:assign config_defaut=$config_json|json_decode}}
|
||||||
{{:assign var="prefix_array" value=$config_defaut.prefixes|keys}}
|
{{:assign var="prefix_array" value=$config_defaut.prefixes|keys}}
|
||||||
|
|
||||||
|
{{#years closed=false order="start_date" assign=years.}}
|
||||||
|
{{:assign ts_debut=$start_date|strtotime}}
|
||||||
|
{{:assign ts_fin=$end_date|strtotime}}
|
||||||
|
{{:assign debut=$start_date|date_short}}
|
||||||
|
{{:assign fin=$end_date|date_short}}
|
||||||
|
{{:assign var="years_data.%d"|args:$id value=$ts_debut|cat:" "|cat:$ts_fin}}
|
||||||
|
{{:assign var="open_years.%d"|args:$id value=$label|cat:" (du "|cat:$debut|cat:" au "|cat:$fin|cat:")"}}
|
||||||
|
{{if $ts_debut <= $now && $now <= $ts_fin}}
|
||||||
|
{{:assign selected_year=$id}}
|
||||||
|
{{/if}}
|
||||||
|
{{/years}}
|
||||||
|
|
||||||
{{* Traiter l'envoi du formulaire *}}
|
{{* Traiter l'envoi du formulaire *}}
|
||||||
{{#form on="add"}}
|
{{#form on="add"}}
|
||||||
|
{{* vérifier que la date d'achat est située dans un l'exercice sélectionné *}}
|
||||||
{{* vérifier que la date est située dans un exercice ouvert *}}
|
{{:assign ts_date = $_POST.date_achat|parse_date|strtotime}}
|
||||||
{{:include
|
{{:assign ok=false}}
|
||||||
file="_check_date.html"
|
{{#foreach from=$years}}
|
||||||
date=$_POST.date_achat
|
{{if $id == $_POST.id_year}}
|
||||||
keep="open_years, selected_year, selected_chart"
|
{{:assign selected_chart=$id_chart}}
|
||||||
}}
|
{{if $start_date|strtotime <= $ts_date && $ts_date <= $end_date|strtotime}}
|
||||||
{{if $selected_year == null}}
|
{{:assign ok=true}}
|
||||||
{{:error message="La date choisie n'est dans aucun exercice ouvert !!\nExercices ouverts : %s"|args:$open_years}}
|
{{:break}}
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
{{/foreach}}
|
||||||
|
{{if ! $ok}}
|
||||||
|
{{:error message="La date saisie n'est pas dans l'exercice choisi !"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{if $_POST.no_amort}}
|
{{if ! $_POST.amortir}}
|
||||||
{{* ne pas amortir *}}
|
{{* ne pas amortir *}}
|
||||||
{{:assign duration=0}}
|
{{:assign duration=0}}
|
||||||
{{:assign date_debut=$ligne_immo.date_achat|parse_date}}
|
{{:assign date_debut=$_POST.date_achat|parse_date}}
|
||||||
{{:assign noamort=true}}
|
{{:assign status="ignored"}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{* vérifier que la date d'acquisition est antérieure à la date de mise en service *}}
|
{{* vérifier que la date d'acquisition est antérieure à la date de mise en service *}}
|
||||||
{{:assign date_debut=$_POST.date_mes|or:$_POST.date_achat|parse_date}}
|
{{:assign date_debut=$_POST.date_mes|or:$_POST.date_achat|parse_date}}
|
||||||
|
@ -37,7 +48,7 @@
|
||||||
{{: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}}
|
||||||
{{:assign noamort=false}}
|
{{:assign status="managed"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{* déterminer le numéro des comptes au cas où la clé serait un identifiant *}}
|
{{* déterminer le numéro des comptes au cas où la clé serait un identifiant *}}
|
||||||
|
@ -77,7 +88,7 @@
|
||||||
method="POST"
|
method="POST"
|
||||||
path="accounting/transaction"
|
path="accounting/transaction"
|
||||||
assign="result"
|
assign="result"
|
||||||
id_year=$selected_year
|
id_year=$_POST.id_year
|
||||||
type="revenue"
|
type="revenue"
|
||||||
date=$_POST.date_achat
|
date=$_POST.date_achat
|
||||||
label=$_POST.designation
|
label=$_POST.designation
|
||||||
|
@ -103,20 +114,26 @@
|
||||||
line=$immo_id
|
line=$immo_id
|
||||||
duration=$duration
|
duration=$duration
|
||||||
date=$date_debut
|
date=$date_debut
|
||||||
noamort=$noamort
|
status=$status
|
||||||
}}
|
}}
|
||||||
{{if $_POST.no_amort}}
|
{{if $_POST.amortir}}
|
||||||
{{:assign amort=0}}
|
{{:assign amort="encours"}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign amort=1}}
|
{{:assign amort="autres"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:redirect force="index.html?ok=1&msg=immobilisation&amort=%s"|args:$amort}}
|
{{:redirect force="index.html?ok=1&msg=immobilisation&amort=%s"|args:$amort}}
|
||||||
{{/form}}
|
{{/form}}
|
||||||
|
|
||||||
|
{{:admin_header title="Ajout immobilisation" current="module_amortissement"}}
|
||||||
|
{{* barre de navigation *}}
|
||||||
|
{{if ! $dialog}}
|
||||||
|
{{:include file="_nav.html" current="index"}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{:form_errors}}
|
{{:form_errors}}
|
||||||
|
|
||||||
{{* formulaire d'ajout d'immobilisation *}}
|
{{* formulaire d'ajout d'immobilisation *}}
|
||||||
{{:assign var="bank_account.512" value="512 — Banques"}}
|
|
||||||
{{:assign var="immo_account.2" value="2 — Classe 2 — Comptes d'immobilisations"}}
|
{{:assign var="immo_account.2" value="2 — Classe 2 — Comptes d'immobilisations"}}
|
||||||
|
|
||||||
{{#select id,label FROM acc_projects WHERE archived = 0;}}
|
{{#select id,label FROM acc_projects WHERE archived = 0;}}
|
||||||
|
@ -127,37 +144,50 @@
|
||||||
{{:assign var="pattern_array." value="%s*"|args:$code}}
|
{{:assign var="pattern_array." value="%s*"|args:$code}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
{{:assign patterns=$pattern_array|implode:"|"}}
|
{{:assign patterns=$pattern_array|implode:"|"}}
|
||||||
{{:assign date=$now|date:'Y-m-d'}}
|
|
||||||
|
<div id="erreur" class="hidden">
|
||||||
|
<p class="block error">La date choisie n'est dans aucun exercice ouvert !</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<form method="post" action="">
|
<form method="post" action="">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Ajouter une immobilisation</legend>
|
<legend>Données de l'immobilisation</legend>
|
||||||
<dl>
|
<dl>
|
||||||
{{:input id="no_amort" type="checkbox" value=1 name="no_amort" label="Ne pas amortir" help="Cocher pour ne pas amortir" onclick="toggleInputs('f_no_amort_1', ['f_date_mes','f_duree'])"}}
|
{{:input type="select" name="id_year" label="Exercice" required=true default_empty="— Faire un choix —" options=$open_years}}
|
||||||
{{:input type="date" name="date_achat" label="Date d'acquisition" required=true default=$now|date_short onchange="setDate('date_achat', ['credit_account', 'debit_account'])"}}
|
{{:input type="date" name="date_achat" label="Date d'acquisition" required=true default=$now|date_short}}
|
||||||
{{:input type="date" name="date_mes" label="Date de mise en service" help="à renseigner uniquement si différente de la date d'acquisition"}}
|
|
||||||
{{:input type="text" name="designation" label="Désignation" required=true}}
|
{{:input type="text" name="designation" label="Désignation" required=true}}
|
||||||
{{:input type="money" name="montant" label="Montant" required=true}}
|
{{:input type="money" name="montant" label="Montant" required=true}}
|
||||||
{{:input type="number" name="duree" label="Durée d'amortissement" required=true min=0 default=1 suffix="année(s)"}}
|
|
||||||
{{:input
|
{{:input
|
||||||
type="list"
|
type="list"
|
||||||
name="credit_account"
|
name="credit_account"
|
||||||
label="Compte de décaissement"
|
label="Compte de décaissement"
|
||||||
required=true
|
required=true
|
||||||
target="!acc/charts/accounts/selector.php?types=%s&date=%s"|args:"1|2|3":$date
|
target="!acc/charts/accounts/selector.php?types=%s&id_year=%d"|args:"1|2|3":$selected_year
|
||||||
default=$bank_account
|
|
||||||
}}
|
}}
|
||||||
{{:input
|
{{:input
|
||||||
type="list"
|
type="list"
|
||||||
name="debit_account"
|
name="debit_account"
|
||||||
label="Compte d'immobilisation (20xx, 21xx, ...)"
|
label="Compte d'immobilisation (20xx, 21xx, ...)"
|
||||||
required=true
|
required=true
|
||||||
target="!acc/charts/accounts/selector.php?date=%s&codes=%s"|args:$date:$patterns
|
target="!acc/charts/accounts/selector.php?codes=%s&id_year=%d"|args:$patterns:$selected_year
|
||||||
default=$immo_account
|
default=$immo_account
|
||||||
}}
|
}}
|
||||||
{{if $projects != null}}
|
{{if $projects != null}}
|
||||||
{{:input type="select" name="id_project" label="Projet (analytique)" options=$projects default_empty="— Aucun —"}}
|
{{:input type="select" name="id_project" label="Projet (analytique)" options=$projects default_empty="— Aucun —"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
<div id="donnees" class="hidden">
|
||||||
|
{{:input type="select" name="years_data" options=$years_data}}
|
||||||
|
</div>
|
||||||
|
</dl>
|
||||||
|
</fieldset>
|
||||||
|
<fieldset>
|
||||||
|
<legend>Amortissement</legend>
|
||||||
|
<dl>
|
||||||
|
{{:input id="amortir" type="checkbox" value=1 name="amortir" label="Amortir cette immobilisation sur plusieurs années" checked="cheched" help="Dé-cocher pour ne pas amortir"}}
|
||||||
|
<div id="div_amort">
|
||||||
|
{{:input type="date" name="date_mes" label="Date de mise en service" help="C'est la date de première utilisation ; à 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 suffix="année(s)"}}
|
||||||
|
</div>
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
@ -166,36 +196,21 @@
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
{{* activer/désactiver les champs passés en paramètres *}}
|
|
||||||
function toggleInputs(idcb, idfields) {
|
|
||||||
const noamort = document.getElementById(idcb);
|
|
||||||
for (let id of idfields) {
|
|
||||||
const field = document.getElementById(id);
|
|
||||||
if (noamort.checked) {
|
|
||||||
field.setAttribute("disabled","disabled");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
field.removeAttribute("disabled");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{{* fixer la date des sélecteurs *}}
|
|
||||||
function setDate(b_date, button_names) {
|
|
||||||
const elem_date = document.querySelector("input[name=" + b_date + "]");
|
|
||||||
const date_fr = elem_date.value;
|
|
||||||
const new_date = date_fr.replace(/([0-9]+)\/([0-9]+)\/([0-9]+)/, "$3-$2-$1");
|
|
||||||
for (const name of button_names) {
|
|
||||||
const button = document.querySelector("button[data-name=" + name + "]");
|
|
||||||
const b_value = button.value;
|
|
||||||
const new_value = b_value.replace(/date=[0-9]+-[0-9]+-[0-9]+/, 'date=' + new_date);
|
|
||||||
console.log(" date = " + new_date + " old_val = " + b_value + " new_val = " + new_value);
|
|
||||||
button.setAttribute('value', new_value);
|
|
||||||
console.log("button_value = " + button.value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
{{:admin_footer}}
|
{{:admin_footer}}
|
||||||
|
|
||||||
|
<script type="text/javascript" src="scripts.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
function changeYear(evt, f_accounts = ['credit_account', 'debit_account'], f_years_select = 'f_id_year') {
|
||||||
|
setSelectorYear(f_accounts, f_years_select);
|
||||||
|
}
|
||||||
|
|
||||||
|
function changeVisibility(evt, idcheck = 'f_amortir_1', fields = ['div_amort']) {
|
||||||
|
toggleVisibility(idcheck, fields);
|
||||||
|
}
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
document.getElementById('f_id_year').onchange = changeYear;
|
||||||
|
document.getElementById('f_amortir_1').onclick = changeVisibility;
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
{{* ne pas amortir *}}
|
{{* ne pas amortir *}}
|
||||||
{{:assign duration=0}}
|
{{:assign duration=0}}
|
||||||
{{:assign date_debut=$ligne_immo.date_achat|parse_date}}
|
{{:assign date_debut=$ligne_immo.date_achat|parse_date}}
|
||||||
{{:assign noamort=true}}
|
{{:assign status="ignored"}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{* vérifier que la date d'acquisition est antérieure à la date de mise en service *}}
|
{{* vérifier que la date d'acquisition est antérieure à la date de mise en service *}}
|
||||||
{{:assign date_debut=$_POST.date_mes|or:$ligne_immo.date_achat|parse_date}}
|
{{:assign date_debut=$_POST.date_mes|or:$ligne_immo.date_achat|parse_date}}
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
{{if $duration <= 0}}
|
{{if $duration <= 0}}
|
||||||
{{:error message="Erreur : la durée d'amortissement doit être strictement positive"}}
|
{{:error message="Erreur : la durée d'amortissement doit être strictement positive"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:assign noamort=false}}
|
{{:assign status="managed"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{* enregistrer les infos de l'immobilisation *}}
|
{{* enregistrer les infos de l'immobilisation *}}
|
||||||
|
@ -51,13 +51,13 @@
|
||||||
line=$immo_id
|
line=$immo_id
|
||||||
duration=$duration
|
duration=$duration
|
||||||
date=$date_debut
|
date=$date_debut
|
||||||
noamort=$noamort
|
status=$status
|
||||||
}}
|
}}
|
||||||
|
|
||||||
{{if $_POST.no_amort}}
|
{{if $_POST.no_amort}}
|
||||||
{{:assign amort=0}}
|
{{:assign amort="autres"}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign amort=1}}
|
{{:assign amort="encours"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:redirect force="index.html?ok=1&msg=infos&amort=%s"|args:$amort}}
|
{{:redirect force="index.html?ok=1&msg=infos&amort=%s"|args:$amort}}
|
||||||
{{else}}
|
{{else}}
|
||||||
|
|
|
@ -1,14 +1,81 @@
|
||||||
{{* -*- brindille -*- *}}
|
{{* -*- brindille -*- *}}
|
||||||
|
|
||||||
|
{{* récupérer les infos de l'immobilisation *}}
|
||||||
|
{{#select
|
||||||
|
line.id as immo_id,
|
||||||
|
line.debit as montant,
|
||||||
|
trans.id as trans_id,
|
||||||
|
trans.label as label,
|
||||||
|
trans.date
|
||||||
|
FROM acc_transactions_lines AS line
|
||||||
|
INNER JOIN acc_transactions AS trans ON line.id_transaction = trans.id
|
||||||
|
WHERE line.id = :line_id;
|
||||||
|
:line_id = $_GET.immo_id|intval
|
||||||
|
assign=ligne_immo
|
||||||
|
}}
|
||||||
|
{{else}}
|
||||||
|
{{:error message="Immobilisation %s non trouvée"|args:$_GET.immo_id}}
|
||||||
|
{{/select}}
|
||||||
|
{{:assign date_debut=$ligne_immo.date}}
|
||||||
|
{{:assign solde=$ligne_immo.montant}}
|
||||||
|
|
||||||
|
{{#load type="immo" where="$$.line = :line_id" :line_id=$_GET.immo_id|intval}}
|
||||||
|
{{:assign duree=$duration}}
|
||||||
|
{{:assign date_debut=$date}}
|
||||||
|
{{/load}}
|
||||||
|
|
||||||
|
{{* chercher des écritures d'amortissement liées à l'immobilisation *}}
|
||||||
|
{{#select
|
||||||
|
l_amort.credit as amort_amount,
|
||||||
|
l_amort.label as amort_label,
|
||||||
|
l_amort.id as amort_line,
|
||||||
|
CASE WHEN links.id_related = t_immo.id
|
||||||
|
THEN links.id_transaction
|
||||||
|
ELSE links.id_related
|
||||||
|
END as amort_trans_id,
|
||||||
|
trans.date as amort_date,
|
||||||
|
trans.label as trans_label,
|
||||||
|
trans.id_year as amort_year,
|
||||||
|
account.id as account_id,
|
||||||
|
account.code as account_code,
|
||||||
|
account.label as account_label
|
||||||
|
FROM acc_transactions_lines as l_immo
|
||||||
|
INNER JOIN acc_transactions as t_immo on t_immo.id = l_immo.id_transaction
|
||||||
|
INNER JOIN acc_transactions_links as links
|
||||||
|
ON (t_immo.id = links.id_transaction
|
||||||
|
OR
|
||||||
|
t_immo.id = links.id_related)
|
||||||
|
INNER JOIN acc_transactions_lines as l_amort on amort_trans_id = l_amort.id_transaction
|
||||||
|
INNER join acc_transactions as trans on l_amort.id_transaction = trans.id
|
||||||
|
INNER join acc_accounts as account on l_amort.id_account = account.id
|
||||||
|
WHERE
|
||||||
|
l_immo.id = :line_id
|
||||||
|
AND account.code LIKE '28%'
|
||||||
|
ORDER BY trans.date;
|
||||||
|
:line_id = $_GET.immo_id|intval
|
||||||
|
assign=linked_lines.
|
||||||
|
}}
|
||||||
|
{{if $date_debut == null}}
|
||||||
|
{{:assign date_debut=$amort_date}}
|
||||||
|
{{/if}}
|
||||||
|
{{/select}}
|
||||||
|
|
||||||
|
{{:assign valeur_residuelle=$ligne_immo.montant}}
|
||||||
|
{{#foreach from=$linked_lines}}
|
||||||
|
{{:assign valeur_residuelle="%d-%d"|math:$valeur_residuelle:$amort_amount}}
|
||||||
|
{{/foreach}}
|
||||||
|
|
||||||
{{:admin_header title="Liste des amortissements" custom_css="./style.css" current="module_amortissement"}}
|
{{:admin_header title="Liste des amortissements" custom_css="./style.css" current="module_amortissement"}}
|
||||||
|
|
||||||
{{* barre de navigation *}}
|
{{* barre de navigation *}}
|
||||||
{{if $_GET.amort == null || $_GET.amort == "amort"}}
|
{{if $_GET.amort == "fini" || $valeur_residuelle== 0 }}
|
||||||
{{:assign subcurrent="amort"}}
|
|
||||||
{{elseif $_GET.amort == "fini"}}
|
|
||||||
{{:assign subcurrent="fini"}}
|
{{:assign subcurrent="fini"}}
|
||||||
|
{{elseif $_GET.amort == "archive"}}
|
||||||
|
{{:assign subcurrent="archive"}}
|
||||||
|
{{elseif $_GET.amort == null || $_GET.amort == "encours"}}
|
||||||
|
{{:assign subcurrent="encours"}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign subcurrent="no_amort"}}
|
{{:assign subcurrent="autres"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:include file="_nav.html" current="index" subcurrent="%s"|args:$subcurrent subsubcurrent="amortization"}}
|
{{:include file="_nav.html" current="index" subcurrent="%s"|args:$subcurrent subsubcurrent="amortization"}}
|
||||||
|
|
||||||
|
@ -30,77 +97,13 @@
|
||||||
<p class="block error">{{$msg}}</p>
|
<p class="block error">{{$msg}}</p>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{* récupérer les infos de l'immobilisation *}}
|
{{if $valeur_residuelle > 0}}
|
||||||
{{#select
|
<nav class="tabs amort">
|
||||||
line.id as immo_id,
|
<aside>
|
||||||
line.id_account as account_id,
|
{{:linkbutton label="Enregistrer un amortissement" shape="plus" href="save_amort.html?immo_id=%s"|args:$_GET.immo_id target="_dialog"}}
|
||||||
line.id_project as project_id,
|
</aside>
|
||||||
line.debit as montant,
|
</nav>
|
||||||
trans.id as trans_id,
|
{{/if}}
|
||||||
trans.label as label,
|
|
||||||
trans.date,
|
|
||||||
y.id as year_id,
|
|
||||||
y.end_date as date_amort,
|
|
||||||
project.label as project_label
|
|
||||||
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
|
|
||||||
LEFT JOIN acc_projects AS project ON line.id_project = project.id
|
|
||||||
WHERE line.id = :line_id;
|
|
||||||
:line_id = $_GET.immo_id|intval
|
|
||||||
assign=ligne_immo
|
|
||||||
}}
|
|
||||||
{{else}}
|
|
||||||
{{:error message="Immobilisation %s non trouvée"|args:$_GET.immo_id}}
|
|
||||||
{{/select}}
|
|
||||||
{{:assign date_debut=$ligne_immo.date}}
|
|
||||||
|
|
||||||
{{#load type="immo" assign="info_immo" where="$$.line = :line_id" :line_id=$_GET.immo_id|intval}}
|
|
||||||
{{:assign var="duree" from="info_immo.duration"|args:$_GET.immo_id}}
|
|
||||||
{{:assign date_debut=$info_immo.date}}
|
|
||||||
{{/load}}
|
|
||||||
|
|
||||||
{{* chercher des écritures d'amortissement liées à l'immobilisation *}}
|
|
||||||
{{#select
|
|
||||||
l_amort.credit as amort_amount,
|
|
||||||
l_amort.label as amort_label,
|
|
||||||
l_amort.id as amort_line,
|
|
||||||
CASE links.id_related = t_immo.id
|
|
||||||
WHEN true THEN links.id_transaction
|
|
||||||
WHEN false THEN links.id_related
|
|
||||||
END as amort_trans_id,
|
|
||||||
trans.date as amort_date,
|
|
||||||
trans.label as trans_label,
|
|
||||||
trans.id_year as amort_year,
|
|
||||||
account.id as account_id,
|
|
||||||
account.code as account_code,
|
|
||||||
account.label as account_label
|
|
||||||
FROM acc_transactions_lines as l_immo
|
|
||||||
INNER JOIN acc_transactions as t_immo on t_immo.id = l_immo.id_transaction
|
|
||||||
INNER JOIN acc_transactions_links as links
|
|
||||||
ON (
|
|
||||||
t_immo.id = links.id_transaction
|
|
||||||
OR
|
|
||||||
t_immo.id = links.id_related
|
|
||||||
)
|
|
||||||
INNER JOIN acc_transactions_lines as l_amort on amort_trans_id = l_amort.id_transaction
|
|
||||||
INNER join acc_transactions as trans on l_amort.id_transaction = trans.id
|
|
||||||
INNER join acc_accounts as account on l_amort.id_account = account.id
|
|
||||||
WHERE
|
|
||||||
l_immo.id = :line_id
|
|
||||||
AND
|
|
||||||
l_amort.credit <> 0
|
|
||||||
AND
|
|
||||||
account.code LIKE '28%'
|
|
||||||
ORDER BY trans.date;
|
|
||||||
:line_id = $_GET.immo_id|intval
|
|
||||||
assign=linked_lines.
|
|
||||||
}}
|
|
||||||
{{:assign var="amort_years." value=$amort_year}}
|
|
||||||
{{if $date_debut == null}}
|
|
||||||
{{:assign date_debut=$amort_date}}
|
|
||||||
{{/if}}
|
|
||||||
{{/select}}
|
|
||||||
|
|
||||||
<h3>Amortissement de «
|
<h3>Amortissement de «
|
||||||
<a class="num"
|
<a class="num"
|
||||||
|
@ -110,25 +113,6 @@
|
||||||
en date du {{$date_debut|date_short}}{{if $duree != null}} sur {{$duree}} ans{{/if}}
|
en date du {{$date_debut|date_short}}{{if $duree != null}} sur {{$duree}} ans{{/if}}
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
{{if $duree != null}}
|
|
||||||
{{* 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}}
|
|
||||||
{{: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 nbamort=0}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{:assign solde=$ligne_immo.montant}}
|
|
||||||
{{if $linked_lines != null}}
|
{{if $linked_lines != null}}
|
||||||
<section class="amortissement">
|
<section class="amortissement">
|
||||||
<h3 class="center-block ruler">Amortissements rattachés</h3>
|
<h3 class="center-block ruler">Amortissements rattachés</h3>
|
||||||
|
@ -151,8 +135,6 @@
|
||||||
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.amort_trans_id}}
|
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.amort_trans_id}}
|
||||||
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$line.account_id:$line.amort_year}}
|
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$line.account_id:$line.amort_year}}
|
||||||
{{:assign solde="%f-%d"|math:$solde:$line.amort_amount}}
|
{{:assign solde="%f-%d"|math:$solde:$line.amort_amount}}
|
||||||
{{:assign date_amort=$line.amort_date}}
|
|
||||||
{{:assign current_year=$line.amort_year}}
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="num"><a href={{$trans_url}}>#{{$line.amort_trans_id}}</a></td>
|
<td class="num"><a href={{$trans_url}}>#{{$line.amort_trans_id}}</a></td>
|
||||||
<td>{{$line.amort_date|date_short}}</td>
|
<td>{{$line.amort_date|date_short}}</td>
|
||||||
|
@ -168,71 +150,9 @@
|
||||||
<td><a href={{$compte_url}}>{{$line.account_code}}</a></td>
|
<td><a href={{$compte_url}}>{{$line.account_code}}</a></td>
|
||||||
<td>{{$line.account_label}}</td>
|
<td>{{$line.account_label}}</td>
|
||||||
<td>
|
<td>
|
||||||
{{:linkbutton label="Détacher" href="detach_amort.html?amort_id=%d&immo_id=%d"|args:$line.amort_line:$ligne_immo.immo_id shape="plus"}}
|
{{:linkbutton label="Détacher" href="detach_amort.html?amort_id=%d&immo_id=%d"|args:$line.amort_line:$ligne_immo.immo_id shape="minus"}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{:assign annuite_courante=$annuite}}
|
|
||||||
{{:include file="_next_year.html" date=$date_amort keep="date_amort"}}
|
|
||||||
{{:assign nbamort="%d+1"|math:$nbamort}}
|
|
||||||
{{/foreach}}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</section>
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{if $duree != null && $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_courante:$solde}}
|
|
||||||
<section class="amortissement">
|
|
||||||
<h3 class="center-block ruler">Amortissements à enregistrer</h3>
|
|
||||||
<table class="list">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>N°</th>
|
|
||||||
<th>Date</th>
|
|
||||||
<th class="nombre">Montant</th>
|
|
||||||
<th class="nombre">Solde</th>
|
|
||||||
<th>Libellé</th>
|
|
||||||
<th class="actions"></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{{#foreach count="%d+1"|math:$nbamort key="num"}}
|
|
||||||
{{:assign solde_prec=$solde}}
|
|
||||||
{{:assign solde="%f-%d"|math:$solde:$annuite_courante}}
|
|
||||||
{{#select id FROM acc_years WHERE :amort_date >= start_date AND :amort_date <= end_date AND status == 0; :amort_date=$date_amort|parse_date}}
|
|
||||||
{{:assign enregistrer=1}}
|
|
||||||
{{:assign current_year=$id}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign enregistrer=0}}
|
|
||||||
{{/select}}
|
|
||||||
<tr>
|
|
||||||
<td class="num">{{"%d+1"|math:$num}}</td>
|
|
||||||
<td>{{$date_amort|date_short}}</td>
|
|
||||||
<td class="money">{{"%f"|math:$annuite_courante|money}}</td>
|
|
||||||
<td class="money">{{$solde|money:false}}</td>
|
|
||||||
<td>
|
|
||||||
{{if $libelle == null}}
|
|
||||||
{{:assign libelle="Amortissement "|cat:$ligne_immo.label}}
|
|
||||||
{{/if}}
|
|
||||||
{{$libelle}}
|
|
||||||
</td>
|
|
||||||
<td class="actions">
|
|
||||||
{{if $enregistrer == 1}}
|
|
||||||
{{:linkbutton
|
|
||||||
label="Créer l'écriture"
|
|
||||||
href="save_amort.html?amount=%d&account=%s&year=%s&trans_id=%d&immo_id=%s&project_id=%d&label=%s&solde=%d"|args:$annuite_courante:$ligne_immo.account_id:$current_year:$ligne_immo.trans_id:$_GET.immo_id:$project_id:$libelle:$solde_prec
|
|
||||||
shape="right"
|
|
||||||
target="_dialog"
|
|
||||||
}}
|
|
||||||
{{/if}}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{{:include file="_next_year.html" date=$date_amort keep="date_amort"}}
|
|
||||||
{{:assign annuite_courante="min(%f,%f)"|math:$annuite:$solde}}
|
|
||||||
{{if $solde == 0}}{{:break}}{{/if}}
|
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
71
archives.html
Normal file
71
archives.html
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
{{* -*- brindille -*- *}}
|
||||||
|
|
||||||
|
{{* Liste des immobilisations archivées *}}
|
||||||
|
|
||||||
|
<section class="immobilisation">
|
||||||
|
<h2 class="ruler">Immobilisations archivées</h2>
|
||||||
|
|
||||||
|
{{:assign nb_immo=0}}
|
||||||
|
<table class="list">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>N°</th>
|
||||||
|
<th>Date</th>
|
||||||
|
<th>Libellé</th>
|
||||||
|
<th class="nombre">Montant</th>
|
||||||
|
<th>N° compte</th>
|
||||||
|
<th>Compte</th>
|
||||||
|
<th>Projet</th>
|
||||||
|
<th class="actions"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
{{#load type="immo" where="$$.status = 'archived'"}}
|
||||||
|
{{:assign var="lines." value="'%s'"|args:$line}}
|
||||||
|
{{/load}}
|
||||||
|
{{:assign lines=$lines|implode:","}}
|
||||||
|
{{:assign lines="("|cat:$lines|cat:")"}}
|
||||||
|
{{:assign condition="line.id IN %s"|args:$lines}}
|
||||||
|
|
||||||
|
{{#select
|
||||||
|
trans.id as trans_id,
|
||||||
|
trans.label as trans_label,
|
||||||
|
trans.date as trans_date,
|
||||||
|
line.id as immo_id,
|
||||||
|
account.id as account_id,
|
||||||
|
account.code as account_code,
|
||||||
|
account.label as account_label,
|
||||||
|
line.debit AS debit,
|
||||||
|
project.label as project_label,
|
||||||
|
trans.id_year as trans_id_year
|
||||||
|
FROM acc_transactions AS trans
|
||||||
|
INNER JOIN acc_transactions_lines AS line ON line.id_transaction = trans.id
|
||||||
|
INNER JOIN acc_accounts AS account ON line.id_account = account.id
|
||||||
|
INNER JOIN acc_years AS years ON trans.id_year = years.id
|
||||||
|
LEFT JOIN acc_projects AS project ON line.id_project = project.id
|
||||||
|
WHERE !condition
|
||||||
|
ORDER BY trans.date DESC;
|
||||||
|
!condition=$condition
|
||||||
|
}}
|
||||||
|
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$trans_id}}
|
||||||
|
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$account_id:$trans_id_year}}
|
||||||
|
{{:assign nb_immo="%d+1"|math:$nb_immo}}
|
||||||
|
<tr>
|
||||||
|
<td class="num"><a href={{$trans_url}}>#{{$trans_id}}</a></td>
|
||||||
|
<td>{{$trans_date|date_short}}</td>
|
||||||
|
<td>{{$trans_label}}</td>
|
||||||
|
<td class="money">{{"%f"|math:$debit|money:false}}</td>
|
||||||
|
<td><a href={{$compte_url}}>{{$account_code}}</a></td>
|
||||||
|
<td>{{$account_label}}</td>
|
||||||
|
<td>{{$project_label}}</td>
|
||||||
|
<td class="actions">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{{/select}}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{{if $nb_immo == 0}}
|
||||||
|
<p class="block alert">Aucune immobilisation</p>
|
||||||
|
{{/if}}
|
||||||
|
</section>
|
220
balance_sheet_exit.html
Normal file
220
balance_sheet_exit.html
Normal file
|
@ -0,0 +1,220 @@
|
||||||
|
{{* -*- brindille -*- *}}
|
||||||
|
|
||||||
|
{{*
|
||||||
|
Sortir une immobilisation du bilan
|
||||||
|
@param immo_id : id de la ligne d'immobilisation
|
||||||
|
*}}
|
||||||
|
|
||||||
|
{{* Infos de l'immobilisation *}}
|
||||||
|
{{#select
|
||||||
|
line.debit as montant,
|
||||||
|
trans.date as date_achat,
|
||||||
|
trans.label
|
||||||
|
FROM acc_transactions_lines AS line
|
||||||
|
INNER JOIN acc_transactions AS trans ON line.id_transaction = trans.id
|
||||||
|
WHERE line.id = :line_id;
|
||||||
|
:line_id = $_GET.immo_id|intval
|
||||||
|
assign="ligne_immo"
|
||||||
|
}}
|
||||||
|
{{else}}
|
||||||
|
{{:error message="Immobilisation %s non trouvée"|args:$_GET.immo_id}}
|
||||||
|
{{/select}}
|
||||||
|
|
||||||
|
{{:assign date_debut=$ligne_immo.date_achat}}
|
||||||
|
{{:assign ts_mes=$ligne_immo.date_achat|strtotime}}
|
||||||
|
|
||||||
|
{{#load type="immo" assign="info_immo" where="$$.line = :line_id" :line_id=$_GET.immo_id|intval}}
|
||||||
|
{{:assign ts_mes=$date|strtotime}}
|
||||||
|
{{:assign date_debut=$date}}
|
||||||
|
{{:assign duree_amort=$duration}}
|
||||||
|
{{/load}}
|
||||||
|
|
||||||
|
{{* chercher des écritures d'amortissement liées à l'immobilisation *}}
|
||||||
|
{{#select
|
||||||
|
SUM(l_amort.credit) as amort_amount,
|
||||||
|
CASE
|
||||||
|
WHEN links.id_related = t_immo.id
|
||||||
|
THEN links.id_transaction
|
||||||
|
ELSE links.id_related
|
||||||
|
END as amort_trans_id,
|
||||||
|
MAX(trans.date) as last_amort_date,
|
||||||
|
MIN(trans.date) as first_amort_date,
|
||||||
|
COUNT(trans.id) as amort_number
|
||||||
|
FROM acc_transactions_lines as l_immo
|
||||||
|
INNER JOIN acc_transactions as t_immo on t_immo.id = l_immo.id_transaction
|
||||||
|
INNER JOIN acc_transactions_links as links
|
||||||
|
ON (t_immo.id = links.id_transaction
|
||||||
|
OR
|
||||||
|
t_immo.id = links.id_related)
|
||||||
|
INNER JOIN acc_transactions_lines as l_amort on amort_trans_id = l_amort.id_transaction
|
||||||
|
INNER join acc_transactions as trans on l_amort.id_transaction = trans.id
|
||||||
|
INNER JOIN acc_accounts AS account ON l_amort.id_account = account.id
|
||||||
|
WHERE l_immo.id = :line_id AND account.code LIKE '28%'
|
||||||
|
LIMIT 1;
|
||||||
|
:line_id = $_GET.immo_id|intval
|
||||||
|
assign=amort_line
|
||||||
|
}}
|
||||||
|
{{/select}}
|
||||||
|
|
||||||
|
{{if $amort_line.amort_number == 0}}
|
||||||
|
{{:assign amort_amount=0}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign amort_amount=$amort_line.amort_amount}}
|
||||||
|
{{:assign date_debut=$amort_line.last_amort_date|strtotime}}
|
||||||
|
{{:assign date_debut="%d+(60*60*24)"|math:$date_debut|date:"Y-m-d"}}
|
||||||
|
{{/if}}
|
||||||
|
{{:assign ts_debut=$date_debut|strtotime}}
|
||||||
|
{{:assign valeur_nette="%f-%f"|math:$ligne_immo.montant:$amort_amount}}
|
||||||
|
|
||||||
|
{{*
|
||||||
|
lister les exercices qui englobent la date de début du prochain amortissement
|
||||||
|
*}}
|
||||||
|
{{:assign default_exit_date=""}}
|
||||||
|
{{#years closed=false order="start_date" where="start_date <= :debut AND :debut <= end_date"
|
||||||
|
:debut=$date_debut assign=years.}}
|
||||||
|
{{if $start_date|strtotime <= $now && $now <= $end_date|strtotime}}
|
||||||
|
{{:assign default_exit_date=$now|date_short}}
|
||||||
|
{{/if}}
|
||||||
|
{{:assign ts_fin=$end_date|strtotime}}
|
||||||
|
{{: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}}
|
||||||
|
{{if $years|count == 1}}
|
||||||
|
{{:assign default_year=$years.0.id}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign default_year=""}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{* Traiter l'envoi du formulaire *}}
|
||||||
|
{{#form on="proceed"}}
|
||||||
|
|
||||||
|
{{if $_POST.date_sortie == null}}
|
||||||
|
{{:error message="Vous devez renseigner la date de sortie"}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{* vérifier la validité de la date de mise en service *}}
|
||||||
|
{{if $_POST.date_mes != null}}
|
||||||
|
{{:assign ts_mes=$_POST.date_mes|parse_date|strtotime}}
|
||||||
|
{{if $ts_mes < $ligne_immo.date_achat|strtotime || $ts_mes > $amort_line.first_amort_date|strtotime}}
|
||||||
|
{{:assign immo_date=$ligne_immo.date_achat|date_short}}
|
||||||
|
{{:assign amort_date=$amort_line.first_amort_date|date_short}}
|
||||||
|
{{:error message="La date de mise en service doit être postérieure à la date d'acquisition de l'immobilisation (%s) et antérieure à la date du premier amortissement (%s)"|args:$immo_date:$amort_date}}
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{* vérifier la validité de la durée d'immobilisation *}}
|
||||||
|
{{if $valeur_nette > 0}}
|
||||||
|
{{if $info_immo.duration == null}}
|
||||||
|
{{if $_POST.duree == null}}
|
||||||
|
{{:error message="Vous devez renseigner la durée de l'immobilisation"}}
|
||||||
|
{{elseif $_POST.duree < $amort_line.amort_number}}
|
||||||
|
{{:error message="La durée de l'amortissement ne peut être inférieure au nombre d'écritures d'amortissement (%d)"|args:$amort_line.amort_number}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign duree_amort=$_POST.duree}}
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{* vérifier la validité de la date de sortie *}}
|
||||||
|
{{if $info_immo.date != null}}
|
||||||
|
{{if $_POST.date_sortie|parse_date < $info_immo.date}}
|
||||||
|
{{:assign immo_date=$info_immo.date|date_short}}
|
||||||
|
{{:error message="La date de sortie doit être postérieure à la date de mise en service de l'immobilisation (%s)"|args:$immo_date}}
|
||||||
|
{{/if}}
|
||||||
|
{{elseif $_POST.date_mes != null}}
|
||||||
|
{{if $_POST.date_sortie|parse_date < $_POST.date_mes|parse_date}}
|
||||||
|
{{:error message="La date de sortie doit être postérieure à la date de mise en service de l'immobilisation (%s)"|args:$_POST.date_mes}}
|
||||||
|
{{/if}}
|
||||||
|
{{elseif $_POST.date_sortie|parse_date < $ligne_immo.date_achat}}
|
||||||
|
{{:assign immo_date=$ligne_immo.date_achat|date_short}}
|
||||||
|
{{:error message="La date de sortie doit être postérieure à la date d'acquisition de l'immobilisation (%s)"|args:$immo_date}}
|
||||||
|
{{/if}}
|
||||||
|
{{if $amort_line.amort_number != 0 && $_POST.date_sortie|parse_date <= $amort_line.last_amort_date}}
|
||||||
|
{{:assign last_amort_date=$amort_line.last_amort_date|date_short}}
|
||||||
|
{{:error message="La date de sortie doit être postérieure à la date de la dernière immobilisation (%s)"|args:$last_amort_date}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{* 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}}
|
||||||
|
{{#foreach from=$years}}
|
||||||
|
{{if $id == $_POST.id_year}}
|
||||||
|
{{:assign selected_year=$id}}
|
||||||
|
{{if $start_date|strtotime <= $ts_exit && $ts_exit <= $end_date|strtotime}}
|
||||||
|
{{:assign ok=true}}
|
||||||
|
{{:break}}
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
{{/foreach}}
|
||||||
|
{{if ! $ok}}
|
||||||
|
{{:error message="La date choisie n'est pas dans l'exercice sélectionné !"}}
|
||||||
|
{{/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" subsubcurrent="balance_exit"}}
|
||||||
|
{{/if}}
|
||||||
|
{{:form_errors}}
|
||||||
|
|
||||||
|
{{* formulaire de sortie du bilan *}}
|
||||||
|
<h3>Sortir l'immobilisation « {{$ligne_immo.label}} » du bilan</h3>
|
||||||
|
<form method="post" action="">
|
||||||
|
|
||||||
|
<div class="informations">
|
||||||
|
<legend>Données de l'imobilisation</legend>
|
||||||
|
<dl class="describe">
|
||||||
|
<dt>Montant</dt>
|
||||||
|
<dd id="montant_immo" class="money">{{$ligne_immo.montant|money_currency:false}}</dd>
|
||||||
|
<dt>Date d'acquisition</dt>
|
||||||
|
<dd >{{$ligne_immo.date_achat|date_short}}</dd>
|
||||||
|
{{if $info_immo.date != null && $info_immo.date != $ligne_immo.date_achat}}
|
||||||
|
<dt>Date de mise en service</dt>
|
||||||
|
<dd>{{$info_immo.date|date_short}}</dd>
|
||||||
|
{{/if}}
|
||||||
|
{{if $info_immo.duration != null}}
|
||||||
|
<dt>Durée de l'amortissement</dt>
|
||||||
|
<dd id="duree_amort" class="num">{{$info_immo.duration}} ans</dd>
|
||||||
|
{{/if}}
|
||||||
|
<dt>Montant des amortissements</dt>
|
||||||
|
<dd id="montant_amort" class="money">{{$amort_amount|money_currency:false}} <span class="help">(à la date de début de l'exercice)</span></dd>
|
||||||
|
<dt>Valeur nette résiduelle</dt>
|
||||||
|
<dd class="money">{{$valeur_nette|money_currency:false}} <span class="help">(à la date de début de l'exercice)</span></dd>
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
{{if $valeur_nette > 0}}
|
||||||
|
{{if $info_immo.date == null || $info_immo.duration == null}}
|
||||||
|
<fieldset>
|
||||||
|
<legend>Informations sur l'immobilisation</legend>
|
||||||
|
<dl>
|
||||||
|
{{if $info_immo.date == null}}
|
||||||
|
{{:input type="date" name="date_mes" label="Date de mise en service" help="C'est la date de première utilisation ; à renseigner uniquement si différente de la date d'acquisition"}}
|
||||||
|
{{/if}}
|
||||||
|
{{if $info_immo.duration == null}}
|
||||||
|
{{:input type="number" name="duree" label="Durée d'amortissement" required=true min=1 help="La durée est nécessaire pour calculer l'amortissement complémentaire"}}
|
||||||
|
{{/if}}
|
||||||
|
</dl>
|
||||||
|
</fieldset>
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
<fieldset>
|
||||||
|
<legend>Informations de sortie</legend>
|
||||||
|
<dl>
|
||||||
|
{{:input type="select" default=$default_year name="id_year" label="Exercice" required=true default_empty="— Faire un choix —" options=$open_years}}
|
||||||
|
{{:input type="date" name="date_sortie" label="Date de sortie du bilan" required=true default=$default_exit_date}}
|
||||||
|
</dl>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<p class="submit">
|
||||||
|
{{:button type="submit" name="proceed" label="Poursuivre" shape="right" class="main"}}
|
||||||
|
</p>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
{{:admin_footer}}
|
133
compute_exit_data.html
Normal file
133
compute_exit_data.html
Normal file
|
@ -0,0 +1,133 @@
|
||||||
|
{{* -*- brindille -*- *}}
|
||||||
|
|
||||||
|
{{*
|
||||||
|
Calculer les valeurs de la sortie et saisir le montant de la cession (optionnel)
|
||||||
|
paramètres :
|
||||||
|
- immo_id : numéro de ligne de l'écriture d'immobilisation
|
||||||
|
- amort_amount : montant des amortissements
|
||||||
|
- year : exercice de la date de sortie de l'immobilisation
|
||||||
|
- date_mes : datede mise en service de l'immobilisation
|
||||||
|
- date_debut : date de début de la période d'amortissement complémentaire
|
||||||
|
- exit_date : date de sortie de l'immobilisation
|
||||||
|
- duree_amort : durée de l'amortiseement (optionnel)
|
||||||
|
*}}
|
||||||
|
|
||||||
|
{{#select
|
||||||
|
line.debit as montant,
|
||||||
|
trans.date as date_achat,
|
||||||
|
trans.label
|
||||||
|
FROM acc_transactions_lines AS line
|
||||||
|
INNER JOIN acc_transactions AS trans ON line.id_transaction = trans.id
|
||||||
|
WHERE line.id = :line_id;
|
||||||
|
:line_id = $_GET.immo_id|intval
|
||||||
|
assign="ligne_immo"
|
||||||
|
}}
|
||||||
|
{{else}}
|
||||||
|
{{:error message="Immobilisation %s non trouvée"|args:$_GET.immo_id}}
|
||||||
|
{{/select}}
|
||||||
|
|
||||||
|
{{:assign valeur_nette="%f-%f"|math:$ligne_immo.montant:$_GET.amort_amount}}
|
||||||
|
{{:assign amort_comp=0}} {{* amortissement complémentaire jqà date sortie *}}
|
||||||
|
{{if $valeur_nette > 0}}
|
||||||
|
{{:assign nbjours="1+(%d-%d)/(60*60*24)"|math:$_GET.exit_date:$_GET.date_debut}}
|
||||||
|
{{:assign annuite="%f/%f"|math:$ligne_immo.montant:$_GET.duree_amort}}
|
||||||
|
{{:assign amort_comp="round(%f/365*%f, 0)"|math:$annuite:$nbjours}}
|
||||||
|
{{:assign amort_comp="min(%f, %f)"|math:$valeur_nette:$amort_comp}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{* Traiter l'envoi du formulaire *}}
|
||||||
|
{{#form on="proceed"}}
|
||||||
|
{{:debug post=$_POST}}
|
||||||
|
{{if $_POST.cession != null}}
|
||||||
|
{{if $_POST.montant_cession == null}}
|
||||||
|
{{:error message="Vous devez saisir le montant de la cession"}}
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{:redirect to="write_exit.html?immo_id=%s&amort_amount=%s&year=%s&date_mes=%s&date_debut=%s&exit_date=%s&duree_amort=%s&cession=%s"|args:$_GET.immo_id:$_GET.amort_amount:$_GET.year:$_GET.date_mes:$_GET.date_debut:$_GET.exit_date:$_GET.duree_amort:$_POST.montant_cession}}
|
||||||
|
|
||||||
|
{{/form}}
|
||||||
|
{{:admin_header title="Sortie du bilan" custom_css="./style.css" current="module_amortissement"}}
|
||||||
|
|
||||||
|
{{* barre de navigation *}}
|
||||||
|
{{if ! $dialog}}
|
||||||
|
{{:include file="_nav.html" current="index" subsubcurrent="balance_exit"}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{:form_errors}}
|
||||||
|
|
||||||
|
<h3>Sortir l'immobilisation « {{$ligne_immo.label}} » du bilan</h3>
|
||||||
|
<form method="post" action="">
|
||||||
|
|
||||||
|
<div class="informations">
|
||||||
|
<legend>Données de l'imobilisation</legend>
|
||||||
|
<dl class="describe">
|
||||||
|
<dt>Montant</dt>
|
||||||
|
<dd id="montant_immo" class="money">{{$ligne_immo.montant|money_currency:false}}</dd>
|
||||||
|
<dt>Date d'acquisition</dt>
|
||||||
|
<dd >{{$ligne_immo.date_achat|date_short}}</dd>
|
||||||
|
{{if $_GET.date_mes != $ligne_immo.date_achat|strtotime}}
|
||||||
|
<dt>Date de mise en service</dt>
|
||||||
|
<dd>{{$_GET.date_mes|date:"d/m/Y"}}</dd>
|
||||||
|
{{/if}}
|
||||||
|
{{if $_GET.duree_amort != null}}
|
||||||
|
<dt>Durée de l'amortissement</dt>
|
||||||
|
<dd id="duree_amort" class="num">{{$_GET.duree_amort}} ans</dd>
|
||||||
|
{{/if}}
|
||||||
|
<dt>Montant des amortissements</dt>
|
||||||
|
<dd id="montant_amort" class="money">{{$_GET.amort_amount|money_currency:false}} <span class="help">(à la date de début de l'exercice)</span></dd>
|
||||||
|
<dt>Valeur nette résiduelle</dt>
|
||||||
|
<dd class="money">{{$valeur_nette|money_currency:false}} <span class="help">(à la date de début de l'exercice)</span></dd>
|
||||||
|
<dt>Date de sortie</dt>
|
||||||
|
<dd>{{$_GET.exit_date|date:"d/m/Y"}}</dd>
|
||||||
|
{{if $amort_comp > 0}}
|
||||||
|
<dt>Amortissement complémentaire</dt>
|
||||||
|
<dd class="money">{{$amort_comp|money_currency:false}} <span class="help">(jusqu'à la date de sortie)</span></dd>
|
||||||
|
<dt>Total des amortissements</dt>
|
||||||
|
<dd class="money">{{"%f+%f"|math:$_GET.amort_amount:$amort_comp|money_currency:false}} <span class="help">(à la date de sortie)</span></dd>
|
||||||
|
<dt>Valeur nette résiduelle</dt>
|
||||||
|
<dd class="money">{{"%f-%f"|math:$valeur_nette:$amort_comp|money_currency:false}} <span class="help">(à la date de sortie)</span></dd>
|
||||||
|
{{/if}}
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
<fieldset>
|
||||||
|
<legend>Informations de sortie</legend>
|
||||||
|
<dl>
|
||||||
|
{{:input type="checkbox" value=1 name="cession" label="Cession" help="Cocher si la sortie est due à une cession" onclick="toggleHiddenAndFocus('f_cession_1', ['infos_cession'], 'f_montant_cession')"}}
|
||||||
|
<div id="infos_cession" class="hidden">
|
||||||
|
{{:input type="money" name="montant_cession" label="Montant de la cession" required=true}}
|
||||||
|
</div>
|
||||||
|
</dl>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<p class="submit">
|
||||||
|
{{:button type="submit" name="proceed" label="Poursuivre" shape="right" class="main"}}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
/*
|
||||||
|
- activer/désactiver les champs passés en paramètres
|
||||||
|
- donner le focus au champ de saisie du montant
|
||||||
|
*/
|
||||||
|
function toggleHiddenAndFocus(idcb, idfields, idinput) {
|
||||||
|
const cession = document.getElementById(idcb);
|
||||||
|
for (let id of idfields) {
|
||||||
|
const field = document.getElementById(id);
|
||||||
|
if (cession.checked) {
|
||||||
|
field.setAttribute("class", "");
|
||||||
|
document.getElementById(idinput).focus();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
field.setAttribute("class","hidden")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
toggleHiddenAndFocus('f_cession_1', ['infos_cession'], 'f_montant_cession');
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{{:admin_footer}}
|
|
@ -3,11 +3,12 @@
|
||||||
{{* Liste des immobilisations amortissable ou à définir *}}
|
{{* Liste des immobilisations amortissable ou à définir *}}
|
||||||
|
|
||||||
<section class="immobilisation">
|
<section class="immobilisation">
|
||||||
{{if $amort == "amort"}}
|
{{if $amort == "encours"}}
|
||||||
<h2 class="ruler">Immobilisations en cours</h2>
|
<h2 class="ruler">Immobilisations en cours</h2>
|
||||||
{{else}}
|
{{elseif $amort == "fini"}}
|
||||||
<h2 class="ruler">Immobilisations amorties</h2>
|
<h2 class="ruler">Immobilisations amorties</h2>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{:assign nb_immo=0}}
|
||||||
|
|
||||||
<table class="list">
|
<table class="list">
|
||||||
<thead>
|
<thead>
|
||||||
|
@ -19,7 +20,6 @@
|
||||||
<th class="nombre">Durée</th>
|
<th class="nombre">Durée</th>
|
||||||
<th>N° compte</th>
|
<th>N° compte</th>
|
||||||
<th>Compte</th>
|
<th>Compte</th>
|
||||||
<th>Projet</th>
|
|
||||||
<th class="actions"></th>
|
<th class="actions"></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
@ -46,13 +46,11 @@
|
||||||
account.code as account_code,
|
account.code as account_code,
|
||||||
account.label as account_label,
|
account.label as account_label,
|
||||||
line.debit AS debit,
|
line.debit AS debit,
|
||||||
project.label as project_label,
|
|
||||||
trans.id_year as trans_id_year
|
trans.id_year as trans_id_year
|
||||||
FROM acc_transactions AS trans
|
FROM acc_transactions AS trans
|
||||||
INNER JOIN acc_transactions_lines AS line ON line.id_transaction = trans.id
|
INNER JOIN acc_transactions_lines AS line ON line.id_transaction = trans.id
|
||||||
INNER JOIN acc_accounts AS account ON line.id_account = account.id
|
INNER JOIN acc_accounts AS account ON line.id_account = account.id
|
||||||
INNER JOIN acc_years AS years ON trans.id_year = years.id
|
INNER JOIN acc_years AS years ON trans.id_year = years.id
|
||||||
LEFT JOIN acc_projects AS project ON line.id_project = project.id
|
|
||||||
WHERE !condition
|
WHERE !condition
|
||||||
ORDER BY trans.date DESC;
|
ORDER BY trans.date DESC;
|
||||||
!condition=$condition
|
!condition=$condition
|
||||||
|
@ -63,7 +61,7 @@
|
||||||
{{* voir si l'immo est prise en charge *}}
|
{{* voir si l'immo est prise en charge *}}
|
||||||
{{#load type="immo" where="$$.line = :line_id" :line_id=$immo_id|intval}}
|
{{#load type="immo" where="$$.line = :line_id" :line_id=$immo_id|intval}}
|
||||||
{{:assign duration=$duration}}
|
{{:assign duration=$duration}}
|
||||||
{{if $noamort}}
|
{{if $status == "ignored"}}
|
||||||
{{:assign amortissable="non"}}
|
{{:assign amortissable="non"}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign amortissable="oui"}}
|
{{:assign amortissable="oui"}}
|
||||||
|
@ -74,6 +72,32 @@
|
||||||
{{if $amortissable == "non"}}
|
{{if $amortissable == "non"}}
|
||||||
{{:continue}}
|
{{:continue}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
{{* voir s'il existe une écriture qui solde l'immobilisation *}}
|
||||||
|
{{:assign ignore=false}}
|
||||||
|
{{#select
|
||||||
|
line.id AS line,
|
||||||
|
line.id_transaction AS trans,
|
||||||
|
line.debit,
|
||||||
|
line.label,
|
||||||
|
line2.id AS line2,
|
||||||
|
line2.id_transaction AS trans2,
|
||||||
|
line2.credit,
|
||||||
|
line2.label
|
||||||
|
FROM acc_transactions_lines AS line
|
||||||
|
INNER JOIN acc_accounts AS acc ON acc.id = line.id_account
|
||||||
|
INNER JOIN acc_transactions_lines AS line2 ON line2.id_account = acc.id
|
||||||
|
WHERE
|
||||||
|
line.id = :line_id
|
||||||
|
AND line2.credit = line.debit;
|
||||||
|
:line_id = $immo_id|intval
|
||||||
|
}}
|
||||||
|
{{:assign ignore=true}}
|
||||||
|
{{/select}}
|
||||||
|
{{if $ignore}}
|
||||||
|
{{:continue}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{* voir s'il existe des écritures d'amortissement associées *}}
|
{{* voir s'il existe des écritures d'amortissement associées *}}
|
||||||
{{#select
|
{{#select
|
||||||
sum(l_amort.credit) as amort_amount,
|
sum(l_amort.credit) as amort_amount,
|
||||||
|
@ -107,12 +131,15 @@
|
||||||
{{:assign exist_amort=true}}
|
{{:assign exist_amort=true}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
{{* immo amortie ? *}}
|
|
||||||
{{if $amort == "amort" && $amort_amount >= $debit ||
|
{{* classement par onglet *}}
|
||||||
$amort == "fini" && $amort_amount < $debit
|
{{if $amort == "encours" && $amort_amount >= $debit ||
|
||||||
|
$amort == "fini" && $amort_amount < $debit ||
|
||||||
|
$amortissable == "nsp" && ! $exist_amort
|
||||||
}}
|
}}
|
||||||
{{:continue}}
|
{{:continue}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{:assign nb_immo="%d+1"|math:$nb_immo}}
|
||||||
<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>
|
||||||
|
@ -121,33 +148,40 @@
|
||||||
<td class="money">{{if $duration != null}}{{$duration}}{{/if}}</td>
|
<td class="money">{{if $duration != null}}{{$duration}}{{/if}}</td>
|
||||||
<td><a href={{$compte_url}}>{{$account_code}}</a></td>
|
<td><a href={{$compte_url}}>{{$account_code}}</a></td>
|
||||||
<td>{{$account_label}}</td>
|
<td>{{$account_label}}</td>
|
||||||
<td>{{$project_label}}</td>
|
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
{{if ! $exist_amort && $duration == null}}
|
|
||||||
{{:linkbutton
|
|
||||||
label="Ajouter infos"
|
|
||||||
href="add_infos.html?immo_id=%s&amort=1"|args:$immo_id
|
|
||||||
shape="help"
|
|
||||||
target="_dialog"
|
|
||||||
}}
|
|
||||||
{{else}}
|
|
||||||
{{if ! $exist_amort}}
|
{{if ! $exist_amort}}
|
||||||
{{:linkbutton
|
{{:linkbutton
|
||||||
label="Modifier infos"
|
label="Modifier infos"
|
||||||
href="modif_infos.html?immo_id=%s&amort=1"|args:$immo_id
|
href="modif_infos.html?immo_id=%s&amort=1"|args:$immo_id
|
||||||
shape="help"
|
shape="settings"
|
||||||
target="_dialog"
|
target="_dialog"
|
||||||
}}
|
}}
|
||||||
|
{{elseif $amortissable == "nsp"}}
|
||||||
|
{{:linkbutton
|
||||||
|
label="Ajouter infos"
|
||||||
|
href="add_infos.html?immo_id=%s&amort=1"|args:$immo_id
|
||||||
|
shape="settings"
|
||||||
|
target="_dialog"
|
||||||
|
}}
|
||||||
|
{{/if}}
|
||||||
|
{{if $amort == "encours" || $amort == "fini"}}
|
||||||
|
{{:linkbutton
|
||||||
|
label="Sortir du bilan"
|
||||||
|
href="balance_sheet_exit.html?immo_id=%s"|args:$immo_id
|
||||||
|
shape="export"
|
||||||
|
}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:linkbutton
|
{{:linkbutton
|
||||||
label="Amortissements"
|
label="Amortissements"
|
||||||
href="amortization.html?immo_id=%s&amort=%s"|args:$immo_id:$amort
|
href="amortization.html?immo_id=%s&amort=%s"|args:$immo_id:$amort
|
||||||
shape="table"
|
shape="table"
|
||||||
}}
|
}}
|
||||||
{{/if}}
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/select}}
|
{{/select}}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
{{if $nb_immo == 0}}
|
||||||
|
<p class="block alert">Aucune immobilisation</p>
|
||||||
|
{{/if}}
|
||||||
</section>
|
</section>
|
||||||
|
|
129
immobilisations_autres.html
Normal file
129
immobilisations_autres.html
Normal file
|
@ -0,0 +1,129 @@
|
||||||
|
{{* -*- brindille -*- *}}
|
||||||
|
|
||||||
|
{{* Liste des immobilisations non amortissables ou non (encore) gérées *}}
|
||||||
|
|
||||||
|
<section class="immobilisation">
|
||||||
|
<h2 class="ruler">Autres immobilisations</h2>
|
||||||
|
|
||||||
|
<table class="list">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>N°</th>
|
||||||
|
<th>Date</th>
|
||||||
|
<th>Libellé</th>
|
||||||
|
<th class="nombre">Montant</th>
|
||||||
|
<th>N° compte</th>
|
||||||
|
<th>Compte</th>
|
||||||
|
<th class="actions"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
{{* lister les immobilisations *}}
|
||||||
|
{{:read file="./defaut.json" assign="config_json"}}
|
||||||
|
{{:assign config_defaut=$config_json|json_decode}}
|
||||||
|
{{:assign var="prefix_array" value=$config_defaut.prefixes|keys}}
|
||||||
|
{{:assign condition="("}}
|
||||||
|
{{#foreach from=$prefix_array item="code"}}
|
||||||
|
{{:assign code=$code|cat:"%"|quote_sql}}
|
||||||
|
{{:assign condition=$condition|cat:" account.code LIKE "|cat:$code|cat:" OR "}}
|
||||||
|
{{/foreach}}
|
||||||
|
{{:assign condition=$condition|cat:"0)"}}
|
||||||
|
{{:assign condition=$condition|cat:" AND debit > 0 AND NOT (trans.status & 16)"}}
|
||||||
|
|
||||||
|
{{#select
|
||||||
|
trans.id as trans_id,
|
||||||
|
trans.label as trans_label,
|
||||||
|
trans.date as trans_date,
|
||||||
|
line.id as immo_id,
|
||||||
|
account.id as account_id,
|
||||||
|
account.code as account_code,
|
||||||
|
account.label as account_label,
|
||||||
|
line.debit AS debit,
|
||||||
|
trans.id_year as trans_id_year
|
||||||
|
FROM acc_transactions AS trans
|
||||||
|
INNER JOIN acc_transactions_lines AS line ON line.id_transaction = trans.id
|
||||||
|
INNER JOIN acc_accounts AS account ON line.id_account = account.id
|
||||||
|
INNER JOIN acc_years AS years ON trans.id_year = years.id
|
||||||
|
WHERE !condition
|
||||||
|
ORDER BY trans.date DESC;
|
||||||
|
!condition=$condition
|
||||||
|
}}
|
||||||
|
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$trans_id}}
|
||||||
|
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$account_id:$trans_id_year}}
|
||||||
|
{{* voir si l'immo est prise en charge *}}
|
||||||
|
{{#load type="immo" where="$$.line = :line_id" :line_id=$immo_id|intval}}
|
||||||
|
{{:assign status=$status}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign status="nsp"}}
|
||||||
|
{{/load}}
|
||||||
|
{{if $status != "ignored" && $status != "nsp"}}
|
||||||
|
{{:continue}}
|
||||||
|
{{/if}}
|
||||||
|
{{*:debug immo_id=$immo_id status=$status*}}
|
||||||
|
|
||||||
|
{{* voir s'il existe des écritures d'amortissement associées *}}
|
||||||
|
{{#select
|
||||||
|
sum(l_amort.credit) as amort_amount,
|
||||||
|
CASE links.id_related = t_immo.id
|
||||||
|
WHEN true THEN links.id_transaction
|
||||||
|
WHEN false THEN links.id_related
|
||||||
|
END as amort_trans_id
|
||||||
|
FROM acc_transactions_lines as l_immo
|
||||||
|
INNER JOIN acc_transactions as t_immo on t_immo.id = l_immo.id_transaction
|
||||||
|
INNER JOIN acc_transactions_links as links
|
||||||
|
ON (
|
||||||
|
t_immo.id = links.id_transaction
|
||||||
|
OR
|
||||||
|
t_immo.id = links.id_related
|
||||||
|
)
|
||||||
|
INNER JOIN acc_transactions_lines as l_amort on amort_trans_id = l_amort.id_transaction
|
||||||
|
INNER JOIN acc_accounts AS account ON l_amort.id_account = account.id
|
||||||
|
WHERE
|
||||||
|
l_immo.id = :line_id
|
||||||
|
AND
|
||||||
|
l_amort.credit <> 0
|
||||||
|
AND
|
||||||
|
account.code LIKE '28%';
|
||||||
|
:line_id = $immo_id|intval
|
||||||
|
}}
|
||||||
|
{{if $amort_amount != null}}
|
||||||
|
{{:assign ignore=true}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign ignore=false}}
|
||||||
|
{{/if}}
|
||||||
|
{{/select}}
|
||||||
|
|
||||||
|
{{if $ignore}}
|
||||||
|
{{:continue}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="num"><a href={{$trans_url}}>#{{$trans_id}}</a></td>
|
||||||
|
<td>{{$trans_date|date_short}}</td>
|
||||||
|
<td>{{$trans_label}}</td>
|
||||||
|
<td class="money">{{"%f"|math:$debit|money:false}}</td>
|
||||||
|
<td><a href={{$compte_url}}>{{$account_code}}</a></td>
|
||||||
|
<td>{{$account_label}}</td>
|
||||||
|
<td class="actions">
|
||||||
|
{{if $status == "nsp"}}
|
||||||
|
{{:linkbutton
|
||||||
|
label="Ajouter infos"
|
||||||
|
href="add_infos.html?immo_id=%s&amort=1"|args:$immo_id
|
||||||
|
shape="settings"
|
||||||
|
target="_dialog"
|
||||||
|
}}
|
||||||
|
{{else}}
|
||||||
|
{{:linkbutton
|
||||||
|
label="Modifier infos"
|
||||||
|
href="modif_infos.html?immo_id=%s&amort=0"|args:$immo_id
|
||||||
|
shape="help"
|
||||||
|
target="_dialog"
|
||||||
|
}}
|
||||||
|
{{/if}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{{/select}}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</section>
|
|
@ -20,12 +20,13 @@
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
||||||
{{#load type="immo" where="$$.noamort = true"}}
|
{{#load type="immo" where="$$.status = 'ignored'"}}
|
||||||
{{:assign var="lines." value="'%s'"|args:$line}}
|
{{:assign var="lines." value="'%s'"|args:$line}}
|
||||||
{{/load}}
|
{{/load}}
|
||||||
{{:assign lines=$lines|implode:","}}
|
{{:assign lines=$lines|implode:","}}
|
||||||
{{:assign lines="("|cat:$lines|cat:")"}}
|
{{:assign lines="("|cat:$lines|cat:")"}}
|
||||||
{{:assign condition="line.id IN %s"|args:$lines}}
|
{{:assign condition="line.id IN %s"|args:$lines}}
|
||||||
|
{{:debug condition=$condition}}
|
||||||
{{#select
|
{{#select
|
||||||
trans.id as trans_id,
|
trans.id as trans_id,
|
||||||
trans.label as trans_label,
|
trans.label as trans_label,
|
||||||
|
|
13
index.html
13
index.html
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
{{* barre de navigation *}}
|
{{* barre de navigation *}}
|
||||||
{{if $_GET.amort == null}}
|
{{if $_GET.amort == null}}
|
||||||
{{:assign amort="amort"}}
|
{{:assign amort="encours"}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign amort=$_GET.amort}}
|
{{:assign amort=$_GET.amort}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
{{:delete key=$key}}
|
{{:delete key=$key}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
|
|
||||||
{{* supprimer les documents correspondant à une écriture de la balance d'ouverture *}}
|
{{* supprimer les documents correspondant à une écriture de la balance d'ouverture
|
||||||
{{#select
|
{{#select
|
||||||
line.id as line_id,
|
line.id as line_id,
|
||||||
trans.status
|
trans.status
|
||||||
|
@ -45,11 +45,14 @@
|
||||||
}}
|
}}
|
||||||
{{:delete key=$key}}
|
{{:delete key=$key}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
|
*}}
|
||||||
{{/load}}
|
{{/load}}
|
||||||
|
|
||||||
{{if $amort == "no_amort"}}
|
{{if $amort == "autres"}}
|
||||||
{{:include file="./immobilisations_non.html"}}
|
{{:include file="./immobilisations_autres.html"}}
|
||||||
{{else}}
|
{{elseif $amort == "archive"}}
|
||||||
|
{{:include file="archives.html"}}
|
||||||
|
{{elseif $amort == "encours" || $amort == "fini"}}
|
||||||
{{:include file="./immobilisations.html"}}
|
{{:include file="./immobilisations.html"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
{{* ne pas amortir *}}
|
{{* ne pas amortir *}}
|
||||||
{{:assign duration=0}}
|
{{:assign duration=0}}
|
||||||
{{:assign date_debut=$ligne_immo.date_achat|parse_date}}
|
{{:assign date_debut=$ligne_immo.date_achat|parse_date}}
|
||||||
{{:assign noamort=true}}
|
{{:assign status="ignored"}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{* vérifier que la date d'acquisition est antérieure à la date de mise en service *}}
|
{{* vérifier que la date d'acquisition est antérieure à la date de mise en service *}}
|
||||||
{{:assign date_debut=$_POST.date_mes|or:$ligne_immo.date_achat|parse_date}}
|
{{:assign date_debut=$_POST.date_mes|or:$ligne_immo.date_achat|parse_date}}
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
{{if $duration <= 0}}
|
{{if $duration <= 0}}
|
||||||
{{:error message="Erreur : la durée d'amortissement doit être strictement positive"}}
|
{{:error message="Erreur : la durée d'amortissement doit être strictement positive"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:assign noamort=false}}
|
{{:assign status="managed"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{* enregistrer les infos modifiées de l'immobilisation *}}
|
{{* enregistrer les infos modifiées de l'immobilisation *}}
|
||||||
|
@ -54,13 +54,13 @@
|
||||||
line=$immo_id
|
line=$immo_id
|
||||||
duration=$duration
|
duration=$duration
|
||||||
date=$date_debut
|
date=$date_debut
|
||||||
noamort=$noamort
|
status=$status
|
||||||
}}
|
}}
|
||||||
|
|
||||||
{{if $_POST.no_amort}}
|
{{if $_POST.no_amort}}
|
||||||
{{:assign amort=0}}
|
{{:assign amort="autres"}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign amort=1}}
|
{{:assign amort="encours"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:redirect force="index.html?ok=1&msg=infos&amort=%s"|args:$amort}}
|
{{:redirect force="index.html?ok=1&msg=infos&amort=%s"|args:$amort}}
|
||||||
{{else}}
|
{{else}}
|
||||||
|
@ -81,7 +81,12 @@
|
||||||
<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')"}}
|
{{if $checked}}
|
||||||
|
{{:assign helptext = "Dé-cocher pour amortir"}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign helptext = "Cocher pour ne pas amortir"}}
|
||||||
|
{{/if}}
|
||||||
|
{{:input id="no_amort" type="checkbox" value=1 name="no_amort" label="Ne pas amortir" default=$checked help=$helptext 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" 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="number" name="duree" label="Durée d'amortissement" default=$info_immo.duration required=true min=1 disabled=$disabled}}
|
||||||
</dl>
|
</dl>
|
||||||
|
|
260
save_amort.html
260
save_amort.html
|
@ -1,26 +1,135 @@
|
||||||
{{* -*- brindille -*- *}}
|
{{* -*- brindille -*- *}}
|
||||||
|
|
||||||
{{:admin_header title="Ajout amortissement" current="module_amortissement"}}
|
{{*
|
||||||
|
Créer une écriture d'amortissement
|
||||||
|
@param immo_id : id de la ligne d'immobilisation
|
||||||
|
*}}
|
||||||
|
|
||||||
{{* barre de navigation *}}
|
{{* Infos de l'immobilisation *}}
|
||||||
{{if ! $dialog}}
|
{{#select
|
||||||
{{:include file="_nav.html" current="amortization"}}
|
line.id as immo_id,
|
||||||
|
line.id_account as account_id,
|
||||||
|
line.debit as montant,
|
||||||
|
line.id_project as project_id,
|
||||||
|
trans.id as trans_id,
|
||||||
|
trans.label,
|
||||||
|
trans.date,
|
||||||
|
y.id as year_id,
|
||||||
|
y.start_date,
|
||||||
|
y.end_date,
|
||||||
|
project.label as project_label
|
||||||
|
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
|
||||||
|
LEFT JOIN acc_projects AS project ON line.id_project = project.id
|
||||||
|
WHERE line.id = :line_id;
|
||||||
|
:line_id = $_GET.immo_id|intval
|
||||||
|
assign=ligne_immo
|
||||||
|
}}
|
||||||
|
{{else}}
|
||||||
|
{{:error message="Immobilisation %s non trouvée"|args:$_GET.immo_id}}
|
||||||
|
{{/select}}
|
||||||
|
{{:assign date_debut=$ligne_immo.date}}
|
||||||
|
|
||||||
|
{{#load type="immo" where="$$.line = :line_id" :line_id=$_GET.immo_id|intval}}
|
||||||
|
{{:assign duree=$duration}}
|
||||||
|
{{:assign date_debut=$date}}
|
||||||
|
{{else}}
|
||||||
|
{{:error message="Vous devez renseigner la date de mise en service et la durée d'immobilisation"}}
|
||||||
|
{{/load}}
|
||||||
|
|
||||||
|
{{* chercher des écritures d'amortissement liées à l'immobilisation *}}
|
||||||
|
{{#select
|
||||||
|
SUM(l_amort.credit) as amort_amount,
|
||||||
|
l_amort.label as amort_label,
|
||||||
|
l_amort.id as amort_line_id,
|
||||||
|
CASE WHEN links.id_related = t_immo.id
|
||||||
|
THEN links.id_transaction
|
||||||
|
ELSE links.id_related
|
||||||
|
END as amort_trans_id,
|
||||||
|
MAX(trans.date) as amort_date,
|
||||||
|
COUNT(trans.id) as amort_number,
|
||||||
|
trans.label as trans_label,
|
||||||
|
trans.id_year as amort_year,
|
||||||
|
account.id as account_id,
|
||||||
|
account.code as account_code,
|
||||||
|
account.label as account_label
|
||||||
|
FROM acc_transactions_lines as l_immo
|
||||||
|
INNER JOIN acc_transactions as t_immo on t_immo.id = l_immo.id_transaction
|
||||||
|
INNER JOIN acc_transactions_links as links
|
||||||
|
ON (t_immo.id = links.id_transaction
|
||||||
|
OR
|
||||||
|
t_immo.id = links.id_related)
|
||||||
|
INNER JOIN acc_transactions_lines as l_amort on amort_trans_id = l_amort.id_transaction
|
||||||
|
INNER join acc_transactions as trans on l_amort.id_transaction = trans.id
|
||||||
|
INNER join acc_accounts as account on l_amort.id_account = account.id
|
||||||
|
WHERE l_immo.id = :line_id AND account.code LIKE '28%'
|
||||||
|
ORDER BY trans.date DESC LIMIT 1;
|
||||||
|
:line_id = $_GET.immo_id|intval
|
||||||
|
assign=amort_line
|
||||||
|
}}
|
||||||
|
{{/select}}
|
||||||
|
|
||||||
|
{{if $amort_line.amort_number == 0}}
|
||||||
|
{{* 1er amortissement *}}
|
||||||
|
{{* déterminer le compte d'amortissement en fonction du compte d'immobilisation *}}
|
||||||
|
{{#select code, label from acc_accounts where id = :id; :id=$ligne_immo.account_id assign=amort_account}}
|
||||||
|
{{/select}}
|
||||||
|
{{:include
|
||||||
|
file="./_get_amort_code.html"
|
||||||
|
code_immo=$amort_account.code
|
||||||
|
keep="code_amort"
|
||||||
|
}}
|
||||||
|
{{:assign var=amort_label value="Amortissement %s"|args:$amort_account.label}}
|
||||||
|
{{:assign var=libelle value="Amortissement %s"|args:$ligne_immo.label}}
|
||||||
|
{{else}}
|
||||||
|
{{* amortissements suivants *}}
|
||||||
|
{{:assign date_debut=$amort_line.amort_date|strtotime}}
|
||||||
|
{{:assign date_debut="%d+(60*60*24)"|math:$date_debut|date:"Y-m-d"}}
|
||||||
|
{{:assign var=code_amort value=$amort_line.account_code}}
|
||||||
|
{{:assign var=amort_label value=$amort_line.account_label}}
|
||||||
|
{{:assign var=libelle value=$amort_line.amort_label}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
{{*
|
||||||
|
lister les exercices qui englobent la date de mise en service de l'immo
|
||||||
|
ou la date du dernier amortissement
|
||||||
|
*}}
|
||||||
|
{{:assign msg_years=""}}
|
||||||
|
{{#years closed=false order="start_date" where="start_date <= :debut AND :debut <= end_date"
|
||||||
|
:debut=$date_debut assign=years.}}
|
||||||
|
{{if $amort_line.amort_number == 0}}
|
||||||
|
{{:assign ts_debut=$date_debut|strtotime}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign ts_debut=$start_date|strtotime}}
|
||||||
|
{{/if}}
|
||||||
|
{{:assign ts_fin=$end_date|strtotime}}
|
||||||
|
{{: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}}
|
||||||
|
{{:assign msg_years=$msg_years|cat:"\n"|cat:" - "|cat:$label|cat:" : "|cat:$debut|cat:" à "|cat:$fin}}
|
||||||
|
{{else}}
|
||||||
|
{{:error message="Aucun exercice ouvert pour enregistrer un amortissement"}}
|
||||||
|
{{/years}}
|
||||||
|
|
||||||
{{* Traiter l'envoi du formulaire *}}
|
{{* Traiter l'envoi du formulaire *}}
|
||||||
{{#form on="save"}}
|
{{#form on="save"}}
|
||||||
|
{{* vérifier que la date est située dans un exercice compatible *}}
|
||||||
{{* vérifier que la date est située dans un exercice ouvert *}}
|
{{:assign ts_date = $_POST.date_amort|parse_date|strtotime}}
|
||||||
{{:include
|
{{:assign ok=false}}
|
||||||
file="_check_date.html"
|
{{#foreach from=$years}}
|
||||||
date=$_POST.date
|
{{if $id == $_POST.id_year}}
|
||||||
keep="open_years, selected_year, selected_chart"
|
{{:assign selected_chart=$id_chart}}
|
||||||
}}
|
{{if $start_date|strtotime <= $ts_date && $ts_date <= $end_date|strtotime}}
|
||||||
|
{{:assign ok=true}}
|
||||||
{{if $selected_year == null}}
|
{{:break}}
|
||||||
{{:error message="La date choisie n'est dans aucun exercice ouvert !!\nExercices ouverts : %s"|args:$open_years}}
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
{{/foreach}}
|
||||||
|
{{if ! $ok}}
|
||||||
|
{{:error message="La date choisie n'est dans aucun exercice compatible !\nExercices compatibles : %s"|args:$msg_years}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{* déterminer le numéro des comptes au cas où la clé serait un identifiant *}}
|
{{* déterminer le numéro des comptes au cas où la clé serait un identifiant *}}
|
||||||
{{:include
|
{{:include
|
||||||
file="_get_codes.html"
|
file="_get_codes.html"
|
||||||
|
@ -34,7 +143,6 @@
|
||||||
keep="account_code"
|
keep="account_code"
|
||||||
}}
|
}}
|
||||||
{{:assign credit_account=$account_code}}
|
{{:assign credit_account=$account_code}}
|
||||||
|
|
||||||
{{* vérifier :
|
{{* vérifier :
|
||||||
- que le compte d'amortissement débute par un préfixe correct (280, 281, ...)
|
- que le compte d'amortissement débute par un préfixe correct (280, 281, ...)
|
||||||
- est présent dans le PC de l'exercice correspondant à la date
|
- est présent dans le PC de l'exercice correspondant à la date
|
||||||
|
@ -59,21 +167,19 @@
|
||||||
prefix_array=$amort_array
|
prefix_array=$amort_array
|
||||||
keep="account_ok"
|
keep="account_ok"
|
||||||
}}
|
}}
|
||||||
|
|
||||||
{{if $account_ok == null}}
|
{{if $account_ok == null}}
|
||||||
{{:assign compte=$credit_account|implode:""}}
|
{{:assign compte=$credit_account|implode:""}}
|
||||||
{{:redirect url="add_account.html?account=%s&chart=%s&immo_id=%s"|args:$compte:$selected_chart:$_GET.immo_id}}
|
{{:redirect url="add_account.html?account=%s&chart=%s&immo_id=%s"|args:$compte:$selected_chart:$_GET.immo_id}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{* vérifier que le montant ne dépasse pas le solde restant *}}
|
{{* vérifier que le montant ne dépasse pas le solde restant *}}
|
||||||
{{if $_POST.montant|trim|money_int > $_GET.solde|intval}}
|
{{:assign solde="%d-%d"|math:$ligne_immo.montant:$amort_line.amort_amount}}
|
||||||
{{:assign solde=$_GET.solde|money_raw}}
|
{{if $_POST.montant|trim|money_int > $solde|intval}}
|
||||||
|
{{:assign solde=$solde|money_raw}}
|
||||||
{{:error message="Le montant indiqué « %s » dépasse le solde à amortir « %s »"|args:$_POST.montant:$solde}}
|
{{:error message="Le montant indiqué « %s » dépasse le solde à amortir « %s »"|args:$_POST.montant:$solde}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{* enregistrer l'écriture *}}
|
{{* enregistrer l'écriture *}}
|
||||||
{{:assign var="linked_transactions." value=$_GET.trans_id}}
|
|
||||||
|
|
||||||
{{:assign
|
{{:assign
|
||||||
var="lines."
|
var="lines."
|
||||||
debit=$_POST.montant
|
debit=$_POST.montant
|
||||||
|
@ -88,66 +194,61 @@
|
||||||
id_project=$_GET.project_id
|
id_project=$_GET.project_id
|
||||||
label=$_POST.designation
|
label=$_POST.designation
|
||||||
}}
|
}}
|
||||||
|
|
||||||
{{:api
|
{{:api
|
||||||
method="POST"
|
method="POST"
|
||||||
path="accounting/transaction"
|
path="accounting/transaction"
|
||||||
assign="result"
|
assign="result"
|
||||||
assign_code="result_code"
|
assign_code="result_code"
|
||||||
id_year=$selected_year
|
id_year=$_POST.id_year
|
||||||
type="advanced"
|
type="advanced"
|
||||||
date=$_POST.date
|
date=$_POST.date_amort
|
||||||
label=$_POST.designation
|
label=$_POST.designation
|
||||||
lines=$lines
|
lines=$lines
|
||||||
linked_transactions=$_GET.trans_id|intval
|
linked_transactions=$ligne_immo.trans_id|intval
|
||||||
}}
|
}}
|
||||||
|
|
||||||
{{:redirect force="amortization.html?immo_id=%s&ok=1&msg=amortissement"|args:$_GET.immo_id}}
|
{{:redirect force="amortization.html?immo_id=%s&ok=1&msg=amortissement"|args:$_GET.immo_id}}
|
||||||
{{/form}}
|
{{/form}}
|
||||||
|
|
||||||
|
{{:admin_header title="Ajout amortissement" current="module_amortissement"}}
|
||||||
|
|
||||||
|
{{* barre de navigation *}}
|
||||||
|
{{if ! $dialog}}
|
||||||
|
{{:include file="_nav.html" current="index" subcurrent="encours" subsubcurrent="amortization"}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{:form_errors}}
|
{{:form_errors}}
|
||||||
|
|
||||||
{{* Préparer les infos pour le formulaire *}}
|
{{:assign var=selected_year value=$years.0.id}}
|
||||||
|
{{:assign var=date_amort value=$years.0.end_date}}
|
||||||
|
{{:include file="_calcul_dates.html" date_debut=$date_debut date_fin=$date_amort keep="nbjours"}}
|
||||||
|
|
||||||
|
{{* montant de l'amortissement *}}
|
||||||
|
{{:assign montant_amort="%f/%f/365*%d"|math:$ligne_immo.montant:$duree:$nbjours|intval}}
|
||||||
|
{{:assign montant_amort="min(%f, %d-%d)"|math:$montant_amort:$ligne_immo.montant:$amort_line.amort_amount}}
|
||||||
{{:assign var="debit_account.6811" value="6811 — Dot. aux amortissements des immobilisations"}}
|
{{:assign var="debit_account.6811" value="6811 — Dot. aux amortissements des immobilisations"}}
|
||||||
|
{{:assign var="credit_account.%s"|args:$code_amort value="%s — "|args:$code_amort|cat:$amort_label}}
|
||||||
|
|
||||||
{{*
|
{{* -------------------------------------------------------------------------------- *}}
|
||||||
déterminer le compte d'amortissement en fonction du compte
|
|
||||||
d'immobilisation => ajouter un 8 après le 2 de tête
|
|
||||||
*}}
|
|
||||||
{{#select code, label from acc_accounts where id = :id; :id=$_GET.account assign=amort_account}}{{/select}}
|
|
||||||
{{:include
|
|
||||||
file="./_get_amort_code.html"
|
|
||||||
code_immo=$amort_account.code
|
|
||||||
keep="code_amort"
|
|
||||||
}}
|
|
||||||
{{:assign var="credit_account.%s"|args:$code_amort value="%s — Amortissements "|args:$code_amort|cat:$amort_account.label}}
|
|
||||||
|
|
||||||
{{#select
|
<div id="f_erreur" class="hidden">
|
||||||
id,
|
<p class="block error">La date saisie n'est pas dans l'exercice choisi !</p>
|
||||||
label,
|
</div>
|
||||||
end_date as date_amort
|
|
||||||
from acc_years where id=:id;
|
|
||||||
:id=$_GET.year assign=year
|
|
||||||
}}
|
|
||||||
{{/select}}
|
|
||||||
|
|
||||||
{{#years status=false}}
|
|
||||||
{{:assign var="open_years.%d"|args:$id value=$label}}
|
|
||||||
{{/years}}
|
|
||||||
|
|
||||||
<form method="post" action="">
|
<form method="post" action="">
|
||||||
<fieldset class="ajout_amort">
|
<fieldset class="ajout_amort">
|
||||||
<legend>Ajouter une écriture d'amortissement</legend>
|
<legend>Ajouter une écriture d'amortissement</legend>
|
||||||
<dl>
|
<dl>
|
||||||
{{:input type="date" name="date" label="Date" required=true default=$year.date_amort|date_short}}
|
{{:input type="select" default=$selected_year name="id_year" label="Exercice" required=true default_empty="— Faire un choix —" options=$open_years}}
|
||||||
{{:input type="text" name="designation" label="Désignation" required=true default=$_GET.label}}
|
{{:input type="date" name="date_amort" label="Date" required=true default=$date_amort|date_short}}
|
||||||
{{:input type="money" name="montant" label="Montant" required=true default=$_GET.amount}}
|
{{:input type="text" name="designation" label="Désignation" required=true default=$libelle}}
|
||||||
|
{{:input type="money" name="montant" label="Montant" required=true default=$montant_amort}}
|
||||||
{{:input
|
{{:input
|
||||||
type="list"
|
type="list"
|
||||||
name="debit_account"
|
name="debit_account"
|
||||||
label="Compte de débit"
|
label="Compte de débit"
|
||||||
required=true
|
required=true
|
||||||
target="!acc/charts/accounts/selector.php?codes=%s&year=%d"|args:"68*":$year.id
|
target="!acc/charts/accounts/selector.php?codes=%s&id_year=%d"|args:"68*":$selected_year
|
||||||
default=$debit_account
|
default=$debit_account
|
||||||
}}
|
}}
|
||||||
{{:input
|
{{:input
|
||||||
|
@ -155,9 +256,15 @@
|
||||||
name="credit_account"
|
name="credit_account"
|
||||||
label="Compte d'amortissement (280xx ou 281xx)"
|
label="Compte d'amortissement (280xx ou 281xx)"
|
||||||
required=true
|
required=true
|
||||||
target="!acc/charts/accounts/selector.php?codes=%s&year=%d"|args:"28*":$year.id
|
target="!acc/charts/accounts/selector.php?codes=%s&id_year=%d"|args:"28*":$selected_year
|
||||||
default=$credit_account
|
default=$credit_account
|
||||||
}}
|
}}
|
||||||
|
<div id="donnees" class="hidden">
|
||||||
|
{{:input type="text" name="montant_immo" default=$ligne_immo.montant}}
|
||||||
|
{{:input type="text" name="duree_amort" default=$duree}}
|
||||||
|
{{:input type="text" name="somme_amort" default=$amort_line.amort_amount}}
|
||||||
|
{{:input type="select" name="years_data" options=$years_data}}
|
||||||
|
</div>
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
@ -166,3 +273,48 @@
|
||||||
</p>
|
</p>
|
||||||
</form>
|
</form>
|
||||||
{{:admin_footer}}
|
{{:admin_footer}}
|
||||||
|
|
||||||
|
<script type="text/javascript" src="scripts.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
/*
|
||||||
|
afficher la date de fin de l'exercice choisi
|
||||||
|
mettre à jour le numéro d'exercice dans les sélecteur de comptes
|
||||||
|
recalculer le montant de l'amortissement
|
||||||
|
*/
|
||||||
|
function redisplayData(evt,
|
||||||
|
f_immo = 'f_montant_immo',
|
||||||
|
f_duree = 'f_duree_amort',
|
||||||
|
f_amort = 'f_somme_amort',
|
||||||
|
f_years_data = 'f_years_data',
|
||||||
|
f_years_select = 'f_id_year',
|
||||||
|
f_date = 'f_date_amort',
|
||||||
|
f_montant = 'f_montant',
|
||||||
|
f_erreur = 'f_erreur'
|
||||||
|
)
|
||||||
|
{
|
||||||
|
setDateEnd(f_years_select, f_date, f_years_data);
|
||||||
|
setSelectorYear(['credit_account', 'debit_account'], f_years_select);
|
||||||
|
displayAmort(f_immo, f_duree, f_amort, f_years_data, f_years_select, f_montant, f_erreur);
|
||||||
|
}
|
||||||
|
|
||||||
|
function redisplayAmort(evt,
|
||||||
|
f_immo = 'f_montant_immo',
|
||||||
|
f_duree = 'f_duree_amort',
|
||||||
|
f_amort = 'f_somme_amort',
|
||||||
|
f_years_data = 'f_years_data',
|
||||||
|
f_years_select = 'f_id_year',
|
||||||
|
f_date = 'f_date_amort',
|
||||||
|
f_montant = 'f_montant',
|
||||||
|
f_erreur = 'f_erreur'
|
||||||
|
)
|
||||||
|
{
|
||||||
|
displayAmort(f_immo, f_duree, f_amort, f_years_data, f_years_select, f_montant, f_erreur, f_date);
|
||||||
|
}
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
setDateEnd('f_id_year', 'f_date_amort', 'f_years_data');
|
||||||
|
document.getElementById('f_id_year').onchange = redisplayData;
|
||||||
|
document.getElementById('f_date_amort').onchange = redisplayAmort;
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
|
|
@ -19,8 +19,9 @@
|
||||||
"type" : ["string", "null"],
|
"type" : ["string", "null"],
|
||||||
"format" : "date"
|
"format" : "date"
|
||||||
},
|
},
|
||||||
"noamort" : {
|
"status" : {
|
||||||
"type" : ["null", "boolean"]
|
"type" : ["string", "null"],
|
||||||
|
"enum" : ["managed", "archived", "ignored"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": ["type", "line", "duration", "date"]
|
"required": ["type", "line", "duration", "date"]
|
||||||
|
|
141
scripts.js
Normal file
141
scripts.js
Normal file
|
@ -0,0 +1,141 @@
|
||||||
|
// activer/désactiver les champs passés en paramètres
|
||||||
|
function toggleInputs(idcb, idfields) {
|
||||||
|
const elem = document.getElementById(idcb);
|
||||||
|
for (let id of idfields) {
|
||||||
|
const field = document.getElementById(id);
|
||||||
|
if (elem.checked) {
|
||||||
|
field.removeAttribute("disabled");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
field.setAttribute("disabled","disabled");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleVisibility(idcheck, fields) {
|
||||||
|
const elem = document.getElementById(idcheck);
|
||||||
|
for (let id of fields) {
|
||||||
|
const field = document.getElementById(id);
|
||||||
|
if (elem.checked) {
|
||||||
|
field.setAttribute('class', '');
|
||||||
|
} else {
|
||||||
|
field.setAttribute('class', 'hidden');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// fixer l'exercice des sélecteurs de compte
|
||||||
|
function setAccountYear(button_names, id_year) {
|
||||||
|
for (const name of button_names) {
|
||||||
|
const button = document.querySelector("button[data-name=" + name + "]");
|
||||||
|
const b_value = button.value;
|
||||||
|
const new_value = b_value.replace(/id_year=\d+/, 'id_year=' + id_year);
|
||||||
|
button.setAttribute('value', new_value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* renvoyer la valeur en secondes d'une date au format j/m/a
|
||||||
|
* @param {string} date
|
||||||
|
*/
|
||||||
|
function str2sec(date) {
|
||||||
|
const jma = date.split('/');
|
||||||
|
const dd = new Date(jma[2], jma[1]-1, jma[0]);
|
||||||
|
return dd.getTime()/1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
// renvoyer la valeur en secondes d'un champ date
|
||||||
|
function getDate(idelem) {
|
||||||
|
return str2sec(document.getElementById(idelem).value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// (unused) désactiver les options du sélecteur qui ne sont pas dans un tableau de valeurs
|
||||||
|
function disableOptions(idSelect, init, values) {
|
||||||
|
for (let i = init; i < idSelect.options.length; ++i) {
|
||||||
|
const choix = idSelect.options[i];
|
||||||
|
if (! values.includes(choix.value)) {
|
||||||
|
choix.setAttribute('disabled', 'true');
|
||||||
|
choix.removeAttribute('selected');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// afficher la date de fin de l'exercice choisi
|
||||||
|
function setDateEnd(id_exercices, id_date, id_years) {
|
||||||
|
const selected_year = document.getElementById(id_exercices).value;
|
||||||
|
if (selected_year == '') {
|
||||||
|
document.getElementById(id_date).value = '';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const years_data = document.getElementById(id_years);
|
||||||
|
for (const choix of years_data.options) {
|
||||||
|
if (choix.value == selected_year) {
|
||||||
|
const epox = choix.text.split(' ');
|
||||||
|
const date_fin = new Date(epox[1] * 1000);
|
||||||
|
document.getElementById(id_date).value = date_fin.toLocaleDateString();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// renvoyer la valeur numérique d'un montant formaté en €
|
||||||
|
function getNumber(text) {
|
||||||
|
return Number(text.replace(/ /g, '').replace(/,/, '.').replace(/€/, ''));
|
||||||
|
}
|
||||||
|
|
||||||
|
// calculer le montant d'un amortissement
|
||||||
|
// @param montant immo
|
||||||
|
// @param durée immo (années)
|
||||||
|
// @param somme amortissements
|
||||||
|
// @param date début
|
||||||
|
// @param date de fin
|
||||||
|
// @result montant de l'amortissement
|
||||||
|
function computeAmort(montant_immo, duree_immo, somme_amort, date_debut, date_fin) {
|
||||||
|
const nbjours = 1 + (date_fin - date_debut) / (60*60*24);
|
||||||
|
return Math.round(Math.min(montant_immo / duree_immo / 365 * nbjours, montant_immo - somme_amort));
|
||||||
|
}
|
||||||
|
|
||||||
|
// calculer et afficher le montant de l'amortissement
|
||||||
|
function displayAmort(id_immo, id_duree, id_amort, id_years, id_exercices, id_montant, id_erreur, id_date=null)
|
||||||
|
{
|
||||||
|
const div_erreur = document.getElementById(id_erreur);
|
||||||
|
div_erreur.setAttribute('class', 'hidden');
|
||||||
|
// document.getElementById(id_erreur).setAttribute('class', 'hidden');
|
||||||
|
let case_montant = document.getElementById(id_montant);
|
||||||
|
const selected_year = document.getElementById(id_exercices).value;
|
||||||
|
if (selected_year == '') {
|
||||||
|
case_montant.value = '';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const years_data = document.getElementById(id_years);
|
||||||
|
let date_debut, date_fin;
|
||||||
|
for (const choix of years_data.options) {
|
||||||
|
if (choix.value == selected_year) {
|
||||||
|
const epox = choix.text.split(' ');
|
||||||
|
date_debut = epox[0];
|
||||||
|
date_fin = epox[1];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (id_date != null) {
|
||||||
|
const date_choisie = str2sec(document.getElementById(id_date).value);
|
||||||
|
console.log("date_choisie = " + date_choisie + ", date_debut=" + date_debut + ", date_fin = " + date_fin);
|
||||||
|
if (date_debut <= date_choisie && date_choisie <= date_fin) {
|
||||||
|
date_fin = date_choisie;
|
||||||
|
} else {
|
||||||
|
div_erreur.setAttribute('class', '');
|
||||||
|
// document.getElementById(id_erreur).setAttribute('class', '');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const montant_immo = Number(document.getElementById(id_immo).value);
|
||||||
|
const duree_immo = Number(document.getElementById(id_duree).value);
|
||||||
|
const somme_amort = Number(document.getElementById(id_amort).value);
|
||||||
|
const montant_amort = computeAmort(montant_immo, duree_immo, somme_amort, date_debut, date_fin);
|
||||||
|
case_montant.value = montant_amort/100;
|
||||||
|
case_montant.innerText = montant_amort;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setSelectorYear(button_names, f_years_selector) {
|
||||||
|
const selected_year = document.getElementById(f_years_selector).value;
|
||||||
|
setAccountYear(button_names, selected_year);
|
||||||
|
}
|
24
style.css
24
style.css
|
@ -17,3 +17,27 @@ h2[class="aide"], h3[class="aide"] {
|
||||||
margin-top: 0.5em;
|
margin-top: 0.5em;
|
||||||
margin-bottom: 0.5em;
|
margin-bottom: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.informations {
|
||||||
|
margin-top : 0.5em;
|
||||||
|
margin-bottom : 0.5em;
|
||||||
|
padding : 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.informations legend {
|
||||||
|
font-weight: bold;
|
||||||
|
border-bottom : solid 1px var(--gLightBorderColor);
|
||||||
|
margin-bottom : 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.informations dt::after {
|
||||||
|
content: ' :';
|
||||||
|
}
|
||||||
|
|
||||||
|
.informations dl.describe > dt {
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
nav.amort aside {
|
||||||
|
margin-top : 0;
|
||||||
|
}
|
||||||
|
|
536
write_exit.html
Normal file
536
write_exit.html
Normal file
|
@ -0,0 +1,536 @@
|
||||||
|
{{* -*- brindille -*- *}}
|
||||||
|
|
||||||
|
{{*
|
||||||
|
Enregistrer les écritures de sortie du bilan
|
||||||
|
paramètres :
|
||||||
|
- immo_id : numéro de ligne de l'écriture d'immobilisation
|
||||||
|
- amort_amount : montant des amortissements
|
||||||
|
- year : exercice de la date de sortie de l'immobilisation
|
||||||
|
- date_mes : date de mise en service de l'immobilisation
|
||||||
|
- date_debut : date de début de la période d'amortissement complémentaire
|
||||||
|
- exit_date : date de sortie de l'immobilisation
|
||||||
|
- duree_amort : durée de l'amortiseement (optionnel)
|
||||||
|
- cession : montant de la cession (optionnel)
|
||||||
|
*}}
|
||||||
|
|
||||||
|
{{#select
|
||||||
|
line.debit as montant,
|
||||||
|
line.id_transaction,
|
||||||
|
line.id_account,
|
||||||
|
trans.date as date_achat,
|
||||||
|
trans.label,
|
||||||
|
id_project
|
||||||
|
FROM acc_transactions_lines AS line
|
||||||
|
INNER JOIN acc_transactions AS trans ON line.id_transaction = trans.id
|
||||||
|
WHERE line.id = :immo_id;
|
||||||
|
:immo_id = $_GET.immo_id|intval
|
||||||
|
assign="ligne_immo"
|
||||||
|
}}
|
||||||
|
{{/select}}
|
||||||
|
|
||||||
|
{{#load type="immo" assign="info_immo" where="$$.line = :line_id" :line_id=$_GET.immo_id|intval}}
|
||||||
|
{{/load}}
|
||||||
|
|
||||||
|
{{* date de début de l'exercice *}}
|
||||||
|
{{#select start_date FROM acc_years WHERE id = :year_id; :year_id = $_GET.year}}
|
||||||
|
{{*:assign date_debut=$start_date*}}
|
||||||
|
{{/select}}
|
||||||
|
|
||||||
|
{{*if $date_debut < "2025-01-01"*}}
|
||||||
|
{{:assign vnc_code=675}}
|
||||||
|
{{:assign cession_code=775}}
|
||||||
|
{{*
|
||||||
|
{{else}}
|
||||||
|
{{:assign vnc_code=657}}
|
||||||
|
{{:assign cession_code=757}}
|
||||||
|
{{/if}}
|
||||||
|
*}}
|
||||||
|
|
||||||
|
{{:assign valeur_nette="%f-%f"|math:$ligne_immo.montant:$_GET.amort_amount}}
|
||||||
|
{{:assign amort_comp=0}} {{* amortissement complémentaire jqà date sortie *}}
|
||||||
|
{{:assign amort_except=0}} {{* amortissement exceptionnel jqà date fin amortissement *}}
|
||||||
|
{{if $valeur_nette > 0}}
|
||||||
|
{{:assign nbjours="1+(%d-%d)/(60*60*24)"|math:$_GET.exit_date:$_GET.date_debut}}
|
||||||
|
{{:assign annuite="%f/%f"|math:$ligne_immo.montant:$_GET.duree_amort}}
|
||||||
|
{{:assign amort_comp="round(%f/365*%f, 0)"|math:$annuite:$nbjours}}
|
||||||
|
{{:assign amort_comp="min(%f, %f)"|math:$valeur_nette:$amort_comp}}
|
||||||
|
|
||||||
|
{{if $_GET.cession == null}}
|
||||||
|
{{:assign amort_except="%f-%f-%f"|math:$ligne_immo.montant:$_GET.amort_amount:$amort_comp}}
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{if $_GET.cession == null}}
|
||||||
|
{{:assign montant_cession=0}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign montant_cession="%f*100"|math:$_GET.cession}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{* TODO : faut-il forcer les 3 sélecteurs de compte d'amortissement à avoir toujours la même valeur ? *}}
|
||||||
|
|
||||||
|
|
||||||
|
{{* Traiter l'envoi du formulaire *}}
|
||||||
|
{{#form on="save"}}
|
||||||
|
{{*
|
||||||
|
{{if $_POST.amort_comp_account != null}
|
||||||
|
{{:assign account=$_POST.amort_comp_account}}
|
||||||
|
{{elseif $_POST.amort_except_account != null}
|
||||||
|
{{:assign account=$_POST.amort_except_account}}
|
||||||
|
{{elseif $_POST.amort_sortie_account != null}
|
||||||
|
{{:assign account=$_POST.amort_sortie_account}}
|
||||||
|
{{/if}}
|
||||||
|
*}}
|
||||||
|
{{:assign account=$_POST.amort_sortie_account}}
|
||||||
|
|
||||||
|
{{:include
|
||||||
|
file="_get_codes.html"
|
||||||
|
account=$account
|
||||||
|
keep="account_code"
|
||||||
|
}}
|
||||||
|
{{:assign amort_account=$account_code|keys|key:0}}
|
||||||
|
|
||||||
|
{{if $valeur_nette > 0}}
|
||||||
|
{{* immo non totalement amortie *}}
|
||||||
|
|
||||||
|
{{* lignes d'écriture de l'amortissement complémentaire *}}
|
||||||
|
{{:include
|
||||||
|
file="_get_codes.html"
|
||||||
|
account=$_POST.comp_account
|
||||||
|
keep="account_code"
|
||||||
|
}}
|
||||||
|
{{:assign comp_account=$account_code|keys|key:0}}
|
||||||
|
|
||||||
|
{{:assign libelle="Amortissement complémentaire "|cat:$ligne_immo.label}}
|
||||||
|
{{:assign
|
||||||
|
var="lines."
|
||||||
|
debit="%f/100"|math:$amort_comp
|
||||||
|
account=$comp_account
|
||||||
|
id_project=$ligne_immo.id_project
|
||||||
|
label=$libelle
|
||||||
|
}}
|
||||||
|
{{:assign
|
||||||
|
var="lines."
|
||||||
|
credit="%f/100"|math:$amort_comp
|
||||||
|
account=$amort_account
|
||||||
|
id_project=$ligne_immo.id_project
|
||||||
|
label=$libelle
|
||||||
|
}}
|
||||||
|
{{:assign valeur_nette="%f-%f"|math:$valeur_nette:$amort_comp}}
|
||||||
|
|
||||||
|
{{if $_GET.cession == null && $amort_except > 0}}
|
||||||
|
{{* lignes d'écriture de l'amortissement exceptionnel *}}
|
||||||
|
{{:include
|
||||||
|
file="_get_codes.html"
|
||||||
|
account=$_POST.except_account
|
||||||
|
keep="account_code"
|
||||||
|
}}
|
||||||
|
{{:assign except_account=$account_code|keys|key:0}}
|
||||||
|
{{:assign libelle="Amortissement exceptionnel "|cat:$ligne_immo.label}}
|
||||||
|
{{:assign
|
||||||
|
var="lines."
|
||||||
|
debit="%f/100"|math:$amort_except
|
||||||
|
account=$except_account
|
||||||
|
id_project=$ligne_immo.id_project
|
||||||
|
label=$libelle
|
||||||
|
}}
|
||||||
|
{{:assign
|
||||||
|
var="lines."
|
||||||
|
credit="%f/100"|math:$amort_except
|
||||||
|
account=$amort_account
|
||||||
|
id_project=$ligne_immo.id_project
|
||||||
|
label=$libelle
|
||||||
|
}}
|
||||||
|
{{:assign valeur_nette="%f-%f"|math:$valeur_nette:$amort_except}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{:api
|
||||||
|
method="POST"
|
||||||
|
path="accounting/transaction"
|
||||||
|
assign="result"
|
||||||
|
assign_code="result_code"
|
||||||
|
id_year=$_GET.year
|
||||||
|
type="advanced"
|
||||||
|
date=$_GET.exit_date
|
||||||
|
label="Amortissement final "|cat:$ligne_immo.label
|
||||||
|
lines=$lines
|
||||||
|
linked_transactions=$ligne_immo.id_transaction
|
||||||
|
}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{* écriture de sortie du bilan *}}
|
||||||
|
{{:assign libelle="Sortie du bilan de "|cat:$ligne_immo.label}}
|
||||||
|
{{:assign lines=null}}
|
||||||
|
{{:assign
|
||||||
|
var="lines."
|
||||||
|
id_account=$ligne_immo.id_account
|
||||||
|
credit="%f/100"|math:$ligne_immo.montant
|
||||||
|
id_project=$ligne_immo.id_project
|
||||||
|
label=$libelle
|
||||||
|
}}
|
||||||
|
{{:assign
|
||||||
|
var="lines."
|
||||||
|
account=$amort_account
|
||||||
|
debit="(%f-%f)/100"|math:$ligne_immo.montant:$valeur_nette
|
||||||
|
id_project=$ligne_immo.id_project
|
||||||
|
label=$libelle
|
||||||
|
}}
|
||||||
|
{{if $valeur_nette > 0}}
|
||||||
|
{{:assign
|
||||||
|
var="lines."
|
||||||
|
account=$vnc_code
|
||||||
|
debit="%f/100"|math:$valeur_nette
|
||||||
|
id_project=$ligne_immo.id_project
|
||||||
|
label=$libelle
|
||||||
|
}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{:api
|
||||||
|
method="POST"
|
||||||
|
path="accounting/transaction"
|
||||||
|
assign="result"
|
||||||
|
assign_code="result_code"
|
||||||
|
id_year=$_GET.year
|
||||||
|
type="advanced"
|
||||||
|
date=$_GET.exit_date
|
||||||
|
label=$libelle
|
||||||
|
lines=$lines
|
||||||
|
linked_transactions=$ligne_immo.id_transaction
|
||||||
|
}}
|
||||||
|
|
||||||
|
{{if $montant_cession > 0}}
|
||||||
|
{{* Cession de l'immobilisation *}}
|
||||||
|
{{:assign libelle="Produit cession "|cat:$ligne_immo.label}}
|
||||||
|
{{:include
|
||||||
|
file="_get_codes.html"
|
||||||
|
account=$_POST.creance_account
|
||||||
|
keep="account_code"
|
||||||
|
}}
|
||||||
|
{{:assign creance_account=$account_code|keys|key:0}}
|
||||||
|
{{:include
|
||||||
|
file="_get_codes.html"
|
||||||
|
account=$_POST.cession_account
|
||||||
|
keep="account_code"
|
||||||
|
}}
|
||||||
|
{{:assign cession_account=$account_code|keys|key:0}}
|
||||||
|
{{:api
|
||||||
|
method="POST"
|
||||||
|
path="accounting/transaction"
|
||||||
|
assign="result"
|
||||||
|
assign_code="result_code"
|
||||||
|
id_year=$_GET.year
|
||||||
|
type="credit"
|
||||||
|
date=$_GET.exit_date
|
||||||
|
label=$libelle
|
||||||
|
amount="%f/100"|math:$montant_cession
|
||||||
|
debit=$creance_account
|
||||||
|
credit=$cession_account
|
||||||
|
id_project=$ligne_immo.id_project
|
||||||
|
linked_transactions=$ligne_immo.id_transaction
|
||||||
|
}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{if $info_immo != null}}
|
||||||
|
{{* mettre à jour l'état de l'immobilisation *}}
|
||||||
|
{{:save
|
||||||
|
key=$info_immo.key
|
||||||
|
status="archived"
|
||||||
|
}}
|
||||||
|
{{else}}
|
||||||
|
{{:save
|
||||||
|
key=""|uuid
|
||||||
|
validate_schema="schema.json"
|
||||||
|
type="immo"
|
||||||
|
line=$_GET.immo_id|intval
|
||||||
|
duration=$_GET.duree_amort|intval
|
||||||
|
date=$_GET.date_mes|date:"Y-m-d"
|
||||||
|
status="archived"
|
||||||
|
}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{:redirect to="index.html?amort=archive"}}
|
||||||
|
{{/form}}
|
||||||
|
|
||||||
|
{{:admin_header title="Sortie du bilan" custom_css="./style.css" current="module_amortissement"}}
|
||||||
|
|
||||||
|
{{* barre de navigation *}}
|
||||||
|
{{if ! $dialog}}
|
||||||
|
{{:include file="_nav.html" current="index" subsubcurrent="balance_exit"}}
|
||||||
|
{{/if}}
|
||||||
|
{{:form_errors}}
|
||||||
|
|
||||||
|
{{* Préparer les infos pour le formulaire *}}
|
||||||
|
|
||||||
|
{{* déterminer les comptes pour les différentes écritures *}}
|
||||||
|
{{:assign var="comp_account.6811" value="6811 — Dot. aux amortissements des immobilisations"}}
|
||||||
|
{{:assign var="except_account.687" value="687 — Dot. aux amortissements & provisions - Charges exceptionnelles"}}
|
||||||
|
|
||||||
|
{{#select code, label from acc_accounts where id = :id;
|
||||||
|
:id=$ligne_immo.id_account
|
||||||
|
assign=immo_account_info
|
||||||
|
}}
|
||||||
|
{{/select}}
|
||||||
|
|
||||||
|
{{:include
|
||||||
|
file="./_get_amort_code.html"
|
||||||
|
code_immo=$immo_account_info.code
|
||||||
|
keep="code_amort"
|
||||||
|
}}
|
||||||
|
{{:assign
|
||||||
|
var="amort_account.%s"|args:$code_amort
|
||||||
|
value="%s — Amortissements "|args:$code_amort|cat:$immo_account_info.label}}
|
||||||
|
{{:assign
|
||||||
|
var="immo_account.%s"|args:$immo_account_info.code
|
||||||
|
value="%s — Immobilisation "|args::$immo_account_info.code|cat:$immo_account_info.label}}
|
||||||
|
{{:assign
|
||||||
|
var="vnc_account.%s"|args:$vnc_code
|
||||||
|
value="%s — Valeurs comptables des éléments d'actifs cédés"|args:$vnc_code}}
|
||||||
|
{{:assign
|
||||||
|
var="cession_account.%s"|args:$cession_code
|
||||||
|
value="%s — Produits des cessions d'actif"|args:$cession_code}}
|
||||||
|
{{:assign var="creance_account.462" value="462 — Créances sur cessions d'immobilisations"}}
|
||||||
|
|
||||||
|
{{:read file="./defaut.json" assign="config_json"}}
|
||||||
|
{{:assign config_defaut=$config_json|json_decode}}
|
||||||
|
{{:assign var="prefix_array" value=$config_defaut.prefixes|keys}}
|
||||||
|
|
||||||
|
{{#foreach from=$prefix_array item="code"}}
|
||||||
|
{{:assign var="pattern_array." value="%s*"|args:$code}}
|
||||||
|
{{/foreach}}
|
||||||
|
{{:assign patterns=$pattern_array|implode:"|"}}
|
||||||
|
|
||||||
|
<h3>Sortir l'immobilisation « {{$ligne_immo.label}} » du bilan</h3>
|
||||||
|
<form method="post" action="">
|
||||||
|
|
||||||
|
<div class="informations">
|
||||||
|
<legend>Données de l'imobilisation</legend>
|
||||||
|
<dl class="describe">
|
||||||
|
<dt>Montant</dt>
|
||||||
|
<dd class="money">{{$ligne_immo.montant|money_currency:false}}</dd>
|
||||||
|
<dt>Date d'acquisition</dt>
|
||||||
|
<dd >{{$ligne_immo.date_achat|date_short}}</dd>
|
||||||
|
{{if $_GET.date_mes != $ligne_immo.date_achat|strtotime}}
|
||||||
|
<dt>Date de mise en service</dt>
|
||||||
|
<dd>{{$_GET.date_mes|date:"d/m/Y"}}</dd>
|
||||||
|
{{/if}}
|
||||||
|
{{if $_GET.duree_amort != null}}
|
||||||
|
<dt>Durée de l'amortissement</dt>
|
||||||
|
<dd class="num">{{$_GET.duree_amort}} ans</dd>
|
||||||
|
{{/if}}
|
||||||
|
<dt>Montant des amortissements</dt>
|
||||||
|
<dd class="money">{{$_GET.amort_amount|money_currency:false}} <span class="help">(à la date de début de l'exercice)</span></dd>
|
||||||
|
<dt>Valeur nette résiduelle</dt>
|
||||||
|
<dd class="money">{{$valeur_nette|money_currency:false}} <span class="help">(à la date de début de l'exercice)</span></dd>
|
||||||
|
<dt>Date de sortie</dt>
|
||||||
|
<dd>{{$_GET.exit_date|date:"d/m/Y"}}</dd>
|
||||||
|
{{if $amort_comp > 0}}
|
||||||
|
{{:assign valeur_nette="%f-%f"|math:$valeur_nette:$amort_comp}}
|
||||||
|
<dt>Amortissement complémentaire</dt>
|
||||||
|
<dd class="money">{{$amort_comp|money_currency:false}} <span class="help">(jusqu'à la date de sortie)</span></dd>
|
||||||
|
<dt>Total des amortissements</dt>
|
||||||
|
<dd class="money">{{"%f+%f"|math:$_GET.amort_amount:$amort_comp|money_currency:false}} <span class="help">(à la date de sortie)</span></dd>
|
||||||
|
<dt>Valeur nette résiduelle</dt>
|
||||||
|
<dd class="money">{{$valeur_nette|money_currency:false}} <span class="help">(à la date de sortie)</span></dd>
|
||||||
|
{{/if}}
|
||||||
|
{{if $montant_cession == 0}}
|
||||||
|
{{if $amort_except > 0}}
|
||||||
|
<dt>Amortissement exceptionnel</dt>
|
||||||
|
<dd class="money">{{$amort_except|money_currency:false}}</dd>
|
||||||
|
{{/if}}
|
||||||
|
{{else}}
|
||||||
|
<dt>Montant de la cession</dt>
|
||||||
|
<dd class="money">{{$montant_cession|money_currency:false}}</dd>
|
||||||
|
{{/if}}
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<fieldset>
|
||||||
|
<legend>Écritures de sortie du bilan</legend>
|
||||||
|
{{* Amortissement complémentaire *}}
|
||||||
|
{{if $amort_comp > 0}}
|
||||||
|
<table class="list">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<td>Amortissement complémentaire</td>
|
||||||
|
<td>Débit</td>
|
||||||
|
<td>Crédit</td>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td colspan="3" class="help">
|
||||||
|
Entre la date de début de l'exercice et la date de sortie du bilan
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{{:input
|
||||||
|
type="list"
|
||||||
|
name="comp_account"
|
||||||
|
target="!acc/charts/accounts/selector.php?codes=%s&year=%d"|args:"68*":$_GET.year
|
||||||
|
default=$comp_account
|
||||||
|
}}
|
||||||
|
</td>
|
||||||
|
<td>{{$amort_comp|money_currency:false}}</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{{:input
|
||||||
|
type="list"
|
||||||
|
name="amort_comp_account"
|
||||||
|
target="!acc/charts/accounts/selector.php?codes=%s&year=%d"|args:"28*":$_GET.year
|
||||||
|
default=$amort_account
|
||||||
|
}}
|
||||||
|
</td>
|
||||||
|
<td></td>
|
||||||
|
<td>{{$amort_comp|money_currency:false}}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{* Amortissement exceptionnel *}}
|
||||||
|
{{if $montant_cession == 0 && $amort_except > 0}}
|
||||||
|
<table class="list">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<td>Amortissement exceptionnel</td>
|
||||||
|
<td>Débit</td>
|
||||||
|
<td>Crédit</td>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td colspan="3" class="help">
|
||||||
|
Montant de l'immobilisation non encore amortie (valeur nette résiduelle à la date de sortie)
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{{:input
|
||||||
|
type="list"
|
||||||
|
name="except_account"
|
||||||
|
target="!acc/charts/accounts/selector.php?codes=%s&year=%d"|args:"687*":$_GET.year
|
||||||
|
default=$except_account
|
||||||
|
}}
|
||||||
|
</td>
|
||||||
|
<td>{{$amort_except|money_currency:false}}</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{{:input
|
||||||
|
type="list"
|
||||||
|
name="amort_except_account"
|
||||||
|
target="!acc/charts/accounts/selector.php?codes=%s&year=%d"|args:"28*":$_GET.year
|
||||||
|
default=$amort_account
|
||||||
|
}}
|
||||||
|
</td>
|
||||||
|
<td></td>
|
||||||
|
<td>{{$amort_except|money_currency:false}}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{* Sortie du bilan *}}
|
||||||
|
<table class="list">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<td>Sortie du bilan</td>
|
||||||
|
<td>Débit</td>
|
||||||
|
<td>Crédit</td>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{{:input
|
||||||
|
type="list"
|
||||||
|
name="amort_sortie_account"
|
||||||
|
target="!acc/charts/accounts/selector.php?codes=%s&year=%d"|args:"28*":$_GET.year
|
||||||
|
default=$amort_account
|
||||||
|
}}
|
||||||
|
</td>
|
||||||
|
{{if $montant_cession == 0}}
|
||||||
|
{{:assign montant=$ligne_immo.montant}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign montant="%f+%f"|math:$_GET.amort_amount:$amort_comp}}
|
||||||
|
{{/if}}
|
||||||
|
<td>{{$montant|money_currency:false}}</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
{{if $montant_cession > 0 && $valeur_nette > 0}}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{{:input
|
||||||
|
type="list"
|
||||||
|
name="vnc_account"
|
||||||
|
target="!acc/charts/accounts/selector.php?codes=%s*&year=%d"|args:$vnc_code:$_GET.year
|
||||||
|
default=$vnc_account
|
||||||
|
}}
|
||||||
|
</td>
|
||||||
|
<td>{{$valeur_nette|money_currency:false}}</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
{{/if}}
|
||||||
|
<tr>
|
||||||
|
<td> {{* style="pointer-events: none; opacity: 0.6;">*}}
|
||||||
|
{{:input
|
||||||
|
type="list"
|
||||||
|
name="immo_account"
|
||||||
|
target="!acc/charts/accounts/selector.php?codes=%s&year=%d"|args:$patterns:$_GET.year
|
||||||
|
default=$immo_account
|
||||||
|
}}
|
||||||
|
</td>
|
||||||
|
<td></td>
|
||||||
|
<td>{{$ligne_immo.montant|money_currency:false}}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
{{* comptabilisation du produit de la cession *}}
|
||||||
|
{{if $montant_cession > 0}}
|
||||||
|
<table class="list">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<td>Comptabilisation de la cession</td>
|
||||||
|
<td>Débit</td>
|
||||||
|
<td>Crédit</td>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{{:input
|
||||||
|
type="list"
|
||||||
|
name="creance_account"
|
||||||
|
target="!acc/charts/accounts/selector.php?codes=%s&year=%d"|args:"462*":$_GET.year
|
||||||
|
default=$creance_account
|
||||||
|
}}
|
||||||
|
</td>
|
||||||
|
<td>{{$montant_cession|money_currency:false}}</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{{:input
|
||||||
|
type="list"
|
||||||
|
name="cession_account"
|
||||||
|
target="!acc/charts/accounts/selector.php?codes=%s*&year=%d"|args:$cession_code:$_GET.year
|
||||||
|
default=$cession_account
|
||||||
|
}}
|
||||||
|
</td>
|
||||||
|
<td></td>
|
||||||
|
<td>{{$montant_cession|money_currency:false}}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{{/if}}
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<p class="submit">
|
||||||
|
{{:button type="submit" name="save" label="Enregistrer" shape="right" class="main"}}
|
||||||
|
</p>
|
||||||
|
</form>
|
||||||
|
{{:admin_footer}}
|
Loading…
Add table
Reference in a new issue