コード例 #1
0
        public JsonResult AddCurrentYearGoals(string foodCost, string laborCost, string salesIncrease, string auv,
            string unitFootlongSales, string fsPercent, string drinkCount, string checkItem, string checkIndex,
            string customerCount, string customerCountIndex, string unit, string ui, string productivity, string factor)
        {
            GoalsModel goalsModel = new GoalsModel();

            double fCost = ValidationUtility.ToDouble(foodCost);
            double lCost = ValidationUtility.ToDouble(laborCost);

            double foodLaborCost = fCost + lCost;
               // ArrayList storeList = ValidationUtility.GetStoreList(false);

            ArrayList storeList = ValidationUtility.GetActiveStoreList(false);

            ResponseDTO responseDTO = null;

            foreach (StoreDTO StoreDTO in storeList)
            {
                GoalsDTO goalsDTO = new GoalsDTO();

                goalsDTO.StoreId = StoreDTO.Id;
                goalsDTO.Year = DateTime.Now.Year;
                goalsDTO.FoodCost = fCost;
                goalsDTO.LaborCost = lCost;
                goalsDTO.FoodLaborCost = foodLaborCost;
                goalsDTO.SalesIncrease = ValidationUtility.ToDouble(salesIncrease);
                goalsDTO.Auv = ValidationUtility.ToDouble(auv);
                goalsDTO.UnitFootlongSales = ValidationUtility.ToDouble(unitFootlongSales);
                goalsDTO.FsPercent = ValidationUtility.ToDouble(fsPercent);
                goalsDTO.DrinkCount = ValidationUtility.ToDouble(drinkCount);
                goalsDTO.CheckItem = ValidationUtility.ToDouble(checkItem);
                goalsDTO.CheckIndex = ValidationUtility.ToDouble(checkIndex);
                goalsDTO.CustomerCount = ValidationUtility.ToDouble(customerCount);
                goalsDTO.CustomerCountIndex = ValidationUtility.ToDouble(customerCountIndex);
                goalsDTO.Unit = ValidationUtility.ToDouble(unit);
                goalsDTO.Ui = ValidationUtility.ToDouble(ui);
                goalsDTO.Productivity = ValidationUtility.ToDouble(productivity);
                goalsDTO.Factor = ValidationUtility.ToDouble(factor);

                if (!goalsModel.IsCurrentYearGoalsExist(StoreDTO.Id, DateTime.Now.Year))
                {
                    // goalsModel.AddPreviousYearAchiveGoals(goalsDTO);
                    goalsModel.AddGoals(goalsDTO);
                    goalsModel.AddCurrentYearYTDGoals(goalsDTO);
                    goalsModel.AddPreviousYearAchiveGoals(goalsDTO);

                    responseDTO = new ResponseDTO { Error = "Success", Message = "Add Successfully" };

                }
                else
                {
                    responseDTO = new ResponseDTO { Error = "Error", Message = "Records Allready Exists Now you can Update Only" };
                }

            }

            return Json(responseDTO, JsonRequestBehavior.AllowGet);
        }
コード例 #2
0
        public JsonResult GetManagerWeeklyInfo(string selectedDate)
        {
            List<ArrayList> weeklyInfoList = new List<ArrayList>();
            DateTime formatedDate;
            if (!ValidationUtility.IsNull(selectedDate))
            {
                formatedDate = ValidationUtility.ToDate(selectedDate);
            }
            else
            {
                formatedDate = DateTime.Now;
            }

            //   AddPreviousYearInfoModel previouseYear = new AddPreviousYearInfoModel();
            GoalsModel goalsModel = new GoalsModel();
            ManagerWeeklyInfoModel managerWeeklyInfoModel = new ManagerWeeklyInfoModel();
            UserContext cont = (UserContext)Session["UserContext"];
            if (!ValidationUtility.IsNull(cont))
            {
               // int sId = ValidationUtility.GetStoredId(cont.Id);

                int sId = ValidationUtility.GetActiveStoredId(cont.Id);

                ArrayList storeList = ValidationUtility.GetStoreList(true);

                ArrayList goalStoreList = new ArrayList();

                foreach (StoreDTO storDTO in storeList)
                {
                    if (storDTO.Id == sId)
                    {
                        goalStoreList.Add(storDTO);
                        break;
                    }
                }

                DateTime actualWeekStartDate = ValidationUtility.GetActualWeekStartDate(formatedDate);

                if (!goalsModel.IsGoalsYTDCurrentYearRecordExist(actualWeekStartDate, goalStoreList))
                {
                    ArrayList currentYTDList = goalsModel.GetCurrentWeekGoalsYTD(actualWeekStartDate, goalStoreList);
                    goalsModel.AddGoalYTD(currentYTDList);
                }
                else if (ValidationUtility.GetActualWeekStartDate(DateTime.Now).Date.Equals(actualWeekStartDate.Date))
                {
                    ArrayList currentYTDList = goalsModel.GetCurrentWeekGoalsYTD(actualWeekStartDate, goalStoreList);
                    goalsModel.UpdateCurrentYTD(currentYTDList);
                }

                weeklyInfoList.Add(managerWeeklyInfoModel.GetWeeklyInfo(goalStoreList, actualWeekStartDate));

                weeklyInfoList.Add(managerWeeklyInfoModel.GetManagerMonthlyInfo(goalStoreList, actualWeekStartDate));

            }
            return Json(weeklyInfoList, JsonRequestBehavior.AllowGet);
        }
コード例 #3
0
        public JsonResult UpdateCurrentYearGoals(string tId, string sId, string foodCost, string laborCost, string salesIncrease, string auv,
            string unitFootlongSales, string fsPercent, string drinkCount, string checkItem, string checkIndex,
            string customerCount, string customerCountIndex, string unit, string ui, string productivity, string factor)
        {
            GoalsModel goalsModel = new GoalsModel();

            double fCost = ValidationUtility.ToDouble(foodCost);
            double lCost = ValidationUtility.ToDouble(laborCost);

            double foodLaborCost = fCost + lCost;
            GoalsDTO goalsDTO = new GoalsDTO();

            goalsDTO.Id = ValidationUtility.ToInteger(tId);
            goalsDTO.StoreId = ValidationUtility.ToInteger(sId);
            goalsDTO.FoodCost = fCost;
            goalsDTO.LaborCost = lCost;
            goalsDTO.FoodLaborCost = foodLaborCost;
            goalsDTO.SalesIncrease = ValidationUtility.ToDouble(salesIncrease);
            goalsDTO.Auv = ValidationUtility.ToDouble(auv);
            goalsDTO.UnitFootlongSales = ValidationUtility.ToDouble(unitFootlongSales);
            goalsDTO.FsPercent = ValidationUtility.ToDouble(fsPercent);
            goalsDTO.DrinkCount = ValidationUtility.ToDouble(drinkCount);
            goalsDTO.CheckItem = ValidationUtility.ToDouble(checkItem);
            goalsDTO.CheckIndex = ValidationUtility.ToDouble(checkIndex);
            goalsDTO.CustomerCount = ValidationUtility.ToDouble(customerCount);
            goalsDTO.CustomerCountIndex = ValidationUtility.ToDouble(customerCountIndex);
            goalsDTO.Unit = ValidationUtility.ToDouble(unit);
            goalsDTO.Ui = ValidationUtility.ToDouble(ui);
            goalsDTO.Productivity = ValidationUtility.ToDouble(productivity);
            goalsDTO.Factor = ValidationUtility.ToDouble(factor);

            goalsModel.UpdateGoals(goalsDTO);

            ResponseDTO responseDTO = new ResponseDTO { Error = "Success", Message = "Add Successfully" };

            return Json(responseDTO, JsonRequestBehavior.AllowGet);
        }
コード例 #4
0
        public ArrayList GetstoreGoalList(int storeId)
        {
            ArrayList goalList = new ArrayList();

            WeeklyPaperworkModel weekPaperModel = new WeeklyPaperworkModel();

            //  int storeId = ValidationUtility.ToInteger(sId);

            AddPreviousYearInfoModel previouseYear = new AddPreviousYearInfoModel();
            GoalsModel goalsModel = new GoalsModel();

             //   ArrayList storeList = ValidationUtility.GetStoreList(true);

            ArrayList storeList = ValidationUtility.GetActiveStoreList(true);

            ArrayList goalStoreList = new ArrayList();

            foreach (StoreDTO storDTO in storeList)
            {
                if (storDTO.Id == storeId)
                {
                    goalStoreList.Add(storDTO);
                    break;
                }
            }

            DateTime previousYearWeekStartDate = ValidationUtility.YearWeekStartDate(new DateTime(DateTime.Now.AddYears(-1).Year, 1, 1));

            DateTime currentYearWeekStartDate = ValidationUtility.YearWeekStartDate(new DateTime(DateTime.Now.Year, 1, 1));

            if (!weekPaperModel.IsAllWeeklyPaperYearWeekRecordExsist(goalStoreList, DateTime.Now))
            {
                previouseYear.AddLastYearWeeklyPaperwork(new DateTime(DateTime.Now.AddYears(-1).Year, 1, 1), goalStoreList);
            }

            if (!goalsModel.IsAllYearWeekRecordExsist(goalStoreList, DateTime.Now))
            {
                goalsModel.AddPreviousYearYTD(previousYearWeekStartDate, goalStoreList);
            }

            goalsModel.AddCurrentYearYTD(new DateTime(DateTime.Now.Year, 1, 1), goalStoreList);

            ArrayList currentYTDList = goalsModel.GetCurrentWeekGoalsYTD(DateTime.Now, goalStoreList);
            goalsModel.UpdateCurrentYTD(currentYTDList);

            GoalYTDDTO previousYearYtd = goalsModel.GetPreviousGoalYTDList(storeId, currentYearWeekStartDate);

            goalList.Add(previousYearYtd);

            goalList.Add(goalsModel.GetCurrentYearGoalsList(storeId, DateTime.Now.Year));

            goalList.Add(goalsModel.GetCurrrentYTDList(storeId, currentYearWeekStartDate, previousYearYtd));

            goalList.Add(goalsModel.GetPreviousYTDList(storeId, previousYearWeekStartDate));

            //if (!goalsModel.IsCurrentYearGoalsExist(storeId, DateTime.Now.AddYears(-1).Year))
            //{

            //    ArrayList PreviousYearDataList = previouseYear.GetControlSheetDataOfYear(new DateTime(DateTime.Now.AddYears(-1).Year, 1, 1), goalStoreList);

            //    goalsModel.AddControlSheetData(PreviousYearDataList, storeId, new DateTime(DateTime.Now.AddYears(-2).Year, 1, 1));
            //}

            //if (!goalsModel.IsGoalsYTDPreviousYearRecordExist(previousYearWeekStartDate, goalStoreList))
            //{
            //    goalsModel.AddPreviousYearYTD(previousYearWeekStartDate, goalStoreList);
            //}

            //DateTime currentYearWeekStartDate = ValidationUtility.YearWeekStartDate(new DateTime(DateTime.Now.Year, 1, 1));

            //if (!goalsModel.IsGoalsYTDCurrentYearRecordExist(currentYearWeekStartDate, goalStoreList))
            //{
            //    goalsModel.AddCurrentYearYTD(new DateTime(DateTime.Now.Year, 1, 1), goalStoreList);

            //}
            //else
            //{
            //    ArrayList currentYTDList = goalsModel.GetCurrentWeekGoalsYTD(currentYearWeekStartDate, goalStoreList);
            //    goalsModel.UpdateCurrentYTD(currentYTDList);
            //}
            //DateTime everyWeekStarDate = currentYearWeekStartDate;

            //bool isWeekExsist = false;

            //while (!isWeekExsist)
            //{
            //    everyWeekStarDate = everyWeekStarDate.AddDays(7);

            //    DateTime currenWeekStartDate = ValidationUtility.GetActualWeekStartDate(DateTime.Now);

            //    if (!goalsModel.IsGoalsYTDCurrentYearRecordExist(everyWeekStarDate, goalStoreList))
            //    {
            //        ArrayList currentYTDList = goalsModel.GetCurrentWeekGoalsYTD(everyWeekStarDate, goalStoreList);
            //        goalsModel.AddGoalYTD(currentYTDList);
            //    }

            //    if (currenWeekStartDate.Date.Equals(everyWeekStarDate.Date))
            //    {
            //        isWeekExsist = true;
            //        ArrayList currentYTDList = goalsModel.GetCurrentWeekGoalsYTD(everyWeekStarDate, goalStoreList);
            //        goalsModel.UpdateCurrentYTD(currentYTDList);
            //    }

            //}

            //DateTime currenWeekStartDate = ValidationUtility.GetActualWeekStartDate(DateTime.Now);

            //ArrayList currentYTDList = goalsModel.GetCurrentWeekGoalsYTD(currenWeekStartDate, goalStoreList);

            //if (!goalsModel.IsGoalsYTDCurrentYearRecordExist(currenWeekStartDate, goalStoreList))
            //{
            //    goalsModel.AddGoalYTD(currentYTDList);
            //}
            //else
            //{
            //    goalsModel.UpdateCurrentYTD(currentYTDList);
            //}

            //  ArrayList goalList = goalsModel.GetAllGoalsList(storeId);

            //goalList.Add(goalsModel.GetAllGoalsList(storeId));

            ////Get CurrentYearYTD
            //goalList.Add(goalsModel.GetCurrrentYTDList(storeId, currentYearWeekStartDate));

            ////GetPreviousYear YTD
            //goalList.Add(goalsModel.GetPreviousYTDList(storeId, previousYearWeekStartDate));

            //  return Json(goalList, JsonRequestBehavior.AllowGet);

            return goalList;
        }
コード例 #5
0
        public JsonResult GetGoalsList(string sId)
        {
            int storeId = ValidationUtility.ToInteger(sId);

            UserContext cont = (UserContext)Session["UserContext"];

            if (!ValidationUtility.IsNull(cont) && ValidationUtility.IsEqual(cont.Role, "Manager"))
            {
                storeId = ValidationUtility.GetActiveStoredId(cont.Id);
            }

            if (storeId == 0)
            {

                ArrayList storeList = null;

                if (!ValidationUtility.IsNull(cont) && ValidationUtility.IsEqual(cont.Role, "Admin"))
                {
                    storeList = ValidationUtility.GetActiveStoreList(true);
                }

                if (!ValidationUtility.IsNull(cont) && ValidationUtility.IsEqual(cont.Role, "Corporate"))
                {
                    storeList = ValidationUtility.GetCorporateUserAssignActiveStore(cont.Id, true);
                }

                if (!ValidationUtility.IsNull(cont) && ValidationUtility.IsEqual(cont.Role, "GeneralManager"))
                {
                    storeList = ValidationUtility.GetGeneralManagerAssignActiveStore(cont.Id);
                }
                if (!ValidationUtility.IsNull(cont) && ValidationUtility.IsEqual(cont.Role, "AreaManager"))
                {
                    storeList = ValidationUtility.GetAreaMngAssignActiveStore(cont.Id);
                }

                ArrayList averageList = new ArrayList();

                if (!ValidationUtility.IsNull(storeList) && storeList.Count > 0)
                {
                    GoalsModel goalsModel = new GoalsModel();

                    ArrayList achiveGoalDTOList = new ArrayList();

                    ArrayList currentGoalsDTOList = new ArrayList();

                    ArrayList currentYTDDTOList = new ArrayList();

                    ArrayList PrviousYTDDTOList = new ArrayList();

                    foreach (StoreDTO storeDTO in storeList)
                    {
                        ArrayList allList = GetstoreGoalList(storeDTO.Id);

                        GoalYTDDTO goalYTDDTO = (GoalYTDDTO)allList[0];
                        achiveGoalDTOList.Add(goalYTDDTO);
                        GoalsDTO currnetGoalDTO = (GoalsDTO)allList[1];
                        // Current Year Goal may be null because if user not insert his goal then it will be blank
                        if (ValidationUtility.IsNull(currnetGoalDTO))
                        {
                            currnetGoalDTO = new GoalsDTO();
                        }

                        currentGoalsDTOList.Add(currnetGoalDTO);
                        GoalYTDDTO currYTDDTO = (GoalYTDDTO)allList[2];
                        currentYTDDTOList.Add(currYTDDTO);
                        GoalYTDDTO previousYTDDTO = (GoalYTDDTO)allList[3];
                        PrviousYTDDTOList.Add(previousYTDDTO);

                    }

                    averageList.Add(goalsModel.GetAllStoreAverageGoals(achiveGoalDTOList));
                    averageList.Add(goalsModel.GetAllStoreCurrentGoalAverageGoals(currentGoalsDTOList));
                    averageList.Add(goalsModel.GetAllStoreAverageGoals(currentYTDDTOList));
                    averageList.Add(goalsModel.GetAllStoreAverageGoals(PrviousYTDDTOList));
                }

                return Json(averageList, JsonRequestBehavior.AllowGet);

            }
            else
            {
                return Json(GetstoreGoalList(storeId), JsonRequestBehavior.AllowGet);
            }
        }
コード例 #6
0
        public JsonResult UpdatePaperworkList(string id, string ar, string paidOuts, string pettyExpense, string storeTransfer, string pfg1, string pfg2, string coke, string laborCost, string taxPercent, string nonTaxableSale)
        {
            WeeklyPaperworkModel weeklyPaperworkModel = new WeeklyPaperworkModel();

            GoalsModel goalsModel = new GoalsModel();

            string error = "";
            string msg = "";

            try
            {
                WeeklyPaperworkDTO weeklyPaperworkDTO = new WeeklyPaperworkDTO();
                weeklyPaperworkDTO.Id = ValidationUtility.ToInteger(id);

                weeklyPaperworkDTO.Ar = ValidationUtility.ToDouble(ar);
                weeklyPaperworkDTO.PaidOuts = ValidationUtility.ToDouble(paidOuts);
                weeklyPaperworkDTO.PettyExpense = ValidationUtility.ToDouble(pettyExpense);
                weeklyPaperworkDTO.StoreTransfer = ValidationUtility.ToDouble(storeTransfer);

                weeklyPaperworkDTO.Pfg1 = ValidationUtility.ToDouble(pfg1);
                weeklyPaperworkDTO.Pfg2 = ValidationUtility.ToDouble(pfg2);
                weeklyPaperworkDTO.Coke = ValidationUtility.ToDouble(coke);
                weeklyPaperworkDTO.LaborCost = ValidationUtility.ToDouble(laborCost);
                weeklyPaperworkDTO.TaxPercent = ValidationUtility.ToDouble(taxPercent);
                weeklyPaperworkDTO.NonTaxableSale = ValidationUtility.ToDouble(nonTaxableSale);

                weeklyPaperworkModel.UpdateWeeklyPaperSales(weeklyPaperworkDTO);

                weeklyPaperworkDTO = weeklyPaperworkModel.GetWeeklyPaperWorkOfWeek(ValidationUtility.ToInteger(id));

                ArrayList goalStoreList = new ArrayList();

               // ArrayList storeList = ValidationUtility.GetStoreList(true);

                ArrayList storeList = ValidationUtility.GetActiveStoreList(true);

                foreach (StoreDTO storDTO in storeList)
                {
                    if (storDTO.Id == weeklyPaperworkDTO.StoreId)
                    {
                        goalStoreList.Add(storDTO);
                        break;
                    }
                }

                if (!goalsModel.IsGoalsYTDCurrentYearRecordExist(weeklyPaperworkDTO.WeekStartDate, goalStoreList))
                {

                    ArrayList currentYTDList = goalsModel.GetCurrentWeekGoalsYTD(weeklyPaperworkDTO.WeekStartDate, goalStoreList);
                    goalsModel.AddGoalYTD(currentYTDList);
                }
                else
                {
                    goalsModel.UpdateCurrentYTD(weeklyPaperworkDTO);
                }

                error = "Success";
                msg = "Update Successfully";
            }
            catch (Exception ex)
            {
                error = "Error";
                msg = " Not Update ";
                log.Error("Exception in UpdatePaperworkList ", ex);

            }

            ResponseDTO resDTO = new ResponseDTO { Error = error, Message = msg };
            return Json(resDTO, JsonRequestBehavior.AllowGet);
        }