如何在quickbooks中将库存添加到同一销售收据中

时间:2013-06-06 08:09:37

标签: c# quickbooks intuit-partner-platform

我正在尝试将多个广告资源添加到quickbooks中的销售收据中。

到目前为止,如果我有4个项目,它会创建4个不同的销售收据。

但是,我想制作包含4个不同商品的1张销售收据。

这是我到目前为止所做的,但我似乎无法找到合适的代码。

        public void SalesInfoAdd(IMsgSetRequest requestMsgSet)
    {
        ISalesReceiptAdd salesReceiptAddRq = requestMsgSet.AppendSalesReceiptAddRq();
        ISalesReceiptLineAdd salesReceiptAddNew = salesReceiptAddRq.ORSalesReceiptLineAddList.Append().SalesReceiptLineAdd;

        salesReceiptAddRq.CustomerRef.FullName.SetValue(Form.name.Text);
        salesReceiptAddRq.IsPending.SetValue(true);
        salesReceiptAddRq.IsTaxIncluded.SetValue(false);

        for (int i = 0; i < Form.productID.Count; i++)
        {
            salesReceiptAddNew.ItemRef.FullName.SetValue(Form.productID[i].ToString());
            salesReceiptAddNew.ORRatePriceLevel.Rate.SetValue(Convert.ToDouble(Form.pricesList.Items[i]));
            salesReceiptAddNew.Quantity.SetValue(Form.QBqt[i]);
            salesReceiptAddNew.Desc.SetValue(Form.productsList.Items[i].ToString());

            //groupSalesReceipt.ItemGroupRef.FullName
            IMsgSetResponse responseMsgSet = sessionManager.DoRequests(requestMsgSet);
        }
    }

对于遇到同样问题的人来说,这是我的解决方案(下方),效果很好。

由于

        public List<ISalesReceiptLineAdd> salesReceiptAddNew;

    public void SalesInfoAdd(IMsgSetRequest requestMsgSet)
    {

        ISalesReceiptAdd salesReceiptAddRq = requestMsgSet.AppendSalesReceiptAddRq();
        salesReceiptAddNew = new List<ISalesReceiptLineAdd>();

        salesReceiptAddRq.CustomerRef.FullName.SetValue(Form.name.Text);
        salesReceiptAddRq.IsPending.SetValue(true);
        salesReceiptAddRq.IsTaxIncluded.SetValue(false);

        for (int i = 0; i < Form.productID.Count; i++)
        {
            salesReceiptAddNew.Add(salesReceiptAddRq.ORSalesReceiptLineAddList.Append().SalesReceiptLineAdd);

            salesReceiptAddNew[i].ItemRef.FullName.SetValue(Form.productID[i].ToString());
            salesReceiptAddNew[i].ORRatePriceLevel.Rate.SetValue(Convert.ToDouble(Form.pricesList.Items[i]));
            salesReceiptAddNew[i].Quantity.SetValue(Form.QBqt[i]);
            salesReceiptAddNew[i].Desc.SetValue(Form.productsList.Items[i].ToString() +
                                            Form.QBsku[i].ToString());
        }
        IMsgSetResponse responseMsgSet = sessionManager.DoRequests(requestMsgSet);

    }

1 个答案:

答案 0 :(得分:0)

可以在一个销售收据下创建多个行。 您可以使用apiexplorer工具来测试此用例。 链接 - https://developer.intuit.com/apiexplorer?apiname=V2QBD Doc Link - https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/v2/0500_quickbooks_windows/0600_object_reference/salesreceipt

我创建了以下包含2个订单项的SalesReceipt。 PFB xml。

<?xml version="1.0" encoding="utf-8"?>
<Add xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" RequestId="b9bf137554a843cf8bd34865812daff6" xmlns="http://www.intuit.com/sb/cdm/v2">
   <ExternalRealmId>179017358</ExternalRealmId>
   <Object xsi:type="SalesReceipt">
    <Header>
     <DocNumber>9900</DocNumber>
     <TxnDate>2010-09-02</TxnDate>
     <Currency>USD</Currency>
     <CustomerId>537923</CustomerId>
     <ShipDate>2011-03-02</ShipDate>
     <TotalAmt>2500</TotalAmt>
     <DiscountAmt>0</DiscountAmt>
    </Header>
    <Line>
     <Desc>7th Item</Desc>
     <ItemId>434443</ItemId>
     <UnitPrice>67890</UnitPrice>
     <Qty>1</Qty>
    </Line>
    <Line>
     <Desc>8th Item</Desc>
     <ItemId>434443</ItemId>
     <UnitPrice>12345</UnitPrice>
     <Qty>2</Qty>
    </Line>
   </Object>
</Add>

在QBD中查看

enter image description here

如果它适合您,请告诉我。

由于