Admin- DispReports.aspx

 

This is a value addition to my project. This facility allows the admin to view daily reports Developed with crystal reports which comes packaged with the Visual Studio.NET  2003. I am using a query  in the code behind to generate records . One more thing is that one has to generate the reports using VS.NET built in crystal report. Go to add new item in the soluton explorer   and add a new crystal report.Automatically new namespaces are added to the references sections ie CrystalDecisions.Web

 

The code behind code is called in the generate event of the button.

 

private void cmdGenerate_Click(object sender, System.EventArgs e)

              {                         

                     string h="";    // This event is called when one clicks on Generate button

                     string sqlString = "select od.productid, od.unitcost,pr.modelname,sum(od.quantity)as Quantity,(od.unitcost * sum(od.quantity))as Subtotal from orderdetails od,products pr where pr.productid = od.productid group by od.quantity,pr.modelname,od.unitcost,od.productid";

 

                     string report = cmbReport.SelectedItem.Text;

 

                     //Instantiates an object of class Reporting class and call the Create Report method

 

                     prjstart.Components.ReportingClass RE = new prjstart.Components.ReportingClass();

                    

                     //methods are sql string to be used for the report and the fileName of the report, doesn't need to add the extension

        h =RE.CreateReport(sqlString, report); // Very important method calls the method creates the report

 

                     if(h!="")

                     {

                           lblMessage.Text ="Report successfully stored in c:\\finalreports folder";

                     }

                     else

                     {

                           lblMessage.Text="Some error in generating the report";

                     }

             

             

              }

 

Back to Main Page