Ayuda Codigo de Barra
Alguien podrÃa decirme como puedo crear y leer codigos de barra con Visual FoxPro 6.0 ? Muchas gracias.
Un articulo muy bueno y hasta con codigo en visual fox para codigo de barra esta en
http://www.portalfox.com/modules.php?op=modload&name=News&file=article&sid=117&mode=nested&order=0&thold=0
Espero le sirva a laguien
http://www.portalfox.com/modules.php?op=modload&name=News&file=article&sid=117&mode=nested&order=0&thold=0
Espero le sirva a laguien
Este algoritmo es para el codigo de barras 128. Tenés que bajarte de internet la fuente. Se llaman SADC128A,SADC128B,SADC128C,SADC128D,SADC128E,SADC128F. Yo particularmente utilizo la B.
parameter x
local ancho,vletra,sstart,sstop,chn,chd,veces
veces=0
vletra=chr(int(rand()*25)+66)
x=x+vletra
ancho=len(x)
sstart=chr(0204)
sstop=chr(0206)
chn=104
chd=""
xx=x
n=len(xx)
for i=1 to n
y=substr(xx,i,1)
if y=""
t=64
else
z=asc(y)
do case
case z>=0 and z<=31
t=z+64
case z>=192 and z<=223
t=z-192+64
case z>=32 and z<=138
t=z-32
case z>=161 and z<=170
t=z-65
otherwise
outstring="Error en la entrada"
messagebox("ERROR EN LA ENTRADA",48,"Error")
cancel
endcase
endif
chn=chn+i*t
next
t=mod(chn,103)
chd=chr(t+32)
outstring=sstart+x+chd+sstop
for i=1 to len(outstring)
x=substr(outstring,i,1)
t=asc(x)
if t=127
outstring=left(outstring,i-1)+chr(223)+substr(outstring,i+1,1)
endif
if t=128 or t=129
outstring=left(outstring,i-1)+chr(t+33)+substr(outstring,i+1,1)
endif
next
if (substr(outstring,ancho+2,1)=chr(22) or substr(outstring,ancho+2,1)=chr(32) or substr(outstring,ancho+2,1)=chr(132) or substr(outstring,ancho+2,1)=chr(133) or substr(outstring,ancho+2,1)=chr(134) or substr(outstring,ancho+2,1)=chr(162) or substr(outstring,ancho+2,1)=chr(130) or substr(outstring,ancho+2,1)=chr(161) or substr(outstring,ancho+2,1)=chr(223) or substr(outstring,ancho+2,1)=chr(131))
return "error"
else
return outstring
endif
parameter x
local ancho,vletra,sstart,sstop,chn,chd,veces
veces=0
vletra=chr(int(rand()*25)+66)
x=x+vletra
ancho=len(x)
sstart=chr(0204)
sstop=chr(0206)
chn=104
chd=""
xx=x
n=len(xx)
for i=1 to n
y=substr(xx,i,1)
if y=""
t=64
else
z=asc(y)
do case
case z>=0 and z<=31
t=z+64
case z>=192 and z<=223
t=z-192+64
case z>=32 and z<=138
t=z-32
case z>=161 and z<=170
t=z-65
otherwise
outstring="Error en la entrada"
messagebox("ERROR EN LA ENTRADA",48,"Error")
cancel
endcase
endif
chn=chn+i*t
next
t=mod(chn,103)
chd=chr(t+32)
outstring=sstart+x+chd+sstop
for i=1 to len(outstring)
x=substr(outstring,i,1)
t=asc(x)
if t=127
outstring=left(outstring,i-1)+chr(223)+substr(outstring,i+1,1)
endif
if t=128 or t=129
outstring=left(outstring,i-1)+chr(t+33)+substr(outstring,i+1,1)
endif
next
if (substr(outstring,ancho+2,1)=chr(22) or substr(outstring,ancho+2,1)=chr(32) or substr(outstring,ancho+2,1)=chr(132) or substr(outstring,ancho+2,1)=chr(133) or substr(outstring,ancho+2,1)=chr(134) or substr(outstring,ancho+2,1)=chr(162) or substr(outstring,ancho+2,1)=chr(130) or substr(outstring,ancho+2,1)=chr(161) or substr(outstring,ancho+2,1)=chr(223) or substr(outstring,ancho+2,1)=chr(131))
return "error"
else
return outstring
endif
