public JsonResult JsonApproveDocReturnTable(string DepartmentId, string SectionId, string YearId, string MonthId, string MatNameId) { // add IEnumerable<AdjustDocReturnededViewModels> List <ApproveDocReturnedViewModels> viewModel = new List <ApproveDocReturnedViewModels>(); //filter department var q = from d in objBs.docReturnAdjustedBs.GetByFilter(DepartmentId, SectionId, Convert.ToInt32(MonthId), Convert.ToInt32(YearId)) select d; //filter matname if (!String.IsNullOrEmpty(MatNameId)) { q = q.Where(x => x.MATFRIGRP == MatNameId); } foreach (var item in q) { ApproveDocReturnedViewModels model = new ApproveDocReturnedViewModels(); model.Shipment = item.SHPMNTNO; model.DeliveryNote = item.DELVNO; model.CarrierId = item.CARRIER_ID; model.RegionId = item.REGION_ID; model.RegionName = item.REGION_NAME_TH; model.Soldto = item.SOLDTO; model.SoldtoName = item.SOLDTO_NAME; model.Shipto = item.SHIPTO; model.ShiptoName = item.TO_SHPG_LOC_NAME; model.ShippingPoint = item.SHPPOINT; model.TruckType = item.TRUCK_TYPE; model.PlanDocReturn = item.PLNDOCRETDATE_SCGL.Value.ToString("dd/MM/yyyy HH:mm", new CultureInfo("th-TH")); model.ActualDocReturn = item.DOCRETDATE_SCGL.Value.ToString("dd/MM/yyyy HH:mm", new CultureInfo("th-TH")); model.ActualGI = item.ACTGIDATE.Value.ToString("dd/MM/yyyy HH:mm", new CultureInfo("th-TH")); model.Approve = Convert.ToBoolean(item.SCGL_DOCRET_ADJUST); model.AdjustBy = item.SCGL_DOCRET_ADJUST_BY; model.Remark = item.SCGL_DOCRET_REMARK; model.Reason = item.SCGL_DOCRET_REASON; model.thisReasonId = Convert.ToString(item.SCGL_DOCRET_REASON_ID); try { model.FilePath = objBs.docReturnFilesBs.GetByShipment(item.DELVNO).FirstOrDefault().FILEPATH; } catch (Exception) { model.FilePath = "#"; } viewModel.Add(model); } return(Json(viewModel, JsonRequestBehavior.AllowGet)); }
public JsonResult JsonApproveDocReturnTable(string DepartmentId, string SectionId, string YearId, string MonthId, string MatNameId) { // add IEnumerable<AdjustDocReturnededViewModels> List<ApproveDocReturnedViewModels> viewModel = new List<ApproveDocReturnedViewModels>(); //filter department var q = from d in objBs.docReturnAdjustedBs.GetByFilter(DepartmentId, SectionId, Convert.ToInt32(MonthId), Convert.ToInt32(YearId)) select d; //filter matname if (!String.IsNullOrEmpty(MatNameId)) { q = q.Where(x => x.MATFRIGRP == MatNameId); } foreach (var item in q) { ApproveDocReturnedViewModels model = new ApproveDocReturnedViewModels(); model.Shipment = item.SHPMNTNO; model.DeliveryNote = item.DELVNO; model.CarrierId = item.CARRIER_ID; model.RegionId = item.REGION_ID; model.RegionName = item.REGION_NAME_TH; model.Soldto = item.SOLDTO; model.SoldtoName = item.SOLDTO_NAME; model.Shipto = item.SHIPTO; model.ShiptoName = item.TO_SHPG_LOC_NAME; model.ShippingPoint = item.SHPPOINT; model.TruckType = item.TRUCK_TYPE; model.PlanDocReturn = item.PLNDOCRETDATE_SCGL.Value.ToString("dd/MM/yyyy HH:mm", new CultureInfo("th-TH")); model.ActualDocReturn = item.DOCRETDATE_SCGL.Value.ToString("dd/MM/yyyy HH:mm", new CultureInfo("th-TH")); model.ActualGI = item.ACTGIDATE.Value.ToString("dd/MM/yyyy HH:mm", new CultureInfo("th-TH")); model.Approve = Convert.ToBoolean(item.SCGL_DOCRET_ADJUST); model.AdjustBy = item.SCGL_DOCRET_ADJUST_BY; model.Remark = item.SCGL_DOCRET_REMARK; model.Reason = item.SCGL_DOCRET_REASON; model.thisReasonId = Convert.ToString(item.SCGL_DOCRET_REASON_ID); try { model.FilePath = objBs.docReturnFilesBs.GetByShipment(item.DELVNO).FirstOrDefault().FILEPATH; } catch(Exception) { model.FilePath = "#"; } viewModel.Add(model); } return Json(viewModel, JsonRequestBehavior.AllowGet); }