@@ -32,8 +23,9 @@
{{* lister les immobilisations *}}
{{:read file="./defaut.json" assign="config_json"}}
{{:assign config_defaut=$config_json|json_decode}}
+ {{:assign var="prefix_array" value=$config_defaut.prefixes|keys}}
{{:assign condition="("}}
- {{#foreach from=$config_defaut.prefixes item="code"}}
+ {{#foreach from=$prefix_array item="code"}}
{{:assign code=$code|cat:"%"|quote_sql}}
{{:assign condition=$condition|cat:" account.code LIKE "|cat:$code|cat:" OR "}}
{{/foreach}}
@@ -60,21 +52,14 @@
}}
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$trans_id}}
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$account_id:$trans_id_year}}
-
{{* voir si l'immo est prise en charge *}}
{{#load type="immo" where="$$.line = :line_id" :line_id=$immo_id|intval}}
{{:assign status=$status}}
{{else}}
- {{:assign status="unknown"}}
+ {{:assign status="nsp"}}
{{/load}}
- {{if $_POST.unhide == null}}
- {{if $status != "unknown"}}
- {{:continue}}
- {{/if}}
- {{else}}
- {{if $status != "ignored" && $status != "unknown"}}
- {{:continue}}
- {{/if}}
+ {{if $status != "ignored" && $status != "nsp"}}
+ {{:continue}}
{{/if}}
{{* voir s'il existe des écritures d'amortissement associées *}}
@@ -102,7 +87,7 @@
account.code LIKE '28%';
:line_id = $immo_id|intval
}}
- {{if $amort_amount != null}}
+ {{if $status == "nsp" && $amort_amount != null}}
{{:assign ignore=true}}
{{else}}
{{:assign ignore=false}}
@@ -122,24 +107,24 @@
{{$account_code}}
{{$account_label}}
- {{if $status == "unknown"}}
+ {{if $status == "nsp"}}
{{:linkbutton
label="Paramètres"
- href="add_infos.html?immo_id=%s&type_immo=other"|args:$immo_id
+ href="add_infos.html?immo_id=%s&amort=0&op=new&type_immo=autre"|args:$immo_id
shape="settings"
target="_dialog"
}}
{{else}}
{{:linkbutton
label="Paramètres"
- href="add_infos.html?immo_id=%s&type_immo=other"|args:$immo_id
+ href="add_infos.html?immo_id=%s&amort=0&op=modif&type_immo=autre"|args:$immo_id
shape="settings"
target="_dialog"
}}
{{/if}}
{{:linkbutton
label="Amortissements"
- href="amortization.html?immo_id=%s&type_immo=other"|args:$immo_id
+ href="amortization.html?immo_id=%s&type_immo=autre"|args:$immo_id
shape="table"
}}
@@ -151,15 +136,3 @@
Aucune immobilisation
{{/if}}
-
-
diff --git a/_nav.html b/_nav.html
index 517cc4d..1ef59e0 100644
--- a/_nav.html
+++ b/_nav.html
@@ -1,35 +1,38 @@
{{* -*- brindille -*- *}}
- {{if $current == "index" && $subsubcurrent == null}}
+ {{if $current == 'index' && $subsubcurrent == null}}
{{:linkbutton label="Ajouter une immobilisation" shape="plus" href="add_asset.html" target="_dialog"}}
- {{elseif $subsubcurrent == "amortization" && $type_immo == null || $type_immo == "managed" || $type_immo == "other"}}
-
- {{if $autres_amort != null}}
- {{:linkbutton label="Rattacher une écriture" href="other_amortizations.html?immo_id=%s"|args:$_GET.immo_id shape="link" target="_dialog"}}
- {{/if}}
- {{:linkbutton label="Enregistrer un amortissement" shape="plus"
- href="save_amort.html?immo_id=%s"|args:$_GET.immo_id target="_dialog"}}
-
{{/if}}
+{{*
+*}}
- {{if $subsubcurrent == "amortization"}}
+ {{if $current == 'index' && $subsubcurrent != 'balance_exit'}}
+{{* *}}
+
+ {{/if}}
+
+ {{if $subsubcurrent == 'amortization'}}
- {{elseif $subsubcurrent == "balance_exit"}}
-
- Sortie de bilan
+ {{elseif $subsubcurrent == 'balance_exit'}}
+{{*
+
+*}}
{{/if}}
diff --git a/add_asset.html b/add_asset.html
index 31ec3dc..db599db 100644
--- a/add_asset.html
+++ b/add_asset.html
@@ -2,6 +2,7 @@
{{:read file="./defaut.json" assign="config_json"}}
{{:assign config_defaut=$config_json|json_decode}}
+{{:assign var="prefix_array" value=$config_defaut.prefixes|keys}}
{{#years closed=false order="start_date" assign=years.}}
{{:assign ts_debut=$start_date|strtotime}}
@@ -73,7 +74,7 @@
file="_check_account.html"
account=$debit_account
chart_id=$selected_chart
- prefix_array=$config_defaut.prefixes
+ prefix_array=$prefix_array
keep="account_ok"
}}
@@ -116,9 +117,9 @@
status=$status
}}
{{if $_POST.amortir}}
- {{:assign type_immo="managed"}}
+ {{:assign type_immo="encours"}}
{{else}}
- {{:assign type_immo="other"}}
+ {{:assign type_immo="autre"}}
{{/if}}
{{:redirect force="index.html?ok=1&msg=immobilisation&type_immo=%s"|args:$type_immo}}
{{/form}}
@@ -137,7 +138,7 @@
{{:assign var="projects.%d"|args:$id value=$label}}
{{/select}}
-{{#foreach from=$config_defaut.prefixes item="code"}}
+{{#foreach from=$prefix_array item="code"}}
{{:assign var="pattern_array." value="%s*"|args:$code}}
{{/foreach}}
{{:assign var="patterns" value=$pattern_array|implode:"|"}}
diff --git a/add_infos.html b/add_infos.html
index a147948..455c690 100644
--- a/add_infos.html
+++ b/add_infos.html
@@ -2,17 +2,18 @@
{{*
@param immo_id
- @param type_immo : managed, amortized, archived, other
+ @param amort = 1 si immo amortissable, 0 si non
+ @param op = new ou modif
+ @param type_immo : encours, archive, fini, autre
*}}
-{{#load type="immo" assign="info_immo" where="$$.line = :line_id" :line_id=$_GET.immo_id|intval}}
-{{/load}}
+{{if $_GET.op == "modif"}}
+ {{#load type="immo" assign="info_immo" where="$$.line = :line_id" :line_id=$_GET.immo_id|intval}}
+ {{/load}}
+{{/if}}
{{* Traiter l'envoi du formulaire *}}
{{#form on="save"}}
- {{if $_POST.classify == null}}
- {{:error message="Vous devez choisir une action"}}
- {{/if}}
{{* chercher la date d'acquisition de l'immobilisation *}}
{{#select
@@ -25,7 +26,7 @@
}}
{{/select}}
- {{if $_POST.classify == "ignored"}}
+ {{if ! $_POST.amortir}}
{{* ne pas amortir *}}
{{:assign duration=0}}
{{:assign date_debut=$ligne_immo.date_achat|parse_date}}
@@ -38,20 +39,15 @@
{{:assign da=$ligne_immo.date_achat|date_short}}
{{:error message="Erreur : la date de mise en service (%s) ne peut être antérieure à la date d'acquisition (%s)"|args:$dd:$da}}
{{/if}}
- {{if $_POST.classify == "amortized"}}
- {{:assign duration=0}}
- {{:assign status="amortized"}}
- {{else}}
- {{:assign duration=$_POST.duree|intval}}
- {{if $duration <= 0}}
- {{:error message="Erreur : la durée d'amortissement doit être strictement positive"}}
- {{/if}}
- {{:assign status="managed"}}
+ {{:assign duration=$_POST.duree|intval}}
+ {{if $duration <= 0}}
+ {{:error message="Erreur : la durée d'amortissement doit être strictement positive"}}
{{/if}}
+ {{:assign status="managed"}}
{{/if}}
{{* enregistrer les infos de l'immobilisation *}}
- {{if $info_immo == null}}
+ {{if $_GET.op == "new"}}
{{:assign key=""|uuid}}
{{else}}
{{:assign key=$info_immo.key}}
@@ -66,8 +62,8 @@
status=$status
}}
- {{if $_POST.classify == "managed" || $_POST.classify == "amortized"}}
- {{:assign type_immo=$_POST.classify}}
+ {{if ! $_POST.amortir}}
+ {{:assign type_immo="autre"}}
{{else}}
{{:assign type_immo=$_GET.type_immo}}
{{/if}}
@@ -76,53 +72,40 @@
{{:form_errors}}
{{/form}}
-{{:admin_header title="Informations amortissement" custom_css=$custom_css current="module_amortissement"}}
+{{:admin_header title="Renseigner informations amortissement" custom_css=$custom_css current="module_amortissement"}}
{{* barre de navigation *}}
{{if ! $dialog}}
{{:include file="_nav.html" current="index"}}
{{/if}}
-{{if $info_immo == null}}
- {{:assign default=$_GET.type_immo}}
-{{else}}
- {{:assign default=$info_immo.status}}
-{{/if}}
-
-{{if $_GET.type_immo == "managed" || $_GET.type_immo == "amortized"}}
- {{:assign disabled=0}}
-{{else}}
+{{* renseigner ou modifier la date de mise en service et la durée d'amortissement *}}
+{{if $_GET.amort == 0}}
+ {{:assign checked=0}}
{{:assign disabled=1}}
+{{else}}
+ {{:assign checked=1}}
+ {{:assign disabled=0}}
{{/if}}
-{{*
- - classer l'immobilisation
- - renseigner ou modifier la date de mise en service et la durée d'amortissement
- *}}
- Immobilisation
- #{{$ligne_immo.trans_id}} {{$ligne_immo.label}}
+ Libellé
+ {{$ligne_immo.label}}
Montant
{{"%f"|math:$ligne_immo.montant|money_currency}}
Début d'amortissement
@@ -181,16 +135,6 @@
Durée
{{$duree}} ans
{{/if}}
- {{if $valeur_residuelle > 0}}
- Montant déjà amorti
- {{"%d-%d"|math:$ligne_immo.montant:$valeur_residuelle|money_currency:false}}
- Valeur résiduelle
- {{$valeur_residuelle|money_currency}}
- {{/if}}
- {{if $duree != null && $valeur_residuelle > 0}}
- Annuité estimée
- {{"%f/%d"|math:$ligne_immo.montant:$duree|money_currency}}
- {{/if}}
Amortissements enregistrés
@@ -241,15 +185,79 @@
Aucun amortissement enregistré pour cette immobilisation
{{/if}}
-{{if $_GET.type_immo == null || $_GET.type_immo != "amortized"}}
+{{if $_GET.type_immo == null || $_GET.type_immo != "fini"}}
{{* Autres amortissements non rattachés *}}
+ {{#select
+ line.id as l_id,
+ line.id_transaction as t_id,
+ line.credit as amort_amount,
+ line.label as l_label,
+ trans.date as t_date,
+ trans.label as t_label,
+ trans.id_year as amort_year,
+ account.id as account_id,
+ account.code as account_code,
+ account.label as account_label
+ FROM acc_transactions_lines AS line
+ INNER JOIN acc_accounts AS account ON account.id = line.id_account
+ INNER JOIN acc_transactions AS trans ON trans.id = line.id_transaction
+ INNER JOIN acc_years AS y ON y.id = trans.id_year
+ WHERE account.code LIKE "28%" AND credit > 0 AND (NOT trans.status & 16)
+ ORDER BY trans.date, trans.label;
+ assign=autre_amort
+ }}
+ {{#select
+ id_transaction,
+ id_related
+ FROM acc_transactions_links
+ WHERE id_transaction = :id_amort OR id_related = :id_amort;
+ :id_amort=$t_id
+ }}
+ {{else}}
+ {{:assign var="autres_amortissements." value=$autre_amort}}
+ {{/select}}
+ {{/select}}
{{if $autres_amortissements != null}}
-
- Il existe des écritures d'amortissement qui ne sont pas rattachés à une immobilisation !
- Utilisez le bouton « Attacher un amortissement » pour les afficher ; vous pourrez choisir d'en attacher certaines à cette immobilisation.
-
+
+ Amortissements non rattachés
+
+
+
+ N°
+ Date
+ Montant
+ Libellé
+ N° compte
+ Compte
+
+
+
+
+ {{#foreach from=$autres_amortissements item="line"}}
+ {{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.t_id}}
+ {{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$line.account_id:$line.amort_year}}
+
+ #{{$line.t_id}}
+ {{$line.t_date|date_short}}
+ {{"%f"|math:$line.amort_amount|money}}
+ {{if $line.l_label == null}}
+ {{$line.t_label}}
+ {{else}}
+ {{$line.l_label}}
+ {{/if}}
+
+ {{$line.account_code}}
+ {{$line.account_label}}
+
+ {{:linkbutton label="Attacher" href="attach_amort.html?amort_id=%d&immo_id=%d"|args:$line.l_id:$ligne_immo.immo_id shape="plus"}}
+
+
+ {{/foreach}}
+
+
+
{{/if}}
{{/if}}
{{:form_errors}}
diff --git a/attach_amort.html b/attach_amort.html
index 8680894..d2863df 100644
--- a/attach_amort.html
+++ b/attach_amort.html
@@ -53,4 +53,4 @@
assign_code="result_code"
transactions=$linked_transactions
}}
-{{:redirect force="amortization.html?immo_id=%s&ok=1&msg=attach&trans_id=%s"|args:$_GET.immo_id:$amort_id}}
+{{:redirect to="amortization.html?immo_id=%s&ok=1&msg=attach&trans_id=%s"|args:$_GET.immo_id:$amort_id}}
diff --git a/balance_sheet_exit.html b/balance_sheet_exit.html
index 3a56e4a..e4aadca 100644
--- a/balance_sheet_exit.html
+++ b/balance_sheet_exit.html
@@ -57,11 +57,7 @@
{{/select}}
{{if $amort_line.amort_number == 0}}
- {{if $info_immo.status == "amortized"}}
- {{:assign amort_amount=$ligne_immo.montant}}
- {{else}}
- {{:assign amort_amount=0}}
- {{/if}}
+ {{:assign amort_amount=0}}
{{else}}
{{:assign amort_amount=$amort_line.amort_amount}}
{{:assign date_debut=$amort_line.last_amort_date|strtotime}}
@@ -71,22 +67,19 @@
{{: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 qui englobent la date de début du prochain amortissement
*}}
{{:assign default_exit_date=""}}
-{{#years closed=false order="start_date" where=":debut <= end_date" :debut=$date_debut}}
+{{#years closed=false order="start_date" where="start_date <= :debut AND :debut <= end_date"
+ :debut=$date_debut assign=years.}}
{{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 ts_fin=$end_date|strtotime}}
{{:assign debut=$start_date|date_short}}
{{:assign fin=$end_date|date_short}}
{{:assign var="open_years.%d"|args:$id value=$label|cat:" (du "|cat:$debut|cat:" au "|cat:$fin|cat:")"}}
+ {{:assign var="years_data.%d"|args:$id value=$ts_debut|cat:" "|cat:$ts_fin}}
{{else}}
{{:error message="Aucun exercice ouvert pour enregistrer un amortissement"}}
{{/years}}
@@ -148,7 +141,6 @@ lister les exercices ouverts :
{{* vérifier que la date de sortie est située dans un exercice ouvert *}}
{{:assign ts_exit = $_POST.date_sortie|parse_date|strtotime}}
{{:assign ok=false}}
- {{:assign msg_amort=""}}
{{#foreach from=$years}}
{{if $id == $_POST.id_year}}
{{:assign selected_year=$id}}
@@ -157,20 +149,10 @@ lister les exercices ouverts :
{{:break}}
{{/if}}
{{/if}}
-
- {{* voir si des amortissements ont été oubliés *}}
- {{if $info_immo.status != "amortized" && $start_date|strtotime > $amort_line.last_amort_date|strtotime && $end_date|strtotime < $now}}
- {{:assign debut=$start_date|date_short}}
- {{:assign fin=$end_date|date_short}}
- {{:assign msg_amort=$msg_amort|cat:"\n"|cat:" - "|cat:$label|cat:" : du "|cat:$debut|cat:" au "|cat:$fin}}
- {{/if}}
{{/foreach}}
{{if ! $ok}}
{{:error message="La date choisie n'est pas dans l'exercice sélectionné !"}}
{{/if}}
- {{if $msg_amort != ""}}
- {{:error message="Vous devez d'abord enregistrer les amortissements des exercices suivants : %s"|args:$msg_amort}}
- {{/if}}
{{:redirect to="compute_exit_data.html?immo_id=%s&amort_amount=%s&year=%s&date_mes=%s&date_debut=%s&exit_date=%s&duree_amort=%s"|args:$_GET.immo_id:$amort_amount:$selected_year:$ts_mes:$ts_debut:$ts_exit:$duree_amort}}
{{/form}}
@@ -178,7 +160,7 @@ lister les exercices ouverts :
{{:admin_header title="Sortie de bilan" custom_css="./style.css" current="module_amortissement"}}
{{* barre de navigation *}}
{{if ! $dialog}}
- {{:include file="_nav.html" current="index" subcurrent="%s"|args:$_GET.type_immo subsubcurrent="balance_exit"}}
+ {{:include file="_nav.html" current="index" subcurrent="balance_exit"}}
{{/if}}
{{:form_errors}}
diff --git a/compute_exit_data.html b/compute_exit_data.html
index f046e77..6672a69 100644
--- a/compute_exit_data.html
+++ b/compute_exit_data.html
@@ -69,7 +69,7 @@
Date de mise en service
{{$_GET.date_mes|date:"d/m/Y"}}
{{/if}}
- {{if $_GET.duree_amort != null && $_GET.duree_amort != 0}}
+ {{if $_GET.duree_amort != null}}
Durée de l'amortissement
{{$_GET.duree_amort}} ans
{{/if}}
diff --git a/config.html b/config.html
deleted file mode 100644
index 6506ce9..0000000
--- a/config.html
+++ /dev/null
@@ -1,191 +0,0 @@
-{{* -*- brindille -*- *}}
-
-{{:admin_header title="Configuration" custom_css="./style.css" current="module_amortissement"}}
-{{* barre de navigation *}}
-{{:include file="_nav.html" current="config"}}
-{{if $_GET.ok == 1}}
- Configuration enregistrée.
-{{/if}}
-
-{{* lecture config (défaut ou enregistrée) *}}
-{{:include file="./_get_config.html" keep="config"}}
-
-{{#form on="save"}}
- {{:assign ok=0}}
- {{#foreach from=$_POST.immo_accounts item="line"}}
- {{:assign elem=$line|values}}
- {{:assign elem=$elem.0}}
- {{:assign var="fields" value=$elem|explode:" "}}
- {{:assign present=false}}
- {{* ne pas garder si préfixe d'un compte déjà présent *}}
- {{#foreach from=$account_codes item="code"}}
- {{:assign pos=$code|strpos:$fields.0}}
- {{if $pos !== false}}
- {{:assign present=true}}
- {{:break}}
- {{/if}}
- {{/foreach}}
- {{if ! $present}}
- {{:assign var="account_codes." value=$fields.0}}
- {{/if}}
- {{/foreach}}
-
- {{:save
- key="config"
- prefixes=$account_codes|sort
- }}
- {{:assign ok=1}}
-
- {{:redirect to="./config.html?ok=%d"|args:$ok}}
-{{/form}}
-
-{{* récupérer l'exercice courant *}}
-{{:assign var="selected_year" from="logged_user.preferences.accounting_year}}
-{{if $selected_year == null}}
- {{* sélectionner l'exercice le plus probable *}}
- {{#years closed=false order="start_date"}}
- {{:assign var="open_years.%d"|args:$id value=$label}}
- {{if $start_date|strtotime <= $now && $end_date|strtotime >= $now}}
- {{:assign selected_year=$id}}
- {{:break}}
- {{/if}}
- {{/years}}
-{{/if}}
-
-{{* libellés des comptes d'immobilisation *}}
-{{:assign condition="("}}
-{{#foreach from=$config.prefixes item="code"}}
- {{:assign code=$code|quote_sql}}
- {{:assign condition=$condition|cat:" account.code = "|cat:$code|cat:" OR "}}
-{{/foreach}}
-{{:assign condition=$condition|cat:"0)"}}
-{{:assign condition=$condition|cat:" AND year.id = %s"|args:$selected_year}}
-
-{{#select
- account.id as account_id,
- account.code,
- account.id_chart,
- account.label,
- year.label as year_label,
- chart.label as chart_label
- FROM acc_accounts AS account
- INNER JOIN acc_charts AS chart ON chart.id = account.id_chart
- INNER JOIN acc_years AS year ON year.id_chart = chart.id
- WHERE !condition
- ;
- !condition=$condition
- }}
- {{:assign var="accounts.%s"|args:$code label=$label id=$account_id}}
-{{/select}}
-
-Comptes d'immobilisation
-
-
-
-
-
-
diff --git a/defaut.json b/defaut.json
index 06771a5..5c00d9b 100644
--- a/defaut.json
+++ b/defaut.json
@@ -1,8 +1,8 @@
{
"tva": false,
- "prefixes": [
- "20",
- "21",
- "27"
- ]
+ "prefixes": {
+ "20": "Immobilisations incorporelles",
+ "21": "Immobilisations corporelles",
+ "27": "Immobilisations financières"
+ }
}
diff --git a/index.html b/index.html
index 27fd870..11373b9 100644
--- a/index.html
+++ b/index.html
@@ -1,22 +1,13 @@
{{* -*- brindille -*- *}}
+{{:admin_header title="Immobilisations et amortissements" custom_css="./style.css" current="module_amortization"}}
{{* barre de navigation *}}
{{if $_GET.type_immo == null}}
- {{:assign type_immo="managed"}}
+ {{:assign type_immo="encours"}}
{{else}}
{{:assign type_immo=$_GET.type_immo}}
{{/if}}
- {{if $type_immo == "managed"}}
- {{:admin_header title="Immobilisations en cours" custom_css="./style.css" current="module_amortization"}}
- {{elseif $type_immo == "amortized"}}
- {{:admin_header title="Immobilisations amorties" custom_css="./style.css" current="module_amortization"}}
- {{elseif $type_immo == "archived"}}
- {{:admin_header title="Immobilisations archivées" custom_css="./style.css" current="module_amortization"}}
- {{elseif $type_immo == "other"}}
- {{:admin_header title="Autres immobilisations" custom_css="./style.css" current="module_amortization"}}
- {{/if}}
-
{{:include file="_nav.html" current="index" subcurrent="%s"|args:$type_immo}}
{{if $_GET.ok}}
@@ -43,11 +34,11 @@
{{/select}}
{{/load}}
-{{if $type_immo == "other"}}
+{{if $type_immo == "autre"}}
{{:include file="_immobilisations_autres.html"}}
-{{elseif $type_immo == "archived"}}
+{{elseif $type_immo == "archive"}}
{{:include file="_archives.html"}}
-{{elseif $type_immo == "managed" || $type_immo == "amortized"}}
+{{elseif $type_immo == "encours" || $type_immo == "fini"}}
{{:include file="_immobilisations.html"}}
{{/if}}
diff --git a/other_amortizations.html b/other_amortizations.html
deleted file mode 100644
index 84d6eaa..0000000
--- a/other_amortizations.html
+++ /dev/null
@@ -1,112 +0,0 @@
-{{* -*- brindille -*- *}}
-
-{{*
- Lister les écritures d'amortissement indépendantes
- et proposer des les attacher à l'immo sélectionnée
- @param immo_id = id de la ligne d'immo
- *}}
-
-{{* récupérer les infos de l'immobilisation *}}
-{{#select
- line.id as immo_id,
- line.debit as montant,
- trans.id as trans_id,
- trans.label as label,
- trans.date
- FROM acc_transactions_lines AS line
- INNER JOIN acc_transactions AS trans ON line.id_transaction = trans.id
- WHERE line.id = :line_id;
- :line_id = $_GET.immo_id|intval
- assign=ligne_immo
- }}
-{{else}}
- {{:error message="Immobilisation %s non trouvée"|args:$_GET.immo_id}}
-{{/select}}
-
-{{#select
- line.id as l_id,
- line.id_transaction as t_id,
- line.credit as amort_amount,
- line.label as l_label,
- trans.date as t_date,
- trans.label as t_label,
- trans.id_year as amort_year,
- account.id as account_id,
- account.code as account_code,
- account.label as account_label
- FROM acc_transactions_lines AS line
- INNER JOIN acc_accounts AS account ON account.id = line.id_account
- INNER JOIN acc_transactions AS trans ON trans.id = line.id_transaction
- INNER JOIN acc_years AS y ON y.id = trans.id_year
- WHERE account.code LIKE "28%" AND credit > 0 AND (NOT trans.status & 16)
- ORDER BY trans.date, trans.label;
- assign=autre_amort
-}}
- {{#select
- id_transaction,
- id_related
- FROM acc_transactions_links
- WHERE id_transaction = :id_amort OR id_related = :id_amort;
- :id_amort=$t_id
- }}
- {{else}}
- {{:assign var="autres_amortissements." value=$autre_amort}}
- {{/select}}
-{{/select}}
-
-{{:admin_header title="Amortissements non rattachés" custom_css="./style.css" current="module_amortissement"}}
-
-{{* barre de navigation *}}
-{{if ! $dialog}}
- {{:include
- file="_nav.html"
- current="index"
- subcurrent="other"
- subsubcurrent="amortization"
- type_immo="other"
- autres_amort=$autres_amortissements
-}}
-{{/if}}
-
-{{if $autres_amortissements != null}}
-
- Immobilisation « {{$ligne_immo.label}} »
-
-
-
- N°
- Date
- Montant
- Libellé
- N° compte
- Compte
-
-
-
-
- {{#foreach from=$autres_amortissements item="line"}}
- {{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.t_id}}
- {{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$line.account_id:$line.amort_year}}
-
- #{{$line.t_id}}
- {{$line.t_date|date_short}}
- {{"%f"|math:$line.amort_amount|money}}
- {{if $line.l_label == null}}
- {{$line.t_label}}
- {{else}}
- {{$line.l_label}}
- {{/if}}
-
- {{$line.account_code}}
- {{$line.account_label}}
-
- {{:linkbutton label="Attacher" href="attach_amort.html?amort_id=%d&immo_id=%d"|args:$line.l_id:$_GET.immo_id shape="plus"}}
-
-
- {{/foreach}}
-
-
-
-{{/if}}
-{{:form_errors}}
-{{:admin_footer}}
diff --git a/save_amort.html b/save_amort.html
index 7ad6b50..1c9df59 100644
--- a/save_amort.html
+++ b/save_amort.html
@@ -149,7 +149,8 @@
*}}
{{:read file="./defaut.json" assign="config_json"}}
{{:assign config_defaut=$config_json|json_decode}}
- {{#foreach from=$config_defaut.prefixes item="code"}}
+ {{:assign var="prefix_array" value=$config_defaut.prefixes|keys}}
+ {{#foreach from=$prefix_array item="code"}}
{{* déterminer le numéro du compte d'amortissement associé au compte d'immobilisation *}}
{{:include
file="./_get_amort_code.html"
@@ -213,7 +214,7 @@
{{* barre de navigation *}}
{{if ! $dialog}}
- {{:include file="_nav.html" current="index" subcurrent="managed" subsubcurrent="amortization"}}
+ {{:include file="_nav.html" current="index" subcurrent="encours" subsubcurrent="amortization"}}
{{/if}}
{{:form_errors}}
@@ -253,7 +254,7 @@
{{:input
type="list"
name="credit_account"
- label="Compte d'amortissement (28xx)"
+ label="Compte d'amortissement (280xx ou 281xx)"
required=true
target="!acc/charts/accounts/selector.php?codes=%s&id_year=%d"|args:"28*":$selected_year
default=$credit_account
diff --git a/schema.json b/schema.json
index 4279385..ea8e31c 100644
--- a/schema.json
+++ b/schema.json
@@ -21,7 +21,7 @@
},
"status" : {
"type" : ["string", "null"],
- "enum" : ["managed", "amortized", "archived", "ignored"]
+ "enum" : ["managed", "archived", "ignored"]
}
},
"required": ["type", "line", "duration", "date"]
diff --git a/scripts.js b/scripts.js
index 3d91074..232df76 100644
--- a/scripts.js
+++ b/scripts.js
@@ -139,21 +139,3 @@ function setSelectorYear(button_names, f_years_selector) {
const selected_year = document.getElementById(f_years_selector).value;
setAccountYear(button_names, selected_year);
}
-
-// config : gestion des ajouts/suppression comptes immo
-
-function initLine(row) {
- var removeBtn = row.querySelector('button[name="remove_line"]');
- removeBtn.onclick = () => {
- var count = $('.transaction-lines tbody tr').length;
- var min = removeBtn.getAttribute('min');
-
- if (count <= min) {
- alert("Il n'est pas possible d'avoir moins de " + min + " compte(s).");
- return false;
- }
-
- row.parentNode.removeChild(row);
- return true;
- };
-}
diff --git a/style.css b/style.css
index fd1cbfb..c9c23f9 100644
--- a/style.css
+++ b/style.css
@@ -41,7 +41,3 @@ h2[class="aide"], h3[class="aide"] {
nav.amort aside {
margin-top : 0;
}
-
-.describe dt::after {
- content: ' :';
-}
diff --git a/write_exit.html b/write_exit.html
index 9d0b553..023fb14 100644
--- a/write_exit.html
+++ b/write_exit.html
@@ -260,7 +260,7 @@
}}
{{/if}}
- {{:redirect to="index.html?type_immo=archived"}}
+ {{:redirect to="index.html?type_immo=archive"}}
{{/form}}
{{:admin_header title="Sortie du bilan" custom_css="./style.css" current="module_amortissement"}}
@@ -311,8 +311,9 @@
{{:read file="./defaut.json" assign="config_json"}}
{{:assign config_defaut=$config_json|json_decode}}
+{{:assign var="prefix_array" value=$config_defaut.prefixes|keys}}
-{{#foreach from=$config_defaut.prefixes item="code"}}
+{{#foreach from=$prefix_array item="code"}}
{{:assign var="pattern_array." value="%s*"|args:$code}}
{{/foreach}}
{{:assign patterns=$pattern_array|implode:"|"}}