METHOD Barcode(nRow, nCol, cCode, nWidth, nHeight, ncolor,lHorz,lBanner,cFont,nType,nScale) CLASS TLabel
LOCAL nPixRow, nPixCol, nPixWidth, nPixHeight
DEFAULT nRow := .2 ,;
nCol := .2 ,;
nWidth := 1 ,;
nHeight := 1 ,;
nScale := RPT_INCHES ,;
lHorz := .f.
IF nScale == RPT_CMETERS
nRow := Int(nRow/2.54)
nCol := Int(nCol/2.54)
nWidth := Int(nWidth/2.54)
nHeight := Int(nHeight/2.54)
ELSEIF nScale == RPT_MMETERS
nRow := Int(nRow/25.4)
nCol := Int(nCol/25.4)
nWidth := Int(nWidth/25.4)
nHeight := Int(nHeight/25.4)
ENDIF
nPixRow := Int(::nLogPixY*nRow)
nPixCol := Int(::nLogPixX*nCol)
nPixWidth := Int(::nLogPixX*nWidth)
nPixHeight := Int(::nLogPixY*nHeight)
Code128(nPixRow, nPixCol,cCode,::oDevice,"C",CLR_BLACK,lHorz,nPixWidth,nPixHeight)
return nil
METHOD PrintBarcode(cCode,nLine,nLeft,nType,nWidth,nHeigth,lBanner,lHorz,cFont,nColor) CLASS TLabel
local nRow := ::nRow +nLine
local nCol := ::Column() +nLeft
Local oPrint := ::oDevice
DEFAULT nWidth := 0.03 ,;
nHeigth := 0.6 ,;
lHorz := .t. ,;
nColor := CLR_BLACK ,;
lBanner := .f. ,;
cFont := 'arial'
// 1 = Code 39 ..
// 2 = Code 39 check digit
// 3 = Code 128 auto select
// 4 = Code 128 mode A
// 5 = Code 128 mode B
// 6 = Code 128 mode C
// 7 = EAN 8 ..
// 8 = EAN 13 ..
// 9 = UPC-A ...
// 10 = Codabar ...
// 11 = Suplemento 5 ..
// 12 = Industrial 2 of 5 ..
// 13 = Industrial 2 of 5 check digit
// 14 = Interlaved 2 of 5 ..
// 15 = Interlaved 2 of 5 check digit
// 16 = Matrix 2 of 5 ...
// 17 = Matrix 2 of 5 check digit
Do case
Case nType==1
Code3_9(nRow,nCol,cCode,oPrint,.f.,nColor,lHorz,nWidth,nHeigth)
Case nType==2
Code3_9(nRow,nCol,cCode,oPrint,.t.,nColor,lHorz,nWidth,nHeigth)
Case nType==3
Code128(nRow,nCol,cCode,oPrint,"",nColor,lHorz,nWidth,nHeigth)
Case nType==4
Code128(nRow,nCol,cCode,oPrint,"A",nColor,lHorz,nWidth,nHeigth)
Case nType==5
Code128(nRow,nCol,cCode,oPrint,"B",nColor,lHorz,nWidth,nHeigth)
Case nType==6
Code128(nRow,nCol,cCode,oPrint,"C",nColor,lHorz,nWidth,nHeigth)
Case nType==7
ean8(nRow,nCol,cCode,oPrint,nColor,lHorz,nWidth,nHeigth,lBanner,cFont)
Case nType==8
ean13(nRow,nCol,cCode,oPrint,nColor,lHorz,nWidth,nHeigth,lBanner,cFont)
Case nType==9
UPCA(nRow,nCol,cCode,oPrint,nColor,lHorz,nWidth,nHeigth,lBanner,cFont)
Case nType==10
Codabar(nRow,nCol,cCode,oPrint,nColor,lHorz,nWidth,nHeigth)
Case nType==11
sup5(nRow,nCol,cCode,oPrint,nColor,lHorz,nWidth,nHeigth,lBanner,cFont)
Case nType==12
ind25(nRow,nCol,cCode,oPrint,.f.,nColor,lHorz,nWidth,nHeigth)
Case nType==13
ind25(nRow,nCol,cCode,oPrint,.t.,nColor,lHorz,nWidth,nHeigth)
Case nType==14
int25(nRow,nCol,cCode,oPrint,.f.,nColor,lHorz,nWidth,nHeigth)
Case nType==15
int25(nRow,nCol,cCode,oPrint,.t.,nColor,lHorz,nWidth,nHeigth)
Case nType==16
mat25(nRow,nCol,cCode,oPrint,.f.,nColor,lHorz,nWidth,nHeigth)
Case nType==17
mat25(nRow,nCol,cCode,oPrint,.t.,nColor,lHorz,nWidth,nHeigth)
Endcase
Return Nil
#include "FiveWin.ch"
#include ".\include\label.ch"
#include ".\include\Barcode.ch"
//static cSendCode := "*51111+40759*"
//----------------------------------------------------------------------------//
FUNCTION label16()
local oLabel
local oPen1
local oFont1, oFont2, oFont3,oF1
USE "TEST" NEW SHARED ALIAS "TEST"
DEFINE PEN oPen1 WIDTH 2
DEFINE FONT oFont1 NAME "ARIAL" SIZE 0,-10 BOLD
DEFINE FONT oFont2 NAME "DEMOEAN 13" SIZE 0,36
DEFINE FONT oFont3 NAME "ARIAL" SIZE 0,-20 BOLD
* DEFINE FONT oF1 NAME "Code 128" SIZE 0, -50
LABEL oLabel SIZE 70, 70 ;
SEPARATORS 5, 2 ;
ON LINE 2 ;
PEN oPen1 ;
FILE "LABEL.PRN" ;
PREVIEW ;
TO FILE "LABEL.TXT" ;
CAPTION ( REPDEMO->DESCRIP );
FONT oFont1, oFont2, oFont3
LBLITEM AT 250 DATA "From :" FONT 1
LBLITEM AT 250 DATA "Antonio Linares SOFTWARE" FONT 1
LBLITEM AT 250 DATA "Urb. El Rosario. Avd. Rosario 34A" FONT 1
LBLITEM AT 250 DATA "29600 Marbella - SPAIN" FONT 1
LBLITEM AT 250 DATA "Phone/Fax: 34-5-2834830" FONT 1
LBLITEM DATA REPLICATE("-", 60) FONT 1
LBLITEM AT 250 DATA "To : " FONT 1
LBLITEM AT 250 DATA TEST->FIRST FONT 1
LBLITEM AT 250 DATA TEST->LAST FONT 1
LBLITEM AT 250 DATA TEST->STREET FONT 1
LBLITEM DATA REPLICATE("-", 60) FONT 1
LBLITEM AT 250 DATA "Send Code : " FONT 1
// LBLITEM DATA char2Ean(cSendCode) FONT 2 CENTERED
END LABEL oLabel
/*
Modificamos los margenes
*/
oLabel:Margin( 0.1, RPT_TOP, RPT_MMETERS )
oLabel:Margin( 0.1, RPT_BOTTOM, RPT_MMETERS )
/*
Modificamos los Colores
*/
oLabel:SetTxtColor(CLR_BLUE,1)
ACTIVATE LABEL oLabel ;
ON STARTLABEL oLabel:PrintBarcode( STR(TEST->SALARY),1100,200,1)
CLOSE TEST
/*
Ending
*/
oPen1:End()
oFont1:End()
oFont2:End()
oFont3:End()
RETURN NIL
//---------------------------------------------------------------------------//
METHOD DrawingBox(lBoxDotted,nPenGrid) CLASS TLabel
local nTop := ::nRow
local nLeft := ::Column()
local nBottom := ::nRow + ::nLblHeight
local nRight := nLeft + ::nLblWidth
local aPen[2]
Local oPrint := ::oDevice
DEFAULT nPenGrid := 1
DEFINE PEN aPen[1] WIDTH nPenGrid
DEFINE PEN aPen[2] STYLE PS_DOT WIDTH nPenGrid COLOR CLR_HGRAY //LINEE GUIDA
IF lBoxDotted
oPrint:Box( nTop, nLeft, nBottom, nRight, aPen[2] )
else
oPrint:Box( nTop, nLeft, nBottom, nRight,aPen[1] )
Endif
RETURN NIL
METHOD EndLine(nHeight, nItem,lAuto) CLASS TLabel
STATIC lRunning := .F.
DEFAULT nHeight := ::nStdLineHeight
DEFAULT lAuto := .F.
/*
Guardamos el valor del campo procesado por si algien lo
quiere usar, puede ser interesante
*/
::nItemNow := nItem
IF ::bEndLine != nil .AND. !lRunning
lRunning := .T.
Eval( ::bEndLine)
lRunning := .F.
ENDIF
/*
Avance de una linea
*/
::nRow += nHeight
::lFirstRow := .F.
if ::NeedNewPage()
if lAuto
::EndPage()
::StartPage()
else
::EndPage()
endif
endif
RETURN nil
nColLabel:= ::oSQLLabels:num_columnas
nRowLabel:= ::oSQLLabels:num_reglones
nAltoLabel:= ::oSQLLabels:tam_alto
nAnchoLabel:= ::oSQLLabels:tam_ancho
nMargenIzq:= ::oSQLLabels:mar_izquierdo
nMargenSup:= ::oSQLLabels:mar_superior
nSepVertical := ::oSQLLabels:sep_vertical
nSepHorizontal:= ::oSQLLabels:sep_horizontal
nCols:= 1
nRows:= 1
nTopLabel := nMargenSup
nLeftLabel := nMargenIzq
nBottomLabel:= nTopLabel + nAltoLabel
nRightLabel := nLeftLabel + nAnchoLabel
WaitOn("Generando codigos de barra... por favor espere un momento", "PRINTER_48" )
IF !Empty(AllTrim( ::aTallas[1,1]) )
IF Len( ::aTallas ) > 0
cSQLQuery:= "SELECT precio"+AppData:cPrecioVenta + ;
" FROM articulos WHERE id_item='" + AllTrim(::cCodeBarItem) + "'"
nPrecioVenta:= AppData:oMySqlDSMain:QueryValue(cSQLQuery)
cSQLQuery:= "SELECT nombre FROM articulos WHERE id_item='" + AllTrim(::cCodeBarItem) + "'"
cNombreItems:= AppData:oMySqlDSMain:QueryValue(cSQLQuery)
IF nPrecioVenta == NIL
nPrecioVenta := 0
ENDIF
IF ::nNumLabels > 1
nCols:= 1
nRows:= 1
FOR nCantidad:= 1 TO ::nNumLabels-1
IF nCols > nColLabel
nCols:= 1
nLeftLabel := nMargenIzq
nRightLabel := nLeftLabel + nAnchoLabel
nTopLabel := nTopLabel + nAltoLabel + nSepHorizontal
nBottomLabel:= nTopLabel + nAltoLabel
++nRows
ENDIF
nLeftLabel := nLeftLabel + nAnchoLabel + nSepVertical
nRightLabel:= nLeftLabel + nAnchoLabel
++nCols
NEXT
ENDIF
nCuantas:= Len( ::aTallas )
FOR nLabel:= 1 TO nCuantas
nHowLabels:= ::aTallas[nLabel,2]
FOR nCantidad:= 1 TO nHowLabels
IF nCols > nColLabel
nCols:= 1
nLeftLabel := nMargenIzq
nRightLabel := nLeftLabel + nAnchoLabel
nTopLabel := nTopLabel + nAltoLabel + nSepHorizontal
nBottomLabel:= nTopLabel + nAltoLabel
++nRows
ENDIF
IF nRows > nRowLabel
nRows:= 1
nCols:= 1
nTopLabel := nMargenSup
nLeftLabel := nMargenIzq
nBottomLabel:= nAltoLabel
nRightLabel := nAnchoLabel
nAltoLabel:= ::oSQLLabels:tam_alto
nAnchoLabel:= ::oSQLLabels:tam_ancho
nMargenIzq:= ::oSQLLabels:mar_izquierdo
nMargenSup:= ::oSQLLabels:mar_superior
nSepVertical := ::oSQLLabels:sep_vertical
nSepHorizontal:= ::oSQLLabels:sep_horizontal
nTopLabel := nMargenSup
nLeftLabel := nMargenIzq
nBottomLabel:= nTopLabel + nAltoLabel
nRightLabel := nLeftLabel + nAnchoLabel
Printer:EndPage()
Printer:StartPage()
ENDIF
// Clas TImprime de Rafa Carmona (The Full)
//MsgStop( Str(nTopLabel)+Str(nLeftLabel)+Str(nBottomLabel)+Str(nRightLabel) )
::Box( nTopLabel*10, nLeftLabel*10, nBottomLabel*10, nRightLabel*10 )
IMPRIME nTopLabel*10+(3.5/10), nLeftLabel*10+(2/10) SAY Left(cNombreItems,28) FONT ::oArial10
IMPRIME nBottomLabel*10-(6.5/10), nRightLabel*10-(18/10) SAY Transform(nPrecioVenta,'@R $ 99,999.99') FONT ::oArial10
IMPRIME nBottomLabel*10-(6.5/10), nLeftLabel*10+(4/10) SAY ::cCodeBarItem+"-"+AllTrim( ::aTallas[nLabel,1]) FONT ::oArial10
IMPRIME (nTopLabel*10)+(8/10), (nLeftLabel*10)+(2/10) CODE128 ::cCodeBarItem+"-"+AllTrim( ::aTallas[nLabel,1]) MODE "B" WIDTH 0.023 SIZE 1
nLeftLabel := nLeftLabel + nAnchoLabel + nSepVertical
nRightLabel:= nLeftLabel + nAnchoLabel
++nCols
NEXT
NEXT
ENDIF
ENDIF
WaitOff()
Dear Otto,
Can I create and print Labels with EasyReport ?
Have you a sample to try ?
thanks
--
Falconi Silvio
EASYREPORT oVRD NAME ".\xVrd\etikette.vrd"
select etikette
go top
while ! EoF()
PRINTAREA 1 OF oVrd ;
ITEMIDS { 101,102,103, ... } ;
ITEMVALUES { etikette->Name,;
etikette->VorName, ;
etikette->ort, ... }
IF oVRD:nNextRow > oVRD:nPageBreak
PAGEBREAK oVRD
ENDIF
select etikette
SKIP
enddo
oVRD:End()
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 109 guests