Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
fb0d34a4f4 | |||
2c11d3e4f3 |
@ -16,6 +16,4 @@
|
||||
{{:assign nbjours="-1*%d"|math:$nbjours}}
|
||||
{{/if}}
|
||||
{{* pour simplifier : 360 jours par an *}}
|
||||
{{if $nbjours > 360}}
|
||||
{{:assign nbjours=360}}
|
||||
{{/if}}
|
||||
{{:assign nbjours="round(%f/365*360)"|math:$nbjours}}
|
||||
|
@ -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,12 +3,14 @@
|
||||
{{: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"}}
|
||||
|
||||
@ -16,7 +18,7 @@
|
||||
{{if $_GET.msg|match:"attach"}}
|
||||
{{:assign msg="Attachement effectué (écriture %s)"|args:$_GET.trans_id}}
|
||||
{{elseif $_GET.msg|match:"detach"}}
|
||||
{{:assign msg="Attachement supprimé (écriture %s)"|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}}
|
||||
@ -72,9 +74,8 @@
|
||||
trans.id_year as amort_year,
|
||||
account.id as account_id,
|
||||
account.code as account_code,
|
||||
account.label as account_name
|
||||
FROM
|
||||
acc_transactions_lines as l_immo
|
||||
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 (
|
||||
@ -165,7 +166,7 @@
|
||||
{{/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>
|
||||
@ -242,19 +243,19 @@
|
||||
|
||||
{{* 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,
|
||||
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,
|
||||
account.code as a_code,
|
||||
account.label as a_label,
|
||||
y.label as y_label
|
||||
FROM acc_transactions_lines AS li
|
||||
INNER JOIN acc_accounts AS account ON account.id = li.id_account
|
||||
INNER JOIN acc_transactions AS trans ON trans.id = li.id_transaction
|
||||
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;
|
||||
@ -288,21 +289,21 @@
|
||||
</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}}
|
||||
{{: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.montant|money}}</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>{{$line.a_code}}</td>
|
||||
<td>{{$line.a_label}}</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>
|
||||
|
@ -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>
|
||||
@ -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}}
|
||||
|
Loading…
Reference in New Issue
Block a user