Exemple #1
0
        private void Abrir_Reporte(bool a_pantalla)
        {
            try
            {
                Sesion    sesion = (Sesion)Session["Sesion" + Session.SessionID];
                ArrayList ALValorParametrosInternos = new ArrayList();
                CN__Comun cn_comun = new CN__Comun();

                string resp = cn_comun.ValidarRango(RadTextBoxTerritorio.Text);
                if (resp != "")
                {
                    Alerta("El rango " + resp + ", en el campo \"Territorio\" no es válido");
                    return;
                }

                resp = cn_comun.ValidarRango(RadTextBoxCliente.Text);
                if (resp != "")
                {
                    Alerta("El rango " + resp + ", en el campo \"Cliente\" no es válido");
                    return;
                }

                resp = cn_comun.ValidarRango(RadTextBoxProducto.Text);
                if (resp != "")
                {
                    Alerta("El rango " + resp + ", en el campo \"Producto\" no es válido");
                    return;
                }

                resp = cn_comun.ValidarRango(RadTextBoxRik.Text);
                if (resp != "")
                {
                    Alerta("El rango " + resp + ", en el campo \"Representante\" no es válido");
                    return;
                }

                //Consulta centro de distribución
                string Emp_Nombre = "";
                string Cd_Nombre  = "";
                string U_Nombre   = "";
                new CN_CapPedido().ConsultarEncabezado_RepFacPedidosPendientes(sesion, ref Emp_Nombre, ref Cd_Nombre, ref U_Nombre);
                //parametros cabecera
                ALValorParametrosInternos.Add(cmbRemisiones.SelectedItem.Text);                      //remisiones
                ALValorParametrosInternos.Add(cmbTipoRem.SelectedItem.Text.Replace("-", "").Trim()); //tipo remision
                if (dpFechaini.SelectedDate == null)
                {
                    ALValorParametrosInternos.Add("Todas");//fecha inicial
                }
                else
                {
                    ALValorParametrosInternos.Add(dpFechaini.SelectedDate);//fecha inicial
                }

                if (dpFechafin.SelectedDate == null)
                {
                    ALValorParametrosInternos.Add("Todas");//fecha inicial
                }
                else
                {
                    ALValorParametrosInternos.Add(dpFechafin.SelectedDate);                                                //fecha final
                }
                ALValorParametrosInternos.Add(RadTextBoxRik.Text == "" ? "Todos" : RadTextBoxRik.Text);                    //RIK
                ALValorParametrosInternos.Add(RadTextBoxTerritorio.Text == "" ? "Todos" : RadTextBoxTerritorio.Text);      //Territorio
                ALValorParametrosInternos.Add(RadTextBoxCliente.Text == "" ? "Todos" : RadTextBoxCliente.Text);            //Cliente
                ALValorParametrosInternos.Add(RadTextBoxProducto.Text == "" ? "Todos" : RadTextBoxProducto.Text);          //Producto
                ALValorParametrosInternos.Add(rblEstatus.SelectedItem.Text);                                               //Estatus
                ALValorParametrosInternos.Add(chkDetalle.Checked ? "A detalle" : "Sin detalle");                           //Detalle

                ALValorParametrosInternos.Add(Emp_Nombre);                                                                 //nombre empresa
                ALValorParametrosInternos.Add(Cd_Nombre);                                                                  //nombre sucursal
                ALValorParametrosInternos.Add(sesion.U_Nombre);                                                            //usuario
                ALValorParametrosInternos.Add(DateTime.Now.ToShortDateString() + "  " + DateTime.Now.ToShortTimeString()); //fecha

                //parametros para el cuerpo del reporte
                ALValorParametrosInternos.Add(sesion.Id_Emp);
                ALValorParametrosInternos.Add(sesion.Id_Cd_Ver);
                ALValorParametrosInternos.Add(cmbTipoRem.SelectedValue == "-1" ? (object)null : cmbTipoRem.SelectedValue);
                ALValorParametrosInternos.Add(dpFechaini.SelectedDate);                                                                                                   //fecha inicial
                ALValorParametrosInternos.Add(dpFechafin.SelectedDate);                                                                                                   //fecha final
                ALValorParametrosInternos.Add(RadTextBoxRik.Text == "" ? (object)null : new CN__Comun().DesgloceRangoProductos(RadTextBoxRik.Text.Trim()));               //RIK
                ALValorParametrosInternos.Add(RadTextBoxTerritorio.Text == "" ? (object)null : new CN__Comun().DesgloceRangoProductos(RadTextBoxTerritorio.Text.Trim())); //Territorio
                ALValorParametrosInternos.Add(RadTextBoxCliente.Text == "" ? (object)null : new CN__Comun().DesgloceRangoProductos(RadTextBoxCliente.Text.Trim()));       //Cliente
                ALValorParametrosInternos.Add(RadTextBoxProducto.Text == "" ? (object)null : new CN__Comun().DesgloceRangoProductos(RadTextBoxProducto.Text.Trim()));     //Producto

                if (cmbRemisiones.SelectedValue == "L")
                {
                    ALValorParametrosInternos.Add(rblEstatus0.SelectedItem.Value);//Estatus
                }
                else
                {
                    ALValorParametrosInternos.Add(rblEstatus.SelectedItem.Text == "Vencidas" ? 1 : 0);//Estatus
                }
                //conexion
                ALValorParametrosInternos.Add(sesion.Emp_Cnx);

                Funciones funcion = new Funciones();
                ALValorParametrosInternos.Add(funcion.GetLocalDateTime(sesion.Minutos));//FECHA ACTUAL
                if (cmbRemisiones.SelectedValue == "E")
                {
                    ALValorParametrosInternos.Add(NtxtAnyo.Text);
                }
                Type instance = null;
                switch (cmbRemisiones.SelectedValue)
                {
                case "P":                    //Producto
                    if (!chkDetalle.Checked) //caso 1a.
                    {                        //sin Detalle
                        if (a_pantalla)
                        {
                            instance = typeof(LibreriaReportes.Rep_InvControlRemisiones1A);
                        }
                        else
                        {
                            instance = typeof(LibreriaReportes.ExpRep_InvControlRemisiones1A);
                        }
                    }
                    else
                    {    //con Detalle
                        if (a_pantalla)
                        {
                            instance = typeof(LibreriaReportes.Rep_InvControlRemisiones1B);
                        }
                        else
                        {
                            instance = typeof(LibreriaReportes.ExpRep_InvControlRemisiones1B);
                        }
                    }
                    break;

                case "E":    //Estadistica
                    switch (rblMostrar.SelectedValue)
                    {
                    case "a":
                        if (a_pantalla)
                        {
                            instance = typeof(LibreriaReportes.Rep_InvControlRemisiones2a);        //unidades
                        }
                        else
                        {
                            instance = typeof(LibreriaReportes.ExpRep_InvControlRemisiones2a);        //unidades
                        }
                        break;

                    case "b":
                        if (a_pantalla)
                        {
                            instance = typeof(LibreriaReportes.Rep_InvControlRemisiones2b);        //pesos
                        }
                        else
                        {
                            instance = typeof(LibreriaReportes.ExpRep_InvControlRemisiones2b);        //pesos
                        }
                        break;

                    case "x":
                        if (a_pantalla)
                        {
                            instance = typeof(LibreriaReportes.Rep_InvControlRemisiones2);        //ambos
                        }
                        else
                        {
                            instance = typeof(LibreriaReportes.ExpRep_InvControlRemisiones2);        //ambos
                        }
                        break;
                    }
                    break;

                case "K":    //Kardex
                    if (a_pantalla)
                    {
                        instance = typeof(LibreriaReportes.Rep_InvControlRemisiones3);
                    }
                    else
                    {
                        instance = typeof(LibreriaReportes.ExpRep_InvControlRemisiones3);
                    }
                    break;

                case "L":    //Listado
                    if (a_pantalla)
                    {
                        if (rblNivel.SelectedValue == "D")
                        {
                            instance = typeof(LibreriaReportes.Rep_RemisionVencidaA);
                        }
                        else
                        {
                            instance = typeof(LibreriaReportes.Rep_RemisionVencidaB);
                        }
                    }
                    else
                    {
                        if (rblNivel.SelectedValue == "D")
                        {
                            instance = typeof(LibreriaReportes.ExpRep_RemisionVencidaA);
                        }
                        else
                        {
                            instance = typeof(LibreriaReportes.ExpRep_RemisionVencidaB);
                        }
                    }
                    break;

                default:
                    break;
                }

                if (a_pantalla)
                {
                    Session["InternParameter_Values" + Session.SessionID + HF_ClvPag.Value] = null;
                    Session["InternParameter_Values" + Session.SessionID + HF_ClvPag.Value] = ALValorParametrosInternos;
                    Session["assembly" + Session.SessionID + HF_ClvPag.Value] = instance.AssemblyQualifiedName;
                    RadAjaxManager1.ResponseScripts.Add("AbrirReporteCve('" + HF_ClvPag.Value + "');");
                }
                else
                {
                    ImprimirXLS(ALValorParametrosInternos, instance);
                }
            }
            catch (Exception ex)
            {
                ErrorManager(ex, new System.Diagnostics.StackTrace().GetFrame(0).GetMethod().Name);
            }
        }
        private void Abrir_Reporte(bool a_pantalla)
        {
            try
            {
                Sesion    sesion   = (Sesion)Session["Sesion" + Session.SessionID];
                CN__Comun cn_comun = new CN__Comun();
                string    resp     = cn_comun.ValidarRango(txtCliente.Text);
                if (resp != "")
                {
                    Alerta("El rango " + resp + " no es válido");
                    return;
                }
                ArrayList ALValorParametrosInternos = new ArrayList();

                //Consulta centro de distribución
                string Emp_Nombre = "";
                string Cd_Nombre  = "";
                string U_Nombre   = "";
                new CN_CapPedido().ConsultarEncabezado_RepFacPedidosPendientes(sesion, ref Emp_Nombre, ref Cd_Nombre, ref U_Nombre);
                ////parametros cabecera
                ALValorParametrosInternos.Add(txtCliente.Text == "" ? "Todos" : txtCliente.Text);//Cliente
                if (dpFechaini.SelectedDate == null)
                {
                    ALValorParametrosInternos.Add("Todas");//fecha inicial
                }
                else
                {
                    ALValorParametrosInternos.Add(dpFechaini.SelectedDate);//fecha inicial
                }
                if (dpFechafin.SelectedDate == null)
                {
                    ALValorParametrosInternos.Add("Todas");//fecha inicial
                }
                else
                {
                    ALValorParametrosInternos.Add(dpFechafin.SelectedDate);                                                //fecha final
                }
                ALValorParametrosInternos.Add(Emp_Nombre);                                                                 //nombre empresa
                ALValorParametrosInternos.Add(Cd_Nombre);                                                                  //nombre sucursal
                ALValorParametrosInternos.Add(sesion.U_Nombre);                                                            //usuario
                ALValorParametrosInternos.Add(DateTime.Now.ToShortDateString() + "  " + DateTime.Now.ToShortTimeString()); //fecha

                //parametros para el cuerpo del reporte
                ALValorParametrosInternos.Add(sesion.Id_Emp);
                ALValorParametrosInternos.Add(sesion.Id_Cd_Ver);
                ALValorParametrosInternos.Add(txtCliente.Text == "" ? null : txtCliente.Text); //Cliente
                ALValorParametrosInternos.Add(dpFechaini.SelectedDate);                        //fecha inicial
                ALValorParametrosInternos.Add(dpFechafin.SelectedDate);                        //fecha final

                //conexion
                ALValorParametrosInternos.Add(sesion.Emp_Cnx);

                Type instance = null;
                if (chkSaldo.Checked)
                {
                    if (a_pantalla)
                    {
                        instance = typeof(LibreriaReportes.Rep_CobCargosCreditos1);
                    }
                    else
                    {
                        instance = typeof(LibreriaReportes.ExpRep_CobCargosCreditos1);
                    }
                }
                else
                {
                    if (a_pantalla)
                    {
                        instance = typeof(LibreriaReportes.Rep_CobCargosCreditos2);
                    }
                    else
                    {
                        instance = typeof(LibreriaReportes.ExpRep_CobCargosCreditos2);
                    }
                }

                if (_PermisoImprimir)
                {
                    if (a_pantalla)
                    {
                        Session["InternParameter_Values" + Session.SessionID + HF_ClvPag.Value] = null;
                        Session["InternParameter_Values" + Session.SessionID + HF_ClvPag.Value] = ALValorParametrosInternos;
                        Session["assembly" + Session.SessionID + HF_ClvPag.Value] = instance.AssemblyQualifiedName;
                        RadAjaxManager1.ResponseScripts.Add("AbrirReporteCve('" + HF_ClvPag.Value + "');");
                    }
                    else
                    {
                        ImprimirXLS(ALValorParametrosInternos, instance);
                    }
                }
                else
                {
                    Alerta("No tiene permiso para imprimir");
                }
            }
            catch (Exception ex)
            {
                ErrorManager(ex, new System.Diagnostics.StackTrace().GetFrame(0).GetMethod().Name);
            }
        }
Exemple #3
0
        private void Abrir_Reporte(bool a_pantalla)
        {
            try
            {
                CN__Comun cn_comun = new CN__Comun();
                string    resp     = cn_comun.ValidarRango(txtRepresentante2.Text);
                if (resp != "")
                {
                    Alerta("El rango " + resp + ", en el campo \"Representante\" no es válido");
                    return;
                }
                resp = cn_comun.ValidarRango(txtTerritorio2.Text);
                if (resp != "")
                {
                    Alerta("El rango " + resp + ", en el campo \"Territorio\" no es válido");
                    return;
                }
                resp = cn_comun.ValidarRango(txtCliente2.Text);
                if (resp != "")
                {
                    Alerta("El rango " + resp + ", en el campo \"Cliente\" no es válido");
                    return;
                }
                resp = cn_comun.ValidarRango(txtEquipo.Text);
                if (resp != "")
                {
                    Alerta("El rango " + resp + ", en el campo \"Equipo\" no es válido");
                    return;
                }

                Sesion    sesion = (Sesion)Session["Sesion" + Session.SessionID];
                ArrayList ALValorParametrosInternos = new ArrayList();

                //Consulta centro de distribución
                string Emp_Nombre = "";
                string Cd_Nombre  = "";
                string U_Nombre   = "";
                new CN_CapPedido().ConsultarEncabezado_RepFacPedidosPendientes(sesion, ref Emp_Nombre, ref Cd_Nombre, ref U_Nombre);
                //parametros cabecera

                ALValorParametrosInternos.Add(txtRepresentante2.Text == "" ? "Todos" : txtRepresentante2.Text);            //RIK
                ALValorParametrosInternos.Add(txtTerritorio2.Text == "" ? "Todos" : txtTerritorio2.Text);                  //Territorio
                ALValorParametrosInternos.Add(txtCliente2.Text == "" ? "Todos" : txtCliente2.Text);                        //Cliente
                ALValorParametrosInternos.Add(txtEquipo.Text == "" ? "Todos" : txtEquipo.Text);                            //equipo

                ALValorParametrosInternos.Add(cmbMes.SelectedItem.Text);                                                   //mes
                ALValorParametrosInternos.Add(cmbAño.SelectedItem.Text);                                                   //año
                ALValorParametrosInternos.Add(rblTipo.SelectedItem.Text);                                                  //tipo

                ALValorParametrosInternos.Add(Emp_Nombre);                                                                 //nombre empresa
                ALValorParametrosInternos.Add(Cd_Nombre);                                                                  //nombre sucursal
                ALValorParametrosInternos.Add(sesion.U_Nombre);                                                            //usuario
                ALValorParametrosInternos.Add(DateTime.Now.ToShortDateString() + "  " + DateTime.Now.ToShortTimeString()); //fecha

                //parametros para el cuerpo del reporte
                ALValorParametrosInternos.Add(sesion.Id_Emp);
                ALValorParametrosInternos.Add(sesion.Id_Cd_Ver);
                ALValorParametrosInternos.Add(txtRepresentante2.Text == "" ? (object)null : txtRepresentante2.Text); //RIK
                ALValorParametrosInternos.Add(txtTerritorio2.Text == "" ? (object)null : txtTerritorio2.Text);       //Territorio
                ALValorParametrosInternos.Add(txtCliente2.Text == "" ? (object)null : txtCliente2.Text);             //Cliente
                ALValorParametrosInternos.Add(txtEquipo.Text == "" ? (object)null : txtEquipo.Text);                 //Producto
                ALValorParametrosInternos.Add(cmbMes.SelectedValue);                                                 //mes
                ALValorParametrosInternos.Add(cmbAño.SelectedValue);                                                 //año
                //ALValorParametrosInternos.Add(rblTipo.SelectedValue);//tipo de reporte

                //conexion
                ALValorParametrosInternos.Add(sesion.Emp_Cnx);
                Type instance = null;
                switch (rblTipo.SelectedValue)
                {
                case "1":
                    if (a_pantalla)
                    {
                        instance = typeof(LibreriaReportes.Rep_SerServicioTecnico1);
                    }
                    else
                    {
                        instance = typeof(LibreriaReportes.ExpRep_SerServicioTecnico1);
                    }
                    break;

                case "2":
                    if (a_pantalla)
                    {
                        instance = typeof(LibreriaReportes.Rep_SerServicioTecnico2);
                    }
                    else
                    {
                        instance = typeof(LibreriaReportes.ExpRep_SerServicioTecnico2);
                    }
                    break;

                case "3":
                    if (a_pantalla)
                    {
                        instance = typeof(LibreriaReportes.Rep_SerServicioTecnico3);
                    }
                    else
                    {
                        instance = typeof(LibreriaReportes.ExpRep_SerServicioTecnico3);
                    }
                    break;

                default:
                    break;
                }

                if (a_pantalla)
                {
                    Session["InternParameter_Values" + Session.SessionID + HF_ClvPag.Value] = null;
                    Session["InternParameter_Values" + Session.SessionID + HF_ClvPag.Value] = ALValorParametrosInternos;
                    Session["assembly" + Session.SessionID + HF_ClvPag.Value] = instance.AssemblyQualifiedName;
                    RadAjaxManager1.ResponseScripts.Add("AbrirReporteCve('" + HF_ClvPag.Value + "');");
                }
                else
                {
                    ImprimirXLS(ALValorParametrosInternos, instance);
                }
            }
            catch (Exception ex)
            {
                ErrorManager(ex, new System.Diagnostics.StackTrace().GetFrame(0).GetMethod().Name);
            }
        }
        private void Abrir_Reporte(bool a_pantalla)
        {
            try
            {
                Sesion    sesion = (Sesion)Session["Sesion" + Session.SessionID];
                ArrayList ALValorParametrosInternos = new ArrayList();

                CN__Comun cn_comun = new CN__Comun();
                string    resp     = cn_comun.ValidarRango(txtGrupo.Text);
                if (resp != "")
                {
                    Alerta("El rango " + resp + ", en el campo \"Grupo\" no es válido");
                    return;
                }
                resp = cn_comun.ValidarRango(txtTerritorio.Text);
                if (resp != "")
                {
                    Alerta("El rango " + resp + ", en el campo \"Territorio\" no es válido");
                    return;
                }
                resp = cn_comun.ValidarRango(txtCliente.Text);
                if (resp != "")
                {
                    Alerta("El rango " + resp + ", en el campo \"Cliente\" no es válido");
                    return;
                }
                resp = cn_comun.ValidarRango(txtEquipo.Text);
                if (resp != "")
                {
                    Alerta("El rango " + resp + ", en el campo \"Equipos\" no es válido");
                    return;
                }
                resp = cn_comun.ValidarRango(txtRepresentante.Text);
                if (resp != "")
                {
                    Alerta("El rango " + resp + ", en el campo \"Representante\" no es válido");
                    return;
                }
                //Consulta centro de distribución
                string Emp_Nombre = "";
                string Cd_Nombre  = "";
                string U_Nombre   = "";
                new CN_CapPedido().ConsultarEncabezado_RepFacPedidosPendientes(sesion, ref Emp_Nombre, ref Cd_Nombre, ref U_Nombre);
                //parametros cabecera
                ALValorParametrosInternos.Add(txtGrupo.Text == "" ? "Todos" : txtGrupo.Text);
                ALValorParametrosInternos.Add(txtTerritorio.Text == "" ? "Todos" : txtTerritorio.Text); //Territorio
                ALValorParametrosInternos.Add(txtCliente.Text == "" ? "Todos" : txtCliente.Text);       //Cliente
                ALValorParametrosInternos.Add(txtEquipo.Text == "" ? "Todos" : txtEquipo.Text);
                ALValorParametrosInternos.Add(txtRepresentante.Text == "" ? "Todos" : txtRepresentante.Text);
                ALValorParametrosInternos.Add(cmbAño.SelectedValue);
                ALValorParametrosInternos.Add(rblDetallado.SelectedItem.Text);
                ALValorParametrosInternos.Add(this.RblNuevo.SelectedValue);
                ALValorParametrosInternos.Add(this.RblNuevo.SelectedItem.Text);
                //ALValorParametrosInternos.Add(cmbAgrupar.SelectedValue);
                //if (cmbAgrupar.SelectedValue == "0")
                //    ALValorParametrosInternos.Add("Todos");
                //else
                //    ALValorParametrosInternos.Add(cmbAgrupar.SelectedItem.Text);

                ALValorParametrosInternos.Add(Emp_Nombre);                                                                 //nombre empresa
                ALValorParametrosInternos.Add(Cd_Nombre);                                                                  //nombre sucursal
                ALValorParametrosInternos.Add(sesion.U_Nombre);                                                            //usuario
                ALValorParametrosInternos.Add(DateTime.Now.ToShortDateString() + "  " + DateTime.Now.ToShortTimeString()); //fecha

                //parametros para el cuerpo del reporte
                ALValorParametrosInternos.Add(sesion.Id_Emp);
                ALValorParametrosInternos.Add(sesion.Id_Cd_Ver);
                ALValorParametrosInternos.Add(txtGrupo.Text == "" ? (object)null : txtGrupo.Text);                 //new CN__Comun().DesgloceRangoProductos(txtGrupo.Text.Trim()));
                ALValorParametrosInternos.Add(txtTerritorio.Text == "" ? (object)null : txtTerritorio.Text);       //(object)null : new CN__Comun().DesgloceRangoProductos(txtTerritorio.Text.Trim()));//Territorio
                ALValorParametrosInternos.Add(txtCliente.Text == "" ? (object)null : txtCliente.Text);             //new CN__Comun().DesgloceRangoProductos(txtCliente.Text.Trim()));//Cliente
                ALValorParametrosInternos.Add(txtEquipo.Text == "" ? (object)null : txtEquipo.Text);               // new CN__Comun().DesgloceRangoProductos(txtEquipo.Text.Trim()));//Producto
                ALValorParametrosInternos.Add(txtRepresentante.Text == "" ? (object)null : txtRepresentante.Text); // new CN__Comun().DesgloceRangoProductos(txtRepresentante.Text.Trim()));
                ALValorParametrosInternos.Add(cmbAño.SelectedValue);
                ALValorParametrosInternos.Add(rblDetallado.SelectedValue);
                //conexion
                ALValorParametrosInternos.Add(sesion.Emp_Cnx);
                Type instance = null;
                if (a_pantalla)
                {
                    instance = typeof(LibreriaReportes.Rep_SerBaseInstalada);
                }
                else
                {
                    instance = typeof(LibreriaReportes.ExpRep_SerBaseInstalada);
                }


                if (_PermisoImprimir)
                {
                    if (a_pantalla)
                    {
                        Session["InternParameter_Values" + Session.SessionID + HF_ClvPag.Value] = null;
                        Session["InternParameter_Values" + Session.SessionID + HF_ClvPag.Value] = ALValorParametrosInternos;
                        Session["assembly" + Session.SessionID + HF_ClvPag.Value] = instance.AssemblyQualifiedName;
                        RadAjaxManager1.ResponseScripts.Add("AbrirReporteCve('" + HF_ClvPag.Value + "');");
                    }
                    else
                    {
                        ImprimirXLS(ALValorParametrosInternos, instance);
                    }
                }
                else
                {
                    Alerta("No tiene permiso para imprimir");
                }
            }
            catch (Exception ex)
            {
                ErrorManager(ex, new System.Diagnostics.StackTrace().GetFrame(0).GetMethod().Name);
            }
        }