Example #1
0
        private void barButtonItem30_ItemClick(object sender, ItemClickEventArgs e)
        {
            var dateSelect = new frmCoverSheet("Select Date", "Select Date");
            dateSelect.ShowDialog();

            if (dateSelect.status)
            {

                //dateSelect.status = false;

                if (!dateSelect.creditBearing)
                {
                    var cover = Database.Query("enrollments e, learner_details l, results r, components c, enrollmentcomponents z",
                                   "e.LearnerKey = l.LearnerKEy AND r.idEnrollments = e.idEnrollments AND c.idCourseComponents = r.idCourseComponents " +
                                   "AND z.idCourseComponents = LEFT(r.idCourseComponents,(LOCATE('-EX',r.idCourseComponents)-1)) " +
                                   "AND z.idEnrollments = e.idEnrollments AND c.ComponentAbrev = 'EX' AND active is Null" +
                                   " AND capturedDate = '" + dateSelect.Selection.ToString("yyyyMMdd") +
                                   "' AND l.Division = '" + GlobalProperties.loggedOnUserDivison + "' AND c.Name NOT LIKE '%Pre%' AND  (( NOT z.Status = 'Inactive') OR z.Status IS Null)",
                                   "l.Surname, l.LearnerNumber, r.idCourseComponents, z.serialNumber, c.Name, r.FinalMark, r.PracMark, z.Result", true, "enrollments e, learner_details l, results r, components c");
                    //cover.WriteXmlSchema(@"C:\temp_schema.xml");
                    var report = new rptAssessmentCoverSheet();
                    report.SetDataSource(cover);

                    report.DataDefinition.FormulaFields["ExamDate"].Text = "\"" + dateSelect.Selection.ToString("dd/MM/yyyy") + "\"";
                    report.DataDefinition.FormulaFields["College"].Text = "\"" + GlobalProperties.LoggedOnUserDivision + "\"";
                    report.DataDefinition.FormulaFields["totalNumber"].Text = "\"" + cover.Tables[0].Rows.Count + "\"";

                    var frmReport = new frmReport(report) { Text = "Assessment Cover Sheet" };
                    frmReport.ShowDialog();
                    dateSelect.ShowDialog();
                }
                else
                {
                    var cover = Database.Query(
                                        "enrollments e, learner_details l, enrollmentComponents r, components c",
                                        "e.LearnerKey = l.LearnerKEy AND r.idEnrollments = e.idEnrollments AND c.idCourseComponents = r.idCourseComponents AND c.ComponentAbrev = 'PROJ' " +
                                        " AND resultDate = '" + dateSelect.Selection.ToString("yyyyMMdd") +
                                        "' AND l.Division = '" + GlobalProperties.loggedOnUserDivison + "'",
                                        "l.Surname, l.LearnerNumber, r.idCourseComponents, r.serialNumber, c.Name, r.Result, r.resultDate");
                    var report = new rptAssessmentCoverSheetCredit();
                    report.SetDataSource(cover);

                    report.DataDefinition.FormulaFields["ExamDate"].Text = "\"" + dateSelect.Selection.ToString("dd/MM/yyyy") + "\"";
                    report.DataDefinition.FormulaFields["College"].Text = "\"" + GlobalProperties.LoggedOnUserDivision + "\"";
                    report.DataDefinition.FormulaFields["totalNumber"].Text = "\"" + cover.Tables[0].Rows.Count + "\"";

                    var frmReport = new frmReport(report) { Text = "Assessment Cover Sheet" };
                    frmReport.ShowDialog();
                    dateSelect.ShowDialog();

                }

            }
        }
 public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
 {
     rptAssessmentCoverSheet rpt = new rptAssessmentCoverSheet();
     rpt.Site = this.Site;
     return rpt;
 }