diff --git a/add_asset.html b/add_asset.html
index a8f3ab4..baa3071 100644
--- a/add_asset.html
+++ b/add_asset.html
@@ -40,7 +40,7 @@
duration=$_POST.duree|intval
}}
- {{:redirect to="index.html?ok=1"}}
+ {{:redirect to="index.html?ok=1&msg=immobilisation"}}
{{/form}}
{{* Préparer les infos pour le formulaire *}}
diff --git a/amortization.html b/amortization.html
index 3882e34..796a579 100644
--- a/amortization.html
+++ b/amortization.html
@@ -1,13 +1,20 @@
{{* -*- brindille -*- *}}
-{{:admin_header title="Gestion des amortissements" custom_css=$custom_css current="module_amortissement"}}
+
+{{:admin_header title="Liste des amortissements" custom_css="./style.css" current="module_amortissement"}}
{{* barre de navigation *}}
{{:include file="_nav.html" current="amortization"}}
+{{if $_GET.ok}}
+
Amortissement enregistré
+{{elseif $_GET.err}}
+ Échec enregistrement amortissement
+{{/if}}
+
{{* récupérer les infos de l'immobilisation *}}
-{{#load type="immo" assign="info_immo" where="$$.line = :line_id" :line_id=$_GET.line|intval}}
+{{#load type="immo" assign="info_immo" where="$$.line = :line_id" :line_id=$_GET.line_id|intval}}
{{else}}
- {{:assign message="Immobilisation %s non trouvée"|args:$_GET.line}}
+ {{:assign message="Pas d'info concernant l'immobilisation %s"|args:$_GET.line_id}}
{{:error message=$message}}
{{/load}}
@@ -27,12 +34,12 @@
inner join acc_years as y on trans.id_year = y.id
left join acc_projects AS project ON line.id_project = project.id
where line.id = :line_id;
- :line_id = $_GET.line|intval
+ :line_id = $_GET.line_id|intval
assign=ligne_immo
}}
Amortissement de « {{$label}} » d'un montant de {{"%f"|math:$montant|money_currency}} en date du {{$date_achat|date_short}} sur {{$info_immo.duration}} ans
{{else}}
- {{:assign message="Immobilisation %s non trouvée"|args:$_GET.line}}
+ {{:assign message="Immobilisation %s non trouvée"|args:$_GET.line_id}}
{{:error message=$message}}
{{/select}}
@@ -50,7 +57,7 @@
line2.id_project as project_id,
project.label as project_label,
trans.date as date_immo,
- acc.code as account_code,
+ acc.code as account_code,
acc.label as nom_compte,
acc.id_chart as PC
from acc_transactions_lines as line
@@ -64,7 +71,7 @@
:line_id = $info_immo.line|intval
assign=lines.
}}
- {{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$trans_id}}
+ {{*:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$trans_id*}}
{{/select}}
{{* calculer les amortissements *}}
@@ -167,11 +174,11 @@
{{if $all_years|keys|has:$current_year}}
{{:linkbutton
label="Enregistrer"
- href="save_amort.html?amount=%d&account=%s&year=%s&trans_id=%d&line_id=%s&project_id=%d&label=%s"|args:$annuite_courante:$ligne_immo.account_id:$current_year:$ligne_immo.trans_id:$_GET.line:$project_id:$libelle
+ href="save_amort.html?amount=%d&account=%s&year=%s&trans_id=%d&line_id=%s&project_id=%d&label=%s"|args:$annuite_courante:$ligne_immo.account_id:$current_year:$ligne_immo.trans_id:$_GET.line_id:$project_id:$libelle
shape="right"
}}
{{else}}
- {{:linkbutton label="Enregistrer" href="" shape="alert"}}
+ {{:linkbutton label="Enregistrer" href="" shape="lock" class="disabled"}}
{{/if}}
diff --git a/index.html b/index.html
index deb6981..7248e98 100644
--- a/index.html
+++ b/index.html
@@ -5,9 +5,14 @@
{{:include file="_nav.html" current="index"}}
{{if $_GET.ok}}
- Immobilisation enregistrée
+ {{if $_GET.msg|match:"immobilisation"}}
+ {{:assign msg="Immobilisation enregistrée"}}
+ {{elseif $_GET.msg|match:"durée"}}
+ {{:assign msg="Durée enregistrée"}}
+ {{/if}}
+ {{$msg}}
{{elseif $_GET.err}}
- Enregistrement immobilisation refusée
+ Échec enregistrement immobilisation
{{/if}}
{{* lister les immobilisations *}}
@@ -51,25 +56,40 @@
(account.code LIKE '21%' OR account.code LIKE '22%')
ORDER BY trans.date DESC
}}
- {{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$trans_id}}
- {{#load type="immo" assign="info_immo" where="$$.line = :line_id" :line_id=$line_id|intval}}{{/load}}
-
- #{{$trans_id}} |
- {{$trans_date|date_short}} |
- {{$trans_label}} |
- {{"%f"|math:$debit|money}} |
- {{$info_immo.duration}} |
- {{$account_code}} |
- {{$account_label}} |
- {{$project_label}} |
-
- {{:linkbutton
- label="Amortissements"
- href="amortization.html?line=%s"|args:$line_id
- shape="table"
- }}
- |
-
+ {{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$trans_id}}
+ {{#load type="immo" where="$$.line = :line_id" :line_id=$line_id|intval}}
+ {{*:debug info_immo=$info_immo*}}
+ {{:assign duration=$duration}}
+ {{else}}
+ {{:assign duration=null}}
+ {{/load}}
+ {{*:debug duration=$duration*}}
+
+ #{{$trans_id}} |
+ {{$trans_date|date_short}} |
+ {{$trans_label}} |
+ {{"%f"|math:$debit|money}} |
+ {{if $duration != null}}{{$duration}}{{/if}} |
+ {{$account_code}} |
+ {{$account_label}} |
+ {{$project_label}} |
+
+ {{if $duration == null}}
+ {{:linkbutton
+ label="Ajouter durée"
+ href="add_duration.html?line_id=%s"|args:$line_id
+ shape="help"
+ target="_dialog"
+ }}
+ {{else}}
+ {{:linkbutton
+ label="Amortissements"
+ href="amortization.html?line_id=%s"|args:$line_id
+ shape="table"
+ }}
+ {{/if}}
+ |
+
{{/select}}
diff --git a/save_amort.html b/save_amort.html
index eb2bcd2..eab83f9 100644
--- a/save_amort.html
+++ b/save_amort.html
@@ -39,7 +39,7 @@
linked_transactions=$_GET.trans_id|intval
}}
- {{:redirect to="amortization.html?line=%s"|args:$_GET.line_id}}
+ {{:redirect to="amortization.html?line_id=%s&ok=1"|args:$_GET.line_id}}
{{/form}}
{{* Préparer les infos pour le formulaire *}}