diff --git a/_archives.html b/_archives.html index 8a8f8ad..be33053 100644 --- a/_archives.html +++ b/_archives.html @@ -34,6 +34,7 @@
Aucun amortissement enregistré pour cette immobilisation
{{/if}} {{if $free_amort_lines}}
- Il y a des écritures d'amortissement qui ne sont pas attachées à une immobilisation !
- Utilisez le bouton « Attacher un amortissement » pour les afficher ; vous pourrez choisir d'en attacher certaines à cette immobilisation.
+ Il y a des écritures d'amortissement qui ne sont pas rattachées à une immobilisation !
+ Utilisez le bouton « Rattacher un amortissement » pour les afficher ; vous pourrez choisir d'en attacher certaines à cette immobilisation.
Aucun amortissement enregistré pour cette immobilisation ; utilisez le bouton « Enregistrer un amortissement » pour enregistrer un nouvel amortissement
-{{/if}} {{:form_errors}} {{:admin_footer}} diff --git a/attach_amort.html b/attach_amort.html index adf9e5c..755ff70 100644 --- a/attach_amort.html +++ b/attach_amort.html @@ -144,9 +144,9 @@ {{/if}} {{if $_GET.from == "exit"}} - {{:redirect force="exit_step2.html?immo_doc_id=%s&ok=1&msg=attach_amort"|args:$_GET.immo_doc_id}} + {{:redirect to="exit_step2.html?immo_doc_id=%s"|args:$_GET.immo_doc_id}} {{else}} - {{:redirect force="amortization.html?immo_doc_id=%s&type_immo=%s&ok=1&msg=attach_amort"|args:$_GET.immo_doc_id:$status}} + {{:redirect to="amortization.html?immo_doc_id=%s&type_immo=%s&ok=1&msg=attach_amort"|args:$_GET.immo_doc_id:$status}} {{/if}} {{/form}} diff --git a/attach_credit.html b/attach_credit.html index 5028718..7cd7b16 100644 --- a/attach_credit.html +++ b/attach_credit.html @@ -125,11 +125,11 @@ {{/if}} {{if $_GET.from == "exit"}} - {{:redirect force="exit_step1.html?immo_doc_id=%s&ok=1&msg=attach_avoir"|args:$_GET.immo_doc_id}} + {{:redirect force="exit_step1.html?immo_doc_id=%s"|args:$_GET.immo_doc_id}} {{else}} - {{:redirect force="details_immo.html?immo_doc_id=%s&ok=1&msg=attach_credit"|args:$_GET.immo_doc_id}} - {{*:redirect force="amortization.html?immo_doc_id=%s&ok=1&msg=attach_avoir"|args:$_GET.immo_doc_id*}} + {{:redirect to="amortization.html?immo_doc_id=%s&ok=1&msg=attach_avoir"|args:$_GET.immo_doc_id}} {{/if}} +{{*:redirect to="details_immo.html?immo_doc_id=%s&ok=1&msg=attach_credit"|args:$_GET.immo_doc_id*}} {{/form}} {{:admin_header title="Écritures au crédit du compte d'immobilisation" custom_css="./style.css" current="module_amortization"}} diff --git a/delete_infos.html b/delete_infos.html index 8af819c..6ec1875 100644 --- a/delete_infos.html +++ b/delete_infos.html @@ -20,9 +20,10 @@ {{#select trans.id FROM acc_transactions_lines AS line - INNER JOIN !table AS credit_link ON $$.credit_line_id = line.id + INNER JOIN !table ON $$.credit_line_id = line.id INNER JOIN acc_transactions AS trans ON line.id_transaction = trans.id - WHERE $$.type = "credit_link" AND $$.immo_doc_id = :immo_doc_id + WHERE $$.type = + "credit_link" AND $$.immo_doc_id = :immo_doc_id ; !table = $module.table :immo_doc_id = $_GET.immo_doc_id|intval @@ -59,7 +60,8 @@ }} {{* supprimer les docs de liaison *}} - {{:delete type="credit_link" where="$$.immo_doc_id = :immo_doc_id" :immo_doc_id = $_GET.immo_doc_id|intval}} + {{:delete type="immo_link" where="$$.immo_doc_id = :immo_doc_id" :immo_doc_id = $_GET.immo_doc_id|intval}} + {{/if}} {{* supprimer les infos de l'immobilisation *}} diff --git a/detach_amort.html b/detach_amort.html index eba97ee..14be3bc 100644 --- a/detach_amort.html +++ b/detach_amort.html @@ -26,7 +26,7 @@ }} {{if $_GET.from == "exit"}} - {{:redirect force="exit_step2.html?immo_doc_id=%s&ok=1&msg=detach_amort"|args:$_GET.immo_doc_id}} + {{:redirect to="exit_step2.html?immo_doc_id=%s"|args:$_GET.immo_doc_id}} {{else}} - {{:redirect force="amortization.html?immo_doc_id=%s&ok=1&msg=detach_amort"|args:$_GET.immo_doc_id:}} + {{:redirect to="amortization.html?immo_doc_id=%s&ok=1&msg=detach_amort"|args:$_GET.immo_doc_id:}} {{/if}} diff --git a/detach_credit.html b/detach_credit.html index 1abc8d9..fb13fcc 100644 --- a/detach_credit.html +++ b/detach_credit.html @@ -25,8 +25,8 @@ }} {{if $_GET.from == "exit"}} - {{:redirect force="exit_step1.html?immo_doc_id=%s&ok=1&msg=detach_avoir"|args:$_GET.immo_doc_id}} + {{:redirect to="exit_step1.html?immo_doc_id=%s"|args:$_GET.immo_doc_id}} {{else}} - {{:redirect force="details_immo.html?immo_doc_id=%s&ok=1&msg=detach&"|args:$_GET.immo_doc_id}} - {{*:redirect force="amortization.html?immo_doc_id=%s&ok=1&msg=detach_avoir"|args:$_GET.immo_doc_id*}} + {{:redirect to="amortization.html?immo_doc_id=%s&ok=1&msg=detach_avoir&"|args:$_GET.immo_doc_id}} {{/if}} +{{*:redirect to="details_immo.html?immo_doc_id=%s&ok=1&msg=detach&"|args:$_GET.immo_doc_id*}} diff --git a/details_immo.html b/details_immo.html index ca3d93b..0896717 100644 --- a/details_immo.html +++ b/details_immo.html @@ -31,19 +31,25 @@ {{:admin_header title="Détails de l'immobilisation" custom_css="./style.css" current="module_amortization"}} +{{* {{if ! $dialog}} {{:assign subsubcurrent=null}} - {{if $total_amort == 0}} + {{if $total_credits == 0 && $total_amort == 0}} {{:assign subsubcurrent="credit"}} {{/if}} + {{if $total_amort == 0}} + {{:assign subsubcurrent=$subsubcurrent|cat:"-modif"}} + {{/if}} {{:include file="_nav.html" current="index" subcurrent="details" subsubcurrent=$subsubcurrent}} {{/if}} +*}} {{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$ligne_immo.trans_id}} -{{* -*}} {{if $_GET.ok}} {{if $_GET.msg|match:"attach_amort"}} @@ -91,9 +96,7 @@{{$msg}}
-{{/if}} -| N° | Date | Libellé | Montant | -N° compte | -Compte | {{#foreach from=$linked_immos item="line"}} {{:assign url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.trans_id}} - {{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$line.account_id:$line.year}} |
| #{{$line.trans_id}} | {{$line.date|date_short}} | {{$line.label}} | {{"%f"|math:$line.amount|money_currency_html:false|raw}} | -{{$line.account_code}} | -{{$line.account_label}} | {{:linkbutton label="Détacher" href="detach_credit.html?immo_doc_id=%s&credit_line_id=%s&from=exit"|args:$_GET.immo_doc_id:$line.credit_line_id shape="minus"}} | @@ -186,13 +173,9 @@ {{/foreach}}
- Vous pouvez attacher une ou plusieurs écritures d'avoir à votre immobilisation -
{{else}}- Aucune écriture au crédit du compte d'immobilisation ; vous pouvez passer à la suite + Vous pouvez attacher une ou plusieurs écritures d'avoir à votre immobilisation
{{/if}} diff --git a/exit_step2.html b/exit_step2.html index 699b947..72deafe 100644 --- a/exit_step2.html +++ b/exit_step2.html @@ -1,16 +1,18 @@ {{* -*- brindille -*- *}} {{* - Associer les différentes écritures à une immo créée et sortie du - bilan avant la mise en service du module + Associer les différentes écritures à une immo créée avant la mise + en service du module et sortie du bilan @param immo_doc_id : id du doc associé à l'immobilisation *}} {{* données de l'immobilisation *}} -{{:include file="_get_immo_data.html" immo_doc_id=$_GET.immo_doc_id keep="info_immo, ligne_immo, message"}} +{{:include file="_get_immo_data.html" immo_doc_id=$_GET.immo_doc_id keep="ligne_immo, message"}} {{if $message != null}} {{:error message=$message}} {{/if}} +{{* voir si un document a été associé à l'immo *}} +{{#load id=$ligne_immo.line_id assign="info_immo"}}{{/load}} {{#form on="backward"}} {{:redirect to="exit_step1.html?immo_doc_id=%s"|args:$_GET.immo_doc_id}} @@ -35,6 +37,44 @@ {{* lister les amortissements liés à l'immobilisation *}} {{:include file="./_get_amort_lines.html" immo_doc_id=$_GET.immo_doc_id keep="linked_amort, total_amort"}} +{{* + chercher des écritures au crédit du compte de l'immo sans doc associé + - line.credit < ligne_immo.amount => peut-être un avoir + - line.credit = ligne_immo.amount - avoirs => écriture de sortie du bilan +*}} +{{#select + trans.id as trans_id, + trans.label as trans_label, + trans.date as date, + trans.id_year as year, + line.id as credit_line_id, + line.label as line_label, + line.credit as amount, + 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 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 + acc.code = :acc_code + AND line.credit > 0 + AND credit_line_id NOT IN ( + SELECT json_extract(link.document, '$.credit_line_id') AS line_id FROM !table as link + WHERE json_extract(link.document, '$.type') == "credit_link") + ; + :acc_code=$ligne_immo.account_code + !table =$module.table + assign="credit_line" + }} + {{if $credit_line.amount < $solde}} + {{:assign var="credit_lines." value=$credit_line}} + {{elseif $credit_line.amount == $solde}} + {{:assign var="exit_lines." value=$credit_line}} + {{/if}} +{{/select}} + {{* déterminer le compte d'amortissement en fonction du compte d'immobilisation *}} {{:include file="./_get_amort_code.html" @@ -92,15 +132,6 @@ {{:admin_header title="Immobilisation sortie du bilan" custom_css="./style.css" current="module_amortization"}} -{{if $_GET.ok}} - {{if $_GET.msg|match:"attach_amort"}} - {{:assign msg="Écriture d'amortissement attachée"}} - {{elseif $_GET.msg|match:"detach_amort"}} - {{:assign msg="Écriture d'amortissement détachée"}} - {{/if}} -{{$msg}}
-{{/if}} -- Vous pouvez attacher une ou plusieurs écritures d'amortissement à l'immobilisation -
{{else}}- Aucune écriture d'amortissement à rattacher ; vous pouvez passer à la suite + Vous pouvez attacher une ou plusieurs écritures d'amortissement à votre immobilisation
{{/if}} +| #{{$line.amort_trans_id}} | {{$line.date|date_short}} | -- {{if $line.line_label != null}} - {{$line.line_label}} - {{if $line.trans_label != $line.line_label}} - — {{$line.trans_label}} - {{/if}} - {{else}} - {{$line.trans_label}} - {{/if}} -{{* - {{$line.trans_label}} + | {{$line.trans_label}} {{if $line.line_label != null && $line.line_label != $line.trans_label}} — {{$line.line_label}}{{/if}} -*}} | {{"%f"|math:$line.amort_amount|money_html:false|raw}} | {{$line.account_code}} | diff --git a/exit_step3.html b/exit_step3.html index 671b415..045cdc5 100644 --- a/exit_step3.html +++ b/exit_step3.html @@ -1,11 +1,15 @@ {{* -*- brindille -*- *}} {{* - Associer les différentes écritures à une immo créée et sortie du - bilan avant la mise en service du module + Associer les différentes écritures à une immo créée avant la mise + en service du module et sortie du bilan @param immo_doc_id : id du doc associé à l'immobilisation *}} +{{* + TODO : affichage après attachement écriture sortie bilan (ligne attachée, bouton détacher) +*}} + {{* données de l'immobilisation *}} {{:include file="_get_immo_data.html" immo_doc_id=$_GET.immo_doc_id keep="info_immo, ligne_immo, message"}} {{if $message != null}} @@ -25,10 +29,6 @@ {{:redirect to="index.html?type_immo=archived"}} {{/form}} -{{#form on="finish"}} - {{:redirect to="index.html?type_immo=managed"}} -{{/form}} - {{:assign label_immo=$info_immo.label|or:$ligne_immo.trans_label}} {{if $ligne_immo.line_label != null && $ligne_immo.line_label != $label_immo}} {{:assign label_immo=$label_immo|cat:" — "|cat:$ligne_immo.line_label}} @@ -68,11 +68,11 @@ {{/select}} {{/if}} +{{* chercher des écritures au crédit du compte de l'immo sans doc associé *}} {{* - chercher des écritures au crédit du compte de l'immo sans doc associé - - 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 => peut-être un avoir + - line.credit = ligne_immo.amount - avoirs => écriture de sortie du bilan + *}} {{#select trans.id as trans_id, trans.label as trans_label, @@ -103,7 +103,9 @@ !table =$module.table assign="credit_line" }} - {{if $credit_line.amount == $solde}} + {{if $credit_line.amount < $solde}} + {{:assign var="credit_lines." value=$credit_line}} + {{elseif $credit_line.amount == $solde}} {{:assign var="exit_lines." value=$credit_line}} {{/if}} {{/select}} @@ -231,9 +233,9 @@
- Vous pouvez attacher une écriture de sortie du bilan à l'immobilisation + Vous pouvez attacher une écriture de sortie du bilan à votre immobilisation
{{/if}} @@ -273,16 +275,14 @@ {{elseif $exit_line == null}} -Aucune écriture de sortie du bilan. Vérifiez l'attachement d'écriture d'avoir.
+Aucune écriture de sortie du bilan
{{/if}} diff --git a/link_immo.html b/link_immo.html index 77f5cd1..a05eab1 100644 --- a/link_immo.html +++ b/link_immo.html @@ -10,10 +10,6 @@ {{if $message != null}} {{:error message=$message}} {{/if}} -{{:assign label_immo=$ligne_immo.trans_label}} -{{if $ligne_immo.line_label != null && $ligne_immo.line_label != $label_immo}} - {{:assign label_immo=$label_immo|cat:" — "|cat:$ligne_immo.line_label}} -{{/if}} {{* lister les écritures au crédit du compte de l'immobilisation diff --git a/modify_infos.html b/modify_infos.html index 1b6d615..354b3f3 100644 --- a/modify_infos.html +++ b/modify_infos.html @@ -168,7 +168,7 @@ {{else}} {{:assign type_immo="other"}} {{/if}} - {{:redirect force="details_immo.html?immo_doc_id=%s&type_immo=%s&ok=1&msg=infos"|args:$_GET.immo_doc_id:$type_immo}} + {{:redirect force="index.html?ok=1&msg=infos&type_immo=%s"|args:$type_immo}} {{/form}} @@ -219,7 +219,6 @@ {{/if}} {{:input type="date" name="date_achat" label="Date d'acquisition" default=$info_immo.date_achat}} {{:input type="date" name="date_mes" label="Date de mise en service" default=$info_immo.date_mes}} -{{* {{if $linked_immos != null}}