private List <GastoViajeComprobante> GetList() { try { CN_CapGastoViajeComprobante clsGastoViajeComprobante = new CN_CapGastoViajeComprobante(); List <GastoViajeComprobante> list = new List <GastoViajeComprobante>(); Sesion session = new Sesion(); session = (Sesion)Session["Sesion" + Session.SessionID]; GastoViajeComprobante gastoViajeComprobante = new GastoViajeComprobante(); //gastoViajeComprobante.Id_Emp = session.Id_Emp; //gastoViajeComprobante.Id_Cd = session.Id_Cd_Ver; gastoViajeComprobante.Id_GV = Int32.Parse(Request.QueryString["Id"] == null ? "-1" : Request.QueryString["Id"]); gastoViajeComprobante.Id_Emp = Int32.Parse(Request.QueryString["Id_Emp"] == null ? session.Id_Emp.ToString() : Request.QueryString["Id_Emp"]); gastoViajeComprobante.Id_Cd = Int32.Parse(Request.QueryString["Id_Cd"] == null ? session.Id_Cd_Ver.ToString() : Request.QueryString["Id_Cd"]); clsGastoViajeComprobante.ConsultaGastoViajeComprobante(gastoViajeComprobante, session.Emp_Cnx, ref list); Session["Id_GV"] = gastoViajeComprobante.Id_GV; return(list); } catch (Exception ex) { throw ex; } }
private void descargarPDF(int id_GVComprobante) { GastoViajeComprobante gastoViajeComprobante = new GastoViajeComprobante(); Sesion Sesion = new Sesion(); Sesion = (Sesion)Session["Sesion" + Session.SessionID]; //gastoViajeComprobante.Id_Emp = Sesion.Id_Emp; //gastoViajeComprobante.Id_Cd = Sesion.Id_Cd_Ver; gastoViajeComprobante.Id_GV = Int32.Parse(Request.QueryString["Id"] == null ? "-1" : Request.QueryString["Id"]); gastoViajeComprobante.Id_Emp = Int32.Parse(Request.QueryString["Id_Emp"] == null ? Sesion.Id_Emp.ToString() : Request.QueryString["Id_Emp"]); gastoViajeComprobante.Id_Cd = Int32.Parse(Request.QueryString["Id_Cd"] == null ? Sesion.Id_Cd_Ver.ToString() : Request.QueryString["Id_Cd"]); gastoViajeComprobante.Id_GVComprobante = id_GVComprobante; CN_CapGastoViajeComprobante clsGastoViajeComprobante = new CN_CapGastoViajeComprobante(); clsGastoViajeComprobante.ConsultaGastoViajeComprobante(gastoViajeComprobante, Sesion.Emp_Cnx); byte[] archivoPdf = gastoViajeComprobante.GVComprobante_Pdf; if (archivoPdf != null) { if (archivoPdf.Length > 0) { string tempPDFname = string.Concat("GVComprobante_" , Sesion.Id_Emp.ToString() , "_", Sesion.Id_Cd.ToString() , "_", id_GVComprobante.ToString() , ".pdf"); string URLtempPDF = Server.MapPath(string.Concat(ConfigurationManager.AppSettings["URLtempPDF"].ToString(), tempPDFname)); string WebURLtempPDFGastos = string.Concat(ConfigurationManager.AppSettings["WebURLtempPDFGastos"].ToString(), tempPDFname); this.ByteToTempPDF(URLtempPDF, archivoPdf); // ------------------------------------------------------------------------------------------------ // Ejecuta funciós JS para abrir una nueva ventada de Explorador y visualizar el archivo PDF // ------------------------------------------------------------------------------------------------ RAM1.ResponseScripts.Add(string.Concat(@"AbrirFacturaPDF('", WebURLtempPDFGastos, "')")); } } else { Alerta("El registro no tiene un archivo PDF."); } }
private void descargarXML(int id_GVComprobante) { GastoViajeComprobante gastoViajeComprobante = new GastoViajeComprobante(); Sesion Sesion = new Sesion(); Sesion = (Sesion)Session["Sesion" + Session.SessionID]; //gastoViajeComprobante.Id_Emp = Sesion.Id_Emp; //gastoViajeComprobante.Id_Cd = Sesion.Id_Cd_Ver; gastoViajeComprobante.Id_GV = Int32.Parse(Request.QueryString["Id"] == null ? "-1" : Request.QueryString["Id"]); gastoViajeComprobante.Id_Emp = Int32.Parse(Request.QueryString["Id_Emp"] == null ? Sesion.Id_Emp.ToString() : Request.QueryString["Id_Emp"]); gastoViajeComprobante.Id_Cd = Int32.Parse(Request.QueryString["Id_Cd"] == null ? Sesion.Id_Cd_Ver.ToString() : Request.QueryString["Id_Cd"]); gastoViajeComprobante.Id_GVComprobante = id_GVComprobante; CN_CapGastoViajeComprobante clsGastoViajeComprobante = new CN_CapGastoViajeComprobante(); clsGastoViajeComprobante.ConsultaGastoViajeComprobante(gastoViajeComprobante, Sesion.Emp_Cnx); //string ruta = null; //System.IO.StreamWriter sw = null; //ruta = Server.MapPath("Reportes") + "\\archivoXml" + Sesion.Id_U.ToString() + "GVComprobante" + id_GVComprobante.ToString() + ".txt"; //if (File.Exists(ruta)) // File.Delete(ruta); //if (File.Exists(Server.MapPath("Reportes") + "\\archivoXml" + Sesion.Id_U.ToString() + "GVComprobante" + id_GVComprobante.ToString() + ".xml")) // File.Delete(Server.MapPath("Reportes") + "\\archivoXml" + Sesion.Id_U.ToString() + "GVComprobante" + id_GVComprobante.ToString() + ".xml"); //sw = new System.IO.StreamWriter(ruta, false, Encoding.UTF8); //sw.WriteLine(gastoViajeComprobante.GVComprobante_Xml.ToString()); //sw.Close(); //File.Move(ruta, Server.MapPath("Reportes") + "\\archivoXml" + Sesion.Id_U.ToString() + "GVComprobante" + id_GVComprobante.ToString() + ".xml"); //RAM1.ResponseScripts.Add(string.Concat(@"abrirArchivo('Reportes\\archivoXml" + Sesion.Id_U.ToString() + "GVComprobante", id_GVComprobante.ToString(), ".xml')")); //string rutadestino = ConfigurationManager.AppSettings["URLtempPDF"].ToString(); //ruta = Server.MapPath(string.Concat(rutadestino, Sesion.Id_U.ToString() + "GV" + id_GVComprobante.ToString() + ".txt")); //if (File.Exists(ruta)) // File.Delete(ruta); //if (File.Exists(rutadestino + "\\archivoXml" + Sesion.Id_U.ToString() + "GV" + id_GVComprobante.ToString() + ".xml")) // File.Delete(rutadestino + "\\archivoXml" + Sesion.Id_U.ToString() + "GV" + id_GVComprobante.ToString() + ".xml"); //sw = new System.IO.StreamWriter(ruta, false, Encoding.UTF8); //sw.WriteLine(gastoViajeComprobante.GVComprobante_Xml.ToString()); //sw.Close(); //File.Move(ruta, rutadestino + "\\archivoXml" + Sesion.Id_U.ToString() + "GV" + id_GVComprobante.ToString() + ".xml"); //RAM1.ResponseScripts.Add(string.Concat(@"abrirArchivo('" + rutadestino + "\\archivoXml" + Sesion.Id_U.ToString() + "GV", id_GVComprobante.ToString(), ".xml')")); string ruta = null; ruta = Server.MapPath(string.Concat(ConfigurationManager.AppSettings["URLtempPDF"].ToString(), "\\archivoXml" + Sesion.Id_U.ToString() + "PagElec" + id_GVComprobante.ToString() + ".txt")); string strarchivo = Server.MapPath(string.Concat(ConfigurationManager.AppSettings["URLtempPDF"].ToString(), "\\archivoXml" + Sesion.Id_U.ToString() + "PagElec" + id_GVComprobante.ToString())); if (File.Exists(ruta)) { File.Delete(ruta); } if (File.Exists(strarchivo + ".xml")) { File.Delete(strarchivo + ".xml"); } using (FileStream fileStream = File.Create(ruta)) { MemoryStream MS = new MemoryStream(gastoViajeComprobante.GVComprobante_XmlStream); MS.CopyTo(fileStream); fileStream.Close(); } File.Move(ruta, strarchivo + ".xml"); //string jola = @"C:\Users\egdev001\Documents\Visual Studio 2010\Projects\SIANWeb - Gastos\SIANWEB\Reportes\archivoXml37PagElec15.xml"; //RAM1.ResponseScripts.Add(@"abrirArchivo('" + jola + "')"); RAM1.ResponseScripts.Add(string.Concat(@"abrirArchivo('xmlSAT\\archivoXml" + Sesion.Id_U.ToString() + "PagElec", id_GVComprobante.ToString(), ".xml')")); }