Example #1
0
 private void fillreport()
 {
     if (txtfromDate.Text != "" && txttoDate.Text != "" && txtcustomer.Text != "")
     {
         string from = txtfromDate.Text.Split('/')[1] + "/" + txtfromDate.Text.Split('/')[0] + "/" + txtfromDate.Text.Split('/')[2];
         string To   = txttoDate.Text.Split('/')[1] + "/" + txttoDate.Text.Split('/')[0] + "/" + txttoDate.Text.Split('/')[2];
         fdate = Convert.ToDateTime(from);
         tdate = Convert.ToDateTime(To);
         if (fdate > tdate)
         {
             MessageBox("From Date is Greater than ToDate");
             txtfromDate.Focus();
         }
         else
         {
             try
             {
                 DataTable dt = new DataTable();
                 dt = Specimen.Get_SpecimenDetailsForInvoice_Customerwise((txtcustomer.Text), Convert.ToDateTime(from), Convert.ToDateTime(To)).Tables[0];
                 // dt = Specimen.Get_SpecimenDetailsForInvoice().Tables[0];
                 if (dt.Rows.Count > 0)
                 {
                     ReportDocument crystalReport = new ReportDocument();
                     crystalReport.Load(Server.MapPath("Report/CustomerWiseReport.rpt"));
                     crystalReport.SetDataSource(dt);
                     crtcustomer.ReportSource = crystalReport;
                 }
                 else
                 {
                     MessageBox("Records Not Found");
                     txtcustomer.Focus();
                 }
             }
             catch { }
         }
     }
 }