Modif sur le module DigressivePrice : on rajoute 2 champs pour permettre la saisie des montants en TTC

This commit is contained in:
2021-05-04 16:33:21 +02:00
parent f14ae4efb5
commit 173ce6c1c4
2 changed files with 51 additions and 4 deletions

View File

@@ -20,5 +20,8 @@ return array(
'The end of range must be greater than the beginning' => 'La quantité de fin de tranche doit être inférieure à celle de début', 'The end of range must be greater than the beginning' => 'La quantité de fin de tranche doit être inférieure à celle de début',
'Your new range surrounds an existing one' => 'Votre tranche de quantités en englobe une autre', 'Your new range surrounds an existing one' => 'Votre tranche de quantités en englobe une autre',
'Your new range begins in another one' => 'Votre tranche de quantités débute dans une autre', 'Your new range begins in another one' => 'Votre tranche de quantités débute dans une autre',
'Your new range ends in another one' => 'Votre tranche de quantités se termine dans une autre' 'Your new range ends in another one' => 'Votre tranche de quantités se termine dans une autre',
'Price with taxes' => 'Prix TTC',
'Sale price with taxes' => 'Prix promo TTC',
); );

View File

@@ -19,13 +19,19 @@
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if} {if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
{/form} {/form}
{loop name="tax-loop" type="tax" country="64" tax_rule="{product attr="tax_rule_id"}"}
<input type="hidden" id="taux-tva" value="{$REQUIREMENTS.percent}">
{/loop}
<table class="table table-hover"> <table class="table table-hover">
<thead> <thead>
<tr> <tr>
<th>{intl l="From" d="digressiveprice.bo.default"}</th> <th>{intl l="From" d="digressiveprice.bo.default"}</th>
<th>{intl l="To" d="digressiveprice.bo.default"}</th> <th>{intl l="To" d="digressiveprice.bo.default"}</th>
<th>{intl l="Price w/o taxes" d="digressiveprice.bo.default"}</th> <th>{intl l="Price w/o taxes" d="digressiveprice.bo.default"}</th>
<th>{intl l="Price with taxes" d="digressiveprice.bo.default"}</th>
<th>{intl l="Sale price w/o taxes" d="digressiveprice.bo.default"}</th> <th>{intl l="Sale price w/o taxes" d="digressiveprice.bo.default"}</th>
<th>{intl l="Sale price with taxes" d="digressiveprice.bo.default"}</th>
<th colspan="2">&nbsp;</th> <th colspan="2">&nbsp;</th>
</tr> </tr>
</thead> </thead>
@@ -37,6 +43,8 @@
{form name="digressiveprice.update"} {form name="digressiveprice.update"}
<form action="{url path='/admin/module/DigressivePrice/update'}" class="form-inline" role="form" {form_enctype form=$form} method="post"> <form action="{url path='/admin/module/DigressivePrice/update'}" class="form-inline" role="form" {form_enctype form=$form} method="post">
{assign var="digressiveId" value="$ID"}
{form_hidden_fields form=$form} {form_hidden_fields form=$form}
{form_field form=$form field="id"} {form_field form=$form field="id"}
@@ -66,19 +74,32 @@
<td> <td>
{form_field form=$form field="price"} {form_field form=$form field="price"}
<span class="input-group"> <span class="input-group">
<input name="{$name}" value="{format_number number=$PRICE decimals="2" dec_point='.'}" class="form-control" type="text" required> <input name="{$name}" value="{format_number number=$PRICE decimals="8" dec_point='.'}" class="form-control" type="text" id="prix-ht-{$digressiveId}" required>
<span class="input-group-addon">{$SYMBOL}</span> <span class="input-group-addon">{$SYMBOL}</span>
</span> </span>
{/form_field} {/form_field}
</td> </td>
<td>
<span class="input-group">
<input id="prix-ttc-{$digressiveId}" name="prix-ttc" value="" class="form-control" type="text" required style="background-color:#95c11e" onchange="modifTTC({$digressiveId});">
<span class="input-group-addon">{$SYMBOL}</span>
</span>
</td>
<td> <td>
{form_field form=$form field="promo"} {form_field form=$form field="promo"}
<span class="input-group"> <span class="input-group">
<input name="{$name}" value="{format_number number=$PROMO_PRICE decimals="2" dec_point='.'}" class="form-control" type="text" required> <input name="{$name}" value="{format_number number=$PROMO_PRICE decimals="8" dec_point='.'}" class="form-control" type="text" id="prix-promo-ht-{$digressiveId}" required>
<span class="input-group-addon">{$SYMBOL}</span> <span class="input-group-addon">{$SYMBOL}</span>
</span> </span>
{/form_field} {/form_field}
</td> </td>
<td>
<span class="input-group">
<input id="prix-promo-ttc-{$digressiveId}" name="prix-promo-ttc" value="" class="form-control" type="text" required style="background-color:#95c11e" onchange="modifPromoTTC({$digressiveId});">
<span class="input-group-addon">{$SYMBOL}</span>
</span>
</td>
{/loop} {/loop}
<!-- Update --> <!-- Update -->
@@ -167,4 +188,27 @@
</table> </table>
</div> </div>
</div> </div>
<script>
function calculerHt(ttc) {
var tauxTva = parseFloat(document.getElementById('taux-tva').value);
return (ttc * 100) / (100 + tauxTva);
}
function modifTTC(id) {
var ttc = document.getElementById('prix-ttc-' + id).value;
var ht = calculerHt(ttc);
document.getElementById('prix-ht-' + id).value = ht;
}
function modifPromoTTC(id) {
var ttc = document.getElementById('prix-promo-ttc-' + id).value;
var ht = calculerHt(ttc);
document.getElementById('prix-promo-ht-' + id).value = ht;
}
</script>
{/if} {/if}