private void textBox1_KeyDown(object sender, KeyEventArgs e) { DataTable midatatable = new DataTable(); if (e.KeyCode == Keys.Enter) { if (CBBuscarportipo.Text == "ADJUDICACION") { midatatable = NegocioRetirodeMercaderia.buscarconcatenacion(0, "", "", DateTime.Now.ToString("dd/MM/yyyy"), DateTime.Now.ToString("dd/MM/yyyy"), false, false, false, false, 0, true, Convert.ToInt32(textBox1.Text)); } if (CBBuscarportipo.Text == "VENTA") { midatatable = NegocioRetirodeMercaderia.buscarconcatenacion(0, "", "", DateTime.Now.ToString("dd/MM/yyyy"), DateTime.Now.ToString("dd/MM/yyyy"), false, false, false, false, 0, false, 0, true, Convert.ToInt32(textBox1.Text)); } if (midatatable.Rows.Count != 0) { DataRow row = midatatable.Rows[0]; LblNorden.Text = row["Orden"].ToString(); LblRazonsocial.Text = row["NombreBeneficiado"].ToString(); LblCuit.Text = row["cuit"].ToString(); LblEstado.Text = row["estado"].ToString(); LblTipo.Text = row["Tipo"].ToString(); LblCodcliente.Text = row["CodEmpresaB"].ToString(); LblEmpresa.Text = row["Tipo"].ToString() == "VENTA" ? NegocioConfigEmpresa.emrazonsocial : row["razon_social"].ToString(); idempresa = row["Tipo"].ToString() == "VENTA" ? 1 : Convert.ToInt32(row["codcliente"].ToString()); cargardetalleretiro(Convert.ToInt32(row["Orden"].ToString())); Txtitems.Focus(); } else { UtilityFrm.mensajeError("La orden que ingreso es inexistente"); textBox1.SelectAll(); } } }
private void cambiartextbox() { if (CHKCambiarcantidad.Checked == true) { if (indice < 0) { GDDetalleretiro.Rows[GDDetalleretiro.Rows.Count - 1].Cells[3].Selected = true; } else { GDDetalleretiro.Rows[indice].Cells[3].Selected = true; } // DGDetalleitems.Rows[DGDetalleitems.CurrentCell.RowIndex].Selected = true; Rectangle rec = GDDetalleretiro.GetCellDisplayRectangle(GDDetalleretiro.CurrentCell.ColumnIndex, GDDetalleretiro.CurrentCell.RowIndex, false); GDDetalleretiro.Focus(); TxtcambioDv.Location = new Point(rec.Location.X + GDDetalleretiro.Location.X, rec.Location.Y + GDDetalleretiro.Location.Y); TxtcambioDv.Visible = true; TxtcambioDv.Text = GDDetalleretiro.CurrentCell.Value.ToString(); TxtcambioDv.Focus(); } else { Txtitems.Focus(); } }
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e) { if (tabControl1.SelectedTab == tabPage1) { Txtitems.Focus(); } if (tabControl1.SelectedTab == tabPage2) { DGListado.DataSource = NegocioRetirodeMercaderia.buscarconcatenacion(idcliente, CBEstado.Text, "", dtpFechaIni.Value.ToString("dd/MM/yyyy"), dtpFechaFin.Value.ToString("dd/MM/yyyy"), CHKCliente.Checked, CHKEstado.Checked, CHKTipo.Checked, CHKFecha.Checked, Convert.ToInt32(CbTipopedido.SelectedValue)); } }
private void TXTCantidad_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (TXTCantidad.Text != "") { recorreritems(Convert.ToInt64(Txtitems.Text), Convert.ToInt32(TXTCantidad.Text)); Txtitems.Text = ""; TXTCantidad.Text = "0"; Txtitems.Focus(); CHKCambiarcantidad.Checked = false; } } }
private void recorreritems(long codigobarra, int numeroincrementado = 1, bool buscaritems = true) { int contador = -1; bool encontrado = false; indice = -1; foreach (DataGridViewRow row in GDDetalleretiro.Rows) { contador = contador + 1; if (buscaritems == true) { if (Convert.ToInt64(row.Cells["codigobarra"].Value) == codigobarra) { encontrado = true; indice = contador; row.Cells["canactual"].Value = Convert.ToString(Convert.ToInt32(row.Cells["canactual"].Value) + numeroincrementado); row.Cells["canparcial"].Value = Convert.ToString(Convert.ToInt32(row.Cells["canparcial"].Value) + numeroincrementado); //GDDetalleretiro.CurrentCell = 1; //row.Selected = true; GDDetalleretiro.CurrentCell = GDDetalleretiro.Rows[row.Index].Cells[0]; //Me.dgv.FirstDisplayedScrollingRowIndex = I } if (Convert.ToInt32(row.Cells["canparcial"].Value) > Convert.ToInt32(row.Cells["cantotal"].Value)) { UtilityFrm.mensajeError("La cantidad supera al total"); row.Cells["canactual"].Value = Convert.ToString(Convert.ToInt32(row.Cells["canactual"].Value) - numeroincrementado); row.Cells["canparcial"].Value = Convert.ToString(Convert.ToInt32(row.Cells["canparcial"].Value) - numeroincrementado); } } if (Convert.ToInt32(row.Cells["canparcial"].Value) == Convert.ToInt32(row.Cells["cantotal"].Value)) { row.DefaultCellStyle.BackColor = Color.FromArgb(189, 236, 182); } else { row.DefaultCellStyle.BackColor = Color.White; } } if (encontrado == false && buscaritems == true) { UtilityFrm.mensajeError("El codigo que esta buscando no pertenece a la planilla"); } Txtitems.SelectAll(); }