/// <summary> /// This method clean the textboxs and other things /// </summary> public void Limpiar() { Txt_Cantidad.Clear(); Txt_Marca.Clear(); Txt_Modelo.Clear(); Txt_Precio.Clear(); Txt_Tipo.Clear(); Btn_Limpiar.Enabled = false; Btn_mod.Enabled = false; Btn_Eliminar.Enabled = false; Btn_Reg.Enabled = true; dataGridView1.CurrentRow.Selected = false; }
private void Txt_Cantidad_TextChanged_1(object sender, EventArgs e) { int rowActual; rowActual = 0; if (dtg_Factura.Rows[rowActual].Cells["Codigo"].Value != null) { CalcularDevolucion(); } else { //MessageBox.Show("Ingrese un Producto Antes de Ingresar una Cantidad de Ingreso"); Txt_Cantidad.Clear(); return; } }
private void Cmb_TipoPago_SelectedValueChanged(object sender, EventArgs e) { if (Cmb_TipoPago.SelectedIndex != -1) { if (Int32.Parse(Cmb_TipoPago.SelectedValue.ToString()) == 1) { Txt_Cantidad.Enabled = true; Txt_Cantidad.Clear(); Txt_Devolucion.Text = "0.0"; } else { Txt_Cantidad.Enabled = false; Txt_Cantidad.Clear(); Txt_Devolucion.Text = "0.0"; Txt_Cantidad.Text = Txt_Total.Text; } } }
private void NotLetter(object sender, KeyPressEventArgs e) { if (sender == Txt_CodigoProducto && e.KeyChar == (Char)Keys.Enter) { e.Handled = true; Txt_Descripcion.Select(); } if (sender == Txt_Descripcion && e.KeyChar == (Char)Keys.Enter) { e.Handled = true; Txt_DescripcionTicket.Select(); } if (sender == Txt_DescripcionTicket && e.KeyChar == (Char)Keys.Enter) { e.Handled = true; Txt_Cantidad.Select(); } if (sender == Txt_Cantidad && e.KeyChar == (Char)Keys.Enter) { e.Handled = true; Txt_PrecioCosto.Select(); } if (sender == Txt_PrecioCosto && e.KeyChar == (Char)Keys.Enter) { e.Handled = true; Txt_PrecioVenta.Select(); } if (sender == Txt_PrecioVenta && e.KeyChar == (Char)Keys.Enter) { e.Handled = true; Txt_StockCritico.Select(); } if (sender == Txt_StockCritico) { if (e.KeyChar == (char)Keys.Enter) { e.Handled = true; Btn_Aceptar.Select(); } if (!(char.IsNumber(e.KeyChar)) && (e.KeyChar != (char)Keys.Back)) { e.Handled = true; } } if (Txt_PorcentajeGanancia == sender && e.KeyChar == (char)Keys.Enter) { double costo = 0, porcentaje = 0, venta = 0; if (Txt_PrecioCosto.Text != "") { costo = Convert.ToDouble(Txt_PrecioCosto.Text); } if (Txt_PrecioVenta.Text != "" && Txt_PorcentajeGanancia.Text != "") { porcentaje = Convert.ToDouble(Txt_PorcentajeGanancia.Text); } venta = Math.Round((costo + ((porcentaje * costo) / 100)), 2); Txt_PrecioVenta.Text = venta.ToString(); cb_prove.Select(); } if (Txt_PrecioVenta == sender) { TextBoxComas(sender, e, Txt_PrecioVenta); if (e.KeyChar == (char)Keys.Enter) { double Venta = Convert.ToDouble(Txt_PrecioVenta.Text); double Costo = Convert.ToDouble(Txt_PrecioCosto.Text); Txt_PorcentajeGanancia.Text = (Math.Round((((Venta - Costo) * 100) / Costo), 2)).ToString(); } } if (Txt_PrecioCosto == sender) { TextBoxComas(sender, e, Txt_PrecioCosto); } }
private void CalcularDevolucion() { double total; double cantidad; double devolucion; if (!chk_VariosPagos.Checked) { if (Txt_Total.Text != String.Empty && Txt_Cantidad.Text != String.Empty) { total = Double.Parse(Txt_Total.Text); try { cantidad = Double.Parse(Txt_Cantidad.Text); } catch (Exception) { MessageBox.Show("El Número de Cantidad no es Válido, Revise La Cantidad Por Favor", "Gestion Ventas", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); Txt_Cantidad.Clear(); Txt_SubTotal.Clear(); Txt_IGV.Clear(); Txt_Total.Clear(); return; //cantidad = double.Parse(Txt_Cantidad.Text); } devolucion = cantidad - total; if (devolucion > 0) { Txt_Devolucion.Text = String.Format("{0:0.00}", devolucion); } else { Txt_Devolucion.Clear(); } } } else { try { total = Double.Parse(Txt_Total.Text); } catch (Exception) { total = 0; } cantidad = 0; foreach (DataGridViewRow row in dgv_TipoPago.Rows) { if (row.Cells["CantidadPago"].Value != null) { try { cantidad += Double.Parse(row.Cells["CantidadPago"].Value.ToString()); } catch (Exception e) { row.Cells["CantidadPago"].Value = 0; } } } Txt_Devolucion.Text = String.Format("{0:0.00}", cantidad); } }
///******************************************************************************* ///NOMBRE DE LA FUNCIÓN: Txt_Contenedor_KeyPress ///DESCRIPCIÓN : Consulta el contenedor al presionar la tecla enter ///PARAMENTROS : ///CREO : Miguel Angel Bedolla Moreno ///FECHA_CREO : 12/Abr/2013 05:27 p.m. ///MODIFICO : ///FECHA_MODIFICO: ///CAUSA_MODIFICACIÓN: ///******************************************************************************* private void Txt_Contenedor_KeyPress(object sender, KeyPressEventArgs e) { Lbl_Cantidad.Visible = false; Txt_Cantidad.Visible = false; Txt_Cantidad.Enabled = false; if (e.KeyChar == (char)Keys.Enter) { if (Txt_Contenedor.Text.Trim() != "") { Cls_Ope_Entradas_Negocio P_Contenedores = new Cls_Ope_Entradas_Negocio(); DataTable Dt_Contenedor = new DataTable(); P_Contenedores.P_Codigo_Contenedor = Txt_Contenedor.Text.ToUpper().Replace("-", "");; P_Contenedores.P_Estatus_Contenedor = "ACTIVO"; Dt_Contenedor = P_Contenedores.Consultar_Detalles_Entrada(); if (Dt_Contenedor.Rows.Count > 0) { Txt_Contenedor_Id.Text = Dt_Contenedor.Rows[0][Ope_Det_Movimientos_Entrada.Campo_Contenedor_Id].ToString(); Txt_Comentarios.Text = Dt_Contenedor.Rows[0][Ope_Det_Movimientos_Entrada.Campo_Comentarios].ToString(); Txt_Destino.Text = Dt_Contenedor.Rows[0][Cat_Destinos.Campo_Destino].ToString(); Txt_Orden_Entrada.Text = Dt_Contenedor.Rows[0][Ope_Entradas.Campo_Orden_Entrada].ToString(); Txt_Fecha.Text = Convert.ToDateTime(Dt_Contenedor.Rows[0][Ope_Entradas.Campo_Fecha_Envio].ToString()).ToString("dd/MMM/yyyy hh:mm:ss tt"); Txt_Cantidad.Text = Dt_Contenedor.Rows[0][Ope_Det_Movimientos_Entrada.Campo_Cantidad].ToString(); Txt_No_Entrada.Text = Dt_Contenedor.Rows[0][Ope_Entradas.Campo_No_Entrada].ToString(); if (Dt_Contenedor.Rows[0][Cat_Tipos_Contenedores.Campo_Es_Charola].ToString().Trim() == "S") { Lbl_Cantidad.Visible = true; Txt_Cantidad.Visible = true; Txt_Cantidad.Enabled = true; } if (Dt_Contenedor.Rows[0][Cat_Tipos_Contenedores.Campo_Uso].ToString().Contains("WIP")) { Cmb_Ubicacion_Wip_Fg.Visible = true; Cmb_Ubicacion_Fg.Visible = false; Cmb_Ubicacion_Wip_Fg.Focus(); } else { Cmb_Ubicacion_Wip_Fg.Visible = false; Cmb_Ubicacion_Fg.Visible = true; Cmb_Ubicacion_Fg.Focus(); } DataTable Dt_Contenedores = (DataTable)Grid_Contenedores_Entrada.DataSource; for (int Cont_Contenedores = 0; Cont_Contenedores < Dt_Contenedores.Rows.Count; Cont_Contenedores++) { if (Dt_Contenedores.Rows[Cont_Contenedores][Cat_Contenedores.Campo_Contenedor_Id].ToString() == Txt_Contenedor_Id.Text) { Txt_Contenedor.Text = ""; Txt_Contenedor_Id.Text = ""; Txt_Observaciones_Contenedor.Text = ""; Txt_Destino.Text = ""; Txt_Fecha.Text = ""; Txt_Cantidad.Text = ""; Txt_No_Entrada.Text = ""; Txt_Orden_Entrada.Text = ""; Txt_Contenedor.Focus(); MessageBox.Show("El contenedor ya se encuentra cargado para su recepción.", "Recepción de contenedores", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); } } Txt_Observaciones_Contenedor.Focus(); if (Txt_Cantidad.Visible) { Txt_Cantidad.Focus(); } } else { Txt_Contenedor_Id.Text = ""; Txt_Comentarios.Text = ""; Txt_Destino.Text = ""; Txt_Fecha.Text = ""; Txt_Cantidad.Text = ""; Txt_No_Entrada.Text = ""; Txt_Contenedor.Focus(); MessageBox.Show("No existe salida para el contenedor ingresado", "Recepción de contenedores", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); } } else { MessageBox.Show("Ingrese el código del contenedor", "Recepción de contenedores", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); } } }