private void SaveBeforePrintReceipt()
 {
     OrderService.OrderService service = new OrderService.OrderService();
     string result;
     if (!takeOutMode)
     {
         result = service.SendOrderPrint(orderInfo, null, false);
         int orderID = 0;
         try
         {
             orderID = int.Parse(result);
             service.SetTableReference(orderID, tableIDList);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
             orderID = 0;
         }
     }
     else
         result = service.SendOrderPrint(orderInfo, FieldCustName.Text, false);
 }
 private void BtnCancel_Click(object sender, System.EventArgs e)
 {
     if (selectedTakeOut == null)
     {
         MessageBox.Show("Please select order first.");
         return;
     }
     // Get bill from database
     OrderService.OrderService service = new OrderService.OrderService();
     OrderInformation orderInfo = service.GetOrderByOrderID(selectedTakeOut.OrderID);
     if (orderInfo == null)
     {
         MessageBox.Show("Can't load order information for this order.");
         return;
     }
     if (orderInfo.Bills == null || orderInfo.Bills.Length <= 0)
     {
         MessageBox.Show("No order item in this order.");
         return;
     }
     // Cancel Order
     OrderManagement.CancelOrder(orderInfo, employeeID);
     service.SendOrder(orderInfo, null);
     selectedTakeOut = null;
     UpdateTakeOutList();
     UpdateOrderButton();
 }
 private void BtnPay_Click(object sender, System.EventArgs e)
 {
     if (selectedTakeOut == null)
     {
         MessageBox.Show("Please select order first.");
         return;
     }
     // Get bill from database
     OrderService.OrderService service = new OrderService.OrderService();
     OrderInformation orderInfo = service.GetOrderByOrderID(selectedTakeOut.OrderID);
     if (orderInfo == null)
     {
         MessageBox.Show("Can't load order information for this order.");
         return;
     }
     if (orderInfo.Bills == null || orderInfo.Bills.Length <= 0)
     {
         MessageBox.Show("No order item in this order.");
         return;
     }
     // Go to print receipt page
     ((MainForm)MdiParent).ShowPrintReceiptForm(tableInfo, orderInfo, orderInfo.Bills[0]);
 }
 /// <summary>
 /// This method work when user select bill item and click Undo button.
 /// Undo command will process and receipt will compute new price.
 /// </summary>
 /// <param name="sender">Sender object</param>
 /// <param name="e">Event object</param>
 private void BtnUndo_Click(object sender, System.EventArgs e)
 {
     if (selectedItem != null)
     {
         OrderManagement.UndoCancelOrderBillItem(selectedItem, employeeID);
         UpdateOrderGrid();
         OrderService.OrderService service = new OrderService.OrderService();
         string msg = service.SendOrderBill(selectedBill);
         if (msg != null)
         {
             MessageBox.Show(this, msg);
             return;
         }
         UpdateSummary();
     }
 }
        private void UpdateTakeOutList()
        {
            StringBuilder sb = new StringBuilder();
            int takeOutCnt;
            DataItem data;

            ListOrderQueue.AutoRefresh = false;
            ListOrderQueue.Items.Clear();
            ListOrderQueue.SelectedIndex = -1;
            // Load Take Out List
            OrderService.OrderService service = new OrderService.OrderService();
            takeOutList = service.GetTakeOutList();
            if (takeOutList == null)
            {
                ListOrderQueue.AutoRefresh = true;
                return;
            }
            // Loop for all take out.
            for (takeOutCnt = 0;takeOutCnt < takeOutList.Length;takeOutCnt++)
            {
                // Add take out's customer name to grid.
                sb.Length = 0;
                sb.Append(takeOutList[takeOutCnt].CustInfo.FirstName);
                if (takeOutList[takeOutCnt].CustInfo.MiddleName != "")
                {
                    sb.Append(" ");
                    sb.Append(takeOutList[takeOutCnt].CustInfo.MiddleName);
                }
                if (takeOutList[takeOutCnt].CustInfo.LastName != "")
                {
                    sb.Append(" ");
                    sb.Append(takeOutList[takeOutCnt].CustInfo.LastName);
                }

                data = new DataItem(sb.ToString(), takeOutList[takeOutCnt], false);
                ListOrderQueue.Items.Add(data);
                // Selected Take Out
                if (selectedTakeOut == takeOutList[takeOutCnt])
                {
                    ListOrderQueue.SelectedIndex = ListOrderQueue.Items.Count - 1;
                }
            }
            ListOrderQueue.AutoRefresh = true;
            UpdateOrderButton();
        }
Example #6
0
 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);
         }
     }
 }
Example #7
0
 private void BtnPay_Click(object sender, EventArgs e)
 {
     if (this.selectedTakeOut == null)
     {
         MessageForm.Show("Pay", "Please select order first.");
     }
     else
     {
         OrderInformation orderByOrderID = new smartRestaurant.OrderService.OrderService().GetOrderByOrderID(this.selectedTakeOut.OrderID);
         if (orderByOrderID == null)
         {
             MessageBox.Show("Can't load order information for this order.");
         }
         else if ((orderByOrderID.Bills == null) || (orderByOrderID.Bills.Length <= 0))
         {
             MessageBox.Show("No order item in this order.");
         }
         else
         {
             ((MainForm) base.MdiParent).ShowPrintReceiptForm(this.tableInfo, orderByOrderID, orderByOrderID.Bills[0]);
         }
     }
 }
Example #8
0
 private void SaveBeforePrintReceipt()
 {
     string str;
     smartRestaurant.OrderService.OrderService service = new smartRestaurant.OrderService.OrderService();
     if (!this.takeOutMode)
     {
         str = service.SendOrderPrint(this.orderInfo, 0, null, false);
         int orderID = 0;
         try
         {
             orderID = int.Parse(str);
             service.SetTableReference(orderID, this.tableIDList);
         }
         catch (Exception exception)
         {
             MessageBox.Show(exception.ToString());
             orderID = 0;
         }
     }
     else
     {
         str = service.SendOrderPrint(this.orderInfo, this.takeOutCustID, this.FieldCustName.Text, false);
     }
 }
Example #9
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();
 }
Example #10
0
 private void BtnPrintReceipt_Click(object sender, EventArgs e)
 {
     smartRestaurant.OrderService.OrderService service = new smartRestaurant.OrderService.OrderService();
     WaitingForm.Show("Print Receipt");
     base.Enabled = false;
     string text = service.SendOrderBill(this.selectedBill);
     if (text != null)
     {
         base.Enabled = true;
         WaitingForm.HideForm();
         MessageBox.Show(this, text);
     }
     else
     {
         bool flag = this.receipt.SendInvoice(false, true);
         base.Enabled = true;
         WaitingForm.HideForm();
         if (flag && (this.orderInfo.TableID != 0))
         {
             ((MainForm) base.MdiParent).ShowTakeOrderForm(null);
         }
         else
         {
             ((MainForm) base.MdiParent).ShowMainMenuForm();
         }
     }
 }
Example #11
0
 private void BtnUndo_Click(object sender, EventArgs e)
 {
     if (this.selectedItem != null)
     {
         OrderManagement.UndoCancelOrderBillItem(this.selectedItem, this.employeeID);
         this.UpdateOrderGrid();
         string text = new smartRestaurant.OrderService.OrderService().SendOrderBill(this.selectedBill);
         if (text != null)
         {
             MessageBox.Show(this, text);
         }
         else
         {
             this.UpdateSummary();
         }
     }
 }
 /// <summary>
 /// This method works when user click at waiting list button. Will call
 /// OrderService.ServeWaitingOrder() to mark bill item to served status.
 /// </summary>
 /// <param name="sender">Sender object</param>
 /// <param name="e">Event object</param>
 private void BillItemPad_PadClick(object sender, smartRestaurant.Controls.ButtonListPadEventArgs e)
 {
     if (e.Value == null)
         return;
     int id = int.Parse(e.Value);
     OrderService.OrderService service = new OrderService.OrderService();
     if (id < 0)
     {
         // Order ID
         id = -id;
         orderWaiting = service.ServeWaitingOrder(id, 0);
     }
     else
     {
         // Bill Detail ID
         orderWaiting = service.ServeWaitingOrder(0, id);
     }
     UpdateWaitingList();
 }
        /*private void Table_Click(object sender, System.EventArgs e)
        {
            ImageButton btn = (ImageButton)sender;
            int tableValue = (int)btn.ObjectValue;

            if (tableValue < 0)
                tableValue = -tableValue;
            // Search table object by table id
            for (int i = 0;i < tableInfo.Length;i++)
            {
                if (tableInfo[i].TableID == tableValue)
                {
                    ((MainForm)MdiParent).ShowTakeOrderForm(tableInfo[i]);
                    return;
                }
            }
            // If not found in loop
            MessageForm.Show("Select Table", "Can't find table information.");
        }*/
        /// <summary>
        /// This method uses for initial status for MainMenuForm before use can use.<br/>
        /// In this method checks user group is manager/auditor or not to show manager button.
        /// And call OrderService.GetBillDetailWaitingList() to get all waiting list for show
        /// on waiting list button.
        /// </summary>
        public override void UpdateForm()
        {
            // Update Screen
            LblPageID.Text = "Employee ID:" + ((MainForm)MdiParent).UserID + " | STST010";
            if (AppParameter.IsDemo())
            {
                BtnManager.Visible = false;
                BtnReserve.Visible = true;
                TablePanel.Height = 544;
                TablePad.Row = 7;
            }
            else
            {
                BtnManager.Visible = ((MainForm)MdiParent).User.IsManager() || ((MainForm)MdiParent).User.IsAuditor();
                BtnReserve.Visible = false;
                TablePanel.Height = 264;
                LoadTableListStyle();
                waitingTop = waitingLeft = 0;
                // Get Order Waiting List from Service
                OrderService.OrderService service = new OrderService.OrderService();
                orderWaiting = service.GetBillDetailWaitingList();
                UpdateWaitingList();
            }
            AddTableButton();
            UpdateTableStatus();
        }
Example #14
0
 private void BillItemPad_PadClick(object sender, ButtonListPadEventArgs e)
 {
     if (e.ObjectValue != null)
     {
         int objectValue = (int) e.ObjectValue;
         smartRestaurant.OrderService.OrderService service = new smartRestaurant.OrderService.OrderService();
         if (objectValue < 0)
         {
             objectValue = -objectValue;
             this.orderWaiting = service.ServeWaitingOrder(objectValue, 0);
         }
         else
         {
             this.orderWaiting = service.ServeWaitingOrder(0, objectValue);
         }
         this.AddTableButton();
         this.UpdateWaitingList();
     }
 }
 /// <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();
 }
Example #16
0
 private void BtnPrintKitchen_Click(object sender, EventArgs e)
 {
     string str;
     smartRestaurant.OrderService.OrderService service = new smartRestaurant.OrderService.OrderService();
     WaitingForm.Show("Print to Kitchen");
     base.Enabled = false;
     if (!this.takeOutMode)
     {
         str = service.SendOrder(this.orderInfo, 0, null);
         int orderID = 0;
         try
         {
             orderID = int.Parse(str);
             service.SetTableReference(orderID, this.tableIDList);
         }
         catch (Exception exception)
         {
             MessageBox.Show(exception.ToString());
             orderID = 0;
         }
     }
     else
     {
         str = service.SendOrder(this.orderInfo, this.takeOutCustID, this.FieldCustName.Text);
     }
     base.Enabled = true;
     WaitingForm.HideForm();
     try
     {
         this.orderInfo.OrderID = int.Parse(str);
     }
     catch (Exception)
     {
         MessageBox.Show(str);
         return;
     }
     if (this.orderInfo.TableID > 0)
     {
         this.tabService.UpdateTableLockInuse(this.orderInfo.TableID, false);
     }
     ((MainForm) base.MdiParent).ShowMainMenuForm();
 }
 private void BtnPrintKitchen_Click(object sender, System.EventArgs e)
 {
     OrderService.OrderService service = new OrderService.OrderService();
     string result;
     WaitingForm.Show("Print to Kitchen");
     this.Enabled = false;
     if (!takeOutMode)
     {
         result = service.SendOrder(orderInfo, null);
         int orderID = 0;
         try
         {
             orderID = int.Parse(result);
             service.SetTableReference(orderID, tableIDList);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
             orderID = 0;
         }
     }
     else
         result = service.SendOrder(orderInfo, FieldCustName.Text);
     this.Enabled = true;
     WaitingForm.HideForm();
     try
     {
         orderInfo.OrderID = Int32.Parse(result);
     }
     catch (Exception)
     {
         MessageBox.Show(result);
         return;
     }
     ((MainForm)MdiParent).ShowMainMenuForm();
 }
        /// <summary>
        /// This method work when user click on PrintReceipt button. Thie method will
        /// send print receipt command and return user to TakeOrderForm or MainMenuForm if
        /// user come from TakeOrderForm or TakeOutForm by order.
        /// </summary>
        /// <param name="sender">Sender object</param>
        /// <param name="e">Event object</param>
        private void BtnPrintReceipt_Click(object sender, System.EventArgs e)
        {
            OrderService.OrderService service = new OrderService.OrderService();
            WaitingForm.Show("Print Receipt");
            this.Enabled = false;
            string msg = service.SendOrderBill(selectedBill);
            if (msg != null)
            {
                this.Enabled = true;
                WaitingForm.HideForm();
                MessageBox.Show(this, msg);
                return;
            }
            bool result = receipt.SendInvoice(false, true);
            this.Enabled = true;
            WaitingForm.HideForm();

            if (result && orderInfo.TableID != 0)
                ((MainForm)MdiParent).ShowTakeOrderForm((TableInformation)null);
            else
                ((MainForm)MdiParent).ShowMainMenuForm();
        }
Example #19
0
 public bool SendInvoice(bool closed, bool print)
 {
     smartRestaurant.CheckBillService.CheckBillService service = new smartRestaurant.CheckBillService.CheckBillService();
     Invoice invoice = this.CreateInvoice();
     if (!closed)
     {
         invoice.totalReceive = 0.0;
     }
     string s = service.SendInvoice(invoice);
     try
     {
         this.invoiceID = int.Parse(s);
     }
     catch (Exception)
     {
         MessageBox.Show(s);
         return true;
     }
     if (!closed && (this.invoiceID == -1))
     {
         return false;
     }
     if (print)
     {
         smartRestaurant.OrderService.OrderService service2 = new smartRestaurant.OrderService.OrderService();
         if (closed)
         {
             service2.PrintBill(invoice.orderBillID);
         }
         else
         {
             service2.PrintReceipt(invoice.orderBillID);
         }
     }
     if (this.invoiceID == -1)
     {
         return false;
     }
     return true;
 }
Example #20
0
 private void BtnCancel_Click(object sender, EventArgs e)
 {
     if (this.selectedTakeOut == null)
     {
         MessageForm.Show("Cancel", "Please select order first.");
     }
     else
     {
         smartRestaurant.OrderService.OrderService service = new smartRestaurant.OrderService.OrderService();
         OrderInformation orderByOrderID = service.GetOrderByOrderID(this.selectedTakeOut.OrderID);
         if (orderByOrderID == null)
         {
             MessageBox.Show("Can't load order information for this order.");
         }
         else if ((orderByOrderID.Bills == null) || (orderByOrderID.Bills.Length <= 0))
         {
             MessageBox.Show("No order item in this order.");
         }
         else if (OrderManagement.CancelOrder(orderByOrderID, this.employeeID))
         {
             service.SendOrder(orderByOrderID, 0, null);
             this.selectedTakeOut = null;
             this.UpdateTakeOutList();
             this.UpdateOrderButton();
         }
     }
 }