private void FgUniMed_CellChanged(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { if (e.Col == 3) { if (FgUniMed.GetData(e.Row, 1).ToString() == FgUniMed.GetData(e.Row, 3).ToString()) { FgUniMed.SetData(e.Row, 3, ""); MessageBox.Show("La unidad basica no puede ser igual a la unidad de presentacion", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); } } }
private void CmdAddUni_Click(object sender, EventArgs e) { bool booAgregarUnidad = true; if (Convert.ToString(FgUniMed.GetData(FgUniMed.Rows.Count - 1, 1)) == "") { booAgregarUnidad = false; } if (Convert.ToString(FgUniMed.GetData(FgUniMed.Rows.Count - 1, 2)) == "") { booAgregarUnidad = false; } if (Convert.ToString(FgUniMed.GetData(FgUniMed.Rows.Count - 1, 3)) == "") { booAgregarUnidad = false; } if (Convert.ToString(FgUniMed.GetData(FgUniMed.Rows.Count - 1, 4)) == "") { booAgregarUnidad = false; } if (Convert.ToString(FgUniMed.GetData(FgUniMed.Rows.Count - 1, 5)) == "") { booAgregarUnidad = false; } if (booAgregarUnidad == true) { FgUniMed.Rows.Count = FgUniMed.Rows.Count + 1; FgUniMed.Cols[5].DataType = typeof(bool); FgUniMed.SetData(FgUniMed.Rows.Count - 1, 5, false); FgUniMed.Focus(); } else { MessageBox.Show("No puede agregar mas unidades hasta que no haya completado los datos de la unidad anterior", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); } }
void AsignarEntidad() { BE_Inventario.n_idemp = STU_SISTEMA.EMPRESAID; BE_Inventario.c_codpro = TxtCodigo.Text; BE_Inventario.c_despro = TxtDescripcion.Text; BE_Inventario.c_destec = TxtdescTecnica.Text; BE_Inventario.c_descar = TxtCaracteristica.Text; BE_Inventario.n_stkini = Convert.ToDouble(funFunciones.NulosN(TxtStockIni.Text)); BE_Inventario.n_stkact = Convert.ToDouble(funFunciones.NulosN(TxtStockActual.Text)); BE_Inventario.n_stkmax = Convert.ToDouble(funFunciones.NulosN(TxtStockmMax.Text)); BE_Inventario.n_stkmin = Convert.ToDouble(funFunciones.NulosN(TxtStockMin.Text)); BE_Inventario.n_preini = Convert.ToDouble(funFunciones.NulosN(TxtPreIni.Text)); BE_Inventario.n_preuni = Convert.ToDouble(funFunciones.NulosN(TxtPreAct.Text)); BE_Inventario.n_idtipexi = Convert.ToInt16(CboTipExis.SelectedValue); BE_Inventario.n_idfam = Convert.ToInt16(CboFamilia.SelectedValue); BE_Inventario.n_idclas = Convert.ToInt16(CboClase.SelectedValue); BE_Inventario.n_idsubclas = Convert.ToInt16(CboSubClase.SelectedValue); BE_Inventario.n_idmon = Convert.ToInt16(CboMoneda.SelectedValue); int n_fila = 0; int n_NumeroElementos = 0; if (BE_Inventario.lst_unidadmedida != null) { n_NumeroElementos = Convert.ToInt16(BE_Inventario.lst_unidadmedida.Count - 1); for (n_fila = 0; n_fila <= n_NumeroElementos; n_fila++) { BE_Inventario.lst_unidadmedida.RemoveAt(0); } } n_fila = 0; booAgregando = true; List <BE_ALM_INVENTARIOUNIMED_CONSULTA> LstUnidades = new List <BE_ALM_INVENTARIOUNIMED_CONSULTA>(); if (FgUniMed.Rows.Count > 2) { for (n_fila = 2; n_fila <= FgUniMed.Rows.Count - 1; n_fila++) { BE_ALM_INVENTARIOUNIMED_CONSULTA BE_UnidadMedida = new BE_ALM_INVENTARIOUNIMED_CONSULTA(); BE_UnidadMedida.c_dessun = FgUniMed.GetData(n_fila, 1).ToString(); BE_UnidadMedida.c_des = FgUniMed.GetData(n_fila, 2).ToString(); BE_UnidadMedida.c_desunimedbas = FgUniMed.GetData(n_fila, 3).ToString(); BE_UnidadMedida.n_canunimedbas = Convert.ToDouble(FgUniMed.GetData(n_fila, 4).ToString()); if (FgUniMed.GetData(n_fila, 5).ToString() == "False") { BE_UnidadMedida.n_default = 0; } else { BE_UnidadMedida.n_default = 1; } DataTable DtFiltro = new DataTable(); // FILTRAMOS LA UNIDAD DE MEDIDA POR LA ABREVIATURA SELECCIONADA PARA LA PRESENTACION string strCadenaFiltro = "c_abr = '" + FgUniMed.GetData(n_fila, 1).ToString() + "'"; DtFiltro = funDatos.DataTableFiltrar(dtUnidadMedida, strCadenaFiltro); BE_UnidadMedida.n_idunimed = Convert.ToInt32(DtFiltro.Rows[0]["n_id"].ToString()); // FILTRAMOS LA UNIDAD DE MEDIDA POR LA ABREVIATURA SELECCIONADA PARA LA UNIDAD DE MEDIDA BASICA strCadenaFiltro = "c_abr = '" + FgUniMed.GetData(n_fila, 3).ToString() + "'"; DtFiltro = funDatos.DataTableFiltrar(dtUnidadMedida, strCadenaFiltro); BE_UnidadMedida.n_idunimedbas = Convert.ToInt32(DtFiltro.Rows[0]["n_id"].ToString()); BE_UnidadMedida.n_idite = BE_Inventario.n_id; LstUnidades.Add(BE_UnidadMedida); } BE_Inventario.lst_unidadmedida = LstUnidades; } booAgregando = false; }
bool CamposOK() { bool booEstado = true; if (Convert.ToInt16(CboTipExis.SelectedValue) == 0) { MessageBox.Show("¡ No ha especificado el tipo de existencia !", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); booEstado = false; return(booEstado); } if (Convert.ToInt16(CboFamilia.SelectedValue) == 0) { MessageBox.Show("¡ No ha especificado la familia para el item !", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); booEstado = false; return(booEstado); } if (Convert.ToInt16(CboClase.SelectedValue) == 0) { MessageBox.Show("¡ No ha especificado la clase para el item !", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); booEstado = false; return(booEstado); } if (Convert.ToInt16(CboSubClase.SelectedValue) == 0) { MessageBox.Show("¡ No ha especificado la subclase para el item !", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); booEstado = false; return(booEstado); } if (Convert.ToInt16(CboMoneda.SelectedValue) == 0) { MessageBox.Show("¡ No ha especificado la moneda para el item !", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); booEstado = false; return(booEstado); } if (TxtDescripcion.Text == "") { MessageBox.Show("¡ No ha especificado la descripcion del item !", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); booEstado = false; return(booEstado); } if (TxtCodigo.Text == "") { MessageBox.Show("¡ No ha especificado el codigo del item !", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); booEstado = false; return(booEstado); } if (FgUniMed.Rows.Count != 2) { int intFila; // VERIFICAMOS QUE LOS DATOS DE LAS PRESENTACIONES ESTEN COMPLETAS for (intFila = 2; intFila <= FgUniMed.Rows.Count - 1; intFila++) { if (funFunciones.NulosC(FgUniMed.GetData(intFila, 1)) == "") { MessageBox.Show("¡ No ha especificado la unidad de medida de la presentacion en la fila " + (FgUniMed.Rows.Count - 2).ToString() + " !", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); booEstado = false; return(booEstado); } if (funFunciones.NulosC(FgUniMed.GetData(intFila, 2)) == "") { MessageBox.Show("¡ No ha especificado la descripcion de la presentacion en la fila " + (FgUniMed.Rows.Count - 2).ToString() + " !", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); booEstado = false; return(booEstado); } if (funFunciones.NulosC(FgUniMed.GetData(intFila, 3)) == "") { MessageBox.Show("¡ No ha especificado la unidad de medida base de la presentacion en la fila " + (FgUniMed.Rows.Count - 2).ToString() + " !", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); booEstado = false; return(booEstado); } if (funFunciones.NulosC(FgUniMed.GetData(intFila, 4)) == "") { MessageBox.Show("¡ No ha especificado la cantidad de la unidad de medida base de la presentacion en la fila " + (FgUniMed.Rows.Count - 2).ToString() + " !", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); booEstado = false; return(booEstado); } } bool booEligioPrincipal = false; // VERIFICAMOS SI SE HA ASIGNADO ALGUNA DE LAS PRESENTACIONES COMO PRINCIPAL for (intFila = 2; intFila <= FgUniMed.Rows.Count - 1; intFila++) { if (Convert.ToInt16(FgUniMed.GetData(intFila, 5)) == 1) { booEligioPrincipal = true; } } if (booEligioPrincipal == false) { MessageBox.Show("¡ Debe de indicar cual sera la presentacion principal del item !", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); booEstado = false; return(booEstado); } } else { MessageBox.Show("¡ No ha especificado las presentaciones para el item !", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); booEstado = false; return(booEstado); } return(booEstado); }