Compare commits

..

3 commits

Author SHA1 Message Date
Jean-Christophe Engel
003af639ea Modifications cosmétiques 2026-06-16 10:33:26 +02:00
Jean-Christophe Engel
d4743f3631 Harmonisation navigation et sélection comptes et sous-comptes crédit 2026-06-16 10:31:26 +02:00
Jean-Christophe Engel
2af96b2796 Amortization : amélioration affichage boutons 2026-06-15 12:27:16 +02:00
9 changed files with 47 additions and 24 deletions

View file

@ -4,15 +4,14 @@ Ce module permet de gérer les écritures d'amortissements pour les immobilisati
- lister les immobilisations - lister les immobilisations
- ajouter une nouvelle immobilisation - 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 - enregistrer un nouvel amortissement
- incorporer d'anciennes immobilisations et leurs amortisements
## Installation ## Installation
- télécharger [l'archive zip](https://link.infini.fr/amortissement) - télécharger [l'archive zip](https://link.infini.fr/amortissement)
- cliquer « Configuration » puis « Extensions » - cliquer « Configuration » puis « Extensions »
- en bas de la page, cliquer « Importer un module » - en bas de la page, cliquer « Importer un module »
- sélectionner l'archive téléchargée ci-dessus - sélectionner l'archive téléchargée ci-dessus
- activer le module qui est maintenant présent dans la liste des extensions inactives - activer le module

View file

@ -153,7 +153,7 @@
<td><a href="{{$compte_url}}">{{$account_code}}</a></td> <td><a href="{{$compte_url}}">{{$account_code}}</a></td>
<td>{{$account_label}}</td> <td>{{$account_label}}</td>
<td class="actions"> <td class="actions">
{{:linkbutton label="Modifier" href="exit_step4.html?immo_doc_id=%s"|args:$info_immo.id shape="edit"}} {{:linkbutton label="Modifier" href="exit_step1.html?immo_doc_id=%s"|args:$info_immo.id shape="edit"}}
</td> </td>
</tr> </tr>
{{/select}} {{/select}}

View file

@ -1,10 +1,11 @@
{{* -*- brindille -*- *}} {{* -*- brindille -*- *}}
{{* {{*
Supprimer l'association entre deux lignes Supprimer l'association entre une ligne d'immo et une autre ligne (amort, credit, cession, sortie)
@param immo_doc_id : id du doc associé à la ligne d'immobilisation @param immo_doc_id : id du doc associé à la ligne d'immobilisation
@param line_id : id de la ligne à détacher @param line_id : id de la ligne à détacher
*}} *}}
{{* données de l'immobilisation *}} {{* données de l'immobilisation *}}
{{:include file="_get_immo_data.html" immo_doc_id=$immo_doc_id|intval keep="ligne_immo, message"}} {{:include file="_get_immo_data.html" immo_doc_id=$immo_doc_id|intval keep="ligne_immo, message"}}
{{if $message != null}} {{if $message != null}}

View file

@ -45,11 +45,11 @@
{{:admin_header title="Détails de l'immobilisation" custom_css="./style.css" current="module_amortization"}} {{:admin_header title="Détails de l'immobilisation" custom_css="./style.css" current="module_amortization"}}
{{* barre de navigation *}} {{* barre de navigation *}}
{{if $_GET.type_immo == "amortized" || $valeur_residuelle == 0 }} {{if $_GET.type_immo == "amortized" && $valeur_residuelle == 0}}
{{:assign current="amortized"}} {{:assign current="amortized"}}
{{elseif $_GET.type_immo == "archived"}} {{elseif $_GET.type_immo == "archived"}}
{{:assign current="archived"}} {{:assign current="archived"}}
{{elseif $_GET.type_immo == null || $_GET.type_immo == "managed"}} {{elseif $_GET.type_immo == null || $_GET.type_immo == "managed" || $valeur_residuelle > 0}}
{{:assign current="managed"}} {{:assign current="managed"}}
{{else}} {{else}}
{{:assign current="other"}} {{:assign current="other"}}
@ -150,7 +150,7 @@
<h3 class="ruler">Avoirs</h3> <h3 class="ruler">Avoirs</h3>
<nav class="actions"> <nav class="actions">
{{if $total_amort == 0}} {{if $total_amort == 0 || ! $created_amort}}
{{:linkbutton label="Attacher une écriture d'avoir" href="link_immo.html?immo_doc_id=%s"|args:$_GET.immo_doc_id shape="link" target="_dialog"}} {{:linkbutton label="Attacher une écriture d'avoir" href="link_immo.html?immo_doc_id=%s"|args:$_GET.immo_doc_id shape="link" target="_dialog"}}
{{/if}} {{/if}}
</nav> </nav>

View file

@ -32,6 +32,7 @@
- line.credit < ligne_immo.amount => peut-être un avoir - line.credit < ligne_immo.amount => peut-être un avoir
- line.credit = ligne_immo.amount - avoirs => écriture de sortie du bilan - line.credit = ligne_immo.amount - avoirs => écriture de sortie du bilan
*}} *}}
{{:assign account_code=$ligne_immo.account_code|cat:"%"}}
{{#select {{#select
trans.id as trans_id, trans.id as trans_id,
trans.label as trans_label, trans.label as trans_label,
@ -40,15 +41,15 @@
line.id as credit_line_id, line.id as credit_line_id,
line.label as line_label, line.label as line_label,
line.credit as amount, line.credit as amount,
acc.id as account_id, account.id as account_id,
acc.code as account_code, account.code as account_code,
acc.label as account_label account.label as account_label
FROM acc_transactions AS trans FROM acc_transactions AS trans
INNER JOIN acc_transactions_lines AS line ON line.id_transaction = trans.id INNER JOIN acc_transactions_lines AS line ON line.id_transaction = trans.id
INNER JOIN acc_accounts AS acc ON line.id_account = acc.id INNER JOIN acc_accounts AS account ON line.id_account = account.id
LEFT JOIN module_data_amortization AS mda ON json_extract(mda.document, '$.amort_line_id') = line.id LEFT JOIN module_data_amortization AS mda ON json_extract(mda.document, '$.amort_line_id') = line.id
WHERE WHERE
acc.code = :acc_code account.code LIKE :account_code
AND line.credit > 0 AND line.credit > 0
AND credit_line_id NOT IN ( AND credit_line_id NOT IN (
SELECT json_extract(credit_link.document, '$.credit_line_id') AS line_id FROM !table as credit_link SELECT json_extract(credit_link.document, '$.credit_line_id') AS line_id FROM !table as credit_link
@ -58,7 +59,7 @@
WHERE json_extract(exit_link.document, '$.type') == "exit_link" WHERE json_extract(exit_link.document, '$.type') == "exit_link"
) )
; ;
:acc_code=$ligne_immo.account_code :account_code=$account_code
!table =$module.table !table =$module.table
assign="credit_line" assign="credit_line"
}} }}
@ -75,7 +76,6 @@
}} }}
{{* chercher des écritures d'amortissement correspondant au compte d'une immo sans doc associé *}} {{* chercher des écritures d'amortissement correspondant au compte d'une immo sans doc associé *}}
{{* TODO écritures d'amort pas entièrement affectées *}}
{{#select {{#select
line.id as amort_line_id, line.id as amort_line_id,
line.credit as amort_amount, line.credit as amort_amount,
@ -105,7 +105,7 @@
{{:assign keep_amort=true}} {{:assign keep_amort=true}}
{{#load type="amort_link" {{#load type="amort_link"
where="$$.amort_line_id = :amort_line_id" where="$$.amort_line_id = :amort_line_id"
:amort_line_id=$amort_line.amort_line_id|intval :amort_line_id=$amort_line.amort_line_id
assign="amort_link" assign="amort_link"
}} }}
{{if $amort_link.amount == null || $amort_link.amount == 0}} {{if $amort_link.amount == null || $amort_link.amount == 0}}
@ -123,6 +123,7 @@
{{/select}} {{/select}}
{{:admin_header title="Immobilisation sortie du bilan" custom_css="./style.css" current="module_amortization"}} {{: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.ok}}
{{if $_GET.msg|match:"attach_avoir"}} {{if $_GET.msg|match:"attach_avoir"}}

View file

@ -43,7 +43,6 @@
}} }}
{{* chercher des écritures d'amortissement correspondant au compte d'une immo sans doc associé *}} {{* chercher des écritures d'amortissement correspondant au compte d'une immo sans doc associé *}}
{{* TODO écritures d'amort pas entièrement affectées *}}
{{#select {{#select
line.id as amort_line_id, line.id as amort_line_id,
line.credit as amort_amount, line.credit as amort_amount,
@ -91,6 +90,7 @@
{{/select}} {{/select}}
{{:admin_header title="Immobilisation sortie du bilan" custom_css="./style.css" current="module_amortization"}} {{: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.ok}}
{{if $_GET.msg|match:"attach_amort"}} {{if $_GET.msg|match:"attach_amort"}}

View file

@ -1,6 +1,5 @@
{{* -*- brindille -*- *}} {{* -*- 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 Associer une écriture de cession à une immo créée et sortie du
bilan avant la mise en service du module bilan avant la mise en service du module
@ -59,6 +58,21 @@
assign="line" assign="line"
}} }}
{{* voir si l'écriture de cession est déjà liée à une immo *}} {{* 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 {{#select
CASE WHEN links.id_related = :trans_id CASE WHEN links.id_related = :trans_id
THEN links.id_transaction THEN links.id_transaction
@ -80,6 +94,9 @@
{{/select}} {{/select}}
{{*:debug linked_cessions=$linked_cessions free_cessions=$free_cessions total_cession=$total_cession*}} {{*: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.ok}}
{{if $_GET.msg|match:"attach_cession"}} {{if $_GET.msg|match:"attach_cession"}}
{{:assign msg="Écriture de cession attachée"}} {{:assign msg="Écriture de cession attachée"}}

View file

@ -164,6 +164,7 @@
{{/select}} {{/select}}
{{:admin_header title="Immobilisation sortie du bilan" custom_css="./style.css" current="module_amortization"}} {{: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.ok}}
{{if $_GET.msg|match:"attach_exit"}} {{if $_GET.msg|match:"attach_exit"}}

View file

@ -18,6 +18,7 @@
{{* {{*
lister les écritures au crédit du compte de l'immobilisation lister les écritures au crédit du compte de l'immobilisation
*}} *}}
{{:assign account_code=$ligne_immo.account_code|cat:"%"}}
{{#select {{#select
line.id as credit_line_id, line.id as credit_line_id,
line.id_transaction as credit_trans_id, line.id_transaction as credit_trans_id,
@ -34,12 +35,15 @@
INNER JOIN acc_transactions AS trans ON trans.id = line.id_transaction 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_accounts AS account ON account.id = line.id_account
INNER JOIN acc_years AS y ON y.id = trans.id_year INNER JOIN acc_years AS y ON y.id = trans.id_year
WHERE account.code = :account_code AND credit > 0 WHERE account.code LIKE :account_code AND credit > 0
AND credit_line_id NOT IN ( AND credit_line_id NOT IN (
SELECT json_extract(link.document, '$.credit_line_id') AS credit_line_id FROM !table as link SELECT json_extract(link.document, '$.credit_line_id') AS credit_line_id FROM !table as link
WHERE json_extract(link.document, '$.type') == "credit_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")
ORDER BY trans.date, trans.label; ORDER BY trans.date, trans.label;
:account_code = $ligne_immo.account_code :account_code = $account_code
!table =$module.table !table =$module.table
assign="other_immos." assign="other_immos."
}} }}
@ -60,7 +64,7 @@
<section class="immobilisation"> <section class="immobilisation">
<fieldset> <fieldset>
<legend> <legend>
Écritures au crédit du compte d'immobilisation « {{$ligne_immo.account_code}} » Écritures au crédit du compte d'immobilisation « {{$ligne_immo.account_code}} » et sous-comptes
</legend> </legend>
<div class="informations"> <div class="informations">