public JsonResult GetAreaAnalysisList(string sId, string selectDate) { ArrayList list = new ArrayList(); int storeId = ValidationUtility.ToInteger(sId); ManagerBonusModel managerBonusModel = new ManagerBonusModel(); DateTime formatedDate; if (!ValidationUtility.IsNull(selectDate)) { formatedDate = ValidationUtility.ToDate(selectDate); } else { formatedDate = DateTime.Now; } AreaAnalysisModel areaAnalysisModel = new AreaAnalysisModel(); DateTime monthWeekStartDate = ValidationUtility.MonthWeekStartDate(formatedDate); DateTime monthWeekEndDate = ValidationUtility.MonthWeekEndDate(formatedDate); ArrayList storeList = ValidationUtility.GetStoreList(true); ArrayList goalStoreList = new ArrayList(); foreach (StoreDTO storDTO in storeList) { if (storDTO.Id == storeId) { goalStoreList.Add(storDTO); break; } } ManagerBonusDTO managerBonusDTO = managerBonusModel.CalculateManagerBonus(formatedDate, goalStoreList); ManagerBonusDTO returnManagerBonusDTO = managerBonusModel.GetActualBounus(managerBonusDTO.StoreId, managerBonusDTO.FirstDateOFMonth, managerBonusDTO.LastDateOFMonth); if (ValidationUtility.IsNull(returnManagerBonusDTO)) { // Add managerBonusModel.AddBounus(managerBonusDTO, false); } else { // update managerBonusModel.UpdateActualValue(managerBonusDTO); } ManagerBonusDTO actualBonusDTO = areaAnalysisModel.GetActualBounus(storeId, monthWeekStartDate, monthWeekEndDate.AddDays(6)); list.Add(actualBonusDTO); return Json(list, JsonRequestBehavior.AllowGet); }
public JsonResult GetBonusControlCenterList() { ManagerBonusModel managerBonusModel = new ManagerBonusModel(); BonusControlCenterModel model = new BonusControlCenterModel(); DateTime formatedDate = DateTime.Now; ArrayList allStoreList = ValidationUtility.GetActiveStoreList(true); foreach (StoreDTO storeDTO in allStoreList) { ArrayList goalStoreList = new ArrayList(); goalStoreList.Add(storeDTO); //Add Or Update Method ManagerBonusDTO managerBonusDTO = model.CalculateManagerBonus(formatedDate,goalStoreList); ManagerBonusDTO returnManagerBonusDTO = managerBonusModel.GetActualBounus(managerBonusDTO.StoreId, managerBonusDTO.FirstDateOFMonth, managerBonusDTO.LastDateOFMonth); if (ValidationUtility.IsNull(returnManagerBonusDTO)) { // Add managerBonusModel.AddBounus(managerBonusDTO, false); } else { // update managerBonusModel.UpdateActualValue(managerBonusDTO); } } ArrayList centerBonusList = model.GetCenterBonus(formatedDate); return Json(centerBonusList, JsonRequestBehavior.AllowGet); }
public JsonResult GetManagerBonusList(string selectDate) { ManagerBonusModel managerBonusModel = new ManagerBonusModel(); ArrayList list = new ArrayList(); DateTime formatedDate; if (!ValidationUtility.IsNull(selectDate)) { formatedDate = ValidationUtility.ToDate(selectDate); } else { formatedDate = DateTime.Now; } UserContext cont = (UserContext)Session["UserContext"]; if (!ValidationUtility.IsNull(cont)) { int sId = managerBonusModel.GetStoredId(cont.Id); ArrayList storeList = ValidationUtility.GetStoreList(true); ArrayList goalStoreList = new ArrayList(); foreach (StoreDTO storDTO in storeList) { if (storDTO.Id == sId) { goalStoreList.Add(storDTO); break; } } ManagerBonusDTO managerBonusDTO = managerBonusModel.CalculateManagerBonus(formatedDate, goalStoreList); ManagerBonusDTO returnManagerBonusDTO = managerBonusModel.GetActualBounus(managerBonusDTO.StoreId, managerBonusDTO.FirstDateOFMonth, managerBonusDTO.LastDateOFMonth); if (ValidationUtility.IsNull(returnManagerBonusDTO)) { // Add managerBonusModel.AddBounus(managerBonusDTO, false); } else { // update managerBonusModel.UpdateActualValue(managerBonusDTO); } ManagerBonusDTO actualBonusDTO = managerBonusModel.GetActualBounus(managerBonusDTO.StoreId, managerBonusDTO.FirstDateOFMonth, managerBonusDTO.LastDateOFMonth); list.Add(actualBonusDTO); ManagerBonusDTO zeroBasisDTO = managerBonusModel.GetZeroBasisList(managerBonusDTO.StoreId, managerBonusDTO.FirstDateOFMonth, managerBonusDTO.LastDateOFMonth); list.Add(zeroBasisDTO); // list = managerBonusModel.GetManagerBonus(sId, endDateOfMonth); } return Json(list, JsonRequestBehavior.AllowGet); }
public JsonResult AddZeroBasis(String selectDate, string foodCost, string laborCost, string salesIncrease, string customerIndex, string customerComplaint, string catering, string subInspection) { ManagerBonusModel managerBonusModel = new ManagerBonusModel(); ArrayList storeList = ValidationUtility.GetStoreList(false); double fCost = ValidationUtility.ToDouble(foodCost); double lCost = ValidationUtility.ToDouble(laborCost); double foodLaborCost = fCost + lCost; DateTime formatedDate; DateTime givenMontWeekStartDate; DateTime montEndDate; if (!ValidationUtility.IsNull(selectDate)) { formatedDate = ValidationUtility.ToDate(selectDate); givenMontWeekStartDate = ValidationUtility.MonthWeekStartDate(formatedDate); montEndDate = ValidationUtility.MonthWeekEndDate(formatedDate); } else { formatedDate = DateTime.Now; givenMontWeekStartDate = ValidationUtility.MonthWeekStartDate(formatedDate); montEndDate = ValidationUtility.MonthWeekEndDate(formatedDate); } ResponseDTO responseDTO = null; foreach (StoreDTO storeDTO in storeList) { ManagerBonusDTO managerBonusDTO = new ManagerBonusDTO(); managerBonusDTO.StoreId = storeDTO.Id; managerBonusDTO.FirstDateOFMonth = givenMontWeekStartDate.Date; managerBonusDTO.LastDateOFMonth = montEndDate.Date.AddDays(6); managerBonusDTO.FoodCost = fCost; managerBonusDTO.LaborCost = lCost; managerBonusDTO.FoodLaborCost = foodLaborCost; managerBonusDTO.SalesIncrease = ValidationUtility.ToDouble(salesIncrease); managerBonusDTO.CustomerIndex = ValidationUtility.ToDouble(customerIndex); managerBonusDTO.CustomerComplaint = ValidationUtility.ToDouble(customerComplaint); managerBonusDTO.Catering = ValidationUtility.ToDouble(catering); managerBonusDTO.SubInspection = ValidationUtility.ToDouble(subInspection); ManagerBonusDTO zeroBasisDTO = managerBonusModel.GetZeroBasisList(managerBonusDTO.StoreId, managerBonusDTO.FirstDateOFMonth, managerBonusDTO.LastDateOFMonth); //if (!managerBonusModel.IsZeroBasisExist(managerBonusDTO)) //{ if (ValidationUtility.IsNull(zeroBasisDTO)) { managerBonusModel.AddBounus(managerBonusDTO, true); 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); }
public JsonResult GetManagerBonusListByAdmin(string sId, string selectDate) { ArrayList list = new ArrayList(); ManagerBonusModel managerBonusModel = new ManagerBonusModel(); int storeId = ValidationUtility.ToInteger(sId); DateTime formatedDate; if (!ValidationUtility.IsNull(selectDate)) { formatedDate = ValidationUtility.ToDate(selectDate); } else { formatedDate = DateTime.Now; } ArrayList storeList = ValidationUtility.GetActiveStoreList(true); ArrayList goalStoreList = new ArrayList(); foreach (StoreDTO storDTO in storeList) { if (storDTO.Id == storeId) { goalStoreList.Add(storDTO); break; } } ManagerBonusDTO managerBonusDTO = managerBonusModel.CalculateManagerBonus(formatedDate, goalStoreList); ManagerBonusDTO returnManagerBonusDTO = managerBonusModel.GetActualBounus(managerBonusDTO.StoreId, managerBonusDTO.FirstDateOFMonth, managerBonusDTO.LastDateOFMonth); if (ValidationUtility.IsNull(returnManagerBonusDTO)) { // Add managerBonusModel.AddBounus(managerBonusDTO, false); } else { // update managerBonusModel.UpdateActualValue(managerBonusDTO); } // ArrayList list = managerBonusModel.GetManagerBonus(storeId, endDateOfMonth); ManagerBonusDTO actualBonusDTO = managerBonusModel.GetActualBounus(managerBonusDTO.StoreId, managerBonusDTO.FirstDateOFMonth, managerBonusDTO.LastDateOFMonth); // ArrayList list = managerBonusModel.GetManagerBonus(storeId, endDateOfMonth); ManagerBonusDTO zeroBasisDTO = managerBonusModel.GetZeroBasisList(managerBonusDTO.StoreId, managerBonusDTO.FirstDateOFMonth, managerBonusDTO.LastDateOFMonth); list.Add(actualBonusDTO); list.Add(zeroBasisDTO); ManagerBonusDTO differenceDTO= managerBonusModel.GetDifferenceDTO(actualBonusDTO, zeroBasisDTO); list.Add(differenceDTO); ManagerBonusDTO totalDTO = managerBonusModel.GetMaximumValue(differenceDTO); list.Add(totalDTO); return Json(list, JsonRequestBehavior.AllowGet); }
public JsonResult GetAreaManagerBonus(string selectDate) { AreaManagerBonusModel areaManagerBonusModel = new AreaManagerBonusModel(); ArrayList bonusList = new ArrayList(); DateTime formatedDate; if (!ValidationUtility.IsNull(selectDate)) { formatedDate = ValidationUtility.ToDate(selectDate); } else { formatedDate = DateTime.Now; } DateTime givenMontWeekStartDate = ValidationUtility.MonthWeekStartDate(formatedDate); DateTime montEndDate = ValidationUtility.MonthWeekEndDate(formatedDate); UserContext cont = (UserContext)Session["UserContext"]; ArrayList assignStoreList = null; ManagerBonusModel managerBonusModel = new ManagerBonusModel(); if (!ValidationUtility.IsNull(cont)) { // assignStoreList = areaManagerBonusModel.GetAreaMngAssignStore(cont.Id); // assignStoreList = ValidationUtility.GetAreaMngAssignStore(cont.Id); assignStoreList = ValidationUtility.GetAreaMngAssignActiveStore(cont.Id); foreach (StoreDTO storeDTO in assignStoreList) { double totalAmount = 0; ArrayList storeList = ValidationUtility.GetActiveStoreList(true); ArrayList goalStoreList = new ArrayList(); foreach (StoreDTO storDTO in storeList) { if (storDTO.Id == storeDTO.Id) { goalStoreList.Add(storDTO); break; } } ManagerBonusDTO managerBonusDTO = managerBonusModel.CalculateManagerBonus(formatedDate, goalStoreList); ManagerBonusDTO returnManagerBonusDTO = managerBonusModel.GetActualBounus(managerBonusDTO.StoreId, managerBonusDTO.FirstDateOFMonth, managerBonusDTO.LastDateOFMonth); if (ValidationUtility.IsNull(returnManagerBonusDTO)) { // Add managerBonusModel.AddBounus(managerBonusDTO, false); } else { // update managerBonusModel.UpdateActualValue(managerBonusDTO); } ArrayList getbonusList = new ArrayList(); ManagerBonusDTO actualBonusDTO = managerBonusModel.GetActualBounus(storeDTO.Id, givenMontWeekStartDate, montEndDate.AddDays(6)); getbonusList.Add(actualBonusDTO); ManagerBonusDTO zeroBasisDTO = managerBonusModel.GetZeroBasisList(storeDTO.Id, givenMontWeekStartDate, montEndDate.AddDays(6)); getbonusList.Add(zeroBasisDTO); totalAmount = areaManagerBonusModel.GetTotalBonus(getbonusList); AreaManagerBonusDTO areaManagerBonusDTO = new AreaManagerBonusDTO { StoreId = storeDTO.Id, StoreName = storeDTO.StoreName, TotalStoreBonus = totalAmount }; bonusList.Add(areaManagerBonusDTO); } } return Json(bonusList, JsonRequestBehavior.AllowGet); }