private void BuscarRecibo() { try { this.Height = 192; ReciboLogica rec = new ReciboLogica(); rec.Usuario = _lsUser; if (!ReciboLogica.ConsultaPendientesRec(rec)) { return; } DataTable datos = ReciboLogica.ListarPendientesRec(rec); for (int x = 0; x < datos.Rows.Count; x++) { string sRecibo = datos.Rows[x][0].ToString(); int iCons = Convert.ToInt32(datos.Rows[x][1].ToString()); if (ImprimeEtiqueta(sRecibo, iCons)) { rec.Recibo = sRecibo; rec.Consec = iCons; ReciboLogica.ReciboPrint(rec); } } } catch (Exception ex) { ex.ToString(); throw; } }
private bool ImprimeEtiqueta(string _asRecibo, int _aiConsec) { this.Cursor = Cursors.WaitCursor; bool bPrint = false; try { ReciboLogica rec = new ReciboLogica(); rec.Recibo = _asRecibo; rec.Consec = _aiConsec; DataTable datos = ReciboLogica.ConsultaReciboMov(rec); if (datos.Rows.Count > 0) { string sFecha = datos.Rows[0]["f_carga"].ToString(); string sOrden = datos.Rows[0]["orden"].ToString(); string sArticulo = datos.Rows[0]["no_art"].ToString(); string sDescrip = datos.Rows[0]["desc_art"].ToString(); double dCant = Double.Parse(datos.Rows[0]["cantidad"].ToString()); string sUM = datos.Rows[0]["um"].ToString(); string sUsuario = datos.Rows[0]["recibio"].ToString(); bPrint = GeneraEtiqueta(_asRecibo, sOrden, sFecha, sArticulo, sDescrip, dCant, sUM, sUsuario); } } catch (Exception ex) { this.Cursor = Cursors.Arrow; MessageBox.Show(ex.ToString(), Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); bPrint = false; Close(); } this.Cursor = Cursors.Arrow; return(bPrint); }
private void cbbbArticulo_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode != Keys.Enter) { return; } if (_lsArea == "REC") { if (string.IsNullOrEmpty(txtRecibo.Text)) { return; } } if (string.IsNullOrEmpty(cbbbArticulo.Text)) { return; } try { string sCve = txtRecibo.Text.ToString(); string sTipo = string.Empty; if (sCve.IndexOf("REC") != -1) { sTipo = "R"; } if (sCve.IndexOf("ORD") != -1) { sTipo = "O"; } if (_lsArea == "REC" || _lsArea == "IT") { #region regRecibo ReciboLogica rec = new ReciboLogica(); rec.Articulo = cbbbArticulo.Text.ToString().ToUpper().Trim(); DataTable dt = new DataTable(); if (sTipo == "R") { rec.Recibo = sCve; dt = ReciboLogica.ConsultaReciboArt(rec); } else { rec.Orden = sCve; dt = ReciboLogica.ConsultaOrdenArt(rec); } if (dt.Rows.Count > 0) { int iCons = Int32.Parse(dt.Rows[0]["consec"].ToString()); if (sTipo == "O") { sCve = dt.Rows[0]["recibo"].ToString(); } rec.Recibo = sCve; rec.Consec = iCons; if (ImprimeEtiqueta(sCve, iCons)) { ReciboLogica.ReciboPrint(rec); } } else { //buscar dentro de Innova InnovaLogica irec = new InnovaLogica(); irec.Articulo = rec.Articulo; if (sTipo == "R") { irec.Recibo = sCve; dt = InnovaLogica.ConsultaReciboArt(irec); } else { irec.Orden = sCve; dt = InnovaLogica.ConsultaOrdenArt(irec); } if (dt.Rows.Count > 0) { int iCons = Int32.Parse(dt.Rows[0]["csc_mov"].ToString()); if (sTipo == "O") { sCve = dt.Rows[0]["no_recibo"].ToString(); } rec.Recibo = sCve; rec.Consec = iCons; ImprimeEtiquetaInnova(sCve, iCons); } else { MessageBox.Show("No se encontro el Artículo", Text, MessageBoxButtons.OK, MessageBoxIcon.Information); cbbbArticulo.ResetText(); return; } } #endregion } else { #region regArticulo InnovaLogica irec = new InnovaLogica(); irec.Articulo = cbbbArticulo.Text.ToString().ToUpper().Trim(); DataTable dtA = InnovaLogica.ConsultaArticulo(irec); if (dtA.Rows.Count > 0) { string sArtNombre = dtA.Rows[0]["desc_esp"].ToString(); string sUM = dtA.Rows[0]["um"].ToString(); txtDesc.Text = sArtNombre; txtUM.Text = sUM; txtCant.Focus(); } #endregion } } catch (Exception ex) { MessageBox.Show("Error." + Environment.NewLine + ex.ToString(), Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } }
private void txtRecibo_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode != Keys.Enter) { return; } if (string.IsNullOrEmpty(txtRecibo.Text) || string.IsNullOrWhiteSpace(txtRecibo.Text)) { return; } string sCve = txtRecibo.Text.ToString().Trim(); string sTipo = string.Empty; if (sCve.IndexOf("REC") != -1) { sTipo = "R"; } if (sCve.IndexOf("ORD") != -1) { sTipo = "O"; } try { ReciboLogica rec = new ReciboLogica(); rec.Recibo = sCve; DataTable dt = new DataTable(); if (sTipo == "R") { dt = ReciboLogica.ConsultaRecibo(rec); } else { rec.Orden = sCve; dt = ReciboLogica.ConsultaOrden(rec); } if (dt.Rows.Count > 0) { cbbbArticulo.DataSource = dt; cbbbArticulo.ValueMember = "no_art"; cbbbArticulo.DisplayMember = "no_art"; cbbbArticulo.SelectedIndex = -1; } else { //buscar dentro de Innova InnovaLogica inn = new InnovaLogica(); inn.Recibo = sCve; if (sTipo == "R") { dt = InnovaLogica.ConsultaRecibo(inn); } else { inn.Orden = sCve; dt = InnovaLogica.ConsultaOrden(inn); } if (dt.Rows.Count > 0) { cbbbArticulo.DataSource = dt; cbbbArticulo.ValueMember = "no_art"; cbbbArticulo.DisplayMember = "no_art"; cbbbArticulo.SelectedIndex = -1; } else { MessageBox.Show("No se encontro el documento", Text, MessageBoxButtons.OK, MessageBoxIcon.Information); txtRecibo.Clear(); txtRecibo.Focus(); return; } } } catch (Exception ex) { MessageBox.Show("Error." + Environment.NewLine + ex.ToString(), Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtRecibo.Clear(); txtRecibo.Focus(); return; } cbbbArticulo.Focus(); }