public void OrthoCases_Delete_DeleteOrthoCaseAndAssociatedObjects() { Prefs.UpdateString(PrefName.OrthoBandingCodes, "D8080"); Prefs.UpdateString(PrefName.OrthoDebondCodes, "D8070"); Prefs.UpdateString(PrefName.OrthoVisitCodes, "D8060"); Userod user = UserodT.CreateUser(); Security.CurUser = user; Patient pat = PatientT.CreatePatient(MethodBase.GetCurrentMethod().Name); Procedure bandingProc = ProcedureT.CreateProcedure(pat, "D8080", ProcStat.C, "", 0); Procedure visitProc = ProcedureT.CreateProcedure(pat, "D8060", ProcStat.C, "", 0); Procedure debondProc = ProcedureT.CreateProcedure(pat, "D8070", ProcStat.C, "", 0); long orthoCaseNum = OrthoCaseT.InsertForFormOrthoCase(pat.PatNum, 2000, 1200, 0, 800, DateTime.Today, false, DateTime.Today.AddMonths(12), 1000, 400, 60, bandingProc); OrthoProcLinks.LinkProcForActiveOrthoCase(visitProc); OrthoProcLinks.LinkProcForActiveOrthoCase(debondProc); OrthoCase orthoCase = OrthoCases.GetOne(orthoCaseNum); OrthoPlanLink schedulePlanLink = OrthoPlanLinks.GetOneForOrthoCaseByType(orthoCaseNum, OrthoPlanLinkType.OrthoSchedule); long orthoscheduleNum = schedulePlanLink.FKey; OrthoSchedule orthoSchedule = OrthoSchedules.GetOne(schedulePlanLink.FKey); List <OrthoProcLink> listAllProcLinks = OrthoProcLinks.GetManyByOrthoCase(orthoCaseNum); OrthoCases.Delete(orthoCase.OrthoCaseNum, orthoSchedule, schedulePlanLink, listAllProcLinks); orthoCase = OrthoCases.GetOne(orthoCaseNum); schedulePlanLink = OrthoPlanLinks.GetOneForOrthoCaseByType(orthoCaseNum, OrthoPlanLinkType.OrthoSchedule); orthoSchedule = OrthoSchedules.GetOne(orthoscheduleNum); listAllProcLinks = OrthoProcLinks.GetManyByOrthoCase(orthoCaseNum); Assert.AreEqual(orthoCase, null); Assert.AreEqual(schedulePlanLink, null); Assert.AreEqual(orthoSchedule, null); Assert.AreEqual(listAllProcLinks.Count, 0); }
private void butAttachProc_Click(object sender, System.EventArgs e) { FormProcSelect formPS = new FormProcSelect(_adjustmentCur.PatNum, false); formPS.ShowDialog(); if (formPS.DialogResult != DialogResult.OK) { return; } if (OrthoProcLinks.IsProcLinked(formPS.ListSelectedProcs[0].ProcNum)) { MsgBox.Show(this, "Adjustments cannot be attached to a procedure that is linked to an ortho case."); return; } if (PrefC.GetInt(PrefName.RigorousAdjustments) < 2) //Enforce Linking //_selectedProvNum=FormPS.ListSelectedProcs[0].ProvNum; { comboClinic.SelectedClinicNum = formPS.ListSelectedProcs[0].ClinicNum; comboProv.SetSelectedProvNum(formPS.ListSelectedProcs[0].ProvNum); if (PrefC.GetInt(PrefName.RigorousAdjustments) == (int)RigorousAdjustments.EnforceFully && !_isEditAnyway) { if (Security.IsAuthorized(Permissions.Setup, true)) { labelEditAnyway.Visible = true; butEditAnyway.Visible = true; } comboProv.Enabled = false; //Don't allow changing if enforce fully butPickProv.Enabled = false; comboClinic.Enabled = false; //this is a separate issue from the internal edit blocking for comboClinic with no permission for a clinic } } _adjustmentCur.ProcNum = formPS.ListSelectedProcs[0].ProcNum; FillProcedure(); textProcDate.Text = formPS.ListSelectedProcs[0].ProcDate.ToShortDateString(); }
public void OrthoCases_UpdateDatesByLinkedProc_UpdateBandingAndDebondDates() { Prefs.UpdateString(PrefName.OrthoDebondCodes, "D8070"); Userod user = UserodT.CreateUser(); Security.CurUser = user; Patient pat = PatientT.CreatePatient(MethodBase.GetCurrentMethod().Name); Procedure bandingProc = ProcedureT.CreateProcedure(pat, "D8080", ProcStat.C, "", 0); Procedure debondProc = ProcedureT.CreateProcedure(pat, "D8070", ProcStat.C, "", 0, procDate: DateTime.Today.AddDays(2)); long orthoCaseNum = OrthoCaseT.InsertForFormOrthoCase(pat.PatNum, 2000, 1200, 0, 800, DateTime.Today, false, DateTime.Today.AddMonths(12), 1000, 400, 60, bandingProc); OrthoProcLinks.LinkProcForActiveOrthoCase(debondProc); OrthoProcLink bandingProcLink = OrthoProcLinks.GetByType(orthoCaseNum, OrthoProcType.Banding); OrthoProcLink debondProcLink = OrthoProcLinks.GetByType(orthoCaseNum, OrthoProcType.Debond); OrthoCase orthoCase = OrthoCases.GetOne(orthoCaseNum); Assert.AreEqual(orthoCase.BandingDate, DateTime.Today); bandingProc.ProcDate = DateTime.Today.AddDays(1); OrthoCases.UpdateDatesByLinkedProc(bandingProcLink, bandingProc); orthoCase = OrthoCases.GetOne(orthoCaseNum); Assert.AreEqual(orthoCase.BandingDate, DateTime.Today.AddDays(1)); Assert.AreEqual(orthoCase.DebondDate, DateTime.Today.AddDays(2)); debondProc.ProcDate = DateTime.Today.AddDays(3); OrthoCases.UpdateDatesByLinkedProc(debondProcLink, debondProc); orthoCase = OrthoCases.GetOne(orthoCaseNum); Assert.AreEqual(orthoCase.BandingDate, DateTime.Today.AddDays(1)); Assert.AreEqual(orthoCase.DebondDate, DateTime.Today.AddDays(3)); }
public void OrthoProcLinks_LinkProcForActiveOrthoCase_LinkCompletedProcsToOrthoCase() { Prefs.UpdateString(PrefName.OrthoBandingCodes, "D8080"); Prefs.UpdateString(PrefName.OrthoDebondCodes, "D8070"); Prefs.UpdateString(PrefName.OrthoVisitCodes, "D8060"); Patient pat = PatientT.CreatePatient(MethodBase.GetCurrentMethod().Name); Procedure bandingProc = ProcedureT.CreateProcedure(pat, "D8080", ProcStat.C, "", 0); Procedure visitProc = ProcedureT.CreateProcedure(pat, "D8060", ProcStat.C, "", 0); Procedure debondProc = ProcedureT.CreateProcedure(pat, "D8070", ProcStat.C, "", 0); long orthoCaseNum = OrthoCaseT.InsertForFormOrthoCase(pat.PatNum, 2000, 1200, 0, 800, DateTime.Today, false, DateTime.Today.AddMonths(12), 1000, 400, 60, bandingProc); OrthoProcLinks.LinkProcForActiveOrthoCase(visitProc); OrthoProcLinks.LinkProcForActiveOrthoCase(debondProc); OrthoCase orthoCase = OrthoCases.GetOne(orthoCaseNum); List <OrthoProcLink> listAllProcLinks = OrthoProcLinks.GetManyByOrthoCase(orthoCaseNum); List <OrthoProcLink> listVisitProcLinks = OrthoProcLinks.GetVisitLinksForOrthoCase(orthoCaseNum); OrthoProcLink debondProcLink = OrthoProcLinks.GetByType(orthoCaseNum, OrthoProcType.Debond); Assert.AreEqual(orthoCase.IsActive, false); Assert.AreEqual(listAllProcLinks.Count, 3); Assert.AreEqual(debondProcLink.ProcNum, debondProc.ProcNum); Assert.AreEqual(debondProcLink.SecUserNumEntry, Security.CurUser.UserNum); Assert.AreEqual(listVisitProcLinks.Count, 1); Assert.AreEqual(listVisitProcLinks[0].ProcNum, visitProc.ProcNum); Assert.AreEqual(listVisitProcLinks[0].SecUserNumEntry, Security.CurUser.UserNum); }
private void butOK_Click(object sender, EventArgs e) { int countProcsLinkedToOrthoCase = 0; float percent = 0; //Placeholder if (!float.TryParse(textPercentage.Text, out percent)) { MsgBox.Show(this, "Percent is invalid. Please enter a valid number to continue."); return; } bool hasDiscount = false; for (int i = 0; i < _listProcs.Count; i++) { if (_listProcs[i].Discount != 0) { hasDiscount = true; break; } } if (hasDiscount && //A discount exists for a procedure !MsgBox.Show(this, MsgBoxButtons.YesNo, "One or more of the selected procedures has a discount value already set. This will overwrite current discount values with a new value. Continue?")) { return; } List <long> listProcNumsLinkedToOrthoCases = OrthoProcLinks.GetManyForProcs(_listProcs.Select(x => x.ProcNum).ToList()).Select(y => y.ProcNum).ToList(); for (int j = 0; j < _listProcs.Count; j++) { if (listProcNumsLinkedToOrthoCases.Contains(_listProcs[j].ProcNum)) { countProcsLinkedToOrthoCase++; } else if (percent == 0) { _listProcs[j].Discount = 0; //Potentially clears out old discount. } else { _listProcs[j].Discount = _listProcs[j].ProcFee * (percent / 100); } if (_listProcs[j].Discount != _oldListProcs[j].Discount) //Discount was changed { string message = Lan.g(this, "Discount created or changed from Treat Plan module for procedure") + ": " + ProcedureCodes.GetProcCode(_listProcs[j].CodeNum).ProcCode + " " + Lan.g(this, "Dated") + ": " + _listProcs[j].ProcDate.ToShortDateString() + " " + Lan.g(this, "With a Fee of") + ": " + _listProcs[j].ProcFee.ToString("c") + ". " + Lan.g(this, "Attributed a") + " " + percent + " " + Lan.g(this, "percent discount, changing the discount value from") + " " + _oldListProcs[j].Discount.ToString("c") + " " + Lan.g(this, "to") + " " + _listProcs[j].Discount.ToString("c"); SecurityLogs.MakeLogEntry(Permissions.TreatPlanDiscountEdit, _listProcs[j].PatNum, message); } Procedures.Update(_listProcs[j], _oldListProcs[j]); } if (countProcsLinkedToOrthoCase > 0) { string countProcsSkipped = countProcsLinkedToOrthoCase.ToString(); MessageBox.Show(this, Lans.g(this, "Procedures attached to ortho cases cannot have discounts. Procedures skipped:") + " " + countProcsSkipped); } DialogResult = DialogResult.OK; }
///<summary>Updates the OrthoCase, OrthoSchedule, and banding OrthoProcLink for an Ortho Case.</summary> public static void UpdateForFormOrthoCase(OrthoCase oldOrthoCase, OrthoSchedule oldOrthoSchedule, double fee, double feeInsPrimary , double feeInsSecondary, double feePat, DateTime bandingDate, bool isTransfer, DateTime debondDateExpected, double bandingAmount, double debondAmount , double visitAmount, Procedure bandingProc, Procedure debondProc, OrthoProcLink bandingProcLink) { //No remoting role check; no call to db OrthoCase newOrthoCase = oldOrthoCase.Copy(); //OrthoCase newOrthoCase.Fee = fee; newOrthoCase.FeeInsPrimary = feeInsPrimary; newOrthoCase.FeeInsSecondary = feeInsSecondary; newOrthoCase.FeePat = feePat; newOrthoCase.BandingDate = bandingDate; newOrthoCase.IsTransfer = isTransfer; if (debondProc == null) { newOrthoCase.DebondDateExpected = debondDateExpected; newOrthoCase.DebondDate = DateTime.MinValue; } if (isTransfer && bandingProcLink != null) //OrthoCase has been changed to a transfer. Delete linked banding proc if it exists. { OrthoProcLinks.Delete(bandingProcLink.OrthoProcLinkNum); } else if (!isTransfer) { if (bandingProcLink == null) //OrthoCase has been changed to a non-transfer. Link banding proc. { OrthoProcLinks.Insert(OrthoProcLinks.CreateHelper(newOrthoCase.OrthoCaseNum, bandingProc.ProcNum, OrthoProcType.Banding)); } else //OrthoCase is still a non-transfer, but banding proc linked may have changed so update. { OrthoProcLink newBandingProcLink = bandingProcLink.Copy(); newBandingProcLink.ProcNum = bandingProc.ProcNum; OrthoProcLinks.Update(newBandingProcLink, bandingProcLink); } if (bandingProc != null && bandingProc.AptNum != 0) //Banding proc may have changed, so check to see if it is scheduled and update bandingDate. { newOrthoCase.BandingDate = bandingProc.ProcDate; } } OrthoCases.Update(newOrthoCase, oldOrthoCase); //OrthoSchedule OrthoSchedule newOrthoSchedule = oldOrthoSchedule.Copy(); newOrthoSchedule.BandingAmount = bandingAmount; newOrthoSchedule.DebondAmount = debondAmount; newOrthoSchedule.VisitAmount = visitAmount; OrthoSchedules.Update(newOrthoSchedule, oldOrthoSchedule); }
private bool IsValid(int numberEntriesSelected) { //No procedures selected AND (rigorous adjustments are fully enforced OR the Fixed Amount option is not selected). if (numberEntriesSelected == 0 && (_rigorousAdjustments == 0 || !radioFixedAmt.Checked)) { MsgBox.Show(this, "You must select a procedure to add the adjustment to."); return(false); } if (listTypePos.SelectedIndex == -1 && listTypeNeg.SelectedIndex == -1) { MsgBox.Show(this, "Please pick an adjustment type."); return(false); } if (comboProv.SelectedIndex == -1) { MsgBox.Show(this, "Please pick a provider."); return(false); } if (PrefC.HasClinicsEnabled && comboClinic.SelectedIndex == -1) { MsgBox.Show(this, "Please pick a clinic."); return(false); } if (string.IsNullOrWhiteSpace(dateAdjustment.Text) || dateAdjustment.errorProvider1.GetError(dateAdjustment) != "") { MsgBox.Show(this, "Please enter a valid date."); return(false); } if (PIn.Date(dateAdjustment.Text).Date > DateTime.Today.Date && !PrefC.GetBool(PrefName.FutureTransDatesAllowed)) { MsgBox.Show(this, "Adjustments cannot be made for future dates"); return(false); } if (string.IsNullOrWhiteSpace(textAmt.Text) || textAmt.errorProvider1.GetError(textAmt) != "") { MsgBox.Show(this, "Please enter a valid amount."); return(false); } List <OrthoProcLink> listOrthoProcLinks = OrthoProcLinks.GetManyForProcs(gridMain.SelectedGridRows.Select(x => ((MultiAdjEntry)x.Tag).Proc.ProcNum).ToList()); if (listOrthoProcLinks.Count > 0) { MsgBox.Show(this, "One or more of the selected procedures cannot be adjusted because it is attached to an ortho case." + " Please deselect these items and try again."); return(false); } return(true); }
///<summary>Inserts the OrthoCase, OrthoSchedule, Schedule OrthoPlanLink, and banding OrthoProcLink for an Ortho Case.</summary> public static long InsertForFormOrthoCase(long patNum, double fee, double feeInsPrimary, double feeInsSecondary, double feePat, DateTime bandingDate , bool isTransfer, DateTime debondDateExpected, double bandingAmount, double debondAmount, double visitAmount, Procedure bandingProc) { //No remoting role check; no call to db //Ortho Case OrthoCase newOrthoCase = new OrthoCase(); newOrthoCase.PatNum = patNum; newOrthoCase.Fee = fee; newOrthoCase.FeeInsPrimary = feeInsPrimary; newOrthoCase.FeeInsSecondary = feeInsSecondary; newOrthoCase.FeePat = feePat; newOrthoCase.BandingDate = bandingDate; newOrthoCase.DebondDateExpected = debondDateExpected; newOrthoCase.IsTransfer = isTransfer; newOrthoCase.SecUserNumEntry = Security.CurUser.UserNum; newOrthoCase.IsActive = true; //New Ortho Cases can only be added if there are no other active ones. So we automatically set a new ortho case as active. if (bandingProc.AptNum != 0) //If banding is scheduled save the appointment date instead. { newOrthoCase.BandingDate = bandingProc.ProcDate; } long orthoCaseNum = OrthoCases.Insert(newOrthoCase); //Ortho Schedule OrthoSchedule newOrthoSchedule = new OrthoSchedule(); newOrthoSchedule.BandingAmount = bandingAmount; newOrthoSchedule.DebondAmount = debondAmount; newOrthoSchedule.VisitAmount = visitAmount; newOrthoSchedule.IsActive = true; long orthoScheduleNum = OrthoSchedules.Insert(newOrthoSchedule); //Ortho Plan Link OrthoPlanLink newOrthoPlanLink = new OrthoPlanLink(); newOrthoPlanLink.OrthoCaseNum = orthoCaseNum; newOrthoPlanLink.LinkType = OrthoPlanLinkType.OrthoSchedule; newOrthoPlanLink.FKey = orthoScheduleNum; newOrthoPlanLink.IsActive = true; newOrthoPlanLink.SecUserNumEntry = Security.CurUser.UserNum; OrthoPlanLinks.Insert(newOrthoPlanLink); //Banding Proc Link if (!newOrthoCase.IsTransfer) { OrthoProcLinks.Insert(OrthoProcLinks.CreateHelper(orthoCaseNum, bandingProc.ProcNum, OrthoProcType.Banding)); } return(orthoCaseNum); }
public void OrthoProcLinks_SetProcFeeForLinkedProc_SetFeeForEachProcType() { Patient pat = PatientT.CreatePatient(MethodBase.GetCurrentMethod().Name); Procedure bandingProc = ProcedureT.CreateProcedure(pat, "D8080", ProcStat.C, "", 0); Procedure visitProc = ProcedureT.CreateProcedure(pat, "D8060", ProcStat.C, "", 0); Procedure debondProc = ProcedureT.CreateProcedure(pat, "D8070", ProcStat.C, "", 0); long orthoCaseNum = OrthoCaseT.InsertForFormOrthoCase(pat.PatNum, 2000, 1200, 0, 800, DateTime.Today, false, DateTime.Today.AddMonths(12), 1000, 400, 60, new Procedure()); OrthoCase orthoCase = OrthoCases.GetOne(orthoCaseNum); OrthoPlanLink schedulePlanLink = OrthoPlanLinks.GetOneForOrthoCaseByType(orthoCaseNum, OrthoPlanLinkType.OrthoSchedule); OrthoSchedule orthoSchedule = OrthoSchedules.GetOne(schedulePlanLink.FKey); List <OrthoProcLink> listVisitProcLinks = OrthoProcLinks.GetVisitLinksForOrthoCase(orthoCaseNum); OrthoProcLinks.SetProcFeeForLinkedProc(orthoCase, bandingProc, OrthoProcType.Banding, listVisitProcLinks, schedulePlanLink, orthoSchedule); OrthoProcLinks.SetProcFeeForLinkedProc(orthoCase, visitProc, OrthoProcType.Visit, listVisitProcLinks, schedulePlanLink, orthoSchedule); OrthoProcLinks.SetProcFeeForLinkedProc(orthoCase, debondProc, OrthoProcType.Debond, listVisitProcLinks, schedulePlanLink, orthoSchedule); Assert.AreEqual(bandingProc.ProcFee, 1000); Assert.AreEqual(debondProc.ProcFee, 400); Assert.AreEqual(visitProc.ProcFee, 60); }
private void butYes_Click(object sender, System.EventArgs e) { //Customers have been complaining about procedurelog entries changing their CodeNum column to 0. //Based on a security log provided by a customer, we were able to determine that this is one of two potential violators. //The following code is here simply to try and get the user to call us so that we can have proof and hopefully find the core of the issue. try { if (_verifyCode < 1) { throw new ApplicationException("Invalid Verify Code"); } } catch (ApplicationException ae) { string error = "Please notify support with the following information.\r\n" + "Error: " + ae.Message + "\r\n" + "_verifyCode: " + _verifyCode.ToString() + "\r\n" + "_procCur.CodeNum: " + (_procCur == null ? "NULL" : _procCur.CodeNum.ToString()) + "\r\n" + "_procCodeCur.CodeNum: " + (_procCodeCur == null ? "NULL" : _procCodeCur.CodeNum.ToString()) + "\r\n" + "\r\n" + "StackTrace:\r\n" + ae.StackTrace; MsgBoxCopyPaste MsgBCP = new MsgBoxCopyPaste(error); MsgBCP.Text = "Fatal Error!!!"; MsgBCP.Show(); //Use .Show() to make it easy for the user to keep this window open while they call in. return; } //Don't change code if proc is linked to OrthoCase if (OrthoProcLinks.IsProcLinked(_procCur.ProcNum)) { MsgBox.Show("This procedure is attached to an ortho case and its code cannot be changed."); return; } //Moved from FormProcEdit.SaveAndClose() in version 16.3+ Procedure procOld = _procCur.Copy(); _procCur.CodeNum = _verifyCode; if (new[] { ProcStat.TP, ProcStat.C, ProcStat.TPi, ProcStat.Cn }.Contains(_procCur.ProcStatus)) //Only change the fee if Complete, TP, TPi, or Cn. { InsSub prisub = null; InsPlan priplan = null; if (_listPatPlans.Count > 0) { prisub = InsSubs.GetSub(_listPatPlans[0].InsSubNum, _listInsSubs); priplan = InsPlans.GetPlan(prisub.PlanNum, _listInsPlans); } _procCur.ProcFee = Fees.GetAmount0(_procCur.CodeNum, FeeScheds.GetFeeSched(_patCur, _listInsPlans, _listPatPlans, _listInsSubs, _procCur.ProvNum), _procCur.ClinicNum, _procCur.ProvNum); if (priplan != null && priplan.PlanType == "p") //PPO { double standardfee = Fees.GetAmount0(_procCur.CodeNum, Providers.GetProv(Patients.GetProvNum(_patCur)).FeeSched, _procCur.ClinicNum, _procCur.ProvNum); _procCur.ProcFee = Math.Max(_procCur.ProcFee, standardfee); } } Procedures.Update(_procCur, procOld); //Compute estimates required, otherwise if adding through quick add, it could have incorrect WO or InsEst if code changed. Procedures.ComputeEstimates(_procCur, _patCur.PatNum, _listClaimProcs, true, _listInsPlans, _listPatPlans, _listBenefits, _patCur.Age, _listInsSubs); Recalls.Synch(_procCur.PatNum); if (_procCur.ProcStatus.In(ProcStat.C, ProcStat.EO, ProcStat.EC)) { string logText = _procCodeCur.ProcCode + " (" + _procCur.ProcStatus + "), "; if (_teethText != null && _teethText.Trim() != "") { logText += Lan.g(this, "Teeth") + ": " + _teethText + ", "; } logText += Lan.g(this, "Fee") + ": " + _procCur.ProcFee.ToString("F") + ", " + _procCodeCur.Descript; Permissions perm = Permissions.ProcComplEdit; if (_procCur.ProcStatus.In(ProcStat.EO, ProcStat.EC)) { perm = Permissions.ProcExistingEdit; } SecurityLogs.MakeLogEntry(perm, _patCur.PatNum, logText); } DialogResult = DialogResult.OK; }
public void ClaimProcs_ComputeEstimatesByOrthoCase_SetClaimProcForEachProcType() { Prefs.UpdateString(PrefName.OrthoBandingCodes, "D8080"); Prefs.UpdateString(PrefName.OrthoDebondCodes, "D8070"); Prefs.UpdateString(PrefName.OrthoVisitCodes, "D8060"); Patient pat = PatientT.CreatePatient(MethodBase.GetCurrentMethod().Name); Procedure bandingProc = ProcedureT.CreateProcedure(pat, "D8080", ProcStat.C, "", 0); PatPlan patPlan = PatPlanT.CreatePatPlan(1, pat.PatNum, 0); ClaimProc bandingClaimProc = ClaimProcT.CreateClaimProc(pat.PatNum, bandingProc.ProcNum, 0, 0, bandingProc.ProcDate, 1, 1, 1); Procedure visitProc = ProcedureT.CreateProcedure(pat, "D8060", ProcStat.C, "", 0); ClaimProc visitClaimProc = ClaimProcT.CreateClaimProc(pat.PatNum, visitProc.ProcNum, 0, 0, visitProc.ProcDate, 1, 1, 1); Procedure debondProc = ProcedureT.CreateProcedure(pat, "D8070", ProcStat.C, "", 0); ClaimProc debondClaimProc = ClaimProcT.CreateClaimProc(pat.PatNum, debondProc.ProcNum, 0, 0, debondProc.ProcDate, 1, 1, 1); long orthoCaseNum = OrthoCaseT.InsertForFormOrthoCase(pat.PatNum, 2000, 1200, 0, 800, DateTime.Today, false, DateTime.Today.AddMonths(12), 1000, 400, 60, bandingProc); OrthoCase orthoCase = OrthoCases.GetOne(orthoCaseNum); OrthoPlanLink schedulePlanLink = OrthoPlanLinks.GetOneForOrthoCaseByType(orthoCaseNum, OrthoPlanLinkType.OrthoSchedule); OrthoSchedule orthoSchedule = OrthoSchedules.GetOne(schedulePlanLink.FKey); OrthoProcLinks.LinkProcForActiveOrthoCase(bandingProc); OrthoProcLinks.LinkProcForActiveOrthoCase(visitProc); OrthoProcLinks.LinkProcForActiveOrthoCase(debondProc); List <OrthoProcLink> allProcLinks = OrthoProcLinks.GetManyByOrthoCase(orthoCaseNum); OrthoProcLink bandingLink = allProcLinks.FirstOrDefault(x => x.ProcLinkType == OrthoProcType.Banding); OrthoProcLink debondLink = allProcLinks.FirstOrDefault(x => x.ProcLinkType == OrthoProcType.Debond); OrthoProcLink visitLink = allProcLinks.FirstOrDefault(x => x.ProcLinkType == OrthoProcType.Visit); List <ClaimProc> listAllClaimProcs = new List <ClaimProc>() { bandingClaimProc, visitClaimProc, debondClaimProc }; List <OrthoProcLink> listAllOrthoProcLinks = new List <OrthoProcLink>() { bandingLink, visitLink, debondLink }; List <PatPlan> listPatPlans = new List <PatPlan>() { patPlan }; ClaimProcs.ComputeEstimatesByOrthoCase(bandingProc, bandingLink, orthoCase, orthoSchedule, true, listAllClaimProcs, new List <ClaimProc>() { bandingClaimProc }, listPatPlans, listAllOrthoProcLinks); ClaimProcs.ComputeEstimatesByOrthoCase(debondProc, debondLink, orthoCase, orthoSchedule, true, listAllClaimProcs, new List <ClaimProc>() { debondClaimProc }, listPatPlans, listAllOrthoProcLinks); ClaimProcs.ComputeEstimatesByOrthoCase(visitProc, visitLink, orthoCase, orthoSchedule, true, listAllClaimProcs, new List <ClaimProc>() { visitClaimProc }, listPatPlans, listAllOrthoProcLinks); Assert.AreEqual(bandingClaimProc.AllowedOverride, 0); Assert.AreEqual(bandingClaimProc.CopayOverride, 0); Assert.AreEqual(bandingClaimProc.PercentOverride, 0); Assert.AreEqual(bandingClaimProc.PaidOtherInsOverride, 0); Assert.AreEqual(bandingClaimProc.WriteOffEstOverride, 0); Assert.AreEqual(bandingClaimProc.InsEstTotalOverride, 600); Assert.AreEqual(debondClaimProc.AllowedOverride, 0); Assert.AreEqual(debondClaimProc.CopayOverride, 0); Assert.AreEqual(debondClaimProc.PercentOverride, 0); Assert.AreEqual(debondClaimProc.PaidOtherInsOverride, 0); Assert.AreEqual(debondClaimProc.WriteOffEstOverride, 0); Assert.AreEqual(debondClaimProc.InsEstTotalOverride, 240); Assert.AreEqual(visitClaimProc.AllowedOverride, 0); Assert.AreEqual(visitClaimProc.CopayOverride, 0); Assert.AreEqual(visitClaimProc.PercentOverride, 0); Assert.AreEqual(visitClaimProc.PaidOtherInsOverride, 0); Assert.AreEqual(visitClaimProc.WriteOffEstOverride, 0); Assert.AreEqual(visitClaimProc.InsEstTotalOverride, 36); }