Compare commits
32 Commits
Author | SHA1 | Date | |
---|---|---|---|
f509cd42c9 | |||
8b87ce74cf | |||
b6ced673dc | |||
9ac427415a | |||
17d132ffa2 | |||
f17ccd1bc8 | |||
4b63ad4560 | |||
2aa64cc525 | |||
022e324bea | |||
5ab7d628a8 | |||
ad4b76695d | |||
f1bea6bda2 | |||
1e2ba133f5 | |||
993ded84d3 | |||
a604a86a3f | |||
9e79eb7f42 | |||
03488b0ab9 | |||
5fcf510b25 | |||
3ef33e15e3 | |||
c943c9d3e6 | |||
0160fef1c2 | |||
6e06d4f24f | |||
3738ea0721 | |||
a1bf1c485c | |||
b1a78a3047 | |||
f76c243b8c | |||
11be1386c2 | |||
4f1be445ff | |||
9d2c30f0eb | |||
516021031d | |||
d599d49e1a | |||
66859c550e |
@ -6,23 +6,15 @@
|
||||
- date_fin
|
||||
résultat : nbjours
|
||||
*}}
|
||||
{{* pour simplifier : 30 jours par mois et 360 jours par an *}}
|
||||
|
||||
{{:assign jour_debut=$date_debut|date:"d"}}
|
||||
{{:assign jour_debut="min(%d, 30)"|math:$jour_debut}}
|
||||
{{:assign mois_debut=$date_debut|date:"m"}}
|
||||
{{:assign annee_debut=$date_debut|date:"Y"}}
|
||||
{{:assign ts_debut=$date_debut|strtotime}}
|
||||
{{:assign ts_fin=$date_fin|strtotime}}
|
||||
|
||||
{{:assign jour_fin=$date_fin|date:"d"}}
|
||||
{{:assign jour_fin="min(%d, 30)"|math:$jour_fin}}
|
||||
{{:assign mois_fin=$date_fin|date:"m"}}
|
||||
{{:assign annee_fin=$date_fin|date:"Y"}}
|
||||
|
||||
{{:assign nbjours="%d-%d"|math:$jour_fin:$jour_debut}}
|
||||
{{:assign nbjours="%d+(%d-%d)*30"|math:$nbjours:$mois_fin:$mois_debut}}
|
||||
{{:assign nbjours="%d+(%d-%d)*360"|math:$nbjours:$annee_fin:$annee_debut}}
|
||||
|
||||
{{* au cas où les deux dates seraient inversées ... *}}
|
||||
{{if $nbjours < 0}}
|
||||
{{:assign nbjours="-1*%d"|math:$nbjours}}
|
||||
{{if $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}}
|
||||
|
@ -12,10 +12,10 @@
|
||||
- account_ok
|
||||
*}}
|
||||
|
||||
{{:assign quote="'"}}
|
||||
{{:assign condition=" AND ("}}
|
||||
{{#foreach from=$prefix_array item="code"}}
|
||||
{{:assign condition=$condition|cat:" code LIKE "|cat:$quote|cat:$code|cat:"%"|cat:$quote|cat:" OR "}}
|
||||
{{:assign code=$code|cat:"%"|quote_sql}}
|
||||
{{:assign condition=$condition|cat:" code LIKE "|cat:$code|cat:" OR "}}
|
||||
{{/foreach}}
|
||||
{{:assign condition=$condition|cat:"0)"}}
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
*}}
|
||||
|
||||
{{:assign open_years=""}}
|
||||
{{#years status=false}}
|
||||
{{#years status=false order="start_date"}}
|
||||
{{:assign open_years=$open_years|cat:"\n"|cat:" - "|cat:$label|cat:" : "}}
|
||||
{{:assign debut=$start_date|date_short}}
|
||||
{{:assign fin=$end_date|date_short}}
|
||||
|
14
_get_amort_code.html
Normal file
14
_get_amort_code.html
Normal file
@ -0,0 +1,14 @@
|
||||
{{* -*- 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,14 +1,28 @@
|
||||
{{* -*- brindille -*- *}}
|
||||
|
||||
<nav class="tabs">
|
||||
{{if $current == 'index'}}
|
||||
<aside>
|
||||
{{:linkbutton label="Ajouter une immobilisation" shape="plus" href="add_asset.html" target="_dialog"}}
|
||||
</aside>
|
||||
{{/if}}
|
||||
|
||||
<ul>
|
||||
<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>
|
||||
</ul>
|
||||
|
||||
{{if $current == 'index'}}
|
||||
<ul class="sub">
|
||||
{{if $subcurrent == 'amortization'}}
|
||||
<li class="current"><a>Amortissements</a></li>
|
||||
{{/if}}
|
||||
<ul class="sub">
|
||||
<li {{if $subcurrent == 'amort'}}class="current"{{/if}}><a href="index.html?amort=amort">Amortissables</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>
|
||||
</ul>
|
||||
|
||||
{{if $subsubcurrent == 'amortization'}}
|
||||
<ul class="sub">
|
||||
<li class="title"><strong>Amortissements</strong></li>
|
||||
</ul>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</nav>
|
||||
|
13
_next_year.html
Normal file
13
_next_year.html
Normal file
@ -0,0 +1,13 @@
|
||||
{{* -*- 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}}
|
@ -6,6 +6,10 @@
|
||||
{{:include file="_nav.html" current="index"}}
|
||||
{{/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 *}}
|
||||
{{#form on="add"}}
|
||||
|
||||
@ -15,19 +19,27 @@
|
||||
date=$_POST.date_achat
|
||||
keep="open_years, selected_year, selected_chart"
|
||||
}}
|
||||
|
||||
{{* 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}}
|
||||
|
||||
{{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}}
|
||||
{{* 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:$_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}}
|
||||
|
||||
{{* déterminer le numéro des comptes au cas où la clé serait un identifiant *}}
|
||||
{{:include
|
||||
file="_get_codes.html"
|
||||
@ -47,10 +59,6 @@
|
||||
- est présent dans le PC de l'exercice correspondant à la date
|
||||
*}}
|
||||
|
||||
{{:read file="./defaut.json" assign="config_json"}}
|
||||
{{:assign config_defaut=$config_json|json_decode}}
|
||||
{{:assign var="prefix_array" value=$config_defaut.prefixes|keys}}
|
||||
|
||||
{{:include
|
||||
file="_check_account.html"
|
||||
account=$debit_account
|
||||
@ -93,10 +101,16 @@
|
||||
validate_schema="schema.json"
|
||||
type="immo"
|
||||
line=$immo_id
|
||||
duration=$_POST.duree|intval
|
||||
duration=$duration
|
||||
date=$date_debut
|
||||
noamort=$noamort
|
||||
}}
|
||||
{{:redirect force="index.html?ok=1&msg=immobilisation"}}
|
||||
{{if $_POST.no_amort}}
|
||||
{{:assign amort=0}}
|
||||
{{else}}
|
||||
{{:assign amort=1}}
|
||||
{{/if}}
|
||||
{{:redirect force="index.html?ok=1&msg=immobilisation&amort=%s"|args:$amort}}
|
||||
{{/form}}
|
||||
|
||||
{{:form_errors}}
|
||||
@ -109,21 +123,28 @@
|
||||
{{:assign var="projects.%d"|args:$id value=$label}}
|
||||
{{/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="">
|
||||
<fieldset class="ajout_immo">
|
||||
<fieldset>
|
||||
<legend>Ajouter une immobilisation</legend>
|
||||
<dl>
|
||||
{{:input type="date" name="date_achat" label="Date d'acquisition" required=true default=$now|date_short}}
|
||||
{{: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_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="money" name="montant" label="Montant" required=true}}
|
||||
{{:input type="number" name="duree" label="Durée d'amortissement" required=true default=1}}
|
||||
{{:input type="number" name="duree" label="Durée d'amortissement" required=true min=0 default=1 suffix="année(s)"}}
|
||||
{{:input
|
||||
type="list"
|
||||
name="credit_account"
|
||||
label="Compte de décaissement"
|
||||
required=true
|
||||
target="!acc/charts/accounts/selector.php?targets=1:2:3&key=code"
|
||||
target="!acc/charts/accounts/selector.php?types=%s&date=%s"|args:"1|2|3":$date
|
||||
default=$bank_account
|
||||
}}
|
||||
{{:input
|
||||
@ -131,7 +152,7 @@
|
||||
name="debit_account"
|
||||
label="Compte d'immobilisation (20xx, 21xx, ...)"
|
||||
required=true
|
||||
target="!acc/charts/accounts/selector.php?key=code"
|
||||
target="!acc/charts/accounts/selector.php?date=%s&codes=%s"|args:$date:$patterns
|
||||
default=$immo_account
|
||||
}}
|
||||
{{if $projects != null}}
|
||||
@ -146,4 +167,35 @@
|
||||
|
||||
</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}}
|
||||
|
@ -1,63 +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'achat 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}}
|
||||
|
||||
{{* 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 key=""|uuid}}
|
||||
{{* enregistrer les infos de l'immobilisation *}}
|
||||
{{:save
|
||||
key=$key
|
||||
validate_schema="schema.json"
|
||||
type="immo"
|
||||
line=$immo_id
|
||||
duration=$_POST.duree|intval
|
||||
date=$date_debut
|
||||
}}
|
||||
|
||||
{{:redirect force="index.html?ok=1&msg=durée"}}
|
||||
{{/form}}
|
||||
|
||||
{{* renseigner la date de mise en service et durée d'amortissement *}}
|
||||
<form method="post" action="">
|
||||
<fieldset class="ajout_duree">
|
||||
<legend>Renseigner informations amortissement</legend>
|
||||
<dl>
|
||||
{{: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="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>
|
||||
|
||||
{{:form_errors}}
|
||||
{{:admin_footer}}
|
108
add_infos.html
Normal file
108
add_infos.html
Normal file
@ -0,0 +1,108 @@
|
||||
{{* -*- 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}}
|
126
aide.html
126
aide.html
@ -5,69 +5,78 @@
|
||||
{{* barre de navigation *}}
|
||||
{{:include file="_nav.html" current="aide"}}
|
||||
|
||||
<h2>Liste des immobilisations</h2>
|
||||
<div class="infos">
|
||||
<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>.
|
||||
</p>
|
||||
<p>
|
||||
Dans le cas d'une immobilisation qui n'est pas encore prise en
|
||||
charge par le module, il faut 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 en cliquant sur le
|
||||
bouton « Ajouter infos ».
|
||||
</p>
|
||||
<p>
|
||||
On obtient 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>
|
||||
<p class="aide">
|
||||
Ce module gère l'amortissement linéaire des immobilisations.
|
||||
</p>
|
||||
|
||||
<h3>Ajout d'immobilisation</h3>
|
||||
<h2 class="aide">Immobilisations</h2>
|
||||
Elles sont classées dans 3 onglets :
|
||||
|
||||
<div class="help block">
|
||||
<p>
|
||||
Il faut renseigner les différents paramètres de l'immobilisation :
|
||||
<ul>
|
||||
<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>
|
||||
<ul class="aide">
|
||||
<li>Date d'acquisition du bien</li>
|
||||
<li>Date de mise en service du bien : uniquement si différente de la précédente</li>
|
||||
<li>Désignation : c'est le libellé de l'immobilisation</li>
|
||||
<li>Montant</li>
|
||||
<li>Durée d'amortissement en années</li>
|
||||
<li>Compte de décaissement : à choisir dans la liste</li>
|
||||
<li>Compte d'immobilisation : doit débuter par <b>20</b> ou <b>21</b></li>
|
||||
<li>Compte d'immobilisation : doit débuter par <b>20</b>, <b>21</b> ou <b>27</b></li>
|
||||
<li>Projet analytique (optionnel)</li>
|
||||
</ul>
|
||||
|
||||
Après ajout, on se retrouve sur la page d'accueil (Liste des immobilisations)
|
||||
</p>
|
||||
<p>
|
||||
Après ajout, on se retrouve sur la page d'accueil des immobilisations.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<h2>Amortissements</h2>
|
||||
<h2 class="aide">Amortissements</h2>
|
||||
|
||||
<div class="infos">
|
||||
<p>
|
||||
<p class="aide">
|
||||
Le calcul de l'amortissement se fait par la <em>méthode linéaire</em>.
|
||||
</p>
|
||||
<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>
|
||||
</div>
|
||||
|
||||
<h3>Liste des amortissements</h3>
|
||||
<h3 class="aide">Liste des amortissements</h3>
|
||||
|
||||
<div class="help block">
|
||||
<fieldset>
|
||||
<div class="aide">
|
||||
On trouve ici de une à trois listes, selon la situation :
|
||||
<ul>
|
||||
<ul class="aide">
|
||||
<li>
|
||||
<b>Écritures d'amortissement liées à l'immobilisation courante</b>
|
||||
<p>
|
||||
@ -79,8 +88,9 @@
|
||||
<li>
|
||||
<b>Écritures d'amortissements à enregistrer</b>
|
||||
<p>
|
||||
Ce sont les amortissements qui n'ont pas encore
|
||||
été enregistrés ; seules les amortissements d'un
|
||||
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
|
||||
@ -97,24 +107,23 @@
|
||||
courante.
|
||||
</p>
|
||||
<p>
|
||||
Si on a rattaché par erreur une écritures
|
||||
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>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<h3>Enregistrer un amortissement</h3>
|
||||
<h3 class="aide">Créer une écriture d'amortissement</h3>
|
||||
|
||||
<div class="help block">
|
||||
<p>
|
||||
<div class="aide">
|
||||
<p class=aide">
|
||||
Il faut renseigner les différents paramètres de l'amortissement :
|
||||
<ul>
|
||||
<ul class="aide">
|
||||
<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</li>
|
||||
<li>Désignation : déterminée à partir du libellé de l'immobilisation< ; elle peut être modifiée/li>
|
||||
<li>Montant : sa valeur est calculée par le module ; elle peut être modifiée</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>
|
||||
@ -123,7 +132,24 @@
|
||||
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>
|
||||
</ul>
|
||||
|
||||
Après enregistrement, on se retrouve sur la page des amortissements
|
||||
<p class="aide">
|
||||
Après enregistrement, on se retrouve sur la page des amortissements
|
||||
</p>
|
||||
</p>
|
||||
</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,13 +3,20 @@
|
||||
{{:admin_header title="Liste des amortissements" custom_css="./style.css" current="module_amortissement"}}
|
||||
|
||||
{{* barre de navigation *}}
|
||||
{{:include file="_nav.html" current="index" subcurrent="amortization"}}
|
||||
{{if $_GET.amort == null || $_GET.amort == "amort"}}
|
||||
{{: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.msg|match:"attach"}}
|
||||
{{:assign msg="Attachement effectué (écriture %s)"|args:$_GET.trans_id}}
|
||||
{{:assign msg="Attachement écriture %s effectué"|args:$_GET.trans_id}}
|
||||
{{elseif $_GET.msg|match:"detach"}}
|
||||
{{:assign msg="Attachement supprimé (écriture %s)"|args:$_GET.trans_id}}
|
||||
{{:assign msg="Détachement écriture %s affectué"|args:$_GET.trans_id}}
|
||||
{{elseif $_GET.msg|match:"amortissement"}}
|
||||
{{:assign msg="Amortissement enregistré"}}
|
||||
{{/if}}
|
||||
@ -24,13 +31,6 @@
|
||||
{{/if}}
|
||||
|
||||
{{* 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}}
|
||||
{{:assign date_debut=$info_immo.date|date_short}}
|
||||
|
||||
{{#select
|
||||
line.id as immo_id,
|
||||
line.id_account as account_id,
|
||||
@ -38,21 +38,27 @@
|
||||
line.debit as montant,
|
||||
trans.id as trans_id,
|
||||
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;
|
||||
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
|
||||
}}
|
||||
<h2>Amortissement de « {{$label}} » d'un montant de {{"%f"|math:$montant|money_currency}} en date du {{$date_debut}} sur {{$duree}} ans</h2>
|
||||
}}
|
||||
{{else}}
|
||||
{{:error message="Immobilisation %s non trouvée"|args:$_GET.immo_id}}
|
||||
{{/select}}
|
||||
{{: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
|
||||
@ -66,11 +72,10 @@
|
||||
trans.date as amort_date,
|
||||
trans.label as trans_label,
|
||||
trans.id_year as amort_year,
|
||||
acc.id as account_id,
|
||||
acc.code as account_code,
|
||||
acc.label as account_name
|
||||
FROM
|
||||
acc_transactions_lines as l_immo
|
||||
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 (
|
||||
@ -80,40 +85,53 @@
|
||||
)
|
||||
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 acc on l_amort.id_account = acc.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}}
|
||||
|
||||
{{* montant de l'annuité théorique *}}
|
||||
{{:assign montant="%f"|math:$ligne_immo.montant}}
|
||||
{{:assign annuite="%f/%f"|math:$montant:$duree}}
|
||||
<h3>Amortissement de «
|
||||
<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}} » 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>
|
||||
|
||||
{{* première annuité *}}
|
||||
{{:assign date_amort=$ligne_immo.date_amort|date_short}}
|
||||
{{:include file="_calcul_dates.html" date_debut=$date_debut date_fin=$date_amort keep="nbjours"}}
|
||||
{{:assign annuite_1="%f/360*%d"|math:$annuite:$nbjours|intval}}
|
||||
{{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 annuite_courante=$annuite_1}}
|
||||
{{:assign current_year=$ligne_immo.year_id}}
|
||||
{{:assign solde=$ligne_immo.montant}}
|
||||
{{:assign nbamort=0}}
|
||||
|
||||
{{if $linked_lines != null}}
|
||||
<section class="amortissement">
|
||||
<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}}, {{$date_debut}})
|
||||
</h3>
|
||||
<h3 class="center-block ruler">Amortissements rattachés</h3>
|
||||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
@ -139,7 +157,7 @@
|
||||
<td class="num"><a href={{$trans_url}}>#{{$line.amort_trans_id}}</a></td>
|
||||
<td>{{$line.amort_date|date_short}}</td>
|
||||
<td class="money">{{"%f"|math:$line.amort_amount|money}}</td>
|
||||
<td class="money">{{"%f"|math:$solde|money}}</td>
|
||||
<td class="money">{{"%f"|math:$solde|money:false}}</td>
|
||||
<td>
|
||||
{{if $line.amort_label == null}}
|
||||
{{$line.trans_label}}
|
||||
@ -148,17 +166,13 @@
|
||||
{{/if}}
|
||||
</td>
|
||||
<td><a href={{$compte_url}}>{{$line.account_code}}</a></td>
|
||||
<td>{{$line.account_name}}</td>
|
||||
<td>{{$line.account_label}}</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"}}
|
||||
</td>
|
||||
</tr>
|
||||
{{:assign annuite_courante=$annuite}}
|
||||
{{: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}}
|
||||
{{:include file="_next_year.html" date=$date_amort keep="date_amort"}}
|
||||
{{:assign nbamort="%d+1"|math:$nbamort}}
|
||||
{{/foreach}}
|
||||
</tbody>
|
||||
@ -166,13 +180,13 @@
|
||||
</section>
|
||||
{{/if}}
|
||||
|
||||
{{if $solde > 0}}
|
||||
{{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="ruler">Amortissements à enregistrer</h3>
|
||||
<h3 class="center-block ruler">Amortissements à enregistrer</h3>
|
||||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
@ -188,7 +202,7 @@
|
||||
{{#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}}
|
||||
{{#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}}
|
||||
@ -196,9 +210,9 @@
|
||||
{{/select}}
|
||||
<tr>
|
||||
<td class="num">{{"%d+1"|math:$num}}</td>
|
||||
<td>{{$date_amort}}</td>
|
||||
<td>{{$date_amort|date_short}}</td>
|
||||
<td class="money">{{"%f"|math:$annuite_courante|money}}</td>
|
||||
<td class="money">{{if $solde == 0}}0,00{{else}}{{"%f"|math:$solde|money}}{{/if}}</td>
|
||||
<td class="money">{{$solde|money:false}}</td>
|
||||
<td>
|
||||
{{if $libelle == null}}
|
||||
{{:assign libelle="Amortissement "|cat:$ligne_immo.label}}
|
||||
@ -216,11 +230,7 @@
|
||||
{{/if}}
|
||||
</td>
|
||||
</tr>
|
||||
{{: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}}
|
||||
{{: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}}
|
||||
@ -229,78 +239,80 @@
|
||||
</section>
|
||||
{{/if}}
|
||||
|
||||
{{* Autres amortissements non rattachés *}}
|
||||
{{#select
|
||||
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
|
||||
}}
|
||||
{{if $_GET.amort == null || $_GET.amort != "fini"}}
|
||||
|
||||
{{* Autres amortissements non rattachés *}}
|
||||
{{#select
|
||||
id_transaction,
|
||||
id_related
|
||||
from acc_transactions_links
|
||||
where id_transaction = :id_amort or id_related = :id_amort;
|
||||
:id_amort=$t_id
|
||||
line.id as l_id,
|
||||
line.id_transaction as t_id,
|
||||
line.credit as amort_amount,
|
||||
line.label as l_label,
|
||||
trans.date as t_date,
|
||||
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
|
||||
}}
|
||||
{{else}}
|
||||
{{:assign var="autres_amortissements." value=$autre_amort}}
|
||||
{{#select
|
||||
id_transaction,
|
||||
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}}
|
||||
|
||||
{{if $autres_amortissements != null}}
|
||||
<section class="amortissement">
|
||||
<h3 class="ruler">Autres amortissements non rattachés</h3>
|
||||
<table class="list">
|
||||
<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}}
|
||||
{{if $autres_amortissements != null}}
|
||||
<section class="amortissement">
|
||||
<h3 class="center-block ruler">Autres amortissements non rattachés</h3>
|
||||
<table class="list">
|
||||
<thead>
|
||||
<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.montant|money}}</td>
|
||||
<td>{{if $line.l_label == null}}
|
||||
{{$line.t_label}}
|
||||
{{else}}
|
||||
{{$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>
|
||||
<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>
|
||||
{{/foreach}}
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#foreach from=$autres_amortissements item="line"}}
|
||||
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.t_id}}
|
||||
{{: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}}
|
||||
|
||||
{{:form_errors}}
|
||||
{{:admin_footer}}
|
||||
|
8
defaut.json
Normal file
8
defaut.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"tva": false,
|
||||
"prefixes": {
|
||||
"20": "Immobilisations incorporelles",
|
||||
"21": "Immobilisations corporelles",
|
||||
"27": "Immobilisations financières"
|
||||
}
|
||||
}
|
153
immobilisations.html
Normal file
153
immobilisations.html
Normal file
@ -0,0 +1,153 @@
|
||||
{{* -*- 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>
|
71
immobilisations_non.html
Normal file
71
immobilisations_non.html
Normal file
@ -0,0 +1,71 @@
|
||||
{{* -*- 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>
|
135
index.html
135
index.html
@ -1,22 +1,28 @@
|
||||
{{* -*- brindille -*- *}}
|
||||
{{:admin_header title="Gestion des amortissements" custom_css=$custom_css current="module_amortissement"}}
|
||||
{{:admin_header title="Gestion des amortissements" custom_css="./style.css" current="module_amortissement"}}
|
||||
|
||||
{{* barre de navigation *}}
|
||||
{{:include file="_nav.html" current="index"}}
|
||||
{{if $_GET.amort == null}}
|
||||
{{:assign amort="amort"}}
|
||||
{{else}}
|
||||
{{:assign amort=$_GET.amort}}
|
||||
{{/if}}
|
||||
|
||||
{{:include file="_nav.html" current="index" subcurrent="%s"|args:$amort}}
|
||||
|
||||
{{if $_GET.ok}}
|
||||
{{if $_GET.msg|match:"immobilisation"}}
|
||||
{{:assign msg="Immobilisation enregistrée"}}
|
||||
{{elseif $_GET.msg|match:"durée"}}
|
||||
{{:assign msg="Durée enregistrée"}}
|
||||
{{elseif $_GET.msg|match:"infos"}}
|
||||
{{:assign msg="Informations enregistrées"}}
|
||||
{{/if}}
|
||||
<p class="block confirm">{{$msg}}</p>
|
||||
{{elseif $_GET.err}}
|
||||
<p class="block error">Échec enregistrement immobilisation</p>
|
||||
{{/if}}
|
||||
|
||||
{{* supprimer les documents sans écriture associée *}}
|
||||
{{#load type="immo"}}
|
||||
{{* supprimer les documents sans écriture associée *}}
|
||||
{{#select
|
||||
line.id as line_id
|
||||
FROM acc_transactions_lines as line
|
||||
@ -27,109 +33,24 @@
|
||||
{{else}}
|
||||
{{:delete key=$key}}
|
||||
{{/select}}
|
||||
|
||||
{{* supprimer les documents correspondant à une écriture de la balance d'ouverture *}}
|
||||
{{#select
|
||||
line.id as line_id,
|
||||
trans.status
|
||||
FROM acc_transactions_lines as line
|
||||
INNER JOIN acc_transactions AS trans on line.id_transaction = trans.id
|
||||
WHERE line.id = :line_id AND (trans.status & 16);
|
||||
:line_id = $line
|
||||
}}
|
||||
{{:delete key=$key}}
|
||||
{{/select}}
|
||||
{{/load}}
|
||||
|
||||
<section class="immobilisation">
|
||||
<h2 class="ruler">Liste des immobilisations</h2>
|
||||
|
||||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>N°</th>
|
||||
<th>Date</th>
|
||||
<th>Libellé</th>
|
||||
<th>Montant</th>
|
||||
<th>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 quote="'"}}
|
||||
{{:assign condition="("}}
|
||||
{{#foreach from=$prefix_array item="code"}}
|
||||
{{:assign condition=$condition|cat:" account.code LIKE "|cat:$quote|cat:$code|cat:"%"|cat:$quote|cat:" OR "}}
|
||||
{{/foreach}}
|
||||
{{:assign condition=$condition|cat:"0)"}}
|
||||
|
||||
{{#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}}
|
||||
{{#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 infos"
|
||||
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>
|
||||
{{if $amort == "no_amort"}}
|
||||
{{:include file="./immobilisations_non.html"}}
|
||||
{{else}}
|
||||
{{:include file="./immobilisations.html"}}
|
||||
{{/if}}
|
||||
|
||||
{{:admin_footer}}
|
||||
|
113
modif_infos.html
Normal file
113
modif_infos.html
Normal file
@ -0,0 +1,113 @@
|
||||
{{* -*- 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"
|
||||
description="Gestion des amortissements pour le logiciel de comptabilité Paheko"
|
||||
description="Gestion des amortissements pour le logiciel de comptabilité Paheko (v0.16)"
|
||||
author="Jean-Christophe Engel"
|
||||
author_url="https://git.roflcopter.fr/lesanges"
|
||||
home_button=false
|
||||
|
@ -43,11 +43,13 @@
|
||||
{{:assign config_defaut=$config_json|json_decode}}
|
||||
{{:assign var="prefix_array" value=$config_defaut.prefixes|keys}}
|
||||
{{#foreach from=$prefix_array item="code"}}
|
||||
{{:assign code_s=$code|strval}}
|
||||
{{:assign ch1=$code_s|substr:0:1}}
|
||||
{{:assign reste=$code_s|substr:1}}
|
||||
{{:assign code=$ch1|cat:"8"|cat:$reste}}
|
||||
{{:assign var="amort_array." value=$code|intval}}
|
||||
{{* 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
|
||||
@ -113,10 +115,12 @@
|
||||
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}}
|
||||
{{:assign c1=$amort_account.code|substr:0:1}}
|
||||
{{:assign reste=$amort_account.code|substr:1}}
|
||||
{{:assign amort_code=$c1|cat:8|cat:$reste}}
|
||||
{{:assign var="credit_account.%s"|args:$amort_code value="%s — Amortissements "|args:$amort_code|cat:$amort_account.label}}
|
||||
{{: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
|
||||
id,
|
||||
@ -143,7 +147,7 @@
|
||||
name="debit_account"
|
||||
label="Compte de débit"
|
||||
required=true
|
||||
target="!acc/charts/accounts/selector.php?&key=code&year=%d"|args:$year.id
|
||||
target="!acc/charts/accounts/selector.php?codes=%s&year=%d"|args:"68*":$year.id
|
||||
default=$debit_account
|
||||
}}
|
||||
{{:input
|
||||
@ -151,7 +155,7 @@
|
||||
name="credit_account"
|
||||
label="Compte d'amortissement (280xx ou 281xx)"
|
||||
required=true
|
||||
target="!acc/charts/accounts/selector.php?key=code&year=%d"|args:$year.id
|
||||
target="!acc/charts/accounts/selector.php?codes=%s&year=%d"|args:"28*":$year.id
|
||||
default=$credit_account
|
||||
}}
|
||||
</dl>
|
||||
|
@ -18,6 +18,9 @@
|
||||
"description" : "date de mise en service de l'immobilisation",
|
||||
"type" : ["string", "null"],
|
||||
"format" : "date"
|
||||
},
|
||||
"noamort" : {
|
||||
"type" : ["null", "boolean"]
|
||||
}
|
||||
},
|
||||
"required": ["type", "line", "duration", "date"]
|
||||
|
Loading…
Reference in New Issue
Block a user