Exemplo n.º 1
0
        private void FixedAmountButton_Click(object sender, EventArgs e)
        {
            CPriceCalculatorForm tempPriceCalculator = new CPriceCalculatorForm("Set Charge", "Enter charge in exact amount");
            tempPriceCalculator.ShowDialog();

            if (CPriceCalculatorForm.inputResult.Equals("Cancel"))
                return;

            Double.TryParse(CPriceCalculatorForm.inputResult, out m_serviceChargeAmount);
            m_serviceChargeType = "Fixed";
        }
Exemplo n.º 2
0
        private void FixedAmountButton_Click(object sender, EventArgs e)
        {
            CPriceCalculatorForm tempPriceCalculator = new CPriceCalculatorForm("Set Discount", "Enter discount in exact amount");
            tempPriceCalculator.ShowDialog();

            if (CPriceCalculatorForm.inputResult.Equals("Cancel"))
                return;

            Double.TryParse(CPriceCalculatorForm.inputResult, out discountAmount);
            discountType = "Fixed";
            this.Close();
        }
Exemplo n.º 3
0
        private void vatbutton_Click(object sender, EventArgs e)
        {
            Double MainFoodTotal = PartyReservation.MainGuestAmount + PartyReservation.OtherGuestAmount + PartyReservation.UtilityCostAmount;
            CPriceCalculatorForm tempCalculatorForm1 = new CPriceCalculatorForm("Reservation", "Enter vat");
            tempCalculatorForm1.ShowDialog();

            if (CPriceCalculatorForm.inputResult.Equals("Cancel"))
                return;

            if (CPriceCalculatorForm.inputResult.Equals("0.000"))
            {
                CMessageBox tempMessageBox = new CMessageBox("Error!", "Vat cannot be zero.");
                tempMessageBox.ShowDialog();
                return;
            }

            double reservationvatpercent = Double.Parse(CPriceCalculatorForm.inputResult);
            double vat = 0;
            vat = (reservationvatpercent*MainFoodTotal)/100;
            PartyReservation.Vat= vat;
            vatlabel.Text = vat.ToString("F02");
            LoadTotalPayable();
        }
Exemplo n.º 4
0
        private void PriceTextBox_Click(object sender, EventArgs e)
        {
            ReferenceTextBox.Clear();
            ReferenceCheckBox.Checked = false;
            PriceTextBox.Clear();
            PriceCheckBox.Checked = false;
            TableNoTextBox.Clear();
            checkBox2.Checked = false;

            CPriceCalculatorForm tempCalculatorForm = new CPriceCalculatorForm("Price for Search", "Enter a Price");
            tempCalculatorForm.BackColor = Color.LightGray;
            tempCalculatorForm.InputNameLabel.ForeColor = Color.Black;
            tempCalculatorForm.InputTextBox.BackColor = Color.LightGray;
            tempCalculatorForm.InputTextBox.ForeColor = Color.Black;
            tempCalculatorForm.ShowDialog();

            if (CCalculatorForm.inputResult.Equals("Cancel"))
            {
                PriceTextBox.Text = "";
            }
            else
            {
                PriceTextBox.Text = CCalculatorForm.inputResult;
            }
        }
Exemplo n.º 5
0
        private void g_MiscButton_Click(object sender, EventArgs e)
        {
            try
            {
                CKeyBoardForm tempKeyBoardForm = new CKeyBoardForm("Misc Item", "Enter Item Name or Description", true);
                tempKeyBoardForm.ShowDialog();

                if (CKeyBoardForm.Content.Equals("Cancel"))
                    return;

                if (CKeyBoardForm.Content.Equals(""))
                {
                    CMessageBox tempMessageBox = new CMessageBox("Error!", "Item Name cannot be Empty");
                    tempMessageBox.ShowDialog();
                    return;
                }
                CPriceCalculatorForm tempCalculatorForm = new CPriceCalculatorForm("Misc Item", "Enter Price");
                tempCalculatorForm.ShowDialog();

                if (CPriceCalculatorForm.inputResult.Equals("Cancel"))
                    return;

                if (CPriceCalculatorForm.inputResult.Equals("0.000"))
                {
                    CMessageBox tempMessageBox = new CMessageBox("Error!", "Price cannot be zero.");
                    tempMessageBox.ShowDialog();
                    return;
                }
                  double price = Double.Parse(CPriceCalculatorForm.inputResult);
                //change by mithu

                        CPriceCalculatorForm tempCalculatorForm1 = new CPriceCalculatorForm("Misc Item", "Enter vat");
                     tempCalculatorForm1.ShowDialog();

                if (CPriceCalculatorForm.inputResult.Equals("Cancel"))
                    return;

                if (CPriceCalculatorForm.inputResult.Equals("0.000"))
                {
                    CMessageBox tempMessageBox = new CMessageBox("Error!", "Vat cannot be zero.");
                    tempMessageBox.ShowDialog();
                    return;
                }

                double addmisvat=Double.Parse(CPriceCalculatorForm.inputResult);

                try
                {
                    CCalculatorForm tempQtyCalculatorForm = new CCalculatorForm("Order Quantity", "Item Quantity");
                    tempQtyCalculatorForm.ShowDialog();

                    if (CCalculatorForm.inputResult.Equals("Cancel"))
                        return;

                    string str = CCalculatorForm.inputResult;
                    str = (str == "") ? "1" : str;

                    if (Int32.Parse(str) == 0)
                    {
                        CMessageBox tempMessageBox = new CMessageBox("Error", "Input invalid!");
                        tempMessageBox.ShowDialog();
                        return;
                    }

                    int tempOrderedQty = Int32.Parse(str);
                    m_iSavedOrderedQty = tempOrderedQty;

                }
                catch (Exception exp)
                {
                    MessageBox.Show(exp.Message, RMSGlobal.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                COrderManager tempOrderManager = new COrderManager();
                COrderDetails tempOrderDetails = new COrderDetails();
                DataGridView tempDataGridView = null;

                if (CKeyBoardForm.m_foodType == true) //If miscelleneous item is food
                {
                    tempDataGridView = g_FoodDataGridView;
                }
                else
                {
                    tempDataGridView = g_BeverageDataGridView;
                }

                int tempResult = FindExistingItem(tempDataGridView, CKeyBoardForm.Content);
                if (tempResult != -1)
                {
                    //update Order_details table
                    int tempRowIndex = tempResult;
                    tempDataGridView.Rows[tempRowIndex].Cells[1].Value = int.Parse(tempDataGridView.Rows[tempRowIndex].Cells[1].Value.ToString()) + m_iSavedOrderedQty;
                    tempOrderDetails.OrderDetailsID = Int64.Parse(tempDataGridView.Rows[tempRowIndex].Cells[7].Value.ToString());
                    tempOrderDetails.OrderID = orderID;
                    tempOrderDetails.ProductID = 0;
                    tempOrderDetails.CategoryLevel = 0;
                    tempOrderDetails.OrderRemarks = CKeyBoardForm.Content;
                    tempOrderDetails.Product_Name = CKeyBoardForm.Content;
                    tempOrderDetails.OrderQuantity = Int32.Parse(tempDataGridView.Rows[tempRowIndex].Cells[1].Value.ToString());
                    tempOrderDetails.OrderAmount = tempOrderDetails.OrderQuantity*price;
                    tempOrderDetails.VatTotal = (addmisvat*tempOrderDetails.OrderAmount)/100.0;
                    tempOrderDetails.Amount_with_vat = tempOrderDetails.OrderAmount + tempOrderDetails.VatTotal;
                    tempOrderDetails.OrderFoodType = "Food";
                    tempOrderDetails.ItemOrderTime = DateTime.Now.Ticks;

                    tempDataGridView.Rows[tempRowIndex].Cells[2].Value = tempOrderDetails.VatTotal.ToString("F02");
                    tempDataGridView.Rows[tempRowIndex].Cells[3].Value = tempOrderDetails.OrderAmount.ToString("F02");

                    tempOrderManager.UpdateOrderDetails(tempOrderDetails);
                }
                else
                {
                    //Insert into Order_details table
                    tempOrderDetails.OrderID = orderID;
                    tempOrderDetails.ProductID = 0;
                    tempOrderDetails.CategoryLevel = 0;
                    tempOrderDetails.OrderRemarks = CKeyBoardForm.Content;
                    tempOrderDetails.Product_Name = CKeyBoardForm.Content;
                    tempOrderDetails.OrderQuantity = m_iSavedOrderedQty;
                    tempOrderDetails.ItemOrderTime = DateTime.Now.Ticks;
                    tempOrderDetails.OrderAmount = tempOrderDetails.OrderQuantity*price;
                    tempOrderDetails.VatTotal = (addmisvat * tempOrderDetails.OrderAmount) / 100.0;
                    tempOrderDetails.Amount_with_vat = tempOrderDetails.OrderAmount + tempOrderDetails.VatTotal;

                    if (CKeyBoardForm.m_foodType == true)
                    {
                        tempOrderDetails.OrderFoodType = "Food";
                    }
                    else
                    {
                        tempOrderDetails.OrderFoodType = "Nonfood";
                    }

                    if (m_orderUserName.Replace(" ", "").ToUpper() != "Web User".Replace(" ", "").ToUpper())
                    {
                        tempOrderDetails = (COrderDetails)tempOrderManager.InsertOrderDetails(tempOrderDetails).Data;
                        string[] tempDataGridViewRow = new string[]
                                { CKeyBoardForm.Content,
                                  m_iSavedOrderedQty.ToString(),
                                  tempOrderDetails.VatTotal.ToString("F02"),
                                  tempOrderDetails.OrderAmount.ToString("F02"),
                                  "0",
                                  "0",
                                  Int64.MaxValue-1+"",
                                  tempOrderDetails.OrderDetailsID.ToString(),"0" //0 for printed item quantity
                                };
                        tempDataGridView.Rows.Add(tempDataGridViewRow);
                    }
                    else
                    {
                        tempOrderDetails.ItemName = CKeyBoardForm.Content;
                        tempOrderDetails = (COrderDetails)tempOrderManager.InsertOnlineOrderDetails(tempOrderDetails).Data;

                        string[] tempDataGridViewRow = new string[]
                                { CKeyBoardForm.Content,
                                  m_iSavedOrderedQty.ToString(),
                                   tempOrderDetails.VatTotal.ToString("F02"),
                                  tempOrderDetails.OrderAmount.ToString("F02"),
                                  "0",
                                  "0",
                                  tempOrderDetails.OnlineItemSequenceNumber.ToString(),
                                  tempOrderDetails.OrderDetailsID.ToString(),"0" //0 for printed item quantity
                                };
                        tempDataGridView.Rows.Add(tempDataGridViewRow);
                    }
                }

                if (m_orderUserName.Replace(" ", "").ToUpper() != "Web User".Replace(" ", "").ToUpper()) //Rank is applicable only for local order only
                {
                    this.ConvertRank();
                }

                tempDataGridView.Sort(tempDataGridView.Columns[5], ListSortDirection.Ascending);
                tempDataGridView.Update();
                TotalAmountCalculation();
                m_iSavedOrderedQty = 1;
                g_FoodDataGridView.ClearSelection();
                g_BeverageDataGridView.ClearSelection();
            }
            catch (Exception exp)
            {
                Console.Write(exp.Message);
            }
        }
Exemplo n.º 6
0
        private void g_MiscButton_Click(object sender, EventArgs e)
        {
            try
            {
                CKeyBoardForm tempKeyBoardForm = new CKeyBoardForm("Misc Item", "Enter Item Name or Description");
                tempKeyBoardForm.ShowDialog();

                if (CKeyBoardForm.Content.Equals("Cancel"))
                    return;

                if (CKeyBoardForm.Content.Equals(""))
                {
                    CMessageBox tempMessageBox = new CMessageBox("Error!", "Item Name cannot be Empty");
                    tempMessageBox.ShowDialog();
                    return;
                }
                CPriceCalculatorForm tempCalculatorForm = new CPriceCalculatorForm("Misc Item", "Enter Price");
                tempCalculatorForm.ShowDialog();

                if (CPriceCalculatorForm.inputResult.Equals("Cancel"))
                    return;

                if (CPriceCalculatorForm.inputResult.Equals("0.000"))
                {
                    CMessageBox tempMessageBox = new CMessageBox("Error!", "Price cannot be zero.");
                    tempMessageBox.ShowDialog();
                    return;
                }

                NewOrder();

                COrderManager tempOrderManager = new COrderManager();
                COrderDetails tempOrderDetails = new COrderDetails();
                DataGridView tempDataGridView = g_FoodDataGridView;

                int tempResult = DataGridViewSearch(tempDataGridView, CKeyBoardForm.Content);
                if (tempResult != -1)
                {
                    //update Order_details table
                    int tempRowIndex = tempResult;
                    tempDataGridView.Rows[tempRowIndex].Cells[1].Value = int.Parse(tempDataGridView.Rows[tempRowIndex].Cells[1].Value.ToString()) + m_iSavedOrderedQty;
                    tempOrderDetails.OrderDetailsID = Int64.Parse(tempDataGridView.Rows[tempRowIndex].Cells[6].Value.ToString());
                    tempOrderDetails.OrderID = orderID;
                    tempOrderDetails.ProductID = 0;
                    tempOrderDetails.CategoryLevel = 0;
                    tempOrderDetails.OrderRemarks = CKeyBoardForm.Content;
                    tempOrderDetails.OrderQuantity = Int32.Parse(tempDataGridView.Rows[tempRowIndex].Cells[1].Value.ToString());
                    tempOrderDetails.OrderAmount = tempOrderDetails.OrderQuantity * Double.Parse(CPriceCalculatorForm.inputResult);
                    tempOrderDetails.OrderFoodType = "Nonfood";
                    tempOrderManager.UpdateOrderDetails(tempOrderDetails);
                }
                else
                {
                    //Insert into Order_details table
                    tempOrderDetails.OrderID = orderID;
                    tempOrderDetails.ProductID = 0;
                    tempOrderDetails.CategoryLevel = 0;
                    tempOrderDetails.OrderRemarks = CKeyBoardForm.Content;
                    tempOrderDetails.OrderQuantity = m_iSavedOrderedQty;
                    tempOrderDetails.OrderAmount = tempOrderDetails.OrderQuantity * Double.Parse(CPriceCalculatorForm.inputResult);
                    tempOrderDetails.OrderFoodType = "Nonfood";
                    tempOrderDetails = (COrderDetails)tempOrderManager.InsertOrderDetails(tempOrderDetails).Data;

                    string[] tempDataGridViewRow = new string[]
                                { CKeyBoardForm.Content,
                                  m_iSavedOrderedQty.ToString(),
                                  CPriceCalculatorForm.inputResult,
                                  "0",
                                  "0",
                                  (Int64.MaxValue-1)+"",
                                  tempOrderDetails.OrderDetailsID.ToString()
                                };

                    tempDataGridView.Rows.Add(tempDataGridViewRow);

                }
                ConvertRank();
                tempDataGridView.Sort(tempDataGridView.Columns[5], ListSortDirection.Ascending);
                tempDataGridView.Update();
                TotalAmountCalculation();
                m_iSavedOrderedQty = 1;
                g_FoodDataGridView.ClearSelection();
            }
            catch (Exception eee)
            {
            }
        }
Exemplo n.º 7
0
        private void tipsfunctionalButton_Click(object sender, EventArgs e)
        {
            CPriceCalculatorForm tempCalculatorForm = new CPriceCalculatorForm("Misc Item", "Enter Price");
            tempCalculatorForm.ShowDialog();

            if (CPriceCalculatorForm.inputResult.Equals("Cancel"))
                return;

            if (CPriceCalculatorForm.inputResult.Equals("0.000"))
            {
                CMessageBox tempMessageBox = new CMessageBox("Error!", "Price cannot be zero.");
                tempMessageBox.ShowDialog();
                return;
            }
            Double totalpayable = Double.Parse(g_BillTotalLabel.Text.Substring(Program.currency.Length));
            totalpayable = totalpayable - tipsamount;
            double price = Double.Parse(CPriceCalculatorForm.inputResult);
            tipsamount = price;

            totalpayable = totalpayable + price;
            m_dBalance = totalpayable;
            g_BillTotalLabel.Text = Program.currency + totalpayable.ToString("F02");
            g_BalaceLabel.Text = String.Format("Balace Due {0}" + (totalpayable.ToString("F02")), Program.currency);
        }