Généralisation comptes immobilisation
This commit is contained in:
parent
92622fb9a0
commit
33ad15dbfc
@ -2,7 +2,7 @@
|
||||
|
||||
{{*
|
||||
vérifier :
|
||||
- que le compte débute par le préfixe corect
|
||||
- que le compte débute par le préfixe correct
|
||||
- est présent dans le PC indiqué
|
||||
paramètres :
|
||||
- account : tableau avec un identifiant de compte
|
||||
@ -12,13 +12,14 @@
|
||||
- account_ok
|
||||
*}}
|
||||
|
||||
{{:assign account_code=$account|keys|key:0}}
|
||||
{{:assign quote="'"}}
|
||||
{{:assign condition=" AND ("}}
|
||||
{{#foreach from=$prefix_array item="code"}}
|
||||
{{: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)"}}
|
||||
|
||||
{{:assign account_code=$account|keys|key:0}}
|
||||
{{#sql
|
||||
select="code"
|
||||
tables="acc_accounts"
|
||||
|
@ -43,11 +43,14 @@
|
||||
{{:assign credit_account=$account_code}}
|
||||
|
||||
{{* vérifier :
|
||||
- que le compte d'immo débute par 20 ou 21
|
||||
- que le compte d'immo débute par un préfixe correct (20, 21, ...)
|
||||
- est présent dans le PC de l'exercice correspondant à la date
|
||||
*}}
|
||||
{{:assign var="prefix_array." value="'20%'"}}
|
||||
{{:assign var="prefix_array." value="'21%'"}}
|
||||
|
||||
{{:read file="./defaut.json" assign="config_json"}}
|
||||
{{:assign config_defaut=$config_json|json_decode}}
|
||||
{{:assign var="prefix_array" value=$config_defaut.prefixes|keys}}
|
||||
|
||||
{{:include
|
||||
file="_check_account.html"
|
||||
account=$debit_account
|
||||
@ -94,7 +97,6 @@
|
||||
date=$date_debut
|
||||
}}
|
||||
{{:redirect force="index.html?ok=1&msg=immobilisation"}}
|
||||
|
||||
{{/form}}
|
||||
|
||||
{{:form_errors}}
|
||||
@ -127,7 +129,7 @@
|
||||
{{:input
|
||||
type="list"
|
||||
name="debit_account"
|
||||
label="Compte d'immobilisation (20xx ou 21xx)"
|
||||
label="Compte d'immobilisation (20xx, 21xx, ...)"
|
||||
required=true
|
||||
target="!acc/charts/accounts/selector.php?key=code"
|
||||
default=$immo_account
|
||||
|
21
index.html
21
index.html
@ -29,7 +29,6 @@
|
||||
{{/select}}
|
||||
{{/load}}
|
||||
|
||||
{{* lister les immobilisations *}}
|
||||
<section class="immobilisation">
|
||||
<h2 class="ruler">Liste des immobilisations</h2>
|
||||
|
||||
@ -48,9 +47,17 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{*
|
||||
TODO améliorer cette requête : voir si assez général
|
||||
*}}
|
||||
|
||||
{{* 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)"}}
|
||||
|
||||
{{#select
|
||||
trans.id as trans_id,
|
||||
@ -68,9 +75,9 @@
|
||||
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
|
||||
(account.code LIKE '21%' OR account.code LIKE '22%' OR account.code LIKE '27%')
|
||||
ORDER BY trans.date DESC
|
||||
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}}
|
||||
|
@ -36,16 +36,25 @@
|
||||
{{:assign credit_account=$account_code}}
|
||||
|
||||
{{* vérifier :
|
||||
- que le compte d'amortissement débute par 280 ou 281
|
||||
- que le compte d'amortissement débute par un préfixe correct (280, 281, ...)
|
||||
- est présent dans le PC de l'exercice correspondant à la date
|
||||
*}}
|
||||
{{:assign var="prefix_array." value="'280%'"}}
|
||||
{{:assign var="prefix_array." value="'281%'"}}
|
||||
{{:read file="./defaut.json" assign="config_json"}}
|
||||
{{:assign config_defaut=$config_json|json_decode}}
|
||||
{{:assign var="prefix_array" value=$config_defaut.prefixes|keys}}
|
||||
{{#foreach from=$prefix_array item="code"}}
|
||||
{{:assign code_s=$code|strval}}
|
||||
{{:assign ch1=$code_s|substr:0:1}}
|
||||
{{:assign reste=$code_s|substr:1}}
|
||||
{{:assign code=$ch1|cat:"8"|cat:$reste}}
|
||||
{{:assign var="amort_array." value=$code|intval}}
|
||||
{{/foreach}}
|
||||
|
||||
{{:include
|
||||
file="_check_account.html"
|
||||
account=$credit_account
|
||||
chart_id=$selected_chart
|
||||
prefix_array=$prefix_array
|
||||
prefix_array=$amort_array
|
||||
keep="account_ok"
|
||||
}}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user