<?php session_start();?>
<?php include('../_cfg/config.php');?>
<?php include('php_gene1.php'); ?>
<?php include('php_session.php');?>

<?php foreach($_POST as $campo => $valor){${$campo}=$valor;} ?>
<?php 

if(substr($docu,0,2)!='CH'){die('Documento NO VALIDO');}
if(empty($user_codigo)){die('Documento NO DISPONIBLE');}
  
$sql_docu ='select *, sum(cant) as valorch ';
$sql_docu.='from bcos1, bcos2, enti0, ctab0 ';
$sql_docu.='where idnum1=idnum2 ';
$sql_docu.='and idnum1="'.$idnum.'" ';
$sql_docu.='and enti=enti_codigo ';
$sql_docu.='and ctab=ctab_codigo ';
$res_docu=msql_query($sql_docu,$link_vcrx);

// echo '<br>'.$sql_docu;
// echo '<br>'.msql_error($link_vcrx);

$ctabdesc=msql_result($res_docu,0,'ctab_descri');
$numero=msql_result($res_docu,0,'numero');
$valorch=abs(msql_result($res_docu,0,'valorch'));
$benefic=msql_result($res_docu,0,'benefic');
if(strlen($benefic)<5)
{$benefic=msql_result($res_docu,0,'enti_descri');}
$fecha=msql_result($res_docu,0,'fecha');
$ciudad='GUAYAQUIL';

// $valorch=54454;
$valorlet=num2let(abs($valorch));
// $valorlet.=' - -';
$valorlet=str_pad($valorlet,80,'  -');



?>
<!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>Cheque #<?php echo $numero; ?></title>
<style type="text/css">
body{ margin:0px; padding:0px; font:"Arial", Arial;}
#contenedor{ margin:0px;padding:0px;}
  @media print {.noprint {display:none;}}
@media screen{.noscreen {display:none}}
@page
{
  margin: 0; 
}
	
/* @font-face {
    font-family: 'Arial Narrow';
    font-weight: normal;
    font-style: italic;
  }
   
@font-face {
    font-family: 'PalScript';
	src: url('KunstlerScript.ttf')format('truetype'); 
    font-weight: normal;
    font-style: italic;
  }
		
@font-face{
    font-family:'EanP36Tt';
    src: url('../_font/EAN13_36.ttf')format('truetype'); 
    font-weight: normal;
    font-style: normal;
  }
   
@font-face{
    font-family: 'PalaceScriptMT';
    src: url('../_font/PalaceScriptMT.ttf')format('truetype'); 
    font-weight: normal;
    font-style: normal;
}
		
@font-face{
    font-family:'Barcode';
    src: url('BarcodeFont.ttf')format('truetype'); 
    font-weight: normal;
    font-style: normal;
}
	 */
/* barcode
{
   font-family: 'Barcode';
   padding:0px; margin:0px;
}
	
pscript{
   font-family: 'PalaceScriptMT';
   padding:0px; margin:0px;
}
	
cbean13 {
   font-family: 'EanP36Tt';
   padding:0px; margin:0px;
}
 */
#header{
    display: none;
}

   
   
div{font-family:Arial;}

</style>
</head>

<body >
<div align="left" valign="top">
<div id="contenedor">
   
<table valign="top" align="left" cellspacing="0" cellpading="0" border="0" 
       style="font-size:12px; border-collapse:collapse;width:156mm; font-weight:bold;">
<tr>
  <td id="zona1" style="width:78mm;height:18mm;" rowspan="2" ></td>
  <td id="zona2" style="width:18mm;height:18mm;" rowspan="2" ></td>
  <td id="zona3" style="width:60mm;height:10mm;" align="right"><span class="noprint"><?php echo $ctabdesc; ?></span></td>
</tr>  
<tr>
  <td id="zona4" style="width:60mm;height:8mm;" align="right"><span class="noprint"><?php echo $docu.'-'.$numero; ?></span></td>
</tr>
<tr >
  <td id="zona5" style="width:156mm;height:19mm;" colspan="3" valign="top">
  <table valign="top" align="left" cellspacing="0" cellpading="0" border="0" 
       style="font-size:12px; border-collapse:collapse; font-weight:bold;">
    <tr>
      <td style="width:25mm;height:8mm;"></td>
      <td style="width:110mm;height:8mm;"><?php echo $benefic; ?></td>
      <td style="width:20mm;height:8mm;" align="right">
        <div style="float:left">
        <?php echo str_pad(number_format($valorch,2),12,'*',STR_PAD_LEFT); ?>
        </div>
        <div style="float:right;width:10mm;">
        </div>
      </td>
    </tr>
    <tr>
      <td style="width:25mm;height:8mm;"></td>
      <td style="width:130mm;height:8mm;" colspan="2"><?php echo $valorlet; ?></td>
    </tr>
  </table>
  </td>
</tr>  
<tr>
  <td id="zona6" style="width:70mm;height:9mm;">
    <div style="width:5mm;float:left;"></div>
    <div style="width:65mm; float:right;"><?php echo $ciudad.', '.$fecha;?></div>
  </td>
  <td id="zona8" style="width:86mm;height:23mm;" rowspan="2" colspan="2"  ></td>
</tr>  
<tr>
  <td id="zona7" style="width:18mm;height:14mm;"></td>
</tr>
<tr>
  <td id="zona9" style="width:156mm;height:16mm;" colspan="3"></td>
</tr>
</table>

</div>
</div>

</body>
</html>
<?php	

?>