/// <summary>
 /// Function to fill Datagridview
 /// </summary>
 public void GridFill()
 {
     try
     {
         SalesOrderBll bllSalesOrder = new SalesOrderBll();
         if (txtVoucherNo.Text.Trim() == string.Empty)
         {
             strInvoiceNo = "-1";
         }
         else
         {
             strInvoiceNo = 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 (cmbArea.SelectedIndex == 0 || cmbArea.SelectedIndex == -1)
         {
             decAreaId = -1;
         }
         else
         {
             decAreaId = Convert.ToDecimal(cmbArea.SelectedValue.ToString());
         }
         if (cmbRoute.SelectedIndex == 0 || cmbRoute.SelectedIndex == -1)
         {
             decRouteId = -1;
         }
         else
         {
             decRouteId = Convert.ToDecimal(cmbRoute.SelectedValue.ToString());
         }
         if (cmbProductGroup.SelectedIndex == 0 || cmbProductGroup.SelectedIndex == -1)
         {
             decGroupId = -1;
         }
         else
         {
             decGroupId = Convert.ToDecimal(cmbProductGroup.SelectedValue.ToString());
         }
         if (cmbQuotationNo.SelectedIndex == 0)
         {
             strSalesQuotationNo = "-1";
         }
         else
         {
             strSalesQuotationNo = cmbQuotationNo.SelectedValue.ToString();
         }
         if (cmbStatus.SelectedIndex == 0 || cmbStatus.SelectedIndex == -1)
         {
             strStatus = "All";
         }
         else
         {
             strStatus = cmbStatus.SelectedItem.ToString();
         }
         DateTime FromDate = this.dtpFromDate.Value;
         DateTime ToDate = this.dtpToDate.Value;
         ListObjSOMaster = bllSalesOrder.SalesOrderReportViewAll(strInvoiceNo, decLedgerId, strProductCode, decVoucherTypeId, FromDate, ToDate, strStatus, decEmployeeId, strSalesQuotationNo, decAreaId, decGroupId, decRouteId);
         if (ListObjSOMaster[0].Rows.Count > 0)
         {
             decimal decTotal = 0;
             for (int i = 0; i < ListObjSOMaster[0].Rows.Count; i++)
             {
                 if (ListObjSOMaster[0].Rows[i]["totalAmount"].ToString() != null)
                 {
                     decTotal = decTotal + Convert.ToDecimal(ListObjSOMaster[0].Rows[i]["totalAmount"].ToString());
                 }
             }
             decTotal = Math.Round(decTotal, 2);
             txtTotalAmount.Text = decTotal.ToString();
         }
         else
         {
             txtTotalAmount.Text = "0.00";
         }
         dgvSalesOrderReport.DataSource = ListObj[0];
         if (dgvSalesOrderReport.Columns.Count > 0)
         {
             dgvSalesOrderReport.Columns["dgvtxtTotalAmount"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("SORP9:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }