<?php
$usuario = $_COOKIE["usuario"];
$nivel = $_COOKIE["nivel"];
if($nivel=="administrador"){$cobrador=$_GET["usuario"];
    
}else{
    $cobrador=$usuario;
}
?>
<style>
    th,td{
        text-align: left;
    }
    *{
        font-family: Arial;
        font-size: 12px;
        font-wight:light;

    }
table,td,th{
    border:gray 1px solid;
    border-collapse: collapse;
    font-size: 12px;
}

th{
    background: green;
    color:white;
}
</style>
<?php
include_once("../php/config.php");
    $sql_empresa = mysql_query("SELECT * FROM empresa") or die(mysql_error());
$enombre= @mysql_result($sql_empresa,0,"nombre");
$etelefono= @mysql_result($sql_empresa,0,"telefono");   
$edireccion= @mysql_result($sql_empresa,0,"direccion"); 
$ernc= @mysql_result($sql_empresa,0,"rnc"); 
$eemail= @mysql_result($sql_empresa,0,"email"); 
    
?>
<span class="datos_empres2" style="font-size: 30px;font-weight: bolder;font-family: 'Arial black'"><?php echo $enombre;?></span><b><br>
<span class="datos_empres"><?php echo $etelefono;?> </span><br>
<span class="datos_empres"><?php echo $edireccion;?> </span><br>
<span class="datos_empres"><?php echo $ernc;?></span><br>
<h3 style="font-size: 25px; text-decoration: underline;">Reporte de operaciones grabadas con ITBIS</h3>
<?php

include_once("../php/formatos.php");

$fecha1 = $_GET["fecha1"];
$fecha2 = $_GET["fecha2"];


echo "<b>Fecha:</b> desde <font color='blue'>".$fecha1."</font> hasta <font color='blue'>".$fecha2;


$sqlIe = mysql_query("select sum(total_precio) as total from detalle_venta where tipo_impuesto='0.00' and fecha between '$fecha1' and '$fecha2'") or die(mysql_error());
$sqlI18 = mysql_query("select sum(total_precio) as total from detalle_venta where tipo_impuesto='18.00' and fecha between '$fecha1' and '$fecha2'") or die(mysql_error());
$sqlI16 = mysql_query("select sum(total_precio) as total from detalle_venta where tipo_impuesto='16.00' and fecha between '$fecha1' and '$fecha2'") or die(mysql_error());
$sqlI13 = mysql_query("select sum(total_precio) as total from detalle_venta where tipo_impuesto='13.00' and fecha between '$fecha1' and '$fecha2'") or die(mysql_error());
$sqlI10 = mysql_query("select sum(total_precio) as total from detalle_venta where tipo_impuesto='10.00' and fecha between '$fecha1' and '$fecha2'") or die(mysql_error());
$sqlTarjeta = mysql_query("select sum(total) as total from ventas where termino='Tarjeta' and fecha between '$fecha1' and '$fecha2'") or die(mysql_error());

echo "<br>";
echo "<table>";
echo "<td>TOTAL</td>";
echo "<td>".@decimal(mysql_result($sqlI18,0,"total") + mysql_result($sqlI16,0,"total") + mysql_result($sqlI13,0,"total") + mysql_result($sqlI10,0,"total") +  mysql_result($sqlIe,0,"total"))."</td>";
echo "<tr>";

echo "<td>TOTAL OPERACIONES EXENTAS</td>";
echo "<td>".@decimal(mysql_result($sqlIe,0,"total"))."</td><tr>";



echo "<td>TOTAL OPERACIONES GRABADAS AL 18%</td>";
echo "<td>".@decimal(mysql_result($sqlI18,0,"total"))."</td>";
echo "<td>VALOR ITEBIS</td>";
echo "<td>".@decimal(mysql_result($sqlI18,0,"total") * 18 / 100)."</td><tr>";

echo "<td>TOTAL OPERACIONES GRABADAS AL 16%</td>";
echo "<td>".@decimal(mysql_result($sqlI16,0,"total"))."</td>";
echo "<td>VALOR ITEBIS</td>";
echo "<td>".@decimal(mysql_result($sqlI16,0,"total") * 16 / 100)."</td><tr>";

echo "<td>TOTAL OPERACIONES GRABADAS AL 13%</td>";
echo "<td>".@decimal(mysql_result($sqlI13,0,"total"))."</td>";
echo "<td>VALOR ITEBIS</td>";
echo "<td>".@decimal(mysql_result($sqlI13,0,"total") * 13 / 100)."</td><tr>";


echo "<td>TOTAL OPERACIONES GRABADAS AL 10%</td>";
echo "<td>".@decimal(mysql_result($sqlI10,0,"total"))."</td>";
echo "<td>VALOR ITEBIS</td>";
echo "<td>".@decimal(mysql_result($sqlI10,0,"total") * 10 / 100)."</td><tr>";

echo "<td>TOTAL OPERACIONES GRABADAS</td>";
echo "<td>".@decimal(mysql_result($sqlI18,0,"total") + mysql_result($sqlI16,0,"total") + mysql_result($sqlI13,0,"total") + mysql_result($sqlI10,0,"total"))."</td>";
echo "<tr>";
echo "<td>TOTAL VENTA TARJETA DE CREDITO</td>";
echo "<td>".@decimal(mysql_result($sqlTarjeta,0,"total"))."</td><tr>";
echo "<td>TOTAL COBERTURA</td>";
echo "<td>".@decimal(mysql_result($sqlCobertura,0,"total"))."</td><tr>";
echo "</table>";

?>
