private void txtCodigo_LostFocus(object sender, EventArgs e) { if (txtCodigo.Text == "") { return; } lastCB = txtCodigo.Text; txtCant.Value = 1; txtDescr.Text = ""; try { var str = txtCodigo.Text.Split('-'); var query = "SELECT CVE_ART, CANT_PIEZAS, CODIGO_BARRA FROM vw_codigosBarras " + "WHERE CODIGO_BARRA = '" + str[0] + "'"; cod = Program.GetDataTable(query, 2).ToData <CodigosBarra>(); if (str.Length == 2) { //txtCodigo.Text = str[0]; cod.cant_piezas = Convert.ToInt32(str[1]); } if (cod != null && str.Length <= 2) { var tot = det.Count(o => o.codigo_barra == txtCodigo.Text); if (tot == 0) { MessageBox.Show(@"Artículo no registrado en la lista del surtido", "SWYRA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); txtCodigo.Focus(); } else if (tot >= 1) { txtCant.ReadOnly = true; // !(cod.cant_piezas == 1); txtCant.Value = cod.cant_piezas; art = det.Find(o => o.codigo_barra == txtCodigo.Text && (o.cancelado == null || o.cancelado == false)); art.cant = art.cant - cod.cant_piezas; art.cancelado = (art.cant <= 0); actualizaDet(); if (cod.cant_piezas == 1) { txtCant.Focus(); } } } else { MessageBox.Show(@"Código de Barra INEXISTENTE, favor de validar.", "SWYRA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); } } catch (Exception ex) { MessageBox.Show(ex.Message, "SWYRA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); } if (txtCant.ReadOnly) { txtCodigo.Text = ""; txtCodigo.Focus(); } }
private void pbQuita_Click(object sender, EventArgs e) { if (mostraremp.Count != 0) { paq = det.Find(o => o.consec_empaque == int.Parse(dgDetalleEmp[dgDetalleEmp.CurrentRowIndex, 0].ToString())); paq.consec_padre = 0; actualizaGrids(); actualizaPed(); } }
private void txtCodigo_LostFocus(object sender, EventArgs e) { if (txtCodigo.Text == "") { return; } txtCant.Value = 1; try { var str = txtCodigo.Text.Split('-'); var query = "SELECT CVE_ART, CANT_PIEZAS, CODIGO_BARRA FROM vw_codigosBarras " + "WHERE CODIGO_BARRA = '" + str[0] + "'"; cod = Program.GetDataTable(query, 2).ToData <CodigosBarra>(); if (cod != null) { if (str.Length == 2) { //txtCodigo.Text = str[0]; cod.cant_piezas = Convert.ToInt32(str[1]); } if (str.Length <= 2) { var tot = det.Count(o => o.codigo_barra == txtCodigo.Text); if (tot == 0) { MessageBox.Show(@"Artículo no registrado en la lista del surtido", "SWYRA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); txtCodigo.Focus(); } else { //txtCant.ReadOnly = !(cod.cant_piezas == 1); txtCant.Value = cod.cant_piezas; if (proceso == "EMP") { art = det.Find(o => o.codigo_barra == txtCodigo.Text && (o.cancelado == null || o.cancelado == false) && (o.consec_padre == null || o.consec_padre == 0)); } else { art = det.Find(o => o.codigo_barra == txtCodigo.Text && (o.cancelado == null || o.cancelado == false) && o.consec_padre == ped.consec); } if (art == null) { if (proceso == "EMP") { MessageBox.Show(@"Artículo ya empaquetado favor de validar", "SWYRA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); } else { MessageBox.Show(@"Artículo no empaquetado en esta " + ped.tipopaquete + " favor de validar", "SWYRA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); } txtCodigo.Focus(); } else { art.consec_padre = (proceso == "EMP") ? ped.consec : 0; actualizaDet(); //if (cod.cant_piezas == 1) { txtCant.Focus(); } } } } } else { var msj = @"Código de Barra INEXISTENTE, favor de validar."; MessageBox.Show(msj, "SWYRA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); } } catch (Exception ex) { MessageBox.Show(ex.Message, "SWYRA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); } if (txtCant.ReadOnly) { txtCant.Value = 1; txtCodigo.Text = ""; txtCodigo.Focus(); } }
private string GeneraDetPaq(DetallePedidoMerc det) { string str = ""; List <DetallePedidoMerc> ls = cargaDetPaquetes(det.cve_doc, det.consec, true, det.tipopaquete); str += valSaltoPag(); str += "^FO20," + (Rini + 5) + "^A0,25,25^FR^FD" + det.tipopaquete + ' ' + det.codigo_barra + "^FS"; Rini += Rsal; int ind = 1; string cb = ""; foreach (var d in ls) { cb = d.codigo_barra.Substring(d.codigo_barra.Length - 7); str += valSaltoPag(); switch (ind) { case 1: str += "^FO20," + Rini + "^A0,30,30^FD" + ((det.tipopaquete == "TARIMA") ? "1" : d.cant.ToString()) + "^FS" + "^FO70," + Rini + "^A0,30,30^FD(" + ((det.tipopaquete == "TARIMA") ? cb : d.cve_art) + ")^FS" + "^FO190," + Rini + "^GB1,30,1,,0^FS"; break; case 2: str += "^FO200," + Rini + "^A0,30,30^FD" + ((det.tipopaquete == "TARIMA") ? "1" : d.cant.ToString()) + "^FS" + "^FO250," + Rini + "^A0,30,30^FD(" + ((det.tipopaquete == "TARIMA") ? cb : d.cve_art) + ")^FS" + "^FO390," + Rini + "^GB1,30,1,,0^FS"; break; case 3: str += "^FO400," + Rini + "^A0,30,30^FD" + ((det.tipopaquete == "TARIMA") ? "1" : d.cant.ToString()) + "^FS" + "^FO450," + Rini + "^A0,30,30^FD(" + ((det.tipopaquete == "TARIMA") ? cb : d.cve_art) + ")^FS" + "^FO590," + Rini + "^GB1,30,1,,0^FS"; break; case 4: str += "^FO600," + Rini + "^A0,30,30^FD" + ((det.tipopaquete == "TARIMA") ? "1" : d.cant.ToString()) + "^FS" + "^FO650," + Rini + "^A0,30,30^FD(" + ((det.tipopaquete == "TARIMA") ? cb : d.cve_art) + ")^FS"; Rini += Rsal; ind = 0; break; } ind++; } for (var i = ind; i <= 4; i++) { switch (i) { case 1: i = 4; break; case 2: str += "^FO390," + Rini + "^GB1,30,1,,0^FS"; break; case 3: str += "^FO590," + Rini + "^GB1,30,1,,0^FS"; break; case 4: Rini += Rsal; break; } } Rini += Rsal; return(str); }
private void txtCodigo_LostFocus(object sender, EventArgs e) { if (txtCodigo.Text == "") { return; } lastCB = txtCodigo.Text; txtCant.Value = 1;; try { var str = txtCodigo.Text.Split('-'); var query = "SELECT CVE_ART, CANT_PIEZAS, CODIGO_BARRA FROM vw_codigosBarras " + "WHERE CODIGO_BARRA = '" + str[0] + "'"; cod = Program.GetDataTable(query, 1).ToData <CodigosBarra>(); if (str.Length == 2) { txtCodigo.Text = str[0]; cod.cant_piezas = Convert.ToInt32(str[1]); } if (cod != null && str.Length <= 2) { try { if (art.cve_art != cod.cve_art) { MessageBox.Show(@"Código NO coincide con el artículo a devolver", "SWYRA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); } else { var tot = detmerc.Count(o => o.codigo_barra == txtCodigo.Text); if (tot == 0) { MessageBox.Show(@"Artículo no registrado en la lista del surtido", "SWYRA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); txtCodigo.Focus(); } else if (tot >= 1) { txtCant.Value = cod.cant_piezas; mrc = detmerc.Find(o => o.codigo_barra == txtCodigo.Text && (o.cancelado == null || o.cancelado == false)); if (mrc.presentacion >= maxvalue) { mrc.cant = mrc.cant - cod.cant_piezas; mrc.cancelado = (mrc.cant <= 0); actualizaDet(); } else { MessageBox.Show(@"Favor de quitar primero el de mayor presentación.", "SWYRA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); txtCodigo.Focus(); } } } } catch (Exception ex) { MessageBox.Show(@"Artículo NO ASIGNADO al pedido.", "SWYRA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); } } else { MessageBox.Show(@"Código de Barra INEXISTENTE, favor de validar.", "SWYRA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); } } catch (Exception ex) { MessageBox.Show(ex.Message, "SWYRA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); } if (txtCant.ReadOnly) { txtCodigo.Text = ""; txtCodigo.Focus(); } }