通过Qbxml中的QuickBooks通过BillQuery提取账单?

时间:2018-06-27 07:40:10

标签: asp.net-mvc quickbooks

我正在使用 QuickBooks Desktop 18.0 ,我有一项任务是在两个日期之间从QuickBooks中获取账单

我正在使用QuickBooks Web Connector,并希望在我的MVC应用程序中提取帐单。

我正在使用Web服务通过Web连接器将应用程序连接到QuickBooks。

下面是我的帐单查询请求,我正在通过Web连接器将其发送到QuickBooks:

<?xml version="1.0"?>
<?qbxml version="10.0"?>
<QBXML>
    <QBXMLMsgsRq onError="stopOnError">
        <BillQueryRq>
            <TxnDateRangeFilter>
                <FromTxnDate>2018-05-01</FromTxnDate>
                <ToTxnDate>2018-05-31</ToTxnDate>
            </TxnDateRangeFilter>
        </BillQueryRq>
    </QBXMLMsgsRq>
</QBXML>

下面是我从QuickBooks得到的答复:

<?xml version="1.0" ?>
<QBXML>
    <QBXMLMsgsRs>
        <BillQueryRs statusCode="0" statusSeverity="Info" statusMessage="Status OK">
            <BillRet>
                <TxnID>4-1495099285</TxnID>
                <TimeCreated>2018-05-18T14:51:25+05:30</TimeCreated>
                <TimeModified>2018-05-20T21:39:51+05:30</TimeModified>
                <EditSequence>1495536273</EditSequence>
                <TxnNumber>2</TxnNumber>
                <VendorRef>
                    <ListID>80000001-1495099067</ListID>
                    <FullName>CSC</FullName>
                </VendorRef>
                <APAccountRef>
                    <ListID>80000041-1495048433</ListID>
                    <FullName>Purchase ledger control</FullName>
                </APAccountRef>
                <TxnDate>2018-05-18</TxnDate>
                <DueDate>2018-05-30</DueDate>
                <AmountDue>267.00</AmountDue>
                <RefNumber>81105354629</RefNumber>
                <IsPaid>true</IsPaid>
                <OpenAmount>800.00</OpenAmount>
            </BillRet>
        </BillQueryRs>
    </QBXMLMsgsRs>
</QBXML>

但这不是我想要的QuickBooks的全部数据。

我想从QuickBooks中获得两个节点<ExpenseLineRet><ItemLineRet>及其子节点,以其示例响应XML给出:

<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
    <QBXMLMsgsRq onError="stopOnError">
        <BillQueryRs statusCode="INTTYPE" statusSeverity="STRTYPE" statusMessage="STRTYPE" retCount="INTTYPE" iteratorRemainingCount="INTTYPE" iteratorID="UUIDTYPE">
            <BillRet> <!-- optional, may repeat -->
                <TxnID >IDTYPE</TxnID> <!-- required -->
                <TimeCreated >DATETIMETYPE</TimeCreated> <!-- required -->
                <TimeModified >DATETIMETYPE</TimeModified> <!-- required -->
                <EditSequence >STRTYPE</EditSequence> <!-- required -->
                <TxnNumber >INTTYPE</TxnNumber> <!-- optional -->
                <VendorRef> <!-- required -->
                    <ListID >IDTYPE</ListID> <!-- optional -->
                    <FullName >STRTYPE</FullName> <!-- optional -->
                </VendorRef>
                <VendorAddress> <!-- optional -->
                    <Addr1 >STRTYPE</Addr1> <!-- optional -->
                    <Addr2 >STRTYPE</Addr2> <!-- optional -->
                    <Addr3 >STRTYPE</Addr3> <!-- optional -->
                    <Addr4 >STRTYPE</Addr4> <!-- optional -->
                    <Addr5 >STRTYPE</Addr5> <!-- optional -->
                    <City >STRTYPE</City> <!-- optional -->
                    <State >STRTYPE</State> <!-- optional -->
                    <PostalCode >STRTYPE</PostalCode> <!-- optional -->
                    <Country >STRTYPE</Country> <!-- optional -->
                    <Note >STRTYPE</Note> <!-- optional -->
                </VendorAddress>
                <APAccountRef> <!-- optional -->
                    <ListID >IDTYPE</ListID> <!-- optional -->
                    <FullName >STRTYPE</FullName> <!-- optional -->
                </APAccountRef>
                <TxnDate >DATETYPE</TxnDate> <!-- required -->
                <DueDate >DATETYPE</DueDate> <!-- optional -->
                <AmountDue >AMTTYPE</AmountDue> <!-- required -->
                <CurrencyRef> <!-- optional -->
                    <ListID >IDTYPE</ListID> <!-- optional -->
                    <FullName >STRTYPE</FullName> <!-- optional -->
                </CurrencyRef>
                <ExchangeRate >FLOATTYPE</ExchangeRate> <!-- optional -->
                <AmountDueInHomeCurrency >AMTTYPE</AmountDueInHomeCurrency> <!-- optional -->
                <RefNumber >STRTYPE</RefNumber> <!-- optional -->
                <TermsRef> <!-- optional -->
                    <ListID >IDTYPE</ListID> <!-- optional -->
                    <FullName >STRTYPE</FullName> <!-- optional -->
                </TermsRef>
                <Memo >STRTYPE</Memo> <!-- optional -->
                <IsPaid >BOOLTYPE</IsPaid> <!-- optional -->
                <ExternalGUID >GUIDTYPE</ExternalGUID> <!-- optional -->
                <LinkedTxn> <!-- optional, may repeat -->
                    <TxnID >IDTYPE</TxnID> <!-- required -->
                    <!-- TxnType may have one of the following values: ARRefundCreditCard, Bill, BillPaymentCheck, BillPaymentCreditCard, BuildAssembly, Charge, Check, CreditCardCharge, CreditCardCredit, CreditMemo, Deposit, Estimate, InventoryAdjustment, Invoice, ItemReceipt, JournalEntry, LiabilityAdjustment, Paycheck, PayrollLiabilityCheck, PurchaseOrder, ReceivePayment, SalesOrder, SalesReceipt, SalesTaxPaymentCheck, Transfer, VendorCredit, YTDAdjustment -->
                    <TxnType >ENUMTYPE</TxnType> <!-- required -->
                    <TxnDate >DATETYPE</TxnDate> <!-- required -->
                    <RefNumber >STRTYPE</RefNumber> <!-- optional -->
                    <!-- LinkType may have one of the following values: AMTTYPE, QUANTYPE -->
                    <LinkType >ENUMTYPE</LinkType> <!-- optional -->
                    <Amount >AMTTYPE</Amount> <!-- required -->
                </LinkedTxn>
                <ExpenseLineRet> <!-- optional, may repeat -->
                    <TxnLineID >IDTYPE</TxnLineID> <!-- required -->
                    <AccountRef> <!-- optional -->
                        <ListID >IDTYPE</ListID> <!-- optional -->
                        <FullName >STRTYPE</FullName> <!-- optional -->
                    </AccountRef>
                    <Amount >AMTTYPE</Amount> <!-- optional -->
                    <Memo >STRTYPE</Memo> <!-- optional -->
                    <CustomerRef> <!-- optional -->
                        <ListID >IDTYPE</ListID> <!-- optional -->
                        <FullName >STRTYPE</FullName> <!-- optional -->
                    </CustomerRef>
                    <ClassRef> <!-- optional -->
                        <ListID >IDTYPE</ListID> <!-- optional -->
                        <FullName >STRTYPE</FullName> <!-- optional -->
                    </ClassRef>
                    <!-- BillableStatus may have one of the following values: Billable, NotBillable, HasBeenBilled -->
                    <BillableStatus >ENUMTYPE</BillableStatus> <!-- optional -->
                    <SalesRepRef> <!-- optional -->
                        <ListID >IDTYPE</ListID> <!-- optional -->
                        <FullName >STRTYPE</FullName> <!-- optional -->
                    </SalesRepRef>
                    <DataExtRet> <!-- optional, may repeat -->
                        <OwnerID >GUIDTYPE</OwnerID> <!-- optional -->
                        <DataExtName >STRTYPE</DataExtName> <!-- required -->
                        <!-- DataExtType may have one of the following values: AMTTYPE, DATETIMETYPE, INTTYPE, PERCENTTYPE, PRICETYPE, QUANTYPE, STR1024TYPE, STR255TYPE -->
                        <DataExtType >ENUMTYPE</DataExtType> <!-- required -->
                        <DataExtValue >STRTYPE</DataExtValue> <!-- required -->
                    </DataExtRet>
                </ExpenseLineRet>
                <ItemLineRet> <!-- optional -->
                    <TxnLineID >IDTYPE</TxnLineID> <!-- required -->
                    <ItemRef> <!-- optional -->
                        <ListID >IDTYPE</ListID> <!-- optional -->
                        <FullName >STRTYPE</FullName> <!-- optional -->
                    </ItemRef>
                    <InventorySiteRef> <!-- optional -->
                        <ListID >IDTYPE</ListID> <!-- optional -->
                        <FullName >STRTYPE</FullName> <!-- optional -->
                    </InventorySiteRef>
                    <InventorySiteLocationRef> <!-- optional -->
                        <ListID >IDTYPE</ListID> <!-- optional -->
                        <FullName >STRTYPE</FullName> <!-- optional -->
                    </InventorySiteLocationRef>
                    <!-- BEGIN OR -->
                    <SerialNumber >STRTYPE</SerialNumber> <!-- optional -->
                    <!-- OR -->
                    <LotNumber >STRTYPE</LotNumber> <!-- optional -->
                    <!-- END OR -->
                    <Desc >STRTYPE</Desc> <!-- optional -->
                    <Quantity >QUANTYPE</Quantity> <!-- optional -->
                    <UnitOfMeasure >STRTYPE</UnitOfMeasure> <!-- optional -->
                    <OverrideUOMSetRef> <!-- optional -->
                        <ListID >IDTYPE</ListID> <!-- optional -->
                        <FullName >STRTYPE</FullName> <!-- optional -->
                    </OverrideUOMSetRef>
                    <Cost >PRICETYPE</Cost> <!-- optional -->
                    <Amount >AMTTYPE</Amount> <!-- optional -->
                    <CustomerRef> <!-- optional -->
                        <ListID >IDTYPE</ListID> <!-- optional -->
                        <FullName >STRTYPE</FullName> <!-- optional -->
                    </CustomerRef>
                    <ClassRef> <!-- optional -->
                        <ListID >IDTYPE</ListID> <!-- optional -->
                        <FullName >STRTYPE</FullName> <!-- optional -->
                    </ClassRef>
                    <!-- BillableStatus may have one of the following values: Billable, NotBillable, HasBeenBilled -->
                    <BillableStatus >ENUMTYPE</BillableStatus> <!-- optional -->
                    <SalesRepRef> <!-- optional -->
                        <ListID >IDTYPE</ListID> <!-- optional -->
                        <FullName >STRTYPE</FullName> <!-- optional -->
                    </SalesRepRef>
                    <DataExtRet> <!-- optional, may repeat -->
                        <OwnerID >GUIDTYPE</OwnerID> <!-- optional -->
                        <DataExtName >STRTYPE</DataExtName> <!-- required -->
                        <!-- DataExtType may have one of the following values: AMTTYPE, DATETIMETYPE, INTTYPE, PERCENTTYPE, PRICETYPE, QUANTYPE, STR1024TYPE, STR255TYPE -->
                        <DataExtType >ENUMTYPE</DataExtType> <!-- required -->
                        <DataExtValue >STRTYPE</DataExtValue> <!-- required -->
                    </DataExtRet>
                </ItemLineRet>
                <OpenAmount >AMTTYPE</OpenAmount> <!-- optional -->
                <DataExtRet> <!-- optional, may repeat -->
                    <OwnerID >GUIDTYPE</OwnerID> <!-- optional -->
                    <DataExtName >STRTYPE</DataExtName> <!-- required -->
                    <!-- DataExtType may have one of the following values: AMTTYPE, DATETIMETYPE, INTTYPE, PERCENTTYPE, PRICETYPE, QUANTYPE, STR1024TYPE, STR255TYPE -->
                    <DataExtType >ENUMTYPE</DataExtType> <!-- required -->
                    <DataExtValue >STRTYPE</DataExtValue> <!-- required -->
                </DataExtRet>
            </BillRet>
        </BillQueryRs>
    </QBXMLMsgsRq>
</QBXML>

我查询错误的请求吗?还是我需要传递更多参数?

先谢谢了。 :)

1 个答案:

答案 0 :(得分:2)

您需要将IncludeLineItems添加到查询中:

<?xml version="1.0"?>
<?qbxml version="10.0"?>
<QBXML>
    <QBXMLMsgsRq onError="stopOnError">
        <BillQueryRq>
            <TxnDateRangeFilter>
                <FromTxnDate>2018-05-01</FromTxnDate>
                <ToTxnDate>2018-05-31</ToTxnDate>
            </TxnDateRangeFilter>
         <IncludeLineItems>1</IncludeLineItems>
        </BillQueryRq>
    </QBXMLMsgsRq>
</QBXML>