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); }
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); }