Page 1 of 2

xBase++ QR Code print for tax authorities pruposes.

Posted: Fri Aug 14, 2020 1:41 am
by PedroAlex
Hello people,

Here, the tax authorities published a law that requires printing a QR code on all invoices and business documents, even those that are printed on a receipt.
In my case, I print the tickets in text mode, that is, I use commands like "Dcprint say". I am studying the possibilities that xbase can support to print this type of data in a stable and robust way..
I ask, if any programmer who frequents this forum has any experience in this type of work and if they can make any comments, opinions or technical advice.
Some recommendations or examples can help.

Many Thanks in advance..

Re: xBase++ QR Code print for tax authorities pruposes.

Posted: Fri Aug 14, 2020 2:11 am
by Tom
Hi, Pedro.

Maybe this is a good moment to migrate a professional report writing tool like "List & Label" (www.combit.net), which will increase the quality of your app and provide stuff like 2D-barcodes out of the box and without additional programming. And lots of other features.

It is possible to paint QR-barcodes using the GRA-functions, which for instance can be accessed via DCPRINT BOX.

Here's a project which someone adapted to be used with Visual Foxpro, so it should be possible to move it to Xbase++ aswell: https://zint.github.io/

Re: xBase++ QR Code print for tax authorities pruposes.

Posted: Fri Aug 14, 2020 4:04 pm
by patito
Hi Pedro

attached qrcode program in xbase++ using visual foxpro dll

best regard
Hector Pezoa

Re: xBase++ QR Code print for tax authorities pruposes.

Posted: Wed Aug 19, 2020 4:14 am
by PedroAlex
Tom,
I appreciate your comments

Hector,
Thank you very much for the example.
I've done some tests.
It seems to me a solution for this case.

Re: xBase++ QR Code print for tax authorities pruposes.

Posted: Mon Aug 24, 2020 1:02 pm
by messaoudlazhar
Sample tested with xbase++,
controlled with QR Scanner

Code: Select all

*********************** Functions BarCodeLibrary.DLL ********************************
DLLFUNCTION SetConfiguration(nSize,nType);
            USING STDCALL FROM BarCodeLibrary.DLL
DLLFUNCTION GenerateFile(cText,cFileOut);
            USING STDCALL FROM BarCodeLibrary.DLL

*********-----------------
Procedure CreateQRCodeImage
 Parameters cQrTexte,cRetFileImg,nSizeQR,nTypeQR
BEGIN SEQUENCE
   If Empty(nTypeQR)
      BREAK
   Endif
   If Empty(cRetFileImg)
      BREAK
   Endif
   If nSizeQR<2 .Or. nSizeQR>12
      MsgBox("Incorrect size: 2 .. 12")
      BREAK
   Endif
   If nTypeQR<0 .Or. nTypeQR>2
      MsgBox("Incorrect image type file: 0 .. 2")
      BREAK
   Endif
   MyConfQR:=SetConfiguration(nSizeQR,nTypeQR)
   // If Oem, conevrt text to ansi, other : GenerateFile(cQrTexte,cRetFileImg)
   MyRetFileQR:=GenerateFile(ConvToAnsiCP(cQrTexte),cRetFileImg)
END SEQUENCE
Return
*********-----------
Procedure TestQr
MyTexte:="Test,  It's great QR code (xbase ++)"
MyTexte+=Chr(13)+Chr(10)+Dtoc(Date())+" … "+Time()
MFileImg:="Lazhar.Jpg"
CreateQRCodeImage(Mytexte,MFileImg,6,1)
Return

Re: xBase++ QR Code print for tax authorities pruposes.

Posted: Mon Oct 26, 2020 10:29 am
by PedroAlex
This DLL has the limitation of only supporting 255 characters in the string to generate the QRcode.

I need generate a QRCode with 455 chars.

Anybody now other solution?

Many Thanks.

Re: xBase++ QR Code print for tax authorities pruposes.

Posted: Wed Oct 28, 2020 1:46 am
by Piotr D
Pedro,
you can use alternative ActiveX library for printing QR Code, like MW6QRCode or StrokeScribe. Here you find about this:
http://bb.donnay-software.com/donnay/vi ... f=2&t=2761
You can manipulate type/size of QR code and with StrokeScribe you can pass the text in various code type, not only UTF-8.

Regards
Piotr

Re: xBase++ QR Code print for tax authorities pruposes.

Posted: Wed Oct 28, 2020 4:06 am
by PedroAlex
Piotr,
Thank you for the tip.
This is the correct way. An external DLL ou activex Control.

Re: xBase++ QR Code print for tax authorities pruposes.

Posted: Mon Oct 03, 2022 8:20 am
by josevalle
patito wrote: Fri Aug 14, 2020 4:04 pm Hi Pedro

attached qrcode program in xbase++ using visual foxpro dll

best regard
Hector Pezoa
Problems with the second barcode generated.
STATIC FUNC Genera(pText,pFile)
*******************************
LOCAL nHandle := DllPrepareCall("BarCodeLibrary.DLL",DLL_CDECL,"SetConfiguration")
LOCAL nSize := 6
LOCAL nType := 1 //0=bmp 1=jpg 2=gip

DllExecuteCall(nHandle ,nSize,nType)

o:=DllPrepareCall("BarCodeLibrary.DLL",DLL_CDECL,"GenerateFile")
DllExecuteCall(o,pText,pFile)

DllUnLoad(nHandle)

RETURN .t.

Re: xBase++ QR Code print for tax authorities pruposes.

Posted: Mon Oct 03, 2022 11:35 pm
by Koverhage
I do it this way

Code: Select all

Local qr_content := "", ;
      qr_bmpfile := "", ;
      qr_file := GetTempFileName_a(GetTempPath_a()), ;
      qr_done := 0

qr_done:=DllCall("QRCODELIB.DLL", DLL_STDCALL, "FastQRCode",qr_content,qr_file,Pixel132x132)    
qr_bmpfile := strtran(qr_file,".tmp",".bmp")  
FRename(qr_file,qr_bmpfile)

IF file(qr_bmpfile)
    nRow+= 2.5
    @ nRow, RBLOCKPOS, nRow + 3.3, d_rs DCPRINT box LINECOLOR GRA_CLR_RED LINEWIDTH 2 PRINTER oPrinter
ENDIF
IF Fexists(qr_file)
   FErase(qr_file)
ENDIF