FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour CODIGO DE BARRAS. ERROR CON FILLRECT()
Posts: 117
Joined: Sun Oct 08, 2017 12:51 PM
CODIGO DE BARRAS. ERROR CON FILLRECT()
Posted: Fri May 10, 2024 09:21 PM

Hola amigos !

Como puedo solucionar la impresi贸n de un c贸digo de barras

que saqu茅 de barlib.zip de libre distribuci贸n,

que tiene el programa go_code.prg y que me da error al

querer imprimir al usar la funci贸n FILLRECT().

Gracias, como siempre !

Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20221118)

FiveWin version: FWH 23.07

C compiler version: Borland/Embarcadero C++ 7.4 (32-bit)

Windows 10 64 Bits, version: 6.2, Build 9200

Error description: Warning BASE/1004 Message not found: FWPDF:FILLRECT

Stack Calls

===========

Called from: source\rtl\tobject.prg => FWPDF:ERROR( 0 )

Called from: source\rtl\tobject.prg => FWPDF:MSGNOTFOUND( 0 )

Called from: source\rtl\tobject.prg => FWPDF:FILLRECT( 0 )

Called from: go_code.prg => GO_CODE( 38 )

Called from: barlib.prg => CODE128( 34 )

Called from: barlib.prg => C_CODE128( 39 )

Pedro L. Lavallen

San Luis (Capital), Argentina
Posts: 117
Joined: Sun Oct 08, 2017 12:51 PM
Re: CODIGO DE BARRAS. ERROR CON FILLRECT()
Posted: Fri May 10, 2024 09:34 PM
  • Adjunto el c贸digo de go_code.prg

// imprime un codigo de barras

include 'vta0000.ch'

//-----------------------------------------------------------------

function go_code( cBarra, nx,ny,oPrint,lHoRz, nColor, nWidth, nLen)

//-----------------------------------------------------------------

local n, oBr

if empty(nColor)

    nColor := CLR_BLACK

end

default lHorz := .t.



default nWidth := 0.030 // 1/3 M/mm
  • default nWidth := 0.035 // 1/3 M/mm

  • default nWidth := 0.025 // 1/3 M/mm

    default nLen := 0.8 // Cmm. 0.8

  • default nLen := 1.5 // Cmm.

    define brush oBr color nColor

    // Width of Bar

    if !lHorz

    nWidth :=round ( nWidth * 10 * oPrint:nVertRes() / oPrint:nVertSize() ,0 )
    

    else

    nWidth :=round ( nWidth * 10 * oPrint:nHorzRes() / oPrint:nHorzSize(), 0 )

    end

    // Len of bar

    if lHorz

    nLen :=round ( nLen * 10 * oPrint:nVertRes() / oPrint:nVertSize() ,0 )
    

    else

    nLen :=round ( nLen * 10 * oPrint:nHorzRes() / oPrint:nHorzSize(), 0 )

    end

    for n:=1 to len(cBarra)

    if substr(cBarra,n,1) ='1'
    
        if lHorz
    
            oPrint:fillRect({nx,ny,nx+nLen,(ny+=nWidth)},oBr)
    
        else
    
            oPrint:fillRect({nx,ny,(nx+=nWidth),ny+nLen},oBr)
    
        end
    
      else
    
      if lHorz
    
        ny+=nWidth
    
        else
    
        nx += nWidth
    
       end
    
    end
    

    next

    oBr:end()

return nil

Pedro L. Lavallen

San Luis (Capital), Argentina
Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM
Re: CODIGO DE BARRAS. ERROR CON FILLRECT()
Posted: Sat May 11, 2024 10:39 AM
Jo茫o Santos - S茫o Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 117
Joined: Sun Oct 08, 2017 12:51 PM
Re: CODIGO DE BARRAS. ERROR CON FILLRECT()
Posted: Sat May 11, 2024 11:59 AM

Muy amable Karinha !

Pero el problema que tengo es que al compilar tengo error en

la Funci贸n FILLRECT() que est谩 en el GO_CODE.PRG.

Compilo el programa con REQUEST FWHARU, y ah铆 surge el error.

Si no compilo con FWHARU funciona todo bien. ???

Saludos !

Pedro L. Lavallen

San Luis (Capital), Argentina
Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM
Re: CODIGO DE BARRAS. ERROR CON FILLRECT()
Posted: Sat May 11, 2024 12:56 PM

REQUEST FWHARU 茅s para usar HARUPDF con PRINTER.PRG, en BARLIB.LIB(C贸digos de Barras) no ejiste HARUPDF.

Regards, saludos.

Jo茫o Santos - S茫o Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 117
Joined: Sun Oct 08, 2017 12:51 PM
Re: CODIGO DE BARRAS. ERROR CON FILLRECT()
Posted: Sat May 11, 2024 10:45 PM

El programa imprime una factura.

Arranca usando FWHARU, y llama a go_code.prg para hacer el c贸digo de barras

que luego se pone en la factura.

Cuando pasa por el go_code.prg me da el error del fillrect()

Pedro L. Lavallen

San Luis (Capital), Argentina
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: CODIGO DE BARRAS. ERROR CON FILLRECT()
Posted: Sun May 12, 2024 09:03 AM

Can you post a reduced and self-contained sample showing the problem, please?

Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM
Re: CODIGO DE BARRAS. ERROR CON FILLRECT()
Posted: Sun May 12, 2024 11:23 AM
Jo茫o Santos - S茫o Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 117
Joined: Sun Oct 08, 2017 12:51 PM
Re: CODIGO DE BARRAS. ERROR CON FILLRECT()
Posted: Sun May 12, 2024 08:27 PM
Hola Grupo !

Esta es s贸lo una peque帽a parte del que uso para imprimir la factura.
Pero que sirve de muestra para lo que me solicitan.
M谩s abajo, hago la llamada al GO_CODE.PRG para hacer el c贸digo de barras
Uso la libreria de Cayetano G贸mez: la BARLIB.
El mencionado programa, de 茅l, tiene el programa GO_CODE.PRG, el cu谩l puse al final.
Esta librer铆a la vengo usando perfectamente hace muchos a帽os, hasta que empec茅 a usar el FWHARU.
A partir de ese momento, cuando quer铆a imprimir el c贸digo de barras:
@25.55+x3,01.00 CM_CODE128 mcodbar1 OF oPrn mode "C"
Llamo a GO_CODE.PRG y el programa me da el siguiente error que encuentra en el go_code.prg.

Called from: source\rtl\tobject.prg => FWPDF:ERROR( 0 )
Called from: source\rtl\tobject.prg => FWPDF:MSGNOTFOUND( 0 )
Called from: source\rtl\tobject.prg => FWPDF:FILLRECT( 0 ) <--------------
Called from: go_code.prg => GO_CODE( 39 )
Called from: barlib.prg => CODE128( 34 )
Called from: barlib.prg => C_CODE128( 39 )
Called from: vta1214.prg => VTA1100PE( 634 )

No entiendo porque da ese error del fillrect(0)

Uso fwh2307

Muchas gracias !

-------------------------------------------------------------------------------------------------
#include "vta0000.ch"
#include "report.ch"
#include "barcode.ch"
#define DMPAPER_A4
REQUEST FWZEBRA
REQUEST FWHARU

*--------------------------------------
FUNCTION VTA1100PE()
*--------------------------------------
...
TPrinter():lUseHaruPDF:= .t.

xnum:=99->numero
cPdfFile := m->xpath+"\PDF\"+strzero(99->cliente,6)+".pdf"
PRINTER oprn FILE cPdfFile // <-------------------------------------------

DEFINE FONT oFnt1 NAME "Arial" SIZE 0,-18 OF oPrn
DEFINE FONT oFnt2 NAME "Arial" SIZE 0,-8 BOLD OF oPrn
DEFINE BRUSH oBrush COLOR 0
DEFINE PEN oPen1 WIDTH 5
DEFINE PEN oPen2 WIDTH 15 COLOR 7873845
DEFINE PEN oPen3 WIDTH 1 COLOR 4556678
DEFINE PEN oPen4 WIDTH 3 COLOR 3123123
#DEFINE VACIA 0
#DEFINE RELLENA 1

oPrn:setpage(9) // A4

sele 1
set order to 8
go top

zmesliq:=val(subs(1->mes_liq,1,4)+subs(1->mes_liq,6,2))
xbarra:=subs(m->wwcuit,1,2)+subs(m->wwcuit,4,8)+subs(m->wwcuit,13,1);
+xlet+strzero(xemi,4)+strzero(xnum,8)+subs(1->cae,1,14)
sele 1
set order to 8 //1
go top
seek str(xtdo,1)+xlet+str(xemi,2)+str(xnum,8)
AGE
SayBitmap(01.20,00.50,01.40,01.50,"logocoop.bmp",oPrn)
oPrn:cmSay(2.50,14.00,"FACTURA",oFnt11)
endif
oPrn:cmSay( 3.30,14.00, "Per铆odo: "+subs(1->mes_liq,6,2)+"/"+;
subs(1->mes_liq,1,4),oFnt3)
oPrn:cmSay( 3.70,14.00, "Emisi贸n: "+dtoc(1->fec_liq),oFnt3)
oPrn:cmSay( 4.10,14.00, "Vencimiento: "+dtoc(1->fec_ven),oFnt3)
SayBitmap(03.00,08.30,05.30,03.10,"pagado.bmp",oPrn)

oPrn:cmSay( 1.20,02.60, "COOPERATIVA DE AGUA POTABLE",oFnt15)
// Nombres columnas
Linea( 07.05, 00.50, 07.05, 20.50, oPrn,oPen5) // Linea Fecha Horiz. c0
Linea( 07.60, 00.50, 07.60, 20.50, oPrn,oPen5) // Linea Fecha Horiz. c1
oPrn:cmSay( 7.20,00.50, "CODIGO",oFnt3)
oPrn:cmSay( 7.20,05.00, "DESCRIPCION",oFnt3)

// Textos recuadros derecha (abajo)
RCAJA( oPrn, 11.10, 15.82, 18.30, 17.30, 10, 10,oPen7) // Caja
oPrn:cmSay(16.00,11.30, "El cr茅dito fiscal discriminado en el presente",oFnt2)
RCAJA( oPrn, 11.10, 17.50, 20.00, 18.60, 10, 10, oPen5) // Caja Total a Pagar
oPrn:cmSay(17.75,11.50,"TOTAL A PAGAR",oFnt11) // 17.75,12.00

// Cobro en Cooperativa
x3:= -1.10 //-0.90 // -1.00 ////////////////
mcodbar1:= mtipo + padl(alltrim(Str(xnum, 8)), 8, "0")
mcodbar1:= mcodbar1 + padl(alltrim(str(mprep, 9)), 9, "0")
oPrn:cmSay(25.15+x3,01.00,"Cobro en Cooperativa",oFnt3)

@25.55+x3,01.00 CM_CODE128 mcodbar1 OF oPrn mode "C" // <------------------- Llamo a GO_CODE.PRG

oPrn:cmSay(26.45+x3-00.10,01.00,"* "+mcodbar1+" COOP *",oFnt3)

// C贸digo QR ----
zcuit:=subs(xcui,1,2)+subs(xcui,4,2)+subs(xcui,7,3);
+subs(xcui,11,3)+subs(xcui,15,1)
nDocTipo:="80"
DEFINE CLIPBOARD oClp FORMAT TEXT
oClp:SetText( cJason )
@ 233,073 PRINT TO oPrn TEXT cJason AS BARCODE TYPE "QR-CODE" SIZE 24,24 MM // 250,165

ENDPAGE
ENDPRINT
return nil


/-----------------------------------------------------------------
function go_code( cBarra, nx,ny,oPrint,lHoRz, nColor, nWidth, nLen) // Cayetano G贸mez
//-----------------------------------------------------------------
local n, oBr
if empty(nColor)
nColor := CLR_BLACK
end
default lHorz := .t.
default nWidth := 0.030 // 1/3 M/mm
default nLen := 0.8 // Cmm. 0.8
define brush oBr color nColor
// Width of Bar
if !lHorz
nWidth :=round ( nWidth * 10 * oPrint:nVertRes() / oPrint:nVertSize() ,0 )
else
nWidth :=round ( nWidth * 10 * oPrint:nHorzRes() / oPrint:nHorzSize(), 0 )
end
// Len of bar
if lHorz
nLen :=round ( nLen * 10 * oPrint:nVertRes() / oPrint:nVertSize() ,0 )
else
nLen :=round ( nLen * 10 * oPrint:nHorzRes() / oPrint:nHorzSize(), 0 )
end
for n:=1 to len(cBarra)
if substr(cBarra,n,1) ='1'
if lHorz
* oPrint:Box(nx,ny,nx+nLen,(ny+=nWidth))
oPrint:fillRect({nx,ny,nx+nLen,(ny+=nWidth)},oBr)
else
oPrint:Box(nx,ny,(nx+=nWidth),ny+nLen)
* oPrint:fillRect({nx,ny,(nx+=nWidth),ny+nLen},oBr)
end
else
if lHorz
ny+=nWidth
else
nx += nWidth
end
end
next
oBr:end()
return nil
Pedro L. Lavallen

San Luis (Capital), Argentina
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: CODIGO DE BARRAS. ERROR CON FILLRECT()
Posted: Sun May 12, 2024 08:37 PM

That sample is not reduced and not self-contained.

Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM
Re: CODIGO DE BARRAS. ERROR CON FILLRECT()
Posted: Mon May 13, 2024 10:42 AM
Code (fw): Select all Collapse
METHOD FillRect( aRect, uBrush, [cUnits] )
https://forums.fivetechsupport.com/~fivetec1/forums/viewtopic.php?f=3&t=40498&start=15#p241978

Cual t煤 version?

Regards, saludos.
Jo茫o Santos - S茫o Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 117
Joined: Sun Oct 08, 2017 12:51 PM
Re: CODIGO DE BARRAS. ERROR CON FILLRECT()
Posted: Mon May 13, 2024 11:34 AM

FWH2307

Pedro L. Lavallen

San Luis (Capital), Argentina
Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM
Re: CODIGO DE BARRAS. ERROR CON FILLRECT()
Posted: Mon May 13, 2024 11:39 AM
pedroluis wrote:FWH2307
驴Funcion贸 antes? En caso afirmativo, 驴con qu茅 versi贸n de FWH?

Regards, saludos.
Jo茫o Santos - S茫o Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM
Re: CODIGO DE BARRAS. ERROR CON FILLRECT()
Posted: Mon May 13, 2024 11:42 AM
Intenta directamente con el LIB de HARUPD, sin llamar el FWHARU de mister Rao.

https://mega.nz/file/RIlSAB6J#L4qDeL8lY6fmAh0B0oMZ5wQZ5dR9BgpZ9zhezinPT2w

O haz una DEMO y publ铆cala en Mega Upload para poder probarla, 驴vale?

Regards, saludos.
Jo茫o Santos - S茫o Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 318
Joined: Fri Jan 14, 2022 08:37 AM
Re: CODIGO DE BARRAS. ERROR CON FILLRECT()
Posted: Mon May 13, 2024 11:44 AM

Hola,

No estoy seguro de lo que pasa pero me pareciera que la clase que imprime a pdf no tiene el metodo ::fillrect() y por eso ocurre el error

Con esa fantastica libreria yo lo que hice en su dia fue hacer que la impresion del codigo de barras fuera a un archivo .bmp y desde alli la imprimi donde queria, que en mi caso fue un archivo excel

Salu2