【发布时间】:2019-09-12 19:19:27
【问题描述】:
我正在 Quickbooks 桌面版上通过 QBFC 运行估算查询,虽然我能够提取在 Quickbooks 的估算屏幕上看到的一些字段,但还有其他字段我无法提取/查找.此外,我提取的某些属性与我期望的值不匹配。
我的代码在这里:
...
IEstimateQuery estimateQuery = msgSetReq.AppendEstimateQueryRq();
estimateQuery.OwnerIDList.Add("0");
estimateQuery.ORTxnQuery.TxnFilter.EntityFilter.OREntityFilter.FullNameList.Add("testcustomer");
estimateQuery.IncludeLineItems.SetValue(true);
IMsgSetResponse msgSetResp = sessionManager.DoRequests(msgSetReq);
IResponse resp = msgSetResp.ResponseList.GetAt(0); //a list of responses for each request - we only sent one request so get the first response
IEstimateRetList estimateList = (IEstimateRetList)resp.Detail;
for(int i=0; i < estimateList.Count; i++) {
IEstimateRet estimate = estimateList.GetAt(i);
Debug.WriteLine("est name: " + estimate.CustomerRef.FullName.GetValue());
Debug.WriteLine("est subtotal: " + estimate.Subtotal.GetValue());
Debug.WriteLine("est total: " + estimate.TotalAmount.GetValue());
if(estimate.DataExtRetList != null) {
for(int j=0; j<estimate.DataExtRetList.Count; j++) {
string fieldName = estimate.DataExtRetList.GetAt(j).DataExtName.GetValue();
string fieldValue = estimate.DataExtRetList.GetAt(j).DataExtValue.GetValue();
Debug.WriteLine("--- " + fieldName + " : " + fieldValue);
}
}
if(estimate.OREstimateLineRetList != null) {
for (int j = 0; j < estimate.OREstimateLineRetList.Count; j++) {
IEstimateLineRet lineRet = estimate.OREstimateLineRetList.GetAt(j).EstimateLineRet;
if(lineRet.Amount != null) {
Debug.WriteLine("total [" + j + "] " + lineRet.Amount.GetValue()); //for some reason amount is estimated par total
if (lineRet.Desc != null) {
Debug.WriteLine("description row [" + j + "] " + lineRet.Desc.GetValue());
}
}
//lineRet.DataExtRetList is null, I've checked
}
}
}
我会得到一个示例输出:
est name: testcustomer
est subtotal: 6996.07
est total: 6996.07
--- Net Income : 6530.24
--- Other : 8036
total [0] 4451.1
description row [0] Test item1
total [1] 1952.5
description row [1] Test item2
...
你会注意到我在上面记录了 lineRet.Amount 的值,但如果你看一下我附上的这张图片,金额实际上是在最右边的列上给了我红色圆圈,而不是绿色圆圈(在“金额”列)。
当我记录小计和总计时,我希望在底部附近同时看到绿色和红色圆圈,但我却两次获得了红色圆圈的值(小计未正确显示)。
最后,我无法获得“成本/单位”列(我相信最初命名为“成本”)。
关于如何访问这些字段的任何想法,或者为什么某些字段似乎提取了错误的值?
提前感谢您的宝贵时间。
【问题讨论】:
标签: c# .net quickbooks qbfc