コード例 #1
0
        public string Modificar(int _id, DateTime fecha, decimal mayo, decimal prestamo, decimal almacen, decimal otros)
        {
            using (grupohie_nominaEntities db = new grupohie_nominaEntities())
            {
                var     resultado = db.resultados.Where(x => x.id == _id && x.fecha == fecha).FirstOrDefault();
                decimal total     = mayo + prestamo + almacen + otros;
                decimal totalD    = resultado.total_descuento2;
                decimal toF       = totalD + total;


                resultado.total_descuento2 = toF;

                decimal neto = resultado.neto_apagar2;

                resultado.neto_apagar3 = neto - toF - resultado.comida;

                resultado.san_mayo = mayo;
                resultado.prestamo = prestamo;
                resultado.desayuno = almacen;
                resultado.otros    = otros;


                db.SaveChanges();
            }
            return("Nomina Modificada Correctamente");
        }
コード例 #2
0
        public string Agregar(string nombre, string cedula, string direccion, string telefono, DateTime fechaN, string sucursal, string atrasP, string ocupacion, decimal sueldoB, decimal horasE, decimal seguroP, bool comida, DateTime fechaE, string fechaS, bool actual)
        {
            using (grupohie_nominaEntities db = new grupohie_nominaEntities())
            {
                empleados n = new empleados();
                n.nombre         = nombre;
                n.cedula         = cedula;
                n.direccion      = direccion;
                n.telefono       = telefono;
                n.fecha_nac      = fechaN;
                n.sucursal       = sucursal;
                n.parte_atras    = atrasP;
                n.ocupacion      = ocupacion;
                n.sueldo_bruto   = sueldoB;
                n.horas_extras   = horasE;
                n.seguro_privado = seguroP;
                n.san_mayo       = 0;
                n.comida         = comida;
                n.fecha_entrada  = fechaE;
                n.fecha_salida   = fechaS;
                n.actual         = actual;

                db.empleados.Add(n);
                db.SaveChanges();
            }



            return("Empleado Agregado Correctamente");
        }
コード例 #3
0
        private void ltbListado_SelectedIndexChanged(object sender, EventArgs e)
        {
            string nombre = ltbListado.SelectedItem.ToString();

            MessageBox.Show(nombre);
            using (grupohie_nominaEntities db = new grupohie_nominaEntities())
            {
                var resultado = db.resultados.Where(x => x.nombre == nombre).ToList();

                foreach (var i in resultado)
                {
                    txtnombreE.Text  = i.nombre;
                    txtcedula.Text   = i.cedula;
                    txtPrestamo.Text = i.prestamo.ToString();
                    txtOtros.Text    = i.otros.ToString();
                    txtAlmacen.Text  = i.desayuno.ToString();
                    txtmayo.Text     = i.san_mayo.ToString();
                    txtId.Text       = i.id.ToString();
                    txtsueldoB.Text  = i.sueldo_bruto.ToString();
                    txtExtra.Text    = i.horas_extras.ToString();
                    txtNombre.Text   = string.Empty;
                    ltbListado.Items.Clear();
                }
            }
        }
コード例 #4
0
 public string Eliminar(int _id)
 {
     using (grupohie_nominaEntities db = new grupohie_nominaEntities())
     {
         var resultado = db.empleados.Where(x => x.id == _id).FirstOrDefault();
         db.empleados.Remove(resultado);
         db.SaveChanges();
     }
     return("Empleado Eliminado correctamente");
 }
コード例 #5
0
        public string Generar(DateTime _fecha)
        {
            using (grupohie_nominaEntities db = new grupohie_nominaEntities())
            {
                var resul = db.empleados;

                resultados n = new resultados();
                decimal    comida;

                foreach (var i in resul)
                {
                    n.nombre       = i.nombre;
                    n.cedula       = i.cedula;
                    n.ocupacion    = i.ocupacion;
                    n.sucursal     = i.sucursal;
                    n.sucursal2    = i.parte_atras;
                    n.sueldo_bruto = i.sueldo_bruto / 2;
                    n.horas_extras = i.horas_extras / 2;
                    n.seguro       = i.seguro_privado;
                    n.san_mayo     = 0;
                    if (i.comida)
                    {
                        comida = 440;
                    }
                    else
                    {
                        comida = 0;
                    }
                    n.comida      = comida;
                    n.neto_apagar = (i.sueldo_bruto / 2) + (i.horas_extras / 2);
                    n.afp         = ((i.sueldo_bruto / 2) + (i.horas_extras / 2)) * Convert.ToDecimal(0.0287);
                    n.sfs         = ((i.sueldo_bruto / 2) + (i.horas_extras / 2)) * Convert.ToDecimal(0.0304);
                    n.isr         = 0;
                    decimal totalD = (((i.sueldo_bruto / 2) + (i.horas_extras / 2)) * Convert.ToDecimal(0.0287)) + (((i.sueldo_bruto / 2) + (i.horas_extras / 2)) * Convert.ToDecimal(0.0304)) + i.seguro_privado;
                    n.total_decuento = totalD;
                    decimal neto2 = ((i.sueldo_bruto / 2) + (i.horas_extras / 2)) - totalD;
                    n.neto_apagar2     = neto2;
                    n.prestamo         = 0;
                    n.desayuno         = 0;
                    n.otros            = 0;
                    n.total_descuento2 = 0;// i.san_mayo;
                    n.neto_apagar3     = neto2 - comida;
                    n.fecha            = _fecha;
                    using (grupohie_nominaEntities db2 = new grupohie_nominaEntities())
                    {
                        db2.resultados.Add(n);
                        db2.SaveChanges();
                    }
                }
            }

            return("Nomina Generada Correctamente");
        }
コード例 #6
0
        public bool login(string _nombre, string _clave)
        {
            int saber;

            using (grupohie_nominaEntities db = new grupohie_nominaEntities())
            {
                saber = db.usuarios.Where(i => i.usuario == _nombre.ToUpper() && i.clave == _clave.ToUpper()).Count();
            }
            if (saber <= 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
コード例 #7
0
        //EXISTE*********************************************************************************************************************************
        public bool existe(string _cedula)
        {
            int saber;

            using (grupohie_nominaEntities db = new grupohie_nominaEntities())
            {
                //var resultado = db.usuarios.OrderByDescending(i => i.id).FirstOrDefault().id ;
                saber = db.empleados.Where(i => i.cedula == _cedula).Count();
            }
            if (saber <= 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }

            //return saber2;
        }
コード例 #8
0
        //EXISTE*********************************************************************************************************************************
        public bool existe(string _sucursal, DateTime _fecha)
        {
            int saber;

            using (grupohie_nominaEntities db = new grupohie_nominaEntities())
            {
                //var resultado = db.usuarios.OrderByDescending(i => i.id).FirstOrDefault().id ;
                saber = db.resultados.Where(i => i.sucursal == _sucursal && i.fecha == _fecha).Count();
            }
            if (saber <= 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }

            //return saber2;
        }
コード例 #9
0
        private void txtNombre_TextChanged(object sender, EventArgs e)
        {
            string _nombre = txtNombre.Text;

            ltbListado.Items.Clear();


            if (_nombre != string.Empty)
            {
                using (grupohie_nominaEntities db = new grupohie_nominaEntities())
                {
                    var resultado = db.empleados.Where(x => x.nombre.Contains(_nombre)).ToList();


                    foreach (var p in resultado)
                    {
                        ltbListado.Items.Add(p.nombre);
                    }
                }
            }
        }
コード例 #10
0
 public string Modificar(int _id, string nombre, string direccion, string sucursal, string atrasP, string telefono, string ocupacion, decimal sueldoB, decimal horasE, decimal seguroP, bool comida, string fechaS, bool actual)
 {
     using (grupohie_nominaEntities db = new grupohie_nominaEntities())
     {
         var resultado = db.empleados.Where(x => x.id == _id).FirstOrDefault();
         resultado.nombre         = nombre;
         resultado.direccion      = direccion;
         resultado.telefono       = telefono;
         resultado.ocupacion      = ocupacion;
         resultado.sueldo_bruto   = sueldoB;
         resultado.horas_extras   = horasE;
         resultado.seguro_privado = seguroP;
         //resultado.san_mayo = san;
         resultado.comida       = comida;
         resultado.fecha_salida = fechaS;
         resultado.actual       = actual;
         resultado.sucursal     = sucursal;
         resultado.parte_atras  = atrasP;
         db.SaveChanges();
     }
     return("Empleado modificado correctamente");
 }
コード例 #11
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            string   _sucursal = cbosucursal.Text;
            DateTime _fecha    = dateTimePicker1.Value.Date;

            reporteCompleto s   = new reporteCompleto();
            reportes        frm = new reportes();

            if (s.existe(_sucursal, _fecha))
            {
                using (grupohie_nominaEntities db = new grupohie_nominaEntities())
                {
                    var resultados = db.resultados.Where(x => x.sucursal == _sucursal && x.sucursal2 == _sucursal && x.fecha == _fecha).ToList();
                    frm.resultadosBindingSource.DataSource = resultados;

                    frm.ShowDialog();
                }
            }
            else
            {
                MessageBox.Show("Esta Sucursal no tiene nada Generado Actualmente");
            }
        }
コード例 #12
0
        private void ltblistado_SelectedIndexChanged(object sender, EventArgs e)
        {
            string nombre = ltblistado.SelectedItem.ToString();

            using (grupohie_nominaEntities db = new grupohie_nominaEntities())
            {
                var resultado = db.empleados.Where(x => x.nombre == nombre).ToList();

                foreach (var i in resultado)
                {
                    txtId.Text        = i.id.ToString();
                    txtnombre.Text    = i.nombre;
                    txtdireccion.Text = i.direccion;
                    //txtmayo.Text = i.san_mayo.ToString();
                    txtocupacion.Text    = i.ocupacion;
                    txtseguro.Text       = i.seguro_privado.ToString();
                    txtsueldobruto.Text  = i.sueldo_bruto.ToString();
                    mkcedula.Text        = i.cedula;
                    mktelefono.Text      = i.telefono;
                    chkcomida.Checked    = i.comida;
                    cbosucursal.Text     = i.sucursal;
                    cboatras.Text        = i.parte_atras;
                    dpentrada.Value      = i.fecha_entrada;
                    dpnacimiento.Value   = i.fecha_nac;
                    mkSalida.Text        = i.fecha_salida;
                    txtextras.Text       = i.horas_extras.ToString();
                    txtId.Visible        = true;
                    lblId.Visible        = true;
                    btnAtras.Visible     = false;
                    btnCedula.Visible    = false;
                    btnComida.Visible    = false;
                    btnDireccion.Visible = false;
                    btnSueldoB.Visible   = false;
                    btnOcupacion.Visible = false;
                    btnHE.Visible        = false;
                    // btnSan.Visible = false ;
                    btnSeguro.Visible = false;
                    button1.Visible   = false;
                    btnnombre.Visible = false;
                    btnFechaS.Visible = false;

                    btneliminar.Enabled = true;
                    btneditar.Enabled   = true;

                    txtdireccion.Enabled = false;
                    txtextras.Enabled    = false;
                    //txtmayo.Enabled = false;
                    txtnombre.Enabled      = false;
                    txtocupacion.Enabled   = false;
                    txtseguro.Enabled      = false;
                    txtsueldobruto.Enabled = false;
                    mkcedula.Enabled       = false;
                    mktelefono.Enabled     = false;
                    cbosucursal.Enabled    = false;
                    cboatras.Enabled       = false;
                    chkcomida.Enabled      = false;;
                    dpentrada.Enabled      = false;
                    dpnacimiento.Enabled   = false;
                    mkSalida.Enabled       = false;
                    ltblistado.Items.Clear();
                }
            }
        }