if( $_POST[submit] == "Imprime Codigo" ) {
if( $_POST[cb_numero] != "" ) {
$fh = fopen('/dev/irlpt0','w') or die($php_errormsg);
fputs($fh,"! 0 200 200 400 1\r\n");
fputs($fh,"LABEL\r\n");
fputs($fh,"CONTRAST 0\r\n");
fputs($fh,"TONE 0\r\n");
fputs($fh,"SPEED 5\r\n");
fputs($fh,"PAGE-WIDTH 600\r\n");
fputs($fh,"BAR-SENSE\r\n");
fputs($fh,";// PAGE 0000000006000400\r\n");
fputs($fh,"T90 5 3 21 296 Hola Mundo\r\n");
fputs($fh,"T 5 3 157 89 Desde la ZAURUS\r\n");
fputs($fh,"BT 0 2 10\r\n");
fputs($fh,"B UPCA 2 1 90 164 176 ");
fputs($fh,"$_POST[cb_numero]\r\n");// incluye
// el numero del codigo de barra
fputs($fh,"BT OFF\r\n");
fputs($fh,"BOX 24 90 129 308 1\r\n");
fputs($fh,"LINE 279 322 279 338 21\r\n");
fputs($fh,"BOX 262 314 322 350 1\r\n");
fputs($fh,"FORM\r\n");
fputs($fh,"PRINT\r\n");
fflush($fh);
fclose($fh) or die($php_errormsg);
}
} else {
if( $_POST[submit] == "Imprime CB desde Arch" ) {
if( $_POST[cb_arch] != "" ) {
if( file_exists($_POST[cb_arch]) ) {
$fr = fopen($_POST[cb_arch],'r') or die($php_errormsg);
$cb = fread($fr,filesize($_POST[cb_arch]));
fclose($fr);
$fh = fopen('/dev/irlpt0','w') or die($php_errormsg);
fputs($fh,$cb."\r\n");
fflush($fh);
fclose($fh) or die($php_errormsg);
} else {
echo "El archivo especificado no existe";
}
}
}
}
?>
<HTML>
<HEAD>
<TITLE>Impresion codigos de Barra</TITLE>
</HEAD>
<BODY>
<FORM name = "form1" METHOD="POST" ACTION="
<?php print $_SERVER[PHP_SELF] ?>" >
<P>Codigo a Imprimir:<br>
<input name="cb_numero" type=text id="cb_numero"
size=30 value="<?php print $cb_numero ?>">
<p><input type="submit" name="submit"
value="Imprime Codigo"></p>
<p>Impresion CB desde Archivo:</p>
<input type=text name="cb_arch" size=40
value="/usr/mnt.rom/card/holaz.lbl">
<p><input type="submit" name="submit"
value="Imprime CB desde Arch"></p>
</FORM>
</BODY>
</HTML>