Skip to content

Instantly share code, notes, and snippets.

Created December 27, 2019 15:34
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
<div class="row">
<div class="col-xs-12">
<table class="table table-condensed table-bordered table-striped">
<th>Precio unitario</th>
$subtotal = 0;
foreach ($productos as $producto) {
$totalProducto = $producto["cantidad"] * $producto["precio"];
$subtotal += $totalProducto;
<td><?php echo $producto["descripcion"] ?></td>
<td><?php echo number_format($producto["cantidad"], 2) ?></td>
<td>$<?php echo number_format($producto["precio"], 2) ?></td>
<td>$<?php echo number_format($totalProducto, 2) ?></td>
<?php }
$subtotalConDescuento = $subtotal - $descuento;
$impuestos = $subtotalConDescuento * ($porcentajeImpuestos / 100);
$total = $subtotalConDescuento + $impuestos;
<td colspan="3" class="text-right">Subtotal</td>
<td>$<?php echo number_format($subtotal, 2) ?></td>
<td colspan="3" class="text-right">Descuento</td>
<td>$<?php echo number_format($descuento, 2) ?></td>
<td colspan="3" class="text-right">Subtotal con descuento</td>
<td>$<?php echo number_format($subtotalConDescuento, 2) ?></td>
<td colspan="3" class="text-right">Impuestos</td>
<td>$<?php echo number_format($impuestos, 2) ?></td>
<td colspan="3" class="text-right">
<h4>$<?php echo number_format($total, 2) ?></h4>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment