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
107
archives.html
107
archives.html
|
@ -2,6 +2,82 @@
|
|||
|
||||
{{* Liste des immobilisations archivées *}}
|
||||
|
||||
{{* Immobilisation archivées prises en charge *}}
|
||||
{{#load type="immo" where="$$.status = 'archived'"}}
|
||||
{{: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="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>
|
||||
|
||||
|
@ -20,34 +96,7 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
{{#load type="immo" where="$$.status = 'archived'"}}
|
||||
{{: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
|
||||
}}
|
||||
{{#foreach from=$immo_archivees}}
|
||||
{{: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 nb_immo="%d+1"|math:$nb_immo}}
|
||||
|
@ -62,7 +111,7 @@
|
|||
<td class="actions">
|
||||
</td>
|
||||
</tr>
|
||||
{{/select}}
|
||||
{{/foreach}}
|
||||
</tbody>
|
||||
</table>
|
||||
{{if $nb_immo == 0}}
|
||||
|
|
Loading…
Add table
Reference in a new issue