Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
fb0d34a4f4 | |||
2c11d3e4f3 |
@ -9,12 +9,11 @@
|
||||
|
||||
{{:assign ts_debut=$date_debut|strtotime}}
|
||||
{{:assign ts_fin=$date_fin|strtotime}}
|
||||
{{:assign nbjours="1+(%d-%d)/(60*60*24)"|math:$ts_fin:$ts_debut}}
|
||||
|
||||
{{if $ts_debut <= $ts_fin}}
|
||||
{{:assign nbjours="(%d-%d)/(60*60*24)"|math:$ts_fin:$ts_debut}}
|
||||
{{else}}
|
||||
{{:assign nbjours="(%d-%d)/(60*60*24)"|math:$ts_debut:$ts_fin}}
|
||||
{{* au cas où les deux dates seraient inversées ... *}}
|
||||
{{if $nbjours < 0}}
|
||||
{{:assign nbjours="-1*%d"|math:$nbjours}}
|
||||
{{/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 code=$code|cat:"%"|quote_sql}}
|
||||
{{:assign condition=$condition|cat:" code LIKE "|cat:$code|cat:" OR "}}
|
||||
{{:assign condition=$condition|cat:" code LIKE "|cat:$quote|cat:$code|cat:"%"|cat:$quote|cat:" OR "}}
|
||||
{{/foreach}}
|
||||
{{:assign condition=$condition|cat:"0)"}}
|
||||
|
||||
|
@ -14,9 +14,10 @@
|
||||
|
||||
{{if $current == 'index'}}
|
||||
<ul class="sub">
|
||||
<li {{if $subcurrent == 'amort'}}class="current"{{/if}}><a href="index.html?amort=amort">Amortissables</a></li>
|
||||
<li {{if $subcurrent == 'encours'}}class="current"{{/if}}><a href="index.html?amort=encours">En cours</a></li>
|
||||
<li {{if $subcurrent == 'fini'}}class="current"{{/if}}><a href="index.html?amort=fini">Terminées</a></li>
|
||||
<li {{if $subcurrent == 'no_amort'}}class="current"{{/if}}><a href="index.html?amort=no_amort">Non amortissables</a></li>
|
||||
<li {{if $subcurrent == 'archive'}}class="current"{{/if}}><a href="index.html?amort=archive">Archivées</a></li>
|
||||
<li {{if $subcurrent == 'autres'}}class="current"{{/if}}><a href="index.html?amort=autres">Autres</a></li>
|
||||
</ul>
|
||||
|
||||
{{if $subsubcurrent == 'amortization'}}
|
||||
|
@ -106,9 +106,9 @@
|
||||
noamort=$noamort
|
||||
}}
|
||||
{{if $_POST.no_amort}}
|
||||
{{:assign amort=0}}
|
||||
{{:assign amort="autres"}}
|
||||
{{else}}
|
||||
{{:assign amort=1}}
|
||||
{{:assign amort="encours"}}
|
||||
{{/if}}
|
||||
{{:redirect force="index.html?ok=1&msg=immobilisation&amort=%s"|args:$amort}}
|
||||
{{/form}}
|
||||
|
@ -55,9 +55,9 @@
|
||||
}}
|
||||
|
||||
{{if $_POST.no_amort}}
|
||||
{{:assign amort=0}}
|
||||
{{:assign amort="autres"}}
|
||||
{{else}}
|
||||
{{:assign amort=1}}
|
||||
{{:assign amort="encours"}}
|
||||
{{/if}}
|
||||
{{:redirect force="index.html?ok=1&msg=infos&amort=%s"|args:$amort}}
|
||||
{{else}}
|
||||
|
@ -3,20 +3,22 @@
|
||||
{{:admin_header title="Liste des amortissements" custom_css="./style.css" current="module_amortissement"}}
|
||||
|
||||
{{* barre de navigation *}}
|
||||
{{if $_GET.amort == null || $_GET.amort == "amort"}}
|
||||
{{:assign subcurrent="amort"}}
|
||||
{{if $_GET.amort == null || $_GET.amort == "encours"}}
|
||||
{{:assign subcurrent="encours"}}
|
||||
{{elseif $_GET.amort == "fini"}}
|
||||
{{:assign subcurrent="fini"}}
|
||||
{{elseif $_GET.amort == "archive"}}
|
||||
{{:assign subcurrent="archive"}}
|
||||
{{else}}
|
||||
{{:assign subcurrent="no_amort"}}
|
||||
{{:assign subcurrent="autres"}}
|
||||
{{/if}}
|
||||
{{:include file="_nav.html" current="index" subcurrent="%s"|args:$subcurrent subsubcurrent="amortization"}}
|
||||
|
||||
{{if $_GET.ok}}
|
||||
{{if $_GET.msg|match:"attach"}}
|
||||
{{:assign msg="Attachement écriture %s effectué"|args:$_GET.trans_id}}
|
||||
{{:assign msg="Attachement effectué (écriture %s)"|args:$_GET.trans_id}}
|
||||
{{elseif $_GET.msg|match:"detach"}}
|
||||
{{:assign msg="Détachement écriture %s affectué"|args:$_GET.trans_id}}
|
||||
{{:assign msg="Attachement détaché (écriture %s)"|args:$_GET.trans_id}}
|
||||
{{elseif $_GET.msg|match:"amortissement"}}
|
||||
{{:assign msg="Amortissement enregistré"}}
|
||||
{{/if}}
|
||||
@ -38,7 +40,6 @@
|
||||
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
|
||||
@ -53,7 +54,6 @@
|
||||
{{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}}
|
||||
|
@ -3,9 +3,9 @@
|
||||
{{* Liste des immobilisations amortissable ou à définir *}}
|
||||
|
||||
<section class="immobilisation">
|
||||
{{if $amort == "amort"}}
|
||||
{{if $amort == "encours"}}
|
||||
<h2 class="ruler">Immobilisations en cours</h2>
|
||||
{{else}}
|
||||
{{elseif $amort == "fini"}}
|
||||
<h2 class="ruler">Immobilisations amorties</h2>
|
||||
{{/if}}
|
||||
|
||||
@ -19,7 +19,6 @@
|
||||
<th class="nombre">Durée</th>
|
||||
<th>N° compte</th>
|
||||
<th>Compte</th>
|
||||
<th>Projet</th>
|
||||
<th class="actions"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -29,10 +28,10 @@
|
||||
{{: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 code=$code|cat:"%"|quote_sql}}
|
||||
{{:assign condition=$condition|cat:" account.code LIKE "|cat:$code|cat:" OR "}}
|
||||
{{:assign condition=$condition|cat:" account.code LIKE "|cat:$quote|cat:$code|cat:"%"|cat:$quote|cat:" OR "}}
|
||||
{{/foreach}}
|
||||
{{:assign condition=$condition|cat:"0)"}}
|
||||
{{:assign condition=$condition|cat:" AND debit > 0 AND NOT (trans.status & 16)"}}
|
||||
@ -46,13 +45,11 @@
|
||||
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
|
||||
@ -98,7 +95,7 @@
|
||||
AND
|
||||
account.code LIKE '28%';
|
||||
:line_id = $immo_id|intval
|
||||
}}
|
||||
}}
|
||||
{{if $amort_amount == null}}
|
||||
{{:assign exist_amort=false}}
|
||||
{{:assign amort_amount=0}}
|
||||
@ -108,8 +105,9 @@
|
||||
{{/if}}
|
||||
{{/select}}
|
||||
{{* immo amortie ? *}}
|
||||
{{if $amort == "amort" && $amort_amount >= $debit ||
|
||||
$amort == "fini" && $amort_amount < $debit
|
||||
{{if $amort == "encours" && $amort_amount >= $debit ||
|
||||
$amort == "fini" && $amort_amount < $debit ||
|
||||
$amortissable == "nsp" && ! $exist_amort
|
||||
}}
|
||||
{{:continue}}
|
||||
{{/if}}
|
||||
@ -121,30 +119,40 @@
|
||||
<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}}
|
||||
{{if ! $exist_amort}}
|
||||
{{: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"
|
||||
shape="settings"
|
||||
target="_dialog"
|
||||
}}
|
||||
{{/if}}
|
||||
}}
|
||||
{{elseif $amortissable == "nsp"}}
|
||||
{{:linkbutton
|
||||
label="Amortissements"
|
||||
href="amortization.html?immo_id=%s&amort=%s"|args:$immo_id:$amort
|
||||
shape="table"
|
||||
label="Ajouter infos"
|
||||
href="add_infos.html?immo_id=%s&amort=1"|args:$immo_id
|
||||
shape="settings"
|
||||
target="_dialog"
|
||||
}}
|
||||
{{/if}}
|
||||
{{if $amort == "encours"}}
|
||||
{{:linkbutton
|
||||
label="Cession"
|
||||
href=""
|
||||
shape="money"
|
||||
}}
|
||||
{{elseif $amort == "fini"}}
|
||||
{{:linkbutton
|
||||
label="Rebut"
|
||||
href=""
|
||||
shape="export"
|
||||
}}
|
||||
{{/if}}
|
||||
{{:linkbutton
|
||||
label="Amortissements"
|
||||
href="amortization.html?immo_id=%s&amort=%s"|args:$immo_id:$amort
|
||||
shape="table"
|
||||
}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/select}}
|
||||
|
133
immobilisations_autres.html
Normal file
133
immobilisations_autres.html
Normal file
@ -0,0 +1,133 @@
|
||||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{* Liste des immobilisations non amortissables ou non (encore) gérées *}}
|
||||
|
||||
<section class="immobilisation">
|
||||
<h2 class="ruler">Autres immobilisations</h2>
|
||||
|
||||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>N°</th>
|
||||
<th>Date</th>
|
||||
<th>Libellé</th>
|
||||
<th class="nombre">Montant</th>
|
||||
<th>N° compte</th>
|
||||
<th>Compte</th>
|
||||
<th class="actions"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
{{* lister les immobilisations *}}
|
||||
{{:read file="./defaut.json" assign="config_json"}}
|
||||
{{:assign config_defaut=$config_json|json_decode}}
|
||||
{{:assign var="prefix_array" value=$config_defaut.prefixes|keys}}
|
||||
{{:assign 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)"}}
|
||||
{{:assign condition=$condition|cat:" AND debit > 0 AND NOT (trans.status & 16)"}}
|
||||
|
||||
{{#select
|
||||
trans.id as trans_id,
|
||||
trans.label as trans_label,
|
||||
trans.date as trans_date,
|
||||
line.id as immo_id,
|
||||
account.id as account_id,
|
||||
account.code as account_code,
|
||||
account.label as account_label,
|
||||
line.debit AS debit,
|
||||
trans.id_year as trans_id_year
|
||||
FROM acc_transactions AS trans
|
||||
INNER JOIN acc_transactions_lines AS line ON line.id_transaction = trans.id
|
||||
INNER JOIN acc_accounts AS account ON line.id_account = account.id
|
||||
INNER JOIN acc_years AS years ON trans.id_year = years.id
|
||||
WHERE !condition
|
||||
ORDER BY trans.date DESC;
|
||||
!condition=$condition
|
||||
}}
|
||||
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$trans_id}}
|
||||
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$account_id:$trans_id_year}}
|
||||
{{* voir si l'immo est prise en charge *}}
|
||||
{{#load type="immo" where="$$.line = :line_id" :line_id=$immo_id|intval}}
|
||||
{{if $noamort}}
|
||||
{{:assign amortissable="non"}}
|
||||
{{else}}
|
||||
{{:assign amortissable="oui"}}
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{:assign amortissable="nsp"}}
|
||||
{{/load}}
|
||||
|
||||
{{if $amortissable == "oui"}}
|
||||
{{: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 ignore=true}}
|
||||
{{else}}
|
||||
{{:assign ignore=false}}
|
||||
{{/if}}
|
||||
{{/select}}
|
||||
|
||||
{{if $ignore}}
|
||||
{{:continue}}
|
||||
{{/if}}
|
||||
|
||||
<tr>
|
||||
<td class="num"><a href={{$trans_url}}>#{{$trans_id}}</a></td>
|
||||
<td>{{$trans_date|date_short}}</td>
|
||||
<td>{{$trans_label}}</td>
|
||||
<td class="money">{{"%f"|math:$debit|money:false}}</td>
|
||||
<td><a href={{$compte_url}}>{{$account_code}}</a></td>
|
||||
<td>{{$account_label}}</td>
|
||||
<td class="actions">
|
||||
{{if $amortissable == "nsp"}}
|
||||
{{:linkbutton
|
||||
label="Ajouter infos"
|
||||
href="add_infos.html?immo_id=%s&amort=1"|args:$immo_id
|
||||
shape="settings"
|
||||
target="_dialog"
|
||||
}}
|
||||
{{else}}
|
||||
{{:linkbutton
|
||||
label="Modifier infos"
|
||||
href="modif_infos.html?immo_id=%s&amort=0"|args:$immo_id
|
||||
shape="help"
|
||||
target="_dialog"
|
||||
}}
|
||||
{{/if}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/select}}
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
@ -3,7 +3,7 @@
|
||||
|
||||
{{* barre de navigation *}}
|
||||
{{if $_GET.amort == null}}
|
||||
{{:assign amort="amort"}}
|
||||
{{:assign amort="encours"}}
|
||||
{{else}}
|
||||
{{:assign amort=$_GET.amort}}
|
||||
{{/if}}
|
||||
@ -47,9 +47,9 @@
|
||||
{{/select}}
|
||||
{{/load}}
|
||||
|
||||
{{if $amort == "no_amort"}}
|
||||
{{:include file="./immobilisations_non.html"}}
|
||||
{{else}}
|
||||
{{if $amort == "autres"}}
|
||||
{{:include file="./immobilisations_autres.html"}}
|
||||
{{elseif $amort == "encours" || $amort == "fini"}}
|
||||
{{:include file="./immobilisations.html"}}
|
||||
{{/if}}
|
||||
|
||||
|
@ -58,9 +58,9 @@
|
||||
}}
|
||||
|
||||
{{if $_POST.no_amort}}
|
||||
{{:assign amort=0}}
|
||||
{{:assign amort="autres"}}
|
||||
{{else}}
|
||||
{{:assign amort=1}}
|
||||
{{:assign amort="encours"}}
|
||||
{{/if}}
|
||||
{{:redirect force="index.html?ok=1&msg=infos&amort=%s"|args:$amort}}
|
||||
{{else}}
|
||||
|
@ -1,5 +1,5 @@
|
||||
name="Amortissements"
|
||||
description="Gestion des amortissements pour le logiciel de comptabilité Paheko (v0.16)"
|
||||
description="Gestion des amortissements pour le logiciel de comptabilité Paheko (v0.14)"
|
||||
author="Jean-Christophe Engel"
|
||||
author_url="https://git.roflcopter.fr/lesanges"
|
||||
home_button=false
|
||||
|
Loading…
Reference in New Issue
Block a user