Amélioration détection immobilisations archivées
This commit is contained in:
parent
255ffe10aa
commit
c096282f08
1 changed files with 78 additions and 29 deletions
|
@ -2,25 +2,7 @@
|
||||||
|
|
||||||
{{* Liste des immobilisations archivées *}}
|
{{* Liste des immobilisations archivées *}}
|
||||||
|
|
||||||
<section class="immobilisation">
|
{{* Immobilisation archivées prises en charge *}}
|
||||||
<h2 class="ruler">Immobilisations archivées</h2>
|
|
||||||
|
|
||||||
{{:assign nb_immo=0}}
|
|
||||||
<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 = 'archived'"}}
|
{{#load type="immo" where="$$.status = 'archived'"}}
|
||||||
{{:assign var="lines." value="'%s'"|args:$line}}
|
{{:assign var="lines." value="'%s'"|args:$line}}
|
||||||
{{/load}}
|
{{/load}}
|
||||||
|
@ -47,7 +29,74 @@
|
||||||
WHERE !condition
|
WHERE !condition
|
||||||
ORDER BY trans.date DESC;
|
ORDER BY trans.date DESC;
|
||||||
!condition=$condition
|
!condition=$condition
|
||||||
|
assign="immo_archivee"
|
||||||
}}
|
}}
|
||||||
|
{{:assign var="immo_archivees.%s"|args:$trans_id value=$immo_archivee}}
|
||||||
|
{{/select}}
|
||||||
|
|
||||||
|
{{* Immobilisation avec une écriture de sortie de bilan *}}
|
||||||
|
{{: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 cond2=$condition|replace:"account.":"acc2."}}
|
||||||
|
{{:assign condition=$condition|cat:" AND "|cat:$cond2}}
|
||||||
|
{{:assign condition=$condition|cat:" AND line.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
|
||||||
|
INNER JOIN acc_transactions_lines AS line2 ON line.debit = line2.credit
|
||||||
|
INNER JOIN acc_transactions AS trans2 ON trans2.id = line2.id_transaction
|
||||||
|
INNER JOIN acc_accounts AS acc2 ON acc2.id = line2.id_account
|
||||||
|
LEFT JOIN acc_projects AS project ON line.id_project = project.id
|
||||||
|
WHERE !condition
|
||||||
|
ORDER BY trans.date DESC;
|
||||||
|
!condition=$condition
|
||||||
|
assign="immo_archivee"
|
||||||
|
}}
|
||||||
|
{{if ! $trans_id|key_in:$immo_archivees}}
|
||||||
|
{{:assign var="immo_archivees.%s"|args:$trans_id value=$immo_archivee}}
|
||||||
|
{{/if}}
|
||||||
|
{{/select}}
|
||||||
|
|
||||||
|
<section class="immobilisation">
|
||||||
|
<h2 class="ruler">Immobilisations archivées</h2>
|
||||||
|
|
||||||
|
{{:assign nb_immo=0}}
|
||||||
|
<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>
|
||||||
|
{{#foreach from=$immo_archivees}}
|
||||||
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$trans_id}}
|
{{: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 compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$account_id:$trans_id_year}}
|
||||||
{{:assign nb_immo="%d+1"|math:$nb_immo}}
|
{{:assign nb_immo="%d+1"|math:$nb_immo}}
|
||||||
|
@ -62,7 +111,7 @@
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/select}}
|
{{/foreach}}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
{{if $nb_immo == 0}}
|
{{if $nb_immo == 0}}
|
||||||
|
|
Loading…
Add table
Reference in a new issue