public void InitializeFromTicket(Ticket activeTicket) { ActiveTicket = activeTicket; personInformationControl.buttonStartTicket.Text = ((activeTicket == null) ? Types.Strings.CreateTicket : Types.Strings.ChangeOccasion); personInformationControl.ActiveTicket = activeTicket; if (ActiveTicket == null) { TicketType = TicketType.DineIn; SetupSeatingButtons(); return; } TicketType = ActiveTicket.Type; if (ActiveTicket.CustomerId > 0) { SelectedCustomer = Customer.Get(ActiveTicket.CustomerId); personInformationControl.SelectedCustomer = SelectedCustomer; } if (ActiveTicket.SeatingId > 0) { Seating seat = SeatingManager.GetSeating(ActiveTicket.SeatingId); SelectedRoom = SeatingManager.GetRoom(seat.RoomId); } else { Room[] rooms = SeatingManager.GetAllRoom(); foreach (Room room in rooms) { if (room.TicketingType == TicketType) { SelectedRoom = room; break; } } } SetupSeatingButtons(); }
public void InitializeListBox(TicketSelectionShow show) { var tickets = new List <Ticket>(); if (show == TicketSelectionShow.All) { tickets.AddRange(TicketManager.GetAllTickets()); } else if (show == TicketSelectionShow.Range) { tickets.AddRange(TicketManager.GetRange(RangeStart, RangeEnd)); } else if (show == TicketSelectionShow.AllDay) { if (DayOfOperation.Today != null) { tickets.AddRange(TicketManager.GetRange(DayOfOperation.Today.StartOfDay, DateTime.Now)); } else { DayOfOperation lastDay = DayOfOperation.GetLatestInYear(DayOfOperation.CurrentYear); if (lastDay.EndOfDay != null) { tickets.AddRange(TicketManager.GetRange(lastDay.StartOfDay, lastDay.EndOfDay.Value)); } } } else if (show == TicketSelectionShow.AllOpen) { tickets.AddRange(TicketManager.GetOpenTickets()); } else if (show == TicketSelectionShow.MyOpen) { tickets.AddRange(TicketManager.GetOpenTickets(SessionManager.ActiveEmployee.Id)); } else if (show == TicketSelectionShow.Closed) { tickets.AddRange(TicketManager.GetTodaysClosedTickets()); } else if (show == TicketSelectionShow.Canceled) { tickets.AddRange(TicketManager.GetTodaysCanceledTickets()); } else if (show == TicketSelectionShow.Dispatched) { tickets.AddRange(TicketManager.GetDispatchedTickets()); } else if (show == TicketSelectionShow.Future) { tickets.AddRange(TicketManager.GetFutureOrderTickets()); } Items.Clear(); foreach (Ticket ticket in tickets .Where(ticket => (TicketTypeFilterControl.CurrentFilter == null) || (TicketTypeFilterControl.CurrentFilter.Value == ticket.Type))) { string text; Seating seat = SeatingManager.GetSeating(ticket.SeatingId); if (seat != null) { text = (ticket.OrderId != null ? Types.Strings.Order + ": " + ticket.OrderId.Value + ", " : "") + Types.Strings.Ticket + ": " + ticket.PrimaryKey.Id + (ticket.PartyId != 0 ? Types.Strings.Party + ticket.PartyId : "") + ", " + seat.Description + Environment.NewLine + Types.Strings.CreateTime + ticket.CreateTime; if (!String.IsNullOrEmpty(ticket.ManagerNote)) { text += Environment.NewLine + Types.Strings.Comment + ticket.ManagerNote; } } else { text = (ticket.OrderId != null ? Types.Strings.Order + ": " + ticket.OrderId.Value + ", " : "") + Types.Strings.Ticket + ": " + ticket.PrimaryKey.Id + (ticket.PartyId != 0 ? Types.Strings.Party + ticket.PartyId : "") + ", " + ticket.Type.GetFriendlyName() + Environment.NewLine + Types.Strings.CreateTime + ticket.CreateTime; if (!String.IsNullOrEmpty(ticket.ManagerNote)) { text += Environment.NewLine + Types.Strings.Comment + ticket.ManagerNote; } } AddItem(ticket, text); } OrderEntryControl.SetDisplayedTicketTypeToStatusBar(); }
private static void PrintHeaderInformation(PrintDestination printDestination, PosPrinter printer, Ticket ticket, TicketItemPrintOptions printOptions) { // Print the receipt header image string filename = "receipt-header.gif"; if (File.Exists(filename)) { PrintToReceipt(printer, PrinterEscapeCodes.SetCenter); printer.PrintBitmap(PrinterStation.Receipt, filename, 200, PosPrinter.PrinterBitmapCenter); } // Occasion / Seating Information if (ConfigurationManager.UseSeating) { PrintLineToReceipt(printer, PrinterEscapeCodes.SetCenter + ticket.Type.GetFriendlyName()); } // Print Ticket Number PrintLineToReceipt(printer, ((ticket.OrderId == null) ? "" : Strings.Order + ticket.OrderId.Value + ", ") + Strings.Ticket + ticket.PrimaryKey.Id); Person person = PersonManager.GetPersonByEmployeeId(ticket.EmployeeId); PrintLineToReceipt(printer, Strings.Employee + ": " + person.FirstName + " " + person.LastName.Substring(0, 1)); if (ticket.SeatingId > 0) { Seating seating = SeatingManager.GetSeating(ticket.SeatingId); PrintLineToReceipt(printer, Strings.Table + seating.Description); } // Print date and time (now, future time, or ticket close time) DateTime time = DateTime.Now; int? intValue = OrderEntryCommands.GetPrepTime().IntValue; if (printOptions == TicketItemPrintOptions.AllAsVoid) { PrintLineToReceipt(printer, PrinterEscapeCodes.SetCenter + Strings.TicketVoid); } else if (printOptions == TicketItemPrintOptions.TicketRefund) { PrintLineToReceipt(printer, PrinterEscapeCodes.SetCenter + Strings.TicketRefund); } else if (printOptions == TicketItemPrintOptions.AllAsCancelMade) { PrintLineToReceipt(printer, PrinterEscapeCodes.SetCenter + Strings.TicketCancelMade); } else if (printOptions == TicketItemPrintOptions.AllAsCancelUnmade) { PrintLineToReceipt(printer, PrinterEscapeCodes.SetCenter + Strings.TicketCancelUnmade); } else if (printOptions == TicketItemPrintOptions.TicketItemVoid) { PrintLineToReceipt(printer, PrinterEscapeCodes.SetCenter + Strings.TicketItemVoid); } else if (printOptions == TicketItemPrintOptions.TicketItemReturn) { PrintLineToReceipt(printer, PrinterEscapeCodes.SetCenter + Strings.TicketItemReturn); } else if (ticket.StartTime.HasValue && intValue.HasValue && ((ticket.StartTime.Value - new TimeSpan(0, 0, ticket.StartTime.Value.Second) - new TimeSpan(0, intValue.Value, 0)) >= time) && !ticket.IsClosed) { PrintLineToReceipt(printer, PrinterEscapeCodes.SetCenter + Strings.FutureOrder); time = ticket.StartTime.Value; } else if (ticket.StartTime.HasValue && !ticket.IsClosed) { PrintLineToReceipt(printer, PrinterEscapeCodes.SetCenter + Strings.MakeNow); time = ticket.StartTime.Value; } if (ticket.IsClosed && ticket.CloseTime.HasValue) { time = ticket.CloseTime.Value; } PrintLineToReceipt(printer, time.ToShortDateString() + PrinterEscapeCodes.SetRight + time.ToShortTimeString()); // Newline PrintLineToReceipt(printer); // Customer's Information bool isKitchen = ((printDestination == PrintDestination.Kitchen1) || (printDestination == PrintDestination.Kitchen2) || (printDestination == PrintDestination.Kitchen3)); if (!isKitchen && (ticket.CustomerId > 0)) { person = PersonManager.GetPersonByCustomerId(ticket.CustomerId); PrintLineToReceipt(printer, person.FirstName + " " + person.LastName); if ((ticket.Type == TicketType.Delivery) || (ticket.Type == TicketType.Catering)) { ZipCode zipCode = ZipCode.Get(person.ZipCodeId); ZipCodeCity zipCodeCity = ZipCodeCity.Get(zipCode.CityId); ZipCodeState zipCodeState = ZipCodeState.Get(zipCodeCity.StateId); PrintLineToReceipt(printer, person.AddressLine1); if (!string.IsNullOrEmpty(person.AddressLine2)) { PrintLineToReceipt(printer, person.AddressLine2); } PrintLineToReceipt(printer, zipCodeCity.City + ", " + zipCodeState.Abbreviation + " " + zipCode.PostalCode.ToString("D5")); } if (person.PhoneNumberId1 > 0) { PhoneNumber phoneNumber = PhoneNumber.Get(person.PhoneNumberId1); PrintLineToReceipt(printer, phoneNumber.GetFormattedPhoneNumber()); } // Newline PrintLineToReceipt(printer); } }