JavaScript - Calcular IVA ( impuesto )

 
Vista:
sin imagen de perfil

Calcular IVA ( impuesto )

Publicado por Ani (1 intervención) el 28/09/2017 01:27:59
hola,
Necesito ayuda, tengo un modulo en prestashop, para los productos.
que segun la cantidad me calcula el precio.
Me muestra el precio por unidad y el total del precio.
Ahora necesito que aparte del precio me muestre tambien el iva.

Como os digo es un modulo de prestashop, he leido mucho pero no logro que me sume el iva.
y que me muestre el precio total con iva incluido. No logro hacerlo.
os añado parte de el codigo que tengo.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//var price = this.priceAsFloat($('#our_price_display').html());
var price = $('#mppricedisc').val();
var newprice = parseFloat($('#mpprice').val());
var attrPrice = this.getAttrPrice(true);
var pricebase = newprice+attrPrice;
if(pricebase==0)
{
$('.our_price_display').hide();
return;
}
else
{
$('.our_price_display').show();
}
if($('#pretaxe_price_display').length>0)
{
var pricewt = pricebase/(1+(taxRate/100));
$('#pretaxe_price_display').html(_MP.displayPrice(pricewt,true));
}
 
var labelshowprice = this.displayPrice(pricebase,true)+this.after_price;
if(this.before_price!='')
labelshowprice = this.before_price+ ' '+ labelshowprice;
$('#our_price_display').html(labelshowprice);
if($('.mp_total_price').length)
$('.mp_total_price').html($('#our_price_display').html());
 
if($('#mp_total_price_IVA').length)
$('.mp_total_price_IVA').html($('#our_price_display').html());
if($('.old_price_display').length>0)
{
var pricedisc = this.priceAsFloat($('#old_price_display').html());
var newpricedisc = parseFloat($('#mppricedisc').val());
var pricebasedisc = newpricedisc+this.getAttrPrice(false);
 
var labelshowprice = this.displayPrice(pricebasedisc,true)+this.after_price;
$('#old_price_display').html(labelshowprice);
 
}
}
},



otro codigo en el mismo archivo .js

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{
 
var price = jsonData['price'];
var unitprice = jsonData['unitprice'];
var preutotaliva = jsonData['preutotaliva'];
//var stringtotal = unitprice + '<br/><span class="mp_our_price">(Total '+price+')</span>';
var stringtotal = price;
$('#our_price_display').html(stringtotal);
if($('.mp_total_price').length)
$('.mp_total_price').html(price);
if($('.mp_unit_price').length){
$('.mp_unit_price').html(unitprice);
if($('.mp_total_price_IVA').length)
$('.mp_total_price_IVA').html(preutotaliva);
 
}
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder