Example #1
0
        public void PopulateUnlockTableDataGridView()
        {
            try
            {
                COrderManager tempUnlockTableManager = new COrderManager();
                List<CTransferOrderShow> tempOrderShowList = new List<CTransferOrderShow>();
                tempOrderShowList = (List<CTransferOrderShow>)tempUnlockTableManager.AvailableTableForUnlock().Data;

                if (tempOrderShowList != null)
                {
                    CTransferOrderShow[] tempOrderShowArray = tempOrderShowList.ToArray();
                    UnlockTableDataGridView.RowCount = tempOrderShowArray.Length;
                    UnlockTableDataGridView.AllowUserToResizeRows = false;
                    UnlockTableDataGridView.Rows.Clear();

                    for (int arrayIndex = 0; arrayIndex < tempOrderShowArray.Length; arrayIndex++)
                    {
                        int sl = arrayIndex + 1;
                        String[] tempString ={ sl.ToString(), tempOrderShowArray[arrayIndex].OrderType, tempOrderShowArray[arrayIndex].TableNumber.ToString(), tempOrderShowArray[arrayIndex].CustomerName, "Unlock", tempOrderShowArray[arrayIndex].OrderID.ToString() };
                        UnlockTableDataGridView.Rows.Add(tempString);
                    }
                }
                if (UnlockTableDataGridView.RowCount < 16) UnlockTableDataGridView.RowCount = 16;
            }
            catch (Exception ex)
            {
            }
        }
Example #2
0
        public void PopulateMergeTableDataGridView()
        {
            try
            {
                COrderManager tempMergeTableManager = new COrderManager();
                List<CTransferOrderShow> inOrderShowList = new List<CTransferOrderShow>();
                inOrderShowList = (List<CTransferOrderShow>)tempMergeTableManager.OrderListForTransfer(true).Data;// Changed here

                if (inOrderShowList != null)
                {
                    CTransferOrderShow[] tempOrderShowArray = inOrderShowList.ToArray();
                    if (tempOrderShowArray.Length > 0) MergeTableDataGridView.RowCount = tempOrderShowArray.Length;
                    MergeTableDataGridView.AllowUserToResizeRows = false;
                    MergeTableDataGridView.AllowUserToAddRows = false;
                    MergeTableDataGridView.Rows.Clear();

                    for (int arrayIndex = 0; arrayIndex < tempOrderShowArray.Length; arrayIndex++)
                    {
                        String[] tempString ={ tempOrderShowArray[arrayIndex].OrderID.ToString(), tempOrderShowArray[arrayIndex].OrderType.ToString(), tempOrderShowArray[arrayIndex].TableNumber.ToString(), tempOrderShowArray[arrayIndex].GuestCount.ToString(), false.ToString() };
                        MergeTableDataGridView.Rows.Add(tempString);
                    }
                }
               // if (MergeTableDataGridView.RowCount < 17) MergeTableDataGridView.RowCount = 17;
            }
            catch (Exception ex)
            {
            }
        }
Example #3
0
        public void PopulateVoidTableDataGridView()
        {
            try
            {
                COrderManager tempVoidTableManager = new COrderManager();
                List<CTransferOrderShow> tempOrderShowList = new List<CTransferOrderShow>();
                tempOrderShowList = (List<CTransferOrderShow>)tempVoidTableManager.AvailableTableForVoid().Data;

                if (tempOrderShowList != null)
                {
                    CTransferOrderShow[] tempOrderShowArray = tempOrderShowList.ToArray();
                    VoidTableDataGridView.RowCount = tempOrderShowArray.Length;
                    VoidTableDataGridView.AllowUserToResizeRows = false;
                    VoidTableDataGridView.Rows.Clear();

                    for (int rowCounter = 0; rowCounter < tempOrderShowArray.Length; rowCounter++)
                    {
                        int sl = rowCounter + 1;
                        String[] tempString ={ sl.ToString(), tempOrderShowArray[rowCounter].OrderType, tempOrderShowArray[rowCounter].TableNumber.ToString(), tempOrderShowArray[rowCounter].CustomerName, "Void", tempOrderShowArray[rowCounter].OrderID.ToString() };
                        VoidTableDataGridView.Rows.Add(tempString);
                    }
                }
                if (VoidTableDataGridView.RowCount < 16) VoidTableDataGridView.RowCount = 16;
            }
            catch (Exception exp)
            {
                throw exp;
            }
        }
Example #4
0
        public CTableInfoMessageBox(Int64 inOrderID)
        {
            InitializeComponent();

            COrderManager tempOrderManager = new COrderManager();
            CResult oResult = tempOrderManager.OrderInfoByOrderID(inOrderID);
            COrderInfo oOrderInfo = new COrderInfo();
            if (oResult.IsSuccess && oResult.Data != null)
            {
                oOrderInfo=(COrderInfo)oResult.Data;
            }

            COrderSeatTime oOrderSeatTime = new COrderSeatTime();
            oResult = tempOrderManager.OrderSeatTimeByOrderID(inOrderID);
            if (oResult.IsSuccess && oResult.Data != null)
            {
                oOrderSeatTime = (COrderSeatTime)oResult.Data;
            }

            g_SeatedTimeLabel.Text = oOrderSeatTime.SeatTime.ToLongTimeString();
            if (oOrderInfo.Status.Equals("Seated"))
            {

            }

            g_TableNumberLabel.Text = oOrderInfo.TableNumber.ToString();
            g_GuestQuantityLabel.Text = oOrderInfo.GuestCount.ToString();

            if (oOrderInfo.Status.Equals("Ordered") || oOrderInfo.Status.Equals("Billed"))
            {
                g_OrderedTimeCaptionLabel.Visible = true;
                g_OrderedTimeLabel.Visible = true;
                g_OrderedTimeLabel.Text = oOrderInfo.OrderTime.ToLongTimeString();
            }
        }
Example #5
0
        public void LocalInstalledPrint(CPrintingFormat inPrintRequest)
        {
            KitchenPrintForm tempForm = new KitchenPrintForm();

            //LocalReport tempReport = new LocalReport();
            //tempForm.reportViewer1.LocalReport.ReportEmbeddedResource = "RMS.TableOrder.KitchenReport.rdlc";
            //LocalReport tempReport = tempForm.reportViewer1.LocalReport;
            //  tempReport.ReportPath = @"..\..\TableOrder\KitchenReport.rdlc";
            KitchenPrintDataSet tempDataSet = new KitchenPrintDataSet();
            tempDataSet.Items.Merge(inPrintRequest.KDataTable);
            //tempDataSet.Items.Merge(DataGridViewToDataTable(g_FoodDataGridView));
            //tempDataSet.Items.Merge(DataGridViewToDataTable(g_BeverageDataGridView));
            //tempForm.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("Items", tempDataSet.Items));
            tempForm.ItemsBindingSource.DataSource = tempDataSet;
            ReportParameter[] paramList = new ReportParameter[3];
            COrderManager tempOrderManager = new COrderManager();
            COrderInfo tempOrderInfo = new COrderInfo();
            CResult oResult = tempOrderManager.OrderInfoByOrderID(inPrintRequest.OrderID);
            if (oResult.IsSuccess && oResult.Data != null)
            {
                tempOrderInfo = (COrderInfo)oResult.Data;
            }
            paramList[0] = new ReportParameter("TableNumber", tempOrderInfo.TableNumber.ToString());
            paramList[1] = new ReportParameter("Header", "IBACS RMS");
            paramList[2] = new ReportParameter("Footer", "Please Come Again.");
            //tempReport.SetParameters(paramList);
            tempForm.reportViewer1.LocalReport.SetParameters(paramList);

            CCommonConstants oCommonConstants = ConfigManager.GetConfig<CCommonConstants>();
            CPrintMethods oPrintMethod = new CPrintMethods();
            oPrintMethod.NetworkPrint(tempForm.reportViewer1.LocalReport, oCommonConstants.LocalPrinterName);
            tempForm.reportViewer1.RefreshReport();
            tempForm.Show();
        }
Example #6
0
        private void ShowKitchenText()
        {
            COrderManager tempOrderManager = new COrderManager();
            CResult objKitchenText = tempOrderManager.GetKitchenTextByOrderID(m_orderID);
            List<OrderLogInformation> tempOrderLogInfoList = new List<OrderLogInformation>();
            tempOrderLogInfoList = (List<OrderLogInformation>)objKitchenText.Data;
            string kitchenTextatKitchen = "";
            string kitchennotatKitchen = "";

            for (int recordCounter = 0; recordCounter < tempOrderLogInfoList.Count; recordCounter++)
            {
                if (tempOrderLogInfoList[recordCounter].KitchenTextPrintStatus > 0)
                {
                    kitchenTextatKitchen += "=> " + tempOrderLogInfoList[recordCounter].KitchenText + "\r\n";
                }
                else
                {
                    kitchennotatKitchen += "=> " + tempOrderLogInfoList[recordCounter].KitchenText + "\r\n";
                }
            }

            if (kitchennotatKitchen.Length > 0)
            {
                txtKitchenText.Text = kitchennotatKitchen;
                lblKitchen.Visible = true;
            }
            if (kitchenTextatKitchen.Length > 0)
            {
                txtKitchenTextSent.Text = kitchenTextatKitchen;
                lblKitchenTextSent.Visible = true;
            }
        }
Example #7
0
        public void UnlockTableDataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (UnlockTableDataGridView.Columns[e.ColumnIndex].Name == "ActionButtonColumn" && e.RowIndex >= 0 && UnlockTableDataGridView.Rows[e.RowIndex].Cells["OrderIDColumn"].Value != null)
                {
                    DialogResult tempDialogResult = MessageBox.Show("Are you sure you want to unlock?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                    if (tempDialogResult.Equals(DialogResult.No)) return;
                    else
                    {
                        String tempOldOrderID = UnlockTableDataGridView.Rows[e.RowIndex].Cells["OrderIDColumn"].Value.ToString();
                        Int64 tempOldTableNumber = Int64.Parse(UnlockTableDataGridView.Rows[e.RowIndex].Cells["TableNumberColumn"].Value.ToString());
                        String tempOldTableType = UnlockTableDataGridView.Rows[e.RowIndex].Cells["TableTypeColumn"].Value.ToString();

                        COrderManager tempUnlockTableManager = new COrderManager();
                        CResult tempResult = tempUnlockTableManager.UpdateForUnlockTable(tempOldTableNumber, tempOldTableType);
                        if (tempResult.IsSuccess)
                        {
                            this.PopulateUnlockTableDataGridView();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
Example #8
0
        private void btnEditCustomer_Click(object sender, EventArgs e)
        {
            //For modifying the customer information
            COrderManager tempOrderManager = new COrderManager();
            CResult objCresult = new CResult();
            objCresult = tempOrderManager.OrderInfoByOrderID(m_orderID);

            CDelivery objDeliveryTime = new CDelivery(); //Collecting the delivery information of the order
            objDeliveryTime.DeliveryOrderID = m_orderID;
            CResult objDeliveryInfo = tempOrderManager.GetDeliveryInfo(objDeliveryTime);
            objDeliveryTime = (CDelivery)objDeliveryInfo.Data;

            COrderInfo tempOrderInfo = (COrderInfo)objCresult.Data;
            CTakeAwayForm objTakeawayFrm = new CTakeAwayForm(m_orderID, objDeliveryTime, tempOrderInfo.Status, true);
            objTakeawayFrm.Show();
            CFormManager.Forms.Push(m_previousForm);
            this.Hide();
        }
Example #9
0
        public CMultipleSplitForm(Int64 inOrderID, Double inTotalAmount, Double inSerrvice, Double inDiscount, Double vat, String inTableType, DataTable inItemList, string userName, string terminalName)
        {
            InitializeComponent();
            lblGuestbillText.Text = "";
            orderID = inOrderID;
            totalAmount = inTotalAmount;
            discount = inDiscount;
            serviceCharge = inSerrvice;
            totalVatAmount = vat;
            tableType = inTableType;
            dtItemList = inItemList;
            this.userName = userName;
            this.terminalName = terminalName;

            COrderManager tempOrderManager = new COrderManager();
            tempOrderInfo = (COrderInfo)tempOrderManager.OrderInfoByOrderID(orderID).Data;

            stringPrintFormater = new StringPrintFormater(37);
        }
Example #10
0
        private void AddItemVoidReport()
        {
            COrderManager tempOrderManager = new COrderManager();
            CResult oResult = tempOrderManager.OrderInfoByOrderID(m_orderID);
            COrderInfo tempOrderInfo = new COrderInfo();

            if (oResult.IsSuccess && oResult.Data != null)
            {
                tempOrderInfo = (COrderInfo)oResult.Data;
            }

            ItemVoid aItemVoid=new ItemVoid();
            aItemVoid.OrderId = (int)m_orderID;
            aItemVoid.Creator_Id = tempOrderInfo.UserID;
            aItemVoid.RemoverId = RMS.RMSGlobal.m_iLoginUserID;
            ReasonForm aReasonForm = new ReasonForm();
            aReasonForm.ShowDialog();
            aItemVoid.Reason = aReasonForm.reason;
            aItemVoid.VoidDate = DateTime.Now;

            foreach (ListViewItem lsvItem in lsvRemovable.Items)
            {

                try
                {
                    aItemVoid.Quantity = Convert.ToDouble(lsvItem.SubItems[1].Text);
                    aItemVoid.ItemName = lsvItem.SubItems[0].Text;

                    int id = Convert.ToInt32(lsvItem.SubItems[3].Text);
                    CCategory3 aCategory3 = new CCategory3();
                    CCategory3DAO aCategory3Dao = new CCategory3DAO();
                    aCategory3 = aCategory3Dao.GetAllCategory3ByCategory3ID(id);
                    aItemVoid.Amount = aItemVoid.Quantity * aCategory3.Category3TablePrice;
                    OrderVoidDAO aOrderVoidDao = new OrderVoidDAO();
                    aOrderVoidDao.InsertItemForVoid(aItemVoid);
                }
                catch (Exception)
                {

                }

            }
        }
Example #11
0
        private void FillBasciInfo()
        {
            COrderManager tempOrderManager = new COrderManager();
            CResult oResult = tempOrderManager.OrderInfoByOrderID(m_orderID);
            COrderInfo oOrderInfo = new COrderInfo();
            if (oResult.IsSuccess && oResult.Data != null)
            {
                oOrderInfo = (COrderInfo)oResult.Data;
            }

            COrderSeatTime oOrderSeatTime = new COrderSeatTime();
            oResult = tempOrderManager.OrderSeatTimeByOrderID(m_orderID);
            if (oResult.IsSuccess && oResult.Data != null)
            {
                oOrderSeatTime = (COrderSeatTime)oResult.Data;
            }

            lblSeatTime.Text = oOrderSeatTime.SeatTime.ToString("hh:mm tt");

            lblTableNumber.Text = oOrderInfo.TableNumber.ToString("00");
            lblGuestQuantity.Text = oOrderInfo.GuestCount.ToString("00");
        }
Example #12
0
 private void SaveButton_Click(object sender, EventArgs e)
 {
     string product_plu = txtProductID.Text;
     int returnVal;
     returnVal = 0;
     COrderManager objOrderManager = new COrderManager();
     m_priceTakeType = -99;
     CResult oResult =null ;//objOrderManager.GetPluDataByProductPLU(product_plu, m_priceTakeType,m_orderID);
     if (oResult.IsSuccess && oResult.Data != null)
         returnVal = int.Parse(oResult.Data.ToString());
     if (returnVal == 0)
     {
         MessageBox.Show("Please enter valid plu product", RMSGlobal.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     else if (returnVal == 3)
     {
         MessageBox.Show("Please enter non food type plu product", RMSGlobal.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     else
     {
         this.Close();
     }
 }
Example #13
0
        private void FillOrders()
        {
            COrderManager tempOrderManager = new COrderManager();
            List<COrderShow> tempOrderShowList = (List<COrderShow>)tempOrderManager.OrderListShowByStatus("Paid").Data;

            dgvCurrentOrders.RowCount = 0;
            for (int orderCounter = 0; orderCounter < tempOrderShowList.Count; orderCounter++)
            {
                CTableIcon tableIcon = new CTableIcon();
                tableIcon.User = tempOrderShowList[orderCounter].UserName;
                tableIcon.GuestCount = tempOrderShowList[orderCounter].GuestCount.ToString();
                tableIcon.TableName = tempOrderShowList[orderCounter].TableName;
                tableIcon.Type = tempOrderShowList[orderCounter].OrderType;
                tableIcon.OrderID = tempOrderShowList[orderCounter].OrderID;

                if (tableIcon.Type.Equals("Table"))
                {
                    tableIcon.TableName = "Table " + tempOrderShowList[orderCounter].TableNumber.ToString();
                }
                else if (tableIcon.Type.Equals("Tabs"))
                {
                    tableIcon.TableName = "Tab " + tempOrderShowList[orderCounter].TableNumber.ToString();
                }
                else if (tableIcon.Type.Equals("TakeAway"))
                {
                    COrderInfo temp2OrderInfo = (COrderInfo)tempOrderManager.OrderInfoByOrderID(tempOrderShowList[orderCounter].OrderID).Data;
                    CCustomerManager tempCustomerManager = new CCustomerManager();
                    CCustomerInfo tempCustomerinfo = new CCustomerInfo();

                    tempCustomerinfo = (CCustomerInfo)tempCustomerManager.CustomerInfoGetByCustomerID(temp2OrderInfo.CustomerID).Data;

                    if (tempCustomerinfo != null)
                    {
                        tableIcon.TableName = tempCustomerinfo.CustomerName;
                    }
                    else
                    {
                        tableIcon.TableName = "Take Away";
                    }
                    tableIcon.GuestCountLabel.Text = tempOrderShowList[orderCounter].Status;
                }

            DataGridViewRowCollection dgvRow = (DataGridViewRowCollection)dgvCurrentOrders.Rows;
            dgvRow.Add(tableIcon.OrderID, tableIcon.TableName, tempOrderShowList[orderCounter].OnlineOrderID);
            }
        }
Example #14
0
        private void dgvCurrentOrders_SelectionChanged(object sender, EventArgs e)
        {
            m_orderID = Convert.ToInt64("0" + dgvCurrentOrders.CurrentRow.Cells[0].Value);
            m_onlineOrderID = Convert.ToInt64("0" + dgvCurrentOrders.CurrentRow.Cells[2].Value);

            lsvCurrent.Items.Clear();
            lsvRemovable.Items.Clear();

            if (m_onlineOrderID < 1)
            {
                COrderManager tempOrderManager = new COrderManager();
                List<COrderDetails> tempOrderDetailsList = new List<COrderDetails>();
                CResult oResult = tempOrderManager.OrderDetailsByOrderID(m_orderID);
                if (oResult.IsSuccess && oResult.Data != null)
                    tempOrderDetailsList = (List<COrderDetails>)oResult.Data;

                m_slOrderedItems = new SortedList();
                for (int itemIndex = 0; itemIndex < tempOrderDetailsList.Count; itemIndex++)
                {
                    Int64 tempProductID = tempOrderDetailsList[itemIndex].ProductID;
                    int tempCategoryLevel = tempOrderDetailsList[itemIndex].CategoryLevel;

                    string tempProductName = "";
                    if (tempCategoryLevel == 3)
                    {
                        DataRow[] tempDataRowArr = Program.initDataSet.Tables["Category3"].Select("cat3_id = " + tempProductID);

                        if (tempDataRowArr.Length > 0)  //Added by Baruri .This was a bug previously when no row found.
                        {
                            tempProductName = tempDataRowArr[0]["cat3_name"].ToString();
                        }
                    }
                    else if (tempCategoryLevel == 4)
                    {
                        DataRow[] tempDataRowArr = Program.initDataSet.Tables["Category4"].Select("cat4_id = " + tempProductID);
                        int tempCat3_id = 0;
                        if (tempDataRowArr.Length > 0)
                        {
                            tempCat3_id = Convert.ToInt32("0" + tempDataRowArr[0]["cat3_id"]);
                        }

                        tempProductName = Program.initDataSet.Tables["Category4"].Select("cat4_id = " + tempProductID)[0]["cat4_name"].ToString();

                        tempDataRowArr = Program.initDataSet.Tables["Category3"].Select("cat3_id = " + tempCat3_id);

                        if (tempDataRowArr.Length > 0)//If rows found
                        {
                            tempProductName += " " + tempDataRowArr[0]["cat3_name"].ToString();
                        }
                    }
                    else if (tempCategoryLevel == 0)
                    {
                        tempProductName = tempOrderDetailsList[itemIndex].OrderRemarks;
                    }

                    //if remarks exists append it... otherwise append nothing...
                    string appendString = "";
                    if (tempCategoryLevel != 0)
                    {
                        appendString = (tempOrderDetailsList[itemIndex].OrderRemarks.Equals("")) ? ("") : (" (" + tempOrderDetailsList[itemIndex].OrderRemarks + ")");
                    }

                    if (tempOrderDetailsList[itemIndex].PrintedQuantity > 0)
                    {
                        ListViewItem lsvItem = new ListViewItem(tempProductName + appendString);
                        lsvItem.SubItems.Add(tempOrderDetailsList[itemIndex].PrintedQuantity.ToString());
                        lsvItem.SubItems.Add(tempOrderDetailsList[itemIndex].OrderAmount.ToString("F02"));
                        lsvItem.SubItems.Add(tempOrderDetailsList[itemIndex].ProductID.ToString());
                        lsvItem.SubItems.Add(tempOrderDetailsList[itemIndex].OrderDetailsID.ToString());
                        lsvItem.SubItems.Add(tempOrderDetailsList[itemIndex].OrderFoodType.ToString());
                        lsvCurrent.Items.Add(lsvItem);

                        //For taking the track of the ordered items.
                        COrderDetails objOrderedItems=new COrderDetails();
                        objOrderedItems.OrderDetailsID=tempOrderDetailsList[itemIndex].OrderDetailsID;
                        objOrderedItems.OrderID=m_orderID;
                        objOrderedItems.ProductID=tempOrderDetailsList[itemIndex].ProductID;
                        objOrderedItems.OrderQuantity=tempOrderDetailsList[itemIndex].OrderQuantity;
                        objOrderedItems.PrintedQuantity=tempOrderDetailsList[itemIndex].PrintedQuantity;
                        objOrderedItems.OrderAmount = tempOrderDetailsList[itemIndex].OrderAmount;
                        m_slOrderedItems.Add(objOrderedItems.OrderDetailsID, objOrderedItems);
                    }
                }
            }
            else
            {
                //Loading the online orders information
                m_slOrderedItems = new SortedList();
                COrderManager tempOrderManager = new COrderManager();
                string remarks = "";
                string itemName = "";
                List<COrderDetails> tempOrderDetailsList = new List<COrderDetails>();
                CResult oResult = tempOrderManager.GetOnlineOrderDetailsByOrderID(m_orderID);
                if (oResult.IsSuccess && oResult.Data != null)
                    tempOrderDetailsList = (List<COrderDetails>)oResult.Data;

                for (int itemIndex = 0; itemIndex < tempOrderDetailsList.Count; itemIndex++)
                {
                    remarks = tempOrderDetailsList[itemIndex].OrderRemarks.ToString();
                    itemName = tempOrderDetailsList[itemIndex].ItemName.ToString();

                    if (remarks.Length > 0)
                    {
                        itemName = itemName + "(" + remarks + ")";
                    }
                    if (tempOrderDetailsList[itemIndex].PrintedQuantity > 0)
                    {
                        ListViewItem lsvItem = new ListViewItem(itemName);
                        lsvItem.SubItems.Add(tempOrderDetailsList[itemIndex].PrintedQuantity.ToString());
                        lsvItem.SubItems.Add(tempOrderDetailsList[itemIndex].OrderAmount.ToString("F02"));
                        lsvItem.SubItems.Add(tempOrderDetailsList[itemIndex].ProductID.ToString());
                        lsvItem.SubItems.Add(tempOrderDetailsList[itemIndex].OnlineItemSequenceNumber.ToString());
                        lsvItem.SubItems.Add(tempOrderDetailsList[itemIndex].OrderFoodType.ToString());
                        lsvCurrent.Items.Add(lsvItem);

                        //For taking the track of the ordered items.
                        COrderDetails objOrderedItems = new COrderDetails();
                        objOrderedItems.OrderDetailsID = tempOrderDetailsList[itemIndex].OnlineItemSequenceNumber; //Here details id contains online ordered item sequence number
                        objOrderedItems.OrderID = m_orderID;
                        objOrderedItems.ProductID = tempOrderDetailsList[itemIndex].ProductID;
                        objOrderedItems.OrderQuantity = tempOrderDetailsList[itemIndex].OrderQuantity;
                        objOrderedItems.PrintedQuantity = tempOrderDetailsList[itemIndex].PrintedQuantity;
                        objOrderedItems.OrderAmount = tempOrderDetailsList[itemIndex].OrderAmount;
                        m_slOrderedItems.Add(objOrderedItems.OrderDetailsID, objOrderedItems);
                    }
                }
            }
        }
Example #15
0
        private void btnVoidItem_Click(object sender, EventArgs e)
        {
            this.CollectSettings();
            DialogResult tempDialogResult = MessageBox.Show("Are you sure you want to void this order?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (tempDialogResult.Equals(DialogResult.No)) return;

            //ITEM_VOID_INFORMATION n = new ITEM_VOID_INFORMATION();
            //n.ShowDialog();

            if (lsvRemovable.Items.Count < 1)
            {
                MessageBox.Show("There is no item to be void.Please select as removable items.", RMSGlobal.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            else
            {

                if (MessageBox.Show("Ok Done", RMSGlobal.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Question) == DialogResult.OK)
                {
                    COrderManager tempOrderManager = new COrderManager();

                    if (m_onlineOrderID < 1)
                    {
                        tempOrderManager.VoidPrintedItems(m_slOrderedItems, m_orderID);//Updatre DB with latest quantity status for local ordered items.

                    }
                    else
                    {
                        tempOrderManager.VoidOnlinePrintedItems(m_slOrderedItems); //For online ordered items
                    }

                   this.AddItemVoidReport();

                    this.KitchenPrintVoidCopy();
                    this.PrintBeverageVoidItems();
                    MessageBox.Show("Items are successfully sent to kitchen.",
                        RMSGlobal.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    lsvRemovable.Items.Clear();
                }
            }
        }
Example #16
0
        public void CurrrentTableDataGridView_CellClick(object sender,DataGridViewCellEventArgs e)
        {
            try
            {
                if (CurrrentTableDataGridView.Columns[e.ColumnIndex].Name.Equals("ActionButtonColumn") && e.RowIndex >= 0 && CurrrentTableDataGridView.Rows[e.RowIndex].Cells["OrderIDColumn"].Value != null)
                {
                    this.CustomerNameTextBox.Text = CurrrentTableDataGridView.Rows[e.RowIndex].Cells["CustomerNameColumn"].Value.ToString();
                    this.TableNumberTextBox.Text = CurrrentTableDataGridView.Rows[e.RowIndex].Cells["TableNumberColumn"].Value.ToString();
                    String tempOrderID = CurrrentTableDataGridView.Rows[e.RowIndex].Cells["OrderIDColumn"].Value.ToString();
                    int tempOldTableNumber = int.Parse(CurrrentTableDataGridView.Rows[e.RowIndex].Cells["TableNumberColumn"].Value.ToString());
                    int tempOldTableGuestCount = int.Parse(CurrrentTableDataGridView.Rows[e.RowIndex].Cells["GuestCountColumn"].Value.ToString());

                    CCalculatorForm tempCalculator = new CCalculatorForm("Transfer Table", "Enter new Table Number to Transfer");
                    tempCalculator.BackColor = Color.LightGray;
                    tempCalculator.InputNameLabel.ForeColor = Color.Black;
                    tempCalculator.InputTextBox.BackColor = Color.LightGray;
                    tempCalculator.InputTextBox.ForeColor = Color.Black;
                    tempCalculator.ShowDialog();

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

                    if (CCalculatorForm.inputResult.Equals("") || Int32.Parse(CCalculatorForm.inputResult) == 0)
                    {
                        MessageBox.Show("Input invalid.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }

                    if (!CCalculatorForm.inputResult.Equals("Cancel") && !CCalculatorForm.inputResult.Equals(String.Empty))
                    {
                        int tempNewTableNumber = int.Parse(CCalculatorForm.inputResult);

                        COrderManager tempTransferTableManager = new COrderManager();
                        List<CTableInfo> tempAvailableTableList = new List<CTableInfo>();
                        tempAvailableTableList = (List<CTableInfo>)tempTransferTableManager.AvailableTableForTransfer().Data;
                        CTableInfo[] tempAvailableTableArray = tempAvailableTableList.ToArray();

                        bool tempPromptAgainBool = false;
                        CResult tempResult = new CResult();

                        for (int i = 0; i < tempAvailableTableArray.Length; i++)
                        {
                            if (tempNewTableNumber == tempAvailableTableArray[i].TableNumber) tempPromptAgainBool = true;
                        }

                        if (tempPromptAgainBool)
                        {
                            MessageBox.Show("The Table selected is already occupied.\n Please select another table.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }

                        else
                        {
                            tempResult = tempTransferTableManager.UpdateForTransferTable(tempOrderID, tempOldTableNumber, tempNewTableNumber, tempOldTableGuestCount);
                            if (tempResult.IsSuccess)
                            {
                                CurrrentTableDataGridView.Rows[e.RowIndex].Cells["TableNumberColumn"].Value = tempNewTableNumber;
                                TableNumberTextBox.Text = tempNewTableNumber.ToString();
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
Example #17
0
        private void CTransferTableForm_Load(object sender, EventArgs e)
        {
            try
            {
                COrderManager tempTransferTableManager = new COrderManager();
                List<CTransferOrderShow> tempOrderShowList = new List<CTransferOrderShow>();
                tempOrderShowList = (List<CTransferOrderShow>)tempTransferTableManager.OrderListForTransfer(false).Data;

                if (tempOrderShowList != null) PopulateCurrentTableDataGridView(tempOrderShowList);
                CurrrentTableDataGridView.CellClick += new DataGridViewCellEventHandler(CurrrentTableDataGridView_CellClick);
            }
            catch (Exception ex)
            {
            }
        }
Example #18
0
        public void ViewReportDataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (ViewReportDataGridView.Columns[e.ColumnIndex].Name == "ActionButtonColumn" && e.RowIndex >= 0 && ViewReportDataGridView.Rows[e.RowIndex].Cells["OrderIDColumn"].Value != null)
                {
                    DialogResult tempDialogResult = MessageBox.Show("Are you sure you want to void this payment?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                    if (tempDialogResult.Equals(DialogResult.No)) return;
                    else
                    {
                        String tempOldOrderID = ViewReportDataGridView.Rows[e.RowIndex].Cells["OrderIDColumn"].Value.ToString();
                        int tempOldTableNumber = int.Parse(ViewReportDataGridView.Rows[e.RowIndex].Cells["TableNumberColumn"].Value.ToString());
                        String tempTableType = ViewReportDataGridView.Rows[e.RowIndex].Cells["OrderTypeColumn"].Value.ToString();

                        COrderManager tempVoidTableManager = new COrderManager();
                        CResult tempResult = tempVoidTableManager.UpdateForVoidTable(tempOldOrderID, tempOldTableNumber, tempTableType, true);
                        if (tempResult.IsSuccess)
                        {
                            if (!tempSearch) this.PopulateViewReportDataGridView();
                            else this.PopulateViewReportDataGridViewBySearch(m_sRef, m_sPrice, m_sTable, m_bRef, m_bPrice, m_bTable);
                        }
                    }
                }
            }
            catch (Exception exp)
            {
                Console.Write(exp.Message);
            }
        }
Example #19
0
        private void FinishButton_Click(object sender, EventArgs e)
        {
            CResult objResultant = new CResult();
            try
            {
                if (!CheckEmpty() && m_orderIndex == 1)
                {
                    CMessageBox tempMessageBox = new CMessageBox("Error", "Please enter all the mandatory values.");
                    tempMessageBox.ShowDialog();
                    return;
                }

                CCustomerManager tempCustomerManager = new CCustomerManager();
                CCustomerInfo tempCustomerInfo = new CCustomerInfo();

                if (txtPhoneNumber.Text.Trim().Equals(String.Empty))
                {
                    CResult oResult5 = tempCustomerManager.CustomerInfoGetByName(txtCustomerName.Text.Trim());
                    if (oResult5.IsSuccess && oResult5.Data != null)
                    {
                        tempCustomerInfo = (CCustomerInfo)oResult5.Data;
                    }
                }

                else
                {
                    CResult oResult = tempCustomerManager.CustomerInfoGetByPhone(txtPhoneNumber.Text.Trim());
                    if (oResult.IsSuccess && oResult.Data != null)
                    {
                        tempCustomerInfo = (CCustomerInfo)oResult.Data;
                    }
                }

                if (txtCustomerName.Text.Length == 0 && (m_orderIndex == 2 || m_orderIndex == 3))
                {
                    txtCustomerName.Text = m_order_name;
                }

                tempCustomerInfo.CustomerName = txtCustomerName.Text.Trim();
                tempCustomerInfo.CustomerPhone = txtPhoneNumber.Text.Trim();

                if (m_orderIndex == 1) //If only delivery type order is considered
                {
                    tempCustomerInfo.CustomerPostalCode = txtPostalCode.Text.Trim();

                    tempCustomerInfo.FloorAptNumber = txtFloorAptNumber.Text.Trim();
                    tempCustomerInfo.HouseNumber = txtHouseNumber.Text.Trim();
                    tempCustomerInfo.StreetName = txtStreetName.Text.Trim() + "-" + txtStreet2.Text.Trim();
                    tempCustomerInfo.BuildingName = txtBuildingName.Text.Trim();

                    tempCustomerInfo.CustomerTown = txtTown.Text.Trim();
                    tempCustomerInfo.CustomerCountry = cmbCountry.Text;
                    tempCustomerInfo.UserName = RMSGlobal.LoginUserName;
                    tempCustomerInfo.TerminalId = RMSGlobal.Terminal_Id;
                    Int64 currentdateTime = DateTime.Now.Ticks;
                    tempCustomerInfo.InsertDate = currentdateTime;
                }

                if (tempCustomerInfo.CustomerID == 0)
                {
                        CResult oResult6 = tempCustomerManager.InsertCustomerInfo(tempCustomerInfo);
                        if (oResult6.IsSuccess && oResult6.Data != null)
                            tempCustomerInfo = (CCustomerInfo)oResult6.Data;
                }
                else
                {
                        tempCustomerManager.UpdateCustomerInfo(tempCustomerInfo);
                }

                #region "Older"

                if (m_customerEditStatus == false)
                {
                    if (m_iOrderID == 0)
                    {
                        COrderManager tempOrderManager = new COrderManager();
                        COrderInfo tempOrderInfo = new COrderInfo();
                        tempOrderInfo.CustomerID = tempCustomerInfo.CustomerID;
                        tempOrderInfo.OrderType = "TakeAway";
                        tempOrderInfo.OrderTime = System.DateTime.Now;
                        tempOrderInfo.TableNumber = GetValidTableNumber("TakeAway");
                        CTableInfo tempTableInfo = new CTableInfo();
                        tempTableInfo.TableNumber = tempOrderInfo.TableNumber;
                        tempTableInfo.TableType = "TakeAway";
                        tempOrderManager.InsertTableInfo(tempTableInfo);

                        if (m_orderIndex==1)
                        {
                            tempOrderInfo.Status = "Delivery";
                        }
                        else if (m_orderIndex ==2 )
                        {
                            tempOrderInfo.Status = "Collection";
                        }
                        else if (m_orderIndex == 3)
                        {
                            tempOrderInfo.Status = "Waiting";
                        }

                        m_oCommonConstants = ConfigManager.GetConfig<CCommonConstants>();
                        tempOrderInfo.UserID = m_oCommonConstants.UserInfo.UserID;

                        objResultant = tempOrderManager.InsertOrderInfo(tempOrderInfo); //New Order
                        COrderInfo tempOrderInfoNew = (COrderInfo)objResultant.Data;//Taking the order ID
                        m_iOrderID = tempOrderInfoNew.OrderID;

                        #region " Inserting Order details info if items are selected from the previous orders"
                        //Developed by baruri
                        List<COrderDetails> tempOrderDetailsList = new List<COrderDetails>();
                        if (m_htOrderInfo.Count > 0) //If item is selected from the previous order
                        {
                            tempOrderDetailsList = (List<COrderDetails>)m_htOrderInfo["orderdetail"];
                        }
                        if (tempOrderDetailsList.Count > 0) //Insert details for the new order
                        {
                            for (int itemDetailIndex = 0; itemDetailIndex < tempOrderDetailsList.Count; itemDetailIndex++)
                            {
                                COrderDetails objOrderDetails = (COrderDetails)tempOrderDetailsList[itemDetailIndex];
                                objOrderDetails.OrderID = tempOrderInfo.OrderID;
                                tempOrderManager.InsertOrderDetails(objOrderDetails);
                            }
                            m_htOrderInfo = new Hashtable();//Clearing the previous items from the order if there is any.
                        }
                        #endregion

                        //insert delivery time
                        if (tempOrderInfo.Status.Equals("Delivery"))
                        {
                            CDelivery tempDelivery = new CDelivery();
                            tempDelivery.DeliveryOrderID = tempOrderInfo.OrderID;
                            string deliveryTime = Convert.ToInt32("0" + cmbHour.Text).ToString("00") + ":" + Convert.ToInt32("0" + cmbMinute.Text).ToString("00") + " " + cmbMeridiem.Text;
                            tempDelivery.DeliveryTime = deliveryTime;// DeliveryTimeTextBox.Text.Trim();
                            tempOrderManager.InsertDeliveryInfo(tempDelivery);
                        }

                        //OLD Code
                        //Form tempForm = CFormManager.Forms.Pop();
                        //tempForm.Show();

                        try
                        {
                            WaiterForm waiterForm = new WaiterForm();
                            waiterForm.UserList = userList;
                            waiterForm.ShowDialog();

                            if (waiterForm.DialogResult == DialogResult.OK)
                            {
                                COrderWaiterDao orderwaiterDao = new COrderWaiterDao();
                                COrderwaiter orderwaiter = new COrderwaiter();

                                orderwaiter = orderwaiterDao.GetOrderwaiterByOrderID(tempOrderInfo.OrderID);
                                if (orderwaiter != null && orderwaiter.ID > 0 && orderwaiter.WaiterID != waiterForm.UserInfoData.UserID)
                                {
                                    orderwaiter.OrderID = tempOrderInfo.OrderID;
                                    orderwaiter.WaiterID = waiterForm.UserInfoData.UserID;
                                    orderwaiter.WaiterName = waiterForm.UserInfoData.UserName;
                                    orderwaiterDao.UpdateOrderwaiter(orderwaiter);
                                }
                                else if (orderwaiter.ID == 0)
                                {
                                    orderwaiter.OrderID = tempOrderInfo.OrderID;
                                    orderwaiter.WaiterID = waiterForm.UserInfoData.UserID;
                                    orderwaiter.WaiterName = waiterForm.UserInfoData.UserName;
                                    orderwaiterDao.InsertOrderwaiter(orderwaiter);
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                        }

                        m_oCommonConstants = ConfigManager.GetConfig<CCommonConstants>();
                        CTableOrderForm tempForm = new CTableOrderForm(m_iOrderID, m_oCommonConstants.TakeAwayType, tempOrderInfo.TableNumber);
                        tempForm.m_orderUserName = RMSGlobal.LoginUserName;
                        tempForm.Show();

                        this.Close();
                    }
                    else
                    {
                        COrderManager tempOrderManager = new COrderManager();
                        CResult oResult7 = tempOrderManager.OrderInfoByOrderID(m_iOrderID);
                        COrderInfo tempOrderInfo = new COrderInfo();
                        if (oResult7.IsSuccess && oResult7.Data != null)
                        {
                            tempOrderInfo = (COrderInfo)oResult7.Data;
                        }

                        tempOrderInfo.OrderType = "TakeAway";
                        tempOrderInfo.Status = "TakeAway";
                        tempOrderInfo.GuestCount = 0;
                        tempOrderInfo.TableName = "";
                        tempOrderInfo.CustomerID = tempCustomerInfo.CustomerID;
                        tempOrderInfo.TableNumber = GetValidTableNumber("TakeAway");

                        CTableInfo tempTableInfo = new CTableInfo();
                        tempTableInfo.TableNumber = tempOrderInfo.TableNumber;
                        tempTableInfo.TableType = "TakeAway";
                        tempOrderManager.InsertTableInfo(tempTableInfo);

                        if (m_orderIndex == 1)
                        {
                            tempOrderInfo.Status = "Delivery";
                        }
                        else if (m_orderIndex == 3)
                        {
                            tempOrderInfo.Status = "Waiting";
                        }
                        else if (m_orderIndex == 2)
                        {
                            tempOrderInfo.Status = "Collection";
                        }
                        tempOrderManager.UpdateOrderInfo(tempOrderInfo);

                        //insert delivery time
                        if (tempOrderInfo.Status.Equals("Delivery"))
                        {
                            CDelivery tempDelivery = new CDelivery();
                            tempDelivery.DeliveryOrderID = tempOrderInfo.OrderID;
                            string deliveryTime = Convert.ToInt32("0" + cmbHour.Text).ToString("00") + ":" + Convert.ToInt32("0" + cmbMinute.Text).ToString("00") + " " + cmbMeridiem.Text;
                            tempDelivery.DeliveryTime = deliveryTime;// DeliveryTimeTextBox.Text.Trim();
                            tempOrderManager.InsertDeliveryInfo(tempDelivery);
                        }

                        try
                        {
                            WaiterForm waiterForm = new WaiterForm();
                            waiterForm.UserList = userList;
                            waiterForm.ShowDialog();

                            if (waiterForm.DialogResult == DialogResult.OK)
                            {
                                COrderWaiterDao orderwaiterDao = new COrderWaiterDao();
                                COrderwaiter orderwaiter = new COrderwaiter();

                                orderwaiter = orderwaiterDao.GetOrderwaiterByOrderID(tempOrderInfo.OrderID);
                                if (orderwaiter != null && orderwaiter.ID > 0 && orderwaiter.WaiterID != waiterForm.UserInfoData.UserID)
                                {
                                    orderwaiter.OrderID = tempOrderInfo.OrderID;
                                    orderwaiter.WaiterID = waiterForm.UserInfoData.UserID;
                                    orderwaiter.WaiterName = waiterForm.UserInfoData.UserName;
                                    orderwaiterDao.UpdateOrderwaiter(orderwaiter);
                                }
                                else if (orderwaiter.ID == 0)
                                {
                                    orderwaiter.OrderID = tempOrderInfo.OrderID;
                                    orderwaiter.WaiterID = waiterForm.UserInfoData.UserID;
                                    orderwaiter.WaiterName = waiterForm.UserInfoData.UserName;
                                    orderwaiterDao.InsertOrderwaiter(orderwaiter);
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                        }

                        m_oCommonConstants = ConfigManager.GetConfig<CCommonConstants>();
                        CTableOrderForm tempForm = (CTableOrderForm)CFormManager.Forms.Pop();
                        tempForm.m_iType = m_oCommonConstants.TakeAwayType;
                        tempForm.Show();
                        this.Close();
                    }
                }
                #endregion
                else //Edit order information.As here is reached from order details screen.
                {
                    COrderInfo tempOrderInfo = new COrderInfo();
                    COrderManager tempOrderManager = new COrderManager();
                    CDelivery tempDelivery = null;

                    tempOrderInfo.OrderID = m_iOrderID;
                    tempOrderManager.DeleteDeliveryInfo(m_iOrderID);//Delete previous record from delivery information table

                    if (m_orderIndex==2)
                    {
                        tempOrderInfo.Status = "Collection";
                    }
                    else if (m_orderIndex==3)
                    {
                        tempOrderInfo.Status = "Waiting";
                    }
                    else
                    {
                        tempOrderInfo.Status = "Delivery";
                        tempDelivery = new CDelivery();
                        tempDelivery.DeliveryOrderID = tempOrderInfo.OrderID;
                        string deliveryTime = Convert.ToInt32("0" + cmbHour.Text).ToString("00") + ":" + Convert.ToInt32("0" + cmbMinute.Text).ToString("00") + " " + cmbMeridiem.Text;
                        tempDelivery.DeliveryTime = deliveryTime;//
                        tempOrderManager.InsertDeliveryInfo(tempDelivery);//Update delivery information
                    }

                    tempOrderManager.UpdateTakeawayOrderInfo(tempOrderInfo);//Update order information

                    try
                    {
                        WaiterForm waiterForm = new WaiterForm();
                        waiterForm.UserList = userList;
                        waiterForm.ShowDialog();

                        if (waiterForm.DialogResult == DialogResult.OK)
                        {
                            COrderWaiterDao orderwaiterDao = new COrderWaiterDao();
                            COrderwaiter orderwaiter = new COrderwaiter();

                            orderwaiter = orderwaiterDao.GetOrderwaiterByOrderID(tempOrderInfo.OrderID);
                            if (orderwaiter != null && orderwaiter.ID > 0 && orderwaiter.WaiterID != waiterForm.UserInfoData.UserID)
                            {
                                orderwaiter.OrderID = tempOrderInfo.OrderID;
                                orderwaiter.WaiterID = waiterForm.UserInfoData.UserID;
                                orderwaiter.WaiterName = waiterForm.UserInfoData.UserName;
                                orderwaiterDao.UpdateOrderwaiter(orderwaiter);
                            }
                            else if (orderwaiter.ID == 0)
                            {
                                orderwaiter.OrderID = tempOrderInfo.OrderID;
                                orderwaiter.WaiterID = waiterForm.UserInfoData.UserID;
                                orderwaiter.WaiterName = waiterForm.UserInfoData.UserName;
                                orderwaiterDao.InsertOrderwaiter(orderwaiter);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                    }

                    m_oCommonConstants = ConfigManager.GetConfig<CCommonConstants>();
                    CTableOrderForm tempForm = (CTableOrderForm)CFormManager.Forms.Pop();
                    tempForm.m_iType = m_oCommonConstants.TakeAwayType;
                    tempForm.Show();
                    this.Close();
                }
                m_phoneNumber = String.Empty;
            }
            catch (Exception exp)
            {
                Console.Write(exp.Message);
            }
        }
Example #20
0
        private void PrintBeverageVoidItems()
        {
            string Cat1ID = String.Empty;
            bool itemAvailable = false;
            try
            {
                StringPrintFormater strPrintFormatter = new StringPrintFormater(29);
                int papersize = 29;

                CPrintMethodsEXT tempPrintMethods = new CPrintMethodsEXT();

                string serialHeader = "";
                string serialFooter = "";

                COrderManager tempOrderManager = new COrderManager();
                COrderInfo tempOrderInfo = (COrderInfo)tempOrderManager.OrderInfoByOrderID(m_orderID).Data;
                List<CSerialPrintContent> serialBody = new List<CSerialPrintContent>();
                CSerialPrintContent tempSerialPrintContent = new CSerialPrintContent();

                if ("Table" == tempOrderInfo.OrderType)
                {
                    //tempSerialPrintContent = new CSerialPrintContent();
                    //tempSerialPrintContent.StringLine = "Order Date: " + tempOrderInfo.OrderTime.ToString("dd/MM/yy hh:mm tt");
                    //serialBody.Add(tempSerialPrintContent);

                    //tempSerialPrintContent = new CSerialPrintContent();
                    //tempSerialPrintContent.StringLine = "Print Date:" + System.DateTime.Now.ToString("dd/MM/yy  hh:mm tt");
                    //serialBody.Add(tempSerialPrintContent);

                    tempSerialPrintContent = new CSerialPrintContent();
                    tempSerialPrintContent.StringLine = "\r\n\r\nTable No:" + tempOrderInfo.TableNumber.ToString() + "\r\n";
                    tempSerialPrintContent.Bold = true;
                    serialBody.Add(tempSerialPrintContent);

                    tempSerialPrintContent = new CSerialPrintContent();
                    tempSerialPrintContent.StringLine = "COVERS:" + tempOrderInfo.GuestCount.ToString() + "\r\n";
                    tempSerialPrintContent.Bold = true;
                    serialBody.Add(tempSerialPrintContent);
                }

                 tempSerialPrintContent = new CSerialPrintContent();
                tempSerialPrintContent.StringLine = "           Void Beverages/Non-Foods\n";
                serialBody.Add(tempSerialPrintContent);

                if ("Table" == tempOrderInfo.OrderType)
                {
                    tempSerialPrintContent = new CSerialPrintContent();
                    tempSerialPrintContent.StringLine = "Order Date: " + tempOrderInfo.OrderTime.ToString("dd/MM/yy hh:mm tt");
                    serialBody.Add(tempSerialPrintContent);

                    tempSerialPrintContent = new CSerialPrintContent();
                    tempSerialPrintContent.StringLine = "Print Date:" + System.DateTime.Now.ToString("dd/MM/yy  hh:mm tt");
                    serialBody.Add(tempSerialPrintContent);

                    //tempSerialPrintContent = new CSerialPrintContent();
                    //tempSerialPrintContent.StringLine = "Table No:" + tempOrderInfo.TableNumber.ToString() + "\r\n";
                    //tempSerialPrintContent.Bold = true;
                    //serialBody.Add(tempSerialPrintContent);

                    //tempSerialPrintContent = new CSerialPrintContent();
                    //tempSerialPrintContent.StringLine = "COVERS:" + tempOrderInfo.GuestCount.ToString() + "\r\n";
                    //tempSerialPrintContent.Bold = true;
                    //serialBody.Add(tempSerialPrintContent);
                }
                else if ("TakeAway" == tempOrderInfo.OrderType)
                {

                    tempSerialPrintContent = new CSerialPrintContent();
                    tempSerialPrintContent.StringLine = "Order Date: " + tempOrderInfo.OrderTime.ToString("dd/MM/yy hh:mm tt");
                    serialBody.Add(tempSerialPrintContent);

                    tempSerialPrintContent = new CSerialPrintContent();
                    tempSerialPrintContent.StringLine = "Print Date: " + System.DateTime.Now.ToString("dd/MM/yy  hh:mm tt");
                    serialBody.Add(tempSerialPrintContent);

                    tempSerialPrintContent = new CSerialPrintContent();
                    tempSerialPrintContent.StringLine = "Type: " + tempOrderInfo.Status;
                    serialBody.Add(tempSerialPrintContent);

                    CCustomerManager tempCustomerManager = new CCustomerManager();
                    CCustomerInfo tempCustomerInfo = (CCustomerInfo)tempCustomerManager.CustomerInfoGetByCustomerID(tempOrderInfo.CustomerID).Data;

                    tempSerialPrintContent = new CSerialPrintContent();
                    tempSerialPrintContent.StringLine = "Customer Name: " + tempCustomerInfo.CustomerName;
                    serialBody.Add(tempSerialPrintContent);

                    tempSerialPrintContent = new CSerialPrintContent();
                    tempSerialPrintContent.StringLine = "Phone:" + tempCustomerInfo.CustomerPhone;
                    serialBody.Add(tempSerialPrintContent);

                    if (tempOrderInfo.Status.Equals("Delivery"))
                    {
                        tempSerialPrintContent = new CSerialPrintContent();
                        tempSerialPrintContent.StringLine = "Address:";
                        serialBody.Add(tempSerialPrintContent);

                        tempSerialPrintContent = new CSerialPrintContent();
                        tempSerialPrintContent.StringLine = "----------------------------------------";
                        serialBody.Add(tempSerialPrintContent);

                        if (tempCustomerInfo.FloorAptNumber.Length > 0)
                        {
                            tempSerialPrintContent = new CSerialPrintContent();
                            tempSerialPrintContent.StringLine = "Floor or Apartment:" + tempCustomerInfo.FloorAptNumber;
                            serialBody.Add(tempSerialPrintContent);
                        }

                        if (tempCustomerInfo.BuildingName.Length > 0)
                        {
                            tempSerialPrintContent = new CSerialPrintContent();
                            tempSerialPrintContent.StringLine = "Building Name:" + tempCustomerInfo.BuildingName;
                            serialBody.Add(tempSerialPrintContent);
                        }

                        if (tempCustomerInfo.HouseNumber.Length > 0)
                        {
                            tempSerialPrintContent = new CSerialPrintContent();
                            tempSerialPrintContent.StringLine = "House Number:" + tempCustomerInfo.HouseNumber;
                            serialBody.Add(tempSerialPrintContent);
                        }

                        string[] street = new string[0];
                        street = tempCustomerInfo.StreetName.Split('-');

                        if (street.Length > 1)
                        {
                            if (street[0].ToString().Length > 0)
                            {
                                tempSerialPrintContent = new CSerialPrintContent();
                                tempSerialPrintContent.StringLine = "Street:" + street[0].ToString();
                                serialBody.Add(tempSerialPrintContent);
                            }

                            if (street[1].ToString().Length > 0)
                            {
                                tempSerialPrintContent = new CSerialPrintContent();
                                tempSerialPrintContent.StringLine = street[1].ToString();
                                serialBody.Add(tempSerialPrintContent);
                            }
                        }
                        else if (street.Length > 0 && street.Length < 2)
                        {
                            if (street[0].ToString().Length > 0)
                            {
                                tempSerialPrintContent = new CSerialPrintContent();
                                tempSerialPrintContent.StringLine = "Street:" + street[0].ToString();
                                serialBody.Add(tempSerialPrintContent);
                            }
                        }

                        if (tempCustomerInfo.CustomerPostalCode.Length > 0)
                        {
                            tempSerialPrintContent = new CSerialPrintContent();
                            tempSerialPrintContent.StringLine = "Postal Code:" + tempCustomerInfo.CustomerPostalCode;
                            serialBody.Add(tempSerialPrintContent);
                        }
                        if (tempCustomerInfo.CustomerTown.Length > 0)
                        {
                            tempSerialPrintContent = new CSerialPrintContent();
                            tempSerialPrintContent.StringLine = "Town:" + tempCustomerInfo.CustomerTown;
                            serialBody.Add(tempSerialPrintContent);
                        }

                        tempSerialPrintContent = new CSerialPrintContent();
                        tempSerialPrintContent.StringLine = "----------------------------------------";
                        serialBody.Add(tempSerialPrintContent);

                        CDelivery objDelivery = new CDelivery();
                        objDelivery.DeliveryOrderID = m_orderID;
                        CResult objDeliveryInfo = tempOrderManager.GetDeliveryInfo(objDelivery);
                        objDelivery = (CDelivery)objDeliveryInfo.Data;
                        if (objDelivery != null)
                        {
                            tempSerialPrintContent = new CSerialPrintContent();
                            tempSerialPrintContent.StringLine = "\r\nDelivery Time:" + objDelivery.DeliveryTime;
                            serialBody.Add(tempSerialPrintContent);
                        }
                    }
                }

                tempSerialPrintContent = new CSerialPrintContent();
                tempSerialPrintContent.StringLine = "Order Information";
                serialBody.Add(tempSerialPrintContent);

                tempSerialPrintContent = new CSerialPrintContent();
                tempSerialPrintContent.StringLine = "----------------------------------------";
                serialBody.Add(tempSerialPrintContent);

                tempSerialPrintContent = new CSerialPrintContent();

                tempSerialPrintContent.StringLine = "Item                           Qty";
                serialBody.Add(tempSerialPrintContent);

                tempSerialPrintContent = new CSerialPrintContent();
                tempSerialPrintContent.StringLine = "----------------------------------------";
                serialBody.Add(tempSerialPrintContent);

                    Hashtable htOrderedItems = new Hashtable();
                    string categoryOrder = String.Empty;
                    PrintUtility printUtility = new PrintUtility();
                    foreach(ListViewItem lsvItem in lsvRemovable.Items)
                    {
                        if (lsvItem.SubItems[5].Text.ToString().Replace(" ", "").ToUpper() == "NonFood".Replace(" ", "").ToUpper())
                        {
                            tempSerialPrintContent = new CSerialPrintContent();
                         //   tempSerialPrintContent.StringLine = "(Void)" + lsvItem.Text.ToString() + "  ";
                        //    tempSerialPrintContent.StringLine += CPrintMethods.GetFixedString(lsvItem.SubItems[1].Text.ToString(), 30);

                            tempSerialPrintContent.StringLine = strPrintFormatter.ItemLabeledText(
                                          printUtility.MultipleLine("(Void)" + lsvItem.Text + "  ", papersize - 5, lsvItem.SubItems[1].Text.ToString(), papersize), "");

                            serialBody.Add(tempSerialPrintContent);
                            itemAvailable = true;

                       //     tempSerialPrintContent.StringLine +=
                       //                                strPrintFormatter.ItemLabeledText(
                       //                             printUtility.MultipleLine(objReport.ItemName.ToString(), papersize - 32, priceString, papersize), "");

                        }
                    }

                tempSerialPrintContent = new CSerialPrintContent();
                tempSerialPrintContent.StringLine = "----------------------------------------";
                serialBody.Add(tempSerialPrintContent);

                //New at 22.08.2008
                tempSerialPrintContent = new CSerialPrintContent();
                tempSerialPrintContent.StringLine = "Order Prepared By :" + RMSGlobal.LoginUserName;
                serialBody.Add(tempSerialPrintContent);

                CPcInfoManager tempPcInfoManager = new CPcInfoManager();
                IPHostEntry ipEntry = System.Net.Dns.GetHostByName(Dns.GetHostName());
                CResult objResult = tempPcInfoManager.PcInfoByPcIP(ipEntry.AddressList[0].ToString());
                CPcInfo tempPcInfo = new CPcInfo();
                if (objResult.IsSuccess && objResult.Data != null)
                {
                    tempPcInfo = (CPcInfo)objResult.Data;
                }

                tempSerialPrintContent = new CSerialPrintContent();
                tempSerialPrintContent.StringLine = tempPcInfo.Name.Trim();
                serialBody.Add(tempSerialPrintContent);

                if (itemAvailable == true) //If there is items for printing
                {
                    for (int printCopy = 0; printCopy < m_barPrintedCopy; printCopy++)
                    {
                       // tempPrintMethods.SerialPrint(PRINTER_TYPES.NORMAL_PRINTER, serialHeader, serialBody, serialFooter, tempOrderInfo.SerialNo.ToString());
                    }

                    string printingObject = ""; //Write to the text file
                    for (int arrayIndex = 0; arrayIndex < serialBody.Count; arrayIndex++)
                    {
                        printingObject += serialBody[arrayIndex].StringLine.ToString() + "\r\n";
                    }

                    tempPrintMethods.USBPrint(printingObject, PrintDestiNation.BEVARAGE, false);
                    this.WriteString(printingObject);///Write to a file when print command is executed
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message, RMSGlobal.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #21
0
        private void Category3Button_Click(object sender, EventArgs e)
        {
            //get item qty

            CCategoryButton tempCategory3Button = (CCategoryButton)sender;
            RMSGlobal.m_sellinginvalue = tempCategory3Button.SellingQuantityorWeight; //Used to identify the product whether sold in quantity or weight

            int tempCategory3ID = tempCategory3Button.CategoryID;
            if (m_bItemDescriptionClicked)
            {
                string tempItemDescription = Program.initDataSet.Tables["Category3"].Select("cat3_id = " + tempCategory3ID)[0]["description"].ToString();
                if (!tempItemDescription.Equals(""))
                {
                    CMessageBox tempMessageBox = new CMessageBox("Item Description", tempItemDescription);
                    tempMessageBox.ShowDialog();
                }
                else
                {
                    CMessageBox tempMessageBox = new CMessageBox("Item Description", "No information available.");
                    tempMessageBox.ShowDialog();
                }
                m_bItemDescriptionClicked = false;
                return;
            }

            int tempFoodType = int.Parse(Program.initDataSet.Tables["Category3"].Select("cat3_id = " + tempCategory3ID)[0].GetParentRow(Program.initDataSet.Relations["category2_to_category3"])["cat2_type"].ToString());
            DataGridView tempDataGridView = new DataGridView();
            if (tempFoodType == 0)
            {
                tempDataGridView = g_BeverageDataGridView;
            }
            else
            {
                tempDataGridView = g_FoodDataGridView;
            }

            DataRow[] tempDataRowArray = Program.initDataSet.Tables["Category4"].Select("cat3_id = " + tempCategory3ID.ToString());

            category4ButtonList.Clear();

            COrderInfoDAO aOrderInfoDao = new COrderInfoDAO();
            COrderInfo aCOrderInfo = aOrderInfoDao.GetOrderInfoByOrderID(orderID);

            if (tempDataRowArray.Length != 0)
            {

                foreach (DataRow tempDataRow in tempDataRowArray)
                {
                    if (Int32.Parse(tempDataRow["status"].ToString()) == 0)
                    {
                        continue;
                    }
                    CCategoryButton tempCategoryButton = new CCategoryButton();
                    tempCategoryButton.CategoryID = int.Parse(tempDataRow["cat4_id"].ToString());
                    tempCategoryButton.CategoryOrder = int.Parse(tempDataRow["cat4_order"].ToString());
                    tempCategoryButton.CategoryLevel = 4;
                    tempCategoryButton.Text = tempDataRow["cat4_name"].ToString();
                    tempCategoryButton.BackColor = tempCategory3Button.BackColor;
                    category4ButtonList.Add(tempCategoryButton);
                }

                keyboardForm.Hide();
                CCategory4Form tempCategory4Form = new CCategory4Form(tempCategory3ID, category4ButtonList, tempCategory3Button.Text);
                tempCategory4Form.ShowDialog();

                CCategoryButton tempCategory4Button = CCategory4Form.m_cbResult;
                m_iSavedOrderedQty = CCategory4Form.ItemQTY;
                if (tempCategory4Button == null)
                {
                    return;
                }
                else   //insert into table and datagridview
                {
                    DataRow[] temp2DataRowArray = Program.initDataSet.Tables["Category4"].Select("cat4_id = " + tempCategory4Button.CategoryID.ToString());
                    if (temp2DataRowArray.Length != 0)
                    {
                        //category4 + categpry3
                        string ItemName = temp2DataRowArray[0]["cat4_name"].ToString() + " " + tempCategory3Button.Text;
                        string tableTypePrice = string.Empty;
                        if (m_iType == m_cCommonConstants.TableType)
                        {
                            tableTypePrice = temp2DataRowArray[0]["table_price"].ToString();
                        }
                        else if (m_iType == m_cCommonConstants.TakeAwayType)
                        {
                            tableTypePrice = temp2DataRowArray[0]["tw_price"].ToString();
                        }

                        int tempSearchResult = FindExistingItem(tempDataGridView, ItemName);

                        // vat_included
                        double vatRate = 0;
                        bool vat_included = false;
                        double vatAmountRate = 0;
                        try
                        {
                            vatRate = Convert.ToDouble(temp2DataRowArray[0]["vat_Rate"].ToString());
                            vat_included = Convert.ToBoolean(temp2DataRowArray[0]["vat_included"].ToString());

                            if (vat_included)
                            {
                                vatAmountRate = (Double.Parse(tableTypePrice) * vatRate) / 100;

                                // tableTypePrice = (Double.Parse(tableTypePrice) - vatAmountRate).ToString();
                                tableTypePrice = Convert.ToDouble(tableTypePrice).ToString();
                            }
                            else
                            {
                                vatAmountRate = 0.00;
                            }

                        }
                        catch (Exception ex) { }

                        COrderManager tempOrderManager = new COrderManager();
                        COrderDetails tempOrderDetails = new COrderDetails();

                        if (tempSearchResult != -1)
                        {
                            int tempRowIndex = tempSearchResult;
                            int qty = int.Parse(tempDataGridView.Rows[tempRowIndex].Cells[1].Value.ToString()) + m_iSavedOrderedQty;
                            tempDataGridView.Rows[tempRowIndex].Cells[1].Value = qty;
                            tempDataGridView.Rows[tempRowIndex].Cells[3].Value = ((double)(Double.Parse(tableTypePrice) * qty)).ToString("F02");
                            //update Order_details table
                            tempOrderDetails.OrderID = orderID;
                            tempOrderDetails.OrderDetailsID = Int64.Parse(tempDataGridView.Rows[tempRowIndex].Cells[7].Value.ToString());
                            tempOrderDetails.ProductID = tempCategory4Button.CategoryID;
                            tempOrderDetails.CategoryLevel = tempCategory4Button.CategoryLevel;
                            tempOrderDetails.OrderQuantity = qty;
                            tempOrderDetails.UnitPrice = Convert.ToDouble(tableTypePrice);
                            tempOrderDetails.OrderAmount = tempOrderDetails.OrderQuantity * Double.Parse(tableTypePrice);
                            tempOrderDetails.OrderFoodType = tempFoodType == 1 ? ("Food") : ("Nonfood");
                            tempOrderDetails.OnlineItemSequenceNumber = Int64.Parse(tempDataGridView.Rows[tempRowIndex].Cells[6].Value.ToString());
                            tempOrderDetails.PrintedQuantity = int.Parse(tempDataGridView.Rows[tempRowIndex].Cells[8].Value.ToString());

                            if (aCOrderInfo.VatComplementory) vatRate =vatAmountRate= 0;
                            if (vat_included)
                            {
                                // tempOrderDetails.VatTotal = tempOrderDetails.OrderAmount * vatAmountRate;
                                tempOrderDetails.VatTotal = qty * vatAmountRate;
                                tempDataGridView.Rows[tempRowIndex].Cells[2].Value = qty * vatAmountRate;
                            }
                            else
                            {
                                tempOrderDetails.VatTotal = tempOrderDetails.OrderAmount * (vatRate / 100);
                            }

                            if (m_orderUserName.Replace(" ", "").ToUpper() != "Web User".Replace(" ", "").ToUpper())
                            {
                                tempOrderManager.UpdateOrderDetails(tempOrderDetails);
                            }
                            else
                            {
                                tempOrderManager.UpdateOnlineOrderDetails(tempOrderDetails);//for online orders
                            }
                        }
                        else
                        {
                            //Insert into Order_details table
                            tempOrderDetails.OrderID = orderID;
                            tempOrderDetails.ProductID = tempCategory4Button.CategoryID;
                            tempOrderDetails.CategoryLevel = tempCategory4Button.CategoryLevel;
                            tempOrderDetails.OrderQuantity = m_iSavedOrderedQty;
                            tempOrderDetails.OrderAmount = tempOrderDetails.OrderQuantity * Double.Parse(tableTypePrice);
                            tempOrderDetails.OrderFoodType = tempFoodType == 1 ? ("Food") : ("Nonfood");
                            tempOrderDetails.ItemOrderTime = DateTime.Now.Ticks;
                            tempOrderDetails.UnitPrice = Convert.ToDouble(tableTypePrice);
                          //  tempOrderDetails.Product_Name = temp2DataRowArray[0]["cat3_name"].ToString();
                            if (aCOrderInfo.VatComplementory) vatRate = 0;
                            if (vat_included)
                            {
                                tempOrderDetails.VatTotal = 0;
                                tempOrderDetails.VatTotal = tempOrderDetails.OrderAmount * (vatRate / 100);
                                // tempOrderDetails.VatTotal = tempOrderDetails.OrderAmount * vatAmountRate;
                            }
                            else
                            {
                                tempOrderDetails.VatTotal = tempOrderDetails.OrderAmount * (vatRate / 100);
                            }

                            tempOrderDetails.Amount_with_vat = tempOrderDetails.OrderAmount + tempOrderDetails.VatTotal;

                            string category1ID = this.GetCategory1ID(tempOrderDetails.ProductID, tempOrderDetails.CategoryLevel);
                            //Int32 cat1Order = this.GetCategory1OrderNumber(Convert.ToInt32(category1ID)); // Change by Mithu

                            if (m_orderUserName.Replace(" ", "").ToUpper() != "Web User".Replace(" ", "").ToUpper())
                            {
                                tempOrderDetails = (COrderDetails)tempOrderManager.InsertOrderDetails(tempOrderDetails).Data;
                                string[] tempDataGridViewRow = new string[]
                                { ItemName,
                                  m_iSavedOrderedQty.ToString(),
                                  ((double)tempOrderDetails.VatTotal).ToString("F02"),
                                  ((double)(Double.Parse(tableTypePrice)*m_iSavedOrderedQty)).ToString("F02"),
                                  tempCategory4Button.CategoryID.ToString(),
                                  "4",
                                  temp2DataRowArray[0]["cat4_rank"].ToString(),
                                  tempOrderDetails.OrderDetailsID.ToString(),
                                  "0",
                                  tempOrderDetails.UnitPrice.ToString("F2")
                                };

                                tempDataGridView.Rows.Add(tempDataGridViewRow);
                            }
                            else //For online orders
                            {
                                tempOrderDetails.ItemName = ItemName;
                                tempOrderDetails = (COrderDetails)tempOrderManager.InsertOnlineOrderDetails(tempOrderDetails).Data;
                                string[] tempDataGridViewRow = new string[]
                                { ItemName,
                                  m_iSavedOrderedQty.ToString(),
                                  ((double)tempOrderDetails.VatTotal).ToString("F02"),
                                  ((double)(Double.Parse(tableTypePrice)*m_iSavedOrderedQty)).ToString("F02"),
                                  tempCategory4Button.CategoryID.ToString(),
                                  "4",
                                  tempOrderDetails.OnlineItemSequenceNumber.ToString(),
                                  tempOrderDetails.OrderDetailsID.ToString(),"0",
                                  tempOrderDetails.UnitPrice.ToString("F2")
                                };

                                tempDataGridView.Rows.Add(tempDataGridViewRow);
                            }
                        }

                        if (m_orderUserName.Replace(" ", "").ToUpper() != "Web User".Replace(" ", "").ToUpper()) //If local orders are considered
                        {
                            this.ConvertRank();
                        }

                        tempDataGridView.Sort(tempDataGridView.Columns[5], ListSortDirection.Ascending);

                        tempDataGridView.Update();
                        TotalAmountCalculation();
                    }
                }
            }
            else //There is no category4
            {
                keyboardForm.Hide();
                try
                {
                    CCalculatorForm tempCalculatorForm = new CCalculatorForm("Order Quantity", "Item Quantity");
                    tempCalculatorForm.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);
                }

                DataGridViewRow tempDataGridViewRow = new DataGridViewRow();
                tempDataGridViewRow.CreateCells(tempDataGridView);

                DataRow[] temp2DataRowArray = Program.initDataSet.Tables["Category3"].Select("cat3_id = " + tempCategory3Button.CategoryID.ToString());
                if (temp2DataRowArray.Length != 0)
                {
                    string tableTypePrice = string.Empty;
                    if (m_iType == m_cCommonConstants.TableType)
                    {
                        tableTypePrice = temp2DataRowArray[0]["table_price"].ToString();
                    }
                    else if (m_iType == m_cCommonConstants.TakeAwayType)
                    {
                        tableTypePrice = temp2DataRowArray[0]["tw_price"].ToString();
                    }

                    // vat_included
                    double vatRate = 0;
                    bool vat_included = false;
                    double vatAmountRate = 0;

                    try
                    {
                        vatRate = Convert.ToDouble(temp2DataRowArray[0]["vat_Rate"].ToString());
                        vat_included = Convert.ToBoolean(temp2DataRowArray[0]["vat_included"].ToString());

                        if (vat_included)
                        {
                            vatAmountRate = (Double.Parse(tableTypePrice) * vatRate) / 100;

                            // tableTypePrice = (Double.Parse(tableTypePrice) - vatAmountRate).ToString();
                            tableTypePrice = Convert.ToDouble(tableTypePrice).ToString();
                        }
                        else
                        {
                            vatAmountRate = 0.00;
                        }

                    }
                    catch (Exception ex) { }

                    COrderManager tempOrderManager = new COrderManager();
                    COrderDetails tempOrderDetails = new COrderDetails();

                    int tempResult = FindExistingItem(tempDataGridView, temp2DataRowArray[0]["cat3_name"].ToString());
                    if (tempResult != -1)
                    {
                        //update Order_details table
                        int tempRowIndex = tempResult;
                        int qty = int.Parse(tempDataGridView.Rows[tempRowIndex].Cells[1].Value.ToString()) + m_iSavedOrderedQty;
                        tempDataGridView.Rows[tempRowIndex].Cells[1].Value = qty;
                        tempDataGridView.Rows[tempRowIndex].Cells[3].Value = ((double)(Double.Parse(tableTypePrice) * qty)).ToString("F02");
                        tempOrderDetails.OrderDetailsID = Int64.Parse(tempDataGridView.Rows[tempRowIndex].Cells[7].Value.ToString());
                        tempOrderDetails.OrderID = orderID;
                        tempOrderDetails.ProductID = tempCategory3Button.CategoryID;
                        tempOrderDetails.CategoryLevel = tempCategory3Button.CategoryLevel;
                        tempOrderDetails.UnitPrice = Convert.ToDouble(tableTypePrice);
                        tempOrderDetails.OrderQuantity = qty;
                        tempOrderDetails.OrderAmount = tempOrderDetails.OrderQuantity * Double.Parse(tableTypePrice);
                        tempOrderDetails.OrderFoodType = tempFoodType == 1 ? ("Food") : ("Nonfood");
                        tempOrderDetails.OnlineItemSequenceNumber = Convert.ToInt64("0" + tempDataGridView.Rows[tempRowIndex].Cells[6].Value.ToString());
                        tempOrderDetails.PrintedQuantity = int.Parse(tempDataGridView.Rows[tempRowIndex].Cells[8].Value.ToString());
                        if (aCOrderInfo.VatComplementory) vatAmountRate = 0;
                        if (vat_included)
                        {
                            tempOrderDetails.VatTotal = qty * vatAmountRate;
                            tempDataGridView.Rows[tempRowIndex].Cells[2].Value = tempOrderDetails.VatTotal;
                        }
                        else
                        {
                            tempOrderDetails.VatTotal = 0.00;
                        }

                        if (m_orderUserName.Replace(" ", "").ToUpper() != "Web User".Replace(" ", "").ToUpper())
                        {
                            tempOrderManager.UpdateOrderDetails(tempOrderDetails);
                        }
                        else
                        {
                            tempOrderManager.UpdateOnlineOrderDetails(tempOrderDetails);
                        }

                    }
                    else
                    {
                        //Insert into Order_details table
                        tempOrderDetails.OrderID = orderID;
                        tempOrderDetails.ProductID = tempCategory3Button.CategoryID;
                        tempOrderDetails.CategoryLevel = tempCategory3Button.CategoryLevel;
                        tempOrderDetails.UnitPrice = Convert.ToDouble(tableTypePrice);
                        tempOrderDetails.OrderQuantity = m_iSavedOrderedQty;
                        tempOrderDetails.OrderAmount = tempOrderDetails.OrderQuantity * Double.Parse(tableTypePrice);
                        tempOrderDetails.OrderFoodType = tempFoodType == 1 ? ("Food") : ("Nonfood");
                        tempOrderDetails.ItemOrderTime = DateTime.Now.Ticks;
                        tempOrderDetails.Product_Name = temp2DataRowArray[0]["cat3_name"].ToString();
                        tempOrderDetails.UOM = temp2DataRowArray[0]["uom"].ToString();
                        tempOrderDetails.Product_Type = temp2DataRowArray[0]["productType"].ToString();
                        if (aCOrderInfo.VatComplementory) vatRate = vatAmountRate = 0;
                        try
                        {
                            if (vat_included)
                            {
                                tempOrderDetails.VatTotal = 0;
                                tempOrderDetails.VatTotal = tempOrderDetails.OrderAmount * (vatRate / 100);
                                // tempOrderDetails.VatTotal = tempOrderDetails.OrderAmount * vatAmountRate;
                            }
                            else
                            {
                                tempOrderDetails.VatTotal = tempOrderDetails.OrderAmount * (vatRate / 100);
                            }
                        }
                        catch { }

                        try
                        {
                            tempOrderDetails.Amount_with_vat = tempOrderDetails.OrderAmount + tempOrderDetails.VatTotal;

                        }
                        catch { }

                        string category1ID = this.GetCategory1ID(tempOrderDetails.ProductID, tempOrderDetails.CategoryLevel);
                        Int32 cat1Order = this.GetCategory1OrderNumber(Convert.ToInt32(category1ID));

                        if (m_orderUserName.Replace(" ", "").ToUpper() != "Web User".Replace(" ", "").ToUpper())
                        {
                            tempOrderDetails = (COrderDetails)tempOrderManager.InsertOrderDetails(tempOrderDetails).Data;
                            string[] temp2DataGridViewRow = new string[]
                                { temp2DataRowArray[0]["cat3_name"].ToString(),
                                  m_iSavedOrderedQty.ToString(),
                                  tempOrderDetails.VatTotal.ToString("F2"),
                                  ((double)(Double.Parse(tableTypePrice)*m_iSavedOrderedQty)).ToString("F02"),
                                  tempCategory3Button.CategoryID.ToString(),
                                  "3",
                                  temp2DataRowArray[0]["cat3_rank"].ToString(),
                                  tempOrderDetails.OrderDetailsID.ToString(),"0",
                                    tempOrderDetails.UnitPrice.ToString("F2")
                                };
                            tempDataGridView.Rows.Add(temp2DataGridViewRow);
                        }
                        else
                        {
                            tempOrderDetails.ItemName = temp2DataRowArray[0]["cat3_name"].ToString();
                            tempOrderDetails = (COrderDetails)tempOrderManager.InsertOnlineOrderDetails(tempOrderDetails).Data;
                            string[] temp2DataGridViewRow = new string[]
                                {temp2DataRowArray[0]["cat3_name"].ToString(),
                                  m_iSavedOrderedQty.ToString(),
                                    tempOrderDetails.VatTotal.ToString(),
                                  ((double)(Double.Parse(tableTypePrice)*m_iSavedOrderedQty)).ToString("F02"),
                                  tempCategory3Button.CategoryID.ToString(),
                                  "3",
                                  tempOrderDetails.OnlineItemSequenceNumber.ToString(),//For online order sequence number is category rank.
                                  tempOrderDetails.OrderDetailsID.ToString(),"0", //0 For first time.
                                  tempOrderDetails.UnitPrice.ToString("F2")
                                };
                            tempDataGridView.Rows.Add(temp2DataGridViewRow);
                        }
                    }

                    if (m_orderUserName.Replace(" ", "").ToUpper() != "Web User".Replace(" ", "").ToUpper())
                    {
                        this.ConvertRank();
                    }
                    tempDataGridView.Sort(tempDataGridView.Columns[5], ListSortDirection.Ascending);
                    try
                    {
                        tempDataGridView.Update();
                    }
                    catch { }
                        TotalAmountCalculation();

                }
            }
            g_FoodDataGridView.ClearSelection();
            g_BeverageDataGridView.ClearSelection();
            m_iSavedOrderedQty = 1;

            keyboardForm.Hide();

            this.SetPrintedItemBackColor();
        }
Example #22
0
 private void UpdateButton_Click(object sender, EventArgs e)
 {
     try
     {
         for (int bkRecordCounter = 0; bkRecordCounter < viewBookingDataGridView.Rows.Count; bkRecordCounter++)
         {
             if (viewBookingDataGridView.Rows[bkRecordCounter].Selected == true && viewBookingDataGridView.Rows[bkRecordCounter].Cells["BookingIDColumn"].Value != null)
             {
                 COrderManager tempOrderManager = new COrderManager();
                 Int64 tempBookingID = Int64.Parse(viewBookingDataGridView.Rows[bkRecordCounter].Cells["BookingIDColumn"].Value.ToString());
                 CResult tempResult = tempOrderManager.GetBookingInfoByID(tempBookingID);
                 if (tempResult.IsSuccess)
                 {
                     CBookingInfoForm tempTransferTableForm = new CBookingInfoForm("Update", (CBooking)tempResult.Data);
                     tempTransferTableForm.Show();
                     CFormManager.Forms.Push(this);
                     this.Hide();
                     Updated = true;
                 }
                 break;
             }
         }
     }
     catch (Exception ex)
     {
     }
 }
Example #23
0
 /// <summary>
 /// If the order is waiting type then collects the waiting number of the order.
 /// For this reason the function collects the maximum waiting number and increases by 1 to return the current id.
 /// </summary>
 /// <returns></returns>
 private void GetWaitingNumber()
 {
     DateTime currentDateTime = DateTime.Now;
     DateTime dateOnly = new DateTime(currentDateTime.Year, currentDateTime.Month, currentDateTime.Day, 0, 0, 0);
     COrderManager tempOrderManager = new COrderManager();
     CResult objWaiting = tempOrderManager.GetWaitingNumber(dateOnly.Ticks,m_orderIndex);
     CTableInfo objTableInfo = (CTableInfo)objWaiting.Data;
     if (m_orderIndex == 3)
     {
         m_order_name = "Waiting" + (objTableInfo.WaitingNumber + 1).ToString("000");
     }
     else if (m_orderIndex == 2)
     {
         m_order_name = "Collection" + (objTableInfo.WaitingNumber + 1).ToString("000");//Here waiting number is collection number.
     }
 }
Example #24
0
        private int GetValidTableNumber(string TableType)
        {
            try
            {
                COrderManager tempOrderManager = new COrderManager();
                List<int> tempTableNumberList = (List<int>)tempOrderManager.GetTableNumberList(TableType).Data;

                for (int rowIndex = 0; rowIndex < tempTableNumberList.Count; rowIndex++)
                {
                    if (tempTableNumberList[rowIndex] != (rowIndex + 1))
                    {
                        return (rowIndex + 1);
                    }
                    if ((rowIndex + 1) == tempTableNumberList.Count)
                        return tempTableNumberList[rowIndex] + 1;
                }
            }
            catch (Exception eee)
            {
            }
            return 1;
        }
Example #25
0
        private void KitchenPrintVoidCopy()
        {
            Hashtable htOrderedItems = new Hashtable();
            bool itemAvailable = false;
            try
            {
                CPrintMethodsEXT tempPrintMethods = new CPrintMethodsEXT();
                CCommonConstants oConstant = ConfigManager.GetConfig<CCommonConstants>();
                COrderManager tempOrderManager = new COrderManager();
                CResult oResult = tempOrderManager.OrderInfoByOrderID(m_orderID);
                COrderInfo tempOrderInfo = new COrderInfo();

                StringPrintFormater strPrintFormatter = new StringPrintFormater(29);
              int   papersize = 29;

                if (oResult.IsSuccess && oResult.Data != null)
                {
                    tempOrderInfo = (COrderInfo)oResult.Data;
                }

                string serialHeader = "";
                string serialFooter = "";
                string serialBody = "";

                if ("Table" == tempOrderInfo.OrderType)
                {
                    serialBody += "\r\n\r\nTable NO:" + tempOrderInfo.TableNumber.ToString();
                    serialBody += "\r\nCovers:" + tempOrderInfo.GuestCount.ToString();
                }

                serialBody += "\r\n           Kitchen Copy";

                if (!tempOrderInfo.Status.Equals("Seated") && "Table"== tempOrderInfo.OrderType)
                {
                    serialBody += "\r\nReprint";
                }
                serialBody += "\r\n\r\nOrdered Date:" + tempOrderInfo.OrderTime.ToString("dd/MM/yy hh:mm tt");
                serialBody += "\r\nPrint Date: " + DateTime.Now.ToString("dd/MM/yy hh:mm tt");

                if ("Table" == tempOrderInfo.OrderType)
                {
                    //serialBody += "\r\n\r\nTable NO:" + tempOrderInfo.TableNumber.ToString();
                    //serialBody += "\r\nCovers:" + tempOrderInfo.GuestCount.ToString();
                }
                else if ("TakeAway" == tempOrderInfo.OrderType)
                {
                    serialBody += "\r\n\r\n        Take Away";
                    serialBody += "\r\n       Type: " + tempOrderInfo.Status;
                    CCustomerManager tempCustomerManager = new CCustomerManager();
                    CCustomerInfo tempCustomerInfo = (CCustomerInfo)tempCustomerManager.CustomerInfoGetByCustomerID(tempOrderInfo.CustomerID).Data;
                    serialBody += "\r\n Customer Name: " + tempCustomerInfo.CustomerName;
                    serialBody += "\r\nPhone:" + tempCustomerInfo.CustomerPhone;

                    if (tempOrderInfo.Status.Equals("Delivery"))
                    {
                        serialBody += "\r\nAddress:";
                        if (tempCustomerInfo.FloorAptNumber.Length > 0)
                        {
                            serialBody += "\r\nFloor or Apartment:" + tempCustomerInfo.FloorAptNumber;
                        }
                        if (tempCustomerInfo.BuildingName.Length > 0)
                        {
                            serialBody += "\r\nBuilding Name:" + tempCustomerInfo.BuildingName;
                        }
                        if (tempCustomerInfo.HouseNumber.Length > 0)
                        {
                            serialBody += "\r\nHouse Number:" + tempCustomerInfo.HouseNumber;
                        }
                        string[] street = new string[0];
                        street = tempCustomerInfo.StreetName.Split('-');

                        if (street.Length > 1)
                        {
                            if (street[0].ToString().Length > 0)
                            {
                                serialBody += "\r\nStreet:" + street[0].ToString();
                            }
                            if (street[1].ToString().Length > 0)
                            {
                                serialBody += "\r\n" + street[1].ToString();
                            }
                        }
                        else if (street.Length > 0 && street.Length < 2)
                        {
                            if (street[0].ToString().Length > 0)
                            {
                                serialBody += "\r\nStreet:" + street[0].ToString();
                            }
                        }
                        if (tempCustomerInfo.CustomerPostalCode.Length > 0)
                        {
                            serialBody += "\r\nPostal Code:" + tempCustomerInfo.CustomerPostalCode;
                        }
                        if (tempCustomerInfo.CustomerTown.Length > 0)
                        {
                            serialBody += "\r\nTown:" + tempCustomerInfo.CustomerTown;
                        }
                        serialBody += "\r\n----------------------------------------";
                        CDelivery objDelivery = new CDelivery();
                        objDelivery.DeliveryOrderID = m_orderID;
                        CResult objDeliveryInfo = tempOrderManager.GetDeliveryInfo(objDelivery);
                        objDelivery = (CDelivery)objDeliveryInfo.Data;

                        serialBody += "\r\nDelivery Time:" + objDelivery.DeliveryTime;
                    }
                }

                serialBody += "\r\n\r\nOrder Information";
                serialBody += "\r\n---------------------------------";

                serialBody += "\r\n Item                       Qty";
                serialBody += "\r\n---------------------------------";

                PrintUtility printUtility = new PrintUtility();

                foreach (ListViewItem lsvItem in lsvRemovable.Items)
                {
                    if (lsvItem.SubItems[5].Text.Replace(" ", "").ToUpper() == "Food".Replace(" ", "").ToUpper())
                    {
                    //    serialBody += "\r\n(Void)" + CPrintMethods.GetFixedString(lsvItem.Text, 20) + "  ";
                      // serialBody += lsvItem.SubItems[0].Text;
                        itemAvailable = true;

                        serialBody += "\r\n" +  strPrintFormatter.ItemLabeledText(
                                                    printUtility.MultipleLine("(Void)" + lsvItem.Text + "  ", papersize - 5, lsvItem.SubItems[1].Text.ToString(), papersize), "");

                    }
                }
                serialBody += "\r\n---------------------------------";

                serialBody += "\r\nOrder Prepared By:" + RMSGlobal.LoginUserName;

                CPcInfoManager tempPcInfoManager = new CPcInfoManager();
                IPHostEntry ipEntry = System.Net.Dns.GetHostByName(Dns.GetHostName());
                CResult objResult = tempPcInfoManager.PcInfoByPcIP(ipEntry.AddressList[0].ToString());
                CPcInfo tempPcInfo = new CPcInfo();
                if (objResult.IsSuccess && objResult.Data != null)
                {
                    tempPcInfo = (CPcInfo)objResult.Data;
                }

                serialBody += "\r\nTerminal Name:" + tempPcInfo.Name;

                serialBody += "\r\n\r\n          [ E N D ]\r\n\r\n";

                CPrintingFormat tempPrintingFormat = new CPrintingFormat();
                tempPrintingFormat.Header = serialHeader;
                tempPrintingFormat.Body = serialBody.ToUpper();
                tempPrintingFormat.Footer = serialFooter;
                tempPrintingFormat.OrderID = m_orderID;
                tempPrintingFormat.PrintType = (int)PRINTER_TYPES.Serial;

                if (itemAvailable == true)
                {
                    CLogin oLogin = new CLogin();
                    oLogin = (RmsRemote.CLogin)Activator.GetObject(typeof(RmsRemote.CLogin), oConstant.RemoteURL);

                    for (int printCopy = 0; printCopy < m_printedCopy; printCopy++)
                    {
                       // oLogin.PostPrintingRequest(tempPrintingFormat);

                        tempPrintMethods.USBPrint(serialBody, PrintDestiNation.KITCHEN, false);

                    }
                    this.WriteString(serialBody);//Writing to the specified file
                }
            }
            catch (Exception exp)
            {
                throw exp;
            }
        }
Example #26
0
 private void DeleteButton_Click(object sender, EventArgs e)
 {
     try
     {
         for (int bkRecordCounter = 0; bkRecordCounter < viewBookingDataGridView.Rows.Count; bkRecordCounter++)
         {
             if (viewBookingDataGridView.Rows[bkRecordCounter].Selected == true && viewBookingDataGridView.Rows[bkRecordCounter].Cells["BookingIDColumn"].Value != null)
             {
                 DialogResult tempDialogResult = MessageBox.Show("Are you sure you want to delete this booking?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                 if (tempDialogResult.Equals(DialogResult.No)) return;
                 else
                 {
                     COrderManager tempOrderManager = new COrderManager();
                     Int64 tempBookingID = Int64.Parse(viewBookingDataGridView.Rows[bkRecordCounter].Cells["BookingIDColumn"].Value.ToString());
                     CResult tempResult = tempOrderManager.deleteBookingInfo(tempBookingID);
                     if (tempResult.IsSuccess)
                     {
                         viewBookingDataGridView.Rows.RemoveAt(bkRecordCounter);
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
     }
 }
Example #27
0
 /// <summary>
 /// Modification of the print status.After first print the command is not included with kitchen copy.
 /// </summary>
 private void UpdateKitchenTextPrintStatus()
 {
     COrderManager objOrderManager = new COrderManager();
     objOrderManager.UpdateOrderKitchenStatus(orderID);
 }
Example #28
0
        private void ViewButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (tempCurrentDate.Date.CompareTo(DateTime.Today.Date) != 0) tempCurrentDate = new DateTime(tempCurrentDate.Year, tempCurrentDate.Month, tempCurrentDate.Day, 8, 0, 0);
                else if (tempCurrentDate.Date.CompareTo(DateTime.Today.Date) == 0) tempCurrentDate = DateTime.Now;

                COrderManager tempOrderManager = new COrderManager();
                CResult tempResult = tempOrderManager.GetBookingInfoAll(tempCurrentDate);

                if (tempResult.IsSuccess)
                {
                    List<CBooking> tempBookingList = (List<CBooking>)tempResult.Data;
                    viewBookingDataGridView.Rows.Clear();

                    if (tempBookingList != null)
                    {
                        PopulateviewBookingDataGridView(tempBookingList);
                    }
                }
                Updated = true;
            }
            catch(Exception ex)
            {
            }
        }
Example #29
0
        private void ReprintButton_Click(object sender, EventArgs e)
        {
            try
            {
                int tempRowIndex = 0;
                bool tempFlag = false;
                for (int rowCounter = 0; rowCounter < ViewReportDataGridView.RowCount; rowCounter++)
                {
                    if (ViewReportDataGridView.Rows[rowCounter].Selected == true && ViewReportDataGridView.Rows[rowCounter].Cells["OrderIDColumn"].Value != null)
                    {
                        tempRowIndex = rowCounter;
                        tempFlag = true;
                        break;
                    }
                }

                if (tempFlag)
                {
                    CPrintMethods tempPrintMethods = new CPrintMethods();

                    Int64 orderID = 0;
                    Int64.TryParse(ViewReportDataGridView.Rows[tempRowIndex].Cells["OrderIDColumn"].Value.ToString(), out orderID);
                    COrderManager tempOrderManager = new COrderManager();
                    COrderInfoArchive tempOrderInfo = (COrderInfoArchive)tempOrderManager.OrderInfoArchiveByOrderID(orderID).Data;

                    //serial print
                    //string serialHeader = "IBACS RMS";
                    string serialHeader = "";
                    string serialFooter = "";
                    List<CSerialPrintContent> serialBody = new List<CSerialPrintContent>();
                    CSerialPrintContent tempSerialPrintContent = new CSerialPrintContent();
                    tempSerialPrintContent.StringLine = "               Guest Bill\n";
                    serialBody.Add(tempSerialPrintContent);

                    tempSerialPrintContent = new CSerialPrintContent();
                    tempSerialPrintContent.StringLine = "Reprint Date: " + System.DateTime.Now.ToLongDateString() + "\n";
                    serialBody.Add(tempSerialPrintContent);

                    tempSerialPrintContent = new CSerialPrintContent();
                    tempSerialPrintContent.StringLine = "Billing Date: " +  tempCurrentDate.ToLongDateString() + "\n";
                    serialBody.Add(tempSerialPrintContent);

                    if (tempOrderInfo.OrderType.Equals("Table"))
                    {
                        tempSerialPrintContent = new CSerialPrintContent();
                        tempSerialPrintContent.StringLine = "            Table Number: " + tempOrderInfo.TableNumber + "\n";
                        tempSerialPrintContent.Bold = true;
                        serialBody.Add(tempSerialPrintContent);

                        tempSerialPrintContent = new CSerialPrintContent();
                        tempSerialPrintContent.StringLine = "                  Covers: " + tempOrderInfo.GuestCount + "\n";
                        tempSerialPrintContent.Bold = true;
                        serialBody.Add(tempSerialPrintContent);
                    }
                    else if (tempOrderInfo.OrderType.Equals("TakeAway"))
                    {

                        tempSerialPrintContent = new CSerialPrintContent();
                        tempSerialPrintContent.StringLine = "Take Away ";
                        serialBody.Add(tempSerialPrintContent);
                        tempSerialPrintContent = new CSerialPrintContent();
                        tempSerialPrintContent.StringLine = "Type: " + tempOrderInfo.Status;
                        serialBody.Add(tempSerialPrintContent);

                        CCustomerManager tempCustomerManager = new CCustomerManager();
                        CCustomerInfo tempCustomerInfo = (CCustomerInfo)tempCustomerManager.CustomerInfoGetByCustomerID(tempOrderInfo.CustomerID).Data;

                        tempSerialPrintContent = new CSerialPrintContent();
                        tempSerialPrintContent.StringLine = "Customer Name: " + tempCustomerInfo.CustomerName;
                        serialBody.Add(tempSerialPrintContent);
                        if (tempOrderInfo.Status.Equals("Delivery"))
                        {
                            tempSerialPrintContent = new CSerialPrintContent();
                            tempSerialPrintContent.StringLine = "Address:";
                            serialBody.Add(tempSerialPrintContent);

                            tempSerialPrintContent = new CSerialPrintContent();
                            tempSerialPrintContent.StringLine = "----------------------------------------";
                            serialBody.Add(tempSerialPrintContent);

                            if (tempCustomerInfo.FloorAptNumber.Length > 0)
                            {
                                tempSerialPrintContent = new CSerialPrintContent();
                                tempSerialPrintContent.StringLine = "Floor or Apartment:" + tempCustomerInfo.FloorAptNumber;
                                serialBody.Add(tempSerialPrintContent);
                            }

                            if (tempCustomerInfo.BuildingName.Length > 0)
                            {
                                tempSerialPrintContent = new CSerialPrintContent();
                                tempSerialPrintContent.StringLine = "Building Name:" + tempCustomerInfo.BuildingName;
                                serialBody.Add(tempSerialPrintContent);
                            }

                            if (tempCustomerInfo.HouseNumber.Length > 0)
                            {
                                tempSerialPrintContent = new CSerialPrintContent();
                                tempSerialPrintContent.StringLine = "House Number:" + tempCustomerInfo.HouseNumber;
                                serialBody.Add(tempSerialPrintContent);
                            }

                            string[] street = new string[0];
                            street = tempCustomerInfo.StreetName.Split('-');

                            if (street.Length > 1)
                            {
                                if (street[0].ToString().Length > 0)
                                {
                                    tempSerialPrintContent = new CSerialPrintContent();
                                    tempSerialPrintContent.StringLine = "Street:" + street[0].ToString();
                                    serialBody.Add(tempSerialPrintContent);
                                }

                                if (street[1].ToString().Length > 0)
                                {
                                    tempSerialPrintContent = new CSerialPrintContent();
                                    tempSerialPrintContent.StringLine = street[1].ToString();
                                    serialBody.Add(tempSerialPrintContent);
                                }
                            }
                            else if (street.Length > 0 && street.Length < 2)
                            {
                                if (street[0].ToString().Length > 0)
                                {
                                    tempSerialPrintContent = new CSerialPrintContent();
                                    tempSerialPrintContent.StringLine = "Street:" + street[0].ToString();
                                    serialBody.Add(tempSerialPrintContent);
                                }
                            }

                            if (tempCustomerInfo.CustomerPostalCode.Length > 0)
                            {
                                tempSerialPrintContent = new CSerialPrintContent();
                                tempSerialPrintContent.StringLine = "Postal Code:" + tempCustomerInfo.CustomerPostalCode;
                                serialBody.Add(tempSerialPrintContent);
                            }
                            if (tempCustomerInfo.CustomerTown.Length > 0)
                            {
                                tempSerialPrintContent = new CSerialPrintContent();
                                tempSerialPrintContent.StringLine = "Town:" + tempCustomerInfo.CustomerTown;
                                serialBody.Add(tempSerialPrintContent);
                            }

                            tempSerialPrintContent = new CSerialPrintContent();
                            tempSerialPrintContent.StringLine = "----------------------------------------";
                            serialBody.Add(tempSerialPrintContent);

                            CDelivery objDelivery = new CDelivery();
                            objDelivery.DeliveryOrderID = orderID;
                            CResult objDeliveryInfo = tempOrderManager.GetDeliveryInfo(objDelivery);
                            objDelivery = (CDelivery)objDeliveryInfo.Data;
                            if (objDelivery != null)
                            {
                                tempSerialPrintContent = new CSerialPrintContent();
                                tempSerialPrintContent.StringLine = "\r\nDelivery Time:" + objDelivery.DeliveryTime;
                                serialBody.Add(tempSerialPrintContent);
                            }
                        }
                    }
                    else if (tempOrderInfo.OrderType.Equals("Tabs"))
                    {
                        tempSerialPrintContent = new CSerialPrintContent();
                        tempSerialPrintContent.StringLine = "            Tabs Number: " + tempOrderInfo.TableNumber + "\n";
                        tempSerialPrintContent.Bold = true;
                        serialBody.Add(tempSerialPrintContent);

                        tempSerialPrintContent = new CSerialPrintContent();
                        tempSerialPrintContent.StringLine = "            Guest Number: " + tempOrderInfo.GuestCount + "\n";
                        tempSerialPrintContent.Bold = true;
                        serialBody.Add(tempSerialPrintContent);
                    }

                    tempSerialPrintContent = new CSerialPrintContent();
                    tempSerialPrintContent.StringLine = "Order Information";
                    serialBody.Add(tempSerialPrintContent);
                    tempSerialPrintContent = new CSerialPrintContent();
                    tempSerialPrintContent.StringLine = "----------------------------------------";
                    serialBody.Add(tempSerialPrintContent);
                    tempSerialPrintContent = new CSerialPrintContent();
                    tempSerialPrintContent.StringLine = "Qty Item                         Price  ";
                    serialBody.Add(tempSerialPrintContent);
                    tempSerialPrintContent = new CSerialPrintContent();
                    tempSerialPrintContent.StringLine = "----------------------------------------";
                    serialBody.Add(tempSerialPrintContent);

                    CResult tempResult = new CResult();
                    tempResult = tempOrderManager.OrderDetailsArchiveByOrderID(orderID);

                    if (tempResult.IsSuccess)
                    {
                        List<COrderDetails> tempList = new List<COrderDetails>();
                        tempList = (List<COrderDetails>)tempResult.Data;
                        COrderDetails[] tempOrderDetails = tempList.ToArray();

                        for (int recordIndex = 0; recordIndex < tempOrderDetails.Length; recordIndex++)
                        {
                            String tempItemName = String.Empty;
                            if (tempOrderDetails[recordIndex].CategoryLevel == 3)
                            {
                                DataRow[] tempDataRowArr = Program.initDataSet.Tables["Category3"].Select("cat3_id = " + tempOrderDetails[recordIndex].ProductID);
                                tempItemName = tempDataRowArr[0]["cat3_name"].ToString();
                            }
                            else if (tempOrderDetails[recordIndex].CategoryLevel == 4)
                            {
                                DataRow[] tempDataRowArr = Program.initDataSet.Tables["Category4"].Select("cat4_id = " + tempOrderDetails[recordIndex].ProductID);
                                tempItemName = tempDataRowArr[0]["cat4_name"].ToString();
                            }

                            tempSerialPrintContent = new CSerialPrintContent();
                            tempSerialPrintContent.StringLine = tempOrderDetails[recordIndex].OrderQuantity.ToString()+" ";
                            tempSerialPrintContent.StringLine += ProcessItemNameFormat(tempItemName, 38);
                            tempSerialPrintContent.StringLine += "\r\n---------------------------------- " + tempOrderDetails[recordIndex].OrderAmount.ToString("F02");
                            serialBody.Add(tempSerialPrintContent);
                        }
                    }

                    tempSerialPrintContent = new CSerialPrintContent();
                    tempSerialPrintContent.StringLine = "----------------------------------------";
                    serialBody.Add(tempSerialPrintContent);
                    tempSerialPrintContent = new CSerialPrintContent();
                    tempSerialPrintContent.StringLine = "                      Order Total: " + ViewReportDataGridView.Rows[tempRowIndex].Cells["TotalPaymentColumn"].Value.ToString();
                    serialBody.Add(tempSerialPrintContent);

                    tempSerialPrintContent = new CSerialPrintContent();
                    tempSerialPrintContent.StringLine = "----------------------------------------";
                    serialBody.Add(tempSerialPrintContent);
                    tempSerialPrintContent = new CSerialPrintContent();
                    tempSerialPrintContent.StringLine = "\nS/N: " + tempOrderInfo.SerialNo.ToString();
                    serialBody.Add(tempSerialPrintContent);
                    tempPrintMethods.SerialPrint(PRINTER_TYPES.NORMAL_PRINTER, serialHeader, serialBody, serialFooter, tempOrderInfo.SerialNo.ToString());

                    string printingObject = "";
                    for (int arrayIndex = 0; arrayIndex < serialBody.Count; arrayIndex++)
                    {
                        printingObject += serialBody[arrayIndex].StringLine.ToString() + "\r\n";
                    }

                    this.WriteString(printingObject);///Write to a file when print command is executed

                }
            }
            catch (Exception exp)
            {
                throw exp;
            }
        }
Example #30
0
        private void CBookingForm_Activated(object sender, EventArgs e)
        {
            try
            {
                DateLabel.Text = tempCurrentDate.ToString("d/MM/yyyy");
                viewBookingDataGridView.RowCount = 19;

                if (Updated == true)
                {
                    if (tempCurrentDate.Date.CompareTo(DateTime.Today.Date) != 0) tempCurrentDate = new DateTime(tempCurrentDate.Year, tempCurrentDate.Month, tempCurrentDate.Day, 8, 0, 0);
                    else if (tempCurrentDate.Date.CompareTo(DateTime.Today.Date) == 0) tempCurrentDate = DateTime.Now;

                    COrderManager tempOrderManager = new COrderManager();
                    CResult tempResult = tempOrderManager.GetBookingInfoAll(tempCurrentDate);

                    if (tempResult.IsSuccess)
                    {
                        List<CBooking> tempBookingList = (List<CBooking>)tempResult.Data;
                        viewBookingDataGridView.Rows.Clear();

                        if (tempBookingList != null)
                        {
                            PopulateviewBookingDataGridView(tempBookingList);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }