/// <summary>
 /// Cancel selected menu order item.
 /// If this item is new order, delete from list.
 /// If this item already print to kitchen, mark for cancel.
 /// </summary>
 /// <param name="item">Order bill item to cancel</param>
 /// <returns>true = success, false = fail</returns>
 public static bool CancelOrderBillItem(OrderBill selectedBill, OrderBillItem item, int employeeID)
 {
     if (selectedBill == null || selectedBill.CloseBillDate != DateTime.MinValue)
         return false;
     if (item.BillDetailID == 0)
     {
         // Case item is new order
         OrderBillItem[] oldItems = selectedBill.Items;
         if (oldItems != null && oldItems.Length > 1)
         {
             // Remove old item
             selectedBill.Items = new OrderBillItem[oldItems.Length - 1];
             int cnt = 0;
             for (int i = 0;i < oldItems.Length;i++)
             {
                 if (oldItems[i] != item)
                 {
                     selectedBill.Items[cnt] = oldItems[i];
                     cnt++;
                 }
             }
         }
         else
             selectedBill.Items = null;
     }
     else
     {
         // Case item already print to kitchen.
         item.CancelReasonID = Utils.CancelForm.Show("Select Cancel Reason");
         item.Status = 0; // Cancel status
         item.EmployeeID = employeeID;
         item.ChangeFlag = true;
     }
     return true;
 }
 /// <summary>
 /// Add Menu Item to Selected Bill by menu item.
 /// </summary>
 /// <param name="menu">Menu Item for insert to selected bill.</param>
 public static OrderBillItem AddOrderBillItem(OrderBill selectedBill, MenuService.MenuItem menu, int employeeID)
 {
     OrderBillItem item = new OrderBillItem();
     item.MenuID = menu.ID;
     item.Unit = 1;
     item.DefaultOption = true;
     item.Status = 1; // New Order Status
     item.EmployeeID = employeeID;
     item.ChangeFlag = true;
     if (AddOrderBillItem(selectedBill, item))
         return item;
     else
         return null;
 }
Пример #3
0
 // Methods
 public Receipt(int invoiceID)
 {
     this.selectedBill = null;
     this.totalReceive = 0.0;
     this.paymentMethod = null;
     this.paymentMethodList = new ArrayList();
     this.payValueList = new ArrayList();
     this.coupon = null;
     this.giftVoucher = null;
     this.useDiscount = new ArrayList();
     this.invoiceID = invoiceID;
     this.invoiceNote = string.Empty;
     this.LoadInvoice();
 }
Пример #4
0
 public static OrderBillItem AddOrderBillItem(OrderBill selectedBill, MenuItem menu, int employeeID)
 {
     OrderBillItem item = new OrderBillItem();
     item.MenuID = menu.ID;
     item.Unit = 1;
     item.DefaultOption = true;
     item.Status = 1;
     item.EmployeeID = employeeID;
     item.ServeTime = AppParameter.MinDateTime;
     item.ChangeFlag = true;
     if (AddOrderBillItem(selectedBill, item))
     {
         return item;
     }
     return null;
 }
 /// <summary>
 /// Add Menu Item to Selected Bill by order bill item.
 /// </summary>
 /// <param name="item">Order bill item for insert to selected bill.</param>
 /// <returns>true = success, false = fail</returns>
 public static bool AddOrderBillItem(OrderBill selectedBill, OrderBillItem item)
 {
     if (selectedBill == null || selectedBill.CloseBillDate != DateTime.MinValue)
         return false;
     OrderBillItem[] oldItems = selectedBill.Items;
     if (oldItems != null)
     {
         // Append new order
         selectedBill.Items = new OrderBillItem[oldItems.Length + 1];
         for (int i = 0;i < oldItems.Length;i++)
             selectedBill.Items[i] = oldItems[i];
     }
     else
         selectedBill.Items = new OrderBillItem[1];
     selectedBill.Items[selectedBill.Items.Length - 1] = item;
     return true;
 }
Пример #6
0
 // Methods
 public static bool AddOrderBillItem(OrderBill selectedBill, OrderBillItem item)
 {
     if ((selectedBill == null) || (selectedBill.CloseBillDate != AppParameter.MinDateTime))
     {
         return false;
     }
     OrderBillItem[] items = selectedBill.Items;
     if (items != null)
     {
         selectedBill.Items = new OrderBillItem[items.Length + 1];
         for (int i = 0; i < items.Length; i++)
         {
             selectedBill.Items[i] = items[i];
         }
     }
     else
     {
         selectedBill.Items = new OrderBillItem[1];
     }
     selectedBill.Items[selectedBill.Items.Length - 1] = item;
     return true;
 }
Пример #7
0
 public string SendOrderBill(OrderBill Bill)
 {
     object[] results = this.Invoke("SendOrderBill", new object[] {
                 Bill});
     return ((string)(results[0]));
 }
Пример #8
0
 /// <remarks/>
 public System.IAsyncResult BeginSendOrderBill(OrderBill Bill, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("SendOrderBill", new object[] {
                 Bill}, callback, asyncState);
 }
 /// <summary>
 /// This method use for user to select bill item list. This method will check for user
 /// click is bill item or order bill and will change selectedBill and selectedItem variable
 /// to.
 /// </summary>
 /// <param name="sender">Sender object</param>
 /// <param name="e">Event object</param>
 private void ListOrderItem_ItemClick(object sender, smartRestaurant.Controls.ItemsListEventArgs e)
 {
     StartInputNone();
     if (e.Item.Value is OrderBill)
     {
         selectedBill = (OrderBill)e.Item.Value;
         selectedItem = null;
         UpdateOrderGrid();
     }
     else if (e.Item.Value is OrderBillItem)
     {
         selectedItem = (OrderBillItem)e.Item.Value;
         for (int i = 0;i >= 0 && i < orderInfo.Bills.Length;i++)
         {
             if (orderInfo.Bills[i].Items != null)
             {
                 for (int j = 0;j < orderInfo.Bills[i].Items.Length;j++)
                     if (orderInfo.Bills[i].Items[j] == selectedItem)
                     {
                         selectedBill = orderInfo.Bills[i];
                         i = -2;
                         break;
                     }
             }
         }
         UpdateOrderGrid();
     }
 }
Пример #10
0
 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();
 }
Пример #11
0
 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>
        /// 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>
 /// 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();
 }
Пример #14
0
 public static bool CancelOrderBillItem(OrderBill selectedBill, OrderBillItem item, int employeeID)
 {
     if ((selectedBill == null) || (selectedBill.CloseBillDate != AppParameter.MinDateTime))
     {
         return false;
     }
     if (item.BillDetailID == 0)
     {
         OrderBillItem[] items = selectedBill.Items;
         if ((items != null) && (items.Length > 1))
         {
             selectedBill.Items = new OrderBillItem[items.Length - 1];
             int index = 0;
             for (int i = 0; i < items.Length; i++)
             {
                 if (items[i] != item)
                 {
                     selectedBill.Items[index] = items[i];
                     index++;
                 }
             }
         }
         else
         {
             selectedBill.Items = null;
         }
     }
     else
     {
         int num3 = CancelForm.Show("Select Cancel Reason");
         if (num3 < 0)
         {
             return false;
         }
         item.CancelReasonID = num3;
         item.Status = 0;
         item.EmployeeID = employeeID;
         item.ChangeFlag = true;
     }
     return true;
 }
Пример #15
0
 public static bool MoveOrderBillItem(OrderBill sourceBill, OrderBill destBill, OrderBillItem item)
 {
     if (((sourceBill == null) || (sourceBill.CloseBillDate != AppParameter.MinDateTime)) || ((destBill == null) || (destBill.CloseBillDate != AppParameter.MinDateTime)))
     {
         return false;
     }
     OrderBillItem[] items = destBill.Items;
     if (items != null)
     {
         destBill.Items = new OrderBillItem[items.Length + 1];
         for (int i = 0; i < items.Length; i++)
         {
             destBill.Items[i] = items[i];
         }
     }
     else
     {
         destBill.Items = new OrderBillItem[1];
     }
     destBill.Items[destBill.Items.Length - 1] = item;
     items = sourceBill.Items;
     if ((items != null) && (items.Length > 1))
     {
         sourceBill.Items = new OrderBillItem[items.Length - 1];
         int index = 0;
         for (int j = 0; j < items.Length; j++)
         {
             if (items[j] != item)
             {
                 sourceBill.Items[index] = items[j];
                 index++;
             }
         }
     }
     else
     {
         sourceBill.Items = null;
     }
     return true;
 }
 private void ListOrderItem_ItemClick(object sender, smartRestaurant.Controls.ItemsListEventArgs e)
 {
     OrderBill bill = null;
     OrderBillItem item = null;
     // Check for move item
     if (moveItem)
     {
         bill = selectedBill;
         item = selectedItem;
     }
     // Check for selected item and selected bill
     if (e.Item.Value is OrderBill)
     {
         selectedBill = (OrderBill)e.Item.Value;
         selectedItem = null;
         StartInputMenu();
     }
     else if (e.Item.Value is OrderBillItem)
     {
         selectedItem = (OrderBillItem)e.Item.Value;
         for (int i = 0;i >= 0 && i < orderInfo.Bills.Length;i++)
         {
             if (orderInfo.Bills[i].Items != null)
             {
                 for (int j = 0;j < orderInfo.Bills[i].Items.Length;j++)
                     if (orderInfo.Bills[i].Items[j] == selectedItem)
                     {
                         selectedBill = orderInfo.Bills[i];
                         i = -2;
                         break;
                     }
             }
         }
         if (selectedBill.CloseBillDate != DateTime.MinValue)
             StartInputMenu();
         else
             StartInputOption();
     }
     // Move item
     if (item != null)
     {
         if (bill != selectedBill)
         {
             if (OrderManagement.MoveOrderBillItem(bill, selectedBill, item))
             {
                 isChanged = true;
                 UpdateOrderGrid();
             }
         }
         else
             UpdateOrderGrid();
     }
 }
 /// <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();
 }
Пример #18
0
 private void ListOrderItem_ItemClick(object sender, ItemsListEventArgs e)
 {
     this.StartInputNone();
     if (e.Item.Value is OrderBill)
     {
         this.selectedBill = (OrderBill) e.Item.Value;
         this.selectedItem = null;
         this.UpdateOrderGrid();
     }
     else if (e.Item.Value is OrderBillItem)
     {
         this.selectedItem = (OrderBillItem) e.Item.Value;
         for (int i = 0; (i >= 0) && (i < this.orderInfo.Bills.Length); i++)
         {
             if (this.orderInfo.Bills[i].Items != null)
             {
                 for (int j = 0; j < this.orderInfo.Bills[i].Items.Length; j++)
                 {
                     if (this.orderInfo.Bills[i].Items[j] == this.selectedItem)
                     {
                         this.selectedBill = this.orderInfo.Bills[i];
                         i = -2;
                         break;
                     }
                 }
             }
         }
         this.UpdateOrderGrid();
     }
 }
Пример #19
0
 private void ListOrderItem_ItemClick(object sender, ItemsListEventArgs e)
 {
     OrderBill sourceBill = null;
     OrderBillItem selectedItem = null;
     if (this.moveItem)
     {
         sourceBill = this.selectedBill;
         selectedItem = this.selectedItem;
     }
     if (e.Item.Value is OrderBill)
     {
         this.selectedBill = (OrderBill) e.Item.Value;
         this.selectedItem = null;
         this.StartInputMenu();
     }
     else if (e.Item.Value is OrderBillItem)
     {
         this.selectedItem = (OrderBillItem) e.Item.Value;
         for (int i = 0; (i >= 0) && (i < this.orderInfo.Bills.Length); i++)
         {
             if (this.orderInfo.Bills[i].Items != null)
             {
                 for (int j = 0; j < this.orderInfo.Bills[i].Items.Length; j++)
                 {
                     if (this.orderInfo.Bills[i].Items[j] == this.selectedItem)
                     {
                         this.selectedBill = this.orderInfo.Bills[i];
                         i = -2;
                         break;
                     }
                 }
             }
         }
         if (this.selectedBill.CloseBillDate != AppParameter.MinDateTime)
         {
             this.StartInputMenu();
         }
         else
         {
             this.StartInputOption();
         }
     }
     if (selectedItem != null)
     {
         if (sourceBill != this.selectedBill)
         {
             if (OrderManagement.MoveOrderBillItem(sourceBill, this.selectedBill, selectedItem))
             {
                 this.isChanged = true;
                 this.UpdateOrderGrid();
             }
         }
         else
         {
             this.UpdateOrderGrid();
         }
     }
 }
 /// <summary>
 /// Move Menu Item to Selected Bill.
 /// </summary>
 /// <param name="item">Order bill item for move.</param>
 /// <returns>true = success, false = fail</returns>
 public static bool MoveOrderBillItem(OrderBill sourceBill, OrderBill destBill, OrderBillItem item)
 {
     if (sourceBill == null || sourceBill.CloseBillDate != DateTime.MinValue ||
         destBill == null || destBill.CloseBillDate != DateTime.MinValue)
         return false;
     // Append order
     OrderBillItem[] oldItems = destBill.Items;
     if (oldItems != null)
     {
         destBill.Items = new OrderBillItem[oldItems.Length + 1];
         for (int i = 0;i < oldItems.Length;i++)
             destBill.Items[i] = oldItems[i];
     }
     else
         destBill.Items = new OrderBillItem[1];
     destBill.Items[destBill.Items.Length - 1] = item;
     // Remove old item
     oldItems = sourceBill.Items;
     if (oldItems != null && oldItems.Length > 1)
     {
         sourceBill.Items = new OrderBillItem[oldItems.Length - 1];
         int cnt = 0;
         for (int i = 0;i < oldItems.Length;i++)
         {
             if (oldItems[i] != item)
             {
                 sourceBill.Items[cnt] = oldItems[i];
                 cnt++;
             }
         }
     }
     else
         sourceBill.Items = null;
     return true;
 }