/// <summary>
        /// Work on dgvProductCreation CellEndEdit event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvProductCreation_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {

            try
            {
                if (dgvProductCreation.Columns[e.ColumnIndex].Name == "dgvtxtbatch")
                {
                    string strBatch = dgvProductCreation.Rows[e.RowIndex].Cells[e.ColumnIndex].Value == null ? "" : dgvProductCreation.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
                    if (strBatch != "")
                    {
                        BatchSP spBatch = new BatchSP();
                        DataTable dtbl = new DataTable();

                        dtbl = spBatch.BatchViewByName(strBatch, decId);
                        if (dtbl.Rows.Count != 0)
                        {
                            //dgvProductCreation.Rows[e.RowIndex].Cells["dgvtxtbatchId"].Value = Convert.ToDecimal(dtbl.Rows[0]["batchId"]);
                            dgvProductCreation.Rows[e.RowIndex].Cells["dgvtxtExpDate"].Value = dtbl.Rows[0]["expiryDate"];
                            dgvProductCreation.Rows[e.RowIndex].Cells["dgvtxManfDate"].Value = dtbl.Rows[0]["manufacturingDate"];
                        }
                    }
                    else
                    {
                        dgvProductCreation.Rows[e.RowIndex].Cells["dgvtxtExpDate"].Value = string.Empty;
                        dgvProductCreation.Rows[e.RowIndex].Cells["dgvtxManfDate"].Value = string.Empty;
                    }
                }
                if (dgvProductCreation.Columns[e.ColumnIndex].Name == "dgvcmbtgodown")
                {
                    RackSP spRack = new RackSP();
                    RackInfo infoRack = new RackInfo();
                    DataTable dtblRack = new DataTable();
                    decimal decGodownId = Convert.ToDecimal(dgvProductCreation.Rows[e.RowIndex].Cells["dgvcmbtgodown"].Value);
                    dtblRack = spRack.RackNamesCorrespondingToGodownId(decGodownId);
                    DataRow drow = dtblRack.NewRow();
                    drow["rackName"] = string.Empty;
                    drow["rackId"] = 0;
                    dtblRack.Rows.InsertAt(drow, 0);
                    DataGridViewComboBoxCell cell = (DataGridViewComboBoxCell)(dgvProductCreation.Rows[e.RowIndex].Cells["dgvcmbrack"]);
                    cell.DataSource = dtblRack;
                    cell.ValueMember = "rackId";
                    cell.DisplayMember = "rackName";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("PC:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
 /// <summary>
 /// Function to fill rack combobox for Production
 /// </summary>
 public void RackComboFillProduction(decimal decGodownId, int inRow, int inColumn)
 {
     try
     {
         DataTable dtbl = new DataTable();
         RackSP spRack = new RackSP();
         dtbl = spRack.RackNamesCorrespondingToGodownId(decGodownId);
         DataRow drow = dtbl.NewRow();
         DataGridViewComboBoxCell dgvcmbRackCellProduction = (DataGridViewComboBoxCell)dgvProduction.Rows[inRow].Cells[inColumn];
         dgvcmbRackCellProduction.DataSource = dtbl;
         dgvcmbRackCellProduction.ValueMember = "rackId";
         dgvcmbRackCellProduction.DisplayMember = "rackName";
     }
     catch (Exception ex)
     {
         MessageBox.Show("SJ:27" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        //-------------------------------------------------------------ReturnFromRackForm--------------------------- 
        public void ReturnFromRackForm(decimal decId)//Form Rack
        {
            try
            {

                if (!isCallFromGrid)
                {

                    RackComboFill();
                    if (decId.ToString() != "0")
                    {
                        cmbDefaultRack.SelectedValue = decId;
                    }
                    else if (strRackName != string.Empty)
                    {
                        cmbDefaultRack.SelectedValue = strRackName;
                    }
                    else
                    {
                        cmbDefaultRack.SelectedIndex = -1;
                    }
                    this.Enabled = true;
                    cmbDefaultRack.Focus();
                    this.WindowState = FormWindowState.Normal;
                    this.Activate();
                }
                else
                {

                    DataGridViewComboBoxCell dgvRackCell = (DataGridViewComboBoxCell)dgvProductCreation[dgvProductCreation.Columns["dgvcmbrack"].Index, dgvProductCreation.CurrentRow.Index];
                    DataTable dtbl = new DataTable();
                    RackSP spRack = new RackSP();

                    dtbl = spRack.RackNamesCorrespondingToGodownId(decGodownIdForRack);
                    if (decId.ToString() != "0")
                    {

                        dgvRackCell.DataSource = dtbl;
                        dgvRackCell.ValueMember = "rackId";
                        dgvRackCell.DisplayMember = "rackName";
                        dgvProductCreation.CurrentRow.Cells["dgvcmbrack"].Value = decId;


                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("PC:42" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        /// <summary>
        /// Function to fill rack combobox in grid
        /// </summary>
        public void RackComboFill()
        {
            try
            {
                DataTable dtbl = new DataTable();
                RackSP spRack = new RackSP();
                decimal decGodownId = Convert.ToDecimal(cmbDefaultGodown.SelectedValue.ToString());
                dtbl = spRack.RackNamesCorrespondingToGodownId(decGodownId);
                cmbDefaultRack.DataSource = dtbl;
                cmbDefaultRack.DisplayMember = "rackName";
                cmbDefaultRack.ValueMember = "rackId";
                if (dtbl.Rows.Count > 0)
                {
                    cmbDefaultRack.SelectedIndex = 0;
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show("PC:54" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
 /// <summary>
 /// Rackcombofill
 /// </summary>
 /// <param name="decrackId"></param>
 public void rackcombofill1(decimal decrackId)
 {
     try
     {
         RackSP spRack = new RackSP();
         DataTable dtblc = new DataTable();
         dtblc = spRack.RackNamesCorrespondingToGodownId(decrackId);
         dgvCmbRack.DataSource = dtblc;
         dgvCmbRack.ValueMember = "rackId";
         dgvCmbRack.DisplayMember = "rackName";
     }
     catch (Exception ex)
     {
         MessageBox.Show("SR73:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemple #6
0
 /// <summary>
 /// Function to use the Rack Combo Fill by under the Godown
 /// </summary>
 /// <param name="dcGodownId"></param>
 public void RackComboFillByGodownId(decimal dcGodownId)
 {
     try
     {
         DataTable dtblRack = new DataTable();
         RackSP spRack = new RackSP();
         dtblRack = spRack.RackNamesCorrespondingToGodownId(dcGodownId);
         cmbRack.DataSource = dtblRack;
         cmbRack.ValueMember = "rackId";
         cmbRack.DisplayMember = "rackName";
     }
     catch (Exception ex)
     {
         MessageBox.Show("POS:15" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// On cellLeave of dgvProduct
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgvProduct_CellLeave(object sender, DataGridViewCellEventArgs e)
 {
     BatchSP spbatch = new BatchSP();
     PurchaseOrderMasterSP SPPurchaseOrderMaster = new PurchaseOrderMasterSP();
     StockPostingSP spStockPosting = new StockPostingSP();
     try
     {
         if (isValueChange)
         {
             string strBarcode = string.Empty;
             string strProductCode = string.Empty;
             if (e.RowIndex > -1 && e.ColumnIndex > -1)
             {
                 CheckInvalidEntries(e);
                 if (e.ColumnIndex == dgvProduct.Columns["dgvcmbBatch"].Index)
                 {
                     if (dgvProduct.Rows[e.RowIndex].Cells["productId"].Value != null && dgvProduct.Rows[e.RowIndex].Cells["productId"].Value.ToString() != string.Empty)
                     {
                         if (dgvProduct.Rows[e.RowIndex].Cells["dgvcmbBatch"].Value != null && dgvProduct.Rows[e.RowIndex].Cells["dgvcmbBatch"].Value.ToString() != string.Empty)
                         {
                             if (Convert.ToString(dgvProduct.Rows[e.RowIndex].Cells["dgvcmbBatch"].Value) != string.Empty &&
                                Convert.ToString(dgvProduct.Rows[e.RowIndex].Cells["dgvcmbBatch"].Value) != "0")
                             {
                                 decBatchId = Convert.ToDecimal(dgvProduct.Rows[e.RowIndex].Cells["dgvcmbBatch"].Value);
                                 strProductCode = dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductCode"].Value.ToString();
                                 strBarcode = spbatch.ProductBatchBarcodeViewByBatchId(decBatchId);
                                 dgvProduct.Rows[e.RowIndex].Cells["dgvtxtBarcode"].Value = strBarcode;
                                 dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductCode"].Value = strProductCode;
                             }
                         }
                     }
                 }
                 else if (dgvProduct.Columns[e.ColumnIndex].Name == "dgvcmbUnit")
                 {
                     if (dgvProduct.Rows[e.RowIndex].Cells["dgvcmbUnit"].Value != null && dgvProduct.Rows[e.RowIndex].Cells["dgvcmbUnit"].Value.ToString() != string.Empty)
                     {
                         UnitConvertionSP SpUnitConvertion = new UnitConvertionSP();
                         DataTable dtblUnitByProduct = new DataTable();
                         dtblUnitByProduct = SpUnitConvertion.UnitConversionIdAndConRateViewallByProductId(dgvProduct.Rows[e.RowIndex].Cells["productId"].Value.ToString());
                         foreach (DataRow drUnitByProduct in dtblUnitByProduct.Rows)
                         {
                             if (dgvProduct.Rows[e.RowIndex].Cells["dgvcmbUnit"].Value.ToString() == drUnitByProduct.ItemArray[0].ToString())
                             {
                                 dgvProduct.Rows[e.RowIndex].Cells["dgvtxtUnitConversionId"].Value = Convert.ToDecimal(drUnitByProduct.ItemArray[2].ToString());
                                 dgvProduct.Rows[e.RowIndex].Cells["dgvtxtConversionRate"].Value = Convert.ToDecimal(drUnitByProduct.ItemArray[3].ToString());
                                 if (isDoAfterGridFill)
                                 {
                                     decimal decNewConversionRate = Convert.ToDecimal(dgvProduct.Rows[e.RowIndex].Cells["dgvtxtConversionRate"].Value.ToString());
                                     decimal decNewRate = (decCurrentRate * decCurrentConversionRate) / decNewConversionRate;
                                     dgvProduct.Rows[e.RowIndex].Cells["dgvtxtRate"].Value = Math.Round(decNewRate, 2);
                                     NewAmountCalculation("dgvtxtQty", e.RowIndex);
                                     CalculateTotalAmount();
                                 }
                             }
                         }
                         CheckInvalidEntries(e);
                     }
                 }
                 else if (dgvProduct.Columns[e.ColumnIndex].Name == "dgvcmbGodown")
                 {
                     if (dgvProduct.Rows[e.RowIndex].Cells["dgvcmbGodown"].Value != null && dgvProduct.Rows[e.RowIndex].Cells["dgvcmbGodown"].Value.ToString() != string.Empty)
                     {
                         decGodownId = Convert.ToDecimal(dgvProduct.CurrentRow.Cells["dgvcmbGodown"].Value);
                         RackComboFill(decGodownId, e.RowIndex, dgvProduct.Rows[e.RowIndex].Cells["dgvCmbRack"].ColumnIndex);
                         DataTable dtbl = new DataTable();
                         RackSP spRack = new RackSP();
                         dtbl = spRack.RackNamesCorrespondingToGodownId(decGodownId);
                         dgvProduct.Rows[e.RowIndex].Cells["dgvCmbRack"].Value = Convert.ToDecimal(dtbl.Rows[0]["rackId"].ToString());
                     }
                     CheckInvalidEntries(e);
                 }
                 else if (dgvProduct.Columns[e.ColumnIndex].Name == "dgvCmbCurrency" && isAmountcalc)
                 {
                     ExchangeRateSP spExchangeRate = new ExchangeRateSP();
                     if (dgvProduct.Rows[e.RowIndex].Cells["dgvCmbCurrency"].Value != null && Convert.ToString(dgvProduct.Rows[e.RowIndex].Cells["dgvCmbCurrency"].Value) != string.Empty)
                     {
                         dgvProduct.Rows[e.RowIndex].Cells["dgvtxtExchangeRate"].Value = spExchangeRate.GetExchangeRateByExchangeRateId(Convert.ToDecimal(Convert.ToString(dgvProduct.Rows[e.RowIndex].Cells["dgvCmbCurrency"].Value)));
                     }
                     else
                     {
                         dgvProduct.Rows[e.RowIndex].Cells["dgvCmbCurrency"].Value = SPPurchaseOrderMaster.ExchangeRateIdByCurrencyId(PublicVariables._decCurrencyId);
                         dgvProduct.Rows[e.RowIndex].Cells["dgvtxtExchangeRate"].Value = spExchangeRate.GetExchangeRateByExchangeRateId(Convert.ToDecimal(Convert.ToString(dgvProduct.Rows[e.RowIndex].Cells["dgvCmbCurrency"].Value)));
                     }
                     CheckInvalidEntries(e);
                 }
                 //----------while changing Qty,corresponding change in amount--------
                 else if (dgvProduct.Columns[e.ColumnIndex].Name == "dgvtxtQty" && isAmountcalc)
                 {
                     if (dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductCode"].Value != null && dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductName"].Value != null)
                     {
                         if (dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductCode"].Value.ToString() != string.Empty && dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductName"].Value.ToString() != string.Empty)
                         {
                             NewAmountCalculation("dgvtxtQty", e.RowIndex);
                             CalculateTotalAmount();
                         }
                     }
                     CheckInvalidEntries(e);
                 }
                 //---------------while changing Qty,corresponding change in amount----
                 else if (dgvProduct.Columns[e.ColumnIndex].Name == "dgvtxtRate" && isAmountcalc)
                 {
                     NewAmountCalculation("dgvtxtRate", e.RowIndex);
                     CalculateTotalAmount();
                     CheckInvalidEntries(e);
                 }
                 //----while changing amount ,corresponding chnage in total amount-------
                 else if (dgvProduct.Columns[e.ColumnIndex].Name == "dgvtxtAmount" && isAmountcalc)
                 {
                     if (cmbcurrency.Text != string.Empty)
                     {
                         CalculateTotalAmount();
                     }
                 }
                 //}
             }
         }
         CheckInvalidEntries(e);
     }
     catch (Exception ex)
     {
         MessageBox.Show("MR72:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to fill the details against purchase order
 /// </summary>
 public void FillOrderDetails()
 {
     BatchSP spbatch = new BatchSP();
     PurchaseOrderDetailsSP SPPurchaseOrderDetails = new PurchaseOrderDetailsSP();
     StockPostingSP spStockPosting = new StockPostingSP();
     ProductSP spproduct = new ProductSP();
     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;
             DataTable dtblDetails = new DataTable();
             if (Convert.ToDecimal(cmbOrderNo.SelectedValue.ToString()) == decOrderNoWhileEditMode && btnSave.Text == "Update")
             {
                 dtblDetails = SPPurchaseOrderDetails.PurchaseOrderDetailsViewByOrderMasterIdWithRemainingForEdit(Convert.ToDecimal(cmbOrderNo.SelectedValue.ToString()), decMaterialReceiptId);
             }
             else
             {
                 dtblDetails = SPPurchaseOrderDetails.PurchaseOrderDetailsViewByOrderMasterIdWithRemaining(Convert.ToDecimal(cmbOrderNo.SelectedValue.ToString()), decMaterialReceiptId);
             }
             int inRowIndex = 0;
             foreach (DataRow drowDetails in dtblDetails.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 = spproduct.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());
                 UnitConvertionSP SpUnitConvertion = new UnitConvertionSP();
                 DataTable dtblUnitByProduct = new DataTable();
                 dtblUnitByProduct = SpUnitConvertion.UnitConversionIdAndConRateViewallByProductId(strproductId);
                 foreach (DataRow drUnitByProduct in dtblUnitByProduct.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 = spStockPosting.BatchViewByProductId(Convert.ToDecimal(strproductId));
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbBatch"].Value = decBatch;
                 string strBarcode = spbatch.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);
                 DataTable dtbl = new DataTable();
                 RackSP spRack = new RackSP();
                 dtbl = spRack.RackNamesCorrespondingToGodownId(1);
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvCmbRack"].Value = Convert.ToDecimal(dtbl.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 Rack combobox
 /// </summary>
 /// <param name="decGodownId"></param>
 /// <param name="inRow"></param>
 /// <param name="inColumn"></param>
 public void RackComboFill(decimal decGodownId, int inRow, int inColumn)
 {
     try
     {
         DataTable dtbl = new DataTable();
         RackSP spRack = new RackSP();
         dtbl = spRack.RackNamesCorrespondingToGodownId(decGodownId);
         DataGridViewComboBoxCell dgvcmbRackCell = (DataGridViewComboBoxCell)dgvProduct.Rows[inRow].Cells[inColumn];
         dgvcmbRackCell.DataSource = dtbl;
         dgvcmbRackCell.ValueMember = "rackId";
         dgvcmbRackCell.DisplayMember = "rackName";
         dgvProduct.Rows[inRow].Cells["dgvCmbRack"].Value = Convert.ToDecimal(dtbl.Rows[0]["rackId"].ToString());
     }
     catch (Exception ex)
     {
         MessageBox.Show("MR24:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }