2024-02-27 10:14:52 +01:00
|
|
|
{{* -*- brindille -*- *}}
|
|
|
|
|
2024-12-17 15:34:46 +01:00
|
|
|
{{:admin_header title="Renseigner informations amortissement" custom_css=$custom_css current="module_amortissement"}}
|
2024-02-27 10:14:52 +01:00
|
|
|
|
|
|
|
{{* barre de navigation *}}
|
|
|
|
{{if ! $dialog}}
|
|
|
|
{{:include file="_nav.html" current="index"}}
|
|
|
|
{{/if}}
|
|
|
|
|
|
|
|
{{* Traiter l'envoi du formulaire *}}
|
|
|
|
{{#form on="add"}}
|
2024-12-17 15:34:46 +01:00
|
|
|
{{* chercher la date d'achat de l'immobilisation *}}
|
2024-03-14 11:03:54 +01:00
|
|
|
{{:assign var="immo_id" value=$_GET.immo_id|intval}}
|
2024-12-17 15:34:46 +01:00
|
|
|
{{#select
|
|
|
|
trans.date as date_achat
|
|
|
|
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 = $immo_id
|
|
|
|
assign=ligne_immo
|
|
|
|
}}
|
|
|
|
{{/select}}
|
|
|
|
|
|
|
|
{{* vérifier que la date d'acquisition est antérieure à la date de mise en service *}}
|
|
|
|
{{:assign date_debut=$_POST.date_mes|or:$ligne_immo.date_achat|parse_date}}
|
|
|
|
{{if $date_debut|strtotime < $ligne_immo.date_achat|strtotime}}
|
|
|
|
{{:assign dd=$date_debut|date_short}}
|
|
|
|
{{: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}}
|
|
|
|
|
2024-02-27 10:14:52 +01:00
|
|
|
{{:assign key=""|uuid}}
|
2024-12-17 15:34:46 +01:00
|
|
|
{{* enregistrer les infos de l'immobilisation *}}
|
2024-02-27 10:14:52 +01:00
|
|
|
{{:save
|
|
|
|
key=$key
|
|
|
|
validate_schema="schema.json"
|
|
|
|
type="immo"
|
2024-03-14 11:03:54 +01:00
|
|
|
line=$immo_id
|
2024-02-27 10:14:52 +01:00
|
|
|
duration=$_POST.duree|intval
|
2024-12-17 15:34:46 +01:00
|
|
|
date=$date_debut
|
2024-02-27 10:14:52 +01:00
|
|
|
}}
|
|
|
|
|
|
|
|
{{:redirect force="index.html?ok=1&msg=durée"}}
|
|
|
|
{{/form}}
|
|
|
|
|
2024-12-17 15:34:46 +01:00
|
|
|
{{* renseigner la date de mise en service et durée d'amortissement *}}
|
2024-02-27 10:14:52 +01:00
|
|
|
<form method="post" action="">
|
|
|
|
<fieldset class="ajout_duree">
|
2024-12-17 15:34:46 +01:00
|
|
|
<legend>Renseigner informations amortissement</legend>
|
2024-02-27 10:14:52 +01:00
|
|
|
<dl>
|
2024-12-17 15:34:46 +01:00
|
|
|
{{:input type="date" name="date_mes" label="Date de mise en service" help="à renseigner uniquement si différente de la date d'acquisition"}}
|
2024-02-27 10:14:52 +01:00
|
|
|
{{: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>
|
|
|
|
|
2024-12-17 15:34:46 +01:00
|
|
|
{{:form_errors}}
|
2024-02-27 10:14:52 +01:00
|
|
|
{{:admin_footer}}
|