Mutualisation paramètres immo + rationalisation navigation
This commit is contained in:
parent
c096282f08
commit
ba17145837
10 changed files with 131 additions and 95 deletions
|
|
@ -1,23 +1,27 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{:admin_header title="Renseigner informations amortissement" custom_css=$custom_css current="module_amortissement"}}
|
||||
{{*
|
||||
@param immo_id
|
||||
@param amort = 1 si immo amortissable, 0 si non
|
||||
@param op = new ou modif
|
||||
@param type_immo : encours, archive, fini, autre
|
||||
*}}
|
||||
|
||||
{{* barre de navigation *}}
|
||||
{{if ! $dialog}}
|
||||
{{:include file="_nav.html" current="index"}}
|
||||
{{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="add"}}
|
||||
{{#form on="save"}}
|
||||
|
||||
{{* chercher la date d'acquisition de l'immobilisation *}}
|
||||
{{:assign var="immo_id" value=$_GET.immo_id|intval}}
|
||||
{{#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
|
||||
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
|
||||
assign=ligne_immo
|
||||
}}
|
||||
{{/select}}
|
||||
|
|
@ -43,28 +47,39 @@
|
|||
{{/if}}
|
||||
|
||||
{{* enregistrer les infos de l'immobilisation *}}
|
||||
{{:assign key=""|uuid}}
|
||||
{{if $_GET.op == "new"}}
|
||||
{{:assign key=""|uuid}}
|
||||
{{else}}
|
||||
{{:assign key=$info_immo.key}}
|
||||
{{/if}}
|
||||
{{:save
|
||||
key=$key
|
||||
validate_schema="schema.json"
|
||||
type="immo"
|
||||
line=$immo_id
|
||||
line=$_GET.immo_id|intval
|
||||
duration=$duration
|
||||
date=$date_debut
|
||||
status=$status
|
||||
}}
|
||||
|
||||
{{if $_POST.no_amort}}
|
||||
{{:assign amort="autres"}}
|
||||
{{:assign type_immo="autres"}}
|
||||
{{else}}
|
||||
{{:assign amort="encours"}}
|
||||
{{:assign type_immo=$_GET.type_immo}}
|
||||
{{/if}}
|
||||
{{:redirect force="index.html?ok=1&msg=infos&amort=%s"|args:$amort}}
|
||||
{{:redirect force="index.html?ok=1&msg=infos&type_immo=%s"|args:$type_immo}}
|
||||
{{else}}
|
||||
{{:form_errors}}
|
||||
{{/form}}
|
||||
|
||||
{{* renseigner la date de mise en service et durée d'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}}
|
||||
|
||||
{{* renseigner ou modifier la date de mise en service et la durée d'amortissement *}}
|
||||
{{if $_GET.amort == 0}}
|
||||
{{:assign checked=1}}
|
||||
{{:assign disabled=1}}
|
||||
|
|
@ -72,18 +87,30 @@
|
|||
{{:assign checked=0}}
|
||||
{{:assign disabled=0}}
|
||||
{{/if}}
|
||||
|
||||
<form method="post" action="">
|
||||
<fieldset id="infos_immo">
|
||||
<legend></legend>
|
||||
<dl>
|
||||
{{:input id="no_amort" type="checkbox" value=1 name="no_amort" label="Ne pas amortir" default=$checked help="Cocher pour ne pas amortir" onclick="toggleInputs('infos_immo','f_no_amort_1')"}}
|
||||
{{:input type="date" name="date_mes" label="Date de mise en service" disabled=$disabled help="à renseigner uniquement si différente de la date d'acquisition"}}
|
||||
{{:input type="number" name="duree" label="Durée d'amortissement" required=true min=1 default=1 disabled=$disabled}}
|
||||
{{if $checked}}
|
||||
{{:assign helptext = "Dé-cocher pour amortir"}}
|
||||
{{else}}
|
||||
{{:assign helptext = "Cocher pour ne pas amortir"}}
|
||||
{{/if}}
|
||||
{{:input id="no_amort" type="checkbox" value=1 name="no_amort" label="Ne pas amortir" default=$checked help=$helptext onclick="toggleInputs('infos_immo','f_no_amort_1')"}}
|
||||
{{if $info_immo != null}}
|
||||
{{:assign date_defaut=$info_immo.date}}
|
||||
{{:assign duree_defaut=$info_immo.duration}}
|
||||
{{else}}
|
||||
{{:assign duree_defaut=1}}
|
||||
{{/if}}
|
||||
{{:input type="date" name="date_mes" label="Date de mise en service" default=$date_defaut disabled=$disabled help="à renseigner uniquement si différente de la date d'acquisition"}}
|
||||
{{:input type="number" name="duree" label="Durée d'amortissement" default=$duree_defaut required=true min=1 disabled=$disabled}}
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<p class="submit">
|
||||
{{:button type="submit" name="add" label="Ajouter" shape="right" class="main"}}
|
||||
{{:button type="submit" name="save" label="Enregistrer" shape="right" class="main"}}
|
||||
</p>
|
||||
|
||||
</form>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue