Ejemplo n.º 1
0
        private void cargar_combos()
        {
            try
            {
                if (FUNCION == Cl_Enumeradores.eFuncion_pantalla_lote.DISTRIBUIR)
                {
                    lst_producto = bus_producto.Get_list_Producto_x_producto_padre(param.IdEmpresa, info_producto_padre.IdProducto);
                    cmb_producto_det.DataSource = lst_producto;
                    ucGe_Menu_Superior_Mant1.Visible_bntAprobar = true;
                }
                else
                {
                    ucGe_Menu_Superior_Mant1.Visible_bntAprobar = false;
                    lst_producto = bus_producto.get_list_Producto_stock_X_lote(param.IdEmpresa, info_producto_padre.IdSucursal, info_producto_padre.IdBodega, info_producto_padre.IdProducto);
                    cmb_producto_det.DataSource = lst_producto;
                    info_in_param = bus_in_param.Get_Info_Parametro(param.IdEmpresa);
                    blst          = new BindingList <in_producto_lote>();
                    foreach (var item in lst_producto)
                    {
                        in_producto_lote det = new in_producto_lote
                        {
                            IdProducto      = item.IdProducto,
                            lote_fecha_fab  = item.lote_fecha_fab,
                            lote_fecha_vcto = item.lote_fecha_vcto,
                            lote_numero     = item.lote_num_lote,
                            pr_descripcion  = item.pr_descripcion,
                            cantidad        = item.pr_stock == null ? 0 : Convert.ToDouble(item.pr_stock),
                            dias_vcto       = get_diferencia_dias_fecha_actual(item.lote_fecha_vcto == null ? DateTime.Now.Date : Convert.ToDateTime(item.lote_fecha_vcto))
                        };
                        if (det.dias_vcto <= info_in_param.P_Dias_menores_alerta_desde_fecha_actual_amarillo && det.dias_vcto > info_in_param.P_Dias_menores_alerta_desde_fecha_actual_rojo)
                        {
                            det.color_alerta = 1;
                        }
                        else
                        if (det.dias_vcto <= info_in_param.P_Dias_menores_alerta_desde_fecha_actual_rojo)
                        {
                            det.color_alerta = 2;
                        }
                        else
                        {
                            det.color_alerta = 0;
                        }
                        blst.Add(det);
                    }
                    blst = new BindingList <in_producto_lote>(blst.OrderBy(q => q.lote_fecha_vcto).ToList());
                    gridControl_lote.DataSource = blst;

                    col_IdProducto.OptionsColumn.AllowEdit       = false;
                    col_pr_descripcion.OptionsColumn.AllowEdit   = false;
                    col_cantidad.OptionsColumn.AllowEdit         = false;
                    col_lote_codigo.OptionsColumn.AllowEdit      = false;
                    col_lote_fecha_fab.OptionsColumn.AllowEdit   = false;
                    col_lote_fecha_vcto.OptionsColumn.AllowEdit  = false;
                    gridView_lote.OptionsView.NewItemRowPosition = DevExpress.XtraGrid.Views.Grid.NewItemRowPosition.None;
                }
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }