Compare commits
4 commits
62f80222ad
...
ceafe9157d
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ceafe9157d | ||
![]() |
021c39759c | ||
![]() |
2c42cad54a | ||
![]() |
e87232e7d4 |
9 changed files with 13 additions and 241 deletions
|
@ -1,19 +0,0 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{*
|
||||
vérifier que la date est située dans un exercice ouvert
|
||||
paramètres :
|
||||
- date
|
||||
résultat : open_years, selected_year, selected_chart
|
||||
*}}
|
||||
|
||||
{{:assign open_years=""}}
|
||||
{{#years closed=false order="start_date" assign="open_years."}}
|
||||
{{if
|
||||
$start_date|strtotime <= $date|parse_date|strtotime &&
|
||||
$end_date|strtotime >= $date|parse_date|strtotime
|
||||
}}
|
||||
{{:assign selected_year=$id}}
|
||||
{{:assign selected_chart=$id_chart}}
|
||||
{{/if}}
|
||||
{{/years}}
|
|
@ -120,6 +120,11 @@
|
|||
target="_dialog"
|
||||
}}
|
||||
{{/if}}
|
||||
{{:linkbutton
|
||||
label="Amortissements"
|
||||
href="amortization.html?immo_id=%s&type_immo=autres"|args:$immo_id
|
||||
shape="table"
|
||||
}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/select}}
|
|
@ -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}}
|
|
@ -137,9 +137,9 @@
|
|||
{{/if}}
|
||||
</dl>
|
||||
|
||||
<h3 class="center-block ruler">Amortissements enregistrés</h3>
|
||||
{{if $linked_lines != null}}
|
||||
<section class="amortissement">
|
||||
<h3 class="center-block ruler">Amortissements enregistrés</h3>
|
||||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -181,6 +181,8 @@
|
|||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
{{else}}
|
||||
<p class="block alert">Aucun amortissement enregistré pour cette immobilisation</p>
|
||||
{{/if}}
|
||||
|
||||
{{if $_GET.type_immo == null || $_GET.type_immo != "fini"}}
|
||||
|
@ -219,7 +221,7 @@
|
|||
|
||||
{{if $autres_amortissements != null}}
|
||||
<section class="amortissement">
|
||||
<h3 class="center-block ruler">Autres amortissements non rattachés</h3>
|
||||
<h3 class="center-block ruler">Amortissements non rattachés</h3>
|
||||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
|
|
|
@ -1,72 +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="$$.status = 'ignored'"}}
|
||||
{{: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}}
|
||||
{{:debug condition=$condition}}
|
||||
{{#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>
|
21
index.html
21
index.html
|
@ -1,5 +1,5 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
{{:admin_header title="Immobilisations et amortissements" custom_css="./style.css" current="module_amortissement"}}
|
||||
{{:admin_header title="Immobilisations et amortissements" custom_css="./style.css" current="module_amortization"}}
|
||||
|
||||
{{* barre de navigation *}}
|
||||
{{if $_GET.type_immo == null}}
|
||||
|
@ -32,27 +32,14 @@
|
|||
{{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}}
|
||||
|
||||
{{if $type_immo == "autres"}}
|
||||
{{:include file="./immobilisations_autres.html"}}
|
||||
{{:include file="_immobilisations_autres.html"}}
|
||||
{{elseif $type_immo == "archive"}}
|
||||
{{:include file="archives.html"}}
|
||||
{{:include file="_archives.html"}}
|
||||
{{elseif $type_immo == "encours" || $type_immo == "fini"}}
|
||||
{{:include file="./immobilisations.html"}}
|
||||
{{:include file="_immobilisations.html"}}
|
||||
{{/if}}
|
||||
|
||||
{{:admin_footer}}
|
||||
|
|
118
modif_infos.html
118
modif_infos.html
|
@ -1,118 +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 status="ignored"}}
|
||||
{{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 status="managed"}}
|
||||
{{/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
|
||||
status=$status
|
||||
}}
|
||||
|
||||
{{if $_POST.no_amort}}
|
||||
{{:assign amort="autres"}}
|
||||
{{else}}
|
||||
{{:assign amort="encours"}}
|
||||
{{/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>
|
||||
{{if $checked}}
|
||||
{{:assign helptext = "Dé-cocher pour amortir"}}
|
||||
{{else}}
|
||||
{{:assign helptext = "Cocher pour ne pas amortir"}}
|
||||
{{/if}}
|
||||
{{:input id="no_amort" type="checkbox" value=1 name="no_amort" label="Ne pas amortir" default=$checked help=$helptext onclick="toggleInputs('infos_immo','f_no_amort_1')"}}
|
||||
{{:input type="date" name="date_mes" label="Date de mise en service" default=$info_immo.date disabled=$disabled help="à renseigner uniquement si différente de la date d'acquisition"}}
|
||||
{{:input type="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}}
|
Loading…
Add table
Reference in a new issue