Exemple #1
0
        private void btnActualizar_Click(object sender, EventArgs e)
        {
            DbDataReader rsCampos;
            //TODO: Fix Mono
            StreamReader sr = new StreamReader(@"E:\programas\sueldos\archivos\SIJP200809.txt");
            string       linea;
            string       valorLeido;
            int          legajo;

            while ((linea = sr.ReadLine()) != null)
            {
                Console.WriteLine(linea);
                rsCampos = Model.DB.ejecutarDataReader(Model.TipoComando.SP, "tablasConsultarFormatosExportacion", "@tabla", "sijp");

                legajo = ConsultaEmpleados.consultarLegajoEmpleado(linea.Substring(0, 11));
                while (rsCampos.Read())
                {
                    valorLeido = linea.Substring(Convert.ToInt32(rsCampos["posicion"]) - 1, Convert.ToInt32(rsCampos["longitud"]));
                    Console.WriteLine(valorLeido);
                    if (Convert.ToInt32(rsCampos["posicion"]) == 1)
                    {
                        Model.DB.ejecutarProceso(Model.TipoComando.SP, "empleadosSueldosActualizar", "@legajo", legajo, "@codigo", 18, "@valor", valorLeido);
                    }
                    if (Convert.ToInt32(rsCampos["posicion"]) == 45)
                    {
                        Model.DB.ejecutarProceso(Model.TipoComando.SP, "empleadosSueldosActualizar", "@legajo", legajo, "@codigo", 60, "@valor", Convert.ToInt32(valorLeido));
                    }
                    if (Convert.ToInt32(rsCampos["posicion"]) == 47)
                    {
                        Model.DB.ejecutarProceso(Model.TipoComando.SP, "empleadosSueldosActualizar", "@legajo", legajo, "@codigo", 61, "@valor", Convert.ToInt32(valorLeido));
                    }
                    if (Convert.ToInt32(rsCampos["posicion"]) == 49)
                    {
                        Model.DB.ejecutarProceso(Model.TipoComando.SP, "empleadosSueldosActualizar", "@legajo", legajo, "@codigo", 62, "@valor", Convert.ToInt32(valorLeido));
                    }
                    if (Convert.ToInt32(rsCampos["posicion"]) == 58)
                    {
                        Model.DB.ejecutarProceso(Model.TipoComando.SP, "empleadosSueldosActualizar", "@legajo", legajo, "@codigo", 63, "@valor", Convert.ToInt32(valorLeido));
                    }
                    if (Convert.ToInt32(rsCampos["posicion"]) == 61)
                    {
                        Model.DB.ejecutarProceso(Model.TipoComando.SP, "empleadosSueldosActualizar", "@legajo", legajo, "@codigo", 50, "@valor", Convert.ToInt32(valorLeido));
                    }
                    if (Convert.ToInt32(rsCampos["posicion"]) == 209 && Varios.IsNumeric(valorLeido))
                    {
                        Model.DB.ejecutarProceso(Model.TipoComando.SP, "empleadosSueldosActualizar", "@legajo", legajo, "@codigo", 64, "@valor", Convert.ToInt32(valorLeido));
                    }

                    //Console.WriteLine(linea.Substring(Convert.ToInt32(rsCampos["posicion"])-1, Convert.ToInt32(rsCampos["longitud"])));
                }
                rsCampos.Close();
            }
            sr.Close();
        }
Exemple #2
0
        private void procesaFichada(FichadaEntity fichada)
        {
            long segundosEntreFichada;

            fichada.Fecha = System.DateTime.Now.ToShortDateString();
            fichada.Hora  = System.DateTime.Now.Hour.ToString().PadLeft(2, '0') + ":" + System.DateTime.Now.Minute.ToString().PadLeft(2, '0') + ":" + System.DateTime.Now.Second.ToString().PadLeft(2, '0');

            //verifica tiempos entre fichadas y legajo repetido
            //si la fichada es del mismo legajo y está dentro de los 30 segundos se descarta.
            segundosEntreFichada = Varios.DateDiff(Varios.DateInterval.Second, this.ultimaFichada, Convert.ToDateTime(fichada.Hora));
            if (this.ultimoLegajo == fichada.Legajo && segundosEntreFichada < 30)
            {
                return;
            }
            this.ultimaFichada = Convert.ToDateTime(fichada.Hora);
            this.ultimoLegajo  = fichada.Legajo;

            labelUltimaFichadaHora.Text   = fichada.Hora;
            labelUltimaFichadaFecha.Text  = fichada.Fecha;
            labelUltimaFichadaLegajo.Text = fichada.Legajo.ToString();

            fichada.ApellidoYnombres = ConsultaEmpleados.consultarApellidoYnombres(fichada.Legajo);
            //ConsultaEmpleados.
            //Cargo datos fichada
            if (fichada.ApellidoYnombres != "SIN DATO")
            {
                fichada.Foto = ConsultaEmpleados.consultarFoto(fichada.Legajo);
                labelUltimaFichadaApellidoNombre.Text = fichada.ApellidoYnombres;
                if (fichada.Foto == "")
                {
                    pictureBoxUltimaFichadaFoto.Image = null;
                }
                else
                {
                    pictureBoxUltimaFichadaFoto.Image = Controles.cargarImagen(fichada.Foto);
                }
                //inserta en lista por arriba
                this.lstFichadas.Items.Insert(0, fichada.Fecha + "  " + fichada.Hora + "  " + fichada.Legajo.ToString().PadLeft(5, '0') + "  " + labelUltimaFichadaApellidoNombre.Text);
                //inserta registro en db.

                fichada.Reloj = consultaTablas.getById("reloj", 3, Program.idReloj);
                fichadasNegocio.Guardar(fichada);
                //  Model.DB.ejecutarProceso(Model.TipoComando.SP, "relojInsertarCaptura", "legajo", legajo, "fecha", fecha, "hora", hora, "idReloj", Program.idReloj);
            }
            else
            {
                labelUltimaFichadaApellidoNombre.Text = "!!!! ERROR !!!!";
                pictureBoxUltimaFichadaFoto.Image     = null;
            }

            //limpia campo
            this.textBoxStringTarjeta.Clear();
        }
        private void empleadosToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            ConsultaEmpleados ce = new ConsultaEmpleados();

            ce.Show();
        }
Exemple #4
0
        private void txtLegajo_TextChanged(object sender, EventArgs e)
        {
            TextBox tb;

            tb = (TextBox)sender;

            if (tb.Text.Length > 0 && Varios.IsNumeric(tb.Text))
            {
                this.barCode39[Convert.ToInt32(tb.Tag)].BarCode    = this.txtEmpresa.Text + tb.Text.PadLeft(5, '0');
                this.barCode39[Convert.ToInt32(tb.Tag)].HeaderText = Varios.Left(tb.Text.PadLeft(5, '0') + "_" + ConsultaEmpleados.consultarApellidoYnombres(Convert.ToInt32(this.txtLegajo[Convert.ToInt32(tb.Tag)].Text)), 28);
            }
        }
Exemple #5
0
        private void btnGenerarArchivo_Click(object sender, EventArgs e)
        {
            int          legajo         = 0;
            int          totalRegistros = 0;
            int          cantRegistros  = 0;
            string       contenido      = "";
            string       registro       = "";
            DbDataReader rsCampos;
            DbDataReader rsLegajos;

            totalRegistros         = (int)Model.DB.ejecutarScalar(Model.TipoComando.SP, "liquidacionesConsultarTotalLegajosParaCargas", "@anioMes", liqui.AnioMes);
            this.pbProceso.Minimum = 0;
            this.pbProceso.Maximum = totalRegistros;

            this.saveFileDialogCargas.Filter   = "Texto TXT (*.txt)|*.txt";
            this.saveFileDialogCargas.FileName = "SIJP";
            this.Refresh();

            if (saveFileDialogCargas.ShowDialog() == DialogResult.OK)
            {
                StreamWriter sw = new StreamWriter(this.saveFileDialogCargas.FileName);

                rsLegajos = Model.DB.ejecutarDataReader(Model.TipoComando.SP, "sijpConsultarLegajos", "@anioMes", liqui.AnioMes);
                while (rsLegajos.Read())  //para cada legajo recorro todos los campos definidos en tablas
                {
                    cantRegistros++;
                    if (cantRegistros <= pbProceso.Maximum)
                    {
                        this.pbProceso.Value = cantRegistros;
                    }

                    registro            = "";
                    legajo              = Convert.ToInt32(rsLegajos["legajo"]);
                    this.txtLegajo.Text = legajo.ToString();
                    this.txtLegajo.Refresh();

                    rsCampos = Model.DB.ejecutarDataReader(Model.TipoComando.SP, "tablasConsultarFormatosExportacion", "@tabla", "sijp");
                    while (rsCampos.Read())
                    {
                        //////campos explicitos para sijp//////
                        if (Convert.ToInt32(rsCampos["posicion"]) == 1)
                        {
                            contenido = CUIL.Limpiar(Model.DB.ejecutarScalar(Model.TipoComando.SP, "empleadosSueldosConsultarValorLegajo", "@legajo", legajo, "@codigo", 18).ToString());
                        }
                        else
                        {
                            if (Convert.ToInt32(rsCampos["posicion"]) == 12)
                            {///elimino caracteres especiales en el nombre por problemas en importacion
                                contenido = Varios.Left(ConsultaEmpleados.consultarApellidoYnombresConBajas(legajo), 30);
                                contenido = contenido.Replace('Ñ', 'N');
                                contenido = contenido.Replace('Á', 'A');
                                contenido = contenido.Replace('É', 'E');
                                contenido = contenido.Replace('Í', 'I');
                                contenido = contenido.Replace('Ó', 'O');
                                contenido = contenido.Replace('Ú', 'U');
                            }
                            else
                            {
                                contenido = Model.DB.ejecutarScalar(Model.TipoComando.SP, "sijpConsultarValorLegajo", "@anioMes", liqui.AnioMes, "legajo", legajo, "codigo", Convert.ToInt32(rsCampos["posicion"])).ToString();
                                //contenido = contenido.Replace('.', ',');
                            }
                        }

                        if (rsCampos["tipoCampo"].ToString() == "9")  //si es numerico completa con ceros.
                        {
                            registro = registro + contenido.PadLeft(Convert.ToInt32(rsCampos["longitud"]), '0');
                        }
                        else                                        //si es texto completa con espacios.
                        {
                            registro = registro + contenido.PadRight(Convert.ToInt32(rsCampos["longitud"]), ' ');
                        }
                    }
                    sw.WriteLine(registro);
                    Console.WriteLine(registro);

                    System.Windows.Forms.Application.DoEvents();
                }
                sw.Close();
                Model.DB.desconectarDB();

                this.pbProceso.Value = totalRegistros;
                MessageBox.Show("El archivo se generó con éxito.");
            }
        }