Example #1
0
        public CMultipleSplitForm(Int64 inOrderID, Double inTotalAmount, Double inSerrvice, Double inDiscount, Double vat, String inTableType, DataTable inItemList, string userName, string terminalName)
        {
            InitializeComponent();
            lblGuestbillText.Text = "";
            orderID = inOrderID;
            totalAmount = inTotalAmount;
            discount = inDiscount;
            serviceCharge = inSerrvice;
            totalVatAmount = vat;
            tableType = inTableType;
            dtItemList = inItemList;
            this.userName = userName;
            this.terminalName = terminalName;

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

            stringPrintFormater = new StringPrintFormater(37);
        }
Example #2
0
        public string MultipleLine(string doc, int divisionLength, string price)
        {
            StringPrintFormater strPrintFormatter = new StringPrintFormater(37);
            string returnString = "";
            string[] lines = new string[(doc.Length / divisionLength) + 1];

            int i = 0;
            int k = 0;
            for (int j = 0; j < doc.Length; j++)
            {
                if (k == divisionLength)
                {
                    j--;
                    k = 0;
                    i++;
                }
                else
                {
                    lines[i] += doc[j];
                    k++;
                }

            }
            lines[0] = strPrintFormatter.ItemLabeledText(lines[0], price);
            int count = 0;
            foreach (string s in lines)
            {
                if (count == 0)
                    returnString += s + "\r\n";
                else
                    returnString += "   " + s + "\r\n";
                count++;
            }

            return returnString;
        }
Example #3
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 #4
0
        // Change by Mithu
        private void PrintA5GuestBillReport()
        {
            int papersize = 70;
            StringPrintFormater strPrintFormatter = new StringPrintFormater(70);

            string Cat1ID = String.Empty;

            try
            {
                CPrintMethodsEXT tempPrintMethods = new CPrintMethodsEXT();

                //CPrintMethods tempPrintMethods = new CPrintMethods();
                int categoryID = 0;
                //serial print
                //string serialHeader = "IBACS RMS";
                string serialHeader = "";
                //string serialFooter = "Please Come Again";
                string serialFooter = "";

                List<CSerialPrintContent> serialBody = new List<CSerialPrintContent>();
                CSerialPrintContent tempSerialPrintContent = new CSerialPrintContent();
                tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.CenterTextWithWhiteSpace("GUEST BILL");
                tempSerialPrintContent.Bold = true;

                serialBody.Add(tempSerialPrintContent);

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

                //string s=tempOrderInfo.
                if (m_iType == m_cCommonConstants.TableType)
                {
                    //Order ID line remove from report for requisting user
                    // Sajib Vai gathered user requirement
                    //Date : 13-02-2012
                    //tempSerialPrintContent = new CSerialPrintContent();
                    //tempSerialPrintContent.StringLine = "\r\n\nOrder ID:" + orderID.ToString();
                    //serialBody.Add(tempSerialPrintContent);

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

                    tempSerialPrintContent = new CSerialPrintContent();
                    tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.ItemLabeledText("Table No: " + m_iTableNumber.ToString(), "") + "\r\n";
                    tempSerialPrintContent.Bold = true;
                    serialBody.Add(tempSerialPrintContent);

                    tempSerialPrintContent = new CSerialPrintContent();
                    tempSerialPrintContent.StringLine = strPrintFormatter.ItemLabeledText("Guest No: " + tempOrderInfo.GuestCount.ToString(), "") + "\r\n";
                    tempSerialPrintContent.Bold = true;
                    serialBody.Add(tempSerialPrintContent);

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

                    //tempSerialPrintContent = new CSerialPrintContent();
                    //tempSerialPrintContent.StringLine = "Covers: " + tempOrderInfo.GuestCount.ToString() + "\r\n";
                    //tempSerialPrintContent.Bold = true;
                    //serialBody.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);
                    }
                } // Change by Mithu

            //private void PrintA5GuestBillReport() // Change by Mithu
            //{
            //    int papersize = 70;
            //    StringPrintFormater strPrintFormatter = new StringPrintFormater(70);

            //    string Cat1ID = String.Empty;

            //    try
            //    {
            //        CPrintMethodsEXT tempPrintMethods = new CPrintMethodsEXT();

            //        //CPrintMethods tempPrintMethods = new CPrintMethods();
            //        int categoryID = 0;
            //        //serial print
            //        //string serialHeader = "IBACS RMS";
            //        string serialHeader = "";
            //        //string serialFooter = "Please Come Again";
            //        string serialFooter = "";

            //        List<CSerialPrintContent> serialBody = new List<CSerialPrintContent>();
            //        CSerialPrintContent tempSerialPrintContent = new CSerialPrintContent();
            //        //tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.CenterTextWithWhiteSpace("Guest Bill");
            //        tempSerialPrintContent.Bold = true;

            //        serialBody.Add(tempSerialPrintContent);

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

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

            //            tempSerialPrintContent = new CSerialPrintContent();
            //            //tempSerialPrintContent.StringLine = "\r\n\nOrder ID:" + orderID.ToString();

            //            serialBody.Add(tempSerialPrintContent);

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

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

            //            tempSerialPrintContent = new CSerialPrintContent();
            //            //tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.ItemLabeledText("Table No: " + m_iTableNumber.ToString(), "Covers: " + tempOrderInfo.GuestCount.ToString()) + "\r\n";
            //            tempSerialPrintContent.Bold = true;
            //            serialBody.Add(tempSerialPrintContent);

            //            //tempSerialPrintContent = new CSerialPrintContent();
            //            //tempSerialPrintContent.StringLine = "Covers: " + tempOrderInfo.GuestCount.ToString() + "\r\n";
            //            //tempSerialPrintContent.Bold = true;
            //            //serialBody.Add(tempSerialPrintContent);
            //            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);
            //            }
            //        } // Change by Mithu
                else if (m_iType == m_cCommonConstants.TakeAwayType)
                {

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

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

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

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

                    if (tempCustomerInfo.CustomerName.Length > 0)
                    {
                        tempSerialPrintContent = new CSerialPrintContent();
                        tempSerialPrintContent.StringLine = "\r\nCustomer Name: " + tempCustomerInfo.CustomerName;
                        serialBody.Add(tempSerialPrintContent);
                    }

                    if (tempCustomerInfo.CustomerPhone.Length > 0)
                    {
                        tempSerialPrintContent = new CSerialPrintContent();
                        tempSerialPrintContent.StringLine = "\r\nPhone:" + tempCustomerInfo.CustomerPhone;
                        serialBody.Add(tempSerialPrintContent);
                    }

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

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

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

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

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

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

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

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

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

                        //tempSerialPrintContent = new CSerialPrintContent();
                        //tempSerialPrintContent.StringLine = "Country:" + tempCustomerInfo.CustomerCountry;
                        //serialBody.Add(tempSerialPrintContent);

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

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

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

                tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.CreateDashedLine();
                serialBody.Add(tempSerialPrintContent);
                tempSerialPrintContent = new CSerialPrintContent();
                tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.ItemLabeledText("Item", "Qnty   Unit Price   Price(" + Program.currency + ")");
                serialBody.Add(tempSerialPrintContent);

                //Line after above line
                //tempSerialPrintContent = new CSerialPrintContent();
                //tempSerialPrintContent.StringLine = "----------------------------------------";
                //serialBody.Add(tempSerialPrintContent);
                #region Populate List
                if (m_orderUserName.Replace(" ", "").ToUpper() != "Web User".Replace(" ", "").ToUpper())
                {
                    Hashtable htOrderedItems = new Hashtable();
                    SortedList slorderedItems = null;

                    string categoryOrder = String.Empty;
                    int internalCategoryID = 0;
                    //Modification By Baruri at 04/08/2008
                    for (int rowIndex = 0; rowIndex < g_FoodDataGridView.Rows.Count; rowIndex++)
                    {
                        internalCategoryID = 0;
                        string cat3ID = String.Empty;
                        string cat2ID = String.Empty;
                        string cat1ID = String.Empty;

                        DataGridViewRow tempRow = g_FoodDataGridView.Rows[rowIndex];
                        categoryOrder = String.Empty;

                        if (!tempRow.Cells[0].Value.ToString().Equals(""))
                        {
                            #region "Parent Category"

                            if (Convert.ToInt32("0" + tempRow.Cells[4].Value.ToString()) == 3)//Item from Category 3
                            {
                                internalCategoryID = Convert.ToInt32("0" + tempRow.Cells[3].Value.ToString());
                                DataRow[] dtRow = dsCategory3.Tables[0].Select("cat3_id = " + internalCategoryID);
                                if (dtRow.Length > 0)
                                {
                                    cat2ID = dtRow[0]["cat2_id"].ToString();
                                    DataRow[] dtRowCat2 = dsCategory2.Tables[0].Select("cat2_id = " + cat2ID);//new
                                    cat1ID = dtRowCat2[0]["cat1_id"].ToString();
                                }
                            }
                            else if (Convert.ToInt32("0" + tempRow.Cells[4].Value.ToString()) == 0)
                            {
                                cat1ID = "0";
                                cat2ID = "0";
                            }

                            else
                            {
                                internalCategoryID = Convert.ToInt32("0" + tempRow.Cells[3].Value.ToString());
                                DataRow[] dtRow = dsCategory4.Tables[0].Select("cat4_id = " + internalCategoryID);
                                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();
                                    DataRow[] dtRowCat2 = dsCategory2.Tables[0].Select("cat2_id = " + cat2ID);//new
                                    cat1ID = dtRowCat2[0]["cat1_id"].ToString();
                                }
                            }
                            #endregion

                            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());
                            objOrderedItems.ItemUnitPrice = Convert.ToDouble("0" + tempRow.Cells[8].Value.ToString());
                            //htOrderedItems.Add(cat2ID + "-" + objOrderedItems.ItemName, objOrderedItems);//Showing the products according to categpry 2
                            Int64 rankNumber = Int64.Parse(tempRow.Cells[5].Value.ToString());

                            Int32 category1OrderNumber = this.GetCategory1OrderNumber(Convert.ToInt32(cat1ID));
                            htOrderedItems.Add(category1OrderNumber + "-" + rankNumber + "-" + objOrderedItems.ItemName, objOrderedItems);//Category 1 wise separator
                        }
                    }
                #endregion

                    NumericComparer nc = new NumericComparer();
                    slorderedItems = new SortedList(htOrderedItems, nc);

                    int keyIndex = 0;
                    string[] valueSplitter = new string[0];
                    SortedList slMiscellaneousItems = new SortedList(); //Only for miscellenious category

                    PrintUtility printUtility = new PrintUtility();

                    foreach (clsOrderReport objReport in slorderedItems.Values)
                    {
                        string keyValue = slorderedItems.GetKey(keyIndex).ToString();
                        valueSplitter = keyValue.Split('-');

                        string priceString = printUtility.PupulateRightString(objReport.Quantity, objReport.ItemUnitPrice, objReport.Price);//objReport.Quantity.ToString() + "     " + objReport.ItemUnitPrice.ToString("f2") + "     " + objReport.Price.ToString("F02");

                        if ((categoryID != Convert.ToInt32("0" + valueSplitter[0].ToString())) && Convert.ToInt32("0" + valueSplitter[0].ToString()) != 0)//Insert separator
                        {
                            categoryID = Convert.ToInt32("0" + valueSplitter[0].ToString());
                            tempSerialPrintContent = new CSerialPrintContent();
                            tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.CreateDashedLine() + "\r\n";
                            serialBody.Add(tempSerialPrintContent);

                            tempSerialPrintContent = new CSerialPrintContent();

                            //tempSerialPrintContent.StringLine +=
                            //                                    strPrintFormatter.ItemLabeledText(objReport.Quantity.ToString() + "  " +
                            //                                   printUtility.MultipleLine(objReport.ItemName.ToString(), papersize - 10, objReport.Price.ToString("F02"), papersize - 5), "");

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

                            serialBody.Add(tempSerialPrintContent);
                        }
                        else if (valueSplitter[0].ToString() == "0") //Used for miscellenious items. i.e these items have no parent category.
                        {
                            tempSerialPrintContent = new CSerialPrintContent();

                            //tempSerialPrintContent.StringLine +=
                            //                               strPrintFormatter.ItemLabeledText(objReport.Quantity.ToString() + "  " +
                            //                                printUtility.MultipleLine(objReport.ItemName.ToString(), papersize - 10, objReport.Price.ToString("F02"), papersize - 5), "");

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

                            slMiscellaneousItems.Add(slMiscellaneousItems.Count, tempSerialPrintContent);
                        }
                        else
                        {
                            tempSerialPrintContent = new CSerialPrintContent();

                            //tempSerialPrintContent.StringLine +=
                            //                              strPrintFormatter.ItemLabeledText(objReport.Quantity.ToString() + "  " +
                            //                                printUtility.MultipleLine(objReport.ItemName.ToString(), papersize - 10, objReport.Price.ToString("F02"), papersize - 5), "");

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

                            serialBody.Add(tempSerialPrintContent);
                        }

                        keyIndex++;
                    }

                    //Add the miscellaneous items with the separator
                    if (slMiscellaneousItems.Count > 0)
                    {
                        tempSerialPrintContent = new CSerialPrintContent();
                        tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.CenterTextWithDashed("Miscellaneous") + "\r\n";
                        serialBody.Add(tempSerialPrintContent);

                        foreach (CSerialPrintContent tempSerialContent in slMiscellaneousItems.Values)
                        {
                            serialBody.Add(tempSerialContent);
                        }
                    }

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

                        if (rowIndex == 0 && (!tempRow.Cells[0].Value.ToString().Equals("")))
                        {
                            tempSerialPrintContent = new CSerialPrintContent();
                            tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.CenterTextWithDashed("Drinks") + "\r\n";
                            serialBody.Add(tempSerialPrintContent);
                        }

                        if (!tempRow.Cells[0].Value.ToString().Equals(""))
                        {
                            tempSerialPrintContent = new CSerialPrintContent();
                        //    string priceString1 = tempRow.Cells[1].Value.ToString() + "   " + tempRow.Cells[8].Value.ToString() + "   " + tempRow.Cells[2].Value.ToString();

                            string priceString = printUtility.PupulateRightString(Convert.ToInt32("0" + tempRow.Cells[1].Value.ToString()), Convert.ToDouble("0"+tempRow.Cells[8].Value.ToString()), Convert.ToDouble("0"+tempRow.Cells[2].Value.ToString()));//objReport.Quantity.ToString() + "     " + objReport.ItemUnitPrice.ToString("f2") + "     " + objReport.Price.ToString("F02");

            //                            string priceString = tempRow.Cells[1].Value.ToString() + "   " + tempRow.Cells[8].Value.ToString() + "   " + tempRow.Cells[2].Value.ToString();

                               //tempSerialPrintContent.StringLine +=
                               //                              strPrintFormatter.ItemLabeledText(tempRow.Cells[1].Value.ToString() + "  " +
                               //                            printUtility.MultipleLine(tempRow.Cells[0].Value.ToString(), papersize - 10, tempRow.Cells[2].Value.ToString(), papersize - 5), "");

                            tempSerialPrintContent.StringLine +=
                                                          strPrintFormatter.ItemLabeledText(
                                                        printUtility.MultipleLine(tempRow.Cells[0].Value.ToString(), papersize - 32, priceString, papersize ), "");

                            serialBody.Add(tempSerialPrintContent);
                        }
                    }
                }

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

                    for (int rowIndex = 0; rowIndex < g_FoodDataGridView.RowCount; rowIndex++)
                    {
                        if (Convert.ToInt32("0" + g_FoodDataGridView.Rows[rowIndex].Cells[1].Value) > 0)
                        {
                            tempSerialPrintContent = new CSerialPrintContent();

                            tempSerialPrintContent.StringLine += "\r\n" + strPrintFormatter.ItemLabeledText(g_FoodDataGridView.Rows[rowIndex].Cells[1].Value.ToString() + "  " +
                            (g_FoodDataGridView.Rows[rowIndex].Cells[0].Value.ToString()), (Convert.ToDouble("0" + g_FoodDataGridView.Rows[rowIndex].Cells[2].Value).ToString("F02")));

                            serialBody.Add(tempSerialPrintContent);
                        }
                    }

                    for (int rowIndex = 0; rowIndex < g_BeverageDataGridView.RowCount; rowIndex++)
                    {
                        if (Convert.ToInt32("0" + g_BeverageDataGridView.Rows[rowIndex].Cells[1].Value) > 0)
                        {
                            tempSerialPrintContent = new CSerialPrintContent();

                            tempSerialPrintContent.StringLine += strPrintFormatter.ItemLabeledText(g_BeverageDataGridView.Rows[rowIndex].Cells[1].Value.ToString() + "  " +
                           (g_BeverageDataGridView.Rows[rowIndex].Cells[0].Value.ToString()), (Convert.ToDouble("0" + g_BeverageDataGridView.Rows[rowIndex].Cells[2].Value).ToString("F02")));

                            serialBody.Add(tempSerialPrintContent);
                        }
                    }
                }

                tempSerialPrintContent = new CSerialPrintContent();
                tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.CreateDashedLine();
                serialBody.Add(tempSerialPrintContent);
                decimal discountAmount = decimal.Parse(g_DiscountLabel.Text);
                Decimal totalAmount = Decimal.Parse(g_AmountLabel.Text);
                Decimal billTotal = discountAmount + totalAmount;

                //New at 02.03.2009
                tempSerialPrintContent = new CSerialPrintContent();

                tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.SumupLabeledText("Order Total: ", GetOrderTotal().ToString("F02"));

                serialBody.Add(tempSerialPrintContent);

                if (discountAmount > 0)
                {
                    decimal itemCost = this.GetOrderTotal();
                    tempSerialPrintContent = new CSerialPrintContent();
                    decimal discountPercent = 100 * discountAmount / (itemCost); //Discount is based on the total item cost

                    tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.SumupLabeledText("Discount:(" + discountPercent.ToString("F02") + "%) ", Convert.ToDecimal(g_DiscountLabel.Text).ToString("F02"));

                    serialBody.Add(tempSerialPrintContent);
                }

                if (Convert.ToDouble("0" + g_serviceCharge.Text) > 0) //If service charge is assigned
                {
                    CResult cResult = tempOrderManager.OrderServiceChargeGetByOrderID(orderID);
                    ServiceCharge serviceCharge = cResult.Data as ServiceCharge;

                    tempSerialPrintContent = new CSerialPrintContent();
                    //tempSerialPrintContent.StringLine = "               Service Charge: " + Convert.ToDecimal("0" + g_serviceCharge.Text).ToString("F02");
                    tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.SumupLabeledText("Service Charge(" + serviceCharge.ServicechargeRate.ToString() + "%): ", Convert.ToDecimal("0" + g_serviceCharge.Text).ToString("F02"));

                    serialBody.Add(tempSerialPrintContent);
                }

                if (isVatEnabled) //If vat is assigned
                {
                    tempSerialPrintContent = new CSerialPrintContent();
                    //tempSerialPrintContent.StringLine = "                          Vat("+vat.ToString()+"%): " + Convert.ToDecimal("0" + lblVat.Text).ToString("F02");
                    tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.SumupLabeledText("Vat(" + vat.ToString() + "%): ", Convert.ToDecimal("0" + lblVat.Text).ToString("F02"));

                    serialBody.Add(tempSerialPrintContent);
                }

                tempSerialPrintContent = new CSerialPrintContent();

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

                tempSerialPrintContent = new CSerialPrintContent();
                decimal payableAmount = Convert.ToDecimal(Convert.ToDecimal("0" + g_serviceCharge.Text).ToString("F02")) + Convert.ToDecimal(this.GetOrderTotal()) - Convert.ToDecimal(Convert.ToDecimal("0" + g_DiscountLabel.Text).ToString("F02"));
                payableAmount = Convert.ToDecimal(Convert.ToDouble(payableAmount) * (1 + vat / 100));

                tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.SumupLabeledText("Total Payable: ", Convert.ToDecimal("0" + g_AmountLabel.Text).ToString("F02"));

                serialBody.Add(tempSerialPrintContent);

                tempSerialPrintContent = new CSerialPrintContent();

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

                //New at 22.08.2008
                tempSerialPrintContent = new CSerialPrintContent();
                //tempSerialPrintContent.StringLine = "You've Served by :" + m_OperatorName;
                tempSerialPrintContent.StringLine = "\r\nYou've Served by:" + m_OperatorName;

                serialBody.Add(tempSerialPrintContent);

                //Terminal Name and Serial No line remove from report for requisting user
                // Sajib Vai gathered user requirement
                //Date : 13-02-2012
                //tempSerialPrintContent = new CSerialPrintContent();
                //tempSerialPrintContent.StringLine = "\r\n" + m_TerminalName.Trim();
                //serialBody.Add(tempSerialPrintContent);
                ////------------------------
                //tempSerialPrintContent = new CSerialPrintContent();
                //tempSerialPrintContent.StringLine = "\r\nS/N: " + tempOrderInfo.SerialNo.ToString() + "\n";
                //serialBody.Add(tempSerialPrintContent);

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

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

                serialBody.Add(tempSerialPrintContent);

                //tempSerialPrintContent = new CSerialPrintContent();
                //tempSerialPrintContent.StringLine = "\r\nDeveloped By: www.ibacs.co.uk";
                //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

                // tempPrintMethods.SerialPrint(PRINTER_TYPES.NORMAL_PRINTER, serialHeader, serialBody, serialFooter, tempOrderInfo.SerialNo.ToString());

                tempPrintMethods.USBPrintA5Report(printingObject, PrintDestiNation.CLIENT, true, papersize);
                ///Update status
                ///
                if (tempOrderInfo.OrderType.Equals("Table"))
                {
                    tempOrderInfo.Status = "Billed";
                    tempOrderInfo.OrderTime = System.DateTime.Now;
                    tempOrderManager.UpdateOrderInfo(tempOrderInfo);

                    CPaymentManager tempPaymentManager = new CPaymentManager();
                    CPayment tempPayment = new CPayment();
                    tempPayment.OrderID = tempOrderInfo.OrderID;
                    tempPayment.BillPrintTime = DateTime.Now;
                    tempPaymentManager.InsertBillPrintTime(tempPayment);
                }
                this.ChangeGuestBillPrintStatus();
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message, RMSGlobal.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #5
0
        private string PrintReportA4()
        {
            string strBody = "";
            stringPrintFormater = new StringPrintFormater(150);
            // strBody += "\r\n";
            //  strBody += "\r\n";
            string hader = GetPrintDecorationText(PrintDecoration.HEADER);

            printReportLogoType = 1;

            string[] lines;
            char[] param = { '\n' };
            lines = hader.Split(param);
            int i = 0;
            char[] trimParam = { '\r' };

            string TotalHader = "";
            foreach (string s in lines)
            {
                TotalHader += stringPrintFormater.CenterTextWithWhiteSpace(s.TrimEnd(trimParam)) + "\r\n";
            }

            strBody += TotalHader;
            strBody += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("INVENTORY REPORT");
            strBody += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("Date: From - " + dtpStart.Value.Date.ToShortDateString() + " to " + dtpEnd.Value.Date.ToShortDateString());
            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();

            //strBody += "\r\n" + stringPrintFormater.ItemLabeledText("Total Order: " + oItemList.Count, "Order Total: " + lelOrderTotal_Value.Text);
            //strBody += "\r\n" + stringPrintFormater.ItemLabeledText("Total Guest: " + lelGuest_Value.Text, "Service Charge: " + lelServiceCharge_Value.Text);
            //strBody += "\r\n" + stringPrintFormater.ItemLabeledText("Food Price: " + lelFoodPrice_Value.Text, "Delivery Charge: " + "0.00");
            //strBody += "\r\n" + stringPrintFormater.ItemLabeledText("Non Food Price: " + lelNonfoodPrice_Value.Text, "Discount: " + lelDiscount_Value.Text);
            //strBody += "\r\n" + stringPrintFormater.ItemLabeledText("Take Away Food Price: " + lelTakeAwayFoodPrice_Value.Text, "Total Paid (ExVat): " + lelTotalpaidEXVAT_value.Text);
            //strBody += "\r\n" + stringPrintFormater.ItemLabeledText("Take Away Non Food Price: " + lelTakeAwayNonfoodPrice_Value.Text, "Total Paid (IncVat): " + lelTotalpaidIncVAT_value.Text);
            //strBody += "\r\n" + stringPrintFormater.ItemLabeledText("Table Food Price: " + lelTableFoodPrice_Value.Text, "Vat Total: " + lelVat_Value.Text);
            //strBody += "\r\n" + stringPrintFormater.ItemLabeledText("Table Non Food Price: " + lelTableNonfoodPrice_Value.Text, "Cash: " + lelCashTotal_value.Text);
            //strBody += "\r\n" + stringPrintFormater.ItemLabeledText("", "EFT: " + lelEftTotal_value.Text);
            // strBody += "\r\n" + stringPrintFormater.CreateDashedLine();

            strBody += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("DETAILS");
            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();
            strBody += "\r\n";
            strBody += stringPrintFormater.GridCell("Item Name", 100, false);
            strBody += stringPrintFormater.GridCell("Item Price", 15, true);
            strBody += stringPrintFormater.GridCell("Item Qty", 10, true);
            strBody += stringPrintFormater.GridCell("Total Amount(" + Program.currency + ")", 25, true);

            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();
            foreach (DataRow row in tableReport.Rows)
            {
                strBody += "\r\n";
                strBody += stringPrintFormater.GridCell(row[1].ToString(), 100, false);
                strBody += stringPrintFormater.GridCell(row[2].ToString(), 15, true);
                strBody += stringPrintFormater.GridCell(row[3].ToString(), 10, true);
                strBody += stringPrintFormater.GridCell(row[4].ToString(), 25, true);

                strBody += "\r\n" + stringPrintFormater.CreateDashedLine();
            }
            strBody += "\r\n" + "Total No. of Items Sold: " + lblNoOfItemsSold.Text;
            strBody += "\r\n" + "Total Orders: " + lblTotalQty.Text;
            strBody += "\r\n" + "Total Order Amount (£): " + lblTotalAmount.Text;

            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();
            strBody += "\r\n" + "Printed at : " + DateTime.Now.ToString("dd MMMM yyyy") + "-" + DateTime.Now.ToString("hh:mm:ss tt");

            strBody += "\r\n" + stringPrintFormater.CenterTextWithDashed("END REPORT");
            //strBody += "\r\n" + stringPrintFormater.CreateDashedLine();
            //strBody += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("Developed By: www.ibacs.co.uk") + "\r\n\n";
            return strBody;
        }
Example #6
0
        public string MultipleLine(string doc, int divisionLength, string price, int printformateline)
        {
            string returnString = "";

            StringPrintFormater strPrintFormatter = new StringPrintFormater(printformateline);

            if (doc.Length > divisionLength)
            {
                int j = 0;

                ArrayList docArray = new ArrayList();

                string tempDoc = "";

                bool isTrue = false;
                bool isFirst = true;
                do
                {
                    tempDoc = doc.Substring(0, divisionLength);

                    //  tempDoc = doc.Substring(0, divisionLength);
                    j = tempDoc.Length;
                    string check = "";
                    do
                    {
                        j--;

                    } while (tempDoc[j] != ' ' && tempDoc[j] != ',' && tempDoc[j] != '-' && tempDoc[j] != '\n' && tempDoc[j] != '[' && tempDoc[j] != ']' && tempDoc[j] != '>' && tempDoc[j] != '>' && tempDoc[j] != '<');

                    //  doc.Substring(0,j);
                    tempDoc = doc.Substring(0, j);
                    if (isFirst)
                        isFirst = false;
                    else
                        tempDoc = "   " + tempDoc;
                    docArray.Add(tempDoc);

                    tempDoc = doc.Substring(j + 1, doc.Length - j - 1);

                    doc = tempDoc;
                } while (doc.Length > divisionLength);

                if (doc.Length > 0)
                {
                    if (printformateline > 50)
                    {
                        doc = "" + doc;
                    }
                    else
                    {
                        doc = "   " + doc;
                    }
                    docArray.Add(doc);
                }

                foreach (string substring in docArray.ToArray(typeof(string)) as string[])
                {
                    if (!isTrue)
                    {
                        returnString = strPrintFormatter.ItemLabeledText(substring, price) + "\r\n";
                    }
                    else
                    {
                        returnString += substring + "\r\n";
                    }
                    isTrue = true;
                }
            }
            else
            {
                returnString = strPrintFormatter.ItemLabeledText(doc, price) + "\r\n";
            }

            return returnString;
        }
Example #7
0
        private void PrintBeverageVoidItems()
        {
            string Cat1ID = String.Empty;
            bool itemAvailable = false;
            try
            {
                StringPrintFormater strPrintFormatter = new StringPrintFormater(29);
                int papersize = 29;

                CPrintMethodsEXT tempPrintMethods = new CPrintMethodsEXT();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                tempSerialPrintContent = new CSerialPrintContent();

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

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

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

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

                            serialBody.Add(tempSerialPrintContent);
                            itemAvailable = true;

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

                        }
                    }

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

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

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

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

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

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

                    tempPrintMethods.USBPrint(printingObject, PrintDestiNation.BEVARAGE, false);
                    this.WriteString(printingObject);///Write to a file when print command is executed
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message, RMSGlobal.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #8
0
        private void PrintStockControl(int printType)
        {
            strBody = "";
            StringPrintFormater stringPrintFormater = new StringPrintFormater(40);
            strBody += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("Carnival Restaruant");
            strBody += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("Road # 35; House # 1; Gulshan # 2");
            if (printType == 1)
            {
                strBody += "\r\n\n" + stringPrintFormater.CenterTextWithWhiteSpace("STOCK REPORT");
            }
            else if(printType == 2)
            {
                strBody += "\r\n\n" + stringPrintFormater.CenterTextWithWhiteSpace("Reorder Level OF STOCK REPORT");
            }
            else if (printType == 2)
            {
                strBody += "\r\n\n" + stringPrintFormater.CenterTextWithWhiteSpace("OUT OF STOCK REPORT");
            }

            strBody += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace(DateTime.Now.ToLongDateString());
            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();

            strBody += "\r\n" + stringPrintFormater.GridCell("Item Name", 20, false);
            strBody += stringPrintFormater.GridCell("Qty", 5, true);
            strBody += stringPrintFormater.GridCell("Unit", 15, true);

            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();

            double balanceQnty = 0;
            double currentQnty = 0;
            string itemName = "";

            foreach (DataGridViewRow row in dgvFoodItem.Rows)
            {
               // string[] _Item = row.Cells["Category3_Name"].Value.ToString().Split('.');
               // string Item = _Item[0];
               // string[] _Current_Stock = row.Cells["UnitsInStock"].Value.ToString().Split('.');
               // string Current_Stock = _Current_Stock[0];
               //// string[] _Balance_Unit = row.Cells["Balance_Unit"].Value.ToString().Split('.');
              //  string Balance_Unit = _Balance_Unit[0];

                try { currentQnty = Convert.ToDouble(row.Cells["UnitsInStock"].Value.ToString()); }
                catch(Exception )
                {
                    currentQnty = 0;
                }

                string uom="Kg";
                balanceQnty += currentQnty;

                strBody += "\r\n" + stringPrintFormater.GridCell(row.Cells["Category3_Name"].Value.ToString(), 20, false);
                strBody += stringPrintFormater.GridCell(currentQnty.ToString(), 5, true);
                strBody += stringPrintFormater.GridCell(balanceQnty.ToString(), 15, true);
               // strBody += stringPrintFormater.GridCell(row.Cells["uom"].Value.ToString(), 15, true);
                strBody += "\r\n" + stringPrintFormater.CreateDashedLine();

            }

            strBody += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("End Report");
            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();
            strBody += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("ibacs.co.uk");
            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();

            if (printDialog1.ShowDialog() == DialogResult.OK)
            {
                Margins margins = new Margins(10, 10, 10, 10);
                printDocument1.DefaultPageSettings.Margins = margins;
                printDocument1.Print();
            }
        }
Example #9
0
        private string PrintReport(List<DatewiseTotal> datewiseTotals)
        {
            string strBody = "";
            StringPrintFormater stringPrintFormater = new StringPrintFormater(172);
            ViewReport aReport = new ViewReport();

            string header = aReport.GetPrintDecorationText(PrintDecoration.HEADER);

            printReportLogoType = 1;
            string[] lines = null;
            char[] param = { '\n' };
            if (header != null && header.Length > 0)
                lines = header.Split(param);
            int i = 0;
            char[] trimParam = { '\r' };

            string TotalHader = "";
            if (lines != null && lines.Length > 0)
                foreach (string s in lines)
                {
                    TotalHader += stringPrintFormater.CenterTextWithWhiteSpace(s.TrimEnd(trimParam)) + "\r\n";
                }

            strBody += TotalHader;

            //   strBody += "\r\n";
            strBody += "\r\n";
            strBody += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("Total Monthly Report");

            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();
            double total = (from Total in datewiseTotals select Total.TotalIncV).Sum();
            double totalvat = (from tvat in datewiseTotals select tvat.VatTotal).Sum();

            strBody += "\r\n" + stringPrintFormater.ItemLabeledText( "Total Paid (IncVat): " + total.ToString("F02"),"");
             strBody += "\r\n" + stringPrintFormater.ItemLabeledText("Total Vat: "+totalvat.ToString("F02"),"");
            // strBody += "\r\n" + stringPrintFormater.ItemLabeledText("", "Total Cost: " + cost.ToString("F02"));
             strBody += "\r\n" + stringPrintFormater.CreateDashedLine();

            strBody += "\r\n" + stringPrintFormater.GridCell("Date", 25, false);
            strBody += stringPrintFormater.GridCell("Order Total", 14, false);
            strBody += stringPrintFormater.GridCell("Cash", 12, false);
            strBody += stringPrintFormater.GridCell("Card", 12, false);
            strBody += stringPrintFormater.GridCell("Due", 12, false);

            strBody += stringPrintFormater.GridCell("Vat", 12, false);
            strBody += stringPrintFormater.GridCell("Food Total", 12, false);
            strBody += stringPrintFormater.GridCell("NonF Total", 12, false);
            strBody += stringPrintFormater.GridCell("Ser.Charge", 12, false);
            strBody += stringPrintFormater.GridCell("Discount", 12, false);

            // strBody += stringPrintFormater.GridCell("ExV Total", 12, true);
            strBody += stringPrintFormater.GridCell("IncV Total", 12, false);
            strBody += stringPrintFormater.GridCell("Covers", 12, false);
            //strBody += stringPrintFormater.GridCell("Cash", 12, true);
            //strBody += stringPrintFormater.GridCell("EFT", 12, true);
            //strBody += stringPrintFormater.GridCell("EFT Card", 16, false);

            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();

            foreach (DatewiseTotal item in datewiseTotals)
            {
                strBody += "\r\n" + stringPrintFormater.GridCell(item.Date.ToString(), 25, false);
                //  strBody += stringPrintFormater.GridCell(item.SerialNumber.ToString(), 14, false);
                strBody += stringPrintFormater.GridCell(item.OrderTotal.ToString("F02"), 14, false);
                strBody += stringPrintFormater.GridCell(item.CashTotal.ToString("F02"), 12, false);
                strBody += stringPrintFormater.GridCell(item.EFTTotal.ToString("F02"), 12, false);
                strBody += stringPrintFormater.GridCell(item.DueTotal.ToString("F02"), 12, false);
                strBody += stringPrintFormater.GridCell(item.VatTotal.ToString("F02"), 12, false);

                strBody += stringPrintFormater.GridCell(item.FoodTotal.ToString("F02"), 12, false);
                strBody += stringPrintFormater.GridCell(item.NoonFoodTotal.ToString("F02"), 12, false);
                strBody += stringPrintFormater.GridCell(item.ServiceChargeTotal.ToString("F02"), 12, false);
                strBody += stringPrintFormater.GridCell(item.DiscountTotal.ToString("F02"), 12, false);
                strBody += stringPrintFormater.GridCell(item.TotalIncV.ToString("F02"), 12, false);
                strBody += stringPrintFormater.GridCell(item.Covers.ToString(), 12, false);
                strBody += "\r\n" + stringPrintFormater.CreateDashedLine(); // Change by Mithu ( Date to Date Seperate will be)
                // strBody += stringPrintFormater.GridCell(item.OrderTotal.ToString(), 12, true);

                // strBody += stringPrintFormater.GridCell(item.TotalPaidExcludingVat.ToString(), 12, true);

                //strBody += stringPrintFormater.GridCell(item.CashPaid.ToString(), 12, true);

                //strBody += stringPrintFormater.GridCell(item.EFTCardName.ToString(), 16, false);
                //strBody += "\r\n" + stringPrintFormater.CreateDashedLine();

            }

            // strBody += "\r\n" + stringPrintFormater.CreateDashedLine();

            strBody += "\r\n";
            strBody += "\r\n" + stringPrintFormater.CenterTextWithDashed("END REPORT");

            strBody += "\r\n\r\n\r\n" + "                     --------------------" + "                                                             ---------------------      ";
            strBody += "\r\n" + "                           Checked By" + "                                                                       Prepared By         ";

            return strBody;
        }
Example #10
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 #11
0
        private void PrintPaymentBill(int paymentMethodIndex)
        {
            bool isPrintA5GuestBill = false;
            if (isPrintA5GuestBill)
            {
                PrintA5GuestBillReport(2);
            }
            else
            {

                int paperSize = 37;
                StringPrintFormater strPrintFormatter = new StringPrintFormater(37);

                COrderWaiterDao orderWaiterDao = new COrderWaiterDao(); // Change by Mithu
                COrderwaiter orderWaiter = orderWaiterDao.GetOrderwaiterByOrderID(m_iOrderID); // Change by Mithu

                m_itemCost = 0.0;
                CPrintMethodsEXT tempPrintMethods = new CPrintMethodsEXT();
                Hashtable htOrderedItems = new Hashtable();
                SortedList slOrderedItems = new SortedList();
                //string serialHeader = "IBACS RMS";
                string serialHeader = "";
                //string serialFooter = "Please Come Again";
                string serialFooter = "";

                string serialBody = "";

                serialBody += "\r\n" + strPrintFormatter.CenterTextWithWhiteSpace("Bill  Payment"); // Change by Mithu
                COrderManager tempOrderManager = new COrderManager();
                COrderInfo tempOrderInfo = (COrderInfo)tempOrderManager.OrderInfoByOrderID(m_iOrderID).Data;
                serialBody += "\r\n\r\n       Vat Reg. No: " + Program.vatRegDes; // Change by Mithu
                serialBody = "\r\nWaiter Name: " + orderWaiter.WaiterName + "\r\n";
                serialBody += "\r\n\nOrder ID:" + m_iOrderID.ToString();
                //serialBody += "\r\n" + strPrintFormatter.CreateDashedLine(); // Change by Mithu
                if (m_sTableType.Equals("Table"))
                {

                    serialBody += "\r\n\nTable #" + tempOrderInfo.TableNumber.ToString(); // Change by Mithu
                    serialBody += "\r\n                    Served by:" + m_OperatorName; // Change by Mithu
                    serialBody += "\r\n\n                    Cust #" + tempOrderInfo.GuestCount.ToString();  // Change by Mithu
                    //serialBody += "\r\nDate: " + System.DateTime.Now.ToString("dd/MM/yy hh:mm tt"); // Change by Mithu
                    serialBody += "\r\n" + System.DateTime.Now.ToString("\r\ndd/MM/yy hh:mm tt");  // Change by Mithu
                }

                else if (m_sTableType.Equals("TakeAway"))
                {
                    serialBody += "\r\n\nTake Away" + "Date: " + System.DateTime.Now.ToString("dd/MM/yy hh:mm tt");
                    CCustomerManager tempCustomerManager = new CCustomerManager();
                    CCustomerInfo tempCustomerInfo = (CCustomerInfo)tempCustomerManager.CustomerInfoGetByCustomerID(tempOrderInfo.CustomerID).Data;

                    if (tempCustomerInfo.CustomerName.Length > 0)
                    {
                        serialBody += "\r\nCustomer Name: " + tempCustomerInfo.CustomerName;
                    }
                    if (tempCustomerInfo.CustomerPhone.Length > 0)
                    {
                        serialBody += "\r\nPhone:" + tempCustomerInfo.CustomerPhone;
                    }

                    serialBody += "\r\nType: " + tempOrderInfo.Status;
                    if (tempOrderInfo.Status.Equals("Delivery"))
                    {
                        serialBody += "\r\nAddress:";
                        serialBody += "\r\n" + strPrintFormatter.CreateDashedLine();

                        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" + strPrintFormatter.CreateDashedLine();

                        CDelivery objDelivery = new CDelivery();
                        objDelivery.DeliveryOrderID = m_iOrderID;
                        CResult objDeliveryInfo = tempOrderManager.GetDeliveryInfo(objDelivery);
                        objDelivery = (CDelivery)objDeliveryInfo.Data;
                        serialBody += "\r\nDelivery Time:" + objDelivery.DeliveryTime;
                    }
                }
                else if (m_sTableType.Equals("Tabs"))
                {
                    serialBody += "\r\n\nBar Service" + " Date: " + System.DateTime.Now.ToString("dd/MM/yy hh:mm tt");
                    if (tempOrderInfo.TableNumber != 0)
                        serialBody += "\r\nTab Number: " + tempOrderInfo.TableNumber.ToString();
                }

                serialBody += "\r\n\nOrder Information";
                serialBody += "\r\n" + strPrintFormatter.CreateDashedLine();
                serialBody += "\r\n" + strPrintFormatter.CreateDashedLine();
                serialBody += "\r\n" + strPrintFormatter.ItemLabeledText("Qty Item", "Price(" + Program.currency + ")");
                serialBody += "\r\n" + strPrintFormatter.CreateDashedLine();
                //serialBody += "\n----------------------------------------";

                #region "Local Orders"
                if (m_orderUserName.Replace(" ", "").ToUpper() != "Web User".Replace(" ", "").ToUpper())
                {
                    #region "For Bar service"

                    if (m_dtItemList.Columns.Count == 3) //For bar service
                    {
                        //serialBody += "\r\n----------------------------------------";
                        serialBody += "\r\n" + strPrintFormatter.CreateDashedLine();
                        for (int rowIndex = 0; rowIndex < m_dtItemList.Rows.Count; rowIndex++)
                        {
                            if (rowIndex == m_iDrinksIndex)
                                // serialBody += "\r\n----------------------------------------";
                                serialBody += "\r\n" + strPrintFormatter.CreateDashedLine();
                            DataRow tempRow = m_dtItemList.Rows[rowIndex];
                            serialBody += "\r\n" + strPrintFormatter.ItemLabeledText(tempRow["Qty"].ToString() + "  " +
                             tempRow["Item"].ToString(), tempRow["Price"].ToString());
                            m_itemCost += Convert.ToDouble("0" + tempRow["Price"].ToString()); //New for item cost of the bar service
                        }
                        serialBody += "\r\n" + strPrintFormatter.CreateDashedLine();//Separator after the bar items.
                    }
                    #endregion

                    #region "For foods separator is used "

                    else
                    {
                        string cat2ID = "";
                        string cat3ID = "";
                        string cat1ID = "";
                        Int32 internalCategoryID = 0;
                        Int32 categoryID = 0;
                        string categoryOrder = String.Empty;

                        for (int rowIndex = 0; rowIndex < m_dtItemList.Rows.Count; rowIndex++)
                        {
                            #region "Parent Category"
                            DataRow tempRow = m_dtItemList.Rows[rowIndex];
                            categoryOrder = String.Empty;
                            if (Convert.ToInt32("0" + tempRow["Catlevel"].ToString()) == 3)//Item from Category 3
                            {
                                internalCategoryID = Convert.ToInt32("0" + tempRow["Catid"].ToString());
                                DataRow[] dtRow = dsCategory3.Tables[0].Select("cat3_id = " + internalCategoryID);
                                if (dtRow.Length > 0)
                                {
                                    cat2ID = dtRow[0]["cat2_id"].ToString();
                                    DataRow[] dtRowCat2 = dsCategory2.Tables[0].Select("cat2_id = " + cat2ID);//new
                                    cat1ID = dtRowCat2[0]["cat1_id"].ToString();
                                }
                            }

                            else if (Convert.ToInt32("0" + tempRow["Catlevel"].ToString()) == 0)//Item from Category 3
                            {
                                cat1ID = "0";
                                cat2ID = "0";
                            }
                            else
                            {
                                internalCategoryID = Convert.ToInt32("0" + tempRow["Catid"].ToString());
                                DataRow[] dtRow = dsCategory4.Tables[0].Select("cat4_id = " + internalCategoryID);
                                if (dtRow.Length > 0)
                                {
                                    cat3ID = dtRow[0]["cat3_id"].ToString();
                                }

                                dtRow = dsCategory3.Tables[0].Select("cat3_id = " + cat3ID);
                                if (dtRow.Length > 0)
                                {
                                    cat2ID = dtRow[0]["cat2_id"].ToString();
                                    DataRow[] dtRowCat2 = dsCategory2.Tables[0].Select("cat2_id = " + cat2ID);//new
                                    cat1ID = dtRowCat2[0]["cat1_id"].ToString();
                                }
                            }
                            #endregion

                            clsOrderReport objOrderedReport = new clsOrderReport();
                            objOrderedReport.Quantity = Convert.ToInt32("0" + tempRow["Qty"].ToString());
                            objOrderedReport.ItemName = tempRow["Item"].ToString();
                            objOrderedReport.Price = Convert.ToDouble("0" + tempRow["Price"].ToString());
                            int drinkValue = Convert.ToInt32("0" + tempRow["isdrink"].ToString());
                            if (drinkValue > 0)
                            {
                                objOrderedReport.DrinkStatus = true;
                            }
                            else
                            {
                                objOrderedReport.DrinkStatus = false;
                            }
                            Int64 rankNumber = Int64.Parse(tempRow["rank"].ToString());

                            Int32 category1OrderNumber = this.GetCategory1OrderNumber(Convert.ToInt32(cat1ID));
                            htOrderedItems.Add(category1OrderNumber + "-" + rankNumber + "-" + objOrderedReport.ItemName, objOrderedReport);

                            m_itemCost += Convert.ToDouble("0" + tempRow["Price"].ToString());
                        }

                        NumericComparer nc = new NumericComparer();
                        slOrderedItems = new SortedList(htOrderedItems, nc);
                        int keyIndex = 0;
                        string[] valueSplitter = new string[0];
                        SortedList slDrinkItems = new SortedList();
                        SortedList slMiscellaneousItems = new SortedList();

                        PrintUtility printUtility = new PrintUtility();

                        foreach (clsOrderReport objOrderedItems in slOrderedItems.Values)
                        {
                            objOrderedItems.ItemName = objOrderedItems.ItemName.Replace("''", "'");
                            objOrderedItems.ItemName = objOrderedItems.ItemName.Replace("'", "''");

                            string keyValue = slOrderedItems.GetKey(keyIndex).ToString();
                            valueSplitter = keyValue.Split('-');

                            if (objOrderedItems.DrinkStatus == true) //To make all drink items consecutively
                            {
                                slDrinkItems.Add(slDrinkItems.Count, objOrderedItems);
                            }

                            else if ((categoryID != Convert.ToInt32("0" + valueSplitter[0].ToString())) && (Convert.ToInt32("0" + valueSplitter[0].ToString()) != 0)) //All the items except drinks.
                            {
                                categoryID = Convert.ToInt32("0" + valueSplitter[0].ToString());
                                serialBody += "\r\n" + strPrintFormatter.CreateDashedLine() + "\r\n"; //Add the separator.

                                /*serialBody += "\r\n" + objOrderedItems.Quantity.ToString() + "  ";
                                serialBody += CPrintMethods.GetFixedString(objOrderedItems.ItemName.ToString(), 29);
                                serialBody += CPrintMethods.RightAlign(objOrderedItems.Price.ToString("F02"), 6);*/

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

                                //if (qty_length_with_twospace + objOrderedItems.ItemName.Length + objOrderedItems.Price.ToString().Length <= printlinelength)
                                //{
                                //    serialBody += "\r\n"
                                //                                    + strPrintFormatter.ItemLabeledText(objOrderedItems.Quantity.ToString() + "  " + objOrderedItems.ItemName.ToString(),
                                //                                    " " + objOrderedItems.Price.ToString("F02"));
                                //}
                                //else
                                //{
                                //    // line 1
                                //    int itemname_firstline_length = printlinelength - 4 - 1 - objOrderedItems.Price.ToString().Length;
                                //    string itemname_first_part = objOrderedItems.ItemName.Substring(0, itemname_firstline_length);
                                //    string itemname_second_part = objOrderedItems.ItemName.Substring(itemname_firstline_length);
                                //    serialBody += "\r\n"
                                //                                    + strPrintFormatter.ItemLabeledText(objOrderedItems.Quantity.ToString() + "  " + itemname_first_part,
                                //                                    " " + objOrderedItems.Price.ToString("F02"));
                                //    // line 2
                                //    serialBody += "\r\n   "
                                //                                    + strPrintFormatter.ItemLabeledText(itemname_second_part,
                                //                                    " ");
                                //}

                                serialBody += strPrintFormatter.ItemLabeledText(objOrderedItems.Quantity.ToString() + "  " +
                                                                printUtility.MultipleLine(objOrderedItems.ItemName.ToString(), paperSize - 10, objOrderedItems.Price.ToString("F02"), paperSize - 5), "");

                            }
                            else if (valueSplitter[0].ToString() == "0")
                            {
                                slMiscellaneousItems.Add(slMiscellaneousItems.Count, objOrderedItems);
                            }
                            else
                            {
                                /* serialBody += "\r\n" + objOrderedItems.Quantity.ToString() + "  ";
                                 serialBody += CPrintMethods.GetFixedString(objOrderedItems.ItemName.ToString(), 29);
                                 serialBody += CPrintMethods.RightAlign(objOrderedItems.Price.ToString("F02"), 6);*/
                                //Blocked by Salim
                                //serialBody += "\r\n" + strPrintFormatter.ItemLabeledText(objOrderedItems.Quantity.ToString() + "  " +
                                //objOrderedItems.ItemName.ToString(), objOrderedItems.Price.ToString("F02"));

                                //if (qty_length_with_twospace + objOrderedItems.ItemName.Length + objOrderedItems.Price.ToString().Length <= printlinelength)
                                //{
                                //    serialBody += "\r\n"
                                //                                    + strPrintFormatter.ItemLabeledText(objOrderedItems.Quantity.ToString() + "  " + objOrderedItems.ItemName.ToString(),
                                //                                    " " + objOrderedItems.Price.ToString("F02"));
                                //}
                                //else
                                //{
                                //    // line 1
                                //    int itemname_firstline_length = printlinelength - 4 - 1 - objOrderedItems.Price.ToString().Length;
                                //    string itemname_first_part = objOrderedItems.ItemName.Substring(0, itemname_firstline_length);
                                //    string itemname_second_part = objOrderedItems.ItemName.Substring(itemname_firstline_length);
                                //    serialBody += "\r\n"
                                //                                    + strPrintFormatter.ItemLabeledText(objOrderedItems.Quantity.ToString() + "  " + itemname_first_part,
                                //                                    " " + objOrderedItems.Price.ToString("F02"));
                                //    // line 2
                                //    serialBody += "\r\n   "
                                //                                    + strPrintFormatter.ItemLabeledText(itemname_second_part,
                                //                                    " ");
                                //}

                                serialBody += strPrintFormatter.ItemLabeledText(objOrderedItems.Quantity.ToString() + "  " +
                                                               printUtility.MultipleLine(objOrderedItems.ItemName.ToString(), paperSize - 10, objOrderedItems.Price.ToString("F02"), paperSize - 5), "");

                            }
                            keyIndex++;
                        }

                        //Add drinks only
                        if (slMiscellaneousItems.Count > 0)
                        {
                            serialBody += "\r\n" + strPrintFormatter.CenterTextWithDashed("Miscellaneous") + "\r\n";
                            foreach (clsOrderReport objOrderedItems in slMiscellaneousItems.Values)
                            {
                                objOrderedItems.ItemName = objOrderedItems.ItemName.Replace("''", "'");
                                objOrderedItems.ItemName = objOrderedItems.ItemName.Replace("'", "''");

                                /*  serialBody += "\r\n" + objOrderedItems.Quantity.ToString() + "  ";
                                  serialBody += CPrintMethods.GetFixedString(objOrderedItems.ItemName.ToString(), 29);
                                  serialBody += CPrintMethods.RightAlign(objOrderedItems.Price.ToString("F02"), 6);*/

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

                                //if (qty_length_with_twospace + objOrderedItems.ItemName.Length + objOrderedItems.Price.ToString().Length <= printlinelength)
                                //{
                                //    serialBody += "\r\n"
                                //                                    + strPrintFormatter.ItemLabeledText(objOrderedItems.Quantity.ToString() + "  " + objOrderedItems.ItemName.ToString(),
                                //                                    " " + objOrderedItems.Price.ToString("F02"));
                                //}
                                //else
                                //{
                                //    // line 1
                                //    int itemname_firstline_length = printlinelength - 4 - 1 - objOrderedItems.Price.ToString().Length;
                                //    string itemname_first_part = objOrderedItems.ItemName.Substring(0, itemname_firstline_length);
                                //    string itemname_second_part = objOrderedItems.ItemName.Substring(itemname_firstline_length);
                                //    serialBody += "\r\n"
                                //                                    + strPrintFormatter.ItemLabeledText(objOrderedItems.Quantity.ToString() + "  " + itemname_first_part,
                                //                                    " " + objOrderedItems.Price.ToString("F02"));
                                //    // line 2
                                //    serialBody += "\r\n   "
                                //                                    + strPrintFormatter.ItemLabeledText(itemname_second_part,
                                //                                    " ");
                                //}

                                serialBody += strPrintFormatter.ItemLabeledText(objOrderedItems.Quantity.ToString() + "  " +
                                                               printUtility.MultipleLine(objOrderedItems.ItemName.ToString(), paperSize - 10, objOrderedItems.Price.ToString("F02"), paperSize - 5), "");

                            }
                        }

                        //Add drinks only
                        if (slDrinkItems.Count > 0)
                        {
                            serialBody += "\r\n" + strPrintFormatter.CenterTextWithDashed("Drinks") + "\r\n"; //Add the separator.
                            foreach (clsOrderReport objOrderedItems in slDrinkItems.Values)
                            {
                                objOrderedItems.ItemName = objOrderedItems.ItemName.Replace("''", "'");
                                objOrderedItems.ItemName = objOrderedItems.ItemName.Replace("'", "''");

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

                                //if (qty_length_with_twospace + objOrderedItems.ItemName.Length + objOrderedItems.Price.ToString().Length <= printlinelength)
                                //{
                                //    serialBody += "\r\n"
                                //                                    + strPrintFormatter.ItemLabeledText(objOrderedItems.Quantity.ToString() + "  " + objOrderedItems.ItemName.ToString(),
                                //                                    " " + objOrderedItems.Price.ToString("F02"));
                                //}
                                //else
                                //{
                                //    // line 1
                                //    int itemname_firstline_length = printlinelength - 4 - 1 - objOrderedItems.Price.ToString().Length;
                                //    string itemname_first_part = objOrderedItems.ItemName.Substring(0, itemname_firstline_length);
                                //    string itemname_second_part = objOrderedItems.ItemName.Substring(itemname_firstline_length);
                                //    serialBody += "\r\n"
                                //                                    + strPrintFormatter.ItemLabeledText(objOrderedItems.Quantity.ToString() + "  " + itemname_first_part,
                                //                                    " " + objOrderedItems.Price.ToString("F02"));
                                //    // line 2
                                //    serialBody += "\r\n   "
                                //                                    + strPrintFormatter.ItemLabeledText(itemname_second_part,
                                //                                    " ");
                                //}

                                serialBody += strPrintFormatter.ItemLabeledText(objOrderedItems.Quantity.ToString() + "  " +
                                                            printUtility.MultipleLine(objOrderedItems.ItemName.ToString(), paperSize - 10, objOrderedItems.Price.ToString("F02"), paperSize - 5), "");

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

                #region "Online orders"
                else
                {
                    m_itemCost = 0.0;
                    serialBody += "\r\n-----------------------------";
                    for (int rowIndex = 0; rowIndex < m_dtItemList.Rows.Count; rowIndex++)
                    {
                        DataRow tempRow = m_dtItemList.Rows[rowIndex];
                        serialBody += "\r\n" + strPrintFormatter.ItemLabeledText(Convert.ToInt32("0" + tempRow["Qty"]).ToString() + "  " +
                        tempRow["Item"].ToString(), Convert.ToDouble("0" + tempRow["Price"]).ToString("F02"));
                        m_itemCost += Convert.ToDouble("0" + tempRow["Price"].ToString()); //New for item cost of the bar service
                    }
                    serialBody += "\r\n" + strPrintFormatter.CreateDashedLine();
                }
                #endregion

                Double discountAmount = Double.Parse(g_DiscountLabel.Text.Substring(Program.currency.Length));
                Double searviceChargeAmount = Double.Parse(g_ServiceChargeLabel.Text.Substring(Program.currency.Length));
                Double billTotal = ((searviceChargeAmount) + m_dTotalAmount);

                //serialBody += "\r\n                     Order Total: " + CPrintMethods.RightAlign(billTotal.ToString("F02"), 6);
                serialBody += "\r\n" + strPrintFormatter.CreateDashedLine();
                serialBody += "\r\n" + strPrintFormatter.SumupLabeledText("Order Amount: ", m_itemCost.ToString("F02")); //New at 03.03.2009
                serialBody += "\r\n" + strPrintFormatter.CreateDashedLine();

                if (discountAmount > 0)
                {
                    Double totalAmount = m_dTotalAmount;
                    Double discountPercent = 100 * discountAmount / (m_itemCost);
                    serialBody += "\r\n" + strPrintFormatter.SumupLabeledText("Discount(" + discountPercent.ToString("F02") + "%): ", Convert.ToDouble(g_DiscountLabel.Text.Substring(Program.currency.Length)).ToString("F02"));
                }

                double itemiscount = 0;

                 COrderManager temmpOrderManager = new COrderManager();
              COrderDiscount tempOrderDiscount = new COrderDiscount();
              CResult oResult = temmpOrderManager.OrderDiscountGetByOrderID(m_iOrderID);
              if (oResult.IsSuccess && oResult.Data != null)
              {

              tempOrderDiscount = (COrderDiscount) oResult.Data;
              itemiscount = tempOrderDiscount.TotalItemDiscount;
              }

                if (itemiscount > 0)
                {

                    //Discount is based on the total item cost
                    //tempSerialPrintContent.StringLine = "                  Discount:(" + discountPercent.ToString("F02") + "%) " +Convert.ToDecimal(g_DiscountLabel.Text).ToString("F02");
                    serialBody += "\r\n" + strPrintFormatter.SumupLabeledText(" Item Discount: ", itemiscount.ToString("F02"));

                }

                serialBody += "\r\n" + strPrintFormatter.SumupLabeledText("Membership Discount: ", membershipdiscount.ToString("F02"));

                #region "Voucher"
                if (!g_VoucherLabel.Text.Substring(Program.currency.Length).Equals("0.00"))
                {
                    serialBody += "\r\n" + strPrintFormatter.SumupLabeledText("Voucher Discount:", g_VoucherLabel.Text.Substring(Program.currency.Length));
                }
                #endregion

                if ((m_serviceCharge_accounts + m_serviceCharge_cash + m_serviceCharge_cheque + m_serviceCharge_eft + m_serviceCharge_voucher) > 0) //If service charge is assigned
                {
                    CResult cResult = tempOrderManager.OrderServiceChargeGetByOrderID(m_iOrderID);
                    ServiceCharge serviceCharge = cResult.Data as ServiceCharge;

                    double subtotalserviceCharg = m_serviceCharge_accounts + m_serviceCharge_cash + m_serviceCharge_cheque + m_serviceCharge_eft + m_serviceCharge_voucher-tipsamount;
                    serialBody += "\r\n" + strPrintFormatter.SumupLabeledText("Service Charge(" + serviceCharge.ServicechargeRate.ToString("F02") + "%): ", (subtotalserviceCharg).ToString("F02"));// + CPrintMethods.RightAlign(Convert.ToDouble("0" + g_ServiceChargeLabel.Text.Substring(Program.currency.Length)).ToString("F02"), 6); // Change by Mithu
                }
                serialBody += "\r\n" + strPrintFormatter.SumupLabeledText("Tips Amount: ", tipsamount.ToString("F02"));
                double pvat = (billTotal * (vat / 100)) / (1 + (vat / 100));

                if (isVatEnabled) //If service charge is assigned
                {
                    // serialBody += "\r\n" + strPrintFormatter.SumupLabeledText("Vat(" + vat + "%): ", pvat.ToString("F02"));
                    serialBody += "\r\n" + strPrintFormatter.SumupLabeledText("Vat Total(15%): ", Convert.ToDouble("0" + lblVat.Text.Substring(Program.currency.Length)).ToString("F02")); // Change by Mithu
                }

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

                if ((m_serviceCharge_accounts + m_serviceCharge_cash + m_serviceCharge_cheque + m_serviceCharge_eft + m_serviceCharge_voucher) > 0)
                {
                    totalAmountForAddvance = (m_dTotalAmount +
                                              (m_serviceCharge_accounts + m_serviceCharge_cash + m_serviceCharge_cheque +
                                               m_serviceCharge_eft + m_serviceCharge_voucher));
                    serialBody += "\r\n" + strPrintFormatter.SumupLabeledText("Total: ", (m_dTotalAmount + (m_serviceCharge_accounts + m_serviceCharge_cash + m_serviceCharge_cheque + m_serviceCharge_eft + m_serviceCharge_voucher)).ToString("F02"));
                }
                else
                {
                    totalAmountForAddvance = m_dTotalAmount;
                    serialBody += "\r\n" + strPrintFormatter.SumupLabeledText("Total:", m_dTotalAmount.ToString("F02"));
                }
                serialBody += "\r\n" + strPrintFormatter.CreateDashedLine();
                serialBody += "\r\nPayment:";

                if (!g_InputTextBox.Text.Substring(Program.currency.Length).Equals("0.00"))
                {

                    if (complementorylabel.Text.Substring(Program.currency.Length).Equals("0.00"))
                    {
                        serialBody += "\r\nReceived :" + "0.00";
                    }

                    else   serialBody += "\r\nReceived :" + g_InputTextBox.Text.Substring(Program.currency.Length);
                }
                if (!g_CashLabel.Text.Substring(Program.currency.Length).Equals("0.00"))
                {
                    serialBody += "\r\nCash:" + g_CashLabel.Text.Substring(Program.currency.Length);
                }
                if (!g_EFTLabel.Text.Substring(Program.currency.Length).Equals("0.00"))
                {
                    serialBody += "\r\nCard - " + EFTOptionForm.seletedEFTCard.CardName + " :" + g_EFTLabel.Text.Substring(Program.currency.Length);
                }
                if (!g_ChequeLabel.Text.Substring(Program.currency.Length).Equals("0.00"))
                {
                    serialBody += "\r\nDue:" + g_ChequeLabel.Text.Substring(Program.currency.Length);
                }

                if (!g_VoucherLabel.Text.Substring(Program.currency.Length).Equals("0.00"))
                {
                    serialBody += "\r\nVoucher:" + g_VoucherLabel.Text.Substring(Program.currency.Length);
                }

                if (!g_AccountLabel.Text.Substring(Program.currency.Length).Equals("0.00"))
                {
                    serialBody += "\r\nAccounts:" + g_AccountLabel.Text.Substring(Program.currency.Length);
                }

                if (!complementorylabel.Text.Substring(Program.currency.Length).Equals("0.00"))
                {
                    serialBody += "\r\nComplementory:" + complementorylabel.Text.Substring(Program.currency.Length);
                }

                if (m_isAddServiceCharge == false)
                {
                    if (Convert.ToDouble("0" + g_BalaceLabel.Text.Substring(9 + Program.currency.Length)) > 0)
                    {
                        serialBody += "\r\nPay Back: " + g_BalaceLabel.Text.Substring(9 + Program.currency.Length) + "\n";
                    }
                }

                if(addvancecAmountCheckBox.Checked)
                {
                    serialBody += "\r\n" + strPrintFormatter.CenterTextWithDashed("Addvance Payment Information");
                    serialBody += "\r\nAddvance Amount:" +(Convert.ToDouble("0"+advanceAmountTextBox.Text.Trim()));
                    serialBody += "\r\nPaid Amount:" + (totalAmountForAddvance-(Convert.ToDouble("0" + advanceAmountTextBox.Text.Trim())));

                }

                serialBody += "\r\n" + strPrintFormatter.CreateDashedLine();
            //    serialBody += "\r\nS/N: " + tempOrderInfo.SerialNo.ToString();
                if (Program.vatRegDes != "")
                {
                  serialBody += "\r\nVat Reg. No: " + Program.vatRegDes; // Change by Mithu
                }
                // serialBody += "\r\n\r\nDeveloped By: www.ibacs.co.uk";
                serialBody += "\r\n" + strPrintFormatter.CreateDashedLine();

                if(complementoryMessage!=null && complementoryMessage.Length!=0)
                {
                    serialBody += "\r\n" + strPrintFormatter.CenterTextWithDashed("Complementory Message");
                    serialBody += "\r\n" + GetMessageFitOnPaper(complementoryMessage);
                    serialBody += "\r\n" + strPrintFormatter.CreateDashedLine();

                }

                if (dueMessage!=null && dueMessage.Length != 0)
                {
                    serialBody += "\r\n" + strPrintFormatter.CenterTextWithDashed("Due Message");
                    serialBody += "\r\n" + GetMessageFitOnPaper(dueMessage);
                    serialBody += "\r\n" + strPrintFormatter.CreateDashedLine();

                }

                this.WriteString(serialBody);
                gusetBillStr = serialBody;
                //tempPrintMethods.SerialPrint(PRINTER_TYPES.NORMAL_PRINTER, serialHeader, serialBody, serialFooter, tempOrderInfo.SerialNo.ToString());
                tempPrintMethods.USBPrint(serialBody, PrintDestiNation.CLIENT, true);
            }
        }
Example #12
0
        /***************************Print Guest Bill*********************/
        private void g_PrintGuestBillButton_Click(object sender, EventArgs e)
        {
            bool isPrintA5GuestBill = false;
            if (isPrintA5GuestBill)
            {
                PrintA5GuestBillReport(1);
            }
            else
            {

                StringPrintFormater strPrintFormatter = new StringPrintFormater(37);

                int printsize = 37;

                Hashtable htOrderedItems = new Hashtable();
                SortedList slOrderedItems = null;
                string cat1ID = String.Empty;

                try
                {
                    CPrintMethodsEXT tempPrintMethods = new CPrintMethodsEXT();

                    //string serialHeader = "IBACS RMS";
                    string serialHeader = "";
                    //string serialFooter = "Please Come Again";
                    string serialFooter = "";

                    string serialBody = "";

                    //serialBody += "\r\n               Guest Bill";
                    serialBody += strPrintFormatter.CenterTextWithWhiteSpace("Bill  Payment");

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

                    if (m_sTableType.Equals("Table"))
                    {
                        serialBody += "\r\n\nTable Number:" + tempOrderInfo.TableNumber.ToString();
                        serialBody += "\r\n\nCovers:" + tempOrderInfo.GuestCount.ToString();
                        serialBody += "\r\nDate: " + System.DateTime.Now.ToString("dd/MM/yy hh:mm tt");

                        COrderWaiterDao orderWaiterDao = new COrderWaiterDao();
                        COrderwaiter orderWaiter = orderWaiterDao.GetOrderwaiterByOrderID(m_iOrderID);

                        if (orderWaiter != null && orderWaiter.WaiterID > 0)
                        {
                            serialBody += "\r\nWaiter Name: " + orderWaiter.WaiterName + "\r\n";
                        }

                    }
                    else if (m_sTableType.Equals("TakeAway"))
                    {
                        serialBody += "\r\n\nTake Away" + "      Date: " + System.DateTime.Now.ToString("dd/MM/yy");
                        CCustomerManager tempCustomerManager = new CCustomerManager();
                        CCustomerInfo tempCustomerInfo = (CCustomerInfo)tempCustomerManager.CustomerInfoGetByCustomerID(tempOrderInfo.CustomerID).Data;

                        COrderWaiterDao orderWaiterDao = new COrderWaiterDao();
                        COrderwaiter orderWaiter = orderWaiterDao.GetOrderwaiterByOrderID(m_iOrderID);

                        if (orderWaiter != null && orderWaiter.WaiterID > 0)
                        {
                            serialBody += "\r\nWaiter Name: " + orderWaiter.WaiterName + "\r\n";
                        }

                        if (tempCustomerInfo.CustomerName.Length > 0)
                        {
                            serialBody += "\r\nCustomer Name: " + tempCustomerInfo.CustomerName;
                        }
                        if (tempCustomerInfo.CustomerPhone.Length > 0)
                        {
                            serialBody += "\r\nPhone:" + tempCustomerInfo.CustomerPhone;
                        }

                        serialBody += "\r\nType: " + tempOrderInfo.Status;
                        if (tempOrderInfo.Status.Equals("Delivery"))
                        {
                            serialBody += "\r\nAddress:";
                            //serialBody += "\r\n----------------------------------------";
                            serialBody += "\r\n" + strPrintFormatter.CreateDashedLine();

                            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 = m_iOrderID;
                            CResult objDeliveryInfo = tempOrderManager.GetDeliveryInfo(objDelivery);
                            objDelivery = (CDelivery)objDeliveryInfo.Data;
                            serialBody += "\r\nDelivery Time:" + objDelivery.DeliveryTime;
                        }
                    }
                    else if (m_sTableType.Equals("Tabs"))
                    {
                        serialBody += "\r\n\nBar Service" + "      Date: " + System.DateTime.Now.ToString("dd/MM/yy");
                        if (tempOrderInfo.TableNumber != 0)
                        {
                            serialBody += "\r\nTab Number: " + tempOrderInfo.TableNumber.ToString();
                            serialBody += "\r\nGuest Number: " + tempOrderInfo.GuestCount.ToString();
                        }
                    }

                    serialBody += "\r\n\nOrder Information";
                    serialBody += "\r\n" + strPrintFormatter.CreateDashedLine();
                    serialBody += "\r\n" + strPrintFormatter.ItemLabeledText("Qty Item", "Price(" + Program.currency + ")");

                    #region "Local Orders"

                    if (m_orderUserName.Replace(" ", "").ToUpper() != "Web User".Replace(" ", "").ToUpper())
                    {
                        string cat2ID = "";
                        string cat3ID = "";
                        Int32 internalCategoryID = 0;
                        Int32 categoryID = 0;
                        m_itemCost = 0.0;

                        string categoryOrder = String.Empty;

                        for (int rowIndex = 0; rowIndex < m_dtItemList.Rows.Count; rowIndex++)
                        {
                            #region "Parent Category"
                            DataRow tempRow = m_dtItemList.Rows[rowIndex];
                            categoryOrder = String.Empty;
                            if (Convert.ToInt32("0" + tempRow["Catlevel"].ToString()) == 3)//Item from Category 3
                            {
                                internalCategoryID = Convert.ToInt32("0" + tempRow["Catid"].ToString());
                                DataRow[] dtRow = dsCategory3.Tables[0].Select("cat3_id = " + internalCategoryID);
                                if (dtRow.Length > 0)
                                {
                                    cat2ID = dtRow[0]["cat2_id"].ToString();
                                    DataRow[] dtRowCat2 = dsCategory2.Tables[0].Select("cat2_id = " + cat2ID);//new
                                    cat1ID = dtRowCat2[0]["cat1_id"].ToString();
                                }
                            }

                            else if (Convert.ToInt32("0" + tempRow["Catlevel"].ToString()) == 0) //If miscellenious items are added
                            {
                                cat1ID = "0";
                                cat2ID = "0";
                            }

                            else
                            {
                                internalCategoryID = Convert.ToInt32("0" + tempRow["Catid"].ToString());
                                DataRow[] dtRow = dsCategory4.Tables[0].Select("cat4_id = " + internalCategoryID);
                                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();
                                    DataRow[] dtRowCat2 = dsCategory2.Tables[0].Select("cat2_id = " + cat2ID);//new
                                    cat1ID = dtRowCat2[0]["cat1_id"].ToString();
                                }
                            }
                            #endregion

                            clsOrderReport objOrderedReport = new clsOrderReport();
                            objOrderedReport.Quantity = Convert.ToInt32("0" + tempRow["Qty"].ToString());
                            objOrderedReport.ItemName = tempRow["Item"].ToString();
                            objOrderedReport.Price = Convert.ToDouble("0" + tempRow["Price"].ToString());
                            int drinkValue = Convert.ToInt32("0" + tempRow["isdrink"].ToString());
                            if (drinkValue > 0)
                            {
                                objOrderedReport.DrinkStatus = true;
                            }
                            else
                            {
                                objOrderedReport.DrinkStatus = false;
                            }

                            Int64 rankNumber = Int64.Parse(tempRow["rank"].ToString());
                            Int32 category1OrderNumber = this.GetCategory1OrderNumber(Convert.ToInt32(cat1ID));
                            htOrderedItems.Add(category1OrderNumber + "-" + rankNumber + "-" + objOrderedReport.ItemName, objOrderedReport);

                            m_itemCost += Convert.ToDouble("0" + tempRow["Price"].ToString());
                        }

                        NumericComparer nc = new NumericComparer();
                        slOrderedItems = new SortedList(htOrderedItems, nc);
                        int keyIndex = 0;
                        string[] valueSplitter = new string[0];
                        SortedList slDrinkItems = new SortedList();
                        SortedList slMiscellaneousItems = new SortedList();

                        PrintUtility printUtility = new PrintUtility();

                        foreach (clsOrderReport objOrderedItems in slOrderedItems.Values)
                        {
                            string keyValue = slOrderedItems.GetKey(keyIndex).ToString();
                            valueSplitter = keyValue.Split('-');

                            if (objOrderedItems.DrinkStatus == true) //To make all drink items consecutively
                            {
                                slDrinkItems.Add(slDrinkItems.Count, objOrderedItems);
                            }

                            else if ((categoryID != Convert.ToInt32("0" + valueSplitter[0].ToString())) && (Convert.ToInt32("0" + valueSplitter[0].ToString()) != 0)) //All the items except drinks.
                            {
                                categoryID = Convert.ToInt32("0" + valueSplitter[0].ToString());
                                serialBody += "\r\n" + strPrintFormatter.CreateDashedLine() + "\r\n"; //Add the separator.
                                serialBody += strPrintFormatter.ItemLabeledText(objOrderedItems.Quantity.ToString() + "  " +
                            printUtility.MultipleLine(objOrderedItems.ItemName.ToString(), printsize - 7, objOrderedItems.Price.ToString("F02"), printsize - 3), "");
                            }
                            else if (valueSplitter[0].ToString() == "0")
                            {
                                slMiscellaneousItems.Add(slMiscellaneousItems.Count, objOrderedItems);//add miscellaneous items in the collection
                            }
                            else
                            {
                                serialBody += strPrintFormatter.ItemLabeledText(objOrderedItems.Quantity.ToString() + "  " +
                                printUtility.MultipleLine(objOrderedItems.ItemName.ToString(), printsize - 10, objOrderedItems.Price.ToString("F02"), printsize - 5), "");
                            }
                            keyIndex++;
                        }

                        //Add miscellaneous items only
                        if (slMiscellaneousItems.Count > 0)
                        {
                            //serialBody += "\r\n--------------Miscellaneous-------------"; //Add the separator.

                            serialBody += "\r\n" + strPrintFormatter.CenterTextWithDashed("Miscellaneous");
                            serialBody += "\r\n" + strPrintFormatter.CreateDashedLine() + "\r\n";
                            foreach (clsOrderReport objOrderedItems in slMiscellaneousItems.Values)
                            {
                                /* serialBody += "\r\n" + objOrderedItems.Quantity.ToString() + "  ";
                                 serialBody += CPrintMethods.GetFixedString(objOrderedItems.ItemName.ToString(), 23);
                                 serialBody += CPrintMethods.RightAlign(objOrderedItems.Price.ToString("F02"), 6);*/

                                serialBody += strPrintFormatter.ItemLabeledText(objOrderedItems.Quantity.ToString() + "  " +
                                printUtility.MultipleLine(objOrderedItems.ItemName.ToString(), printsize - 10, objOrderedItems.Price.ToString("F02"), printsize - 5), "");
                            }
                        }

                        //Add drinks only
                        if (slDrinkItems.Count > 0)
                        {
                            // serialBody += "\r\n-----------------Drinks-----------------"; //Add the separator.
                            serialBody += "\r\n" + strPrintFormatter.CenterTextWithDashed("Drinks") + "\r\n";
                            foreach (clsOrderReport objOrderedItems in slDrinkItems.Values)
                            {
                                /*serialBody += "\r\n" + objOrderedItems.Quantity.ToString() + "  ";
                                 serialBody += CPrintMethods.GetFixedString(objOrderedItems.ItemName.ToString(), 23);
                                 serialBody += CPrintMethods.RightAlign(objOrderedItems.Price.ToString("F02"), 6);*/

                                serialBody += strPrintFormatter.ItemLabeledText(objOrderedItems.Quantity.ToString() + "  " +
                               printUtility.MultipleLine(objOrderedItems.ItemName.ToString(), printsize - 10, objOrderedItems.Price.ToString("F02"), printsize - 5), "");
                            }
                        }

                        //serialBody += "\r\n----------------------------------------";
                        serialBody += "\r\n" + strPrintFormatter.CreateDashedLine();
                        Double discountAmount = Convert.ToDouble(Double.Parse(g_DiscountLabel.Text.Substring(Program.currency.Length)).ToString("F02"));
                        //Double billTotal = (discountAmount + m_dTotalAmount);
                        //serialBody += "\r\n                     Order Total: " + CPrintMethods.RightAlign(billTotal.ToString("F02"), 6);

                        //serialBody += "\r\n                     Order Total: " + CPrintMethods.RightAlign(m_itemCost.ToString("F02"), 6);//Item cost of the ordered products
                        serialBody += "\r\n" + strPrintFormatter.SumupLabeledText("Order Total: ", m_itemCost.ToString("F02"));
                        //if (discountAmount > 0)
                        //{
                        //    Double totalAmount = m_dTotalAmount;
                        //    Double discountPercent = 100 * discountAmount / (discountAmount + totalAmount);
                        //    serialBody += "\r\n                 Discount:(" + discountPercent.ToString("F02") + "%) " + CPrintMethods.RightAlign(g_DiscountLabel.Text.Substring(Program.currency.Length), 6);
                        //}

                        if (discountAmount > 0)
                        {
                            Double totalAmount = m_dTotalAmount;
                            Double discountPercent = 100 * discountAmount / (m_itemCost); //Discount percentage of the selected products
                            // serialBody += "\r\n                Discount:(" + discountPercent.ToString("F02") + "%) " + CPrintMethods.RightAlign(Convert.ToDouble(g_DiscountLabel.Text.Substring(Program.currency.Length)).ToString("F02"), 6);
                            serialBody += "\r\n" + strPrintFormatter.SumupLabeledText("Discount:(" + discountPercent.ToString("F02") + "%) ", Convert.ToDouble(g_DiscountLabel.Text.Substring(Program.currency.Length)).ToString("F02"));
                        }

                        if (Convert.ToDouble("0" + g_ServiceChargeLabel.Text.Substring(Program.currency.Length)) > 0) //If service charge is assigned
                        {
                            string tempstring = Convert.ToDouble("0" + g_ServiceChargeLabel.Text.Substring(Program.currency.Length)).ToString("F02");

                            serialBody += "\r\n" + strPrintFormatter.SumupLabeledText("Service Charge: ", tempstring);

                        }

                        //double payableAmount = Convert.ToDouble(Convert.ToDouble("0" + g_ServiceChargeLabel.Text.Substring(Program.currency.Length)).ToString("F02")) + m_dTotalAmount;
                        double payableAmount = Convert.ToDouble(Convert.ToDouble("0" + g_ServiceChargeLabel.Text.Substring(Program.currency.Length)).ToString("F02")) + (m_itemCost - discountAmount);

                        //double pvat = (payableAmount * (vat / 100));
                        payableAmount = payableAmount + Convert.ToDouble("0" + lblVat.Text.Substring(Program.currency.Length));

                        if (isVatEnabled) //If service charge is assigned
                        {
                            //serialBody += "\r\n                        Vat("+vat.ToString()+"%): " + CPrintMethods.RightAlign(pvat.ToString("F02"), 6);
                            // serialBody += "\r\n" + strPrintFormatter.SumupLabeledText("Vat(" + vat + "%): ", pvat.ToString("F02"));
                            serialBody += "\r\n" + strPrintFormatter.SumupLabeledText("Vat(" + vat + "%): ", Convert.ToDouble("0" + lblVat.Text.Substring(Program.currency.Length)).ToString("F02"));
                        }

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

                        //serialBody += "\r\n                   Total Payable: " + CPrintMethods.RightAlign(payableAmount.ToString("F02"), 6);
                        serialBody += "\r\n" + strPrintFormatter.SumupLabeledText("Total Payable: ", payableAmount.ToString("F02"));

                        //if (Convert.ToDouble("0" + g_ServiceChargeLabel.Text.Substring(Program.currency.Length)) == 0) //If service charge is not assigned
                        //{
                        //    //serialBody += "\r\n            Tips/Service Charge: ______";
                        //    serialBody += "\r\n" + strPrintFormatter.SumupLabeledText("Service Charge:", " ______");
                        //}
                        //serialBody += "\r\n----------------------------------------";
                        serialBody += "\r\n" + strPrintFormatter.CreateDashedLine();
                        if (m_bEqualSplit)
                        {
                            serialBody += "\r\n" + g_SplitAmountLabel.Text;
                        }

                        serialBody += "\r\nYou've Served by:" + m_OperatorName;
                        serialBody += "\r\n" + m_TerminalName.Trim();

                        serialBody += "\r\nS/N: " + tempOrderInfo.SerialNo.ToString() + "\n";
                        serialBody += strPrintFormatter.CreateDashedLine();
                       // serialBody += "\r\nDeveloped By: www.ibacs.co.uk";

                        this.WriteString(serialBody);

                        //tempPrintMethods.SerialPrint(PRINTER_TYPES.NORMAL_PRINTER, serialHeader, serialBody, serialFooter, tempOrderInfo.SerialNo.ToString());
                        tempPrintMethods.USBPrint(serialBody, PrintDestiNation.CLIENT, true);

                        ///Update status
                        ///

                        if (tempOrderInfo.OrderType.Equals("Table"))
                        {
                            tempOrderInfo.Status = "Billed";
                            tempOrderInfo.OrderTime = System.DateTime.Now;
                            tempOrderManager.UpdateOrderInfo(tempOrderInfo);

                            CPaymentManager tempPaymentManager = new CPaymentManager();
                            CPayment tempPayment = new CPayment();
                            tempPayment.OrderID = tempOrderInfo.OrderID;
                            tempPayment.BillPrintTime = DateTime.Now;
                            tempPaymentManager.InsertBillPrintTime(tempPayment);
                        }
                        // tempPrintMethods.SerialPrint(PRINTER_TYPES.NORMAL_PRINTER, serialHeader, serialBody, serialFooter, tempOrderInfo.SerialNo.ToString());
                        if (m_bEqualSplit)
                        {
                            tempPrintMethods.SerialPrint(PRINTER_TYPES.NORMAL_PRINTER, serialHeader, serialBody, serialFooter, tempOrderInfo.SerialNo.ToString());

                        }
                    }
                    #endregion

                    #region "Online orders"
                    else //For online order information .Added by Baruri
                    {
                        serialBody += "\r\n----------------------------------------";
                        for (int rowIndex = 0; rowIndex < m_dtItemList.Rows.Count; rowIndex++)
                        {
                            DataRow tempRow = m_dtItemList.Rows[rowIndex];
                            serialBody += "\r\n" + Convert.ToInt32("0" + tempRow["Qty"]).ToString() + "  ";
                            serialBody += CPrintMethods.GetFixedString(tempRow["Item"].ToString(), 23);
                            serialBody += CPrintMethods.RightAlign(Convert.ToDouble("0" + tempRow["Price"]).ToString("F02"), 6);
                        }

                        serialBody += "\r\n----------------------------------------";
                        Double discountAmount = Convert.ToDouble(Double.Parse(g_DiscountLabel.Text.Substring(Program.currency.Length)).ToString("F02"));
                        Double billTotal = (discountAmount + m_dTotalAmount);
                        serialBody += "\r\n                     Order Total: " + CPrintMethods.RightAlign(billTotal.ToString("F02"), 6);
                        if (discountAmount > 0)
                        {
                            Double totalAmount = m_dTotalAmount;
                            Double discountPercent = 100 * discountAmount / (discountAmount + totalAmount);
                            serialBody += "\r\n                 Discount:(" + discountPercent.ToString("F02") + "%) " + CPrintMethods.RightAlign(discountAmount.ToString(), 6);
                        }

                        if (Convert.ToDouble("0" + g_ServiceChargeLabel.Text.Substring(Program.currency.Length)) > 0) //If service charge is assigned
                        {
                            serialBody += "\r\n             Service Charge: " + CPrintMethods.RightAlign(Convert.ToDouble("0" + g_ServiceChargeLabel.Text.Substring(Program.currency.Length)).ToString("F02"), 6);
                        }
                        double payableAmount = Convert.ToDouble(Convert.ToDouble("0" + g_ServiceChargeLabel.Text.Substring(Program.currency.Length)).ToString("F02")) + (m_itemCost - discountAmount);
                        double pvat = (payableAmount * (vat / 100)) / (1 + (vat / 100));

                        if (isVatEnabled) //If service charge is assigned
                        {
                            serialBody += "\r\n                    Vat: " + CPrintMethods.RightAlign(pvat.ToString("F02"), 6);
                        }

                        serialBody += "\r\n                   Total Payable: " + CPrintMethods.RightAlign(payableAmount.ToString("F02"), 6);

                        if (Convert.ToDouble("0" + g_ServiceChargeLabel.Text.Substring(Program.currency.Length)) == 0) //If service charge is assigned
                        {
                            serialBody += "\r\n             Service Charge: ______";
                        }
                        serialBody += "\r\n----------------------------------------";
                        if (m_bEqualSplit)
                        {
                            serialBody += "\r\n" + g_SplitAmountLabel.Text;
                        }

                        serialBody += "\r\nYou've Served by:" + m_OperatorName;
                        serialBody += "\r\n" + m_TerminalName.Trim();
                        serialBody += "\r\n              S/N: " + tempOrderInfo.SerialNo.ToString();
                        serialBody += "\r\nDeveloped By: www.ibacs.co.uk";

                        this.WriteString(serialBody);

                        tempPrintMethods.SerialPrint(PRINTER_TYPES.NORMAL_PRINTER, serialHeader, serialBody, serialFooter, tempOrderInfo.SerialNo.ToString());
                    }
                    #endregion
                }
                catch (Exception exp)
                {
                    throw exp;
                }
            }
        }
Example #13
0
        private void PrintA5GuestBillReport(int printType)
        {
            int papersize = 70;
            StringPrintFormater strPrintFormatter = new StringPrintFormater(70);

              Hashtable htOrderedItems = new Hashtable();
                SortedList slOrderedItems = null;
                string cat1ID = String.Empty;

            try
            {
                CPrintMethodsEXT tempPrintMethods = new CPrintMethodsEXT();

                //CPrintMethods tempPrintMethods = new CPrintMethods();
                int categoryID = 0;
                //serial print
                //string serialHeader = "IBACS RMS";
                string serialHeader = "";
                //string serialFooter = "Please Come Again";
                string serialFooter = "";

                List<CSerialPrintContent> serialBody = new List<CSerialPrintContent>();
                CSerialPrintContent tempSerialPrintContent;
                if (printType == 2)
                {
                    tempSerialPrintContent = new CSerialPrintContent();
                    tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.CenterTextWithWhiteSpace("BILL PAYMENT") + "\r\n";
                    tempSerialPrintContent.Bold = true;
                    serialBody.Add(tempSerialPrintContent);
                }
                else
                {
                    tempSerialPrintContent = new CSerialPrintContent();
                    tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.CenterTextWithWhiteSpace("GUEST BILL") + "\r\n" ;
                    tempSerialPrintContent.Bold = true;
                    serialBody.Add(tempSerialPrintContent);
                }

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

                //string s=tempOrderInfo.
                if (m_sTableType.Equals("Table"))
                {
                    if (printType == 1)
                    {
                        //Order ID line remove from report for requisting user
                        // Sajib Vai gathered user requirement
                        //Date : 13-02-2012

                        //tempSerialPrintContent = new CSerialPrintContent();
                        //tempSerialPrintContent.StringLine = "\r\n\nOrder ID:" + m_iOrderID.ToString();
                        //serialBody.Add(tempSerialPrintContent);
                    }

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

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

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

                    tempSerialPrintContent = new CSerialPrintContent();
                    tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.ItemLabeledText("Guest No: " + tempOrderInfo.GuestCount.ToString(),"") + "\r\n";
                    tempSerialPrintContent.Bold = true;
                    serialBody.Add(tempSerialPrintContent);

                    //tempSerialPrintContent = new CSerialPrintContent();
                    //tempSerialPrintContent.StringLine = "Covers: " + tempOrderInfo.GuestCount.ToString() + "\r\n";
                    //tempSerialPrintContent.Bold = true;
                    //serialBody.Add(tempSerialPrintContent);
                    COrderWaiterDao orderWaiterDao = new COrderWaiterDao();
                    COrderwaiter orderWaiter = orderWaiterDao.GetOrderwaiterByOrderID(m_iOrderID);
                    if (orderWaiter != null && orderWaiter.WaiterID > 0)
                    {
                        tempSerialPrintContent = new CSerialPrintContent();
                        tempSerialPrintContent.StringLine = "Waiter Name: " + orderWaiter.WaiterName + "\r\n";
                        //tempSerialPrintContent.Bold = true;
                        serialBody.Add(tempSerialPrintContent);
                    }
                }
                else if (m_sTableType.Equals("TakeAway"))
                {

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

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

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

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

                    if (tempCustomerInfo.CustomerName.Length > 0)
                    {
                        tempSerialPrintContent = new CSerialPrintContent();
                        tempSerialPrintContent.StringLine = "\r\nCustomer Name: " + tempCustomerInfo.CustomerName;
                        serialBody.Add(tempSerialPrintContent);
                    }

                    if (tempCustomerInfo.CustomerPhone.Length > 0)
                    {
                        tempSerialPrintContent = new CSerialPrintContent();
                        tempSerialPrintContent.StringLine = "\r\nPhone:" + tempCustomerInfo.CustomerPhone;
                        serialBody.Add(tempSerialPrintContent);
                    }

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

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

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

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

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

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

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

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

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

                        //tempSerialPrintContent = new CSerialPrintContent();
                        //tempSerialPrintContent.StringLine = "Country:" + tempCustomerInfo.CustomerCountry;
                        //serialBody.Add(tempSerialPrintContent);

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

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

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

                tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.CreateDashedLine();
                serialBody.Add(tempSerialPrintContent);
                tempSerialPrintContent = new CSerialPrintContent();
                tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.ItemLabeledText("Item", "Qnty   Unit Price   Price(" + Program.currency + ")");
                serialBody.Add(tempSerialPrintContent);
                tempSerialPrintContent = new CSerialPrintContent();
                //
                tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.CreateDashedLine() + "\r\n";
                serialBody.Add(tempSerialPrintContent);
                //Line after above line
                //tempSerialPrintContent = new CSerialPrintContent();
                //tempSerialPrintContent.StringLine = "----------------------------------------";
                //serialBody.Add(tempSerialPrintContent);

                if (m_orderUserName.Replace(" ", "").ToUpper() != "Web User".Replace(" ", "").ToUpper())
                    {
                        string cat2ID = "";
                        string cat3ID = "";
                        Int32 internalCategoryID = 0;
                       // Int32 categoryID = 0;
                        m_itemCost = 0.0;

                        string categoryOrder = String.Empty;

                        for (int rowIndex = 0; rowIndex < m_dtItemList.Rows.Count; rowIndex++)
                        {
                            #region "Parent Category"
                            DataRow tempRow = m_dtItemList.Rows[rowIndex];
                            categoryOrder = String.Empty;
                            if (Convert.ToInt32("0" + tempRow["Catlevel"].ToString()) == 3)//Item from Category 3
                            {
                                internalCategoryID = Convert.ToInt32("0" + tempRow["Catid"].ToString());
                                DataRow[] dtRow = dsCategory3.Tables[0].Select("cat3_id = " + internalCategoryID);
                                if (dtRow.Length > 0)
                                {
                                    cat2ID = dtRow[0]["cat2_id"].ToString();
                                    DataRow[] dtRowCat2 = dsCategory2.Tables[0].Select("cat2_id = " + cat2ID);//new
                                    cat1ID = dtRowCat2[0]["cat1_id"].ToString();
                                }
                            }

                            else if (Convert.ToInt32("0" + tempRow["Catlevel"].ToString()) == 0) //If miscellenious items are added
                            {
                                cat1ID = "0";
                                cat2ID = "0";
                            }

                            else
                            {
                                internalCategoryID = Convert.ToInt32("0" + tempRow["Catid"].ToString());
                                DataRow[] dtRow = dsCategory4.Tables[0].Select("cat4_id = " + internalCategoryID);
                                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();
                                    DataRow[] dtRowCat2 = dsCategory2.Tables[0].Select("cat2_id = " + cat2ID);//new
                                    cat1ID = dtRowCat2[0]["cat1_id"].ToString();
                                }
                            }
                            #endregion

                            clsOrderReport objOrderedReport = new clsOrderReport();
                            objOrderedReport.Quantity = Convert.ToInt32("0" + tempRow["Qty"].ToString());
                            objOrderedReport.ItemName = tempRow["Item"].ToString();
                            objOrderedReport.Price = Convert.ToDouble("0" + tempRow["Price"].ToString());
                            int drinkValue = Convert.ToInt32("0" + tempRow["isdrink"].ToString());
                            if (drinkValue > 0)
                            {
                                objOrderedReport.DrinkStatus = true;
                            }
                            else
                            {
                                objOrderedReport.DrinkStatus = false;
                            }

                            Int64 rankNumber = Int64.Parse(tempRow["rank"].ToString());
                            objOrderedReport.ItemUnitPrice = Convert.ToDouble(tempRow["unitPrice"].ToString());

                            Int32 category1OrderNumber = this.GetCategory1OrderNumber(Convert.ToInt32(cat1ID));
                            htOrderedItems.Add(category1OrderNumber + "-" + rankNumber + "-" + objOrderedReport.ItemName, objOrderedReport);

                            m_itemCost += Convert.ToDouble("0" + tempRow["Price"].ToString());
                        }

                        NumericComparer nc = new NumericComparer();
                        slOrderedItems = new SortedList(htOrderedItems, nc);
                        int keyIndex = 0;
                        string[] valueSplitter = new string[0];
                        SortedList slDrinkItems = new SortedList();
                        SortedList slMiscellaneousItems = new SortedList();

                        PrintUtility printUtility = new PrintUtility();

                        foreach (clsOrderReport objOrderedItems in slOrderedItems.Values)
                        {
                            string priceString = printUtility.PupulateRightString(objOrderedItems.Quantity, objOrderedItems.ItemUnitPrice, objOrderedItems.Price);

                            string keyValue = slOrderedItems.GetKey(keyIndex).ToString();
                            valueSplitter = keyValue.Split('-');

                            if (objOrderedItems.DrinkStatus == true) //To make all drink items consecutively
                            {
                                slDrinkItems.Add(slDrinkItems.Count, objOrderedItems);
                            }

                            else if ((categoryID != Convert.ToInt32("0" + valueSplitter[0].ToString())) && (Convert.ToInt32("0" + valueSplitter[0].ToString()) != 0)) //All the items except drinks.
                            {
                                categoryID = Convert.ToInt32("0" + valueSplitter[0].ToString());

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

                                serialBody.Add(tempSerialPrintContent);
                            }
                            else if (valueSplitter[0].ToString() == "0")
                            {
                                slMiscellaneousItems.Add(slMiscellaneousItems.Count, objOrderedItems);//add miscellaneous items in the collection
                            }
                            else
                            {

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

                                serialBody.Add(tempSerialPrintContent);
                            }
                            keyIndex++;
                        }

                        //Add miscellaneous items only
                        if (slMiscellaneousItems.Count > 0)
                        {
                            tempSerialPrintContent = new CSerialPrintContent();
                            tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.CenterTextWithDashed("Miscellaneous") + "\r\n";
                            serialBody.Add(tempSerialPrintContent);

                            foreach (clsOrderReport objOrderedItems in slMiscellaneousItems.Values)
                            {
                                string priceString = printUtility.PupulateRightString(objOrderedItems.Quantity, objOrderedItems.ItemUnitPrice, objOrderedItems.Price);
                                tempSerialPrintContent = new CSerialPrintContent();
                                tempSerialPrintContent.StringLine +=
                                                              strPrintFormatter.ItemLabeledText(
                                                              printUtility.MultipleLine(objOrderedItems.ItemName.ToString(), papersize - 32, priceString, papersize), "");

                                serialBody.Add(tempSerialPrintContent);
                            }
                        }

                        //Add drinks only
                        if (slDrinkItems.Count > 0)
                        {
                            tempSerialPrintContent = new CSerialPrintContent();
                            tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.CenterTextWithDashed("Drinks") + "\r\n";
                            serialBody.Add(tempSerialPrintContent);

                            foreach (clsOrderReport objOrderedItems in slDrinkItems.Values)
                            {
                                string priceString = printUtility.PupulateRightString(objOrderedItems.Quantity, objOrderedItems.ItemUnitPrice, objOrderedItems.Price);
                                tempSerialPrintContent = new CSerialPrintContent();
                                tempSerialPrintContent.StringLine +=
                                                              strPrintFormatter.ItemLabeledText(
                                                              printUtility.MultipleLine(objOrderedItems.ItemName.ToString(), papersize - 32, priceString, papersize), "");

                                serialBody.Add(tempSerialPrintContent);
                            }
                        }
                }

                tempSerialPrintContent = new CSerialPrintContent();
                tempSerialPrintContent.StringLine = strPrintFormatter.CreateDashedLine();
                serialBody.Add(tempSerialPrintContent);

               // strPrintFormatter.SumupLabeledText
                tempSerialPrintContent = new CSerialPrintContent();
                tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.SumupLabeledText("Order Total: ", m_itemCost.ToString("F02"));
                serialBody.Add(tempSerialPrintContent);

                Double discountAmount = Convert.ToDouble(Double.Parse(g_DiscountLabel.Text.Substring(Program.currency.Length)).ToString("F02"));

                if (discountAmount > 0)
                {
                    Double totalAmount = m_dTotalAmount;
                    Double discountPercent = 100 * discountAmount / (m_itemCost); //Discount percentage of the selected products

                    tempSerialPrintContent = new CSerialPrintContent();
                    tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.SumupLabeledText("Discount:(" + discountPercent.ToString("F02") + "%) ", Convert.ToDouble(g_DiscountLabel.Text.Substring(Program.currency.Length)).ToString("F02"));
                    serialBody.Add(tempSerialPrintContent);
                }

                if (Convert.ToDouble("0" + g_ServiceChargeLabel.Text.Substring(Program.currency.Length)) > 0) //If service charge is assigned
                {
                    CResult cResult = tempOrderManager.OrderServiceChargeGetByOrderID(m_iOrderID);
                    ServiceCharge serviceCharge = cResult.Data as ServiceCharge;

                    string tempstring = Convert.ToDouble("0" + g_ServiceChargeLabel.Text.Substring(Program.currency.Length)).ToString("F02");
                    tempSerialPrintContent = new CSerialPrintContent();
                    tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.SumupLabeledText("Service Charge(" + serviceCharge .ServicechargeRate.ToString()+ "%): ", tempstring);
                    serialBody.Add(tempSerialPrintContent);
                }

                double payableAmount = Convert.ToDouble(Convert.ToDouble("0" + g_ServiceChargeLabel.Text.Substring(Program.currency.Length)).ToString("F02")) + (m_itemCost - discountAmount);
                payableAmount = payableAmount + Convert.ToDouble("0" + lblVat.Text.Substring(Program.currency.Length));

                if (isVatEnabled) //If service charge is assigned
                {
                    tempSerialPrintContent = new CSerialPrintContent();
                    tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.SumupLabeledText("Vat(" + vat + "%): ", Convert.ToDouble("0" + lblVat.Text.Substring(Program.currency.Length)).ToString("F02"));
                    serialBody.Add(tempSerialPrintContent);
                }

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

                if (printType == 2)
                {
                    if ((m_serviceCharge_accounts + m_serviceCharge_cash + m_serviceCharge_cheque + m_serviceCharge_eft + m_serviceCharge_voucher) > 0)
                    {
                        tempSerialPrintContent = new CSerialPrintContent();
                        tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.SumupLabeledText("Total Payable: ", (m_dTotalAmount + (m_serviceCharge_accounts + m_serviceCharge_cash + m_serviceCharge_cheque + m_serviceCharge_eft + m_serviceCharge_voucher)).ToString("F02"));
                        serialBody.Add(tempSerialPrintContent);
                    }
                    else
                    {
                        tempSerialPrintContent = new CSerialPrintContent();
                        tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.SumupLabeledText("Total Payable: ", m_dTotalAmount.ToString("F02"));
                        serialBody.Add(tempSerialPrintContent);
                    }

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

                    tempSerialPrintContent = new CSerialPrintContent();
                    tempSerialPrintContent.StringLine = "\r\nPayment:";
                    serialBody.Add(tempSerialPrintContent);

                    if (!g_InputTextBox.Text.Substring(Program.currency.Length).Equals("0.00"))
                    {
                        tempSerialPrintContent = new CSerialPrintContent();
                        tempSerialPrintContent.StringLine = "\r\nReceived :" + g_InputTextBox.Text.Substring(Program.currency.Length);
                        serialBody.Add(tempSerialPrintContent);
                    }
                    if (!g_CashLabel.Text.Substring(Program.currency.Length).Equals("0.00"))
                    {
                        tempSerialPrintContent = new CSerialPrintContent();
                        tempSerialPrintContent.StringLine = "\r\nCash:" + g_CashLabel.Text.Substring(Program.currency.Length);
                        serialBody.Add(tempSerialPrintContent);
                    }
                    if (!g_EFTLabel.Text.Substring(Program.currency.Length).Equals("0.00"))
                    {
                        tempSerialPrintContent = new CSerialPrintContent();
                        tempSerialPrintContent.StringLine = "\r\nCard - " + EFTOptionForm.seletedEFTCard.CardName + " :" + g_EFTLabel.Text.Substring(Program.currency.Length);
                        serialBody.Add(tempSerialPrintContent);
                    }
                    if (!g_ChequeLabel.Text.Substring(Program.currency.Length).Equals("0.00"))
                    {
                        tempSerialPrintContent = new CSerialPrintContent();
                        tempSerialPrintContent.StringLine = "\r\nDue:" + g_ChequeLabel.Text.Substring(Program.currency.Length);
                        serialBody.Add(tempSerialPrintContent);
                    }

                    if (!g_VoucherLabel.Text.Substring(Program.currency.Length).Equals("0.00"))
                    {
                        tempSerialPrintContent = new CSerialPrintContent();
                        tempSerialPrintContent.StringLine = "\r\nVoucher:" + g_VoucherLabel.Text.Substring(Program.currency.Length);
                        serialBody.Add(tempSerialPrintContent);
                    }

                    if (!g_AccountLabel.Text.Substring(Program.currency.Length).Equals("0.00"))
                    {
                        tempSerialPrintContent = new CSerialPrintContent();
                        tempSerialPrintContent.StringLine = "\r\nAccounts:" + g_AccountLabel.Text.Substring(Program.currency.Length);
                        serialBody.Add(tempSerialPrintContent);
                    }

                    if (m_isAddServiceCharge == false)
                    {
                        if (Convert.ToDouble("0" + g_BalaceLabel.Text.Substring(9 + Program.currency.Length)) > 0)
                        {
                            tempSerialPrintContent = new CSerialPrintContent();
                            tempSerialPrintContent.StringLine = "\r\nPay Back: " + g_BalaceLabel.Text.Substring(9 + Program.currency.Length) + "\n";
                            serialBody.Add(tempSerialPrintContent);
                        }
                    }

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

                    // Serial No line remove from report for requisting user
                    // Sajib Vai gathered user requirement
                    //Date : 13-02-2012
                    //tempSerialPrintContent = new CSerialPrintContent();
                    //tempSerialPrintContent.StringLine = "\r\nS/N: " + tempOrderInfo.SerialNo.ToString();
                    //serialBody.Add(tempSerialPrintContent);

                    if (Program.vatRegDes != "")
                    {
                        tempSerialPrintContent = new CSerialPrintContent();
                        tempSerialPrintContent.StringLine = "\r\nVat Reg. No: " + Program.vatRegDes;
                        serialBody.Add(tempSerialPrintContent);
                    }

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

                }
                else if(printType ==1)
                {
                    tempSerialPrintContent = new CSerialPrintContent();
                    tempSerialPrintContent.StringLine = "\r\n" + strPrintFormatter.SumupLabeledText("Total Payable: ", payableAmount.ToString("F02"));
                    serialBody.Add(tempSerialPrintContent);

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

                    tempSerialPrintContent = new CSerialPrintContent();
                    tempSerialPrintContent.StringLine = "\r\n" + "You've Served by:" + m_OperatorName;
                    serialBody.Add(tempSerialPrintContent);

                    //Terminal Name and Serial No line remove from report for requisting user
                    // Sajib Vai gathered user requirement
                    //Date : 13-02-2012
                    //if (m_TerminalName.Length > 0)
                    //{
                    //    tempSerialPrintContent = new CSerialPrintContent();
                    //    tempSerialPrintContent.StringLine = "\r\n" + m_TerminalName;
                    //    serialBody.Add(tempSerialPrintContent);
                    //}

                    //if (tempOrderInfo.SerialNo.ToString().Length > 0)
                    //{
                    //    tempSerialPrintContent = new CSerialPrintContent();
                    //    tempSerialPrintContent.StringLine = "\r\n" + "S/N: " + tempOrderInfo.SerialNo.ToString();
                    //    serialBody.Add(tempSerialPrintContent);
                    //}

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

                    if (tempOrderInfo.OrderType.Equals("Table"))
                    {
                        tempOrderInfo.Status = "Billed";
                        tempOrderInfo.OrderTime = System.DateTime.Now;
                        tempOrderManager.UpdateOrderInfo(tempOrderInfo);

                        CPaymentManager tempPaymentManager = new CPaymentManager();
                        CPayment tempPayment = new CPayment();
                        tempPayment.OrderID = tempOrderInfo.OrderID;
                        tempPayment.BillPrintTime = DateTime.Now;
                        tempPaymentManager.InsertBillPrintTime(tempPayment);
                    }
                    // tempPrintMethods.SerialPrint(PRINTER_TYPES.NORMAL_PRINTER, serialHeader, serialBody, serialFooter, tempOrderInfo.SerialNo.ToString());
                    //if (m_bEqualSplit)
                    //{
                    //    tempPrintMethods.SerialPrint(PRINTER_TYPES.NORMAL_PRINTER, serialHeader, serialBody, serialFooter, tempOrderInfo.SerialNo.ToString());
                    //}
                }

                #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

                gusetBillStr = printingObject;
                #endregion

                tempPrintMethods.USBPrintA5Report(printingObject, PrintDestiNation.CLIENT, true, papersize);

            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message, RMSGlobal.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #14
0
        private string PrintReport(DataTable dtFood, DataTable dtNonFood)
        {
            stringPrintFormater = new StringPrintFormater(172);

            string strBody = "";
            string header = GetPrintDecorationText(PrintDecoration.HEADER);

            string[] lines = null;
            char[] param = { '\n' };
            if (header != null && header.Length > 0)
                lines = header.Split(param);
            int i = 0;
            char[] trimParam = { '\r' };

            string TotalHader = "";
            if (lines != null && lines.Length > 0)
                foreach (string s in lines)
                {
                    TotalHader += stringPrintFormater.CenterTextWithWhiteSpace(s.TrimEnd(trimParam)) + "\r\n";
                }

            strBody += TotalHader;
             //   strBody += "\r\n";
            strBody += "\r\n";
            strBody += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("SALES REPORT- ITEM WISE");
              //  strBody += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("RED CHICK'N");
            strBody += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("Date: From - " + fromDate.ToShortDateString() + " to " + toDate.ToShortDateString());
            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("" + lblOrderCount.Text, "");
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("" + lblQtySoldFood.Text, "");
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("" + lblQtySoldNonFood.Text, "");
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("" + lblQtySoldTotal.Text, "");
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("" + lblPriceFood.Text, "");
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("" + lblPriceNonFood.Text, "");
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("" + lblPriceTotal.Text, "");

            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();

            strBody += "\r\n";
            strBody += "\r\n";
            strBody += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("DETAILS : FOOD");
            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();

            strBody += "\r\n" + stringPrintFormater.GridCell("Item ID", 15, false);
            strBody += stringPrintFormater.GridCell("Item Name", 45, false);
            strBody += stringPrintFormater.GridCell("Price Per Unit", 18, false);
            strBody += stringPrintFormater.GridCell("Quantity Sold", 18, false);

            strBody += stringPrintFormater.GridCell("Total Price", 18, false);
            strBody += stringPrintFormater.GridCell("Total Cost", 18, false);
            strBody += stringPrintFormater.GridCell("Profit", 18, false);
            strBody += stringPrintFormater.GridCell("Profit(%)", 18, false);

            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();

            foreach (DataRow row in dtFood.Rows)
            {

                strBody += "\r\n" + stringPrintFormater.GridCell(row[0].ToString(), 15, false);
                strBody += stringPrintFormater.GridCell(row[1].ToString(), 45, false);
                strBody += stringPrintFormater.GridCell(row[2].ToString(), 18, false);
                strBody += stringPrintFormater.GridCell(row[3].ToString(), 18, false);

                strBody += stringPrintFormater.GridCell(row[4].ToString(), 18, false);
                strBody += stringPrintFormater.GridCell(row[5].ToString(), 18, false);
                strBody += stringPrintFormater.GridCell(row[6].ToString(), 18, false);
                strBody += stringPrintFormater.GridCell(row[7].ToString(), 18, false);

                strBody += "\r\n" + stringPrintFormater.CreateDashedLine();

            }

            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();

            strBody += "\r\n";
            strBody += "\r\n";
            strBody += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("DETAILS : NON FOOD");
            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();

            foreach (DataRow row in dtNonFood.Rows)
            {
                strBody += "\r\n" + stringPrintFormater.GridCell(row[0].ToString(), 15, false);
                strBody += stringPrintFormater.GridCell(row[1].ToString(), 45, false);
                strBody += stringPrintFormater.GridCell(row[2].ToString(), 18, false);
                strBody += stringPrintFormater.GridCell(row[3].ToString(), 18, false);
                strBody += stringPrintFormater.GridCell(row[4].ToString(), 18, false);
                strBody += stringPrintFormater.GridCell(row[5].ToString(), 18, false);
                strBody += stringPrintFormater.GridCell(row[6].ToString(), 18, false);
                strBody += stringPrintFormater.GridCell(row[7].ToString(), 18, false);
                strBody += "\r\n" + stringPrintFormater.CreateDashedLine();

            }

            // strBody += "\r\n" + stringPrintFormater.CreateDashedLine();

            strBody += "\r\n";
            strBody += "\r\n" + stringPrintFormater.CenterTextWithDashed("END REPORT");

            strBody += "\r\n\r\n\r\n" + "                     --------------------" + "                                                             ---------------------      ";
            strBody += "\r\n" + "                           Checked By" + "                                                                       Prepared By         ";

            return strBody;
        }
Example #15
0
        private string getSummaryPrintDoc(string dateString, int lineLength, bool showHeader)
        {
            printReportLogoType = 2;

            stringPrintFormater = new StringPrintFormater(lineLength);

            string strPrint = "";
            if (_showAll)
            {
                strPrint += "\r\n" + stringPrintFormater.CenterTextWithDashed("**********") + "\r\n";
            }
            if (showHeader)
            {
               // strPrint += "\r\n" + tempPrintMethods.GetPrintDecorationText(PrintDecoration.HEADER);

                string header = GetPrintDecorationText(PrintDecoration.HEADER);

                string[] lines = null;
                char[] param = { '\n' };
                if (header != null && header.Length > 0)
                    lines = header.Split(param);
                int i = 0;
                char[] trimParam = { '\r' };

                string TotalHader = "";
                if (lines != null && lines.Length > 0)
                    foreach (string s in lines)
                    {
                        TotalHader += stringPrintFormater.CenterTextWithWhiteSpace(s.TrimEnd(trimParam)) + "\r\n";
                    }

                strPrint += TotalHader;
            }
            strPrint += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("Sales Report (Item Wise)");
            strPrint += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace(dateString);

            strPrint += "\r\n";
            strPrint += "\r\n" + stringPrintFormater.CreateDashedLine();
            strPrint += "\r\n" + lblQtySoldFood.Text;
            strPrint += "\r\n" + lblQtySoldNonFood.Text;
            strPrint += "\r\n" + lblQtySoldTotal.Text;
            strPrint += "\r\n" + lblPriceFood.Text;
            strPrint += "\r\n" + lblPriceNonFood.Text;
            strPrint += "\r\n" + lblPriceTotal.Text;
              //  strPrint += "\r\n" + stringPrintFormater.CreateDashedLine();
             //   strPrint += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("Item(s)");
             //   strPrint += "\r\n" + stringPrintFormater.CreateDashedLine();

            // strPrint += "\r\n" + stringPrintFormater.ItemLabeledText("Sold Food Qty:", stringPrintFormater.CenterTextWithWhiteSpace("Items Price(" +Program.currency +")"));
            strPrint += "\r\n" + stringPrintFormater.CreateDashedLine();

            //  strPrint += "\r\n";
            strPrint += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("FOOD ITEM");
            strPrint += "\r\n" + stringPrintFormater.CreateDashedLine();

            Utility.PrintUtility printUtility = new Utility.PrintUtility();
            foreach (DataRow row in dtFood.Rows)
            {

                strPrint += "\r\n" + (row[1].ToString());
                strPrint += "\r\n" + stringPrintFormater.ItemLabeledText(row[2].ToString() + " x " + row[3].ToString(), row[4].ToString());
                //strPrint += "\r\n" + stringPrintFormater.CreateDashedLine();

                //  strPrint += "\r\n" + stringPrintFormater.ItemLabeledText(printUtility.MultipleLine(row[2].ToString(), 33, "", 38) + " x " + row[3].ToString(), row[4].ToString());
            }

            strPrint += "\r\n\r\n" + stringPrintFormater.CreateDashedLine();
            strPrint += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("NON FOOD ITEM");
            strPrint += "\r\n" + stringPrintFormater.CreateDashedLine();

            foreach (DataRow row in dtNonFood.Rows)
            {
                strPrint += "\r\n" + (row[1].ToString());
                strPrint += "\r\n" + stringPrintFormater.ItemLabeledText(row[2].ToString() + " x " + row[3].ToString(), row[4].ToString());
                //strPrint += "\r\n" + stringPrintFormater.CreateDashedLine();
            }

            //PrintUtility printUtility = new PrintUtility();

            //foreach (DataRow row in dtFood.Rows)
            //{

            //    strPrint += "\r\n" + printUtility.MultipleLine((row[1].ToString()),36,"",36 );
            //    strPrint +=   stringPrintFormater.ItemLabeledText(row[2].ToString() + " x " + row[3].ToString(), row[4].ToString());
            //    strPrint += "\r\n" + stringPrintFormater.CreateDashedLine();

            //}

            strPrint += "\r\n" + stringPrintFormater.CreateDashedLine();
            strPrint += "\r\n" + "Printed at : ";
            strPrint += "\r\n" + DateTime.Now.ToString("dd MMMM yyyy") + "-" + DateTime.Now.ToString("hh:mm:ss tt");
            strPrint += "\r\n" + stringPrintFormater.CreateDashedLine();
            strPrint += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("End Report");
            strPrint += "\r\n" + stringPrintFormater.CreateDashedLine();

            //MessageBox.Show(strPrint);

            return strPrint;
        }
Example #16
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 #17
0
        private string getSummaryPrintText(string dateString, int lineLength, bool showHeader)
        {
            stringPrintFormater = new StringPrintFormater(lineLength);
            printReportLogoType = 2;
            string strPrint = "";
            if (radioButtonActualReport.Checked)
            {
                strPrint += "\r\n" + stringPrintFormater.CenterTextWithDashed("**********") + "\r\n";
            }
            if (showHeader)
            {
               // strPrint += "\r\n" + tempPrintMethods.GetPrintDecorationText(PrintDecoration.HEADER);

                string header = GetPrintDecorationText(PrintDecoration.HEADER);

                string[] lines = null;
                char[] param = { '\n' };
                if (header != null && header.Length > 0)
                    lines = header.Split(param);
                int i = 0;
                char[] trimParam = { '\r' };

                string TotalHader = "";
                if (lines != null && lines.Length > 0)
                    foreach (string s in lines)
                    {
                        TotalHader += stringPrintFormater.CenterTextWithWhiteSpace(s.TrimEnd(trimParam)) + "\r\n";
                    }

                strPrint += TotalHader;
            }

            strPrint += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("Sales Report (Order Wise)");
            strPrint += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace(dateString);

            /***************/
            /* var filter = from searchItem in oItemList
                          where searchItem.or == "Table"
                          select searchItem;

             oItemList = filter.ToList();*/

            TimeSpan ts = new TimeSpan(dtpEnd.Value.Ticks - dtpStart.Value.Ticks);
            if (ts.Days > 1)
            {

                strPrint += "\r\n" + stringPrintFormater.CreateDashedLine();
                for (int i = 0; i <= ts.Days; i++)
                {
                    var qurryDaywiseOrder = from searchItem in oItemList
                                            where searchItem.OrderDateTime.Ticks > getDayStartTicks(dtpStart.Value.AddDays(i))
                                            &&
                                            searchItem.OrderDateTime.Ticks < getDayEndTicks(dtpStart.Value.AddDays(i))
                                            select searchItem;

                    if (qurryDaywiseOrder.Count() > 0)
                    {
                        List<CSearchOrderInfo> tempList = qurryDaywiseOrder.ToList();
                        decimal totalpaidIncvat = (from item in tempList
                                                   select item.TotalPaidIncludingVat).Sum();

                        strPrint += "\r\n" + stringPrintFormater.ItemLabeledText(dtpStart.Value.AddDays(i).ToString("dd MMM") + " Day Total:", totalpaidIncvat.ToString());

                    }

                }
            }

            /****************/

            strPrint += "\r\n";
            strPrint += "\r\n" + stringPrintFormater.CreateDashedLine();
            strPrint += "\r\n" + stringPrintFormater.ItemLabeledText("Total Order: ", oItemList.Count.ToString());
            strPrint += "\r\n" + stringPrintFormater.ItemLabeledText("Total Guest: ", lelGuest_Value.Text);
            strPrint += "\r\n" + stringPrintFormater.ItemLabeledText("Food : ", lelFoodPrice_Value.Text);
            strPrint += "\r\n" + stringPrintFormater.ItemLabeledText("Non Food : ", lelNonfoodPrice_Value.Text);
            strPrint += "\r\n" + stringPrintFormater.ItemLabeledText("T/W Food : ", lelTakeAwayFoodPrice_Value.Text);
            strPrint += "\r\n" + stringPrintFormater.ItemLabeledText("T/W Non Food : ", lelTakeAwayNonfoodPrice_Value.Text);
            strPrint += "\r\n" + stringPrintFormater.ItemLabeledText("Table Food : ", lelTableFoodPrice_Value.Text);
            strPrint += "\r\n" + stringPrintFormater.ItemLabeledText("Table Non Food : ", lelTableNonfoodPrice_Value.Text);
            strPrint += "\r\n" + stringPrintFormater.ItemLabeledText("Order Total: ", lelOrderTotal_Value.Text);
            strPrint += "\r\n" + stringPrintFormater.ItemLabeledText("Service Charge: ", lelServiceCharge_Value.Text);
            strPrint += "\r\n" + stringPrintFormater.ItemLabeledText("Discount: ", lelDiscount_Value.Text);
            strPrint += "\r\n" + stringPrintFormater.ItemLabeledText("Total(ExVat): ", lelTotalpaidEXVAT_value.Text);
            strPrint += "\r\n" + stringPrintFormater.ItemLabeledText("Total(IncVat): ", lelTotalpaidIncVAT_value.Text);
            strPrint += "\r\n" + stringPrintFormater.ItemLabeledText("Vat Total: ", lelVat_Value.Text);
            strPrint += "\r\n" + stringPrintFormater.ItemLabeledText("Cash: ", lelCashTotal_value.Text);
            strPrint += "\r\n" + stringPrintFormater.ItemLabeledText("EFT: ", lelEftTotal_value.Text);
            strPrint += "\r\n" + stringPrintFormater.ItemLabeledText("Due: ", dueTotalLabel.Text);
            strPrint += "\r\n" + stringPrintFormater.ItemLabeledText("Complementory: ", complementorylabel.Text);
            strPrint += "\r\n" + stringPrintFormater.CreateDashedLine();
            strPrint += "\r\n" + "Printed at : ";
            strPrint += "\r\n" + DateTime.Now.ToString("dd MMMM yyyy") + "-" + DateTime.Now.ToString("hh:mm:ss tt");
            strPrint += "\r\n" + stringPrintFormater.CreateDashedLine();
            strPrint += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("End Report");
            strPrint += "\r\n" + stringPrintFormater.CreateDashedLine();

            return strPrint;
        }
Example #18
0
        //private void Doc_PrintPage(object sender, PrintPageEventArgs e)
        //{
        //    int printReportLogoType = 1;
        //    try
        //    {
        //        TextDocument doc = (TextDocument)sender;
        //        Font font = new Font("Lucida Console", 7);
        //        float lineHeight = font.GetHeight(e.Graphics);
        //        float x = e.MarginBounds.Left;
        //        float y = e.MarginBounds.Top + 3;
        //        if (printReportLogoType == 1)
        //        {
        //            //For Birds Eye Restaurant
        //            //  e.Graphics.DrawImage(Image.FromFile("C:\\Program Files\\Ibacs Ltd\\RMS Client\\rooftop.png"), 480, 40);
        //            //for Labamba Restaurant
        //            e.Graphics.DrawImage(Image.FromFile("C:\\Program Files\\Ibacs Ltd\\RMS Client\\IZUMI.jpg"), 493, 35);
        //            //for Aroma Restaurant
        //            //  e.Graphics.DrawImage(Image.FromFile("C:\\Program Files\\Ibacs Ltd\\RMS Client\\aroma.png"), 400, 0);
        //        }
        //        else if (printReportLogoType == 2)
        //        {
        //            //For Bird Eye Restaurant Logo
        //            //  e.Graphics.DrawImage(Image.FromFile("C:\\Program Files\\Ibacs Ltd\\RMS Client\\rooftop.png"), 50, 40);
        //            //for Labamba Restaurant
        //            e.Graphics.DrawImage(Image.FromFile("C:\\Program Files\\Ibacs Ltd\\RMS Client\\IZUMI.jpg"), 50, 0);
        //            //for Aroma Restaurant
        //            //   e.Graphics.DrawImage(Image.FromFile("C:\\Program Files\\Ibacs Ltd\\RMS Client\\aroma.png"), 5, 0);
        //        }
        //        else if (printReportLogoType == 3)
        //        {
        //            //For Bird Eye Restaurant Logo
        //            //   e.Graphics.DrawImage(Image.FromFile("C:\\Program Files\\Ibacs Ltd\\RMS Client\\rooftop.png"), 50, 40);
        //            //for Labamba Restaurant
        //            e.Graphics.DrawImage(Image.FromFile("C:\\Program Files\\Ibacs Ltd\\RMS Client\\SKYSHEEP.png"), 50, 40);
        //            //for Aroma Restaurant
        //            //  e.Graphics.DrawImage(Image.FromFile("C:\\Program Files\\Ibacs Ltd\\RMS Client\\aroma.png"), 50, 0);
        //        }
        //        doc.PageNumber += 1;
        //        while ((y + lineHeight) < e.MarginBounds.Bottom && doc.Offset <= doc.Text.GetUpperBound(0))
        //        {
        //            e.Graphics.DrawString(doc.Text[doc.Offset], font, Brushes.Black, 0, y);
        //            doc.Offset += 1;
        //            y += lineHeight;
        //        }
        //        if (doc.Offset < doc.Text.GetUpperBound(0))
        //        {
        //            e.HasMorePages = true;
        //        }
        //        else
        //        {
        //            doc.Offset = 0;
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        MessageBox.Show("Sorry! Problem occured." + ex.ToString());
        //    }
        //}
        private string PrintReportPrepared(List<double> aGuest)
        {
            string strBody = "";
            StringPrintFormater stringPrintFormater = new StringPrintFormater(172);

            string header = GetPrintDecorationText(PrintDecoration.HEADER);

            string[] lines = null;
            char[] param = { '\n' };
            if (header != null && header.Length > 0)
                lines = header.Split(param);
            int i = 0;
            char[] trimParam = { '\r' };

            string TotalHader = "";
            if (lines != null && lines.Length > 0)
                foreach (string s in lines)
                {
                    TotalHader += stringPrintFormater.CenterTextWithWhiteSpace(s.TrimEnd(trimParam)) + "\r\n";
                }

            strBody += TotalHader;

            //   strBody += "\r\n";
            strBody += "\r\n";
            strBody += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("Total Balance Statement");
            strBody += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("Report Date: " + DateTime.Now.ToShortDateString());
            //    strBody += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("RED CHICK'N");
            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();
            strBody += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("Total Credit Amount(Tk.): " + amount[1].ToString("F02"));

            strBody += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("Total Debit Amount(Tk.): " + amount[2].ToString("F02"));
            strBody += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("Total Balance  in Bank Amount(Tk.): " + amount[0].ToString("F02"));
            strBody += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("Total other Debit Amount(Tk.): " + amount[3].ToString("F02"));
            strBody += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("Total Cash in hand Amount(Tk.): " + amount[4].ToString("F02"));

            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();

            strBody += "\r\n";

            strBody += "\r\n" + stringPrintFormater.CenterTextWithDashed("END REPORT");

            strBody += "\r\n\r\n\r\n" + "                     --------------------" + "                                                             ---------------------      ";
            strBody += "\r\n" + "                           Checked By" + "                                                                       Prepared By         ";

            return strBody;
        }
Example #19
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);
                }
        }
Example #20
0
        private string PrintReport(List<CSearchOrderInfo> oItemList)
        {
            string strBody = "";
            stringPrintFormater = new StringPrintFormater(172);

            string header = GetPrintDecorationText(PrintDecoration.HEADER);

            printReportLogoType = 1;
            string[] lines = null;
            char[] param = { '\n' };
            if (header != null && header.Length > 0)
                lines = header.Split(param);
            int i = 0;
            char[] trimParam = { '\r' };

            string TotalHader = "";
            if (lines != null && lines.Length > 0)
                foreach (string s in lines)
                {
                    TotalHader += stringPrintFormater.CenterTextWithWhiteSpace(s.TrimEnd(trimParam)) + "\r\n";
                }

            strBody += TotalHader;

             //   strBody += "\r\n";
            strBody += "\r\n";
            strBody += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("SALES REPORT");
            //    strBody += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("RED CHICK'N");
            strBody += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("Date: From - " + dtpStart.Value.Date.ToShortDateString() + " to " + dtpEnd.Value.Date.ToShortDateString());
            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("Total Guest: " + lelGuest_Value.Text, "Food Price: " + lelFoodPrice_Value.Text);
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("Take Away Food Price: " + lelTakeAwayFoodPrice_Value.Text, "Non Food Price: " + lelNonfoodPrice_Value.Text);
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("Take Away Non Food Price: " + lelTakeAwayNonfoodPrice_Value.Text, "Total: " + lelOrderTotal_Value.Text);
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("Table Food Price: " + lelTableFoodPrice_Value.Text, "Vat Total: " + lelVat_Value.Text);
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("Table Non Food Price: " + lelTableNonfoodPrice_Value.Text, "Service Charge: " + lelServiceCharge_Value.Text);
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("", "Discount: " + lelDiscount_Value.Text);
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("", "Total Paid (IncVat): " + lelTotalpaidIncVAT_value.Text);
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("", "Cash: " + lelCashTotal_value.Text);
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("", "EFT: " + lelEftTotal_value.Text);
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("", "Due: " + dueTotalLabel.Text);
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("", "Complementory: " + complementorylabel.Text);
            //change by mithu
            double cost = (from item in oItemList select item.TotalCost).Sum();
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("", "Total Cost: " + cost.ToString("F02"));
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("", "Total Profit: " + profitlebel.Text);
            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();

            strBody += "\r\n";
            strBody += "\r\n";
            strBody += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("DETAILS");
            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();

            strBody += "\r\n" + stringPrintFormater.GridCell("O/ID", 9, false);
              //  strBody += stringPrintFormater.GridCell("SN", 14, false);
            strBody += stringPrintFormater.GridCell("Order Date-Time", 25, false);
            strBody += stringPrintFormater.GridCell("O/Type", 10, false);

            strBody += stringPrintFormater.GridCell("Cover", 7, false);
            // strBody += stringPrintFormater.GridCell("Food Total", 12, true);
            // strBody += stringPrintFormater.GridCell("NonF Total", 12, true);
            strBody += stringPrintFormater.GridCell("Order Total", 12, true);
            strBody += stringPrintFormater.GridCell("Discount", 10, true);
            strBody += stringPrintFormater.GridCell("Ser.Charge", 12, true);
            // strBody += stringPrintFormater.GridCell("ExV Total", 12, true);
            strBody += stringPrintFormater.GridCell("IncV Total", 12, true);
            strBody += stringPrintFormater.GridCell("Vat Total", 10, true);
            strBody += stringPrintFormater.GridCell("Cash", 12, true);
            strBody += stringPrintFormater.GridCell("EFT", 12, true);
            strBody += stringPrintFormater.GridCell("EFT Card", 16, false);
            strBody += stringPrintFormater.GridCell("Due", 10, false);
            strBody += stringPrintFormater.GridCell("Cost", 10, false);
            strBody += stringPrintFormater.GridCell("Waiter", 20, false);

            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();

            foreach (CSearchOrderInfo item in oItemList)
            {
                strBody += "\r\n" + stringPrintFormater.GridCell(item.OrderID.ToString(), 9, false);
              //  strBody += stringPrintFormater.GridCell(item.SerialNumber.ToString(), 14, false);
                strBody += stringPrintFormater.GridCell(item.OrderDateTime.ToString(), 25, false);
                strBody += stringPrintFormater.GridCell(item.OrderType.ToString(), 10, false);
                strBody += stringPrintFormater.GridCell(item.Covers.ToString(), 7, false);
                //  strBody += stringPrintFormater.GridCell(item.FoodTotal.ToString(), 12, true);
                //  strBody += stringPrintFormater.GridCell(item.NonfoodTotal.ToString(), 12, true);
                strBody += stringPrintFormater.GridCell(item.OrderTotal.ToString(), 12, true);
                strBody += stringPrintFormater.GridCell(item.Discount.ToString(), 10, true);
                strBody += stringPrintFormater.GridCell(item.ServiceChargeCash.ToString(), 12, true);
                // strBody += stringPrintFormater.GridCell(item.TotalPaidExcludingVat.ToString(), 12, true);
                strBody += stringPrintFormater.GridCell(item.TotalPaidIncludingVat.ToString(), 12, true);
                strBody += stringPrintFormater.GridCell(item.VatPaid.ToString(), 10, true);
                strBody += stringPrintFormater.GridCell(item.CashPaid.ToString(), 12, true);
                strBody += stringPrintFormater.GridCell(item.EFTPaid.ToString(), 12, true);
                strBody += stringPrintFormater.GridCell(item.EFTCardName.ToString(), 16, false);
                strBody += stringPrintFormater.GridCell(item.DuePaid.ToString(), 10, false);
                strBody += stringPrintFormater.GridCell(item.TotalCost.ToString("F02"), 10, false);
                strBody += stringPrintFormater.GridCell(item.Waiter, 20, false);
                strBody += "\r\n" + stringPrintFormater.CreateDashedLine();

            }

            // strBody += "\r\n" + stringPrintFormater.CreateDashedLine();

            strBody += "\r\n";
            strBody += "\r\n" + stringPrintFormater.CenterTextWithDashed("END REPORT");

            strBody += "\r\n\r\n\r\n" + "                     --------------------" + "                                                             ---------------------      ";
            strBody += "\r\n" + "                           Checked By" + "                                                                       Prepared By         ";

            return strBody;
        }
Example #21
0
        private string PrintReportPreparedForDateTodate(List<double> doubles)
        {
            string strBody = "";
            StringPrintFormater stringPrintFormater = new StringPrintFormater(172);

            string header = GetPrintDecorationText(PrintDecoration.HEADER);

            string[] lines = null;
            char[] param = { '\n' };
            if (header != null && header.Length > 0)
                lines = header.Split(param);
            int i = 0;
            char[] trimParam = { '\r' };

            string TotalHader = "";
            if (lines != null && lines.Length > 0)
                foreach (string s in lines)
                {
                    TotalHader += stringPrintFormater.CenterTextWithWhiteSpace(s.TrimEnd(trimParam)) + "\r\n";
                }
            strBody += TotalHader;
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("Cash In: "+label4.Text,"");
            strBody += "\r\n";

            strBody += stringPrintFormater.CreateDashedLine();
            strBody += "\r\n" + stringPrintFormater.GridCell("Transaction Date", 15+5, false);
            strBody += stringPrintFormater.GridCell("Credit Amount", 15+ 3, false);
            strBody += stringPrintFormater.GridCell("DebitAmount", 15 + 3, false);
            strBody += stringPrintFormater.GridCell("Other DEBIT", 10 + 5, false);
            strBody += stringPrintFormater.GridCell("Balance", 15 + 3, false);
            strBody += stringPrintFormater.GridCell("Cash Amount", 15 + 3, false);
            strBody += stringPrintFormater.GridCell("Cash Balance", 15 + 3, false);
            strBody += stringPrintFormater.GridCell("Cash In", 15 + 3, false);
            strBody += stringPrintFormater.GridCell("Cash Out", 15 + 3, false);
            strBody += stringPrintFormater.GridCell("Cash Extra", 15 + 3, false);
            //strBody += stringPrintFormater.GridCell("S. Charge", 15, false);
            //strBody += stringPrintFormater.GridCell("Vat", 15, false);
            //strBody += stringPrintFormater.GridCell("Discount", 15, false);
            //strBody += stringPrintFormater.GridCell("Client Name", 15, false);
            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();
            // strBody += "\r\n";
            int count = 0;
            int length = balancedataGridView.Rows.Count;
            //Transaction_Date, Credit_Amount,Debit_Amount,Other_DEBIT,Balance,Cash_Amount,Cash_Balance
            foreach (DataGridViewRow row in balancedataGridView.Rows)
            {
                count++;

                    try
                    {

                        strBody += "\r\n";
                        try
                        {
                            strBody += stringPrintFormater.GridCell(Convert.ToDateTime(row.Cells["TransactionDate"].Value).ToShortDateString(), 15 + 5, false);
                        }
                        catch (Exception)
                        {
                        }
                        try
                        {
                            strBody += stringPrintFormater.GridCell(row.Cells["CreditAmount"].Value.ToString(), 15 + 3, false);
                        }
                        catch (Exception)
                        {
                        }
                        try
                        {

                            strBody += stringPrintFormater.GridCell((row.Cells["DebitAmount"].Value).ToString(), 15 + 3, false);
                        }
                        catch (Exception)
                        {
                        }
                       // Balance,Cash_Amount,Cash_Balance
                        try
                        {
                            strBody += stringPrintFormater.GridCell(row.Cells["OtherDebitAmount"].Value.ToString(), 10 + 5, false);
                        }
                        catch (Exception)
                        {

                        }
                        try
                        {
                            strBody += stringPrintFormater.GridCell(row.Cells["Balance"].Value.ToString(), 15 + 3, false);
                        }
                        catch (Exception)
                        {
                        }
                        try
                        {
                            strBody += stringPrintFormater.GridCell(row.Cells["CashAmount"].Value.ToString(), 15 + 3, false);
                        }
                        catch (Exception)
                        {
                        }
                        try
                        {
                            strBody += stringPrintFormater.GridCell(row.Cells["CashBalance"].Value.ToString(), 15 + 3, false);
                        }
                        catch (Exception)
                        {
                        }
                        try
                        {
                            strBody += stringPrintFormater.GridCell(row.Cells["CashIn"].Value.ToString(), 15 + 3, false);
                        }
                        catch (Exception)
                        {
                        }
                        try
                        {
                            strBody += stringPrintFormater.GridCell(row.Cells["CashOut"].Value.ToString(), 15 + 3, false);
                        }
                        catch (Exception)
                        {
                        }
                        try
                        {
                            strBody += stringPrintFormater.GridCell(row.Cells["CashExtra"].Value.ToString(), 15 + 3, false);
                        }
                        catch (Exception)
                        {
                        }
                        //try
                        //{
                        //    strBody += stringPrintFormater.GridCell(row.Cells["servicecharge"].Value.ToString(), 15, false);
                        //}
                        //catch (Exception)
                        //{
                        //}
                        //try
                        //{
                        //    strBody += stringPrintFormater.GridCell(row.Cells["vat"].Value.ToString(), 15, false);
                        //}
                        //catch (Exception)
                        //{

                        //}
                        //try
                        //{
                        //    strBody += stringPrintFormater.GridCell(row.Cells["discount"].Value.ToString(), 15, false);
                        //}
                        //catch (Exception)
                        //{
                        //}
                        //try
                        //{
                        //    strBody += stringPrintFormater.GridCell(row.Cells["clientname"].Value.ToString(), 15, false);
                        //}
                        //catch (Exception)
                        //{
                        //}

                    }
                    catch (Exception)
                    {

                    }

                strBody += "\r\n" + stringPrintFormater.CreateDashedLine();

            }

            strBody += "\r\n" + stringPrintFormater.CenterTextWithDashed("END REPORT");

            strBody += "\r\n\r\n\r\n" + "                     --------------------" + "                                                             ---------------------      ";
            strBody += "\r\n" + "                           Checked By" + "                                                                       Prepared By         ";
            return strBody;
        }
Example #22
0
        private void KitchenPrintVoidCopy()
        {
            Hashtable htOrderedItems = new Hashtable();
            bool itemAvailable = false;
            try
            {
                CPrintMethodsEXT tempPrintMethods = new CPrintMethodsEXT();
                CCommonConstants oConstant = ConfigManager.GetConfig<CCommonConstants>();
                COrderManager tempOrderManager = new COrderManager();
                CResult oResult = tempOrderManager.OrderInfoByOrderID(m_orderID);
                COrderInfo tempOrderInfo = new COrderInfo();

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

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

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

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

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

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

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

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

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

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

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

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

                PrintUtility printUtility = new PrintUtility();

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

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

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

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

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

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

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

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

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

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

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

                    }
                    this.WriteString(serialBody);//Writing to the specified file
                }
            }
            catch (Exception exp)
            {
                throw exp;
            }
        }
Example #23
0
        private string PrintReport(DataTable dtFood)
        {
            StringPrintFormater stringPrintFormater = new StringPrintFormater(172);

            string strBody = "";
            string header = GetPrintDecorationText(PrintDecoration.HEADER);

            string[] lines = null;
            char[] param = { '\n' };
            if (header != null && header.Length > 0)
                lines = header.Split(param);
            int i = 0;
            char[] trimParam = { '\r' };

            string TotalHader = "";
            if (lines != null && lines.Length > 0)
                foreach (string s in lines)
                {
                    TotalHader += stringPrintFormater.CenterTextWithWhiteSpace(s.TrimEnd(trimParam)) + "\r\n";
                }

            strBody += TotalHader;
            //   strBody += "\r\n";
            strBody += "\r\n";
            strBody += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("SALES REPORT- Category WISE");
            //  strBody += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("RED CHICK'N");
            strBody += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("Date: From - " + dtpStart.Value.ToShortDateString() + " to " + dtpEnd.Value.ToShortDateString());
            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();

            Decimal totalprice = 0;
            try
            {

                 totalprice =
                (from order in dtFood.AsEnumerable()
                 select order.Field<Decimal>("TotalPrice")).Sum();
            }
            catch (Exception)
            {

            }
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("Total Sold Price: "+totalprice.ToString("F02"),"" );
            //strBody += "\r\n" + stringPrintFormater.ItemLabeledText("" + lblQtySoldFood.Text, "");
            //strBody += "\r\n" + stringPrintFormater.ItemLabeledText("" + lblQtySoldNonFood.Text, "");
            //strBody += "\r\n" + stringPrintFormater.ItemLabeledText("" + lblQtySoldTotal.Text, "");
            //strBody += "\r\n" + stringPrintFormater.ItemLabeledText("" + lblPriceFood.Text, "");
            //strBody += "\r\n" + stringPrintFormater.ItemLabeledText("" + lblPriceNonFood.Text, "");
            //strBody += "\r\n" + stringPrintFormater.ItemLabeledText("" + lblPriceTotal.Text, "");

            //strBody += "\r\n" + stringPrintFormater.CreateDashedLine();

            //strBody += "\r\n";
            //strBody += "\r\n";
            //strBody += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("DETAILS : FOOD");
            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();

              //  strBody += "\r\n" + stringPrintFormater.GridCell("Item ID", 15, false);
            strBody += "\r\n" + stringPrintFormater.GridCell("Item Name", 45, false);
            strBody += stringPrintFormater.GridCell("Price Per Unit", 18, false);
            strBody += stringPrintFormater.GridCell("Quantity Sold", 18, false);

            strBody += stringPrintFormater.GridCell("Total Price", 18, false);
            //strBody += stringPrintFormater.GridCell("Total Cost", 18, false);
            //strBody += stringPrintFormater.GridCell("Profit", 18, false);
            //strBody += stringPrintFormater.GridCell("Profit(%)", 18, false);

            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();

            foreach (DataRow row in dtFood.Rows)
            {

                //strBody += "\r\n" + stringPrintFormater.GridCell(row[0].ToString(), 15, false);
                strBody += "\r\n" + stringPrintFormater.GridCell(row["product_Name"].ToString(), 45, false);
                strBody += stringPrintFormater.GridCell(row["PricePerUnit"].ToString(), 18, false);
                strBody += stringPrintFormater.GridCell(row["QuantitySold"].ToString(), 18, false);

                strBody += stringPrintFormater.GridCell(row["TotalPrice"].ToString(), 18, false);
                //strBody += stringPrintFormater.GridCell(row[5].ToString(), 18, false);
                //strBody += stringPrintFormater.GridCell(row[6].ToString(), 18, false);
                //strBody += stringPrintFormater.GridCell(row[7].ToString(), 18, false);

                strBody += "\r\n" + stringPrintFormater.CreateDashedLine();

            }

            //strBody += "\r\n" + stringPrintFormater.CreateDashedLine();

            //strBody += "\r\n";
            //strBody += "\r\n";
            //strBody += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("DETAILS : NON FOOD");
            //strBody += "\r\n" + stringPrintFormater.CreateDashedLine();

            //foreach (DataRow row in dtNonFood.Rows)
            //{
            //    strBody += "\r\n" + stringPrintFormater.GridCell(row[0].ToString(), 15, false);
            //    strBody += stringPrintFormater.GridCell(row[1].ToString(), 45, false);
            //    strBody += stringPrintFormater.GridCell(row[2].ToString(), 18, false);
            //    strBody += stringPrintFormater.GridCell(row[3].ToString(), 18, false);
            //    strBody += stringPrintFormater.GridCell(row[4].ToString(), 18, false);
            //    strBody += stringPrintFormater.GridCell(row[5].ToString(), 18, false);
            //    strBody += stringPrintFormater.GridCell(row[6].ToString(), 18, false);
            //    strBody += stringPrintFormater.GridCell(row[7].ToString(), 18, false);
            //    strBody += "\r\n" + stringPrintFormater.CreateDashedLine();

            //}

            // strBody += "\r\n" + stringPrintFormater.CreateDashedLine();

            strBody += "\r\n";
            strBody += "\r\n" + stringPrintFormater.CenterTextWithDashed("END REPORT");

            strBody += "\r\n\r\n\r\n" + "                     --------------------" + "                                                             ---------------------      ";
            strBody += "\r\n" + "                           Checked By" + "                                                                       Prepared By         ";

            return strBody;
        }
Example #24
0
        private string PrintReportForPOS()
        {
            List<ReservationIteminformation> utilityIteminformations = new List<ReservationIteminformation>();
            utilityIteminformations = aPartyReservationDao.GetUtilityIteminformationByreservationId(reservationId);

            List<ReservationIteminformation> otherGuestIteminformations = new List<ReservationIteminformation>();
            otherGuestIteminformations = aPartyReservationDao.GetotherguestIteminformationByreservationId(reservationId);

            List<ReservationIteminformation> mainGuestIteminformations = new List<ReservationIteminformation>();
            mainGuestIteminformations = aPartyReservationDao.GetMainguestIteminformationByreservationId(reservationId);

            string strBody = "";
            StringPrintFormater stringPrintFormater = new StringPrintFormater(40);

            string header = GetPrintDecorationText(PrintDecoration.HEADER);

            string[] lines = null;
            char[] param = { '\n' };
            if (header != null && header.Length > 0)
                lines = header.Split(param);
            int i = 0;
            char[] trimParam = { '\r' };

            string TotalHader = "";
            if (lines != null && lines.Length > 0)
                foreach (string s in lines)
                {
                    TotalHader += stringPrintFormater.CenterTextWithWhiteSpace(s.TrimEnd(trimParam)) + "\r\n";
                }

            strBody += TotalHader;

            //   strBody += "\r\n";
            strBody += "\r\n";
            strBody += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("Party Reservation Form");
            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("Booking Date: " + PartyReservation.BookingDate.ToShortDateString(),"");
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("Booking By: " + PartyReservation.LoginPerson, "");
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("Booking Area: " + PartyReservation.BookingArea, "");
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("Type Of Booking: " + PartyReservation.BookingType,"");
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("Party Date: " + PartyReservation.PartyDate.ToShortDateString(), "");
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("Nummber Of Guest: " + PartyReservation.NumberOfGuest,"");
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("Time Of Entry: " + PartyReservation.FromTime + " To " + PartyReservation.ToTime, "");
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("Number Of Other Guest: " + PartyReservation.NumberofOtherGuest,"");
            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();
            strBody += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace(" Main Guest Particulars");
            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();
            strBody += "\r\n" + stringPrintFormater.GridCell("Item Name", 18, false);
            //  strBody += stringPrintFormater.GridCell("SN", 14, false);
            strBody += stringPrintFormater.GridCell("Unit Price", 12, false);
            strBody += stringPrintFormater.GridCell("Total Price",10, false);
            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();
            foreach (ReservationIteminformation iteminformation in mainGuestIteminformations)
            {
                strBody += "\r\n" + stringPrintFormater.GridCell(iteminformation.ItemName,18, false);
                //  strBody += stringPrintFormater.GridCell(item.SerialNumber.ToString(), 14, false);
                strBody += stringPrintFormater.GridCell(iteminformation.UnitPrice.ToString("F02"),12, false);
                strBody += stringPrintFormater.GridCell(iteminformation.TotalPrice.ToString("F02"), 10, false);
            }
            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();
            strBody += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("Other Guest Particulars");
            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();
            strBody += "\r\n" + stringPrintFormater.GridCell("Item Name", 18, false);
            //  strBody += stringPrintFormater.GridCell("SN", 14, false);
            strBody += stringPrintFormater.GridCell("Unit Price", 12, false);
            strBody += stringPrintFormater.GridCell("Total Price", 10, false);
            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();
            foreach (ReservationIteminformation iteminformation in otherGuestIteminformations)
            {
                strBody += "\r\n" + stringPrintFormater.GridCell(iteminformation.ItemName, 18, false);
                //  strBody += stringPrintFormater.GridCell(item.SerialNumber.ToString(), 14, false);
                strBody += stringPrintFormater.GridCell(iteminformation.UnitPrice.ToString("F02"), 12, false);
                strBody += stringPrintFormater.GridCell(iteminformation.TotalPrice.ToString("F02"), 10, false);
            }

            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();
            strBody += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("Utility Cost  Particulars");
            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();
            strBody += "\r\n" + stringPrintFormater.GridCell("Item Name", 26, false);
            //  strBody += stringPrintFormater.GridCell("SN", 14, false);
            //strBody += stringPrintFormater.GridCell("Unit Price", 40, false);
            strBody += stringPrintFormater.GridCell("Total Price", 10, false);
            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();
            foreach (ReservationIteminformation iteminformation in utilityIteminformations)
            {
                strBody += "\r\n" + stringPrintFormater.GridCell(iteminformation.ItemName, 26, false);
                //  strBody += stringPrintFormater.GridCell(item.SerialNumber.ToString(), 14, false);
                //strBody += stringPrintFormater.GridCell(iteminformation.UnitPrice.ToString("F02"), 40, false);
                strBody += stringPrintFormater.GridCell(iteminformation.TotalPrice.ToString("F02"), 10, false);
            }
            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();

            strBody += "\r\n" +stringPrintFormater.ItemLabeledText( "Main Guest Amount(Tk): " + PartyReservation.MainGuestAmount.ToString("F02"), "");
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("Total Payable Amount(Tk): " + PartyReservation.TotalPayableAmount.ToString("F02"),"");
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("Other Guest Amount(Tk): " + PartyReservation.OtherGuestAmount.ToString("F02"), "");
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("Deposite Amount(Tk): " + PartyReservation.DepositeAmount.ToString("F02"),"");
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("Utility Cost Amount(Tk): " + PartyReservation.UtilityCostAmount.ToString("F02"), "");
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("Due Amount(Tk): " + PartyReservation.DueAmount.ToString("F02"), "");
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("Service Charge Amount(Tk): " + PartyReservation.ServiceCharge.ToString("F02"), "");
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("Vat Amount(Tk): " + PartyReservation.Vat.ToString("F02"), "");
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("Discount Amount(Tk): " + PartyReservation.Discount.ToString("F02"), "");
            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();
            strBody += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("Special Instruction");
            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();
            strBody += "\r\n" + PartyReservation.SpecialInstruction;
            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();
            strBody += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("Client Information");
            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("Full Name: " + PartyReservation.ClientName, "");
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("Cell Number: " + PartyReservation.ClientPhone, "");
            strBody += "\r\n" + stringPrintFormater.ItemLabeledText("Email Address: " + PartyReservation.ClientEmail, "");
            strBody += "\r\n" + stringPrintFormater.CreateDashedLine();

            strBody += "\r\n";
            strBody += "\r\n" + stringPrintFormater.CenterTextWithDashed("END REPORT");
            strBody += "\r\n\r\n\r\n" + "--------------------" + "   ---------------------      ";
            strBody += "\r\n" + "Executive Chef" + "              Managemant  ";

            PartyReservation.PrintPreview = strBody;
            return strBody;
        }
Example #25
0
        private void PrintBill(DataTable inDataTable)
        {
            double totalorderamount = (from item in SecondSpiltItems select item.Price).Sum();
            copymember++;

            int papersize = 30;
            PrintUtility  printUtility=new PrintUtility();
            StringPrintFormater strPrintFormatter = new StringPrintFormater(papersize);
            try
            {
                //CPrintMethods tempPrintMethods = new CPrintMethods();
                CPrintMethodsEXT tempPrintMethods = new CPrintMethodsEXT();

                string serialHeader = "IBACS RMS_print bill after split";
                string serialFooter = "Please Come Again";

                string serialBody = "";

                //serialBody += "\n               Guest Bill";
                serialBody += "\r\n" + strPrintFormatter.CenterTextWithWhiteSpace("Spilt Bill(1/"+copymember+")");

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

                if (m_sTableType.Equals("Table"))
                {
                    serialBody += "\n\nTable Number:" + tempOrderInfo.TableNumber.ToString() + " Date: " + System.DateTime.Now.ToShortDateString();
                }
                else if (m_sTableType.Equals("TakeAway"))
                {
                    serialBody += "\n\nTake Away" + " Date: " + System.DateTime.Now.ToShortDateString();

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

                    serialBody += "\nCustomer Name: " + tempCustomerInfo.CustomerName;
                    serialBody += "\nType: " + tempOrderInfo.Status;
                    if (tempOrderInfo.Status.Equals("Delivery"))
                    {
                        serialBody += "\nAddress: " + tempCustomerInfo.CustomerAddress +
                         "\n" + tempCustomerInfo.CustomerTown + "," + tempCustomerInfo.CustomerPostalCode +
                         "\n" + tempCustomerInfo.CustomerPhone;
                    }
                }
                else if (m_sTableType.Equals("Tabs"))
                {
                    serialBody += "\n\nBar Service" + " Date: " + System.DateTime.Now.ToShortDateString();
                    if (tempOrderInfo.TableNumber != 0)
                    {
                        serialBody += "\nTab Number: " + tempOrderInfo.TableNumber.ToString();
                    }
                }

                //serialBody += "\n Order Information";
                serialBody += "\n" + strPrintFormatter.CenterTextWithDashed("Order Information");
                //serialBody += "\n----------------------------------------";
                serialBody += "\r\n" + strPrintFormatter.CreateDashedLine();
                //serialBody += "\nQty Item                         Price  ";
                serialBody += "\r\n" + strPrintFormatter.ItemLabeledText("Qty Item", "Price(" + Program.currency + ")");

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

                //for (int counter = 0; counter < inDataTable.Rows.Count; counter++)
                //{
                //    DataRow tempRow = inDataTable.Rows[counter];

                //   /* serialBody += "\n" + tempRow["Qty"].ToString() + "  ";
                //    serialBody += CPrintMethods.GetFixedString(tempRow["Item"].ToString(), 30);
                //    serialBody += CPrintMethods.RightAlign(tempRow["Price"].ToString(), 6);*/

                //    serialBody += "\n" + strPrintFormatter.ItemLabeledText(tempRow["Qty"].ToString() + "   " + tempRow["Item"].ToString(), tempRow["Price"].ToString());

                //}
                foreach (SpiltItem item in SecondSpiltItems)
                {
                   // serialBody += "\n" + strPrintFormatter.ItemLabeledText(item.Qty.ToString() + "   " + item.ItemName, item.Price.ToString("F02"));

                    serialBody += "\n" + strPrintFormatter.ItemLabeledText(item.Qty.ToString() + "  " +
                       printUtility.MultipleLine(item.ItemName, papersize - 10, item.Price.ToString("F02"), papersize - 3), "");
                }

                //serialBody += "\n----------------------------------------";
                serialBody += "\r\n" + strPrintFormatter.CreateDashedLine();
                Double discountAmount = m_dDiscount;
               // Double svat = Program.vat;
                Double billTotal = (discountAmount + m_dTotalAmount);
                //serialBody += "\nOrder Total: " + CPrintMethods.RightAlign(billTotal.ToString("F02"), 6);

                serialBody += "\r\n" + strPrintFormatter.SumupLabeledText("Order Total: ", totalorderamount.ToString("F02"));
                if (discountAmount > 0)
                {
                    Double totalAmount = ordertotal;
                    Double discountPercent = totalorderamount * discountAmount / (totalAmount);
                    //serialBody += "\n                 Discount:(" + discountPercent.ToString("F02") + "%) " + CPrintMethods.RightAlign(m_dDiscount.ToString("F02"), 6);
                    serialBody += "\r\n" + strPrintFormatter.SumupLabeledText("Discount:", discountPercent.ToString("F02"));

                }

                if (m_dservicecharge > 0)
                {
                    Double totalAmount = ordertotal;
                    Double discountPercent = totalorderamount * m_dservicecharge / (totalAmount);
                    //serialBody += "\n                 Discount:(" + discountPercent.ToString("F02") + "%) " + CPrintMethods.RightAlign(m_dDiscount.ToString("F02"), 6);
                    serialBody += "\r\n" + strPrintFormatter.SumupLabeledText("Service Charge:", discountPercent.ToString("F02"));

                }
                if (m_dvat> 0)
                {
                    Double totalAmount = ordertotal;
                    Double discountPercent = (m_dvat * totalorderamount) / (totalAmount);
                    //serialBody += "\n                 Discount:(" + discountPercent.ToString("F02") + "%) " + CPrintMethods.RightAlign(m_dDiscount.ToString("F02"), 6);
                    serialBody += "\r\n" + strPrintFormatter.SumupLabeledText("Vat:", discountPercent.ToString("F02"));

                }
                serialBody += "\r\n" + strPrintFormatter.CreateDashedLine();
                //serialBody += "\n                   Total Payable: " + CPrintMethods.RightAlign(m_dTotalAmount.ToString("F02"), 6);
                double totalpayable = totalorderamount + (totalorderamount * m_dservicecharge / (ordertotal)) + (totalorderamount * m_dvat / (ordertotal)) -
                        +(totalorderamount * m_dDiscount / (ordertotal));

                serialBody += "\r\n" + strPrintFormatter.SumupLabeledText("Total Payable:   ", totalpayable.ToString("F02"));

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

                //serialBody+= "\r\n\r\n Cash Pay: "+g_CashLabel.Text;
                //serialBody+= "\r\n EFT Pay: "+g_EFTLabel.Text;
                //serialBody+= "\r\n Cheque Pay: "+g_ChequeLabel.Text;
                //serialBody+= "\r\n Voucher Pay: "+g_VoucherLabel.Text;
                //serialBody+= "\r\n "+g_BalaceLabel.Text;

                serialBody += "\n\nS/N: " + tempOrderInfo.SerialNo.ToString()+"\n";

                //tempPrintMethods.SerialPrint(PRINTER_TYPES.NORMAL_PRINTER, serialHeader, serialBody, serialFooter, tempOrderInfo.SerialNo.ToString());

                tempPrintMethods.USBPrint(serialBody, PrintDestiNation.CLIENT, true);
            }
            catch (Exception exp)
            {
                throw exp;
            }
        }
Example #26
0
        private string PrintReport()
        {
            string strBody = "";
            StringPrintFormater stringPrintFormater = new StringPrintFormater(172);

            string header = GetPrintDecorationText(PrintDecoration.HEADER);

            string[] lines = null;
            char[] param = { '\n' };
            if (header != null && header.Length > 0)
                lines = header.Split(param);
            int i = 0;
            char[] trimParam = { '\r' };

            string TotalHader = "";
            if (lines != null && lines.Length > 0)
                foreach (string s in lines)
                {
                    TotalHader += stringPrintFormater.CenterTextWithWhiteSpace(s.TrimEnd(trimParam)) + "\r\n";
                }
            strBody += TotalHader;
            strBody += "\r\n";
            strBody +=  stringPrintFormater.CreateDashedLine();
            strBody += "\r\n"+stringPrintFormater.GridCell("Booking Date", 15, false);
            strBody += stringPrintFormater.GridCell("Creator", 20, false);
            strBody +=  stringPrintFormater.GridCell("Party Date", 15, false);
            strBody += stringPrintFormater.GridCell("Guest", 10, false);
            strBody += stringPrintFormater.GridCell("P. Amount", 15, false);
            strBody += stringPrintFormater.GridCell("D. Amount", 15, false);
            strBody += stringPrintFormater.GridCell("Due Amount", 15, false);
            strBody += stringPrintFormater.GridCell("S. Charge", 15, false);
            strBody += stringPrintFormater.GridCell("Vat", 15, false);
            strBody += stringPrintFormater.GridCell("Discount", 15, false);
            strBody += stringPrintFormater.GridCell("Client Name", 15, false);
            strBody +=  "\r\n"+ stringPrintFormater.CreateDashedLine();
               // strBody += "\r\n";
            int count = 0;
            int length = reportdataGridView.Rows.Count;

            foreach (DataGridViewRow  row in reportdataGridView.Rows)
            {
                count++;
                if (count != length)
                {
                    try
                    {

                        strBody += "\r\n";
                        try
                        {
                            strBody += stringPrintFormater.GridCell(Convert.ToDateTime(row.Cells["BookingDate"].Value).ToShortDateString(), 15, false);
                        }
                        catch (Exception)
                        {
                        }
                        try
                        {
                            strBody += stringPrintFormater.GridCell(row.Cells["Creator"].Value.ToString(), 20, false);
                        }
                        catch (Exception)
                        {
                        }
                        try
                        {

                            strBody += stringPrintFormater.GridCell(Convert.ToDateTime(row.Cells["partydate"].Value).ToShortDateString(), 15, false);
                        }
                        catch (Exception)
                        {
                        }
                        try
                        {
                            strBody += stringPrintFormater.GridCell(row.Cells["Total Guest"].Value.ToString(), 10, false);
                        }
                        catch (Exception)
                        {

                        }
                        try
                        {
                            strBody += stringPrintFormater.GridCell(row.Cells["totalpayableamount"].Value.ToString(), 15, false);
                        }
                        catch (Exception)
                        {
                        }
                        try
                        {
                            strBody += stringPrintFormater.GridCell(row.Cells["depositeamount"].Value.ToString(), 15, false);
                        }
                        catch (Exception)
                        {
                        }
                        try
                        {
                            strBody += stringPrintFormater.GridCell(row.Cells["dueamount"].Value.ToString(), 15, false);
                        }
                        catch (Exception)
                        {
                        }
                        try
                        {
                            strBody += stringPrintFormater.GridCell(row.Cells["servicecharge"].Value.ToString(), 15, false);
                        }
                        catch (Exception)
                        {
                        }
                        try
                        {
                            strBody += stringPrintFormater.GridCell(row.Cells["vat"].Value.ToString(), 15, false);
                        }
                        catch (Exception)
                        {

                        }
                        try
                        {
                            strBody += stringPrintFormater.GridCell(row.Cells["discount"].Value.ToString(), 15, false);
                        }
                        catch (Exception)
                        {
                        }
                        try
                        {
                            strBody += stringPrintFormater.GridCell(row.Cells["clientname"].Value.ToString(), 15, false);
                        }
                        catch (Exception)
                        {
                        }

                    }
                    catch (Exception)
                    {

                    }
                }
                strBody += "\r\n" + stringPrintFormater.CreateDashedLine();

            }

            strBody += "\r\n";
            strBody += "\r\n" + stringPrintFormater.CenterTextWithDashed("END REPORT");
            strBody += "\r\n\r\n\r\n" + "                     ------------------------" + "                                                             ---------------------      ";
            strBody += "\r\n" + "                     Signature Executive Chef" + "                                                             Signature Managemant  ";

            return strBody;
        }
Example #27
0
        private string GetHeader()
        {
            string strBody = "";
            StringPrintFormater stringPrintFormater = new StringPrintFormater(172);

            string header = GetPrintDecorationText(PrintDecoration.HEADER);

              //  printReportLogoType = 1;
            string[] lines = null;
            char[] param = { '\n' };
            if (header != null && header.Length > 0)
                lines = header.Split(param);
            int i = 0;
            char[] trimParam = { '\r' };

            string TotalHader = "";
            if (lines != null && lines.Length > 0)
                foreach (string s in lines)
                {
                    TotalHader += stringPrintFormater.CenterTextWithWhiteSpace(s.TrimEnd(trimParam)) + "\r\n";
                }

            return TotalHader;
        }