Quickbooks message: "Object "..." specified in the request cannot be found" - integration

I'm the programmer for a company that sells a web-based business software product, that lets the user run their business. Our system is also required to sync all financial information to our user's Desktop QuickBoooks. We use the QB Web Connector to do this.
When I send an invoice to QB that has already been paid in our system, first I send an InvoiceAddRq. I specify the exact AR account name in the ARAccountRef field.
When the InvoiceAddRs comes back, if the statusSeverity is INFO and the statusMessage is "Status OK", then I read the TxnID from the XML and store in in our database.
Then when the web connector sends the request for the next operation, I read the same TxnID from the database and send a ReceivePaymentAddRq, in which I use the exact same AR account name in the ARAccountRef, the exact same customer name in the CustomerRef, and in the AppliedToTxnAdd block of the ReceivePaymentAddRq, I use that same TxnID from the InvoiceAddRs for TxnID and the same invoice total for PaymentAmount that I sent in the InvoiceAddRq's InvoiceLineAdd's Amount field.
(Our InvoiceAddRq's always contain only one Invoice Line, with the grand total of the invoice in our system. We don't import our customers' individual items.)
Now -- Sometimes this works fine, but sometimes the ReceivePaymentAddRs contains the error "Object "..." specified in the request cannot be found" -- where the "..." is the TxnID I got from the initial InvoiceAddRs.
When this happens, the customer verifies to us that the respective invoice is indeed in their QB, but is not marked paid.
Also, to NOTE, our customers are NOT using multiple currencies, all currencies are in USD$, and the ReceivePaymentAddRq happens within a couple seconds after the InvoiceAddRq, which means that no QB user in the customer's company has time to modify the newly inserted invoice.
Why does this happen? Is it a QB bug?
EDIT:
2017-01-04 14:24:21
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="8.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<InvoiceAddRq>
<InvoiceAdd>
<CustomerRef>
<FullName>SILMAN DC</FullName>
</CustomerRef>
<ARAccountRef>
<FullName>Accounts Receivable:Accounts Receivable</FullName>
</ARAccountRef>
<TxnDate>2017-01-04</TxnDate>
<RefNumber>77671</RefNumber>
<BillAddress>
<Addr1>SILMAN DC</Addr1>
<Addr2>1053 31ST STREET NW</Addr2>
<Addr3/>
<Addr4/>
<City>WASHINGTON</City>
<State>DC</State>
<PostalCode>20007</PostalCode>
</BillAddress>
<ShipAddress>
<Addr1>1053 31ST STREET NW</Addr1>
<Addr2/>
<Addr3/>
<City>WASHINGTON</City>
<State>DC</State>
<PostalCode>20007</PostalCode>
</ShipAddress>
<PONumber/>
<TermsRef>
<FullName>Credit Card</FullName>
</TermsRef>
<InvoiceLineAdd>
<ItemRef>
<FullName>Invoice</FullName>
</ItemRef>
<Desc>Invoice</Desc>
<Quantity>1</Quantity>
<Amount>59.21</Amount>
</InvoiceLineAdd>
</InvoiceAdd>
</InvoiceAddRq>
</QBXMLMsgsRq>
</QBXML>
2017-01-04 14:24:21
<?xml version="1.0"?>
<QBXML>
<QBXMLMsgsRs>
<InvoiceAddRs statusCode="0" statusSeverity="Info" statusMessage="Status OK">
<InvoiceRet>
<TxnID>A13F8-1483561159</TxnID>
<TimeCreated>2017-01-04T15:19:19-05:00</TimeCreated>
<TimeModified>2017-01-04T15:19:19-05:00</TimeModified>
<EditSequence>1483561159</EditSequence>
<TxnNumber>133184</TxnNumber>
<CustomerRef>
<ListID>800005FF-1478123373</ListID>
<FullName>SILMAN DC</FullName>
</CustomerRef>
<ARAccountRef>
<ListID>80000025-1423671174</ListID>
<FullName>Accounts Receivable:Accounts Receivable</FullName>
</ARAccountRef>
<TemplateRef>
<ListID>80000003-1423576739</ListID>
<FullName>Intuit Service Invoice</FullName>
</TemplateRef>
<TxnDate>2017-01-04</TxnDate>
<RefNumber>77671</RefNumber>
<BillAddress>
<Addr1>SILMAN DC</Addr1>
<Addr2>1053 31ST STREET NW</Addr2>
<City>WASHINGTON</City>
<State>DC</State>
<PostalCode>20007</PostalCode>
</BillAddress>
<BillAddressBlock>
<Addr1>SILMAN DC</Addr1>
<Addr2>1053 31ST STREET NW</Addr2>
<Addr3>WASHINGTON, DC 20007</Addr3>
</BillAddressBlock>
<ShipAddress>
<Addr1>1053 31ST STREET NW</Addr1>
<City>WASHINGTON</City>
<State>DC</State>
<PostalCode>20007</PostalCode>
</ShipAddress>
<ShipAddressBlock>
<Addr1>1053 31ST STREET NW</Addr1>
<Addr2>WASHINGTON, DC 20007</Addr2>
</ShipAddressBlock>
<IsPending>false</IsPending>
<IsFinanceCharge>false</IsFinanceCharge>
<TermsRef>
<ListID>80000009-1425488517</ListID>
<FullName>Credit Card</FullName>
</TermsRef>
<DueDate>2017-01-04</DueDate>
<ShipDate>2017-01-04</ShipDate>
<Subtotal>59.21</Subtotal>
<SalesTaxPercentage>0.00</SalesTaxPercentage>
<SalesTaxTotal>0.00</SalesTaxTotal>
<AppliedAmount>0.00</AppliedAmount>
<BalanceRemaining>59.21</BalanceRemaining>
<IsPaid>false</IsPaid>
<IsToBePrinted>true</IsToBePrinted>
<IsToBeEmailed>false</IsToBeEmailed>
<InvoiceLineRet>
<TxnLineID>A13FA-1483561159</TxnLineID>
<ItemRef>
<ListID>80000003-1423676477</ListID>
<FullName>Invoice</FullName>
</ItemRef>
<Desc>Invoice</Desc>
<Quantity>1</Quantity>
<Rate>59.21</Rate>
<Amount>59.21</Amount>
<SalesTaxCodeRef>
<ListID>80000002-1423576739</ListID>
<FullName>Non</FullName>
</SalesTaxCodeRef>
</InvoiceLineRet>
</InvoiceRet>
</InvoiceAddRs>
</QBXMLMsgsRs>
</QBXML>
2017-01-04 14:25:33
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="8.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<ReceivePaymentAddRq>
<ReceivePaymentAdd>
<CustomerRef>
<FullName>SILMAN DC</FullName>
</CustomerRef>
<TotalAmount>59.21</TotalAmount>
<PaymentMethodRef>
<FullName>Credit Card</FullName>
</PaymentMethodRef>
<DepositToAccountRef>
<FullName>Undeposited Funds</FullName>
</DepositToAccountRef>
<AppliedToTxnAdd>
<TxnID>A13F8-1483561159</TxnID>
<PaymentAmount>59.21</PaymentAmount>
</AppliedToTxnAdd>
</ReceivePaymentAdd>
</ReceivePaymentAddRq>
</QBXMLMsgsRq>
</QBXML>
2017-01-04 14:25:33
<?xml version="1.0"?>
<QBXML>
<QBXMLMsgsRs>
<ReceivePaymentAddRs statusCode="3120" statusSeverity="Error" statusMessage="Object "A13F8-1483561159" specified in the request cannot be found. "/>
</QBXMLMsgsRs>
</QBXML>
OK, one correction: It seems that I am NOT including an ARAccountRef aggregate in my ReceivePaymentAddRq. Probably because the IDN Unified OSR said it was optional. Is this the problem? Remember, it only happens once in a while...
**EDIT:
I added the ARAccountRef aggregate in my ReceivePaymentAddRq. Still getting the error.

Related

xpath filter - how to filter to the latest node record

I have an issue with filtering xpath on specified node to have only the latest record. In the example xml there s a rule that the very first record on each node is the most current information. I would like to filter all records which are not relevant (different than the first record).
The second rule is that i do not want to use date conditions to filter all job_information records after the very first one.
Normally I am using xpath tester with expression such like:
/queryCompoundEmployeeResponse/CompoundEmployee[(person/employment_information/job_information[1])]
which gives me only the first record of job information but here is does not work. Can you show me what is wrong with it?
Can you help me?
xml input with 3 job_information records
<queryCompoundEmployeeResponse>
<CompoundEmployee>
<id>11111</id>
<person>
<employment_information>
<job_information>
<end_date>9999-12-31</end_date>
<start_date>2017-05-17</start_date>
</job_information>
<job_information>
<end_date>2018-12-31</end_date>
<start_date>2017-05-17</start_date>
</job_information>
<job_information>
<end_date>2016-12-31</end_date>
<start_date>2013-05-17</start_date>
</job_information>
</employment_information>
</person>
</CompoundEmployee>
</queryCompoundEmployeeResponse>
xml output I would like to have
<queryCompoundEmployeeResponse>
<CompoundEmployee>
<id>11111</id>
<person>
<employment_information>
<job_information>
<end_date>9999-12-31</end_date>
<start_date>2017-05-17</start_date>
</job_information>
</employment_information>
</person>
</CompoundEmployee>
</queryCompoundEmployeeResponse>
Assuming you have always the same XML structure, you can try :
data=xmlParse("C:/Users/.../pathtoyourxmlfile.xml")
a=xpathSApply(data,"count(//job_information[1]/ancestor::*)+6")
b=xpathSApply(data,"count(//job_information)-1")*4+(a-1)
old=read_lines("C:/Users/.../pathtoyourxmlfile.xml")
new = old[-(a:b)]
writeLines(new,con = "new.xml")
Output (new.xml) :
<queryCompoundEmployeeResponse>
<CompoundEmployee>
<id>11111</id>
<person>
<employment_information>
<job_information>
<end_date>9999-12-31</end_date>
<start_date>2017-05-17</start_date>
</job_information>
</employment_information>
</person>
</CompoundEmployee>
</queryCompoundEmployeeResponse>

How to decode OBD-2 data from Hyundai Ioniq EV

I try to read out OBD-2 data from Hyundai Ioniq Electro (Version 28kWh), using a Raspberry PI and a Bluetooth ELM327 interface. Connection and data transfer works fine.
For example: sending 2105<cr><lf> gives a response (<cr> is value 0x0d = 13):
7F2112<cr>7F2112<cr>7F2112<cr>02D<cr>0:6105FFFFFFFF<cr>7F2112<cr>1:00000000001616<cr>2:161616161621FA<cr>3:26480001501616<cr>4:03E82403E80FC0<cr>5:003A0000000000<cr>6:00000000000000<cr><cr>>
The value C0 in 4:03E82403E80FC0 seems to be the State of charge (SOC) display value:
C0 -> 192 -> 192/2 % = 96%
There are some tables for decoding available (see https://github.com/JejuSoul/OBD-PIDs-for-HKMC-EVs/tree/master/Ioniq%20EV%20-%2028kWh), but how to use these tables?
For example sending 2101<cr><lf> gives the response:
02C<cr>
0:6101FFFFF800<cr>
01E<cr>
0:6101000003FF<cr>
03D<cr>
0:6101FFFFFFFF<cr>
016<cr>
0:6101FFE00000<cr>
1:0002D402CD03F0<cr>
1:0838010A015C2F<cr>
7F2112<cr>
1:B4256026480000<cr>
1:0921921A061B03<cr>
2:000582003401BD<cr>
2:0000000A002702<cr>
2:000F4816161616<cr>
2:00000000276234<cr>
3:04B84100000000<cr>
3:5B04692F180018<cr>
3:01200000000000<cr>
3:1616160016CB3F<cr>
4:00220000600000<cr>
4:00D0FF00000000<cr>
4:CB0100007A0002<cr>
5:000001F3026A02<cr>
5:5D4000025D4600<cr>
6:D2000000000000<cr>
6:00DECA0000D8E6<cr>
7:008A2FEB090002<cr>
8:0000000003E800<cr>
<cr>
>
Please note, that the line feed was added behind every carriage return (<cr>) for better readability and is not part of the original data response.
How can I decode temperature, currents, ... from these data?
I have found the mistake by myself. The ELM327 description (http://elmelectronics.com/DSheets/ELM327DS.pdf) explains the AT commands in detail.
The problem on this issue was the mixing of CAN responses from multiple ECU's caused by the AT H0 command (headers off) in the initialization phase (not described in question). See also EM327DS.pdf page 44 (Multiple Responses).
When using AT H1 on startup, the responses can be decoded without problem.
Initialization (with AT H1 = headers on)
AT D\r\n
AT Z\r\n
AT L0\r\n
AT E0\r\n
AT S0\r\n
AT H1\r\n
AT SP 0\r\n
Afterwards communication with ECU's:
Response on first command 0100\r\n:
SEARCHING...\r7EB06410080000001\r7EC06410080000001\r\r>
Response on second command 2101\r\n:
7EE037F2112\r7ED102C6101FFFFF800\r7EA10166101FFE00000\r7EC103D6101FFFFFFFF\r7EB101E6101000003FF\r7EA2109211024062703\r7EC214626482648A3FF\r7ED2100907D87E15592\r7EB210838011D88B132\r7ED2202A1A7024C0134\r7EA2200000000546900\r7EC22C00D9E1C1B1B1B\r7EB220000000A000802\r7EA2307200000000000\r7ED23050343102000C8\r7EC231B1B1C001BB50F\r7EB233C04B8320000D0\r7EC24B5010000810002\r7ED24047400C8760017\r7EB24FF300000000000\r7ED25001401F387F46A\r7EC256AC100026CB100\r7EC2600E3C50000DE69\r7ED263F001300000000\r7EC27008CC38209015C\r7EC280000000003E800\r\r>
Response on third command 2105\r\n:
7EE037F2112\r7ED037F2112\r7EA037F2112\r7EC102D6105FFFFFFFF\r7EB037F2112\r7EC2100000000001B1C\r7EC221C1B1B1B1B2648\r7EC2326480001641A1B\r7EC2403E80803E80147\r7EC25003A0000000000\r7EC2600000000000000\r\r>
Now every response starts with the id of the ECU. Take attention only to responses starting with 7EC.
Example:
Looking for battery current in amps. In the document Spreadsheet_IoniqEV_BMS_2101_2105.xls you find the battery current on:
response 21 for 2101: last byte = High Byte of battery current
response 22 for 2101: first byte = Low Byte of battery current
So look to the response of 2101\r\n and search for 7EC21 and 7EC22: You will find:
7EC214626482648A3FF: take last byte for battery high value -> FF
7EC22C00D9E1C1B1B1B: take first byte after 7EC22 for battery low value -> C0
The battery current value is: FFC0
This value is two complements encoded:
0xffc0 = 65472 -> 65472 - 65536 = -64 -> -6.4A
Result: the battery is charged with 6.4A
For a coding example see:
https://github.com/greenenergyprojects/obd2-gateway, file src/obd2/obd2.ts

Extract Input parameters from "mxnet" model

I have saved the model using
mx.model.save(model = fit_dl, prefix = "model", iteration = 10)
and loaded later
fit <- mx.model.load(prefix = "model", iteration = 10)
Now, using object fit, I want to extract the input features (column names of train data). How to do that
Posting for sake of all open source community
As per my email exchange with maintner of mxnet packge, Qiang Kou replies following
From: Qiang Kou
To: Shiv Onkar Kumar
Sent: Wednesday, 14 June 2017 10:33 PM
Subject: Re: Extract Input parameters from “mxnet” model
Hi, Shiv,
I don't this is possible since we never store this information in the model.
Best,
Qiang Kou

Upload XML payload into multiple Exact Online companies

Using a query as below, you get output in the XML format required for Exact Online.
These XML messages can be put in many files on disk using:
local export documents in filecontents to "c:\temp\in" filename column filename
And then loaded into Exact Online's current division using:
local eol batch import xml "Accounts" in "c:\temp\in\Accounts" success "c:\temp\success" fail "c:\temp\fail"
This works fine for one division, but not when you load 100 divisions/companies.
How can I directly load data from the SQL into multiple companies/divisions at the same time instead of using an individual local eol batch import xml statement and use DIVISIONCODE statement?
Query sample:
select 'Accounts\010-Accounts.xml'
filename
, stg.fileprefix
|| chr(13)
|| '<Accounts>'
|| xml
|| chr(13)
|| '</Accounts>'
|| stg.filepostfix
filecontents
from ( select listagg
( chr(13)
|| '<Account code="'
|| xmlencode(custsupid)
|| '" status="'
...
You can upload into multiple companies/divisions with one statement using the following syntax as described on UploadXMLTopics:
insert into UploadXMLTopics#eol
( topic
, payload
, division_code
)
select topic
, filecontents
, division_code
from ...
Even when one or more of the uploads fail, the insert will not report an error and process all XML messages.
You can see the results afterwards using:
select *
from UploadXMLTopics
The column SUCCESSFUL indicates whether the payload column was loaded succesfully.
In RESULT column you will find the return message of Exact Online, such as:
<?xml version="1.0" encoding="utf-8"?>
<eExact xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="eExact-XML.xsd">
<Messages>
<Message type="0">
<Topic code="FinYears" node="FinYear" />
<Date>2016-12-09T09:02:36</Date>
<Description>Kan boekjaar niet aanmaken: 2014 vanwege ontbrekende boekjaren. Het laagste boekjaar in Exact Online is 2016.</Description>
</Message>
<Message type="2">
<Topic code="FinYears" node="FinYear">
<Data key="2015" keyAlt="2015" />
</Topic>
<Date>2016-12-09T09:02:37</Date>
<Description>Aangemaakt</Description>
</Message>
</Messages>
</eExact>

how to escape xml space in service?

hi now i m working with XSLT and now i call to a service
as like this
<xsl:for-each select="ext">
<config type="2" liveserver="XXX.com" localserver="XXX.com" httpuri="/myservices/jsonrequesthomenew?companyid=homepage&outputtype=xml" params="" readtimeout="10000"/>
</xsl:for-each>
if i cehck to this live url than show to this result
<?xml version="1.0" encoding="UTF-8"?>
<indexes>
<data>
<sensex>
<CloseIndexValue>25719.58</CloseIndexValue>
<trend>equal</trend>
<premarket>false</premarket>
<DateTime>03:53 PM | 10 Sep 2015</DateTime>
<CurrentIndexValue>25622.17</CurrentIndexValue>
<Segment>BSE</Segment>
<OpenIndexValue>25522.96</OpenIndexValue>
<IndexName>SENSEX</IndexName>
<PercentChange>-0.38</PercentChange>
<NetChange>-97.41</NetChange>
</sensex>
<nifty>
<CloseIndexValue>7818.60</CloseIndexValue>
<trend>equal</trend>
<premarket>false</premarket>
<DateTime>03:53 PM | 10 Sep 2015</DateTime>
<CurrentIndexValue>7788.10</CurrentIndexValue>
<Segment>NSE</Segment>
<OpenIndexValue>7729.05</OpenIndexValue>
<IndexName>CNX NIFTY</IndexName>
<PercentChange>-0.39</PercentChange>
<NetChange>-30.50</NetChange>
</nifty>
<USD>
<DateTime>2015-09-10 15:48:06.0</DateTime>
<netChange>0.05</netChange>
<percentChange>0.08</percentChange>
<name>USD/INR</name>
<bidprice>66.47</bidprice>
</USD>
<silver>
<ClosePrice>35294.00</ClosePrice>
<trend>negative</trend>
<OpenPrice>35391.00</OpenPrice>
<ExpiryDate>2015-12-04</ExpiryDate>
<SpotSymbol>SSILVERAHM</SpotSymbol>
<LastTradedPrice>35475.00</LastTradedPrice>
<DateTime>10-September-2015 15:46:32</DateTime>
<Symbol>SILVER</Symbol>
<PercentChange>0.51</PercentChange>
<CommodityName>Silver</CommodityName>
<NetChange>181.00</NetChange>
<SpotPrice>34912.0</SpotPrice>
<PriceQuotationUnit>1 KGS </PriceQuotationUnit>
</silver>
<marketstatus>
<currentMarketStatus>Live</currentMarketStatus>
</marketstatus>
<gold>
<ClosePrice>26057.00</ClosePrice>
<trend>positive</trend>
<OpenPrice>26143.00</OpenPrice>
<ExpiryDate>2015-10-05</ExpiryDate>
<SpotSymbol>SGOLDAHM</SpotSymbol>
<LastTradedPrice>26067.00</LastTradedPrice>
<DateTime>10-September-2015 15:46:15</DateTime>
<Symbol>GOLD</Symbol>
<PercentChange>0.04</PercentChange>
<CommodityName>Gold</CommodityName>
<NetChange>10.00</NetChange>
<SpotPrice>26003.0</SpotPrice>
<PriceQuotationUnit>10 GRMS </PriceQuotationUnit>
</gold>
<DXY Index>
<DateTime>2015-09-10 15:49:21.0</DateTime>
<netChange>0.1</netChange>
<percentChange>0.1</percentChange>
<name>DXY Index</name>
<bidprice>96.11</bidprice>
</DXY Index>
</data>
</indexes>
but this service is not call to my xslt file why can u please help me .
i check to this xml data validate in thsi url http://www.xmlvalidation.com/index.php?id=1&L=0
than show to this error
Click on to jump to the error. In the document, you can point at with your mouse to see the error message.
Errors in the XML document:
1: 1931 Attribute name "Index" associated with an element type "DXY" must be followed by the ' = ' character.
How to resolve this error in front end .
The error you are getting is because of this element in your XML
<DXY Index>
<DateTime>2015-09-10 15:49:21.0</DateTime>
<netChange>0.1</netChange>
<percentChange>0.1</percentChange>
<name>DXY Index</name>
<bidprice>96.11</bidprice>
</DXY Index>
DXY Index is not a valid element name, as you can't have spaces in element names.
The XML needs to be corrected, so the name is something DXYIndex or DXY-Index, although the name you actually use will depend on what the XML is actually used for.