FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Etiquetas con c贸digos de barra
Posts: 464
Joined: Tue Mar 21, 2006 07:30 PM
Etiquetas con c贸digos de barra
Posted: Tue Jan 10, 2012 09: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
Posts: 1445
Joined: Mon Oct 10, 2005 02:38 PM
Re: Etiquetas con c贸digos de barra
Posted: 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 (fw): Select all Collapse
=========
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, "::nVertRes()=", ::nVertRes() )
//TRAZA(1, "::nHORZRes()=", ::nHORZRes() )
//TRAZA(1, "::nVertSIZE()=", ::nVertSIZE() )
//TRAZA(1, "::nHORZSIZE()=", ::nHORZSIZE() )

//TRAZA(1, "::GetPhySize()[1]=", ::GetPhySize()[1] )
//TRAZA(1, "::GetPhySize()[2]=", ::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, ::Row( nRow ), donde nRow
聽 聽 聽 聽 聽// sera un valor expresado en CMS.

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


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

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

聽 聽 聽 聽 聽//@ ::Row( ::nLinea + ( (::nVertSIZE()/10) / nEtiqFila ) - 1.5 - 0.5 ), ::Col( ::nFila + 0.5 ) EAN13 Right("000000000000" + AllTrim(Str( nContador, 12, 0) ), 12) ;
聽 聽 聽 聽 聽// OF ::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 := ( (::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, "::nVertRes()=", ::nVertRes() )
聽 聽 //TRAZA(1, "::nHORZRes()=", ::nHORZRes() )
聽 聽 TRAZA(1, "::nVertSIZE()=", ::oPrn:nVertSIZE() )
聽 聽 TRAZA(1, "::nHORZSIZE()=", ::oPrn:nHORZSIZE() )

聽 聽 TRAZA(1, "::GetPhySize()[1]=", ::oPrn:GetPhySize()[1] )
聽 聽 TRAZA(1, "::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, ::Row( nRow ), donde nRow
聽 聽 聽 聽 聽// sera un valor expresado en CMS.

聽 聽 聽 聽 聽/* Si los m谩rgenes son '0':
聽 聽 聽 聽 聽 聽 ::nVertSIZE()=297 聽 聽 MILIMETROS !!!
聽 聽 聽 聽 聽 聽 ::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
*************************************

Un Saludo

Carlos G.



FiveWin 25.12 + Harbour 3.2.0dev (r2502110321), BCC 7.7 Windows 11 Home

Posts: 464
Joined: Tue Mar 21, 2006 07:30 PM
Re: Etiquetas con c贸digos de barra
Posted: Sat Jan 14, 2012 08: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
Posts: 1445
Joined: Mon Oct 10, 2005 02:38 PM
Re: Etiquetas con c贸digos de barra
Posted: Sun Jan 15, 2012 04: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 (fw): Select all Collapse
=========
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, ::Row( nRow ), donde nRow
聽 聽 聽 聽 聽// sera un valor expresado en CMS.

聽 聽 聽 聽 聽/* Si los m谩rgenes son '0':
聽 聽 聽 聽 聽 聽 ::nVertSIZE()=297 聽 聽 MILIMETROS !!!
聽 聽 聽 聽 聽 聽 ::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, ::Row( nRow ), donde nRow
聽 聽 聽 聽 聽// sera un valor expresado en CMS.

聽 聽 聽 聽 聽/* Si los m谩rgenes son '0':
聽 聽 聽 聽 聽 聽 ::nVertSIZE()=297 聽 聽 MILIMETROS !!!
聽 聽 聽 聽 聽 聽 ::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 25.12 + Harbour 3.2.0dev (r2502110321), BCC 7.7 Windows 11 Home

Posts: 883
Joined: Tue Oct 11, 2005 11:57 AM
Re: Etiquetas con c贸digos de barra
Posted: Mon Jan 16, 2012 01: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, 2 * 1 TB NVME M.2, GTX 1650
Posts: 464
Joined: Tue Mar 21, 2006 07:30 PM
Re: Etiquetas con c贸digos de barra
Posted: Mon Jan 16, 2012 01: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
Posts: 883
Joined: Tue Oct 11, 2005 11:57 AM
Re: Etiquetas con c贸digos de barra
Posted: Mon Jan 16, 2012 01: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, 2 * 1 TB NVME M.2, GTX 1650
Posts: 428
Joined: Thu Oct 19, 2006 12:28 PM
Re: Etiquetas con c贸digos de barra
Posted: Fri Jan 20, 2012 08: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
Posts: 464
Joined: Tue Mar 21, 2006 07:30 PM
Re: Etiquetas con c贸digos de barra
Posted: Fri Jan 20, 2012 09: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
Posts: 344
Joined: Sat Jul 22, 2006 09:04 PM
Re: Etiquetas con c贸digos de barra
Posted: Fri Jun 08, 2012 05: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

Continue the discussion