付款不被创建 [英] Payment not being created

查看:150
本文介绍了付款不被创建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的款项没有显示在QuickBooks的。

My payments are not showing up in QuickBooks.

我可以成功地创建和更新的客户。我也可以成功地创建和更新发票。我无法创建付款。但这里的东西,当我我的支付对象,我得到一个正确的ID和域(NG)传递回上执行更新命令。我已经运行同步后检查同步日志文件(IntuitSyncManagerLogger.log),但它没有错误消息。一切看起来正常,那里只是没有用在QuickBooks发票相关的付款。

I can successfully create and update Customers. I can also successfully create and update Invoices. I cannot create Payments. But here's the thing, when I execute the Update command on my Payment object I do get a proper Id and Domain (NG) passed back. I've checked the Sync log file (IntuitSyncManagerLogger.log) after running a Sync but it has no error messages. Everything looks ok, there just is no payment associated with the invoice in QuickBooks.

我相信我设置所有必填字段,但我不知道他们两个。

I believe I'm setting all of the required fields but I'm not sure about two of them.

1)PaymentLine有一个名为TxnId字段。我设置它是InvoiceHeader的id和站点,但我不知道这是否是正确的。

1) The PaymentLine has a field named TxnId. I'm setting it to be the Id and Domain of the InvoiceHeader, but am not sure if this is correct.

2)有(每个文件)的另一个必填字段,但我保留为空,因为我不知道该怎么填充它。这是DiscountAccountId领域。我不想与发票相关的折扣。

2) There is another required field (per the documentation) but I'm leaving it blank as I don't know what to populate it with. It's the DiscountAccountId field. I don't want a discount associated with the invoice.

下面是我的code ...

Here is my code...

SqlConnection connection = new SqlConnection(m_connectionString);
connection.Open();

SqlCommand cmd = new SqlCommand("dbo.Intuit_GetPayment", connection);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@glmvSyncId", SqlDbType.Int).Value = glmvSyncId;

SqlDataReader rdr = cmd.ExecuteReader();
rdr.Read();

Intuit.Ipp.Data.Qbd.PaymentHeader paymentHeader = new Intuit.Ipp.Data.Qbd.PaymentHeader();
paymentHeader.ARAccountId = new Intuit.Ipp.Data.Qbd.IdType() {
    idDomain = Intuit.Ipp.Data.Qbd.idDomainEnum.QB,
    Value = "37"
};
paymentHeader.ARAccountName = "Accounts Receivable";
paymentHeader.DepositToAccountId = new Intuit.Ipp.Data.Qbd.IdType() {
    idDomain = Intuit.Ipp.Data.Qbd.idDomainEnum.QB,
    Value = "35"
};
paymentHeader.DepositToAccountName = "Undeposited Funds";
paymentHeader.CustomerId = new Intuit.Ipp.Data.Qbd.IdType() {
    idDomain = (rdr["cust_iddomain"].ToString() == "QB" ? Intuit.Ipp.Data.Qbd.idDomainEnum.QB : Intuit.Ipp.Data.Qbd.idDomainEnum.NG),
    Value = rdr["cust_idvalue"].ToString()
}; // cust_iddomain and cust_idvalue are from the Customer
paymentHeader.DocNumber = rdr["invoicekey"].ToString();
paymentHeader.TxnDate = DateTime.Now; 

List<Intuit.Ipp.Data.Qbd.PaymentLine> listLine = new List<Intuit.Ipp.Data.Qbd.PaymentLine>();

var paymentLine = new Intuit.Ipp.Data.Qbd.PaymentLine();
paymentLine.Amount = Convert.ToDecimal(rdr["amount"]);
paymentLine.TxnId = new Intuit.Ipp.Data.Qbd.IdType() {
    idDomain = (rdr["invc_iddomain"].ToString() == "QB" ? Intuit.Ipp.Data.Qbd.idDomainEnum.QB : Intuit.Ipp.Data.Qbd.idDomainEnum.NG),
    Value = rdr["invc_idvalue"].ToString()
}; // invc_iddomain and invc_idvalue are from the InvoiceHeader

listLine.Add(paymentLine);

Intuit.Ipp.Data.Qbd.Payment syncPayment = new Intuit.Ipp.Data.Qbd.Payment();
syncPayment.Header = paymentHeader;
syncPayment.Line = listLine.ToArray();

connection.Close();

Intuit.Ipp.Data.Qbd.Payment resultPayment = new Intuit.Ipp.Data.Qbd.Payment();

resultPayment = commonService.Add(syncPayment);

我怀疑问题是TxnId。

I suspect the problem is with TxnId.

我做的是创造一个客户,然后为客户创造发票,然后创建发票付款。我缺少一个对象某处?

All I'm doing is creating a Customer, then creating an Invoice for the Customer, then creating a Payment for the Invoice. Am I missing a object someplace?

任何及所有帮助是极大的AP preciated。

Any and all help is greatly appreciated.

推荐答案

添加code以下行似乎已经解决了这一问题。现在的支付被记录在QuickBooks。

Adding the following lines of code seems to have fixed the problem. The Payment is now being recorded in QuickBooks.

paymentHeader.TotalAmt = Convert.ToDecimal(rdr["amount"]);
paymentHeader.TotalAmtSpecified = true;

这篇关于付款不被创建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆