private void butReport_Click(object sender, System.EventArgs e) { if (errorProvider1.GetError(textDateFrom) != "" || errorProvider1.GetError(textDateTo) != "") { MsgBox.Show(this, "Please fix data entry errors first."); return; } DateTime dateFrom = PIn.PDate(textDateFrom.Text); DateTime dateTo = PIn.PDate(textDateTo.Text); if (dateTo < dateFrom) { MsgBox.Show(this, "To date cannot be before From date."); return; } ReportOld2 report = new ReportOld2(); report.ReportName = Lan.g(this, "Birthdays"); report.AddTitle(Lan.g(this, "Birthdays")); report.AddSubTitle(PrefB.GetString("PracticeTitle")); report.AddSubTitle(dateFrom.ToString("MM/dd") + " - " + dateTo.ToString("MM/dd")); /*report.Query=@"SELECT LName,FName,Address,Address2,City,State,Zip,Birthdate,Birthdate * FROM patient * WHERE SUBSTRING(Birthdate,6,5) >= '"+dateFrom.ToString("MM-dd")+"' " +"AND SUBSTRING(Birthdate,6,5) <= '"+dateTo.ToString("MM-dd")+"' " +"AND PatStatus=0 ORDER BY LName,FName";*/ report.AddColumn("LName", 90, FieldValueType.String); report.AddColumn("FName", 90, FieldValueType.String); report.AddColumn("Preferred", 90, FieldValueType.String); report.AddColumn("Address", 90, FieldValueType.String); report.AddColumn("Address2", 90, FieldValueType.String); report.AddColumn("City", 75, FieldValueType.String); report.AddColumn("State", 60, FieldValueType.String); report.AddColumn("Zip", 75, FieldValueType.String); report.AddColumn("Birthdate", 75, FieldValueType.Date); report.GetLastRO(ReportObjectKind.FieldObject).FormatString = "d"; report.AddColumn("Age", 45, FieldValueType.Integer); report.AddPageNum(); report.ReportTable = Patients.GetBirthdayList(dateFrom, dateTo); //if(!report.SubmitQuery()){ // return; //} FormReportOld2 FormR = new FormReportOld2(report); FormR.ShowDialog(); DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, System.EventArgs e) { //validate user input if (textDateFrom.errorProvider1.GetError(textDateFrom) != "" || textDateTo.errorProvider1.GetError(textDateTo) != "") { MessageBox.Show(Lan.g(this, "Please fix data entry errors first.")); return; } if (textDateFrom.Text.Length == 0 || textDateTo.Text.Length == 0) { MessageBox.Show(Lan.g(this, "From and To dates are required.")); return; } DateTime dateFrom = PIn.PDate(textDateFrom.Text); DateTime dateTo = PIn.PDate(textDateTo.Text); if (dateTo < dateFrom) { MessageBox.Show(Lan.g(this, "To date cannot be before From date.")); return; } if (listProv.SelectedIndices.Count == 0) { MessageBox.Show(Lan.g(this, "You must select at least one provider.")); return; } string whereProv; //used as the provider portion of the where clauses. //each whereProv needs to be set up separately for each query whereProv = "appointment.ProvNum in ("; for (int i = 0; i < listProv.SelectedIndices.Count; i++) { if (i > 0) { whereProv += ","; } whereProv += "'" + POut.PInt(Providers.List[listProv.SelectedIndices[i]].ProvNum) + "'"; } whereProv += ") "; //create the report ReportOld2 report = new ReportOld2(); report.IsLandscape = true; report.ReportName = "Appointments"; report.AddTitle("Appointments"); report.AddSubTitle(((Pref)PrefB.HList["PracticeTitle"]).ValueString); report.AddSubTitle(dateFrom.ToShortDateString() + " - " + dateTo.ToShortDateString()); //setup query report.Query = @"SELECT appointment.AptDateTime, trim(CONCAT(CONCAT(CONCAT(CONCAT(concat(patient.LName,', '),case when length(patient.Preferred) > 0 then CONCAT(concat('(',patient.Preferred),') ') else '' end),patient.fname), ' '),patient.middlei)) AS PatName, patient.Birthdate, appointment.AptDateTime, length(appointment.Pattern)*5, appointment.ProcDescript, patient.HmPhone, patient.WkPhone, patient.WirelessPhone FROM appointment INNER JOIN patient ON appointment.PatNum = patient.PatNum WHERE appointment.AptDateTime between " + POut.PDate(dateFrom) + " AND " + POut.PDate(dateTo.AddDays(1)) + " AND " + "AptStatus != '" + (int)ApptStatus.UnschedList + "' AND " + "AptStatus != '" + (int)ApptStatus.Planned + "' AND " + whereProv + " " + "ORDER BY appointment.AptDateTime, 2"; // add columns to report report.AddColumn("Date", 75, FieldValueType.Date); report.GetLastRO(ReportObjectKind.FieldObject).SuppressIfDuplicate = true; report.GetLastRO(ReportObjectKind.FieldObject).FormatString = "d"; report.AddColumn("Patient", 175, FieldValueType.String); report.AddColumn("Age", 45, FieldValueType.Age); // remove the total column //if(report.ReportObjects[report.ReportObjects.Count-1].SummarizedField == "Age") // report.ReportObjects.RemoveAt(report.ReportObjects.Count-1); //report.GetLastRO(ReportObjectKind.FieldObject).FormatString = "###0"; //report.GetLastRO(ReportObjectKind.FieldObject).TextAlign = ContentAlignment.MiddleCenter; //report.GetLastRO(ReportObjectKind.TextObject).TextAlign = ContentAlignment.MiddleCenter; report.AddColumn("Time", 65, FieldValueType.Date); report.GetLastRO(ReportObjectKind.FieldObject).FormatString = "t"; report.GetLastRO(ReportObjectKind.TextObject).TextAlign = ContentAlignment.MiddleRight; report.GetLastRO(ReportObjectKind.FieldObject).TextAlign = ContentAlignment.MiddleRight; report.AddColumn("Length", 60, FieldValueType.Integer); report.GetLastRO(ReportObjectKind.TextObject).Location = new Point( report.GetLastRO(ReportObjectKind.TextObject).Location.X + 6, report.GetLastRO(ReportObjectKind.TextObject).Location.Y); report.GetLastRO(ReportObjectKind.FieldObject).Location = new Point( report.GetLastRO(ReportObjectKind.FieldObject).Location.X + 8, report.GetLastRO(ReportObjectKind.FieldObject).Location.Y); report.AddColumn("Description", 170, FieldValueType.String); report.AddColumn("Home Ph.", 120, FieldValueType.String); report.AddColumn("Work Ph.", 120, FieldValueType.String); report.AddColumn("Cell Ph.", 120, FieldValueType.String); report.AddPageNum(); // execute query if (!report.SubmitQuery()) { return; } // display report FormReportOld2 FormR = new FormReportOld2(report); //FormR.MyReport=report; FormR.ShowDialog(); DialogResult = DialogResult.OK; }
private void ExecuteReport() { ReportOld2 report = new ReportOld2(); report.IsLandscape = true; report.AddTitle("CAPITATION UTILIZATION"); report.AddSubTitle(((Pref)PrefB.HList["PracticeTitle"]).ValueString); //incomplete: Need more flexible default values, eg based on current date instead of fixed date: DateTime DateTimeFirst = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1); report.AddParameter("carrier", FieldValueType.String, "" , "Enter a few letters of the name of the insurance carrier" , "carrier.CarrierName LIKE '%?%'"); // SPK 8/04 report.AddParameter("date1", FieldValueType.Date, DateTimeFirst , "From Date" , "procedurelog.ProcDate >= '?'"); report.AddParameter("date2", FieldValueType.Date , DateTimeFirst.AddMonths(1).AddDays(-1) , "To Date" , "procedurelog.ProcDate <= '?'"); // added carrierNum, SPK report.Query = @"SELECT carrier.CarrierName,CONCAT(CONCAT(patSub.LName,', '),patSub.FName) ,patSub.SSN,CONCAT(CONCAT(patPat.LName,', '),patPat.FName) ,patPat.Birthdate,procedurelog.ADACode,procedurecode.Descript ,procedurelog.ToothNum,procedurelog.Surf,procedurelog.ProcDate ,procedurelog.ProcFee,procedurelog.ProcFee-claimproc.WriteOff FROM procedurelog,patient AS patSub,patient AS patPat ,insplan,carrier,procedurecode,claimproc WHERE procedurelog.PatNum = patPat.PatNum AND claimproc.ProcNum = procedurelog.ProcNum AND claimproc.PlanNum = insplan.PlanNum AND claimproc.Status = 7 AND claimproc.NoBillIns = 0 AND insplan.Subscriber = patSub.PatNum AND insplan.CarrierNum = carrier.CarrierNum AND procedurelog.ADACode = procedurecode.ADACode AND ?carrier AND ?date1 AND ?date2 AND insplan.PlanType = 'c' AND procedurelog.ProcStatus = 2" ; report.AddColumn("Carrier", 150, FieldValueType.String); report.GetLastRO(ReportObjectKind.FieldObject).SuppressIfDuplicate = true; report.AddColumn("Subscriber", 120, FieldValueType.String); report.GetLastRO(ReportObjectKind.FieldObject).SuppressIfDuplicate = true; report.AddColumn("Subsc SSN", 70, FieldValueType.String); report.GetLastRO(ReportObjectKind.FieldObject).SuppressIfDuplicate = true; report.AddColumn("Patient", 120, FieldValueType.String); report.AddColumn("Pat DOB", 80, FieldValueType.Date); report.AddColumn("Code", 50, FieldValueType.String); report.AddColumn("Proc Description", 120, FieldValueType.String); report.AddColumn("Tth", 30, FieldValueType.String); report.AddColumn("Surf", 40, FieldValueType.String); report.AddColumn("Date", 80, FieldValueType.Date); report.AddColumn("UCR Fee", 70, FieldValueType.Number); report.AddColumn("Co-Pay", 70, FieldValueType.Number); report.AddPageNum(); if (!report.SubmitQuery()) { DialogResult = DialogResult.Cancel; return; } //incomplete: Add functionality for using parameter values in textObjects, probably using inline XML: report.AddSubTitle(((DateTime)report.ParameterFields["date1"].CurrentValues[0]).ToShortDateString() + " - " + ((DateTime)report.ParameterFields["date2"].CurrentValues[0]).ToShortDateString()); //incomplete: Implement formulas for situations like this: for (int i = 0; i < report.ReportTable.Rows.Count; i++) { if (PIn.PDouble(report.ReportTable.Rows[i][11].ToString()) == -1) { report.ReportTable.Rows[i][11] = "0"; } } FormReportOld2 FormR = new FormReportOld2(report); //FormR.MyReport=report; FormR.ShowDialog(); DialogResult = DialogResult.OK; }