private void gridProc_CellDoubleClick(object sender,ODGridClickEventArgs e) { if(!doubleClickWarningAlreadyDisplayed){ doubleClickWarningAlreadyDisplayed=true; if(!MsgBox.Show(this,true,"If you are trying to enter payment information, please use the payments buttons at the upper right.\r\nThen, don't forget to finish by creating the check using the button below this section.\r\nYou should probably click cancel unless you are just editing estimates.\r\nContinue anyway?")){ return; } } List<ClaimProcHist> histList=null; List<ClaimProcHist> loopList=null; FormClaimProc FormCP=new FormClaimProc(ClaimProcsForClaim[e.Row],null,FamCur,PatCur,PlanList,histList,ref loopList,PatPlanList,true,SubList); FormCP.IsInClaim=true; FormCP.ShowDialog(); if(FormCP.DialogResult!=DialogResult.OK){ return; } ClaimProcList=ClaimProcs.Refresh(PatCur.PatNum); FillGrids(); }
private void butPayTotal_Click(object sender, System.EventArgs e) { if(!Security.IsAuthorized(Permissions.InsPayCreate)){//date not checked here, but it will be checked when actually creating the check return; } //preauths are only allowed "payment" entry by procedure since a total would be meaningless if(ClaimCur.ClaimType=="PreAuth"){ MessageBox.Show(Lan.g(this,"PreAuthorizations can only be entered by procedure.")); return; } if(ClaimCur.ClaimType=="Cap"){ if(MessageBox.Show(Lan.g(this,"If you enter by total, the insurance payment will affect the patient balance. It is recommended to enter by procedure instead. Continue anyway?"),"",MessageBoxButtons.OKCancel)!=DialogResult.OK) return; } Double dedEst=0; Double payEst=0; for(int i=0;i<ClaimProcsForClaim.Count;i++){ if(ClaimProcsForClaim[i].Status!=ClaimProcStatus.NotReceived){ continue; } if(ClaimProcsForClaim[i].ProcNum==0){ continue;//also ignore non-procedures. } //ClaimProcs.Cur=ClaimProcs.ForClaim[i]; dedEst+=ClaimProcsForClaim[i].DedApplied; payEst+=ClaimProcsForClaim[i].InsPayEst; } ClaimProc ClaimProcCur=new ClaimProc(); //ClaimProcs.Cur.ProcNum ClaimProcCur.ClaimNum=ClaimCur.ClaimNum; ClaimProcCur.PatNum=ClaimCur.PatNum; ClaimProcCur.ProvNum=ClaimCur.ProvTreat; //ClaimProcs.Cur.FeeBilled //ClaimProcs.Cur.InsPayEst ClaimProcCur.DedApplied=dedEst; ClaimProcCur.Status=ClaimProcStatus.Received; ClaimProcCur.InsPayAmt=payEst; //remarks //ClaimProcs.Cur.ClaimPaymentNum ClaimProcCur.PlanNum=ClaimCur.PlanNum; ClaimProcCur.InsSubNum=ClaimCur.InsSubNum; ClaimProcCur.DateCP=DateTimeOD.Today; ClaimProcCur.ProcDate=ClaimCur.DateService; ClaimProcCur.DateEntry=DateTime.Now;//will get set anyway ClaimProcCur.ClinicNum=ClaimCur.ClinicNum; ClaimProcs.Insert(ClaimProcCur); List<ClaimProcHist> loopList=null; FormClaimProc FormCP=new FormClaimProc(ClaimProcCur,null,FamCur,PatCur,PlanList,null,ref loopList,PatPlanList,true,SubList); FormCP.IsInClaim=true; FormCP.ShowDialog(); if(FormCP.DialogResult!=DialogResult.OK){ ClaimProcs.Delete(ClaimProcCur); } else{ for(int i=0;i<ClaimProcsForClaim.Count;i++){ if(ClaimProcsForClaim[i].Status!=ClaimProcStatus.NotReceived){ continue; } //ClaimProcs.Cur=ClaimProcs.ForClaim[i]; ClaimProcsForClaim[i].Status=ClaimProcStatus.Received; if(ClaimProcsForClaim[i].DedApplied>0){ ClaimProcsForClaim[i].InsPayEst+=ClaimProcsForClaim[i].DedApplied; ClaimProcsForClaim[i].DedApplied=0;//because ded will show as part of payment now. } ClaimProcsForClaim[i].DateEntry=DateTime.Now;//the date is was switched to rec'd ClaimProcs.Update(ClaimProcsForClaim[i]); } } comboClaimStatus.SelectedIndex=5;//Received if(textDateRec.Text==""){ textDateRec.Text=DateTime.Today.ToShortDateString(); } ClaimProcList=ClaimProcs.Refresh(PatCur.PatNum); FillGrids(); }
///<summary>Validates the values in the claimproc window when opened from the TP module.</summary> public static string TestThirty(int specificTest) { if(specificTest != 0 && specificTest !=30) { return ""; } string suffix="30"; Patient pat=PatientT.CreatePatient(suffix); Carrier carrier=CarrierT.CreateCarrier(suffix); InsPlan plan=InsPlanT.CreateInsPlan(carrier.CarrierNum); InsSub sub=InsSubT.CreateInsSub(pat.PatNum,plan.PlanNum); long subNum=sub.InsSubNum; BenefitT.CreateAnnualMax(plan.PlanNum,1300); BenefitT.CreateCategoryPercent(plan.PlanNum,EbenefitCategory.Crowns,50); BenefitT.CreateDeductibleGeneral(plan.PlanNum,BenefitCoverageLevel.Individual,25); PatPlanT.CreatePatPlan(1,pat.PatNum,subNum); //proc1 - crown Procedure proc1=ProcedureT.CreateProcedure(pat,"D2790",ProcStat.TP,"1",800);//Tooth 1 ProcedureT.SetPriority(proc1,0);//Priority 1 //proc2 - crown Procedure proc2=ProcedureT.CreateProcedure(pat,"D2790",ProcStat.TP,"9",800);//Tooth 9 ProcedureT.SetPriority(proc2,1);//Priority 2 //Lists: List<ClaimProc> claimProcs=ClaimProcs.Refresh(pat.PatNum); List<ClaimProc> claimProcListOld=new List<ClaimProc>(); Family fam=Patients.GetFamily(pat.PatNum); List<InsSub> subList=InsSubs.RefreshForFam(fam); List<InsPlan> planList=InsPlans.RefreshForSubList(subList); List<PatPlan> patPlans=PatPlans.Refresh(pat.PatNum); List<Benefit> benefitList=Benefits.Refresh(patPlans,subList); List<ClaimProcHist> histList=new List<ClaimProcHist>(); List<ClaimProcHist> loopList=new List<ClaimProcHist>(); List<Procedure> ProcList=Procedures.Refresh(pat.PatNum); Procedure[] ProcListTP=Procedures.GetListTP(ProcList);//sorted by priority, then toothnum //Validate //Mimick the TP module estimate calculations when the TP module is loaded. string retVal=""; for(int i=0;i<ProcListTP.Length;i++) { Procedures.ComputeEstimates(ProcListTP[i],pat.PatNum,ref claimProcs,false,planList,patPlans,benefitList, histList,loopList,false,pat.Age,subList); //then, add this information to loopList so that the next procedure is aware of it. loopList.AddRange(ClaimProcs.GetHistForProc(claimProcs,ProcListTP[i].ProcNum,ProcListTP[i].CodeNum)); } //Save changes in the list to the database, just like the TP module does when loaded. ClaimProcs.Synch(ref claimProcs,claimProcListOld); claimProcs=ClaimProcs.Refresh(pat.PatNum); //Validate the estimates within the Edit Claim Proc window are correct when opened from inside of the TP module by passing in same histlist and loop list that the TP module would. histList=ClaimProcs.GetHistList(pat.PatNum,benefitList,patPlans,planList,DateTime.Today,subList);//The history list is fetched when the TP module is loaded and is passed in the same for all claimprocs. loopList=new List<ClaimProcHist>();//Always empty for the first claimproc. ClaimProc claimProc1=ClaimProcs.GetEstimate(claimProcs,proc1.ProcNum,plan.PlanNum,subNum); FormClaimProc formCP1=new FormClaimProc(claimProc1,proc1,fam,pat,planList,histList,ref loopList,patPlans,false,subList); formCP1.Initialize(); string dedEst1=formCP1.GetTextValue("textDedEst"); if(dedEst1!="25.00") { throw new Exception("Deductible estimate in Claim Proc Edit window is $"+dedEst1+" but should be $25.00 for proc1 from TP module. \r\n"); } string patPortCP1=formCP1.GetTextValue("textPatPortion1"); if(patPortCP1!="412.50") { throw new Exception("Estimated patient portion in Claim Proc Edit window is $"+patPortCP1+" but should be $412.50 for proc1 from TP module. \r\n"); } ClaimProc claimProc2=ClaimProcs.GetEstimate(claimProcs,proc2.ProcNum,plan.PlanNum,subNum); histList=ClaimProcs.GetHistList(pat.PatNum,benefitList,patPlans,planList,DateTime.Today,subList);//The history list is fetched when the TP module is loaded and is passed in the same for all claimprocs. loopList=new List<ClaimProcHist>(); loopList.AddRange(ClaimProcs.GetHistForProc(claimProcs,proc1.ProcNum,proc1.CodeNum)); FormClaimProc formCP2=new FormClaimProc(claimProc2,proc2,fam,pat,planList,histList,ref loopList,patPlans,false,subList); formCP2.Initialize(); string dedEst2=formCP2.GetTextValue("textDedEst"); if(dedEst2!="0.00") { throw new Exception("Deductible estimate in Claim Proc Edit window is $"+dedEst2+" but should be $0.00 for proc2 from TP module. \r\n"); } string patPortCP2=formCP2.GetTextValue("textPatPortion1"); if(patPortCP2!="400.00") { throw new Exception("Estimated patient portion in Claim Proc Edit window is $"+patPortCP2+" but should be $400.00 for proc2 from TP module. \r\n"); } retVal+="30: Passed. Claim Procedure Edit window estimates correct from TP module.\r\n"; return retVal; }
private void gridMain_CellDoubleClick(object sender,OpenDental.UI.ODGridClickEventArgs e) { try{ SaveGridChanges(); } catch(ApplicationException ex){ MessageBox.Show(ex.Message); return; } List<ClaimProcHist> histList=null; List<ClaimProcHist> loopList=null; FormClaimProc FormCP=new FormClaimProc(ClaimProcsToEdit[e.Row],null,FamCur,PatCur,PlanList,histList,ref loopList,PatPlanList,false,SubList); FormCP.IsInClaim=true; //no need to worry about permissions here FormCP.ShowDialog(); if(FormCP.DialogResult!=DialogResult.OK){ return; } FillGrid(); FillTotals(); }
///<summary>Validates the values in the claimproc window when opened from the Claim Edit window.</summary> public static string TestTwentyNine(int specificTest) { if(specificTest != 0 && specificTest !=29) { return ""; } string suffix="29"; Patient pat=PatientT.CreatePatient(suffix); Carrier carrier=CarrierT.CreateCarrier(suffix); InsPlan plan=InsPlanT.CreateInsPlan(carrier.CarrierNum); InsSub sub=InsSubT.CreateInsSub(pat.PatNum,plan.PlanNum); long subNum=sub.InsSubNum; BenefitT.CreateAnnualMax(plan.PlanNum,1300); BenefitT.CreateCategoryPercent(plan.PlanNum,EbenefitCategory.Crowns,50); BenefitT.CreateDeductibleGeneral(plan.PlanNum,BenefitCoverageLevel.Individual,25); PatPlanT.CreatePatPlan(1,pat.PatNum,subNum); //proc1 - crown Procedure proc1=ProcedureT.CreateProcedure(pat,"D2790",ProcStat.C,"1",800);//Tooth 1 ProcedureT.SetPriority(proc1,0);//Priority 1 //proc2 - crown Procedure proc2=ProcedureT.CreateProcedure(pat,"D2790",ProcStat.C,"9",800);//Tooth 9 ProcedureT.SetPriority(proc2,1);//Priority 2 //Lists: List<ClaimProc> claimProcs=ClaimProcs.Refresh(pat.PatNum); List<ClaimProc> claimProcListOld=new List<ClaimProc>(); Family fam=Patients.GetFamily(pat.PatNum); List<InsSub> subList=InsSubs.RefreshForFam(fam); List<InsPlan> planList=InsPlans.RefreshForSubList(subList); List<PatPlan> patPlans=PatPlans.Refresh(pat.PatNum); List<Benefit> benefitList=Benefits.Refresh(patPlans,subList); List<Procedure> ProcList=Procedures.Refresh(pat.PatNum); string retVal=""; Claim claim=ClaimT.CreateClaim("P",patPlans,planList,claimProcs,ProcList,pat,ProcList,benefitList,subList);//Creates the claim in the same manner as the account module, including estimates. claimProcs=ClaimProcs.Refresh(pat.PatNum); //Validate the estimates as they would appear inside of the Claim Proc Edit window when opened from inside of the Edit Claim window by passing in the null histlist and null looplist that the Claim Edit window would send in. List<ClaimProcHist> histList=null; List<ClaimProcHist> loopList=null; ClaimProc claimProc1=ClaimProcs.GetEstimate(claimProcs,proc1.ProcNum,plan.PlanNum,subNum); FormClaimProc formCP1=new FormClaimProc(claimProc1,proc1,fam,pat,planList,histList,ref loopList,patPlans,false,subList); formCP1.IsInClaim=true; formCP1.Initialize(); string dedEst1=formCP1.GetTextValue("textDedEst"); if(dedEst1!="25.00") { throw new Exception("Deductible estimate in Claim Proc Edit window is $"+dedEst1+" but should be $25.00 for proc1 from Edit Claim Window. \r\n"); } string patPortCP1=formCP1.GetTextValue("textPatPortion1"); if(patPortCP1!="412.50") { throw new Exception("Estimated patient portion in Claim Proc Edit window is $"+patPortCP1+" but should be $412.50 for proc1 from Edit Claim Window. \r\n"); } ClaimProc claimProc2=ClaimProcs.GetEstimate(claimProcs,proc2.ProcNum,plan.PlanNum,subNum); FormClaimProc formCP2=new FormClaimProc(claimProc2,proc2,fam,pat,planList,histList,ref loopList,patPlans,false,subList); formCP2.IsInClaim=true; formCP2.Initialize(); string dedEst2=formCP2.GetTextValue("textDedEst"); if(dedEst2!="0.00") { throw new Exception("Deductible estimate in Claim Proc Edit window is $"+dedEst2+" but should be $0.00 for proc2 from Edit Claim Window. \r\n"); } string patPortCP2=formCP2.GetTextValue("textPatPortion1"); if(patPortCP2!="400.00") { throw new Exception("Estimated patient portion in Claim Proc Edit window is $"+patPortCP2+" but should be $400.00 for proc2 from Edit Claim Window. \r\n"); } retVal+="29: Passed. Claim Procedure Edit window estimates correct from Claim Edit window.\r\n"; return retVal; }
private void butAddEstimate_Click(object sender, System.EventArgs e) { FormInsPlanSelect FormIS=new FormInsPlanSelect(PatCur.PatNum); FormIS.ShowDialog(); if(FormIS.DialogResult==DialogResult.Cancel){ return; } InsPlan plan=FormIS.SelectedPlan; InsSub sub=FormIS.SelectedSub; List <Benefit> benList=Benefits.Refresh(PatPlanList,SubList); ClaimProc cp=new ClaimProc(); ClaimProcs.CreateEst(cp,ProcCur,plan,sub); if(plan.PlanType=="c") {//capitation double allowed=PIn.Double(textProcFee.Text); cp.BaseEst=allowed; cp.InsEstTotal=allowed; cp.CopayAmt=InsPlans.GetCopay(ProcCur.CodeNum,plan.FeeSched,plan.CopayFeeSched,plan.CodeSubstNone,ProcCur.ToothNum); if(cp.CopayAmt > allowed) {//if the copay is greater than the allowed fee calculated above cp.CopayAmt=allowed;//reduce the copay } if(cp.CopayAmt==-1) { cp.CopayAmt=0; } cp.WriteOffEst=cp.BaseEst-cp.CopayAmt; if(cp.WriteOffEst<0) { cp.WriteOffEst=0; } cp.WriteOff=cp.WriteOffEst; ClaimProcs.Update(cp); } long patPlanNum=PatPlans.GetPatPlanNum(sub.InsSubNum,PatPlanList); if(patPlanNum > 0){ double paidOtherInsTotal=ClaimProcs.GetPaidOtherInsTotal(cp,PatPlanList); double writeOffOtherIns=ClaimProcs.GetWriteOffOtherIns(cp,PatPlanList); ClaimProcs.ComputeBaseEst(cp,ProcCur.ProcFee,ProcCur.ToothNum,ProcCur.CodeNum,plan,patPlanNum,benList, HistList,LoopList,PatPlanList,paidOtherInsTotal,paidOtherInsTotal,PatCur.Age,writeOffOtherIns); } FormClaimProc FormC=new FormClaimProc(cp,ProcCur,FamCur,PatCur,PlanList,HistList,ref LoopList,PatPlanList,true,SubList); //FormC.NoPermission not needed because butAddEstimate not enabled FormC.ShowDialog(); if(FormC.DialogResult==DialogResult.Cancel){ ClaimProcs.Delete(cp); } FillIns(); }
private void gridIns_CellDoubleClick(object sender,ODGridClickEventArgs e) { FormClaimProc FormC=new FormClaimProc(ClaimProcsForProc[e.Row],ProcCur,FamCur,PatCur,PlanList,HistList,ref LoopList,PatPlanList,true,SubList); if(!butOK.Enabled){ FormC.NoPermissionProc=true; } FormC.ShowDialog(); FillIns(); }
///<summary>Validates that insurance plan deductible adjustments only count towards the None or General deductibles.</summary> public static string TestThirtyFive(int specificTest) { if(specificTest != 0 && specificTest !=35) { return ""; } string suffix="35"; string retVal=""; Patient pat=PatientT.CreatePatient(suffix); Carrier carrier=CarrierT.CreateCarrier(suffix); InsPlan plan=InsPlanT.CreateInsPlan(carrier.CarrierNum); InsSub sub=InsSubT.CreateInsSub(pat.PatNum,plan.PlanNum); long subNum=sub.InsSubNum; BenefitT.CreateAnnualMax(plan.PlanNum,1000); BenefitT.CreateCategoryPercent(plan.PlanNum,EbenefitCategory.Diagnostic,100); BenefitT.CreateCategoryPercent(plan.PlanNum,EbenefitCategory.RoutinePreventive,100); BenefitT.CreateDeductible(plan.PlanNum,EbenefitCategory.RoutinePreventive,50); //There are two "general" deductibles here because the Category General and the BenCat of 0 are not the same and need to be tested seperately. BenefitT.CreateDeductible(plan.PlanNum,EbenefitCategory.General,50); BenefitT.CreateDeductibleGeneral(plan.PlanNum,BenefitCoverageLevel.Individual,50); PatPlanT.CreatePatPlan(1,pat.PatNum,subNum); //proc1 - PerExam Procedure proc1=ProcedureT.CreateProcedure(pat,"D0120",ProcStat.TP,"",200); //proc2 - Sealant Procedure proc2=ProcedureT.CreateProcedure(pat,"D1351",ProcStat.TP,"5",200); List<ClaimProc> claimProcs=ClaimProcs.Refresh(pat.PatNum); List<ClaimProc> claimProcListOld=new List<ClaimProc>(); //Add insurance adjustment of $150 deductible. This allows us to check that proc2's deductible amount didn't get removed. ClaimProcT.AddInsUsedAdjustment(pat.PatNum,plan.PlanNum,0,sub.InsSubNum,150); Family fam=Patients.GetFamily(pat.PatNum); List<InsSub> subList=InsSubs.RefreshForFam(fam); List<InsPlan> planList=InsPlans.RefreshForSubList(subList); List<PatPlan> patPlans=PatPlans.Refresh(pat.PatNum); List<Benefit> benefitList=Benefits.Refresh(patPlans,subList); List<ClaimProcHist> histList=new List<ClaimProcHist>(); List<ClaimProcHist> loopList=new List<ClaimProcHist>(); List<Procedure> ProcList=Procedures.Refresh(pat.PatNum); Procedure[] ProcListTP=Procedures.GetListTP(ProcList);//sorted by priority, then toothnum for(int i=0;i<ProcListTP.Length;i++) { Procedures.ComputeEstimates(ProcListTP[i],pat.PatNum,ref claimProcs,false,planList,patPlans,benefitList, histList,loopList,false,pat.Age,subList); //then, add this information to loopList so that the next procedure is aware of it. loopList.AddRange(ClaimProcs.GetHistForProc(claimProcs,ProcListTP[i].ProcNum,ProcListTP[i].CodeNum)); } //Save changes in the list to the database, just like the TP module does when loaded. ClaimProcs.Synch(ref claimProcs,claimProcListOld); claimProcs=ClaimProcs.Refresh(pat.PatNum); //Validate the estimates within the Edit Claim Proc window are correct when opened from inside of the TP module by passing in same histlist and loop list that the TP module would. histList=ClaimProcs.GetHistList(pat.PatNum,benefitList,patPlans,planList,DateTime.Today,subList);//The history list is fetched when the TP module is loaded and is passed in the same for all claimprocs. loopList=new List<ClaimProcHist>();//Always empty for the first claimproc. ClaimProc claimProc1=ClaimProcs.GetEstimate(claimProcs,proc1.ProcNum,plan.PlanNum,subNum); FormClaimProc formCP1=new FormClaimProc(claimProc1,proc1,fam,pat,planList,histList,ref loopList,patPlans,false,subList); formCP1.Initialize(); string dedEst1=formCP1.GetTextValue("textDedEst"); if(dedEst1!="0.00") { throw new Exception("Deductible estimates in Treatment Plan Procedure Grid and Claim Proc Edit Window are $"+dedEst1+" but should be $0.00 for proc1 from TP module. \r\n"); } ClaimProc claimProc2=ClaimProcs.GetEstimate(claimProcs,proc2.ProcNum,plan.PlanNum,subNum); histList=ClaimProcs.GetHistList(pat.PatNum,benefitList,patPlans,planList,DateTime.Today,subList);//The history list is fetched when the TP module is loaded and is passed in the same for all claimprocs. loopList=new List<ClaimProcHist>(); loopList.AddRange(ClaimProcs.GetHistForProc(claimProcs,proc1.ProcNum,proc1.CodeNum)); FormClaimProc formCP2=new FormClaimProc(claimProc2,proc2,fam,pat,planList,histList,ref loopList,patPlans,false,subList); formCP2.Initialize(); string dedEst2=formCP2.GetTextValue("textDedEst"); if(dedEst2!="50.00") { throw new Exception("Deductible estimates in Treatment Plan Procedure Grid and Claim Proc Edit Window are $"+dedEst2+" but should be $50.00 for proc2 from TP module. \r\n"); } retVal+="35: Passed. Insurance adjustments only apply to None and General deductibles.\r\n"; return retVal; }
private void gridMain_CellDoubleClick(object sender,OpenDental.UI.ODGridClickEventArgs e) { try{ SaveGridChanges(); } catch(ApplicationException ex){ MessageBox.Show(ex.Message); return; } List<ClaimProcHist> histList=null; List<ClaimProcHist> loopList=null; ClaimProc claimProc=ListClaimProcsForClaim[e.Row]; FormClaimProc FormCP=new FormClaimProc(claimProc,null,_famCur,_patCur,_listPlans,histList,ref loopList,_listPatPlans,false,_listInsSubs); FormCP.IsInClaim=true; //no need to worry about permissions here FormCP.ShowDialog(); if(FormCP.DialogResult!=DialogResult.OK){ return; } if(claimProc.DoDelete) { ListClaimProcsForClaim.RemoveAt(e.Row); } FillGridProcedures(); FillTotals(); }