diff --git a/_archives.html b/_archives.html index 671ceb4..e774b6d 100644 --- a/_archives.html +++ b/_archives.html @@ -1,36 +1,92 @@ {{* -*- brindille -*- *}} -{{* Liste des immobilisations sorties du bilan *}} -
- Cette page liste les immobilisations sorties du bilan -
+{{* 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 *}} -{{:include file="_get_config.html" keep="module.config"}} +{{:read file="./defaut.json" assign="config_json"}} +{{:assign config_defaut=$config_json|json_decode}} +{{:assign var="prefix_array" value=$config_defaut.prefixes|keys}} -{{* lister les immobilisations *}} -{{:assign account_condition="("}} -{{#foreach from=$module.config.prefixes item="code"}} +{{:assign condition="("}} +{{#foreach from=$prefix_array item="code"}} {{:assign code=$code|cat:"%"|quote_sql}} - {{:assign account_condition=$account_condition|cat:"account.code LIKE "|cat:$code|cat:" OR "}} + {{:assign condition=$condition|cat:"account.code LIKE "|cat:$code|cat:" OR "}} {{/foreach}} -{{:assign account_condition=$account_condition|cat:"0)"}} +{{: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)"}} -{{:assign filter_condition=" AND 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=$account_condition|cat:" AND debit > 0 AND NOT (trans.status & 16)"|cat:$filter_condition}} +{{#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}}| N° | -Mise en service | -Date sortie | +Date | Libellé | Montant | N° compte | @@ -40,185 +96,23 @@|||
|---|---|---|---|---|---|---|---|---|---|
| #{{$trans_id}} | {{$trans_date|date_short}} | -{{$exit_date|date_short}} | {{$trans_label}} | -{{"%f"|math:$montant_immo|money_html:false|raw}} | +{{"%f"|math:$debit|money:false}} | {{$account_code}} | {{$account_label}} | {{$project_label}} | |
| - | |||||||||
| - | - | - | Total du compte {{$code}} | -{{$value|money_html:false|raw}} | -- | - | - | - | |
| - | - | - | Total des immobilisations | -{{$total_immo|money_html:false|raw}} | -- | - | - | - | |
| - | |||||||||
| - | - | - | Cessions du compte {{$code}} | -{{$value|money_html:false|raw}} | -- | - | - | - | |
| - | - | - | Total des cessions | -{{$total_cessions|money_html:false|raw}} | -- | - | - | - | |
Aucune immobilisation
diff --git a/_check_account.html b/_check_account.html index ce6816e..06e1108 100644 --- a/_check_account.html +++ b/_check_account.html @@ -19,7 +19,7 @@ {{/foreach}} {{:assign condition=$condition|cat:"0)"}} -{{:assign account_code=$account|keys|value:0}} +{{:assign account_code=$account|keys|key:0}} {{#sql select="code" tables="acc_accounts" diff --git a/_get_codes.html b/_get_codes.html index 0373085..a780b40 100644 --- a/_get_codes.html +++ b/_get_codes.html @@ -2,13 +2,9 @@ {{* déterminer le numéro du compte passé en paramètre dans un tableau - la clé est parfois l'identifiant du compte, parfois son code... - d'où l'obligation d'extraire le code de la valeur qui a toujours - la forme : code — libellé *}} -{{:assign values=$account|values}} -{{:assign label=$values.0}} +{{:assign label=$account|values|key:0}} {{:assign pos=$label|strpos:" "}} {{:assign account_code=$label|substr:0:$pos}} {{:assign var="account_code.%s"|args:$account_code value=$label}} diff --git a/_get_config.html b/_get_config.html deleted file mode 100644 index b1a9231..0000000 --- a/_get_config.html +++ /dev/null @@ -1,23 +0,0 @@ -{{* -*- brindille -*- *}} - -{{* - Récupérer la config -*}} - -{{* config par défaut *}} -{{:read file="./defaut.json" assign="config_defaut"}} -{{:assign config_defaut=$config_defaut|json_decode}} - -{{if $module.config.prefixes == null}} - {{:assign var="module.config.prefixes" value=$config_defaut.prefixes}} -{{/if}} - -{{if $module.config.unfinished == null}} - {{:assign var="module.config.unfinished" value=$config_defaut.unfinished}} -{{/if}} - -{{* -{{if $module.config.tva == null}} - {{:assign var="module.config.tva" value=$config_defaut.tva}} -{{/if}} -*}} diff --git a/_immobilisations.html b/_immobilisations.html index f26b23f..2f28b30 100644 --- a/_immobilisations.html +++ b/_immobilisations.html @@ -3,59 +3,49 @@ {{* Liste des immobilisations en cours ou amorties *}}- {{if $type_immo == "managed"}} - Cette page liste les immobilisations en cours d'amortissement - {{elseif $type_immo == "amortized"}} - Cette page liste les immobilisations dont l'amortissement est terminé - {{/if}} -
+ {{if $type_immo == "encours"}} +| N° | +N° | Date | Libellé | Montant | Durée | -Amortissements | -Valeur nette | N° compte | +Compte | ||
|---|---|---|---|---|---|---|---|---|---|---|---|
| #{{$immo_trans_id}} | +#{{$trans_id}} | {{$trans_date|date_short}} | {{$trans_label}} | -{{$montant_immo|money_html:false|raw}} | +{{"%f"|math:$debit|money}} | {{if $duration != null}}{{$duration}}{{/if}} | -{{$amort_amount|money_html:false|raw}} | -{{"%d-%d"|math:$montant_immo:$amort_amount|money_html:false|raw}} | {{$account_code}} | +{{$account_label}} | - {{:linkbutton - label="Paramètres" - href="add_infos.html?immo_id=%s&type_immo=%s"|args:$immo_line_id:$type_immo - shape="settings" - target="_dialog" - }} + {{if ! $exist_amort}} + {{:linkbutton + label="Paramètres" + href="add_infos.html?immo_id=%s&amort=1&op=modif&type_immo=%s"|args:$immo_id:$type_immo + shape="settings" + target="_dialog" + }} + {{elseif $status == "unknown"}} + {{:linkbutton + label="Paramètres" + href="add_infos.html?immo_id=%s&amort=1&op=new&type_immo=%s"|args:$immo_id:$type_immo + shape="settings" + target="_dialog" + }} + {{/if}} {{:linkbutton label="Amortissements" - href="amortization.html?immo_id=%s&type_immo=%s"|args:$immo_line_id:$type_immo + href="amortization.html?immo_id=%s&type_immo=%s"|args:$immo_id:$type_immo shape="table" }} |
| - | |||||||||||
| - | - | Total du compte {{$code}} | -{{$value|money_html:false|raw}} | -- | - | - | - | - | |||
| - | - | Total des immobilisations | -{{$total_immo|money_html|raw}} | -- | - | - | - | - | |||
Aucune immobilisation
diff --git a/_immobilisations_autres.html b/_immobilisations_autres.html index 6ebb556..4444ac8 100644 --- a/_immobilisations_autres.html +++ b/_immobilisations_autres.html @@ -3,40 +3,17 @@ {{* Liste des immobilisations non amortissables ou non (encore) gérées *}}- Cette page liste les écritures pas (encore) prises en charge par le module et sans écriture d'amortissement associée. -
- - {{: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_other}} - {{else}} - {{if $_POST.unhide == null}} - {{:assign unhide=0}} - {{else}} - {{:assign unhide=1}} - {{/if}} - {{:assign var="user_hides.unhide_other" 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}} - - - + {{if $nb_immo == 0}}Aucune immobilisation
{{/if}}- Cette page liste les immobilisations en cours de constitution, donc non amortissables -
- - {{: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}} - {{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"}} - {{/if}} - - - -| - | N° | -Date | -Libellé | -Montant | -N° compte | -Compte | -- |
|---|---|---|---|---|---|---|---|
| {{:input type="checkbox" name="selected[]" value=$trans_id}} | -#{{$trans_id}} | -{{$trans_date|date_short}} | -{{$trans_label}} | -{{"%f"|math:$debit|money_html:false|raw}} | -{{$account_code}} | -{{$account_label}} | -- {{:linkbutton - label="Modifier" - href="ignore.html?immo_id=%s"|args:$immo_id - shape="edit" - target="_dialog" - }} - | -
| - | - | - | Total du compte {{$code}} | -{{$value|money_html|raw}} | -- | - | - |
| - | - | - | Total des immobilisations | -{{$total_immo|money_html|raw}} | -- | - | - |
Aucune immobilisation
- {{/if}} -La date choisie n'est dans aucun exercice ouvert !
@@ -194,7 +155,7 @@