private void CargarGrilla(string Nombre, string CodigoBarra, string Codigo) { string Tabla = ""; if (chkLibreria.Checked == true) { Tabla = "Articulo"; } else { Tabla = "Juguete"; } Int32?CodMarca = null; if (cmbMarca.SelectedIndex > 0) { CodMarca = Convert.ToInt32(cmbMarca.SelectedValue); } cFunciones fun = new cFunciones(); cArticulo art = new Clases.cArticulo(); cJuguete jug = new cJuguete(); DataTable trdo = new DataTable(); if (Tabla == "Articulo") { trdo = art.GetDetalleArticulo(Nombre, CodigoBarra, Codigo, Tabla); } if (Tabla == "Juguete") { trdo = jug.GetDetalleArticulo(Nombre, CodigoBarra, Codigo, CodMarca); } trdo = fun.TablaaMiles(trdo, "PrecioEfectivo"); trdo = fun.TablaaMiles(trdo, "PrecioTarjeta"); trdo = fun.TablaaMiles(trdo, "Descuento"); Grilla.DataSource = trdo; Grilla.Columns[0].Visible = false; Grilla.Columns[5].Visible = false; Grilla.Columns[3].Width = 410; Grilla.Columns[6].HeaderText = "Tarjeta"; Grilla.Columns[8].HeaderText = "Efectivo/Deb"; DataGridViewCellStyle style = new DataGridViewCellStyle(); style.Font = new Font(Grilla.Font, FontStyle.Bold); Grilla.Columns[8].DefaultCellStyle = style; //Grilla.Rows[8].DefaultCellStyle = style; }
private void btnAplicar_Click(object sender, EventArgs e) { /* * for (int i = 0; i < Lista.Items.Count; i++) * { * Boolean op = Lista.GetSelected(i); * if (op == true) * { * string msj = Lista.Items[i].ToString(); * * } * } */ if (txtPorcentaje.Text == "") { Mensaje("Debe ingresar un porcentaje"); return; } int b = 0; int Por = Convert.ToInt32(txtPorcentaje.Text); Int32 CodMarca = 0; cJuguete jug = new cJuguete(); foreach (var item in Lista.CheckedItems) { DataRowView dataRowView = item as DataRowView; //Suponiendo que estás utilizando un DataTable haces un cast pues item es de tipo object string id = Convert.ToString(dataRowView["CodMarca"]); CodMarca = Convert.ToInt32(id); jug.ActualizarPrecioxMarca(CodMarca, Por); b = 1; //estados += id; } if (b == 1) { Mensaje("Datos grabados correctamente"); } else { Mensaje("Debe seleccionar algun registro para continuar"); } // Verificar(); }
private void LlenarComboArticulo() { cFunciones fun = new cFunciones(); cArticulo art = new cArticulo(); cJuguete jug = new cJuguete(); DataTable trdo = art.GetTodosArticulos(); txt_Nombre.DataSource = trdo; txt_Nombre.ValueMember = "CodArticulo"; txt_Nombre.DisplayMember = "Nombre"; AutoCompleteStringCollection coleccion = new AutoCompleteStringCollection(); foreach (DataRow r in trdo.Rows) { coleccion.Add(r["Nombre"].ToString()); } txt_Nombre.AutoCompleteCustomSource = coleccion; txt_Nombre.AutoCompleteMode = AutoCompleteMode.SuggestAppend; txt_Nombre.AutoCompleteSource = AutoCompleteSource.CustomSource; txt_Nombre.SelectedIndex = -1; }
private void BuscarJuguetexCodigo(string Codigo) { int b = 0; int Operacion = 0; if (CmbTipoOperacion.SelectedIndex > 0) { Operacion = Convert.ToInt32(CmbTipoOperacion.SelectedValue); } cJuguete jug = new cJuguete(); DataTable trdo = jug.GetJuguetexCodigo(Codigo); if (trdo.Rows.Count > 0) { b = 1; txtCodigo.Text = trdo.Rows[0]["CodArticulo"].ToString(); txt_Nombre.SelectedValue = trdo.Rows[0]["CodArticulo"].ToString(); txt_CodigoBarra.Text = trdo.Rows[0]["CodigoBarra"].ToString(); txt_Nombre.Text = trdo.Rows[0]["Nombre"].ToString(); txt_Stock.Text = trdo.Rows[0]["Stock"].ToString(); if (Operacion == 1) { txtPrecio.Text = trdo.Rows[0]["PrecioEfectivo"].ToString(); } if (Operacion == 2) { txtPrecio.Text = trdo.Rows[0]["PrecioTarjeta"].ToString(); Double Precio = Convert.ToDouble(trdo.Rows[0]["PrecioTarjeta"].ToString()); Precio = Precio - 0.10 * Precio; txtDescuento.Text = Precio.ToString(); } if (Operacion == 3) { txtPrecio.Text = trdo.Rows[0]["PrecioEfectivo"].ToString(); } if (txtPrecio.Text != "") { Double Precio = Convert.ToDouble(txtPrecio.Text); Precio = Math.Round(Precio, 0); txtPrecio.Text = Precio.ToString(); } if (txtDescuento.Text != "") { Double Precio = Convert.ToDouble(txtDescuento.Text); Precio = Math.Round(Precio, 0); txtDescuento.Text = Precio.ToString(); } if (b == 1) { PuedeAgregar = true; txtCantidad.Focus(); } } else { txtCodigo.Text = ""; // if (txt_Nombre.Items.Count > 0) // txt_Nombre.SelectedIndex = 0; txt_CodigoBarra.Text = ""; txt_Nombre.Text = ""; txt_Stock.Text = ""; txtDescuento.Text = ""; txtPrecio.Text = ""; //txtCantidad.Text = ""; } }
private void txt_Nombre_SelectedIndexChanged(object sender, EventArgs e) { Boolean EsJuguete = false; if (radioJugueteria.Checked == true) { EsJuguete = true; } int b = 0; int Operacion = 0; if (CmbTipoOperacion.SelectedIndex > 0) { Operacion = Convert.ToInt32(CmbTipoOperacion.SelectedValue); } if (Cargando == false) { if (EsJuguete == false) { if (txt_Nombre.SelectedIndex > 0) { Int32 CodArt = Convert.ToInt32(txt_Nombre.SelectedValue); cArticulo art = new Clases.cArticulo(); DataTable trdo = art.GetArticuloxCodArt(CodArt); if (trdo.Rows.Count > 0) { b = 1; radioLibreria.Checked = true; radioJugueteria.Checked = false; txtCodigo.Text = trdo.Rows[0]["CodArticulo"].ToString(); //txt_Nombre.Text = trdo.Rows[0]["Nombre"].ToString(); txt_CodigoBarra.Text = trdo.Rows[0]["CodigoBarra"].ToString(); // txt_Codigo.Text = trdo.Rows[0]["Codigo"].ToString(); txt_Stock.Text = trdo.Rows[0]["Stock"].ToString(); if (Operacion == 1) { txtPrecio.Text = trdo.Rows[0]["PrecioEfectivo"].ToString(); } if (Operacion == 2) { txtPrecio.Text = trdo.Rows[0]["PrecioTarjeta"].ToString(); Double Precio = Convert.ToDouble(trdo.Rows[0]["PrecioTarjeta"].ToString()); Precio = Precio - 0.10 * Precio; txtDescuento.Text = Precio.ToString(); } if (Operacion == 3) { txtPrecio.Text = trdo.Rows[0]["PrecioEfectivo"].ToString(); } if (txtPrecio.Text != "") { Double Precio = Convert.ToDouble(txtPrecio.Text); Precio = Math.Round(Precio, 0); txtPrecio.Text = Precio.ToString(); } if (txtDescuento.Text != "") { Double Precio = Convert.ToDouble(txtDescuento.Text); Precio = Math.Round(Precio, 0); txtDescuento.Text = Precio.ToString(); } PuedeAgregar = true; txtCantidad.Focus(); } } } if (EsJuguete == true) { //busco juguete radioLibreria.Checked = false; radioJugueteria.Checked = true; Int32 CodArt = Convert.ToInt32(txt_Nombre.SelectedValue); cJuguete jug = new cJuguete(); DataTable trdo = jug.GetArticuloxCodArt(CodArt); if (trdo.Rows.Count > 0) { txtCodigo.Text = trdo.Rows[0]["CodArticulo"].ToString(); //txt_Nombre.Text = trdo.Rows[0]["Nombre"].ToString(); txt_CodigoBarra.Text = trdo.Rows[0]["CodigoBarra"].ToString(); // txt_Codigo.Text = trdo.Rows[0]["Codigo"].ToString(); txt_Stock.Text = trdo.Rows[0]["Stock"].ToString(); if (Operacion == 1) { txtPrecio.Text = trdo.Rows[0]["PrecioEfectivo"].ToString(); } if (Operacion == 2) { txtPrecio.Text = trdo.Rows[0]["PrecioTarjeta"].ToString(); Double Precio = Convert.ToDouble(trdo.Rows[0]["PrecioTarjeta"].ToString()); Precio = Precio - 0.10 * Precio; txtDescuento.Text = Precio.ToString(); } if (Operacion == 3) { txtPrecio.Text = trdo.Rows[0]["PrecioEfectivo"].ToString(); } if (txtPrecio.Text != "") { Double Precio = Convert.ToDouble(txtPrecio.Text); Precio = Math.Round(Precio, 0); txtPrecio.Text = Precio.ToString(); } if (txtDescuento.Text != "") { Double Precio = Convert.ToDouble(txtDescuento.Text); Precio = Math.Round(Precio, 0); txtDescuento.Text = Precio.ToString(); } PuedeAgregar = true; txtCantidad.Focus(); } } } }
private void txt_CodigoBarra_TextChanged(object sender, EventArgs e) { int b = 0; int Operacion = 0; if (CmbTipoOperacion.SelectedIndex > 0) { Operacion = Convert.ToInt32(CmbTipoOperacion.SelectedValue); } if (txt_CodigoBarra.Text.Length < 5) { return; } string Codigo = txt_CodigoBarra.Text; cArticulo art = new cArticulo(); cJuguete jug = new cJuguete(); if (radioJugueteria.Checked == true) { DataTable trdo = jug.GetArticulo("", Codigo, ""); if (trdo.Rows.Count > 0) { b = 1; txtCodigo.Text = trdo.Rows[0]["CodArticulo"].ToString(); txt_Nombre.SelectedValue = trdo.Rows[0]["CodArticulo"].ToString(); txt_CodigoBarra.Text = trdo.Rows[0]["CodigoBarra"].ToString(); txt_Nombre.Text = trdo.Rows[0]["Nombre"].ToString(); txt_Stock.Text = trdo.Rows[0]["Stock"].ToString(); if (Operacion == 1) { txtPrecio.Text = trdo.Rows[0]["PrecioEfectivo"].ToString(); } if (Operacion == 2) { txtPrecio.Text = trdo.Rows[0]["PrecioTarjeta"].ToString(); Double Precio = Convert.ToDouble(trdo.Rows[0]["PrecioTarjeta"].ToString()); Precio = Precio - 0.10 * Precio; txtDescuento.Text = Precio.ToString(); } if (Operacion == 3) { txtPrecio.Text = trdo.Rows[0]["PrecioEfectivo"].ToString(); } if (txtPrecio.Text != "") { Double Precio = Convert.ToDouble(txtPrecio.Text); Precio = Math.Round(Precio, 0); txtPrecio.Text = Precio.ToString(); } if (txtDescuento.Text != "") { Double Precio = Convert.ToDouble(txtDescuento.Text); Precio = Math.Round(Precio, 0); txtDescuento.Text = Precio.ToString(); } if (b == 1) { PuedeAgregar = false; txtCantidad.Focus(); } } } if (radioLibreria.Checked == true) { DataTable trdo = art.GetArticulo("", Codigo, ""); if (trdo.Rows.Count > 0) { b = 1; txtCodigo.Text = trdo.Rows[0]["CodArticulo"].ToString(); txt_Nombre.SelectedValue = trdo.Rows[0]["CodArticulo"].ToString(); txt_CodigoBarra.Text = trdo.Rows[0]["CodigoBarra"].ToString(); txt_Nombre.Text = trdo.Rows[0]["Nombre"].ToString(); txt_Stock.Text = trdo.Rows[0]["Stock"].ToString(); if (Operacion == 1) { txtPrecio.Text = trdo.Rows[0]["PrecioEfectivo"].ToString(); } if (Operacion == 2) { txtPrecio.Text = trdo.Rows[0]["PrecioTarjeta"].ToString(); Double Precio = Convert.ToDouble(trdo.Rows[0]["PrecioTarjeta"].ToString()); Precio = Precio - 0.10 * Precio; txtDescuento.Text = Precio.ToString(); } if (Operacion == 3) { txtPrecio.Text = trdo.Rows[0]["PrecioEfectivo"].ToString(); } if (txtPrecio.Text != "") { Double Precio = Convert.ToDouble(txtPrecio.Text); Precio = Math.Round(Precio, 0); txtPrecio.Text = Precio.ToString(); } if (txtDescuento.Text != "") { Double Precio = Convert.ToDouble(txtDescuento.Text); Precio = Math.Round(Precio, 0); txtDescuento.Text = Precio.ToString(); } if (b == 1) { PuedeAgregar = false; txtCantidad.Focus(); } } } }