// // GET: /Master/MaterialRequirementList/ public ActionResult Index() { var model = new MaterialReqListSearchViewModel { Grid = GenerateGrid(), DefaultGrid = GenerateDefaultGrid(), DateSearch = DateTime.Now.ToString("MM/yyyy") }; return(View(model)); }
public async Task <ActionResult> Print(MaterialReqListSearchViewModel model) { // Parameters are invalid. if (!ModelState.IsValid) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } string renderedData; // Base on what user selects, print the related. // Find the template absolute path. var exportPreProductAbsolutePath = Server.MapPath(string.Format("~/{0}", Constants.ExportTemplate.MaterialRequirementList)); // Read the template. var masterListPreProductTemplate = await _exportReportDomain.ReadTemplateFileAsync(exportPreProductAbsolutePath); // Find all records. var result = _materialRequirementListDomain.SearchCriteria(ConvertHelper.ConvertToDateTimeFull("01/" + model.DateSearch), null); var lstPreProduct = new { Data = new { result.Data.data, currentDate = DateTime.Now.ToString("dd/MM/yyyy"), yearMonth = model.DateSearch, companyName = WebConfigurationManager.AppSettings["CompanyName"] } }; // Render template renderedData = await _exportReportDomain.ExportToFlatFileAsync(lstPreProduct.Data, masterListPreProductTemplate); return(Json(new { render = renderedData, })); }
public ActionResult SearchByMaterial(MaterialReqListSearchViewModel model, GridSettings gridSettings) { if (string.IsNullOrEmpty(gridSettings.SortField)) { gridSettings.SortOrder = SortOrder.Asc; gridSettings.SortField = "F01_MaterialCode"; } var result = _materialRequirementListDomain.SearchCriteria(ConvertHelper.ConvertToDateTimeFull("01/" + model.DateSearch), gridSettings); if (!result.IsSuccess) { return(Json(null, JsonRequestBehavior.AllowGet)); } var response = Mapper.Map <GridResponse <object> >(result.Data); return(Json(response, JsonRequestBehavior.AllowGet)); }