Incorporation écritures comptes 23xx créées hors Paheko
This commit is contained in:
parent
f1738f2197
commit
54273c6707
6 changed files with 186 additions and 91 deletions
|
|
@ -1,5 +1,6 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{:admin_header title="Classer l'immobilisation" custom_css="./style.css" current="module_amortization"}}
|
||||
{{*
|
||||
Classer une immobilisation non prise en charge
|
||||
@param immo_line_id
|
||||
|
|
@ -53,12 +54,12 @@
|
|||
{{:assign status="ignored"}}
|
||||
{{elseif $_POST.classify == "archived"}}
|
||||
{{* voir s'il y a déjà un doc associé à cette immo *}}
|
||||
{{#load type="immo" where="$$.line = :immo_line_id" :immo_line_id=$_GET.immo_line_id|intval}}
|
||||
{{:assign uuid=$key}}
|
||||
{{:assign immo_doc_id=$id}}
|
||||
{{if $info_immo != null}}
|
||||
{{:assign uuid=$info_immo.key}}
|
||||
{{:assign immo_doc_id=$info_immo.id}}
|
||||
{{else}}
|
||||
{{:assign uuid=""|uuid}}
|
||||
{{/load}}
|
||||
{{/if}}
|
||||
|
||||
{{* immobilisation sortie du bilan *}}
|
||||
{{:save
|
||||
|
|
@ -71,7 +72,7 @@
|
|||
assign_new_id="immo_doc_id"
|
||||
}}
|
||||
{{:redirect force="exit_step1.html?immo_doc_id=%s&from=exit"|args:$immo_doc_id}}
|
||||
{{else}}
|
||||
{{elseif $_POST.classify == "managed"}}
|
||||
{{* immobilisation amortissable *}}
|
||||
{{if $_POST.date_achat|parse_date > $ligne_immo.date_achat}}
|
||||
{{:assign da=$ligne_immo.date_achat|date_short}}
|
||||
|
|
@ -124,12 +125,46 @@
|
|||
{{:assign montant_nb="%f"|math:$montant|money_currency:false}}
|
||||
{{:error message="Le montant (%s) ne peut être supérieur au reste (%s)"|args:$montant_nb:$reste_nb}}
|
||||
{{/if}}
|
||||
|
||||
{{:assign status="managed"}}
|
||||
{{elseif $_POST.classify == "unfinished"}}
|
||||
{{* immobilisation en cours de constitution *}}
|
||||
{{if $_POST.date_achat|parse_date > $ligne_immo.date_achat}}
|
||||
{{:assign da=$ligne_immo.date_achat|date_short}}
|
||||
{{:error message="Erreur : la date d'achat (%s) ne peut être postérieure à la date de l'écriture d'immobilisation (%s)"|args:$_POST.date_achat:$da}}
|
||||
{{/if}}
|
||||
|
||||
{{if $_POST.date_achat == null || $_POST.date_achat|parse_date == $ligne_immo.date_achat}}
|
||||
{{:assign date_achat=null}}
|
||||
{{else}}
|
||||
{{:assign date_achat=$_POST.date_achat|parse_date}}
|
||||
{{/if}}
|
||||
|
||||
{{if $_POST.libelle != $ligne_immo.line_label && $_POST.libelle != $ligne_immo.trans_label}}
|
||||
{{:assign libelle=$_POST.libelle}}
|
||||
{{/if}}
|
||||
|
||||
{{if $_POST.montant == null || $_POST.montant|money_int == 0 }}
|
||||
{{if $montant_affecte > 0}}
|
||||
{{:assign montant=$reste}}
|
||||
{{else}}
|
||||
{{:assign montant=null}}
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{:assign montant=$_POST.montant|money_int}}
|
||||
{{if $montant == $ligne_immo.montant}}
|
||||
{{:assign montant=null}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{if $montant > $reste}}
|
||||
{{:assign reste_nb="%f"|math:$reste|money_currency:false}}
|
||||
{{:assign montant_nb="%f"|math:$montant|money_currency:false}}
|
||||
{{:error message="Le montant (%s) ne peut être supérieur au reste (%s)"|args:$montant_nb:$reste_nb}}
|
||||
{{/if}}
|
||||
{{:assign status="inprogress"}}
|
||||
{{/if}}
|
||||
|
||||
{{* enregistrer les infos de l'immobilisation *}}
|
||||
{{if $info_immo == null || $montant_affecte > 0}}
|
||||
{{if $info_immo == null || $_POST.classify == "unfinished" || $montant_affecte > 0}}
|
||||
{{:assign key=""|uuid}}
|
||||
{{else}}
|
||||
{{:assign key=$info_immo.key}}
|
||||
|
|
@ -139,7 +174,7 @@
|
|||
validate_schema="asset.schema.json"
|
||||
type="immo"
|
||||
line=$_GET.immo_line_id|intval
|
||||
duration=$duration
|
||||
duration=0
|
||||
label=$libelle
|
||||
amount=$montant
|
||||
date_achat=$date_achat
|
||||
|
|
@ -149,13 +184,14 @@
|
|||
|
||||
{{if $_POST.classify == "managed"}}
|
||||
{{:assign type_immo="managed"}}
|
||||
{{elseif $_POST.classify == "unfinished"}}
|
||||
{{:assign type_immo="unfinished"}}
|
||||
{{else}}
|
||||
{{:assign type_immo="other"}}
|
||||
{{/if}}
|
||||
{{:redirect force="index.html?ok=1&msg=infos&type_immo=%s"|args:$type_immo}}
|
||||
{{/form}}
|
||||
|
||||
{{:admin_header title="Classer l'immobilisation" custom_css="./style.css" current="module_amortization"}}
|
||||
{{* barre de navigation *}}
|
||||
{{if ! $dialog}}
|
||||
{{:include file="_nav.html" current="other" subcurrent="parameter"}}
|
||||
|
|
@ -194,14 +230,19 @@
|
|||
<dd>{{$ligne_immo.code}} — {{$ligne_immo.account_label}}
|
||||
</dl>
|
||||
</div>
|
||||
{{:assign unfinished_prefix=$ligne_immo.code|strpos:"23"}}
|
||||
|
||||
<form method="post" action="">
|
||||
<fieldset>
|
||||
<legend>Classement</legend>
|
||||
<dl id="classement_immo">
|
||||
<dt><label>Faites un choix</label> <b>(obligatoire)</b></dt>
|
||||
{{:input type="radio-btn" name="classify" value="managed" label="Immobilisation à amortir" default=$choix_defaut}}
|
||||
{{if $ligne_immo.date_achat > $first_date}}
|
||||
{{if $unfinished_prefix === 0}}
|
||||
{{:input type="radio-btn" name="classify" value="unfinished" label="Immobilisation en cours de constitution" default=$choix_defaut}}
|
||||
{{else}}
|
||||
{{:input type="radio-btn" name="classify" value="managed" label="Immobilisation à amortir" default=$choix_defaut}}
|
||||
{{/if}}
|
||||
{{if $ligne_immo.date_achat > $first_date && $unfinished_prefix !== 0}}
|
||||
{{:input type="radio-btn" name="classify" value="archived" label="Immobilisation sortie du bilan" default=$choix_defaut}}
|
||||
{{/if}}
|
||||
{{:input type="radio-btn" name="classify" value="ignored" label="Immobilisation à ignorer" help="L'écriture n'apparaitra plus dans la liste des immobilisations" default=$choix_defaut}}
|
||||
|
|
@ -214,8 +255,10 @@
|
|||
{{:input type="date" name="date_achat" label="Date d'acquisition" default=$date_achat_defaut help="à modifier si nécessaire"}}
|
||||
{{:input type="text" name="libelle" label="Libellé" default=$immo_label help="à modifier si nécessaire"}}
|
||||
{{:input type="money" name="montant" label="Montant de l'immobilisation" required=true default=$reste help="à modifier si différent du montant de l'écriture d'immobilisation"}}
|
||||
{{:input type="number" name="duree" label="Durée d'amortissement" required=true min=1 suffix="année(s)"}}
|
||||
{{:input type="date" name="date_mes" label="Date de mise en service" default=$date_mes_defaut help="à modifier si différente de la date d'acquisition"}}
|
||||
{{if $unfinished_prefix !== 0}}
|
||||
{{:input type="number" name="duree" label="Durée d'amortissement" required=true min=1 suffix="année(s)"}}
|
||||
{{:input type="date" name="date_mes" label="Date de mise en service" default=$date_mes_defaut help="à modifier si différente de la date d'acquisition"}}
|
||||
{{/if}}
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
|
|
@ -234,7 +277,8 @@
|
|||
function toggleInputs(event) {
|
||||
const classement_immo = document.getElementById('classement_immo');
|
||||
const managed = classement_immo.querySelector('input[type=radio][value=managed]');
|
||||
if (managed.checked) {
|
||||
const unfinished = classement_immo.querySelector('input[type=radio][value=unfinished]');
|
||||
if ((managed != null && managed.checked) || (unfinished != null && unfinished.checked)) {
|
||||
g.toggle('.masquable', true);
|
||||
} else {
|
||||
g.toggle('.masquable', false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue