/// <summary> /// Create a new CreditMemo object. /// </summary> /// <param name="id">Initial value of the ID property.</param> public static CreditMemo CreateCreditMemo(global::System.String id) { CreditMemo creditMemo = new CreditMemo(); creditMemo.ID = id; return creditMemo; }
public void ImportToQuickbooks(Gen4Transaction Gen4ImportTransaction) { var gen4Customer = (from c in Gen4Customers where c.CustomerID == Gen4ImportTransaction.CustomerID select c).Single(); var quickBookItem = (from i in QuickbookItems where i.Name == gen4Customer.QuickbookPaymentPlan select i).Single(); IdaQuickbookEntities ctxQuickbooks = new IdaQuickbookEntities(); if (Gen4ImportTransaction.TransactionType == "Invoice") { InvoiceLineItem myItem = new InvoiceLineItem(); myItem.CustomerId = gen4Customer.QuickbookCustomerID; myItem.ItemId = quickBookItem.ID; myItem.ItemQuantity = 1; myItem.Memo = "TrxID: {" + Gen4ImportTransaction.TransactionID + "}, Type: {" + Gen4ImportTransaction.LeadType + "}, Source: {" + Gen4ImportTransaction.Source + "}"; ctxQuickbooks.InvoiceLineItems.AddObject(myItem); ctxQuickbooks.SaveChanges(); } else if (Gen4ImportTransaction.TransactionType == "Credit") { var quickbooksCustomer = (from q in QuickbooksCustomers where q.ID == gen4Customer.QuickbookCustomerID select q).Single(); CreditMemo creditItem = new CreditMemo(); creditItem.CustomerName = quickbooksCustomer.Name; creditItem.CustomerId = gen4Customer.QuickbookCustomerID; creditItem.ItemAggregate = "<CreditMemoLineItems><Row><ItemQuantity>1</ItemQuantity><ItemName>" + quickBookItem.FullName + "</ItemName></Row></CreditMemoLineItems>"; creditItem.Memo = "TrxID: {" + Gen4ImportTransaction.TransactionID + "}, Type: {" + Gen4ImportTransaction.LeadType + "}, Source: {" + Gen4ImportTransaction.Source + "}, ParentTrxID: {" + Gen4ImportTransaction.ParentTransactionID + "}"; ctxQuickbooks.CreditMemos.AddObject(creditItem); ctxQuickbooks.SaveChanges(); } Gen4LiveEntities gen4Ctx = new Gen4LiveEntities(); var gen4Transaction = (from t in gen4Ctx.Gen4PplLedger where t.TransactionID == Gen4ImportTransaction.TransactionID select t).Single(); gen4Transaction.IsReported = true; gen4Transaction.ReportStatus = "Imported to QB on " + DateTime.Now.ToString(); gen4Transaction.LastModified = DateTime.Now; gen4Ctx.SaveChanges(); }
/// <summary> /// Deprecated Method for adding a new object to the CreditMemos EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToCreditMemos(CreditMemo creditMemo) { base.AddObject("CreditMemos", creditMemo); }