Etiquetas con códigos de barra

Etiquetas con códigos de barra

Postby Pedro » Tue Jan 10, 2012 9:23 pm

Hola a todos
Pues eso, que si algún amable compañero, me puede tirar un ejemplo de como hacer etiquetas como las normales pero con código de barra incluido?
Es decir desde hacer una, hasta hacer un folio de esos que vienen con etiquetas.
Un saludo
Pedro
gahetesoft@gmail.com
FWH12.06 BCC582, Xverce CW, Pelles C 6.00.4,PSPAD 4.54
y ahora con ADO
User avatar
Pedro
 
Posts: 464
Joined: Tue Mar 21, 2006 7:30 pm
Location: Córdoba (España)

Re: Etiquetas con códigos de barra

Postby FiveWiDi » Tue Jan 10, 2012 11:08 pm

Pedro wrote:Hola a todos
Pues eso, que si algún amable compañero, me puede tirar un ejemplo de como hacer etiquetas como las normales pero con código de barra incluido?
Es decir desde hacer una, hasta hacer un folio de esos que vienen con etiquetas.


Buenas Noches Pedro (de Córdoba-España supongo),

Perdona que 'vomite' aquí este código 'tal cual' y sin comentar nada sobre él, pero quizás te sirva.
Son 2 impresiones independientes de etiquetas.

Una me gusta mucho por que utiliza 3 joyas que tenemos disponibles de 3 'Grandes':
-Barlib de Cayetano
-TImprime de Rafa Carmona (The Full)
-TDBF de Manuel Expósito

Insisto 3 JOYAS en mayúsculas.

Code: Select all  Expand view

=========
1er. PRG
=========

#include "AMPA32.ch"

/* *************************************************************************
   Per a imprimir codi de barres EAN13
   ********************************************************************** */


FUNCTION ImprCoba( AmpaArra )

Local nCodBar13Ini := 0
Local nCodBar13Fin := 0
Local nEtiqLini    := 6
Local nEtiqCOLU    := 12


If MsgGet( "CODI DE BARRES INICIAL", "Indiqui el número INICIAL de codi de barres a imprimir:", @nCodBar13Ini, Nil, Nil )

    If MsgGet( "CODI DE BARRES FINAL", "Indiqui el número FINAL de codi de barres a imprimir:", @nCodBar13Fin, Nil, Nil )

        If MsgGet( "Nombre d'etiquetes per LÍNIA", "Indiqui nombre d'etiquetes per LÍNIA:", @nEtiqLini, Nil, Nil )

            If MsgGet( "Nombre d'etiquetes per COLUMNA", "Indiqui nombre d'etiquetes per COLUMNA:", @nEtiqCOLU, Nil, Nil )

                TImpCoBa():New( AMPAArra, nCodBar13Ini, nCodBar13Fin, nEtiqLini, nEtiqCOLU )

            EndIf

        EndIf

    EndIf

EndIf


Return Nil

/* *************************************************************************
/* *************************************************************************
   Per a imprimir codi de barres CODE128
   ********************************************************************** */


FUNCTION ImprCobaAlum( AmpaArra )

Local aFiltro     := aFiltroFun( AMPAARRA )
Local nEtiqLini    := 4
Local nEtiqCOLU    := 12
Local nEtiqAlum    := 1
Local aOrden       := aOrdenFun( AMPAARRA )

aOrden[2] := 4

aFiltro := Filtro01( AMPAarra, AMPAarra[1][1][2][1][1], "ALUMNE", Nil, Nil, .F., aFiltro, .F. )

If aFiltro[1] = 1

    aOrden := Orden01( AMPAARRA, AMPAarra[1][1][2][1][1], "ALUMNE", Nil, .F., aOrden )

    If aOrden[3]

        If MsgGet( "Nombre d'etiquetes per LÍNIA", "Indiqui nombre d'etiquetes per LÍNIA:", @nEtiqLini, Nil, Nil )

            If MsgGet( "Nombre d'etiquetes per COLUMNA", "Indiqui nombre d'etiquetes per COLUMNA:", @nEtiqCOLU, Nil, Nil )

                If MsgGet( "Nombre d'etiquetes per ALUMNE", "Indiqui nombre d'etiquetes per ALUMNE:", @nEtiqAlum, Nil, Nil )

                    TImpCoBaAlum():New( AMPAArra, nEtiqLini, nEtiqCOLU, nEtiqAlum, aFiltro, aOrden )

                EndIf

            EndIf

        EndIf

    EndIf

EndIf
Return Nil
/* ********************************************************************** */


========
2do. PRG
========

#include "AMPA32.ch"

//#INCLUDE "Fivewin.CH"

#INCLUDE "Utilprn.CH"
#INCLUDE "Barcode.CH"

#DEFINE CLR_GREY 14671839

************************************************************************
************************************************************************
************************************************************************
*Clase para realizar unas etiquetas
*Haciendo uso de la Clausula NOBOX.

CLASS TIMPCOBA FROM TIMPRIME

      CLASSDATA lRegistered AS LOGICAL

      DATA lprevisual
      DATA ARRAAMPA
      DATA nContadora

      // Methods constructores
      //METHOD Init( cSpool)
      METHOD New( AMPAARRA, nCodBar13Ini, nCodBar13Fin, netiqlini, netiqfila ) CONSTRUCTOR

      METHOD Etiqueta()
      METHOD InitLineFile() INLINE ( ::nLinea := 0, ::nFila := 0 )
      METHOD Separator()  // Este method es compartido por las dos clases

ENDCLASS

METHOD New( AMPAARRA, nCodBar13Ini, nCodBar13Fin, netiqlini, netiqfila )  CLASS TIMPCOBA

    ::ARRAAMPA := AMPAARRA

    /* Es solicita si es desitja previsualitzar.
       --------------------------------------*/

    ::lprevisual := MsgNoYes( "Es desitja previsualitzar?", "Atenció!" )

    traza( 1, "::lPrevisual=", ::lprevisual )

    msgnowait2( AMPAARRA, "Imprimint ...", "Cancel·lar...")

    CursorWait()

    /* Inicia el proceso de impresión
       --------------------------- */

    IMPRIME INIT "Impressió EAN13 entre " + AllTrim( Str( nCodBar13Ini, 15, 0 ) ) + " i " + AllTrim( Str( nCodBar13Fin, 15, 0 ) )

    PAGE
      ::Etiqueta( nCodBar13Ini, nCodBar13Fin, netiqlini, netiqfila )
    ENDPAGE

//TRAZA(1, "::oPrn:nVertRes()=", ::oPrn:nVertRes() )
//TRAZA(1, "::oPrn:nHORZRes()=", ::oPrn:nHORZRes() )
//TRAZA(1, "::oPrn:nVertSIZE()=", ::oPrn:nVertSIZE() )
//TRAZA(1, "::oPrn:nHORZSIZE()=", ::oPrn:nHORZSIZE() )

//TRAZA(1, "::oPrn:GetPhySize()[1]=", ::oPrn:GetPhySize()[1] )
//TRAZA(1, "::oPrn:GetPhySize()[2]=", ::oPrn:GetPhySize()[2] )


    IMPRIME END .F.

    CursorArrow()

    EndMsgNoWait( ::ARRAAMPA )

Return .T.

METHOD Etiqueta( nCodBar13Ini, nCodBar13Fin, netiqlini, netiqfila ) CLASS TIMPCOBA

Local nContador := 0
Local nFlag     := 1
Local nVertSIZE := 0
Local nHORZSIZE := 0
Local cCode     := ""

nVertSIZE := Val(Str( ::oPrn:GetPhySize()[2] / 10, 4, 1 ) )
nHORZSIZE := Val(Str( ::oPrn:GetPhySize()[1] / 10, 4, 1 ) )

TRAZA(1, "nVertSIZE=", nVertSIZE )
TRAZA(1, "nHORZSIZE=", nHORZSIZE )

::InitLineFile()

    For nContador := nCodBar13Ini To nCodBar13Fin STEP 1

         // Usando BARLIB de Cayetano.
         // Para no tener que retocar el .CH ni historia solamente tendremos que
         // pasar en vez de nCol como hasta ahora , hacerlo asi, ::oUtil:Row( nRow ), donde nRow
         // sera un valor expresado en CMS.

         /* Si los márgenes son '0':
            ::oPrn:nVertSIZE()=297     MILIMETROS !!!
            ::oPrn:nHORZSIZE()=210
         */



         //@ ::oUtil:Row( ::nLinea + 1.5 ), ::oUtil:Col( ::nFila  - 1 ) EAN13 Right("000000000000" + AllTrim(Str( nContador, 12, 0) ), 12) ;
         // OF ::oUtil:oPrinter SIZE 1 BANNER

         //@ ::oUtil:Row( ::nLinea + 3 ), ::oUtil:Col( ::nFila  - 1 ) CODE128 "LOLES REBALE 8E PRIMARIA" MODE "A" ;
         // OF ::oUtil:oPrinter SIZE 1

         //@ ::oUtil:Row( ::nLinea + ( (::oPrn:nVertSIZE()/10) / nEtiqFila ) - 1.5 - 0.5 ), ::oUtil:Col( ::nFila + 0.5 ) EAN13 Right("000000000000" + AllTrim(Str( nContador, 12, 0) ), 12) ;
         // OF ::oUtil:oPrinter SIZE 1 BANNER

         cCode := Right("00000000000" + AllTrim(Str( nContador, 11, 0) ), 11) + cGetDigitMatr( ::ARRAAMPA, Right("00000000000" + AllTrim(Str( nContador, 11, 0) ), 11) )

         @ ::oUtil:Row( ::nLinea + ( nVertSIZE / nEtiqFila ) - 1.5 - 0.5 ), ::oUtil:Col( ::nFila + 0.5 ) EAN13 cCode ;
          OF ::oUtil:oPrinter SIZE 1 BANNER


         //::nFila := ( (::oPrn:nHORZSIZE()/10) / nEtiqLini ) * nFlag

         ::nFila := ( nHORZSIZE / nEtiqLini ) * nFlag

         nFlag++

         if nFlag = (nEtiqLini + 1 )
              ISEPARATOR ( nVertSIZE / nEtiqFila )
              nFlag := 1
              ::nFila := 0
         endif

    EndFor

   ::oUtil:Reset()  //Valores por defecto

RETURN NIL

METHOD Separator( nSpace ) CLASS TIMPCOBA

   // Si habido un salto de pagina despues de una linea de separacion
   if Super:Separator( nSpace ) // Atentos. Llamada a la TImprime.
      ::InitLineFile()
   endif

Return Self
************************************************************************
************************************************************************
CLASS TIMPCOBAALUM FROM TIMPRIME

      CLASSDATA lRegistered AS LOGICAL

      DATA lprevisual
      DATA ARRAAMPA
      DATA nContadora

      // Methods constructores
      //METHOD Init( cSpool)
      METHOD New( AMPAARRA, netiqlini, netiqfila, nEtiqAlum, aFiltro, aOrden ) CONSTRUCTOR

      METHOD Etiqueta( nEtiqlini, nEtiqfila, nEtiqAlum, aFiltro, aOrden )
      METHOD InitLineFile() INLINE ( ::nLinea := 0, ::nFila := 0 )
      METHOD Separator()  // Este method es compartido por las dos clases

ENDCLASS

METHOD New( AMPAARRA, nEtiqlini, nEtiqfila, nEtiqAlum, aFiltro, aOrden )  CLASS TIMPCOBAALUM

    ::ARRAAMPA := AMPAARRA

    /* Es solicita si es desitja previsualitzar.
       --------------------------------------*/

    ::lprevisual := MsgNoYes( "Es desitja previsualitzar?", "Atenció!" )

    traza( 1, "::lPrevisual=", ::lprevisual )

    msgnowait2( AMPAARRA, "Imprimint ...", "Cancel·lar...")

    CursorWait()

    /* Inicia el proceso de impresión
       --------------------------- */

    IMPRIME INIT "Impressió CODE128 d'alumnes " + aFiltro[2]

    PAGE
      ::Etiqueta( nEtiqlini, nEtiqfila, nEtiqAlum, aFiltro, aOrden )
    ENDPAGE

    //TRAZA(1, "::oPrn:nVertRes()=", ::oPrn:nVertRes() )
    //TRAZA(1, "::oPrn:nHORZRes()=", ::oPrn:nHORZRes() )
    TRAZA(1, "::oPrn:nVertSIZE()=", ::oPrn:nVertSIZE() )
    TRAZA(1, "::oPrn:nHORZSIZE()=", ::oPrn:nHORZSIZE() )

    TRAZA(1, "::oPrn:GetPhySize()[1]=", ::oPrn:GetPhySize()[1] )
    TRAZA(1, "::oPrn:GetPhySize()[2]=", ::oPrn:GetPhySize()[2] )

    IMPRIME END .F.

    CursorArrow()

    EndMsgNoWait( ::ARRAAMPA )

Return .T.

METHOD Etiqueta( nEtiqlini, nEtiqfila, nEtiqAlum, aFiltro, aOrden ) CLASS TIMPCOBAALUM

Local nContadora  := 0
Local nFlag       := 1
Local nVertSIZE   := 0
Local nHORZSIZE   := 0
Local oTdbfAlumne := Nil
Local lRest       := .F.
Local oFnt_8      := Nil

DEFINE FONT oFnt_8 NAME "Arial" SIZE 0,-8 OF ::oPrn

oTdbfAlumne := oDbfClon( ::ArraAMPA, "ALUMNE" )
oTdbfAlumne:SetIndex( aOrden[ 2 ] )

nVertSIZE := Val(Str( ::oPrn:GetPhySize()[2] / 10, 4, 1 ) )
nHORZSIZE := Val(Str( ::oPrn:GetPhySize()[1] / 10, 4, 1 ) )

TRAZA(1, "nVertSIZE=", nVertSIZE )
TRAZA(1, "nHORZSIZE=", nHORZSIZE )

::InitLineFile()

While oTDbfAlumne:Locate( bCodiFil( ::ArraAMPA, aFiltro[3] ), , lRest )   // .and. ValType( ::ArraAMPA[1][1][1] ) = "O"

    lRest := .T.

    oTdbfalumne:Load()

    For nContadora := 1 To nEtiqalum STEP 1

         // Usando BARLIB de Cayetano.
         // Para no tener que retocar el .CH ni historia solamente tendremos que
         // pasar en vez de nCol como hasta ahora , hacerlo asi, ::oUtil:Row( nRow ), donde nRow
         // sera un valor expresado en CMS.

         /* Si los márgenes son '0':
            ::oPrn:nVertSIZE()=297     MILIMETROS !!!
            ::oPrn:nHORZSIZE()=210
         */


         @ ::oUtil:Row( ::nLinea + ( nVertSIZE / nEtiqFila ) - 1.5 - 0.6 ), ::oUtil:Col( ::nFila + 0.5 ) ;
           CODE128 ;
           Left( AllTrim( oTdbfalumne:CodiAlum ) + Space(12), 12 ) ;
           MODE "A" OF ::oUtil:oPrinter SIZE 1


          ::oUtil:Text( ;
                        AlLTrim(oTdbfalumne:CodCurAc) + " / " + AlLTrim(oTdbfalumne:CodiAlum), ;
                        ::nLinea + ( nVertSIZE / nEtiqFila ) - 0 - 1.1, ;
                        ::nFila + 0.5, ;
                        oFnt_8, ;
                        Nil, Nil, ;
                        Nil, Nil, Nil, Nil, Nil, Nil, Nil )

          ::oUtil:Text( ;
                        AlLTrim(oTDbfAlumne:nomAlum) + " " + AlLTrim(oTDbfAlumne:cognom1) + " " + AlLtrim(oTDbfAlumne:cognom2), ;
                        ::nLinea + ( nVertSIZE / nEtiqFila ) - 0 - 0.7, ;
                        ::nFila + 0.5, ;
                        oFnt_8, ;
                        Nil, Nil, ;
                        Nil, Nil, Nil, Nil, Nil, Nil, Nil )



/*
         UTILPRN ::oUtil 3, ( ::nFila + 0.5 ) SAY ;
                 AlLTrim(oTdbfalumne:CodCurAc) + "-" + AlLTrim(oTdbfalumne:CodiAlum) + "-" + ;
                 AlLTrim(oTDbfAlumne:nomAlum) + " " + AlLTrim(oTDbfAlumne:cognom1) + " " + AlLtrim(oTDbfAlumne:cognom2)




         UTILPRN ::oUtil (::nLinea + ( nVertSIZE / nEtiqFila ) - 0 - 0.5 ), ;
                 ( ::nFila + 0.5 ) SAY ;
                 AlLTrim(oTdbfalumne:CodCurAc) + "-" + AlLTrim(oTdbfalumne:CodiAlum) + "-" + ;
                 AlLTrim(oTDbfAlumne:nomAlum) + " " + AlLTrim(oTDbfAlumne:cognom1) + " " + AlLtrim(oTDbfAlumne:cognom2)
*/


         ::nFila := ( nHORZSIZE / nEtiqLini ) * nFlag

         nFlag++

         if nFlag = (nEtiqLini + 1 )
              ISEPARATOR ( nVertSIZE / nEtiqFila )
              nFlag := 1
              ::nFila := 0
         endif

    EndFor

EndDo

::oUtil:Reset()  //Valores por defecto

laTDbfEnd( ::ArraAMPA, { oTdbfAlumne } )

oFnt_8:End()

RETURN NIL

METHOD Separator( nSpace ) CLASS TIMPCOBAALUM

   // Si habido un salto de pagina despues de una linea de separacion
   if Super:Separator( nSpace ) // Atentos. Llamada a la TImprime.
      ::InitLineFile()
   endif

Return Self
*************************************

 
Last edited by FiveWiDi on Sat Nov 23, 2013 10:58 pm, edited 1 time in total.
Un Saludo
Carlos G.

FiveWin 24.02 + Harbour 3.2.0dev (r2403071241), BCC 7.7 Windows 10
FiveWiDi
 
Posts: 1087
Joined: Mon Oct 10, 2005 2:38 pm

Re: Etiquetas con códigos de barra

Postby Pedro » Sat Jan 14, 2012 8:34 pm

Hola Carlos

Gracias por los prgs, pero podrías ponerme el ampa32.ch o decirme para que sirve el ampaarra , ya que no puedo compilar los prgs como ejemplos para ver si me sirven,
ya que lo que quiero es poner el código de barras y debajo un texto, ya sabes lo típico de las etiquetas de los comercios, código de barras, nombre del artículo y precio.
Un saludo
Pedro
gahetesoft@gmail.com
FWH12.06 BCC582, Xverce CW, Pelles C 6.00.4,PSPAD 4.54
y ahora con ADO
User avatar
Pedro
 
Posts: 464
Joined: Tue Mar 21, 2006 7:30 pm
Location: Córdoba (España)

Re: Etiquetas con códigos de barra

Postby FiveWiDi » Sun Jan 15, 2012 4:02 pm

Pedro wrote:Hola Carlos

Gracias por los prgs, pero podrías ponerme el ampa32.ch o decirme para que sirve el ampaarra , ya que no puedo compilar los prgs como ejemplos para ver si me sirven,
ya que lo que quiero es poner el código de barras y debajo un texto, ya sabes lo típico de las etiquetas de los comercios, código de barras, nombre del artículo y precio.


Es evidente que no te va a compilar, está pensado para mis aplicaciones.

Envié el código para que sirviera de ejemplo de como está construído y adaptándolo a tus particularidades obtuvieras tu propia rutina de impresion.

Adjunto el mismo código modificado para que te dé menos errores y te sea más fácil ccorregirlos.
Code: Select all  Expand view

=========
1er. PRG
=========

#include "fivewin.ch"

/* *************************************************************************
   Per a imprimir codi de barres EAN13
   ********************************************************************** */


FUNCTION ImprCoba( Nil )

Local nCodBar13Ini := 0
Local nCodBar13Fin := 0
Local nEtiqLini    := 6
Local nEtiqCOLU    := 12


If MsgGet( "CODI DE BARRES INICIAL", "Indiqui el número INICIAL de codi de barres a imprimir:", @nCodBar13Ini, Nil, Nil )

    If MsgGet( "CODI DE BARRES FINAL", "Indiqui el número FINAL de codi de barres a imprimir:", @nCodBar13Fin, Nil, Nil )

        If MsgGet( "Nombre d'etiquetes per LÍNIA", "Indiqui nombre d'etiquetes per LÍNIA:", @nEtiqLini, Nil, Nil )

            If MsgGet( "Nombre d'etiquetes per COLUMNA", "Indiqui nombre d'etiquetes per COLUMNA:", @nEtiqCOLU, Nil, Nil )

                TImpCoBa():New( nil, nCodBar13Ini, nCodBar13Fin, nEtiqLini, nEtiqCOLU )

            EndIf

        EndIf

    EndIf

EndIf


Return Nil

/* *************************************************************************
/* *************************************************************************
   Per a imprimir codi de barres CODE128
   ********************************************************************** */


FUNCTION ImprCobaAlum( Nil)

Local nEtiqLini    := 4
Local nEtiqCOLU    := 12
Local nEtiqAlum    := 1

        If MsgGet( "Nombre d'etiquetes per LÍNIA", "Indiqui nombre d'etiquetes per LÍNIA:", @nEtiqLini, Nil, Nil )

            If MsgGet( "Nombre d'etiquetes per COLUMNA", "Indiqui nombre d'etiquetes per COLUMNA:", @nEtiqCOLU, Nil, Nil )

                If MsgGet( "Nombre d'etiquetes per ALUMNE", "Indiqui nombre d'etiquetes per ALUMNE:", @nEtiqAlum, Nil, Nil )

                    TImpCoBaAlum():New( Nil, nEtiqLini, nEtiqCOLU, nEtiqAlum  )

                EndIf

            EndIf

        EndIf

Return Nil
/* ********************************************************************** */


========
2do. PRG
========

#INCLUDE "Fivewin.CH"

#INCLUDE "Utilprn.CH"
#INCLUDE "Barcode.CH"

#DEFINE CLR_GREY 14671839

************************************************************************
************************************************************************
************************************************************************
*Clase para realizar unas etiquetas
*Haciendo uso de la Clausula NOBOX.

CLASS TIMPCOBA FROM TIMPRIME

      CLASSDATA lRegistered AS LOGICAL

      DATA lprevisual
      DATA nContadora

      // Methods constructores
      //METHOD Init( cSpool)
      METHOD New( Nil, nCodBar13Ini, nCodBar13Fin, netiqlini, netiqfila ) CONSTRUCTOR

      METHOD Etiqueta()
      METHOD InitLineFile() INLINE ( ::nLinea := 0, ::nFila := 0 )
      METHOD Separator()  // Este method es compartido por las dos clases

ENDCLASS

METHOD New( Nil, nCodBar13Ini, nCodBar13Fin, netiqlini, netiqfila )  CLASS TIMPCOBA

    /* Es solicita si es desitja previsualitzar.
       --------------------------------------*/

    ::lprevisual := MsgNoYes( "Es desitja previsualitzar?", "Atenció!" )

    CursorWait()

    /* Inicia el proceso de impresión
       --------------------------- */

    IMPRIME INIT "Impressió EAN13 entre " + AllTrim( Str( nCodBar13Ini, 15, 0 ) ) + " i " + AllTrim( Str( nCodBar13Fin, 15, 0 ) )

    PAGE
      ::Etiqueta( nCodBar13Ini, nCodBar13Fin, netiqlini, netiqfila )
    ENDPAGE

    IMPRIME END .F.

    CursorArrow()

Return .T.

METHOD Etiqueta( nCodBar13Ini, nCodBar13Fin, netiqlini, netiqfila ) CLASS TIMPCOBA

Local nContador := 0
Local nFlag     := 1
Local nVertSIZE := 0
Local nHORZSIZE := 0
Local cCode     := ""

nVertSIZE := Val(Str( ::oPrn:GetPhySize()[2] / 10, 4, 1 ) )
nHORZSIZE := Val(Str( ::oPrn:GetPhySize()[1] / 10, 4, 1 ) )

::InitLineFile()

    For nContador := nCodBar13Ini To nCodBar13Fin STEP 1

         // Usando BARLIB de Cayetano.
         // Para no tener que retocar el .CH ni historia solamente tendremos que
         // pasar en vez de nCol como hasta ahora , hacerlo asi, ::oUtil:Row( nRow ), donde nRow
         // sera un valor expresado en CMS.

         /* Si los márgenes son '0':
            ::oPrn:nVertSIZE()=297     MILIMETROS !!!
            ::oPrn:nHORZSIZE()=210
         */


         cCode := Right("00000000000" + AllTrim(Str( nContador, 11, 0) ), 11) + cGetDigitMatr( Nil, Right("00000000000" + AllTrim(Str( nContador, 11, 0) ), 11) )

         @ ::oUtil:Row( ::nLinea + ( nVertSIZE / nEtiqFila ) - 1.5 - 0.5 ), ::oUtil:Col( ::nFila + 0.5 ) EAN13 cCode ;
          OF ::oUtil:oPrinter SIZE 1 BANNER

         ::nFila := ( nHORZSIZE / nEtiqLini ) * nFlag

         nFlag++

         if nFlag = (nEtiqLini + 1 )
              ISEPARATOR ( nVertSIZE / nEtiqFila )
              nFlag := 1
              ::nFila := 0
         endif

    EndFor

   ::oUtil:Reset()  //Valores por defecto

RETURN NIL

METHOD Separator( nSpace ) CLASS TIMPCOBA

   // Si habido un salto de pagina despues de una linea de separacion
   if Super:Separator( nSpace ) // Atentos. Llamada a la TImprime.
      ::InitLineFile()
   endif

Return Self
************************************************************************
************************************************************************
CLASS TIMPCOBAALUM FROM TIMPRIME

      CLASSDATA lRegistered AS LOGICAL

      DATA lprevisual
      DATA nContadora

      // Methods constructores
      METHOD New( Nil, netiqlini, netiqfila, nEtiqAlum ) CONSTRUCTOR

      METHOD Etiqueta( nEtiqlini, nEtiqfila, nEtiqAlum )
      METHOD InitLineFile() INLINE ( ::nLinea := 0, ::nFila := 0 )
      METHOD Separator()  // Este method es compartido por las dos clases

ENDCLASS

METHOD New( Nil, nEtiqlini, nEtiqfila, nEtiqAlum )  CLASS TIMPCOBAALUM

    /* Es solicita si es desitja previsualitzar.
       --------------------------------------*/

    ::lprevisual := MsgNoYes( "Es desitja previsualitzar?", "Atenció!" )

    CursorWait()

    /* Inicia el proceso de impresión
       --------------------------- */

    IMPRIME INIT "Impressió CODE128 d'alumnes ..."

    PAGE
      ::Etiqueta( nEtiqlini, nEtiqfila, nEtiqAlum )
    ENDPAGE

    IMPRIME END .F.

    CursorArrow()

Return .T.

METHOD Etiqueta( nEtiqlini, nEtiqfila, nEtiqAlum ) CLASS TIMPCOBAALUM

Local nContadora  := 0
Local nFlag       := 1
Local nVertSIZE   := 0
Local nHORZSIZE   := 0
Local oTdbfAlumne := Nil
Local lRest       := .F.
Local oFnt_8      := Nil

DEFINE FONT oFnt_8 NAME "Arial" SIZE 0,-8 OF ::oPrn

oTdbfAlumne := oDbfClon( Nil, "ALUMNE" )    // Aquí se obtiene el objeto TDbf
oTdbfAlumne:SetIndex( 2 )

nVertSIZE := Val(Str( ::oPrn:GetPhySize()[2] / 10, 4, 1 ) )
nHORZSIZE := Val(Str( ::oPrn:GetPhySize()[1] / 10, 4, 1 ) )

::InitLineFile()

While oTDbfAlumne:Locate( ".T.", , lRest )

    lRest := .T.

    oTdbfalumne:Load()

    For nContadora := 1 To nEtiqalum STEP 1

         // Usando BARLIB de Cayetano.
         // Para no tener que retocar el .CH ni historia solamente tendremos que
         // pasar en vez de nCol como hasta ahora , hacerlo asi, ::oUtil:Row( nRow ), donde nRow
         // sera un valor expresado en CMS.

         /* Si los márgenes son '0':
            ::oPrn:nVertSIZE()=297     MILIMETROS !!!
            ::oPrn:nHORZSIZE()=210
         */


         @ ::oUtil:Row( ::nLinea + ( nVertSIZE / nEtiqFila ) - 1.5 - 0.6 ), ::oUtil:Col( ::nFila + 0.5 ) ;
           CODE128 ;
           Left( AllTrim( oTdbfalumne:CodiAlum ) + Space(12), 12 ) ;
           MODE "A" OF ::oUtil:oPrinter SIZE 1


          ::oUtil:Text( ;
                        AlLTrim(oTdbfalumne:CodCurAc) + " / " + AlLTrim(oTdbfalumne:CodiAlum), ;
                        ::nLinea + ( nVertSIZE / nEtiqFila ) - 0 - 1.1, ;
                        ::nFila + 0.5, ;
                        oFnt_8, ;
                        Nil, Nil, ;
                        Nil, Nil, Nil, Nil, Nil, Nil, Nil )

          ::oUtil:Text( ;
                        AlLTrim(oTDbfAlumne:nomAlum) + " " + AlLTrim(oTDbfAlumne:cognom1) + " " + AlLtrim(oTDbfAlumne:cognom2), ;
                        ::nLinea + ( nVertSIZE / nEtiqFila ) - 0 - 0.7, ;
                        ::nFila + 0.5, ;
                        oFnt_8, ;
                        Nil, Nil, ;
                        Nil, Nil, Nil, Nil, Nil, Nil, Nil )


         ::nFila := ( nHORZSIZE / nEtiqLini ) * nFlag

         nFlag++

         if nFlag = (nEtiqLini + 1 )
              ISEPARATOR ( nVertSIZE / nEtiqFila )
              nFlag := 1
              ::nFila := 0
         endif

    EndFor

EndDo

::oUtil:Reset()  //Valores por defecto

laTDbfEnd( Nil, { oTdbfAlumne } )

oFnt_8:End()

RETURN NIL

METHOD Separator( nSpace ) CLASS TIMPCOBAALUM

   // Si habido un salto de pagina despues de una linea de separacion
   if Super:Separator( nSpace ) // Atentos. Llamada a la TImprime.
      ::InitLineFile()
   endif

Return Self
*************************************
 
Un Saludo
Carlos G.

FiveWin 24.02 + Harbour 3.2.0dev (r2403071241), BCC 7.7 Windows 10
FiveWiDi
 
Posts: 1087
Joined: Mon Oct 10, 2005 2:38 pm

Re: Etiquetas con códigos de barra

Postby Adolfo » Mon Jan 16, 2012 1:07 pm

Pedro

En que tipo de impresora vas a sacar los codigos ?

Porque si es compátible con ESC/POS (Epson), existe una forma mucho mas rapida y efectiva.
Aqui un Ej imprimiedo CODE3-9

Local CodigoBar:="235468521"
oPrn:TdosPrn():New("LPT1")

oPrn:Say(1,5,CHR(29) + "k" + CHR(69) + CHR(9) + CodigoBar)

oPrn:End()

Si lees con atencion el manual de la impresora puedes incluso variar el tamaño, imprimir el codigo en la parte inferior Etc

Espero te Sirva.
;-) Ji,ji,ji... buena la cosa... "all you need is code"

http://www.xdata.cl - Desarrollo Inteligente
----------
Asus TUF F15, 32GB Ram, 1 TB NVME M.2, 1 TB SSD, GTX 1650
User avatar
Adolfo
 
Posts: 846
Joined: Tue Oct 11, 2005 11:57 am
Location: Chile

Re: Etiquetas con códigos de barra

Postby Pedro » Mon Jan 16, 2012 1:20 pm

Hola Adolfo

Pues en principio serán etiquetas de código EAN13 (las típicas de tiendas, en este caso es para una ferretería) y si no entendí mal, las harán en una impresora de tinta.

De todas formas y si no es molestia para ti, me gustaría que nos comunicáramos por e mail, a fin de hacerte algunas preguntas sobre ADO, el mío lo tienes en la firma, por si no tienes inconveniente.
Un saludo
Pedro
gahetesoft@gmail.com
FWH12.06 BCC582, Xverce CW, Pelles C 6.00.4,PSPAD 4.54
y ahora con ADO
User avatar
Pedro
 
Posts: 464
Joined: Tue Mar 21, 2006 7:30 pm
Location: Córdoba (España)

Re: Etiquetas con códigos de barra

Postby Adolfo » Mon Jan 16, 2012 1:53 pm

Pedro wrote:Pues en principio serán etiquetas de código EAN13 (las típicas de tiendas, en este caso es para una ferretería) y si no entendí mal, las harán en una impresora de tinta.


MM, van a salir un poco caras, si es que usan etiquetas AVERY, y lo peor es que dependiendo de la calidad vas a utilizar mas tinta, pueden salir "reventadas", lo mas probable es que ningun "VERIFICADOR DE CODIGOS DE BARRA" les de clase A o B
Deberia irse por una ZEBRA de transferencia termica o LASER.

Pedro mi mail es "adolfo_lagos at hotmail dot com", o a "desarrollo at xdata dot cl"

Desde Chile
Saludos
;-) Ji,ji,ji... buena la cosa... "all you need is code"

http://www.xdata.cl - Desarrollo Inteligente
----------
Asus TUF F15, 32GB Ram, 1 TB NVME M.2, 1 TB SSD, GTX 1650
User avatar
Adolfo
 
Posts: 846
Joined: Tue Oct 11, 2005 11:57 am
Location: Chile

Re: Etiquetas con códigos de barra

Postby JoseLuis » Fri Jan 20, 2012 8:21 am

Pedro

Hace mucho tiempo hice algo, que quizá sea lo que quieres, descárgatelo de aquí: http://www.mediafire.com/?niyua8mdhmnx7i4, y si es lo que quieres, me pongo a buscar los fuentes.

Saludos
--------------------------
Saludos

Jose Luis
JoseLuis
 
Posts: 426
Joined: Thu Oct 19, 2006 12:28 pm
Location: Toledo

Re: Etiquetas con códigos de barra

Postby Pedro » Fri Jan 20, 2012 9:54 am

Hola José Luis

He bajado el archivo, pero faltan algunas DLLs así que no he podido verlo, si eres tan amable de enviármelo a mi correo te lo agradezco
Un saludo
Pedro
gahetesoft@gmail.com
FWH12.06 BCC582, Xverce CW, Pelles C 6.00.4,PSPAD 4.54
y ahora con ADO
User avatar
Pedro
 
Posts: 464
Joined: Tue Mar 21, 2006 7:30 pm
Location: Córdoba (España)

Re: Etiquetas con códigos de barra

Postby Marcelo Roggeri » Fri Jun 08, 2012 5:26 pm

Hola Jose Luis, podrias subir nuevamente ese archivo, justo en este momento estoy con este tema y quisiera ver el ejemplo que subiste en aquella oportunidad que tan amablemente has subido.
Saludos
Marcelo
FWH - Harbour - BCC7 - PellesC
User avatar
Marcelo Roggeri
 
Posts: 325
Joined: Sat Jul 22, 2006 9:04 pm
Location: Venado Tuerto - Santa Fe -Argentina


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 81 guests