/// <summary> /// Initializes a new instance of the <see cref="CancelInvoiceResponse"/> class. /// </summary> /// <param name="invoice">invoice.</param> /// <param name="errors">errors.</param> public CancelInvoiceResponse( Models.Invoice invoice = null, IList <Models.Error> errors = null) { this.Invoice = invoice; this.Errors = errors; }
/// <summary> /// Initializes a new instance of the <see cref="CreateInvoiceRequest"/> class. /// </summary> /// <param name="invoice">invoice.</param> /// <param name="idempotencyKey">idempotency_key.</param> public CreateInvoiceRequest( Models.Invoice invoice, string idempotencyKey = null) { this.Invoice = invoice; this.IdempotencyKey = idempotencyKey; }
public ActionResult Invoice(int id) // transaction id { Models.Invoice objI = new Models.Invoice(); Transaction objT = new Transaction(id); Customer objC; Business objB; TransactionDetails objTDs; Payments objPs; Refunds objRs; if (objT.TransactionsExists) { objC = new Customer(objT.CustomerID); objB = new Business(objT.BusinessID); objTDs = new TransactionDetails(id); objPs = new Payments(id); objRs = new Refunds(id); objI.Customer = objC; objI.Business = objB; objI.TransactionDetails = objTDs; objI.Transaction = objT; objI.Payments = objPs; objI.Refunds = objRs; //var t = new Tuple<AHDDManagerClass.Customer, AHDDManagerClass.Business, AHDDManagerClass.TransactionDetails, AHDDManagerClass.Transaction, AHDDManagerClass.Payments>(objC, objB, objTDs, objT, objPs); return(View(objI)); } else { return(View()); } }
public DocVenda Get(string id) { try { Models.Invoice invoice = (from i in db.Invoice where i.InvoiceNo == id select i).AsQueryable().First(); List <Models.Line> lines = (from i in db.Invoice join l in db.Line on i.InvoiceNo equals l.InvoiceNo where i.InvoiceNo == invoice.InvoiceNo select l).ToList(); Models.DocumentTotals doc = (from d in db.DocumentTotals where d.InvoiceNo == invoice.InvoiceNo select d).AsQueryable().First(); return(new DocVenda(invoice, lines, doc)); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e); return(null); } }
public ActionResult MailContent(long obId) { CLayer.Invoice data = BLayer.Invoice.GetInvoiceByOfflineBooking(obId); if (data == null) { data = new CLayer.Invoice(); data.OfflineBookingId = obId; data.InvoiceDate = DateTime.Today; data.DueDate = DateTime.Today.AddDays(10); data.InvoiceType = (int)CLayer.ObjectStatus.InvoiceType.Invoice; BLayer.Invoice.Save(data); //data = BLayer.Invoice.GetInvoiceByOfflineBooking(offId); //data = await MessageFromHtml(offId); } Models.Invoice inv = new Models.Invoice(); inv.InvoiceId = data.InvoiceId; inv.InvoiceNumber = data.InvoiceNumber; inv.OfflineBookingId = data.OfflineBookingId; inv.IsMailed = (data.MailedDate <= DateTime.Today); inv.HtmlSection1 = data.HtmlSection1; inv.HtmlSection2 = data.HtmlSection2; inv.HtmlSection3 = data.HtmlSection3; return(View("Mail", inv)); }
public IActionResult SaveInvoice([FromBody] Models.Invoice invoice) { dataContext.Invoices.Add(invoice); invoice.LineItems.ForEach(x => dataContext.LineItems.Add(x)); dataContext.SaveChanges(); return(Ok(invoice)); }
public void RemoveInvoiceLine(Models.Invoice invoice, Guid lineId) { var item = invoice.LineItems.SingleOrDefault(_ => _.Id == lineId); invoice.LineItems.Remove(item); _logger.LogInformation($"Line: {lineId} removed from invoice: {invoice.Id}"); }
public IActionResult Edit(int?Id) { Services.Data.Core.Domain.Invoice invoice; if (Id == null) { invoice = new Services.Data.Core.Domain.Invoice(); } else { invoice = _unitOfWork.Invoices.Get((int)Id); if (invoice == null) { return(Redirect( "/../Invoice")); } } var model = new Models.Invoice(invoice); // Model parents and children //model.PopulateChilden(); return(View(model)); }
//Methods #region CreateFromUnbilledSales public static void CreateFromUnbilledSales() { var unbilledSales = Models.Sale.LoadUnbilled(); //Load all non cash sales var invoiceAddresses = from current in unbilledSales where !current.IsCashSale group current by current.ComparableInvoiceAddress into x select x; foreach (var current in invoiceAddresses) { if (current.AreMailingTypesDecided()) { Models.Invoice newInvoice = Models.Invoice.CreateFromSales(current.ToList()); Models.MyDataContext.Default.Invoices.Add(newInvoice); } } Models.MyDataContext.Default.SaveChanges(); //Create for cash sales var cashSales = from current in unbilledSales where current.IsCashSale select current; foreach (var current in cashSales) { Models.Invoice newInvoice = Models.Invoice.CreateFromSales(new List <Sale>() { current }); Models.MyDataContext.Default.Invoices.Add(newInvoice); } Models.MyDataContext.Default.SaveChanges(); }
public void UpdateModel(Models.Invoice invoice, Person currentPerson) { invoice.InvoiceIdentifyingName = InvoiceIdentifyingName; invoice.RequestorName = RequestorName; invoice.InvoiceDate = InvoiceDate.Value; invoice.PurchaseAuthority = PurchaseAuthority; invoice.TotalPaymentAmount = InvoiceAmount; invoice.InvoiceApprovalStatusID = InvoiceApprovalStatusID; invoice.InvoiceApprovalStatusComment = InvoiceApprovalStatusComment; invoice.PurchaseAuthorityIsLandownerCostShareAgreement = PurchaseAuthorityIsLandownerCostShareAgreement.Value; invoice.MatchAmount = MatchAmount; invoice.InvoiceMatchAmountTypeID = InvoiceMatchAmountTypeID; invoice.PreparedByPersonID = PreparedByPersonID; if (InvoiceFileResourceData != null) { var currentInvoiceFileResource = invoice.InvoiceFileResource; invoice.InvoiceFileResource = null; // Delete old Invoice file, if present if (currentInvoiceFileResource != null) { HttpRequestStorage.DatabaseEntities.SaveChanges(); HttpRequestStorage.DatabaseEntities.FileResources.DeleteFileResource(currentInvoiceFileResource); } invoice.InvoiceFileResource = FileResource.CreateNewFromHttpPostedFileAndSave(InvoiceFileResourceData, currentPerson); } }
public UpdateInvoiceRequest(Models.Invoice invoice, string idempotencyKey = null, IList <string> fieldsToClear = null) { Invoice = invoice; IdempotencyKey = idempotencyKey; FieldsToClear = fieldsToClear; }
public InvoiceBasicsViewData(Models.Invoice invoice, bool userHasProjectBudgetManagePermissions, TaxonomyLevel taxonomyLevel) { Invoice = invoice; UserHasProjectBudgetManagePermissions = userHasProjectBudgetManagePermissions; //OrganizationDisplayName = grantAllocation.Organization != null ? grantAllocation.Organization.DisplayName : string.Empty; //GrantAllocationTaxonomyViewData = new GrantAllocationTaxonomyViewData(grantAllocation, taxonomyLevel); ShowDownload = invoice.InvoiceFileResource != null; }
public Invoice(Models.Invoice invoice) { Id = invoice.Id; Name = invoice.Name; Type = invoice.Type; Amount = invoice.Amount; Company = new Company(invoice.Company); CreatedDate = invoice.CreatedDate; }
private void InvoiceWindowLogic(Models.Invoice invoice) { var page = new CoolIcePro.Views.InsertInvoice(PAGE_STATE.UPDATE, new CoolIcePro.ViewModels.InsertInvoiceViewModel(invoice)); var customer = ProjectManager.Instance.CoolIceProDBHelper.GetCustomer(invoice.CompanyId); Windows.GenericWindow gw = new Windows.GenericWindow(685, 625, string.Format("Invoice for {0}", customer.CompanyName), page); gw.ShowDialog(); this.Invoices = new ObservableCollection <Models.Invoice>(ProjectManager.Instance.CoolIceProDBHelper.GetCustomerInvoices(Id)); }
protected InvoiceViewData(Person currentPerson, Models.Invoice invoice) : base(currentPerson, null) { Invoice = invoice; HtmlPageTitle = invoice.InvoiceIdentifyingName; EntityName = $"{Models.FieldDefinition.Invoice.GetFieldDefinitionLabel()}"; EditInvoiceUrl = invoice.GetEditUrl(); UserHasEditInvoicePermissions = new InvoiceEditFeature().HasPermissionByPerson(currentPerson); BackToInvoicesText = "Back to all Invoices"; InvoicesListUrl = SitkaRoute <InvoiceController> .BuildUrlFromExpression(c => c.Index()); }
public InsertInvoiceViewModel(InsertInvoiceViewModel lhs) { this.ServicePerformanceOn = lhs.ServicePerformanceOn; this.CheckNumber = lhs.CheckNumber; this.TotalAmount = lhs.TotalAmount; this.Description = lhs.Description; this.InvoiceNumber = lhs.InvoiceNumber; this.Date = lhs.Date; this._invoice = lhs.GetInvoice(); }
/// <summary> /// Creates a deep clone of the current invoice (all fields and properties) /// </summary> public Models.Invoice Clone(Models.Invoice sourceInvoice) { _logger.LogInformation($"Deep cloning invoice: {sourceInvoice.Id}"); //todo: use reflection? return(new Models.Invoice { Id = sourceInvoice.Id, // this seems a little smelly to me, but the method summary says ALL fields and properties InvoiceDate = sourceInvoice.InvoiceDate, Code = sourceInvoice.Code, LineItems = sourceInvoice.LineItems }); }
public ActionResult Confirmation() { if (Session["SelectedCustomerId"] == null || Session["SelectedCustomerId"].ToString() == "") { TempData["msg"] = "Please select the customer first."; return(RedirectToAction("SelectCustomers")); } ViewModel.Invoice.Invoice invoice = new ViewModel.Invoice.Invoice(); Models.Invoice inv = invoice.Get(Session["SelectedCustomerId"].ToString()); return(View(inv)); }
public static InvoiceItem CreateShippingCosts(Models.Invoice invoice) { InvoiceItem result = new InvoiceItem(); result.Amount = 1; result.ArticleNumber = String.Empty; result.ArticleName = "Versandkosten"; result.SinglePriceGross = invoice.MailingCosts; result.TaxRate = invoice.MailingCostsTaxRate; result.Invoice = invoice; return(result); }
private Models.Invoice GetInvoiceInformationUI() { Models.Invoice invoice = new Models.Invoice(); invoice.Id = _invoice.Id; invoice.Date = this.Date; invoice.Check = this.IsCheck; invoice.InvoiceNumber = this.InvoiceNumber; invoice.CompanyId = GetInvoice().CompanyId; invoice.CheckNumber = this.CheckNumber ?? string.Empty; invoice.Description = this.Description ?? string.Empty; invoice.ServicePerformanceOn = this.ServicePerformanceOn ?? string.Empty; invoice.TotalAmount = double.Parse(this.TotalAmount, System.Globalization.NumberStyles.Currency); return(invoice); }
public async Task <ActionResult> ReportPdf(long obId) { CLayer.Invoice data = BLayer.Invoice.GetProformaByOfflineBooking(obId); if (data == null) { data = new CLayer.Invoice(); data.OfflineBookingId = obId; data.InvoiceDate = DateTime.Today; data.DueDate = DateTime.Today.AddDays(10); data.InvoiceType = (int)CLayer.ObjectStatus.InvoiceType.Proforma; BLayer.Invoice.Save(data); //data = BLayer.Invoice.GetProformaByOfflineBooking(offId); //data = await MessageFromHtml(offId); } Models.Invoice inv = new Models.Invoice(); inv.InvoiceId = data.InvoiceId; inv.OfflineBookingId = data.OfflineBookingId; inv.IsMailed = (data.MailedDate <= DateTime.Today); string url = ConfigurationManager.AppSettings.Get("ProformaLink") + obId.ToString(); System.Net.Http.HttpClient client = new System.Net.Http.HttpClient(); string mainHtml = await client.GetStringAsync(url); string html2; int i, len; // html2 = mainHtml; // html2 = html2.Substring(html2.IndexOf("<!--#SECONDROW_START-->")); // len = html2.Length; //i = html2.LastIndexOf("<!--#SECONDROW_END-->"); //html2 = html2.Substring(0, len - (len - i)); if (data.HtmlSection2 != null && data.HtmlSection2 != "") { inv.HtmlSection2 = data.HtmlSection2; } else { // inv.HtmlSection2 = html2; } inv.HtmlSection1 = data.HtmlSection1; inv.HtmlSection3 = data.HtmlSection3; return(View("Preview", inv)); }
public IActionResult Edit(Models.Invoice model) { if (model != null) { // Temporary remove many to many selected collections, // as they will cause invalid model state if there are any required fields on the many to many selected. ModelState.Clear(); TryValidateModel(model); } if (ModelState.IsValid) { try { if (!model.Validate(_unitOfWork, out List <string> errors)) { foreach (var error in errors) { ModelState.AddModelError( "Error", error); } return(View(model)); } _unitOfWork.Invoices.Add(model.GetCore()); if (_unitOfWork.Complete() == Services.Data.DataStoreResult.Success) { return(Redirect( "/../Invoice")); } return(View(model)); } catch (System.Exception ex) { ModelState.AddModelError( "Error", ex.Message); return(View(model)); } } else { return(View(model)); } }
public EditInvoiceViewModel(Models.Invoice invoice) { InvoiceIdentifyingName = invoice.InvoiceIdentifyingName; RequestorName = invoice.RequestorName; InvoiceDate = invoice.InvoiceDate; PurchaseAuthority = invoice.PurchaseAuthority; InvoiceAmount = invoice.TotalPaymentAmount; InvoiceApprovalStatusID = invoice.InvoiceApprovalStatusID; InvoiceApprovalStatusComment = invoice.InvoiceApprovalStatusComment; PurchaseAuthorityIsLandownerCostShareAgreement = invoice.PurchaseAuthorityIsLandownerCostShareAgreement; MatchAmount = invoice.MatchAmount; InvoiceMatchAmountTypeID = invoice.InvoiceMatchAmountTypeID; PreparedByPersonID = invoice.PreparedByPersonID; }
public InsertInvoiceViewModel(Models.Invoice vm) { if (vm == null) { return; } this._invoice = vm; this.Date = vm.Date; this.CheckNumber = vm.CheckNumber; this.Description = vm.Description; this.ServicePerformanceOn = vm.ServicePerformanceOn; this.TotalAmount = String.Format("{0:C}", vm.TotalAmount.ToString());//;String.Format("{0:C} this.IsCheck = vm.Check; this.InvoiceNumber = vm.InvoiceNumber; }
public IActionResult Create([FromBody] Models.Invoice invoice) { try { EnsureHasPermission((int)MenuFeatureEnum.ReadWritePurchaseSale); invoice.OrganisationId = invoiceService.OrganisationId; invoice.CreatedBy = invoiceService.UserId; invoiceService.Create(invoice); return(Ok(invoice)); } catch (Exception ex) { return(BadRequest(new Error(ex.Message))); } }
public async Task <ActionResult> Edit(long obid) { CLayer.Invoice data = BLayer.Invoice.GetProformaByOfflineBooking(obid); if (data != null) { if (data.HtmlSection1 == "" || data.HtmlSection2 == "") { data = await MessageFromHtml(obid); } } else { data = new CLayer.Invoice(); data.OfflineBookingId = obid; data.InvoiceDate = DateTime.Today; data.DueDate = DateTime.Today.AddDays(10); data.InvoiceType = (int)CLayer.ObjectStatus.InvoiceType.Proforma; BLayer.Invoice.Save(data); // data = BLayer.Invoice.(obid); data = await MessageFromHtml(obid); } Models.Invoice inv = new Models.Invoice(); inv.InvoiceId = data.InvoiceId; DateTime dt = DateTime.Today; if (data.InvoiceDate != DateTime.MinValue) { inv.InvoiceDate = data.InvoiceDate.ToString("dd/MM/yyyy"); } string u = User.Identity.GetUserId(); long id = 0; long.TryParse(u, out id); if (BLayer.User.GetRole(id) != CLayer.Role.Roles.Administrator) { inv.ShowText = 2; } inv.OfflineBookingId = data.OfflineBookingId; inv.IsMailed = (data.MailedDate <= DateTime.Today); inv.HtmlSection1 = data.HtmlSection1; inv.HtmlSection2 = data.HtmlSection2; inv.HtmlSection3 = data.HtmlSection3; inv.InvoiceNumber = data.InvoiceNumber; return(View("Edit", inv)); }
public IHttpActionResult CreateNewInvoice([FromBody] CreateNewInvoiceJsonObj obj) { var vendorInDb = _context.UpperVendors.SingleOrDefault(x => x.Name == obj.Vendor && x.DepartmentCode == obj.DepartmentCode); var newInvoice = new Models.Invoice { InvoiceNumber = "Unsynchronised", InvoiceType = "", InvoiceDate = obj.InvoiceDate, TotalDue = 0, PurchaseOrder = obj.PurchaseOrder, DueDate = obj.DueDate, Enclosed = obj.Enclosed, ShipDate = obj.ShipDate, ShipVia = obj.ShipVia, BillTo = obj.BillTo, ShipTo = obj.ShipTo, Currency = obj.Currency, UpperVendor = vendorInDb, Container = obj.Container, RequestId = "", CreatedBy = _userName, CreatedDate = DateTime.Now }; if (obj.Container != "" && obj.PurchaseOrder != "") { newInvoice.InvoiceType = InvoiceType.Operation; } else if (obj.Container != "") { newInvoice.InvoiceType = InvoiceType.Receiving; } else if (obj.PurchaseOrder != "") { newInvoice.InvoiceType = InvoiceType.OperationAndShipping; } _context.Invoices.Add(newInvoice); _context.SaveChanges(); var sampleDto = Mapper.Map <Models.Invoice, InvoiceDto>(_context.Invoices.OrderByDescending(x => x.Id).First()); return(Created(Request.RequestUri + "/" + sampleDto.Id, sampleDto)); }
public JsonResult SaveOrder(int INVID, int FK_CustomerID, short FK_TypeID, DateTime INDate, double Total, double Paid, double Remaind, InvoiceDetails[] details) { if (INVID != 0) { Invoice order = new Models.Invoice(); order.INVID = INVID; order.FK_CustomerID = FK_CustomerID; order.FK_TypeID = FK_TypeID; order.INDate = INDate; order.Total = Total; order.Paid = Paid; order.Remaind = Remaind; db.Invoice.Add(order); db.SaveChanges(); Customers cust = db.Customers.Find(FK_CustomerID); cust.CIN += Paid; db.Entry(cust).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); for (int i = 0; i < details.Length; i++) { InvoiceDetails det = new Models.InvoiceDetails(); det.FK_InvoiceID = INVID; det.FK_ItemID = details[i].FK_ItemID; det.Price = details[i].Price; det.QTY = details[i].QTY; det.Total = details[i].Total; db.InvoiceDetails.Add(det); db.SaveChanges(); Items item = db.Items.Find(details[i].FK_ItemID); item.Amount -= details[i].QTY; db.Entry(item).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } return(new JsonResult { Data = new { result = "Done Successfully" } }); } else { return(new JsonResult { Data = new { result = "Done with Error" } }); } }
public IActionResult Delete(Models.Invoice model) { if (ModelState.IsValid) { if (model == null) { return(View(model)); } if (model.Id == null) { return(View(model)); } try { if (_unitOfWork.Invoices .Remove((int)model.Id) != Services.Data.DataStoreResult.Success) { ModelState.AddModelError("Error", "Could not remove record."); return(View(model)); } _unitOfWork.Complete(); return(Redirect( "/../Invoice")); } catch { ModelState.AddModelError("Error", "Cannot delete the Invoice."); return(View(model)); } } else { return(View(model)); } }
public ActionResult ReportPrint(long obId) { Models.Invoice data = new Models.Invoice(); DataTable Reportlist = new DataTable(); //List<CLayer.PropertyDetailsReport> Reportlist; try { Reportlist = BLayer.Report.ReportCityWiseCount(); ViewBag.Filter = new Models.Invoice(); //data.ReportList = Reportlist; //data.ForPrint = true; //data.ForPdf = true; } catch (Exception ex) { Common.LogHandler.HandleError(ex); } return(View("Print", Reportlist)); }