<?
session_start();
if ($_SESSION['estado'] != "ON")
		{
		?>
		<script>
			parent.location.href = '../index.php';
		</script>
		<? 
		exit();
		}
$id_empresa = $_SESSION['ss_empresa'];
$id_user = $_SESSION['ss_user'];
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Resumen Ventas</title>
<?
include("../conex.php");
$id_bodega=$_POST["lstbodega"];
if ($id_bodega==0) $bodegas='Todos';
else
	{
	$sql_bv = "SELECT * FROM bodega WHERE id = $id_bodega";
  	$resbv = mysql_query($sql_bv,$enlace);	
	while (mysql_fetch_object ($resbv))
			{
			$bodegas = mysql_result($resbv, 0, "descripcion");
			}
	}
$txtfecha=$_POST["txtfecha"];
$dia = substr ($txtfecha, 0, 2);
$mes = substr ($txtfecha, 3, 2);
$mes2=$mes;
$aņo = substr ($txtfecha, 6, 4);
$ano2=$aņo;
if ($mes=='01') $mes = "ENERO";
if ($mes=='02') $mes = "FEBRERO";
if ($mes=='03') $mes = "MARZO";
if ($mes=='04') $mes = "ABRIL";
if ($mes=='05') $mes = "MAYO";
if ($mes=='06') $mes = "JUNIO";
if ($mes=='07') $mes = "JULIO";
if ($mes=='08') $mes = "AGOSTO";
if ($mes=='09') $mes = "SEPTIEMBRE";
if ($mes=='10') $mes = "OCTUBRE";
if ($mes=='11') $mes = "NOVIEMBRE";
if ($mes=='12') $mes = "DICIEMBRE";
?>
		<?	
		$totalv_boleta=0;		
		$totalv_ivaboleta=0;
		$totalv_iva5boleta=0;
		$totalv_factura=0;
		$totalv_ivafactura=0;
		$totalv_iva5factura=0;
		$totalv_nc=0;
		$totalv_ivanc=0;
		$totalv_iva5nc=0;
		$totalv_nd=0;
		$totalv_ivand=0;
		$totalv_iva5nd=0;		
		$totalv_nfactura=0;
		$totalv_nboleta=0;
		$totalv_nnc=0;
		$totalv_nnd=0;
		$totalv_exentos=0;
		$totalc_eFE=0;
if ($id_bodega==0)
{
$sqlfs = "SELECT * FROM salida, tipo_dcto WHERE extract(month from fecha_emision)='$mes2' AND extract(year from fecha_emision)='$ano2' AND (tipo_dcto.descripcion='FACTURA ELECTRONICA' OR tipo_dcto.descripcion='NC ELECTRONICA' OR tipo_dcto.descripcion='ND ELECTRONICA' OR tipo_dcto.descripcion='FACTURA' OR tipo_dcto.descripcion='NC' OR tipo_dcto.descripcion='ND' OR tipo_dcto.descripcion='FACTURA ELECTRONICA EXENTA'  OR tipo_dcto.descripcion='FACTURA EXENTA') AND tipo_dcto.id = salida.tipo_dcto AND salida.empresa = $id_empresa";
}
else
{
$sqlfs = "SELECT * FROM salida, tipo_dcto WHERE extract(month from fecha_emision)='$mes2' AND extract(year from fecha_emision)='$ano2' AND (tipo_dcto.descripcion='FACTURA ELECTRONICA' OR tipo_dcto.descripcion='NC ELECTRONICA' OR tipo_dcto.descripcion='ND ELECTRONICA' OR tipo_dcto.descripcion='FACTURA' OR tipo_dcto.descripcion='NC' OR tipo_dcto.descripcion='ND' OR tipo_dcto.descripcion='FACTURA ELECTRONICA EXENTA'  OR tipo_dcto.descripcion='FACTURA EXENTA' OR tipo_dcto.descripcion='FACTURA DE COMPRA') AND tipo_dcto.id = salida.tipo_dcto AND salida.empresa = $id_empresa AND bodega=$id_bodega";
}		
		  	$resfs = mysql_query($sqlfs,$enlace);	
			$cont=0;
			while (mysql_fetch_object ($resfs))
				{
				$fecha = mysql_result($resfs, $cont, "fecha_emision");
				$dia = substr ($fecha, 8, 2);
				$iddcto = mysql_result($resfs, $cont, "tipo_dcto");
				
				
				$valorneto= mysql_result($resfs, $cont, "neto");
				$valoriva= mysql_result($resfs, $cont, "iva");
				
				if($iddcto==1)
					{
					$totalv_boleta+=1;
					$totalv_nboleta+=$valorneto;
					$totalv_ivaboleta+=$valoriva;
					
					}
				if($iddcto==2 || $iddcto==33)
					{
					$totalv_factura+=1;
					$totalv_nfactura+=$valorneto;
					$totalv_ivafactura+=$valoriva;
					
					}
				if($iddcto==6 || $iddcto==61 )
					{
					$totalv_nc+=1;
					$totalv_nnc+=$valorneto;
					$totalv_ivanc+=$valoriva;
					
					}
				
				
				if($iddcto==3)$dcto='NV';
				if($iddcto==4)$dcto='C';
				if($iddcto==5)$dcto='G';
				
				
				
				if($iddcto==7  || $iddcto==56)
	{				$totalv_nd+=1;
					$totalv_nnd+=$valorneto;
					$totalv_ivand+=$valoriva;
					
					}
		  	
			$cont+=1;
			}
			
			$totalv_debitos=$totalv_nboleta+$totalv_nfactura+$totalv_nnd-$totalv_nnc;
			$totalv_iva=$totalv_ivaboleta+$totalv_ivafactura+$totalv_ivand-$totalv_ivanc;
			$totalv_iva5=$totalv_iva5boleta+$totalv_iva5factura+$totalv_iva5nd-$totalv_iva5nc;
			
			
			$totalv_nboleta=number_format($totalv_nboleta,0,',','.');
			$totalv_ivaboleta=number_format($totalv_ivaboleta,0,',','.');
			$totalv_iva5boleta=number_format($totalv_iva5boleta,0,',','.');
			
			$totalv_nfactura=number_format($totalv_nfactura,0,',','.');
			$totalv_ivafactura=number_format($totalv_ivafactura,0,',','.');
			$totalv_iva5factura=number_format($totalv_iva5factura,0,',','.');
			
			$totalv_nnc=number_format($totalv_nnc,0,',','.');
			$totalv_ivanc=number_format($totalv_ivanc,0,',','.');
			$totalv_iva5nc=number_format($totalv_iva5nc,0,',','.');
			
			$totalv_nnd=number_format($totalv_nnd,0,',','.');
			$totalv_ivand=number_format($totalv_ivand,0,',','.');
			$totalv_iva5nd=number_format($totalv_iva5nd,0,',','.');
			
			$totalv_debitos=number_format($totalv_debitos,0,',','.');
            $totalv_iva=number_format($totalv_iva,0,',','.');
			$totalv_iva5=number_format($totalv_iva5,0,',','.');
			
		$totalc_factura=0;
		$totalc_ivafactura=0;
		$totalc_iva5factura=0;
		
		$totalc_facturae=0;
		$totalc_ivafacturae=0;
		$totalc_iva5facturae=0;
		
		$totalc_nc=0;
		$totalc_ivanc=0;
		$totalc_iva5nc=0;
		
		$totalc_nce=0;
		$totalc_ivance=0;
		$totalc_iva5nce=0;
		
		$totalc_nd=0;
		$totalc_ivand=0;
		$totalc_iva5nd=0;
		
		$totalc_nde=0;
		$totalc_ivande=0;
		$totalc_iva5nde=0;
        $totalc_FC=0;
      	$totalc_nFC=0;
		$totalc_ivaFC=0;
		$totalc_iva5FC=0;
   	    $totalc_FE=0;
     	$totalc_nFE=0;
		$totalc_ivaFE=0;
		$totalc_iva5FE=0;
        $totalc_FEE=0;
	    $totalc_nFEE=0;
		$totalc_ivaFEE=0;
		$totalc_iva5FEE=0;
		
		
		$totalc_nfactura=0;
		$totalc_nfacturae=0;
		$totalc_nnc=0;
		$totalc_nnce=0;
		$totalc_nnd=0;
		$totalc_nnde=0;
		
		$totalc_nFC=0;
		$totalc_nFE=0;
		$totalc_nFEE=0;
if ($id_bodega==0)
{		
$sqlfs = "SELECT * FROM entrada, tipo_dcto WHERE extract(month from fecha_recepcion)='$mes2' AND extract(year from fecha_emision)='$ano2' AND (tipo_dcto.descripcion='FACTURA ELECTRONICA' OR tipo_dcto.descripcion='NC ELECTRONICA' OR tipo_dcto.descripcion='ND ELECTRONICA' OR tipo_dcto.descripcion='FACTURA' OR tipo_dcto.descripcion='NC' OR tipo_dcto.descripcion='ND' OR tipo_dcto.descripcion='FACTURA ELECTRONICA EXENTA'  OR tipo_dcto.descripcion='FACTURA EXENTA' OR tipo_dcto.descripcion='FACTURA DE COMPRA') AND tipo_dcto.id = entrada.tipo_dcto AND entrada.empresa = $id_empresa";
}
else
{
$sqlfs = "SELECT * FROM entrada, tipo_dcto WHERE extract(month from fecha_recepcion)='$mes2' AND extract(year from fecha_emision)='$ano2' AND (tipo_dcto.descripcion='FACTURA ELECTRONICA' OR tipo_dcto.descripcion='NC ELECTRONICA' OR tipo_dcto.descripcion='ND ELECTRONICA' OR tipo_dcto.descripcion='FACTURA' OR tipo_dcto.descripcion='NC' OR tipo_dcto.descripcion='ND' OR tipo_dcto.descripcion='FACTURA ELECTRONICA EXENTA'  OR tipo_dcto.descripcion='FACTURA EXENTA' OR tipo_dcto.descripcion='FACTURA DE COMPRA') AND tipo_dcto.id = entrada.tipo_dcto AND entrada.empresa = $id_empresa AND bodega=$id_bodega";
}
$resfs = mysql_query($sqlfs,$enlace);	
			$cont=0;
			while (mysql_fetch_object ($resfs))
				{
				$fecha = mysql_result($resfs, $cont, "fecha_emision");
				$dia = substr ($fecha, 8, 2)."/".substr ($fecha, 5, 2)."/".substr ($fecha, 0, 4);
				$iddcto = mysql_result($resfs, $cont, "tipo_dcto");
				$valorneto= mysql_result($resfs, $cont, "neto");
				$valoriva= mysql_result($resfs, $cont, "iva");
				$valoriva5= mysql_result($resfs, $cont, "iva_retenido");
		         $valorexento= mysql_result($resfs, $cont, "exento");
    		       if($iddcto==8)
					{
					$totalc_FC+=1;
					$totalc_nFC+=$valorneto;
					$totalc_ivaFC+=$valoriva;
					$totalc_iva5FC+=$valoriva5;
					}
					if($iddcto==9)
					{
					$totalc_FE+=1;
					$totalc_eFE+=$valorexento;
					$totalc_nFE+=$valorneto;
					$totalc_ivaFE+=$valoriva;
					$totalc_iva5FE+=$valoriva5;
					}
					if($iddcto==19)
					{
					$totalc_FEE+=1;
					$totalc_eFEE+=$valorexento;
					$totalc_nFEE+=$valorneto;
					$totalc_ivaFEE+=$valoriva;
					$totalc_iva5FEE+=$valoriva5;
					}
				
				if($iddcto==2)
					{
					$totalc_factura+=1;
					$totalc_nfactura+=$valorneto;
					$totalc_ivafactura+=$valoriva;
					$totalc_iva5factura+=$valoriva5;
					}
				if($iddcto==33)
					{
					$totalc_facturae+=1;
					$totalc_nfacturae+=$valorneto;
					$totalc_ivafacturae+=$valoriva;
					$totalc_iva5facturae+=$valoriva5;
					}
				
				if($iddcto==6)
					{
					$totalc_nc+=1;
					$totalc_nnc+=$valorneto;
					$totalc_ivanc+=$valoriva;
					$totalc_iva5nc+=$valoriva5;
					}
				if($iddcto==61)
					{
					$totalc_nce+=1;
					$totalc_nnce+=$valorneto;
					$totalc_ivance+=$valoriva;
					$totalc_iva5nce+=$valoriva5;
					}	
				if($iddcto==7)
					{
					$totalc_nd+=1;
					$totalc_nnd+=$valorneto;
					$totalc_ivand+=$valoriva;
					$totalc_iva5nd+=$valoriva5;
					}
				if($iddcto==56)
					{
					$totalc_nde+=1;
					$totalc_nnde+=$valorneto;
					$totalc_ivande+=$valoriva;
					$totalc_iva5nde+=$valoriva5;
					}
				if($iddcto==3)$dcto='NV';
				if($iddcto==4)$dcto='C';
				if($iddcto==5)$dcto='G';
				
			$cont+=1;
			}
$totalc_exentos=$totalc_eFE+$totalc_eFEE;			
$totalc_creditos=$totalc_nfactura-$totalc_nnc+$totalc_nnd+$totalc_nfacturae-$totalc_nnce+$totalc_nnde+$totalc_nFC+$totalc_nFE+$totalc_nFEE;
$totalc_iva=$totalc_ivafactura-$totalc_ivanc+$totalc_ivand+$totalc_ivafacturae-$totalc_ivance+$totalc_ivande+$totalc_ivaFC+$totalc_ivaFE+$totalc_ivaFEE;
$totalc_iva5=$totalc_iva5factura-$totalc_iva5nc+$totalc_iva5nd+$totalc_iva5facturae-$totalc_iva5nce+$totalc_iva5nde+$totalc_iva5FC+$totalc_ivaFE+$totalc_iva5FEE;
		
			
			
		
			$totalc_nfactura=number_format($totalc_nfactura,0,',','.');
			$totalc_ivafactura=number_format($totalc_ivafactura,0,',','.');
			$totalc_iva5factura=number_format($totalc_iva5factura,0,',','.');
			
			$totalc_nnc=number_format($totalc_nnc,0,',','.');
			$totalc_ivanc=number_format($totalc_ivanc,0,',','.');
			$totalc_iva5nc=number_format($totalc_iva5nc,0,',','.');
			
			$totalc_nnd=number_format($totalc_nnd,0,',','.');
			$totalc_ivand=number_format($totalc_ivand,0,',','.');
			$totalc_iva5nd=number_format($totalc_iva5nd,0,',','.');
			
			$totalc_nfacturae=number_format($totalc_nfacturae,0,',','.');
			$totalc_ivafacturae=number_format($totalc_ivafacturae,0,',','.');
			$totalc_iva5facturae=number_format($totalc_iva5facturae,0,',','.');
			
			$totalc_nnce=number_format($totalc_nnce,0,',','.');
            $totalc_ivance=number_format($totalc_ivance,0,',','.');
			$totalc_iva5nce=number_format($totalc_iva5nce,0,',','.');
			
			$totalc_nnde=number_format($totalc_nnde,0,',','.');
			 $totalc_ivande=number_format($totalc_ivande,0,',','.');
			$totalc_iva5nde=number_format($totalc_iva5nde,0,',','.');
		
			$totalc_creditos=number_format($totalc_creditos,0,',','.');
			$totalc_iva=number_format($totalc_iva,0,',','.');
			$totalc_iva5=number_format($totalc_iva5,0,',','.');

			?>
<style type="text/css">
<!--
.Estilo1 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px;}
.Estilo2 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color:#FF0000}
-->
</style>
</head>
<body LINK="#000000" VLINK="#000000" ALINK="#000000">  <br>
<div align="center" class="titulos2">RESUMEN DE COMPRA Y VENTAS (NETO) MES DE  
<?=$mes?> DEL <?=$aņo?> Bodega <?=$bodegas?></div>
<div align="center">

 
<!------------------------------------------------------------------>
<table width="880" border="0">
  <tr bgcolor="#CCCCCC">
    <th width="36" scope="col"><div align="center">Cant.</div></th>
    <th width="218" scope="col"><div align="center">Dcto.</div></th>
    <th width="106" scope="col"><div align="center">Compra Exento</div></th>
    <th width="106" scope="col"><div align="center">Compra Neto</div></th>
    <th width="90" scope="col"><div align="center">IVA </div></th>
    <th width="114" scope="col"><div align="center">IVA Retenido</div></th>
    <th width="106" scope="col"><div align="center">Venta Exento</div></th>
    <th width="95" scope="col"><div align="center">Venta Neto</div></th>
    <th width="84" scope="col"><div align="center">IVA</div></th>
    <th width="103" scope="col"><div align="center">IVA Retenido 5%</div></th>
  </tr>
  <tr>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="center">
      <?=$totalc_factura;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="left">Facturas Recibidas</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">
      <?=$totalc_nfactura;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">
      <?=$totalc_ivafactura;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">
      <?=$totalc_iva5factura;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
  </tr>
  <tr>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="center">
      <?=$totalc_facturae;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="left">Facturas Electronicas Recibidas</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">
      <?=$totalc_nfacturae;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">
      <?=$totalc_ivafacturae;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">
      <?=$totalc_iva5facturae;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
  </tr>
  <tr>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="center">
      <?=$totalv_factura;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="left">Facturas Electr Emitidas</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">
      <?=$totalv_nfactura;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">
      <?=$totalv_ivafactura;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">
      <?=$totalv_iva5factura;?>
    </div></td>
  </tr>
  <tr>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="center">
      <?=$totalv_boleta;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="left">Boletas Emitidas</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">
      <?=$totalv_nboleta;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">
      <?=$totalv_ivaboleta;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">
      <?=$totalv_iva5boleta;?>
    </div></td>
  </tr>
  <tr>
    <td height="35" style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="center">
      <?=$totalc_nd;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="left">ND Recibidas</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right"><font color="#FF0000">
      <?=$totalc_nnd;?>
    </font></div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">
      <?=$totalc_ivand;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">
      <?=$totalc_iva5nd;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
  </tr>
  <tr>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="center">
      <?=$totalc_nde;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="left">ND Electronicas Recibidas</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right"><font color="#FF0000">
      <?=$totalc_nnde;?>
    </font></div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">
      <?=$totalc_ivande;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">
      <?=$totalc_iva5nde;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
  </tr>
  <tr>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="center">
      <?=$totalv_nd;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="left">ND Electr Emitidas</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
      <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right"><font color="#FF0000">
      <?=$totalv_nnd;?>
    </font></div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">
      <?=$totalv_ivand;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">
      <?=$totalv_iva5nd;?>
    </div></td>
  </tr>
  <tr>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="center">
      <?=$totalc_nc;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="left">NC Recibidas</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right"><font color="#FF0000">-
          <?=$totalc_nnc;?>
    </font></div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">-
      <?=$totalc_ivanc;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">-
      <?=$totalc_iva5nc;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
  </tr>
  <tr>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="center">
      <?=$totalc_nce;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="left">NC Electronicas Recibidas</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right"><font color="#FF0000">-
          <?=$totalc_nnce;?>
    </font></div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">-
      <?=$totalc_ivance;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">-
      <?=$totalc_iva5nce;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
  </tr>
  <tr>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="center">
      <?=$totalv_nc;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="left">NC Electro Emitidas</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
      <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
       <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right"><font color="#FF0000">-
      <?=$totalv_nnc;?>
    </font></div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">-
      <?=$totalv_ivanc;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">-
      <?=$totalv_iva5nc;?>
    </div></td>
  </tr>
  <tr>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="center">
      <?=$totalc_FE;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="left">Facturas Exenta Recibidas</div></td>
     <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">
      <?=$totalc_eFE;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">
      <?=$totalc_nFE;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">
      <?=$totalc_ivaFE;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">
      <?=$totalc_iva5FE;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
     <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
  </tr>
  <tr>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="center">
      <?=$totalc_FEE;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="left">Facturas Exentas Elect Recibidas</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">
      <?=$totalc_eFEE;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">
      <?=$totalc_nFEE;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">
      <?=$totalc_ivaFEE;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">
      <?=$totalc_iva5FEE;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
     <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
  </tr>
  <tr>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="center">
      <?=$totalc_FC;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="left">Facturas Compra Recibidas</div></td>
     <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">
      <?=$totalc_nFC;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">
      <?=$totalc_ivaFC;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">
      <?=$totalc_iva5FC;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
     <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">&nbsp;</div></td>
  </tr>
  <tr>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="center">&nbsp;</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="left">Totales</div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">
      <?=$totalc_exentos;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">
      <?=$totalc_creditos;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">
      <?=$totalc_iva;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">
      <?=$totalc_iva5;?>
    </div></td>
     <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">
      <?=$totalv_exentos;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">
      <?=$totalv_debitos;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">
      <?=$totalv_iva;?>
    </div></td>
    <td style="border-color:#CCCCCC; border:solid; border-width:2px; border-right-width:1px"><div align="right">
      <?=$totalv_iva5;?>
    </div></td>
  </tr>
</table>
<form name="form1" method="post" action="">

	  <input type="button" name="imprimir" id="imprimir" value="Imprimir" onClick="fun_imprimir();">
	  <input name="txt_nv" id="txt_nv" type="text" style="visibility:hidden" size="1">
    </form>
  </div>
</body>
</html>

<script language="javascript" type="text/javascript">
function cerrar()
{
window.top.open('','_parent','');
window.top.close();
}
function fun_imprimir()
	{
	document.getElementById('imprimir').style.display = "none";
	window.print();
	document.getElementById('imprimir').style.display = "block";
	};

</script>