public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { SchoolList rpt = new SchoolList(); rpt.Site = this.Site; return(rpt); }
private void cboOk_Click(object sender, EventArgs e) { string selformular = ""; ReportDocument RptFilename = new ReportDocument(); string tstartdate = (dtpStartDate.Checked == false ? "" : "Date(" + dtpStartDate.Value.Year + "," + dtpStartDate.Value.Month + "," + dtpStartDate.Value.Day + ")"); string tenddate = (dtpEndDate.Checked == false ? "" : "Date(" + dtpEndDate.Value.Year + "," + dtpEndDate.Value.Month + "," + dtpEndDate.Value.Day + ")"); switch (lblReportTitle.Text) { case "Payment List (Layout 1)": RptFilename = new Reports.PaymentList(); if (chkSchool.Checked) { selformular = " {RptPaymentWithRegionAndCategory.Source}='SCHOOL'"; } if (chkStudent.Checked) { selformular = selformular + (selformular == "" ? "" : " OR ") + " {RptPaymentWithRegionAndCategory.Source}='STUDENT'"; } if (chkVendor.Checked) { selformular = selformular + (selformular == "" ? "" : " OR ") + " {RptPaymentWithRegionAndCategory.Source}='VENDOR'"; } if (chkStaff.Checked) { selformular = selformular + (selformular == "" ? "" : " OR ") + " {RptPaymentWithRegionAndCategory.Source}='STAFF'"; } if (selformular != "") { selformular = "(" + selformular + ")"; } if (tstartdate != "") { selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptPaymentWithRegionAndCategory.PayValueDate}>=" + tstartdate; } if (tenddate != "") { selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptPaymentWithRegionAndCategory.PayValueDate}<=" + tenddate; } if (cboGrpFilter.Text != "<ALL>" && cboGrpBy.Text == "Region") { selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptPaymentWithRegionAndCategory.Region}='" + cboGrpFilter.Text + "'"; } if (cboGrpFilter.Text != "<ALL>" && cboGrpBy.Text == "Category") { selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptPaymentWithRegionAndCategory.Category}='" + cboGrpFilter.Text + "'"; } if (cboGrpFilter.Text != "<ALL>" && cboGrpBy.Text == "Intervention Line") { selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptPaymentWithRegionAndCategory.InterventionLine}='" + cboGrpFilter.Text + "'"; } switch (cboGrpBy.Text) { case "Region": RptFilename.DataDefinition.FormulaFields["Grp"].Text = "{RptPaymentWithRegionAndCategory.Region}"; break; case "Category": RptFilename.DataDefinition.FormulaFields["Grp"].Text = "{RptPaymentWithRegionAndCategory.Category}"; break; case "Intervention Line": RptFilename.DataDefinition.FormulaFields["Grp"].Text = "{RptPaymentWithRegionAndCategory.InterventionLine}"; break; default: RptFilename.DataDefinition.FormulaFields["Grp"].Text = ""; break; } break; case "Payment List (Layout 2)": RptFilename = new Reports.PaymentList2(); if (chkSchool.Checked) { selformular = " {RptPaymentWithRegionAndCategory.Source}='SCHOOL'"; } if (chkStudent.Checked) { selformular = selformular + (selformular == "" ? "" : " OR ") + " {RptPaymentWithRegionAndCategory.Source}='STUDENT'"; } if (chkVendor.Checked) { selformular = selformular + (selformular == "" ? "" : " OR ") + " {RptPaymentWithRegionAndCategory.Source}='VENDOR'"; } if (chkStaff.Checked) { selformular = selformular + (selformular == "" ? "" : " OR ") + " {RptPaymentWithRegionAndCategory.Source}='STAFF'"; } if (selformular != "") { selformular = "(" + selformular + ")"; } if (tstartdate != "") { selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptPaymentWithRegionAndCategory.PayValueDate}>=" + tstartdate; } if (tenddate != "") { selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptPaymentWithRegionAndCategory.PayValueDate}<=" + tenddate; } if (cboGrpFilter.Text != "<ALL>" && cboGrpBy.Text == "Region") { selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptPaymentWithRegionAndCategory.Region}='" + cboGrpFilter.Text + "'"; } if (cboGrpFilter.Text != "<ALL>" && cboGrpBy.Text == "Category") { selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptPaymentWithRegionAndCategory.Category}='" + cboGrpFilter.Text + "'"; } if (cboGrpFilter.Text != "<ALL>" && cboGrpBy.Text == "Intervention Line") { selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptPaymentWithRegionAndCategory.InterventionLine}='" + cboGrpFilter.Text + "'"; } switch (cboGrpBy.Text) { case "Region": RptFilename.DataDefinition.FormulaFields["Grp"].Text = "{RptPaymentWithRegionAndCategory.Region}"; break; case "Category": RptFilename.DataDefinition.FormulaFields["Grp"].Text = "{RptPaymentWithRegionAndCategory.Category}"; break; case "Intervention Line": RptFilename.DataDefinition.FormulaFields["Grp"].Text = "{RptPaymentWithRegionAndCategory.InterventionLine}"; break; default: RptFilename.DataDefinition.FormulaFields["Grp"].Text = ""; break; } break; case "School List": RptFilename = new Reports.SchoolList(); if (cboGrpFilter.Text != "<ALL>" && cboGrpBy.Text == "Region") { selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptRegisterSchool.Region}='" + cboGrpFilter.Text + "'"; } if (cboGrpFilter.Text != "<ALL>" && cboGrpBy.Text == "Category") { selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptRegisterSchool.Category}='" + cboGrpFilter.Text + "'"; } switch (cboGrpBy.Text) { case "Region": RptFilename.DataDefinition.FormulaFields["Grp"].Text = "{RptRegisterSchool.Region}"; break; case "Category": RptFilename.DataDefinition.FormulaFields["Grp"].Text = "{RptRegisterSchool.Category}"; break; default: RptFilename.DataDefinition.FormulaFields["Grp"].Text = ""; break; } break; case "Student List": RptFilename = new Reports.StudentList(); if (cboGrpFilter.Text != "<ALL>" && cboGrpBy.Text == "Region") { selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptRegisterStudent.Region}='" + cboGrpFilter.Text + "'"; } if (cboGrpFilter.Text != "<ALL>" && cboGrpBy.Text == "Category") { selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptRegisterStudent.Category}='" + cboGrpFilter.Text + "'"; } switch (cboGrpBy.Text) { case "Region": RptFilename.DataDefinition.FormulaFields["Grp"].Text = "{RptRegisterStudent.Region}"; break; case "Category": RptFilename.DataDefinition.FormulaFields["Grp"].Text = "{RptRegisterStudent.Category}"; break; default: RptFilename.DataDefinition.FormulaFields["Grp"].Text = ""; break; } break; case "Staff List": RptFilename = new Reports.VendorList(); selformular = " {RptRegisterVendor.Source}='STAFF'"; if (cboGrpFilter.Text != "<ALL>" && cboGrpBy.Text == "Region") { selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptRegisterVendor.Region}='" + cboGrpFilter.Text + "'"; } if (cboGrpFilter.Text != "<ALL>" && cboGrpBy.Text == "Category") { selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptRegisterVendor.Category}='" + cboGrpFilter.Text + "'"; } switch (cboGrpBy.Text) { case "Region": RptFilename.DataDefinition.FormulaFields["Grp"].Text = "{RptRegisterVendor.Region}"; break; case "Category": RptFilename.DataDefinition.FormulaFields["Grp"].Text = "{RptRegisterVendor.Category}"; break; default: RptFilename.DataDefinition.FormulaFields["Grp"].Text = ""; break; } break; case "Vendor List": RptFilename = new Reports.VendorList(); selformular = " {RptRegisterVendor.Source}='VENDOR'"; if (cboGrpFilter.Text != "<ALL>" && cboGrpBy.Text == "Region") { selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptRegisterVendor.Region}='" + cboGrpFilter.Text + "'"; } if (cboGrpFilter.Text != "<ALL>" && cboGrpBy.Text == "Category") { selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptRegisterVendor.Category}='" + cboGrpFilter.Text + "'"; } switch (cboGrpBy.Text) { case "Region": RptFilename.DataDefinition.FormulaFields["Grp"].Text = "{RptRegisterVendor.Region}"; break; case "Category": RptFilename.DataDefinition.FormulaFields["Grp"].Text = "{RptRegisterVendor.Category}"; break; default: RptFilename.DataDefinition.FormulaFields["Grp"].Text = ""; break; } break; case "Mandate": FrmMandateRpt childform = new FrmMandateRpt(); childform.TheMandateNo = cboMandateNo.Text; childform.dAmount = "0"; childform.MainAction = "Main"; childform.ShowDialog(); return; case "Payment Deduction List": RptFilename = new Reports.PaymentDeductionList(); if (tstartdate != "") { selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptPaymentDeductions.PayValueDate}>=" + tstartdate; } if (tenddate != "") { selformular = selformular + (selformular == "" ? "" : " AND ") + " {RptPaymentDeductions.PayValueDate}<=" + tenddate; } break; default: MessageBox.Show("Pls. select a report option"); return; } FrmRptDisplay ChildForm = new FrmRptDisplay(); ChildForm.RptTitle = lblReportTitle.Text; ChildForm.RptDestination = "Screen"; ChildForm.myReportDocument = RptFilename; //MessageBox.Show(selformular); if (selformular != "") { ChildForm.SelFormula = selformular; } ChildForm.ShowDialog(); }