QR Code in HMG
Moderator: Rathinagiri
Re: QR Code in HMG
Dear All,
If any one generated QRCODE in HMG, for INDIAN E-Invoice IRN, I would be thankful for sharing the code.
The QRCODE generated by me gives Error 3. QRCODE data received from INDIAN GST site has 3400 to 3600 character length.
I do not know how to attach program file in HMG forum.
Thanks every one in advance.
Regards,
Ramesh Bhat.
If any one generated QRCODE in HMG, for INDIAN E-Invoice IRN, I would be thankful for sharing the code.
The QRCODE generated by me gives Error 3. QRCODE data received from INDIAN GST site has 3400 to 3600 character length.
I do not know how to attach program file in HMG forum.
Thanks every one in advance.
Regards,
Ramesh Bhat.
- danielmaximiliano
- Posts: 2625
- Joined: Fri Apr 09, 2010 4:53 pm
- Location: Argentina
- Contact:
Re: QR Code in HMG
When composing a post use the option "Full Editor & Preview" inside look for the "Attachment" tab look for the code in ZIP or RAR format
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*
Saludos / Regards
DaNiElMaXiMiLiAnO
Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*
Saludos / Regards
DaNiElMaXiMiLiAnO
Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
Re: QR Code in HMG
Thank you Danielmaximiliano.
The QRCODE when scanned by scanner (Downloaded from GST E-Invoice website) should give result like this.
The QRCODE when scanned by scanner (Downloaded from GST E-Invoice website) should give result like this.
- Attachments
-
- qrc.zip
- (1.84 MiB) Downloaded 3554 times
-
- einvoiceverification.jpg (295.71 KiB) Viewed 332201 times
Re: QR Code in HMG
1. Received data from INDIAN GST is saved in JSON format - it is not the QR Code itself. Other data is also stored there.
2. The JSON string stored in the database should be converted into the Hash array.
3. The contents of the "SignedQRCode" key should be read from the Hash array.
4. The content of this key is the content of the QR Code.
Try this:
Code: Select all
#include "hmg.ch"
Function Main()
Local hHash, cHash, cSignedQRCode := ""
REQUEST DBFCDX, DBFFPT
RDDSETDEFAULT( "DBFCDX" )
SELECT 0
USE seljsn INDEX seljsn
GO TOP
cHash := AllTrim ( seljsn->qrcode )
nLen := hb_JsonDecode( cHash, @hHash )
IF nLen = 0
MsgStop ("Error while decoding JSON")
Close Data
Quit
ENDIF
cSignedQRCode := hb_HGetDef( hHash, "SignedQRCode", "")
IF EMPTY (cSignedQRCode)
MsgStop ("No SignedQRCode into JSON")
Close Data
Quit
ENDIF
//msgdebug ( cSignedQRCode)
//msgdebug (hb_HKeys (hHash))
SELECT HPDFDOC "sample.pdf" PAPERLENGTH 300 PAPERWIDTH 300 LOG
SET HPDFDOC ENCODING TO "WinAnsiEncoding"
START HPDFDOC
START HPDFPAGE
@10, 10 HPDFPRINT "QRCODE line width = 1"
HPDFDrawBarcode(10, 70, cSignedQRCode , "QRCODE", 1)
@55, 10 HPDFPRINT "QRCODE line width = 1.5"
HPDFDrawBarcode(55, 70, cSignedQRCode , "QRCODE", 1.5)
@120, 10 HPDFPRINT "QRCODE line width = 2"
HPDFDrawBarcode(120, 70, cSignedQRCode , "QRCODE", 2)
END HPDFPAGE
END HPDFDOC
Execute File 'sample.pdf'
Return Nil
*******************************
PROCEDURE HPDFDrawBarcode( nRow, nCol, cCode, cType, nLineWidth, nLineHeight, lShowDigits, lCheckSum, lWide2_5, lWide3 )
Local hZebra, cTxt, nFlags, nSizeWidth, nTextWidth
Local hPdf := _HMG_SYSDATA[ 150 ][ 1 ]
Local hPage := _HMG_SYSDATA[ 150 ][ 7 ]
Local nWidth := _HMG_SYSDATA[ 150 ][ 4 ]
Local nHeight := _HMG_SYSDATA[ 150 ][ 5 ]
Local nxPos := _HMG_HPDF_MM2Pixel( nCol )
Local nyPos := nHeight - _HMG_HPDF_MM2Pixel( nRow )
Local cFont := "Helvetica"
Local nFontSize := 9
Local nTextHeight := 0
DEFAULT nLineWidth := 1
DEFAULT nLineHeight := 18
DEFAULT lCheckSum := .F.
DEFAULT lWide2_5 := .F.
DEFAULT lWide3 := .F.
DEFAULT lShowDigits := .F.
nFlags := 0
IF lChecksum
nFlags := nFlags + HB_ZEBRA_FLAG_CHECKSUM
ENDIF
IF lWide2_5
nFlags := nFlags + HB_ZEBRA_FLAG_WIDE2_5
ENDIF
IF lWide3
nFlags := nFlags + HB_ZEBRA_FLAG_WIDE3
ENDIF
IF nFlags == 0
nFlags := Nil
ENDIF
SWITCH cType
CASE "EAN13" ; hZebra := hb_zebra_create_ean13( cCode, nFlags ) ; EXIT
CASE "EAN8" ; hZebra := hb_zebra_create_ean8( cCode, nFlags ) ; EXIT
CASE "UPCA" ; hZebra := hb_zebra_create_upca( cCode, nFlags ) ; EXIT
CASE "UPCE" ; hZebra := hb_zebra_create_upce( cCode, nFlags ) ; EXIT
CASE "CODE39" ; hZebra := hb_zebra_create_code39( cCode, nFlags ) ; EXIT
CASE "ITF" ; hZebra := hb_zebra_create_itf( cCode, nFlags ) ; EXIT
CASE "MSI" ; hZebra := hb_zebra_create_msi( cCode, nFlags ) ; EXIT
CASE "CODABAR" ; hZebra := hb_zebra_create_codabar( cCode, nFlags ) ; EXIT
CASE "CODE93" ; hZebra := hb_zebra_create_code93( cCode, nFlags ) ; EXIT
CASE "CODE11" ; hZebra := hb_zebra_create_code11( cCode, nFlags ) ; EXIT
CASE "CODE128" ; hZebra := hb_zebra_create_code128( cCode, nFlags ) ; EXIT
CASE "PDF417" ; hZebra := hb_zebra_create_pdf417( cCode, nFlags ); nLineHeight := nLineWidth * 3 ; lShowDigits := .f. ; EXIT
CASE "DATAMATRIX" ; hZebra := hb_zebra_create_datamatrix( cCode, nFlags ); nLineHeight := nLineWidth ; lShowDigits := .f. ; EXIT
CASE "QRCODE" ; hZebra := hb_zebra_create_qrcode( cCode, nFlags ); nLineHeight := nLineWidth ; lShowDigits := .f. ; EXIT
ENDSWITCH
IF hZebra != NIL
IF hb_zebra_geterror( hZebra ) == 0
IF lShowDigits
cTxt := ALLTRIM(hb_zebra_getcode( hZebra ))
nSizeWidth := HMG_Zebra_GetWidth (hZebra, nLineWidth, nLineHeight, NIL)
nSizeHeight := HMG_Zebra_GetHeight (hZebra, nLineWidth, nLineHeight, NIL)
HPDF_Page_SetFontAndSize( hPage, HPDF_GetFont( hPdf, cFont, NIL ), nFontSize )
nTextWidth := HPDF_Page_TextWidth( hPage, cTxt )
nTextHeight:= nFontSize - 1
HPDF_Page_BeginText( hPage )
HPDF_Page_TextOut( hPage, (nxPos + ( nSizeWidth / 2 )) - ( nTextWidth / 2 ), nyPos - nSizeHeight, cTxt )
HPDF_Page_EndText( hPage )
ENDIF
hb_zebra_draw_hpdf( hZebra, hPage, nxPos, nyPos, nLineWidth, -(nLineHeight-nTextHeight))
ELSE
MsgInfo ("Type "+ cType + CRLF +"Code "+ cCode+ CRLF+ "Error "+LTrim(hb_valtostr(hb_zebra_geterror(hZebra))))
ENDIF
hb_zebra_destroy( hZebra )
ELSE
MsgStop("Invalid barcode type !", cType)
ENDIF
RETURN
***************************************
STATIC FUNCTION hb_zebra_draw_hpdf( hZebra, hPage, ... )
IF hb_zebra_geterror( hZebra ) != 0
RETURN HB_ZEBRA_ERROR_INVALIDZEBRA
ENDIF
hb_zebra_draw( hZebra, {| x, y, w, h | HPDF_Page_Rectangle( hPage, x, y, w, h ) }, ... )
HPDF_Page_Fill( hPage )
RETURN 0
******************************************************
*-----------------------------------------------------------------------------------------------*
FUNCTION HMG_Zebra_GetWidth (hZebra, nLineWidth, nLineHeight, iFlags)
*-----------------------------------------------------------------------------------------------*
LOCAL x1:= 0, y1 := 0, nBarWidth := 0, nBarHeight := 0
// always --> nBarHeight = nLineHeight
IF hb_zebra_GetError( hZebra ) != 0
RETURN HB_ZEBRA_ERROR_INVALIDZEBRA
ENDIF
// hb_zebra_draw ( hZebra, bCodeBlock, dX, dY, dWidth, dHeight, iFlags )
hb_zebra_draw ( hZebra, {| x, y, w, h | nBarWidth:=MAX(x+w-x1, nBarWidth), nBarHeight:=MAX(y+h-y1, nBarHeight) }, x1, y1, nLineWidth, nLineHeight, iFlags )
RETURN nBarWidth
// hb_zebra_draw ( hZebra, {| x, y, w, h | nBarWidth:=x+w-x1, nBarHeight:=y+h-y1 }, x1, y1, nLineWidth, nLineHeight, iFlags )
// hb_zebra_draw ( hZebra, {| x, y, w, h | nBarWidth:=MAX(x+w-x1, nBarWidth), nBarHeight:=MAX(y+h-y1, nBarHeight) }, x1, y1, nLineWidth, nLineHeight, iFlags )
*-----------------------------------------------------------------------------------------------*
FUNCTION HMG_Zebra_GetHeight (hZebra, nLineWidth, nLineHeight, iFlags)
*-----------------------------------------------------------------------------------------------*
LOCAL x1:= 0, y1 := 0, nBarWidth := 0, nBarHeight := 0
// always --> nBarHeight = nLineHeight
IF hb_zebra_GetError( hZebra ) != 0
RETURN HB_ZEBRA_ERROR_INVALIDZEBRA
ENDIF
// hb_zebra_draw ( hZebra, bCodeBlock, dX, dY, dWidth, dHeight, iFlags )
hb_zebra_draw ( hZebra, {| x, y, w, h | nBarWidth:=MAX(x+w-x1, nBarWidth), nBarHeight:=MAX(y+h-y1, nBarHeight) }, x1, y1, nLineWidth, nLineHeight, iFlags )
RETURN nBarHeight
****************************************************************************************************************************
Re: QR Code in HMG
Wow! it is working.
I never thought it is so simple.
Thank you EDK. It made my life much more simple.
Regards,
Ramesh Bhat.
I never thought it is so simple.
Thank you EDK. It made my life much more simple.
Regards,
Ramesh Bhat.
- Rathinagiri
- Posts: 5480
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: QR Code in HMG
As of now, this is the first and foremost requirement of HMG.
I think we can make use of the Git.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
Re: QR Code in HMG
I've published things to be implemented on the GIt ( automatic compilation ). But no one cared...
Some other people here had similar experiences.
Reported fixes totally ignored.
Is there a real interest on keeping this tool alive?
Some other people here had similar experiences.
Reported fixes totally ignored.
Is there a real interest on keeping this tool alive?
Angel Pais
Web Apps consultant/architect/developer.
Web Apps consultant/architect/developer.
- serge_girard
- Posts: 3309
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
Re: QR Code in HMG
Maybe many of HMG-members have some corona trouble to handle..?
There's nothing you can do that can't be done...
Re: QR Code in HMG
Sorry, I'm not familiar with Github.
I also don't touch sources because of none knowledge of this
I also don't touch sources because of none knowledge of this
Re: QR Code in HMG
Hi
We would like to contribute / generate / publish HMG but most of the user are not familiar with Git hub
You are master in Harbour but we have not such knowledge
I am old clipper user, even I am not using IDE, I prefer to write code
Anyone guide us how to work with Git or GIt ( automatic compilation )
BPD
Convert Dream into Reality through HMG
Convert Dream into Reality through HMG