public void RpProcNotBilledIns_GetProcsNotBilled_MedicalInsOnly() { string suffix = MethodBase.GetCurrentMethod().Name; Patient patient = PatientT.CreatePatient(suffix); Carrier carrier = CarrierT.CreateCarrier(suffix); ProcedureCode procedureCode = ProcedureCodeT.CreateProcCode("T7782"); //Create a primary medical insurance plan InsuranceInfo insuranceInfo = InsuranceT.AddInsurance(patient, carrier.CarrierName, ordinal: 1, isMedical: true); insuranceInfo.AddBenefit(BenefitT.CreatePercentForProc(insuranceInfo.MedInsPlan.PlanNum, procedureCode.CodeNum, 80)); Procedure procedure = ProcedureT.CreateProcedure(patient, procedureCode.ProcCode, ProcStat.TP, "", 55, procDate: DateTime.Now.AddDays(-3)); ProcedureT.ComputeEstimates(patient, insuranceInfo); ProcedureT.SetComplete(procedure, patient, insuranceInfo); //Run the procs not billed report with "includeMedProcs" set to false. //The patient should not be returned due to not having any dental insurance estimates. DataTable table = RpProcNotBilledIns.GetProcsNotBilled(new List <long>(), false, DateTime.Now.AddDays(-10), DateTime.Now, false, false); Assert.IsNotNull(table); Assert.IsFalse(table.Select().Select(x => PIn.Long(x["PatNum"].ToString())).Contains(patient.PatNum)); //Run the procs not billed report with "includeMedProcs" set to true. //The patient should be returned due to the medical insurance estimates. table = RpProcNotBilledIns.GetProcsNotBilled(new List <long>(), true, DateTime.Now.AddDays(-10), DateTime.Now, false, false); Assert.IsNotNull(table); Assert.IsTrue(table.Rows.Count > 0); Assert.IsTrue(table.Select().Select(x => PIn.Long(x["PatNum"].ToString())).Contains(patient.PatNum)); }
//Only called in FillGrid(). private void RefreshReport() { bool hasValidationPassed = ValidateFields(); //Above line also sets "All" clinics option if no items are selected. DataTable tableNotBilled = new DataTable(); if (hasValidationPassed) { //not truly all clinics; just the ones user has permission for tableNotBilled = RpProcNotBilledIns.GetProcsNotBilled(comboClinics.ListSelectedClinicNums, checkMedical.Checked, _myReportDateFrom, _myReportDateTo, checkShowProcsNoIns.Checked, checkShowProcsInProcess.Checked); } string subtitleClinics = ""; if (PrefC.HasClinicsEnabled) { subtitleClinics = Lan.g(this, "Clinics: ") + comboClinics.GetStringSelectedClinics(); } //This report will never show progress for printing. This is because the report is being rebuilt whenever the grid is refreshed. _myReport = new ReportComplex(true, false, false); _myReport.ReportName = Lan.g(this, "Procedures Not Billed to Insurance"); _myReport.AddTitle("Title", Lan.g(this, "Procedures Not Billed to Insurance")); _myReport.AddSubTitle("Practice Name", PrefC.GetString(PrefName.PracticeTitle)); if (_myReportDateFrom == _myReportDateTo) { _myReport.AddSubTitle("Report Dates", _myReportDateFrom.ToShortDateString()); } else { _myReport.AddSubTitle("Report Dates", _myReportDateFrom.ToShortDateString() + " - " + _myReportDateTo.ToShortDateString()); } if (PrefC.HasClinicsEnabled) { _myReport.AddSubTitle("Clinics", subtitleClinics); } QueryObject query = _myReport.AddQuery(tableNotBilled, DateTimeOD.Today.ToShortDateString()); query.AddColumn("Patient Name", _colWidthPatName, FieldValueType.String); query.AddColumn("Stat", _colWidthStat, FieldValueType.String); query.AddColumn("Procedure Date", _colWidthProcDate, FieldValueType.Date); query.GetColumnDetail("Procedure Date").StringFormat = "d"; query.AddColumn("Procedure Description", 300, FieldValueType.String); query.AddColumn("Amount", _colWidthAmount, FieldValueType.Number); _myReport.AddPageNum(); if (!_myReport.SubmitQueries(false)) //If we are loading and there are no results for _myReport do not show msgbox found in SubmitQueryies(...). { return; } }
public void RpProcNotBilledIns_GetProcsNotBilled_ShowProcsBeforeIns() { string suffix = MethodBase.GetCurrentMethod().Name; Patient patient = PatientT.CreatePatient(suffix); Carrier carrier = CarrierT.CreateCarrier(suffix); ProcedureCode procedureCode = ProcedureCodeT.CreateProcCode("T7782"); Procedure procedure = ProcedureT.CreateProcedure(patient, procedureCode.ProcCode, ProcStat.C, "", 55, procDate: DateTime.Now.AddDays(-3)); //Add insurance after the procedure has been set complete. InsuranceInfo insuranceInfo = InsuranceT.AddInsurance(patient, carrier.CarrierName, ordinal: 1, isMedical: true); //The patient should not be returned when 'showProcsBeforeIns' is set to false. DataTable table = RpProcNotBilledIns.GetProcsNotBilled(new List <long>(), false, DateTime.Now.AddDays(-10), DateTime.Now, false, false); Assert.IsNotNull(table); Assert.IsFalse(table.Select().Select(x => PIn.Long(x["PatNum"].ToString())).Contains(patient.PatNum)); //The patient should be returned when 'showProcsBeforeIns' is set to true. table = RpProcNotBilledIns.GetProcsNotBilled(new List <long>(), true, DateTime.Now.AddDays(-10), DateTime.Now, true, false); Assert.IsNotNull(table); Assert.IsTrue(table.Rows.Count > 0); Assert.IsTrue(table.Select().Select(x => PIn.Long(x["PatNum"].ToString())).Contains(patient.PatNum)); }
//Only called in FillGrid(). private void RefreshReport() { bool hasValidationPassed = ValidateFields(); List <long> listClinicNums = new List <long>(); if (PrefC.HasClinicsEnabled) { if (comboBoxMultiClinics.ListSelectedIndices.Contains(0)) //All option selected { for (int j = 0; j < _listClinics.Count; j++) { listClinicNums.Add(_listClinics[j].ClinicNum); //Add all clinics this person has access to. } if (!Security.CurUser.ClinicIsRestricted) { listClinicNums.Add(0); //Unassigned } } else //All option not selected { for (int i = 0; i < comboBoxMultiClinics.ListSelectedIndices.Count; i++) { if (Security.CurUser.ClinicIsRestricted) { listClinicNums.Add(_listClinics[comboBoxMultiClinics.ListSelectedIndices[i] - 1].ClinicNum); //Minus 1 to skip over the All. } else if (comboBoxMultiClinics.ListSelectedIndices[i] == 1) //Not restricted and user selected Unassigned. { listClinicNums.Add(0); //Unassigned } else //Not restricted and Unassigned option is not selected. { listClinicNums.Add(_listClinics[comboBoxMultiClinics.ListSelectedIndices[i] - 2].ClinicNum); //Minus 2 to skip over All and Unassigned. } } } } DataTable tableNotBilled = new DataTable(); if (hasValidationPassed) { tableNotBilled = RpProcNotBilledIns.GetProcsNotBilled(listClinicNums, checkMedical.Checked, _myReportDateFrom, _myReportDateTo, checkShowProcsNoIns.Checked); } string subtitleClinics = ""; if (PrefC.HasClinicsEnabled) { if (comboBoxMultiClinics.ListSelectedIndices.Contains(0)) //All option selected { subtitleClinics = Lan.g(this, "All Clinics"); } else { for (int i = 0; i < comboBoxMultiClinics.ListSelectedIndices.Count; i++) { if (i > 0) { subtitleClinics += ", "; } if (Security.CurUser.ClinicIsRestricted) { subtitleClinics += _listClinics[comboBoxMultiClinics.ListSelectedIndices[i] - 1].Abbr; //Minus 1 for All. } else //Not restricted { if (comboBoxMultiClinics.ListSelectedIndices[i] == 1) //Unassigned option selected. { subtitleClinics += Lan.g(this, "Unassigned"); } else { subtitleClinics += _listClinics[comboBoxMultiClinics.ListSelectedIndices[i] - 2].Abbr; //Minus 2 for All and Unassigned. } } } } } //This report will never show progress for printing. This is because the report is being rebuilt whenever the grid is refreshed. _myReport = new ReportComplex(true, false, false); _myReport.ReportName = Lan.g(this, "Procedures Not Billed to Insurance"); _myReport.AddTitle("Title", Lan.g(this, "Procedures Not Billed to Insurance")); _myReport.AddSubTitle("Practice Name", PrefC.GetString(PrefName.PracticeTitle)); if (_myReportDateFrom == _myReportDateTo) { _myReport.AddSubTitle("Report Dates", _myReportDateFrom.ToShortDateString()); } else { _myReport.AddSubTitle("Report Dates", _myReportDateFrom.ToShortDateString() + " - " + _myReportDateTo.ToShortDateString()); } if (PrefC.HasClinicsEnabled) { _myReport.AddSubTitle("Clinics", subtitleClinics); } QueryObject query = _myReport.AddQuery(tableNotBilled, DateTimeOD.Today.ToShortDateString()); query.AddColumn("Patient Name", _colWidthPatName, FieldValueType.String); query.AddColumn("Procedure Date", _colWidthProcDate, FieldValueType.Date); query.GetColumnDetail("Procedure Date").StringFormat = "d"; query.AddColumn("Procedure Description", 300, FieldValueType.String); query.AddColumn("Amount", _colWidthAmount, FieldValueType.Number); _myReport.AddPageNum(); if (!_myReport.SubmitQueries(false)) //If we are loading and there are no results for _myReport do not show msgbox found in SubmitQueryies(...). { return; } }