Example #1
0
        private void butOK_Click(object sender, EventArgs e)
        {
            DataTable tablePats = KPINewPatients.GetNewPatients(dtpStart.Value, dtpEnd.Value);

            ReportComplex report = new ReportComplex(true, false);

            report.ReportName = Lan.g(this, "New Patients");
            report.AddTitle("Title", Lan.g(this, "New Patients"));
            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("Date of Service", 100, FieldValueType.String);
            query.AddGroupSummaryField("Patient Count:", "Name", "Date of Service", SummaryOperation.Count);
            report.AddPageNum();
            if (!report.SubmitQueries())
            {
                return;
            }
            FormReportComplex FormR = new FormReportComplex(report);

            FormR.ShowDialog();
            //DialogResult=DialogResult.OK;
        }
Example #2
0
        public void GetNewPatients()
        {
            DataTable real_dt     = KPINewPatients.GetNewPatients(Convert.ToDateTime("2017-02-26"), Convert.ToDateTime("2017-03-26"));
            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("Date of Service");

            DataRow _testPat = expected_dt.NewRow();

            _testPat["Name"]   = "Test, Patient 1";
            _testPat["Gender"] = "M";
            var birthdate = Convert.ToDateTime("1988-07-21");
            var age       = DateTime.UtcNow.Year - birthdate.Year;

            if (birthdate > DateTime.UtcNow.AddYears(-age))
            {
                age--;
            }
            _testPat["Age"]             = age.ToString();
            _testPat["Date of Service"] = "2017-03-21";

            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"]);
        }