Example #1
0
        public CResult GetDrawerLogDetails(Int64 startTime, Int64 endTime)
        {
            CResult tempcResult = new CResult();
            List<CPayment> paymentdetails = new List<CPayment>();
            string sqlCommand = String.Format(SqlQueries.GetQuery(Query.DrawerLogdetails), startTime, endTime);
            IDataReader oReader = this.ExecuteReader(sqlCommand);
            if (oReader != null)
            {
                while (oReader.Read())
                {
                    CPayment tempPayment = new CPayment();

                    if (oReader["terminal_id"] != null)
                    {
                        tempPayment.PcID = int.Parse(oReader["terminal_id"].ToString());
                    }

                    if (oReader["userid"] != null)
                    {
                        tempPayment.UserID = Convert.ToString(oReader["userid"]);
                    }

                    if (oReader["opentime"] != null)
                    {
                        Int64 dateTime = Convert.ToInt64(oReader["opentime"].ToString());
                        tempPayment.PaymentTime = new DateTime(dateTime);// Convert.ToDateTime(dateTime);
                    }
                    paymentdetails.Add(tempPayment);
                }
            }
            tempcResult.Data = paymentdetails;
            return tempcResult;
        }
Example #2
0
        public CResult GetPaymentByOrderID(Int64 inPaymentID)
        {
            CPayment tempPayment = new CPayment();
            try
            {
                m_oResult.Data = Database.Instance.Payment.GetPaymentByOrderID(inPaymentID);
                m_oResult.IsSuccess = true;
                m_oResult.Message = "Data Read Successfully";

            }
            catch (Exception ex)
            {
                System.Console.WriteLine("Exception occuer at GetPaymentByOrderID() : " + ex.Message);
                m_oResult.IsException = true;
                m_oResult.Action = EERRORNAME.EXCEPTION_OCCURE;
                //m_oResult.SetParams(ex.Message);

                m_oResult.Message = ex.Message;
                Logger.Write("Exception : " + ex + " in GetPaymentByOrderID()", LogLevel.Error, "COrderManager");
            }
            return m_oResult;
        }
Example #3
0
        public void DeletePayment(CPayment inPayment)
        {
            try
            {

                this.OpenConnection();
                string sSql = string.Format(SqlQueries.GetQuery(Query.PaymentDelete),inPayment.PaymentID);

                this.ExecuteNonQuery(sSql);

            }
            catch (Exception ex)
            {
                Logger.Write("Exception : " + ex + " in DeletePayment()", LogLevel.Error, "Database");

                throw new Exception("Exception occure at DeletePayment()", ex);
            }
            finally
            {
                this.CloseConnection();
            }
        }
Example #4
0
        public CPayment GetPaymentByOrderID(Int64 inOrderID)
        {
            CPayment tempPayment= new CPayment();
            try
            {
                this.OpenConnection();
                string sSql = string.Format(SqlQueries.GetQuery(Query.PayementGetByOrderID), inOrderID);

                IDataReader oReader = this.ExecuteReader(sSql);
                if (oReader != null)
                {
                    while (oReader.Read())
                    {
                        tempPayment= ReaderToPayment(oReader);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.Write("###" + ex + "###");
                Logger.Write("Exception : " + ex + " in GetPaymentByOrderID()", LogLevel.Error, "Database");
                if (ex.GetType().Equals(typeof(SqlException)))
                {
                    SqlException oSQLEx = ex as SqlException;
                    if (oSQLEx.Number != 7619)
                        throw new Exception("Exception occure at GetPaymentByOrderID()", ex);
                }
                else
                {
                    throw new Exception("Exception occure at GetPaymentByOrderID()", ex);
                }
            }
            finally
            {
                this.CloseConnection();
            }
            return tempPayment;
        }
Example #5
0
        CPayment ReaderToPayment(IDataReader inReader)
        {
            CPayment tempPayment = new CPayment();

            if (inReader["payment_id"] != null)
            {
                tempPayment.PaymentID = Int64.Parse(inReader["payment_id"].ToString());
            }

            if (inReader["order_id"] != null)
            {
                tempPayment.OrderID = Int64.Parse(inReader["order_id"].ToString());
            }

            if (inReader["pc_id"] != null)
            {
                tempPayment.PcID = int.Parse(inReader["pc_id"].ToString());
            }

            if (inReader["total_amount"] != null)
            {
                tempPayment.TotalAmount =Double.Parse(inReader["total_amount"].ToString());
            }

            if (inReader["cash_amount"] != null)
            {
                tempPayment.CashAmount= Double.Parse(inReader["cash_amount"].ToString());
            }

            if (inReader["eft_amount"] != null)
            {
                tempPayment.EFTAmount= Double.Parse(inReader["eft_amount"].ToString());
            }

            if (inReader["cheque_amount"] != null)
            {
                tempPayment.ChequeAmount = Double.Parse(inReader["cheque_amount"].ToString());
            }

            if (inReader["voucher_amount"] != null)
            {
                tempPayment.VoucherAmount= Double.Parse(inReader["voucher_amount"].ToString());
            }

            if (inReader["service_amount"] != null)
            {
                tempPayment.ServiceAmount = Double.Parse(inReader["service_amount"].ToString());
            }

            if (inReader["discount"] != null)
            {
                tempPayment.Discount = Double.Parse(inReader["discount"].ToString());
            }

            if (inReader["account_pay"] != null)
            {
                tempPayment.AccountPay = Double.Parse(inReader["account_pay"].ToString());
            }

            if (inReader["deposit_id"] != null)
            {
                tempPayment.DepositID = Int64.Parse(inReader["deposit_id"].ToString());
            }

            if (inReader["deposit_amount"] != null)
            {
                tempPayment.DepositAmount= Double.Parse(inReader["deposit_amount"].ToString());
            }

            return tempPayment;
        }
Example #6
0
        //Changed
        public void UpdatePayment(CPayment inPayment)
        {
            try
            {

                this.OpenConnectionWithTransection();
                string sSql = string.Format(SqlQueries.GetQuery(Query.PaymentUpdate),
                    inPayment.OrderID, inPayment.PcID, inPayment.TotalAmount, inPayment.CashAmount,
                    inPayment.EFTAmount, inPayment.ChequeAmount, inPayment.VoucherAmount, inPayment.ServiceAmount,
                    inPayment.Discount, inPayment.AccountPay,inPayment.DepositID,inPayment.DepositAmount, inPayment.PaymentID);

                this.ExecuteNonQuery(sSql);

                sSql = String.Format(SqlQueries.GetQuery(Query.GetOrderIDFromBillPrintTime), inPayment.OrderID);
                IDataReader oReader = this.ExecuteReader(sSql);
                if (oReader != null)
                {
                    bool bIsRead2 = oReader.Read();
                    if (bIsRead2)
                    {
                        oReader.Close();
                        //sSql = String.Format(SqlQueries.GetQuery(Query.UpdateBillPrintTime), inPayment.BillPrintTime, inPayment.PaymentTime, inPayment.OrderID);
                        sSql = String.Format(SqlQueries.GetQuery(Query.UpdateBillPrintTime), inPayment.BillPrintTime.Ticks, inPayment.PaymentTime.Ticks, inPayment.OrderID);
                        this.ExecuteNonQuery(sSql);

                    }
                    else
                    {
                        oReader.Close();
                        //sSql = String.Format(SqlQueries.GetQuery(Query.InsertBillPrintTime), inPayment.OrderID, inPayment.BillPrintTime, inPayment.PaymentTime);
                        sSql = String.Format(SqlQueries.GetQuery(Query.InsertBillPrintTime), inPayment.OrderID, inPayment.BillPrintTime.Ticks, inPayment.PaymentTime.Ticks);
                        this.ExecuteNonQuery(sSql);
                    }

                }

                this.CommitTransection();

            }
            catch (Exception ex)
            {
                Logger.Write("Exception : " + ex + " in UpdatePayment()", LogLevel.Error, "Database");

               // throw new Exception("Exception occure at UpdatePayment()", ex);
                this.RollBackTransection();
            }
            finally
            {
                this.CloseConnection();
            }
        }
Example #7
0
        /// <summary>
        /// Save Drawing Opening logs
        /// </summary>
        /// <param name="terminal_id"></param>
        /// <param name="user_id"></param>
        /// <param name="dateTime"></param>
        /// <returns></returns>
        public CPayment SaveDrawerLogs(Int32 terminal_id, string user_id, Int64 dateTime)
        {
            CPayment tempPayment = new CPayment();
            string sqlCommand = String.Format(SqlQueries.GetQuery(Query.SaveDrawerOpening), user_id, dateTime, terminal_id);
            this.ExecuteNonQuery(sqlCommand);
            sqlCommand = SqlQueries.GetQuery(Query.ScopeIdentity);

            IDataReader oReader = this.ExecuteReader(sqlCommand);

            if (oReader != null)
            {
                bool bIsRead = oReader.Read();
                if (bIsRead)
                {

                    tempPayment.PaymentID = Int64.Parse(oReader[0].ToString());
                }
                oReader.Close();
            }
            return tempPayment;
        }
Example #8
0
        //Changed
        public CPayment InsertPayment(CPayment inPayment)
        {
            CPayment tempPayment = inPayment;
            try
            {
                DateTime dtPayment = DateTime.Now;
                dtPayment = new DateTime(dtPayment.Year, dtPayment.Month, dtPayment.Day, dtPayment.Hour, dtPayment.Minute, 0);
                Int64 dateTime = dtPayment.Ticks;
                CCommonConstants oConstant = ConfigManager.GetConfig<CCommonConstants>();
                CUserInfo objUserInfo = oConstant.UserInfo;

                this.OpenConnectionWithTransection();
                string sSql = string.Format(SqlQueries.GetQuery(Query.PaymentInsert),
                    inPayment.OrderID,inPayment.PcID,inPayment.TotalAmount,inPayment.CashAmount,
                    inPayment.EFTAmount,inPayment.ChequeAmount,inPayment.VoucherAmount, inPayment.ServiceAmount,
                    inPayment.Discount, inPayment.AccountPay, inPayment.DepositID, inPayment.DepositAmount, "'" + objUserInfo.UserName + "'", dateTime);

                this.ExecuteNonQuery(sSql);
                sSql = SqlQueries.GetQuery(Query.ScopeIdentity);

                IDataReader oReader = this.ExecuteReader(sSql);
                if (oReader != null)
                {
                    bool bIsRead = oReader.Read();
                    if (bIsRead)
                    {

                        tempPayment.PaymentID = Int64.Parse(oReader[0].ToString());

                    }
                    oReader.Close();
                }

                sSql = String.Format(SqlQueries.GetQuery(Query.GetOrderIDFromBillPrintTime), inPayment.OrderID);
                oReader = this.ExecuteReader(sSql);
                if (oReader != null)
                {
                    bool bIsRead2 = oReader.Read();
                    if (bIsRead2)
                    {
                        oReader.Close();
                        //sSql = String.Format(SqlQueries.GetQuery(Query.UpdateBillPrintTime), inPayment.BillPrintTime, inPayment.PaymentTime, inPayment.OrderID);
                        sSql = String.Format(SqlQueries.GetQuery(Query.UpdateBillPrintTime), inPayment.BillPrintTime.Ticks, inPayment.PaymentTime.Ticks, inPayment.OrderID);
                        this.ExecuteNonQuery(sSql);

                    }
                    else
                    {
                        oReader.Close();
                        //sSql = String.Format(SqlQueries.GetQuery(Query.InsertBillPrintTime), inPayment.OrderID, inPayment.BillPrintTime, inPayment.PaymentTime);
                        sSql = String.Format(SqlQueries.GetQuery(Query.InsertBillPrintTime), inPayment.OrderID, inPayment.BillPrintTime.Ticks, inPayment.PaymentTime.Ticks);
                        this.ExecuteNonQuery(sSql);
                    }

                }

                this.CommitTransection();

            }
            catch (Exception ex)
            {
                Logger.Write("Exception : " + ex + " in InsertPayment()", LogLevel.Error, "Database");

               // throw new Exception("Exception occure at InsertPayment()", ex);
                this.RollBackTransection();
            }
            finally
            {
                this.CloseConnection();
            }

            return tempPayment;
        }
Example #9
0
        public string UpdatePaymentForDueBill(CPayment aPayment, PaymentDueBill aPaymentDueBill)
        {
            string result = "";
            try
            {
                this.OpenConnection();
                string sSql = string.Format(SqlQueries.GetQuery(Query.UpdatePaymentForDueBill), aPayment.OrderID, aPayment.CashAmount, aPayment.EFTAmount, aPayment.ChequeAmount);
                this.ExecuteNonQuery(sSql);
                result = "Due Bill Payment Successfully";
                int billid = CheckExistsDueBill(aPaymentDueBill);
                if (billid > 0)
                {
                    aPaymentDueBill.BillId = billid;
                    sSql = string.Format(SqlQueries.GetQuery(Query.UpdateTotalDueBillPayment), aPaymentDueBill.BillId, aPaymentDueBill.CashAmount, aPaymentDueBill.CardAmount, aPaymentDueBill.Cheque);
                    this.ExecuteNonQuery(sSql);
                }
                else
                {
                    sSql = string.Format(SqlQueries.GetQuery(Query.InsertTotalDueBillPayment), aPaymentDueBill.CashAmount, aPaymentDueBill.CardAmount, aPaymentDueBill.Cheque, DateTime.Now.Date);
                    this.ExecuteNonQuery(sSql);
                }

            }
            catch (Exception ex)
            {
                result = "Sorry Please Try again";
                Logger.Write("Exception : " + ex + " in UpdatePaymentVatStat()", LogLevel.Error, "Database");

            }
            finally
            {
                this.CloseConnection();
            }

            return result;
        }
Example #10
0
        private void UpdateCalculation(int paymentMethodIndex)
        {
            try
                {
                Double tempTotalPaid = 0.0;

                Debug.WriteLine("UpdateCalc 1");
                tempTotalPaid += Double.Parse(g_CashLabel.Text.Substring(Program.currency.Length)) + Double.Parse(g_EFTLabel.Text.Substring(Program.currency.Length)) + Double.Parse(g_ChequeLabel.Text.Substring(Program.currency.Length))
                     + Double.Parse(g_AccountLabel.Text.Substring(Program.currency.Length)) + Double.Parse(complementorylabel.Text.Substring(Program.currency.Length));

                Debug.WriteLine("UpdateCalc 2");
                Double tempBillTotal = m_dTotalAmount + Convert.ToDouble("0" + g_ServiceChargeLabel.Text.Substring(Program.currency.Length));
                Debug.WriteLine("UpdateCalc 3");
                Double tempDifference = tempBillTotal - tempTotalPaid;
                Debug.WriteLine("UpdateCalc 4");
                if (tempDifference > 0)
                {
                    m_dBalance = tempDifference;
                    g_BalaceLabel.Text = String.Format("Balance Due {0}" + m_dBalance.ToString("F02"), Program.currency);
                    Debug.WriteLine("UpdateCalc 5");
                }
                else
                {
                    if (CurrentPaymentMethod.Equals("Cash"))
                    {
                        if (m_isAddServiceCharge == false)
                        {
                            g_CashLabel.Text = Program.currency + m_dBalance.ToString("F02");
                        }
                    }
                    else if (CurrentPaymentMethod.Equals("EFT"))
                    {
                        if (m_isAddServiceCharge == false)
                        {
                            g_EFTLabel.Text = Program.currency + m_dBalance.ToString("F02");
                        }
                    }
                    else if (CurrentPaymentMethod.Equals("Due"))
                    {
                        if (m_isAddServiceCharge == false)
                        {
                            g_ChequeLabel.Text = Program.currency + m_dBalance.ToString("F02");
                        }
                    }
                    else if (CurrentPaymentMethod.Equals("Voucher"))
                    {
                        if (m_isAddServiceCharge == false)
                        {
                            g_VoucherLabel.Text = Program.currency + m_dBalance.ToString("F02");
                        }
                    }
                    else if (CurrentPaymentMethod.Equals("Account"))
                    {
                        if (m_isAddServiceCharge == false)
                        {
                            g_AccountLabel.Text = Program.currency + m_dBalance.ToString("F02");
                        }
                    }
                    else if (CurrentPaymentMethod.Equals("Discount"))
                    {
                        g_DiscountLabel.Text = Program.currency + m_dBalance.ToString("F02");
                    }
                    else if (CurrentPaymentMethod.Equals("Deposit"))
                    {
                        g_DepositUsedLabel.Text = Program.currency + m_dBalance.ToString("F02");
                    }

                    else if (CurrentPaymentMethod.Equals("Complementory"))
                    {
                        if (m_isAddServiceCharge == false)
                        {
                            complementorylabel.Text = Program.currency + m_dBalance.ToString("F02");
                        }
                    }

                    Debug.WriteLine("UpdateCalc 6");
                    m_dBalance = -tempDifference;

                    g_BalaceLabel.Text = "Pay Back " + Program.currency + (m_dBalance-tipsamount).ToString("F02");

                    Debug.WriteLine("UpdateCalc 7");
                    CPaymentManager tempPaymentManager = new CPaymentManager();

                    /***********************/
                    /********New Print******/
                    /***********************/

                    if (isCheatManuallyhandled())
                    {
                        DialogResult dresult = MessageBox.Show("Make It Open?", "Message", MessageBoxButtons.YesNo);

                        if (dresult == DialogResult.Yes)
                        {
                            makeOpen = true;
                        }
                        if (dresult == DialogResult.No)
                        {
                            makeOpen = false;
                        }
                    }

                    DataSet tempDataSet = new DataSet();
                    tempDataSet.ReadXml("Config/Print_Config.xml");
                    if (tempDataSet.Tables[0].Rows[0]["PrintPaymentBill"].ToString().ToLower().Equals("true"))
                    {
                        Debug.WriteLine("UpdateCalc 17");
                        PrintPaymentBill(paymentMethodIndex);//Payment method index .Cash=1,EFT=2,Cheque=3
                    }

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

              tempOrderDiscount = (COrderDiscount) ooResult.Data;
              itemDiscount = tempOrderDiscount.TotalItemDiscount;
              }

                    //Check whether payment data exists
                    if (m_cPayment == null)
                    {
                        Debug.WriteLine("UpdateCalc 8");
                        ///insert into payment table
                        CPayment tempPayment = new CPayment();
                        tempPayment.OrderID = m_iOrderID;

                        //get pc id from pc ip
                        CPcInfoManager tempPcInfoManager = new CPcInfoManager();
                        IPHostEntry ipEntry = System.Net.Dns.GetHostByName(Dns.GetHostName());

                        CPcInfo tempPcInfo = (CPcInfo)tempPcInfoManager.PcInfoByPcIP(ipEntry.AddressList[0].ToString()).Data;

                        tempPayment.PcID = tempPcInfo.PcID;
                        Debug.WriteLine("UpdateCalc 9");
                        tempPayment.TotalAmount = m_dTotalAmount;
                        tempPayment.CashAmount = Double.Parse(g_CashLabel.Text.Substring(Program.currency.Length));
                        tempPayment.EFTAmount = Double.Parse(g_EFTLabel.Text.Substring(Program.currency.Length));
                        tempPayment.ChequeAmount = Double.Parse(g_ChequeLabel.Text.Substring(Program.currency.Length));
                        tempPayment.ServiceAmount = m_serviceCharge_cash + m_serviceCharge_voucher + m_serviceCharge_eft + m_serviceCharge_cheque + m_serviceCharge_accounts - tipsamount;  //Double.Parse(g_ServiceChargeLabel.Text.Substring(Program.currency.Length));
                        tempPayment.VoucherAmount = Double.Parse(complementorylabel.Text.Substring(Program.currency.Length));
                        tempPayment.Discount = Double.Parse(g_DiscountLabel.Text.Substring(Program.currency.Length));
                        tempPayment.AccountPay = Double.Parse(g_AccountLabel.Text.Substring(Program.currency.Length));
                        tempPayment.DepositID = m_oDeposit.DepositID;
                        tempPayment.DepositAmount = Double.Parse(g_DepositUsedLabel.Text.Substring(Program.currency.Length));
                        tempPayment.PaymentTime = System.DateTime.Now;

                        tempPayment.ServiceChargeCash = m_serviceCharge_cash;
                        tempPayment.ServiceChargeCheque = m_serviceCharge_cheque;
                        tempPayment.ServiceChargeEft = m_serviceCharge_eft;
                        tempPayment.ServiceChargeVoucher = m_serviceCharge_voucher;
                        tempPayment.ServiceChargeAcc = m_serviceCharge_accounts;

                        tempPayment.DueMessage = dueMessage;
                        tempPayment.ComplementoryMessage = complementoryMessage;

                        double totalCost = GetTotalCost(m_iOrderID);
                        tempPayment.TotalCost = totalCost;
                        tempPayment.TipsAmount = tipsamount;

                        tempPayment.VatImposed = Program.vat.ToString();

                        tempPayment.membershipDiscount = (double)membershipdiscount;
                        tempPayment.ItemDiscount = itemDiscount;

                        //tempPayment.VatImposed = Program.vat.ToString();
                        tempPayment.GuestBill = gusetBillStr;
                        COrderWaiterDao orderWaiterDao = new COrderWaiterDao(); // Change by Mithu
                        COrderwaiter orderWaiter = orderWaiterDao.GetOrderwaiterByOrderID(m_iOrderID); // Change by Mithu

                        try
                        {
                            tempPayment.Waiter = orderWaiter.WaiterName;
                        }
                        catch (Exception)
                        {

                        }

                        if (makeOpen)
                            tempPayment.Vat_stat = true;
                        else
                            tempPayment.Vat_stat = false;

                        tempPayment.PaymentPerson = RMSGlobal.LoginUserName;

                        DataSet tempStockDataSet = new DataSet();
                        tempStockDataSet.ReadXml("Config/StockSetting.xml");
                        bool isAllowedToOrder = Convert.ToBoolean(tempStockDataSet.Tables[0].Rows[0]["AllowedtoOrder"].ToString());
                        if (!isAllowedToOrder)
                        {
                            COrderDetailsDAO aDao = new COrderDetailsDAO();
                            List<COrderDetails> aList = new List<COrderDetails>();
                            double cost = 0.0;
                            try
                            {
                                aList = aDao.OrderDetailsGetAll();
                                var check = from list in aList where list.OrderID == tempPayment.OrderID select list;
                                SaleReportDAO aSaleReportDao = new SaleReportDAO();
                                aSaleReportDao.InsertOrUpdateSaleRawmaterialsReport(check);
                            }
                            catch
                            {
                            }

                        }

                        CResult oResult = tempPaymentManager.InsertPayment(tempPayment);
                        if (oResult.IsSuccess && oResult.Data != null)
                        {
                            tempPayment = (CPayment)oResult.Data;
                            m_cPayment = tempPayment;
                            Debug.WriteLine("UpdateCalc 10");
                        }
                    }
                    else
                    {
                        Debug.WriteLine("UpdateCalc 11");
                        //update payment table
                        CPayment tempPayment = new CPayment();
                        tempPayment.PaymentID = m_cPayment.PaymentID;
                        tempPayment.OrderID = m_iOrderID;

                        tempPayment.TotalAmount = m_dTotalAmount;
                        tempPayment.CashAmount = Double.Parse(g_CashLabel.Text.Substring(Program.currency.Length));
                        tempPayment.EFTAmount = Double.Parse(g_EFTLabel.Text.Substring(Program.currency.Length));
                        tempPayment.ChequeAmount = Double.Parse(g_ChequeLabel.Text.Substring(Program.currency.Length));
                        tempPayment.ServiceAmount = m_serviceCharge_cash + m_serviceCharge_voucher + m_serviceCharge_eft + m_serviceCharge_cheque + m_serviceCharge_accounts - tipsamount;  //Double.Parse(g_ServiceChargeLabel.Text.Substring(Program.currency.Length));
                        tempPayment.VoucherAmount = Double.Parse(complementorylabel.Text.Substring(Program.currency.Length));
                        tempPayment.Discount = Double.Parse(g_DiscountLabel.Text.Substring(Program.currency.Length));
                        tempPayment.AccountPay = Double.Parse(g_AccountLabel.Text.Substring(Program.currency.Length));
                        tempPayment.DepositID = m_oDeposit.DepositID;
                        tempPayment.DepositAmount = Double.Parse(g_DepositUsedLabel.Text.Substring(Program.currency.Length));
                        tempPayment.PaymentTime = System.DateTime.Now;

                        tempPayment.ServiceChargeCash = m_serviceCharge_cash;
                        tempPayment.ServiceChargeCheque = m_serviceCharge_cheque;
                        tempPayment.ServiceChargeEft = m_serviceCharge_eft;
                        tempPayment.ServiceChargeVoucher = m_serviceCharge_voucher;
                        tempPayment.ServiceChargeAcc = m_serviceCharge_accounts;
                        tempPayment.VatImposed = Program.vat.ToString();
                        tempPayment.TipsAmount = tipsamount;
                        tempPayment.GuestBill = gusetBillStr;
                        tempPayment.membershipDiscount = (double)membershipdiscount;
                        tempPayment.ItemDiscount = itemDiscount;
                        //tempPayment.DueMessage = dueMessage;
                        //tempPayment.ComplementoryMessage = complementoryMessage;

                        if (isCheatManuallyhandled())
                        {
                            DialogResult dresult = MessageBox.Show("Make It Open?", "Message", MessageBoxButtons.YesNo);

                            if (dresult == DialogResult.Yes)
                            {
                                makeOpen = true;
                            }
                            if (dresult == DialogResult.No)
                            {
                                makeOpen = false;
                            }
                        }

                        if (makeOpen)
                            tempPayment.Vat_stat = true;
                        else
                            tempPayment.Vat_stat = false;
                        tempPayment.PaymentPerson = RMSGlobal.LoginUserName;

                        tempPaymentManager.UpdatePayment(tempPayment);
                        m_cPayment = tempPayment;
                        Debug.WriteLine("UpdateCalc 12");
                    }

                    //Update Deposit
                    CDepositManager tempDepositManager = new CDepositManager();
                    tempDepositManager.UpdateDeposit(m_oDeposit);

                    //opening cash drawer
                    try
                    {
                        CPrintMethods tempPrintMethods = new CPrintMethods();
                        tempPrintMethods.OpenDrawer();

                        #region "Tracking Area"
                        CCommonConstants m_oCommonConstants;
                        //Drawer Opening log
                        DateTime dtPayment = DateTime.Now;
                        dtPayment = new DateTime(dtPayment.Year, dtPayment.Month, dtPayment.Day, dtPayment.Hour, dtPayment.Minute, dtPayment.Second);
                        Int64 dateTime = dtPayment.Ticks;
                        m_oCommonConstants = ConfigManager.GetConfig<CCommonConstants>();
                        CUserInfo objUserInfo = m_oCommonConstants.UserInfo;
                        tempPaymentManager.SaveDrawerLogs(RMSGlobal.Terminal_Id, objUserInfo.UserName, dateTime);
                        #endregion

                        Debug.WriteLine("UpdateCalc 18");
                    }
                    catch (Exception eee)
                    {
                        Debug.WriteLine("UpdateCalc 19");
                        Debug.WriteLine(eee.ToString());
                    }

                    ///Print Payment Bill
                    ///
                    /*  DataSet tempDataSet = new DataSet();
                      tempDataSet.ReadXml("Config/Print_Config.xml");
                      if (tempDataSet.Tables[0].Rows[0]["PrintPaymentBill"].ToString().ToLower().Equals("true"))
                      {
                          Debug.WriteLine("UpdateCalc 17");
                          PrintPaymentBill(paymentMethodIndex);//Payment method index .Cash=1,EFT=2,Cheque=3
                      }
              */

                    COrderManager tempOrderManager = new COrderManager();
                    COrderInfo tempOrderInfo = null;

                    if (m_orderUserName.Replace(" ", "").ToUpper() != "Web User".Replace(" ", "").ToUpper()) //If local orders are processed
                    {
                        tempOrderInfo = (COrderInfo)tempOrderManager.OrderInfoByOrderID(m_iOrderID).Data;
                        tempOrderManager.UpdateOrderInfo(tempOrderInfo);
                        Debug.WriteLine("UpdateCalc 13");
                        tempOrderManager.InsertOrderArchive(tempOrderInfo);
                        Debug.WriteLine("UpdateCalc 14");
                        tempOrderManager.InsertOrderDetailsArchive(tempOrderInfo);
                        Debug.WriteLine("UpdateCalc 15");
                    }
                    else //If online orders are processed
                    {
                        tempOrderInfo = (COrderInfo)tempOrderManager.OrderInfoByOrderID(m_iOrderID).Data;
                        tempOrderManager.InsertOnlineOrderArchive(tempOrderInfo);
                        Debug.WriteLine("Online orders archiving");
                    }

                    tempOrderManager.DeleteTableInfo(tempOrderInfo.TableNumber, m_sTableType);
                    Debug.WriteLine("UpdateCalc 16");

                    //insert voucher
                    tempOrderManager.InsertOrderVoucher(m_oOrderVoucher);

                    ///back to main screen
                    ///

                    CFormManager.Forms.Pop();
                    Form tempForm = CFormManager.Forms.Pop();
                    tempForm.Show();
                    this.Close();
                }
                g_BalaceLabel.ForeColor = Color.Red;
            }
            catch (Exception eee)
            {
                //MessageBox.Show(eee.ToString());
                Debug.WriteLine("UpdateCalc catch");
                Debug.WriteLine(eee.ToString());
            }
        }
Example #11
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 #12
0
        private void duebillPaymentButton_Click(object sender, EventArgs e)
        {
            if (tempSearchOrderInfo.DueBill > 0)
            {

                DueBillPaymentForm aDueBillPaymentForm = new DueBillPaymentForm();
                aDueBillPaymentForm.ShowDialog();

                double amount = 0.0;

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

                string amt = DueBillPaymentForm.inputResult.Substring(Program.currency.Length);

                if (Convert.ToDouble(amt) == 0.00)
                {
                    CMessageBox tempMessageBox = new CMessageBox("Error!", "Price cannot be zero.");
                    tempMessageBox.ShowDialog();
                    return;
                }
                amount = Convert.ToDouble(amt);

                string paymentmethod = "";
                string cardName = "";
                PaymentMethod aPaymentMethod = new PaymentMethod();
                aPaymentMethod.ShowDialog();
                paymentmethod = PaymentMethod.inputResult;

                if (paymentmethod == "Card")
                {
                    EFTOptionForm eFTOptionForm = new EFTOptionForm();

                    DialogResult dr = eFTOptionForm.ShowDialog();

                    if (dr == DialogResult.Cancel)
                        return;

                    saveEFTCardAgainsOrderid(EFTOptionForm.seletedEFTCard);
                }

                PaymentDueBill aPaymentDueBill = new PaymentDueBill();
                CPayment aPayment = new CPayment();
                aPayment.OrderID = orderID;

                double tempamount = 0;
                if (amount - tempSearchOrderInfo.DueBill >= 0)
                {
                    tempamount = tempSearchOrderInfo.DueBill;
                }
                else if (tempSearchOrderInfo.DueBill - amount > 0)
                {
                    tempamount = amount;
                }
                if (paymentmethod == "Cash")
                {
                    aPayment.CashAmount = tempamount;
                    aPayment.EFTAmount = 0;
                    aPaymentDueBill.CashAmount = tempamount;
                }

                else if (paymentmethod == "Card")
                {
                    aPayment.EFTAmount = tempamount;
                    aPayment.CashAmount = 0;
                    aPaymentDueBill.CardAmount = tempamount;

                }
                aPayment.ChequeAmount = tempSearchOrderInfo.DueBill - tempamount;
                aPaymentDueBill.PaymentDate = DateTime.Now;

                CPaymentDAO aPaymentDao = new CPaymentDAO();
                string sr = aPaymentDao.UpdatePaymentForDueBill(aPayment, aPaymentDueBill);
                MessageBox.Show(sr);
                this.Close();
            }
            else
            {
                MessageBox.Show("Due Bill Must be greater than zero");
            }
        }
Example #13
0
        private void g_PrintGuestBillButton_Click(object sender, EventArgs e)
        {
            try
            {
                /*if (m_dtItemList.Rows.Count > 0)
                {
                    //PrintBill(m_dtItemList);
                }*/
                if (m_dtItemList != null)
                {
                    if (m_dtSecondList.Rows.Count > 0)
                    {

                        PrintBill(m_dtSecondList);
                        g_PrintBill2ListBox.Items.Clear();
                        SecondSpiltItems.Clear();
                        return ;
                    }
                }

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

                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);
                }
            }
            catch (Exception exp)
            {
                throw exp;
            }
        }
Example #14
0
        private void g_CashButton_Click(object sender, EventArgs e)
        {
            try
            {
                Double tempTotal = Double.Parse(g_BalanceLabel.Text);
                Double tempInput = Double.Parse(g_InputTextBox.Text.Substring(1));
                if (tempTotal > tempInput)
                {
                    CMessageBox tempMessageBox = new CMessageBox("Error", "Paid Amount less than Balance Amount.");
                    tempMessageBox.ShowDialog();
                    return;
                }

                CPaymentManager tempPaymentManager = new CPaymentManager();

                ///insert into payment table
                CPayment tempPayment = new CPayment();
                tempPayment.OrderID = orderID;

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

                tempPayment.PcID = tempPcInfo.PcID;
                tempPayment.TotalAmount = Double.Parse(g_BalanceLabel.Text);
                tempPayment.CashAmount = tempPayment.TotalAmount;
                tempPayment.PaymentTime = System.DateTime.Now;

                oResult = tempPaymentManager.InsertPayment(tempPayment);
                if (oResult.IsSuccess && oResult.Data != null)
                {
                    tempPayment = (CPayment)oResult.Data;
                }

                ////update order info status
                COrderManager tempOrderManager = new COrderManager();
                COrderInfo tempOrderInfo = (COrderInfo)tempOrderManager.OrderInfoByOrderID(orderID).Data;
                //tempOrderInfo.Status = "Paid";
                //tempOrderManager.UpdateOrderInfo(tempOrderInfo);

                //opening cash drawer
                try
                {
                    CPrintMethods tempPrintMethods = new CPrintMethods();
                    tempPrintMethods.OpenDrawer();
                }
                catch (Exception eee)
                {
                }

                //archiving
                tempOrderManager.InsertOrderArchive(tempOrderInfo);
                tempOrderManager.InsertOrderDetailsArchive(tempOrderInfo);
                tempOrderManager.DeleteTableInfo(tempOrderInfo.TableNumber, "Tabs");
                Reload();
            }
            catch (Exception eee)
            {
            }
        }
Example #15
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 #16
0
        private CPayment ReaderToPayment(IDataReader inReader,bool isExists)
        {
            CPayment tempPayment = new CPayment();

            if (inReader["pc_id"] != null)
            {
                tempPayment.PcID = int.Parse(inReader["pc_id"].ToString());
            }

            if (inReader["userid"] != null)
            {
                tempPayment.UserID = Convert.ToString(inReader["userid"].ToString());
            }

            if (inReader["paymentdate"] != null)
            {
                Int64 dateTime = Convert.ToInt64(inReader["paymentdate"].ToString());
                tempPayment.PaymentTime = new DateTime(dateTime);// Convert.ToDateTime(dateTime);
            }

            if (inReader["total_amount"] != null)
            {
                tempPayment.TotalAmount = Double.Parse(inReader["total_amount"].ToString());
            }
            return tempPayment;
        }
Example #17
0
        public CPayment SaveDrawerLogs(Int32 terminal_id,string user_id,Int64 dateTime)
        {
            CPayment tempPayment = new CPayment();
            try
            {
                tempPayment = Database.Instance.Payment.SaveDrawerLogs(terminal_id,user_id,dateTime);
                m_oResult.IsSuccess = true;
                m_oResult.Message = "Data Read Successfully";

            }
            catch (Exception ex)
            {
                System.Console.WriteLine("Exception occuer at GetPaymentByOrderID() : " + ex.Message);
                Logger.Write("Exception : " + ex + " in GetPaymentByOrderID()", LogLevel.Error, "COrderManager");
            }
            return tempPayment;
        }
Example #18
0
 public CResult GetPaymentLogDetails(Int64 startTime, Int64 endTime)
 {
     CResult tempcResult = new CResult();
     List<CPayment> paymentdetails = new List<CPayment>();
     string sqlCommand = String.Format(SqlQueries.GetQuery(Query.LogRegisterForPayment), startTime,endTime);
     IDataReader oReader = this.ExecuteReader(sqlCommand);
     if (oReader != null)
     {
         while (oReader.Read())
         {
             CPayment tempPayment = new CPayment();
             tempPayment = ReaderToPayment(oReader,true);
             paymentdetails.Add(tempPayment);
         }
     }
     tempcResult.Data = paymentdetails;
     return tempcResult;
 }
Example #19
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 #20
0
        public CResult InsertBillPrintTime(CPayment inPayment)
        {
            CPayment tempPayment = new CPayment();
            try
            {
                Database.Instance.Payment.InsertBillPrintTime(inPayment);
                m_oResult.IsSuccess = true;
                m_oResult.Message = "Data Inserted Successfully";

            }
            catch (Exception ex)
            {
                System.Console.WriteLine("Exception occuer at InsertBillPrintTime() : " + ex.Message);
                m_oResult.IsException = true;
                m_oResult.Action = EERRORNAME.EXCEPTION_OCCURE;
                //m_oResult.SetParams(ex.Message);

                m_oResult.Message = ex.Message;
                Logger.Write("Exception : " + ex + " in InsertBillPrintTime()", LogLevel.Error, "CPaymentManager");
            }
            return m_oResult;
        }
Example #21
0
        public double GetSortedPayment(DateTime inTime)
        {
            double MaxAmount = 0.0;
            GetTimeSpan(inTime);
            try
            {
                this.OpenConnection();

                string sSql = string.Format(SqlQueries.GetQuery(Query.GetSortedPayment),m_oStartTime,m_oEndTime);

                IDataReader oReader = this.ExecuteReader(sSql);

                CPayment tempPayment = new CPayment();
                if (oReader != null)
                {
                    while (oReader.Read())
                    {
                        Double.TryParse(oReader.GetValue(0).ToString(), out MaxAmount);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.Write("###" + ex + "###");
                Logger.Write("Exception : " + ex + " in GetSortedPayment()", LogLevel.Error, "Database");
                if (ex.GetType().Equals(typeof(SqlException)))
                {
                    SqlException oSQLEx = ex as SqlException;
                    if (oSQLEx.Number != 7619)
                        throw new Exception("Exception occure at GetSortedPayment()", ex);
                }
                else
                {
                    throw new Exception("Exception occure at GetPaymentByOrderID()", ex);
                }
            }
            finally
            {
                this.CloseConnection();
            }
            return MaxAmount;
        }
Example #22
0
        //Changed
        public void InsertBillPrintTime(CPayment inPayment)
        {
            try
            {

                this.OpenConnection();
                //string sSql = String.Format(SqlQueries.GetQuery(Query.InsertBillPrintTime), inPayment.OrderID, inPayment.BillPrintTime, inPayment.PaymentTime);
                string sSql = String.Format(SqlQueries.GetQuery(Query.InsertBillPrintTime), inPayment.OrderID, inPayment.BillPrintTime.Ticks, inPayment.PaymentTime.Ticks);
                this.ExecuteNonQuery(sSql);

            }
            catch (Exception ex)
            {
                Logger.Write("Exception : " + ex + " in InsertBillPrintTime()", LogLevel.Error, "Database");

                throw new Exception("Exception occure at InsertBillPrintTime()", ex);

            }
            finally
            {
                this.CloseConnection();
            }
        }
Example #23
0
        /// <summary>
        /// Collecting the printed copy of the respective order .added by Baruri at 13.12.2008
        /// </summary>
        private void GetPrintedCopy(Int64 orderID, List<COrderDetails> tempOrderDetailsList)
        {
            string Cat1ID = String.Empty;

            try
            {
                CPrintMethods tempPrintMethods = new CPrintMethods();
                int categoryID = 0;

                string serialHeader = "IBACS RMS";
                string serialFooter = "Please Come Again";
                string serialBody = "";
                CSerialPrintContent tempSerialPrintContent = new CSerialPrintContent();
                serialBody = "               KITCHEN COPY\r\n";

                COrderManager tempOrderManager = new COrderManager();
                COrderInfo tempOrderInfo = (COrderInfo)tempOrderManager.OrderInfoByOrderID(orderID).Data;//order information for online orders

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

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

                    serialBody += "\r\nType: " + tempOrderInfo.Status;

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

                    serialBody += "\r\nCustomer Name: " + tempCustomerInfo.CustomerName;
                    serialBody += "\r\nPhone: " + tempCustomerInfo.CustomerPhone;

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

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

                        serialBody += "\r\nFloor or Apartment:" + tempCustomerInfo.FloorAptNumber;

                        serialBody += "\r\nBuilding Name:" + tempCustomerInfo.BuildingName;

                        serialBody += "\r\nHouse Number:" + tempCustomerInfo.HouseNumber;

                        serialBody += "\r\nPhone:" + tempCustomerInfo.CustomerPhone;

                        serialBody += "\r\nPostal Code:" + tempCustomerInfo.CustomerPostalCode;

                        serialBody += "\r\nTown:" + tempCustomerInfo.CustomerTown;

                        serialBody += "\r\nCountry:" + tempCustomerInfo.CustomerCountry;

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

                serialBody += "\r\nOrder Information";

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

                serialBody += "\r\nQty Item                         Price  ";

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

                if (tempOrderDetailsList.Count > 0)
                {
                    for (int counter = 0; counter < tempOrderDetailsList.Count; counter++)
                    {
                        serialBody += "\r\n" + tempOrderDetailsList[counter].OrderQuantity.ToString() + "  ";
                        serialBody += CPrintMethods.GetFixedString(tempOrderDetailsList[counter].ItemName.ToString(), 30)+" ";
                        serialBody += CPrintMethods.RightAlign(tempOrderDetailsList[counter].OrderAmount.ToString(), 6);
                       // billTotal += Convert.ToDouble("0" + tempOrderDetailsList[j].OrderAmount);
                    }
                 }

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

                //serialBody += "\r\n                      Order Total: " + billTotal.ToString("F02");

                //serialBody += "\r\n                    Total Payable: " + billTotal.ToString("F02");

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

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

                //serialBody += "\r\nDeveloped by:ibacs limited.";

                serialBody += "\r\nThis is an online order.";
                serialBody += "\r\n           [END]        ";

                CCommonConstants oConstant = ConfigManager.GetConfig<CCommonConstants>();

                CPrintingFormat tempPrintingFormat = new CPrintingFormat();
                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);

                ///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);
                }
            }
            catch (Exception exp)
            {

            }
        }