<?php 
include '../../inc/config.php';

$gana="SELECT
Sum(factura_detalle.precio_venta) AS venta,
Sum(productos.precio_costo) AS costo,
(SUM(factura_detalle.precio_venta)-SUM(productos.precio_costo)) AS ganancia
FROM
factura_detalle ,
factura ,
productos
WHERE
factura_detalle.id_producto = productos.idproductos AND
factura.fecha BETWEEN '".$_POST['fechad']."' AND '".$_POST['fechah']."' AND
factura.estado <> 'A'";

foreach ($db->fetch_custom($gana) as $isi) { ?>
	<div class="box-footer">
                  <div class="row">
                    <div class="col-sm-4 col-xs-6">
                      <div class="description-block border-right">
                        <!--<span class="description-percentage text-green"><i class="fa fa-caret-up"></i> 17%</span>-->
                        <h5 class="description-header">$ <?=number_format($isi->costo)?></h5>
                        <span class="description-text"><small class="label bg-green">Costo Total</small></span>
                      </div><!-- /.description-block -->
                    </div><!-- /.col -->
                    <div class="col-sm-4 col-xs-6">
                      <div class="description-block border-right">
                        <!--<span class="description-percentage text-yellow"><i class="fa fa-caret-left"></i> 0%</span>-->
                        <h5 class="description-header">$ <?=number_format($isi->venta)?></h5>
                        <span class="description-text"><small class="label bg-yellow">Venta Total</small></span>
                      </div><!-- /.description-block -->
                    </div><!-- /.col -->
                    <div class="col-sm-4 col-xs-6">
                      <div class="description-block border-right">
                        <!--<span class="description-percentage text-green"><i class="fa fa-caret-up"></i> 20%</span>-->
                        <h5 class="description-header">$ <?=number_format($isi->ganancia)?></h5>
                        <span class="description-text"><small class="label bg-red">Ganancia Total</small></span>
                      </div><!-- /.description-block -->
                    </div><!-- /.col -->
                  </div><!-- /.row -->
                </div><!-- /.box-footer -->

<?php	
}


?>

