/// <summary> /// Function to fill the dataGridView from productSearchPopup when Cntrl+F navigation key used /// </summary> /// <param name="frmProductSearchPopup"></param> /// <param name="decproductId"></param> /// <param name="decCurrentRowIndex"></param> public void CallFromProductSearchPopup(frmProductSearchPopup frmProductSearchPopup, decimal decproductId, decimal decCurrentRowIndex) { try { ProductInfo infoProduct = new ProductInfo(); ProductCreationBll BllProductCreation = new ProductCreationBll(); base.Show(); this.frmProductSearchPopupObj = frmProductSearchPopup; UnitConvertionBll bllUnitConvertion = new UnitConvertionBll(); infoProduct = BllProductCreation.ProductView(decproductId); int inRowcount = dgvPurchaseReturn.Rows.Count; if (decCurrentRowIndex == inRowcount - 1) { dgvPurchaseReturn.Rows.Add(); } for (int i = 0; i < inRowcount; i++) { if (i == decCurrentRowIndex) { dgvPurchaseReturn.Rows[i].Cells["dgvtxtproductCode"].Value = infoProduct.ProductCode; FillProductDetails(infoProduct.ProductCode.ToString(), i); } } frmProductSearchPopupObj.Close(); frmProductSearchPopupObj = null; } catch (Exception ex) { MessageBox.Show("PR:23" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to call frmProductSearchPopup form to select and view product /// </summary> /// <param name="frmProductSearchPopup"></param> /// <param name="decproductId"></param> /// <param name="decCurrentRowIndex"></param> public void CallFromProductSearchPopup(frmProductSearchPopup frmProductSearchPopup, decimal decproductId, decimal decCurrentRowIndex) { ProductCreationBll BllProductCreation = new ProductCreationBll(); ProductInfo infoProduct = new ProductInfo(); try { this.Enabled = true; this.BringToFront(); this.frmProductSearchPopupObj = frmProductSearchPopup; int inCurrentRowIndex = dgvProduct.CurrentRow.Index; dgvProduct.Rows.Add(); if (decproductId != 0) { List<DataTable> ListObj = new List<DataTable>(); List<DataTable> ListObjUnitViewAll = new List<DataTable>(); infoProduct = BllProductCreation.ProductView(decproductId); TransactionsGeneralFillBll transactionGeneralFillObj = new TransactionsGeneralFillBll(); SalesQuotationBll bllSalesQuotation = new SalesQuotationBll(); dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtProductName"].Value = infoProduct.ProductName; dgvProduct.Rows[inCurrentRowIndex].Cells["ProductId"].Value = infoProduct.ProductId; dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtProductCode"].Value = infoProduct.ProductCode; dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtRate"].Value = Math.Round(infoProduct.SalesRate, PublicVariables._inNoOfDecimalPlaces); DefaultRate = Math.Round(infoProduct.PurchaseRate, PublicVariables._inNoOfDecimalPlaces); ListObjUnitViewAll = transactionGeneralFillObj.UnitViewAllByProductId(dgvProduct, infoProduct.ProductId.ToString(), inCurrentRowIndex); ListObj= bllSalesQuotation.SalesQuotationMasterBatchFill(dgvProduct, infoProduct.ProductId, inCurrentRowIndex); BatchBll BllBatch = new BatchBll(); decimal decBatchId = BllBatch.BatchIdViewByProductId(infoProduct.ProductId); dgvProduct.Rows[inCurrentRowIndex].Cells["dgvcmbBatch"].Value = decBatchId; dgvProduct.Rows[inCurrentRowIndex].Cells["dgvcmbUnit"].Value = infoProduct.UnitId; if (infoProduct.PartNo != string.Empty) { dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtBarcode"].Value = infoProduct.PartNo; } else { if (dgvProduct.Rows[inCurrentRowIndex].Cells["dgvcmbBatch"].Value != null && dgvProduct.Rows[inCurrentRowIndex].Cells["dgvcmbBatch"].Value.ToString() != string.Empty) { decBatchId = Convert.ToDecimal(dgvProduct.Rows[inCurrentRowIndex].Cells["dgvcmbBatch"].Value); dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtBarcode"].Value = BllProductCreation.BarcodeViewByBatchId(decBatchId); } } IsDoAfterFill = true; UnitConvertionBll bllUnitConvertion = new UnitConvertionBll(); List<DataTable> listUnitByProduct = bllUnitConvertion.UnitConversionIdAndConRateViewallByProductId(dgvProduct.Rows[inCurrentRowIndex].Cells["ProductId"].Value.ToString()); if (listUnitByProduct[0].Rows.Count > 0) { foreach (DataRow drUnitByProduct in listUnitByProduct[0].Rows) { if (dgvProduct.Rows[inCurrentRowIndex].Cells["dgvcmbUnit"].Value.ToString() == drUnitByProduct.ItemArray[0].ToString()) { dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtUnitConversionId"].Value = Convert.ToDecimal(drUnitByProduct.ItemArray[2].ToString()); dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtConversionRate"].Value = Convert.ToDecimal(drUnitByProduct.ItemArray[3].ToString()); if (IsDoAfterFill) { decimal decNewConversionRate = Convert.ToDecimal(dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtConversionRate"].Value.ToString()); decimal decNewRate = (decCurrentRate * decCurrentConversionRate) / decNewConversionRate; dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtRate"].Value = Math.Round(decNewRate, PublicVariables._inNoOfDecimalPlaces); } } } } decimal decStandardRate = BllProductCreation.SalesInvoiceProductRateForSales(infoProduct.ProductId, PublicVariables._dtCurrentDate, decBatchId, Convert.ToDecimal(cmbPricinglevel.SelectedValue), PublicVariables._inNoOfDecimalPlaces); if (dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtConversionRate"].Value != null && dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtConversionRate"].Value.ToString() != string.Empty) { if (decStandardRate != 0 && Convert.ToDecimal(dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtConversionRate"].Value) != 0) { dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtRate"].Value = Math.Round(decStandardRate / Convert.ToDecimal(dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtConversionRate"].Value), PublicVariables._inNoOfDecimalPlaces); } } dgvProduct.Rows[inCurrentRowIndex].HeaderCell.Value = "X"; dgvProduct.Rows[inCurrentRowIndex].HeaderCell.Style.ForeColor = Color.Red; } frmProductSearchPopupObj.Close(); frmProductSearchPopupObj = null; } catch (Exception ex) { MessageBox.Show("SQ:42" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill the product details in dataGridView from productCreationPopup /// </summary> /// <param name="productcreation"></param> /// <param name="decproductId"></param> /// <param name="decCurrentRowIndex"></param> public void productDetailsFillFromProductCreation(frmProductCreation productcreation, decimal decproductId, decimal decCurrentRowIndex) { try { decimal decCurrentConversionRate = 0; UnitConvertionBll bllUnitConvertion = new UnitConvertionBll(); List<DataTable> list = new List<DataTable>(); BatchBll BllBatch = new BatchBll(); ProductInfo infoProductFill = new ProductInfo(); ProductCreationBll BllProductCreation = new ProductCreationBll(); ProductInfo infoProduct = new ProductInfo(); int inI = dgvPurchaseReturn.CurrentRow.Index; if (inI == dgvPurchaseReturn.Rows.Count - 1) { dgvPurchaseReturn.Rows.Add(); } if (decproductId != 0) { infoProduct = BllProductCreation.ProductView(decproductId); SerialNo(); dgvPurchaseReturn.Rows[inI].Cells["dgvtxtproductCode"].Value = infoProduct.ProductCode; dgvPurchaseReturn.Rows[inI].Cells["dgvtxtproductId"].Value = decproductId.ToString(); dgvPurchaseReturn.Rows[inI].Cells["dgvtxtproductName"].Value = infoProduct.ProductName; dgvPurchaseReturn.Rows[inI].Cells["dgvcmbGodown"].Value = infoProduct.GodownId; dgvPurchaseReturn.Rows[inI].Cells["dgvcmbRack"].Value = infoProduct.RackId; UnitComboFill(infoProduct.ProductId, dgvPurchaseReturn.CurrentRow.Index, dgvPurchaseReturn.CurrentRow.Cells["dgvcmbUnit"].ColumnIndex); dgvPurchaseReturn.Rows[inI].Cells["dgvcmbUnit"].Value = infoProduct.UnitId; dgvPurchaseReturn.Rows[inI].Cells["dgvtxtrate"].Value = Math.Round(infoProduct.PurchaseRate, PublicVariables._inNoOfDecimalPlaces); dgvPurchaseReturn.Rows[inI].Cells["dgvtxtUnitConversionId"].Value = Convert.ToDecimal(new UnitConvertionBll().UnitconversionIdViewByUnitIdAndProductId(infoProduct.UnitId, infoProduct.ProductId)); dgvPurchaseReturn.CurrentRow.Cells["dgvtxtConversionRate"].Value = bllUnitConvertion.UnitConversionRateByUnitConversionId(Convert.ToDecimal(dgvPurchaseReturn.Rows[inI].Cells["dgvtxtUnitConversionId"].Value.ToString())); BatchComboFill(decproductId, inI, dgvPurchaseReturn.Rows[inI].Cells["dgvcmbBatch"].ColumnIndex); dgvPurchaseReturn.Rows[inI].Cells["dgvcmbBatch"].Value = BllBatch.BatchIdViewByProductId(decproductId); RackComboFill(infoProduct.GodownId, inI, dgvPurchaseReturn.Rows[inI].Cells["dgvcmbRack"].ColumnIndex); dgvPurchaseReturn.Rows[inI].Cells["dgvtxtqty"].Value = "0"; dgvPurchaseReturn.Rows[inI].Cells["dgvtxtbarcode"].Value = BllBatch.ProductBatchBarcodeViewByBatchId(Convert.ToDecimal(dgvPurchaseReturn.Rows[inI].Cells["dgvcmbBatch"].Value.ToString())); list = bllUnitConvertion.DGVUnitConvertionRateByUnitId(infoProduct.UnitId, infoProduct.ProductName); dgvPurchaseReturn.Rows[inI].Cells["dgvtxtConversionRate"].Value = list[0].Rows[0]["conversionRate"].ToString(); decCurrentConversionRate = Convert.ToDecimal(dgvPurchaseReturn.CurrentRow.Cells["dgvtxtConversionRate"].Value.ToString()); AmountCalculation("dgvtxtqty", inI); dgvPurchaseReturn.Rows[inI].Cells["dgvtxtqty"].Selected = true; dgvPurchaseReturn.Rows[inI + 1].Selected = false; } dgvPurchaseReturn.Rows[inI].HeaderCell.Value = "X"; dgvPurchaseReturn.Rows[inI].HeaderCell.Style.ForeColor = Color.Red; } catch (Exception ex) { MessageBox.Show("PR:24" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function for Return from productCreationPopup /// </summary> /// <param name="decProductId"></param> public void ReturnFromProductCreation(decimal decProductId) { frmProductCreation productcreation = new frmProductCreation(); ProductInfo infoProduct = new ProductInfo(); ProductCreationBll BllProductCreation = new ProductCreationBll(); try { int inI = dgvPurchaseReturn.CurrentRow.Index; this.Enabled = true; base.Show(); if (decProductId != 0) { infoProduct = BllProductCreation.ProductView(decProductId); strProductCode = infoProduct.ProductCode; productDetailsFillFromProductCreation(productcreation, decProductId, inI); } dgvPurchaseReturn.Focus(); } catch (Exception ex) { MessageBox.Show("PR:25" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to call frmProductSearchPopup form to select and view Products /// </summary> /// <param name="frmProductSearchPopup"></param> /// <param name="decproductId"></param> /// <param name="decCurrentRowIndex"></param> public void CallFromProductSearchPopup(frmProductSearchPopup frmProductSearchPopup, decimal decproductId, decimal decCurrentRowIndex) { try { ProductInfo infoProduct = new ProductInfo(); ProductCreationBll BllProductCreation = new ProductCreationBll(); this.frmProductSearchPopupObj = frmProductSearchPopup; infoProduct = BllProductCreation.ProductView(decproductId); dgvPurchaseOrder.CurrentRow.Cells["dgvtxtProductCode"].Value = infoProduct.ProductCode; dgvPurchaseOrder.CurrentRow.Cells["dgvtxtProductName"].Value = infoProduct.ProductName; dgvPurchaseOrder.CurrentRow.Cells["dgvtxtRate"].Value = infoProduct.PurchaseRate; UnitComboFill(decproductId, dgvPurchaseOrder.CurrentRow.Index, dgvPurchaseOrder.CurrentRow.Cells["dgvcmbUnit"].ColumnIndex); dgvPurchaseOrder.CurrentRow.Cells["dgvcmbUnit"].Value = infoProduct.UnitId; UnitConvertionBll bllUnitConvertion = new UnitConvertionBll(); List<DataTable> list = new List<DataTable>(); list = bllUnitConvertion.UnitConversionIdAndConRateViewallByProductId(infoProduct.ProductCode); foreach (DataRow drUnitByProduct in list[0].Rows) { if (dgvPurchaseOrder.CurrentRow.Cells["dgvcmbUnit"].Value.ToString() == drUnitByProduct.ItemArray[0].ToString()) { dgvPurchaseOrder.CurrentRow.Cells["dgvtxtUnitConversionId"].Value = drUnitByProduct.ItemArray[2].ToString(); dgvPurchaseOrder.CurrentRow.Cells["dgvtxtUnitConversionRate"].Value = drUnitByProduct.ItemArray[3].ToString(); } } decCurrentConversionRate = Convert.ToDecimal(dgvPurchaseOrder.CurrentRow.Cells["dgvtxtUnitConversionRate"].Value.ToString()); decCurrentRate = Convert.ToDecimal(dgvPurchaseOrder.CurrentRow.Cells["dgvtxtRate"].Value.ToString()); NewAmountCalculation("dgvtxtQty", dgvPurchaseOrder.CurrentRow.Index); CalculateTotalAmount(); frmProductSearchPopupObj.Close(); frmProductSearchPopupObj = null; this.Enabled = true; this.BringToFront(); } catch (Exception ex) { MessageBox.Show("PO24:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to calculate total amount /// </summary> /// <param name="inRowIndex"></param> public void Calculate(int inRowIndex) { decimal decDiscount = 0; decimal decDiscountPercent = 0; decimal decGrossValue = 0; decimal decNetValue = 0; decimal decTaxAmount = 0; decimal decTaxPercent = 0; decimal decTaxId = 0; decimal decAmount = 0; decimal decTotalAmount = 0; decimal decProductId = 0; decimal decDefaultTotalAmount = 0; decimal decProductRate = 0; decimal decQuantity = 0; ProductInfo infoProduct = new ProductInfo(); ProductCreationBll BllProductCreation = new ProductCreationBll(); TaxInfo infotax = new TaxInfo(); TaxBll bllTax = new TaxBll(); ExchangeRateBll BllExchangeRate = new ExchangeRateBll(); try { if (dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtProductId"].Value != null) { if (dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtProductId"].Value.ToString() != string.Empty) { if (dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtRate"].Value != null) { if (dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtRate"].Value.ToString() != string.Empty && dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtRate"].Value.ToString() != ".") { decProductRate = Convert.ToDecimal(dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtRate"].Value.ToString()); } } if (dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtQuantity"].Value != null) { if (dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtQuantity"].Value.ToString() != string.Empty && dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtQuantity"].Value.ToString() != ".") { decQuantity = Convert.ToDecimal(dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtQuantity"].Value.ToString()); } } decGrossValue = decProductRate * decQuantity; dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtGrossValue"].Value = Math.Round(decGrossValue, PublicVariables._inNoOfDecimalPlaces); if (dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscountPercent"].Value != null) { if (dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscountPercent"].Value.ToString() != string.Empty) { decDiscountPercent = Convert.ToDecimal(dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscountPercent"].Value.ToString()); } else { dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscountPercent"].Value = 0; } } else { dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscountPercent"].Value = 0; } if (dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscount"].Value != null) { if (dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscount"].Value.ToString() != string.Empty) { decDiscount = Convert.ToDecimal(dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscount"].Value.ToString()); } else { dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscount"].Value = 0; } } else { dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscount"].Value = 0; } /*------------------------------Calculate-----------------------------------*/ /*------------------------------Discount Calculation-----------------------------------*/ if (decGrossValue >= decDiscount) { dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscount"].Value = Math.Round(decDiscount, PublicVariables._inNoOfDecimalPlaces); } else { dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscountPercent"].Value = 0; dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscount"].Value = 0; decDiscount = 0; } decNetValue = decGrossValue - decDiscount; dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtNetValue"].Value = Math.Round(decNetValue, PublicVariables._inNoOfDecimalPlaces); /*------------------------------Tax Calculation-----------------------------------*/ if (dgvcmbTax.Visible) { if (dgvProductDetails.Rows[inRowIndex].Cells["dgvcmbTax"].Value != null) { if (dgvProductDetails.Rows[inRowIndex].Cells["dgvcmbTax"].Value.ToString() != string.Empty && dgvProductDetails.Rows[inRowIndex].Cells["dgvcmbTax"].Value.ToString() != "0") { decTaxId = Convert.ToDecimal(dgvProductDetails.Rows[inRowIndex].Cells["dgvcmbTax"].Value.ToString()); infotax = bllTax.TaxView(decTaxId); decTaxPercent = infotax.Rate; } else { decTaxPercent = 0; } } else { decTaxPercent = 0; } decProductId = Convert.ToDecimal(dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtProductId"].Value.ToString()); infoProduct = BllProductCreation.ProductView(decProductId); if (infoProduct.TaxapplicableOn == "MRP") { decTaxAmount = infoProduct.Mrp * decTaxPercent / 100; } else { decTaxAmount = decNetValue * decTaxPercent / 100; } dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtTaxAmount"].Value = Math.Round(decTaxAmount, PublicVariables._inNoOfDecimalPlaces); } decAmount = decNetValue + decTaxAmount; dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtAmount"].Value = Math.Round(decAmount, PublicVariables._inNoOfDecimalPlaces); decTotalAmount = decTotalAmount + decAmount; decDefaultTotalAmount = decTotalAmount * 1; //CalculateTotalAmount(); //if (dgvTax.Visible) //{ // TotalTaxAmount(); //} //CalculateGrandTotal(); } } } catch (Exception ex) { MessageBox.Show("PI84:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// function to get the product rate based on the batch /// </summary> /// <param name="index"></param> /// <param name="decProductId"></param> /// <param name="decBatchId"></param> public void getProductRate(int index, decimal decProductId, decimal decBatchId) { ProductInfo infoProduct = new ProductInfo(); ProductCreationBll BllProductCreation = new ProductCreationBll(); decimal decPricingLevelId = 0; decimal decRateForPricingLevel = 0; try { DateTime dtcurrentDate = PublicVariables._dtCurrentDate; decimal decNodecplaces = PublicVariables._inNoOfDecimalPlaces; decPricingLevelId = Convert.ToDecimal(cmbPricingLevel.SelectedValue.ToString()); decRateForPricingLevel = BllProductCreation.SalesInvoiceProductRateForSales(decProductId, dtcurrentDate, decBatchId, decPricingLevelId, decNodecplaces); infoProduct = BllProductCreation.ProductView(decProductId); dgvSalesReturn.Rows[index].Cells["dgvCmbUnit"].Value = infoProduct.UnitId; dgvSalesReturn.Rows[index].Cells["dgvTextRate"].Value = decRateForPricingLevel; decRate = decRateForPricingLevel; } catch (Exception ex) { MessageBox.Show("SR7: " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fil Controls based on the ProductName /// </summary> /// <param name="decProductId"></param> public void FillControlsByProductName(decimal decProductId) { try { PriceListInfo InfoPriceList = new PriceListInfo(); ProductInfo infoProduct = new ProductInfo(); ProductCreationBll BllProductCreation = new ProductCreationBll(); PriceListBll BllPriceList = new PriceListBll(); ProductBatchInfo infoProductBatch = new ProductBatchInfo(); infoProduct = BllProductCreation.ProductView(decProductId); txtProductCode.Text = infoProduct.ProductCode; infoProductBatch = BllProductCreation.BarcodeViewByProductCode(txtProductCode.Text); decProductId = infoProductBatch.ProductId; decBatchId = infoProductBatch.BatchId; InfoPriceList = BllPriceList.PriceListViewByBatchIdORProduct(decBatchId); batchcombofill(); txtBarcode.Text = infoProductBatch.Barcode; cmbItem.Text = infoProduct.ProductName; cmbGodown.SelectedValue = infoProduct.GodownId; cmbRack.SelectedValue = infoProduct.RackId; UnitComboFill(); UnitInfo infoUnit = new UnitInfo(); infoUnit = new UnitBll().unitVieWForStandardRate(decProductId); cmbUnit.SelectedValue = infoUnit.UnitId; if (InfoPriceList.PricinglevelId != 0) { cmbPricingLevel.SelectedValue = InfoPriceList.PricinglevelId; } else { cmbPricingLevel.SelectedIndex = 0; } ComboTaxFill(); cmbTax.SelectedValue = infoProduct.TaxId; if (txtProductCode.Text.Trim() != string.Empty && cmbItem.SelectedIndex != -1) { decimal decNodecplaces = PublicVariables._inNoOfDecimalPlaces; decimal dcRate = BllProductCreation.ProductRateForSales(decProductId, Convert.ToDateTime(txtDate.Text), decBatchId, decNodecplaces); txtRate.Text = dcRate.ToString(); try { if (decimal.Parse(txtQuantity.Text) == 0) txtQuantity.Text = "1"; } catch { txtQuantity.Text = "1"; } txtQuantity.Focus(); } TaxAmountCalculation(); isAfterFillControls = true; } catch (Exception ex) { MessageBox.Show("POS:27" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// To select the product from ProductSearchPopup /// </summary> /// <param name="frmProductSearchPopup"></param> /// <param name="decproductId"></param> /// <param name="decCurrentRowIndex"></param> public void CallFromProductSearchPopup(frmProductSearchPopup frmProductSearchPopup, decimal decproductId, decimal decCurrentRowIndex) { ProductInfo infoProduct = new ProductInfo(); ProductCreationBll BllProductCreation = new ProductCreationBll(); UnitConvertionBll bllUnitConvertion = new UnitConvertionBll(); BatchBll BllBatch = new BatchBll(); try { base.Show(); this.frmProductSearchPopupObj = frmProductSearchPopup; infoProduct = BllProductCreation.ProductView(decproductId); int inRowcount = dgvProduct.Rows.Count; for (int i = 0; i < inRowcount; i++) { if (i == inRowcount - 1) { dgvProduct.Rows.Add(); } if (i == decCurrentRowIndex) { SerialNo(); dgvProduct.Rows[i].Cells["dgvtxtproductCode"].Value = infoProduct.ProductCode; dgvProduct.Rows[i].Cells["productId"].Value = decproductId.ToString(); dgvProduct.Rows[i].Cells["dgvtxtProductName"].Value = infoProduct.ProductName; dgvProduct.Rows[i].Cells["dgvcmbGodown"].Value = infoProduct.GodownId; dgvProduct.Rows[i].Cells["dgvCmbRack"].Value = infoProduct.RackId; UnitComboFill(decproductId, i, dgvProduct.Rows[i].Cells["dgvcmbUnit"].ColumnIndex); dgvProduct.Rows[i].Cells["dgvcmbUnit"].Value = infoProduct.UnitId; List<DataTable> list = new List<DataTable>(); list = bllUnitConvertion.UnitConversionIdAndConRateViewallByProductId(dgvProduct.Rows[i].Cells["productId"].Value.ToString()); dgvProduct.Rows[i].Cells["dgvtxtRate"].Value = Math.Round(infoProduct.PurchaseRate, PublicVariables._inNoOfDecimalPlaces); dgvProduct.Rows[i].Cells["dgvtxtUnitConversionId"].Value = Convert.ToDecimal(new UnitConvertionBll().UnitconversionIdViewByUnitIdAndProductId(infoProduct.UnitId, infoProduct.ProductId)); dgvProduct.CurrentRow.Cells["dgvtxtConversionRate"].Value = bllUnitConvertion.UnitConversionRateByUnitConversionId(Convert.ToDecimal(dgvProduct.Rows[i].Cells["dgvtxtUnitConversionId"].Value.ToString())); BatchComboFill(decproductId, i, dgvProduct.Rows[i].Cells["dgvcmbBatch"].ColumnIndex); dgvProduct.Rows[i].Cells["dgvcmbBatch"].Value = BllBatch.BatchIdViewByProductId(decproductId); RackComboFill(infoProduct.GodownId, i, dgvProduct.Rows[i].Cells["dgvCmbRack"].ColumnIndex); dgvProduct.Rows[i].Cells["dgvtxtBarcode"].Value = BllBatch.ProductBatchBarcodeViewByBatchId(Convert.ToDecimal(dgvProduct.Rows[i].Cells["dgvcmbBatch"].Value.ToString())); list= bllUnitConvertion.DGVUnitConvertionRateByUnitId(infoProduct.UnitId, infoProduct.ProductName); dgvProduct.Rows[i].Cells["dgvtxtConversionRate"].Value = list[0].Rows[0]["conversionRate"].ToString(); decCurrentConversionRate = Convert.ToDecimal(dgvProduct.CurrentRow.Cells["dgvtxtConversionRate"].Value.ToString()); NewAmountCalculation("dgvtxtQty", i); CalculateTotalAmount(); } } frmProductSearchPopupObj.Close(); frmProductSearchPopupObj = null; } catch (Exception ex) { MessageBox.Show("MR4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill the details against purchase order /// </summary> public void FillOrderDetails() { BatchBll BllBatch = new BatchBll(); PurchaseOrderBll BllPurchaseOrder = new PurchaseOrderBll(); //StockPostingSP spStockPosting = new StockPostingSP(); StockPostingBll BllStockPosting = new StockPostingBll(); ProductCreationBll BllProductCreation = new ProductCreationBll(); try { if (!isEditFill) { isValueChange = false; if (dgvProduct.RowCount > 1) { for (int i = 0; i < dgvProduct.RowCount - 1; i++) { if (dgvProduct.Rows[i].Cells["dgvtxtMaterialReceiptdetailsId"].Value != null && dgvProduct.Rows[i].Cells["dgvtxtMaterialReceiptdetailsId"].Value.ToString() != string.Empty) { lstArrOfRemove.Add(dgvProduct.Rows[i].Cells["dgvtxtMaterialReceiptdetailsId"].Value.ToString()); } } } dgvProduct.Rows.Clear(); isValueChange = true; isDoAfterGridFill = false; List<DataTable> ListObjDetails = new List<DataTable>(); if (Convert.ToDecimal(cmbOrderNo.SelectedValue.ToString()) == decOrderNoWhileEditMode && btnSave.Text == "Update") { ListObjDetails = BllPurchaseOrder.PurchaseOrderDetailsViewByOrderMasterIdWithRemainingForEdit(Convert.ToDecimal(cmbOrderNo.SelectedValue.ToString()), decMaterialReceiptId); } else { ListObjDetails = BllPurchaseOrder.PurchaseOrderDetailsViewByOrderMasterIdWithRemaining(Convert.ToDecimal(cmbOrderNo.SelectedValue.ToString()), decMaterialReceiptId); } int inRowIndex = 0; foreach (DataRow drowDetails in ListObjDetails[0].Rows) { dgvProduct.Rows.Add(); isValueChange = false; isDoAfterGridFill = false; dgvProduct.CurrentCell = dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtProductName"]; dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtPurchaseOrderDetailsId"].Value = Convert.ToString(drowDetails.ItemArray[0]); strproductId = drowDetails.ItemArray[2].ToString(); ProductInfo infoproduct = new ProductInfo(); infoproduct = BllProductCreation.ProductView(Convert.ToDecimal(strproductId)); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["productId"].Value = Convert.ToDecimal(strproductId); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtProductCode"].Value = infoproduct.ProductCode; dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtProductName"].Value = infoproduct.ProductName; dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtvouchertypeId"].Value = Convert.ToString(drowDetails.ItemArray[11]); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtvoucherNo"].Value = Convert.ToString(drowDetails.ItemArray[12]); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtinvoiceNo"].Value = Convert.ToString(drowDetails.ItemArray[13]); UnitComboFill(Convert.ToDecimal(strproductId), dgvProduct.Rows.Count - 2, dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbUnit"].ColumnIndex); isValueChange = true; isDoAfterGridFill = true; dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbUnit"].Value = Convert.ToDecimal(drowDetails["unitId"].ToString()); UnitConvertionBll bllUnitConvertion = new UnitConvertionBll(); List< DataTable >listUnitByProduct = new List<DataTable>(); listUnitByProduct = bllUnitConvertion.UnitConversionIdAndConRateViewallByProductId(strproductId); foreach (DataRow drUnitByProduct in listUnitByProduct[0].Rows) { if (dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbUnit"].Value.ToString() == drUnitByProduct.ItemArray[0].ToString()) { dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtUnitConversionId"].Value = Convert.ToDecimal(drUnitByProduct.ItemArray[2].ToString()); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtConversionRate"].Value = Convert.ToDecimal(drUnitByProduct.ItemArray[3].ToString()); } } isValueChange = false; isDoAfterGridFill = false; BatchComboFill(Convert.ToDecimal(strproductId), dgvProduct.Rows.Count - 2, Convert.ToInt32(dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbBatch"].ColumnIndex)); decimal decBatch = BllStockPosting.BatchViewByProductId(Convert.ToDecimal(strproductId)); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbBatch"].Value = decBatch; string strBarcode = BllBatch.ProductBatchBarcodeViewByBatchId(decBatch); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtBarcode"].Value = strBarcode; DGVGodownComboFill(); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbGodown"].Value = Convert.ToDecimal(1); RackComboFill(1, dgvProduct.Rows.Count - 2, dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvCmbRack"].ColumnIndex); List<DataTable> listObj = new List<DataTable>(); RackBll BllRack = new RackBll(); listObj = BllRack.RackNamesCorrespondingToGodownId(1); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvCmbRack"].Value = Convert.ToDecimal(listObj[0].Rows[0]["rackId"].ToString()); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtQty"].Value = Convert.ToString(drowDetails.ItemArray[3]); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtRate"].Value = Convert.ToString(drowDetails.ItemArray[4]); decCurrentRate = Convert.ToDecimal(drowDetails.ItemArray[4].ToString()); decCurrentConversionRate = Convert.ToDecimal(dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtConversionRate"].Value.ToString()); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtAmount"].Value = Convert.ToString(drowDetails.ItemArray[6]); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtProductCode"].ReadOnly = true; dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtProductName"].ReadOnly = true; dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtBarcode"].ReadOnly = true; dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtAmount"].ReadOnly = true; dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["inRowIndex"].Value = Convert.ToString(drowDetails["extra1"]); if (cmbVoucherType.Text != "NA") { dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbUnit"].ReadOnly = true; } dgvProduct.Rows[dgvProduct.Rows.Count - 2].HeaderCell.Value = string.Empty; int intIndex = 0; int.TryParse(Convert.ToString(drowDetails["extra1"]), out intIndex); if (inMaxCount < intIndex) inMaxCount = intIndex; inRowIndex++; NewAmountCalculation(string.Empty, dgvProduct.Rows.Count - 2); isValueChange = true; isDoAfterGridFill = true; dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbUnit"].ReadOnly = true; } for (int i = inRowIndex; i < dgvProduct.Rows.Count; ++i) dgvProduct["inRowIndex", i].Value = Convert.ToString(GetNextinRowIndex()); SerialNo(); CalculateTotalAmount(); } } catch (Exception ex) { MessageBox.Show("MR39:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill the product details in dataGridView from productCreationPopup /// </summary> /// <param name="productcreation"></param> /// <param name="decproductId"></param> /// <param name="decCurrentRowIndex"></param> public void productDetailsFillFromProductCreation(frmProductCreation productcreation, decimal decproductId, decimal decCurrentRowIndex) { try { decimal decCurrentConversionRate = 0; DataTable dtbl = new DataTable(); UnitConvertionBll bllUnitConvertion = new UnitConvertionBll(); BatchBll BllBatch = new BatchBll(); ProductInfo infoProductFill = new ProductInfo(); ProductCreationBll BllProductCreation = new ProductCreationBll(); ProductInfo infoProduct = new ProductInfo(); int inI = dgvProduct.CurrentRow.Index; if (inI == dgvProduct.Rows.Count - 1) { dgvProduct.Rows.Add(); } if (decproductId != 0) { infoProduct = BllProductCreation.ProductView(decproductId); SerialNo(); dgvProduct.Rows[inI].Cells["dgvtxtproductCode"].Value = infoProduct.ProductCode; dgvProduct.Rows[inI].Cells["productId"].Value = decproductId.ToString(); dgvProduct.Rows[inI].Cells["dgvtxtProductName"].Value = infoProduct.ProductName; dgvProduct.Rows[inI].Cells["dgvcmbGodown"].Value = infoProduct.GodownId; dgvProduct.Rows[inI].Cells["dgvCmbRack"].Value = infoProduct.RackId; UnitComboFill(decproductId, inI, dgvProduct.Rows[inI].Cells["dgvcmbUnit"].ColumnIndex); dgvProduct.Rows[inI].Cells["dgvcmbUnit"].Value = infoProduct.UnitId; List<DataTable> list = new List<DataTable>(); list = bllUnitConvertion.UnitConversionIdAndConRateViewallByProductId(dgvProduct.Rows[inI].Cells["productId"].Value.ToString()); //UnitComboFill(infoProduct.ProductId, dgvProduct.CurrentRow.Index, dgvProduct.CurrentRow.Cells["dgvcmbUnit"].ColumnIndex); //dgvProduct.Rows[inI].Cells["dgvcmbUnit"].Value = infoProduct.UnitId; dgvProduct.Rows[inI].Cells["dgvtxtRate"].Value = Math.Round(infoProduct.PurchaseRate, PublicVariables._inNoOfDecimalPlaces); dgvProduct.Rows[inI].Cells["dgvtxtUnitConversionId"].Value = Convert.ToDecimal(new UnitConvertionBll().UnitconversionIdViewByUnitIdAndProductId(infoProduct.UnitId, infoProduct.ProductId)); dgvProduct.CurrentRow.Cells["dgvtxtConversionRate"].Value = bllUnitConvertion.UnitConversionRateByUnitConversionId(Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtUnitConversionId"].Value.ToString())); BatchComboFill(decproductId, inI, dgvProduct.Rows[inI].Cells["dgvcmbBatch"].ColumnIndex); dgvProduct.Rows[inI].Cells["dgvcmbBatch"].Value = BllBatch.BatchIdViewByProductId(decproductId); RackComboFill(infoProduct.GodownId, inI, dgvProduct.Rows[inI].Cells["dgvCmbRack"].ColumnIndex); dgvProduct.Rows[inI].Cells["dgvtxtBarcode"].Value = BllBatch.ProductBatchBarcodeViewByBatchId(Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvcmbBatch"].Value.ToString())); list = bllUnitConvertion.DGVUnitConvertionRateByUnitId(infoProduct.UnitId, infoProduct.ProductName); dgvProduct.Rows[inI].Cells["dgvtxtConversionRate"].Value = dtbl.Rows[0]["conversionRate"].ToString(); decCurrentConversionRate = Convert.ToDecimal(dgvProduct.CurrentRow.Cells["dgvtxtConversionRate"].Value.ToString()); NewAmountCalculation("dgvtxtQty", inI); CalculateTotalAmount(); } } catch (Exception ex) { MessageBox.Show("MR6:new" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to call frmProductSearchPopup form to select and view Product /// </summary> /// <param name="frmProductSearchPopup"></param> /// <param name="decproductId"></param> /// <param name="decCurrentRowIndex"></param> public void CallFromProductSearchPopup(frmProductSearchPopup frmProductSearchPopup, decimal decproductId, decimal decCurrentRowIndex) { UnitConvertionBll bllUnitConversion = new UnitConvertionBll(); try { this.frmProductSearchPopupObj = frmProductSearchPopup; List<DataTable> list = new List<DataTable>(); BatchBll BllBatch = new BatchBll(); ProductCreationBll BllProductCreation = new ProductCreationBll(); if (decproductId != 0) { infoProduct = BllProductCreation.ProductView(decproductId); dgvSalesOrder.CurrentRow.Cells["dgvtxtProductCode"].Value = infoProduct.ProductCode.ToString(); dgvSalesOrder.CurrentRow.Cells["dgvtxtProductId"].Value = decproductId.ToString(); dgvSalesOrder.CurrentRow.Cells["dgvtxtProductName"].Value = infoProduct.ProductName; dgvSalesOrder.CurrentRow.Cells["dgvtxtRate"].Value = infoProduct.SalesRate.ToString(); UnitComboFill(decproductId, dgvSalesOrder.CurrentRow.Index, dgvSalesOrder.CurrentRow.Cells["dgvcmbUnit"].ColumnIndex); dgvSalesOrder.CurrentRow.Cells["dgvcmbUnit"].Value = infoProduct.UnitId; BatchComboFill(decproductId, dgvSalesOrder.CurrentRow.Index, dgvSalesOrder.CurrentRow.Cells["dgvcmbBatch"].ColumnIndex); dgvSalesOrder.CurrentRow.Cells["dgvcmbBatch"].Value = BllBatch.BatchIdViewByProductId(decproductId); dgvSalesOrder.CurrentRow.Cells["dgvtxtBarcode"].Value = BllBatch.ProductBatchBarcodeViewByBatchId(Convert.ToDecimal(dgvSalesOrder.CurrentRow.Cells["dgvcmbBatch"].Value.ToString())); list = bllUnitConversion.DGVUnitConvertionRateByUnitId(infoProduct.UnitId, infoProduct.ProductName); dgvSalesOrder.CurrentRow.Cells["dgvtxtUnitConversionId"].Value = list[0].Rows[0]["unitconversionId"].ToString(); dgvSalesOrder.CurrentRow.Cells["dgvtxtConversionRate"].Value = list[0].Rows[0]["conversionRate"].ToString(); decCurrentConversionRate = Convert.ToDecimal(dgvSalesOrder.CurrentRow.Cells["dgvtxtConversionRate"].Value.ToString()); decCurrentRate = Convert.ToDecimal(dgvSalesOrder.CurrentRow.Cells["dgvtxtRate"].Value.ToString()); AmountCalculation("dgvtxtQty", dgvSalesOrder.CurrentRow.Index); TotalAmountCalculation(); } frmProductSearchPopupObj.Close(); frmProductSearchPopupObj = null; this.Enabled = true; this.BringToFront(); } catch (Exception ex) { MessageBox.Show("S10:" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to call frmProductSearch form to select and view product /// </summary> /// <param name="frmProductSearchPopup"></param> /// <param name="decproductId"></param> /// <param name="decCurrentRowIndex"></param> public void CallFromProductSearchPopup(frmProductSearchPopup frmProductSearchPopup, decimal decproductId, decimal decCurrentRowIndex) { ProductCreationBll BllProductCreation = new ProductCreationBll(); ProductInfo infoProduct = new ProductInfo(); try { base.Show(); this.frmProductSearchPopupObj = frmProductSearchPopup; if (decproductId != 0) { int inCurrentRowIndex = dgvProductDetails.CurrentRow.Index; dgvProductDetails.Rows.Add(); infoProduct = BllProductCreation.ProductView(decproductId); strProductCode = infoProduct.ProductCode; ProductDetailsFill(strProductCode, inCurrentRowIndex, "ProductCode"); SerialNo(); frmProductSearchPopupObj.Close(); frmProductSearchPopupObj = null; } } catch (Exception ex) { MessageBox.Show("PI48:" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill Sales invoice grid while return from Product creation when creating Product /// </summary> /// <param name="decProductId"></param> public void ReturnFromProductCreation(decimal decProductId) { ProductInfo infoProduct = new ProductInfo(); ProductCreationBll BllProductCreation = new ProductCreationBll(); try { this.Enabled = true; this.Activate(); if (decProductId != 0) { infoProduct = BllProductCreation.ProductView(decProductId); strProductCode = infoProduct.ProductCode; ProductDetailsFill(strProductCode, dgvSalesInvoice.CurrentRow.Index, "ProductCode"); } } catch (Exception ex) { MessageBox.Show("SI: 88" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function for call from productRegister /// </summary> public void CallFromProductRegister(decimal decId, frmProductRegister frmProRegister) { try { base.Show(); this.frmProductRegisterObj = frmProRegister; frmProductRegisterObj.Enabled = false; ProductCreationBll BllProductCreation = new ProductCreationBll(); ProductInfo infoProduct = new ProductInfo(); StockPostingInfo infoStockPosting = new StockPostingInfo(); BatchInfo infoBatch = new BatchInfo(); StockPostingBll BllStockPosting = new StockPostingBll(); BatchBll BllBatch = new BatchBll(); UnitBll bllUnit = new UnitBll(); List<DataTable> ListObj = new List<DataTable>(); decProductIdForEdit = decId; infoProduct = BllProductCreation.ProductView(decId); strUnitNameForGrid = bllUnit.UnitName(infoProduct.UnitId); btnSave.Text = "Update"; btnDelete.Enabled = true; txtName.Text = infoProduct.ProductName; txtProductCode.Text = infoProduct.ProductCode; cmbGroup.SelectedValue = infoProduct.GroupId; cmbBrand.SelectedValue = infoProduct.BrandId; cmbUnit.SelectedValue = infoProduct.UnitId; if (BllProductCreation.ProductReferenceCheck(decId)) { cmbUnit.Enabled = false; } decUnitIdForUpdate = infoProduct.UnitId; cmbSize.SelectedValue = infoProduct.SizeId; cmbModalNo.SelectedValue = infoProduct.ModelNoId; cmbTax.SelectedValue = infoProduct.TaxId; cmbTaxApplicableOn.SelectedItem = infoProduct.TaxapplicableOn; txtPurchaseRate.Text = infoProduct.PurchaseRate.ToString(); txtSalesRate.Text = infoProduct.SalesRate.ToString(); txtMrp.Text = infoProduct.Mrp.ToString(); txtMinimumStock.Text = infoProduct.MinimumStock.ToString(); txtMaximumStock.Text = infoProduct.MaximumStock.ToString(); txtReorderLevel.Text = infoProduct.ReorderLevel.ToString(); txtPartNo.Text = infoProduct.PartNo; cmbDefaultGodown.SelectedValue = infoProduct.GodownId; cmbDefaultRack.SelectedValue = infoProduct.RackId; if (infoProduct.IsBom) { cmbBom.SelectedIndex = 1; isBomFromRegister = true; } if (infoProduct.Ismultipleunit) { cmbMultipleUnit.SelectedIndex = 1; isMulUnitFromRgister = true; } if (infoProduct.Isopeningstock) { isOpeningStockForUpdate = true; OpeningStockGridFill(); } if (infoProduct.IsallowBatch) { OpeningStockGridWithBathFill(); } else { cmbAllowBatch.SelectedIndex = 0; txtPartNo.Text = BllBatch.PartNoReturn(decProductIdForEdit); } if (infoProduct.Ismultipleunit) { cmbMultipleUnit.SelectedIndex = 1; } else { cmbMultipleUnit.SelectedIndex = 0; } if (infoProduct.IsBom) { cmbBom.SelectedIndex = 1; } else { cmbBom.SelectedIndex = 0; } if (infoProduct.Isopeningstock) { cmbOpeningStock.SelectedIndex = 1; } else { cmbOpeningStock.SelectedIndex = 0; } if (infoProduct.IsActive) { cbxActive.Checked = true; } else { cbxActive.Checked = false; } if (infoProduct.IsshowRemember) { cbxReminder.Checked = true; } else { cbxReminder.Checked = false; } txtNarration.Text = infoProduct.Narration; } catch (Exception ex) { MessageBox.Show("PC:63" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to call frmProductSearchPopup form to select and view a product /// </summary> /// <param name="frmProductSearchPopup"></param> /// <param name="decproductId"></param> /// <param name="decCurrentRowIndex"></param> public void CallFromProductSearchPopup(frmProductSearchPopup frmProductSearchPopup, decimal decproductId, decimal decCurrentRowIndex) { ProductInfo infoProduct = new ProductInfo(); ProductCreationBll BllProductCreation= new ProductCreationBll(); try { base.Show(); this.frmProductSearchPopupObj = frmProductSearchPopup; infoProduct = BllProductCreation.ProductView(decproductId); int inRowcount = dgvSalesInvoice.Rows.Count; for (int i = 0; i < inRowcount; i++) { if (i == decCurrentRowIndex) { dgvSalesInvoice.Rows.Add(); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceProductCode"].Value = infoProduct.ProductCode; strProductCode = infoProduct.ProductCode; ProductDetailsFill(strProductCode, i, "ProductCode"); } } frmProductSearchPopupObj.Close(); frmProductSearchPopupObj = null; } catch (Exception ex) { MessageBox.Show("SI: 59" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Get the Product details from the Product creation form /// </summary> /// <param name="decproductId"></param> public void ReturnFromProductCreation(decimal decproductId) { try { ProductInfo infoProduct = new ProductInfo(); ProductCreationBll BllProductCreation = new ProductCreationBll(); BatchBll BllBatch = new BatchBll(); DataTable dtbl = new DataTable(); UnitConvertionBll bllUnitConvertion = new UnitConvertionBll(); this.Enabled = true; this.BringToFront(); if (decproductId != 0) { infoProduct = BllProductCreation.ProductView(decproductId); strProductCode = infoProduct.ProductCode; if (IsdgvConsuption) { int inCurrentRowIndex = dgvConsumption.CurrentRow.Index; dgvConsumption.Rows.Add(); ProductDetailsFillConsumption(strProductCode, inCurrentRowIndex, "ProductCode"); } else { int inProductionRowIndex = dgvProduction.CurrentRow.Index; dgvProduction.Rows.Add(); ProductDetailsFillProduction(strProductCode, inProductionRowIndex, "ProductCode"); } } } catch (Exception ex) { MessageBox.Show("SJ:34" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to add the products to grid /// </summary> public void AddToGrid() { BatchBll BllBatch = new BatchBll(); GodownBll BllGodown = new GodownBll(); try { SettingsBll BllSettings = new SettingsBll(); if (txtProductCode.Text.Trim() == null && txtProductCode.Text.Trim() == string.Empty) { Messages.InformationMessage("Enter product code"); txtProductCode.Focus(); } else if (cmbItem.SelectedIndex == -1 && cmbItem.SelectedValue == null) { Messages.InformationMessage("Select a product"); cmbItem.Focus(); } else if (Convert.ToDecimal(txtQuantity.Text.Trim()) <= 0 || txtQuantity.Text.Trim() == string.Empty) { Messages.InformationMessage("Enter quantity"); txtQuantity.Focus(); } else if (cmbUnit.SelectedValue == null) { Messages.InformationMessage("Select a unit"); cmbUnit.Focus(); } else if (BllSettings.SettingsStatusCheck("AllowZeroValueEntry") == "No" && decimal.Parse(txtRate.Text.Trim()) <= 0 || txtRate.Text.Trim() == string.Empty) { Messages.InformationMessage("Enter rate"); txtRate.Focus(); } else { int inCurrentRowIndex = new int(); bool isExecutef = false; if (rowIdToEdit == 0) { dgvPointOfSales.Rows.Add(); inCurrentRowIndex = dgvPointOfSales.Rows.Count - 1; isExecutef = true; } else { for (int i = 0; i < dgvPointOfSales.Rows.Count; ++i) { if (dgvPointOfSales.Rows[i].Cells["rowId"].Value.ToString() == rowIdToEdit.ToString()) { isExecutef = true; inCurrentRowIndex = i; break; } } } if (!isExecutef) { dgvPointOfSales.Rows.Add(); inCurrentRowIndex = dgvPointOfSales.Rows.Count - 1; } ProductInfo infoProduct = new ProductInfo(); BatchInfo infoBatch = new BatchInfo(); RackInfo infoRack = new RackInfo(); ProductCreationBll BllProductCreation = new ProductCreationBll(); UnitConvertionInfo InfoUnitConvertion = new UnitConvertionInfo(); infoProduct = BllProductCreation.ProductView(decProductId); decimal dcProductBatch = BllBatch.BatchIdViewByProductId(decProductId); InfoUnitConvertion = new UnitConvertionBll().UnitViewAllByProductId(decProductId); infoBatch = BllBatch.BatchView(dcProductBatch); decimal dcGodownId = infoProduct.GodownId; GodownInfo infoGodown = new GodownInfo(); infoGodown = BllGodown.GodownView(dcGodownId); decimal dcRackId = infoProduct.RackId; infoRack = new RackBll().RackView(dcRackId); dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtProductCode"].Value = txtProductCode.Text; dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtProductName"].Value = cmbItem.Text; dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtQuantity"].Value = txtQuantity.Text; dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtUnit"].Value = cmbUnit.Text; dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtRate"].Value = txtRate.Text; dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtGrossValue"].Value = txtGrossValue.Text; dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtTaxPercentage"].Value = cmbTax.Text; dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtTaxAmount"].Value = txtTaxAmount.Text; dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtNetAmount"].Value = txtNetAmount.Text; dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtDiscount"].Value = txtDiscountAmount.Text; dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtTotalAmount"].Value = txtAmount.Text; dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxttaxid"].Value = Convert.ToDecimal(cmbTax.SelectedValue); dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtProductId"].Value = infoProduct.ProductId; dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtBatchId"].Value = dcProductBatch; dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtRackId"].Value = infoProduct.RackId; dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtGodownId"].Value = infoProduct.GodownId; dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtUnitId"].Value = Convert.ToDecimal(cmbUnit.SelectedValue); dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtunitconversionId"].Value = InfoUnitConvertion.UnitconvertionId; dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtBarcode"].Value = txtBarcode.Text; dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtBatchno"].Value = infoBatch.BatchNo; dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtGodownName"].Value = infoGodown.GodownName; dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtRackName"].Value = infoRack.RackName; TotalAmountCalculation(); ClearGroupbox(); dgvPointOfSales.CurrentCell = dgvPointOfSales[0, dgvPointOfSales.Rows.Count - 1]; txtBarcode.Focus(); } } catch (Exception ex) { MessageBox.Show("POS:34" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Get the Product details from the Product Search form /// </summary> /// <param name="frmProductSearchPopup"></param> /// <param name="decproductId"></param> /// <param name="decCurrentRowIndex"></param> public void CallFromProductSearchPopup(frmProductSearchPopup frmProductSearchPopup, decimal decproductId, decimal decCurrentRowIndex) { ProductInfo infoProduct = new ProductInfo(); ProductCreationBll BllProductCreation = new ProductCreationBll(); BatchBll BllBatch = new BatchBll(); DataTable dtbl = new DataTable(); UnitConvertionBll bllUnitConversion = new UnitConvertionBll(); try { base.Show(); this.frmProductSearchPopupObj = frmProductSearchPopup; infoProduct = BllProductCreation.ProductView(decproductId); if (IsdgvConsuption) { int inRowcount = dgvConsumption.Rows.Count; dgvConsumption.Rows.Add(); for (int i = 0; i < inRowcount; i++) { if (i == decCurrentRowIndex) { dgvConsumption.Rows[i].Cells["dgvtxtConsumptionProductCode"].Value = infoProduct.ProductCode; strProductCode = infoProduct.ProductCode; ProductDetailsFillConsumption(strProductCode, i, "ProductCode"); } } } else { int inRowcount = dgvProduction.Rows.Count; dgvProduction.Rows.Add(); for (int i = 0; i < inRowcount; i++) { if (i == decCurrentRowIndex) { dgvProduction.Rows[i].Cells["dgvtxtProductionProductCode"].Value = infoProduct.ProductCode; strProductCode = infoProduct.ProductCode; ProductDetailsFillProduction(strProductCode, i, "ProductCode"); } } } frmProductSearchPopupObj.Close(); frmProductSearchPopupObj = null; } catch (Exception ex) { MessageBox.Show("SJ:92" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> ///Function for ReturnFromProductCreationPopup /// </summary> public void ReturnFromProductCreation(decimal decProductId) { ProductInfo infoProduct = new ProductInfo(); ProductCreationBll BllProductCreation = new ProductCreationBll(); BatchBll BllBatch = new BatchBll(); List<DataTable> list = new List<DataTable>(); UnitConvertionBll bllUnitConvertion = new UnitConvertionBll(); try { this.Enabled = true; this.BringToFront(); int inI = dgvProduct.CurrentRow.Index; if (inI == dgvProduct.Rows.Count - 1) { dgvProduct.Rows.Add(); } if (decProductId != 0) { infoProduct = BllProductCreation.ProductView(decProductId); dgvProduct.Rows[inI].Cells["dgvtxtProductCode"].Value = infoProduct.ProductCode.ToString(); dgvProduct.Rows[inI].Cells["dgvtxtProductId"].Value = decProductId.ToString(); dgvProduct.Rows[inI].Cells["dgvtxtProductName"].Value = infoProduct.ProductName; dgvProduct.Rows[inI].Cells["dgvtxtRate"].Value = infoProduct.SalesRate.ToString(); UnitComboFill1(decProductId, inI, dgvProduct.Rows[inI].Cells["dgvcmbUnit"].ColumnIndex); dgvProduct.Rows[inI].Cells["dgvcmbUnit"].Value = infoProduct.UnitId; BatchComboFill(decProductId, inI, dgvProduct.Rows[inI].Cells["dgvcmbBatch"].ColumnIndex); dgvProduct.Rows[inI].Cells["dgvcmbBatch"].Value = BllBatch.BatchIdViewByProductId(decProductId); dgvProduct.Rows[inI].Cells["dgvtxtBarcode"].Value = BllBatch.ProductBatchBarcodeViewByBatchId(Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvcmbBatch"].Value.ToString())); GridGodownComboFill(decProductId, dgvProduct.CurrentRow.Index, dgvProduct.Rows[inI].Cells["dgvcmbGodown"].ColumnIndex); dgvProduct.Rows[inI].Cells["dgvcmbGodown"].Value = infoProduct.GodownId; RackComboFill1(infoProduct.GodownId, inI, dgvProduct.Rows[inI].Cells["dgvcmbRack"].ColumnIndex); dgvProduct.Rows[inI].Cells["dgvcmbRack"].Value = infoProduct.RackId; list = bllUnitConvertion.DGVUnitConvertionRateByUnitId(infoProduct.UnitId, infoProduct.ProductName); dgvProduct.Rows[inI].Cells["dgvtxtUnitConversionId"].Value = list[0].Rows[0]["unitconversionId"].ToString(); dgvProduct.Rows[inI].Cells["dgvtxtConversionRate"].Value = list[0].Rows[0]["conversionRate"].ToString(); decCurrentConversionRate = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtConversionRate"].Value.ToString()); decCurrentRate = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtRate"].Value.ToString()); AmountCalculation("dgvtxtQty", dgvProduct.CurrentRow.Index); dgvProduct.Rows[inI].HeaderCell.Value = "X"; dgvProduct.Rows[inI].HeaderCell.Style.ForeColor = Color.Red; TotalAmountCalculation(); } } catch (Exception ex) { MessageBox.Show("DN25:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill product Details while return from Product creation when creating new Product /// </summary> /// <param name="decProductId"></param> public void ReturnFromProductCreation(decimal decProductId) { ProductInfo infoProduct = new ProductInfo(); ProductCreationBll BllProductCreation = new ProductCreationBll(); try { this.Enabled = true; this.BringToFront(); if (decProductId != 0) { int inCurrentRowIndex = dgvProductDetails.CurrentRow.Index; dgvProductDetails.Rows.Add(); infoProduct = BllProductCreation.ProductView(decProductId); strProductCode = infoProduct.ProductCode; ProductDetailsFill(strProductCode, inCurrentRowIndex, "ProductCode"); SerialNo(); } } catch (Exception ex) { MessageBox.Show("PI59:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }