private void butOK_Click(object sender, EventArgs e) { DataTable tablePats = KPIActiveRecall.GetActiveRecall(dtpStart.Value, dtpEnd.Value); ReportComplex report = new ReportComplex(true, false); report.ReportName = Lan.g(this, "Patients on Active Recall"); report.AddTitle("Title", Lan.g(this, "Patients on Active Recall")); report.AddSubTitle("Date", dtpStart.Value.ToShortDateString() + " - " + dtpEnd.Value.ToShortDateString()); QueryObject query; query = report.AddQuery(tablePats, "", "", SplitByKind.None, 0); query.AddColumn("Name", 150, FieldValueType.String); query.AddColumn("Gender", 60, FieldValueType.String); query.AddColumn("Age", 40, FieldValueType.String); query.AddColumn("Postal Code", 90, FieldValueType.String); query.AddColumn("Date of Service", 100, FieldValueType.String); query.AddColumn("Frequency", 90, FieldValueType.String); query.AddColumn("Primary Provider", 80, FieldValueType.String); query.AddGroupSummaryField("Patient Count:", "Name", "Provider", SummaryOperation.Count); report.AddPageNum(); if (!report.SubmitQueries()) { return; } FormReportComplex FormR = new FormReportComplex(report); FormR.ShowDialog(); //DialogResult=DialogResult.OK; }
public void GetPatientsOnActiveRecall() { DataTable real_dt = KPIActiveRecall.GetActiveRecall(Convert.ToDateTime("2016-03-20"), Convert.ToDateTime("2017-03-20")); DataTable expected_dt = new DataTable(); expected_dt.Clear(); expected_dt.Columns.Add("Name"); expected_dt.Columns.Add("Gender"); expected_dt.Columns.Add("Age"); expected_dt.Columns.Add("Postal Code"); expected_dt.Columns.Add("Date of Service"); expected_dt.Columns.Add("Frequency"); expected_dt.Columns.Add("Primary Provider"); DataRow _testPat = expected_dt.NewRow(); _testPat["Name"] = "Test, Patient 1"; _testPat["Gender"] = "F"; var birthdate = Convert.ToDateTime("1990-07-21"); var age = DateTime.UtcNow.Year - birthdate.Year; if (birthdate > DateTime.UtcNow.AddYears(-age)) { age--; } _testPat["Age"] = age.ToString(); _testPat["Postal Code"] = "T6E1R1"; _testPat["Date of Service"] = "25/12/2016"; _testPat["Frequency"] = "1y"; _testPat["Primary Provider"] = "DOC"; expected_dt.Rows.Add(_testPat); Assert.IsNotNull(real_dt); Assert.AreEqual(1, real_dt.Rows.Count); Assert.AreEqual(real_dt.Rows[0]["Name"], expected_dt.Rows[0]["Name"]); }