From ec54c9044065ad096d53b71132d9c8e3b27f24ef Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Mon, 15 Dec 2025 15:59:18 +0100 Subject: [PATCH 1/6] Changement filtre brindille : key => value --- _check_account.html | 2 +- _get_codes.html | 6 +++++- add_asset.html | 4 ++-- save_amort.html | 4 ++-- transfer.html | 4 ++-- write_exit.html | 14 +++++++------- 6 files changed, 19 insertions(+), 15 deletions(-) diff --git a/_check_account.html b/_check_account.html index 06e1108..ce6816e 100644 --- a/_check_account.html +++ b/_check_account.html @@ -19,7 +19,7 @@ {{/foreach}} {{:assign condition=$condition|cat:"0)"}} -{{:assign account_code=$account|keys|key:0}} +{{:assign account_code=$account|keys|value:0}} {{#sql select="code" tables="acc_accounts" diff --git a/_get_codes.html b/_get_codes.html index a780b40..0373085 100644 --- a/_get_codes.html +++ b/_get_codes.html @@ -2,9 +2,13 @@ {{* 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 label=$account|values|key:0}} +{{:assign values=$account|values}} +{{:assign label=$values.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/add_asset.html b/add_asset.html index 898042d..39c8b00 100644 --- a/add_asset.html +++ b/add_asset.html @@ -93,8 +93,8 @@ date=$_POST.date_achat label=$_POST.designation amount=$_POST.montant - debit=$debit_account|keys|key:0 - credit=$credit_account|keys|key:0 + debit=$debit_account|keys|value:0 + credit=$credit_account|keys|value:0 id_project=$_POST.id_project }} diff --git a/save_amort.html b/save_amort.html index 8fc110d..2872348 100644 --- a/save_amort.html +++ b/save_amort.html @@ -181,14 +181,14 @@ {{:assign var="lines." debit=$_POST.montant - account=$debit_account|keys|key:0 + account=$debit_account|keys|value:0 id_project=$_GET.project_id label=$_POST.designation }} {{:assign var="lines." credit=$_POST.montant - account=$credit_account|keys|key:0 + account=$credit_account|keys|value:0 id_project=$_GET.project_id label=$_POST.designation }} diff --git a/transfer.html b/transfer.html index c7f5dfc..6756386 100644 --- a/transfer.html +++ b/transfer.html @@ -54,7 +54,7 @@ account=$elem keep="account_code" }} - {{:assign debit_account=$account_code|keys|key:0}} + {{:assign debit_account=$account_code|keys|value:0}} {{:assign var="amount" from="_POST.credit_lines.%s"|args:$rang}} {{:assign var="label" from="_POST.line_labels.%s"|args:$rang}} {{:assign @@ -71,7 +71,7 @@ account=$_POST.debit_account keep="account_code" }} - {{:assign credit_account=$account_code|keys|key:0}} + {{:assign credit_account=$account_code|keys|value:0}} {{:assign var="amount" from="_POST.debit_lines.%s"|args:0}} {{:assign count=$_POST.line_labels|count}} {{:assign count="%d-1"|math:$count}} diff --git a/write_exit.html b/write_exit.html index 168a776..1e5d067 100644 --- a/write_exit.html +++ b/write_exit.html @@ -73,7 +73,7 @@ account=$account keep="account_code" }} - {{:assign amort_account_code=$account_code|keys|key:0}} + {{:assign amort_account_code=$account_code|keys|value:0}} {{if $valeur_nette > 0}} {{* immo non totalement amortie *}} @@ -84,7 +84,7 @@ account=$_POST.comp_account keep="account_code" }} - {{:assign comp_account_code=$account_code|keys|key:0}} + {{:assign comp_account_code=$account_code|keys|value:0}} {{:assign libelle="Amortissement complémentaire "|cat:$ligne_immo.label}} {{:assign @@ -110,7 +110,7 @@ account=$_POST.except_account keep="account_code" }} - {{:assign except_account_code=$account_code|keys|key:0}} + {{:assign except_account_code=$account_code|keys|value:0}} {{:assign libelle="Amortissement exceptionnel "|cat:$ligne_immo.label}} {{:assign var="lines." @@ -150,7 +150,7 @@ account=$_POST.immo_account keep="account_code" }} - {{:assign immo_account_code=$account_code|keys|key:0}} + {{:assign immo_account_code=$account_code|keys|value:0}} {{:assign libelle="Sortie du bilan de "|cat:$ligne_immo.label}} {{:assign var="lines." @@ -172,7 +172,7 @@ account=$_POST.vnc_account keep="account_code" }} - {{:assign vnc_account_code=$account_code|keys|key:0}} + {{:assign vnc_account_code=$account_code|keys|value:0}} {{:assign var="lines." account=$vnc_account_code @@ -203,13 +203,13 @@ account=$_POST.creance_account keep="account_code" }} - {{:assign creance_account=$account_code|keys|key:0}} + {{:assign creance_account=$account_code|keys|value:0}} {{:include file="_get_codes.html" account=$_POST.cession_account keep="account_code" }} - {{:assign cession_account=$account_code|keys|key:0}} + {{:assign cession_account=$account_code|keys|value:0}} {{:api method="POST" path="accounting/transaction" From 6fe88739c19725c5deb8abb5d241fe83329575b1 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Mon, 15 Dec 2025 19:21:17 +0100 Subject: [PATCH 2/6] Correction bug classement manuel immobilisation --- add_infos.html | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/add_infos.html b/add_infos.html index a147948..8001254 100644 --- a/add_infos.html +++ b/add_infos.html @@ -104,9 +104,9 @@ Classement
(obligatoire)
- {{:input type="radio-btn" name="classify" value="managed" label="Amortir" default=$default onclick="toggleInputs('div_inputs','f_classify_managed', 'f_classify_amortized')"}} - {{:input type="radio-btn" name="classify" value="amortized" label="Amortissement terminé" help="Cette immobilisation sera classée parmi les immobilisations amorties" default=$default onclick="toggleInputs('div_inputs','f_classify_managed', 'f_classify_amortized')"}} - {{:input type="radio-btn" name="classify" value="ignored" label="Ignorer l'écriture" help="Cette écriture n'apparaitra plus dans la liste des immobilisations" default=$default onclick="toggleInputs('div_inputs','f_classify_managed', 'f_classify_amortized')"}} + {{:input type="radio-btn" name="classify" value="managed" label="Amortir" default=$default}} + {{:input type="radio-btn" name="classify" value="amortized" label="Amortissement terminé" help="Cette immobilisation sera classée parmi les immobilisations amorties" default=$default}} + {{:input type="radio-btn" name="classify" value="ignored" label="Ignorer l'écriture" help="Cette écriture n'apparaitra plus dans la liste des immobilisations" default=$default}}
@@ -132,11 +132,12 @@ +{{:admin_footer}} + {{* activer/désactiver les champs de saisie *}} -{{:admin_footer}} +function toggleInputs(event) { + toggleInputFields('div_inputs', 'f_classify_managed'); +} + +(function () { + const radios = document.querySelectorAll('input[name="classify"]'); + radios.forEach(radio => { + radio.addEventListener("change", toggleInputs); + }); +})(); + + From b50de139f8b8c7b3b82c4905964f4582e51cd26e Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Mon, 15 Dec 2025 19:22:25 +0100 Subject: [PATCH 3/6] Correction bug sortie bilan si date sortie dans aucun exercice ouvert --- balance_sheet_exit.html | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/balance_sheet_exit.html b/balance_sheet_exit.html index 3a56e4a..3d19e35 100644 --- a/balance_sheet_exit.html +++ b/balance_sheet_exit.html @@ -71,18 +71,13 @@ {{:assign valeur_nette="%f-%f"|math:$ligne_immo.montant:$amort_amount}} {{* -lister les exercices ouverts : - - dont la date de fin est postérieure à la date du dernier amortissment - - dont la date de début est antérieure ou égale à la date du jour + lister les exercices ouverts dont la date de fin est postérieure à la date du dernier amortissment *}} {{:assign default_exit_date=""}} {{#years closed=false order="start_date" where=":debut <= end_date" :debut=$date_debut}} {{if $start_date|strtotime <= $now && $now <= $end_date|strtotime}} {{:assign default_exit_date=$now|date_short}} {{/if}} - {{if $start_date|strtotime > $now}} - {{:break}} - {{/if}} {{:assign var="years." id=$id label=$label start_date=$start_date end_date=$end_date}} {{:assign debut=$start_date|date_short}} {{:assign fin=$end_date|date_short}} From bdef57545cc6f73f842810b4374632eee6cb55c6 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Tue, 16 Dec 2025 10:11:01 +0100 Subject: [PATCH 4/6] =?UTF-8?q?V=C3=A9rification=20date=20transfert=20immo?= =?UTF-8?q?=20en=20cours?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- transfer.html | 104 +++++++++++++++++++++++++++++--------------------- 1 file changed, 61 insertions(+), 43 deletions(-) diff --git a/transfer.html b/transfer.html index 6756386..71f123e 100644 --- a/transfer.html +++ b/transfer.html @@ -17,8 +17,59 @@ {{:error message="Aucun exercice ouvert"}} {{/years}} +{{* déterminer les comptes d'immo en cours *}} +{{:include file="_get_config.html" keep="module.config.unfinished"}} +{{:assign condition="("}} +{{#foreach from=$module.config.unfinished item="elem"}} + {{:assign code=$elem.code|cat:"%"|quote_sql}} + {{:assign condition=$condition|cat:" account.code LIKE "|cat:$code|cat:" OR "}} +{{/foreach}} +{{:assign condition=$condition|cat:"0)"}} + +{{* détails des écritures paramètres *}} +{{:assign trans=$_GET.trans|explode:","}} +{{:assign var="trans_list" value=$trans|map:quote_sql}} +{{:assign trans_list=$trans_list|implode:","}} +{{:assign trans_list="("|cat:$trans_list|cat:")"}} +{{:assign condition=$condition|cat:" AND trans.id IN "|cat:$trans_list}} +{{:assign condition=$condition|cat:" AND NOT (trans.status & 16)"}} + +{{#select + trans.id as trans_id, + trans.label AS trans_label, + trans.date AS trans_date, + SUM(line.debit) AS line_debit, + account.code AS account_code, + account.label AS account_label, + line.id_project as project_id + 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 !condition + GROUP BY trans.id + ; + !condition=$condition +}} + {{:assign var="transactions.%s"|args:$trans_id + amount=$line_debit + date=$trans_date + code=$account_code + label=$account_label + project=$project_id + }} + {{if $max_date == null || $trans_date > $max_date}} + {{:assign max_date=$trans_date}} + {{/if}} +{{/select}} + {{* Traiter l'envoi du formulaire *}} {{#form on="transfer"}} + {{* vérifier que la date de mise en service est postérieure aux dates d'acquisition *}} + {{if $_POST.date_mes|parse_date < $max_date}} + {{:assign dacq=$max_date|date_short}} + {{:error message="La date de mise en service (%s) doit être postérieure à la date d'acquisition d'immobilisation la plus récente (%s) !"|args:$_POST.date_mes:$dacq}} + {{/if}} + {{* vérifier que la date de mise en service est située dans l'exercice sélectionné *}} {{:assign ts_date = $_POST.date_mes|parse_date|strtotime}} {{:assign ok=false}} @@ -120,7 +171,6 @@ {{:assign lines_count=$lines|count}} {{:assign lines_count="%d-1"|math:$lines_count}} {{:assign var="immo_id" from="result.lines.%s.id"|args:$lines_count}} - {{* enregistrer les infos de l'immobilisation *}} {{:save key=""|uuid @@ -137,7 +187,6 @@ {{:assign type_immo="other"}} {{/if}} {{:redirect force="index.html?ok=1&msg=immobilisation&type_immo=%s"|args:$type_immo}} - {{/form}} {{* barre de navigation *}} @@ -148,6 +197,15 @@ {{:form_errors}} {{* formulaire d'ajout d'immobilisation *}} +{{if $_GET.trans == null}} + {{:error message="Vous n'avez sélectionné aucune écriture !"}} +{{/if}} + +{{if $max_date|strtotime > $now}} + {{:assign default_date=$max_date}} +{{else}} + {{:assign default_date=$now|date_short}} +{{/if}} {{#select id,label FROM acc_projects WHERE archived = 0;}} {{:assign var="projects.%d"|args:$id value=$label}} @@ -162,53 +220,13 @@

La date choisie n'est dans aucun exercice ouvert !

-{{if $_GET.trans == null}} - {{:error message="Vous n'avez sélectionné aucune écriture !"}} -{{/if}} - -{{* déterminer les comptes d'immo en cours *}} -{{:include file="_get_config.html" keep="module.config.unfinished"}} -{{:assign condition="("}} -{{#foreach from=$module.config.unfinished item="elem"}} - {{:assign code=$elem.code|cat:"%"|quote_sql}} - {{:assign condition=$condition|cat:" account.code LIKE "|cat:$code|cat:" OR "}} -{{/foreach}} -{{:assign condition=$condition|cat:"0)"}} - -{{* détails des écritures paramètres *}} -{{:assign trans=$_GET.trans|explode:","}} -{{:assign var="trans_list" value=$trans|map:quote_sql}} -{{:assign trans_list=$trans_list|implode:","}} -{{:assign trans_list="("|cat:$trans_list|cat:")"}} -{{:assign condition=$condition|cat:" AND trans.id IN "|cat:$trans_list}} -{{:assign condition=$condition|cat:" AND NOT (trans.status & 16)"}} - -{{#select - trans.id as trans_id, - trans.label AS trans_label, - trans.date AS trans_date, - SUM(line.debit) AS line_debit, - account.code AS account_code, - account.label AS account_label, - line.id_project as project_id - 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 !condition - GROUP BY trans.id - ; - !condition=$condition -}} - {{:assign var="transactions.%s"|args:$trans_id amount=$line_debit date=$trans_date code=$account_code label=$account_label project=$project_id}} -{{/select}} -
Données de l'immobilisation
{{:input type="select" name="id_year" label="Exercice" default=$selected_year required=true default_empty="— Faire un choix —" options=$open_years}} - {{:input type="date" name="date_mes" label="Date de mise en service" required=true default=$now|date_short}} + {{:input type="date" name="date_mes" label="Date de mise en service" required=true default=$default_date}} {{:input type="text" name="designation" label="Libellé" required=true}}
From 4ac6cbb1a6528f905216dfbb197653ccd963343c Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Tue, 16 Dec 2025 11:58:07 +0100 Subject: [PATCH 5/6] =?UTF-8?q?Immo=20en=20cours=20:=20ajout=20total=20g?= =?UTF-8?q?=C3=A9n=C3=A9ral=20+=20modif=20pr=C3=A9sentation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _unfinished.html | 25 +++++++++++----------- scripts.js | 55 +++++++++++++++++++++++++++++++++--------------- style.css | 5 +++++ 3 files changed, 56 insertions(+), 29 deletions(-) diff --git a/_unfinished.html b/_unfinished.html index 3e41d55..60ac42b 100644 --- a/_unfinished.html +++ b/_unfinished.html @@ -16,9 +16,12 @@

Montants sélectionnés -
    -
  •  
  • -
+ + + + + +

@@ -181,15 +184,13 @@