private void barbtnReprintShipBox_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (gvList.RowCount < 0) { return; } try { int intRowHandle = gvList.FocusedRowHandle; _ShipBoxLable sb = new _ShipBoxLable(); sb.ShipBoxNo = gvList.GetRowCellValue(intRowHandle, "ShipBoxNo").ToString(); sb.Quantity = gvList.GetRowCellValue(intRowHandle, "ShippedQty").ToString(); //sb.Model = gvList.GetRowCellValue(intRowHandle, "ItemCode").ToString(); sb.ItemCode = gvList.GetRowCellValue(intRowHandle, "ActItemNumber").ToString(); sb.Status = gvList.GetRowCellValue(intRowHandle, "ShippingStatusName").ToString(); sb.Date = Convert.ToDateTime(gvList.GetRowCellValue(intRowHandle, "ShippedDate").ToString()).ToString("MM/dd/yyyy"); if (sb.Date == "04/01/2017") { sb.Date = "03/31/2017"; } sb.Shipper = "EG2 Mobile Technology"; sb.PONumber = gvList.GetRowCellValue(intRowHandle, "PONumber").ToString(); Boolean blnReturn = PrintShipBoxLabel(Properties.Settings.Default.PrintShipBox, sb); } catch { } }
public Boolean PrintShipBoxLabel(string lptPort, _ShipBoxLable ShipBoxID) { try { string zpl = ""; string nl = Convert.ToChar(13).ToString() + Convert.ToChar(10).ToString(); zpl = zpl + Environment.NewLine + "^XA"; zpl = zpl + Environment.NewLine + "^MMT"; //zpl = zpl + Environment.NewLine + "^LS" + convert.int16(barEditLabelShift.EditValue.ToString()) + " "; //zpl = zpl + Environment.NewLine + String.Format("^LH{0},{1}", Convert.ToInt16(barEditLabelX.EditValue.ToString()).ToString(), Convert.ToInt16(barEditLabelY.EditValue.ToString()).ToString()); zpl = zpl + Environment.NewLine + string.Format("^LS{0}", Convert.ToInt16(barEditLabelShift.EditValue.ToString()).ToString()); zpl = zpl + Environment.NewLine + "^FO0080,0080^GB0730,1100,4^FS"; // outline zpl = zpl + Environment.NewLine + "^FO0080,0850^GB0730,0000,4^FS"; // separate line zpl = zpl + Environment.NewLine + "^FO0080,0080^GB0730,1100,4^FS"; // outline zpl = zpl + Environment.NewLine + "^FO0080,0850^GB0730,0000,4^FS"; // separate line zpl = zpl + Environment.NewLine + "^FT0160,1100^A0B,58,58^FDBox ID^FS"; zpl = zpl + Environment.NewLine + "^FT0160,0800^A0B,58,58^FD" + ShipBoxID.ShipBoxNo + "^FS"; zpl = zpl + Environment.NewLine + "^FT0230,0800^BY3,3,50^BCB,,N,N^FD" + ShipBoxID.ShipBoxNo + "^FS"; zpl = zpl + Environment.NewLine + "^FT0300,1100^A0B,58,58^FDQuantity^FS"; zpl = zpl + Environment.NewLine + "^FT0300,0800^A0B,58,58^FD" + ShipBoxID.Quantity + "^FS"; //zpl = zpl + Environment.NewLine + "^FT0370,1100^A0B,58,58^FDModel^FS"; //zpl = zpl + Environment.NewLine + "^FT0370,0800^A0B,58,58^FD" + ShipBoxID.Model + "^FS"; //zpl = zpl + Environment.NewLine + "^FT0440,1100^A0B,58,58^FDItem#^FS"; //zpl = zpl + Environment.NewLine + "^FT0440,0800^A0B,58,58^FD" + ShipBoxID.ItemCode + "^FS"; zpl = zpl + Environment.NewLine + "^FT0370,1100^A0B,58,58^FDItem#^FS"; zpl = zpl + Environment.NewLine + "^FT0370,0800^A0B,58,58^FD" + ShipBoxID.ItemCode + "^FS"; zpl = zpl + Environment.NewLine + "^FT0440,0800^BY3,3,50^BCB,,N,N^FD" + ShipBoxID.ItemCode + "^FS"; zpl = zpl + Environment.NewLine + "^FT0510,1100^A0B,58,58^FDStatus^FS"; zpl = zpl + Environment.NewLine + "^FT0510,0800^A0B,58,58^FD" + ShipBoxID.Status + "^FS"; zpl = zpl + Environment.NewLine + "^FT0580,1100^A0B,58,58^FDDate^FS"; zpl = zpl + Environment.NewLine + "^FT0580,0800^A0B,58,58^FD" + ShipBoxID.Date + "^FS"; zpl = zpl + Environment.NewLine + "^FT0650,1100^A0B,58,58^FDShipper^FS"; zpl = zpl + Environment.NewLine + "^FT0650,0800^A0B,58,58^FDEG2 Mobile Technology^FS"; zpl = zpl + Environment.NewLine + "^FT0720,1100^A0B,58,58^FDPO#^FS"; zpl = zpl + Environment.NewLine + "^FT0720,0800^A0B,58,58^FD" + ShipBoxID.PONumber + "^FS"; zpl = zpl + Environment.NewLine + "^FT0790,0800^BY3,3,50^BCB,,N,N^FD" + ShipBoxID.PONumber + "^FS"; zpl = zpl + Environment.NewLine + "^PQ1,0,1,Y^XZ"; Print2LPT.Print(zpl, lptPort); } catch (SystemException ex) { MessageBox.Show("QR Code printing is not working!" + Environment.NewLine + ex.Message.ToString(), "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } return(true); }