private void btnEditItem_Click(object sender, EventArgs e) { if (lvDetailsList.SelectedItem != null) { if (basicProduct.SelectedItem != null) { var oProd = ProductEx.Get(this.ProductId); if (oProd != null) { ListViewItem listItem = lvDetailsList.SelectedItem; listItem.SubItems[2].Text = listItem.SubItems[2].Text != "NEW" ? "EDIT" : listItem.SubItems[2].Text; // Status listItem.SubItems[3].Text = oProd.STKCODE; // Stock Code listItem.SubItems[4].Text = oProd.APPENDIX1; // Appendix1 listItem.SubItems[5].Text = oProd.APPENDIX2; // Appendix2 listItem.SubItems[6].Text = oProd.APPENDIX3; // Appendix3 listItem.SubItems[7].Text = txtDescription.Text; // Description listItem.SubItems[8].Text = txtQty.Text; // Qty listItem.SubItems[9].Text = txtUnitAmount.Text; // Unit Amount decimal qty = Convert.ToDecimal(txtQty.Text.Length == 0 ? "0" : txtQty.Text); decimal price = Convert.ToDecimal(txtUnitAmount.Text.Length == 0 ? "0" : txtUnitAmount.Text); decimal amt = qty * price; listItem.SubItems[10].Text = amt.ToString("n2"); // Amount listItem.SubItems[11].Text = this.ProductId.ToString(); // ProductId CalcTotal(); basicProduct.ResultList = SetDetailData(oProd.STKCODE); } } } }
private void ItemInfo(ref string stkCode, ref string appendix1, ref string appendix2, ref string appendix3) { if (basicProduct.SelectedItem != null) { string query = string.Empty; if (basicProduct.SelectedItem != null) { query = "ProductId = '" + basicProduct.SelectedItem.ToString() + "'"; } else if (basicProduct.cboFullStockCode.Text.Trim().Length > 0) { query = BuildWhereClause(basicProduct.cboFullStockCode.Text.Trim()); } if (query.Length > 0) { var oProd = ProductEx.Get(query); if (oProd != null) { stkCode = oProd.STKCODE; appendix1 = oProd.APPENDIX1; appendix2 = oProd.APPENDIX2; appendix3 = oProd.APPENDIX3; this.ProductId = oProd.ProductId; } } } }
private void cboFullStockCode_SelectedIndexChanged(object sender, EventArgs e) { string query = string.Empty; Guid productId = Guid.Empty; //* 搞咩呢?cboFullStockCode 一定係 ProductId + stkcode if (cboFullStockCode.SelectedValue != null && Guid.TryParse(cboFullStockCode.SelectedValue.ToString(), out productId)) { query = "ProductId = '" + productId.ToString() + "'"; } else { query = BuildWhereClause(cboFullStockCode.Text.Trim()); } if (query.Length > 0) { var oProd = ProductEx.Get(query); if (oProd != null) { this.SelectedItem = oProd.ProductId; ProductSelectionEventArgs args = new ProductSelectionEventArgs(oProd.ProductId, oProd.STKCODE, oProd.APPENDIX1, oProd.APPENDIX2, oProd.APPENDIX3, oProd.ProductName, oProd.RetailPrice.Value, Utility.GetOnHandQtyByCurrentZone(oProd.ProductId), oProd.OriginalRetailPrice.Value, ProductCurrentSummaryEx.GetAverageCode(oProd.ProductId), oProd.NormalDiscount); OnSelectionChanged(args); } } }
private Guid GetProductId(TxferTxtIEDetails detail) { string sql = "STKCODE = '" + detail.StockCode + "' AND APPENDIX1 = '" + detail.Appendix1 + "' AND APPENDIX2 = '" + detail.Appendix2 + "' AND APPENDIX3 = '" + detail.Appendix3 + "'"; var oItem = ProductEx.Get(sql); if (oItem != null) { return(oItem.ProductId); } else { return(System.Guid.Empty); } }
public void AddItemByList(List <RT2020.Controls.ProductSearcher.DetailData> resultList) { foreach (RT2020.Controls.ProductSearcher.DetailData detail in resultList) { var oProduct = ProductEx.Get(detail.ProductId); if (oProduct != null) { string stkCode = oProduct.STKCODE; string appendix1 = oProduct.APPENDIX1; string appendix2 = oProduct.APPENDIX2; string appendix3 = oProduct.APPENDIX3; decimal amt = detail.Qty * detail.UnitAmount; if (IsDuplicated(stkCode, appendix1, appendix2, appendix3)) { foreach (ListViewItem lvItem in lvDetailsList.Items) { if (lvItem.SubItems[11].Text == oProduct.ProductId.ToString() && lvItem.SubItems[2].Text != "REMOVED") { if (lvItem.SubItems[8].Text != detail.Qty.ToString("n0") || lvItem.SubItems[9].Text != detail.UnitAmount.ToString("n2")) { lvItem.SubItems[2].Text = lvItem.SubItems[2].Text != "NEW" ? "EDIT" : lvItem.SubItems[2].Text; // Status lvItem.SubItems[8].Text = detail.Qty.ToString("n0"); // QTY lvItem.SubItems[9].Text = detail.UnitAmount.ToString("n2"); // Unit Amount lvItem.SubItems[10].Text = amt.ToString("n2"); // Amount } } } } else { ListViewItem listItem = lvDetailsList.Items.Add(System.Guid.Empty.ToString()); listItem.SubItems.Add(lvDetailsList.Items.Count.ToString()); listItem.SubItems.Add("NEW"); // Status listItem.SubItems.Add(stkCode); // Stock Code listItem.SubItems.Add(appendix1); // Appendix1 listItem.SubItems.Add(appendix2); // Appendix2 listItem.SubItems.Add(appendix3); // Appendix3 listItem.SubItems.Add(oProduct.ProductName); // Description listItem.SubItems.Add(detail.Qty.ToString("n0")); // Qty listItem.SubItems.Add(detail.UnitAmount.ToString("n2")); // Unit Amount listItem.SubItems.Add(amt.ToString("n2")); // Amount listItem.SubItems.Add(oProduct.ProductId.ToString()); // ProductId } } } CalcTotal(); }
private Guid GetProductId(string stkCode, string appendix1, string appendix2, string appendix3) { string sql = "STKCODE = '" + stkCode + "' AND APPENDIX1 = '" + appendix1 + "' AND APPENDIX2 = '" + appendix2 + "' AND APPENDIX3 = '" + appendix3 + "'"; var oProduct = ProductEx.Get(sql); if (oProduct != null) { return(oProduct.ProductId); } else { return(System.Guid.Empty); } }
private void ItemInfo(ref string stkCode, ref string appendix1, ref string appendix2, ref string appendix3) { if (basicProduct.SelectedItem != null) { var oProd = ProductEx.Get((Guid)basicProduct.SelectedItem); if (oProd != null) { stkCode = oProd.STKCODE; appendix1 = oProd.APPENDIX1; appendix2 = oProd.APPENDIX2; appendix3 = oProd.APPENDIX3; this.ProductId = oProd.ProductId; } } }
private void ItemInfo(ref string stkCode, ref string appendix1, ref string appendix2, ref string appendix3) { if (basicProduct.SelectedItem != null) { //RT2020.DAL.Product oProd = RT2020.DAL.Product.Load(new Guid(basicProduct.SelectedItem.ToString())); var oProd = ProductEx.Get((Guid)basicProduct.SelectedItem); if (oProd != null) { stkCode = oProd.STKCODE; appendix1 = oProd.APPENDIX1; appendix2 = oProd.APPENDIX2; appendix3 = oProd.APPENDIX3; _ProductId = oProd.ProductId; } } }
private void GenBarcode() { StringBuilder barcode = new StringBuilder(); var oItem = ProductEx.Get(this.ProductId); if (oItem != null) { barcode.Append(oItem.STKCODE); barcode.Append(oItem.APPENDIX1); barcode.Append(oItem.APPENDIX2); barcode.Append(oItem.APPENDIX3); } txtBarcode.Text = barcode.ToString(); cboBarcodeType.SelectedIndex = 0; chkPrimaryBarcode.CheckState = Gizmox.WebGUI.Forms.CheckState.Checked; }
private void btnAddItem_Click(object sender, EventArgs e) { if (basicProduct.SelectedItem != null) { var oProd = ProductEx.Get((Guid)basicProduct.SelectedItem); if (oProd != null) { if (IsDuplicated(oProd.STKCODE, oProd.APPENDIX1, oProd.APPENDIX2, oProd.APPENDIX3)) { //this.Invoke(new EventHandler(btnEditItem_Click), new object[] { this, e }); MessageBox.Show(string.Format(Resources.Common.DuplicatedCode, "Stock Item"), string.Format(Resources.Common.DuplicatedCode, string.Empty)); } else { if (this.ProductId != System.Guid.Empty) { ListViewItem listItem = lvDetailsList.Items.Add(System.Guid.Empty.ToString()); listItem.SubItems.Add(lvDetailsList.Items.Count.ToString()); listItem.SubItems.Add("NEW"); // Status listItem.SubItems.Add(oProd.STKCODE); // Stock Code listItem.SubItems.Add(oProd.APPENDIX1); // Appendix1 listItem.SubItems.Add(oProd.APPENDIX2); // Appendix2 listItem.SubItems.Add(oProd.APPENDIX3); // Appendix3 listItem.SubItems.Add(txtDescription.Text); // Description listItem.SubItems.Add(txtQty.Text.Length == 0 ? "0" : txtQty.Text); // Rej. Qty listItem.SubItems.Add(txtUnitAmount.Text); // Unit Amount decimal qty = Convert.ToDecimal(txtQty.Text.Length == 0 ? "0" : txtQty.Text); decimal unitPrice = Convert.ToDecimal(txtUnitAmount.Text.Length == 0 ? "0" : txtUnitAmount.Text); decimal amt = qty * unitPrice; listItem.SubItems.Add(amt.ToString("n2")); // Amount listItem.SubItems.Add(this.ProductId.ToString()); // ProductId CalcTotal(); } } } } }
private string[] GetProductCode(Guid productId) { List <string> productCode = new List <string>(); var product = ProductEx.Get(productId); if (product != null) { productCode.Add(product.STKCODE); productCode.Add(product.APPENDIX1); productCode.Add(product.APPENDIX2); productCode.Add(product.APPENDIX3); } else { productCode.Add(string.Empty); productCode.Add(string.Empty); productCode.Add(string.Empty); productCode.Add(string.Empty); } return(productCode.ToArray()); }
private void LoadIntoDetailList(XlsImportTemplate[] res) { int iCount = 0; Guid productId = System.Guid.Empty; lvDetailsList.Items.Clear(); btnImport.Enabled = false; if (res.Length > 0) { foreach (XlsImportTemplate row in res) { iCount++; if (row.STOCKCODE == null) { row.STOCKCODE = System.String.Empty; } if (row.APPENDIX1 == null) { row.APPENDIX1 = System.String.Empty; } if (row.APPENDIX2 == null) { row.APPENDIX2 = System.String.Empty; } if (row.APPENDIX3 == null) { row.APPENDIX3 = System.String.Empty; } if (row.CLASS1 == null) { row.CLASS1 = System.String.Empty; } if (row.CLASS2 == null) { row.CLASS2 = System.String.Empty; } if (row.CLASS3 == null) { row.CLASS3 = System.String.Empty; } if (row.CLASS4 == null) { row.CLASS4 = System.String.Empty; } if (row.CLASS5 == null) { row.CLASS5 = System.String.Empty; } if (row.CLASS6 == null) { row.CLASS6 = System.String.Empty; } if (row.PRODUCT_NAME == null) { row.PRODUCT_NAME = System.String.Empty; } if (row.REMARKS == null) { row.REMARKS = System.String.Empty; } if (row.REMARK1 == null) { row.REMARK1 = System.String.Empty; } if (row.REMARK2 == null) { row.REMARK2 = System.String.Empty; } if (row.REMARK3 == null) { row.REMARK3 = System.String.Empty; } if (row.REMARK4 == null) { row.REMARK4 = System.String.Empty; } if (row.REMARK5 == null) { row.REMARK5 = System.String.Empty; } if (row.REMARK6 == null) { row.REMARK6 = System.String.Empty; } if (row.REMARK1 == null) { row.REMARK1 = System.String.Empty; } ListViewItem listItem = lvDetailsList.Items.Add(iCount.ToString()); // LN listItem.SubItems.Add(string.Empty); // Status listItem.SubItems.Add(row.STOCKCODE); // STKCode listItem.SubItems.Add(row.APPENDIX1); // Appendix1 listItem.SubItems.Add(row.APPENDIX2); // Appendix2 listItem.SubItems.Add(row.APPENDIX3); // Appendix3 // Check STKCode already exsist String sql = String.Format("STKCODE = '{0}'", row.STOCKCODE); var oProduct = ProductEx.Get(sql); if (oProduct == null) { lvDetailsList.Items[iCount - 1].Tag = "P"; // New Product } else { sql = String.Format("STKCODE = '{0}' AND APPENDIX1 = '{1}' AND APPENDIX2 = '{2}' AND APPENDIX3 = '{3}'", row.STOCKCODE, row.APPENDIX1, row.APPENDIX2, row.APPENDIX3); oProduct = ProductEx.Get(sql); if (oProduct == null) { lvDetailsList.Items[iCount - 1].Tag = "A"; // New Appendix/Class } else { productId = oProduct.ProductId; } } listItem.SubItems.Add(row.COST.ToString("n2")); // Cost if (row.COST == 0) { lvDetailsList.Items[iCount - 1].Tag += "C"; // No Cost listItem.SubItems.Add("0.00"); // CostLocal } else { listItem.SubItems.Add((Convert.ToDecimal(row.COST) * Convert.ToDecimal(txtExchangeRate.Text.Length == 0 ? "1" : txtExchangeRate.Text)).ToString("n2")); // CostLocal } listItem.SubItems.Add(row.QTY.ToString("n0")); // Qty if (row.QTY == 0) { lvDetailsList.Items[iCount - 1].Tag += "Q"; // No Qty } listItem.SubItems.Add(row.CLASS1); // Class1 listItem.SubItems.Add(row.CLASS2); // Class2 listItem.SubItems.Add(row.CLASS3); // Class3 listItem.SubItems.Add(row.CLASS4); // Class4 listItem.SubItems.Add(row.CLASS5); // Class5 listItem.SubItems.Add(row.CLASS6); // Class6 listItem.SubItems.Add(row.PRODUCT_NAME); // ProductName listItem.SubItems.Add(row.REMARKS); // Remarks listItem.SubItems.Add(row.REMARK1); // Remark1 listItem.SubItems.Add(row.REMARK2); // Remark2 listItem.SubItems.Add(row.REMARK3); // Remark3 listItem.SubItems.Add(row.REMARK4); // Remark4 listItem.SubItems.Add(row.REMARK5); // Remark5 listItem.SubItems.Add(row.REMARK6); // Remark6 listItem.SubItems.Add(row.RETAIL_PRICE.ToString()); // Retail Price if (row.RETAIL_PRICE == 0 && chkImportStockCode.Checked) { lvDetailsList.Items[iCount - 1].Tag += "R"; // No Retail Price } listItem.SubItems.Add(row.RETAIL_DISCOUNT.ToString()); // Retail Discount listItem.SubItems.Add(row.DISCOUNT_FOR_DISCOUNT_ITEM.ToString()); // Discount for Discount Item listItem.SubItems.Add(productId.ToString()); // ProductId } if (updatelvDetailStatus() <= 1)// 0 = no error, 1 = has alert, 2 = has error { btnImport.Enabled = true; } } }
private bool IsPostable(string headerId, ref DataTable errorTable) { bool isPostable = true; using (var ctx = new EF6.RT2020Entities()) { Guid id = Guid.Empty; if (Guid.TryParse(headerId, out id)) { var oBatchHeader = InvtBatchADJ_HeaderEx.Get(id); if (oBatchHeader != null) { if (!CheckTxDate(oBatchHeader.TxDate.Value)) { #region 加一行 DataRow row = errorTable.NewRow(); row["HeaderId"] = oBatchHeader.HeaderId.ToString(); row["TxNumber"] = oBatchHeader.TxNumber; row["STKCODE"] = string.Empty; row["APPENDIX1"] = string.Empty; row["APPENDIX2"] = string.Empty; row["APPENDIX3"] = string.Empty; row["ErrorReason"] = "Transaction date does not belong to current system month."; row["PostDate"] = DateTime.Now; errorTable.Rows.Add(row); #endregion isPostable = isPostable & false; } if (oBatchHeader.Status == (int)EnumHelper.Status.Active && oBatchHeader.PostedBy != System.Guid.Empty) { #region 加一行 DataRow row = errorTable.NewRow(); row["HeaderId"] = oBatchHeader.HeaderId.ToString(); row["TxNumber"] = oBatchHeader.TxNumber; row["STKCODE"] = string.Empty; row["APPENDIX1"] = string.Empty; row["APPENDIX2"] = string.Empty; row["APPENDIX3"] = string.Empty; row["ErrorReason"] = "Transaction already had been posted! Cannot post again!"; row["PostDate"] = DateTime.Now; errorTable.Rows.Add(row); #endregion isPostable = isPostable & false; } var detailList = ctx.InvtBatchADJ_Details.Where(x => x.HeaderId == oBatchHeader.HeaderId).AsNoTracking().ToList(); foreach (var detail in detailList) { bool retired = false; string stk = string.Empty, a1 = string.Empty, a2 = string.Empty, a3 = string.Empty; var oProduct = ProductEx.Get(detail.ProductId); if (oProduct != null) { stk = oProduct.STKCODE; a1 = oProduct.APPENDIX1; a2 = oProduct.APPENDIX2; a3 = oProduct.APPENDIX3; retired = oProduct.Retired; } if (retired) { #region 加一行 DataRow row = errorTable.NewRow(); row["HeaderId"] = oBatchHeader.HeaderId.ToString(); row["TxNumber"] = oBatchHeader.TxNumber; row["STKCODE"] = stk; row["APPENDIX1"] = a1; row["APPENDIX2"] = a2; row["APPENDIX3"] = a3; row["ErrorReason"] = "Product does not exist or has been removed!"; row["PostDate"] = DateTime.Now; errorTable.Rows.Add(row); #endregion isPostable = isPostable & false; } decimal qty = ProductHelper.GetOnHandQtyByWorkplaceId(detail.ProductId, oBatchHeader.WorkplaceId); if ((qty + detail.Qty) < 0) { #region 加一行 DataRow row = errorTable.NewRow(); row["HeaderId"] = oBatchHeader.HeaderId.ToString(); row["TxNumber"] = oBatchHeader.TxNumber; row["STKCODE"] = stk; row["APPENDIX1"] = a1; row["APPENDIX2"] = a2; row["APPENDIX3"] = a3; row["ErrorReason"] = "Product does not have enough on-hand qty!"; row["PostDate"] = DateTime.Now; errorTable.Rows.Add(row); #endregion isPostable = isPostable & false; } } var oStaff = StaffEx.GetByStaffId(oBatchHeader.StaffId); if (oStaff != null) { if (oStaff.Retired) { #region 加一行 DataRow row = errorTable.NewRow(); row["HeaderId"] = oBatchHeader.HeaderId.ToString(); row["TxNumber"] = oBatchHeader.TxNumber; row["STKCODE"] = string.Empty; row["APPENDIX1"] = string.Empty; row["APPENDIX2"] = string.Empty; row["APPENDIX3"] = string.Empty; row["ErrorReason"] = "Staff does not exist or has been removed!"; row["PostDate"] = DateTime.Now; errorTable.Rows.Add(row); #endregion isPostable = isPostable & false; } } var oInvtLedger = ctx.InvtLedgerHeader.Where(x => x.TxNumber == oBatchHeader.TxNumber && x.TxType == "ADJ").AsNoTracking().FirstOrDefault(); if (oInvtLedger != null) { #region 加一行 DataRow row = errorTable.NewRow(); row["HeaderId"] = oBatchHeader.HeaderId.ToString(); row["TxNumber"] = oBatchHeader.TxNumber; row["STKCODE"] = string.Empty; row["APPENDIX1"] = string.Empty; row["APPENDIX2"] = string.Empty; row["APPENDIX3"] = string.Empty; row["ErrorReason"] = "Transaction existed in Inventory Ledger!"; row["PostDate"] = DateTime.Now; errorTable.Rows.Add(row); #endregion isPostable = isPostable & false; } } else { return(false); } } } return(isPostable); }
/// <summary> /// Gets the product code. /// </summary> private void GetProductCode() { var oProduct = ProductEx.Get("STKCODE IN (SELECT MIN(STKCODE) FROM Product)"); if (oProduct != null) { switch (this.ViewerType) { case RT2020.Controls.InvtUtility.InvtOlapViewerType.QoH_ATS: case RT2020.Controls.InvtUtility.InvtOlapViewerType.QoH_ATS_WithCutOffDate: this.txtFromStkCode.Text = oProduct.STKCODE; break; case RT2020.Controls.InvtUtility.InvtOlapViewerType.StockReorder: this.txtFromStkCode_Reorder.Text = oProduct.STKCODE; break; case RT2020.Controls.InvtUtility.InvtOlapViewerType.StockIOHistory: txtFromStkCode_IOHistory.Text = oProduct.STKCODE; break; case RT2020.Controls.InvtUtility.InvtOlapViewerType.OCInventory: txtFromStkCode_OCInventory.Text = oProduct.STKCODE; break; case RT2020.Controls.InvtUtility.InvtOlapViewerType.DiscrepancyAudit: txtFromStkCode_DiscrepancyAudit.Text = oProduct.STKCODE; break; case RT2020.Controls.InvtUtility.InvtOlapViewerType.StockTransfer: txtFromStkCode_Transfer.Text = oProduct.STKCODE; break; } } oProduct = ProductEx.Get("STKCODE IN (SELECT MAX(STKCODE) FROM Product)", "STKCODE"); if (oProduct != null) { switch (this.ViewerType) { case RT2020.Controls.InvtUtility.InvtOlapViewerType.QoH_ATS: case RT2020.Controls.InvtUtility.InvtOlapViewerType.QoH_ATS_WithCutOffDate: this.txtToStkCode.Text = oProduct.STKCODE; break; case RT2020.Controls.InvtUtility.InvtOlapViewerType.StockReorder: this.txtToStkCode_Reorder.Text = oProduct.STKCODE; break; case RT2020.Controls.InvtUtility.InvtOlapViewerType.StockIOHistory: txtToStkCode_IOHistory.Text = oProduct.STKCODE; break; case RT2020.Controls.InvtUtility.InvtOlapViewerType.OCInventory: txtToStkCode_OCInventory.Text = oProduct.STKCODE; break; case RT2020.Controls.InvtUtility.InvtOlapViewerType.DiscrepancyAudit: txtToStkCode_DiscrepancyAudit.Text = oProduct.STKCODE; break; case RT2020.Controls.InvtUtility.InvtOlapViewerType.StockTransfer: txtToStkCode_Transfer.Text = oProduct.STKCODE; break; } } }
private bool IsPostable(string headerId, ref DataTable errorTable) { bool isPostable = true; Guid id = Guid.Empty; if (Guid.TryParse(headerId, out id)) { var oBatchHeader = StockTakeHeaderEx.Get(id); if (oBatchHeader != null) { if (!CheckTxDate(oBatchHeader.TxDate.Value)) { DataRow row = errorTable.NewRow(); row["HeaderId"] = oBatchHeader.HeaderId.ToString(); row["TxNumber"] = oBatchHeader.TxNumber; row["STKCODE"] = string.Empty; row["APPENDIX1"] = string.Empty; row["APPENDIX2"] = string.Empty; row["APPENDIX3"] = string.Empty; row["ErrorReason"] = "Transaction date does not belong to current system month."; row["PostDate"] = DateTime.Now; errorTable.Rows.Add(row); isPostable = isPostable & false; } if (oBatchHeader.PostedOn.Value.Year > 1900) { DataRow row = errorTable.NewRow(); row["HeaderId"] = oBatchHeader.HeaderId.ToString(); row["TxNumber"] = oBatchHeader.TxNumber; row["STKCODE"] = string.Empty; row["APPENDIX1"] = string.Empty; row["APPENDIX2"] = string.Empty; row["APPENDIX3"] = string.Empty; row["ErrorReason"] = "Transaction already had been posted! Cannot post again!"; row["PostDate"] = DateTime.Now; errorTable.Rows.Add(row); isPostable = isPostable & false; } var detailList = StockTakeDetailsEx.GetByHeaderIdr(oBatchHeader.HeaderId); foreach (var detail in detailList) { bool retired = false; string stk = string.Empty, a1 = string.Empty, a2 = string.Empty, a3 = string.Empty; var oProduct = ProductEx.Get(detail.ProductId.Value); if (oProduct != null) { stk = oProduct.STKCODE; a1 = oProduct.APPENDIX1; a2 = oProduct.APPENDIX2; a3 = oProduct.APPENDIX3; retired = oProduct.Retired; } if (retired) { DataRow row = errorTable.NewRow(); row["HeaderId"] = oBatchHeader.HeaderId.ToString(); row["TxNumber"] = oBatchHeader.TxNumber; row["STKCODE"] = stk; row["APPENDIX1"] = a1; row["APPENDIX2"] = a2; row["APPENDIX3"] = a3; row["ErrorReason"] = "Product does not exist or has been removed!"; row["PostDate"] = DateTime.Now; errorTable.Rows.Add(row); isPostable = isPostable & false; } if (chkCheckVeQty.Checked && chkCheckVeQty.Visible) { decimal stkTtlQty = (detail.Book1Qty.Value + detail.Book2Qty.Value + detail.Book3Qty.Value + detail.Book4Qty.Value + detail.Book5Qty.Value + detail.HHTQty.Value) - detail.CapturedQty.Value; //string sql = "ProductId = '" + detail.ProductId + "' AND WorkplaceId = '" + oBatchHeader.WorkplaceId.ToString() + "'"; var pw = ProductWorkplaceEx.Get(detail.ProductId.Value, oBatchHeader.WorkplaceId.Value); if (pw != null) { if ((pw.CDQTY + stkTtlQty) < 0) { DataRow row = errorTable.NewRow(); row["HeaderId"] = oBatchHeader.HeaderId.ToString(); row["TxNumber"] = oBatchHeader.TxNumber; row["STKCODE"] = stk; row["APPENDIX1"] = a1; row["APPENDIX2"] = a2; row["APPENDIX3"] = a3; row["ErrorReason"] = "Not enough stock for adjustment!"; row["PostDate"] = DateTime.Now; errorTable.Rows.Add(row); isPostable = isPostable & false; } } } } } else { return(false); } } return(isPostable); }