Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {



            String n_solicitud = Request.QueryString["n_solicitud"];
            String c_uniNeg = Request.QueryString["c_unidadNeg"];

            lbl_n_requisicion.Text = n_solicitud;
            solSolicitudesBO objsolSolicitudesBO = new solSolicitudesBO();
            solSolicitudes objsolSolicitudes = new solSolicitudes();
            objsolSolicitudes.N_solicitud = int.Parse(n_solicitud);
            objsolSolicitudes.C_tipo = "VIA";
            objsolSolicitudes.C_unidadNeg = c_uniNeg;

            objsolSolicitudes = objsolSolicitudesBO.Retrieve(objsolSolicitudes);

            list_empleados.Text = objsolSolicitudes.D_emp_solicita_JDE;
            txt_f_inicio_sol.Text = objsolSolicitudes.F_inicio_via;
            txt_f_fin_sol.Text = objsolSolicitudes.F_fin_via;
            txt_d_referencias_sugeridas.Text = objsolSolicitudes.D_lugar_via;
            txt_objeto.Text = objsolSolicitudes.D_solicitud;
            TxtNumeroUnidad.Text = objsolSolicitudes.C_num_unidad;
            List_vehiculos.SelectedValue = objsolSolicitudes.C_req_vehi;

            List_UniNeg.Text = objsolSolicitudes.D_unidadNeg;



            String idEmpleadoJDE = objsolSolicitudes.C_emp_solicita_JDE;
            empleadosBO MyEmpleado = new empleadosBO();
            empleado MyEmpleadoE = new empleado();
            MyEmpleadoE.IdlibretaDir = int.Parse(idEmpleadoJDE);
            MyEmpleadoE = MyEmpleado.Retrievex_idlibretaDir(MyEmpleadoE);
            lbl_d_gerencia.Text = MyEmpleadoE.Gerencia;
            lbl_d_autorizador.Text = MyEmpleadoE.Autorizador;
            lbl_id_empAutoriza.Text = MyEmpleadoE.IdAutorizador.ToString();
            lbl_idgerencia.Text = MyEmpleadoE.IdGerencia;

            //********** para buscar que compania tiene asignada **********

            NegocioCapitalHumano negocio = new NegocioCapitalHumano();
            List<Employee> listaEmpleados = negocio.ListaEmpleados(idEmpleadoJDE, "%", "%", "%", "%", "%", "%", "%", "%", "%", "%", Convert.ToDateTime("01/Jan/1950"), Convert.ToDateTime("01/Jan/9999"));
            string nombrecompania = "";
            if (listaEmpleados == null)
            {
                nombrecompania = "No tiene asignada Compania / o este es Ex-Empleado ";
            }
            else
            {
                nombrecompania = listaEmpleados[0].CompañiaJde.ToString();
                if (nombrecompania == "")
                {
                    nombrecompania = "No tiene asignada Compania / o este es Ex-Empleado";
                }
            }
            TextNombreEmpresa.Text = nombrecompania;
            // solSolicitudes objsolSolicitudes = new solSolicitudes();
            objsolSolicitudes.C_compania = TextNombreEmpresa.Text;

            unidadNegBO MyCompaniaDO = new unidadNegBO();
            solSolicitudes MySol = new solSolicitudes();
            MySol = MyCompaniaDO.BuscaCompania(objsolSolicitudes);
            TextRFC.Text = MySol.C_companiaRFC;
            TextDireccion.Text = MySol.C_companiaDir;
            TextIdEmpresa.Text = MySol.C_idcompania;


            //empleadosBO MyEmpleado = new empleadosBO();




            //Request.QueryString
            //Request.QueryString("n_contrato")

            //String Cadena = Request.QueryString["n_requisicion"];
            ////String Cadena = lbl_n_requisicion.Text;
            //if (Cadena == null || Cadena == "")
            //{
            //    Cadena = "0";
            //}
            //lbl_n_requisicion.Text = Cadena;


            //empleadosBO MyEmpleado = new empleadosBO();

            //if (IsCallback)
            //{ 

            //}

            if (!this.IsPostBack)
            {
                //String strEmpleado = list_empleados.SelectedValue.ToString();
            //usuarioOracleDO MyUsuarioDO = new usuarioOracleDO();
           
            //list_empleados.DataSource = MyEmpleado.BuscaEmpleados();
            //list_empleados.DataValueField = "ABAN8";
            //list_empleados.DataTextField = "ABALPH";
            //list_empleados.DataBind();

            //unidadNegBO MyUnidadNegDO = new unidadNegBO();
            //List_UniNeg.DataSource = MyUnidadNegDO.BuscaUnidadNeg();
            //List_UniNeg.DataValueField = "MCMCU";
            //List_UniNeg.DataTextField = "MCDC";
            //List_UniNeg.DataBind();


                
               
                ////int i = 0;
                ////i++;

                //// MyUsuarioDO.testConexion("Hola mundo");

                //DataSet conjunto = new DataSet();
                //dSolicitudesBO mydSolicitudesBO = new dSolicitudesBO();
                ////conjunto = (DataSet)mydSolicitudesBO.BuscaSolicitudes();

                ////adapter.Fill(set,"NombreTabla");
                //GView_Detalle.DataSourceID = null;
                //GView_Detalle.DataSource = mydSolicitudesBO.BuscaSolicitudes();
                //String[] valores = { "n_contrato", "n_requisicion", "n_partida" };
                //GView_Detalle.DataKeyNames = valores;
                ////GView_Detalle.DataMember = "NombreTabla";

                //GView_Detalle.DataBind();

                ////DataKeyNames="n_contrato,n_requisicion,n_partida" 
                ////DataSourceID="Data_Drequisicion"
                ////GView_Detalle.Refresh();

            }
            else
            {

                //if (lbl_n_requisicion.Text == "0" )
                //{

                //    String idEmpleadoJDE = list_empleados.SelectedValue.ToString();
                //    //empleadosBO MyEmpleado = new empleadosBO();
                //    empleado MyEmpleadoE = new empleado();
                //    MyEmpleadoE.IdlibretaDir = int.Parse(idEmpleadoJDE);
                //    MyEmpleadoE = MyEmpleado.Retrievex_idlibretaDir(MyEmpleadoE);
                //    lbl_d_gerencia.Text = MyEmpleadoE.Gerencia;
                //    lbl_d_autorizador.Text = MyEmpleadoE.Autorizador;
                //    lbl_id_empAutoriza.Text = MyEmpleadoE.IdAutorizador.ToString();
                //    lbl_idgerencia.Text = MyEmpleadoE.IdGerencia;
                
                //}
                
               





                //DataSet conjunto = new DataSet();
                //dSolicitudesBO mydSolicitudesBO = new dSolicitudesBO();
                ////conjunto = (DataSet)mydSolicitudesBO.BuscaSolicitudes();
                ////adapter.Fill(set,"NombreTabla");
                //GView_Detalle.DataSourceID = null;

                //GView_Detalle.DataSource = mydSolicitudesBO.BuscaSolicitudes(int.Parse(lbl_n_requisicion.Text));
                ////String[] valores = { "n_contrato", "n_requisicion", "n_partida" };
                ////GView_Detalle.DataKeyNames = valores;
                ////GView_Detalle.DataMember = "NombreTabla";

                //GView_Detalle.DataBind();

                ////DataKeyNames="n_contrato,n_requisicion,n_partida" 
                ////DataSourceID="Data_Drequisicion"
                ////GView_Detalle.Refresh();



            }
             




        }
Example #2
0
        protected void botonFinalizar_Click1(object sender, EventArgs e)
        {
            int bandera = 1;

            if ((etiquetaNoSolicitud.Text == "") || (etiquetaNoSolicitud.Text.Trim() == "0"))
            {
                MensajeErrorPartidas("Grabe el encabezado de la Solicitud, Verifique!");
                bandera = 0;
            }

            if ((bandera == 1) && (GView_Detalle.Rows.Count < 1))
            {
                MensajeErrorPartidas("No se ha capturado ninguna partida de viaticos, favor de capturar al menos un partida para finalizar al Solicitud");
                bandera = 0;
            }

            if (bandera == 1)
            {
                solSolicitudesBO MysolSolicitudesBO = new solSolicitudesBO();
                solSolicitudes MysolSolicitudes = new solSolicitudes();

                MysolSolicitudes.N_solicitud = int.Parse(etiquetaNoSolicitud.Text);
                MysolSolicitudes.C_tipo = "VIA";
                MysolSolicitudes.C_unidadNeg = List_UniNeg.SelectedValue.ToString();
                MysolSolicitudesBO.grabarFinal(MysolSolicitudes);

                //Busco si tiene una partida o 2 si tiene 1 busco que tenga hospedaje o vuelo, si tiene 2 que los dos tenga hospedaje y vuelo para poner
                //estatus de autorizado
                int nolineas = 0;
                viaticos = new GastosViaje();
                LineaSolicitud Myp = new LineaSolicitud();
                Myp.Clave = int.Parse(etiquetaNoSolicitud.Text);
                List<LineaSolicitud> listaPartidas = viaticos.ObtenerPartidas(Myp);
                if (listaPartidas != null)
                {
                    nolineas = listaPartidas[0].Partida;
                }

                //Busco si tiene partida con Hospedaje para mandar correo a su AUTORIZADOR y [email protected]
                viaticos = new GastosViaje();
                var tipolinea = "0";
                var tipolineaConc = "0";
                var tipolineaVuelo = "0";
                var mensaje_correo = "";
                LineaSolicitud Mylinea = new LineaSolicitud();
                Mylinea.Clave = int.Parse(etiquetaNoSolicitud.Text);

                //Busco que tenga Hospedaje
                List<LineaSolicitud> listaSolicitudes = viaticos.ObtenerLineasHospedaje(Mylinea);
                if (listaSolicitudes != null)
                {
                    tipolinea = listaSolicitudes[0].ConceptoDescripcion;
                }
                // Busco que tenga Alimentos
                List<LineaSolicitud> listaLineaSolicitud = viaticos.ObtenerLineasAlimentos(Mylinea);
                if (listaLineaSolicitud != null)
                {
                    tipolineaConc = listaLineaSolicitud[0].ConceptoDescripcion;
                }

                // Busco que tenga Vuelos
                List<LineaSolicitud> listaLineaSolicitudV = viaticos.ObtenerLineasVuelos(Mylinea);
                if (listaLineaSolicitudV != null)
                {
                    tipolineaVuelo = listaLineaSolicitudV[0].ConceptoDescripcion;
                }


                if (nolineas == 1)
                {
                    if (tipolinea == "Hospedaje" || tipolineaConc == "ALIMENTOS POR VIATICOS" || tipolineaVuelo == "PASAJES AEREOS")
                    {
                        string connectionString1 = ConfigurationManager.ConnectionStrings["conexionAPPS"].ConnectionString;
                        //actualizo el estatus autorizado para que no pase autorizacion
                        using (SqlConnection cnx = new SqlConnection(connectionString1))
                        {
                            cnx.Open();
                            string query = " update  Sol_solicitudes set   " +
                                            " c_estado_sol = 'AUT',         " +
                                            " f_autoriza_sol = GETDATE()    " +
                                            " where n_solicitud = '" + etiquetaNoSolicitud.Text + "' and c_tipo='VIA' ";
                            SqlCommand cmd = new SqlCommand(query, cnx);
                            SqlDataReader dr = cmd.ExecuteReader();
                        }
                    }

                    //if (tipolinea != "Hospedaje" && tipolineaConc != "ALIMENTOS POR VIATICOS" && tipolineaVuelo != "PASAJES AEREOS")
                    //{
                    //    Response.Redirect("frmViaticos.aspx");
                    //}
                }

                if (nolineas == 2)
                {
                    if (tipolinea == "Hospedaje" && tipolineaConc == "ALIMENTOS POR VIATICOS" && tipolineaVuelo == "PASAJES AEREOS")
                    {
                        //actualizo el estatus autorizado para que no pase autorizacion
                        string connectionString2 = ConfigurationManager.ConnectionStrings["conexionAPPS"].ConnectionString;
                        using (SqlConnection cnx = new SqlConnection(connectionString2))
                        {
                            cnx.Open();
                            string query = " update  Sol_solicitudes set    " +
                                            " c_estado_sol = 'AUT',         " +
                                            " f_autoriza_sol = GETDATE()    " +
                                            " where n_solicitud = '" + etiquetaNoSolicitud.Text + "' and c_tipo='VIA' ";
                            SqlCommand cmd = new SqlCommand(query, cnx);
                            SqlDataReader dr = cmd.ExecuteReader();
                        }
                    }
                }

                //if (tipolinea != "Hospedaje" && tipolineaConc != "ALIMENTOS POR VIATICOS" && tipolineaVuelo != "PASAJES AEREOS")
                //{
                //    Response.Redirect("frmViaticos.aspx");
                //}


                //if (tipolinea == "Hospedaje" || tipolineaConc == "ALIMENTOS POR VIATICOS" || tipolineaVuelo == "PASAJES AEREOS")
                //{
                string connectionString3 = ConfigurationManager.ConnectionStrings["conexionAPPS"].ConnectionString;

                //-==================================== ENVIA CORREO AUTORIZADOR y GESTOR ==============================
                string mensaje1 = " <table class=style1 font-family=calibri> " +
                                  " <tr><td colspan=8 align=center><strong>   SOLICITUD DE VIATICOS  </strong></td></tr> " +
                                  " <tr>  " +
                                  " <td style=background-color: #C0C0C0 >  " +
                                  " <strong>NO VIATICO</strong></td>       " +
                                  " <td style=background-color: #C0C0C0>   " +
                                  " <strong>FECHA DE PARTIDA</strong></td> " +
                                  " <td style=background-color: #C0C0C0>   " +
                                  " <strong>FECHA DE REGRESO</strong></td> " +
                                  " <td style=background-color: #C0C0C0>   " +
                                  " <strong>SOLICITANTE</strong></td>      " +
                                  " <td style=background-color: #C0C0C0>   " +
                                  " <strong>DESTINO</strong></td>          " +
                                  " <td style=background-color: #C0C0C0>   " +
                                  " <strong>UNIDAD NEGOCIO</strong></td>   " +
                                  " <td style=background-color: #C0C0C0>   " +

                                  " </tr> " +
                                  " <tr>  " +
                                       "  <td> " + MysolSolicitudes.N_solicitud + " </td> " +
                                       "  <td> " + txt_f_inicio_sol.Text + " </td> " +
                                       "  <td> " + txt_f_fin_sol.Text + " </td> " +
                                       "  <td> " + list_empleados.SelectedItem.Text.Trim() + " </td> " +
                                       "  <td> " + txt_d_referencias_sugeridas.Text + " </td> " +
                                       "  <td> " + List_UniNeg.SelectedItem.Text.Trim() + " </td> " +  //MysolSolicitudes.C_unidadNeg
                                 "  </tr> </table>";


                string mensaje_enc_detalle = "<br>  <table class=style1 font-family='calibri'> " +
                  " <tr><td colspan='5' align='center'><strong>   DETALLE  </strong></td></tr> " +
                  " <tr> " +
                      " <td style=background-color: #C0C0C0> " +
                          " <strong>SOLICITUD</strong></td> " +
                      " <td style=background-color: #C0C0C0> " +
                          " <strong>PARTIDA</strong></td> " +
                      " <td style=background-color: #C0C0C0> " +
                          " <strong>TOTAL</strong></td> " +
                      " <td style=background-color: #C0C0C0> " +
                          " <strong>DESCRIPCION </strong></td> " +
                      //" <td style=background-color: #C0C0C0> " +
                      //    " <strong>CONCEPTO </strong></td> " +
                      " <td style=background-color: #C0C0C0> " +
                          " <strong>ESTATUS</strong></td> " +

                  " </tr> ";

                string mensaje_detalle_partidas = "";
                using (SqlConnection cnxdet = new SqlConnection(connectionString3))
                {
                    cnxdet.Open();
                    string query = " SELECT  c_tipo, n_solicitud, n_partida, n_total, d_concepto_via,  c_unidadNeg, f_autoriza, " +
                                   " CASE   WHEN dSol_solicitudes.n_concepto_via = 'GPA' then 'PASAJES AEREOS' " +
                                   "        WHEN dSol_solicitudes.n_concepto_via = 'ALMV' then 'ALIMENTOS POR VIATICOS' " +
                                   "        WHEN dSol_solicitudes.n_concepto_via = 'HTL' then 'Hospedaje' " +
                                   " ELSE n_concepto_via " +
                                   " END as conceptoDescripcion, " +
                                   " CASE WHEN dSol_solicitudes.n_concepto_via = 'GPA' then 'PRE-AUTORIZADOS' " +
                                   "      WHEN dSol_solicitudes.n_concepto_via = 'HTL' then 'PRE-AUTORIZADOS' " +
                                   " ELSE 'POR AUTORIZAR' " +
                                   " END as estatus " +
                                   " FROM dSol_solicitudes " +
                                   " WHERE c_tipo = 'VIA'  and  n_solicitud = '" + etiquetaNoSolicitud.Text + "' and c_tipo='VIA' ";
                    SqlCommand cmd = new SqlCommand(query, cnxdet);
                    SqlDataReader dr = cmd.ExecuteReader();
                    if (dr.HasRows)
                    {
                        while (dr.Read())
                        {
                            // mensaje_detalle_partidas = dr["c_tipo"].ToString();
                            mensaje_detalle_partidas = mensaje_detalle_partidas + " <tr> <td> " + dr["n_solicitud"].ToString() + " </td> " +
                                         " <td> " + dr["n_partida"].ToString() + " </td> " +
                                         " <td> " + dr["n_total"].ToString() + " </td> " +
                                         " <td> " + dr["d_concepto_via"].ToString() + " </td> " +
                                         //" <td> " + dr["conceptoDescripcion"].ToString() + " </td> " +
                                         " <td> " + dr["estatus"].ToString() + " </td> ";
                            //" <td align='center'> " + dr["c_unidadNeg"].ToString() + " </td> </tr>";
                        }
                    }
                }



                if (tipolinea == "Hospedaje" || tipolineaConc == "ALIMENTOS POR VIATICOS" || tipolineaVuelo == "PASAJES AEREOS")
                {
                    var nota = "Si no esta de acuerdo con los gastos pre-autorizados, favor de de comunicarse inmediatamente con el gestor de viajes [email protected] </p>";
                    mensaje_correo = mensaje1 + mensaje_enc_detalle + mensaje_detalle_partidas + " </table> <br> <p>" + nota;
                }
                else
                {
                    mensaje_correo = mensaje1 + mensaje_enc_detalle + mensaje_detalle_partidas + " </table> <br> <p>";
                }

                string noempleado_solicitante = list_empleados.SelectedValue.ToString();
                var JefeInmediato_nombre = "0";
                var JefeInmediato_no = "0";

                //List<Employee> listaEmpleados3 = capitalHumano.ListaPersonaName(noempleado_solicitante);

                this.capitalHumano = new RecursosHumanos();

                List<Employee> listaEmpleados2 = capitalHumano.ListaPersona(noempleado_solicitante);
                if (listaEmpleados2 != null)
                {
                    // JefeInmediato_nombre = listaEmpleados2[0].SupervisorName.ToString();
                    JefeInmediato_no = listaEmpleados2[0].Supervisor.ToString();
                }
                else
                {
                    JefeInmediato_no = "0";
                    etiquetaMensajeError.Text = capitalHumano.Log + " / o No se encuentra actualizado su Jefe en BD, consulte con Capital Humano";
                }

                if (JefeInmediato_no != "0")
                {

                    List<Employee> listaEmpleados3 = capitalHumano.ListaPersonaName(JefeInmediato_no);
                    if (listaEmpleados3 != null)
                    {
                        JefeInmediato_nombre = listaEmpleados3[0].SupervisorName.ToString();
                        JefeInmediato_no = listaEmpleados3[0].SupervisorNoemp.ToString();
                    }
                    else
                    {
                        // MensajeError(capitalHumano.Log + " / o No se encuentra actualizado su Jefe en BD, consulte con Capital Humano");
                        etiquetaMensajeError.Text = capitalHumano.Log + " / o No se encuentra actualizado su Jefe en BD, consulte con Capital Humano";
                        return;
                    }
                }

                if (tipolineaConc == "ALIMENTOS POR VIATICOS") //autorizador
                {
                    JefeInmediato_no = lbl_id_empAutoriza.Text;
                }

                string email1 = "";
                string email_aut = "";
                usuario myUsuario = new usuario();
                usuarioBO myUsuarioBO = new usuarioBO();
                // para obtener correo de Jefe inmediato
                if (JefeInmediato_no != "0")
                {
                    myUsuario.Usr_id_JDE_AB = JefeInmediato_no;
                    myUsuario = myUsuarioBO.RetrievexJDE_AD(myUsuario);
                    email1 = myUsuario.Correo;
                }

                // para obtener correo de Autorizdor
                if (lbl_id_empAutoriza.Text != "")
                {
                    myUsuario.Usr_id_JDE_AB = lbl_id_empAutoriza.Text;
                    myUsuario = myUsuarioBO.RetrievexJDE_AD(myUsuario);
                    email_aut = myUsuario.Correo;
                }

                //string email1 = "";
                //using (SqlConnection cnx = new SqlConnection(connectionString3))
                //{
                //    cnx.Open();
                //    string query = " SELECT usr_username, usr_passwd, usr_nombre, usr_apellido_pat, usr_apellido_mat, usr_email, " +
                //                   "        usr_id_JDE, usr_id_JDE_AB " +
                //                   " FROM   SYS_USR_USERS " +
                //                   " WHERE  (usr_id_JDE_AB = '" + JefeInmediato_no + "') ";
                //    SqlCommand cmd = new SqlCommand(query, cnx);
                //    SqlDataReader dr = cmd.ExecuteReader();
                //    if (dr.HasRows)
                //    {
                //        while (dr.Read())
                //        {
                //            email1 = dr["usr_email"].ToString();
                //        }
                //    }
                //}

                string listaemail = "";

                if (tipolinea == "Hospedaje" || tipolineaVuelo == "PASAJES AEREOS")
                {
                    if (email1 == "")
                    {
                          listaemail = "[email protected], [email protected]"; 
                       // listaemail = "*****@*****.**";
                    }
                    listaemail = email1 + ", [email protected], [email protected]";
                    //listaemail = "*****@*****.**";
                }

                if (tipolineaConc == "ALIMENTOS POR VIATICOS")
                {
                    if (email1 == "")
                    {
                        listaemail = " [email protected]";
                    }
                     listaemail = email1 + ", [email protected]";
                    //listaemail = "*****@*****.**";
                }

                if (tipolinea != "Hospedaje" && tipolineaConc != "ALIMENTOS POR VIATICOS" && tipolineaVuelo != "PASAJES AEREOS")
                {
                    if (email1 == "")
                    {
                        listaemail = " [email protected]";
                    }
                     listaemail = email1 + ", [email protected]";
                    //listaemail = "*****@*****.**";
                }

                //envio el correo dependiendo si es hospedaje a jefe inmediato y gestor de viajes / alimentos solo autorizador
                correoDO enviarCorreo = new correoDO();
                // enviarCorreo.EnviaMail("ALTA DE SOLICITUD DE VIATICOS", mensaje1, listaemail);
               // mensaje_correo = mensaje_correo + " <br> Correo a enviar: " + email1 + " Autorizador: " + lbl_id_empAutoriza.Text + "Nombre: " + lbl_d_autorizador.Text + "correo autorizador:" + email_aut;
                enviarCorreo.EnviaMail("ALTA DE SOLICITUD DE VIATICOS", mensaje_correo, listaemail);

                Response.Redirect("frmViaticos.aspx");
                //}
                //else
                //{
                //    Response.Redirect("frmViaticos.aspx");
                //}


            }
        }
Example #3
0
        // **** Eventos en Cabecera **** //
        protected void Click_BotonGuardarEnc(object sender, EventArgs e)
        {
            MensajeError(string.Empty);
            MensajeExito(string.Empty);

            int graba = 1;

            if (graba == 1 && this.list_empleados.SelectedValue.ToString() == "0")
            {
                MensajeError("Seleccione el Empleado que viajara");
                graba = 0;
            }

            if (graba == 1 && this.txt_f_inicio_sol.Text.ToString() == string.Empty)
            {
                MensajeError("Indique la fecha en la que viajara (Fecha de partida)");
                graba = 0;
            }
            if (graba == 1 && this.txt_f_fin_sol.Text.ToString() == "")
            {
                MensajeError("Capture la fecha en la que estara de vuelta (Fecha de regreso)");
                graba = 0;
            }

            if (graba == 1 && this.List_UniNeg.SelectedValue.ToString() == "00")
            {
                MensajeError("Capture la Unidad de Negocio");
                graba = 0;
            }

            if (graba == 1 && this.txt_d_referencias_sugeridas.Text.ToString() == "")
            {
                MensajeError("Capture la ciudad a la que viajara");
                graba = 0;
            }

            if (graba == 1 && this.txt_objeto.Text.ToString() == "")
            {
                MensajeError("Capture el proposito del viaje viaticos");
                graba = 0;
            }

            if (graba == 1 && this.List_vehiculos.SelectedValue.ToString() == "00")
            {
                MensajeError("Indique si necesitara vehiculo por parte de la empresa");
                graba = 0;
            }

            if (this.TextIdEmpresa.Text.ToString() == "" || this.TextIdEmpresa.Text.ToString() == null)
            {
                //MensajeError("Indique si necesitara vehiculo por parte de la empresa");
                TextIdEmpresa.Text = "0";
            }

            if (graba == 1)
            {
                DesahabilitarControles();

                solSolicitudesBO objsolSolicitudesBO = new solSolicitudesBO();
                solSolicitudes objsolSolicitudes = new solSolicitudes();

                objsolSolicitudes.C_tipo = "VIA";
                objsolSolicitudes.C_unidadNeg = this.List_UniNeg.SelectedValue.ToString();
                objsolSolicitudes.D_solicitud = txt_objeto.Text;
                objsolSolicitudes.C_estado_sol = "CAP";

                String usuario = Session["Username"].ToString();
                objsolSolicitudes.C_user_captura = usuario.ToUpper();

                objsolSolicitudes.F_solicitud = DateTime.Now.Day + "/" + DateTime.Now.Month + "/" + DateTime.Now.Year;
                objsolSolicitudes.C_emp_solicita_JDE = list_empleados.SelectedValue.ToString();
                objsolSolicitudes.C_emp_autoriza_JDE = lbl_id_empAutoriza.Text;
                objsolSolicitudes.I_importe_total = 0;
                objsolSolicitudes.F_inicio_via = txt_f_inicio_sol.Text;
                objsolSolicitudes.F_fin_via = txt_f_fin_sol.Text;
                objsolSolicitudes.D_lugar_via = txt_d_referencias_sugeridas.Text;
                objsolSolicitudes.C_req_vehi = this.List_vehiculos.SelectedValue.ToString();
                objsolSolicitudes.C_num_unidad = this.TxtNumeroUnidad.Text;

                secuSolBO MysecuSolBO = new secuSolBO();
                secuSol MysecuSol = new secuSol();
                MysecuSol = MysecuSolBO.RetrieveViaticos(MysecuSol);
                MysecuSol.n_secuencia = MysecuSol.n_secuencia + 1;

                objsolSolicitudes.N_solicitud = MysecuSol.n_secuencia;

                objsolSolicitudes.D_unidadNeg = this.List_UniNeg.SelectedItem.Text.Trim();
                objsolSolicitudes.D_emp_solicita_JDE = list_empleados.SelectedItem.Text.Trim();
                objsolSolicitudes.D_emp_autoriza_JDE = lbl_d_autorizador.Text.Trim();

                objsolSolicitudes.C_idcompania = TextIdEmpresa.Text.Trim();

                objsolSolicitudesBO.graba(objsolSolicitudes);
                MysecuSolBO.Save(MysecuSol);

                etiquetaNoSolicitud.Text = MysecuSol.n_secuencia.ToString();
                //list_empleados.DataBind();

                // Oculta la Cabecera

                // Muestra panel de lineas
                panelCabecera.CssClass = "da-panel collapsible collapsed";
                panelPartidas.Visible = true;
                MensajeExitoPartidas("Proceda a Capturar las partidas que conforman la Solicitud..");
            }
        }
Example #4
0
        protected void List_c_cta_contable_SelectedIndexChanged(object sender, EventArgs e)
        {
            GridViewRow gvr;
            DropDownList CmbCOncepto = (DropDownList)sender;
            String StrCuenta = CmbCOncepto.SelectedValue;
            String StrEmpleadoViat;

            StrEmpleadoViat = list_empleados.SelectedValue;
            //StrEmpleadoViat = lbl_c_empleado.Text;

            System.DateTime Dt1;
            System.DateTime Dt2;
            int dias;


            int bandera = 1;

            if ((etiquetaNoSolicitud.Text == "") || (etiquetaNoSolicitud.Text.Trim() == "0"))
            {
                MensajeError("Grabe el encabezado de la Solicitud, Verifique!");
                bandera = 0;
            }

            idviatico.Text = etiquetaNoSolicitud.Text;
            idviatico2.Text = etiquetaNoSolicitud.Text;

            if (StrCuenta == "HTL")  //para cuando selecciona Gastos de Hotel
            {
                ClientScript.RegisterStartupScript(this.GetType(), "myScript", "PrepararComponentes();", true);
            }

            if (StrCuenta == "GPA")  //para cuando selecciona PASAJES AEREOS
            {
                ClientScript.RegisterStartupScript(this.GetType(), "myScript", "PrepararComponentes2();", true);
            }

            if (bandera == 1)
            {
                if (String.IsNullOrEmpty(txt_f_inicio_sol.Text) == false && String.IsNullOrEmpty(txt_f_fin_sol.Text) == false)
                {
                    Dt1 = DateTime.ParseExact(txt_f_inicio_sol.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture);
                    Dt2 = DateTime.ParseExact(txt_f_fin_sol.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture);
                    //dias =  DateDiff(DateInterval.Day, Dt1, Dt2) + 1
                    dias = (int)(Dt2 - Dt1).TotalDays + 1;


                    if (GView_Detalle.Rows.Count == 0)
                    {
                        TextBox txt_q_requeridoNO;
                        TextBox txt_d_materialNO;
                        //Dim emptyRow As  = GView_Detalle.Controls(0).Controls(0)
                        GridViewRow emptyRow = (GridViewRow)GView_Detalle.Controls[0].Controls[0];
                        txt_q_requeridoNO = (TextBox)(emptyRow.FindControl("txt_q_requeridoNO"));
                        txt_d_materialNO = (TextBox)(emptyRow.FindControl("txt_d_materialNO"));

                        Double monto1Tmp;
                        Double Monto;

                        //--------------------------------------------------------------------------------
                        empleadosBO MyEmpleado = new empleadosBO();
                        String idEmpleadoJDE = list_empleados.SelectedValue.ToString();
                        //empleadosBO MyEmpleado = new empleadosBO();
                        empleado MyEmpleadoE = new empleado();
                        MyEmpleadoE.IdlibretaDir = int.Parse(idEmpleadoJDE);
                        MyEmpleadoE = MyEmpleado.Retrievex_idlibretaDir(MyEmpleadoE);

                        solSolicitudesBO MydSolicitudesBO = new solSolicitudesBO();
                        solSolicitudes MydSolicitudes = new solSolicitudes();
                        MydSolicitudes.N_solicitud = int.Parse(etiquetaNoSolicitud.Text);
                        MydSolicitudes.C_tipo = "VIA";
                        MydSolicitudes.C_unidadNeg = List_UniNeg.SelectedValue;
                        MydSolicitudes = MydSolicitudesBO.Retrieve(MydSolicitudes);

                        //MydSolicitudes.C_emp_solicita_JDE
                        empleado empBusGer = new empleado();
                        empleadosBO empBusGerBO = new empleadosBO();
                        empBusGer.IdlibretaDir = int.Parse(MydSolicitudes.C_emp_solicita_JDE);
                        empBusGer = empBusGerBO.Retrievex_idlibretaDir(empBusGer);

                        //--------------------------------------------------------------------------------

                        grupoBO mygrupoBO = new grupoBO();
                        monto1Tmp = mygrupoBO.BuscaGruposPolitica(empBusGer.IdGerencia, StrCuenta);

                        if (monto1Tmp > 0.0)
                        {
                            //B = CDbl(Val(Campo5)) '// Val do hard work
                            Monto = monto1Tmp * dias;
                            txt_q_requeridoNO.Text = Monto.ToString();
                            txt_q_requeridoNO.ReadOnly = true;
                            txt_q_requeridoNO.Enabled = false;
                            txt_q_requeridoNO.BackColor = System.Drawing.Color.LightGray;

                            if (StrCuenta == "HTL" || StrCuenta == "GPA")  //para cuando selecciona Gastos de Hotel y Pasajes aeros
                            {
                                if (txt_q_requeridoNO.Text == "")
                                {
                                    txt_q_requeridoNO.Text = "0";
                                    txt_d_materialNO.Text = "-";
                                }
                            }
                        }
                        else
                        {
                            txt_q_requeridoNO.ReadOnly = false;
                            txt_q_requeridoNO.Enabled = true;
                            txt_q_requeridoNO.BackColor = System.Drawing.Color.White;
                            txt_q_requeridoNO.Text = "";

                            if (StrCuenta == "HTL" || StrCuenta == "GPA")  //para cuando selecciona Gastos de Hotel y Pasajes aeros
                            {
                                if (txt_q_requeridoNO.Text == "")
                                {
                                    txt_q_requeridoNO.Text = "0";
                                    txt_d_materialNO.Text = "-";
                                }
                            }
                        }

                    }
                    else
                    {

                        TextBox txt_q_requeridoNO;
                        TextBox txt_d_materialNO;
                        GridViewRow emptyRow = (GridViewRow)GView_Detalle.FooterRow;
                        txt_q_requeridoNO = (TextBox)(emptyRow.FindControl("txt_q_requerido"));
                        txt_d_materialNO = (TextBox)(emptyRow.FindControl("txt_d_materialNO"));

                        Double monto1Tmp;
                        Double Monto;

                        grupoBO mygrupoBO = new grupoBO();
                        monto1Tmp = mygrupoBO.BuscaGruposPolitica(lbl_idgerencia.Text, StrCuenta);

                        if (monto1Tmp > 0.0)
                        {
                            //B = CDbl(Val(Campo5)) '// Val do hard work
                            Monto = monto1Tmp * dias;
                            txt_q_requeridoNO.Text = Monto.ToString();
                            txt_q_requeridoNO.ReadOnly = true;
                            txt_q_requeridoNO.Enabled = false;
                            txt_q_requeridoNO.BackColor = System.Drawing.Color.LightGray;

                            if (StrCuenta == "HTL" || StrCuenta == "GPA")  //para cuando selecciona Gastos de Hotel y Pasajes aeros
                            {
                                if (txt_q_requeridoNO.Text == "")
                                {
                                    txt_q_requeridoNO.Text = "0";
                                    txt_d_materialNO.Text = "-";
                                }
                            }
                        }
                        else
                        {
                            //TextBox txt_d_materialNO2;
                            //txt_d_materialNO2 = (TextBox)(emptyRow.FindControl("txt_d_materialNO"));

                            txt_q_requeridoNO.ReadOnly = false;
                            txt_q_requeridoNO.Enabled = true;
                            txt_q_requeridoNO.BackColor = System.Drawing.Color.White;
                            txt_q_requeridoNO.Text = "";
                            if (StrCuenta == "HTL" || StrCuenta == "GPA")  //para cuando selecciona Gastos de Hotel y Pasajes aeros
                            {
                                if (txt_q_requeridoNO.Text == "")
                                {
                                    txt_q_requeridoNO.Text = "0";
                                    //  txt_d_materialNO.Text = "-";
                                }
                            }
                        }

                    }
                }
            }
        }
Example #5
0
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {

            //DropDownList drdList;
            //drdList = (DropDownList)(GridView1.Rows[e.RowIndex].Cells[10].FindControl("List_status"));
            //String n_solicitud = GridView1.DataKeys[e.RowIndex]["n_solicitud"].ToString();

            //solSolicitudesBO mysolSolicitudesBO = new solSolicitudesBO();
            //mysolSolicitudesBO.grabarStatus(n_solicitud,drdList.Text );



            DropDownList drdList;
            drdList = (DropDownList)(GridView1.Rows[e.RowIndex].Cells[10].FindControl("List_status"));
            String n_solicitud = GridView1.DataKeys[e.RowIndex]["n_solicitud"].ToString();

            String c_tipo = GridView1.DataKeys[e.RowIndex]["c_tipo"].ToString();
            String c_unidadNeg = GridView1.DataKeys[e.RowIndex]["c_unidadNeg"].ToString();

            solSolicitudesBO mysolSolicitudesBO = new solSolicitudesBO();
            mysolSolicitudesBO.grabarStatus(n_solicitud, drdList.Text, c_tipo, c_unidadNeg);




            //mySqlCommand.Parameters.Add("@order_id", SqlDbType.Int).Value = Convert.ToInt32(GridView1.DataKeys[e.RowIndex]["order_id"]);  
            //String n_solicitud = GridView1.Rows[e.RowIndex].Cells[1].Text;
            //TableCell  celda = GridView1.Rows[e.RowIndex].Cells[1];
            //celda.
            //String n_solicitud2 = GridView1.SelectedRow.Cells[1].Text;

            int i;
            i = 1;
            i = i+1;


            //// string variable to store the connection string  
            //// defined in appsettings section of web.config file.  
            //string connStr = ConfigurationManager.ConnectionStrings["ConStr"].ConnectionString;
            //// object created for SqlConnection Class.  
            //SqlConnection mySQLconnection = new SqlConnection(connStr);
            //// if condition that can be used to check the sql connection  
            //// whether it is already open or not.  
            //if (mySQLconnection.State == ConnectionState.Closed)
            //{
            //    mySQLconnection.Open();
            //}
            //// SQL Command object to pass the SQL query for updating the data of tbl_orders table.  
            //SqlCommand mySqlCommand = new SqlCommand("update tbl_orders set order_status_id=@order_status_id where order_id=@order_id", mySQLconnection);
            
            //// SQL command input parameter to set the new value for order_status_id  
            //mySqlCommand.Parameters.Add("@order_status_id", SqlDbType.Int).Value = drdList.SelectedValue;
            //// SQL command input parameter as order_id whose corresponding value for order_status_id is to be set  
            //mySqlCommand.Parameters.Add("@order_id", SqlDbType.Int).Value = Convert.ToInt32(GridView1.DataKeys[e.RowIndex]["order_id"]);
            //// Execute the SQL query to update the tbl_orders  
            //mySqlCommand.ExecuteNonQuery();
            //// if condition that can be used to check the sql connection  
            //// if it is open then close it.  
            //if (mySQLconnection.State == ConnectionState.Open)
            //{
            //    mySQLconnection.Close();
            //}
            //GridView1.EditIndex = -1;
            //bindGridView();


        }