<?php
session_start();
include("cls_conexion.php");$CNN=new ClsMySQL();include("conexion23.php");
if(strlen($_SESSION['SYS_USER_ID'])==0){JsDir("login.php");	return;}
?>
<!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=euc-jp">
<style type="text/css">
.cs0{
	font-size:12px; 
	font-family:Arial, Helvetica, sans-serif; 
	font-weight:bold;
}
.cs1{
	font-size:14px; 
	font-family:Arial, Helvetica, sans-serif; 
	font-weight:bold;
}
.cs2{
	font-size:22px; 
	font-family:Arial, Helvetica, sans-serif; 
	font-weight:bold;
	margin-top:2px;	
}
.cs3{
	font-size:12px; 
	font-family:Arial, Helvetica, sans-serif; 	
}
.cs4{
	font-size:20px; 
	font-family:Arial, Helvetica, sans-serif; 
	font-weight:bold;
	margin-top:2px;	
}
</style>

<?php
function tu($s){
	$s=trim(strtoupper($s));
	return $s;
}
$ID=V($_GET['ID']);
$r=gr("vis_ventas_print","ID=$ID");	
$SER=tu($r['SER']);
$NUM=tu($r['NUM']);
$CLI=tu($r['CLI_NOM']);
$DIR=tu($r['CLI_DIR']);
$DNI=tu($r['CLI_DNI']);
$RUC=tu($r['CLI_RUC']);
$TDP=tu($r['TDP']);
$FEC=tu($r['FEC_']);
$USU=tu($r['USU']);
$VEN=tu($r['VEND']);
$USU_NOM_APE=tu($r['USU_NOM_APE']);
$TOT=$r['TOT'];
$ENV=$r['COS_ENV'];
$TOT_IMP=$r['IMP_TOT'];
//
if(strlen($CLI)==0)$CLI="-";
if(strlen($DIR)==0)$DIR="-";
if(strlen($DNI)==0)$DNI="-";
if(strlen($USU)==0)$USU="-";
if(strlen($VEN)==0)$VEN="-";
if(strlen($USU_NOM_APE)==0)$USU_NOM_APE="-";
?>
<title>Ventas imprimir</title>
</head>
<body onload=" window.print() ;">
<center>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" style="max-width:950px;" >
      <tr>
        <td width="1%">&nbsp;</td>
        <td width="98%">
            <table width="100%" border="0" cellspacing="0" cellpadding="0" >
            <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>            
            </tr>
            <tr>
            <td width="40%">
            <table width="100%" border="0" cellspacing="0" cellpadding="0" style="min-width:220px">
            <tr>
            <td align="center">
            <span  class="cs1">INVERSIONES</span>
            </td>
            </tr>
            <tr>
            <td align="center">
            <div  class="cs2">SOUND UNIVERSAL</div>
            </td>
            </tr>
            <tr>
            <td align="center">
            <div  class="cs0">JR. CUZCO 686 - LIMA</div>
            </td>
            </tr>
            <tr>
            <td align="center">
            <div  class="cs0">TELF. 428-3617</div>
            </td>
            </tr>
            </table>
            </td>
            <td width="30%">&nbsp;</td>
            <td  width="30%">
            <table width="100%" border="0" cellspacing="0" cellpadding="0" style="min-width:220px">
            <tr>
            <td align="center">&nbsp;
            
            </td>
            </tr>
            <tr>
            <td align="center">
            <div  class="cs2">NOTA DE VENTA</div>
            </td>
            </tr>
            <tr>
            <td align="center">
            <div  class="cs4"><?php echo $SER."-".$NUM;?></div>
            </td>
            </tr>
            <tr>
            <td align="center">
            <div  class="cs0">&nbsp;</div>
            </td>
            </tr>
            </table>
            </td>
            </tr>
            </table>
        </td>
        <td width="1%">&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>
        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="cs3" style="min-width:800px;">
          <tr>
            <td width="14%">Señores</td>
            <td width="1%">:</td>
            <td colspan="2"><?php echo $CLI;?></td>
            <td width="16%">&nbsp;</td>
          </tr>
          <tr>
            <td>Direccion</td>
            <td>:</td>
            <td colspan="2"><?php echo $DIR;?></td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td>Dni</td>
            <td>:</td>
            <td colspan="2"><?php echo $DNI;?></td>
            <td>&nbsp;</td>
          </tr>
          <?php
		  if(strlen($RUC)>0){
		  ?>
          <tr>
            <td>Ruc</td>
            <td>:</td>
            <td colspan="2"><?php echo $RUC;?></td>
            <td>&nbsp;</td>
          </tr>
          <?php
		  }
		  ?>
          <tr>
            <td>Medio de pago</td>
            <td>:</td>
            <td colspan="2"><?php echo $TDP;?></td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td>Fecha de emision</td>
            <td>:</td>
            <td colspan="2"><?php echo $FEC;?></td>
            <td>&nbsp;</td>
          </tr>
          
          <tr>
            <td>Vendedor</td>
            <td>:</td>
            <td colspan="2"><?php echo $VEN;?></td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td>Usuario</td>
            <td>:</td>
            <td colspan="2"><?php echo $USU;?></td>
            <td>&nbsp;</td>
          </tr>
          
            <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td colspan="2">&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
         
         
        </table>
        </td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>
        
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="cs3">
            <tr>
            <td colspan="11"><hr></td>
            </tr>
            <tr>
            <td width="4%">&nbsp;</td>
            <td width="4%">&nbsp;</td>
            <td width="3%" align="right"><b>CANT</b></td>
            <td width="1%">&nbsp;</td>
            <td width="58%"><b>DESCRIPCION</b></td>
            <td width="3%">&nbsp;</td>
            <td width="9%" align="right"><b>PRECIO</b></td> 
            <td width="6%">&nbsp;</td>
            <td width="12%" align="right"><b>IMPORTE</b></td>
            </tr>
            <tr>
            <td colspan="9"><hr></td>
            </tr>
            <?php
			$CX=0;
			$s="SELECT * FROM vis_ventas_print_det WHERE ID=$ID ORDER BY CX";
			$rs=grs($s);
			while($r=$rs->fetch_assoc()){
				$CX++;
			?>
            
            <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td align="right"><?php echo $r['CAN'];?></td>
            <td>&nbsp;</td>
            <td><?php echo $r['DES'];?></td>
            <td>&nbsp;</td>
            <td align="right"><?php echo $r['PRE'];?></td>
            <td>&nbsp;</td>
            <td align="right"><?php echo $r['IMP'];?></td>
            </tr>
            <tr>
            <td colspan="9"><hr></td>
            </tr>
            <?php
			}
			?>           
            <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td colspan="2">
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                <td><b>TOTAL IMPORTE</b></td>
                <td align="right">:</td>
                </tr>
                </table>
            </td>
            <td align="right"><b>S/ <?php echo NF2($TOT,2)?></b></td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td colspan="2">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                    <td><b>COSTO DE ENVIO</b></td>
                    <td align="right">:</td>
                    </tr>
                    </table>
              </td>
              <td align="right"><b>S/ <?php echo NF2($ENV,2)?></b></td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td colspan="2">
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                <td><b>TOTAL FINAL</b></td>
                <td align="right">:</td>
                </tr>
                </table>              
              </td>
              <td align="right"><b>S/ <?php echo NF2($TOT_IMP,2)?></b></td>
            </tr>
            </table>
            
            
        </td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
    </table>
</center>
</body>
</html>