Example #1
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 #2
0
        private void exportToCSVfile(string fileOut)
        {
            //      SqlConnection conn = new SqlConnection(DBForm.sqlConnString);
            //     string sqlQuery = "select * from " + this.lbxTables.SelectedItem.ToString();
            //    SqlCommand command = new SqlCommand(sqlQuery, conn);
            //   conn.Open();

            // productsTable.d

            //     SqlDataReader dr = command.ExecuteReader();

            //     DataTable dtSchema = dr.GetSchemaTable();

                   StreamWriter sw = new StreamWriter(fileOut, false, Encoding.Unicode);

            //      string strRow;
            //        if (this.chkFirstRowColumnNames.Checked)
            //      {
            //            sw.WriteLine(columnNames(dtSchema, this.separator));
            //       }

            string strRow = "";

            string separator = "\t";

            //strRow += "cat1 ";
            //strRow += separator;

            //strRow += "cat2 ";
            //strRow += separator;

            strRow += "Item ID";
            strRow += separator;

            strRow += "Product Name";
            strRow += separator;

            strRow += "Retail Price";
            strRow += separator;

            strRow += "Whole Price";
            strRow += separator;

            strRow += "Last Purchase Price";
            strRow += separator;

            strRow += "Vat Included";
            strRow += separator;

            strRow += "Non Tax ableGood";
            strRow += separator;

            strRow += "Qnty Per S.U.";
            strRow += separator;

            strRow += "Qnty Per P U";
            strRow += separator;

            strRow += "Stock";
            strRow += separator;

            sw.WriteLine(strRow);

            foreach (DataGridViewRow row in dgvFoodItem.Rows)
            {
                int itemID = Convert.ToInt32(row.Cells["cat3_id"].Value);

               //     CCategoryManager oManager = new CCategoryManager();
                CCategory3DAO cCategory3Dao = new CCategory3DAO();
                CCategory3 objFoodItemUpdate = cCategory3Dao.GetAllCategory3ByCategory3ID(itemID);
             //   CCategory3 objFoodItemUpdate = (CCategory3)oResult.Data;

                //   foreach (DataRow row in productsTable.Rows)
                //    {
                strRow = "";

                //Category Name
                //try
                //{

                //    strRow += Convert.ToString(row.Cells["cat1"].Value);
                //}
                //catch (Exception ex) { strRow += ""; }
                //strRow += separator;

                ////Category2_Name
                //try { strRow += Convert.ToString(row.Cells["cat2"].Value); }
                //catch (Exception ex) { strRow += ""; }
                //strRow += separator;

                //Item ID

                //  int itemID = 0;

                try
                {
                    strRow += Convert.ToString(itemID);
                }
                catch (Exception ex) { strRow += ""; }
                strRow += separator;

                //Product Name
                try { strRow += objFoodItemUpdate.Category3Name; }
                catch (Exception ex) { strRow += "  "; }
                strRow += separator;

                //Retail Sale Price
              //  try { strRow += objFoodItemUpdate.MRetailPrice.ToString("F2"); }
                try { strRow += objFoodItemUpdate.Category3TablePrice.ToString("F2"); }
                catch (Exception ex) { strRow += "   "; }
                strRow += separator;

                //WholeSalePrice
               // try { strRow += Convert.ToString(objFoodItemUpdate.MWholeSalePrice.ToString("F2")); }
                try { strRow += Convert.ToString(objFoodItemUpdate.Category3TakeAwayPrice.ToString("F2")); }
                catch (Exception ex) { strRow += "   "; }
                strRow += separator;

                //LastPurchasePrice
               // try { strRow += Convert.ToString(objFoodItemUpdate.MLastPurchasePrice.ToString("F2")); }
                try { strRow += Convert.ToString(objFoodItemUpdate.Category3BarPrice.ToString("F2")); }
                catch (Exception ex) { strRow += "   "; }
                strRow += separator;

                //VatIncluded
                try
                {
                    strRow += objFoodItemUpdate.MVatIncluded.ToString();
                }
                catch (Exception ex) { strRow += "   "; }
                strRow += separator;

                //NonTaxableGood
                try
                {
                    strRow += objFoodItemUpdate.MNonTaxableGood.ToString();
                }
                catch (Exception ex) { strRow += "   "; }
                strRow += separator;

                //QTYPerSaleUint
                try
                {

                    strRow += objFoodItemUpdate.MQtyPerSaleUint.ToString();
                }
                catch (Exception ex) { strRow += "   "; }
                strRow += separator;

                //QTYPerPurchaseUnit
                try
                {

                    strRow += objFoodItemUpdate.MQtyPerPurchaseUnit.ToString();
                }
                catch (Exception ex) { strRow += "   "; }
                strRow += separator;

                //Stock
                try
                {
                    strRow += objFoodItemUpdate.MUnitsInStock.ToString();

                }
                catch (Exception ex) { strRow += "   "; }
                strRow += separator;

                sw.WriteLine(strRow);
            }

            sw.Close();

            MessageBox.Show("CSV file Created Successful");
        }
Example #3
0
        private void PrintNewBeverage()
        {
            int papersize = 29;
            StringPrintFormater strPrintFormatter = new StringPrintFormater(29);

            string Cat1ID = String.Empty;
            bool blnToBePrinted = false;

            try
            {
                CPrintMethodsEXT tempPrintMethods = new CPrintMethodsEXT();

                //string serialHeader = "IBACS RMS";

                string serialHeader = "";
                string serialFooter = "";
                List<CSerialPrintContent> serialBody = new List<CSerialPrintContent>();
                List<CSerialPrintContent> serialBody2 = new List<CSerialPrintContent>();
                CSerialPrintContent tempSerialPrintContent = new CSerialPrintContent();
                COrderManager tempOrderManager = new COrderManager();
                COrderInfo tempOrderInfo = (COrderInfo)tempOrderManager.OrderInfoByOrderID(orderID).Data;
                //tempSerialPrintContent.StringLine = "               Beverages/Non-Food\n";

                if (m_iType == m_cCommonConstants.TableType)
                {

                    tempSerialPrintContent = new CSerialPrintContent();
                    //tempSerialPrintContent.StringLine = "             Table No:" + m_iTableNumber.ToString();

                    tempSerialPrintContent.StringLine = "Table No:\r\n" + m_iTableNumber.ToString();

                    tempSerialPrintContent.Bold = true;
                    serialBody.Add(tempSerialPrintContent);
                    serialBody2.Add(tempSerialPrintContent);

                    tempSerialPrintContent = new CSerialPrintContent();

                    //tempSerialPrintContent.StringLine = "             Guest No:" +tempOrderInfo.GuestCount.ToString() + "\r\n";
                    tempSerialPrintContent.StringLine = "Covers:" + tempOrderInfo.GuestCount.ToString();

                    tempSerialPrintContent.Bold = true;
                    serialBody.Add(tempSerialPrintContent);
                    serialBody2.Add(tempSerialPrintContent);

                }

                tempSerialPrintContent = new CSerialPrintContent();
                tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.CenterTextWithWhiteSpace("Beverages/Non-Food");
                serialBody.Add(tempSerialPrintContent);
                serialBody2.Add(tempSerialPrintContent);

                //string s=tempOrderInfo.
                if (m_iType == m_cCommonConstants.TableType)
                {

                    tempSerialPrintContent = new CSerialPrintContent();
                    tempSerialPrintContent.StringLine = "Order ID:" + orderID.ToString();
                    serialBody.Add(tempSerialPrintContent);
                    serialBody2.Add(tempSerialPrintContent);

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

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

                    //tempSerialPrintContent = new CSerialPrintContent();
                    ////tempSerialPrintContent.StringLine = "             Table No:" + m_iTableNumber.ToString();

                    //tempSerialPrintContent.StringLine = "\r\n\nTable No:" + m_iTableNumber.ToString();

                    //tempSerialPrintContent.Bold = true;
                    //serialBody.Add(tempSerialPrintContent);
                    //serialBody2.Add(tempSerialPrintContent);

                    //tempSerialPrintContent = new CSerialPrintContent();

                    ////tempSerialPrintContent.StringLine = "             Guest No:" +tempOrderInfo.GuestCount.ToString() + "\r\n";
                    //tempSerialPrintContent.StringLine = "Covers:" + tempOrderInfo.GuestCount.ToString();

                    //tempSerialPrintContent.Bold = true;
                    //serialBody.Add(tempSerialPrintContent);
                    //serialBody2.Add(tempSerialPrintContent);

                    COrderWaiterDao orderWaiterDao = new COrderWaiterDao();
                    COrderwaiter orderWaiter = orderWaiterDao.GetOrderwaiterByOrderID(orderID);
                    if (orderWaiter != null && orderWaiter.WaiterID > 0)
                    {
                        tempSerialPrintContent = new CSerialPrintContent();
                        tempSerialPrintContent.StringLine = "Waiter Name: " + orderWaiter.WaiterName +"\r\n" ;
                        tempSerialPrintContent.Bold = true;
                        serialBody.Add(tempSerialPrintContent);
                        serialBody2.Add(tempSerialPrintContent);
                    }

                }
                else if (m_iType == m_cCommonConstants.TakeAwayType)
                {
                    tempSerialPrintContent = new CSerialPrintContent();
                    tempSerialPrintContent.StringLine = "Order Date:" + tempOrderInfo.OrderTime.ToString("dd/MM/yy hh:mm tt");

                    serialBody.Add(tempSerialPrintContent);
                    serialBody2.Add(tempSerialPrintContent);

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

                    tempSerialPrintContent = new CSerialPrintContent();
                    tempSerialPrintContent.StringLine = "Type:" + tempOrderInfo.Status;
                    serialBody.Add(tempSerialPrintContent);
                    serialBody2.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);
                    serialBody2.Add(tempSerialPrintContent);

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

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

                        tempSerialPrintContent = new CSerialPrintContent();

                        //tempSerialPrintContent.StringLine = "----------------------------------------";
                        tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.CreateDashedLine();
                        serialBody.Add(tempSerialPrintContent);
                        serialBody2.Add(tempSerialPrintContent);

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

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

                        if (tempCustomerInfo.HouseNumber.Length > 0)
                        {
                            tempSerialPrintContent = new CSerialPrintContent();
                            tempSerialPrintContent.StringLine = "House Number:" + tempCustomerInfo.HouseNumber;
                            serialBody.Add(tempSerialPrintContent);
                            serialBody2.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);
                                serialBody2.Add(tempSerialPrintContent);
                            }

                            if (street[1].ToString().Length > 0)
                            {
                                tempSerialPrintContent = new CSerialPrintContent();
                                tempSerialPrintContent.StringLine = street[1].ToString();
                                serialBody.Add(tempSerialPrintContent);
                                serialBody2.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);
                                serialBody2.Add(tempSerialPrintContent);
                            }
                        }

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

                        tempSerialPrintContent = new CSerialPrintContent();

                        //tempSerialPrintContent.StringLine = "----------------------------------------";
                        tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.CreateDashedLine();
                        serialBody.Add(tempSerialPrintContent);
                        serialBody2.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);
                            serialBody2.Add(tempSerialPrintContent);
                        }
                    }
                }

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

                //tempSerialPrintContent.StringLine = "----------------------------------------";

                tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.CreateDashedLine();
                serialBody.Add(tempSerialPrintContent);
                serialBody2.Add(tempSerialPrintContent);
                tempSerialPrintContent = new CSerialPrintContent();
                if (m_isBarPriceAvailable == true)
                {
                    //tempSerialPrintContent.StringLine = "Qty Item                      Price(" + Program.currency.ToString() + ")";
                    tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.ItemLabeledText("Qty Item", "Price(" + Program.currency + ")");

                }
                else
                {
                    tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.ItemLabeledText("Qty Item", "");
                }
                serialBody.Add(tempSerialPrintContent);
                serialBody2.Add(tempSerialPrintContent);

                tempSerialPrintContent = new CSerialPrintContent();
                //tempSerialPrintContent.StringLine = "----------------------------------------";

                tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.CreateDashedLine();
                serialBody.Add(tempSerialPrintContent);
                serialBody.Add(tempSerialPrintContent);
               // serialBody2 = serialBody;
                bool nonfood = false;
                bool othernoonfood = false;
                PrintUtility printUtility = new PrintUtility();

                if (m_orderUserName.Replace(" ", "").ToUpper() != "Web User".Replace(" ", "").ToUpper())
                {
                    Hashtable htOrderedItems = new Hashtable();
                    string categoryOrder = String.Empty;

                    for (int rowIndex = 0; rowIndex < g_BeverageDataGridView.Rows.Count; rowIndex++)
                    {
                        DataGridViewRow tempRow = g_BeverageDataGridView.Rows[rowIndex];

                        int totalItem = Convert.ToInt32("0" + tempRow.Cells[1].Value);
                        int printItem = Convert.ToInt32("0" + tempRow.Cells[8].Value);                             // Here index number was 7 and now change index number is 8 by mithu
                        if ((!tempRow.Cells[0].Value.ToString().Equals("")) && (totalItem > printItem))
                        {
                            blnToBePrinted = true;
                            tempSerialPrintContent = new CSerialPrintContent();
                            int productId = Convert.ToInt32(tempRow.Cells[4].Value.ToString());
                            CCategory3DAO aDao = new CCategory3DAO();
                            string printstatus = aDao.GetAllCategory3printareaByCategory3ID(productId);
                            double price = (Convert.ToDouble("0" + tempRow.Cells[3].Value.ToString()) / Convert.ToInt32("0" + tempRow.Cells[1].Value.ToString())) * (totalItem - printItem);//change for kitchen

                            //tempSerialPrintContent.StringLine += CPrintMethods.GetFixedString(tempRow.Cells[0].Value.ToString(), 30);
                            if (printstatus == "OtherNonfood")
                            {
                                othernoonfood = true;
                                tempSerialPrintContent = new CSerialPrintContent();

                                if (m_isBarPriceAvailable == true) //Is bar price available or not for online order
                                {
                                    //   tempSerialPrintContent.StringLine += strPrintFormatter.ItemLabeledText(Convert.ToString(g_BeverageDataGridView.Rows[rowIndex].Cells[1].Value) + "  " + Convert.ToString(g_BeverageDataGridView.Rows[rowIndex].Cells[0].Value), Convert.ToDouble("0" + g_BeverageDataGridView.Rows[rowIndex].Cells[2].Value).ToString("F02"));

                                    // tempSerialPrintContent.StringLine += strPrintFormatter.ItemLabeledText(Convert.ToString(g_BeverageDataGridView.Rows[rowIndex].Cells[1].Value) + "  " +
                                    //  printUtility.MultipleLine(Convert.ToString(g_BeverageDataGridView.Rows[rowIndex].Cells[0].Value), papersize - 10, Convert.ToDouble("0" + g_BeverageDataGridView.Rows[rowIndex].Cells[2].Value).ToString("F02"), papersize-3), "");

                                    tempSerialPrintContent.StringLine += strPrintFormatter.ItemLabeledText(Convert.ToString(totalItem-printItem) + "  " +
                                      printUtility.MultipleLine(Convert.ToString(g_BeverageDataGridView.Rows[rowIndex].Cells[0].Value), papersize - 10, price.ToString("F02"), papersize - 3), ""); //change for kitchen

                                }
                                else
                                {
                                    //tempSerialPrintContent.StringLine += strPrintFormatter.ItemLabeledText(Convert.ToString(g_BeverageDataGridView.Rows[rowIndex].Cells[1].Value) + "  " + Convert.ToString(g_BeverageDataGridView.Rows[rowIndex].Cells[0].Value), "");

                                    tempSerialPrintContent.StringLine += strPrintFormatter.ItemLabeledText(Convert.ToString(totalItem - printItem) + "  " +
                                       printUtility.MultipleLine(Convert.ToString(g_BeverageDataGridView.Rows[rowIndex].Cells[0].Value), papersize - 5, "", papersize), "");

                                }

                                serialBody2.Add(tempSerialPrintContent);

                            }
                            else
                            {
                                tempSerialPrintContent = new CSerialPrintContent();
                                nonfood = true;
                                if (m_isBarPriceAvailable == true) //Is bar price available or not for online order
                                {
                                    //   tempSerialPrintContent.StringLine += strPrintFormatter.ItemLabeledText(Convert.ToString(g_BeverageDataGridView.Rows[rowIndex].Cells[1].Value) + "  " + Convert.ToString(g_BeverageDataGridView.Rows[rowIndex].Cells[0].Value), Convert.ToDouble("0" + g_BeverageDataGridView.Rows[rowIndex].Cells[2].Value).ToString("F02"));

                                    // tempSerialPrintContent.StringLine += strPrintFormatter.ItemLabeledText(Convert.ToString(g_BeverageDataGridView.Rows[rowIndex].Cells[1].Value) + "  " +
                                    //  printUtility.MultipleLine(Convert.ToString(g_BeverageDataGridView.Rows[rowIndex].Cells[0].Value), papersize - 10, Convert.ToDouble("0" + g_BeverageDataGridView.Rows[rowIndex].Cells[2].Value).ToString("F02"), papersize-3), "");

                                    tempSerialPrintContent.StringLine +=
                                        strPrintFormatter.ItemLabeledText(
                                            Convert.ToString(totalItem - printItem) +
                                            "  " +
                                            printUtility.MultipleLine(
                                                Convert.ToString(g_BeverageDataGridView.Rows[rowIndex].Cells[0].Value),
                                                papersize - 10, price.ToString("F02"), papersize - 3), ""); //change for kitchen

                                }
                                else
                                {
                                    //tempSerialPrintContent.StringLine += strPrintFormatter.ItemLabeledText(Convert.ToString(g_BeverageDataGridView.Rows[rowIndex].Cells[1].Value) + "  " + Convert.ToString(g_BeverageDataGridView.Rows[rowIndex].Cells[0].Value), "");

                                    tempSerialPrintContent.StringLine +=
                                        strPrintFormatter.ItemLabeledText(
                                            Convert.ToString(totalItem - printItem) +
                                            "  " +
                                            printUtility.MultipleLine(
                                                Convert.ToString(g_BeverageDataGridView.Rows[rowIndex].Cells[0].Value),
                                                papersize - 5, "", papersize), "");

                                }

                                serialBody.Add(tempSerialPrintContent);
                               // itemAvailable = true;
                            }
                        }
                    }
                }

                else
                {
                    //For online orders
                    //tempSerialPrintContent = new CSerialPrintContent();
                    //tempSerialPrintContent.StringLine = "----------------------------------------\r\n";
                    //serialBody.Add(tempSerialPrintContent);

                    for (int rowIndex = 0; rowIndex < g_BeverageDataGridView.RowCount; rowIndex++)
                    {
                        DataGridViewRow tempRow = g_BeverageDataGridView.Rows[rowIndex];
                        int totalItem = Convert.ToInt32("0" + tempRow.Cells[1].Value);
                        int printItem = Convert.ToInt32("0" + tempRow.Cells[7].Value);

                        if ((!tempRow.Cells[0].Value.ToString().Equals("")) && (totalItem > printItem))
                        {
                            tempSerialPrintContent = new CSerialPrintContent();
                            int productId = Convert.ToInt32(tempRow.Cells[4].Value.ToString());
                            CCategory3DAO aDao = new CCategory3DAO();
                            string printstatus = aDao.GetAllCategory3printareaByCategory3ID(productId);
                            double price = (Convert.ToDouble("0" + tempRow.Cells[3].Value.ToString()) / Convert.ToInt32("0" + tempRow.Cells[1].Value.ToString())) * (totalItem - printItem); //change for kitchen

                            //tempSerialPrintContent.StringLine += CPrintMethods.GetFixedString(tempRow.Cells[0].Value.ToString(), 30);
                            if (printstatus == "OtherNonfood")
                            {
                                othernoonfood = true;
                                tempSerialPrintContent = new CSerialPrintContent();

                                if (m_isBarPriceAvailable == true) //Is bar price available or not for online order
                                {
                                    //   tempSerialPrintContent.StringLine += strPrintFormatter.ItemLabeledText(Convert.ToString(g_BeverageDataGridView.Rows[rowIndex].Cells[1].Value) + "  " + Convert.ToString(g_BeverageDataGridView.Rows[rowIndex].Cells[0].Value), Convert.ToDouble("0" + g_BeverageDataGridView.Rows[rowIndex].Cells[2].Value).ToString("F02"));

                                    // tempSerialPrintContent.StringLine += strPrintFormatter.ItemLabeledText(Convert.ToString(g_BeverageDataGridView.Rows[rowIndex].Cells[1].Value) + "  " +
                                    //  printUtility.MultipleLine(Convert.ToString(g_BeverageDataGridView.Rows[rowIndex].Cells[0].Value), papersize - 10, Convert.ToDouble("0" + g_BeverageDataGridView.Rows[rowIndex].Cells[2].Value).ToString("F02"), papersize-3), "");

                                    tempSerialPrintContent.StringLine += strPrintFormatter.ItemLabeledText(Convert.ToString(totalItem - printItem) + "  " +
                                      printUtility.MultipleLine(Convert.ToString(g_BeverageDataGridView.Rows[rowIndex].Cells[0].Value), papersize - 10, price.ToString("F02"), papersize - 3), "");//change for kitchen

                                }
                                else
                                {
                                    //tempSerialPrintContent.StringLine += strPrintFormatter.ItemLabeledText(Convert.ToString(g_BeverageDataGridView.Rows[rowIndex].Cells[1].Value) + "  " + Convert.ToString(g_BeverageDataGridView.Rows[rowIndex].Cells[0].Value), "");

                                    tempSerialPrintContent.StringLine += strPrintFormatter.ItemLabeledText(Convert.ToString(totalItem - printItem) + "  " +
                                       printUtility.MultipleLine(Convert.ToString(g_BeverageDataGridView.Rows[rowIndex].Cells[0].Value), papersize - 5, "", papersize), "");

                                }

                                serialBody2.Add(tempSerialPrintContent);

                            }
                            else
                            {
                                tempSerialPrintContent = new CSerialPrintContent();
                                nonfood = true;
                                if (m_isBarPriceAvailable == true) //Is bar price available or not for online order
                                {
                                    //   tempSerialPrintContent.StringLine += strPrintFormatter.ItemLabeledText(Convert.ToString(g_BeverageDataGridView.Rows[rowIndex].Cells[1].Value) + "  " + Convert.ToString(g_BeverageDataGridView.Rows[rowIndex].Cells[0].Value), Convert.ToDouble("0" + g_BeverageDataGridView.Rows[rowIndex].Cells[2].Value).ToString("F02"));

                                    // tempSerialPrintContent.StringLine += strPrintFormatter.ItemLabeledText(Convert.ToString(g_BeverageDataGridView.Rows[rowIndex].Cells[1].Value) + "  " +
                                    //  printUtility.MultipleLine(Convert.ToString(g_BeverageDataGridView.Rows[rowIndex].Cells[0].Value), papersize - 10, Convert.ToDouble("0" + g_BeverageDataGridView.Rows[rowIndex].Cells[2].Value).ToString("F02"), papersize-3), "");

                                    tempSerialPrintContent.StringLine +=
                                        strPrintFormatter.ItemLabeledText(
                                            Convert.ToString(totalItem - printItem) +
                                            "  " +
                                            printUtility.MultipleLine(
                                                Convert.ToString(g_BeverageDataGridView.Rows[rowIndex].Cells[0].Value),
                                                papersize - 10, price.ToString("F02"), papersize - 3), "");  ////change for kitchen

                                }
                                else
                                {
                                    //tempSerialPrintContent.StringLine += strPrintFormatter.ItemLabeledText(Convert.ToString(g_BeverageDataGridView.Rows[rowIndex].Cells[1].Value) + "  " + Convert.ToString(g_BeverageDataGridView.Rows[rowIndex].Cells[0].Value), "");

                                    tempSerialPrintContent.StringLine +=
                                        strPrintFormatter.ItemLabeledText(
                                            Convert.ToString(totalItem - printItem) +
                                            "  " +
                                            printUtility.MultipleLine(
                                                Convert.ToString(g_BeverageDataGridView.Rows[rowIndex].Cells[0].Value),
                                                papersize - 5, "", papersize), "");

                                }

                                serialBody.Add(tempSerialPrintContent);
                                //itemAvailable = true;
                            }
                            blnToBePrinted = true;
                        }
                    }
                }

                tempSerialPrintContent = new CSerialPrintContent();

                //tempSerialPrintContent.StringLine = "----------------------------------------";
                tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.CreateDashedLine();
                serialBody.Add(tempSerialPrintContent);
                serialBody2.Add(tempSerialPrintContent);

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

                tempSerialPrintContent = new CSerialPrintContent();
                tempSerialPrintContent.StringLine = m_TerminalName.Trim();
                serialBody.Add(tempSerialPrintContent);
                serialBody2.Add(tempSerialPrintContent);

                #region "Testing printing area"
                string printingObject = "";
                string printingObject2 = "";

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

                if (blnToBePrinted == true) //If there is new items
                {
                    if (nonfood)
                    {
                        for (int printCopy = 0; printCopy < m_barCopyNumber; printCopy++)
                        {
                            //tempPrintMethods.SerialPrint(PRINTER_TYPES.NORMAL_PRINTER, serialHeader, serialBody, serialFooter, tempOrderInfo.SerialNo.ToString());
                            // tempPrintMethods.SerialPrint(PRINTER_TYPES.NORMAL_PRINTER, serialHeader, serialBody, serialFooter, tempOrderInfo.SerialNo.ToString(),true);

                            string fullPrintingText = serialHeader + "\r\n" + printingObject + "\r\n" + serialFooter;
                            tempPrintMethods.USBPrint(fullPrintingText, PrintDestiNation.BEVARAGE, false);
                        }

                        this.WriteString(printingObject); ///Write to a file when print command is executed
                    }
                    if (othernoonfood)
                    {
                        for (int printCopy = 0; printCopy < m_barCopyNumber; printCopy++)
                        {
                            //tempPrintMethods.SerialPrint(PRINTER_TYPES.NORMAL_PRINTER, serialHeader, serialBody, serialFooter, tempOrderInfo.SerialNo.ToString());
                            // tempPrintMethods.SerialPrint(PRINTER_TYPES.NORMAL_PRINTER, serialHeader, serialBody, serialFooter, tempOrderInfo.SerialNo.ToString(),true);

                            string fullPrintingText = serialHeader + "\r\n" + printingObject2 + "\r\n" + serialFooter;
                            tempPrintMethods.USBPrint(fullPrintingText, PrintDestiNation.OtherNonFood, false);
                        }

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

                #endregion

            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message, RMSGlobal.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #4
0
        private bool CheckStockControl()
        {
            CCategory3DAO cCategory3Dao = new CCategory3DAO();

            COrderManager tempOrderManager = new COrderManager();
            List<COrderDetails> tempOrderDetailsList = new List<COrderDetails>();

            CResult oResult = tempOrderManager.OrderDetailsByOrderID(orderID);

            if (oResult.IsSuccess && oResult.Data != null)
                tempOrderDetailsList = (List<COrderDetails>)oResult.Data;

            string stockMessage = "Stock is unavailable ";
            bool isStockAvailable = true;

            foreach (COrderDetails orderDetail in tempOrderDetailsList)
            {
                CCategory3 cCategory3 = cCategory3Dao.GetAllCategory3ByCategory3ID(Convert.ToInt32(orderDetail.ProductID));

                if ((orderDetail.OrderQuantity - orderDetail.KitchenQuantity) > cCategory3.MUnitsInStock && cCategory3.MNonStockable)
                {
                    //stockMessage += "\n   " + orderDetail.Product_Name + "  " + (orderDetail.OrderQuantity - cCategory3.MUnitsInStock);
                    stockMessage += "\n   " + cCategory3.Category3Name + ": Needed: " + (orderDetail.OrderQuantity - orderDetail.KitchenQuantity) + " But Have " + (cCategory3.MUnitsInStock);
                    isStockAvailable = false;
                }

            }

            if (!isStockAvailable)
            {
                CUserInfoDAO aUserInfoDao = new CUserInfoDAO();
                CUserInfo aUserInfo = new CUserInfo();
                aUserInfo = aUserInfoDao.GetUserInfoByUsername(RMSGlobal.LoginUserName);
                if (aUserInfo.Type == 0)
                {
                    DialogResult dialogResult = MessageBox.Show("Do You Proceed", "Stock Alert", MessageBoxButtons.YesNo);
                    if (dialogResult == DialogResult.Yes)
                    {
                        isStockAvailable = true;
                    }
                    else if (dialogResult == DialogResult.No)
                    {

                    }
                }

            }

            if (!isStockAvailable || !CheckRawProduct(tempOrderDetailsList))
            {
                CMessageBox cMessageBox = new CMessageBox("Finished Product", stockMessage);
                cMessageBox.ShowDialog();
                //MessageBox.Show(stockMessage);
                return false;
            }
            else
            {
                foreach (COrderDetails orderDetails in tempOrderDetailsList)
                {
                    CCategory3 cCategory3 = cCategory3Dao.GetAllCategory3ByCategory3ID(Convert.ToInt32(orderDetails.ProductID));
                    if (!cCategory3.MNonStockable)
                    {
                        cCategory3Dao.UpdateStock(Convert.ToInt32(orderDetails.ProductID), orderDetails.OrderQuantity - orderDetails.KitchenQuantity);
                        COrderDetailsDAO cOrderDetailsDao = new COrderDetailsDAO();
                        cOrderDetailsDao.UpdateKitchenQuantity(orderDetails);
                    }
                }
            }

            //   parrentForm.scre

            return true;
        }
Example #5
0
        /// <summary>
        /// Printing at the kitchen
        /// </summary>
        private void KitchenPrint()
        {
            int papersize = 29;
            StringPrintFormater strPrintFormatter = new StringPrintFormater(29);
            Hashtable htOrderedItems = new Hashtable();
            SortedList slOrderedItems = null;

            try
            {
                bool itemAvailable = false;
                CPrintMethodsEXT tempPrintMethods = new CPrintMethodsEXT();
                CCommonConstants oConstant = ConfigManager.GetConfig<CCommonConstants>();
                COrderManager tempOrderManager = new COrderManager();
                CResult oResult = tempOrderManager.OrderInfoByOrderID(orderID);
                COrderInfo tempOrderInfo = new COrderInfo();
                if (oResult.IsSuccess && oResult.Data != null)
                {
                    tempOrderInfo = (COrderInfo)oResult.Data;
                }

                if (oConstant.KitchenPrintFlag == 1)
                {
                    bool otherfoodprint = false;
                    bool foodprint = false;
                    string serialHeader = "";
                    string serialFooter = "";
                    string serialBody = "";
                    string serialBody2 = "";
                    if (m_iType == m_cCommonConstants.TableType)
                    {
                        //serialBody += "\r\n\r\n        Table Number:" + m_iTableNumber.ToString();
                        serialBody += "Table Number:\r\n" + m_iTableNumber.ToString();
                        serialBody += "\r\nCovers:" + tempOrderInfo.GuestCount.ToString();
                    }

                     serialBody += "\n\r\n";
                    serialBody += strPrintFormatter.CenterTextWithWhiteSpace("Kitchen Copy");

                    if (!tempOrderInfo.Status.Equals("Seated") && m_iType == m_cCommonConstants.TableType)
                    {
                        //serialBody += "\r\nReprint";
                        serialBody += "\r\n" + strPrintFormatter.CenterTextWithWhiteSpace("Reprint");
                    }
                    serialBody += "\r\n\r\nOrder ID:" + orderID.ToString();
                    serialBody += "\r\n\r\nOrder Date:" + tempOrderInfo.OrderTime.ToString("dd/MM/yy hh:mm tt");
                    serialBody += "\r\nPrint Date:" + DateTime.Now.ToString("dd/MM/yy hh:mm tt");

                    if (m_iType == m_cCommonConstants.TableType)
                    {
                        //serialBody += "\r\n\r\n        Table Number:" + m_iTableNumber.ToString();
                        //serialBody += "\r\n\n\r\nTable Number:" + m_iTableNumber.ToString();
                        //serialBody += "\r\nCovers:" + tempOrderInfo.GuestCount.ToString();

                        COrderWaiterDao orderWaiterDao = new COrderWaiterDao();
                        COrderwaiter orderWaiter = orderWaiterDao.GetOrderwaiterByOrderID(orderID);
                        if (orderWaiter != null && orderWaiter.WaiterID > 0)
                        {
                            serialBody += "\r\nWaiter Name: " + orderWaiter.WaiterName +"\r\n";
                        }
                    }
                    else if (m_iType == m_cCommonConstants.TakeAwayType)
                    {
                        //Waiter for Takeway
                        COrderWaiterDao orderWaiterDao = new COrderWaiterDao();
                        COrderwaiter orderWaiter = orderWaiterDao.GetOrderwaiterByOrderID(orderID);
                        if (orderWaiter != null && orderWaiter.WaiterID > 0)
                        {
                            serialBody += "\r\nWaiter Name: " + orderWaiter.WaiterName + "\r\n";
                        }
                        //serialBody += "\r\n\r\n        Take Away";
                        serialBody += "\r\n" + strPrintFormatter.CenterTextWithWhiteSpace("Take Away");
                        serialBody += "\r\nType: " + tempOrderInfo.Status;

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

                        if (tempCustomerInfo.CustomerName.Length > 0) //If customer name is present
                        {
                            serialBody += "\r\nCustomer Name: " + tempCustomerInfo.CustomerName;
                        }
                        if (tempCustomerInfo.CustomerPhone.Length > 0) //If customer phone number is available
                        {
                            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----------------------------------------";

                            serialBody += "\r\n" + strPrintFormatter.CreateDashedLine();

                            CDelivery objDelivery = new CDelivery();
                            objDelivery.DeliveryOrderID = 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" + strPrintFormatter.CenterTextWithWhiteSpace("Order Information");
                    //serialBody += "\r\n---------------------------------";

                    serialBody += "\r\n" + strPrintFormatter.CreateDashedLine();

                    if (m_isKitchenPriceAvailable == true)
                    {
                        //serialBody += "\r\nQty Item                      Price(" + Program.currency.ToString() + ")";
                        serialBody += "\r\n" + strPrintFormatter.ItemLabeledText("Qty Item", "Price(" + Program.currency + ")");

                    }
                    else
                    {
                        serialBody += "\r\nQty Item";

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

                    if (m_orderUserName.Replace(" ", "").ToUpper() != "Web User".Replace(" ", "").ToUpper())
                    {
                        string cat1ID = String.Empty;
                        string cat2ID = String.Empty;
                        string cat3ID = String.Empty;

                        string separatorCatID = String.Empty;
                        string category2Order = String.Empty; //Printing order will be according to category2 order

                        for (int rowIndex = 0; rowIndex < g_FoodDataGridView.Rows.Count; rowIndex++)
                        {
                            DataGridViewRow tempRow = g_FoodDataGridView.Rows[rowIndex];
                            category2Order = String.Empty;

                            if (!tempRow.Cells[0].Value.ToString().Equals(""))
                            {
                               // Int64 productID = Int64.Parse(tempRow.Cells[3].Value.ToString());
                               // Int32 productLevel = Int32.Parse(tempRow.Cells[4].Value.ToString());
                                Int64 productID = Int64.Parse(tempRow.Cells[4].Value.ToString());
                                Int32 productLevel = Int32.Parse(tempRow.Cells[5].Value.ToString());

                                if (productLevel == 3)
                                {
                                    DataRow[] dtRow = dsCategory3.Tables[0].Select("cat3_id = " + productID);
                                    if (dtRow.Length > 0)
                                    {
                                        cat2ID = dtRow[0]["cat2_id"].ToString();
                                    }
                                    cat1ID = Program.initDataSet.Tables["Category2"].Select("cat2_id = " + cat2ID)[0].GetParentRow(Program.initDataSet.Relations["category1_to_category2"])["cat1_id"].ToString();
                                }
                                else if (productLevel == 4)
                                {

                                    DataRow[] dtRow = dsCategory4.Tables[0].Select("cat4_id = " + productID);
                                    if (dtRow.Length > 0)
                                    {
                                        cat3ID = dtRow[0]["cat3_id"].ToString();
                                        if (cat3ID != "" || cat3ID != null)
                                        {
                                            dtRow = dsCategory3.Tables[0].Select("cat3_id = " + cat3ID);
                                        }
                                        else
                                        {
                                            dtRow = null;
                                        }
                                    }

                                    if (dtRow.Length > 0)
                                    {
                                        cat2ID = dtRow[0]["cat2_id"].ToString();
                                    }
                                    cat1ID = Program.initDataSet.Tables["Category2"].Select("cat2_id = " + cat2ID)[0].GetParentRow(Program.initDataSet.Relations["category1_to_category2"])["cat1_id"].ToString();//Not necessary
                                }
                                else if (productLevel == 0)// && inFoodType.Equals("Indian")) //If miscellenious foods.
                                {
                                    cat1ID = "0";
                                    cat2ID = "0";
                                }

                                #region "New "
                                CCategory3DAO aDao = new CCategory3DAO();
                                string printstatus = aDao.GetAllCategory3printareaByCategory3ID((int)productID);
                                clsOrderReport objOrderedItems = new clsOrderReport();
                               // objOrderedItems.Quantity = Convert.ToInt32("0" + tempRow.Cells[1].Value.ToString());
                               // objOrderedItems.ItemName = tempRow.Cells[0].Value.ToString();
                              //  objOrderedItems.Price = Convert.ToDouble("0" + tempRow.Cells[2].Value.ToString());

                                //For vat grid index
                                objOrderedItems.Quantity = Convert.ToInt32("0" + tempRow.Cells[1].Value.ToString());
                                objOrderedItems.ItemName = tempRow.Cells[0].Value.ToString();
                                objOrderedItems.Price = Convert.ToDouble("0" + tempRow.Cells[3].Value.ToString());
                                objOrderedItems.PrintArea = printstatus;

                                //htOrderedItems.Add(cat2ID + "-" + objOrderedItems.ItemName, objOrderedItems);

                                //Int64 rankNumber = Int64.Parse(tempRow.Cells[5].Value.ToString());
                                //For Vat
                                Int64 rankNumber = Int64.Parse(tempRow.Cells[6].Value.ToString());

                                Int32 category1OrderNumber = this.GetCategory1OrderNumber(Convert.ToInt32(cat1ID));

                                htOrderedItems.Add(category1OrderNumber + "-" + rankNumber.ToString() + "-" + objOrderedItems.ItemName, objOrderedItems);// Category 1 wise
                                #endregion
                                itemAvailable = true;//For drinks.When drinks is avalable then no separator is used.
                            }
                        }

                        NumericComparer ncomp = new NumericComparer();
                        slOrderedItems = new SortedList(htOrderedItems, ncomp);

                        int keyIndex = 0;
                        SortedList slMiscellaneousItems = new SortedList();
                        PrintUtility printUtility = new PrintUtility();

                        string[] valueSplitter = new string[0];
                        foreach (clsOrderReport objReport in slOrderedItems.Values)
                        {
                            string keyValue = slOrderedItems.GetKey(keyIndex).ToString();
                            valueSplitter = keyValue.Split('-');

                            if ((separatorCatID.Trim() != valueSplitter[0].ToString().Trim()) && (valueSplitter[0].ToString().Trim() != "0"))//Insert separator
                            {
                                ////serialBody += "\r\n---------------------------------";
                                //serialBody += "\r\n" + strPrintFormatter.CreateDashedLine();

                                //separatorCatID = valueSplitter[0].ToString().Trim();

                                ///*serialBody += "\r\n" + objReport.Quantity.ToString() + "  ";
                                //serialBody += CPrintMethods.GetFixedString(objReport.ItemName, 20);*/

                                ////serialBody += "\r\n" + strPrintFormatter.ItemLabeledText(objReport.Quantity.ToString().Trim(),  objReport.ItemName.ToString());

                                //if (m_isKitchenPriceAvailable == true)
                                //{
                                //    serialBody += "\r\n" + strPrintFormatter.ItemLabeledText(objReport.Quantity.ToString().Trim() + "  " +
                                //        printUtility.MultipleLine(objReport.ItemName.ToString(), papersize - 10, objReport.Price.ToString("F02"), papersize-3), "");
                                //}
                                //else
                                //{
                                //    serialBody += "\r\n" + strPrintFormatter.ItemLabeledText(objReport.Quantity.ToString().Trim() + "  " +
                                //     printUtility.MultipleLine(objReport.ItemName.ToString(), papersize - 5, "", papersize), "");

                                //}

                                if (objReport.PrintArea == "Otherfood")
                                {

                                    otherfoodprint = true;
                                    serialBody2 += "\r\n" + strPrintFormatter.CreateDashedLine();
                                    separatorCatID = valueSplitter[0].ToString().Trim();

                                    //serialBody += "\r\n" + objReport.Quantity.ToString() + "  ";

                                    // serialBody += CPrintMethods.GetFixedString(objReport.ItemName, 20);
                                    if (m_isKitchenPriceAvailable == true)
                                    {
                                        //serialBody += "  " + CPrintMethods.RightAlign(objReport.Price.ToString("F02"), 6);

                                        //  serialBody += "\r\n" + strPrintFormatter.ItemLabeledText(objReport.Quantity.ToString() + "  " + objReport.ItemName, objReport.Price.ToString("F02"));

                                        serialBody2 += "\r\n" +
                                                      strPrintFormatter.ItemLabeledText(
                                                          objReport.Quantity.ToString() + "  " +
                                                          printUtility.MultipleLine(objReport.ItemName, papersize - 10,
                                                                                    objReport.Price.ToString("F02"),
                                                                                    papersize - 3), "");

                                    }
                                    else
                                    {
                                        //  serialBody += "\r\n" + strPrintFormatter.ItemLabeledText(objReport.Quantity.ToString() + "  " + objReport.ItemName, "");
                                        serialBody2 += "\r\n" +
                                                      strPrintFormatter.ItemLabeledText(
                                                          objReport.Quantity.ToString() + "  " +
                                                          printUtility.MultipleLine(objReport.ItemName, papersize - 5, "",
                                                                                    papersize), "");

                                    }

                                }
                                else
                                {

                                    foodprint = true;
                                    serialBody += "\r\n" + strPrintFormatter.CreateDashedLine();
                                    separatorCatID = valueSplitter[0].ToString().Trim();

                                    //serialBody += "\r\n" + objReport.Quantity.ToString() + "  ";

                                    // serialBody += CPrintMethods.GetFixedString(objReport.ItemName, 20);
                                    if (m_isKitchenPriceAvailable == true)
                                    {
                                        //serialBody += "  " + CPrintMethods.RightAlign(objReport.Price.ToString("F02"), 6);

                                        //  serialBody += "\r\n" + strPrintFormatter.ItemLabeledText(objReport.Quantity.ToString() + "  " + objReport.ItemName, objReport.Price.ToString("F02"));

                                        serialBody += "\r\n" +
                                                      strPrintFormatter.ItemLabeledText(
                                                          objReport.Quantity.ToString() + "  " +
                                                          printUtility.MultipleLine(objReport.ItemName, papersize - 10,
                                                                                    objReport.Price.ToString("F02"),
                                                                                    papersize - 3), "");

                                    }
                                    else
                                    {
                                        //  serialBody += "\r\n" + strPrintFormatter.ItemLabeledText(objReport.Quantity.ToString() + "  " + objReport.ItemName, "");
                                        serialBody += "\r\n" +
                                                      strPrintFormatter.ItemLabeledText(
                                                          objReport.Quantity.ToString() + "  " +
                                                          printUtility.MultipleLine(objReport.ItemName, papersize - 5, "",
                                                                                    papersize), "");

                                    }
                                }

                            }
                            else if (valueSplitter[0].ToString() == "0")
                            {
                                slMiscellaneousItems.Add(slMiscellaneousItems.Count, objReport);
                            }
                            else
                            {
                                ///*serialBody += "\r\n" + objReport.Quantity.ToString() + "  ";
                                //serialBody += CPrintMethods.GetFixedString(objReport.ItemName, 20);*/

                                ////  serialBody += "\r\n" + strPrintFormatter.SumupLabeledText(objReport.Quantity.ToString() + "  " + objReport.ItemName.ToString()," ");

                                //if (m_isKitchenPriceAvailable == true)
                                //{
                                //    //serialBody += "  " + CPrintMethods.RightAlign(objReport.Price.ToString("F02"), 6);
                                //  //  serialBody += "\r\n" + strPrintFormatter.ItemLabeledText(objReport.Quantity.ToString() + "  " + objReport.ItemName.ToString(), objReport.Price.ToString("F02"));
                                //    serialBody += "\r\n" + strPrintFormatter.ItemLabeledText(objReport.Quantity.ToString().Trim() + "  " +
                                //      printUtility.MultipleLine(objReport.ItemName.ToString(), papersize - 10, objReport.Price.ToString("F02"), papersize-3), "");

                                //}
                                //else
                                //{
                                //    //serialBody += "\r\n" + strPrintFormatter.ItemLabeledText(objReport.Quantity.ToString() + "  " + objReport.ItemName.ToString(), "");

                                //    serialBody += "\r\n" + strPrintFormatter.ItemLabeledText(objReport.Quantity.ToString().Trim() + "  " +
                                //     printUtility.MultipleLine(objReport.ItemName.ToString(), papersize - 5, "", papersize), "");
                                //}

                                if (objReport.PrintArea == "Otherfood")
                                {
                                    otherfoodprint = true;
                                    //serialBody2 += "\r\n" + objReport.Quantity.ToString() + "  ";
                                    //serialBody2 += CPrintMethods.GetFixedString(objReport.ItemName, 20);
                                    if (m_isKitchenPriceAvailable == true)
                                    {
                                        //serialBody += "  " + CPrintMethods.RightAlign(objReport.Price.ToString("F02"), 6);
                                        //    serialBody += "\r\n" + strPrintFormatter.ItemLabeledText("\r\n" + objReport.Quantity.ToString() + "  " + objReport.ItemName, objReport.Price.ToString("F02"));
                                        serialBody2 += "\r\n" +
                                                      strPrintFormatter.ItemLabeledText(
                                                          objReport.Quantity.ToString() + "  " +
                                                          printUtility.MultipleLine(objReport.ItemName, papersize - 10,
                                                                                    objReport.Price.ToString("F02"),
                                                                                    papersize - 3), "");

                                    }
                                    else {
                                        serialBody2 += "\r\n" + objReport.Quantity.ToString() + "  ";
                                        serialBody2 += CPrintMethods.GetFixedString(objReport.ItemName, 20);
                                    }
                                }
                                else
                                {
                                    foodprint = true;
                                    //serialBody += "\r\n" + objReport.Quantity.ToString() + "  ";
                                    //serialBody += CPrintMethods.GetFixedString(objReport.ItemName, 20);
                                    if (m_isKitchenPriceAvailable == true)
                                    {
                                        //serialBody += "  " + CPrintMethods.RightAlign(objReport.Price.ToString("F02"), 6);
                                        //    serialBody += "\r\n" + strPrintFormatter.ItemLabeledText("\r\n" + objReport.Quantity.ToString() + "  " + objReport.ItemName, objReport.Price.ToString("F02"));
                                        serialBody += "\r\n" +
                                                      strPrintFormatter.ItemLabeledText(
                                                          objReport.Quantity.ToString() + "  " +
                                                          printUtility.MultipleLine(objReport.ItemName, papersize - 10,
                                                                                    objReport.Price.ToString("F02"),
                                                                                    papersize - 3), "");

                                    }
                                    else
                                    {
                                        serialBody += "\r\n" + objReport.Quantity.ToString() + "  ";
                                        serialBody += CPrintMethods.GetFixedString(objReport.ItemName, 20);
                                    }
                                }

                            }
                            keyIndex++;
                        }

                        if (slMiscellaneousItems.Count > 0)
                        {
                            foodprint = true;
                            //serialBody += "\r\n----------Miscellaneous----------"; //separator for miscellaneous
                            serialBody += "\r\n" + strPrintFormatter.CenterTextWithDashed("Miscelaneous");

                            foreach (clsOrderReport objReport in slMiscellaneousItems.Values)
                            {
                                /*serialBody += "\r\n" + objReport.Quantity.ToString() + "  ";
                                 serialBody += CPrintMethods.GetFixedString(objReport.ItemName, 20);*/

                                // serialBody += "\r\n" + strPrintFormatter.SumupLabeledText(objReport.Quantity.ToString() + "  " + objReport.ItemName.ToString(), "");

                                if (m_isKitchenPriceAvailable == true)
                                {
                                    //serialBody += "  " + CPrintMethods.RightAlign(objReport.Price.ToString("F02"), 6);

                                   // serialBody += "\r\n" + strPrintFormatter.ItemLabeledText(objReport.Quantity.ToString() + "  " + objReport.ItemName.ToString(), objReport.Price.ToString("F02"));
                                    serialBody += "\r\n" + strPrintFormatter.ItemLabeledText(objReport.Quantity.ToString().Trim() + "  " +
                                     printUtility.MultipleLine(objReport.ItemName.ToString(), papersize - 10, objReport.Price.ToString("F02"), papersize-3), "");
                                }

                                else
                                {
                                   // serialBody += "\r\n" + strPrintFormatter.ItemLabeledText(objReport.Quantity.ToString() + "  " + objReport.ItemName.ToString(), "");
                                    serialBody += "\r\n" + strPrintFormatter.ItemLabeledText(objReport.Quantity.ToString().Trim() + "  " +
                                     printUtility.MultipleLine(objReport.ItemName.ToString(), papersize - 5, "", papersize), "");
                                }
                            }
                        }

                        //string[] kitchenCommand = new string[0];
                        //kitchenCommand = tempOrderInfo.InitialKitchenText.Split(',');

                        //serialBody += "\r\n---------------------------------";
                        serialBody += "\r\n" + strPrintFormatter.CreateDashedLine();
                        serialBody2 += "\r\n" + strPrintFormatter.CreateDashedLine();
                        CResult objKitchenText = tempOrderManager.GetKitchenTextByOrderID(orderID);
                        List<OrderLogInformation> tempOrderLogInfoList = new List<OrderLogInformation>();

                        tempOrderLogInfoList = (List<OrderLogInformation>)objKitchenText.Data;

                        if (tempOrderLogInfoList.Count > 0)
                        {
                            serialBody += "\r\nKT Txt:";
                            serialBody2 += "\r\nKT Txt:";
                        }
                        for (int recordCounter = 0; recordCounter < tempOrderLogInfoList.Count; recordCounter++)
                        {
                            if (tempOrderLogInfoList[recordCounter].KitchenTextPrintStatus < 1)
                            {
                                serialBody += "\r\n- " + tempOrderLogInfoList[recordCounter].KitchenText;
                                serialBody += "\r\n- " + tempOrderLogInfoList[recordCounter].KitchenText;
                            }
                        }

                        serialBody += "\r\nOrder Prepared By:" + m_OperatorName;
                        serialBody += "\r\n" + m_TerminalName;

                        serialBody += "\r\n\r\n" + strPrintFormatter.CenterTextWithWhiteSpace("[ E N D ]") + "\r\n\r\n";
                        serialBody2 += "\r\nOrder Prepared By:" + m_OperatorName;
                        serialBody2 += "\r\n" + m_TerminalName;

                        serialBody2 += "\r\n\r\n" + strPrintFormatter.CenterTextWithWhiteSpace("[ E N D ]") + "\r\n\r\n";
                        //tempPrintMethods.SerialPrint(PRINTER_TYPES.KITCHEN_PRINTER, serialHeader, serialBody, serialFooter);

                        // string fullKitchenPrinttext=serialHeader+"\r\n"+serialBody+"\r\n"+serialFooter;
                        // tempPrintMethods.USBPrint(fullKitchenPrinttext, PrintDestiNation.KITCHEN, false);

                        if (itemAvailable == true) //If there is available items
                        {
                            ///Kitchen Print call
                            ///
                            CPrintingFormat tempPrintingFormat = new CPrintingFormat();
                            tempPrintingFormat.Header = serialHeader;
                            tempPrintingFormat.Body = serialBody.ToUpper();
                            tempPrintingFormat.Footer = serialFooter;
                            tempPrintingFormat.OrderID = orderID;
                            tempPrintingFormat.PrintType = (int)PRINTER_TYPES.Serial;
                            CPrintingFormat tempPrintingFormat1 = new CPrintingFormat();
                            tempPrintingFormat1.Header = serialHeader;
                            tempPrintingFormat1.Body = serialBody2.ToUpper();
                            tempPrintingFormat1.Footer = serialFooter;
                            tempPrintingFormat1.OrderID = orderID;
                            tempPrintingFormat1.PrintType = (int)PRINTER_TYPES.Serial;

                            CPrintMethodsEXT cPrintMethods = new CPrintMethodsEXT();

                            CLogin oLogin = new CLogin();
                            oLogin = (RmsRemote.CLogin)Activator.GetObject(typeof(RmsRemote.CLogin), oConstant.RemoteURL);
                            for (int printCopy = 0; printCopy < m_printedCopy; printCopy++)
                            {
                                if (foodprint)
                                {
                                    string fulltext = tempPrintingFormat.Header + "\r\n" + tempPrintingFormat.Body +
                                                      "\r\n" + tempPrintingFormat.Footer;
                                    cPrintMethods.USBPrint(fulltext, PrintDestiNation.KITCHEN, false);
                                }
                                if (otherfoodprint)
                                {
                                    string fulltext = tempPrintingFormat1.Header + "\r\n" + tempPrintingFormat1.Body + "\r\n" + tempPrintingFormat1.Footer;
                                    cPrintMethods.USBPrint(fulltext, PrintDestiNation.Other, false);
                                }
                            }

                            if (tempOrderLogInfoList.Count > 0) //If kitchen command is available.
                            {
                                this.UpdateKitchenTextPrintStatus();
                            }
                            this.WriteString(serialBody);//Writing to the specified file
                        }
                    }
                    else //For online orders all items
                    {
                        bool isItemsAvailable = false;
                        foodprint = false;
                        otherfoodprint = false;
                        serialBody += "\r\n---------------------------------";
                        for (int rowIndex = 0; rowIndex < g_FoodDataGridView.RowCount; rowIndex++)
                        {
                          //  Int64 productID = Int64.Parse(tempRow.Cells[4].Value.ToString());
                            if (g_FoodDataGridView.Rows[rowIndex].Cells[1].Value.ToString() != String.Empty)
                            {
                                Int64 productID = Int64.Parse(g_FoodDataGridView.Rows[rowIndex].Cells[1].Value.ToString());
                                CCategory3DAO aDao = new CCategory3DAO();
                                string printstatus = aDao.GetAllCategory3printareaByCategory3ID((int)productID);

                                if (printstatus == "Otherfood")
                                {
                                    otherfoodprint = true;
                                    serialBody2 += "\r\n" + g_FoodDataGridView.Rows[rowIndex].Cells[1].Value.ToString() +
                                                  "  ";
                                    serialBody2 +=
                                        CPrintMethods.GetFixedString(
                                            g_FoodDataGridView.Rows[rowIndex].Cells[0].Value.ToString(), 20);
                                    if (m_isKitchenPriceAvailable == true)
                                    {
                                        serialBody2 += "  " +
                                                      CPrintMethods.RightAlign(
                                                          Convert.ToDouble("0" +
                                                                           g_FoodDataGridView.Rows[rowIndex].Cells[2].
                                                                               Value).ToString("F02"), 6);
                                    }
                                } else
                                {
                                    foodprint = true;
                                    serialBody += "\r\n" + g_FoodDataGridView.Rows[rowIndex].Cells[1].Value.ToString() +
                                                  "  ";
                                    serialBody +=
                                        CPrintMethods.GetFixedString(
                                            g_FoodDataGridView.Rows[rowIndex].Cells[0].Value.ToString(), 20);
                                    if (m_isKitchenPriceAvailable == true)
                                    {
                                        serialBody += "  " +
                                                      CPrintMethods.RightAlign(
                                                          Convert.ToDouble("0" +
                                                                           g_FoodDataGridView.Rows[rowIndex].Cells[2].
                                                                               Value).ToString("F02"), 6);
                                    }

                                }
                                isItemsAvailable = true;
                            }
                        }
                        serialBody += "\r\n---------------------------------";
                        serialBody += "\r\nKT Txt:" + tempOrderInfo.InitialKitchenText;
                        serialBody += "\r\n---------------------------------";
                        serialBody += "\r\nOrder Prepared By:" + m_OperatorName;

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

                        serialBody2 += "\r\n---------------------------------";
                        serialBody2 += "\r\nKT Txt:" + tempOrderInfo.InitialKitchenText;
                        serialBody2 += "\r\n---------------------------------";
                        serialBody2 += "\r\nOrder Prepared By:" + m_OperatorName;

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

                        if (isItemsAvailable == false)//If there is no items in the datagrid view
                        {
                            return;
                        }
                        else
                        {
                            if (foodprint)
                            {
                                CPrintingFormat tempPrintingFormat = new CPrintingFormat();

                                CPrintMethodsEXT cPrintMethods = new CPrintMethodsEXT();
                                tempPrintingFormat.Header = serialHeader;
                                tempPrintingFormat.Body = serialBody.ToUpper();

                                tempPrintingFormat.Footer = serialFooter;
                                tempPrintingFormat.OrderID = orderID;
                                tempPrintingFormat.PrintType = (int) PRINTER_TYPES.Serial;

                                CLogin oLogin = new CLogin();
                                oLogin =
                                    (RmsRemote.CLogin)
                                    Activator.GetObject(typeof (RmsRemote.CLogin), oConstant.RemoteURL);
                                // oLogin.PostPrintingRequest(tempPrintingFormat);

                                string fulltext = tempPrintingFormat.Header + "\r\n" + tempPrintingFormat.Body + "\r\n" +
                                                  tempPrintingFormat.Footer;
                                cPrintMethods.USBPrint(fulltext, PrintDestiNation.KITCHEN, false);

                                this.WriteString(serialBody); //Writing to the specified file
                            }
                            if (otherfoodprint)
                            {
                                CPrintingFormat tempPrintingFormat = new CPrintingFormat();

                                CPrintMethodsEXT cPrintMethods = new CPrintMethodsEXT();
                                tempPrintingFormat.Header = serialHeader;
                                tempPrintingFormat.Body = serialBody2.ToUpper();

                                tempPrintingFormat.Footer = serialFooter;
                                tempPrintingFormat.OrderID = orderID;
                                tempPrintingFormat.PrintType = (int)PRINTER_TYPES.Serial;

                                CLogin oLogin = new CLogin();
                                oLogin =
                                    (RmsRemote.CLogin)
                                    Activator.GetObject(typeof(RmsRemote.CLogin), oConstant.RemoteURL);
                                // oLogin.PostPrintingRequest(tempPrintingFormat);

                                string fulltext = tempPrintingFormat.Header + "\r\n" + tempPrintingFormat.Body + "\r\n" +
                                                  tempPrintingFormat.Footer;
                                cPrintMethods.USBPrint(fulltext, PrintDestiNation.Other, false);

                                this.WriteString(serialBody); //Writing to the specified file
                            }
                        }
                    }

                    if (tempOrderInfo.Status.Equals("Seated") && tempOrderInfo.OrderType.Equals("Table"))
                    {
                        tempOrderInfo.Status = "Ordered";
                        tempOrderManager.UpdateOrderInfo(tempOrderInfo);
                    }
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message, RMSGlobal.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #6
0
        private void LoadItemMenu()
        {
            try
            {
                CCategory3DAO aCCategory3Dao = new CCategory3DAO();
                List<CCategory3> aCategory3s = new List<CCategory3>();
                if (Convert.ToInt32("0" + cmbsubcategory.SelectedValue) != 0)
                {
                    aCategory3s =
                        aCCategory3Dao.GetCategory3ByCategory2ID(Convert.ToInt32("0" + cmbsubcategory.SelectedValue));
                    itemMenucomboBox.DataSource = aCategory3s;

                    itemMenucomboBox.DisplayMember = "Category3Name";
                    itemMenucomboBox.ValueMember = "Category3ID";
                }
            }
            catch (Exception)
            {

            }
        }
Example #7
0
        private bool CheckRawProduct(List<COrderDetails> tempOrderDetailsList)
        {
            CCategory3DAO cCategory3Dao = new CCategory3DAO();
            FinishedRawProductListDAO finishedRawProductListDao = new FinishedRawProductListDAO();

            string stockMessage = "Stock is unavailable ";
            bool isStockAvailable = true;
            KitchenStockDAO aKitchenStockDao = new KitchenStockDAO();

            foreach (COrderDetails orderDetail in tempOrderDetailsList)
            {
                List<CFinishedRawProductList> finishedRawProductList = finishedRawProductListDao.GetFinishedRawProductListByProductID(Convert.ToInt32(orderDetail.ProductID));

                foreach (CFinishedRawProductList finishedRawProduct in finishedRawProductList)
                {

                    // CCategory3 cCategory3 = cCategory3Dao.GetAllCategory3ByCategory3ID(Convert.ToInt32(finishedRawProduct.RawProductID));
                    KitchenStock aKitchenStock = new KitchenStock();
                    //  KitchenStockDAO aKitchenStockDao=new KitchenStockDAO();
                    aKitchenStock = aKitchenStockDao.GetStockByItemidFrominventory_kitchen_stock((int)finishedRawProduct.RawProductID);

                    //List<CCategory3> aList = cCategory3Dao.GetAllCategory3();
                    //var temp = from acategory in aList where acategory.Category2ID == cCategory3.Category2ID select acategory;

                    if (finishedRawProduct.Qnty * (orderDetail.OrderQuantity - orderDetail.KitchenQuantity) > aKitchenStock.Stocks)
                    {
                        stockMessage += "\n   " + finishedRawProduct.RawProductName + ": Needed: " + finishedRawProduct.Qnty *
                            (orderDetail.OrderQuantity - orderDetail.KitchenQuantity) + "\n " + " But Have: " + (aKitchenStock.Stocks);
                        isStockAvailable = false;
                    }
                }

            }

            if(!isStockAvailable)
            {
                CUserInfoDAO aUserInfoDao=new CUserInfoDAO();
                CUserInfo aUserInfo=new CUserInfo();
                aUserInfo = aUserInfoDao.GetUserInfoByUsername(RMSGlobal.LoginUserName);
                if (aUserInfo.Type == 0)
                {
                    DialogResult dialogResult = MessageBox.Show("Do You Proceed", "Stock Alert", MessageBoxButtons.YesNo);
                    if (dialogResult == DialogResult.Yes)
                    {
                        isStockAvailable = true;
                    }
                    else if (dialogResult == DialogResult.No)
                    {

                    }
                }

            }

            if (!isStockAvailable)
            {
                CMessageBox cMessageBox = new CMessageBox("Raw Product", stockMessage);
                cMessageBox.ShowDialog();
                return false;
            }
            else
            {
                foreach (COrderDetails orderDetails in tempOrderDetailsList)
                {
                    List<CFinishedRawProductList> finishedRawProductList =
                        finishedRawProductListDao.GetFinishedRawProductListByProductID(
                            Convert.ToInt32(orderDetails.ProductID));

                    foreach (CFinishedRawProductList finishedRawProduct in finishedRawProductList)
                    {
                        aKitchenStockDao.UpdateStock(Convert.ToInt32(finishedRawProduct.RawProductID),
                                                  finishedRawProduct.Qnty * (orderDetails.OrderQuantity - orderDetails.KitchenQuantity));

                    }
                    COrderDetailsDAO cOrderDetailsDao = new COrderDetailsDAO();
                    cOrderDetailsDao.UpdateKitchenQuantity(orderDetails);
                }
            }

            return true;
        }
Example #8
0
        /// <summary>
        /// Saving the food item.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            CResult objResult = ValidateForm();

            if (objResult.IsSuccess)
            {
                CCategory3 objFoodItem = new CCategory3();

                objFoodItem.Category2ID = Int32.Parse(cmbCategory.SelectedValue.ToString());

                objFoodItem.Category3Name = txtProductName.Text.Trim();

                objFoodItem.Category3Description = txtDescription.Text.Trim();
                objFoodItem.PrintArea = printareacomboBox.Text;

                if (chkTable.Checked)
                {
                    objFoodItem.Category3ViewTable = 1;
                }

                if (chkBar.Checked)
                {
                    objFoodItem.Category3ViewBar = 1;
                }

                if (chkTakeAway.Checked)
                {
                    objFoodItem.Category3ViewTakeAway = 1;
                }

                if (!txtTablePrice.Text.Trim().Equals(String.Empty))
                {
                    objFoodItem.Category3TablePrice = Double.Parse(txtTablePrice.Text.Trim());
                }

                if (!txtTakeawayPrice.Text.Trim().Equals(String.Empty))
                {
                    objFoodItem.Category3TakeAwayPrice = Double.Parse(txtTakeawayPrice.Text.Trim());
                }

                if (!txtBarPrice.Text.Trim().Equals(String.Empty))
                {
                    objFoodItem.Category3BarPrice = Double.Parse(txtBarPrice.Text.Trim());
                }

                //Add by mithu

                if (!tblCost.Text.Trim().Equals(String.Empty))
                {
                    objFoodItem.TableCost = Double.Parse(tblCost.Text.Trim());
                }

                if (!takeawayCost.Text.Trim().Equals(String.Empty))
                {
                    objFoodItem.TakeAwayCost = Double.Parse(takeawayCost.Text.Trim());
                }

                if (!barCost.Text.Trim().Equals(String.Empty))
                {
                    objFoodItem.BarCost = Double.Parse(barCost.Text.Trim());
                }

                if (rdoActive.Checked)
                {
                    objFoodItem.Category3OrderStatus = 1;
                }
                else if (rdoInactive.Checked)
                {
                    objFoodItem.Category3OrderStatus = 0;
                }

                if (chkUnlimited.Checked)
                {
                    objFoodItem.InitialItemQuantity = 0;
                    objFoodItem.UnlimitStatus = 1;
                }
                else
                {
                    objFoodItem.InitialItemQuantity = Convert.ToInt32("0"+txtInitialQuantity.Text);
                    objFoodItem.UnlimitStatus = 0;
                }

                objFoodItem.ItemSellingIn = cmbSellingIn.Text; //Whether the item sold in quantity or weight

                try
                {
                    objFoodItem.vatRate = Convert.ToDouble(txtVateRate.Text.ToString());
                }
                catch
                {
                    objFoodItem.vatRate = 0.00;
                }

                if (chkVateIncluded.Checked)
                {
                    objFoodItem.vatIncluded = true;
                }
                else
                {
                    objFoodItem.vatIncluded = false;
                }

                objFoodItem.ProductType = ProductType;

               // if(ProductType=="")

                try
                {
                    objFoodItem.UoM = cmbSellingIn.Text;
                }
                catch { }
                CCategoryManager oManager = new CCategoryManager();

                CResult oResult2 = oManager.AddCategory3(objFoodItem);

                if (oResult2.IsSuccess)
                {
                    if (ProductType == "RawMaterial")
                    {
                        CCategory3DAO aCategory3Dao=new CCategory3DAO();
                        objFoodItem.Category3ID = Convert.ToInt32(categorycomboBox.SelectedValue);

                        aCategory3Dao.AddPurchaseStore(objFoodItem,categorycomboBox.Text);
                    }
                    lblSaveStatus.Text = " The product has been saved successfully.";
                    lblSaveStatus.Visible = true;
                }
                else
                {
                    lblSaveStatus.Text = "The product can not be added. Please try again. ";
                    lblSaveStatus.Visible = true;
                }
            }
            else
            {
                lblSaveStatus.Text = objResult.Message;

                lblSaveStatus.Visible = true;
            }
        }
Example #9
0
 private double GetTotalCost(long mIOrderId)
 {
     COrderDetailsDAO aDetailsDao=new COrderDetailsDAO();
        List<COrderDetails> aDetailses=new List<COrderDetails>();
        aDetailses = (List<COrderDetails>)aDetailsDao.OrderDetailsGetByOrderID(mIOrderId).Data;
     CCategory3DAO aCCategory3Dao=new CCategory3DAO();
     List<CCategory3> aCCategory3s=new List<CCategory3>();
     aCCategory3s = aCCategory3Dao.GetAllCategory3();
     double totalcost = 0;
     foreach (COrderDetails order in aDetailses)
     {
         foreach (CCategory3 category3 in aCCategory3s)
         {
             if(category3.Category3ID==order.ProductID)
             {
                 totalcost += (category3.TableCost*order.OrderQuantity);
             }
         }
     }
     return totalcost;
 }
Example #10
0
        private void LoadRawProduct()
        {
            try
            {
                cCategory3sList = new List<CCategory3>();

                int cat2ID = Convert.ToInt32(cmbRawCategory2.SelectedValue);

                cmbProductName.Items.Clear();

                CCategory3DAO cCategory3Dao = new CCategory3DAO();

                cCategory3sList = cCategory3Dao.GetCategory3ByCategory2ID(cat2ID);

                if (cCategory3sList != null && cCategory3sList.Count > 0)
                {
                    foreach (CCategory3 cCategory3 in cCategory3sList)
                    {
                        cmbProductName.Items.Add(cCategory3.Category3Name);
                    }
                }

                if (cmbProductName.Items.Count > 0)
                {
                    cmbProductName.SelectedIndex = 0;
                }

            }
            catch (Exception ex)
            {

            }
        }
Example #11
0
        /// <summary>
        /// Saving the food item.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {

                CResult objResult = ValidateForm();

                if (objResult.IsSuccess)
                {
                    CCategory3 productItem = new CCategory3();
                    productItem = objFoodItemUpdate;
                    //  productItem.Category2ID = Int32.Parse(cmbCategory.SelectedValue.ToString());
                    //    productItem.Category3Name = txtProductName.Text.Trim();
                    //   productItem.Category3Description = txtDescription.Text.Trim();

                    //productItem.Category3TablePrice = objFoodItemUpdate.Category3TablePrice;
                    //productItem.Category3TakeAwayPrice = objFoodItemUpdate.Category3TakeAwayPrice;
                    //productItem.Category3BarPrice = objFoodItemUpdate.Category3BarPrice;

                    /* start: price */

                    if (!txtRetailPrice.Text.Trim().Equals(String.Empty))
                    {
                        // productItem.MRetailPrice = Double.Parse(txtRetailPrice.Text.Trim());
                        productItem.Category3TablePrice = Double.Parse(txtRetailPrice.Text.Trim());
                    }

                    if (!txtWholeSalePrice.Text.Trim().Equals(String.Empty))
                    {
                        //productItem.MWholeSalePrice = Double.Parse(txtWholeSalePrice.Text.Trim());
                        productItem.Category3TakeAwayPrice = Double.Parse(txtWholeSalePrice.Text.Trim());
                    }

                    if (!txtLastPurchasePrice.Text.Trim().Equals(String.Empty))
                    {
                        // productItem.MLastPurchasePrice = Double.Parse(txtLastPurchasePrice.Text.Trim());
                        productItem.Category3BarPrice = Double.Parse(txtLastPurchasePrice.Text.Trim());
                    }

                    // is input price vat inluded
                    //     if (chbVatIncluded.Checked)

                    if (cmbboxVatIncluded.SelectedIndex == 0)
                    {
                        // double vat = Program.vat / 100;

                        /*  productItem.Category3TablePrice = Convert.ToDouble( (productItem.Category3TablePrice/(1+vat)).ToString("F02"));
                          productItem.RetailPrice = Convert.ToDouble((productItem.RetailPrice / (1 + vat)).ToString("F02"));
                          productItem.Category3TakeAwayPrice = Convert.ToDouble((productItem.Category3TakeAwayPrice/(1+vat)).ToString("F02"));
                          productItem.WholeSalePrice =Convert.ToDouble(( productItem.WholeSalePrice / (1 + vat)).ToString("F02"));
                          productItem.Category3BarPrice =Convert.ToDouble(( productItem.Category3BarPrice / (1 + vat)).ToString("F02"));
                          productItem.LastPurchasePrice = Convert.ToDouble((productItem.LastPurchasePrice / (1 + vat)).ToString("F02"));
                        */

            #if VATFIXED
                  //  int i = 0;

            #else
                        //productItem.Category3TablePrice = (Double)Convert.ToDecimal((productItem.Category3TablePrice / (1 + vat)));
                        //productItem.MRetailPrice = (Double)Convert.ToDecimal((productItem.MRetailPrice / (1 + vat)));
                        //productItem.Category3TakeAwayPrice = (Double)Convert.ToDecimal((productItem.Category3TakeAwayPrice / (1 + vat)));
                        //productItem.MWholeSalePrice = (Double)Convert.ToDecimal((productItem.MWholeSalePrice / (1 + vat)));
                        //productItem.Category3BarPrice = (Double)Convert.ToDecimal((productItem.Category3BarPrice / (1 + vat)));
                        //productItem.MLastPurchasePrice = (Double)Convert.ToDecimal((productItem.MLastPurchasePrice / (1 + vat)));

            #endif

                        //productItem.Category3TablePrice =  (Double) Convert.ToDecimal((productItem.Category3TablePrice / (1 + vat)));
                        //productItem.RetailPrice = (Double)Convert.ToDecimal((productItem.RetailPrice / (1 + vat)));
                        //productItem.Category3TakeAwayPrice = (Double)Convert.ToDecimal((productItem.Category3TakeAwayPrice / (1 + vat)));
                        //productItem.WholeSalePrice = (Double)Convert.ToDecimal((productItem.WholeSalePrice / (1 + vat)));
                        //productItem.Category3BarPrice = (Double)Convert.ToDecimal((productItem.Category3BarPrice / (1 + vat)));
                        //productItem.LastPurchasePrice = (Double)Convert.ToDecimal((productItem.LastPurchasePrice / (1 + vat)));

                    }

                    /* end: price */
                    // active or inactive

                    //if (rdoActive.Checked)
                    //{
                    //    productItem.Category3OrderStatus = 1;
                    //}
                    //else if (rdoInactive.Checked)
                    //{
                    //    productItem.Category3OrderStatus = 0;
                    //}

                    // stockable
                    if (chkunstockable.Checked)
                    {
                        productItem.MInitialQuantity = 0;
                        productItem.MUnlimitStatus = 1;
                    }
                    else
                    {
                        if (cmbSellingIn.SelectedItem.ToString() == "Per Piece" || cmbSellingIn.SelectedItem.ToString() == "")
                        {
                            productItem.MInitialQuantity = Convert.ToInt32("0" + txtInitialQuantity.Text);

                        }
                        else
                        {
                            productItem.MInitialQuantity = Convert.ToInt32("0" + txtInitialQuantity.Text);
                        }

                        productItem.MUnlimitStatus = 0;
                    }

                    //      Item selling : "Per Piece" - Whether the item sold in quantity or weight

                    productItem.ItemSellingIn = cmbSellingIn.SelectedItem.ToString();

                    productItem.MBarCode = txtBoxBarcode.Text;

                    productItem.MUnitsInStock = int.Parse(txtInitialQuantity.Text);

                    if (cmbSellingIn.SelectedItem.ToString() == "Per Piece" || cmbSellingIn.SelectedItem.ToString() == "")
                    {
                        productItem.MUnitsInStock = Convert.ToInt32("0" + txtInitialQuantity.Text);

                    }
                    else
                    {
                        productItem.MUnitsInStock = Convert.ToInt32("0" + txtInitialQuantity.Text);
                    }

                    //non stocablke
                    productItem.MNonStockable = chkunstockable.Checked;
                    productItem.MNonTaxableGood = chkNontaxable.Checked;
                    productItem.MReorderLevel = int.Parse(txtReorderLevel.Text);

                    //start: UoM
                    //if (!cmbStanUoM.SelectedValue.ToString().Equals(string.Empty))
                    //{
                    //    productItem.MStandardUoM = cmbStanUoM.SelectedValue.ToString();
                    //}

                    //if (!cmbSalesUoM.SelectedValue.ToString().Equals(string.Empty))
                    //{
                    //    productItem.MSalesUoM = cmbSalesUoM.SelectedValue.ToString();
                    //    productItem.MQtyPerSaleUint = int.Parse(txtBoxUnitPerSaleUnit.Text);
                    //}
                    //else
                    //{
                    //    productItem.MSalesUoM = cmbStanUoM.SelectedValue.ToString();
                    //    productItem.MQtyPerSaleUint = 1;
                    //}

                    //if (!cmbPurUoM.SelectedValue.ToString().Equals(string.Empty))
                    //{
                    //    productItem.MPurchaseUoM = cmbPurUoM.SelectedValue.ToString();
                    //    productItem.MQtyPerPurchaseUnit = int.Parse(txtBoxUnitPerPurchaseUnit.Text);
                    //}
                    //else
                    //{
                    //    productItem.MPurchaseUoM = cmbStanUoM.SelectedValue.ToString();
                    //    productItem.MQtyPerPurchaseUnit = 1;
                    //}

                    if (cmbboxVatIncluded.Visible)
                    {
                        productItem.MVatIncluded = !Convert.ToBoolean(cmbboxVatIncluded.SelectedIndex);
                    }
                    else
                    {
                        productItem.MVatIncluded = false;
                    }

                    if (rdbRaw.Checked)
                    {
                        productItem.MProductType = rdbRaw.Text;
                    }
                    else if (rdbFinished.Checked)
                    {
                        productItem.MProductType = rdbFinished.Text;
                    }

                    CCategory3DAO cCategory3Dao = new CCategory3DAO();
                    CResult oResult2 = new CResult();
                    if (m_iCat3ID > 0)
                    {
                        // update new category3
                        productItem.Category3ID = m_iCat3ID;
                        oResult2 = cCategory3Dao.Category3Update(productItem, 0);
                    }
                    else
                    {
                        // add new category3
                        oResult2 = cCategory3Dao.Category3Insert(productItem);
                    }
                    // end: add/update cat3

                    if (oResult2.IsSuccess)
                    {
                        lblSaveStatus.Text = " The product has been Updated successfully.";
                        lblSaveStatus.Visible = true;
                        currentStock = Convert.ToDouble(txtInitialQuantity.Text);
                    }
                    else
                    {
                        lblSaveStatus.Text = "The product can not be Updated. Please try again. ";
                        lblSaveStatus.Visible = true;
                    }
                }
                else
                {
                    lblSaveStatus.Text = objResult.Message;

                    lblSaveStatus.Visible = true;
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #12
0
        /// <summary>
        /// Show existing Data
        /// </summary>
        private void showExistingData()
        {
            CCategory3DAO cCategory3Dao = new CCategory3DAO();

            objFoodItemUpdate = new CCategory3();

            objFoodItemUpdate = cCategory3Dao.GetAllCategory3ByCategory3ID(m_iCat3ID);

            CCategoryAncestorDAO cCategoryAncestorDao = new CCategoryAncestorDAO();

            CResult oResult = cCategoryAncestorDao.GetCategoryAnchestors(m_iCat3ID, 3);
            CCategoryAncestor oCatAnc = (CCategoryAncestor)oResult.Data;

            //if (oResult.IsSuccess && oResult.Data != null)
            //{
            if (objFoodItemUpdate != null)
            {
                //objFoodItemUpdate = (CCategory3)oResult.Data;

                txtProductName.Text = objFoodItemUpdate.Category3Name;

                //txtBoxBarcode.Text = objFoodItemUpdate.MBarCode;

                txtInitialQuantity.Text = objFoodItemUpdate.MInitialQuantity.ToString();

                if (objFoodItemUpdate.MUnlimitStatus == 1)
                {
                    //txtInitialQuantity.Clear();
                    chkunstockable.Checked = true;
                }
                else
                {
                    chkunstockable.Checked = false;
                    //txtInitialQuantity.Text = objFoodItem.InitialItemQuantity.ToString();
                }

                txtReorderLevel.Text = objFoodItemUpdate.MReorderLevel.ToString();

                //  txtRetailPrice.Text = objFoodItemUpdate.MRetailPrice.ToString("F02");
                txtRetailPrice.Text = objFoodItemUpdate.Category3TablePrice.ToString("F02");

                txtDescription.Text = objFoodItemUpdate.Category3Description;

                txtInitialQuantity.Text = objFoodItemUpdate.MUnitsInStock.ToString();
                currentStock = objFoodItemUpdate.MUnitsInStock;

                chkNontaxable.Checked = objFoodItemUpdate.MNonTaxableGood;

                if (objFoodItemUpdate.MVatIncluded)
                {
            #if VATFIXED
                    cmbboxVatIncluded.SelectedIndex = 0;

                    txtRetailPrice.Text = objFoodItemUpdate.RetailPrice.ToString("F02");
                    txtLastPurchasePrice.Text = objFoodItemUpdate.LastPurchasePrice.ToString("F02");
                    txtWholeSalePrice.Text = objFoodItemUpdate.WholeSalePrice.ToString("F02");

            #else

                    // chbVatIncluded.Checked = true;

                    //  double vat = 1 + Program.vat / 100;

                    //txtRetailPrice.Text = (objFoodItemUpdate.MRetailPrice * vat).ToString("F02");
                    //txtLastPurchasePrice.Text = (objFoodItemUpdate.MLastPurchasePrice * vat).ToString("F02");
                    //txtWholeSalePrice.Text = (objFoodItemUpdate.MWholeSalePrice * vat).ToString("F02");

                    //txtRetailPrice.Text = (objFoodItemUpdate.Category3TablePrice * vat).ToString("F02");
                    //txtLastPurchasePrice.Text = (objFoodItemUpdate.Category3TakeAwayPrice * vat).ToString("F02");
                    //txtWholeSalePrice.Text = (objFoodItemUpdate.Category3BarPrice * vat).ToString("F02");

                    txtRetailPrice.Text = objFoodItemUpdate.Category3TablePrice.ToString("F02");
                    txtLastPurchasePrice.Text = objFoodItemUpdate.Category3TakeAwayPrice.ToString("F02");
                    txtWholeSalePrice.Text = objFoodItemUpdate.Category3BarPrice.ToString("F02");

                    cmbboxVatIncluded.SelectedIndex = 0;

            #endif
                }
                else
                {
                    // chbVatIncluded.Checked = false;

                    //txtRetailPrice.Text = objFoodItemUpdate.MRetailPrice.ToString("F02");
                    //txtLastPurchasePrice.Text = objFoodItemUpdate.MLastPurchasePrice.ToString("F02");
                    //txtWholeSalePrice.Text = objFoodItemUpdate.MWholeSalePrice.ToString("F02");
                    txtRetailPrice.Text = objFoodItemUpdate.Category3TablePrice.ToString("F02");
                    txtLastPurchasePrice.Text = objFoodItemUpdate.Category3TakeAwayPrice.ToString("F02");
                    txtWholeSalePrice.Text = objFoodItemUpdate.Category3BarPrice.ToString("F02");

                    cmbboxVatIncluded.SelectedIndex = 1;

                }

                if (objFoodItemUpdate.Category3OrderStatus > 0) rdoActive.Checked = true;
                else rdoInactive.Checked = true;

                //if (objFoodItem.ItemSellingIn == "Per Piece") cmbSellingIn.SelectedText = "Per Piece";
                //else if (objFoodItem.ItemSellingIn == "Per Weight") cmbSellingIn.SelectedText = "Per Weight";

                try
                {
                    cmbSellingIn.SelectedIndex = cmbSellingIn.FindString(objFoodItemUpdate.ItemSellingIn);
                    cmbStanUoM.SelectedIndex = cmbStanUoM.FindString(objFoodItemUpdate.MStandardUoM);
                    cmbSalesUoM.SelectedIndex = cmbSalesUoM.FindString(objFoodItemUpdate.MSalesUoM);
                    cmbPurUoM.SelectedIndex = cmbPurUoM.FindString(objFoodItemUpdate.MPurchaseUoM);

                    //cmbParent.SelectedValue = oCatAnc.ParentCategoryID;
                    //cmbFoodType.SelectedValue = oCatAnc.Category2ID;
                    //cmbCategory.SelectedValue = objFoodItemUpdate.Category3ID;
                }
                catch (Exception ex)
                {
                }
            }

            if (oResult.IsSuccess && oResult.Data != null)
            {
                int tmpCat3ID = oCatAnc.Category3ID;
                int tmpCat2ID = oCatAnc.Category2ID;
                int tmpCat1ID = oCatAnc.Category1ID;
                int tmpParentCatID = oCatAnc.ParentCategoryID;

                if (objFoodItemUpdate.Category3OrderStatus == 1)
                {
                    //m_activeStatus = true;
                    rdoActive.Checked = true;
                }
                else if (objFoodItemUpdate.Category3OrderStatus == 0)
                {
                    //rdoInActive.Checked = true;
                    //m_activeStatus = false;
                }

                //  cmbParent.SelectedValue = tmpParentCatID;
                // cmbFoodType.SelectedValue = tmpCat2ID;
                // cmbCategory.SelectedValue = tmpCat3ID;

            }
        }
Example #13
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            StringPrintFormater strPrintFormatter = new StringPrintFormater(40);

            DataSet dsSalesRecords = new DataSet();
            CResult objResult = new CResult();
            SystemManager objSystemMgnr = new SystemManager();
            m_htFoods = new Hashtable();
            m_htNonFoods = new Hashtable();

            DateTime dtStart = new DateTime(dtpStart.Value.Year, dtpStart.Value.Month, dtpStart.Value.Day, 0, 0, 0);
            DateTime dtEnd = new DateTime(dtpEnd.Value.Year, dtpEnd.Value.Month, dtpEnd.Value.Day, 23, 59, 59);

            //if (chkFromTime.Checked)
            //{
                dtStart = new DateTime(dtpStart.Value.Year, dtpStart.Value.Month, dtpStart.Value.Day, 7, 0, 0);
                dtEnd = new DateTime(dtpEnd.Value.Year, dtpEnd.Value.Month, dtpEnd.Value.Day, 6, 59, 59);
               // }

            dtEnd = dtEnd.AddDays(1);

            objResult = objSystemMgnr.GetSalesRecords(dtStart.Ticks, dtEnd.Ticks);
            dsSalesRecords = (DataSet)objResult.Data;

            if (dsSalesRecords.Tables.Count > 0 && dsSalesRecords.Tables[0].Rows.Count > 0)
            {
                Int32 guestCounter = Convert.ToInt32(dsSalesRecords.Tables[0].Rows[0]["guest_count"]);

                CPrintMethods tempPrintMethods = new CPrintMethods();

                string serialHeader = RMSClientController.CollectHeader();

                string serialFooter = RMSClientController.CollectFooter();

                List<CSerialPrintContent> serialBody = new List<CSerialPrintContent>();
                CSerialPrintContent tempSerialPrintContent = new CSerialPrintContent();
                tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.CenterTextWithWhiteSpace("Inventory Sales Report");
                serialBody.Add(tempSerialPrintContent);

                tempSerialPrintContent = new CSerialPrintContent();
                tempSerialPrintContent.StringLine = strPrintFormatter.CenterTextWithWhiteSpace("Date of Consumption of Items");
                serialBody.Add(tempSerialPrintContent);

                tempSerialPrintContent = new CSerialPrintContent();
                tempSerialPrintContent.StringLine = strPrintFormatter.CenterTextWithWhiteSpace("From " + dtpStart.Value.Date.ToString("dd/MM/yyyy") + " To " + dtpEnd.Value.Date.ToString("dd/MM/yyyy"));
                serialBody.Add(tempSerialPrintContent);

                //tempSerialPrintContent = new CSerialPrintContent();
                //tempSerialPrintContent.StringLine = "No. of Covers:" + guestCounter.ToString() + "\n";
                //serialBody.Add(tempSerialPrintContent);
                tempSerialPrintContent = new CSerialPrintContent();
                tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.CreateDashedLine();
                serialBody.Add(tempSerialPrintContent);

                tempSerialPrintContent = new CSerialPrintContent();
                tempSerialPrintContent.StringLine = "Qty Item                         Price(£)";
                serialBody.Add(tempSerialPrintContent);
                tempSerialPrintContent = new CSerialPrintContent();
                tempSerialPrintContent.StringLine = strPrintFormatter.CreateDashedLine();
                serialBody.Add(tempSerialPrintContent);
                SortedList slorderedFoodItems = new SortedList();
                SortedList slorderedNonFoodItems = new SortedList();

                PrintUtility printUtility = new PrintUtility();
                CCategory3DAO category3DAO = new CCategory3DAO();

                foreach (DataRow dtRrow in dsSalesRecords.Tables[0].Rows)
                {
                    clsOrderReport objOrderedItems = new clsOrderReport();
                    string[] returnedValue = GetProductName(dtRrow).Split(':');

                   // string productName = Convert.ToString(returnedValue[0]);
                    string cat1ID = Convert.ToString(returnedValue[1]);

                    objOrderedItems.Quantity = Convert.ToInt32("0" + dtRrow["quantity"].ToString());
                    //  objOrderedItems.ItemName = productName;
                    string productName = "";
                    CCategory3 cat3 = category3DAO.GetAllCategory3ByCategory3ID(Convert.ToInt32(dtRrow["product_id"].ToString()));
                    if (cat3 != null && cat3.Category3Name.Length>0)
                    {
                        productName = cat3.Category3Name.Trim();
                    }
                    else
                    {
                        productName = Convert.ToString(dtRrow["product_Name"].ToString());  // @hafiz
                    }

                    objOrderedItems.ItemName = productName; //Convert.ToString(dtRrow["product_Name"].ToString());  //@Hafiz

                    objOrderedItems.Price = Convert.ToDouble(dtRrow["amount"]);
                    objOrderedItems.FoodTypeName = Convert.ToString(returnedValue[2]);

                    Int32 category1OrderNumber = this.GetCategory1OrderNumber(Convert.ToInt32("0" + cat1ID));
                    objOrderedItems.OrderNumber = category1OrderNumber;
                    string keyCode = category1OrderNumber + "-" + objOrderedItems.Quantity.ToString() + "-" + objOrderedItems.ItemName;

                    string tempKey = 99999 + "-" + objOrderedItems.Quantity.ToString() + "-" + objOrderedItems.ItemName; ;
                    if (Convert.ToString(dtRrow["food_type"]).Equals("Food") && Convert.ToInt16(dtRrow["product_id"]) != 0) //Separate food/nonfoods
                    {
                        if (!m_htFoods.ContainsKey(keyCode))
                        {
                            m_htFoods.Add(keyCode, objOrderedItems);
                        }
                        else
                        {
                            clsOrderReport orderReport = m_htFoods[keyCode] as clsOrderReport;
                            objOrderedItems.Quantity = objOrderedItems.Quantity + orderReport.Quantity;
                            m_htFoods[keyCode] = objOrderedItems;
                        }
                    }
                    else if (Convert.ToString(dtRrow["product_id"]).Equals("0")) //Separate food/nonfoods
                    {
                      //  m_htFoods.Add(tempKey, objOrderedItems);

                        if (!m_htFoods.ContainsKey(tempKey))
                        {
                            m_htFoods.Add(tempKey, objOrderedItems);
                        }
                        else
                        {
                            clsOrderReport orderReport = m_htFoods[tempKey] as clsOrderReport;
                            objOrderedItems.Quantity = objOrderedItems.Quantity + orderReport.Quantity;
                            m_htFoods[tempKey] = objOrderedItems;
                        }
                    }
                    else
                    {
                        //m_htNonFoods.Add(keyCode, objOrderedItems);

                        if (!m_htNonFoods.ContainsKey(keyCode))
                        {
                            m_htNonFoods.Add(keyCode, objOrderedItems);
                        }
                        else
                        {
                            clsOrderReport orderReport = m_htNonFoods[keyCode] as clsOrderReport;
                            objOrderedItems.Quantity = objOrderedItems.Quantity + orderReport.Quantity;
                            m_htNonFoods[keyCode] = objOrderedItems;
                        }
                    }
                }
                int separatorNumber = -1;
                NumericComparer nc = new NumericComparer();
                slorderedFoodItems = new SortedList(m_htFoods, nc); //Creating the sorted list from the hash table.
                slorderedNonFoodItems = new SortedList(m_htNonFoods, nc);

                SortedList slMaster1 = new SortedList();
                ArrayList arrListItems = null;

                foreach (DictionaryEntry objOrderedItems in slorderedFoodItems)
                {
                    clsOrderReport objItem = (clsOrderReport)objOrderedItems.Value;
                    string keyValue = objOrderedItems.Key.ToString();
                    string[] splitter = new string[0];
                    splitter = keyValue.Split('-');

                    if (separatorNumber != Convert.ToInt32(splitter[0]))
                    {
                        separatorNumber = Convert.ToInt32(splitter[0]);
                        arrListItems = new ArrayList();
                        arrListItems.Add(objItem);
                        slMaster1.Add(separatorNumber, arrListItems);
                    }
                    else
                    {
                        arrListItems.Add(objItem);
                        separatorNumber = Convert.ToInt32(splitter[0]);
                    }
                }

                ArrayList alReverseOrderedItem;
                foreach (DictionaryEntry deReverseOrderedItem in slMaster1)
                {
                    alReverseOrderedItem = (ArrayList)deReverseOrderedItem.Value;
                    alReverseOrderedItem.Reverse();//Reversing the current item order.

                    foreach (clsOrderReport objOrderedItems in alReverseOrderedItem)
                    {
                        if (separatorNumber != objOrderedItems.OrderNumber)
                        {
                            //tempSerialPrintContent = new CSerialPrintContent();
                            //tempSerialPrintContent.StringLine = "----------------------------------------";
                            //serialBody.Add(tempSerialPrintContent);

                            tempSerialPrintContent = new CSerialPrintContent();
                            tempSerialPrintContent.StringLine = objOrderedItems.FoodTypeName + ":";
                            serialBody.Add(tempSerialPrintContent);

                            tempSerialPrintContent = new CSerialPrintContent();
                            tempSerialPrintContent.StringLine += objOrderedItems.Quantity.ToString() + "  ";
                            tempSerialPrintContent.ISAlredyNewLine = true;
                          //  tempSerialPrintContent.StringLine += CPrintMethods.GetFixedString(objOrderedItems.ItemName, 30);
                           // tempSerialPrintContent.StringLine += CPrintMethods.RightAlign(objOrderedItems.Price.ToString("F02"), 6);
                              tempSerialPrintContent.StringLine += printUtility.MultipleLine(objOrderedItems.ItemName, 30,
                                                                          objOrderedItems.Price.ToString("F02"), 37);
                            serialBody.Add(tempSerialPrintContent);

                            separatorNumber = objOrderedItems.OrderNumber;
                        }
                        else
                        {
                            tempSerialPrintContent = new CSerialPrintContent();
                            tempSerialPrintContent.StringLine += objOrderedItems.Quantity.ToString() + "  ";
                          //  tempSerialPrintContent.StringLine += CPrintMethods.GetFixedString(objOrderedItems.ItemName, 30);
                           // tempSerialPrintContent.StringLine += CPrintMethods.RightAlign(objOrderedItems.Price.ToString("F02"), 6);
                            tempSerialPrintContent.StringLine += printUtility.MultipleLine(objOrderedItems.ItemName, 30,
                                                                          objOrderedItems.Price.ToString("F02"), 37);
                            tempSerialPrintContent.ISAlredyNewLine = true;
                            serialBody.Add(tempSerialPrintContent);
                        }
                    }
                }

                #region "Non food items"
                tempSerialPrintContent = new CSerialPrintContent();
                tempSerialPrintContent.StringLine = "-----------------Drinks-----------------";
                serialBody.Add(tempSerialPrintContent);

                SortedList slMaster2 = new SortedList();
                ArrayList arrListItemsNonFood = new ArrayList();

                separatorNumber = -1;

                foreach (DictionaryEntry objOrderedNonFood in slorderedNonFoodItems)
                {
                    clsOrderReport objItem = (clsOrderReport)objOrderedNonFood.Value;
                    string keyValue = objOrderedNonFood.Key.ToString();
                    string[] splitter = new string[0];
                    splitter = keyValue.Split('-');

                    if (separatorNumber != Convert.ToInt32(splitter[0]))
                    {
                        separatorNumber = Convert.ToInt32(splitter[0]);
                        arrListItemsNonFood = new ArrayList();
                        arrListItemsNonFood.Add(objItem);
                        slMaster2.Add(separatorNumber, arrListItemsNonFood);
                    }
                    else
                    {
                        arrListItemsNonFood.Add(objItem);
                        separatorNumber = Convert.ToInt32(splitter[0]);
                    }
                }

                separatorNumber = -1;
                foreach (DictionaryEntry objNonFood in slMaster2)
                {
                    ArrayList alNonFoods = (ArrayList)objNonFood.Value;
                    alNonFoods.Reverse();
                    foreach (clsOrderReport objNonFoodItem in alNonFoods)
                    {
                        if (separatorNumber != objNonFoodItem.OrderNumber)
                        {
                            //tempSerialPrintContent = new CSerialPrintContent();
                            //// tempSerialPrintContent.StringLine = "----------------------------------------";
                            //serialBody.Add(tempSerialPrintContent);

                            tempSerialPrintContent = new CSerialPrintContent();
                            tempSerialPrintContent.StringLine += objNonFoodItem.Quantity.ToString() + "  ";
                        //    tempSerialPrintContent.StringLine += CPrintMethods.GetFixedString(objNonFoodItem.ItemName, 30);
                         //   tempSerialPrintContent.StringLine += CPrintMethods.RightAlign(objNonFoodItem.Price.ToString("F02"), 6);
                            tempSerialPrintContent.StringLine += printUtility.MultipleLine(objNonFoodItem.ItemName, 30,
                                                                          objNonFoodItem.Price.ToString("F02"), 37);
                            serialBody.Add(tempSerialPrintContent);
                            tempSerialPrintContent.ISAlredyNewLine = true;
                            separatorNumber = objNonFoodItem.OrderNumber;
                        }
                        else
                        {
                            tempSerialPrintContent = new CSerialPrintContent();
                            tempSerialPrintContent.StringLine += objNonFoodItem.Quantity.ToString() + "  ";
                          //  tempSerialPrintContent.StringLine += CPrintMethods.GetFixedString(objNonFoodItem.ItemName, 30);
                         //   tempSerialPrintContent.StringLine += CPrintMethods.RightAlign(objNonFoodItem.Price.ToString("F02"), 6);
                            tempSerialPrintContent.StringLine += printUtility.MultipleLine(objNonFoodItem.ItemName, 30,
                                                                        objNonFoodItem.Price.ToString("F02"), 37);
                            tempSerialPrintContent.ISAlredyNewLine = true;
                            serialBody.Add(tempSerialPrintContent);
                        }
                    }
                }

                #endregion

                tempSerialPrintContent = new CSerialPrintContent();
                tempSerialPrintContent.StringLine = strPrintFormatter.CreateDashedLine();// "----------------------------------------";
                serialBody.Add(tempSerialPrintContent);
                tempSerialPrintContent = new CSerialPrintContent();
                tempSerialPrintContent.StringLine = "Total No Of Item: " + lblNoOfItemsSold.Text;
                serialBody.Add(tempSerialPrintContent);

                tempSerialPrintContent = new CSerialPrintContent();
                tempSerialPrintContent.StringLine = "Total Qty: " + lblTotalQty.Text;
                serialBody.Add(tempSerialPrintContent);

                tempSerialPrintContent = new CSerialPrintContent();
                tempSerialPrintContent.StringLine = "Total Item Amount: " + lblTotalAmount.Text;
                serialBody.Add(tempSerialPrintContent);
                tempSerialPrintContent = new CSerialPrintContent();
                tempSerialPrintContent.StringLine = strPrintFormatter.CreateDashedLine();
                serialBody.Add(tempSerialPrintContent);
                tempSerialPrintContent = new CSerialPrintContent();
                //tempSerialPrintContent.StringLine = strPrintFormatter.CenterTextWithWhiteSpace("Developed By: www.ibacs.co.uk") + "\r\n\n";
                serialBody.Add(tempSerialPrintContent);
                #region "Testing printing area"
                string printingObject = "";
                for (int arrayIndex = 0; arrayIndex < serialBody.Count; arrayIndex++)
                {
                    if (serialBody[arrayIndex].ISAlredyNewLine)
                    {
                        printingObject += serialBody[arrayIndex].StringLine.ToString() ;
                    }
                    else
                    {
                        printingObject += serialBody[arrayIndex].StringLine.ToString() + "\r\n";
                    }
                }

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

                #endregion
                A4Text = printingObject;
                CPrintMethodsEXT tempPrintMethods1 = new CPrintMethodsEXT();
                DataSet tempDataSet = new DataSet();
                tempDataSet.ReadXml("Config/Print_Config.xml");
                if (dataGridView1.Rows.Count > 0)
                    if (Convert.ToBoolean(tempDataSet.Tables[0].Rows[0]["IsGuestBillPrinterSerial"]) == true)
                    {
                        //  tempPrintMethods.SerialPrint(PRINTER_TYPES.NORMAL_PRINTER, serialHeader, serialBody, serialFooter, "SN".ToString());

                        tempPrintMethods.SerialPrint(PRINTER_TYPES.NORMAL_PRINTER, serialHeader, printingObject, serialFooter, "SN".ToString());

                    }
                    else
                    {
                        tempPrintMethods1.USBPrint(printingObject, PrintDestiNation.CLIENT, true);
                    }
                else
                {
                    MessageBox.Show("There is no record", RMSGlobal.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show("There is no record", RMSGlobal.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Example #14
0
        private void btnPrintSummary_Click(object sender, EventArgs e)
        {
            m_htFoods = new Hashtable();
            m_htNonFoods = new Hashtable();

            //    FormatDataTime();

            DataSet dsSalesRecords = new DataSet();
            CResult objResult = new CResult();
            SystemManager objSystemMgnr = new SystemManager();

            DateTime dtNow = DateTime.Now;

            DateTime dtStart = new DateTime(dtNow.Year, dtNow.Month, dtNow.Day, 0, 0, 0);
            DateTime dtEnd = new DateTime(dtNow.Year, dtNow.Month, dtNow.Day, 23, 59, 59);

            //if (chkFromTime.Checked)
            //{
                dtStart = new DateTime(dtStart.Year, dtStart.Month, dtStart.Day, 7, 0, 0);
                dtEnd = new DateTime(dtEnd.Year, dtEnd.Month, dtEnd.Day, 6, 59, 59);
               // }

            dtEnd = dtEnd.AddDays(1);

            objResult = objSystemMgnr.GetSalesRecordsForINV(dtStart.Ticks, dtEnd.Ticks);
            StringPrintFormater strPrintFormatter = new StringPrintFormater(40);

            DataTable dt = (DataTable)objResult.Data;

            tableReport = new DataTable();
            tableReport.Columns.Add("product_id", typeof(int));
            tableReport.Columns.Add("product_Name", typeof(string));
            tableReport.Columns.Add("amount", typeof(string));
            tableReport.Columns.Add("quantity", typeof(string));
            tableReport.Columns.Add("TotalAmount", typeof(string));
            tableReport.Columns.Add("guest_count", typeof(int));
            tableReport.Columns.Add("cat_level", typeof(int));
            tableReport.Columns.Add("food_type", typeof(string));
            if (dt != null || dt.Rows.Count > 0)
                for (int i = 0; i < dt.Rows.Count; i++)
                {

                    tableReport.Rows.Add(Convert.ToInt16(dt.Rows[i]["product_id"]), Convert.ToString(dt.Rows[i]["product_Name"]), dt.Rows[i]["amount"].ToString(), dt.Rows[i]["quantity"].ToString(), dt.Rows[i]["TotalAmount"].ToString(), Convert.ToInt16(dt.Rows[i]["guest_count"]), Convert.ToInt16(dt.Rows[i]["cat_level"]), dt.Rows[i]["food_type"].ToString());
                }

            if (dataGridView1.Rows.Count > 0)
                if (tableReport.Rows.Count > 0)
                {
                    // Int32 guestCounter = Convert.ToInt32(dsSalesRecords.Tables[0].Rows[0]["guest_count"]);
                    Int32 guestCounter = Convert.ToInt32(tableReport.Rows[0]["guest_count"]);
                    CPrintMethods tempPrintMethods = new CPrintMethods();

                    string serialHeader = RMSClientController.CollectHeader();

                    string serialFooter = RMSClientController.CollectFooter();

                    List<CSerialPrintContent> serialBody = new List<CSerialPrintContent>();
                    CSerialPrintContent tempSerialPrintContent = new CSerialPrintContent();
                    tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.CenterTextWithWhiteSpace("Inventory Sales Report") + "\r\n";
                    serialBody.Add(tempSerialPrintContent);

                    tempSerialPrintContent = new CSerialPrintContent();
                    tempSerialPrintContent.StringLine = strPrintFormatter.CenterTextWithWhiteSpace("Date of Consumption of Items:" + DateTime.Now.ToString("dd/MM/yyyy")) + "\r\n";
                    serialBody.Add(tempSerialPrintContent);

                    //tempSerialPrintContent = new CSerialPrintContent();
                    //tempSerialPrintContent.StringLine = "No. of Covers:" + guestCounter.ToString() + "\n";
                    //serialBody.Add(tempSerialPrintContent);

                    tempSerialPrintContent = new CSerialPrintContent();
                    tempSerialPrintContent.StringLine = strPrintFormatter.CreateDashedLine() +"\r\n";
                    serialBody.Add(tempSerialPrintContent);
                    tempSerialPrintContent = new CSerialPrintContent();
                    tempSerialPrintContent.StringLine = "Qty  Item                        Price(£)"+"\r\n";
                    serialBody.Add(tempSerialPrintContent);

                    tempSerialPrintContent = new CSerialPrintContent();
                    tempSerialPrintContent.StringLine = strPrintFormatter.CreateDashedLine() + "\r\n";
                    serialBody.Add(tempSerialPrintContent);

                    CCategory3DAO category3DAO = new CCategory3DAO();

                    SortedList slorderedFoodItems = new SortedList();
                    SortedList slorderedNonFoodItems = new SortedList();
                    //if (dsSalesRecords.Tables[0].Rows.Count > 0)
                    if (tableReport.Rows.Count > 0)
                    {
                        // foreach (DataRow dtRrow in dsSalesRecords.Tables[0].Rows)
                        foreach (DataRow dtRrow in tableReport.Rows)
                        {
                            clsOrderReport objOrderedItems = new clsOrderReport();
                            string[] returnedValue = GetProductName(dtRrow).Split(':');

                            //  string productName = Convert.ToString(returnedValue[0]);
                            string productName = "";
                            CCategory3 cat3 = category3DAO.GetAllCategory3ByCategory3ID(Convert.ToInt32(dtRrow["product_id"].ToString()));
                            if (cat3 != null && cat3.Category3Name.Length>0)
                            {
                                productName = cat3.Category3Name;
                            }
                            else
                            {
                              productName = Convert.ToString(dtRrow["product_Name"].ToString());  // @hafiz
                            }
                            string cat1ID = Convert.ToString(returnedValue[1]);

                            objOrderedItems.Quantity = Convert.ToInt32("0" + dtRrow["quantity"].ToString());
                            objOrderedItems.ItemName = productName;
                            objOrderedItems.Price = Convert.ToDouble(dtRrow["TotalAmount"]);
                            objOrderedItems.FoodTypeName = Convert.ToString(returnedValue[2]);
                            Int32 category1OrderNumber = 0;
                            if (cat1ID != "")
                            {
                                category1OrderNumber = this.GetCategory1OrderNumber(Convert.ToInt32(cat1ID));
                                objOrderedItems.OrderNumber = category1OrderNumber;

                                string keyCode = category1OrderNumber + "-" + objOrderedItems.Quantity.ToString() + "-" + objOrderedItems.ItemName;

                                if (Convert.ToString(dtRrow["food_type"]).Equals("Food")) //Separate food/nonfoods
                                {
                                    m_htFoods.Add(keyCode, objOrderedItems);
                                }
                                else
                                {
                                    m_htNonFoods.Add(keyCode, objOrderedItems);
                                }
                            }
                            else
                            {
                                category1OrderNumber = maxOrder + 1;
                                objOrderedItems.OrderNumber = category1OrderNumber;

                                string keyCode = category1OrderNumber + "-" + objOrderedItems.Quantity.ToString() + "-" + objOrderedItems.ItemName;

                                if (Convert.ToString(dtRrow["food_type"]).Equals("Food")) //Separate food/nonfoods
                                {
                                    m_htFoods.Add(keyCode, objOrderedItems);
                                }
                                else
                                {
                                    m_htNonFoods.Add(keyCode, objOrderedItems);
                                }
                            }
                        }
                        int separatorNumber = -1;
                        NumericComparer nc = new NumericComparer();
                        slorderedFoodItems = new SortedList(m_htFoods, nc); //Creating the sorted list from the hash table.
                        slorderedNonFoodItems = new SortedList(m_htNonFoods, nc);

                        SortedList slMaster1 = new SortedList();
                        ArrayList arrListItems = null;

                        foreach (DictionaryEntry objOrderedItems in slorderedFoodItems)
                        {
                            clsOrderReport objItem = (clsOrderReport)objOrderedItems.Value;
                            string keyValue = objOrderedItems.Key.ToString();
                            string[] splitter = new string[0];
                            splitter = keyValue.Split('-');

                            if (separatorNumber != Convert.ToInt32(splitter[0]))
                            {
                                separatorNumber = Convert.ToInt32(splitter[0]);
                                arrListItems = new ArrayList();
                                arrListItems.Add(objItem);
                                slMaster1.Add(separatorNumber, arrListItems);
                            }
                            else
                            {
                                arrListItems.Add(objItem);
                                separatorNumber = Convert.ToInt32(splitter[0]);
                            }
                        }

                        PrintUtility printUtility = new PrintUtility();

                        ArrayList alReverseOrderedItem;

                        foreach (DictionaryEntry deReverseOrderedItem in slMaster1)
                        {
                            alReverseOrderedItem = (ArrayList)deReverseOrderedItem.Value;
                            alReverseOrderedItem.Reverse();//Reversing the current item order.

                            foreach (clsOrderReport objOrderedItems in alReverseOrderedItem)
                            {
                                if (separatorNumber != objOrderedItems.OrderNumber)
                                {

                                    tempSerialPrintContent = new CSerialPrintContent();
                                    tempSerialPrintContent.StringLine = objOrderedItems.FoodTypeName + ":" +"\r\n";
                                    serialBody.Add(tempSerialPrintContent);

                                    tempSerialPrintContent = new CSerialPrintContent();

                                    //tempSerialPrintContent.StringLine += objOrderedItems.Quantity.ToString() + "  ";
                                    //tempSerialPrintContent.StringLine += CPrintMethods.GetFixedString(objOrderedItems.ItemName, 30);
                                    //tempSerialPrintContent.StringLine += CPrintMethods.RightAlign(objOrderedItems.Price.ToString("F02"), 6);

                                    tempSerialPrintContent.StringLine = strPrintFormatter.ItemLabeledText(objOrderedItems.Quantity.ToString() + "  " +
                                                printUtility.MultipleLine(objOrderedItems.ItemName, 32,
                                                                          objOrderedItems.Price.ToString("F02"), 37), "");

                                    serialBody.Add(tempSerialPrintContent);

                                    separatorNumber = objOrderedItems.OrderNumber;
                                }
                                else
                                {
                                    tempSerialPrintContent = new CSerialPrintContent();
                                    //tempSerialPrintContent.StringLine += objOrderedItems.Quantity.ToString() + "  ";
                                    //tempSerialPrintContent.StringLine += CPrintMethods.GetFixedString(objOrderedItems.ItemName, 30);
                                    //tempSerialPrintContent.StringLine += CPrintMethods.RightAlign(objOrderedItems.Price.ToString("F02"), 6);

                                    tempSerialPrintContent.StringLine = strPrintFormatter.ItemLabeledText(objOrderedItems.Quantity.ToString() + "  " +
                                                printUtility.MultipleLine(objOrderedItems.ItemName, 32,
                                                                          objOrderedItems.Price.ToString("F02"), 37), "");

                                    serialBody.Add(tempSerialPrintContent);
                                }
                            }
                        }

                        #region "Non food items"
                        tempSerialPrintContent = new CSerialPrintContent();

                        tempSerialPrintContent.StringLine = strPrintFormatter.CenterTextWithDashed("Drinks") + "\r\n";
                      //  tempSerialPrintContent.StringLine =  "-----------------Drinks-----------------" + "\r\n";
                        serialBody.Add(tempSerialPrintContent);

                        SortedList slMaster2 = new SortedList();
                        ArrayList arrListItemsNonFood = new ArrayList();
                        separatorNumber = -1;
                        foreach (DictionaryEntry objOrderedNonFood in slorderedNonFoodItems)
                        {
                            clsOrderReport objItem = (clsOrderReport)objOrderedNonFood.Value;
                            string keyValue = objOrderedNonFood.Key.ToString();
                            string[] splitter = new string[0];
                            splitter = keyValue.Split('-');

                            if (separatorNumber != Convert.ToInt32(splitter[0]))
                            {
                                separatorNumber = Convert.ToInt32(splitter[0]);
                                arrListItemsNonFood = new ArrayList();
                                arrListItemsNonFood.Add(objItem);
                                slMaster2.Add(separatorNumber, arrListItemsNonFood);
                            }
                            else
                            {
                                arrListItemsNonFood.Add(objItem);
                                separatorNumber = Convert.ToInt32(splitter[0]);
                            }
                        }

                        separatorNumber = -1;
                        bool istrue = false;
                        foreach (DictionaryEntry objNonFood in slMaster2)
                        {
                            ArrayList alNonFoods = (ArrayList)objNonFood.Value;
                            alNonFoods.Reverse();
                            foreach (clsOrderReport objNonFoodItem in alNonFoods)
                            {
                                if (separatorNumber != objNonFoodItem.OrderNumber)
                                {
                                    tempSerialPrintContent = new CSerialPrintContent();
                                    // tempSerialPrintContent.StringLine = "----------------------------------------";
                                    serialBody.Add(tempSerialPrintContent);
                                    if (tempSerialPrintContent != null && tempSerialPrintContent.StringLine.Equals("") && !istrue)
                                    {
                                        tempSerialPrintContent = new CSerialPrintContent();
                                        tempSerialPrintContent.StringLine = objNonFoodItem.FoodTypeName + ":" +"\r\n";
                                        serialBody.Add(tempSerialPrintContent);
                                    }

                                    tempSerialPrintContent = new CSerialPrintContent();
                                    //tempSerialPrintContent.StringLine += objNonFoodItem.Quantity.ToString() + "  ";
                                    //tempSerialPrintContent.StringLine += CPrintMethods.GetFixedString(objNonFoodItem.ItemName, 30);
                                    //tempSerialPrintContent.StringLine += CPrintMethods.RightAlign(objNonFoodItem.Price.ToString("F02"), 6);
                                    tempSerialPrintContent.StringLine = strPrintFormatter.ItemLabeledText(objNonFoodItem.Quantity.ToString() + "  " +
                                                printUtility.MultipleLine(objNonFoodItem.ItemName, 32,
                                                                          objNonFoodItem.Price.ToString("F02"), 37), "");
                                    serialBody.Add(tempSerialPrintContent);

                                    separatorNumber = objNonFoodItem.OrderNumber;

                                    istrue = true;
                                }
                                else
                                {
                                    tempSerialPrintContent = new CSerialPrintContent();

                                    //tempSerialPrintContent.StringLine += objNonFoodItem.Quantity.ToString() + "  ";
                                    //tempSerialPrintContent.StringLine += CPrintMethods.GetFixedString(objNonFoodItem.ItemName, 30);
                                    //tempSerialPrintContent.StringLine += CPrintMethods.RightAlign(objNonFoodItem.Price.ToString("F02"), 6);

                                    tempSerialPrintContent.StringLine = strPrintFormatter.ItemLabeledText(objNonFoodItem.Quantity.ToString() + "  " +
                                             printUtility.MultipleLine(objNonFoodItem.ItemName, 32,
                                                                       objNonFoodItem.Price.ToString("F02"), 37), "");

                                    serialBody.Add(tempSerialPrintContent);
                                }
                            }
                        }

                        #endregion

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

                        tempSerialPrintContent = new CSerialPrintContent();
                        tempSerialPrintContent.StringLine = "Total No Of Item: " + lblNoOfItemsSold.Text + "\r\n";
                        serialBody.Add(tempSerialPrintContent);

                        tempSerialPrintContent = new CSerialPrintContent();
                        tempSerialPrintContent.StringLine = "Total Qty: " + lblTotalQty.Text + "\r\n";
                        serialBody.Add(tempSerialPrintContent);

                        tempSerialPrintContent = new CSerialPrintContent();
                        tempSerialPrintContent.StringLine = "Total Item Amount: " + lblTotalAmount.Text + "\r\n";
                        serialBody.Add(tempSerialPrintContent);

                        tempSerialPrintContent = new CSerialPrintContent();
                        tempSerialPrintContent.StringLine = strPrintFormatter.CreateDashedLine() + "\r\n";
                        serialBody.Add(tempSerialPrintContent);
                        tempSerialPrintContent = new CSerialPrintContent();
                        //tempSerialPrintContent.StringLine = strPrintFormatter.CenterTextWithWhiteSpace("Developed By: www.ibacs.co.uk") + "\r\n\n";
                        serialBody.Add(tempSerialPrintContent);

                        #region "Testing printing area"
                        string printingObject = "";
                        for (int arrayIndex = 0; arrayIndex < serialBody.Count; arrayIndex++)
                        {
                            printingObject += serialBody[arrayIndex].StringLine.ToString();
                        }

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

                        #endregion
                        //@aamr Remote Print
                        CCommonConstants m_oCommonConstants;
                        m_oCommonConstants = ConfigManager.GetConfig<CCommonConstants>();
                        CLogin oLogin = new CLogin();
                        oLogin = (RmsRemote.CLogin)Activator.GetObject(typeof(RmsRemote.CLogin), m_oCommonConstants.RemoteURL);

                        CResult oResult = oLogin.GetInitialDBStr();
                        Object o = oLogin.GetType();
                        CPrintingFormat inPrintRequest = new CPrintingFormat();
                        inPrintRequest.Header = "Header";
                        inPrintRequest.Footer = "Footer";
                        inPrintRequest.Body = "Hello Remote Printing...";
                        try
                        {
                            oLogin.PostPrintingRequest(inPrintRequest);
                            PostPrintingRequest1(inPrintRequest);
                        }
                        catch (Exception ex)
                        {

                        }

                        CPrintMethodsEXT tempPrintMethods1 = new CPrintMethodsEXT();
                        DataSet tempDataSet = new DataSet();
                        tempDataSet.ReadXml("Config/Print_Config.xml");

                        if (Convert.ToBoolean(tempDataSet.Tables[0].Rows[0]["IsGuestBillPrinterSerial"]) == true)
                        {
                            // tempPrintMethods.SerialPrint(PRINTER_TYPES.NORMAL_PRINTER, serialHeader, serialBody, serialFooter, "SN".ToString());

                            tempPrintMethods.SerialPrint(PRINTER_TYPES.NORMAL_PRINTER, serialHeader, printingObject, serialFooter, "SN".ToString());

                        }
                        else
                        {
                            tempPrintMethods1.USBPrint(printingObject, PrintDestiNation.CLIENT, true);

                        }

                    }
                }
                else
                {
                    MessageBox.Show("There is no record", RMSGlobal.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
        }