Exemple #1
0
        public static HG_OrderItem PaybleAmt(Int64 OID)
        {
            HG_OrderItem objOrdItm = new HG_OrderItem();
            var          OrderItms = new HG_OrderItem().GetAll(OID);

            for (int i = 0; i < OrderItms.Count; i++)
            {
                objOrdItm.CostPrice += OrderItms[i].Count * OrderItms[i].CostPrice;
                objOrdItm.TaxInItm  += OrgType.TotalTax(OrderItms[i].CostPrice, OrderItms[i].TaxInItm, OrderItms[i].Count);
                objOrdItm.Price     += OrderItms[i].Count * OrderItms[i].Price;
            }
            return(objOrdItm);
        }
Exemple #2
0
        public static HG_OrderItem ActualAmtToPay(Int64 OID)
        {
            HG_OrderItem objOrdItm = new HG_OrderItem();
            var          OrderItms = new HG_OrderItem().GetAll(OID);

            OrderItms = OrderItms.FindAll(x => x.Status != 4);
            for (int i = 0; i < OrderItms.Count; i++)
            {
                objOrdItm.CostPrice += OrderItms[i].Count * OrderItms[i].CostPrice;
                objOrdItm.TaxInItm  += OrgType.TotalTax(OrderItms[i].CostPrice, OrderItms[i].TaxInItm, OrderItms[i].Count);
                objOrdItm.Price     += OrderItms[i].Count * OrderItms[i].Price;
            }
            return(objOrdItm);
        }
Exemple #3
0
        public List <HG_OrderItem> GetAll(Int64 OID = 0)
        {
            var CurrOrgID = HttpContext.Current.Request.Cookies["UserInfo"];

            System.Data.SqlClient.SqlCommand    cmd = null;
            System.Data.SqlClient.SqlDataReader SDR = null;
            List <HG_OrderItem> ListTmp             = new List <HG_OrderItem>();
            DBCon Obj = new DBCon();

            try
            {
                string Query = "SELECT * FROM HG_ORDERITEM";
                if (OID > 0)
                {
                    Query = "SELECT * FROM HG_ORDERITEM WHERE OID=" + OID.ToString() + " and Deleted=0 ";
                }
                else if (int.Parse(CurrOrgID["OrgId"]) > 0)
                {
                    Query = "SELECT * FROM HG_ORDERITEM WHERE OrgId=" + CurrOrgID["OrgId"] + " and Deleted=0 ";
                }
                cmd = new System.Data.SqlClient.SqlCommand(Query, Obj.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    HG_OrderItem ObjTmp = new HG_OrderItem();
                    ObjTmp.OIID         = SDR.GetInt64(0);
                    ObjTmp.FID          = SDR.GetInt64(1);
                    ObjTmp.Price        = SDR.GetDouble(2);
                    ObjTmp.Count        = SDR.GetInt32(3);
                    ObjTmp.IsAddon      = SDR.GetString(4);
                    ObjTmp.OID          = SDR.GetInt64(5);
                    ObjTmp.Status       = SDR.GetInt32(7);
                    ObjTmp.OrderDate    = SDR.GetDateTime(8);
                    ObjTmp.UpdatedBy    = SDR.GetInt32(9);
                    ObjTmp.UpdationDate = SDR.GetDateTime(10);
                    ObjTmp.TickedNo     = SDR.GetInt32(11);
                    ObjTmp.ChefSeenBy   = SDR.GetInt32(12);
                    ObjTmp.OrgId        = SDR.GetInt32(13);
                    ObjTmp.OrdById      = SDR.GetInt64(14);
                    ObjTmp.TaxInItm     = SDR.GetDouble(15);
                    ObjTmp.CostPrice    = SDR.GetDouble(16);
                    ListTmp.Add(ObjTmp);
                }
            }
            catch (System.Exception e) { e.ToString(); }
            finally { cmd.Dispose(); SDR.Close(); Obj.Con.Close(); Obj.Con.Dispose(); Obj.Con = null; }
            return(ListTmp);
        }
Exemple #4
0
        public int DeleteOrderAndOrderItem(System.Int64 OID, bool DeleteOItem)
        {
            HG_Orders Order = new HG_Orders().GetOne(OID);

            if (Order != null)
            {
                Order.Deleted = true;
                Order.Save();
            }
            if (DeleteOItem)
            {
                List <HG_OrderItem> list = new HG_OrderItem().GetAll(OID);
                foreach (var obj in list)
                {
                    obj.Deleted = true;
                    obj.Save();
                }
            }
            return(0);
        }
Exemple #5
0
        public HG_OrderItem GetOne(Int64 OIID = 0)
        {
            System.Data.SqlClient.SqlCommand    cmd = null;
            System.Data.SqlClient.SqlDataReader SDR = null;
            HG_OrderItem ObjTmp = new HG_OrderItem();
            DBCon        Obj    = new DBCon();

            try
            {
                string Query = "SELECT * FROM HG_ORDERITEM WHERE OIID=" + OIID.ToString() + " and Deleted=0 ";
                //if (TicketNo > 0)
                //{
                //    Query = "SELECT * FROM HG_ORDERITEM WHERE TickedNo=" + TicketNo.ToString() + " and Deleted=0 ";
                //}
                cmd = new System.Data.SqlClient.SqlCommand(Query, Obj.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    ObjTmp              = new HG_OrderItem();
                    ObjTmp.OIID         = SDR.GetInt64(0);
                    ObjTmp.FID          = SDR.GetInt64(1);
                    ObjTmp.Price        = SDR.GetDouble(2);
                    ObjTmp.Count        = SDR.GetInt32(3);
                    ObjTmp.IsAddon      = SDR.GetString(4);
                    ObjTmp.OID          = SDR.GetInt64(5);
                    ObjTmp.Status       = SDR.GetInt32(7);
                    ObjTmp.OrderDate    = SDR.GetDateTime(8);
                    ObjTmp.UpdatedBy    = SDR.GetInt32(9);
                    ObjTmp.UpdationDate = SDR.GetDateTime(10);
                    ObjTmp.TickedNo     = SDR.GetInt32(11);
                    ObjTmp.ChefSeenBy   = SDR.GetInt32(12);
                    ObjTmp.OrgId        = SDR.GetInt32(13);
                    ObjTmp.OrdById      = SDR.GetInt64(14);
                    ObjTmp.TaxInItm     = SDR.GetDouble(15);
                    ObjTmp.CostPrice    = SDR.GetDouble(16);
                }
            }
            catch (Exception e) { e.ToString(); }
            finally { cmd.Dispose(); SDR.Close(); Obj.Con.Close(); Obj.Con.Dispose(); Obj.Con = null; }
            return(ObjTmp);
        }
Exemple #6
0
        public static int UnseenOrd(int OrgId)
        {
            string Query = "SELECT distinct TickedNo,OID FROM HG_OrderItem WHERE  (Status=1 or Status=2) and OID In(select OID from HG_Orders where  Status='1' ";
            int    Count = 0;
            HG_OrganizationDetails ObjOrg = new HG_OrganizationDetails().GetOne(OrgId);

            if (OrgId == 0 || (ObjOrg.OrgID > 0 && ObjOrg.PaymentType == 1))
            {
                Query = "SELECT distinct TickedNo,OID FROM HG_OrderItem WHERE  (Status=1 or Status=2) and OID In(select OID from HG_Orders where  Status='1' and PaymentStatus!= 0 ";
            }
            if (OrgId > 0)
            {
                Query += "and OrgId=" + OrgId.ToString() + " )";
            }
            else
            {
                Query += ")";
            }

            System.Data.SqlClient.SqlCommand    cmd = null;
            System.Data.SqlClient.SqlDataReader SDR = null;
            HG_OrderItem ObjTmp = new HG_OrderItem();
            DBCon        Obj    = new DBCon();

            try
            {
                cmd = new System.Data.SqlClient.SqlCommand(Query, Obj.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    Count = Count + 1;
                }
            }
            catch (System.Exception e) { e.ToString(); }
            finally { cmd.Dispose(); SDR.Close(); Obj.Con.Close(); Obj.Con.Dispose(); Obj.Con = null; }
            return(Count);
        }
Exemple #7
0
        public List <HG_OrderItem> GetAllByOrg(int OrgId, int ChefId = 0, int ItemStatus = 0, bool TodayOnly = false, string Status = null)
        {
            System.Data.SqlClient.SqlCommand    cmd = null;
            System.Data.SqlClient.SqlDataReader SDR = null;
            List <HG_OrderItem> ListTmp             = new List <HG_OrderItem>();
            DBCon Obj = new DBCon();

            try
            {
                string Query = "";
                if (OrgId > 0)
                {
                    Query = "SELECT * FROM HG_ORDERITEM WHERE OrgId=" + OrgId.ToString() + "";
                }
                else if (OrgId <= 0)//super admin && postpaid-admin
                {
                    Query = "SELECT * FROM HG_ORDERITEM WHERE OrgId>0";
                }
                if (ChefId > 0)
                {
                    Query += " and (ChefSeenBy=" + ChefId.ToString() + " or ChefSeenBy=0)";
                }
                if (ItemStatus > 0)
                {
                    Query += " and Status=" + ItemStatus.ToString();
                }
                if (TodayOnly)
                {
                    var Formdate = DateTime.Now;
                    var theDate  = new DateTime(Formdate.Year, Formdate.Month, Formdate.Day, 23, 59, 00);
                    Query = "SELECT * FROM HG_ORDERITEM WHERE OrderDate between '" + Formdate.ToString("MM/dd/yyyy") + "' and '" + theDate.ToString("MM/dd/yyyy HH:mm:ss") + "' and OrgId=" + OrgId.ToString() + "";
                }
                if (Status != null && ItemStatus == 0)
                {
                    Query += " and " + Status;
                }
                cmd = new System.Data.SqlClient.SqlCommand(Query, Obj.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    HG_OrderItem ObjTmp = new HG_OrderItem();
                    ObjTmp.OIID         = SDR.GetInt64(0);
                    ObjTmp.FID          = SDR.GetInt64(1);
                    ObjTmp.Price        = SDR.GetDouble(2);
                    ObjTmp.Count        = SDR.GetInt32(3);
                    ObjTmp.IsAddon      = SDR.GetString(4);
                    ObjTmp.OID          = SDR.GetInt64(5);
                    ObjTmp.Status       = SDR.GetInt32(7);
                    ObjTmp.OrderDate    = SDR.GetDateTime(8);
                    ObjTmp.UpdatedBy    = SDR.GetInt32(9);
                    ObjTmp.UpdationDate = SDR.GetDateTime(10);
                    ObjTmp.TickedNo     = SDR.GetInt32(11);
                    ObjTmp.ChefSeenBy   = SDR.GetInt32(12);
                    ObjTmp.OrgId        = SDR.GetInt32(13);
                    ObjTmp.OrdById      = SDR.GetInt64(14);
                    ObjTmp.TaxInItm     = SDR.GetDouble(15);
                    ObjTmp.CostPrice    = SDR.GetDouble(16);
                    ListTmp.Add(ObjTmp);
                }
            }
            catch (Exception e) { e.ToString(); }
            finally { cmd.Dispose(); SDR.Close(); Obj.Con.Close(); Obj.Con.Dispose(); Obj.Con = null; }
            return(ListTmp);
        }