public IActionResult ConsultarPorGuiaRecepcionMateriaPrimaId([FromBody] ConsultaNotaCompraPorGuiaRecepcionMateriaPrimaIdRequestDTO request) { Guid guid = Guid.NewGuid(); _log.RegistrarEvento($"{guid.ToString()}{Environment.NewLine}{Newtonsoft.Json.JsonConvert.SerializeObject(request)}"); ConsultaNotaCompraPorGuiaRecepcionMateriaPrimaIdResponseDTO response = new ConsultaNotaCompraPorGuiaRecepcionMateriaPrimaIdResponseDTO(); try { response.Result.Data = _notaCompraService.ConsultarNotaCompraPorGuiaRecepcionMateriaPrimaId(request); response.Result.Success = true; } catch (ResultException ex) { response.Result = new Result() { Success = true, ErrCode = ex.Result.ErrCode, Message = ex.Result.Message }; } catch (Exception ex) { response.Result = new Result() { Success = false, Message = "Ocurrio un problema en el servicio, intentelo nuevamente." }; _log.RegistrarEvento(ex, guid.ToString()); } _log.RegistrarEvento($"{guid.ToString()}{Environment.NewLine}{Newtonsoft.Json.JsonConvert.SerializeObject(response)}"); return(Ok(response)); }
private IActionResult generar(int id) { Guid guid = Guid.NewGuid(); _log.RegistrarEvento($"{guid.ToString()}{Environment.NewLine}{Newtonsoft.Json.JsonConvert.SerializeObject(id)}"); ConsultaNotaCompraPorGuiaRecepcionMateriaPrimaIdResponseDTO response = new ConsultaNotaCompraPorGuiaRecepcionMateriaPrimaIdResponseDTO(); try { ConsultaNotaCompraPorGuiaRecepcionMateriaPrimaIdRequestDTO request = new ConsultaNotaCompraPorGuiaRecepcionMateriaPrimaIdRequestDTO(); request.GuiaRecepcionMateriaPrimaId = id; ConsultaImpresionNotaCompraPorGuiaRecepcionMateriaPrimaIdBE item = _notaCompraService.ConsultarImpresionNotaCompraPorGuiaRecepcionMateriaPrimaId(request); List <ConsultaImpresionAdelantoBE> adelantos = _notaCompraService.ConsultarImpresionNotaCompraAdelantosPorGuiaRecepcionMateriaPrimaId(item.NotaCompraId); List <ConsultaImpresionNotaCompraPorGuiaRecepcionMateriaPrimaIdBE> lista = new List <ConsultaImpresionNotaCompraPorGuiaRecepcionMateriaPrimaIdBE>(); lista.Add(item); string mimetype = ""; int extension = 1; var path = $"{this._webHostEnvironment.ContentRootPath}\\Reportes\\NotaCompra.rdlc"; LocalReport lr = new LocalReport(path); Dictionary <string, string> parameters = new Dictionary <string, string>(); lr.AddDataSource("dsNotaCompra", Util.ToDataTable(lista)); lr.AddDataSource("dsAdelanto", Util.ToDataTable(adelantos)); var result = lr.Execute(RenderType.Pdf, extension, parameters, mimetype); return(File(result.MainStream, "application/pdf")); } catch (ResultException ex) { response.Result = new Result() { Success = true, ErrCode = ex.Result.ErrCode, Message = ex.Result.Message }; } catch (Exception ex) { response.Result = new Result() { Success = false, Message = "Ocurrio un problema en el servicio, intentelo nuevamente." }; _log.RegistrarEvento(ex, guid.ToString()); } _log.RegistrarEvento($"{guid.ToString()}{Environment.NewLine}{Newtonsoft.Json.JsonConvert.SerializeObject(response)}"); return(Ok(response)); }
private IActionResult generar(int id) { Guid guid = Guid.NewGuid(); _log.RegistrarEvento($"{guid.ToString()}{Environment.NewLine}{Newtonsoft.Json.JsonConvert.SerializeObject(id)}"); ConsultaNotaCompraPorGuiaRecepcionMateriaPrimaIdResponseDTO response = new ConsultaNotaCompraPorGuiaRecepcionMateriaPrimaIdResponseDTO(); try { ConsultaNotaCompraPorGuiaRecepcionMateriaPrimaIdRequestDTO request = new ConsultaNotaCompraPorGuiaRecepcionMateriaPrimaIdRequestDTO(); request.GuiaRecepcionMateriaPrimaId = id; ConsultaImpresionListaProductoresPorNotaSalidaAlmacenResponseDTO impresionListaProductores = _notaSalidaAlmacenService.ConsultarImpresionListaProductoresPorNotaSalidaAlmacen(id); impresionListaProductores.FechaImpresion = DateTime.Now.ToString("dd/MM/yyyy"); List <ConsultaImpresionListaProductoresPorNotaSalidaAlmacenResponseDTO> reportCabecera = new List <ConsultaImpresionListaProductoresPorNotaSalidaAlmacenResponseDTO>(); reportCabecera.Add(impresionListaProductores); string mimetype = ""; int extension = 1; var path = $"{this._webHostEnvironment.ContentRootPath}\\Reportes\\ListaProductoresPorNotaSalidaAlmacen.rdlc"; LocalReport lr = new LocalReport(path); Dictionary <string, string> parameters = new Dictionary <string, string>(); //TODO: impresionListaProductores lr.AddDataSource("dsCabeceraLP", Util.ToDataTable(reportCabecera, true)); lr.AddDataSource("dsDetalleLP", Util.ToDataTable(impresionListaProductores.ListaProductores)); var result = lr.Execute(RenderType.Pdf, extension, parameters, mimetype); return(File(result.MainStream, "application/pdf")); } catch (ResultException ex) { response.Result = new Result() { Success = true, ErrCode = ex.Result.ErrCode, Message = ex.Result.Message }; } catch (Exception ex) { response.Result = new Result() { Success = false, Message = "Ocurrio un problema en el servicio, intentelo nuevamente." }; _log.RegistrarEvento(ex, guid.ToString()); } _log.RegistrarEvento($"{guid}{Environment.NewLine}{Newtonsoft.Json.JsonConvert.SerializeObject(response)}"); return(Ok(response)); }