Compare commits

...

4 Commits

8 changed files with 115 additions and 35 deletions

View File

@ -1,3 +1,4 @@
{{* -*- brindille -*- *}}
{{*
Calcule le nombre de jours entre deux dates
paramètres :

View File

@ -1,3 +1,4 @@
{{* -*- brindille -*- *}}
{{:admin_header title="Ajout immobilisation" current="module_amortissement"}}
{{* barre de navigation *}}
@ -39,8 +40,8 @@
duration=$_POST.duree|intval
}}
{{:redirect to="index.html?ok=1"}}
{{/form}}
{{:redirect to="index.html?ok=1&msg=immobilisation"}}
{{/form}}
{{* Préparer les infos pour le formulaire *}}

44
add_duration.html Normal file
View File

@ -0,0 +1,44 @@
{{* -*- brindille -*- *}}
{{:admin_header title="Renseigner durée amortissement" custom_css=$custom_css current="module_amortissement"}}
{{* barre de navigation *}}
{{if ! $dialog}}
{{:include file="_nav.html" current="index"}}
{{/if}}
{{* renseigner la durée d'amortissement *}}
<h2 class="ruler">Durée d'amortissement</h2>
{{* Traiter l'envoi du formulaire *}}
{{#form on="add"}}
{{* enregistrer les infos de l'immobilisation *}}
{{:assign var="line_id" value=$_GET.line_id|intval}}
{{:assign key=""|uuid}}
{{:save
key=$key
validate_schema="schema.json"
type="immo"
line=$line_id
duration=$_POST.duree|intval
}}
{{:redirect force="index.html?ok=1&msg=durée"}}
{{/form}}
<form method="post" action="">
<fieldset class="ajout_duree">
<legend>Renseigner durée amortissement</legend>
<dl>
{{:input type="number" name="duree" label="Durée d'amortissement" required=true default=1}}
</dl>
</fieldset>
<p class="submit">
{{:button type="submit" name="add" label="Ajouter" shape="right" class="main"}}
</p>
</form>
{{:admin_footer}}

View File

@ -1,12 +1,20 @@
{{:admin_header title="Gestion des amortissements" custom_css=$custom_css current="module_amortissement"}}
{{* -*- brindille -*- *}}
{{: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}}
<p class="block confirm">Amortissement enregistré</p>
{{elseif $_GET.err}}
<p class="block error">Échec enregistrement amortissement</p>
{{/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}}
@ -26,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
}}
<h2>Amortissement de « {{$label}} » d'un montant de {{"%f"|math:$montant|money_currency}} en date du {{$date_achat|date_short}} sur {{$info_immo.duration}} ans</h2>
{{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}}
@ -49,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
@ -63,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 *}}
@ -166,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}}
</td>
</tr>

View File

@ -1,12 +1,18 @@
{{* -*- brindille -*- *}}
{{:admin_header title="Gestion des amortissements" custom_css=$custom_css current="module_amortissement"}}
{{* barre de navigation *}}
{{:include file="_nav.html" current="index"}}
{{if $_GET.ok}}
<p class="block confirm">Immobilisation enregistrée</p>
{{if $_GET.msg|match:"immobilisation"}}
{{:assign msg="Immobilisation enregistrée"}}
{{elseif $_GET.msg|match:"durée"}}
{{:assign msg="Durée enregistrée"}}
{{/if}}
<p class="block confirm">{{$msg}}</p>
{{elseif $_GET.err}}
<p class="block error">Enregistrement immobilisation refusée</p>
<p class="block error">Échec enregistrement immobilisation</p>
{{/if}}
{{* lister les immobilisations *}}
@ -28,7 +34,7 @@
</tr>
</thead>
<tbody>
{{*
{{*
TODO améliorer cette requête : voir si assez général
*}}
@ -50,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}}
<tr>
<td class="num"><a href={{$trans_url}}>#{{$trans_id}}</a></td>
<td>{{$trans_date|date_short}}</td>
<td>{{$trans_label}}</td>
<td class="money">{{"%f"|math:$debit|money}}</td>
<td class="num">{{$info_immo.duration}}</td>
<td>{{$account_code}}</td>
<td>{{$account_label}}</td>
<td>{{$project_label}}</td>
<td class="actions">
{{:linkbutton
label="Amortissements"
href="amortization.html?line=%s"|args:$line_id
shape="table"
}}
</td>
</tr>
{{: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*}}
<tr>
<td class="num"><a href={{$trans_url}}>#{{$trans_id}}</a></td>
<td>{{$trans_date|date_short}}</td>
<td>{{$trans_label}}</td>
<td class="money">{{"%f"|math:$debit|money}}</td>
<td class="num">{{if $duration != null}}{{$duration}}{{/if}}</td>
<td>{{$account_code}}</td>
<td>{{$account_label}}</td>
<td>{{$project_label}}</td>
<td class="actions">
{{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}}
</td>
</tr>
{{/select}}
</tbody>
</table>

View File

@ -1,5 +1,5 @@
name="Gestion des amortissements"
description="Gestion des amortissements : ..."
description="Gestion des amortissements pour le logiciel de comptabilité Paheko"
author="Jean-Christophe Engel"
author_url="https://git.roflcopter.fr/lesanges"
home_button=false

View File

@ -1,3 +1,4 @@
{{* -*- brindille -*- *}}
{{:admin_header title="Ajout amortissement" current="module_amortissement"}}
{{* barre de navigation *}}
@ -38,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 *}}

4
style.css Normal file
View File

@ -0,0 +1,4 @@
.disabled {
pointer-events: none;
font-style : oblique;
}