private void grvSupport_CellEndEdit(object sender, DataGridViewCellEventArgs e) { if (!this.grvSupport.Rows[e.RowIndex].IsNewRow && this.txtStatus.Text == Constz.Requisition.Status.Waiting.Code) { if (e.ColumnIndex == indexBARCODE) { string barcode = (this.grvSupport.Rows[e.RowIndex].Cells[indexBARCODE].Value == null ? "" : this.grvSupport.Rows[e.RowIndex].Cells[indexBARCODE].Value.ToString().Trim()); if (barcode == "") { this.grvSupport.Rows[e.RowIndex].Cells[indexPRODUCT].Value = DBNull.Value; this.grvSupport.Rows[e.RowIndex].Cells[indexUNIT].Value = DBNull.Value; this.grvSupport.Rows[e.RowIndex].Cells[indexBARCODE].Value = DBNull.Value; this.grvSupport.Rows[e.RowIndex].Cells[indexNAME].Value = DBNull.Value; this.grvSupport.Rows[e.RowIndex].Cells[indexQTY].Value = DBNull.Value; this.grvSupport.Rows[e.RowIndex].Cells[indexPRICE].Value = DBNull.Value; this.grvSupport.Rows[e.RowIndex].Cells[indexDISCOUNT].Value = DBNull.Value; this.grvSupport.Rows[e.RowIndex].Cells[indexNETPRICE].Value = DBNull.Value; this.grvSupport.Rows[e.RowIndex].Cells[indexISVAT].Value = DBNull.Value; this.grvSupport.Rows[e.RowIndex].Cells[indexNORMALDISCOUNT].Value = DBNull.Value; } else { if (barcode.Substring(0, 1) == "*") { this.grvSupport.Rows[e.RowIndex].Cells[indexPRODUCT].Value = DBNull.Value; this.grvSupport.Rows[e.RowIndex].Cells[indexUNIT].Value = DBNull.Value; this.grvSupport.Rows[e.RowIndex].Cells[indexBARCODE].Value = DBNull.Value; this.grvSupport.Rows[e.RowIndex].Cells[indexNAME].Value = DBNull.Value; this.grvSupport.Rows[e.RowIndex].Cells[indexQTY].Value = DBNull.Value; this.grvSupport.Rows[e.RowIndex].Cells[indexPRICE].Value = DBNull.Value; this.grvSupport.Rows[e.RowIndex].Cells[indexDISCOUNT].Value = DBNull.Value; this.grvSupport.Rows[e.RowIndex].Cells[indexNETPRICE].Value = DBNull.Value; this.grvSupport.Rows[e.RowIndex].Cells[indexISVAT].Value = DBNull.Value; this.grvSupport.Rows[e.RowIndex].Cells[indexNORMALDISCOUNT].Value = DBNull.Value; if (barcode.Length > 1) { barcode = barcode.Substring(1); this.grvSupport.Rows[e.RowIndex].Cells[indexQTY].Value = Convert.ToDouble(barcode); } this.grvSupport.Rows[e.RowIndex].Cells[indexBARCODE].Value = ""; endEditBarcode = false; } else { SearchFlow search = new SearchFlow(); ABB.Data.Search.SearchProductData data = new ABB.Data.Search.SearchProductData(); data.CODE = barcode.Trim(); data.WAREHOUSE = Appz.CurrentUserData.Warehouse; data.TYPE = Constz.ProductType.Type.FG.Code; data.ZONE = Constz.Zone.Z11; DataTable dt = search.GetProductList(data); if (dt.Rows.Count == 1) { this.grvSupport.Rows[e.RowIndex].Cells[indexPRODUCT].Value = dt.Rows[0]["LOID"].ToString(); SetProductDetail(this.grvSupport.Rows[e.RowIndex], Convert.ToDouble(dt.Rows[0]["LOID"])); SetNewBarcodeFocus(); } else { Appz.OpenErrorDialog("äÁ辺ÊÔ¹¤éÒµÒÁºÒÃìâ¤é´·ÕèÃкØ"); endEditBarcode = false; return; } } } } else if (e.ColumnIndex == indexQTY) { if (this.grvSupport.Rows[e.RowIndex].Cells[indexQTY].Value.ToString().Trim() == "") this.grvSupport.Rows[e.RowIndex].Cells[indexQTY].Value = "1"; CalculateGrandTotal(); SetNewBarcodeFocus(); } } }
private void grvStockIn_CellEndEdit(object sender, DataGridViewCellEventArgs e) { if (!this.grvStockIn.Rows[e.RowIndex].IsNewRow) { if (e.ColumnIndex == indexBARCODE) { string barcode = this.grvStockIn.Rows[e.RowIndex].Cells[indexBARCODE].Value.ToString(); if (barcode == "") { this.grvStockIn.Rows[e.RowIndex].Cells[indexPRODUCT].Value = DBNull.Value; this.grvStockIn.Rows[e.RowIndex].Cells[indexUNIT].Value = DBNull.Value; this.grvStockIn.Rows[e.RowIndex].Cells[indexBARCODE].Value = DBNull.Value; this.grvStockIn.Rows[e.RowIndex].Cells[indexNAME].Value = DBNull.Value; this.grvStockIn.Rows[e.RowIndex].Cells[indexQTY].Value = DBNull.Value; this.grvStockIn.Rows[e.RowIndex].Cells[indexPRICE].Value = DBNull.Value; this.grvStockIn.Rows[e.RowIndex].Cells[indexNETPRICE].Value = DBNull.Value; } else { if (barcode.Substring(0, 1) == "*") { this.grvStockIn.Rows[e.RowIndex].Cells[indexPRODUCT].Value = DBNull.Value; this.grvStockIn.Rows[e.RowIndex].Cells[indexUNIT].Value = DBNull.Value; this.grvStockIn.Rows[e.RowIndex].Cells[indexBARCODE].Value = DBNull.Value; this.grvStockIn.Rows[e.RowIndex].Cells[indexNAME].Value = DBNull.Value; this.grvStockIn.Rows[e.RowIndex].Cells[indexPRICE].Value = DBNull.Value; this.grvStockIn.Rows[e.RowIndex].Cells[indexNETPRICE].Value = DBNull.Value; if (barcode.Length > 1) { barcode = barcode.Substring(1); this.grvStockIn.Rows[e.RowIndex].Cells[indexQTY].Value = Convert.ToDouble(barcode); } this.grvStockIn.Rows[e.RowIndex].Cells[indexBARCODE].Value = ""; endEditBarcode = false; } else { SearchFlow search = new SearchFlow(); ABB.Data.Search.SearchProductData data = new ABB.Data.Search.SearchProductData(); data.CODE = barcode.Trim(); data.WAREHOUSE = Appz.CurrentUserData.Warehouse; DataTable dt = search.GetProductList(data); if (dt.Rows.Count == 1) { this.grvStockIn.Rows[e.RowIndex].Cells[indexPRODUCT].Value = dt.Rows[0]["LOID"].ToString(); SetProductDetail(e.RowIndex, Convert.ToDouble(dt.Rows[0]["LOID"])); if (!SetProductDuplicate(e.RowIndex, Convert.ToDouble(dt.Rows[0]["LOID"]), Convert.ToDouble(this.grvStockIn[indexQTY, e.RowIndex].Value))) { CalculateProductItemNetPrice(this.grvStockIn.Rows[e.RowIndex]); CalculateGrandTotal(); } } else { Appz.OpenErrorDialog("äÁ辺ÊÔ¹¤éÒµÒÁºÒÃìâ¤é´·ÕèÃкØ"); return; } } } } else if (e.ColumnIndex == indexQTY) { if (this.grvStockIn.Rows[e.RowIndex].Cells[indexQTY].Value.ToString().Trim() == "") this.grvStockIn.Rows[e.RowIndex].Cells[indexQTY].Value = "1"; CalculateProductItemNetPrice(this.grvStockIn.Rows[e.RowIndex]); CalculateGrandTotal(); } } }
private void btnSearchProduct_Click(object sender, EventArgs e) { Search.ProductMasterPopup frmProductSearch = new Search.ProductMasterPopup(this.txtCode.Text.Trim(), Appz.CurrentUserData.Warehouse); ABB.Data.Search.SearchProductData data = new ABB.Data.Search.SearchProductData(); data.CODE = this.txtCode.Text.Trim(); frmProductSearch.SetData(data); frmProductSearch.ShowDialog(this); if (frmProductSearch.DialogResult == DialogResult.OK) { this.txtPLoid.Text = frmProductSearch.ProductID.ToString(); GetProductDetail(); GetMinMax(); } }
private void grvStockin_CellEndEdit(object sender, DataGridViewCellEventArgs e) { if (!this.grvStockin.Rows[e.RowIndex].IsNewRow) { if (e.ColumnIndex == indexBARCODE) { string barcode = (this.grvStockin.Rows[e.RowIndex].Cells[indexBARCODE].Value == null ? "" : this.grvStockin.Rows[e.RowIndex].Cells[indexBARCODE].Value.ToString().Trim()); if (barcode == "") { this.grvStockin.Rows[e.RowIndex].Cells[indexPRODUCT].Value = DBNull.Value; this.grvStockin.Rows[e.RowIndex].Cells[indexUNIT].Value = DBNull.Value; this.grvStockin.Rows[e.RowIndex].Cells[indexBARCODE].Value = DBNull.Value; this.grvStockin.Rows[e.RowIndex].Cells[indexNAME].Value = DBNull.Value; this.grvStockin.Rows[e.RowIndex].Cells[indexQTY].Value = DBNull.Value; this.grvStockin.Rows[e.RowIndex].Cells[indexPRICE].Value = DBNull.Value; this.grvStockin.Rows[e.RowIndex].Cells[indexNETPRICE].Value = DBNull.Value; } else { if (barcode.Substring(0, 1) == "*") { this.grvStockin.Rows[e.RowIndex].Cells[indexPRODUCT].Value = DBNull.Value; this.grvStockin.Rows[e.RowIndex].Cells[indexUNIT].Value = DBNull.Value; this.grvStockin.Rows[e.RowIndex].Cells[indexBARCODE].Value = DBNull.Value; this.grvStockin.Rows[e.RowIndex].Cells[indexNAME].Value = DBNull.Value; this.grvStockin.Rows[e.RowIndex].Cells[indexQTY].Value = DBNull.Value; this.grvStockin.Rows[e.RowIndex].Cells[indexPRICE].Value = DBNull.Value; this.grvStockin.Rows[e.RowIndex].Cells[indexNETPRICE].Value = DBNull.Value; if (barcode.Length > 1) { barcode = barcode.Substring(1); this.grvStockin.Rows[e.RowIndex].Cells[indexQTY].Value = Convert.ToDouble(barcode); } this.grvStockin.Rows[e.RowIndex].Cells[indexBARCODE].Value = ""; endEditBarcode = false; } else { SearchFlow search = new SearchFlow(); ABB.Data.Search.SearchProductData data = new ABB.Data.Search.SearchProductData(); data.CODE = barcode.Trim(); DataTable dt = search.GetProductShopList(data); if (dt.Rows.Count == 1) { this.grvStockin.Rows[e.RowIndex].Cells[indexPRODUCT].Value = dt.Rows[0]["LOID"].ToString(); SetProductDetail(this.grvStockin.Rows[e.RowIndex], Convert.ToDouble(dt.Rows[0]["LOID"])); SetNewBarcodeFocus(); } else { Appz.OpenErrorDialog("äÁ辺ÊÔ¹¤éÒµÒÁºÒÃìâ¤é´·ÕèÃкØ"); endEditBarcode = false; return; } } } } else if (e.ColumnIndex == indexQTY) { if (this.grvStockin.Rows[e.RowIndex].Cells[indexQTY].Value.ToString().Trim() == "") this.grvStockin.Rows[e.RowIndex].Cells[indexQTY].Value = "1"; Calculate(); SetNewBarcodeFocus(); } } }