private void BtnimprimirRide_Click(object sender, EventArgs e) { if (txtNAutorizacion.Text != "" && TxtNumeroComprobante.Text != "") { string ambiente = ""; switch (Program.Ambiente) { case 1: ambiente = "PRUEBA"; break; case 2: ambiente = "PRODUCCION"; break; default: break; } if (tipodocumento == "Retencion") { ReporteRetencion objeformularioReporte = null; List <string> LISTA = ObjConsul.ObtenerListaStringReimprimirRide("Select IDORDENGIRO,AUTORIZACIONSRICLAVEACCESO,FECHAAUTORIZACIONSRI from TbEncabezadoOrdenGiro where AUTORIZACIONSRICLAVEACCESO = '" + txtNAutorizacion.Text + "' and IDORDENGIRO = " + TxtNumeroComprobante.Text + ";"); if (LISTA != null && LISTA.Count == 3) { objeformularioReporte = new ReporteRetencion(LISTA[1], LISTA[2], LISTA[0], ambiente, "NORMAL", ""); objeformularioReporte.Show(); } else { MessageBox.Show("Los datos son incorrectos o el Comprobante no esta autorizado", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else if (tipodocumento == "Factura") { string rutaXMl = ConfigurationManager.AppSettings["XmlServidor"].ToString() + @"\Autorizados\" + txtNAutorizacion.Text + ".xml"; XmlDocument docxml = new XmlDocument(); docxml.Load(rutaXMl); string fechaAutorizacion = Convert.ToString(docxml.GetElementsByTagName("fechaAutorizacion")[0].InnerText); string rutaXM2 = ConfigurationManager.AppSettings["XmlServidor"].ToString() + @"\Generados\" + txtNAutorizacion.Text + ".xml"; XmlDocument docxml2 = new XmlDocument(); docxml.Load(rutaXM2); string fechaemisionfactura = Convert.ToString(docxml.GetElementsByTagName("fechaEmision")[0].InnerText); string[] partesfecha = fechaemisionfactura.Split('/'); string año = partesfecha[2]; Comisariato.Ride.Factura.ReporteFacturaRide ObjformularioRepoteFactura = null; ObjformularioRepoteFactura = new Ride.Factura.ReporteFacturaRide(txtNAutorizacion.Text, fechaAutorizacion, ambiente, año); ObjformularioRepoteFactura.Show(); } } else { MessageBox.Show("Ingrese todos los datos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void BtnimprimirRide_Click(object sender, EventArgs e) { if (txtNAutorizacion.Text != "" && TxtNumeroComprobante.Text != "") { string ambiente = ""; switch (Program.Ambiente) { case 1: ambiente = "PRUEBA"; break; case 2: ambiente = "PRODUCCION"; break; default: break; } ReporteRetencion objeformularioReporte = null; List <string> LISTA = ObjConsul.ObtenerListaStringReimprimirRide("Select IDORDENGIRO,AUTORIZACIONSRICLAVEACCESO,FECHAAUTORIZACIONSRI from TbEncabezadoOrdenGiro where AUTORIZACIONSRICLAVEACCESO = '" + txtNAutorizacion.Text + "' and IDORDENGIRO = " + TxtNumeroComprobante.Text + ";"); if (LISTA != null && LISTA.Count == 3) { objeformularioReporte = new ReporteRetencion(LISTA[1], LISTA[2], LISTA[0], ambiente, "NORMAL", ""); objeformularioReporte.Show(); } else { MessageBox.Show("Los datos son incorrectos o el Comprobante no esta autorizado", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Ingrese todos los datos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void CambiarProgreso(string nombreXml, string fecha, string contadorDevuelta, string contadorRecibida, string contadorautorizado, string contadornoautorizado, string contadorenviados, string contador, string archivosTotales) { if (this.InvokeRequired) { CambiarProgresoDelegado h1 = new CambiarProgresoDelegado(CambiarProgreso); object[] parametros = new object[] { nombreXml, fecha, contadorDevuelta, contadorRecibida, contadorautorizado, contadornoautorizado, contadorenviados, contador, archivosTotales }; this.Invoke(h1, parametros); } else { if (fechaAutorizacion != null) //solo se formara ride si la fecha de autorizacion esta, lo q significa si se autorizo o no { //LLamar Reporte string ambiente = ""; switch (Program.Ambiente) { case 1: ambiente = "PRUEBA"; break; case 2: ambiente = "PRODUCCION"; break; default: break; } if (tipocomprobante == "Factura") { string rutaXMl = ConfigurationManager.AppSettings["XmlServidor"].ToString() + @"\Generados\" + nombreXml + ".xml"; XmlDocument docxml = new XmlDocument(); docxml.Load(rutaXMl); string fechaemisionfactura = Convert.ToString(docxml.GetElementsByTagName("fechaEmision")[0].InnerText); string nombreCliente = Convert.ToString(docxml.GetElementsByTagName("razonSocialComprador")[0].InnerText); string IdentificacionCliente = Convert.ToString(docxml.GetElementsByTagName("identificacionComprador")[0].InnerText); string[] partesfecha = fechaemisionfactura.Split('/'); string año = partesfecha[2]; string rutaRide = ConfigurationManager.AppSettings["XmlServidor"].ToString() + @"\Ride\Factura\" + año + @"\" + nombreXml + ".pdf"; Comisariato.Ride.Factura.ReporteFacturaRide ObjformularioRepoteFactura = null; ObjformularioRepoteFactura = new Ride.Factura.ReporteFacturaRide(nombrexml, fechaAutorizacion, ambiente, año); ObjformularioRepoteFactura.Show(); String emailCliente = ""; //ObtenerEmaailComprador-Cliente DataTable dt = objconsul.BoolDataTable("SELECT EMAIL FROM TBCLIENTE WHERE IDENTIFICACION = '" + IdentificacionCliente + "'"); if (dt.Rows.Count > 0) { DataRow myRow = dt.Rows[0]; emailCliente = myRow["EMAIL"].ToString(); } if (emailCliente != "") { //Eviar Correo objconsul.enviarCorreoFactura(emailCliente, rutaXMl, rutaRide, nombrexml, nombreCliente); //Fin Eviar Correo } } else { string rutaXMl = ConfigurationManager.AppSettings["XmlServidor"].ToString() + @"\Generados\" + nombreXml + ".xml"; XmlDocument docxml = new XmlDocument(); docxml.Load(rutaXMl); int numeroRetencion2 = Convert.ToInt32(docxml.GetElementsByTagName("secuencial")[0].InnerText); objconsul.EjecutarSQL("UPDATE [dbo].[TbEncabezadoOrdenGiro] SET [AUTORIZACIONSRICLAVEACCESO] = '" + nombreXml + "' ,[FECHAAUTORIZACIONSRI] = '" + fechaAutorizacion + "' WHERE NUMERORETECION ="+ numeroRetencion2 + "; "); string numeroOrdengiro = objconsul.ObtenerValorEntero("SELECT * FROM [BDComiSuper2].[dbo].[TbEncabezadoOrdenGiro] where NUMERORETECION =" + numeroRetencion2 + "").ToString(); string fechaemision = docxml.GetElementsByTagName("fechaEmision")[0].InnerText; string[] fechaseparada = fechaemision.Split('/'); cmbAñoRetencionHechaVariable = fechaseparada[2]; ReporteRetencion objeformularioReporte = null; objeformularioReporte = new ReporteRetencion(nombrexml, fechaAutorizacion, numeroOrdengiro.ToString(), ambiente, "NORMAL", cmbAñoRetencionHechaVariable); objeformularioReporte.Show(); //Fin Llamar Reporte //Eviar Correo objconsul.enviarCorreoRideRetencion(numeroOrdengiro.ToString(), cmbAñoRetencionHechaVariable, nombrexml); //Fin Eviar Correo } } nombrexml = ""; rTxtVistaXML.Text = ""; TxtMensajeError.Text = ""; //procesarComprobantesPendientes(); btnBuscar_Click(null, null); } }