public JsonResult GetAllPOFacilityByPOIdList(string _search, long?UserId, string POId, int?rows = 20, int?page = 1, int?TotalRecords = 10, string sord = null, string txtSearch = null, string sidx = null, string UserType = null) { eTracLoginModel ObjLoginModel = null; long LocationId = 0; long Id = 0; decimal? Calculation = 0; if (Session != null && Session["eTrac"] != null) { ObjLoginModel = (eTracLoginModel)(Session["eTrac"]); if (LocationId == null) { LocationId = ObjLoginModel.LocationID; } UserId = ObjLoginModel.UserId; } if (!string.IsNullOrEmpty(POId)) { POId = Cryptography.GetDecryptedData(POId, true); long.TryParse(POId, out Id); } JQGridResults result = new JQGridResults(); List <JQGridRow> rowss = new List <JQGridRow>(); decimal? grandTotal = 0; sord = string.IsNullOrEmpty(sord) ? "desc" : sord; sidx = string.IsNullOrEmpty(sidx) ? "UserEmail" : sidx; txtSearch = string.IsNullOrEmpty(txtSearch) ? "" : txtSearch; //UserType = Convert.ToInt64(Helper.UserType.ITAdministrator); try { var AllPOFacilityList = _IPOTypeDetails.GetAllPOFacilityByPOIdList(UserId, Id, rows, TotalRecords, sidx, sord); //foreach (var poFacilityList in AllPOFacilityList.rows) //{ // grandTotal += poFacilityList.UnitPrice * poFacilityList.Quantity; // poFacilityList.TotalPrice = grandTotal; // poFacilityList.TotalPrice = poFacilityList.UnitPrice * poFacilityList.Quantity; // JQGridRow row = new JQGridRow(); // row.id = Cryptography.GetEncryptedData(Convert.ToString(poFacilityList.COM_FacilityId), true); // row.cell = new string[10]; // row.cell[0] = poFacilityList.COM_FacilityId.ToString(); // row.cell[1] = poFacilityList.CostCode.ToString(); // row.cell[2] = poFacilityList.FacilityType.ToString(); // row.cell[3] = poFacilityList.COM_Facility_Desc.ToString(); // row.cell[4] = poFacilityList.UnitPrice.ToString(); // row.cell[5] = poFacilityList.Tax.ToString(); // row.cell[6] = poFacilityList.Quantity.ToString(); // row.cell[7] = poFacilityList.Total.ToString(); // row.cell[8] = poFacilityList.TotalPrice.ToString(); // row.cell[9] = poFacilityList.CostCodeName.ToString(); // rowss.Add(row); //} result.rows = rowss.ToArray(); result.page = Convert.ToInt32(page); result.total = (int)Math.Ceiling((decimal)Convert.ToInt32(TotalRecords.Value) / rows.Value); result.records = Convert.ToInt32(TotalRecords.Value); } catch (Exception ex) { return(Json(ex.Message, JsonRequestBehavior.AllowGet)); } return(Json(result, JsonRequestBehavior.AllowGet)); }
/// <summary> /// Created By : Ashwajit Bansod /// Created Date : 17-April-2019 /// Created For : To get PO Details ad facility list by PO id /// </summary> /// <param name="POId"></param> /// <param name="_search"></param> /// <param name="UserId"></param> /// <param name="rows"></param> /// <param name="page"></param> /// <param name="TotalRecords"></param> /// <param name="sord"></param> /// <param name="txtSearch"></param> /// <param name="sidx"></param> /// <param name="UserType"></param> /// <returns></returns> public JsonResult GetAllPODetailByPOId(long POId, string _search, long?UserId, int?rows = 20, int?page = 1, int?TotalRecords = 10, string sord = null, string txtSearch = null, string sidx = null, string UserType = null) { eTracLoginModel ObjLoginModel = null; var getResult = new POTypeDataModel(); var resultPayment = new BillPayment(); if (Session["eTrac"] != null) { ObjLoginModel = (eTracLoginModel)(Session["eTrac"]); } try { var obj = new PaymentModel(); obj.BillNo = POId; var getPOByBillNo = _IPaymentManager.GetPODetails(null, obj); getResult = _IPOTypeDetails.GetPODetailsById(getPOByBillNo.POId); if (getResult != null) { getResult.IssueDateDisplay = getResult.IssueDate.ToString(); getResult.DeliveryDateDisplay = getResult.DeliveryDate.ToString(); JQGridResults result = new JQGridResults(); List <JQGridRow> rowss = new List <JQGridRow>(); decimal? grandTotal = 0; sord = string.IsNullOrEmpty(sord) ? "desc" : sord; sidx = string.IsNullOrEmpty(sidx) ? "UserEmail" : sidx; txtSearch = string.IsNullOrEmpty(txtSearch) ? "" : txtSearch; //UserType = Convert.ToInt64(Helper.UserType.ITAdministrator); getResult.NewPOTypeDetails = _IPOTypeDetails.GetAllPOFacilityByPOIdList(ObjLoginModel.UserId, getPOByBillNo.POId, rows, TotalRecords, sidx, sord); foreach (var poFacilityList in getResult.NewPOTypeDetails.rows) { grandTotal += poFacilityList.UnitPrice * poFacilityList.Quantity; poFacilityList.TotalPrice = grandTotal; //poFacilityList.TotalPrice = poFacilityList.UnitPrice * poFacilityList.Quantity; poFacilityList.Total = poFacilityList.UnitPrice * poFacilityList.Quantity; JQGridRow row = new JQGridRow(); row.id = Cryptography.GetEncryptedData(Convert.ToString(poFacilityList.COM_FacilityId), true); row.cell = new string[10]; row.cell[0] = poFacilityList.COM_FacilityId.ToString(); row.cell[1] = poFacilityList.CostCode.ToString(); row.cell[2] = poFacilityList.FacilityType.ToString(); row.cell[3] = poFacilityList.COM_Facility_Desc.ToString(); row.cell[4] = poFacilityList.UnitPrice.ToString(); row.cell[5] = poFacilityList.Tax.ToString(); row.cell[6] = poFacilityList.Quantity.ToString(); row.cell[7] = poFacilityList.Total.ToString(); row.cell[8] = poFacilityList.TotalPrice.ToString(); row.cell[9] = poFacilityList.CostCodeName.ToString(); rowss.Add(row); } result.rows = rowss.ToArray(); result.page = Convert.ToInt32(page); result.total = (int)Math.Ceiling((decimal)Convert.ToInt32(TotalRecords.Value) / rows.Value); result.records = Convert.ToInt32(TotalRecords.Value); } } catch (Exception ex) { return(Json(ex.Message, JsonRequestBehavior.AllowGet)); } return(Json(getResult, JsonRequestBehavior.AllowGet)); }