Modif sur le module DigressivePrice : on rajoute 2 champs pour permettre la saisie des montants en TTC
This commit is contained in:
@@ -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',
|
||||
'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 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',
|
||||
);
|
||||
|
||||
@@ -18,14 +18,20 @@
|
||||
{form name="digressiveprice.delete"}
|
||||
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
|
||||
{/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">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{intl l="From" 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 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 with taxes" d="digressiveprice.bo.default"}</th>
|
||||
<th colspan="2"> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -37,6 +43,8 @@
|
||||
{form name="digressiveprice.update"}
|
||||
<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_field form=$form field="id"}
|
||||
@@ -66,19 +74,32 @@
|
||||
<td>
|
||||
{form_field form=$form field="price"}
|
||||
<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>
|
||||
{/form_field}
|
||||
</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>
|
||||
{form_field form=$form field="promo"}
|
||||
<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>
|
||||
{/form_field}
|
||||
</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}
|
||||
|
||||
<!-- Update -->
|
||||
@@ -167,4 +188,27 @@
|
||||
</table>
|
||||
</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}
|
||||
|
||||
Reference in New Issue
Block a user