Exemplo n.º 1
0
        private void Cargar_TituBenef()
        {
            if (dgv_titu_benef.Rows.Count > 0)
            {
                Func_Utiles fn = new Func_Utiles();
                fn.limpiar_dgv(dgv_titu_benef);
            }

            socios soc = new socios();

            foreach (var item in soc.Get_Titular_Benef(_cuil, Convert.ToInt32(cbx_eventos.SelectedValue)))
            {
                dgv_titu_benef.Rows.Add();
                int fila = dgv_titu_benef.Rows.Count - 1;
                dgv_titu_benef.Rows[fila].Cells["nombre"].Value      = item.nombre;
                dgv_titu_benef.Rows[fila].Cells["Parentesco"].Value  = item.Parentesco;
                dgv_titu_benef.Rows[fila].Cells["CodigoFliar"].Value = item.CodigoFliar;
                dgv_titu_benef.Rows[fila].Cells["dni"].Value         = item.Cuil;
                dgv_titu_benef.Rows[fila].Cells["sexo"].Value        = item.Sexo;
                dgv_titu_benef.Rows[fila].Cells["Edad"].Value        = item.Edad;
                dgv_titu_benef.Rows[fila].Cells["Exepcion"].Value    = 0;
                dgv_titu_benef.Rows[fila].Cells["Emitir"].Value      = Properties.Resources.impresora_PNG_24; //D:\Proyectos\entrega_cupones\entrega_cupones\Resources\impresora (1).png;
            }
            if (Convert.ToInt32(cbx_eventos.SelectedValue) == 4)
            {
                cargar_exepciones();
            }
        }
Exemplo n.º 2
0
        private void ListadoMochilasEntregadas()
        {
            using (var context = new lts_sindicatoDataContext())
            {
                Func_Utiles Func = new Func_Utiles();
                var         loc  = context.localidades.Where(x => x.idprovincias == 14).ToList();

                var LstMochilasEntregadas = from a in context.eventos_cupones
                                            join mochi in context.articulos on a.ArticuloID equals mochi.ID
                                            where a.ArticuloID == 1

                                            join MF in context.maeflia on a.eventcupon_maesoc_cuil equals Convert.ToDouble(MF.MAEFLIA_NRODOC)
                                            select a;

                //  join SF in context.socflia on MF.MAEFLIA_CODFLIAR equals SF.SOCFLIA_CODFLIAR
                //  join MS in context.maesoc on SF.SOCFLIA_CUIL equals MS.MAESOC_CUIL
                //  where (cbx_localidad.SelectedValue.ToString() == "0" ? MS.MAESOC_CODPOS != cbx_localidad.SelectedValue.ToString() : MS.MAESOC_CODPOS == cbx_localidad.SelectedValue.ToString())
                //  select new
                //  {
                //    FechaDeEntrega = a.FechaDeEntregaArticulo,
                //    NroDeCupon = a.event_cupon_nro,
                //    Mochila = mochi.Sexo == 'F' ? mochi.Descripcion + " - MUJER" : mochi.Descripcion + " - VARON",
                //    mochi.Sexo,
                //    IdMochila = a.ArticuloID,
                //    IdMochilaRetirada = a.ArticuloIDRetira,
                //    EnStock = mochi.Cantidad,
                //    CodigoPostal = MS.MAESOC_CODPOS
                //  };

                var LstMochilasEntregadas1 = from a in context.eventos_cupones
                                             join mochi in context.articulos on a.ArticuloID equals mochi.ID
                                             join MF in context.maeflia on a.eventcupon_maesoc_cuil equals Convert.ToDouble(MF.MAEFLIA_NRODOC)
                                             join SF in context.socflia on MF.MAEFLIA_CODFLIAR equals SF.SOCFLIA_CODFLIAR
                                             join MS in context.maesoc on SF.SOCFLIA_CUIL equals MS.MAESOC_CUIL
                                             //where (cbx_localidad.SelectedValue.ToString() == "0" ? MS.MAESOC_CODPOS != cbx_localidad.SelectedValue.ToString() : MS.MAESOC_CODPOS == cbx_localidad.SelectedValue.ToString())
                                             select new mdlMochilasEntregadas
                {
                    FechaDeEntrega    = a.FechaDeEntregaArticulo,
                    NroDeCupon        = a.event_cupon_nro,
                    Mochila           = mochi.Sexo == 'F' ? mochi.Descripcion + " - MUJER" : mochi.Descripcion + " - VARON",
                    Sexo              = mochi.Sexo,
                    IdMochila         = (int)a.ArticuloID,
                    IdMochilaRetirada = (int)a.ArticuloIDRetira,
                    EnStock           = (int)mochi.Cantidad,
                    CodigoPostal      = MS.MAESOC_CODPOS,
                    ApenomSocio       = MS.MAESOC_APELLIDO.Trim() + " " + MS.MAESOC_NOMBRE.Trim(),
                    ApenomBenef       = MF.MAEFLIA_APELLIDO.Trim() + " " + MF.MAEFLIA_NOMBRE.Trim(),
                    Entregado         = a.FechaDeEntregaArticulo == null ? "NO":"SI"
                };


                //(cbx_localidad.SelectedValue.ToString() == "0" ? maesocio.MAESOC_CODPOS != cbx_localidad.SelectedValue.ToString() : maesocio.MAESOC_CODPOS == cbx_localidad.SelectedValue.ToString())
                //var LstMochilasEntregadas = from a in LstMochilasEntregadas_
                //                            join b in loc on a.CodigoPostal equals Convert.ToInt16( b.codigopostal)
                //                            select a;

                if (LstMochilasEntregadas1.Count() > 0)
                {
                    Func.limpiar_dgv(dgv_Resumen);
                    //dgv_MochilasEntregadas.DataSource = LstMochilasEntregadas.Where(x => x.FechaDeEntrega != null).OrderByDescending(x => x.FechaDeEntrega).ToList();
                    dgv_MochilasEntregadas.DataSource = LstMochilasEntregadas1.OrderBy(x => x.ApenomSocio).ToList();
                    txt_TotalCuponMochilas.Text       = dgv_MochilasEntregadas.Rows.Count.ToString();
                    lbl_SinRegistros1.Visible         = false;
                    lbl_SinRegistros2.Visible         = false;

                    dgv_Resumen.Rows.Add();
                    int fila = dgv_Resumen.Rows.Count - 1;
                    dgv_Resumen.Rows[fila].Cells["Mochila"].Value             = "JARDIN    - MUJER";
                    dgv_Resumen.Rows[fila].Cells["CuponesEmitidos"].Value     = LstMochilasEntregadas1.Where(x => x.IdMochila == 1).Count().ToString();
                    dgv_Resumen.Rows[fila].Cells["MochilasEntregadas"].Value  = LstMochilasEntregadas1.Where(x => x.IdMochila == 1 && x.FechaDeEntrega != null).Count().ToString();
                    dgv_Resumen.Rows[fila].Cells["FaltanEntregar"].Value      = (Convert.ToInt32(dgv_Resumen.Rows[fila].Cells["CuponesEmitidos"].Value) - Convert.ToInt32(dgv_Resumen.Rows[fila].Cells["MochilasEntregadas"].Value)).ToString();
                    dgv_Resumen.Rows[fila].Cells["EnStock"].Value             = context.articulos.Where(x => x.ID == 1).Single().Cantidad.ToString();
                    dgv_Resumen.Rows[fila].Cells["StockRealSinReserva"].Value = (Convert.ToInt32(dgv_Resumen.Rows[fila].Cells["EnStock"].Value) - Convert.ToInt32(dgv_Resumen.Rows[fila].Cells["FaltanEntregar"].Value)).ToString();
                    dgv_Resumen.Rows[fila].Cells["PorcentajeDeEntrega"].Value = ((Convert.ToDouble(dgv_Resumen.Rows[fila].Cells["MochilasEntregadas"].Value) * 100) / Convert.ToDouble(context.articulos.Where(x => x.ID == 1).Single().StockInicial)).ToString("N2");

                    dgv_Resumen.Rows.Add();
                    fila = dgv_Resumen.Rows.Count - 1;
                    dgv_Resumen.Rows[fila].Cells["Mochila"].Value             = "JARDIN    - VARON";
                    dgv_Resumen.Rows[fila].Cells["CuponesEmitidos"].Value     = LstMochilasEntregadas1.Where(x => x.IdMochila == 2).Count().ToString();
                    dgv_Resumen.Rows[fila].Cells["MochilasEntregadas"].Value  = LstMochilasEntregadas1.Where(x => x.IdMochila == 2 && x.FechaDeEntrega != null).Count().ToString();
                    dgv_Resumen.Rows[fila].Cells["FaltanEntregar"].Value      = (Convert.ToInt32(dgv_Resumen.Rows[fila].Cells["CuponesEmitidos"].Value) - Convert.ToInt32(dgv_Resumen.Rows[fila].Cells["MochilasEntregadas"].Value)).ToString();
                    dgv_Resumen.Rows[fila].Cells["EnStock"].Value             = context.articulos.Where(x => x.ID == 2).Single().Cantidad.ToString();
                    dgv_Resumen.Rows[fila].Cells["StockRealSinReserva"].Value = (Convert.ToInt32(dgv_Resumen.Rows[fila].Cells["EnStock"].Value) - Convert.ToInt32(dgv_Resumen.Rows[fila].Cells["FaltanEntregar"].Value)).ToString();
                    dgv_Resumen.Rows[fila].Cells["PorcentajeDeEntrega"].Value = ((Convert.ToDouble(dgv_Resumen.Rows[fila].Cells["MochilasEntregadas"].Value) * 100) / Convert.ToDouble(context.articulos.Where(x => x.ID == 2).Single().StockInicial)).ToString("N2");

                    dgv_Resumen.Rows.Add();
                    fila = dgv_Resumen.Rows.Count - 1;
                    dgv_Resumen.Rows[fila].Cells["CuponesEmitidos"].Value     = LstMochilasEntregadas1.Where(x => x.IdMochila == 3).Count().ToString();
                    dgv_Resumen.Rows[fila].Cells["Mochila"].Value             = "PRIMARIA 1 - MUJER";
                    dgv_Resumen.Rows[fila].Cells["MochilasEntregadas"].Value  = LstMochilasEntregadas1.Where(x => x.IdMochila == 3 && x.FechaDeEntrega != null).Count().ToString();
                    dgv_Resumen.Rows[fila].Cells["FaltanEntregar"].Value      = (Convert.ToInt32(dgv_Resumen.Rows[fila].Cells["CuponesEmitidos"].Value) - Convert.ToInt32(dgv_Resumen.Rows[fila].Cells["MochilasEntregadas"].Value)).ToString();
                    dgv_Resumen.Rows[fila].Cells["EnStock"].Value             = context.articulos.Where(x => x.ID == 3).Single().Cantidad.ToString();
                    dgv_Resumen.Rows[fila].Cells["StockRealSinReserva"].Value = (Convert.ToInt32(dgv_Resumen.Rows[fila].Cells["EnStock"].Value) - Convert.ToInt32(dgv_Resumen.Rows[fila].Cells["FaltanEntregar"].Value)).ToString();
                    dgv_Resumen.Rows[fila].Cells["PorcentajeDeEntrega"].Value = ((Convert.ToDouble(dgv_Resumen.Rows[fila].Cells["MochilasEntregadas"].Value) * 100) / Convert.ToDouble(context.articulos.Where(x => x.ID == 3).Single().StockInicial)).ToString("N2");

                    dgv_Resumen.Rows.Add();
                    fila = dgv_Resumen.Rows.Count - 1;
                    dgv_Resumen.Rows[fila].Cells["CuponesEmitidos"].Value     = LstMochilasEntregadas1.Where(x => x.IdMochila == 4).Count().ToString();
                    dgv_Resumen.Rows[fila].Cells["Mochila"].Value             = "PRIMARIA 1 - VARON";
                    dgv_Resumen.Rows[fila].Cells["MochilasEntregadas"].Value  = LstMochilasEntregadas1.Where(x => x.IdMochila == 4 && x.FechaDeEntrega != null).Count().ToString();
                    dgv_Resumen.Rows[fila].Cells["FaltanEntregar"].Value      = (Convert.ToInt32(dgv_Resumen.Rows[fila].Cells["CuponesEmitidos"].Value) - Convert.ToInt32(dgv_Resumen.Rows[fila].Cells["MochilasEntregadas"].Value)).ToString();
                    dgv_Resumen.Rows[fila].Cells["EnStock"].Value             = context.articulos.Where(x => x.ID == 4).Single().Cantidad.ToString();
                    dgv_Resumen.Rows[fila].Cells["StockRealSinReserva"].Value = (Convert.ToInt32(dgv_Resumen.Rows[fila].Cells["EnStock"].Value) - Convert.ToInt32(dgv_Resumen.Rows[fila].Cells["FaltanEntregar"].Value)).ToString();
                    dgv_Resumen.Rows[fila].Cells["PorcentajeDeEntrega"].Value = ((Convert.ToDouble(dgv_Resumen.Rows[fila].Cells["MochilasEntregadas"].Value) * 100) / Convert.ToDouble(context.articulos.Where(x => x.ID == 4).Single().StockInicial)).ToString("N2");

                    dgv_Resumen.Rows.Add();
                    fila = dgv_Resumen.Rows.Count - 1;
                    dgv_Resumen.Rows[fila].Cells["CuponesEmitidos"].Value     = LstMochilasEntregadas1.Where(x => x.IdMochila == 5).Count().ToString();
                    dgv_Resumen.Rows[fila].Cells["Mochila"].Value             = "PRIMARIA 2 - MUJER";
                    dgv_Resumen.Rows[fila].Cells["MochilasEntregadas"].Value  = LstMochilasEntregadas1.Where(x => x.IdMochila == 5 && x.FechaDeEntrega != null).Count().ToString();
                    dgv_Resumen.Rows[fila].Cells["FaltanEntregar"].Value      = (Convert.ToInt32(dgv_Resumen.Rows[fila].Cells["CuponesEmitidos"].Value) - Convert.ToInt32(dgv_Resumen.Rows[fila].Cells["MochilasEntregadas"].Value)).ToString();
                    dgv_Resumen.Rows[fila].Cells["EnStock"].Value             = context.articulos.Where(x => x.ID == 5).Single().Cantidad.ToString();
                    dgv_Resumen.Rows[fila].Cells["StockRealSinReserva"].Value = (Convert.ToInt32(dgv_Resumen.Rows[fila].Cells["EnStock"].Value) - Convert.ToInt32(dgv_Resumen.Rows[fila].Cells["FaltanEntregar"].Value)).ToString();
                    dgv_Resumen.Rows[fila].Cells["PorcentajeDeEntrega"].Value = ((Convert.ToDouble(dgv_Resumen.Rows[fila].Cells["MochilasEntregadas"].Value) * 100) / Convert.ToDouble(context.articulos.Where(x => x.ID == 5).Single().StockInicial)).ToString("N2");

                    dgv_Resumen.Rows.Add();
                    fila = dgv_Resumen.Rows.Count - 1;
                    dgv_Resumen.Rows[fila].Cells["CuponesEmitidos"].Value     = LstMochilasEntregadas1.Where(x => x.IdMochila == 6).Count().ToString();
                    dgv_Resumen.Rows[fila].Cells["Mochila"].Value             = "PRIMARIA 2 - VARON";
                    dgv_Resumen.Rows[fila].Cells["MochilasEntregadas"].Value  = LstMochilasEntregadas1.Where(x => x.IdMochila == 6 && x.FechaDeEntrega != null).Count().ToString();
                    dgv_Resumen.Rows[fila].Cells["FaltanEntregar"].Value      = (Convert.ToInt32(dgv_Resumen.Rows[fila].Cells["CuponesEmitidos"].Value) - Convert.ToInt32(dgv_Resumen.Rows[fila].Cells["MochilasEntregadas"].Value)).ToString();
                    dgv_Resumen.Rows[fila].Cells["EnStock"].Value             = context.articulos.Where(x => x.ID == 6).Single().Cantidad.ToString();
                    dgv_Resumen.Rows[fila].Cells["StockRealSinReserva"].Value = (Convert.ToInt32(dgv_Resumen.Rows[fila].Cells["EnStock"].Value) - Convert.ToInt32(dgv_Resumen.Rows[fila].Cells["FaltanEntregar"].Value)).ToString();
                    dgv_Resumen.Rows[fila].Cells["PorcentajeDeEntrega"].Value = ((Convert.ToDouble(dgv_Resumen.Rows[fila].Cells["MochilasEntregadas"].Value) * 100) / Convert.ToDouble(context.articulos.Where(x => x.ID == 6).Single().StockInicial)).ToString("N2");

                    dgv_Resumen.Rows.Add();
                    fila = dgv_Resumen.Rows.Count - 1;
                    dgv_Resumen.Rows[fila].Cells["CuponesEmitidos"].Value     = LstMochilasEntregadas1.Where(x => x.IdMochila == 7).Count().ToString();
                    dgv_Resumen.Rows[fila].Cells["Mochila"].Value             = "SECUNDARIA - MUJER";
                    dgv_Resumen.Rows[fila].Cells["MochilasEntregadas"].Value  = LstMochilasEntregadas1.Where(x => x.IdMochila == 7 && x.FechaDeEntrega != null).Count().ToString();
                    dgv_Resumen.Rows[fila].Cells["FaltanEntregar"].Value      = (Convert.ToInt32(dgv_Resumen.Rows[fila].Cells["CuponesEmitidos"].Value) - Convert.ToInt32(dgv_Resumen.Rows[fila].Cells["MochilasEntregadas"].Value)).ToString();
                    dgv_Resumen.Rows[fila].Cells["EnStock"].Value             = context.articulos.Where(x => x.ID == 7).Single().Cantidad.ToString();
                    dgv_Resumen.Rows[fila].Cells["StockRealSinReserva"].Value = (Convert.ToInt32(dgv_Resumen.Rows[fila].Cells["EnStock"].Value) - Convert.ToInt32(dgv_Resumen.Rows[fila].Cells["FaltanEntregar"].Value)).ToString();
                    dgv_Resumen.Rows[fila].Cells["PorcentajeDeEntrega"].Value = ((Convert.ToDouble(dgv_Resumen.Rows[fila].Cells["MochilasEntregadas"].Value) * 100) / Convert.ToDouble(context.articulos.Where(x => x.ID == 7).Single().StockInicial)).ToString("N2");

                    dgv_Resumen.Rows.Add();
                    fila = dgv_Resumen.Rows.Count - 1;
                    dgv_Resumen.Rows[fila].Cells["CuponesEmitidos"].Value     = LstMochilasEntregadas1.Where(x => x.IdMochila == 8).Count().ToString();
                    dgv_Resumen.Rows[fila].Cells["Mochila"].Value             = "SECUNDARIA - VARON";
                    dgv_Resumen.Rows[fila].Cells["MochilasEntregadas"].Value  = LstMochilasEntregadas1.Where(x => x.IdMochila == 8 && x.FechaDeEntrega != null).Count().ToString();
                    dgv_Resumen.Rows[fila].Cells["FaltanEntregar"].Value      = (Convert.ToInt32(dgv_Resumen.Rows[fila].Cells["CuponesEmitidos"].Value) - Convert.ToInt32(dgv_Resumen.Rows[fila].Cells["MochilasEntregadas"].Value)).ToString();
                    dgv_Resumen.Rows[fila].Cells["EnStock"].Value             = context.articulos.Where(x => x.ID == 8).Single().Cantidad.ToString();
                    dgv_Resumen.Rows[fila].Cells["StockRealSinReserva"].Value = (Convert.ToInt32(dgv_Resumen.Rows[fila].Cells["EnStock"].Value) - Convert.ToInt32(dgv_Resumen.Rows[fila].Cells["FaltanEntregar"].Value)).ToString();
                    dgv_Resumen.Rows[fila].Cells["PorcentajeDeEntrega"].Value = ((Convert.ToDouble(dgv_Resumen.Rows[fila].Cells["MochilasEntregadas"].Value) * 100) / Convert.ToDouble(context.articulos.Where(x => x.ID == 8).Single().StockInicial)).ToString("N2");
                }
                else
                {
                    dgv_MochilasEntregadas.DataSource = null;
                    txt_TotalCuponMochilas.Text       = "0";
                    Func.limpiar_dgv(dgv_Resumen);
                    lbl_SinRegistros1.Visible = true;
                    lbl_SinRegistros2.Visible = true;
                }
            }
        }