private void chk_seleccionar_visibles_CheckedChanged(object sender, EventArgs e) { try { if (!chk_seleccionar_visibles.Checked) { for (int i = 0; i < gridView_unidades.RowCount; i++) { gridView_unidades.SetRowCellValue(i, col_check, false); } } else { if (cmb_tipo_horas.EditValue == null) { return; } eTipo_horas = (Cl_Enumeradores.eTipo_horas_facturar)Enum.Parse(typeof(Cl_Enumeradores.eTipo_horas_facturar), lst_etipo_horas.FirstOrDefault(q => q.Key == Convert.ToInt32(cmb_tipo_horas.EditValue)).Value); if (eTipo_horas == Cl_Enumeradores.eTipo_horas_facturar.HORAS_NORMALES) { for (int i = 0; i < gridView_unidades.RowCount; i++) { if (gridView_unidades.GetRowCellValue(i, col_IdCbteVta_hn) == null && Convert.ToDouble(gridView_unidades.GetRowCellValue(i, col_cantidad_unidades_normales)) > 0) { gridView_unidades.SetRowCellValue(i, col_check, true); } else { gridView_unidades.SetRowCellValue(i, col_check, false); } } } else { for (int i = 0; i < gridView_unidades.RowCount; i++) { if (gridView_unidades.GetRowCellValue(i, col_IdCbteVta_he) == null && Convert.ToDouble(gridView_unidades.GetRowCellValue(i, col_cantidad_unidades_extra)) > 0) { gridView_unidades.SetRowCellValue(i, col_check, true); } else { gridView_unidades.SetRowCellValue(i, col_check, false); } } } } } catch (Exception ex) { string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name; NameMetodo = NameMetodo + " - " + ex.ToString(); MessageBox.Show(NameMetodo + " " + param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas) , param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString()); } }
private void gridView_unidades_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { try { fa_registro_unidades_x_equipo_det_ini_x_Af_Info row = (fa_registro_unidades_x_equipo_det_ini_x_Af_Info)gridView_unidades.GetRow(e.FocusedRowHandle); if (row == null) { gridView_unidades.OptionsBehavior.ReadOnly = false; return; } if (cmb_tipo_horas.EditValue == null) { gridView_unidades.OptionsBehavior.ReadOnly = false; return; } eTipo_horas = (Cl_Enumeradores.eTipo_horas_facturar)Enum.Parse(typeof(Cl_Enumeradores.eTipo_horas_facturar), lst_etipo_horas.FirstOrDefault(q => q.Key == Convert.ToInt32(cmb_tipo_horas.EditValue)).Value); if (eTipo_horas == Cl_Enumeradores.eTipo_horas_facturar.HORAS_NORMALES) { if (row.cantidad_unidades_normales > 0 && row.IdCbteVta_hn == null) { gridView_unidades.OptionsBehavior.ReadOnly = false; return; } else { gridView_unidades.OptionsBehavior.ReadOnly = true; return; } } else { if (row.cantidad_unidades_extra > 0 && row.IdCbteVta_he == null) { gridView_unidades.OptionsBehavior.ReadOnly = false; return; } else { gridView_unidades.OptionsBehavior.ReadOnly = true; return; } } } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void set_info(List <fa_registro_unidades_x_equipo_det_ini_x_Af_Info> info, Cl_Enumeradores.eTipo_horas_facturar _eTipo_horas) { try { lst_unidades_x_AF = info; eTipo_horas = _eTipo_horas; } catch (Exception ex) { string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name; NameMetodo = NameMetodo + " - " + ex.ToString(); MessageBox.Show(NameMetodo + " " + param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas) , param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString()); } }
private bool validar() { try { if (cmb_centro_costo.EditValue == null) { MessageBox.Show("Ingrese el centro de costo", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } if (ucCon_Periodo1.Get_Periodo_Info() == null) { MessageBox.Show("Ingrese el periodo", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } if (ucIn_Sucursal_Bodega1.get_IdSucursal() == 0) { MessageBox.Show("Seleccione la sucursal", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } if (ucIn_Sucursal_Bodega1.get_IdBodega() == 0) { MessageBox.Show("Seleccione la bodega", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } if (blst_registro_unidades_x_af.Where(q => q.seleccionado == true).Count() == 0) { MessageBox.Show("Seleccione los registros a facturar", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } if (cmb_tipo_horas.EditValue == null) { MessageBox.Show("Seleccione el tipo de horas a facturar", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } info_fa_param = bus_fa_param.Get_Info_parametro(param.IdEmpresa); int cont_hn = blst_registro_unidades_x_af.Where(q => q.cantidad_unidades_normales > 0 && q.seleccionado == true && q.IdCbteVta_hn == null).Count(); int cont_he = blst_registro_unidades_x_af.Where(q => q.cantidad_unidades_extra > 0 && q.seleccionado == true && q.IdCbteVta_he == null).Count(); eTipo_horas = (Cl_Enumeradores.eTipo_horas_facturar)Enum.Parse(typeof(Cl_Enumeradores.eTipo_horas_facturar), lst_etipo_horas.FirstOrDefault(q => q.Key == Convert.ToInt32(cmb_tipo_horas.EditValue)).Value); if (eTipo_horas == Cl_Enumeradores.eTipo_horas_facturar.HORAS_NORMALES) { if (cont_hn == 0) { MessageBox.Show("Los registros seleccionados no contienen horas normales pendientes de facturar " + info_fa_param.NumeroDeItemFact, param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } if ((cont_hn) > info_fa_param.NumeroDeItemFact) { MessageBox.Show("Los registros seleccionados crearán " + (cont_hn) + " líneas en la factura y el máximo permitido es " + info_fa_param.NumeroDeItemFact, param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } } else { if (cont_he == 0) { MessageBox.Show("Los registros seleccionados no contienen horas extras pendientes de facturar " + info_fa_param.NumeroDeItemFact, param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } if (cont_he > info_fa_param.NumeroDeItemFact) { MessageBox.Show("Los registros seleccionados crearán " + (cont_he) + " líneas en la factura y el máximo permitido es " + info_fa_param.NumeroDeItemFact, param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } } return(true); } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } }