/// <summary>
        /// Function to fill the grid based on the search conditions
        /// </summary>
        public void FillGrid()
        {
            try
            {

                decimal decProdGroup = 0;
                decimal decLedgerId = 0;
                decimal decVoucherTypeId = 0;
                string strProductName = string.Empty;
                string strProductCode = string.Empty;
                string strVoucherNo = string.Empty;
                if (cmbCashOrParty.SelectedIndex > -1)
                {
                    if (cmbCashOrParty.SelectedIndex == 0 || cmbCashOrParty.SelectedIndex == -1)
                    {
                        decLedgerId = 0;
                    }
                    else
                    {
                        decLedgerId = Convert.ToDecimal(cmbCashOrParty.SelectedValue.ToString());

                    }
                }
                if (cmbProductGroup.SelectedIndex > -1)
                {
                    if (cmbProductGroup.SelectedIndex == 0 || cmbProductGroup.SelectedIndex == -1)
                    {
                        decProdGroup = 0;
                    }
                    else
                    {
                        decProdGroup = Convert.ToDecimal(cmbProductGroup.SelectedValue.ToString());

                    }
                }

                if (cmbVoucherType.SelectedIndex > -1)
                {
                    if (cmbVoucherType.SelectedValue.ToString() != "System.Data.DataRowView" && cmbVoucherType.Text != "System.Data.DataRowView")
                    {

                        if (cmbVoucherType.SelectedIndex == 0 || cmbVoucherType.SelectedIndex == -1)
                        {

                            decVoucherTypeId = Convert.ToDecimal(cmbVoucherType.SelectedValue.ToString());
                        }
                        else
                        {
                            decVoucherTypeId = Convert.ToDecimal(cmbVoucherType.SelectedValue.ToString());

                        }
                    }
                }

                if (txtVoucherNo.Text == string.Empty)
                {
                    strVoucherNo = string.Empty;
                }
                else
                {
                    strVoucherNo = txtVoucherNo.Text;
                }
                if (txtProductCode.Text == string.Empty)
                {
                    strProductCode = string.Empty;
                }
                else
                {
                    strProductCode = txtProductCode.Text;
                }
                if (txtProductName.Text == string.Empty)
                {
                    strProductName = string.Empty;
                }
                else
                {
                    strProductName = txtProductName.Text;
                }
                List<DataTable> listobj = new List<DataTable>();
                ProductCreationBll BllProductCreation = new ProductCreationBll();
                listobj = BllProductCreation.VoucherWiseProductSearch(decVoucherTypeId, strVoucherNo, Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtToDate.Text), decProdGroup, strProductCode, decLedgerId, strProductName);
                dgvVoucherwiseProductSearch.DataSource = listobj[0];
                decimal dcTotalInward = 0;
                decimal dcTotalOutward = 0;
                try
                {

                    dcTotalInward = Math.Round((Convert.ToDecimal(listobj[0].Compute("Sum([InwardQty])", string.Empty).ToString())), 2);

                }
                catch { }
                try
                {
                    dcTotalOutward = Math.Round((Convert.ToDecimal(listobj[0].Compute("Sum([OutwardQty])", string.Empty).ToString())), 2);

                }
                catch { }
                decimal dcBalance = Math.Round((dcTotalInward - dcTotalOutward), 2);

                lblTotalInqty.Text = "Total Inward : " + dcTotalInward.ToString();

                lblTotalOutQty.Text = "Total Outward : " + dcTotalOutward.ToString();

                lblBalanceQty.Text = "Balance : " + dcBalance.ToString();

                if (inCurrenRowIndex >= 0 && dgvVoucherwiseProductSearch.Rows.Count > 0 && inCurrenRowIndex < dgvVoucherwiseProductSearch.Rows.Count)
                {
                    if (dgvVoucherwiseProductSearch.Columns.Contains("outwardQty"))
                    {
                        dgvVoucherwiseProductSearch.CurrentCell = dgvVoucherwiseProductSearch.Rows[inCurrenRowIndex].Cells["dgvtxtOutwardQty"];
                    }
                    else
                    {

                    }

                }
                inCurrenRowIndex = 0;
                dgvVoucherwiseProductSearch.Columns["dgvtxtrate"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            }
            catch (Exception ex)
            {

                MessageBox.Show("VPS :04" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }