private async void ShowConfirmationPopup(string emptyString) { try { confirmationPopup = new Popup(); confirmationPopup.IsLightDismissEnabled = true; confirmationPopup.Closed += confirmationPopup_Closed; confirmationPopup.Child = await CreateConfirmationView(); confirmationPopup.Height = 0.6 * Window.Current.CoreWindow.Bounds.Bottom; confirmationPopup.Width = 0.5 * Window.Current.CoreWindow.Bounds.Right; confirmationPopup.HorizontalOffset = 0.25 * Window.Current.CoreWindow.Bounds.Right; confirmationPopup.VerticalOffset = 0.2 * Window.Current.CoreWindow.Bounds.Bottom; confirmationPopup.IsOpen = true; } catch (T360Exception te) { InvoiceListViewModel invoiceListVM = (InvoiceListViewModel)DataContext; if (T360ErrorCodes.NotInReviewerQueue.Equals(te.ErrorCodes[0].Code)) { invoiceListVM.ReloadList(-1); } else { string msg = invoiceListVM.getErrorMessages(te); invoiceListVM.showErrorMessages(msg); } } }
public IActionResult Index() { var query = _dbContext.Invoices .Where(i => i.Team.Slug == TeamSlug); // fetch filter from session var filter = GetInvoiceFilter(); // hide deleted unless explicitly asked to show if (!filter.ShowDeleted) { query = query.Where(i => !i.Deleted); } if (filter.Statuses.Any()) { query = query.Where(i => filter.Statuses.Contains(i.Status)); } if (filter.CreatedDateStart.HasValue) { query = query.Where(i => i.CreatedAt >= filter.CreatedDateStart.FromPacificTime().Value); } if (filter.CreatedDateEnd.HasValue) { query = query.Where(i => i.CreatedAt <= filter.CreatedDateEnd.FromPacificTime().Value); } // get count for display reasons //var count = query.Count(); var invoices = query .Take(MaxRows) .OrderByDescending(i => i.Id) .ToList(); var model = new InvoiceListViewModel() { Invoices = invoices, Filter = filter }; // setup dropdown viewmodels ViewBag.Statuses = Invoice.StatusCodes.GetAllCodes() .Select(c => new SelectListItem { Text = c, Value = c, }); if (invoices.Count >= MaxRows) { //Message = $"Only showing {MaxRows} records, adjust filters to show other invoices."; //Something strange with tempData. It shows up ONLY the second time ViewBag.Message = $"Only showing {MaxRows} records, adjust filters to show other invoices."; } return(View(model)); }
public async Task <IActionResult> Index(string code, string name) { InvoiceListViewModel invoiceListViewModel = new InvoiceListViewModel(); invoiceListViewModel.Invoices = await ApiService <InvoiceDetailedModel> .GetList("Invoice/GetByCompany", code); invoiceListViewModel.CompanyName = name; return(View(invoiceListViewModel)); }
public async Task <ActionResult> Index() { var invoices = (await _invoiceAppService.GetInvoice()).Items; var model = new InvoiceListViewModel { InvoiceHeaders = invoices }; return(View(model)); }
public void Unregister(string param) { InvoiceListViewModel invoiceListVM = (InvoiceListViewModel)DataContext; InvoiceList.SelectionChanged -= changeHandler; Messenger.Default.Unregister <string>(this, Constants.UnregisterInvoiceListEvents, Unregister); Messenger.Default.Unregister <string>(this, Constants.MultiSelect_SelectAll, SelectAll); Messenger.Default.Unregister <string>(this, Constants.MultiSelect_ClearAll, ClearAll); Messenger.Default.Unregister <string>(this, Constants.ShowConfirmationPopup, ShowConfirmationPopup); Messenger.Default.Unregister <string>(this, Constants.CloseConfirmationPopup, CloseConfirmationPopup); Messenger.Default.Unregister <InvoiceErrorDetails>(this, Constants.InvoiceErrorDetails, ShowFailurePage); Messenger.Default.Unregister <string>(this, Constants.ShowPopupAfterConfirmation, OpenPopup); }
public MainWindow() { // var viewModel = new InvoiceHeaderViewModel(AppContext.InvoiceService.GetById(new SimpleObjectIdentifier(1L))); var viewModel = new InvoiceListViewModel(AppContext.InvoiceService.GetAll()); DataContext = viewModel; InitializeComponent(); // viewModel.FirstName = "Mark"; // viewModel.OnPropertyChanged(nameof(ViewModel.FirstName)); }
public async Task <bool> DeleteInvoice(InvoiceListViewModel model) { if (db != null) { Invoices obj = new Invoices(); obj = db.Invoices.Where(x => x.InvoiceId == model.InvoiceId).FirstOrDefault(); obj.IsDeleted = true; obj.DeletedBy = model.UserId; obj.DeletedDate = DateTime.Now; db.Invoices.Update(obj); await db.SaveChangesAsync(); return(true); } return(false); }
// // GET: /Invoice/ public ActionResult Index(int meterId, int propertyId, string fuel) { try { InvoiceListViewModel model = new InvoiceListViewModel(); model.BelongsToProperty = propertyId; model.Invoices = ResponseReader.convertTo <List <Invoice> >(emAPI.getInvoicesForMeter(meterId)); model.Invoices = model.Invoices.OrderByDescending(inv => inv.BillDate).ToList(); model.MeterDetails = ResponseReader.convertTo <Meter>(emAPI.getDetailsForMeter(meterId)); return(View(model)); } catch { return(View("Error")); } }
private List <InvoiceListViewModel> searchInvoiceByID(int InvID) { List <InvoiceListViewModel> _lstLstObj = new List <InvoiceListViewModel>(); var invoices = db.Invoices.Include(i => i.Agents).Include(i => i.AirlinesS).Include(i => i.Vendors).Where(a => a.Id == InvID).FirstOrDefault(); if (invoices != null) { var iTotal = db.InvoiceNames.Where(x => x.InvoiceId == invoices.Id).GroupBy(x => x.InvoiceId == invoices.Id).Select(g => new { Total = g.Sum(s => s.Amount) }); double vTotal = 0; if (iTotal.Count() > 0) { vTotal = Convert.ToDouble(iTotal.FirstOrDefault().Total); } var iPaid = db.InvoicePayments.Where(x => x.InvoiceId == invoices.Id).GroupBy(x => x.InvoiceId == invoices.Id).Select(g => new { Paid = g.Sum(s => s.Amount) }); double vPaid = 0; if (iPaid.Count() > 0) { vPaid = iPaid.FirstOrDefault().Paid; } InvoiceListViewModel _vObj = new InvoiceListViewModel(); _vObj.InvoiceId = invoices.Id; _vObj.SysCreateDate = invoices.SysCreateDate; _vObj.AirlineCode = invoices.AirlinesS.Code; _vObj.AgentCust = invoices.Agents.Name; _vObj.Total = vTotal; _vObj.Paid = vPaid; _vObj.Refund = Convert.ToDouble(0); _vObj.Due = Convert.ToDouble(vTotal) - Convert.ToDouble(vPaid); _vObj.PersonName = invoices.ApplicationUsers.PersonName; _lstLstObj.Add(_vObj); return(_lstLstObj); } else { return(_lstLstObj); } }
public IActionResult Activity(string team) { // TODO: add in date range filters var invoices = _dbContext.Invoices .Include(i => i.Account) .Where(i => i.Team.Slug == TeamSlug) .Where(i => i.CreatedAt >= DateTime.UtcNow.AddMonths(-12)) .OrderByDescending(i => i.Id) .AsNoTracking() .ToList(); var model = new InvoiceListViewModel() { Invoices = invoices, Filter = null }; return(View(model)); }
public IActionResult Index() { var orgId = getOrg(); var allInvoices = _context.InvoiceRecords.Where(x => x.OrganisationId == orgId).ToList(); var customer = _context.Customers.Where(x => x.OrganisationId == orgId).ToList(); List <InvoiceListViewModel> listIVM = new List <InvoiceListViewModel>(); InvoiceListViewModel iVM; foreach (var item in allInvoices) { iVM = new InvoiceListViewModel(); iVM.InvoiceRecord = item; iVM.Customer = customer.Where(x => x.Id == item.CustomerId).FirstOrDefault(); listIVM.Add(iVM); } ViewData["StatusMessage"] = StatusMessage; return(View(listIVM.OrderByDescending(x => x.InvoiceRecord.DateCreated))); }
public List <InvoiceListViewModel> GetOutstandingInvoiceListByAgentId(int AgentId) { List <InvoiceListViewModel> invList = new List <InvoiceListViewModel>(); try { using (SqlConnection connection = DataAccess.CreateConnection()) { SqlCommand command = DataAccess.CreateCommand(connection); DataAccess.CreateStoredprocedure(command, "GetOutstandingInvoiceListByAgentId_SP"); DataAccess.AddInParameter(command, "@AgentId", SqlDbType.Int, AgentId); SqlDataReader reader = DataAccess.ExecuteReader(command); if (reader != null) { while (reader.Read()) { InvoiceListViewModel invoice = new InvoiceListViewModel(); invoice.InvoiceId = reader["InvoiceId"] is DBNull ? 0 : Convert.ToInt32(reader["InvoiceId"]); invoice.SysCreateDate = reader["SysCreateDate"] is DBNull ? DateTime.MinValue : Convert.ToDateTime(reader["SysCreateDate"]); invoice.AirlineCode = reader["AirlineCode"] is DBNull ? string.Empty : (String)reader["AirlineCode"]; invoice.AgentCust = reader["AgentCust"] is DBNull ? string.Empty : (String)reader["AgentCust"]; invoice.Total = reader["Total"] is DBNull ? 0 : Convert.ToDouble(reader["Total"]); invoice.Paid = reader["Paid"] is DBNull ? 0 : Convert.ToDouble(reader["Paid"]); invoice.Refund = Convert.ToDouble(0); invoice.Due = (invoice.Total - invoice.Paid); invoice.PersonName = reader["Person"] is DBNull ? string.Empty : (String)reader["Person"]; invList.Add(invoice); } } reader.Close(); return(invList); } } catch (Exception ex) { return(invList); } }
public IActionResult Index(int?doctorId, int?clientId) // In de index tabel staan geen Prescription Lines { List <Invoice> listInvoiceDb; var invoiceListVM = new InvoiceListViewModel { // In de index tabel staan geen Invoice Lines, maar ze worden wel // meegegeven in deze ViewModel. InvoiceList = new List <InvoiceViewModel>() }; // Deze gaat de index view in // - Determine full names of client and doctor on top of the view: if (clientId.HasValue) { invoiceListVM.ClientId = clientId; invoiceListVM.ClientFullName = _clientManager.ClientFullName(clientId.Value); var clt = _clientManager.GetClient(clientId.Value); invoiceListVM.ClientNumber = clt.ClientNumber; invoiceListVM.NumberOfInvoices = _invoiceManager.NumberOfInvoicesPerClient(clientId.Value); } if (doctorId.HasValue) { invoiceListVM.DoctorId = doctorId; invoiceListVM.DoctorFullName = _clientManager.DoctorFullName(doctorId.Value); } //----Determine list of invoices --------------------------------------- if (!doctorId.HasValue && !clientId.HasValue) // Admin wil lijst van alle recepten zien { listInvoiceDb = _invoiceManager.GetAll(); } else if (!doctorId.HasValue && clientId.HasValue) // Een client logt in { var clt = _clientManager.GetClient(clientId.Value); invoiceListVM.ClientId = clt.Id; listInvoiceDb = _invoiceManager.GetAllPerClient(clientId.Value); } else if (doctorId.HasValue && !clientId.HasValue) // Een doctor vraagt alle recepten op van al zijn clienten { listInvoiceDb = _invoiceManager.GetAllPerDoctor(doctorId.Value); invoiceListVM.DoctorId = doctorId; } else // beiden ongelijk null // Als vanuit de clienten-lijst een lijst van recepten wordt opgehaald { listInvoiceDb = _invoiceManager.GetAllPerDoctorPerClient((int)doctorId, (int)clientId); invoiceListVM.ClientId = clientId; invoiceListVM.DoctorId = doctorId; } for (int i = 0; i < listInvoiceDb.Count; i++) { invoiceListVM.InvoiceList.Add ( new InvoiceViewModel { Invoice = listInvoiceDb[i], ClientFullName = _clientManager.ClientFullName(listInvoiceDb[i].ClientId), DoctorFullName = _clientManager.DoctorFullName(listInvoiceDb[i].DoctorId), // We tonen geen factuur-lijnen in het index-lijst-scherm // Onderstaande regels kan je ook weglaten Line1 = null, Line2 = null, Line3 = null } );; } return(View(invoiceListVM)); }
protected override void OnWindowSizeChanged() { InvoiceListViewModel invoiceListVM = (InvoiceListViewModel)DataContext; invoiceListVM.SetAppBar(); }
private async void InvoiceList_SelectionChanged(object sender, SelectionChangedEventArgs e) { InvoiceListViewModel invoiceListVM = (InvoiceListViewModel)DataContext; if (invoiceListVM.MultiSelect) { invoiceListVM.InvoiceCount = InvoiceList.SelectedItems.Count.ToString(); return; } if (ApplicationView.Value == ApplicationViewState.Snapped) { ApplicationView.TryUnsnap(); } try { if (invoiceListVM.SelectedInvoice > -1) { if (canCallServer) { bool selectionSuccess = await invoiceListVM.SetSummary(invoiceListVM.InvoiceDetails[invoiceListVM.SelectedInvoice].InvoiceId); if (selectionSuccess) { previousSelectedInvoice = invoiceListVM.SelectedInvoice; } else { invoiceListVM.SelectedInvoice = previousSelectedInvoice; } if (invoiceListVM.SelectedInvoice == -1) { if (invoiceListVM.InvoiceDetails.Count > 0) { UserPreference.Instance.SelectedInvoiceId = 0; InvoiceList.ScrollIntoView(InvoiceList.Items[0], ScrollIntoViewAlignment.Default); } } else { UserPreference.Instance.SelectedInvoiceId = invoiceListVM.InvoiceDetails[invoiceListVM.SelectedInvoice].InvoiceId; InvoiceList.ScrollIntoView(InvoiceList.Items[invoiceListVM.SelectedInvoice], ScrollIntoViewAlignment.Default); } } else { canCallServer = true; } invoiceListVM.HasSelectedInvoice = Visibility.Visible; } if (invoiceListVM.SelectedInvoice == -1) { invoiceListVM.HasSelectedInvoice = Visibility.Collapsed; } } catch (T360Exception ex) { if (T360ErrorCodes.NotInReviewerQueue.Equals(ex.ErrorCodes[0].Code)) { invoiceListVM.ReloadList(-1); } else { string msg = invoiceListVM.getErrorMessages(ex); invoiceListVM.showErrorMessages(msg); } } }
public PartialViewResult Search(int?invoiceID, string ToDate, string FromDate, string SearchBy, string SearchValue) { List <InvoiceListViewModel> lstLstObj = new List <InvoiceListViewModel>(); #region SearchByInvoiceID if (invoiceID > 0 && invoiceID != null) { var invoices = db.Invoices.Include(i => i.Agents).Include(i => i.AirlinesS).Include(i => i.Vendors).Where(a => a.Id == invoiceID).FirstOrDefault(); //.OrderBy(a => a.SysCreateDate).ToList(); if (invoices != null) { var iTotal = db.InvoiceNames.Where(x => x.InvoiceId == invoices.Id).GroupBy(x => x.InvoiceId == invoices.Id).Select(g => new { Total = g.Sum(s => s.Amount) }); double vTotal = 0; if (iTotal.Count() > 0) { vTotal = Convert.ToDouble(iTotal.FirstOrDefault().Total); } var iPaid = db.InvoicePayments.Where(x => x.InvoiceId == invoices.Id).GroupBy(x => x.InvoiceId == invoices.Id).Select(g => new { Paid = g.Sum(s => s.Amount) }); double vPaid = 0; if (iPaid.Count() > 0) { vPaid = iPaid.FirstOrDefault().Paid; } InvoiceListViewModel _vObj = new InvoiceListViewModel(); _vObj.InvoiceId = invoices.Id; _vObj.SysCreateDate = invoices.SysCreateDate; _vObj.AirlineCode = invoices.AirlinesS.Code; _vObj.AgentCust = invoices.Agents.Name; _vObj.Total = vTotal; _vObj.Paid = vPaid; _vObj.Refund = Convert.ToDouble(0); _vObj.Due = Convert.ToDouble(vTotal) - Convert.ToDouble(vPaid); _vObj.PersonName = invoices.ApplicationUsers.PersonName; lstLstObj.Add(_vObj); return(PartialView("Search", lstLstObj)); } else { return(PartialView("Search", lstLstObj)); } } #endregion #region SearchByLastNamePnrTicketNo else if (Convert.ToInt32(SearchBy) > 0) { int InvID = 0; if (String.IsNullOrEmpty(SearchValue)) { return(PartialView("Search", lstLstObj)); } else { if (Convert.ToInt32(SearchBy) == 1) { if (!string.IsNullOrEmpty(SearchBy)) { lstLstObj = new SearchDA().SearchInvoicesByPaxLastNames(SearchValue); return(PartialView("Search", lstLstObj)); } else { return(PartialView("Search", lstLstObj)); } } else if (Convert.ToInt32(SearchBy) == 2) { if (!string.IsNullOrEmpty(SearchBy)) { lstLstObj = new SearchDA().SearchInvoicesByTicketNo(SearchValue); return(PartialView("Search", lstLstObj)); } else { return(PartialView("Search", lstLstObj)); } } else if (Convert.ToInt32(SearchBy) == 3) { if (!string.IsNullOrEmpty(SearchBy)) { lstLstObj = new SearchDA().SearchInvoicesByPNR(SearchValue); return(PartialView("Search", lstLstObj)); } else { return(PartialView("Search", lstLstObj)); } } } } #endregion #region SearchByDateOrDateRange else if (!string.IsNullOrEmpty(FromDate)) { if (string.IsNullOrEmpty(ToDate)) { lstLstObj = new SearchDA().SearchInvoicesByDate(FromDate); return(PartialView("Search", lstLstObj)); } else { lstLstObj = new SearchDA().SearchInvoicesByDateRange(FromDate, ToDate); return(PartialView("Search", lstLstObj)); } } #endregion return(PartialView("Search", lstLstObj)); }
public async Task SendInvoiceMail(long InvoiceId) { try { InvoiceListViewModel invoiceDetails = new InvoiceListViewModel(); invoiceDetails = await GetInvoiceByInvoiceId(InvoiceId); BussinessDetailViewModel adminbussinessDetials = new BussinessDetailViewModel(); if (invoiceDetails != null) { adminbussinessDetials = await _bussinessService.GetBussinessDetailsById(invoiceDetails.UserId); } var pathToFile = _hostingEnvironment.WebRootPath + Path.DirectorySeparatorChar.ToString() + Constants.mainTemplatesContainer + Path.DirectorySeparatorChar.ToString() + Constants.invoicesTemplatesContainer + Path.DirectorySeparatorChar.ToString() + Constants.invoice_template_Sample_Invoice_Template; var subject = string.Empty; if (invoiceDetails.Type == Constants.typeInvoice) { subject = Constants.subject_SendInvoice_to_customer + " Invoice No: # " + invoiceDetails.InvoiceNumber; } else { subject = Constants.subject_SendQuotation_to_customer + " Quotation No: # " + invoiceDetails.InvoiceNumber; } string customerName = invoiceDetails.FirstName + " " + invoiceDetails.LastName; StringBuilder sb = new StringBuilder(); foreach (var item in invoiceDetails.ItemList) { sb.Append("<tr class='item'>"); sb.AppendFormat("<td>{0}</td>", item.Name); sb.AppendFormat("<td>{0}</td>", item.Quantity); sb.AppendFormat("<td>{0}</td>", item.Tax); sb.AppendFormat("<td>{0}</td>", item.Price); sb.Append("</tr>"); } string itemList = sb.ToString(); var body = new BodyBuilder(); using (StreamReader reader = System.IO.File.OpenText(pathToFile)) { body.HtmlBody = reader.ReadToEnd(); } string messageBody = body.HtmlBody; messageBody = messageBody.Replace("{companylogoUrl}", adminbussinessDetials.BussinessLogo); messageBody = messageBody.Replace("{invoiceNumber}", invoiceDetails.InvoiceNumber); messageBody = messageBody.Replace("{invoiceDate}", invoiceDetails.Date); messageBody = messageBody.Replace("{dueDate}", invoiceDetails.DueDate); messageBody = messageBody.Replace("{bussinessName}", adminbussinessDetials.BussinessName); messageBody = messageBody.Replace("{bussinessAddress}", CommonMethods.SplitLine(adminbussinessDetials.Address1)); messageBody = messageBody.Replace("{customerBussiness}", invoiceDetails.BussinessName); messageBody = messageBody.Replace("{customerEmail}", invoiceDetails.PersonalEmail); messageBody = messageBody.Replace("{itemList}", itemList); messageBody = messageBody.Replace("{subTotal}", invoiceDetails.Subtotal.ToString()); messageBody = messageBody.Replace("{tax}", invoiceDetails.Tax.ToString()); messageBody = messageBody.Replace("{total}", invoiceDetails.Total.ToString()); messageBody = messageBody.Replace("{customerName}", customerName); messageBody = messageBody.Replace("{currencySymbol}", invoiceDetails.CurrencySymbol); await _emailSender.SendEmailAsync(email : invoiceDetails.PersonalEmail, subject : subject, htmlMessage : messageBody); } catch (Exception ex) { throw ex; } }
public ActionResult AgentInvoiceDetails(int agentId) { var invoiceDetails = (from c in _context.Customer join i in _context.Invoice on c.IdCustomer equals i.IdCustomer join ag in _context.Agent on i.IdAgent equals ag.IdAgent join iap in _context.InvoiceArtPiece on i.IdInvoice equals iap.IdInvoice join ap in _context.ArtPiece on iap.IdArtPiece equals ap.IdArtPiece join aw in _context.ArtWork on ap.IdArtWork equals aw.IdArtWork join ar in _context.Artist on aw.IdArtist equals ar.IdArtist where ag.IdAgent == agentId group new { i.IdInvoice, ag.AgentFirstName, ag.AgentLastName, c.CustomerFirstName, c.CustomerLastName, c.CustomerAddress, c.CustomerPhoneNumber, i.PaymentMethod, ap.IdArtPiece, aw.ArtWorkTitle, ar.ArtistName } by i.IdInvoice into newGroup select newGroup).ToList(); // Create a father VM that will cointains a list of tickets InvoiceListViewModel Allinvoices = new InvoiceListViewModel(); // Create a local VM that IS a list of tickets List <InvoiceViewModel> _localInvoices = new List <InvoiceViewModel>(); decimal TotalSales = new decimal(); foreach (var item in invoiceDetails) { //create a new view model InvoiceViewModel ivm = new InvoiceViewModel(); ivm.IdInvoice = item.First().IdInvoice; ivm.agentName = item.First().AgentFirstName + " " + item.First().AgentLastName; ivm.customerName = item.First().CustomerFirstName + " " + item.First().CustomerLastName; ivm.customerAddress = item.First().CustomerAddress; ivm.customerPhoneNumber = item.First().CustomerPhoneNumber; ivm.paymentMethod = item.First().PaymentMethod; decimal invoiceTotalSales = new decimal(); List <APinInvoice> art = new List <APinInvoice>(); // Get acces to each painting sold in the invoice foreach (var curInvoice in item) { //add painting to the view model of each invoice APinInvoice singleAP = new APinInvoice(); singleAP.Artist = curInvoice.ArtistName; singleAP.ArtWorkTitle = curInvoice.ArtWorkTitle; singleAP.ArtPiecePrice = curInvoice.IdArtPiece; art.Add(singleAP); invoiceTotalSales += singleAP.ArtPiecePrice; //ivm.IdartPiece.Add(curInvoice.IdArtPiece); } ivm.invoiceTotalSales = invoiceTotalSales; TotalSales += invoiceTotalSales; ivm.ArtWork = art; _localInvoices.Add(ivm); } Allinvoices.TotalSales = TotalSales; Allinvoices.InvoiceModels = _localInvoices; return(View(Allinvoices)); }
public InvoiceListPage() { InitializeComponent(); BindingContext = viewModel = new InvoiceListViewModel(); }