private void MostrarDatosTitular(double cuil)
        {
            using (var context = new lts_sindicatoDataContext())
            {
                var DatosSocio = from a in context.maesoc.Where(x => x.MAESOC_CUIL == cuil) select a;

                if (DatosSocio.Count() > 0)
                {
                    var Datos = DatosSocio.SingleOrDefault();
                    //txt_NroSocio.Text = dgv_MostrarSocios.CurrentRow.Cells["numero_soc"].Value.ToString();// Datos.MAESOC_NROAFIL.ToString();
                    txt_NroSocio.Text        = dgv_MostrarSocios.CurrentRow.Cells["numero_soc"].Value.ToString();// Datos.MAESOC_NROAFIL.ToString();
                    txt_Estado.Text          = (context.soccen.Where(x => x.SOCCEN_CUIL == cuil).SingleOrDefault().SOCCEN_ESTADO == 1 ? "Socio Activo" : "No Socio");
                    txt_Nombre.Text          = dgv_MostrarSocios.CurrentRow.Cells["ayn"].Value.ToString();
                    txt_DNI.Text             = dgv_MostrarSocios.CurrentRow.Cells["dni_socio"].Value.ToString();
                    txt_CUIL.Text            = dgv_MostrarSocios.CurrentRow.Cells["CUIL"].Value.ToString();
                    txt_CUIT2.Text           = dgv_MostrarSocios.CurrentRow.Cells["CUIT_"].Value.ToString();
                    txt_EmpresaNombre.Text   = dgv_MostrarSocios.CurrentRow.Cells["socio_empresa"].Value.ToString();
                    txt_EstadoCivil.Text     = Datos.MAESOC_ESTCIV.ToString();
                    txt_Sexo.Text            = Datos.MAESOC_SEXO.ToString();
                    txt_FechaNacimiento.Text = Datos.MAESOC_FECHANAC.ToString("d");
                    txt_Edad.Text            = fnc.calcular_edad(Datos.MAESOC_FECHANAC).ToString();
                    string calle    = Datos.MAESOC_CALLE == null ? "" : "Calle: " + Datos.MAESOC_CALLE.Trim();
                    string nrocalle = Datos.MAESOC_NROCALLE == null ? "" : "Nº " + Datos.MAESOC_NROCALLE.Trim();
                    string barrio   = Datos.MAESOC_BARRIO == null ? "" : "Bº " + Datos.MAESOC_BARRIO.Trim();
                    txt_Domicilio.Text    = calle + " " + nrocalle + " " + barrio;
                    txt_Localidad.Text    = fnc.GetLocalidad(Convert.ToInt32(Datos.MAESOC_CODLOC));
                    txt_CodigoPostal.Text = (Datos.MAESOC_CODPOS == null || Datos.MAESOC_CODPOS == "" ? "No Asignada" : Datos.MAESOC_CODPOS.Trim());
                    txt_Telefono.Text     = Datos.MAESOC_TEL.Trim() + " // " + Datos.MAESOC_TELCEL.Trim();
                    txt_Jornada.Text      = context.ddjj.Where(x => x.cuil == cuil).OrderByDescending(x => x.periodo).FirstOrDefault().jorp == true ? "PARCIAL" : "COMPLETA";
                    txt_Categoria.Text    = Datos.MAESOC_CODCAT == 0 ? "No Especifica" : context.categorias_empleado.Where(x => x.MAECAT_CODCAT == Datos.MAESOC_CODCAT).SingleOrDefault().MAECAT_NOMCAT.Trim();
                    //string fechabaja = context.socemp.Where(x => x.SOCEMP_CUIL == cuil && x.SOCEMP_ULT_EMPRESA == 'S').SingleOrDefault().SOCEMP_FECHABAJA.ToString("d");
                    //txt_FechaBaja.Text = fechabaja == "01/01/1000" ? "" : fechabaja;
                }
            }
        }
        private void btn_imprimir_Click(object sender, EventArgs e)
        {
            Func_Utiles func_utiles = new Func_Utiles();
            var         edades      = (from a in db_socios.soccen
                                       join sf in db_socios.socflia on a.SOCCEN_CUIL equals sf.SOCFLIA_CUIL
                                       join flia in db_socios.maeflia on sf.SOCFLIA_CODFLIAR equals flia.MAEFLIA_CODFLIAR
                                       join maesocio in db_socios.maesoc on a.SOCCEN_CUIL equals maesocio.MAESOC_CUIL
                                       //where a.SOCCEN_ESTADO == 1 && maesocio.MAESOC_CODPOS == "4220"
                                       where a.SOCCEN_ESTADO == 1 && (cbx_localidad.SelectedValue.ToString() == "0" ? maesocio.MAESOC_CODPOS != cbx_localidad.SelectedValue.ToString() : maesocio.MAESOC_CODPOS == cbx_localidad.SelectedValue.ToString())
                                       select new
            {
                sexo = flia.MAEFLIA_SEXO.ToString(),
                edad = func_utiles.calcular_edad(flia.MAEFLIA_FECNAC)      // calcular_edad(flia.MAEFLIA_FECNAC)
            }).ToList();

            while (dgv_edades.Rows.Count > 0)
            {
                dgv_edades.Rows.RemoveAt(0);
            }
            dgv_edades.Rows.Add(5);

            //dgv_edades.Rows[4].Cells["edad"].Value = "12 a 18";
            //dgv_edades.Rows[4].Cells["F"].Value = edades.Where(x => x.edad >= 12 && x.edad <= 18 && x.sexo == "F").Count();
            //dgv_edades.Rows[4].Cells["M"].Value = edades.Where(x => x.edad >= 12 && x.edad <= 18 && x.sexo == "M").Count();
            //dgv_edades.Rows[4].Cells["cantidad"].Value = edades.Where(x => x.edad >= 12 && x.edad <= 18 && x.sexo != " ").Count();

            //dgv_edades.Rows[3].Cells["edad"].Value = "8 a 11";
            //dgv_edades.Rows[3].Cells["F"].Value = edades.Where(x => x.edad >= 8 && x.edad <= 11 && x.sexo == "F").Count();
            //dgv_edades.Rows[3].Cells["M"].Value = edades.Where(x => x.edad >= 8 && x.edad <= 11 && x.sexo == "M").Count();
            //dgv_edades.Rows[3].Cells["cantidad"].Value = edades.Where(x => x.edad >= 8 && x.edad <= 11 && x.sexo != " ").Count();

            dgv_edades.Rows[3].Cells["edad"].Value     = "13 a 17";
            dgv_edades.Rows[3].Cells["F"].Value        = edades.Where(x => x.edad >= 13 && x.edad <= 17 && x.sexo == "F").Count();
            dgv_edades.Rows[3].Cells["M"].Value        = edades.Where(x => x.edad >= 13 && x.edad <= 17 && x.sexo == "M").Count();
            dgv_edades.Rows[3].Cells["cantidad"].Value = edades.Where(x => x.edad >= 13 && x.edad <= 17 && x.sexo != " ").Count();

            dgv_edades.Rows[2].Cells["edad"].Value     = "8 a 12";
            dgv_edades.Rows[2].Cells["F"].Value        = edades.Where(x => x.edad >= 8 && x.edad <= 12 && x.sexo == "F").Count();
            dgv_edades.Rows[2].Cells["M"].Value        = edades.Where(x => x.edad >= 8 && x.edad <= 12 && x.sexo == "M").Count();
            dgv_edades.Rows[2].Cells["cantidad"].Value = edades.Where(x => x.edad >= 8 && x.edad <= 12 && x.sexo != " ").Count();

            dgv_edades.Rows[1].Cells["edad"].Value     = "6 a 7";
            dgv_edades.Rows[1].Cells["F"].Value        = edades.Where(x => x.edad >= 6 && x.edad <= 7 && x.sexo == "F").Count();
            dgv_edades.Rows[1].Cells["M"].Value        = edades.Where(x => x.edad >= 6 && x.edad <= 7 && x.sexo == "M").Count();
            dgv_edades.Rows[1].Cells["cantidad"].Value = edades.Where(x => x.edad >= 6 && x.edad <= 7 && x.sexo != " ").Count();

            dgv_edades.Rows[0].Cells["edad"].Value     = "3 a 5";
            dgv_edades.Rows[0].Cells["F"].Value        = edades.Where(x => x.edad >= 3 && x.edad <= 5 && x.sexo == "F").Count();
            dgv_edades.Rows[0].Cells["M"].Value        = edades.Where(x => x.edad >= 3 && x.edad <= 5 && x.sexo == "M").Count();
            dgv_edades.Rows[0].Cells["cantidad"].Value = edades.Where(x => x.edad >= 3 && x.edad <= 5 && x.sexo != " ").Count();

            dgv_edades.Rows[4].Cells["edad"].Value     = "sin sexo";
            dgv_edades.Rows[4].Cells["cantidad"].Value = edades.Where(x => x.edad >= 3 && x.edad <= 17 && x.sexo == " ").Count();

            lbl_total_edades.Text = edades.Where(x => x.edad >= 3 && x.edad <= 17).Count().ToString();
            //dgv_linq();
        }
Exemple #3
0
        private void cargar_exepciones()
        {
            EventosExepciones evntexp   = new EventosExepciones();
            Func_Utiles       func_util = new Func_Utiles();
            Parentesco        prnt      = new Parentesco();

            foreach (var item in evntexp.GetListadoExepciones(_cuil))
            {
                dgv_titu_benef.Rows.Add();
                int fila = dgv_titu_benef.Rows.Count - 1;
                dgv_titu_benef.Rows[fila].Cells["nombre"].Value      = item.EventExepApellido + " " + item.EventExepNombre;
                dgv_titu_benef.Rows[fila].Cells["Parentesco"].Value  = prnt.GetParentescoDescrip(item.EventExepParent).parent_descrip;
                dgv_titu_benef.Rows[fila].Cells["CodigoFliar"].Value = 0;
                dgv_titu_benef.Rows[fila].Cells["dni"].Value         = item.EventExepDni;
                dgv_titu_benef.Rows[fila].Cells["sexo"].Value        = item.EventExpSexo;
                dgv_titu_benef.Rows[fila].Cells["Edad"].Value        = func_util.calcular_edad(item.EventFechaNac);
                dgv_titu_benef.Rows[fila].Cells["Exepcion"].Value    = 1;
                dgv_titu_benef.Rows[fila].Cells["ExepcionID"].Value  = item.EventExepId;
                dgv_titu_benef.Rows[fila].Cells["Emitir"].Value      = Properties.Resources.impresora_PNG_24; //D:\Proyectos\entrega_cupones\entrega_cupones\Resources\impresora (1).png;
            }
        }
Exemple #4
0
 private void msk_fecha_nac_KeyDown(object sender, KeyEventArgs e)
 {
     if (msk_fecha_nac.MaskCompleted)
     {
         if (Keys.Enter == e.KeyCode)
         {
             Func_Utiles fnc  = new Func_Utiles();
             int         edad = fnc.calcular_edad(Convert.ToDateTime(msk_fecha_nac.Text));
             txt_edad.Text = edad.ToString();
             if (edad >= 0 && edad < 13)
             {
                 txt_apellido.Enabled        = true;
                 txt_dni.Enabled             = true;
                 txt_edad.Enabled            = true;
                 txt_nombre.Enabled          = true;
                 cbx_parentesco.Enabled      = true;
                 cbx_sexo.Enabled            = true;
                 btn_cargar_exepcion.Enabled = true;
                 txt_apellido.Focus();
             }
             else
             {
                 MessageBox.Show("La edad no corresponde para el evento");
                 disable_textbox();
             }
         }
         else
         {
             if (Keys.Back == e.KeyCode)
             {
                 disable_textbox();
             }
         }
     }
     else
     {
         disable_textbox();
     }
 }
Exemple #5
0
        public static List <mdlSocio> GetSocios(int _FiltroDeSocio, int _BuscarPor, string _CodigoPostal, int _NroDeSocio, int _Jordada, int _CodigoCategoria, int _ActivoEnEmpresa, int _Jubilados, string DatoABuscar, string cuit, bool Carencia)
        {
            using (var context = new lts_sindicatoDataContext())
            {
                Func_Utiles fnc = new Func_Utiles();
                //var ddjj_ = from a in context.ddjj select new { a.periodo, a.cuil, a.jorp };

                DateTime _FechaDeBaja = Convert.ToDateTime("01-01-1000");

                _Socios.Clear();
                _Socios = (from a in context.maesoc
                           join b in context.soccen on a.MAESOC_CUIL equals b.SOCCEN_CUIL
                           into g
                           from essocio in g.DefaultIfEmpty()
                           join sc in context.socemp on a.MAESOC_CUIL equals sc.SOCEMP_CUIL
                           join empr in context.maeemp on sc.SOCEMP_CUITE equals empr.MAEEMP_CUIT
                           where (sc.SOCEMP_ULT_EMPRESA == 'S') &&
                           (_FiltroDeSocio == 0 ? essocio.SOCCEN_ESTADO >= 0 : _FiltroDeSocio == 1 ? essocio.SOCCEN_ESTADO == 1 : essocio.SOCCEN_ESTADO == 0) &&
                           (_BuscarPor == 0 ? a.MAESOC_NRODOC == DatoABuscar.Trim() : _BuscarPor == 1 ? a.APENOM.Contains(DatoABuscar) : _BuscarPor == 2 ? empr.MEEMP_CUIT_STR == cuit : a.MAESOC_CUIL_STR != "0") &&
                           (_CodigoPostal == "0" ? a.MAESOC_CODPOS != _CodigoPostal : a.MAESOC_CODPOS == _CodigoPostal) &&
                           (_NroDeSocio == 0 ? a.MAESOC_NROAFIL != "0" : _NroDeSocio == 1 ? a.MAESOC_NROAFIL != "" : a.MAESOC_NROAFIL == "") &&
                           (_CodigoCategoria == 0 ? a.MAESOC_CODCAT != _CodigoCategoria : a.MAESOC_CODCAT == _CodigoCategoria) &&
                           (_Jubilados == 0 ? a.MAESOC_JUBIL != 4 : _Jubilados == 1 ? a.MAESOC_JUBIL == 1 : a.MAESOC_JUBIL == 0)
                           select new mdlSocio
                {
                    NroDeSocio = a.MAESOC_NROAFIL,
                    NroDNI = a.MAESOC_NRODOC.Trim(),
                    ApeNom = a.MAESOC_APELLIDO.Trim() + " " + a.MAESOC_NOMBRE.Trim(),
                    CUIT = empr.MEEMP_CUIT_STR,
                    RazonSocial = empr.MAEEMP_RAZSOC.Trim(),
                    EsSocio = essocio.SOCCEN_ESTADO == 1 ? true : false,
                    CUIL = a.MAESOC_CUIL_STR,
                    CodigoPostal = a.MAESOC_CODPOS,
                    //JornadaParcial = false,//(from c in _ddjj where c.cuil.Contains(a.MAESOC_CUIL_STR) select new { c.periodo, jorp = Convert.ToBoolean(c.jorp) } ).OrderByDescending(x=>x.periodo).FirstOrDefault().jorp , //_ddjj.Where(x => x.cuil == a.MAESOC_CUIL_STR).OrderByDescending(x => x.periodo).FirstOrDefault().jorp,
                    Categoria = a.MAESOC_CODCAT,
                    FechaBaja = sc.SOCEMP_FECHABAJA == _FechaDeBaja ? "" : sc.SOCEMP_FECHABAJA.ToString(),
                    Jubilado = a.MAESOC_JUBIL,
                    EstadoCivil = a.MAESOC_ESTCIV.ToString(),
                    Edad = fnc.calcular_edad(a.MAESOC_FECHANAC).ToString(),
                    Calle = a.MAESOC_CALLE,
                    Barrio = a.MAESOC_BARRIO,
                    NroCalle = a.MAESOC_NROCALLE,
                    Localidad = mtdFuncUtiles.GetLocalidad(a.MAESOC_CODLOC),  //fnc.GetLocalidad(a.MAESOC_CODLOC),
                    Telefono = a.MAESOC_TEL,
                    EmpresaNombre = empr.MAEEMP_NOMFAN,
                    EmpresaTelefono = empr.MAEEMP_TEL,
                    EmpresaDomicilio = empr.MAEEMP_CALLE + " Nº" + empr.MAEEMP_NRO,
                    EmpresaContador = empr.MAEEMP_ESTUDIO_CONTACTO,
                    EmpresaContadorTelefono = empr.MAEEMP_ESTUDIO_TEL,
                    EmpresaContadorEmail = empr.MAEEMP_ESTUDIO_EMAIL,
                    EmpresaEmail = empr.MAEEMP_EMAIL,
                    EmpresaCodigoPostal = empr.MAEEMP_CODPOS,
                    EmpresaLocalidad = mtdFuncUtiles.GetLocalidad(Convert.ToInt32(empr.MAEEMP_CODLOC)),
                    //Aportes = GetAportes(a.MAESOC_CUIL_STR)
                    Carencia = false
                }).ToList();
                //_BuscarPor
                // 0 D.N.I.
                // 1 Apellido y Nombre
                // 2 Empresa
                // 3 Todas las Empresas

                if (_Socios.Count() > 0)
                {
                    Getddjj(_BuscarPor, cuit);
                }

                var empresa = from a in context.maeemp
                              select new Empresa
                {
                    MEEMP_CUIT_STR = a.MEEMP_CUIT_STR,
                    MAEEMP_RAZSOC  = a.MAEEMP_RAZSOC,
                };

                _Empresas.AddRange(empresa.ToList());

                _Socios.ForEach(x => x.JornadaParcial = GetJornada(_BuscarPor, x.CUIL));
                _Socios.ForEach(x => x.Aportes        = GetAportes(x.CUIL));
                _Socios.ForEach(x => x.Carencia       = VerificarCarencia(x.Aportes.Max(y => y.Periodo)));

                if (Carencia)
                {
                    return(_Socios.Where(x => x.Carencia == false).OrderBy(x => x.ApeNom).ToList());
                }
                else
                {
                    return(_Socios.OrderBy(x => x.ApeNom).ToList());
                }
                //return _Socios.Where(x => x.Carencia == false).OrderBy(x => x.ApeNom).ToList();
            }
        }