Quickbooks WebConnector How I can add invoice with

2019-09-19 17:08发布

问题:

I am trying to Create Invoice in QuickBooks desktop with lineitem site/location. Is there a way we can send location of an item with lineitems along with Invoice.

I tried some code but didn't work Web Connector report error 0x80040400: QuickBooks found an error when parsing the provided XML text stream.

I tried below all 4

<Site>location name</Site>

<Site>
    <FullName>location name</FullName>
</Site>

<Location>location name</Location>

<Location>
    <FullName>location name</FullName>
</Location>

but no success it gives parsing error, Please can you help?

<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="7.0"?>
<QBXML>
    <QBXMLMsgsRq onError="continueOnError">
    <InvoiceAddRq requestID="' . $requestID . '">
        <InvoiceAdd>
        <CustomerRef>
            <ListID>' . $invoice['customer_id'] . '</ListID>
        </CustomerRef>
        <RefNumber>' . $invoice['ref_number'] . '</RefNumber>
        <BillAddress>
            <Addr1>' . $invoice['bill_addr1'] . '</Addr1>
            <Addr2>' . $invoice['bill_addr2'] . '</Addr2>
            <Addr3>' . $invoice['bill_addr3'] . '</Addr3>
            <Addr4>' . $invoice['bill_city'] . '</Addr4>
            <State>' . $invoice['bill_state'] . '</State>
            <PostalCode>' . $invoice['bill_postalcode'] . '</PostalCode>
        </BillAddress>
        <ShipAddress>
            <Addr1>' . $invoice['ship_addr1'] . '</Addr1>
            <Addr2>' . $invoice['ship_addr2'] . '</Addr2>
            <Addr3>' . $invoice['ship_addr3'] . '</Addr3>
            <Addr4>' . $invoice['ship_city'] . '</Addr4>
            <State>' . $invoice['ship_state'] . '</State>
            <PostalCode>' . $invoice['ship_postalcode'] . '</PostalCode>
        </ShipAddress>
        <PONumber>' . $invoice['po_number'] . '</PONumber>
        <DueDate>' . $invoice['due_date'] . '</DueDate>
        <ShipDate>' . $invoice['ship_date'] . '</ShipDate>
        <Memo>' . $invoice['memo'] . '</Memo>
        <InvoiceLineAdd>
            <ItemRef>
            <FullName>'.$line['item_name'].'</FullName>
            </ItemRef>
            <Quantity>'.$line['quantity'].'</Quantity>
            <Rate>'.$line['rate'].'</Rate>
                        <Amount>'.$line['amount'].'</Amount>
                        <Location>Floresville</Location>
            </InvoiceLineAdd>
    </InvoiceAdd>
</InvoiceAddRq>
</QBXMLMsgsRq>

`

I just need to know how we can add a location/stock for an item in Invoice lineitems

回答1:

Whenever you have syntax questions about QuickBooks desktop for Windows, you should refer to the QuickBooks OSR:

  • https://developer-static.intuit.com/qbsdk-current/common/newosr/index.html

Choose InvoiceAdd from the Select Message dropdown, and you'll see documentation about all of the XML tags.

What you're looking for is this:

<InvoiceLineAdd>
    <ItemRef>
        <FullName>'.$line['item_name'].'</FullName>
    </ItemRef>
    <Quantity>'.$line['quantity'].'</Quantity>
    <Rate>'.$line['rate'].'</Rate>
    <Amount>'.$line['amount'].'</Amount>

    <InventorySiteRef>
        <ListID >IDTYPE</ListID>
        <FullName >STRTYPE</FullName>
    </InventorySiteRef>
    <InventorySiteLocationRef>
        <ListID >IDTYPE</ListID>
        <FullName >STRTYPE</FullName>
    </InventorySiteLocationRef>

</InvoiceLineAdd>

You should specify EITHER a ListID or a FullName for each of those two nodes.

Also, you should do a search on StackOverflow for this message:

  • 0x80040400: QuickBooks found an error when parsing the provided XML text stream.

If you do, you get some helpful results like the one linked below, which tell you how to troubleshoot things like that. For example:

  • 0x80040400: QuickBooks found an error when parsing the provided XML text stream