private void Txt_CanMov_KeyDown(object sender, KeyEventArgs e) { switch (e.KeyCode) { case Keys.Enter: e.SuppressKeyPress = true; if (Txt_CanMov.Text.Trim() != "" && Convert.ToDecimal(Txt_CanMov.Text) > 0) { Util.CambiarTxt(Txt_CanMov, Txt_CatMov); Txt_CatMov.Text = "0"; Txt_CatMov.SelectAll(); } else { MessageBox.Show("El campo de cantidad debe ser mayor a 0 ó esta vaio.", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Stop); Txt_CanMov.SelectAll(); } break; case Keys.Escape: e.SuppressKeyPress = true; Util.CambiarTxt(Txt_CanMov, Txt_CodPro); SwActivoM = false; break; } }
private void Txt_CatMov_KeyDown(object sender, KeyEventArgs e) { switch (e.KeyCode) { case Keys.Return: e.SuppressKeyPress = false; if (Txt_CatMov.Text.Trim() != "" && Convert.ToInt32(Txt_CatMov.Text) > 0) { if (Evento.CompareTo("Nuevo") == 0) { decimal Total = Convert.ToDecimal(Txt_CanMov.Text.Trim()) * Convert.ToDecimal(Lb_CosMov.Text.Trim()); string Result = string.Format("{0:0.00}", Total); string Vindex = Txt_CodPro.Text.PadLeft(8, '0'); ListViewItem itmx = listView1.FindItemWithText(Vindex); if (itmx == null) { string[] Arra = { Txt_CodPro.Text.Trim().PadLeft(8, '0'), Lb_DesPro.Text.Trim(), Lb_UndUnm.Text, Txt_CanMov.Text.Trim(), Txt_CatMov.Text.Trim(), Lb_CosMov.Text, Result }; ListViewItem itm = new ListViewItem(Arra); listView1.Items.Add(itm); listView1.SelectedItems.Clear(); listView1.FocusedItem = null; listView1.Refresh(); Util.CambiarTxt(Txt_CatMov, Txt_CodPro); MenuProductoLimpial(); } else { if (Evento2.CompareTo("Modificar") == 0 && SwActivoM == true) { listView1.SelectedItems[0].SubItems[3].Text = Txt_CanMov.Text; listView1.SelectedItems[0].SubItems[4].Text = Txt_CatMov.Text; Util.CambiarTxt(Txt_CatMov, Txt_CodPro); MenuProductoLimpial(); SwActivoM = false; } else { MessageBox.Show("El producto ya existe en la lista.", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Stop); //itmx.Remove(); } } } } else { MessageBox.Show("El campo de cantidad debe ser mayor a 0 ó esta vaio.", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Stop); Txt_CanMov.SelectAll(); } break; case Keys.Escape: e.SuppressKeyPress = true; Util.CambiarTxt(Txt_CatMov, Txt_CanMov); break; } }
private void Txt_CodPro_KeyDown(object sender, KeyEventArgs e) { switch (e.KeyCode) { case Keys.Enter: e.SuppressKeyPress = true; if (Txt_CodPro.Text.Trim() != "") { if (FunPR.Existe(Convert.ToInt32(Txt_CodPro.Text))) { if (FunPR.StatudAI(Convert.ToInt32(Txt_CodPro.Text))) { Llenar_Lb_DesPro(Convert.ToInt32(Txt_CodPro.Text)); Llenar_Lb_UndUnm(Convert.ToInt32(Txt_CodPro.Text)); Llenar_Lb_PrePro(Convert.ToInt32(Txt_CodPro.Text)); Util.CambiarTxt(Txt_CodPro, Txt_CanMov); Txt_CanMov.Text = "0"; Txt_CanMov.SelectAll(); } else { MessageBox.Show("El producto se encuentra inativo.", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Stop); Txt_CodPro.SelectAll(); } } else { MessageBox.Show("El producto no extiste.", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Stop); Txt_CodPro.SelectAll(); } } else { FormBUSQUEDAS f = new FormBUSQUEDAS(); f.ListaProductosAI(); f.ShowDialog(); if (f._CodPro != "") { Txt_CodPro.Text = f._CodPro; Llenar_Lb_DesPro(Convert.ToInt32(Txt_CodPro.Text)); Llenar_Lb_UndUnm(Convert.ToInt32(Txt_CodPro.Text)); Llenar_Lb_PrePro(Convert.ToInt32(Txt_CodPro.Text)); Util.CambiarTxt(Txt_CodPro, Txt_CanMov); Txt_CanMov.Text = "0"; Txt_CanMov.SelectAll(); } } break; case Keys.Escape: e.SuppressKeyPress = true; Util.CambiarTxt(Txt_CodPro, Txt_DotMov); MenulistView(false); Txt_CodPro.Text = ""; break; } }
private void AcOpcion() { FormOPCIONES F = new FormOPCIONES(); F.Lb_Titulo1.Text = "Opciones"; F.Lb_Titulo2.Text = "ESC - Salir"; F.Opc = new string[] { "Nuevo", "Modificar", "Eliminar" }; //this.Hide(); F.ShowDialog(); this.Show(); // MessageBox.Show(F.Returno); switch (F.Returno) { case "1": Evento2 = "Nuevo"; MenulistView(true); MenulistViewReset(); Txt_CodPro.Clear(); Txt_CodPro.Enabled = true; Txt_CodPro.Focus(); Txt_CodPro.SelectAll(); Txt_CodPro.BackColor = Color.Turquoise; break; case "2": if (listView1.SelectedItems.Count > 0) { Evento2 = "Modificar"; MenulistView(true); MenulistViewReset(); Txt_CodPro.Text = listView1.SelectedItems[0].SubItems[0].Text; Lb_DesPro.Text = listView1.SelectedItems[0].SubItems[1].Text; Lb_UndUnm.Text = listView1.SelectedItems[0].SubItems[2].Text; Txt_CanMov.Text = listView1.SelectedItems[0].SubItems[3].Text; Txt_CatMov.Text = listView1.SelectedItems[0].SubItems[4].Text; Lb_CosMov.Text = listView1.SelectedItems[0].SubItems[5].Text; Txt_CanMov.Enabled = true; Txt_CanMov.Focus(); Txt_CanMov.SelectAll(); Txt_CanMov.BackColor = Color.Turquoise; SwActivoM = true; } break; case "3": foreach (ListViewItem item in listView1.SelectedItems) { listView1.Items.Remove(item); } if (listView1.Items.Count == 0) { Evento2 = "Nuevo"; MenulistView(true); MenulistViewReset(); Txt_CodPro.Clear(); Txt_CodPro.Enabled = true; Txt_CodPro.Focus(); Txt_CodPro.SelectAll(); Txt_CodPro.BackColor = Color.Turquoise; } break; default: //MessageBox.Show("ESCAPE"); break; } }