我在进行检查时收到此错误:
您必须为每个拆分行选择一个产品/服务或一个帐户,其中包含金额或可计费的 $$customer$$。
这是我的代码:
public void BuildCheckAddRq(Order order)
{
if (_qboSettings.MerchantPercent > 0 || _qboSettings.MerchantFee > 0)
{
Check newCheck = new Check(); // TODO: Initialize to an appropriate value
var total = (order.OrderTotal * _qboSettings.MerchantPercent) + _qboSettings.MerchantFee;
newCheck.Header = new CheckHeader();
newCheck.Header.TotalAmt = total;
newCheck.Header.TotalAmtSpecified = true;
newCheck.Header.TxnDate = System.DateTime.Now;
newCheck.Header.Note = "Merchant Account Fees";
newCheck.Header.BankAccountName = _qboSettings.DefaultAccount;
newCheck.Header.DocNumber = order.Id.ToString();
newCheck.Header.BankAccountId = new IdType { idDomain = idDomainEnum.QBO, Value = GetAccountId(_qboSettings.DefaultAccount) };
newCheck.Header.EntityName = _qboSettings.MerchantVendorAcct;
newCheck.Header.EntityType = EntityTypeEnum.Vendor;
//newCheck.Header.PayeeAddr = headerEntity.Address[0];
newCheck.Header.ToBePrinted = _qboSettings.ToBePrinted;
//ItemService ItemServ = new ItemService();
//List<Item> findItems = ItemServ.FindAll(Initializer.sessionContext, Initializer.realmId);
CheckLine checkedLine = new CheckLine();
checkedLine.Amount = total;
checkedLine.AmountSpecified = true;
checkedLine.Desc = "Merchant Account Fees";
decimal qty = 1;
checkedLine.ItemsElementName = new ItemsChoiceType1[] { ItemsChoiceType1.ItemId, ItemsChoiceType1.Qty};
checkedLine.Items = new object[] { new IdType() { idDomain = idDomainEnum.QBO, Value = GetAccountId("Merchant Account Fees")}, qty };
newCheck.Line = new CheckLine[] { checkedLine };
try
{
Check actualCheck = dataServices.Add<Check>(newCheck);
ErrorMessageDataSource.Insert(new ErrorMessage(MessageSeverity.Info, "QBO", "Check # " + actualCheck.Header.DocNumber + " synced successfully!"));
}
catch (Exception ex)
{
ErrorMessageDataSource.Insert(new ErrorMessage(MessageSeverity.Error, "QBO", ex.ToString()));
}
}
}