/// <summary>
 /// Function to fill Datagridview
 /// </summary>
 public void GridFill()
 {
     try
     {
         if (txtVoucherNo.Text.Trim() == string.Empty)
         {
             strVoucherNo = string.Empty;
         }
         else
         {
             strVoucherNo = txtVoucherNo.Text;
         }
         if (cmbCashOrParty.SelectedIndex == 0 || cmbCashOrParty.SelectedIndex == -1)
         {
             decLedgerId = -1;
         }
         else
         {
             decLedgerId = Convert.ToDecimal(cmbCashOrParty.SelectedValue.ToString());
         }
         if (cmbVoucherType.SelectedIndex == 0 || cmbVoucherType.SelectedIndex == -1)
         {
             decVoucherTypeId = -1;
         }
         else
         {
             decVoucherTypeId = Convert.ToDecimal(cmbVoucherType.SelectedValue.ToString());
         }
         if (cmbSalesMan.SelectedIndex == 0 || cmbSalesMan.SelectedIndex == -1)
         {
             decEmployeeId = -1;
         }
         else
         {
             decEmployeeId = Convert.ToDecimal(cmbSalesMan.SelectedValue.ToString());
         }
         if (txtProductCode.Text.Trim() == string.Empty)
         {
             strProductCode = string.Empty;
         }
         else
         {
             strProductCode = txtProductCode.Text;
         }
         if (cmbStatus.SelectedIndex == 0 || cmbStatus.SelectedIndex == -1)
         {
             strStatus = "All";
         }
         if (cmbStatus.SelectedIndex == 1)
         {
             strStatus = "True";
         }
         if (cmbStatus.SelectedIndex == 2)
         {
             strStatus = "False";
         }
         DateTime FromDate = this.dtpFromDate.Value;
         DateTime ToDate   = this.dtpToDate.Value;
         dtblSalesQuotationReport = spSalesQuotationMaster.SalesQuotationReportSearch(strVoucherNo, decLedgerId, FromDate, ToDate, strStatus, decEmployeeId, decVoucherTypeId, strProductCode);
         if (dtblSalesQuotationReport.Rows.Count > 0)
         {
             decimal decTotal = 0;
             for (int i = 0; i < dtblSalesQuotationReport.Rows.Count; i++)
             {
                 if (dtblSalesQuotationReport.Rows[i]["totalAmount"].ToString() != null)
                 {
                     decTotal = decTotal + Convert.ToDecimal(dtblSalesQuotationReport.Rows[i]["totalAmount"].ToString());
                 }
             }
             decTotal            = Math.Round(decTotal, 2);
             txtTotalAmount.Text = decTotal.ToString();
         }
         else
         {
             txtTotalAmount.Text = "0.00";
         }
         dgvSalesQuotationReport.DataSource = dtblSalesQuotationReport;
         if (dgvSalesQuotationReport.Columns.Count > 0)
         {
             dgvSalesQuotationReport.Columns["Amount"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("SQRP:05" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }