Correction erreur conversion montant saisi
This commit is contained in:
parent
d6fd5b4047
commit
b74ef8ae9c
3 changed files with 19 additions and 12 deletions
|
|
@ -77,15 +77,14 @@
|
||||||
{{:assign libelle=$_POST.libelle}}
|
{{:assign libelle=$_POST.libelle}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{if $_POST.montant == null || $_POST.montant|intval == 0 }}
|
{{if $_POST.montant == null || $_POST.montant|money_int == 0 }}
|
||||||
{{if $montant_affecte > 0}}
|
{{if $montant_affecte > 0}}
|
||||||
{{:assign montant=$reste}}
|
{{:assign montant=$reste}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign montant=null}}
|
{{:assign montant=null}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign montant=$_POST.montant|intval}}
|
{{:assign montant=$_POST.montant|money_int}}
|
||||||
{{:assign montant="%d*100"|math:$montant}}
|
|
||||||
{{if $montant == $reste}}
|
{{if $montant == $reste}}
|
||||||
{{:assign montant=null}}
|
{{:assign montant=null}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
||||||
|
|
@ -76,8 +76,7 @@
|
||||||
{{:assign saved_amount=$reste}}
|
{{:assign saved_amount=$reste}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign montant_amort=$_POST.montant|floatval}}
|
{{:assign montant_amort=$_POST.montant|money_int}}
|
||||||
{{:assign montant_amort="%f*100"|math:$montant_amort}}
|
|
||||||
{{if $montant_amort > $reste}}
|
{{if $montant_amort > $reste}}
|
||||||
{{:assign reste_nb="%f"|math:$reste|money_currency:false}}
|
{{:assign reste_nb="%f"|math:$reste|money_currency:false}}
|
||||||
{{:error message="Le montant de l'amortissement ne peut être supérieur au reste (%s)"|args:$reste_nb}}
|
{{:error message="Le montant de l'amortissement ne peut être supérieur au reste (%s)"|args:$reste_nb}}
|
||||||
|
|
@ -85,7 +84,7 @@
|
||||||
{{if $montant_amort == $amort_line.amount}}
|
{{if $montant_amort == $amort_line.amount}}
|
||||||
{{:assign saved_amount=null}}
|
{{:assign saved_amount=null}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign saved_amount=$montant_amort|intval}}
|
{{:assign saved_amount=$montant_amort}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@
|
||||||
{{/select}}
|
{{/select}}
|
||||||
{{:assign credit_trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$credit_line.credit_trans_id}}
|
{{:assign credit_trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$credit_line.credit_trans_id}}
|
||||||
|
|
||||||
|
{{* montant de l'écriture de crédit déjà affecté *}}
|
||||||
{{:assign montant_affecte=0}}
|
{{:assign montant_affecte=0}}
|
||||||
{{#load type="immo_link" assign="linked_immo."
|
{{#load type="immo_link" assign="linked_immo."
|
||||||
where="$$.credit_line_id = :credit_line_id"
|
where="$$.credit_line_id = :credit_line_id"
|
||||||
|
|
@ -61,16 +62,24 @@
|
||||||
|
|
||||||
{{* Traiter l'envoi du formulaire *}}
|
{{* Traiter l'envoi du formulaire *}}
|
||||||
{{#form on="save"}}
|
{{#form on="save"}}
|
||||||
{{* vérifier que le montant est inférieur au reste *}}
|
{{* vérifier que le montant saisi est inférieur au reste *}}
|
||||||
{{if $_POST.montant == null}}
|
{{if $_POST.montant == null}}
|
||||||
{{:assign montant_credit=null}}
|
{{if $montant_affecte == 0}}
|
||||||
|
{{:assign saved_credit=null}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign montant_credit=$_POST.montant|floatval}}
|
{{:assign saved_credit=$reste}}
|
||||||
{{:assign montant_credit="%f*100"|math:$montant_credit}}
|
{{/if}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign montant_credit=$_POST.montant|money_int}}
|
||||||
{{if $montant_credit > $reste}}
|
{{if $montant_credit > $reste}}
|
||||||
{{:assign reste_nb="%f"|math:$reste|money_currency:false}}
|
{{:assign reste_nb="%f"|math:$reste|money_currency:false}}
|
||||||
{{:error message="Le montant de l'avoir ne peut être supérieur au reste (%s)"|args:$reste_nb}}
|
{{:error message="Le montant de l'avoir ne peut être supérieur au reste (%s)"|args:$reste_nb}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{if $montant_credit == $credit_line.amount}}
|
||||||
|
{{:assign saved_credit=null}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign saved_credit=$montant_credit}}
|
||||||
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{* chercher les liaisons de l'écriture d'immobilisation *}}
|
{{* chercher les liaisons de l'écriture d'immobilisation *}}
|
||||||
|
|
@ -108,7 +117,7 @@
|
||||||
type="immo_link"
|
type="immo_link"
|
||||||
immo_doc_id=$_GET.immo_doc_id|intval
|
immo_doc_id=$_GET.immo_doc_id|intval
|
||||||
credit_line_id=$_GET.credit_line_id|intval
|
credit_line_id=$_GET.credit_line_id|intval
|
||||||
amount=$montant_credit|intval
|
amount=$saved_credit
|
||||||
}}
|
}}
|
||||||
|
|
||||||
{{:redirect force="details_immo.html?immo_doc_id=%s&ok=1&msg=attach_immo"|args:$_GET.immo_doc_id}}
|
{{:redirect force="details_immo.html?immo_doc_id=%s&ok=1&msg=attach_immo"|args:$_GET.immo_doc_id}}
|
||||||
|
|
@ -143,7 +152,7 @@
|
||||||
<form method="post" action="" data-focus="1">
|
<form method="post" action="" data-focus="1">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<dl>
|
<dl>
|
||||||
{{:input type="money" name="montant" label="Montant" help="Montant de l'avoir ; à renseigner uniquement si différent du montant de l'écriture"}}
|
{{:input type="money" name="montant" label="Montant" default=$reste help="Montant de l'avoir"}}
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<p class="submit">
|
<p class="submit">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue