From f9df1210bc8807c89e0dce96129ccaac5b83e36c Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Wed, 2 Sep 2026 11:25:31 +0200 Subject: [PATCH] Masquer titre tableau si aucune immobilisation --- _unfinished.html | 378 ++++++++++++++++++++++++----------------------- 1 file changed, 193 insertions(+), 185 deletions(-) diff --git a/_unfinished.html b/_unfinished.html index 1d754a1..a977b3a 100644 --- a/_unfinished.html +++ b/_unfinished.html @@ -2,214 +2,222 @@ {{* Liste des immobilisations en cours de constitution *}} -
+

+ Cet onglet liste les immobilisations en cours de + constitution ; vous pouvez les sélectionner pour créer une + immobilisation amortissable (exemple : achat de matériaux pour + la construction d'un bâtiment destiné à être amorti) +

-

- Cet onglet liste les immobilisations en cours de - constitution ; vous pouvez les sélectionner pour créer une - immobilisation amortissable (exemple : achat de matériaux pour - la construction d'un bâtiment destiné à être amorti) -

+{{:include file="_get_config.html" keep="module.config"}} +{{:assign saved_hides=$module.config.hides}} +{{:assign var="user_hides" from="saved_hides.%s"|args:$logged_user.id}} - {{:include file="_get_config.html" keep="module.config"}} - {{:assign saved_hides=$module.config.hides}} - {{:assign var="user_hides" from="saved_hides.%s"|args:$logged_user.id}} - - {{if $_POST|count == 0}} - {{:assign unhide=$user_hides.unhide_unfinished}} +{{if $_POST|count == 0}} + {{:assign unhide=$user_hides.unhide_unfinished}} +{{else}} + {{if $_POST.unhide == null}} + {{:assign unhide=0}} {{else}} - {{if $_POST.unhide == null}} - {{:assign unhide=0}} - {{else}} - {{:assign unhide=1}} - {{/if}} - {{:assign var="user_hides.unhide_unfinished" value=$unhide"}} - {{:assign var="saved_hides.%s"|args:$logged_user.id value=$user_hides}} - {{:save key="config" hides=$saved_hides}} - {{/if}} - {{if $unhide}} - {{:assign checked="checked"}} + {{:assign unhide=1}} {{/if}} + {{:assign var="user_hides.unhide_unfinished" value=$unhide"}} + {{:assign var="saved_hides.%s"|args:$logged_user.id value=$user_hides}} + {{:save key="config" hides=$saved_hides}} +{{/if}} +{{if $unhide}} + {{:assign checked="checked"}} +{{/if}} -
-
- Transférer une ou plusieurs lignes vers une immobilisation amortissable -

- Cocher les lignes concernées + +

+ Transférer une ou plusieurs lignes vers une immobilisation amortissable +

+ Cocher les lignes concernées +

+
+ Montants sélectionnés + + + + + +
+
+
+

+ {{:linkbutton + label="Transférer" + href="transfer.html?trans=" + shape="right" + id="transfer" + }}

-
- Montants sélectionnés - - - - - -
-
-
-

- {{:linkbutton - label="Transférer" - href="transfer.html?trans=" - shape="right" - id="transfer" - }} -

-
-
-
- {{:input type="checkbox" value=1 name="unhide" checked="%s"|args:$checked label="Afficher toutes les écritures" }} -
- + +
+
+ {{:input type="checkbox" value=1 name="unhide" checked="%s"|args:$checked label="Afficher toutes les écritures" }} +
+ - - - - - - - - - - - - - - +{{* lister les immobilisations en cours de constitution *}} +{{:assign first_code=null}} +{{:assign accounts_condition="("}} +{{#foreach from=$module.config.unfinished item="elem"}} + {{if $elem.code != null}} + {{:assign code=$elem.code}} + {{else}} + {{:assign code=$elem}} + {{/if}} + {{if $first_code == null}} + {{:assign first_code=$code}} + {{/if}} + {{:assign code=$code|cat:"%"|quote_sql}} + {{:assign accounts_condition=$accounts_condition|cat:" account.code LIKE "|cat:$code|cat:" OR "}} +{{/foreach}} +{{:assign accounts_condition=$accounts_condition|cat:"0)"}} +{{:assign condition=$accounts_condition|cat:" AND debit > 0 AND NOT (trans.status & 16)"}} - {{* lister les immobilisations en cours de constitution *}} +{{:assign filter_condition=" NOT ("}} +{{#foreach from=$module.config.filters item="filter"}} + {{:assign filter="%"|cat:$filter|cat:"%"|quote_sql}} + {{:assign filter_condition=$filter_condition|cat:" trans_label LIKE "|cat:$filter|cat:" OR "}} +{{/foreach}} +{{:assign filter_condition=$filter_condition|cat:"0)"}} +{{:assign condition=$condition|cat:" AND "|cat:$filter_condition}} - {{:assign accounts_condition="("}} - {{#foreach from=$module.config.unfinished item="elem"}} - {{if $elem.code != null}} - {{:assign code=$elem.code}} - {{else}} - {{:assign code=$elem}} - {{/if}} - {{:assign code=$code|cat:"%"|quote_sql}} - {{:assign accounts_condition=$accounts_condition|cat:" account.code LIKE "|cat:$code|cat:" OR "}} - {{/foreach}} - {{:assign accounts_condition=$accounts_condition|cat:"0)"}} - {{:assign condition=$accounts_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_line_id, + account.id as account_id, + account.code as account_code, + account.label as account_label, + sum(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 + GROUP BY trans.id + ORDER BY trans.date DESC; + !condition=$condition + assign="immo_line" +}} + {{* voir si l'écriture a été marquée ignorée *}} + {{:assign ignore=false}} + {{#load type="immo" assign="info_immo" where="$$.line = :line_id AND $$.status = 'ignored'" :line_id=$immo_line_id|intval}} + {{:assign ignore=true}} + {{/load}} + {{if $ignore && $unhide == null}} + {{:continue}} + {{/if}} - {{:assign filter_condition=" NOT ("}} - {{#foreach from=$module.config.filters item="filter"}} - {{:assign filter="%"|cat:$filter|cat:"%"|quote_sql}} - {{:assign filter_condition=$filter_condition|cat:" trans_label LIKE "|cat:$filter|cat:" OR "}} - {{/foreach}} - {{:assign filter_condition=$filter_condition|cat:"0)"}} - {{:assign condition=$condition|cat:" AND "|cat:$filter_condition}} - {{:assign nb_immo=0}} - {{:assign total_immo = 0}} - {{#select - trans.id as trans_id, - trans.label as trans_label, - trans.date as trans_date, - line.id as immo_line_id, - account.id as account_id, - account.code as account_code, - account.label as account_label, - sum(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 - GROUP BY trans.id - ORDER BY trans.date DESC; - !condition=$condition - }} - {{* voir si l'écriture a été marquée ignorée *}} - {{:assign ignore=false}} - {{#load type="immo" assign="info_immo" where="$$.line = :line_id AND $$.status = 'ignored'" :line_id=$immo_line_id|intval}} - {{:assign ignore=true}} - {{/load}} - {{if $ignore && $unhide == null}} - {{:continue}} - {{/if}} + {{* + TODO cas où : + - il y a (au moins) une écriture d'avoir + *}} - {{* - TODO cas où : - - il y a (au moins) une écriture d'avoir - *}} + {{* voir s'il existe une écriture qui solde l'immobilisation (voir ci-dessus) *}} + {{#select + count(*) AS count + 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 + WHERE line.credit = :amount AND code = :account_code + ; + :amount = $debit + :account_code = $account_code + }} + {{:assign count=$count}} + {{/select}} - {{* voir s'il existe une écriture qui solde l'immobilisation (voir ci-dessus) *}} - {{#select - count(*) AS count - 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 - WHERE line.credit = :amount AND code = :account_code - ; - :amount = $debit - :account_code = $account_code - }} - {{:assign count=$count}} - {{/select}} + {{* S'il y a plus d'une écriture de même montant on ne peut pas décider *}} + {{if $count == 1}} + {{:continue}} + {{/if}} - {{* S'il y a plus d'une écriture de même montant on ne peut pas décider *}} - {{if $count == 1}} - {{:continue}} - {{/if}} + {{:assign var="immo_lines." value=$immo_line}} +{{/select}} - {{: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}} - {{:assign total_immo="%d+%d"|math:$total_immo:$debit}} - {{:assign var="montant" from="sommes_immo.%s"|args:$account_code}} - {{:assign var="sommes_immo.%s"|args:$account_code value="%d+%d"|math:$montant:$debit}} +{{if $immo_lines|count > 0}} +
+
DateLibelléMontantN° compteCompte
+ + + + + + + + + + + + + - - - - - - - - - - - {{/select}} - - - {{if $total_immo != 0}} - {{#foreach from=$sommes_immo|ksort key="code" item="value"}} + {{:assign total_immo = 0}} + {{#foreach from=$immo_lines}} + {{: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 total_immo="%d+%d"|math:$total_immo:$debit}} + {{:assign var="montant" from="sommes_immo.%s"|args:$account_code}} + {{:assign var="sommes_immo.%s"|args:$account_code value="%d+%d"|math:$montant:$debit}} + + + + + + + + + + + + {{/foreach}} + + + + {{if $total_immo != 0}} + {{#foreach from=$sommes_immo|ksort key="code" item="value"}} + + + + + + + + + + + {{/foreach}} - - + + - {{/foreach}} - - - - - - - - - - - {{/if}} - -
DateLibelléMontantN° compteCompte
{{:input type="checkbox" name="selected[]" value=$trans_id}}#{{$trans_id}}{{$trans_date|date_short}}{{$trans_label}}{{"%f"|math:$debit|money_html:false|raw}}{{$account_label}} - {{:linkbutton - label="Modifier" - href="ignore.html?immo_line_id=%s"|args:$immo_line_id - shape="edit" - target="_dialog" - }} -
{{:input type="checkbox" name="selected[]" value=$trans_id}}#{{$trans_id}}{{$trans_date|date_short}}{{$trans_label}}{{"%f"|math:$debit|money_html:false|raw}}{{$account_label}} + {{:linkbutton + label="Modifier" + href="ignore.html?immo_line_id=%s"|args:$immo_line_id + shape="edit" + target="_dialog" + }} +
Total du compte {{$code}}{{$value|money_html|raw}}
Total du compte {{$code}}{{$value|money_html|raw}}Total des immobilisations{{$total_immo|money_html|raw}}
Total des immobilisations{{$total_immo|money_html|raw}}
- {{if $nb_immo == 0}} -

Aucune écriture d'immobilisation trouvée dans la comptabilité (comptes N° xxx)

- {{/if}} -
+ {{/if}} + + + +{{else}} +

Aucune écriture d'immobilisation trouvée dans la comptabilité (compte {{$first_code}} et sous-comptes)

+{{/if}}