private void txtNoPlanItemCD_TextChanged(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(txtItemCode.Text)) { lbItemName.Text = "Item Name"; lbItemName.BackColor = Color.FromKnownColor(KnownColor.ActiveCaption); } else { pts_item itemData = new pts_item(); itemData = itemData.GetItem(txtItemCode.Text); lbItemName.Text = itemData.item_name; lbItemName.BackColor = Color.Lime; } errorProvider.SetError(txtItemCode, null); } catch (Exception ex) { lbItemName.Text = "Item Name"; lbItemName.BackColor = Color.FromKnownColor(KnownColor.ActiveCaption); errorProvider.SetError(txtItemCode, "Wrong Item Code" + Environment.NewLine + ex.Message); } }
/// <summary> /// Search stock item /// </summary> /// <param name="itemNumber"></param> private void SearchNoSet(string itemNumber, string invoiceText) { try { pts_item itemdata = new pts_item(); itemdata = itemdata.GetItem(itemNumber); double totalWHQty = itemdata.wh_qty; txtWHQty.Text = totalWHQty.ToString(); pts_stock stockdata = new pts_stock(); stockdata.SearchItem(new pts_stock { item_cd = itemNumber, invoice = invoiceText }); double totalPackingQty = stockdata.listStockItems.Select(x => x.packing_qty).Sum(); txtTotalPackingQty.Text = totalPackingQty.ToString(); dgvMainStockOut.DataSource = stockdata.listStockItems; dgvMainStockOut.Columns["stock_id"].HeaderText = "ID"; dgvMainStockOut.Columns["packing_cd"].HeaderText = "Packing Code"; dgvMainStockOut.Columns["item_cd"].HeaderText = "Item Number"; dgvMainStockOut.Columns["supplier_cd"].HeaderText = "Supplier Code"; dgvMainStockOut.Columns["order_no"].HeaderText = "Order Number"; dgvMainStockOut.Columns["invoice"].HeaderText = "Invoice"; dgvMainStockOut.Columns["stockin_date"].HeaderText = "Stock-In Date"; dgvMainStockOut.Columns["stockin_user_cd"].HeaderText = "Incharge"; dgvMainStockOut.Columns["stockin_qty"].HeaderText = "Stock-In Qty"; dgvMainStockOut.Columns["packing_qty"].HeaderText = "Packing Qty"; dgvMainStockOut.Columns["registration_user_cd"].HeaderText = "Reg User"; dgvMainStockOut.Columns["registration_date_time"].HeaderText = "Reg Time"; if (dgvMainStockOut.Columns.Contains("order_no")) { dgvMainStockOut.Columns.Remove("order_no"); } if (dgvMainStockOut.Columns.Contains("registration_user_cd")) { dgvMainStockOut.Columns.Remove("registration_user_cd"); } if (dgvMainStockOut.Columns.Contains("registration_date_time")) { dgvMainStockOut.Columns.Remove("registration_date_time"); } if (dgvMainStockOut.Columns.Contains("btnOpenSet")) { dgvMainStockOut.Columns.Remove("btnOpenSet"); } } catch (Exception ex) { CustomMessageBox.Error(ex.Message); } }