Compare commits
No commits in common. "main" and "v0.7" have entirely different histories.
@ -6,15 +6,23 @@
|
|||||||
- date_fin
|
- date_fin
|
||||||
résultat : nbjours
|
résultat : nbjours
|
||||||
*}}
|
*}}
|
||||||
|
{{* pour simplifier : 30 jours par mois et 360 jours par an *}}
|
||||||
|
|
||||||
{{:assign ts_debut=$date_debut|strtotime}}
|
{{:assign jour_debut=$date_debut|date:"d"}}
|
||||||
{{:assign ts_fin=$date_fin|strtotime}}
|
{{:assign jour_debut="min(%d, 30)"|math:$jour_debut}}
|
||||||
|
{{:assign mois_debut=$date_debut|date:"m"}}
|
||||||
|
{{:assign annee_debut=$date_debut|date:"Y"}}
|
||||||
|
|
||||||
{{if $ts_debut <= $ts_fin}}
|
{{:assign jour_fin=$date_fin|date:"d"}}
|
||||||
{{:assign nbjours="(%d-%d)/(60*60*24)"|math:$ts_fin:$ts_debut}}
|
{{:assign jour_fin="min(%d, 30)"|math:$jour_fin}}
|
||||||
{{else}}
|
{{:assign mois_fin=$date_fin|date:"m"}}
|
||||||
{{:assign nbjours="(%d-%d)/(60*60*24)"|math:$ts_debut:$ts_fin}}
|
{{:assign annee_fin=$date_fin|date:"Y"}}
|
||||||
|
|
||||||
|
{{:assign nbjours="%d-%d"|math:$jour_fin:$jour_debut}}
|
||||||
|
{{:assign nbjours="%d+(%d-%d)*30"|math:$nbjours:$mois_fin:$mois_debut}}
|
||||||
|
{{:assign nbjours="%d+(%d-%d)*360"|math:$nbjours:$annee_fin:$annee_debut}}
|
||||||
|
|
||||||
|
{{* au cas où les deux dates seraient inversées ... *}}
|
||||||
|
{{if $nbjours < 0}}
|
||||||
|
{{:assign nbjours="-1*%d"|math:$nbjours}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{* pour simplifier : 360 jours par an *}}
|
|
||||||
{{:assign nbjours="round(%f/365*360)"|math:$nbjours}}
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
{{*
|
{{*
|
||||||
vérifier :
|
vérifier :
|
||||||
- que le compte débute par le préfixe correct
|
- que le compte débute par le préfixe corect
|
||||||
- est présent dans le PC indiqué
|
- est présent dans le PC indiqué
|
||||||
paramètres :
|
paramètres :
|
||||||
- account : tableau avec un identifiant de compte
|
- account : tableau avec un identifiant de compte
|
||||||
@ -12,14 +12,13 @@
|
|||||||
- account_ok
|
- account_ok
|
||||||
*}}
|
*}}
|
||||||
|
|
||||||
|
{{:assign account_code=$account|keys|key:0}}
|
||||||
{{:assign condition=" AND ("}}
|
{{:assign condition=" AND ("}}
|
||||||
{{#foreach from=$prefix_array item="code"}}
|
{{#foreach from=$prefix_array item="code"}}
|
||||||
{{:assign code=$code|cat:"%"|quote_sql}}
|
|
||||||
{{:assign condition=$condition|cat:" code LIKE "|cat:$code|cat:" OR "}}
|
{{:assign condition=$condition|cat:" code LIKE "|cat:$code|cat:" OR "}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
{{:assign condition=$condition|cat:"0)"}}
|
{{:assign condition=$condition|cat:"0)"}}
|
||||||
|
|
||||||
{{:assign account_code=$account|keys|key:0}}
|
|
||||||
{{#sql
|
{{#sql
|
||||||
select="code"
|
select="code"
|
||||||
tables="acc_accounts"
|
tables="acc_accounts"
|
||||||
|
@ -7,8 +7,9 @@
|
|||||||
résultat : open_years, selected_year, selected_chart
|
résultat : open_years, selected_year, selected_chart
|
||||||
*}}
|
*}}
|
||||||
|
|
||||||
|
{{*:debug check::date=$date*}}
|
||||||
{{:assign open_years=""}}
|
{{:assign open_years=""}}
|
||||||
{{#years status=false order="start_date"}}
|
{{#years status=false}}
|
||||||
{{:assign open_years=$open_years|cat:"\n"|cat:" - "|cat:$label|cat:" : "}}
|
{{:assign open_years=$open_years|cat:"\n"|cat:" - "|cat:$label|cat:" : "}}
|
||||||
{{:assign debut=$start_date|date_short}}
|
{{:assign debut=$start_date|date_short}}
|
||||||
{{:assign fin=$end_date|date_short}}
|
{{:assign fin=$end_date|date_short}}
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
{{* -*- brindille -*- *}}
|
|
||||||
|
|
||||||
{{*
|
|
||||||
déterminer le numéro du compte d'amortissement associé à un compte d'immobilisation
|
|
||||||
- param :
|
|
||||||
- code_immo : numéro du compte d'immobilisation
|
|
||||||
- résultat :
|
|
||||||
- code_amort : numéro du compte d'amortissement
|
|
||||||
*}}
|
|
||||||
|
|
||||||
{{:assign code_s=$code_immo|strval}}
|
|
||||||
{{:assign ch1=$code_s|substr:0:1}}
|
|
||||||
{{:assign reste=$code_s|substr:1}}
|
|
||||||
{{:assign code_amort=$ch1|cat:"8"|cat:$reste}}
|
|
22
_nav.html
22
_nav.html
@ -1,28 +1,14 @@
|
|||||||
{{* -*- brindille -*- *}}
|
|
||||||
|
|
||||||
<nav class="tabs">
|
<nav class="tabs">
|
||||||
{{if $current == 'index'}}
|
|
||||||
<aside>
|
|
||||||
{{:linkbutton label="Ajouter une immobilisation" shape="plus" href="add_asset.html" target="_dialog"}}
|
|
||||||
</aside>
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li {{if $current == 'index'}} class="current"{{/if}}><a href="{{$module.url}}index.html">Immobilisations</a></li>
|
<li {{if $current == 'index'}} class="current"{{/if}}><a href="{{$module.url}}index.html">Immobilisations</a></li>
|
||||||
<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'}}
|
||||||
<ul class="sub">
|
<ul class="sub">
|
||||||
<li {{if $subcurrent == 'amort'}}class="current"{{/if}}><a href="index.html?amort=amort">Amortissables</a></li>
|
{{if $subcurrent == 'amortization'}}
|
||||||
<li {{if $subcurrent == 'fini'}}class="current"{{/if}}><a href="index.html?amort=fini">Terminées</a></li>
|
<li class="current"><a>Amortissements</a></li>
|
||||||
<li {{if $subcurrent == 'no_amort'}}class="current"{{/if}}><a href="index.html?amort=no_amort">Non amortissables</a></li>
|
{{/if}}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
{{if $subsubcurrent == 'amortization'}}
|
|
||||||
<ul class="sub">
|
|
||||||
<li class="title"><strong>Amortissements</strong></li>
|
|
||||||
</ul>
|
|
||||||
{{/if}}
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</nav>
|
</nav>
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
{{* -*- brindille -*- *}}
|
|
||||||
{{*
|
|
||||||
Rend une date située un an après la date paramètre
|
|
||||||
paramètres :
|
|
||||||
- date
|
|
||||||
résultat : date_amort
|
|
||||||
*}}
|
|
||||||
|
|
||||||
{{:assign jour=$date|date:"d"}}
|
|
||||||
{{:assign mois=$date|date:"m"}}
|
|
||||||
{{:assign annee=$date|date:"Y"}}
|
|
||||||
{{:assign annee="%d+1"|math:$annee}}
|
|
||||||
{{:assign date_amort="%s/%s/%s"|args:$jour:$mois:$annee}}
|
|
@ -1,21 +0,0 @@
|
|||||||
{{* -*- brindille -*- *}}
|
|
||||||
{{:admin_header title="Ajout immobilisation" current="module_amortissement"}}
|
|
||||||
|
|
||||||
{{* barre de navigation *}}
|
|
||||||
{{if ! $dialog}}
|
|
||||||
{{:include file="_nav.html" current="index"}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
<div class="block error">
|
|
||||||
Le compte « {{$_GET.account}} » n'est pas un compte
|
|
||||||
d'amortissement ou n'est pas dans le plan comptable de l'exercice
|
|
||||||
choisi
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
{{:linkbutton
|
|
||||||
label="Créer le compte"
|
|
||||||
shape="plus"
|
|
||||||
href="!acc/charts/accounts/new.php?id=%s"|args:$_GET.chart
|
|
||||||
}}
|
|
||||||
</div>
|
|
101
add_asset.html
101
add_asset.html
@ -1,43 +1,26 @@
|
|||||||
{{* -*- brindille -*- *}}
|
{{* -*- brindille -*- *}}
|
||||||
{{:admin_header title="Ajout immobilisation" current="module_amortissement"}}
|
{{:admin_header title="Ajout immobilisation" current="module_amortissement"}}
|
||||||
|
|
||||||
|
|
||||||
{{* barre de navigation *}}
|
{{* barre de navigation *}}
|
||||||
{{if ! $dialog}}
|
{{if ! $dialog}}
|
||||||
{{:include file="_nav.html" current="index"}}
|
{{:include file="_nav.html" current="index"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{:read file="./defaut.json" assign="config_json"}}
|
|
||||||
{{:assign config_defaut=$config_json|json_decode}}
|
|
||||||
{{:assign var="prefix_array" value=$config_defaut.prefixes|keys}}
|
|
||||||
|
|
||||||
{{* Traiter l'envoi du formulaire *}}
|
{{* Traiter l'envoi du formulaire *}}
|
||||||
{{#form on="add"}}
|
{{#form on="add"}}
|
||||||
|
{{*:debug add::POST=$_POST*}}
|
||||||
|
|
||||||
{{* vérifier que la date est située dans un exercice ouvert *}}
|
{{* vérifier que la date est située dans un exercice ouvert *}}
|
||||||
{{:include
|
{{:include
|
||||||
file="_check_date.html"
|
file="_check_date.html"
|
||||||
date=$_POST.date_achat
|
date=$_POST.date
|
||||||
keep="open_years, selected_year, selected_chart"
|
keep="open_years, selected_year, selected_chart"
|
||||||
}}
|
}}
|
||||||
{{if $selected_year == null}}
|
|
||||||
{{:error message="La date choisie n'est dans aucun exercice ouvert !!\nExercices ouverts : %s"|args:$open_years}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{if $_POST.no_amort}}
|
{{if $selected_year == null}}
|
||||||
{{* ne pas amortir *}}
|
{{:assign message="La date choisie n'est dans aucun exercice ouvert !!\nExercices ouverts : %s"|args:$open_years}}
|
||||||
{{:assign duration=0}}
|
{{:error message=$message}}
|
||||||
{{:assign date_debut=$ligne_immo.date_achat|parse_date}}
|
|
||||||
{{:assign noamort=true}}
|
|
||||||
{{else}}
|
|
||||||
{{* 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}}
|
|
||||||
{{if $date_debut|strtotime < $_POST.date_achat|parse_date|strtotime}}
|
|
||||||
{{:assign dd=$date_debut|date_short}}
|
|
||||||
{{:assign da=$_POST.date_achat|date_short}}
|
|
||||||
{{:error message="Erreur : la date de mise en service (%s) ne peut être antérieure à la date d'acquisition (%s)"|args:$dd:$da}}
|
|
||||||
{{/if}}
|
|
||||||
{{:assign duration=$_POST.duree|intval}}
|
|
||||||
{{:assign noamort=false}}
|
|
||||||
{{/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 *}}
|
||||||
@ -55,10 +38,11 @@
|
|||||||
{{:assign credit_account=$account_code}}
|
{{:assign credit_account=$account_code}}
|
||||||
|
|
||||||
{{* vérifier :
|
{{* vérifier :
|
||||||
- que le compte d'immo débute par un préfixe correct (20, 21, ...)
|
- que le compte d'immo débute par 20 ou 21
|
||||||
- est présent dans le PC de l'exercice correspondant à la date
|
- est présent dans le PC de l'exercice correspondant à la date
|
||||||
*}}
|
*}}
|
||||||
|
{{:assign var="prefix_array." value="'20%'"}}
|
||||||
|
{{:assign var="prefix_array." value="'21%'"}}
|
||||||
{{:include
|
{{:include
|
||||||
file="_check_account.html"
|
file="_check_account.html"
|
||||||
account=$debit_account
|
account=$debit_account
|
||||||
@ -79,7 +63,7 @@
|
|||||||
assign="result"
|
assign="result"
|
||||||
id_year=$selected_year
|
id_year=$selected_year
|
||||||
type="revenue"
|
type="revenue"
|
||||||
date=$_POST.date_achat
|
date=$_POST.date
|
||||||
label=$_POST.designation
|
label=$_POST.designation
|
||||||
amount=$_POST.montant
|
amount=$_POST.montant
|
||||||
debit=$debit_account|keys|key:0
|
debit=$debit_account|keys|key:0
|
||||||
@ -87,6 +71,7 @@
|
|||||||
id_project=$_POST.id_project
|
id_project=$_POST.id_project
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
{{* enregistrer les infos de l'immobilisation *}}
|
||||||
{{* vérifier s'il y a déjà un document avec le même numéro de ligne *}}
|
{{* vérifier s'il y a déjà un document avec le même numéro de ligne *}}
|
||||||
{{:assign var="immo_id" value=$result.lines.1.id}}
|
{{:assign var="immo_id" value=$result.lines.1.id}}
|
||||||
{{#load where="$$.line = :line_id" :line_id=$immo_id}}
|
{{#load where="$$.line = :line_id" :line_id=$immo_id}}
|
||||||
@ -95,22 +80,15 @@
|
|||||||
{{:assign key=""|uuid}}
|
{{:assign key=""|uuid}}
|
||||||
{{/load}}
|
{{/load}}
|
||||||
|
|
||||||
{{* enregistrer les infos de l'immobilisation *}}
|
|
||||||
{{:save
|
{{:save
|
||||||
key=$key
|
key=$key
|
||||||
validate_schema="schema.json"
|
validate_schema="schema.json"
|
||||||
type="immo"
|
type="immo"
|
||||||
line=$immo_id
|
line=$immo_id
|
||||||
duration=$duration
|
duration=$_POST.duree|intval
|
||||||
date=$date_debut
|
|
||||||
noamort=$noamort
|
|
||||||
}}
|
}}
|
||||||
{{if $_POST.no_amort}}
|
{{:redirect force="index.html?ok=1&msg=immobilisation"}}
|
||||||
{{:assign amort=0}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign amort=1}}
|
|
||||||
{{/if}}
|
|
||||||
{{:redirect force="index.html?ok=1&msg=immobilisation&amort=%s"|args:$amort}}
|
|
||||||
{{/form}}
|
{{/form}}
|
||||||
|
|
||||||
{{:form_errors}}
|
{{:form_errors}}
|
||||||
@ -123,36 +101,28 @@
|
|||||||
{{:assign var="projects.%d"|args:$id value=$label}}
|
{{:assign var="projects.%d"|args:$id value=$label}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
|
|
||||||
{{#foreach from=$prefix_array item="code"}}
|
|
||||||
{{:assign var="pattern_array." value="%s*"|args:$code}}
|
|
||||||
{{/foreach}}
|
|
||||||
{{:assign patterns=$pattern_array|implode:"|"}}
|
|
||||||
{{:assign date=$now|date:'Y-m-d'}}
|
|
||||||
|
|
||||||
<form method="post" action="">
|
<form method="post" action="">
|
||||||
<fieldset>
|
<fieldset class="ajout_immo">
|
||||||
<legend>Ajouter une immobilisation</legend>
|
<legend>Ajouter une 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="date" name="date" label="Date" required=true default=$now|date_short}}
|
||||||
{{: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_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 type="number" name="duree" label="Durée d'amortissement" required=true default=1}}
|
||||||
{{: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?targets=1:2:3&key=code"
|
||||||
default=$bank_account
|
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 ou 21xx)"
|
||||||
required=true
|
required=true
|
||||||
target="!acc/charts/accounts/selector.php?date=%s&codes=%s"|args:$date:$patterns
|
target="!acc/charts/accounts/selector.php?key=code"
|
||||||
default=$immo_account
|
default=$immo_account
|
||||||
}}
|
}}
|
||||||
{{if $projects != null}}
|
{{if $projects != null}}
|
||||||
@ -167,35 +137,4 @@
|
|||||||
|
|
||||||
</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}}
|
||||||
|
44
add_duration.html
Normal file
44
add_duration.html
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
{{* -*- brindille -*- *}}
|
||||||
|
|
||||||
|
{{:admin_header title="Renseigner durée amortissement" custom_css=$custom_css current="module_amortissement"}}
|
||||||
|
|
||||||
|
{{* barre de navigation *}}
|
||||||
|
{{if ! $dialog}}
|
||||||
|
{{:include file="_nav.html" current="index"}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{* renseigner la durée d'amortissement *}}
|
||||||
|
|
||||||
|
<h2 class="ruler">Durée d'amortissement</h2>
|
||||||
|
|
||||||
|
{{* Traiter l'envoi du formulaire *}}
|
||||||
|
{{#form on="add"}}
|
||||||
|
{{* enregistrer les infos de l'immobilisation *}}
|
||||||
|
{{:assign var="immo_id" value=$_GET.immo_id|intval}}
|
||||||
|
{{:assign key=""|uuid}}
|
||||||
|
{{:save
|
||||||
|
key=$key
|
||||||
|
validate_schema="schema.json"
|
||||||
|
type="immo"
|
||||||
|
line=$immo_id
|
||||||
|
duration=$_POST.duree|intval
|
||||||
|
}}
|
||||||
|
|
||||||
|
{{:redirect force="index.html?ok=1&msg=durée"}}
|
||||||
|
{{/form}}
|
||||||
|
|
||||||
|
<form method="post" action="">
|
||||||
|
<fieldset class="ajout_duree">
|
||||||
|
<legend>Renseigner durée amortissement</legend>
|
||||||
|
<dl>
|
||||||
|
{{:input type="number" name="duree" label="Durée d'amortissement" required=true default=1}}
|
||||||
|
</dl>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<p class="submit">
|
||||||
|
{{:button type="submit" name="add" label="Ajouter" shape="right" class="main"}}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
{{:admin_footer}}
|
108
add_infos.html
108
add_infos.html
@ -1,108 +0,0 @@
|
|||||||
{{* -*- brindille -*- *}}
|
|
||||||
|
|
||||||
{{:admin_header title="Renseigner informations amortissement" custom_css=$custom_css current="module_amortissement"}}
|
|
||||||
|
|
||||||
{{* barre de navigation *}}
|
|
||||||
{{if ! $dialog}}
|
|
||||||
{{:include file="_nav.html" current="index"}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{* Traiter l'envoi du formulaire *}}
|
|
||||||
{{#form on="add"}}
|
|
||||||
|
|
||||||
{{* chercher la date d'acquisition de l'immobilisation *}}
|
|
||||||
{{:assign var="immo_id" value=$_GET.immo_id|intval}}
|
|
||||||
{{#select
|
|
||||||
trans.date as date_achat
|
|
||||||
from acc_transactions_lines as line
|
|
||||||
inner join acc_transactions as trans on line.id_transaction = trans.id
|
|
||||||
where line.id = :line_id;
|
|
||||||
:line_id = $immo_id
|
|
||||||
assign=ligne_immo
|
|
||||||
}}
|
|
||||||
{{/select}}
|
|
||||||
|
|
||||||
{{if $_POST.no_amort}}
|
|
||||||
{{* ne pas amortir *}}
|
|
||||||
{{:assign duration=0}}
|
|
||||||
{{:assign date_debut=$ligne_immo.date_achat|parse_date}}
|
|
||||||
{{:assign noamort=true}}
|
|
||||||
{{else}}
|
|
||||||
{{* 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}}
|
|
||||||
{{if $date_debut|strtotime < $ligne_immo.date_achat|strtotime}}
|
|
||||||
{{:assign dd=$date_debut|date_short}}
|
|
||||||
{{:assign da=$ligne_immo.date_achat|date_short}}
|
|
||||||
{{:error message="Erreur : la date de mise en service (%s) ne peut être antérieure à la date d'acquisition (%s)"|args:$dd:$da}}
|
|
||||||
{{/if}}
|
|
||||||
{{:assign duration=$_POST.duree|intval}}
|
|
||||||
{{if $duration <= 0}}
|
|
||||||
{{:error message="Erreur : la durée d'amortissement doit être strictement positive"}}
|
|
||||||
{{/if}}
|
|
||||||
{{:assign noamort=false}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{* enregistrer les infos de l'immobilisation *}}
|
|
||||||
{{:assign key=""|uuid}}
|
|
||||||
{{:save
|
|
||||||
key=$key
|
|
||||||
validate_schema="schema.json"
|
|
||||||
type="immo"
|
|
||||||
line=$immo_id
|
|
||||||
duration=$duration
|
|
||||||
date=$date_debut
|
|
||||||
noamort=$noamort
|
|
||||||
}}
|
|
||||||
|
|
||||||
{{if $_POST.no_amort}}
|
|
||||||
{{:assign amort=0}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign amort=1}}
|
|
||||||
{{/if}}
|
|
||||||
{{:redirect force="index.html?ok=1&msg=infos&amort=%s"|args:$amort}}
|
|
||||||
{{else}}
|
|
||||||
{{:form_errors}}
|
|
||||||
{{/form}}
|
|
||||||
|
|
||||||
{{* renseigner la date de mise en service et durée d'amortissement *}}
|
|
||||||
{{if $_GET.amort == 0}}
|
|
||||||
{{:assign checked=1}}
|
|
||||||
{{:assign disabled=1}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign checked=0}}
|
|
||||||
{{:assign disabled=0}}
|
|
||||||
{{/if}}
|
|
||||||
<form method="post" action="">
|
|
||||||
<fieldset id="infos_immo">
|
|
||||||
<legend></legend>
|
|
||||||
<dl>
|
|
||||||
{{:input id="no_amort" type="checkbox" value=1 name="no_amort" label="Ne pas amortir" default=$checked help="Cocher pour ne pas amortir" onclick="toggleInputs('infos_immo','f_no_amort_1')"}}
|
|
||||||
{{:input type="date" name="date_mes" label="Date de mise en service" disabled=$disabled help="à renseigner uniquement si différente de la date d'acquisition"}}
|
|
||||||
{{:input type="number" name="duree" label="Durée d'amortissement" required=true min=1 default=1 disabled=$disabled}}
|
|
||||||
</dl>
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<p class="submit">
|
|
||||||
{{:button type="submit" name="add" label="Ajouter" shape="right" class="main"}}
|
|
||||||
</p>
|
|
||||||
|
|
||||||
</form>
|
|
||||||
|
|
||||||
{{* activer/désactiver les champs de saisie *}}
|
|
||||||
<script type="text/javascript">
|
|
||||||
function toggleInputs(idfs, idcb) {
|
|
||||||
const noamort = document.getElementById(idcb);
|
|
||||||
const fs = document.getElementById(idfs);
|
|
||||||
for (let field of fs.querySelectorAll("input")) {
|
|
||||||
if (field == noamort) { continue }
|
|
||||||
if (noamort.checked) {
|
|
||||||
field.setAttribute("disabled","disabled");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
field.removeAttribute("disabled");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
{{:admin_footer}}
|
|
174
aide.html
174
aide.html
@ -5,125 +5,80 @@
|
|||||||
{{* barre de navigation *}}
|
{{* barre de navigation *}}
|
||||||
{{:include file="_nav.html" current="aide"}}
|
{{:include file="_nav.html" current="aide"}}
|
||||||
|
|
||||||
<p class="aide">
|
<h2>Liste des immobilisations</h2>
|
||||||
Ce module gère l'amortissement linéaire des immobilisations.
|
<div class="infos">
|
||||||
</p>
|
<p>
|
||||||
|
On y trouve les immobilisations détectées par le module, c'est-à-dire les écritures passées sur les comptes d'immobilisation <b>20xx</b> et <b>21xx</b>
|
||||||
<h2 class="aide">Immobilisations</h2>
|
|
||||||
Elles sont classées dans 3 onglets :
|
|
||||||
|
|
||||||
<h3 class="aide">Amortissables</h3>
|
|
||||||
|
|
||||||
On y trouve les immobilisations en cours et celles pour lesquelles le
|
|
||||||
module n'a pas d'information.
|
|
||||||
|
|
||||||
<p class="aide">
|
|
||||||
Dans le deuxième cas, il faut cliquer sur le bouton « Ajouter
|
|
||||||
infos » puis :
|
|
||||||
<ul class="aide">
|
|
||||||
<li>soit indiquer que l'immobilisation ne doit pas être amortie</li>
|
|
||||||
<li>soit fournir la date de mise en service du bien (si différente de la date d'acquisition) ainsi
|
|
||||||
que la durée en années de l'amortissement</li>
|
|
||||||
</ul>
|
|
||||||
</p>
|
|
||||||
<p class="aide">
|
|
||||||
Tant qu'une immobilisation ne possède pas d'amortissement, il est
|
|
||||||
possible de modifier ses informations à l'aide du bouton «
|
|
||||||
Modifier infos ».
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<h3 class="aide">Terminées</h3>
|
|
||||||
|
|
||||||
On y trouve les immobilisations dont l'amortissement est terminé
|
|
||||||
|
|
||||||
<h3 class="aide">Non amortissables</h3>
|
|
||||||
|
|
||||||
<h3 class="aide">Ajouter une immobilisation</h3>
|
|
||||||
|
|
||||||
<div class="aide">
|
|
||||||
<p class="aide">
|
|
||||||
On peut indiquer qu'il s'agit d'une immobilisation qui ne doit pas être amortie ; dans le cas contraire, il faut renseigner les différents paramètres de l'immobilisation :
|
|
||||||
</p>
|
</p>
|
||||||
<ul class="aide">
|
<p>
|
||||||
<li>Date d'acquisition du bien</li>
|
Dans le cas d'une immobilisation qui n'est pas encore prise en charge par le module, il faut fournir la durée en années de l'amortissement en cliquant sur le bouton « Ajouter durée »
|
||||||
<li>Date de mise en service du bien : uniquement si différente de la précédente</li>
|
</p>
|
||||||
|
<p>
|
||||||
|
Une fois la durée indiquée, on accède à la liste des amortissements d'une immobilisation en cliquant le bouton «Amortissements »
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
On peut enregistrer une nouvelle immobilisation en cliquant le bouton « Ajouter une immobilisation »
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h3>Ajout d'immobilisation</h3>
|
||||||
|
|
||||||
|
<div class="help block">
|
||||||
|
<p>
|
||||||
|
Il faut renseigner les différents paramètres de l'immobilisation :
|
||||||
|
<ul>
|
||||||
|
<li>Date : celle de l'écriture de l'immobilisation</li>
|
||||||
<li>Désignation : c'est le libellé de l'immobilisation</li>
|
<li>Désignation : c'est le libellé de l'immobilisation</li>
|
||||||
<li>Montant</li>
|
<li>Montant</li>
|
||||||
<li>Durée d'amortissement en années</li>
|
<li>Durée d'amortissement en années</li>
|
||||||
<li>Compte de décaissement : à choisir dans la liste</li>
|
<li>Compte de décaissement : à choisir dans la liste</li>
|
||||||
<li>Compte d'immobilisation : doit débuter par <b>20</b>, <b>21</b> ou <b>27</b></li>
|
<li>Compte d'immobilisation : doit débuter par <b>20</b> ou <b>21</b></li>
|
||||||
<li>Projet analytique (optionnel)</li>
|
<li>Projet analytique (optionnel)</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>
|
|
||||||
Après ajout, on se retrouve sur la page d'accueil des immobilisations.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h2 class="aide">Amortissements</h2>
|
Après ajout, on se retrouve sur la page d'accueil (Liste des immobilisations)
|
||||||
|
|
||||||
<div class="infos">
|
|
||||||
<p class="aide">
|
|
||||||
Le calcul de l'amortissement se fait par la <em>méthode linéaire</em>.
|
|
||||||
</p>
|
|
||||||
<p class="aide">
|
|
||||||
La date de début du calcul est par défaut la <em>date d'achat</em> ; si la
|
|
||||||
date de mise en service est <em>postérieure</em> à la date d'achat, c'est
|
|
||||||
celle-ci qui est prise en compte.
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h3 class="aide">Liste des amortissements</h3>
|
<h2>Liste des amortissements</h2>
|
||||||
|
|
||||||
<div class="aide">
|
<div class="help block">
|
||||||
|
<fieldset>
|
||||||
On trouve ici de une à trois listes, selon la situation :
|
On trouve ici de une à trois listes, selon la situation :
|
||||||
<ul class="aide">
|
<dl>
|
||||||
<li>
|
<dt>
|
||||||
<b>Écritures d'amortissement liées à l'immobilisation courante</b>
|
<label>liste des écritures d'amortissement liées à l'immobilisation courante</label>
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
Ce sont des écritures d'amortissement déjà enregistrées et liées à l'écriture de l'immobilisation courante.
|
||||||
|
</dd>
|
||||||
|
<dt>
|
||||||
|
<label>liste des amortissements à enregistrer</label>
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
Ce sont les amortissements qui n'ont pas encore été enregistrés ; seules les amortissements d'un exercice ouvert peuvent être enregistrés ; les autres sont présents pour information et pourront être enregistrés quand l'exercice correspondant aura été ouvert.
|
||||||
|
</dd>
|
||||||
|
<dt>
|
||||||
|
<label>liste des écritures d'amortissement qui ne sont associées à aucune immobilisation</label>
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
Ce sont des écritures passées sur un compte d'amortissement (<b>28xx</b>) ; en cliquant le bouton « Attacher », on peut rattacher l'écriture d'amortissement sélectionnée à l'immobilisation courante
|
||||||
<p>
|
<p>
|
||||||
Ce sont des écritures d'amortissement déjà
|
Si on a rattaché par ereur une écritures d'amortissement à une immobilisation, le bouton « Détacher » en face de l'écriture permettra de défaire l'opération
|
||||||
enregistrées et liées à l'écriture de
|
|
||||||
l'immobilisation courante.
|
|
||||||
</p>
|
</p>
|
||||||
</li>
|
</dd>
|
||||||
<li>
|
</dl>
|
||||||
<b>Écritures d'amortissements à enregistrer</b>
|
</fieldset>
|
||||||
<p>
|
|
||||||
Ce sont les écritures amortissement de
|
|
||||||
l'immobilisation courante qui n'ont pas encore été
|
|
||||||
enregistrées ; seules les amortissements d'un
|
|
||||||
exercice ouvert peuvent être enregistrés ; les
|
|
||||||
autres sont présents pour information et pourront
|
|
||||||
être enregistrés quand l'exercice correspondant
|
|
||||||
aura été ouvert.
|
|
||||||
</p>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<b>Écritures d'amortissement qui ne sont associées à aucune immobilisation</b>
|
|
||||||
<p>
|
|
||||||
Ce sont des écritures passées sur un compte
|
|
||||||
d'amortissement (<b>28xx</b>) ; en cliquant le
|
|
||||||
bouton « Attacher », on peut rattacher l'écriture
|
|
||||||
d'amortissement sélectionnée à l'immobilisation
|
|
||||||
courante.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
Si on a rattaché par erreur une écriture
|
|
||||||
d'amortissement à une immobilisation, le bouton «
|
|
||||||
Détacher » en face de l'écriture permettra de
|
|
||||||
défaire l'opération.
|
|
||||||
</p>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h3 class="aide">Créer une écriture d'amortissement</h3>
|
<h3>Enregistrer un amortissement</h3>
|
||||||
|
|
||||||
<div class="aide">
|
<div class="help block">
|
||||||
<p class=aide">
|
<p>
|
||||||
Il faut renseigner les différents paramètres de l'amortissement :
|
Il faut renseigner les différents paramètres de l'amortissement :
|
||||||
<ul class="aide">
|
<ul>
|
||||||
<li>Date ; par défaut, il s'agit de la date de fin d'exercice</li>
|
<li>Date ; par défaut, il s'agit de la date de fin d'exercice</li>
|
||||||
<li>Désignation : déterminée à partir du libellé de l'immobilisation< ; elle peut être modifiée/li>
|
<li>Désignation : déterminée à partir du libellé de l'immobilisation</li>
|
||||||
<li>Montant : sa valeur est calculée par le module ; elle peut être modifiée</li>
|
<li>Montant : sa valeur est calculée par le module ; elle peut être modifiée</li>
|
||||||
<li>
|
<li>
|
||||||
Compte de débit : à choisir dans la liste ; par défaut c'est le compte <em>6811 : Dotation aux amortissements des immobilisations</em>
|
Compte de débit : à choisir dans la liste ; par défaut c'est le compte <em>6811 : Dotation aux amortissements des immobilisations</em>
|
||||||
@ -132,24 +87,7 @@ On y trouve les immobilisations dont l'amortissement est terminé
|
|||||||
Compte d'amortissement : à choisir dans la liste ; par défaut c'est le compte formé en intercalant un 8 après le 2 initial du compte d'immobilisation (exemple : 2183 => 28183)
|
Compte d'amortissement : à choisir dans la liste ; par défaut c'est le compte formé en intercalant un 8 après le 2 initial du compte d'immobilisation (exemple : 2183 => 28183)
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p class="aide">
|
|
||||||
Après enregistrement, on se retrouve sur la page des amortissements
|
Après enregistrement, on se retrouve sur la page des amortissements
|
||||||
</p>
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2 class="aide">Remarques</h2>
|
|
||||||
|
|
||||||
<ul class="aide">
|
|
||||||
<li>
|
|
||||||
Les écritures d'immobilisation et d'amortissement créées en
|
|
||||||
dehors du module ne peuvent être associées automatiquement que
|
|
||||||
si leurs écritures ont été liées ; dans le cas contraire, il
|
|
||||||
faudra renseigner manuellement les infos de l'immobilisation.
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
Les écritures d'immobilisation de la balance d'ouverture ne
|
|
||||||
peuvent être détectées automatiquement : il faudra indiquer
|
|
||||||
manuellement qu'elles ne doivent pas être amorties.
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
@ -3,20 +3,13 @@
|
|||||||
{{: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"}}
|
{{:include file="_nav.html" current="index" subcurrent="amortization"}}
|
||||||
{{:assign subcurrent="amort"}}
|
|
||||||
{{elseif $_GET.amort == "fini"}}
|
|
||||||
{{:assign subcurrent="fini"}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign subcurrent="no_amort"}}
|
|
||||||
{{/if}}
|
|
||||||
{{:include file="_nav.html" current="index" subcurrent="%s"|args:$subcurrent subsubcurrent="amortization"}}
|
|
||||||
|
|
||||||
{{if $_GET.ok}}
|
{{if $_GET.ok}}
|
||||||
{{if $_GET.msg|match:"attach"}}
|
{{if $_GET.msg|match:"attach"}}
|
||||||
{{:assign msg="Attachement écriture %s effectué"|args:$_GET.trans_id}}
|
{{:assign msg="Attachement effectué"}}
|
||||||
{{elseif $_GET.msg|match:"detach"}}
|
{{elseif $_GET.msg|match:"detach"}}
|
||||||
{{:assign msg="Détachement écriture %s affectué"|args:$_GET.trans_id}}
|
{{:assign msg="Attachement supprimé"}}
|
||||||
{{elseif $_GET.msg|match:"amortissement"}}
|
{{elseif $_GET.msg|match:"amortissement"}}
|
||||||
{{:assign msg="Amortissement enregistré"}}
|
{{:assign msg="Amortissement enregistré"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
@ -31,6 +24,12 @@
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{* récupérer les infos de l'immobilisation *}}
|
{{* récupérer les infos de l'immobilisation *}}
|
||||||
|
{{#load type="immo" assign="info_immo" where="$$.line = :line_id" :line_id=$_GET.immo_id|intval}}
|
||||||
|
{{else}}
|
||||||
|
{{:error message="Pas d'info concernant l'immobilisation %s"|args:$_GET.immo_id}}
|
||||||
|
{{/load}}
|
||||||
|
{{:assign var="duree" from="info_immo.duration"|args:$_GET.immo_id}}
|
||||||
|
|
||||||
{{#select
|
{{#select
|
||||||
line.id as immo_id,
|
line.id as immo_id,
|
||||||
line.id_account as account_id,
|
line.id_account as account_id,
|
||||||
@ -38,27 +37,22 @@
|
|||||||
line.debit as montant,
|
line.debit as montant,
|
||||||
trans.id as trans_id,
|
trans.id as trans_id,
|
||||||
trans.label as label,
|
trans.label as label,
|
||||||
trans.date,
|
trans.date as date_achat,
|
||||||
y.id as year_id,
|
y.id as year_id,
|
||||||
y.end_date as date_amort,
|
y.end_date as date_amort,
|
||||||
project.label as project_label
|
project.label as project_label
|
||||||
FROM acc_transactions_lines AS line
|
from acc_transactions_lines as line
|
||||||
INNER JOIN acc_transactions AS trans ON line.id_transaction = trans.id
|
inner join acc_transactions as trans on line.id_transaction = trans.id
|
||||||
INNER JOIN acc_years AS y ON trans.id_year = y.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
|
left join acc_projects AS project ON line.id_project = project.id
|
||||||
WHERE line.id = :line_id;
|
where line.id = :line_id;
|
||||||
:line_id = $_GET.immo_id|intval
|
:line_id = $_GET.immo_id|intval
|
||||||
assign=ligne_immo
|
assign=ligne_immo
|
||||||
}}
|
}}
|
||||||
|
<h2>Amortissement de « {{$label}} » d'un montant de {{"%f"|math:$montant|money_currency}} en date du {{$date_achat|date_short}} sur {{$duree}} ans</h2>
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:error message="Immobilisation %s non trouvée"|args:$_GET.immo_id}}
|
{{:error message="Immobilisation %s non trouvée"|args:$_GET.immo_id}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
{{: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 *}}
|
{{* chercher des écritures d'amortissement liées à l'immobilisation *}}
|
||||||
{{#select
|
{{#select
|
||||||
@ -72,10 +66,11 @@
|
|||||||
trans.date as amort_date,
|
trans.date as amort_date,
|
||||||
trans.label as trans_label,
|
trans.label as trans_label,
|
||||||
trans.id_year as amort_year,
|
trans.id_year as amort_year,
|
||||||
account.id as account_id,
|
acc.id as account_id,
|
||||||
account.code as account_code,
|
acc.code as account_code,
|
||||||
account.label as account_label
|
acc.label as account_name
|
||||||
FROM acc_transactions_lines as l_immo
|
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 as t_immo on t_immo.id = l_immo.id_transaction
|
||||||
INNER JOIN acc_transactions_links as links
|
INNER JOIN acc_transactions_links as links
|
||||||
ON (
|
ON (
|
||||||
@ -85,53 +80,41 @@
|
|||||||
)
|
)
|
||||||
INNER JOIN acc_transactions_lines as l_amort on amort_trans_id = l_amort.id_transaction
|
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_transactions as trans on l_amort.id_transaction = trans.id
|
||||||
INNER join acc_accounts as account on l_amort.id_account = account.id
|
INNER join acc_accounts as acc on l_amort.id_account = acc.id
|
||||||
WHERE
|
WHERE
|
||||||
l_immo.id = :line_id
|
l_immo.id = :line_id
|
||||||
AND
|
AND
|
||||||
l_amort.credit <> 0
|
l_amort.credit <> 0
|
||||||
AND
|
|
||||||
account.code LIKE '28%'
|
|
||||||
ORDER BY trans.date;
|
ORDER BY trans.date;
|
||||||
:line_id = $_GET.immo_id|intval
|
:line_id = $_GET.immo_id|intval
|
||||||
assign=linked_lines.
|
assign=linked_lines.
|
||||||
}}
|
}}
|
||||||
{{:assign var="amort_years." value=$amort_year}}
|
{{:assign var="amort_years." value=$amort_year}}
|
||||||
{{if $date_debut == null}}
|
|
||||||
{{:assign date_debut=$amort_date}}
|
|
||||||
{{/if}}
|
|
||||||
{{/select}}
|
{{/select}}
|
||||||
|
|
||||||
<h3>Amortissement de «
|
{{* montant de l'annuité théorique *}}
|
||||||
<a class="num"
|
{{:assign montant="%f"|math:$ligne_immo.montant}}
|
||||||
href={{"%s/acc/transactions/details.php?id=%s"|args:$admin_url:$ligne_immo.trans_id}}>#{{$ligne_immo.trans_id}}</a>
|
{{:assign annuite="%f/%f"|math:$montant:$duree}}
|
||||||
{{$ligne_immo.label}} » d'un montant de
|
|
||||||
{{"%f"|math:$ligne_immo.montant|money_currency}}
|
|
||||||
en date du {{$date_debut|date_short}}{{if $duree != null}} sur {{$duree}} ans{{/if}}
|
|
||||||
</h3>
|
|
||||||
|
|
||||||
{{if $duree != null}}
|
{{* première annuité *}}
|
||||||
{{* montant de l'annuité théorique *}}
|
{{:assign date_achat=$ligne_immo.date_achat|date_short}}
|
||||||
{{:assign montant="%f"|math:$ligne_immo.montant}}
|
{{:assign date_amort=$ligne_immo.date_amort|date_short}}
|
||||||
{{:assign annuite="%f/%f"|math:$montant:$duree}}
|
{{:include file="_calcul_dates.html" date_debut=$date_achat date_fin=$date_amort keep="nbjours"}}
|
||||||
{{* première annuité *}}
|
{{:assign annuite_1="%f/360*%d"|math:$annuite:$nbjours|intval}}
|
||||||
{{: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 annuite_courante=$annuite_1}}
|
||||||
|
{{:assign current_year=$ligne_immo.year_id}}
|
||||||
{{:assign solde=$ligne_immo.montant}}
|
{{:assign solde=$ligne_immo.montant}}
|
||||||
|
{{:assign nbamort=0}}
|
||||||
|
|
||||||
{{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="ruler">
|
||||||
|
Amortissements attachés à « <a class="num"
|
||||||
|
href={{"%s/acc/transactions/details.php?id=%s"|args:$admin_url:$ligne_immo.trans_id}}>{{$ligne_immo.trans_id}}</a>
|
||||||
|
{{$ligne_immo.label}} »
|
||||||
|
({{"%f"|math:$ligne_immo.montant|money_currency}}, {{$ligne_immo.date_achat|date_short}})
|
||||||
|
</h3>
|
||||||
<table class="list">
|
<table class="list">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@ -157,7 +140,7 @@
|
|||||||
<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>
|
||||||
<td class="money">{{"%f"|math:$line.amort_amount|money}}</td>
|
<td class="money">{{"%f"|math:$line.amort_amount|money}}</td>
|
||||||
<td class="money">{{"%f"|math:$solde|money:false}}</td>
|
<td class="money">{{"%f"|math:$solde|money}}</td>
|
||||||
<td>
|
<td>
|
||||||
{{if $line.amort_label == null}}
|
{{if $line.amort_label == null}}
|
||||||
{{$line.trans_label}}
|
{{$line.trans_label}}
|
||||||
@ -166,13 +149,17 @@
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
</td>
|
</td>
|
||||||
<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_name}}</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="plus"}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{:assign annuite_courante=$annuite}}
|
{{:assign annuite_courante=$annuite}}
|
||||||
{{:include file="_next_year.html" date=$date_amort keep="date_amort"}}
|
{{:assign jour=$date_amort|date:"d"}}
|
||||||
|
{{:assign mois=$date_amort|date:"m"}}
|
||||||
|
{{:assign annee=$date_amort|date:"Y"}}
|
||||||
|
{{:assign annee="%d+1"|math:$annee}}
|
||||||
|
{{:assign date_amort="%s/%s/%s"|args:$jour:$mois:$annee|parse_date|date_short}}
|
||||||
{{:assign nbamort="%d+1"|math:$nbamort}}
|
{{:assign nbamort="%d+1"|math:$nbamort}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -180,13 +167,13 @@
|
|||||||
</section>
|
</section>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{if $duree != null && $solde > 0}}
|
{{if $solde > 0}}
|
||||||
{{:assign project_id=$ligne_immo.project_id}}
|
{{:assign project_id=$ligne_immo.project_id}}
|
||||||
{{:assign project_label=$ligne_immo.project_label}}
|
{{:assign project_label=$ligne_immo.project_label}}
|
||||||
{{:assign nbamort="%d-%d"|math:$duree:$nbamort}}
|
{{:assign nbamort="%d-%d"|math:$duree:$nbamort}}
|
||||||
{{:assign annuite_courante="min(%f,%f)"|math:$annuite_courante:$solde}}
|
{{:assign annuite_courante="min(%f,%f)"|math:$annuite_courante:$solde}}
|
||||||
<section class="amortissement">
|
<section class="amortissement">
|
||||||
<h3 class="center-block ruler">Amortissements à enregistrer</h3>
|
<h3 class="ruler">Amortissements à enregistrer</h3>
|
||||||
<table class="list">
|
<table class="list">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@ -202,7 +189,7 @@
|
|||||||
{{#foreach count="%d+1"|math:$nbamort key="num"}}
|
{{#foreach count="%d+1"|math:$nbamort key="num"}}
|
||||||
{{:assign solde_prec=$solde}}
|
{{:assign solde_prec=$solde}}
|
||||||
{{:assign solde="%f-%d"|math:$solde:$annuite_courante}}
|
{{: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}}
|
{{#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 enregistrer=1}}
|
||||||
{{:assign current_year=$id}}
|
{{:assign current_year=$id}}
|
||||||
{{else}}
|
{{else}}
|
||||||
@ -210,9 +197,9 @@
|
|||||||
{{/select}}
|
{{/select}}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="num">{{"%d+1"|math:$num}}</td>
|
<td class="num">{{"%d+1"|math:$num}}</td>
|
||||||
<td>{{$date_amort|date_short}}</td>
|
<td>{{$date_amort}}</td>
|
||||||
<td class="money">{{"%f"|math:$annuite_courante|money}}</td>
|
<td class="money">{{"%f"|math:$annuite_courante|money}}</td>
|
||||||
<td class="money">{{$solde|money:false}}</td>
|
<td class="money">{{if $solde == 0}}0,00{{else}}{{"%f"|math:$solde|money}}{{/if}}</td>
|
||||||
<td>
|
<td>
|
||||||
{{if $libelle == null}}
|
{{if $libelle == null}}
|
||||||
{{:assign libelle="Amortissement "|cat:$ligne_immo.label}}
|
{{:assign libelle="Amortissement "|cat:$ligne_immo.label}}
|
||||||
@ -230,7 +217,11 @@
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{:include file="_next_year.html" date=$date_amort keep="date_amort"}}
|
{{:assign jour=$date_amort|date:"d"}}
|
||||||
|
{{:assign mois=$date_amort|date:"m"}}
|
||||||
|
{{:assign annee=$date_amort|date:"Y"}}
|
||||||
|
{{:assign annee="%d+1"|math:$annee}}
|
||||||
|
{{:assign date_amort="%s/%s/%s"|args:$jour:$mois:$annee|parse_date|date_short}}
|
||||||
{{:assign annuite_courante="min(%f,%f)"|math:$annuite:$solde}}
|
{{:assign annuite_courante="min(%f,%f)"|math:$annuite:$solde}}
|
||||||
{{if $solde == 0}}{{:break}}{{/if}}
|
{{if $solde == 0}}{{:break}}{{/if}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
@ -239,80 +230,78 @@
|
|||||||
</section>
|
</section>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{if $_GET.amort == null || $_GET.amort != "fini"}}
|
{{* Autres amortissements non rattachés *}}
|
||||||
|
{{#select
|
||||||
{{* Autres amortissements non rattachés *}}
|
li.id as l_id,
|
||||||
|
li.id_transaction as t_id,
|
||||||
|
li.credit as montant,
|
||||||
|
li.reference,
|
||||||
|
li.label as l_label,
|
||||||
|
trans.date as t_date,
|
||||||
|
trans.label as t_label,
|
||||||
|
acc.code as a_code,
|
||||||
|
acc.label as a_label,
|
||||||
|
y.label as y_label
|
||||||
|
from acc_transactions_lines as li
|
||||||
|
inner join acc_accounts as acc on acc.id = li.id_account
|
||||||
|
inner join acc_transactions as trans on trans.id = li.id_transaction
|
||||||
|
inner join acc_years as y on y.id = trans.id_year
|
||||||
|
where acc.code like "28%"
|
||||||
|
order by trans.date, trans.label;
|
||||||
|
assign=autre_amort
|
||||||
|
}}
|
||||||
{{#select
|
{{#select
|
||||||
line.id as l_id,
|
id_transaction,
|
||||||
line.id_transaction as t_id,
|
id_related
|
||||||
line.credit as amort_amount,
|
from acc_transactions_links
|
||||||
line.label as l_label,
|
where id_transaction = :id_amort or id_related = :id_amort;
|
||||||
trans.date as t_date,
|
:id_amort=$t_id
|
||||||
trans.label as t_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 line
|
|
||||||
INNER JOIN acc_accounts AS account ON account.id = line.id_account
|
|
||||||
INNER JOIN acc_transactions AS trans ON trans.id = line.id_transaction
|
|
||||||
INNER JOIN acc_years AS y ON y.id = trans.id_year
|
|
||||||
WHERE account.code LIKE "28%" AND credit > 0 AND (NOT trans.status & 16)
|
|
||||||
ORDER BY trans.date, trans.label;
|
|
||||||
assign=autre_amort
|
|
||||||
}}
|
}}
|
||||||
{{#select
|
{{else}}
|
||||||
id_transaction,
|
{{:assign var="autres_amortissements." value=$autre_amort}}
|
||||||
id_related
|
|
||||||
FROM acc_transactions_links
|
|
||||||
WHERE id_transaction = :id_amort OR id_related = :id_amort;
|
|
||||||
:id_amort=$t_id
|
|
||||||
}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign var="autres_amortissements." value=$autre_amort}}
|
|
||||||
{{/select}}
|
|
||||||
{{/select}}
|
{{/select}}
|
||||||
|
{{/select}}
|
||||||
|
|
||||||
{{if $autres_amortissements != null}}
|
{{if $autres_amortissements != null}}
|
||||||
<section class="amortissement">
|
<section class="amortissement">
|
||||||
<h3 class="center-block ruler">Autres amortissements non rattachés</h3>
|
<h3 class="ruler">Autres amortissements non rattachés</h3>
|
||||||
<table class="list">
|
<table class="list">
|
||||||
<thead>
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>N°</th>
|
||||||
|
<th>Date</th>
|
||||||
|
<th class="nombre">Montant</th>
|
||||||
|
<th>Libellé</th>
|
||||||
|
<th>N° compte</th>
|
||||||
|
<th>Compte</th>
|
||||||
|
<th class="actions"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
{{#foreach from=$autres_amortissements item="line"}}
|
||||||
|
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.t_id}}
|
||||||
<tr>
|
<tr>
|
||||||
<th>N°</th>
|
<td class="num"><a href={{$trans_url}}>#{{$line.t_id}}</a></td>
|
||||||
<th>Date</th>
|
<td>{{$line.t_date|date_short}}</td>
|
||||||
<th class="nombre">Montant</th>
|
<td class="money">{{"%f"|math:$line.montant|money}}</td>
|
||||||
<th>Libellé</th>
|
<td>{{if $line.l_label == null}}
|
||||||
<th>N° compte</th>
|
{{$line.t_label}}
|
||||||
<th>Compte</th>
|
{{else}}
|
||||||
<th class="actions"></th>
|
{{$line.l_label}}
|
||||||
|
{{/if}}
|
||||||
|
</td>
|
||||||
|
<td>{{$line.a_code}}</td>
|
||||||
|
<td>{{$line.a_label}}</td>
|
||||||
|
<td>
|
||||||
|
{{:linkbutton label="Attacher" href="attach_amort.html?amort_id=%d&immo_id=%d"|args:$line.l_id:$ligne_immo.immo_id shape="plus"}}
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
{{/foreach}}
|
||||||
<tbody>
|
</tbody>
|
||||||
{{#foreach from=$autres_amortissements item="line"}}
|
</table>
|
||||||
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.t_id}}
|
</section>
|
||||||
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$line.account_id:$line.amort_year}}
|
|
||||||
<tr>
|
|
||||||
<td class="num"><a href={{$trans_url}}>#{{$line.t_id}}</a></td>
|
|
||||||
<td>{{$line.t_date|date_short}}</td>
|
|
||||||
<td class="money">{{"%f"|math:$line.amort_amount|money}}</td>
|
|
||||||
<td>{{if $line.l_label == null}}
|
|
||||||
{{$line.t_label}}
|
|
||||||
{{else}}
|
|
||||||
{{$line.l_label}}
|
|
||||||
{{/if}}
|
|
||||||
</td>
|
|
||||||
<td><a href={{$compte_url}}>{{$line.account_code}}</a></td>
|
|
||||||
<td>{{$line.account_label}}</td>
|
|
||||||
<td>
|
|
||||||
{{:linkbutton label="Attacher" href="attach_amort.html?amort_id=%d&immo_id=%d"|args:$line.l_id:$ligne_immo.immo_id shape="plus"}}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{{/foreach}}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</section>
|
|
||||||
{{/if}}
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{:form_errors}}
|
{{:form_errors}}
|
||||||
{{:admin_footer}}
|
{{:admin_footer}}
|
||||||
|
@ -53,4 +53,4 @@
|
|||||||
assign_code="result_code"
|
assign_code="result_code"
|
||||||
transactions=$linked_transactions
|
transactions=$linked_transactions
|
||||||
}}
|
}}
|
||||||
{{:redirect to="amortization.html?immo_id=%s&ok=1&msg=attach&trans_id=%s"|args:$_GET.immo_id:$amort_id}}
|
{{:redirect to="amortization.html?immo_id=%s&ok=1&msg=attach"|args:$_GET.immo_id}}
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"tva": false,
|
|
||||||
"prefixes": {
|
|
||||||
"20": "Immobilisations incorporelles",
|
|
||||||
"21": "Immobilisations corporelles",
|
|
||||||
"27": "Immobilisations financières"
|
|
||||||
}
|
|
||||||
}
|
|
@ -55,4 +55,4 @@
|
|||||||
assign_code="result_code"
|
assign_code="result_code"
|
||||||
transactions=$linked_transactions
|
transactions=$linked_transactions
|
||||||
}}
|
}}
|
||||||
{{:redirect to="amortization.html?immo_id=%s&ok=1&msg=detach&trans_id=%s"|args:$_GET.immo_id:$amort_id}}
|
{{:redirect to="amortization.html?immo_id=%s&ok=1&msg=detach"|args:$_GET.immo_id}}
|
||||||
|
@ -1,153 +0,0 @@
|
|||||||
{{* -*- brindille -*- *}}
|
|
||||||
|
|
||||||
{{* Liste des immobilisations amortissable ou à définir *}}
|
|
||||||
|
|
||||||
<section class="immobilisation">
|
|
||||||
{{if $amort == "amort"}}
|
|
||||||
<h2 class="ruler">Immobilisations en cours</h2>
|
|
||||||
{{else}}
|
|
||||||
<h2 class="ruler">Immobilisations amorties</h2>
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
<table class="list">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>N°</th>
|
|
||||||
<th>Date</th>
|
|
||||||
<th>Libellé</th>
|
|
||||||
<th class="nombre">Montant</th>
|
|
||||||
<th class="nombre">Durée</th>
|
|
||||||
<th>N° compte</th>
|
|
||||||
<th>Compte</th>
|
|
||||||
<th>Projet</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,
|
|
||||||
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 duration=null}}
|
|
||||||
{{* voir si l'immo est prise en charge *}}
|
|
||||||
{{#load type="immo" where="$$.line = :line_id" :line_id=$immo_id|intval}}
|
|
||||||
{{:assign duration=$duration}}
|
|
||||||
{{if $noamort}}
|
|
||||||
{{:assign amortissable="non"}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign amortissable="oui"}}
|
|
||||||
{{/if}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign amortissable="nsp"}}
|
|
||||||
{{/load}}
|
|
||||||
{{if $amortissable == "non"}}
|
|
||||||
{{:continue}}
|
|
||||||
{{/if}}
|
|
||||||
{{* 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 exist_amort=false}}
|
|
||||||
{{:assign amort_amount=0}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign amort_amount=$amort_amount}}
|
|
||||||
{{:assign exist_amort=true}}
|
|
||||||
{{/if}}
|
|
||||||
{{/select}}
|
|
||||||
{{* immo amortie ? *}}
|
|
||||||
{{if $amort == "amort" && $amort_amount >= $debit ||
|
|
||||||
$amort == "fini" && $amort_amount < $debit
|
|
||||||
}}
|
|
||||||
{{: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}}</td>
|
|
||||||
<td class="money">{{if $duration != null}}{{$duration}}{{/if}}</td>
|
|
||||||
<td><a href={{$compte_url}}>{{$account_code}}</a></td>
|
|
||||||
<td>{{$account_label}}</td>
|
|
||||||
<td>{{$project_label}}</td>
|
|
||||||
<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}}
|
|
||||||
{{:linkbutton
|
|
||||||
label="Modifier infos"
|
|
||||||
href="modif_infos.html?immo_id=%s&amort=1"|args:$immo_id
|
|
||||||
shape="help"
|
|
||||||
target="_dialog"
|
|
||||||
}}
|
|
||||||
{{/if}}
|
|
||||||
{{:linkbutton
|
|
||||||
label="Amortissements"
|
|
||||||
href="amortization.html?immo_id=%s&amort=%s"|args:$immo_id:$amort
|
|
||||||
shape="table"
|
|
||||||
}}
|
|
||||||
{{/if}}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{{/select}}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</section>
|
|
@ -1,71 +0,0 @@
|
|||||||
{{* -*- brindille -*- *}}
|
|
||||||
|
|
||||||
{{* Liste des immobilisations non amortissables *}}
|
|
||||||
|
|
||||||
<section class="immobilisation">
|
|
||||||
<h2 class="ruler">Immobilisations non amortissables</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>Projet</th>
|
|
||||||
<th class="actions"></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
|
|
||||||
{{#load type="immo" where="$$.noamort = true"}}
|
|
||||||
{{: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}}
|
|
||||||
<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">
|
|
||||||
{{:linkbutton
|
|
||||||
label="Modifier infos"
|
|
||||||
href="modif_infos.html?immo_id=%s&amort=0"|args:$immo_id
|
|
||||||
shape="help"
|
|
||||||
target="_dialog"
|
|
||||||
}}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{{/select}}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</section>
|
|
136
index.html
136
index.html
@ -1,56 +1,114 @@
|
|||||||
{{* -*- brindille -*- *}}
|
{{* -*- brindille -*- *}}
|
||||||
{{:admin_header title="Gestion des amortissements" custom_css="./style.css" current="module_amortissement"}}
|
{{:admin_header title="Gestion des amortissements" custom_css=$custom_css current="module_amortissement"}}
|
||||||
|
|
||||||
{{* barre de navigation *}}
|
{{* barre de navigation *}}
|
||||||
{{if $_GET.amort == null}}
|
{{:include file="_nav.html" current="index"}}
|
||||||
{{:assign amort="amort"}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign amort=$_GET.amort}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{:include file="_nav.html" current="index" subcurrent="%s"|args:$amort}}
|
|
||||||
|
|
||||||
{{if $_GET.ok}}
|
{{if $_GET.ok}}
|
||||||
{{if $_GET.msg|match:"immobilisation"}}
|
{{if $_GET.msg|match:"immobilisation"}}
|
||||||
{{:assign msg="Immobilisation enregistrée"}}
|
{{:assign msg="Immobilisation enregistrée"}}
|
||||||
{{elseif $_GET.msg|match:"infos"}}
|
{{elseif $_GET.msg|match:"durée"}}
|
||||||
{{:assign msg="Informations enregistrées"}}
|
{{:assign msg="Durée enregistrée"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<p class="block confirm">{{$msg}}</p>
|
<p class="block confirm">{{$msg}}</p>
|
||||||
{{elseif $_GET.err}}
|
{{elseif $_GET.err}}
|
||||||
<p class="block error">Échec enregistrement immobilisation</p>
|
<p class="block error">Échec enregistrement immobilisation</p>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#load type="immo"}}
|
{{* lister les immobilisations *}}
|
||||||
{{* supprimer les documents sans écriture associée *}}
|
<section class="immobilisation">
|
||||||
{{#select
|
<h2 class="ruler">Liste des immobilisations</h2>
|
||||||
line.id as line_id
|
|
||||||
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 = $line
|
|
||||||
}}
|
|
||||||
{{else}}
|
|
||||||
{{:delete key=$key}}
|
|
||||||
{{/select}}
|
|
||||||
|
|
||||||
{{* supprimer les documents correspondant à une écriture de la balance d'ouverture *}}
|
<table class="list">
|
||||||
{{#select
|
<thead>
|
||||||
line.id as line_id,
|
<tr>
|
||||||
trans.status
|
<th>N°</th>
|
||||||
FROM acc_transactions_lines as line
|
<th>Date</th>
|
||||||
INNER JOIN acc_transactions AS trans on line.id_transaction = trans.id
|
<th>Libellé</th>
|
||||||
WHERE line.id = :line_id AND (trans.status & 16);
|
<th>Montant</th>
|
||||||
:line_id = $line
|
<th>Durée</th>
|
||||||
}}
|
<th>N° compte</th>
|
||||||
{{:delete key=$key}}
|
<th>Compte</th>
|
||||||
{{/select}}
|
<th>Projet</th>
|
||||||
{{/load}}
|
<th class="actions"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{{*
|
||||||
|
TODO améliorer cette requête : voir si assez général
|
||||||
|
*}}
|
||||||
|
|
||||||
{{if $amort == "no_amort"}}
|
{{#select
|
||||||
{{:include file="./immobilisations_non.html"}}
|
trans.id as trans_id,
|
||||||
{{else}}
|
trans.label as trans_label,
|
||||||
{{:include file="./immobilisations.html"}}
|
trans.date as trans_date,
|
||||||
{{/if}}
|
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
|
||||||
|
(account.code LIKE '21%' OR account.code LIKE '22%')
|
||||||
|
ORDER BY trans.date DESC
|
||||||
|
}}
|
||||||
|
{{: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}}
|
||||||
|
{{#load type="immo" where="$$.line = :line_id" :line_id=$immo_id|intval}}
|
||||||
|
{{:assign duration=$duration}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign duration=null}}
|
||||||
|
{{/load}}
|
||||||
|
|
||||||
|
<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}}</td>
|
||||||
|
<td class="num">{{if $duration != null}}{{$duration}}{{/if}}</td>
|
||||||
|
<td><a href={{$compte_url}}>{{$account_code}}</a></td>
|
||||||
|
<td>{{$account_label}}</td>
|
||||||
|
<td>{{$project_label}}</td>
|
||||||
|
<td class="actions">
|
||||||
|
{{if $duration == null}}
|
||||||
|
{{:linkbutton
|
||||||
|
label="Ajouter durée"
|
||||||
|
href="add_duration.html?immo_id=%s"|args:$immo_id
|
||||||
|
shape="help"
|
||||||
|
target="_dialog"
|
||||||
|
}}
|
||||||
|
{{else}}
|
||||||
|
{{:linkbutton
|
||||||
|
label="Amortissements"
|
||||||
|
href="amortization.html?immo_id=%s"|args:$immo_id
|
||||||
|
shape="table"
|
||||||
|
}}
|
||||||
|
{{/if}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{{/select}}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<form method="post" action="">
|
||||||
|
<fieldset>
|
||||||
|
<legend>Ajouter une immobilisation</legend>
|
||||||
|
<p class="submit">
|
||||||
|
{{:linkbutton
|
||||||
|
label="Ajouter une immobilisation"
|
||||||
|
shape="plus"
|
||||||
|
href="add_asset.html"
|
||||||
|
target="_dialog"
|
||||||
|
}}
|
||||||
|
</p>
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
|
|
||||||
{{:admin_footer}}
|
{{:admin_footer}}
|
||||||
|
113
modif_infos.html
113
modif_infos.html
@ -1,113 +0,0 @@
|
|||||||
{{* -*- brindille -*- *}}
|
|
||||||
|
|
||||||
{{:admin_header title="Modifier informations amortissement" custom_css=$custom_css current="module_amortissement"}}
|
|
||||||
|
|
||||||
{{* barre de navigation *}}
|
|
||||||
{{if ! $dialog}}
|
|
||||||
{{:include file="_nav.html" current="index"}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{* infos de l'immobilisation *}}
|
|
||||||
{{:assign var="immo_id" value=$_GET.immo_id|intval}}
|
|
||||||
{{#load type="immo" assign="info_immo" where="$$.line = :line_id" :line_id=$immo_id|intval}}
|
|
||||||
{{/load}}
|
|
||||||
|
|
||||||
{{* Traiter l'envoi du formulaire *}}
|
|
||||||
{{#form on="change"}}
|
|
||||||
|
|
||||||
{{* chercher la date d'acquisition de l'immobilisation *}}
|
|
||||||
{{#select
|
|
||||||
trans.date as date_achat
|
|
||||||
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 = $immo_id
|
|
||||||
assign=ligne_immo
|
|
||||||
}}
|
|
||||||
{{/select}}
|
|
||||||
|
|
||||||
{{if $_POST.no_amort}}
|
|
||||||
{{* ne pas amortir *}}
|
|
||||||
{{:assign duration=0}}
|
|
||||||
{{:assign date_debut=$ligne_immo.date_achat|parse_date}}
|
|
||||||
{{:assign noamort=true}}
|
|
||||||
{{else}}
|
|
||||||
{{* 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}}
|
|
||||||
{{if $date_debut|strtotime < $ligne_immo.date_achat|strtotime}}
|
|
||||||
{{:assign dd=$date_debut|date_short}}
|
|
||||||
{{:assign da=$ligne_immo.date_achat|date_short}}
|
|
||||||
{{:error message="Erreur : la date de mise en service (%s) ne peut être antérieure à la date d'acquisition (%s)"|args:$dd:$da}}
|
|
||||||
{{/if}}
|
|
||||||
{{:assign duration=$_POST.duree|intval}}
|
|
||||||
{{if $duration <= 0}}
|
|
||||||
{{:error message="Erreur : la durée d'amortissement doit être strictement positive"}}
|
|
||||||
{{/if}}
|
|
||||||
{{:assign noamort=false}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{* enregistrer les infos modifiées de l'immobilisation *}}
|
|
||||||
{{:save
|
|
||||||
key=$info_immo.key
|
|
||||||
validate_schema="schema.json"
|
|
||||||
type="immo"
|
|
||||||
line=$immo_id
|
|
||||||
duration=$duration
|
|
||||||
date=$date_debut
|
|
||||||
noamort=$noamort
|
|
||||||
}}
|
|
||||||
|
|
||||||
{{if $_POST.no_amort}}
|
|
||||||
{{:assign amort=0}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign amort=1}}
|
|
||||||
{{/if}}
|
|
||||||
{{:redirect force="index.html?ok=1&msg=infos&amort=%s"|args:$amort}}
|
|
||||||
{{else}}
|
|
||||||
{{:form_errors}}
|
|
||||||
{{/form}}
|
|
||||||
|
|
||||||
{{* modifier la date de mise en service et durée d'amortissement *}}
|
|
||||||
|
|
||||||
{{if $_GET.amort == 0}}
|
|
||||||
{{:assign checked=1}}
|
|
||||||
{{:assign disabled=1}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign checked=0}}
|
|
||||||
{{:assign disabled=0}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
<form method="post" action="">
|
|
||||||
<fieldset id="infos_immo">
|
|
||||||
<legend></legend>
|
|
||||||
<dl>
|
|
||||||
{{:input id="no_amort" type="checkbox" value=1 name="no_amort" label="Ne pas amortir" default=$checked help="Cocher pour ne pas amortir" onclick="toggleInputs('infos_immo','f_no_amort_1')"}}
|
|
||||||
{{:input type="date" name="date_mes" label="Date de mise en service" default=$info_immo.date disabled=$disabled help="à renseigner uniquement si différente de la date d'acquisition"}}
|
|
||||||
{{:input type="number" name="duree" label="Durée d'amortissement" default=$info_immo.duration required=true min=1 disabled=$disabled}}
|
|
||||||
</dl>
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<p class="submit">
|
|
||||||
{{:button type="submit" name="change" label="Modifier" shape="right" class="main"}}
|
|
||||||
</p>
|
|
||||||
|
|
||||||
</form>
|
|
||||||
|
|
||||||
{{* activer/désactiver les champs de saisie *}}
|
|
||||||
<script type="text/javascript">
|
|
||||||
function toggleInputs(idfs, idcb) {
|
|
||||||
const noamort = document.getElementById(idcb);
|
|
||||||
const fs = document.getElementById(idfs);
|
|
||||||
for (let field of fs.querySelectorAll("input")) {
|
|
||||||
if (field == noamort) { continue }
|
|
||||||
if (noamort.checked) {
|
|
||||||
field.setAttribute("disabled","disabled");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
field.removeAttribute("disabled");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
{{:admin_footer}}
|
|
@ -1,5 +1,5 @@
|
|||||||
name="Amortissements"
|
name="Amortissements"
|
||||||
description="Gestion des amortissements pour le logiciel de comptabilité Paheko (v0.16)"
|
description="Gestion des amortissements pour le logiciel de comptabilité Paheko"
|
||||||
author="Jean-Christophe Engel"
|
author="Jean-Christophe Engel"
|
||||||
author_url="https://git.roflcopter.fr/lesanges"
|
author_url="https://git.roflcopter.fr/lesanges"
|
||||||
home_button=false
|
home_button=false
|
||||||
|
@ -18,7 +18,8 @@
|
|||||||
}}
|
}}
|
||||||
|
|
||||||
{{if $selected_year == null}}
|
{{if $selected_year == null}}
|
||||||
{{:error message="La date choisie n'est dans aucun exercice ouvert !!\nExercices ouverts : %s"|args:$open_years}}
|
{{:assign message="La date choisie n'est dans aucun exercice ouvert !!\nExercices ouverts : %s"|args:$open_years}}
|
||||||
|
{{:error message=$message}}
|
||||||
{{/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 *}}
|
||||||
@ -36,33 +37,22 @@
|
|||||||
{{: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 280 ou 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
|
||||||
*}}
|
*}}
|
||||||
{{:read file="./defaut.json" assign="config_json"}}
|
{{:assign var="prefix_array." value="'280%'"}}
|
||||||
{{:assign config_defaut=$config_json|json_decode}}
|
{{:assign var="prefix_array." value="'281%'"}}
|
||||||
{{:assign var="prefix_array" value=$config_defaut.prefixes|keys}}
|
|
||||||
{{#foreach from=$prefix_array item="code"}}
|
|
||||||
{{* déterminer le numéro du compte d'amortissement associé au compte d'immobilisation *}}
|
|
||||||
{{:include
|
|
||||||
file="./_get_amort_code.html"
|
|
||||||
code_immo=$code
|
|
||||||
keep="code_amort"
|
|
||||||
}}
|
|
||||||
{{:assign var="amort_array." value=$code_amort|intval}}
|
|
||||||
{{/foreach}}
|
|
||||||
|
|
||||||
{{:include
|
{{:include
|
||||||
file="_check_account.html"
|
file="_check_account.html"
|
||||||
account=$credit_account
|
account=$credit_account
|
||||||
chart_id=$selected_chart
|
chart_id=$selected_chart
|
||||||
prefix_array=$amort_array
|
prefix_array=$prefix_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}}
|
{{:error message="Le compte « %s » n'est pas un compte d'amortissement ou n'est pas dans le plan comptable de l'exercice choisi"|args:$compte}}
|
||||||
{{/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 *}}
|
||||||
@ -115,12 +105,10 @@
|
|||||||
d'immobilisation => ajouter un 8 après le 2 de tête
|
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}}
|
{{#select code, label from acc_accounts where id = :id; :id=$_GET.account assign=amort_account}}{{/select}}
|
||||||
{{:include
|
{{:assign c1=$amort_account.code|substr:0:1}}
|
||||||
file="./_get_amort_code.html"
|
{{:assign reste=$amort_account.code|substr:1}}
|
||||||
code_immo=$amort_account.code
|
{{:assign amort_code=$c1|cat:8|cat:$reste}}
|
||||||
keep="code_amort"
|
{{:assign var="credit_account.%s"|args:$amort_code value="%s — Amortissements "|args:$amort_code|cat:$amort_account.label}}
|
||||||
}}
|
|
||||||
{{:assign var="credit_account.%s"|args:$code_amort value="%s — Amortissements "|args:$code_amort|cat:$amort_account.label}}
|
|
||||||
|
|
||||||
{{#select
|
{{#select
|
||||||
id,
|
id,
|
||||||
@ -147,7 +135,7 @@
|
|||||||
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?&key=code&year=%d"|args:$year.id
|
||||||
default=$debit_account
|
default=$debit_account
|
||||||
}}
|
}}
|
||||||
{{:input
|
{{:input
|
||||||
@ -155,7 +143,7 @@
|
|||||||
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?key=code&year=%d"|args:$year.id
|
||||||
default=$credit_account
|
default=$credit_account
|
||||||
}}
|
}}
|
||||||
</dl>
|
</dl>
|
||||||
|
10
schema.json
10
schema.json
@ -13,15 +13,7 @@
|
|||||||
"duration" : {
|
"duration" : {
|
||||||
"description": "durée de l'amortissement en années",
|
"description": "durée de l'amortissement en années",
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
|
||||||
"date" : {
|
|
||||||
"description" : "date de mise en service de l'immobilisation",
|
|
||||||
"type" : ["string", "null"],
|
|
||||||
"format" : "date"
|
|
||||||
},
|
|
||||||
"noamort" : {
|
|
||||||
"type" : ["null", "boolean"]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": ["type", "line", "duration", "date"]
|
"required": ["type", "line", "duration"]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user