<?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 //foreach($_GET as $campo => $valor){${$campo}=$valor;} ?>
<?php 

// echo '*/*/*/*'.$prec;

$sql_item ='select * from item00 ';
$sql_item.=' left join tlla0 on item_tlla=tlla_codigo  ';
$sql_item.=' left join mrca0 on item_mrca=mrca_codigo ';
$sql_item.=' where item_codigo like "'.trim($codigo).'"';
$res_item=msql_query($sql_item,$link_vcrx);

$sizedescri=10;
$item_codigo=@msql_result($res_item,0,'item_codigo'); 
$item_marca=@ucwords(strtolower(msql_result($res_item,0,'mrca_descri')));
$item_master=substr($item_codigo,0,6);
$bc_ean13=@msql_result($res_item,0,'bc_ean13');
$item_ean=@msql_result($res_item,0,'item_ean');
$item_ean13bc=@msql_result($res_item,0,'item_ean13bc');
$item_ean8bc=@msql_result($res_item,0,'item_ean8bc');
$item_lsub=@msql_result($res_item,0,'item_lsub');
$item_puni=@msql_result($res_item,0,'item_puni');
$item_pvp1=@msql_result($res_item,0,'item_pvp1');

$xprec=@msql_result($res_item,0,'item_pvp'.$prec);



$clor_codigo=@msql_result($res_item,0,'item_clor');
$clor_descri=@msql_result($res_item,0,'clor_descri');
$tlla_descri=@msql_result($res_item,0,'tlla_descri');



$item_eanbc=$item_ean13bc;
$clor_descri=substr($clor_descri,0,7);



if(substr($item_master,0,2)=='20')
{$item_master=substr($item_codigo,0,8);}

// $descri=@substr(msql_result($res_item,0,'item_descri'),0,strpos(msql_result($res_item,0,'item_descri'),'/'));
$descri=msql_result($res_item,0,'item_descri');
$descri=@substr($descri,0,strpos($descri,'/'));
if(trim($descri)==""){$descri=@msql_result($res_item,0,'item_descri');}

if(mb_stristr('gmny.gnya',$cfg_empr))
{
  $descri=str_replace('BLUSA','BL.',$descri);
  $descri=str_replace('SHORT','SH.',$descri);
  $descri=str_replace('CON ','C/',$descri);
  $descri=str_replace('FALDA','FA.',$descri);
  $descri=str_replace('VESTIDO','VES.',$descri);
  $descri=str_replace('CAMISA','CAM.',$descri);
  $descri=str_replace('DELANTERA','DELANT.',$descri);
  $descri=str_replace('DELANTERO','DELANT.',$descri);
  $descri=str_replace('DECORATIVA','DECOR.',$descri);
  $descri=str_replace('DECORATIVO','DECOR.',$descri);
  $descri=str_replace('CAMISETA','CAM.',$descri);
  $descri=str_replace('COMBINADA','COMBI.',$descri);
  $descri=str_replace('ESTAMPAD','ESTPD',$descri);
  $descri=str_replace('CONJUNTO','CJTO.',$descri);
  $descri=str_replace('PESPUNTE','PESP.',$descri);
  $descri=str_replace('PESPUNTES','PESP.',$descri);
}

if(strlen(trim($descri))>20){$sizedescri=8;}


$talla='';
$xlote=0;
$xpvp1=0;

if (isset($_GET['ipvp1']) && !empty($_GET['ipvp1'])){$xpvp1=msql_result($res_item,0,'item_pvp1');}
	
if (isset($_GET['lote']) && !empty($_GET['lote'])){$xlote=1;}


// echo '*/*//*/*'.$_POST['ipvp1'];
	
//if($_GET['eti']=='1'){}
if($_GET['itlla']=='0')
{
	$sql_item0='select *from item00 left join tlla0 on item_tlla=tlla_codigo left join mrca0 on item_mrca=mrca_codigo where item_codigo like "'.substr($item,0,6).'"';
	$res_item0=msql_query($sql_item0,$link_vcrx);
	$bc_ean13=msql_result($res_item0,0,'bc_ean13');
	$item_ean=msql_result($res_item0,0,'item_ean');
	$item_ean8bc=msql_result($res_item0,0,'item_ean8bc');
	$item_ean13bc=msql_result($res_item0,0,'item_ean13bc');
}


// echo '*/*/*/'.$codigo;


?>
<!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>Etiqueta Codigo de Barras</title>
<style type="text/css">
body{ margin:0px; padding:0px; font:"Arial", Arial;}
#contenedor{ width:1000px;margin:0px;padding:0px;}

@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">

   
<?php // ETIQUETAS MATERIA PRIMA ?>	
	
<?php if(mb_stristr($item_lsub,'MPRI')) { ?>
	
<table valign="top" align="left" width="40%" cellspacing="0" cellpading="0" border="1" style="font-size:24px; border-collapse:collapse">
<tr align="center">
<!-- 	<td width="20%" style="transform: rotate(270deg);";>
	<cbean13 style="font-size:40px; padding:0px; margin:1px;"><?php if(strlen(trim($item_ean)==13)){echo $item_ean13bc;}else{echo $item_ean8bc;};?></cbean13>	
	</td> -->
	<td width="100%" colspan=2>
	<?php echo str_repeat('\\\*//',10);?>	
	<br>	
	<?php //echo '*** '.msql_result($res_item,0,'item_codigo').' ***';?>	
	<?php echo  str_repeat('*',8).'__ '.msql_result($res_item,0,'item_codigo').' __'.str_repeat('*',8);?>	
	</td>
</tr>	
<tr>
	<td style="" colspan=2;>
	<div style="font-size:20px; font-style:italic; font-weight: bold;  " >
	<?php echo ''.$descri. '';?>	
	</div>	
</tr>
<tr>
	<td>
	<div  style="font-size:15px;" >
	<?php echo 'COLOR: '.r_fiel('clor',msql_result($res_item,0,'item_clor'));?>	
	<br>	
	<?php echo 'MRKA: '.msql_result($res_item,0,'mrca_descri');?>	
	</div>	
	</td>
	<td width="45%" style="" align="left">
	<cbean13 style="font-size:50px; padding:0px; margin:1px; "><?php if(strlen(trim($item_ean)==13)){echo $item_ean13bc;}else{echo $item_ean8bc;};?></cbean13>	
	</td>
</tr>	
<tr>
</tr>	
	
</table>
<?php } ?>	

	
<?php // ETIQUETAS PRODUCTO TERMINADO ?>	
	
<?php if(!mb_stristr($item_lsub,'MPRI')) { ?>
<table valign="top" align="left" width="32%" cellspacing="0" cellpading="0" border="0" style="font-size:18px; border-collapse:collapse">
<tr>
<?php for($c=1;$c<=2;$c++) { ?>
<td>
<table width="100%" cellpadding="0" cellspacing="0" border="0" style="font-size:12px; border-left:solid 0px;border-right:solid 0px">
<?php if ($xlote==0) { ?>
	<tr height="5px"></tr>
<?php } ?>

<tr align="center">
    <td><pscript style="font-size:40px;"><?php { echo $item_marca;}?></pscript></td>
</tr>
<tr align="left">
    <td style="padding-left:10px;"><span style="font-size:<?php echo $sizedescri; ?>px; ">
	<?php //echo substr($descri,0,25);?>
	<?php echo substr(trim($descri),0,50);?>
	</span></td>
</tr>
<?php //$bc_ean13='$!88B8AA-bbifad!';?>  
<tr align="left">
    <td><cbean13 style="font-size:50px; padding:0px; margin:-10px;">
      <?php //if(strlen(trim($item_ean)==13)){echo $item_ean13bc;}else{echo $item_ean8bc;};?>
      <?php echo $item_eanbc;?>
      </cbean13></td>
</tr>
	
<tr align="center">
    <td>
    	<div><span style="font-size:12px;font-weight:bolder;">
         <?php echo $item_master;?>
        <?php if($xprec==0){echo '<br>';}?>
         <?php echo '/'.$clor_descri;?>
         <?php echo '/'.$tlla_descri;?>
         <?php //echo '<br> /'.substr(@msql_result($res_item,0,'clor_tipo'),0,2).'-'.substr(@msql_result($res_item,0,'clor_descri'),0,2);?>
       </span></div>
        <div><b><?php if($xprec>0){ echo 'P.V.P.  $'.number_format($xprec,2);}?></b></div>
        <div><b><?php if($xlote==1){ echo 'LOTE :'.$_GET['lote'];}?></b></div>
    </td>
</tr>
</table>
</td>

<?php if ($c==1) { ?>
<td width ="10px"></td>	
<?php } ?>
	
<?php } ?>
</tr>
</table>
<?php } ?>	



</div>
</div>

</body>
</html>
<?php	

?>