private void butPrint_Click(object sender, EventArgs e) { if (gridMain.Rows.Count == 0) { MsgBox.Show(this, "The report has no results to show. Please click 'Run' to populate the grid first."); return; } DataTable tableReportCur = new DataTable(); tableReportCur.Columns.Add("Patient"); tableReportCur.Columns.Add("0_30"); tableReportCur.Columns.Add("31_60"); tableReportCur.Columns.Add("61_90"); tableReportCur.Columns.Add("Over90"); tableReportCur.Columns.Add("BatTotal"); //Uses the grid's rows so that the user's row sorting selection is retained. foreach (AgingPat agingPatCur in gridMain.Rows.Select(x => (AgingPat)x.Tag)) { DataRow row = tableReportCur.NewRow(); row["Patient"] = agingPatCur.Pat.GetNameLF(); row["0_30"] = agingPatCur.BalZeroThirty.ToString("f"); row["31_60"] = agingPatCur.BalThirtySixty.ToString("f"); row["61_90"] = agingPatCur.BalSixtyNinety.ToString("f"); row["Over90"] = agingPatCur.BalOverNinety.ToString("f"); row["BatTotal"] = agingPatCur.BalTotal.ToString("f"); tableReportCur.Rows.Add(row); } ReportComplex report = new ReportComplex(true, false); report.ReportName = Lan.g(this, "Custom Aging of Accounts Receivable"); report.AddTitle("Custom Aging Report", Lan.g(this, "Custom Aging of Accounts Receivable")); report.AddSubTitle("PracTitle", PrefC.GetString(PrefName.PracticeTitle)); report.AddSubTitle("AsOf", Lan.g(this, "As of ") + _agingOptions.DateAsOf.ToShortDateString()); List <string> listAgingInc = new List <string>(); //Go through every aging option and for every one that is selected, add the descriptions as a subtitle foreach (AgingOptions.AgingInclude agingInc in Enum.GetValues(typeof(AgingOptions.AgingInclude))) { if (agingInc == AgingOptions.AgingInclude.None) { continue; } if (_agingOptions.AgingInc.HasFlag(agingInc)) { listAgingInc.Add(Lan.g(this, agingInc.GetDescription())); } } //Add a newline to the list if it's too long. if (listAgingInc.Count > 5) { listAgingInc[(listAgingInc.Count + 1) / 2] = "\r\n" + listAgingInc[(listAgingInc.Count + 1) / 2]; } report.AddSubTitle("AgeInc", Lan.g(this, "For") + ": " + string.Join(", ", listAgingInc)); if (_agingOptions.AgeAccount == AgeOfAccount.Any) { report.AddSubTitle("Balance", Lan.g(this, "Any Balance")); } else if (_agingOptions.AgeAccount == AgeOfAccount.Over30) { report.AddSubTitle("Over30", Lan.g(this, "Over 30 Days")); } else if (_agingOptions.AgeAccount == AgeOfAccount.Over60) { report.AddSubTitle("Over60", Lan.g(this, "Over 60 Days")); } else if (_agingOptions.AgeAccount == AgeOfAccount.Over90) { report.AddSubTitle("Over90", Lan.g(this, "Over 90 Days")); } if (_agingOptions.ListBillTypes == null) { report.AddSubTitle("BillingTypes", Lan.g(this, "All Billing Types")); } else { report.AddSubTitle("BillingTypes", string.Join(", ", _agingOptions.ListBillTypes.Select(x => x.ItemName))); } if (_agingOptions.ListProvs == null) { report.AddSubTitle("Providers", Lan.g(this, "All Providers")); } else { report.AddSubTitle("Providers", string.Join(", ", _agingOptions.ListProvs.Select(x => x.Abbr))); } if (_agingOptions.ListClins == null) { report.AddSubTitle("Clinics", Lan.g(this, "All Clinics")); } else { report.AddSubTitle("Clinics", string.Join(", ", _agingOptions.ListClins.Select(x => x.Abbr))); } QueryObject query = report.AddQuery(tableReportCur, "Date " + DateTimeOD.Today.ToShortDateString()); query.AddColumn((_agingOptions.FamGroup == AgingOptions.FamilyGrouping.Family ? "GUARANTOR" : "PATIENT"), 160, FieldValueType.String); query.AddColumn("0-30 DAYS", 75, FieldValueType.Number); query.AddColumn("31-60 DAYS", 75, FieldValueType.Number); query.AddColumn("61-90 DAYS", 75, FieldValueType.Number); query.AddColumn("> 90 DAYS", 75, FieldValueType.Number); query.AddColumn("TOTAL", 80, FieldValueType.Number); report.AddPageNum(); report.AddGridLines(); if (!report.SubmitQueries()) { return; } FormReportComplex FormR = new FormReportComplex(report); FormR.ShowDialog(); }
private void butOK_Click(object sender, System.EventArgs e) { if (date2.SelectionStart < date1.SelectionStart) { MsgBox.Show(this, "End date cannot be before start date."); return; } if (!checkAllProv.Checked && listProv.SelectedIndices.Count == 0) { MsgBox.Show(this, "At least one provider must be selected."); return; } if (_hasClinicsEnabled) { if (!checkAllClin.Checked && listClin.SelectedIndices.Count == 0) { MsgBox.Show(this, "At least one clinic must be selected."); return; } } List <long> listClinicNums = new List <long>(); for (int i = 0; i < listClin.SelectedIndices.Count; i++) { if (Security.CurUser.ClinicIsRestricted) { listClinicNums.Add(_listClinics[listClin.SelectedIndices[i]].ClinicNum); //we know that the list is a 1:1 to _listClinics } else { if (listClin.SelectedIndices[i] == 0) { listClinicNums.Add(0); } else { listClinicNums.Add(_listClinics[listClin.SelectedIndices[i] - 1].ClinicNum); //Minus 1 from the selected index } } } List <string> listProvNames = new List <string>(); List <long> listProvNums = new List <long>(); if (checkAllProv.Checked) { for (int i = 0; i < _listProviders.Count; i++) { listProvNums.Add(_listProviders[i].ProvNum); listProvNames.Add(_listProviders[i].Abbr); } } else { for (int i = 0; i < listProv.SelectedIndices.Count; i++) { listProvNums.Add(_listProviders[listProv.SelectedIndices[i]].ProvNum); listProvNames.Add(_listProviders[listProv.SelectedIndices[i]].Abbr); } } ReportComplex report = new ReportComplex(true, false); DataTable table = RpWriteoffSheet.GetWriteoffTable(date1.SelectionStart, date2.SelectionStart, listProvNums, listClinicNums , checkAllClin.Checked, _hasClinicsEnabled, radioWriteoffPay.Checked); Font font = new Font("Tahoma", 9); Font fontTitle = new Font("Tahoma", 17, FontStyle.Bold); Font fontSubTitle = new Font("Tahoma", 10, FontStyle.Bold); report.ReportName = Lan.g(this, "Daily Writeoffs"); report.AddTitle("Title", Lan.g(this, "Daily Writeoffs"), fontTitle); report.AddSubTitle("PracticeTitle", PrefC.GetString(PrefName.PracticeTitle), fontSubTitle); report.AddSubTitle("Date SubTitle", date1.SelectionStart.ToString("d") + " - " + date2.SelectionStart.ToString("d"), fontSubTitle); if (checkAllProv.Checked) { report.AddSubTitle("Providers", Lan.g(this, "All Providers")); } else { report.AddSubTitle("Providers", string.Join(", ", listProvNames)); } if (_hasClinicsEnabled) { if (checkAllClin.Checked) { report.AddSubTitle("Clinics", Lan.g(this, "All Clinics")); } else { string clinNames = ""; for (int i = 0; i < listClin.SelectedIndices.Count; i++) { if (i > 0) { clinNames += ", "; } if (Security.CurUser.ClinicIsRestricted) { clinNames += _listClinics[listClin.SelectedIndices[i]].Abbr; } else { if (listClin.SelectedIndices[i] == 0) { clinNames += Lan.g(this, "Unassigned"); } else { clinNames += _listClinics[listClin.SelectedIndices[i] - 1].Abbr; //Minus 1 from the selected index } } } report.AddSubTitle("Clinics", clinNames); } } QueryObject query = report.AddQuery(table, Lan.g(this, "Date") + ": " + DateTimeOD.Today.ToString("d")); query.AddColumn("Date", 100, FieldValueType.Date); query.AddColumn("Patient Name", 150); query.AddColumn("Carrier", 225); query.AddColumn("Provider", 60); if (_hasClinicsEnabled) { query.AddColumn("Clinic", 80); } query.AddColumn("Amount", 75, FieldValueType.Number); query.GetColumnDetail("Amount").ContentAlignment = ContentAlignment.MiddleRight; report.AddPageNum(font); if (!report.SubmitQueries()) { return; } FormReportComplex FormR = new FormReportComplex(report); FormR.ShowDialog(); DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, EventArgs e) { //create the report if (textYear.errorProvider1.GetError(textYear) != "") { MsgBox.Show(this, "Please enter a valid year."); return; } //The query shows, per provider, two numbers with a percentage. Then there is a totals row at the bottom. ReportComplex report = new ReportComplex(true, false); DataTable tableMeasures = RpDentalSealantMeasure.GetDentalSealantMeasureTable(textYear.Text); DataTable tableTotals = tableMeasures.Clone(); DataRow totalsRow = tableTotals.NewRow(); int numerator = 0; int denominator = 0; foreach (DataRow row in tableMeasures.Rows) { numerator += PIn.Int(row["Numerator"].ToString()); denominator += PIn.Int(row["Denominator"].ToString()); } totalsRow["Provider"] = ""; totalsRow["Numerator"] = numerator.ToString(); totalsRow["Denominator"] = denominator.ToString(); if (denominator > 0) { totalsRow["Percentage Met"] = (numerator / (double)denominator).ToString("P"); } else { totalsRow["Percentage Met"] = 0.ToString("P"); } tableTotals.Rows.Add(totalsRow); report.ReportName = "Dental Sealant Measure"; report.AddTitle("Title", Lan.g(this, "Dental Sealant Measure")); report.AddSubTitle("Date", textYear.Text); //setup query QueryObject query; query = report.AddQuery(tableMeasures, "Measure Count By Provider", "", SplitByKind.None, 1, true); query.AddColumn("Provider", 150, FieldValueType.String); query.AddColumn("Numerator", 150, FieldValueType.Integer); query.AddColumn("Denominator", 150, FieldValueType.Integer); query.AddColumn("Percentage Met", 150, FieldValueType.String); query.GetColumnDetail("Percentage Met").StringFormat = "N2"; query = report.AddQuery(tableTotals, "Totals", "", SplitByKind.None, 1, true); query.AddColumn("", 150, FieldValueType.String); query.AddColumn("Total Numerator", 150, FieldValueType.Integer); query.AddColumn("Total Denominator", 150, FieldValueType.Integer); query.AddColumn("Total Percentage Met", 150, FieldValueType.String); query.GetColumnDetail("Total Percentage Met").StringFormat = "N2"; report.AddPageNum(); // execute query if (!report.SubmitQueries()) { return; } // display report FormReportComplex FormR = new FormReportComplex(report); //FormR.MyReport=report; FormR.ShowDialog(); DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, EventArgs e) { if (!checkAllProvs.Checked && listProvs.SelectedIndices.Count == 0) { MsgBox.Show(this, "At least one provider must be selected."); return; } if (_hasClinicsEnabled) { if (!checkAllClinics.Checked && listClinics.SelectedIndices.Count == 0) { MsgBox.Show(this, "At least one clinic must be selected."); return; } } if (radioAdj.Checked && listOptions.SelectedIndices.Count == 0) { MsgBox.Show(this, "At least one adjustment type must be selected."); return; } if (radioProcs.Checked && listOptions.SelectedIndices.Count == 0) { MsgBox.Show(this, "At least one procedure code option must be selected."); return; } List <long> listClinicNums = new List <long>(); for (int i = 0; i < listClinics.SelectedIndices.Count; i++) { if (Security.CurUser.ClinicIsRestricted) { listClinicNums.Add(_listClinics[listClinics.SelectedIndices[i]].ClinicNum); //we know that the list is a 1:1 to _listClinics } else { if (listClinics.SelectedIndices[i] == 0) { listClinicNums.Add(0); } else { listClinicNums.Add(_listClinics[listClinics.SelectedIndices[i] - 1].ClinicNum); //Minus 1 from the selected index } } } List <long> listProvNums = new List <long>(); if (checkAllProvs.Checked) { for (int i = 0; i < _listProviders.Count; i++) { listProvNums.Add(_listProviders[i].ProvNum); } } else { for (int i = 0; i < listProvs.SelectedIndices.Count; i++) { listProvNums.Add(_listProviders[listProvs.SelectedIndices[i]].ProvNum); } } List <long> listAdjDefNums = new List <long>(); if (radioAdj.Checked) { for (int i = 0; i < listOptions.SelectedIndices.Count; i++) { listAdjDefNums.Add(_listPosAdjTypes[listOptions.SelectedIndices[i]].DefNum); } } BrokenApptProcedure brokenApptSelection = BrokenApptProcedure.None; if (radioProcs.Checked) { brokenApptSelection = _listBrokenProcOptions[listOptions.SelectedIndex]; } ReportComplex report = new ReportComplex(true, false); DataTable table = new DataTable(); table = RpBrokenAppointments.GetBrokenApptTable(dateStart.SelectionStart, dateEnd.SelectionStart, listProvNums, listClinicNums, listAdjDefNums, brokenApptSelection , checkAllClinics.Checked, radioProcs.Checked, radioAptStatus.Checked, radioAdj.Checked, _hasClinicsEnabled); string subtitleProvs = ""; string subtitleClinics = ""; if (checkAllProvs.Checked) { subtitleProvs = Lan.g(this, "All Providers"); } else { for (int i = 0; i < listProvs.SelectedIndices.Count; i++) { if (i > 0) { subtitleProvs += ", "; } subtitleProvs += _listProviders[listProvs.SelectedIndices[i]].Abbr; } } if (_hasClinicsEnabled) { if (checkAllClinics.Checked) { subtitleClinics = Lan.g(this, "All Clinics"); } else { for (int i = 0; i < listClinics.SelectedIndices.Count; i++) { if (i > 0) { subtitleClinics += ", "; } if (Security.CurUser.ClinicIsRestricted) { subtitleClinics += _listClinics[listClinics.SelectedIndices[i]].Abbr; } else { if (listClinics.SelectedIndices[i] == 0) { subtitleClinics += Lan.g(this, "Unassigned"); } else { subtitleClinics += _listClinics[listClinics.SelectedIndices[i] - 1].Abbr; //Minus 1 from the selected index } } } } } Font font = new Font("Tahoma", 10); Font fontBold = new Font("Tahoma", 10, FontStyle.Bold); Font fontTitle = new Font("Tahoma", 17, FontStyle.Bold); Font fontSubTitle = new Font("Tahoma", 11, FontStyle.Bold); report.ReportName = Lan.g(this, "Broken Appointments"); report.AddTitle("Title", Lan.g(this, "Broken Appointments"), fontTitle); if (radioProcs.Checked) //Report looking at ADA procedure code D9986 { string codes = ""; switch (brokenApptSelection) { case BrokenApptProcedure.None: case BrokenApptProcedure.Missed: codes = "D9986"; break; case BrokenApptProcedure.Cancelled: codes = "D9987"; break; case BrokenApptProcedure.Both: codes = "D9986 or D9987"; break; } report.AddSubTitle("Report Description", Lan.g(this, "By ADA Code " + codes), fontSubTitle); } else if (radioAdj.Checked) //Report looking at broken appointment adjustments { report.AddSubTitle("Report Description", Lan.g(this, "By Broken Appointment Adjustment"), fontSubTitle); } else //Report looking at appointments with a status of 'Broken' { report.AddSubTitle("Report Description", Lan.g(this, "By Appointment Status"), fontSubTitle); } report.AddSubTitle("Providers", subtitleProvs, fontSubTitle); report.AddSubTitle("Clinics", subtitleClinics, fontSubTitle); QueryObject query; if (PrefC.HasClinicsEnabled) //Split the query up by clinics. { query = report.AddQuery(table, Lan.g(this, "Date") + ": " + DateTimeOD.Today.ToString("d"), "ClinicDesc", SplitByKind.Value, 0, true); } else { query = report.AddQuery(table, Lan.g(this, "Date") + ": " + DateTimeOD.Today.ToString("d"), "", SplitByKind.None, 0, true); } //Add columns to report if (radioProcs.Checked) //Report looking at ADA procedure code D9986 or D9987 { query.AddColumn(Lan.g(this, "Date"), 85, FieldValueType.Date, font); query.AddColumn(Lan.g(this, "Provider"), 180, FieldValueType.String, font); if (brokenApptSelection == BrokenApptProcedure.Both) { query.AddColumn(Lan.g(this, "Code"), 75, FieldValueType.String, font); } query.AddColumn(Lan.g(this, "Patient"), 220, FieldValueType.String, font); query.AddColumn(Lan.g(this, "Fee"), 200, FieldValueType.Number, font); query.AddGroupSummaryField(Lan.g(this, "Total Broken Appointment Fees") + ":", Lan.g(this, "Fee"), "ProcFee", SummaryOperation.Sum, fontBold, 0, 10); query.AddGroupSummaryField(Lan.g(this, "Total Broken Appointments") + ":", Lan.g(this, "Fee"), "ProcFee", SummaryOperation.Count, fontBold, 0, 10); } else if (radioAdj.Checked) //Report looking at broken appointment adjustments { query.AddColumn(Lan.g(this, "Date"), 85, FieldValueType.Date, font); query.AddColumn(Lan.g(this, "Provider"), 100, FieldValueType.String, font); query.AddColumn(Lan.g(this, "Patient"), 220, FieldValueType.String, font); query.AddColumn(Lan.g(this, "Amount"), 80, FieldValueType.Number, font); query.AddColumn(Lan.g(this, "Note"), 300, FieldValueType.String, font); query.AddGroupSummaryField(Lan.g(this, "Total Broken Appointment Adjustment Amount") + ":", Lan.g(this, "Amount"), "AdjAmt", SummaryOperation.Sum, fontBold, 0, 10); query.AddGroupSummaryField(Lan.g(this, "Total Broken Appointments") + ":", Lan.g(this, "Amount"), "AdjAmt", SummaryOperation.Count, fontBold, 0, 10); } else //Report looking at appointments with a status of 'Broken' { query.AddColumn(Lan.g(this, "AptDate"), 85, FieldValueType.Date, font); query.AddColumn(Lan.g(this, "Patient"), 220, FieldValueType.String, font); query.AddColumn(Lan.g(this, "Doctor"), 165, FieldValueType.String, font); query.AddColumn(Lan.g(this, "Hygienist"), 165, FieldValueType.String, font); query.AddColumn(Lan.g(this, "IsHyg"), 50, FieldValueType.Boolean, font); query.GetColumnDetail(Lan.g(this, "IsHyg")).ContentAlignment = ContentAlignment.MiddleCenter; query.AddGroupSummaryField(Lan.g(this, "Total Broken Appointments") + ":", Lan.g(this, "IsHyg"), "AptDateTime", SummaryOperation.Count, fontBold, 0, 10); } query.ContentAlignment = ContentAlignment.MiddleRight; report.AddPageNum(font); //execute query if (!report.SubmitQueries()) { return; } //display report FormReportComplex FormR = new FormReportComplex(report); //FormR.MyReport=report; FormR.ShowDialog(); DialogResult = DialogResult.OK; }