/// <summary>
 /// Function to fill Datagridview
 /// </summary>
 public void GridFill()
 {
     try
     {
         List<DataTable> ListObj = new List<DataTable>();
         SalesOrderBll bllSalesOrder = new SalesOrderBll();
         if (cmbSalesOrderNo.SelectedIndex == 0 || cmbSalesOrderNo.SelectedIndex == -1)
         {
             strInvoiceNo = "All";
         }
         else
         {
             strInvoiceNo = cmbSalesOrderNo.Text;
         }
         if (cmbCashOrParty.SelectedIndex == 0 || cmbCashOrParty.SelectedIndex == -1)
         {
             decLedgerId = -1;
         }
         else
         {
             decLedgerId = Convert.ToDecimal(cmbCashOrParty.SelectedValue.ToString());
         }
         if (rbtnAll.Checked == true)
         {
             strCondition = "All";
         }
         if (rbtnPendingOrder.Checked == true)
         {
             strCondition = "Pending";
         }
         if (rbtnOverdue.Checked == true)
         {
             strCondition = "Due";
         }
         if (rbtnCancelled.Checked == true)
         {
             strCondition = "Cancelled";
         }
         DateTime FromDate = this.dtpFromDate.Value;
         DateTime ToDate = this.dtpToDate.Value;
         ListObj = bllSalesOrder.SalesOrderRegisterSearch(strInvoiceNo, decLedgerId, FromDate, ToDate, strCondition);
         dgvSalesOrderRegister.DataSource = ListObj[0];
         if (dgvSalesOrderRegister.Columns.Count > 0)
         {
             dgvSalesOrderRegister.Columns["dgvtxtBillAmount"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("SOREG2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }