<?php 
include ("../conexion.php");
    
require_once '../dompdf/autoload.inc.php';


require_once '../dompdf/lib/html5lib/Parser.php';
require_once '../dompdf/lib/php-font-lib/src/FontLib/Autoloader.php';
require_once '../dompdf/lib/php-svg-lib/src/autoload.php';
require_once '../dompdf/src/Autoloader.php';
Dompdf\Autoloader::register();

use Dompdf\Dompdf;


  $subtotcre = 0;
  $destotcre = 0;
  $impvencre = 0;
  $totalcre  = 0;
  $subtotcon = 0;
  $destotcon = 0;
  $impvencon = 0;
  $totalcon  = 0;
  $totalventas=0;
  
	$totmerexe_con = 0;
	$totmerexo_con = 0;
	$totgravado_con = 0;
				
	$totmerexe_cre = 0;
	$totmerexo_cre = 0;
	$totgravado_cre = 0;			
				
	
  $where     = "";
	
	
	
$codigoHTML='
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Lista</title>
<link href="../estilos/estilos.css" type="text/css" rel="stylesheet"></head>


   <script type="text/php">

        if ( isset($pdf) ) {

          $font = Font_Metrics::get_font("helvetica", "bold");
          $pdf->page_text(72, 18, "Header: {PAGE_NUM} of {PAGE_COUNT}", $font, 6, array(0,0,0));

        }
  

</script>

	    <style type="text/css">      
		tabla {
  border-collapse: separate;
  border-spacing:  3px;
}
 </style>
<body>
<div align="center">
  <p>&nbsp;</p>';
  
       $parametros = "SELECT * FROM web_0000 ";
       $result_parametros = $mysqli->query($parametros);
       $row_para = $result_parametros->fetch_array();
     
	   $NombreComercial =  $row_para["NOMCOM"];
	   $razsoc          =  $row_para["RAZSOC"];
	   $Direccion       =  $row_para["DIREMP"];
	   $Cedula          =  $row_para["CEDJUR"];
	   $Telefono        =  $row_para["NUMTEL"];


	 $fecini    = $_GET["fechainicio"];
	 $fecfin    = $_GET["fechafin"];
	 $cdgtipven = $_GET["combotipoventa"];
	 $cdgcaj    = $_GET["cdgcaj"];
	 $cdgcli    = $_GET["cdgcli"];
	 $dsccli    = $_GET["dsccli"];
	 
if ($cdgcaj <> "") { $where.=" AND cdgcaj='$cdgcaj'"; }
	if ($cdgcli<> "") { $where.=" AND cdgcli='$cdgcli'"; }
	if ($dsccli<> "") { $where.=" AND dsccli like '%$dsccli%'"; }	
	 
 $fechainicio = implode("-", array_reverse(explode("-", $fecini))); 
 $fechafin    = implode("-", array_reverse(explode("-", $fecfin))); 


		$consulta= "SELECT * FROM facturas WHERE cdgtipven='2' AND fecha  between '$fechainicio' AND '$fechafin' ".$where ;
 		if ($resultado = $mysqli->query($consulta)) 

 
  		while ($dato = $resultado->fetch_assoc()) {
				$codfactura = $dato['codfactura'];
				$numfactura = $dato['numfactura'];
				$fecha      = $dato['fecha'];
 				$fecha      = implode("-", array_reverse(explode("-", $fecha))); 		
				$cdgcli     = $dato['cdgcli'];
				$cdgcli     = sprintf('%04d',$cdgcli) ;
				$dsccli     = $dato['dsccli'];
				$dsccli     = substr($dsccli, 0, 40);
				$pladia     = $dato['pladia'];
				$totalfactura = $dato['totalfactura'];
				$subtot     = $dato['subtot'];
				$impven     = $dato['impven'];
				$destot     = $dato['destot'];
	
				$totmerexe     = $dato['totmerexe'];
				$totmerexo     = $dato['totmerexo'];
				$totgravado    = $dato['totgravado'];
	
				$subtotcre= $subtotcre + $subtot;
				$destotcre= $destotcre + $destot;
				$impvencre= $impvencre + $impven;
				$totalcre= $totalcre + $totalfactura;
				
				/*****************/
				$totmerexe_cre  = $totmerexe_cre + $totmerexe;
				$totmerexo_cre  = $totmerexo_cre + $totmerexo;
				$totgravado_cre  = $totgravado_cre + $totgravado;
				/*******************/
	
}

		
		  $consulta2="SELECT * FROM facturas WHERE cdgtipven='1' AND  fecha  between '$fechainicio' AND '$fechafin'  ".$where ;
 		if ($resultado2 = $mysqli->query($consulta2)) 

 
  		while ($dato1 = $resultado2->fetch_assoc()) {
				$codfactura = $dato1['codfactura'];
				$numfactura = $dato1['numfactura'];
				$fecha      = $dato1['fecha'];
 				$fecha      = implode("-", array_reverse(explode("-", $fecha))); 		
				$cdgcli     = $dato1['cdgcli'];
				$cdgcli     = sprintf('%04d',$cdgcli) ;
				$dsccli     = $dato1['dsccli'];
				$dsccli     = substr($dsccli, 0, 40);
				$pladia     = $dato1['pladia'];
				$totalfactura = $dato1['totalfactura'];
				$subtot     = $dato1['subtot'];
				$impven     = $dato1['impven'];
				$destot     = $dato1['destot'];
				
				$totmerexe   = $dato1['totmerexe'];
				$totmerexo   = $dato1['totmerexo'];
				$totgravado  = $dato1['totgravado'];
	
				$subtotcon= $subtotcon + $subtot;
				$destotcon= $destotcon + $destot;
				$impvencon= $impvencon + $impven;
				$totalcon= $totalcon + $totalfactura;
	
	
					/*****************/
				$totmerexe_con  = $totmerexe_con + $totmerexe;
				$totmerexo_con  = $totmerexo_con + $totmerexo;
				$totgravado_con = $totgravado_con + $totgravado;
				/*******************/
	
}

		

$estrec="1";
$borrado="0";

 $consulta3= ("SELECT  numrec, fecrec, cdgcli, estrec, cdgcaj, Sum(montot) AS totalrec, Sum(monint) AS totalint ,Sum(monabo) AS totalabo FROM pagos_clientes WHERE estrec = '$estrec'  AND  fecrec  between '$fechainicio' AND '$fechafin'".$where );

	if ($resultado3 = $mysqli->query($consulta3)) 

  	 while ($dato = $resultado3->fetch_assoc()) {

				$totalrec  = $dato["totalrec"];
				$totalint  = $dato["totalint"];
				$totalabo  = $dato["totalabo"];
		
}



    $consulta4= ("SELECT codnota, fecha, cdgcli, borrado, cdgcaj, Sum(subtot) AS subtotNotas , Sum(impven) AS impvenNotas , Sum(destot) AS destotNotas , Sum(totalnota) AS totalNotas, SUM(totmerexe) AS  totmerexe, SUM(totmerexo) AS  totmerexo,SUM(totgravado) AS  totgravado FROM facturas_notas WHERE 	
 borrado = '$borrado'  AND fecha  between '$fechainicio' AND '$fechafin' ".$where  );

	if ($resultado4 = $mysqli->query($consulta4)) 

  	 while ($dato = $resultado4->fetch_assoc()) {

				$totalNot   = $dato["totalNotas"];
				$subtotNot  = $dato["subtotNotas"];
				$impvenNot  = $dato["impvenNotas"];
				$destotNot  = $dato["destotNotas"];
				
				
				$totmerexeNot   = $dato["totmerexe"];
				$totmerexoNot   = $dato["totmerexo"];
				$totgravadoNot  = $dato["totgravado"];
	
		}
	


    $consulta5= ("SELECT codnota, fecha, cdgcli, borrado, cdgcaj, Sum(subtot) AS subtotNotas , Sum(impven) AS impvenNotas , Sum(destot) AS destotNotas , Sum(totalnota) AS totalNotas, SUM(totmerexe) AS  totmerexe, SUM(totmerexo) AS  totmerexo,SUM(totgravado) AS  totgravado FROM facturas_notas_debito WHERE 	
 borrado = '$borrado'  AND fecha  between '$fechainicio' AND '$fechafin' ".$where  );

	if ($resultado5 = $mysqli->query($consulta5)) 

  	 while ($dato = $resultado5->fetch_assoc()) {

				$totalNotDeb   = $dato["totalNotas"];
				$subtotNotDeb  = $dato["subtotNotas"];
				$impvenNotDeb  = $dato["impvenNotas"];
				$destotNotDeb  = $dato["destotNotas"];
				
				$totmerexeNotDeb   = $dato["totmerexe"];
				$totmerexoNotDeb   = $dato["totmerexo"];
				$totgravadoNotDeb  = $dato["totgravado"];
		}


$totalventas=$totalcre+$totalcon-$totalNot+$totalNotDeb;


 if ($cdgcaj=="") {
	   
	    $nomcomusu="TODOS LOS CAJEROS";
	 
	     } else {

	 
	   $query_codcaj="SELECT * FROM usuarios  WHERE codusu=$cdgcaj ";
       $resultado = $mysqli->query( $query_codcaj);
       $row = $resultado->fetch_array();
        
		$nomcomusu    = $row["nomcomusu"];
	
     }
	 
	 
	 /////////////////////////////////////////////////////////////////  CALCULA TARIFAS FACTURACION  CONTADO ///////////////////////////////////////

$consulta6= ("SELECT * FROM facturas WHERE cdgtipven='2' AND  fecha  between '$fechainicio' AND '$fechafin'  ".$where );
	  $TOTAL_I0R_CRE =  0 ;
	  $TOTAL_I1R_CRE =  0 ;
	  $TOTAL_I2R_CRE = 0 ;
	  $TOTAL_I4R_CRE =  0 ;
	  $TOTAL_I0T_CRE =  0 ;
	  $TOTAL_I4T_CRE =  0 ;
	  $TOTAL_I8T_CRE =  0 ;
	  $TOTAL_I13_CRE =  0 ;
	  
	if ($resultado6 = $mysqli->query($consulta6)) 


  	 while ($dato6 = $resultado6->fetch_assoc()) {			
	 $codfactura   = $dato6['codfactura'];

    $consulta7= ("SELECT codfactura, impuesto, cdgtar, cdgimp FROM factulinea WHERE  codfactura = '$codfactura' AND cdgimp = '01' ");

	if ($resultado7 = $mysqli->query($consulta7)) 

	 
  	 while ($dato7 = $resultado7->fetch_assoc()) {
	 $I0R =  0;
	 $I1R =  0;
	 $I2R =  0;
	 $I4R =  0;
	 $I0T =  0;
	 $I4T =  0;
	 $I8T =  0;
	 $I13 =  0;

				$impuesto    = $dato7['impuesto'];
			  	$cdgtar      = $dato7['cdgtar'];
		
	     if ($cdgtar == "01") {	$I0R =  $impuesto;
	}elseif ($cdgtar == "02") { $I1R =  $impuesto;
	}elseif ($cdgtar == "03") { $I2R =  $impuesto;
	}elseif ($cdgtar == "04") { $I4R =  $impuesto;
	}elseif ($cdgtar == "05") { $I0T =  $impuesto;
	}elseif ($cdgtar == "06") { $I4T =  $impuesto;
	}elseif ($cdgtar == "07") { $I8T =  $impuesto;
	}elseif ($cdgtar == "08") { $I13 =  $impuesto;
	} 
	
	  $TOTAL_I0R_CRE =  $TOTAL_I0R_CRE + $I0R ;
	  $TOTAL_I1R_CRE =  $TOTAL_I1R_CRE + $I1R ;
	  $TOTAL_I2R_CRE =  $TOTAL_I2R_CRE + $I2R ;
	  $TOTAL_I4R_CRE =  $TOTAL_I4R_CRE + $I4R ;
	  $TOTAL_I0T_CRE =  $TOTAL_I0T_CRE + $I0T ;
	  $TOTAL_I4T_CRE =  $TOTAL_I4T_CRE + $I4T ;
	  $TOTAL_I8T_CRE =  $TOTAL_I8T_CRE + $I8T ;
	  $TOTAL_I13_CRE =  $TOTAL_I13_CRE + $I13 ;
		
	 } 		
	 } 		
	 
	 
	 /////////////////////////////////////////////////////////////////  CALCULA TARIFAS FACTURACION  CREDITO ///////////////////////////////////////

$consulta8= ("SELECT * FROM facturas WHERE cdgtipven='1' AND  fecha  between '$fechainicio' AND '$fechafin'  ".$where );
	  $TOTAL_I0R_CON =  0 ;
	  $TOTAL_I1R_CON =  0 ;
	  $TOTAL_I2R_CON = 0 ;
	  $TOTAL_I4R_CON =  0 ;
	  $TOTAL_I0T_CON =  0 ;
	  $TOTAL_I4T_CON =  0 ;
	  $TOTAL_I8T_CON =  0 ;
	  $TOTAL_I13_CON =  0 ;
	  
	if ($resultado8 = $mysqli->query($consulta8)) 


  	 while ($dato8 = $resultado8->fetch_assoc()) {			
	 $codfactura   = $dato8['codfactura'];

    $consulta9= ("SELECT codfactura, impuesto, cdgtar, cdgimp FROM factulinea WHERE  codfactura = '$codfactura' AND cdgimp = '01' ");

	if ($resultado9 = $mysqli->query($consulta9)) 

	 
  	 while ($dato9 = $resultado9->fetch_assoc()) {
	 $I0R =  0;
	 $I1R =  0;
	 $I2R =  0;
	 $I4R =  0;
	 $I0T =  0;
	 $I4T =  0;
	 $I8T =  0;
	 $I13 =  0;

				$impuesto    = $dato9['impuesto'];
			  	$cdgtar      = $dato9['cdgtar'];
		
	     if ($cdgtar == "01") {	$I0R =  $impuesto;
	}elseif ($cdgtar == "02") { $I1R =  $impuesto;
	}elseif ($cdgtar == "03") { $I2R =  $impuesto;
	}elseif ($cdgtar == "04") { $I4R =  $impuesto;
	}elseif ($cdgtar == "05") { $I0T =  $impuesto;
	}elseif ($cdgtar == "06") { $I4T =  $impuesto;
	}elseif ($cdgtar == "07") { $I8T =  $impuesto;
	}elseif ($cdgtar == "08") { $I13 =  $impuesto;
	} 
	
	  $TOTAL_I0R_CON =  $TOTAL_I0R_CON + $I0R ;
	  $TOTAL_I1R_CON =  $TOTAL_I1R_CON + $I1R ;
	  $TOTAL_I2R_CON =  $TOTAL_I2R_CON + $I2R ;
	  $TOTAL_I4R_CON =  $TOTAL_I4R_CON + $I4R ;
	  $TOTAL_I0T_CON =  $TOTAL_I0T_CON + $I0T ;
	  $TOTAL_I4T_CON =  $TOTAL_I4T_CON + $I4T ;
	  $TOTAL_I8T_CON =  $TOTAL_I8T_CON + $I8T ;
	  $TOTAL_I13_CON =  $TOTAL_I13_CON + $I13 ;
		
	 } 		
	 } 		


/////////////////////////////////////////////////////////////////  CALCULA TARIFAS NOTAS ///////////////////////////////////////

$consulta10= ("SELECT  codnota FROM facturas_notas WHERE  fecha  between '$fechainicio' AND '$fechafin'  ".$where  );
	  $TOTAL_I0R_NOT =  0 ;
	  $TOTAL_I1R_NOT =  0 ;
	  $TOTAL_I2R_NOT = 0 ;
	  $TOTAL_I4R_NOT =  0 ;
	  $TOTAL_I0T_NOT =  0 ;
	  $TOTAL_I4T_NOT =  0 ;
	  $TOTAL_I8T_NOT =  0 ;
	  $TOTAL_I13_NOT =  0 ;
	  
	if ($resultado10 = $mysqli->query($consulta10)) 


  	 while ($dato10 = $resultado10->fetch_assoc()) {			
	 $codnota   = $dato10['codnota'];

    $consulta11= ("SELECT codnota, impuesto, cdgtar, cdgimp FROM factulinea_notas WHERE  codnota = '$codnota' AND cdgimp = '01' ");

	if ($resultado11 = $mysqli->query($consulta11)) 

	 
  	 while ($dato11 = $resultado11->fetch_assoc()) {
	 $I0R =  0;
	 $I1R =  0;
	 $I2R =  0;
	 $I4R =  0;
	 $I0T =  0;
	 $I4T =  0;
	 $I8T =  0;
	 $I13 =  0;

				$impuesto    = $dato11['impuesto'];
			  	$cdgtar      = $dato11['cdgtar'];
		
	     if ($cdgtar == "01") {	$I0R =  $impuesto;
	}elseif ($cdgtar == "02") { $I1R =  $impuesto;
	}elseif ($cdgtar == "03") { $I2R =  $impuesto;
	}elseif ($cdgtar == "04") { $I4R =  $impuesto;
	}elseif ($cdgtar == "05") { $I0T =  $impuesto;
	}elseif ($cdgtar == "06") { $I4T =  $impuesto;
	}elseif ($cdgtar == "07") { $I8T =  $impuesto;
	}elseif ($cdgtar == "08") { $I13 =  $impuesto;
	} 
	
	  $TOTAL_I0R_NOT =  $TOTAL_I0R_NOT + $I0R ;
	  $TOTAL_I1R_NOT =  $TOTAL_I1R_NOT + $I1R ;
	  $TOTAL_I2R_NOT =  $TOTAL_I2R_NOT + $I2R ;
	  $TOTAL_I4R_NOT =  $TOTAL_I4R_NOT + $I4R ;
	  $TOTAL_I0T_NOT =  $TOTAL_I0T_NOT + $I0T ;
	  $TOTAL_I4T_NOT =  $TOTAL_I4T_NOT + $I4T ;
	  $TOTAL_I8T_NOT =  $TOTAL_I8T_NOT + $I8T ;
	  $TOTAL_I13_NOT =  $TOTAL_I13_NOT + $I13 ;
	
		
	 } 		
	 } 		



/////////////////////////////////////////////////////////////////  CALCULA TARIFAS NOTAS DEBITO ///////////////////////////////////////

$consulta12= ("SELECT  codnota FROM facturas_notas_debito WHERE  fecha  between '$fechainicio' AND '$fechafin'  ".$where  );
	  $TOTAL_I0R_DEB =  0 ;
	  $TOTAL_I1R_DEB =  0 ;
	  $TOTAL_I2R_DEB = 0 ;
	  $TOTAL_I4R_DEB =  0 ;
	  $TOTAL_I0T_DEB =  0 ;
	  $TOTAL_I4T_DEB =  0 ;
	  $TOTAL_I8T_DEB =  0 ;
	  $TOTAL_I13_DEB =  0 ;
	  
	if ($resultado12 = $mysqli->query($consulta12)) 


  	 while ($dato12 = $resultado12->fetch_assoc()) {			
	 $codnota   = $dato12['codnota'];

    $consulta13= ("SELECT codnota, impuesto, cdgtar, cdgimp FROM factulinea_notas_debito WHERE  codnota = '$codnota' AND cdgimp = '01' ");

	if ($resultado13 = $mysqli->query($consulta13)) 

	 
  	 while ($dato13 = $resultado13->fetch_assoc()) {
	 $I0R =  0;
	 $I1R =  0;
	 $I2R =  0;
	 $I4R =  0;
	 $I0T =  0;
	 $I4T =  0;
	 $I8T =  0;
	 $I13 =  0;

				$impuesto    = $dato13['impuesto'];
			  	$cdgtar      = $dato13['cdgtar'];
		
	     if ($cdgtar == "01") {	$I0R =  $impuesto;
	}elseif ($cdgtar == "02") { $I1R =  $impuesto;
	}elseif ($cdgtar == "03") { $I2R =  $impuesto;
	}elseif ($cdgtar == "04") { $I4R =  $impuesto;
	}elseif ($cdgtar == "05") { $I0T =  $impuesto;
	}elseif ($cdgtar == "06") { $I4T =  $impuesto;
	}elseif ($cdgtar == "07") { $I8T =  $impuesto;
	}elseif ($cdgtar == "08") { $I13 =  $impuesto;
	} 
	
	  $TOTAL_I0R_DEB =  $TOTAL_I0R_DEB + $I0R ;
	  $TOTAL_I1R_DEB =  $TOTAL_I1R_DEB + $I1R ;
	  $TOTAL_I2R_DEB =  $TOTAL_I2R_DEB + $I2R ;
	  $TOTAL_I4R_DEB =  $TOTAL_I4R_DEB + $I4R ;
	  $TOTAL_I0T_DEB =  $TOTAL_I0T_DEB + $I0T ;
	  $TOTAL_I4T_DEB =  $TOTAL_I4T_DEB + $I4T ;
	  $TOTAL_I8T_DEB =  $TOTAL_I8T_DEB + $I8T ;
	  $TOTAL_I13_DEB =  $TOTAL_I13_DEB + $I13 ;
	
		
	 } 		
	 } 		


	 
$codigoHTML='
  <table width="100%"  cellpadding="0" cellspacing="0"  border="0">
      <tr>
        <td width="22%" align="" rowspan="3"><img src="../img/logo.jpg" /></td>
        <td width="56%" align="center"><font color="blue" size=4><strong>'.$NombreComercial.'</strong></font></td>
        <td width="22%">&nbsp;</td>
      </tr>
      <tr>	 
        <td height="12" align="center"><font size=2 >Reporte Analitico de Ventas del '.$fecini.' Al '.$fecfin.'</font></td>
        <td height="12">&nbsp;</td>
      </tr>
      <tr>
        <td height="12" align="center"><font size=2 ></font><font size="3" ><strong>Cajero: '.$cdgcaj.' - '.$nomcomusu.'</strong></font></td>
        <td height="12">&nbsp;</td>
      </tr>
  </table>
    ';
  
   

	 

	 
	 $codigoHTML.='
  
  ';
	
	
    $codigoHTML.='</p>
    <hr  color="#000000"/>
       <table cellspacing="0" align="center" cellpadding="0" style=" border-width: 2px;"  width="55%" border="1" bordercolor="#000000">
      <tr>
        <td colspan="4"  align="center" bgcolor="#CCCCCC" class="titulo"><strong><em>Facturas de Credito</em></strong></td>
      </tr>
		<tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">Sub.Exento </td>
        <td align="right"  style="padding-bottom: 1px; border:0px solid black;"><font size="3" > '.number_format($totmerexe_cre,2).'</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">Sub.Exonerado </td>
        <td align="right"  style="padding-bottom: 1px; border:0px solid black;"><font size="3" > '.number_format($totmerexo_cre,2).'</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">Sub.Gravado </td>
        <td align="right"  style="padding-bottom: 1px; border:0px solid black;"><font size="3" > '.number_format($totgravado_cre,2).'</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>		
      <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">Monto Subtotal</td>
        <td align="right"  style="padding-bottom: 1px; border:0px solid black;"><font size="3" > '.number_format($subtotcre,2).'</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
      <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">Mto Descuento</td>
        <td align="right"  style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($destotcre,2).'</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
      <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">Impuesto Valor Agregado</td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($impvencre,2).'</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;"> &nbsp; &nbsp; &nbsp; &nbsp; 0 % Reducida</td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($TOTAL_I0R_CRE,2).'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	  
	  	  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;"> &nbsp; &nbsp; &nbsp; &nbsp; 1 % Reducida</td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($TOTAL_I1R_CRE,2).'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	  
	  	  	  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;"> &nbsp; &nbsp; &nbsp; &nbsp; 2 % Reducida</td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($TOTAL_I2R_CRE,2).'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	  
	  	  	  	  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;"> &nbsp; &nbsp; &nbsp; &nbsp; 4 % Reducida</td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($TOTAL_I4R_CRE,2).'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	  
	  	  	  	  	  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;"> &nbsp; &nbsp; &nbsp; &nbsp; 0 % Transitoria</td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($TOTAL_I0T_CRE,2).'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	  
	  
	  	  	  	  	  	  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;"> &nbsp; &nbsp; &nbsp; &nbsp; 4 % Transitoria</td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($TOTAL_I4T_CRE,2).'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	  
	  
	  	  	  	  	  	  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;"> &nbsp; &nbsp; &nbsp; &nbsp; 8 % Transitoria</td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($TOTAL_I8T_CRE,2).'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	  
	  	  	  	  	  	  	  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;"> &nbsp; &nbsp; &nbsp; &nbsp; 13% General</td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($TOTAL_I13_CRE,2).'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	  
	  
	  
      <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td colspan="2"  style="padding-bottom: 1px; border:0px solid black;">_________________________________________________________________</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
      <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;"><strong>Total Facturas de Credito</strong></td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><strong><font size="3" >'.number_format($totalcre,2).'</font></strong></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
      <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
      <tr>
        <td colspan="4"  align="center" bgcolor="#CCCCCC" class="titulo"><strong><em>Facturas de Contado</em></strong></td>
      </tr>
		<tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">Sub.Exento </td>
        <td align="right"  style="padding-bottom: 1px; border:0px solid black;"><font size="3" > '.number_format($totmerexe_con,2).'</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">Sub.Exonerado </td>
        <td align="right"  style="padding-bottom: 1px; border:0px solid black;"><font size="3" > '.number_format($totmerexo_con,2).'</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">Sub.Gravado </td>
        <td align="right"  style="padding-bottom: 1px; border:0px solid black;"><font size="3" > '.number_format($totgravado_con,2).'</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>	
      <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">Monto Subtotal</td>
        <td align="right"  style="padding-bottom: 1px; border:0px solid black;"><font size="3" > '.number_format($subtotcon,2).'</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
      <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">Mto Descuento</td>
        <td align="right"  style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($destotcon,2).'</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
      <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">Impuesto Valor Agregado</td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($impvencon,2).'</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	   <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;"> &nbsp; &nbsp; &nbsp; &nbsp; 0 % Reducida</td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($TOTAL_I0R_CON,2).'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	  
	  	  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;"> &nbsp; &nbsp; &nbsp; &nbsp; 1 % Reducida</td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($TOTAL_I1R_CON,2).'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	  
	  	  	  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;"> &nbsp; &nbsp; &nbsp; &nbsp; 2 % Reducida</td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($TOTAL_I2R_CON,2).'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	  
	  	  	  	  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;"> &nbsp; &nbsp; &nbsp; &nbsp; 4 % Reducida</td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($TOTAL_I4R_CON,2).'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	  
	  	  	  	  	  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;"> &nbsp; &nbsp; &nbsp; &nbsp; 0 % Transitoria</td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($TOTAL_I0T_CON,2).'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	  
	  
	  	  	  	  	  	  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;"> &nbsp; &nbsp; &nbsp; &nbsp; 4 % Transitoria</td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($TOTAL_I4T_CON,2).'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	  
	  
	  	  	  	  	  	  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;"> &nbsp; &nbsp; &nbsp; &nbsp; 8 % Transitoria</td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($TOTAL_I8T_CON,2).'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	  
	  	  	  	  	  	  	  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;"> &nbsp; &nbsp; &nbsp; &nbsp; 13% General</td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($TOTAL_I13_CON,2).'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	  
      <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td colspan="2"  style="padding-bottom: 1px; border:0px solid black;">_________________________________________________________________</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
      <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;"><strong>Total Facturas de Contado</strong></td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><strong><font size="3" >'.number_format($totalcon,2).'</font></strong></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>

      <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td align="right"  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
      <tr>
        <td colspan="4"  align="center" bgcolor="#CCCCCC" class="titulo"><em><strong>Notas de Credito </strong></em></td>
      </tr>
      <tr>
        <td   style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td   style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td   style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td   style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>

	  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">Sub.Exento </td>
        <td align="right"  style="padding-bottom: 1px; border:0px solid black;"><font size="3" > '.number_format($totmerexeNot,2).'</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">Sub.Exonerado </td>
        <td align="right"  style="padding-bottom: 1px; border:0px solid black;"><font size="3" > '.number_format($totmerexoNot,2).'</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">Sub.Gravado </td>
        <td align="right"  style="padding-bottom: 1px; border:0px solid black;"><font size="3" > '.number_format($totgravadoNot,2).'</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>		
      <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">Monto Subtotal</td>
        <td align="right"  style="padding-bottom: 1px; border:0px solid black;"><font size="3" > '.number_format($subtotNot,2).'</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
      <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">Mto Descuento</td>
        <td align="right"  style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($destotNot,2).'</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
      <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">Impuesto Valor Agregado</td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($impvenNot,2).'</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;"> &nbsp; &nbsp; &nbsp; &nbsp; 0 % Reducida</td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($TOTAL_I0R_NOT,2).'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	  
	  	  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;"> &nbsp; &nbsp; &nbsp; &nbsp; 1 % Reducida</td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($TOTAL_I1R_NOT,2).'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	  
	  	  	  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;"> &nbsp; &nbsp; &nbsp; &nbsp; 2 % Reducida</td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($TOTAL_I2R_NOT,2).'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	  
	  	  	  	  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;"> &nbsp; &nbsp; &nbsp; &nbsp; 4 % Reducida</td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($TOTAL_I4R_NOT,2).'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	  
	  	  	  	  	  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;"> &nbsp; &nbsp; &nbsp; &nbsp; 0 % Transitoria</td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($TOTAL_I0T_NOT,2).'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	  
	  
	  	  	  	  	  	  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;"> &nbsp; &nbsp; &nbsp; &nbsp; 4 % Transitoria</td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($TOTAL_I4T_NOT,2).'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	  
	  
	  	  	  	  	  	  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;"> &nbsp; &nbsp; &nbsp; &nbsp; 8 % Transitoria</td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($TOTAL_I8T_NOT,2).'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	  
	  	  	  	  	  	  	  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;"> &nbsp; &nbsp; &nbsp; &nbsp; 13% General</td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($TOTAL_I13_NOT,2).'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
      <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td colspan="2"  style="padding-bottom: 1px; border:0px solid black;">_________________________________________________________________</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
      <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;"><strong>Total Notas de Credito </strong></td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><strong><font size="3" >'.number_format($totalNot,2).'</font></strong></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>

      <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td align="right"  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	   <tr>
        <td colspan="4"  align="center" bgcolor="#CCCCCC" class="titulo"><em><strong>Notas de Debito </strong></em></td>
      </tr>
      <tr>
        <td   style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td   style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td   style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td   style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>

				
	  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">Sub.Exento </td>
        <td align="right"  style="padding-bottom: 1px; border:0px solid black;"><font size="3" > '.number_format($totmerexeNotDeb,2).'</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">Sub.Exonerado </td>
        <td align="right"  style="padding-bottom: 1px; border:0px solid black;"><font size="3" > '.number_format($totmerexoNotDeb,2).'</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">Sub.Gravado </td>
        <td align="right"  style="padding-bottom: 1px; border:0px solid black;"><font size="3" > '.number_format($totgravadoNotDeb,2).'</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>		
      <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">Monto Subtotal</td>
        <td align="right"  style="padding-bottom: 1px; border:0px solid black;"><font size="3" > '.number_format($subtotNotDeb,2).'</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
      <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">Mto Descuento</td>
        <td align="right"  style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($destotNotDeb,2).'</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
      <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">Impuesto Valor Agregado</td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($impvenNotDeb,2).'</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	   <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;"> &nbsp; &nbsp; &nbsp; &nbsp; 0 % Reducida</td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($TOTAL_I0R_DEB,2).'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	  
	  	  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;"> &nbsp; &nbsp; &nbsp; &nbsp; 1 % Reducida</td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($TOTAL_I1R_DEB,2).'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	  
	  	  	  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;"> &nbsp; &nbsp; &nbsp; &nbsp; 2 % Reducida</td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($TOTAL_I2R_DEB,2).'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	  
	  	  	  	  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;"> &nbsp; &nbsp; &nbsp; &nbsp; 4 % Reducida</td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($TOTAL_I4R_DEB,2).'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	  
	  	  	  	  	  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;"> &nbsp; &nbsp; &nbsp; &nbsp; 0 % Transitoria</td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($TOTAL_I0T_DEB,2).'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	  
	  
	  	  	  	  	  	  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;"> &nbsp; &nbsp; &nbsp; &nbsp; 4 % Transitoria</td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($TOTAL_I4T_DEB,2).'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	  
	  
	  	  	  	  	  	  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;"> &nbsp; &nbsp; &nbsp; &nbsp; 8 % Transitoria</td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($TOTAL_I8T_DEB,2).'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	  
	  	  	  	  	  	  	  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;"> &nbsp; &nbsp; &nbsp; &nbsp; 13% General</td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($TOTAL_I13_DEB,2).'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
      <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td colspan="2"  style="padding-bottom: 1px; border:0px solid black;">_________________________________________________________________</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
      <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;"><strong>Total Notas de Debito </strong></td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><strong><font size="3" >'.number_format($totalNotDeb,2).'</font></strong></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>

      <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td align="right"  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
      <tr>
        <td colspan="4"  align="center" bgcolor="#CCCCCC" class="titulo"><strong><em>Recibos por Dinero</em></strong></td>
      </tr>
      <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
      <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">Monto Capital</td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($totalabo,2).'</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
      <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">Monto Interes</td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($totalint,2).'</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
      <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td colspan="2"  style="padding-bottom: 1px; border:0px solid black;">_________________________________________________________________</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
      <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;"><strong>Total Recibos</strong></td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><strong><font size="3" >'.number_format($totalrec,2).'</font></strong></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
      <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
      <tr>
        <td colspan="4"  align="center" bgcolor="#CCCCCC" class="titulo"><em><strong>Totales</strong></em></td>
      </tr>
      <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
  <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;"><strong>Total Facturas de Credito</strong></td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><strong><font size="3" >'.number_format($totalcre,2).'</font></strong></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
      <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;"><strong>Total Facturas de Contado</strong></td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><strong><font size="3" >'.number_format($totalcon,2).'</font></strong></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
      
      <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">Total Notas Credito (-)</td>
        <td align="right"  style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($totalNot,2).'</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
	   <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">Total Notas Debito (+)</td>
        <td align="right"  style="padding-bottom: 1px; border:0px solid black;"><font size="3" >'.number_format($totalNotDeb,2).'</font></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
      <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td colspan="2"  style="padding-bottom: 1px; border:0px solid black;">_________________________________________________________________</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
      <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;"><strong>Total Acumulado  Ventas</strong></td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;"><strong><font size="3" >'.number_format($totalventas,2).'</font></strong></td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
      <tr>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  align="right" style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
        <td  style="padding-bottom: 1px; border:0px solid black;">&nbsp;</td>
      </tr>
    </table>
  <p>&nbsp;</p>
 ';
          


$codigoHTML.='

   
   <p>';
   
   //  } 
$codigoHTML.='   </p>
  <table width="100%" border="0">
     <tr>
     </tr>
  </table>
   </div>
</body>
</html>';

$codigoHTML=utf8_decode($codigoHTML);
$dompdf=new DOMPDF();
$dompdf->set_paper( "A4", "portrait" ); // a4,vertical
$dompdf->load_html($codigoHTML);
ini_set("memory_limit","256M");
$dompdf->render();
$dompdf->stream("Reporte Analitico de Ventas.pdf", array("Attachment" => false));

?>
