public static bool CancelOrder(OrderInformation orderInfo, int employeeID) { if (orderInfo == null) { return false; } int num = CancelForm.Show("Select Cancel Reason"); if (num < 0) { return false; } for (int i = 0; i < orderInfo.Bills.Length; i++) { for (int j = 0; j < orderInfo.Bills[i].Items.Length; j++) { if ((orderInfo.Bills[i] != null) && !(orderInfo.Bills[i].CloseBillDate != AppParameter.MinDateTime)) { orderInfo.Bills[i].Items[j].CancelReasonID = num; orderInfo.Bills[i].Items[j].Status = 0; orderInfo.Bills[i].Items[j].EmployeeID = employeeID; orderInfo.Bills[i].Items[j].ChangeFlag = true; } } orderInfo.Bills[i].CloseBillDate = DateTime.Now; } orderInfo.CloseOrderDate = DateTime.Now; return true; }
/// <summary> /// Cancel all bill detail in order /// </summary> /// <param name="orderInfo">Order to cancel</param> /// <returns>true = success, false = fail</returns> public static bool CancelOrder(OrderInformation orderInfo, int employeeID) { if (orderInfo == null) return false; for (int i = 0;i < orderInfo.Bills.Length;i++) { for (int j = 0;j < orderInfo.Bills[i].Items.Length;j++) CancelOrderBillItem(orderInfo.Bills[i], orderInfo.Bills[i].Items[j], employeeID); orderInfo.Bills[i].CloseBillDate = DateTime.Now; } orderInfo.CloseOrderDate = DateTime.Now; return true; }
public static void PrintReceiptAll(OrderInformation orderInfo) { smartRestaurant.OrderService.OrderService service = new smartRestaurant.OrderService.OrderService(); for (int i = 0; i < orderInfo.Bills.Length; i++) { if (((orderInfo.Bills[i].Items != null) && (orderInfo.Bills[i].Items.Length > 0)) && (orderInfo.Bills[i].CloseBillDate == AppParameter.MinDateTime)) { service.PrintReceipt(orderInfo.Bills[i].OrderBillID); } } }
/// <summary> /// Update order item grid. /// </summary> private void UpdateOrderGrid() { StringBuilder sb = new StringBuilder(); int billCnt, itemCnt; OrderBill[] bills; OrderBillItem[] items; DataItem data; ListOrderItem.AutoRefresh = false; ListOrderCount.AutoRefresh = false; ListOrderItemBy.AutoRefresh = false; ListOrderItem.Items.Clear(); ListOrderCount.Items.Clear(); ListOrderItemBy.Items.Clear(); if (orderInfo == null || orderInfo.Bills.Length != billNumber) { orderInfo = OrderManagement.CreateOrderObject(orderInfo, employeeID, tableInfo, guestNumber, billNumber); } bills = orderInfo.Bills; if (selectedBill == null) selectedBill = bills[0]; // Loop for all bills. for (billCnt = 0;billCnt < bills.Length;billCnt++) { // Add bill title to grid. sb.Length = 0; if (AppParameter.IsDemo()) sb.Append("Bill #"); else sb.Append("Seat #"); sb.Append(billCnt + 1); if (bills[billCnt].CloseBillDate != DateTime.MinValue) sb.Append(" (Closed)"); data = new DataItem(sb.ToString(), bills[billCnt], true); ListOrderItem.Items.Add(data); // Add bill title to order count data = new DataItem("Amt.", bills[billCnt], true); ListOrderCount.Items.Add(data); // Add bill title to order by grid data = new DataItem("Emp#", bills[billCnt], true); ListOrderItemBy.Items.Add(data); // Selected Bill if (selectedBill == bills[billCnt] && selectedItem == null) { ListOrderItem.SelectedIndex = ListOrderItem.Items.Count - 1; ListOrderCount.SelectedIndex = ListOrderCount.Items.Count - 1; ListOrderItemBy.SelectedIndex = ListOrderItemBy.Items.Count - 1; } items = bills[billCnt].Items; if (items != null) { // Loop for all items in bill for (itemCnt = 0;itemCnt < items.Length;itemCnt++) { // Add item to grid data = new DataItem(OrderManagement.OrderBillItemDisplayString(items[itemCnt]), items[itemCnt], false); if (OrderManagement.IsCancel(items[itemCnt])) data.Strike = true; ListOrderItem.Items.Add(data); // Add item to grid order count data = new DataItem(items[itemCnt].Unit.ToString(), items[itemCnt], false); if (OrderManagement.IsCancel(items[itemCnt])) data.Strike = true; ListOrderCount.Items.Add(data); // Add item to grid order by data = new DataItem(items[itemCnt].EmployeeID.ToString(), items[itemCnt], false); if (OrderManagement.IsCancel(items[itemCnt])) data.Strike = true; ListOrderItemBy.Items.Add(data); // Selected Item if (selectedItem == items[itemCnt]) { ListOrderItem.SelectedIndex = ListOrderItem.Items.Count - 1; ListOrderCount.SelectedIndex = ListOrderCount.Items.Count - 1; ListOrderItemBy.SelectedIndex = ListOrderItemBy.Items.Count - 1; } } } } ListOrderItem.AutoRefresh = true; ListOrderCount.AutoRefresh = true; ListOrderItemBy.AutoRefresh = true; UpdateOrderButton(); UpdateFlowButton(); }
/// <summary> /// Initial form when start take order. /// (Call this method from outside) /// </summary> public override void UpdateForm() { LoadMenus(); // Check for reserve mode takeOutMode = (tableInfo.TableID == 0); OrderService.OrderService service = new OrderService.OrderService(); if (!takeOrderResume) { // Load old table order information (Web Services) if (!takeOutMode) { orderInfo = service.GetOrder(tableInfo.TableID); if (orderInfo != null) { if (tableInfo.TableID != orderInfo.TableID) { TableService.TableService tabService = new TableService.TableService(); tableInfo = tabService.GetTableInformation(orderInfo.TableID); } tableIDList = service.GetTableReference(orderInfo.OrderID); } else tableIDList = null; } else if (takeOutOrderID > 0) { orderInfo = service.GetOrderByOrderID(takeOutOrderID); tableIDList = null; } else { orderInfo = null; tableIDList = null; } // Reset input isChanged = false; } else { if (!takeOutMode) orderInfo = service.GetOrder(tableInfo.TableID); } // Check exist order information if (orderInfo != null) { // Found (Edit order) guestNumber = orderInfo.NumberOfGuest; billNumber = orderInfo.Bills.Length; } else if (guestNumber <= 0) { // Not found (New order) guestNumber = billNumber = 1; } // Check Demo version if (AppParameter.IsDemo()) { ListOrderItem.ItemWidth = 240; ListOrderCount.Left = 248; ListOrderItemBy.Visible = true; LblGuest.Text = "Guest"; } else { ListOrderItem.ItemWidth = 280; ListOrderCount.Left = 288; ListOrderItemBy.Visible = false; LblGuest.Text = "Seat"; } ListOrderCount.Left = ListOrderItem.Left + ListOrderItem.ItemWidth; // Clear Input selectedBill = null; selectedItem = null; selectedType = null; if (orderInfo != null && orderInfo.Bills != null) { for (int i = 0;i < orderInfo.Bills.Length;i++) if (orderInfo.Bills[i].CloseBillDate == DateTime.MinValue) { selectedBill = orderInfo.Bills[i]; break; } } // Update screen LblPageID.Text = "Employee ID:" + ((MainForm)MdiParent).UserID + " | "; if (takeOutMode) LblPageID.Text += "STTO021"; else LblPageID.Text += "STTO011"; PanCustName.Visible = takeOutMode; BtnSearch.Visible = takeOutMode; OptionPad.AutoRefresh = false; OptionPad.Red = OptionPad.Green = OptionPad.Blue = 1; OptionPad.AutoRefresh = true; ListOrderItem.Reset(); ListOrderCount.Reset(); ListOrderItemBy.Reset(); UpdateTableInformation(); StartInputMenu(); }
public string SendOrderPrint(OrderInformation orderInfo, int CustID, string CustFullName, bool print) { object[] results = this.Invoke("SendOrderPrint", new object[] { orderInfo, CustID, CustFullName, print}); return ((string)(results[0])); }
/// <remarks/> public System.IAsyncResult BeginSendOrderPrint(OrderInformation orderInfo, int CustID, string CustFullName, bool print, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("SendOrderPrint", new object[] { orderInfo, CustID, CustFullName, print}, callback, asyncState); }
private void UpdateOrderGrid() { StringBuilder builder = new StringBuilder(); this.ListOrderItem.AutoRefresh = false; this.ListOrderCount.AutoRefresh = false; this.ListOrderItemBy.AutoRefresh = false; this.ListOrderItem.Items.Clear(); this.ListOrderCount.Items.Clear(); this.ListOrderItemBy.Items.Clear(); if ((this.orderInfo == null) || (this.orderInfo.Bills.Length != this.billNumber)) { this.orderInfo = OrderManagement.CreateOrderObject(this.orderInfo, this.employeeID, this.tableInfo, this.guestNumber, this.billNumber); } OrderBill[] bills = this.orderInfo.Bills; if (this.selectedBill == null) { this.selectedBill = bills[0]; } double num3 = 0.0; double price = 0.0; for (int i = 0; i < bills.Length; i++) { builder.Length = 0; if (AppParameter.IsDemo()) { builder.Append("Bill #"); } else { builder.Append("Seat #"); } builder.Append((int) (i + 1)); if (bills[i].CloseBillDate != AppParameter.MinDateTime) { builder.Append(" (Closed)"); } DataItem item = new DataItem(builder.ToString(), bills[i], true); this.ListOrderItem.Items.Add(item); item = new DataItem("Amt.", bills[i], true); this.ListOrderCount.Items.Add(item); item = new DataItem("Emp#", bills[i], true); this.ListOrderItemBy.Items.Add(item); if ((this.selectedBill == bills[i]) && (this.selectedItem == null)) { this.ListOrderItem.SelectedIndex = this.ListOrderItem.Items.Count - 1; this.ListOrderCount.SelectedIndex = this.ListOrderCount.Items.Count - 1; this.ListOrderItemBy.SelectedIndex = this.ListOrderItemBy.Items.Count - 1; } OrderBillItem[] items = bills[i].Items; if (items != null) { for (int j = 0; j < items.Length; j++) { bool flag = OrderManagement.IsCancel(items[j]); item = new DataItem(OrderManagement.OrderBillItemDisplayString(items[j]), items[j], false); if (flag) { item.Strike = true; } this.ListOrderItem.Items.Add(item); item = new DataItem(OrderManagement.OrderBillCountDisplayString(items[j], ref price), items[j], false); if (flag) { item.Strike = true; } this.ListOrderCount.Items.Add(item); item = new DataItem(items[j].EmployeeID.ToString(), items[j], false); if (flag) { item.Strike = true; } this.ListOrderItemBy.Items.Add(item); if (this.selectedItem == items[j]) { this.ListOrderItem.SelectedIndex = this.ListOrderItem.Items.Count - 1; this.ListOrderCount.SelectedIndex = this.ListOrderCount.Items.Count - 1; this.ListOrderItemBy.SelectedIndex = this.ListOrderItemBy.Items.Count - 1; } if (!flag) { num3 += price; } } } } this.LblTotalValue.Text = num3.ToString("N"); this.ListOrderItem.AutoRefresh = true; this.ListOrderCount.AutoRefresh = true; this.ListOrderItemBy.AutoRefresh = true; this.UpdateOrderButton(); this.UpdateFlowButton(); }
public override void UpdateForm() { this.LoadMenus(); this.takeOutMode = this.tableInfo.TableID == 0; smartRestaurant.OrderService.OrderService service = new smartRestaurant.OrderService.OrderService(); if (!this.takeOrderResume) { if (!this.takeOutMode) { this.orderInfo = service.GetOrder(this.tableInfo.TableID); if (this.orderInfo != null) { if (this.tableInfo.TableID != this.orderInfo.TableID) { this.tableInfo = this.tabService.GetTableInformation(this.orderInfo.TableID); } this.tableIDList = service.GetTableReference(this.orderInfo.OrderID); } else { this.tableIDList = null; } } else if (this.takeOutOrderID > 0) { this.orderInfo = service.GetOrderByOrderID(this.takeOutOrderID); this.tableIDList = null; } else { this.orderInfo = null; this.tableIDList = null; } this.isChanged = false; } else if (!this.takeOutMode) { this.orderInfo = service.GetOrder(this.tableInfo.TableID); } if (this.orderInfo != null) { this.guestNumber = this.orderInfo.NumberOfGuest; this.billNumber = this.orderInfo.Bills.Length; } else if (this.guestNumber <= 0) { this.guestNumber = this.billNumber = 1; } if (AppParameter.IsDemo()) { this.ListOrderItem.ItemWidth = 240; this.ListOrderCount.Left = 0xf8; this.ListOrderItem.Row = 14; this.ListOrderCount.Row = 14; this.ListOrderItemBy.Row = 14; this.ListOrderItemBy.Visible = true; this.LblTotalText.Visible = false; this.LblTotalValue.Visible = false; this.LblGuest.Text = "Guest"; } else { if (AppParameter.ShowOrderItemPrice) { this.ListOrderItem.ItemWidth = 240; this.ListOrderCount.Left = 0xf8; this.ListOrderCount.ItemWidth = 80; this.ListOrderItem.Row = 13; this.ListOrderCount.Row = 13; this.LblTotalText.Visible = true; this.LblTotalValue.Visible = true; } else { this.ListOrderItem.ItemWidth = 280; this.ListOrderCount.Left = 0x120; this.ListOrderCount.ItemWidth = 40; this.ListOrderItem.Row = 14; this.ListOrderCount.Row = 14; this.LblTotalText.Visible = false; this.LblTotalValue.Visible = false; } this.ListOrderItemBy.Visible = false; this.LblGuest.Text = "Seat"; } this.ListOrderCount.Left = this.ListOrderItem.Left + this.ListOrderItem.ItemWidth; this.selectedBill = null; this.selectedItem = null; this.selectedType = null; if ((this.orderInfo != null) && (this.orderInfo.Bills != null)) { for (int i = 0; i < this.orderInfo.Bills.Length; i++) { if (this.orderInfo.Bills[i].CloseBillDate == AppParameter.MinDateTime) { this.selectedBill = this.orderInfo.Bills[i]; break; } } } this.LblPageID.Text = "Employee ID:" + ((MainForm) base.MdiParent).UserID + " | "; if (this.takeOutMode) { this.LblPageID.Text = this.LblPageID.Text + "STTO021"; } else { this.LblPageID.Text = this.LblPageID.Text + "STTO011"; } this.PanCustName.Visible = this.takeOutMode; this.BtnSearch.Visible = this.takeOutMode; this.OptionPad.AutoRefresh = false; this.OptionPad.Red = this.OptionPad.Green = this.OptionPad.Blue = 1f; this.OptionPad.AutoRefresh = true; this.ListOrderItem.Reset(); this.ListOrderCount.Reset(); this.ListOrderItemBy.Reset(); this.UpdateTableInformation(); this.StartInputMenu(); }
/// <summary> /// This methods use for show PrintReceiptForm. Print Receipt Form is form to print /// receipt and check bill form. All cases, take order and take out, use this form to /// check bill too. /// </summary> /// <param name="table">Table object for print receipt and check bill.</param> /// <param name="order">Order object for print receipt and check bill.</param> /// <param name="orderBill">Order Bill object for print receipt and check bill.</param> public void ShowPrintReceiptForm(TableInformation table, OrderInformation order, OrderBill orderBill) { if (table == null || order == null || orderBill == null) return; printReceiptForm.Table = table; printReceiptForm.Order = order; printReceiptForm.OrderBill = orderBill; if (userProfile != null) printReceiptForm.EmployeeID = userProfile.UserID; printReceiptForm.Show(); printReceiptForm.BringToFront(); printReceiptForm.UpdateForm(); }
public static OrderInformation CreateOrderObject(OrderInformation orderInfo, int employeeID, TableInformation tableInfo, int guestNumber, int billNumber) { if (orderInfo == null) { orderInfo = new OrderInformation(); orderInfo.OrderID = 0; orderInfo.OrderTime = DateTime.Now; orderInfo.TableID = tableInfo.TableID; orderInfo.EmployeeID = employeeID; orderInfo.NumberOfGuest = guestNumber; orderInfo.CloseOrderDate = AppParameter.MinDateTime; orderInfo.CreateDate = DateTime.Now; orderInfo.Bills = new OrderBill[billNumber]; for (int j = 0; j < billNumber; j++) { orderInfo.Bills[j] = new OrderBill(); orderInfo.Bills[j].CloseBillDate = AppParameter.MinDateTime; orderInfo.Bills[j].EmployeeID = employeeID; orderInfo.Bills[j].BillID = j + 1; } return orderInfo; } int billID = 0; OrderBill[] bills = orderInfo.Bills; orderInfo.Bills = new OrderBill[billNumber]; for (int i = 0; i < billNumber; i++) { if (i < bills.Length) { orderInfo.Bills[i] = bills[i]; billID = orderInfo.Bills[i].BillID; } else { orderInfo.Bills[i] = new OrderBill(); orderInfo.Bills[i].CloseBillDate = AppParameter.MinDateTime; orderInfo.Bills[i].EmployeeID = employeeID; orderInfo.Bills[i].BillID = ++billID; } } return orderInfo; }
public string SendOrder(OrderInformation orderInfo, string CustFullName) { object[] results = this.Invoke("SendOrder", new object[] { orderInfo, CustFullName}); return ((string)(results[0])); }
/// <remarks/> public System.IAsyncResult BeginSendOrder(OrderInformation orderInfo, string CustFullName, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("SendOrder", new object[] { orderInfo, CustFullName}, callback, asyncState); }
/// <summary> /// If not found order object, create new order object. /// If found order object, allocate bills array. /// </summary> public static OrderInformation CreateOrderObject(OrderInformation orderInfo, int employeeID, TableInformation tableInfo, int guestNumber, int billNumber) { if (orderInfo == null) { // Create new order object orderInfo = new OrderInformation(); orderInfo.OrderID = 0; orderInfo.OrderTime = DateTime.Now; orderInfo.TableID = tableInfo.TableID;; orderInfo.EmployeeID = employeeID; orderInfo.NumberOfGuest = guestNumber; orderInfo.CloseOrderDate = DateTime.MinValue; orderInfo.CreateDate = DateTime.Now; // Allocate bills array orderInfo.Bills = new OrderBill[billNumber]; for (int i = 0;i < billNumber;i++) { orderInfo.Bills[i] = new OrderBill(); orderInfo.Bills[i].CloseBillDate = DateTime.MinValue; orderInfo.Bills[i].EmployeeID = employeeID; orderInfo.Bills[i].BillID = i + 1; } } else { int lastID = 0; // Reallocate bills array OrderBill[] oldBills = orderInfo.Bills; orderInfo.Bills = new OrderBill[billNumber]; for (int i = 0;i < billNumber;i++) { if (i < oldBills.Length) { orderInfo.Bills[i] = oldBills[i]; lastID = orderInfo.Bills[i].BillID; } else { orderInfo.Bills[i] = new OrderBill(); orderInfo.Bills[i].CloseBillDate = DateTime.MinValue; orderInfo.Bills[i].EmployeeID = employeeID; orderInfo.Bills[i].BillID = ++lastID; } } } return orderInfo; }