示例#1
0
        private void LoadReport()

        {
            try
            {
                reportViewer1.ProcessingMode = ProcessingMode.Local;

                dtPRPDBatchCost = objPRPDBatch_DL.GetPRPDBatchCost(PRPDBatchID);

                dtPRPDBatchLabourCost = objPRPDBatch_DL.GetPRPDBatchLabourCost(PRPDBatchID);

                dtPRPDBatchMachineCost = objPRPDBatch_DL.GetPRPDBatchMachineCost(PRPDBatchID);

                dtPRPDBatchOHCost = objPRPDBatch_DL.GetPRPDBatchOHCost(PRPDBatchID);

                dtPRPDBatchMaterialCost = objPRPDBatch_DL.GetPRPDBatchMaterialCost(PRPDBatchID);

                dtPRPDBatchPrevious = objPRPDBatch_DL.GetPrevious(PRPDBatchID);

                ReportDataSource source1 = new ReportDataSource();
                source1.Name  = "PRPDBatchCostSummary";
                source1.Value = dtPRPDBatchCost;

                ReportDataSource source2 = new ReportDataSource();
                source2.Name  = "PRPDBatchLabourCost";
                source2.Value = dtPRPDBatchLabourCost;

                ReportDataSource source3 = new ReportDataSource();
                source3.Name  = "PRPDBatchMachineCost";
                source3.Value = dtPRPDBatchMachineCost;

                ReportDataSource source4 = new ReportDataSource();
                source4.Name  = "PRPDBatchOHCost";
                source4.Value = dtPRPDBatchOHCost;

                ReportDataSource source5 = new ReportDataSource();
                source5.Name  = "PRPDBatchMaterialCost";
                source5.Value = dtPRPDBatchMaterialCost;


                ReportDataSource source6 = new ReportDataSource();
                source6.Name  = "PRPDBatchPrevious";
                source6.Value = dtPRPDBatchPrevious;

/*
 #region Report Parameters
 *              ReportParameter p1 = new ReportParameter("UserID", CurrentUser.EmployeeID);
 *              rptViewer.LocalReport.SetParameters(p1);
 *              ReportParameter p2 = new ReportParameter("RPDBatchID", PRPDBatchID);
 *              rptViewer.LocalReport.SetParameters(p2);
 #endregion
 */

                reportViewer1.LocalReport.DataSources.Clear();
                reportViewer1.LocalReport.DataSources.Add(source1);
                reportViewer1.LocalReport.DataSources.Add(source2);
                reportViewer1.LocalReport.DataSources.Add(source3);
                reportViewer1.LocalReport.DataSources.Add(source4);
                reportViewer1.LocalReport.DataSources.Add(source5);
                reportViewer1.LocalReport.DataSources.Add(source6);


                reportViewer1.LocalReport.Refresh();
                reportViewer1.RefreshReport();
            }
            catch (Exception ee)
            {
                MessageBox.Show(this, ee.Message.ToString(), "Error Loading the Report", MessageBoxButtons.OK);
            }
        }