如何获取日期框架中已更改的所有发票的列表。我正在编写一个程序,要求出去修改发票,但不能这样做,所以我必须仔细阅读它们。
我正在使用IPP .Net
这是我到目前为止所做的事情:
DataService dataService = new DataService(serviceContext);
QueryService<Invoice> invoiceQueryService = new QueryService<Invoice>(serviceContext);
IEnumerable<Invoice> InvoiceList = invoiceQueryService.OrderBy(c => c.Id);
我想做的是添加类似的内容。(c =&gt; c.MetaData.LastChangedDB&gt;&#39; 1/1/2014&#39;)
但是当我尝试时,我得到表达式无效的异常。
任何帮助都将不胜感激。
TIA - 杰夫。
答案 0 :(得分:2)
您应该使用Change Data Capture
功能:
这些API专门针对您遇到的情况 - 提取在给定日期范围内更改的数据。
您需要点击的API端点看起来像这样:
https://quickbooks.api.intuit.com/v3/company/1234/cdc?entities=Invoice&changedSince=2012-07-20T22:25:51-07:00
请注意,您可以指定实体(或实体 - 逗号分隔列表)以获取已更改的记录和时间戳。
答案 1 :(得分:1)
以下是C#中用于CDC操作的代码:
List<Intuit.Ipp.Data.IEntity> entityList = new List<Intuit.Ipp.Data.IEntity>();
entityList.Add(new Intuit.Ipp.Data.Invoice());
var DataService = new DataService(context);
var CDCResponse = DataService.CDC(entityList, DateTime.Now.AddDays(-1)).entities;
或尝试以下查询:
QueryService<Invoice> QueryService = new QueryService<Invoice>(context);
List<Invoice> accs = QueryService.ExecuteIdsQuery("Select * FROM Account WHERE MetaData.LastUpdatedTime >= '2000-01-01T00:00:00'").ToList();
List<Invoice> accs1 = QueryService.Where(c =>c.MetaData.LastUpdatedTime <= new DateTime(2012, 06, 30, 11, 20, 50)).ToList();