Login to website

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
tomtagaris
Posts: 107
Joined: Tue Aug 23, 2016 2:43 pm

Re: Login to website

Post by tomtagaris »

i send file
Attachments
tomresp.zip
(389 Bytes) Downloaded 166 times
edk
Posts: 909
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: Login to website

Post by edk »

Strange, this response should not generate an error.
Please, show the piece of code with the line numbers where this error occurs.
Also, please try to:

Code: Select all

Msgdebug ( GetFromXML ( ohttp:ResponseBody(), "entityUid" ) )
edk
Posts: 909
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: Login to website

Post by edk »

Also try this code (based on mxml and hash array)

Code: Select all

#include "hbmxml.ch"

(...)


cXml := ohttp:ResponseBody()

pRoot := mxmlLoadString( NIL, cXml, MXML_OPAQUE_CALLBACK )

hHash := XMLtoHash( pRoot, 'response' )

mxmlDelete( pRoot )

MsgInfo( "entitylineNumber: " + hHash["entitylineNumber"] + CRLF + ;
		"statusCode: " + hHash["statusCode"]  + CRLF + ;
		"entityUid: " + hHash["entityUid"]  + CRLF + ;
		"entityMark: " + hHash["entityMark"] ) 

(...)


*************************************************************
FUNCTION XMLtoHash( pRoot, cElement )
Local pNode, hNext
Local Map := {=>}

If Empty( cElement )
	pNode := pRoot
Else  
	pNode := mxmlFindElement( pRoot, pRoot, cElement, NIL, NIL, MXML_DESCEND )
Endif
     
IF Empty( pNode )
	RETURN Map
ENDIF

hNext := mxmlWalkNext( pNode, pNode, MXML_DESCEND )

Map :=  NodeToHash( hNext )

Return Map

**********************************************
STATIC FUNCTION NodeToHash( node )
Local hNext
Local hHashChild := {=>}
Local hHash := {=>}

DO WHILE node != NIL

	IF mxmlGetType( node ) == MXML_ELEMENT

     	If HB_HHASKEY( hHash, mxmlGetElement( node ) )
     		if valtype( hHash[ mxmlGetElement( node ) ] ) <> "A"
     			
     			hHash[ mxmlGetElement( node ) ] := mxmlGetOpaque( node )
     		else
     			//Jest to tablica, dlatego pomijamy 
     		endif  
     	Else                  
     		hHash[ mxmlGetElement( node ) ] := mxmlGetOpaque( node )
     	Endif

     	If HB_MXMLGETATTRSCOUNT( node ) > 0
     		hHash[ mxmlGetElement( node ) + "@attribute"] := HB_MXMLGETATTRS( node )
     	Endif  
 
     	If Empty(  mxmlGetOpaque( node ) ) // Zagladamy do srodka
     		hNext := mxmlWalkNext( node, node, MXML_DESCEND )  
     		
     		iF hNext != NIL
     			if Empty( hHash[ mxmlGetElement( node ) ]  )
     				hHash[ mxmlGetElement( node ) ] := {}
     			endif  
     			hHashChild :=  NodeToHash( hNext  )
     			if hHashChild != NIL
     				AADD( hHash[ mxmlGetElement( node ) ], hHashChild )
     			endif  
     		enDiF  
     	EndIf
     ENDIF   

     node := mxmlGetNextSibling( node )
                    
ENDDO WHILE

RETURN hHash 
**********************************************************************************************************************

Remember to add #include "hbmxml.ch" at the beginning of your code.
You must also add "hbmxml.hbc" to your project (preferably in a .hbp file)
User avatar
tomtagaris
Posts: 107
Joined: Tue Aug 23, 2016 2:43 pm

Re: Login to website

Post by tomtagaris »

yes it works perfectly
thank you very much
User avatar
tomtagaris
Posts: 107
Joined: Tue Aug 23, 2016 2:43 pm

Re: Login to website

Post by tomtagaris »

Something else
if i send two invoices the answer is double or triple depending on how much i send
is there any way to get the answer because you don't get it with for ...next
thanks
<?xml version="1.0" encoding="utf-8"?>
<ResponseDoc xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<response>
<entitylineNumber>1</entitylineNumber>
<statusCode>Success</statusCode>
<entityUid>8B5F90485B444AC25259C053646A3F098C6965F9</entityUid>
<entityMark>1000000278308</entityMark>
</response>
<response>
<entitylineNumber>2</entitylineNumber>
<statusCode>Success</statusCode>
<entityUid>8B5F90485B444AC25259C053646A3F098C6965F9</entityUid>
<entityMark>1000000278309</entityMark>
</response>
</ResponseDoc>
edk
Posts: 909
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: Login to website

Post by edk »

Code: Select all

cXml := ohttp:ResponseBody()

pRoot := mxmlLoadString( NIL, cXml, MXML_OPAQUE_CALLBACK )

hHash := XMLtoHash( pRoot, /* start from root node */ )

mxmlDelete( pRoot )

hResponse := hHash["ResponseDoc"][1]["response"]  //All <response> nodes

For i=1 TO Len( hResponse )

MsgInfo( "entitylineNumber: " + hResponse[i]["entitylineNumber"] + CRLF + ;
		"statusCode: " + hResponse[i]["statusCode"]  + CRLF + ;
		"entityUid: " + hResponse[i]["entityUid"]  + CRLF + ;
		"entityMark: " + hResponse[i]["entityMark"] , hb_NTOS(i) + " response" ) 

Next i
User avatar
tomtagaris
Posts: 107
Joined: Tue Aug 23, 2016 2:43 pm

Re: Login to website

Post by tomtagaris »

perfect
I have no words to thank you
I wish you the best edk
thank you very much
User avatar
tomtagaris
Posts: 107
Joined: Tue Aug 23, 2016 2:43 pm

Re: Login to website

Post by tomtagaris »

SOMETHING ELSE EDK
I USE THE SAME PROCEDURE TO PROVIDE DATA FROM THE XML FILE RETURNED WITH RequestInvoices BUT I DON'T GET ANYTHING
WHAT I DON'T DO right

cXml := ohttp:ResponseBody()
pRoot := mxmlLoadString( NIL, cXml, MXML_OPAQUE_CALLBACK )

hHash := XMLtoHash( pRoot, /* start from root node */ )

mxmlDelete( pRoot )

hResponse := hHash["invoicesDoc"][2]["invoice"] //All <response> nodes

For i=1 TO Len( hResponse )

MsgInfo( "uid: " + hResponse["uid"] + CRLF + ;
"mark: " + hResponse["mark"] + CRLF + ;
"vatNumber: " + hResponse["vatNumber"] + CRLF + ;
"mark: " + hResponse["mark"] , hb_NTOS(i) + " response" )
next i
the returned xml
<?xml version="1.0" encoding="utf-8"?>
<requestedInvoicesDoc xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<invoicesDoc xmlns="http://www.aade.gr/myDATA/invoice/v1.0">
<invoice>
<uid>8B5F90485B444AC25259C053646A3F098C6965F9</uid>
<mark>1000000280441</mark>
<issuer>
<vatNumber>029690710</vatNumber>
<country>GR</country>
<name>οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½</name>
</issuer>
<counterpart>
<vatNumber>029690710</vatNumber>
<country>GR</country>
</counterpart>
<invoiceHeader>
<branch>0</branch>
<series>οΏ½</series>
<aa>2</aa>
<issueDate>2019-07-19</issueDate>
<invoiceType>1.1</invoiceType>
<vatPaymentSuspension>true</vatPaymentSuspension>
<currency>EUR</currency>
<exchangeRate>8.00</exchangeRate>
<correlatedInvoices />
<selfPricing>false</selfPricing>
<dispatchTime>16:47:51.7000000+00:00</dispatchTime>
<vehicleNumber />
<movePurpose>1</movePurpose>
</invoiceHeader>
<invoiceDetails>
<lineNumber>1</lineNumber>
<measurementUnit>1</measurementUnit>
<netValue>140</netValue>
<vatCategory>2</vatCategory>
<vatExemptionCategory>1</vatExemptionCategory>
<dienergia>
<applicationId />
<applicationDate>1986-12-20</applicationDate>
<shipId />
</dienergia>
<discountOption>true</discountOption>
<withheldAmount>0</withheldAmount>
<stampDutyPercentCategory>1</stampDutyPercentCategory>
<feesAmount>0</feesAmount>
<otherTaxesPercentCategory>1</otherTaxesPercentCategory>
<deductionsPercentage>0</deductionsPercentage>
<incomeClassification>
<classificationType>101</classificationType>
<classificationCategory>1</classificationCategory>
<amount>140</amount>
</incomeClassification>
<incomeClassification>
<classificationType>101</classificationType>
<classificationCategory>1</classificationCategory>
<amount>140</amount>
</incomeClassification>
<incomeClassification>
<classificationType>101</classificationType>
<classificationCategory>1</classificationCategory>
<amount>140</amount>
</incomeClassification>
<incomeClassification>
<classificationType>101</classificationType>
<classificationCategory>1</classificationCategory>
<amount>140</amount>
</incomeClassification>
</invoiceDetails>
<invoiceDetails>
<lineNumber>1</lineNumber>
<quantity>10</quantity>
<measurementUnit>1</measurementUnit>
<invoiceDetailType>1</invoiceDetailType>
<netValue>140</netValue>
<vatCategory>2</vatCategory>
<dienergia>
<applicationId />
<applicationDate>2004-12-14</applicationDate>
<shipId />
</dienergia>
<discountOption>true</discountOption>
<withheldAmount>0</withheldAmount>
<withheldPercentCategory>1</withheldPercentCategory>
<stampDutyPercentCategory>1</stampDutyPercentCategory>
<feesAmount>0</feesAmount>
<otherTaxesPercentCategory>1</otherTaxesPercentCategory>
<incomeClassification>
<classificationType>101</classificationType>
<classificationCategory>1</classificationCategory>
<amount>140</amount>
</incomeClassification>
</invoiceDetails>
<invoiceSummary>
<totalNetValue>140</totalNetValue>
<totalVatAmount>18.2</totalVatAmount>
<totalWithheldAmount>0</totalWithheldAmount>
<totalFeesAmount>0</totalFeesAmount>
<totalStampDutyAmount>0</totalStampDutyAmount>
<totalOtherTaxesAmount>0</totalOtherTaxesAmount>
<totalDeductionsAmount>0</totalDeductionsAmount>
<totalGrossValue>158.2</totalGrossValue>
<incomeClassification>
<classificationType>101</classificationType>
<classificationCategory>1</classificationCategory>
<amount>158.2</amount>
</incomeClassification>
<incomeClassification>
<classificationType>101</classificationType>
<classificationCategory>1</classificationCategory>
<amount>140</amount>
</incomeClassification>
<incomeClassification>
<classificationType>101</classificationType>
<classificationCategory>1</classificationCategory>
<amount>140</amount>
</incomeClassification>
</invoiceSummary>
</invoice>
<invoice>
<uid>8B5F90485B444AC25259C053646A3F098C6965F9</uid>
<mark>1000000280442</mark>
<issuer>
<vatNumber>029690710</vatNumber>
<country>GR</country>
<name>ΤΑΓΑΡΗΣ</name>
</issuer>
<counterpart>
<vatNumber>029690710</vatNumber>
<country>GR</country>
</counterpart>
<invoiceHeader>
<branch>0</branch>
<series>οΏ½</series>
<aa>1</aa>
<issueDate>2019-07-19</issueDate>
<invoiceType>1.1</invoiceType>
<vatPaymentSuspension>true</vatPaymentSuspension>
<currency>EUR</currency>
<exchangeRate>1.00</exchangeRate>
<correlatedInvoices />
<selfPricing>false</selfPricing>
<dispatchTime>16:47:51.0000000+00:00</dispatchTime>
<vehicleNumber />
<movePurpose>1</movePurpose>
</invoiceHeader>
<invoiceDetails>
<lineNumber>1</lineNumber>
<quantity>1</quantity>
<measurementUnit>1</measurementUnit>
<invoiceDetailType>2</invoiceDetailType>
<netValue>140</netValue>
<vatCategory>2</vatCategory>
<discountOption>true</discountOption>
<withheldAmount>0</withheldAmount>
<incomeClassification>
<classificationType>101</classificationType>
<classificationCategory>1</classificationCategory>
<amount>158.2</amount>
</incomeClassification>
</invoiceDetails>
<invoiceSummary>
<totalNetValue>140</totalNetValue>
<totalVatAmount>18.2</totalVatAmount>
<totalWithheldAmount>0</totalWithheldAmount>
<totalFeesAmount>0</totalFeesAmount>
<totalStampDutyAmount>0</totalStampDutyAmount>
<totalOtherTaxesAmount>0</totalOtherTaxesAmount>
<totalDeductionsAmount>0</totalDeductionsAmount>
<totalGrossValue>158.2</totalGrossValue>
</invoiceSummary>
</invoice>
<invoice>
<uid>8B5F90485B444AC25259C053646A3F098C6965F9</uid>
<mark>1000000280443</mark>
<issuer>
<vatNumber>029690710</vatNumber>
<country>GR</country>
<name>οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½</name>
</issuer>
<counterpart>
<vatNumber>029690710</vatNumber>
<country>GR</country>
</counterpart>
<invoiceHeader>
<branch>0</branch>
<series>οΏ½</series>
<aa>2</aa>
<issueDate>2019-07-19</issueDate>
<invoiceType>1.1</invoiceType>
<vatPaymentSuspension>true</vatPaymentSuspension>
<currency>EUR</currency>
<exchangeRate>8.00</exchangeRate>
<correlatedInvoices />
<selfPricing>false</selfPricing>
<dispatchTime>16:47:51.7000000+00:00</dispatchTime>
<vehicleNumber />
<movePurpose>1</movePurpose>
</invoiceHeader>
<invoiceDetails>
<lineNumber>1</lineNumber>
<measurementUnit>1</measurementUnit>
<netValue>140</netValue>
<vatCategory>2</vatCategory>
<vatExemptionCategory>1</vatExemptionCategory>
<dienergia>
<applicationId />
<applicationDate>1986-12-20</applicationDate>
<shipId />
</dienergia>
<discountOption>true</discountOption>
<withheldAmount>0</withheldAmount>
<stampDutyPercentCategory>1</stampDutyPercentCategory>
<feesAmount>0</feesAmount>
<otherTaxesPercentCategory>1</otherTaxesPercentCategory>
<deductionsPercentage>0</deductionsPercentage>
<incomeClassification>
<classificationType>101</classificationType>
<classificationCategory>1</classificationCategory>
<amount>140</amount>
</incomeClassification>
<incomeClassification>
<classificationType>101</classificationType>
<classificationCategory>1</classificationCategory>
<amount>140</amount>
</incomeClassification>
<incomeClassification>
<classificationType>101</classificationType>
<classificationCategory>1</classificationCategory>
<amount>140</amount>
</incomeClassification>
<incomeClassification>
<classificationType>101</classificationType>
<classificationCategory>1</classificationCategory>
<amount>140</amount>
</incomeClassification>
</invoiceDetails>
<invoiceDetails>
<lineNumber>1</lineNumber>
<quantity>10</quantity>
<measurementUnit>1</measurementUnit>
<invoiceDetailType>1</invoiceDetailType>
<netValue>140</netValue>
<vatCategory>2</vatCategory>
<dienergia>
<applicationId />
<applicationDate>2004-12-14</applicationDate>
<shipId />
</dienergia>
<discountOption>true</discountOption>
<withheldAmount>0</withheldAmount>
<withheldPercentCategory>1</withheldPercentCategory>
<stampDutyPercentCategory>1</stampDutyPercentCategory>
<feesAmount>0</feesAmount>
<otherTaxesPercentCategory>1</otherTaxesPercentCategory>
<incomeClassification>
<classificationType>101</classificationType>
<classificationCategory>1</classificationCategory>
<amount>140</amount>
</incomeClassification>
</invoiceDetails>
<invoiceSummary>
<totalNetValue>140</totalNetValue>
<totalVatAmount>18.2</totalVatAmount>
<totalWithheldAmount>0</totalWithheldAmount>
<totalFeesAmount>0</totalFeesAmount>
<totalStampDutyAmount>0</totalStampDutyAmount>
<totalOtherTaxesAmount>0</totalOtherTaxesAmount>
<totalDeductionsAmount>0</totalDeductionsAmount>
<totalGrossValue>158.2</totalGrossValue>
<incomeClassification>
<classificationType>101</classificationType>
<classificationCategory>1</classificationCategory>
<amount>158.2</amount>
</incomeClassification>
<incomeClassification>
<classificationType>101</classificationType>
<classificationCategory>1</classificationCategory>
<amount>140</amount>
</incomeClassification>
<incomeClassification>
<classificationType>101</classificationType>
<classificationCategory>1</classificationCategory>
<amount>140</amount>
</incomeClassification>
</invoiceSummary>
</invoice>
</invoicesDoc>
</requestedInvoicesDoc>
edk
Posts: 909
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: Login to website

Post by edk »

Hi Tom.
I see you have a problem understanding the hash array structure.
Unfortunately, my English is not very good to explain, so I made a pictorial description. I hope it will be helpful.
Bez tytułu.png
Bez tytułu.png (55.27 KiB) Viewed 3481 times
Source code below:

Code: Select all

hInvoice := hHash["requestedInvoicesDoc"][ 1 ]["invoicesDoc"][ 1 ]["invoice"] //All <invoice> nodes

For i=1 TO Len( hInvoice )

	// the "invoice" root node
	cInv_Root   := "uid: " + hInvoice[ i /* n-th invoice */ ]["uid"] + CRLF + ;
			"mark: " + hInvoice[ i ]["mark"]


				
	// the "invoice" node has only one [1] "issuer" node 
	cInv_Issuer := "issuer -> vatNumber:" + hInvoice[ i /* n-th invoice */ ]["issuer"][ 1 /* 1-st and only sub-node "issuer" */ ]["vatNumber"] + CRLF +;
			"issuer -> counrty:" + hInvoice[ i ]["issuer"][ 1 ]["country"] + CRLF +;
			"issuer -> name:" + hInvoice[ i ]["issuer"][ 1 ]["name"]

				

	// the "invoice" node has only one [1] "counterpart" node
	cInv_Counterpart := "counterpart -> vatNumber:" + hInvoice[ i /* n-th invoice */ ]["counterpart"][ 1 /* 1-st and only sub-node "counterpart" */ ]["vatNumber"] + CRLF +;
				"counterpart -> country:" + hInvoice[ i ]["counterpart"][ 1 ]["country"]

					
					
	// the "invoice" node has only one [1] "invoiceHeadert" node					
	cInv_Header := "invoiceHeader -> branch:" + hInvoice[ i /* n-th invoice */ ]["invoiceHeader"][ 1 /* 1-st and only sub-node "invoiceHeader" */ ]["branch"] + CRLF +;
			"invoiceHeader -> series:" + hInvoice[ i ]["invoiceHeader"][ 1 ]["series"] + CRLF +;
			"invoiceHeader -> aa:" + hInvoice[ i ]["invoiceHeader"][ 1 ]["aa"] + CRLF +;
			"invoiceHeader -> issueDate:" + hInvoice[ i ]["invoiceHeader"][ 1 ]["issueDate"] + CRLF +;
			"invoiceHeader -> invoiceType:" + hInvoice[ i ]["invoiceHeader"][ 1 ]["invoiceType"] + CRLF +;
			"invoiceHeader -> vatPaymentSuspension:" + hInvoice[ i ]["invoiceHeader"][ 1 ]["vatPaymentSuspension"] + CRLF +;
			"invoiceHeader -> currency:" + hInvoice[ i ]["invoiceHeader"][ 1 ]["currency"] + CRLF +;
			"invoiceHeader -> exchangeRate:" + hInvoice[ i ]["invoiceHeader"][ 1 ]["exchangeRate"] + CRLF +;
			"invoiceHeader -> correlatedInvoices:" + hInvoice[ i ]["invoiceHeader"][ 1 ]["correlatedInvoices"] + CRLF +;
			"invoiceHeader -> selfPricing:" + hInvoice[ i ]["invoiceHeader"][ 1 ]["selfPricing"] + CRLF +;
			"invoiceHeader -> dispatchTime:" + hInvoice[ i ]["invoiceHeader"][ 1 ]["dispatchTime"] + CRLF +;
			"invoiceHeader -> vehicleNumber:" + hInvoice[ i ]["invoiceHeader"][ 1 ]["vehicleNumber"] + CRLF +;
			"invoiceHeader -> movePurpose:" + hInvoice[ i ]["invoiceHeader"][ 1 ]["movePurpose"]
			
	MsgInfo( "Invoice #" + hb_ntos (i) + CRLF + ;
		cInv_root + CRLF +;
		cInv_Issuer + CRLF +;
		cInv_Counterpart + CRLF +;
		cInv_Header )
		

	

	// the "invoice" node can have several "invoiceDetails" nodes
	FOR nDetails = 1 TO Len ( hInvoice[ i /* n-th invoice */ ]["invoiceDetails"] )
		
		hDetails := hInvoice[ i /* n-th invoice */ ]["invoiceDetails"][ nDetails /* n-th sub-node "invoiceDetails" */ ]
	
		cInv_Details := "invoiceDetails -> lineNumber:" + hDetails["lineNumber"] + CRLF
		
		//I am not sure if the item exists (may be optional), so I will ask for it using the function hb_HGetDef (<hHash>, <Key>, [<DefaultValue>]) => xValue | NIL
		cInv_Details += "invoiceDetails -> quantity:" + hb_HGetDef( hDetails , "quantity" , "") + CRLF
		cInv_Details += "invoiceDetails -> measurementUnit:" + hb_HGetDef( hDetails , "measurementUnit" , "") + CRLF
		cInv_Details += "invoiceDetails -> netValue:" + hb_HGetDef( hDetails, "netValue", "") + CRLF
		cInv_Details += "invoiceDetails -> vatCategory:" + hb_HGetDef( hDetails, "vatCategory", "") + CRLF
		cInv_Details += "invoiceDetails -> vatExemptionCategory:" + hb_HGetDef( hDetails, "vatExemptionCategory", "") + CRLF
		
		//the "invoiceDetails" node has the optional "dienergy" node. Let's check if it exists
		IF hb_HHasKey( hDetails, "dienergia" )
		
			//I don't know if the "dienergia" node can occur more than once. Just in case, I check all occurrences
			FOR j = 1 TO Len( hDetails["dienergia"] )
				cInv_Details += "invoiceDetails -> dienergia -> applicationId:" + hb_HGetDef( hDetails["dienergia"][ j /* n-st sub-node "dianergia" */ ], "applicationId", "") + CRLF
				cInv_Details += "invoiceDetails -> dienergia -> applicationDate:" + hb_HGetDef( hDetails["dienergia"][ j ], "applicationDate", "") + CRLF
				cInv_Details += "invoiceDetails -> dienergia -> shipId:" + hb_HGetDef( hDetails["dienergia"][ j ], "shipId", "") + CRLF
			NEXT j
		
		ENDIF
		
		cInv_Details += "invoiceDetails -> discountOption:" + hb_HGetDef( hDetails, "discountOption" , "") + CRLF
		cInv_Details += "invoiceDetails -> withheldAmount:" + hb_HGetDef( hDetails, "withheldAmount" , "") + CRLF
		cInv_Details += "invoiceDetails -> stampDutyPercentCategory:" + hb_HGetDef( hDetails, "stampDutyPercentCategory" , "") + CRLF
		cInv_Details += "invoiceDetails -> feesAmount:" + hb_HGetDef( hDetails, "feesAmount" , "") + CRLF
		cInv_Details += "invoiceDetails -> otherTaxesPercentCategory:" + hb_HGetDef( hDetails, "otherTaxesPercentCategory" , "") + CRLF
		cInv_Details += "invoiceDetails -> deductionsPercentage:" + hb_HGetDef( hDetails, "deductionsPercentage" , "") + CRLF
		
		//the "invoiceDetails" node has the optional "incomeClassification" node. Let's check if it exists
		IF hb_HHasKey( hDetails, "incomeClassification" )
		
			//I don't know if the "incomeClassification" node can occur more than once. Just in case, I check all occurrences
			FOR j = 1 TO Len( hDetails["incomeClassification"] )
				cInv_Details += "invoiceDetails -> incomeClassification -> classificationType:" + hb_HGetDef( hDetails["incomeClassification"][ j /* n-st sub-node "incomeClassification" */ ], "classificationType", "") + CRLF
				cInv_Details += "invoiceDetails -> incomeClassification -> classificationCategory:" + hb_HGetDef( hDetails["incomeClassification"][ j ], "classificationCategory", "") + CRLF
				cInv_Details += "invoiceDetails -> incomeClassification -> amount:" + hb_HGetDef( hDetails["incomeClassification"][ j ], "amount", "") + CRLF
			NEXT j
		
		ENDIF
		
		
		MsgInfo( "Invoice #" + hb_ntos (i) + "   Detail #" + hb_ntos (nDetails) + CRLF + cInv_Details)
	
	Next nDetails
	
	
	// the "invoice" node has only one [1] "invoiceSummary" node
	hSummary := hInvoice[ i /* n-th invoice */ ]["invoiceSummary"][ 1 /* 1-st and only sub-node "invoiceSummary" */ ]
	
	cInv_Summary := "invoiceSummary -> totalNetValue:" + hSummary["totalNetValue"] + CRLF +;
			 "invoiceSummary -> totalVatAmount:" + hSummary["totalVatAmount"] + CRLF +;
			 "invoiceSummary -> totalWithheldAmount:" + hSummary["totalWithheldAmount"] + CRLF +;
			 "invoiceSummary -> totalFeesAmount:" + hSummary["totalFeesAmount"] + CRLF +;
			 "invoiceSummary -> totalStampDutyAmount:" + hSummary["totalStampDutyAmount"] + CRLF +;
			 "invoiceSummary -> totalOtherTaxesAmount:" + hSummary["totalOtherTaxesAmount"] + CRLF +;
			 "invoiceSummary -> totalDeductionsAmount:" + hSummary["totalDeductionsAmount"] + CRLF +;
			 "invoiceSummary -> totalGrossValue:" + hSummary["totalGrossValue"] + CRLF
				 
	//the "invoiceSummary" node has the optional "incomeClassification" node. Let's check if it exists
	IF hb_HHasKey( hSummary, "incomeClassification" )
			
			//I don't know if the "incomeClassification" node can occur more than once. Just in case, I check all occurrences
			FOR j = 1 TO Len( hSummary["incomeClassification"] )
				cInv_Summary += "invoiceSummary -> incomeClassification -> classificationType:" + hb_HGetDef( hSummary["incomeClassification"][ j /* n-st sub-node "incomeClassification" */ ], "classificationType", "") + CRLF
				cInv_Summary += "invoiceSummary -> incomeClassification -> classificationCategory:" + hb_HGetDef( hSummary["incomeClassification"][ j ], "classificationCategory", "") + CRLF
				cInv_Summary += "invoiceSummary -> incomeClassification -> amount:" + hb_HGetDef( hSummary["incomeClassification"][ j ], "amount", "") + CRLF
			NEXT j
		
		ENDIF
		
		
	MsgInfo( "Invoice #" + hb_ntos (i) + "   Summary:" + CRLF + cInv_Summary)
	
next i
I split hHash into individual variables to make the structure easier to understand.

Edward.
User avatar
tomtagaris
Posts: 107
Joined: Tue Aug 23, 2016 2:43 pm

Re: Login to website

Post by tomtagaris »

thank you very much edk
I'm trying to understand how it works
it's too deep for me
and my english is not good
your work is amazing
Thank you very much
without your help I wouldn't succeed
I hope this is the last thing I ask of you
Post Reply