xBase++ QR Code print for tax authorities pruposes.

Xbase++ 2.0 Build 554 or later
Message
Author
User avatar
PedroAlex
Posts: 229
Joined: Tue Feb 09, 2010 3:06 am

xBase++ QR Code print for tax authorities pruposes.

#1 Post 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..
Pedro Alexandre

User avatar
Tom
Posts: 1165
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

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

#2 Post 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/
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

patito
Posts: 121
Joined: Tue Aug 31, 2010 9:01 pm

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

#3 Post by patito »

Hi Pedro

attached qrcode program in xbase++ using visual foxpro dll

best regard
Hector Pezoa
Attachments
qr-vfp.rar
(267.39 KiB) Downloaded 671 times
qr-vfp.rar
(267.39 KiB) Downloaded 581 times

User avatar
PedroAlex
Posts: 229
Joined: Tue Feb 09, 2010 3:06 am

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

#4 Post 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.
Pedro Alexandre

messaoudlazhar
Posts: 42
Joined: Mon Dec 23, 2013 2:10 pm
Contact:

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

#5 Post 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

User avatar
PedroAlex
Posts: 229
Joined: Tue Feb 09, 2010 3:06 am

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

#6 Post 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.
Pedro Alexandre

Piotr D
Posts: 129
Joined: Mon Jul 28, 2014 1:26 am
Location: Poznań, Poland

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

#7 Post 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

User avatar
PedroAlex
Posts: 229
Joined: Tue Feb 09, 2010 3:06 am

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

#8 Post by PedroAlex »

Piotr,
Thank you for the tip.
This is the correct way. An external DLL ou activex Control.
Pedro Alexandre

josevalle
Posts: 2
Joined: Mon Oct 03, 2022 8:05 am

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

#9 Post 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.

Koverhage
Posts: 150
Joined: Mon Feb 01, 2010 8:45 am

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

#10 Post 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
Klaus

Post Reply