CODE BAR ( por si alguien le sirve )

Post Reply
User avatar
sysctrl2
Posts: 833
Joined: Mon Feb 05, 2007 7:15 pm
Contact:

CODE BAR ( por si alguien le sirve )

Post by sysctrl2 »

Amigos con este código de barra, hecho en FWH,

imprimimos código de barra con BARLIB.

Code: Select all

METHOD BuildCode() CLASS ScCodebar
  local oPrn
  local nAncho := 6 //medidas en cm
  local nLargo := 3  //medidas en cm
  
   PrnSetSize(nAncho*100, nLargo*100) //tamaño de la etiqueta

   PRINT oPrn NAME "SysCtrl CodeBar" PREVIEW

   define font oFont name "New Roman" size 0, -08 of oPrn

   oPrn:lPrvModal := .t.

   oPrn:SetPortrait()

   ::nRowStep := oPrn:nVertRes() / nLargo
   ::nColStep := oPrn:nHorzRes() / nAncho

   if ! oPrn:setup()
      return nil
   endif


    for i := 1 to nCuantos
      PAGE
       nRow := 1
       nCol := .5


        oPrn:Say(nRow, ::nColStep * nCol,cstr2(cCode_bar), oFont )

        nRow += ::nRowStep*.5

        @ nRow , ::nColStep*nCol code128 cstr2(cCode_bar) of oPrn SIZE 1

        nRow += ::nRowStep

        oPrn:Say( nRow, ::nColStep * nCol, cstr2(cNombre), oFont )


      ENDPAGE
    next
   ENDPRINT
   
return nil   
 
Image

Por si a alguien le interesa ahi esta,
estas etiquetas se imprimen en una impresora ZEBRA,

saludos..
Cesar Cortes Cruz
SysCtrl Software
Mexico

' Sin +- FWH es mejor "
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: CODE BAR ( por si alguien le sirve )

Post by karinha »

César, és posible hacer un DEMO simples en formato *.zip con las librerias que usastes y poner en un link? Gracias, saludos.
Last edited by karinha on Fri Feb 26, 2016 9:51 pm, edited 2 times in total.
João Santos - São Paulo - Brasil
User avatar
sysctrl2
Posts: 833
Joined: Mon Feb 05, 2007 7:15 pm
Contact:

Re: CODE BAR ( por si alguien le sirve )

Post by sysctrl2 »

Hola con mucho gusto, en un momento hago un test y lo subo aquí.

saludos..
Cesar Cortes Cruz
SysCtrl Software
Mexico

' Sin +- FWH es mejor "
User avatar
sysctrl2
Posts: 833
Joined: Mon Feb 05, 2007 7:15 pm
Contact:

Re: CODE BAR ( por si alguien le sirve )

Post by sysctrl2 »

karinha, amigo
servido aquí tienes,
saludos.

https://app.box.com/s/y6cfnku4stb9r0y2rgwf7rnc14djccxj
Cesar Cortes Cruz
SysCtrl Software
Mexico

' Sin +- FWH es mejor "
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: CODE BAR ( por si alguien le sirve )

Post by karinha »

Muchas gracias Friend!! Excelente!
João Santos - São Paulo - Brasil
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: CODE BAR ( por si alguien le sirve )

Post by karinha »

César, mejoras:

Code: Select all

#include "fivewin.ch"
#include 'barcode.ch'  // C:\FWH\INCLUDE

#DEFINE C_SIMPLE CHR( 39 )
#DEFINE c_simple CHR( 39 )

* +++++++++++++++++++++++++++++++++++++++++++++++++++++++ *
*                                                         *
* SysCtrl CodeBar + BARLIB DE Cayetano Gomez              *
*                                                         *
* Sistema para imprimir codigos de barra                  *
*                                                         *
* fecha 26 de febrero 2016                                *
* Autor: Cesar Cortes Cruz                                *
* CopyRight (c) SysCtrl Software 2003-2016                *
* +++++++++++++++++++++++++++++++++++++++++++++++++++++++ *

/* Nota: 
  esta aplicacion fue desarrollada para imprimir etiquetas de codigos de barra en impresora ZEBRA
  importante que la impresora este calibrada por el programa ( ZebraDesigner )
  toda duda o mejoras es bienvenido.
*/

static oCode, oWnd
static cCode_bar
static cNombre
static nCuantos

REQUEST HB_LANG_PT
REQUEST HB_CODEPAGE_PT850

function Principal()

   PRIVATE SELF

   SET DATE BRITISH
   SET EPOCH TO 1950
   SET CENTURY ON
   SET SOFTSEEK OFF
   SET WRAP ON
   SETCANCEL( .F. )
   SET CONFIRM OFF
   SET DELETED ON
   SET ESCAPE OFF
   SET EXACT ON
   SET EXCLUSIVE OFF
   SET MULTIPLE OFF

   HB_LANGSELECT( 'PT' )         // Default language is now Portuguese
   HB_SETCODEPAGE( "PT850" )

   IF IsExeRunning( cFileName( HB_ARGV( 0 ) ) )
      QUIT
   ENDIF

   WITH OBJECT ScCodebar()
      :New()
   END OBJECT

return nil

CLASS ScCodebar

  data oCon AS OBJECT

  * ---------------------------------- *
  * variables usadas en tprinter       *
  * ---------------------------------- *
  data nRowStep, nColStep

  Method New( oCon )
  METHOD MakeWin()
  METHOD MakeDlg()
  METHOD BuildCode()

ENDCLASS

METHOD New() CLASS ScCodebar

  ::MakeWin()

Return nil

METHOD MakeWin() CLASS ScCodebar

   local oMenu
   local oSelf := Self

   menu oMenu 2007

      menuitem "MENU: SysCtrl CodeBar + ( BARLIB ) "

         menu

            menuitem "Codigo STD Ean13"   action( oSelf:MakeDlg() )

            SEPARATOR
            menuitem "Salida del Sistema" action( Encerra( oWnd ) )

         endmenu

   endmenu

   define window oWnd menu oMenu TITLE "SysCtrl CodeBar + Barlib of Cayetano Gomez"

   activate window oWnd

return nil

METHOD MakeDlg() CLASS ScCodebar

   local oGet := array( 10 )
   local oBtn := array( 2 )
   local oBrush
   local oBox
   local nRow := 10

   cCode_bar := "A1A1A1A1A1A1"
   cNombre   := "NOMBRE DEL PRODUCTO"
   nCuantos  := 10  //cuantas etiquetas

   DEFINE BRUSH oBrush    color nrgb(255,255,255 )

   DEFINE DIALOG oBox  SIZE 600, 250 FONT WndMain():oFont TRANSPARENT BRUSH oBrush

   oBox:lhelpicon := .F.

   oBox:lTransparent := .t.
   oBox:cTitle := "Impresion de etiquedas para productos ..."

   @ nRow, 10 SAY "Clave de producto: " OF oBox pixel
   @ nRow, 70 GET oGet[ 1] VAR cCode_bar of oBox SIZE 100, 10 ;
      PICTURE "@!k" PIXEL UPDATE

   nRow += 15

   @ nRow, 10 SAY "Nombre: " OF oBox pixel
   @ nRow, 70 GET oGet[ 2] VAR cNombre of oBox SIZE 230, 10 ;
      PICTURE "@!k" PIXEL UPDATE
   
   nRow += 15

   @ nRow, 10 SAY "Cuantas etiquetas : ? " OF oBox pixel
   @ nRow, 70 GET oGet[ 3] VAR nCuantos of oBox SIZE 30, 10 ;
      PICTURE "999999" PIXEL UPDATE

   @ 5.3, 6 BUTTON oBtn[1] PROMPT "&Aceptar"  SIZE 48, 24 OF oBox ;
       ACTION (  ::BuildCode(), oGet[1]:SetFocus() )

   @ 5.3, 18 BUTTON oBtn[2] PROMPT "&Regresar" SIZE 48, 24 OF oBox  ACTION ( oBox:end() ) CANCEL

   ACTIVATE DIALOG oBox CENTERED

RETURN NIL

METHOD BuildCode() CLASS ScCodebar

   local oPrn
   local nAncho := 6 //medidas en cm
   local nLargo := 3  //medidas en cm
   local oFont
   local nRow, nCol

   PrnSetSize(nAncho*100, nLargo*100) //tamaño de la etiqueta

   PRINT oPrn NAME "SysCtrl CodeBar" PREVIEW

   define font oFont name "New Roman" size 0, -08 of oPrn

   oPrn:lPrvModal := .t.

   oPrn:SetPortrait()

   ::nRowStep := oPrn:nVertRes() / nLargo
   ::nColStep := oPrn:nHorzRes() / nAncho

   if ! oPrn:setup()
      return nil
   endif


    for i := 1 to nCuantos
      PAGE
       nRow := 1
       nCol := .5

        oPrn:Say(nRow, ::nColStep * nCol,cstr2(cCode_bar), oFont )

        nRow += ::nRowStep*.5

        @ nRow , ::nColStep*nCol code128 cstr2(cCode_bar) of oPrn SIZE 1

        nRow += ::nRowStep

        oPrn:Say( nRow, ::nColStep * nCol, cstr2(cNombre), oFont )


      ENDPAGE

    next

   ENDPRINT
   
return nil   


FUNCTION cStr2( nNum )
RETURN AllTrim( CStr( nNum ) )


FUNCTION ENCERRA( oWnd  )

   oWnd:End()

   FreeResources()

   SysRefresh()

   RELEASE All

   Hb_GCAll( .T. )

   CLEAR MEMORY

   PostQuitMessage( 0 )

   __QUIT()

RETURN NIL

// FIN
 
Muchas gracias, saludos.
João Santos - São Paulo - Brasil
User avatar
sysctrl2
Posts: 833
Joined: Mon Feb 05, 2007 7:15 pm
Contact:

Re: CODE BAR ( por si alguien le sirve )

Post by sysctrl2 »

Bien amigo, gracias,

saludos..
Cesar Cortes Cruz
SysCtrl Software
Mexico

' Sin +- FWH es mejor "
User avatar
FranciscoA
Posts: 1964
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: CODE BAR ( por si alguien le sirve )

Post by FranciscoA »

Muchas gracias, Cesar. Voy a probarlo.
Saludos.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh1204-MySql-TMySql
User avatar
sysctrl2
Posts: 833
Joined: Mon Feb 05, 2007 7:15 pm
Contact:

Re: CODE BAR ( por si alguien le sirve )

Post by sysctrl2 »

ok. Francisco,
saludos.
Cesar.
Cesar Cortes Cruz
SysCtrl Software
Mexico

' Sin +- FWH es mejor "
ACC69
Posts: 619
Joined: Tue Dec 12, 2006 7:34 pm
Contact:

Re: CODE BAR ( por si alguien le sirve )

Post by ACC69 »

sysctrl2 wrote:ok. Francisco,
saludos.
Cesar.

Gracias Cesar Cortez.

Saludos
Post Reply