예제 #1
0
파일: SalesReport.cs 프로젝트: Jusharra/RMS
        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);
            }
        }
예제 #2
0
        private void btnCurrentDay_Click(object sender, EventArgs e)
        {
            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);

            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 = "         Inventory Sales Report\n";
                serialBody.Add(tempSerialPrintContent);

                tempSerialPrintContent = new CSerialPrintContent();
                tempSerialPrintContent.StringLine = "Date of Consumption of Items:" + DateTime.Now.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 = "Qty Item                           Price";
                serialBody.Add(tempSerialPrintContent);

                SortedList slorderedFoodItems = new SortedList();
                SortedList slorderedNonFoodItems = new SortedList();
                if (dsSalesRecords.Tables[0].Rows.Count > 0)
                {
                    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;
                        objOrderedItems.Price = Convert.ToDouble(dtRrow["amount"]);
                        objOrderedItems.FoodTypeName = Convert.ToString(returnedValue[2]);

                        Int32 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);
                        }
                    }
                    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.StringLine += CPrintMethods.GetFixedString(objOrderedItems.ItemName, 30);
                                tempSerialPrintContent.StringLine += CPrintMethods.RightAlign(objOrderedItems.Price.ToString("F02"), 6);
                                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);
                                serialBody.Add(tempSerialPrintContent);
                            }
                        }
                    }

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

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

                    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);
                                serialBody.Add(tempSerialPrintContent);

                                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);
                                serialBody.Add(tempSerialPrintContent);
                            }
                        }
                    }

                    #endregion

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

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

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

                    #endregion

                    tempPrintMethods.SerialPrint(PRINTER_TYPES.NORMAL_PRINTER, serialHeader, serialBody, serialFooter, "SN".ToString());
                }
            }
            else
            {
                MessageBox.Show("There is no record",RMSGlobal.MessageBoxTitle,MessageBoxButtons.OK,MessageBoxIcon.Information);
            }
        }
예제 #3
0
파일: SalesReport.cs 프로젝트: Jusharra/RMS
        private void btnCurrentDay_Click(object sender, EventArgs e)
        {
            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);

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

            DataTable dt = (DataTable)objResult.Data;
            dataGridView1.AutoGenerateColumns = true;
            dataGridView1.DataSource = dt;
            {
                // MessageBox.Show("There is no record", RMSGlobal.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }