/// <summary>
        /// Function to fill the product details
        /// </summary>
        /// <param name="strProduct"></param>
        /// <param name="inRowIndex"></param>
        /// <param name="strFillMode"></param>
        public void ProductDetailsFill(string strProduct, int inRowIndex, string strFillMode)
        {
            decimal decProductId = 0;
            decimal decGodownId = 0;
            PurchaseDetailsSP spPurchaseDetails = new PurchaseDetailsSP();
            DataTable dtbl = new DataTable();
            try
            {
                if (strFillMode == "ProductCode")
                {
                    dtbl = spPurchaseDetails.PurchaseDetailsViewByProductCodeForPI(decPurchaseInvoiceVoucherTypeId, strProduct);
                }
                else if (strFillMode == "ProductName")
                {
                    dtbl = spPurchaseDetails.PurchaseDetailsViewByProductNameForPI(decPurchaseInvoiceVoucherTypeId, strProduct);
                }
                else if (strFillMode == "Barcode")
                {
                    dtbl = spPurchaseDetails.PurchaseDetailsViewByBarcodeForPI(decPurchaseInvoiceVoucherTypeId, strProduct);
                }
                if (dtbl.Rows.Count >= 1)
                {
                    decProductId = Convert.ToDecimal(dtbl.Rows[0]["productId"]);
                    decGodownId = Convert.ToDecimal(dtbl.Rows[0]["godownId"]);
                    UnitComboFill(decProductId, inRowIndex, dgvProductDetails.Columns["dgvcmbUnit"].Index);
                    GodownComboFill();
                    RackComboFill(decGodownId, inRowIndex, dgvProductDetails.Columns["dgvcmbRack"].Index);
                    BatchComboFill(decProductId, inRowIndex, dgvProductDetails.Columns["dgvcmbBatch"].Index);
                    dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtPurchaseDetailsId"].Value = dtbl.Rows[0]["purchaseDetailsId"];
                    dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtPurchaseOrderDetailsId"].Value = dtbl.Rows[0]["purchaseOrderDetailsId"];
                    dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtMaterialReceiptDetailsId"].Value = dtbl.Rows[0]["materialReceiptDetailsId"];
                    dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtProductId"].Value = dtbl.Rows[0]["productId"];
                    dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtBarcode"].Value = dtbl.Rows[0]["barcode"];
                    dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtProductCode"].Value = dtbl.Rows[0]["productCode"];
                    dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtProductName"].Value = dtbl.Rows[0]["productName"];
                    dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtUnitConversionId"].Value = dtbl.Rows[0]["unitConversionId"];
                    dgvProductDetails.Rows[inRowIndex].Cells["dgvcmbUnit"].Value = dtbl.Rows[0]["unitId"];
                    dgvProductDetails.Rows[inRowIndex].Cells["dgvcmbGodown"].Value = dtbl.Rows[0]["godownId"];
                    dgvProductDetails.Rows[inRowIndex].Cells["dgvcmbRack"].Value = dtbl.Rows[0]["rackId"];
                    dgvProductDetails.Rows[inRowIndex].Cells["dgvcmbBatch"].Value = dtbl.Rows[0]["batchId"];
                    dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtRate"].Value = dtbl.Rows[0]["rate"];
                    dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtGrossValue"].Value = dtbl.Rows[0]["grossValue"];
                    dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscountPercent"].Value = dtbl.Rows[0]["discountPercent"];
                    dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscount"].Value = dtbl.Rows[0]["discount"];
                    dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtNetValue"].Value = dtbl.Rows[0]["netvalue"];
                    dgvProductDetails.Rows[inRowIndex].Cells["dgvcmbTax"].Value = dtbl.Rows[0]["taxId"];
                    dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtTaxAmount"].Value = dtbl.Rows[0]["taxAmount"];
                    dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtAmount"].Value = dtbl.Rows[0]["amount"];
                    dgvProductDetails.Rows[inRowIndex].HeaderCell.Value = "X";
                    dgvProductDetails.Rows[inRowIndex].HeaderCell.Style.ForeColor = Color.Red;
                }
                else
                {
                    if (strProductCode != string.Empty)
                    {
                        ProductDetailsFill(strProductCode, inRowIndex, "ProductCode");
                    }
                    else
                    {
                        dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtPurchaseDetailsId"].Value = 0;
                        dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtPurchaseOrderDetailsId"].Value = 0;
                        dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtMaterialReceiptDetailsId"].Value = 0;
                        dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtProductId"].Value = 0;
                        dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtBarcode"].Value = string.Empty;
                        dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtProductCode"].Value = string.Empty;
                        dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtProductName"].Value = string.Empty;
                        dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtQuantity"].Value = 0;
                        dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtUnitConversionId"].Value = 0;
                        dgvProductDetails.Rows[inRowIndex].Cells["dgvcmbUnit"].Value = Convert.ToDecimal("0");
                        dgvProductDetails.Rows[inRowIndex].Cells["dgvcmbGodown"].Value = Convert.ToDecimal("0");
                        dgvProductDetails.Rows[inRowIndex].Cells["dgvcmbRack"].Value = Convert.ToDecimal("0");
                        dgvProductDetails.Rows[inRowIndex].Cells["dgvcmbBatch"].Value = Convert.ToDecimal("0");
                        dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtRate"].Value = 0;
                        dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtGrossValue"].Value = 0;
                        dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscountPercent"].Value = 0;
                        dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscount"].Value = 0;
                        dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtNetValue"].Value = 0;
                        dgvProductDetails.Rows[inRowIndex].Cells["dgvcmbTax"].Value = Convert.ToDecimal("0");
                        dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtTaxAmount"].Value = 0;
                        dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtAmount"].Value = 0;
                        dgvProductDetails.Rows[inRowIndex].HeaderCell.Value = "X";
                        dgvProductDetails.Rows[inRowIndex].HeaderCell.Style.ForeColor = Color.Red;

                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("PI49:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }