Example #1
0
        private void PagoImpresion_NeedDataSource(object sender, EventArgs e)
        {
            try
            {
                this.sqlConnection2.ConnectionString = this.ReportParameters["Conexion"].Value.ToString();
                //Transfer the ReportParameter value to the parameter of the select command
                this.sqlDataAdapter1.SelectCommand.Parameters["@Id_Emp"].Value = this.ReportParameters["Id_Emp"].Value;
                this.sqlDataAdapter1.SelectCommand.Parameters["@Id_Cd"].Value  = this.ReportParameters["Id_Cd"].Value;
                this.sqlDataAdapter1.SelectCommand.Parameters["@Id_Pag"].Value = this.ReportParameters["Id_Pag"].Value;


                //Take the Telerik.Reporting.Processing.Report instance and set the adapter as it's DataSource
                Telerik.Reporting.Processing.Report report = (Telerik.Reporting.Processing.Report)sender;
                report.DataSource = this.sqlDataAdapter1;

                // ---------------------------------------------------------------------------------------------
                // Si se asigno correctamente el origen de datos, se actualiza el estatus del pago
                // ---------------------------------------------------------------------------------------------
                //actualiza estatus de orden de compra a Impreso (I)

                CN_CapPago cn_cappedido = new CN_CapPago();
                Pago       pag          = new Pago();
                pag.Id_Emp = (int)ReportParameters["Id_Emp"].Value;
                pag.Id_Cd  = (int)ReportParameters["Id_Cd"].Value;
                pag.Id_Pag = (int)ReportParameters["Id_Pag"].Value;

                int verificador = 0;
                cn_cappedido.Imprimir(pag, ReportParameters["Conexion"].Value.ToString(), ref verificador);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void Imprimir(string relacion, string foranea, string elaboro, string ejecutor)
        {
            try
            {
                ArrayList ALValorParametrosInternos = new ArrayList();

                string Orden = "Cliente y territorio";
                Orden = "Referencia";

                /*   PARAMETROS QUE LLENAN EL ENCABEZADO   */
                ALValorParametrosInternos.Add(relacion); // OPCION DE SELECCION POR RELACIONES
                ALValorParametrosInternos.Add(Orden);    // PARAMETRO DE CALCULADO CON

                /*   PARAMETROS PARA LLENAR EL TITULO DEL ENCABEZADO   */
                ALValorParametrosInternos.Add(this.sesion.Emp_Nombre); // NOMBRE DE LA EMPRESA
                ALValorParametrosInternos.Add(this.sesion.Cd_Nombre);  // UBICACION DE LA EMPRESA
                ALValorParametrosInternos.Add(this.sesion.U_Nombre);   // NOMBRE DEL USUARIO

                /*   PARAMETROS OBLIGATORIOS PARA EL REPORTE   */
                ALValorParametrosInternos.Add(sesion.Emp_Cnx);        // CADENA DE CONEXION A LA BASE DE DATOS
                ALValorParametrosInternos.Add(this.sesion.Id_Emp);    // ID DE LA EMPRESA
                ALValorParametrosInternos.Add(this.sesion.Id_Cd_Ver); //ID DEL CENTRO DE DISTRIBUCION

                ///*   PARAMETROS QUE PUEDEN SER NULOS   */
                ALValorParametrosInternos.Add(relacion);                                                                                                             //CADENA DE ID'S DE RELACIONES

                ALValorParametrosInternos.Add(foranea != "" ? elaboro + "\n\rZONA " + foranea : "Elaboro");                                                          //Elaboro
                ALValorParametrosInternos.Add(foranea != "" ? "COBRANZA FORANEA \"ZONA " + foranea + "\"" : ejecutor != "0" ? "COBRANZA FORANEA \"EJECUTOR\"" : ""); //Foranea

                /*  MANDA LLAMAR EL REPORTE Y LO MUESTRA EN PANTALLA  */
                Type instance = null;
                instance = typeof(LibreriaReportes.Rep_CobRelacionCobranzaFto1);

                Session["InternParameter_Values" + Session.SessionID + HF_ClvPag.Value] = ALValorParametrosInternos;
                Session["assembly" + Session.SessionID + HF_ClvPag.Value] = instance.AssemblyQualifiedName;
                RAM1.ResponseScripts.Add("AbrirReporteCve('" + HF_ClvPag.Value + "');");

                CN_CapPago cn_cappedido = new CN_CapPago();
                Pago       pag          = new Pago();
                pag.Id_Emp = this.sesion.Id_Emp;
                pag.Id_Cd  = this.sesion.Id_Cd_Ver;
                pag.Id_Pag = Convert.ToInt32(relacion);
                int verificador = 0;
                cn_cappedido.Imprimir(pag, this.sesion.Emp_Cnx, ref verificador);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }