diff --git a/README.md b/README.md index 578af08..e771e69 100644 --- a/README.md +++ b/README.md @@ -4,14 +4,15 @@ Ce module permet de gérer les écritures d'amortissements pour les immobilisati - lister les immobilisations - ajouter une nouvelle immobilisation -- lister les amortissements d'une immobilisation +- lister les amortissements d'une immobilisation : + - amortissements déjà enregistrés + - amortissements à venir +- associer une écriture d'amortissement à une immobilisation - enregistrer un nouvel amortissement -- incorporer d'anciennes immobilisations et leurs amortisements ## Installation - télécharger [l'archive zip](https://link.infini.fr/amortissement) - cliquer « Configuration » puis « Extensions » - en bas de la page, cliquer « Importer un module » - sélectionner l'archive téléchargée ci-dessus -- activer le module - +- activer le module qui est maintenant présent dans la liste des extensions inactives diff --git a/_archives.html b/_archives.html index a4356d6..ce92aff 100644 --- a/_archives.html +++ b/_archives.html @@ -153,7 +153,7 @@ {{$account_code}} {{$account_label}} - {{:linkbutton label="Modifier" href="exit_step1.html?immo_doc_id=%s"|args:$info_immo.id shape="edit"}} + {{:linkbutton label="Modifier" href="exit_step4.html?immo_doc_id=%s"|args:$info_immo.id shape="edit"}} {{/select}} diff --git a/_common_detach.html b/_common_detach.html index 2c730c8..b4e80d0 100644 --- a/_common_detach.html +++ b/_common_detach.html @@ -1,11 +1,10 @@ {{* -*- brindille -*- *}} {{* - Supprimer l'association entre une ligne d'immo et une autre ligne (amort, credit, cession, sortie) + Supprimer l'association entre deux lignes @param immo_doc_id : id du doc associé à la ligne d'immobilisation @param line_id : id de la ligne à détacher *}} - {{* données de l'immobilisation *}} {{:include file="_get_immo_data.html" immo_doc_id=$immo_doc_id|intval keep="ligne_immo, message"}} {{if $message != null}} diff --git a/_nav.html b/_nav.html index c81e1f3..fac14e4 100644 --- a/_nav.html +++ b/_nav.html @@ -1,31 +1,55 @@ {{* -*- brindille -*- *}} {{if $linked_amort != null}} diff --git a/attach_amort.html b/attach_amort.html index 738a3c0..5c2951c 100644 --- a/attach_amort.html +++ b/attach_amort.html @@ -134,7 +134,7 @@ {{* barre de navigation *}} {{if ! $dialog}} - {{:include file="_nav.html" current="managed" subcurrent="attach_amort"}} + {{:include file="_nav.html" current="config" subcurrent="init" subsubcurrent="parameter"}} {{/if}} {{:form_errors}} diff --git a/attach_credit.html b/attach_credit.html index 276dc76..6e8d22a 100644 --- a/attach_credit.html +++ b/attach_credit.html @@ -115,8 +115,9 @@ {{if ! $dialog}} {{:include file="_nav.html" - current="managed" - subcurrent="attach_credit" + current="config" + subcurrent="other" + subsubcurrent="immo" type_immo="other" }} {{/if}} diff --git a/balance_sheet_exit.html b/balance_sheet_exit.html index d844c91..2b4cf6b 100644 --- a/balance_sheet_exit.html +++ b/balance_sheet_exit.html @@ -10,12 +10,6 @@ {{if $message != null}} {{:error message=$message}} {{/if}} -{{* TODO VÉRIFIER SI UTILE *}} -{{* -{{if $info_immo.duration == null || $info_immo.duration == 0}} - {{:error message="Vous devez renseigner la durée d'amortissement au préalable"}} -{{/if}} -*}} {{:assign label_immo=$info_immo.label|or:$ligne_immo.trans_label}} {{if $ligne_immo.line_label != null && $ligne_immo.line_label != $label_immo}} @@ -141,7 +135,7 @@ {{:admin_header title="Sortie de bilan" custom_css="./style.css" current="module_amortization"}} {{if ! $dialog}} - {{:include file="_nav.html" current="%s"|args:$_GET.type_immo subcurrent="balance_exit"}} + {{:include file="_nav.html" current="index" subcurrent="%s"|args:$_GET.type_immo subsubcurrent="balance_exit"}} {{/if}} {{:form_errors}} diff --git a/compute_exit_data.html b/compute_exit_data.html index c824af5..7caf90b 100644 --- a/compute_exit_data.html +++ b/compute_exit_data.html @@ -9,9 +9,7 @@ @param date_debut : date de début de la période d'amortissement complémentaire @param exit_date : date de sortie de l'immobilisation *}} - -{{* TODO boutons de navigation avant-arrière*}} - +{{* TODO *}} {{* données de l'immobilisation *}} {{:include file="_get_immo_data.html" immo_doc_id=$_GET.immo_doc_id|intval keep="info_immo, ligne_immo, message"}} {{if $message != null}} @@ -60,12 +58,7 @@ {{* barre de navigation *}} {{if ! $dialog}} - {{if $valeur_nette > 0}} - {{:assign type_immo="managed"}} - {{else}} - {{:assign type_immo="amortized"}} - {{/if}} - {{:include file="_nav.html" current="%s"|args:$type_immo subcurrent="balance_exit"}} + {{:include file="_nav.html" current="index" subcurrent="balance_exit"}} {{/if}} {{:form_errors}} diff --git a/exit_step1.html b/exit_step1.html index 0b85eb9..0fc2fb1 100644 --- a/exit_step1.html +++ b/exit_step1.html @@ -32,7 +32,6 @@ - line.credit < ligne_immo.amount => peut-être un avoir - line.credit = ligne_immo.amount - avoirs => écriture de sortie du bilan *}} -{{:assign account_code=$ligne_immo.account_code|cat:"%"}} {{#select trans.id as trans_id, trans.label as trans_label, @@ -41,15 +40,15 @@ line.id as credit_line_id, line.label as line_label, line.credit as amount, - account.id as account_id, - account.code as account_code, - account.label as account_label + acc.id as account_id, + acc.code as account_code, + acc.label as account_label 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_accounts AS acc ON line.id_account = acc.id LEFT JOIN module_data_amortization AS mda ON json_extract(mda.document, '$.amort_line_id') = line.id WHERE - account.code LIKE :account_code + acc.code = :acc_code AND line.credit > 0 AND credit_line_id NOT IN ( SELECT json_extract(credit_link.document, '$.credit_line_id') AS line_id FROM !table as credit_link @@ -59,7 +58,7 @@ WHERE json_extract(exit_link.document, '$.type') == "exit_link" ) ; - :account_code=$account_code + :acc_code=$ligne_immo.account_code !table =$module.table assign="credit_line" }} @@ -76,6 +75,7 @@ }} {{* chercher des écritures d'amortissement correspondant au compte d'une immo sans doc associé *}} +{{* TODO écritures d'amort pas entièrement affectées *}} {{#select line.id as amort_line_id, line.credit as amort_amount, @@ -105,7 +105,7 @@ {{:assign keep_amort=true}} {{#load type="amort_link" where="$$.amort_line_id = :amort_line_id" - :amort_line_id=$amort_line.amort_line_id + :amort_line_id=$amort_line.amort_line_id|intval assign="amort_link" }} {{if $amort_link.amount == null || $amort_link.amount == 0}} @@ -123,7 +123,6 @@ {{/select}} {{:admin_header title="Immobilisation sortie du bilan" custom_css="./style.css" current="module_amortization"}} -{{:include file="_nav.html" current="archived" subcurrent="exit"}} {{if $_GET.ok}} {{if $_GET.msg|match:"attach_avoir"}} diff --git a/exit_step2.html b/exit_step2.html index ee740ff..8199426 100644 --- a/exit_step2.html +++ b/exit_step2.html @@ -43,6 +43,7 @@ }} {{* chercher des écritures d'amortissement correspondant au compte d'une immo sans doc associé *}} +{{* TODO écritures d'amort pas entièrement affectées *}} {{#select line.id as amort_line_id, line.credit as amort_amount, @@ -90,7 +91,6 @@ {{/select}} {{:admin_header title="Immobilisation sortie du bilan" custom_css="./style.css" current="module_amortization"}} -{{:include file="_nav.html" current="archived" subcurrent="exit"}} {{if $_GET.ok}} {{if $_GET.msg|match:"attach_amort"}} diff --git a/exit_step3.html b/exit_step3.html index 458357c..5d8ff0d 100644 --- a/exit_step3.html +++ b/exit_step3.html @@ -1,5 +1,6 @@ {{* -*- brindille -*- *}} +{{:admin_header title="Immobilisation sortie du bilan" custom_css="./style.css" current="module_amortization"}} {{* Associer une écriture de cession à une immo créée et sortie du bilan avant la mise en service du module @@ -58,21 +59,6 @@ assign="line" }} {{* voir si l'écriture de cession est déjà liée à une immo *}} - {{* TODO VOIR SI TUTILE - {{#load type="cession_link" - where="$$.cession_line_id = :cession_line_id" - :cession_line_id = $line.line_id - assign="cession_link" - }} -{{:debug line=$line cession_link=$cession_link}} - {{:assign total_cession="%d+%d"|math:$total_cession:$line.amount}} - {{:assign var="line.linked_id" value=$linked_id}} - {{:assign var="linked_cessions." value=$line}} - {{else}} - {{:assign var="free_cessions." value=$line}} - {{/load}} -*}} - {{#select CASE WHEN links.id_related = :trans_id THEN links.id_transaction @@ -94,9 +80,6 @@ {{/select}} {{*:debug linked_cessions=$linked_cessions free_cessions=$free_cessions total_cession=$total_cession*}} -{{:admin_header title="Immobilisation sortie du bilan" custom_css="./style.css" current="module_amortization"}} -{{:include file="_nav.html" current="archived" subcurrent="exit"}} - {{if $_GET.ok}} {{if $_GET.msg|match:"attach_cession"}} {{:assign msg="Écriture de cession attachée"}} diff --git a/exit_step4.html b/exit_step4.html index 8a2b51e..ccb6d7f 100644 --- a/exit_step4.html +++ b/exit_step4.html @@ -164,7 +164,6 @@ {{/select}} {{:admin_header title="Immobilisation sortie du bilan" custom_css="./style.css" current="module_amortization"}} -{{:include file="_nav.html" current="archived" subcurrent="exit"}} {{if $_GET.ok}} {{if $_GET.msg|match:"attach_exit"}} diff --git a/index.html b/index.html index f2fab2e..5007c48 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,7 @@ {{:admin_header title="Immobilisations en cours de constitution" custom_css="./style.css" current="module_amortization" subcurrent="unfinished"}} {{/if}} -{{:include file="_nav.html" current=$type_immo}} +{{:include file="_nav.html" current="index" subcurrent=$type_immo}} {{if $_GET.ok}} {{if $_GET.msg|match:"immobilisation"}} diff --git a/link_immo.html b/link_immo.html index 557b0e8..77f5cd1 100644 --- a/link_immo.html +++ b/link_immo.html @@ -18,7 +18,6 @@ {{* lister les écritures au crédit du compte de l'immobilisation *}} -{{:assign account_code=$ligne_immo.account_code|cat:"%"}} {{#select line.id as credit_line_id, line.id_transaction as credit_trans_id, @@ -35,15 +34,12 @@ INNER JOIN acc_transactions AS trans ON trans.id = line.id_transaction INNER JOIN acc_accounts AS account ON account.id = line.id_account INNER JOIN acc_years AS y ON y.id = trans.id_year - WHERE account.code LIKE :account_code AND credit > 0 + WHERE account.code = :account_code AND credit > 0 AND credit_line_id NOT IN ( SELECT json_extract(link.document, '$.credit_line_id') AS credit_line_id FROM !table as link - WHERE json_extract(link.document, '$.type') == "credit_link" - UNION - SELECT json_extract(exit_link.document, '$.exit_line_id') AS line_id FROM !table as exit_link - WHERE json_extract(exit_link.document, '$.type') == "exit_link") + WHERE json_extract(link.document, '$.type') == "credit_link") ORDER BY trans.date, trans.label; - :account_code = $account_code + :account_code = $ligne_immo.account_code !table =$module.table assign="other_immos." }} @@ -55,8 +51,9 @@ {{if ! $dialog}} {{:include file="_nav.html" - current="managed" - subcurrent="link_immo" + current="config" + subcurrent="other" + subsubcurrent="immo" type_immo="other" }} {{/if}} @@ -64,7 +61,7 @@
- Écritures au crédit du compte d'immobilisation « {{$ligne_immo.account_code}} » et sous-comptes + Écritures au crédit du compte d'immobilisation « {{$ligne_immo.account_code}} »
diff --git a/modify_infos.html b/modify_infos.html index 7694e83..5b89e91 100644 --- a/modify_infos.html +++ b/modify_infos.html @@ -153,7 +153,7 @@ {{:admin_header title="Modifier l'immobilisation" custom_css="./style.css" current="module_amortization"}} {{if ! $dialog}} - {{:include file="_nav.html" current="managed" subcurrent="modify_infos"}} + {{:include file="_nav.html" current="index" subcurrent="%s"|args:$_GET.type_immo subsubcurrent="parameter"}} {{/if}} {{:form_errors}} diff --git a/other_amortizations.html b/other_amortizations.html index 8716a25..bc5b2c5 100644 --- a/other_amortizations.html +++ b/other_amortizations.html @@ -38,8 +38,9 @@ {{if ! $dialog}} {{:include file="_nav.html" - current="managed" - subcurrent="amortization" + current="index" + subcurrent="managed" + subsubcurrent="amortization" type_immo="managed" autres_amort=$free_amort_lines }} diff --git a/save_amort.html b/save_amort.html index 224d52e..1705579 100644 --- a/save_amort.html +++ b/save_amort.html @@ -65,7 +65,7 @@ *}} {{:assign msg_years=""}} {{#years closed=false order="start_date" where="start_date <= :debut AND :debut <= end_date" - :debut=$date_debut assign="years."}} + :debut=$date_debut assign=years.}} {{if $total_amort == 0}} {{:assign ts_debut=$date_debut|strtotime}} {{else}} @@ -178,20 +178,6 @@ {{* enregistrer la liaison des lignes *}} {{#foreach from=$result.lines item="line"}} {{if $line.account_code == $credit_account|keys|value:0}} - {{* TODO VOIR SI CORRECT ET UTILE *}} - {{* - vérifier la présence d'un doc avec cette ligne d'amortissement - (cas de la suppression manuelle d'un amortissement) - *}} - - {{#load type="amort_link" where="$$.amort_line_id = :amort_line_id" :amort_line_id=$line.id debug=true assign="info_amort"}} - {{:debug info_amort=$info_amort}} - {{:assign uuid=$key}} - {{:break}} - {{else}} - {{:assign uuid=""|uuid}} - {{/load}} -{{:debug uuid=$uuid}} {{:save key=""|uuid type="amort_link" @@ -219,14 +205,12 @@ {{* barre de navigation *}} {{if ! $dialog}} - {{:include file="_nav.html" current="managed" subcurrent="amortization"}} + {{:include file="_nav.html" current="index" subcurrent="managed" subsubcurrent="amortization"}} {{/if}} {{:form_errors}} -{{if $years|count == 1}} - {{:assign var=selected_year value=$years.0.id}} -{{/if}} +{{:assign var=selected_year value=$years.0.id}} {{:assign var=date_amort value=$years.0.end_date}} {{:include file="_calcul_dates.html" date_debut=$date_debut date_fin=$date_amort keep="nbjours"}} diff --git a/transfer.html b/transfer.html index 17d3b31..a9c9f50 100644 --- a/transfer.html +++ b/transfer.html @@ -192,7 +192,7 @@ {{:admin_header title="Transfert d'immobilisation en cours" custom_css="./style.css" current="module_amortization"}} {{if ! $dialog}} - {{:include file="_nav.html" current="unfinished" subcurrent="transfer"}} + {{:include file="_nav.html" current="index" subcurrent="unfinished" subsubcurrent="transfer"}} {{/if}} {{:form_errors}} diff --git a/write_exit.html b/write_exit.html index beb6e68..0a17d3b 100644 --- a/write_exit.html +++ b/write_exit.html @@ -267,12 +267,7 @@ {{:admin_header title="Sortie du bilan" custom_css="./style.css" current="module_amortization"}} {{if ! $dialog}} - {{if $valeur_nette > 0}} - {{:assign type_immo="managed"}} - {{else}} - {{:assign type_immo="amortized"}} - {{/if}} - {{:include file="_nav.html" current="%s"|args:$type_immo subcurrent="balance_exit"}} + {{:include file="_nav.html" current="index" subcurrent="balance_exit"}} {{/if}} {{*