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