///<summary></summary> public static long Insert(Fee fee) { if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { fee.FeeNum=Meth.GetLong(MethodBase.GetCurrentMethod(),fee); return fee.FeeNum; } return Crud.FeeCrud.Insert(fee); }
///<summary></summary> public static void Update(Fee fee){ if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(),fee); return; } Crud.FeeCrud.Update(fee); }
///<summary>If the named fee schedule does not exist, then it will be created. It always returns the defnum for the feesched used, regardless of whether it already existed. procCode must have already been tested for valid code, and feeSchedName must not be blank.</summary> public static long ImportTrojan(string procCode,double amt,string feeSchedName) { FeeSched feeSched=FeeScheds.GetByExactName(feeSchedName); //if isManaged, then this should be done differently from here on out. if(feeSched==null){ //add the new fee schedule feeSched=new FeeSched(); feeSched.ItemOrder=FeeSchedC.ListLong.Count; feeSched.Description=feeSchedName; feeSched.FeeSchedType=FeeScheduleType.Normal; //feeSched.IsNew=true; FeeScheds.Insert(feeSched); //Cache.Refresh(InvalidType.FeeScheds); //Fees.Refresh(); DataValid.SetInvalid(InvalidType.FeeScheds, InvalidType.Fees); } if(feeSched.IsHidden){ feeSched.IsHidden=false;//unhide it FeeScheds.Update(feeSched); DataValid.SetInvalid(InvalidType.FeeScheds); } Fee fee=Fees.GetFee(ProcedureCodes.GetCodeNum(procCode),feeSched.FeeSchedNum); if(fee==null) { fee=new Fee(); fee.Amount=amt; fee.FeeSched=feeSched.FeeSchedNum; fee.CodeNum=ProcedureCodes.GetCodeNum(procCode); Fees.Insert(fee); } else{ fee.Amount=amt; Fees.Update(fee); } return feeSched.FeeSchedNum; }
///<summary></summary> public static void Delete(Fee fee) { //No need to check RemotingRole; no call to db. Delete(fee.FeeNum); }
private void SaveAllowedFees(){ //if no allowed fees entered, then nothing to do bool allowedFeesEntered=false; for(int i=0;i<gridPayments.Rows.Count;i++){ if(gridPayments.Rows[i].Cells[7].Text!=""){ allowedFeesEntered=true; break; } } if(!allowedFeesEntered){ return; } //if no allowed fee schedule, then nothing to do InsPlan plan=InsPlans.GetPlan(ListClaimProcsForClaim[0].PlanNum,_listPlans); if(plan.AllowedFeeSched==0){//no allowed fee sched //plan.PlanType!="p" && //not ppo, and return; } //ask user if they want to save the fees if(!MsgBox.Show(this,true,"Save the allowed amounts to the allowed fee schedule?")){ return; } //select the feeSchedule long feeSched=-1; feeSched=plan.AllowedFeeSched; if(FeeScheds.GetIsHidden(feeSched)){ MsgBox.Show(this,"Allowed fee schedule is hidden, so no changes can be made."); return; } Fee feeCur=null; long codeNum; List<Procedure> listProcs=Procedures.Refresh(_patCur.PatNum); Procedure proc; for(int i=0;i<ListClaimProcsForClaim.Count;i++) { proc=Procedures.GetProcFromList(listProcs,ListClaimProcsForClaim[i].ProcNum); codeNum=proc.CodeNum; //skip total payments if(codeNum==0){ continue; } feeCur=Fees.GetFee(codeNum,feeSched); if(feeCur==null){ feeCur=new Fee(); feeCur.FeeSched=feeSched; feeCur.CodeNum=codeNum; feeCur.Amount=PIn.Double(gridPayments.Rows[i].Cells[7].Text); Fees.Insert(feeCur); } else{ feeCur.Amount=PIn.Double(gridPayments.Rows[i].Cells[7].Text); Fees.Update(feeCur); } SecurityLogs.MakeLogEntry(Permissions.ProcFeeEdit,0,Lan.g(this,"Procedure")+": "+ProcedureCodes.GetStringProcCode(feeCur.CodeNum) +", "+Lan.g(this,"Fee: ")+""+feeCur.Amount.ToString("c")+", "+Lan.g(this,"Fee Schedule")+" "+FeeScheds.GetDescription(feeCur.FeeSched) +". "+Lan.g(this,"Automatic change to allowed fee in Enter Payment window. Confirmed by user."),feeCur.CodeNum); } DataValid.SetInvalid(InvalidType.Fees); }
private void gridMain_CellLeave(object sender,ODGridClickEventArgs e) { //logic only works for column 4. long codeNum=PIn.Long(ProcTable.Rows[e.Row]["CodeNum"].ToString()); long feesched=FeeSchedC.ListShort[listFeeSched.SelectedIndex].FeeSchedNum; Fee fee=Fees.GetFee(codeNum,feesched); string strOld=""; if(fee!=null){ strOld=fee.Amount.ToString("n"); } string strNew=gridMain.Rows[e.Row].Cells[e.Col].Text; if(strOld==strNew){ return; } if(!Security.IsAuthorized(Permissions.Setup)){//includes dialog gridMain.Rows[e.Row].Cells[e.Col].Text=strOld; gridMain.Invalidate(); return; } double dNew=-1; if(strNew!=""){ try{ dNew=PIn.Double(strNew); } catch{ gridMain.SetSelected(new Point(e.Col,e.Row)); MessageBox.Show(Lan.g(this,"Please fix data entry error first.")); return; } gridMain.Rows[e.Row].Cells[e.Col].Text=dNew.ToString("n");//to standardize formatting. They probably didn't type .00 //invalidate doesn't seem to be necessary here } if(strOld==""){//if no fee was originally entered and since it's no longer empty, then we need to insert a fee. //Somehow duplicate fees were being inserted so double check that this fee does not already exist. Fee tmpFee=Fees.GetFee(codeNum,feesched);//Looks in cache. if(tmpFee!=null) { return;//Fee exists. Must be unknown bug. } fee=new Fee(); fee.FeeSched=feesched; fee.CodeNum=codeNum; fee.Amount=dNew; Fees.Insert(fee); Fees.Listt.Add(fee); } else{//if fee existed if(strNew==""){//delete old fee Fees.Delete(fee); Fees.Listt.Remove(fee); } else{//change fee fee.Amount=dNew; Fees.Update(fee); Fees.Listt[Fees.Listt.IndexOf(fee)].Amount=dNew; } } SecurityLogs.MakeLogEntry(Permissions.ProcFeeEdit,0,Lan.g(this,"Procedure")+": "+ProcedureCodes.GetStringProcCode(fee.CodeNum) +", "+Lan.g(this,"Fee: ")+""+fee.Amount.ToString("c")+", "+Lan.g(this,"Fee Schedule")+": "+FeeScheds.GetDescription(fee.FeeSched) +". "+Lan.g(this,"Manual edit in grid from Procedure Codes list."),fee.CodeNum); }
private void butUpdateAllowed_Click(object sender, System.EventArgs e) { InsPlan plan=InsPlans.GetPlan(ClaimProcCur.PlanNum,PlanList); if(plan==null){ //this should never happen } if(plan.AllowedFeeSched==0 && plan.PlanType!="p"){ MsgBox.Show(this,"Plan must either be a PPO type or it must have an 'Allowed' fee schedule set."); return; } long feeSched=-1; if(plan.AllowedFeeSched!=0) { feeSched=plan.AllowedFeeSched; } else if(plan.PlanType=="p") { feeSched=plan.FeeSched; } if(FeeScheds.GetIsHidden(feeSched)){ MsgBox.Show(this,"Allowed fee schedule is hidden, so no changes can be made."); return; } Fee FeeCur=Fees.GetFee(proc.CodeNum,feeSched); FormFeeEdit FormFE=new FormFeeEdit(); if(FeeCur==null){ FeeCur=new Fee(); FeeCur.FeeSched=feeSched; FeeCur.CodeNum=proc.CodeNum; Fees.Insert(FeeCur); FormFE.IsNew=true; } FormFE.FeeCur=FeeCur; FormFE.ShowDialog(); if(FormFE.DialogResult==DialogResult.OK){ Fees.RefreshCache(); DataValid.SetInvalid(InvalidType.Fees); } FillAllowed(); ComputeAmounts();//? }
//public static string TestFourteen(int specificTest) {//This was taken out of the manual because it was a duplicate of Unit Test 1 but expected a different result. // if(specificTest != 0 && specificTest !=14){ // return""; // } // string suffix="14"; // Patient pat=PatientT.CreatePatient(suffix); // long patNum=pat.PatNum; // long feeSchedNum1=FeeSchedT.CreateFeeSched(FeeScheduleType.Normal,suffix); // long feeSchedNum2=FeeSchedT.CreateFeeSched(FeeScheduleType.Normal,suffix+"b"); // //Standard Fee // Fees.RefreshCache(); // long codeNum=ProcedureCodes.GetCodeNum("D7140"); // Fee fee=Fees.GetFee(codeNum,53); // if(fee==null) { // fee=new Fee(); // fee.CodeNum=codeNum; // fee.FeeSched=53; // fee.Amount=140; // Fees.Insert(fee); // } // else { // fee.Amount=140; // Fees.Update(fee); // } // //PPO fees // fee=new Fee(); // fee.CodeNum=codeNum; // fee.FeeSched=feeSchedNum1; // fee.Amount=136; // Fees.Insert(fee); // fee=new Fee(); // fee.CodeNum=codeNum; // fee.FeeSched=feeSchedNum2; // fee.Amount=77; // Fees.Insert(fee); // Fees.RefreshCache(); // //Carrier // Carrier carrier=CarrierT.CreateCarrier(suffix); // long planNum1=InsPlanT.CreateInsPlanPPO(carrier.CarrierNum,feeSchedNum1).PlanNum; // long planNum2=InsPlanT.CreateInsPlanPPO(carrier.CarrierNum,feeSchedNum2).PlanNum; // InsSub sub1=InsSubT.CreateInsSub(pat.PatNum,planNum1); // long subNum1=sub1.InsSubNum; // InsSub sub2=InsSubT.CreateInsSub(pat.PatNum,planNum2); // long subNum2=sub2.InsSubNum; // BenefitT.CreateCategoryPercent(planNum1,EbenefitCategory.OralSurgery,50); // BenefitT.CreateCategoryPercent(planNum2,EbenefitCategory.OralSurgery,100); // PatPlanT.CreatePatPlan(1,patNum,subNum1); // PatPlanT.CreatePatPlan(2,patNum,subNum2); // Procedure proc=ProcedureT.CreateProcedure(pat,"D7140",ProcStat.TP,"8",Fees.GetAmount0(codeNum,53));//extraction on 8 // long procNum=proc.ProcNum; // //Lists // List<ClaimProc> claimProcs=ClaimProcs.Refresh(patNum); // Family fam=Patients.GetFamily(patNum); // List<InsSub> subList=InsSubs.RefreshForFam(fam); // List<InsPlan> planList=InsPlans.RefreshForSubList(subList); // List<PatPlan> patPlans=PatPlans.Refresh(patNum); // List<Benefit> benefitList=Benefits.Refresh(patPlans,subList); // List<ClaimProcHist> histList=new List<ClaimProcHist>(); // List<ClaimProcHist> loopList=new List<ClaimProcHist>(); // //Validate // ClaimProc claimProc; // Procedures.ComputeEstimates(proc,patNum,ref claimProcs,false,planList,patPlans,benefitList,histList,loopList,true,pat.Age,subList); // claimProcs=ClaimProcs.Refresh(patNum); // claimProc=ClaimProcs.GetEstimate(claimProcs,procNum,planNum1,subNum1); // if(claimProc.InsEstTotal!=68) { // throw new Exception("Should be 68. \r\n"); // } // if(claimProc.WriteOffEst!=4) { // throw new Exception("Should be 4. \r\n"); // } // claimProc=ClaimProcs.GetEstimate(claimProcs,procNum,planNum2,subNum2); // if(claimProc.InsEstTotal!=9) { // throw new Exception("Should be 9. \r\n"); // } // if(claimProc.WriteOffEst!=59) { // throw new Exception("Writeoff should be 59. \r\n"); // } // return "14: Passed. Claim proc estimates for dual PPO ins. Writeoff2 not zero.\r\n"; //} ///<summary></summary> public static string TestFourteen(int specificTest) { if(specificTest != 0 && specificTest !=15) { return ""; } string suffix="14"; Patient pat=PatientT.CreatePatient(suffix); long patNum=pat.PatNum; long feeSchedNum1=FeeSchedT.CreateFeeSched(FeeScheduleType.Normal,suffix); long feeSchedNum2=FeeSchedT.CreateFeeSched(FeeScheduleType.Normal,suffix+"b"); //Standard Fee Fees.RefreshCache(); long codeNum=ProcedureCodes.GetCodeNum("D2160"); Fee fee=Fees.GetFee(codeNum,53); if(fee==null) { fee=new Fee(); fee.CodeNum=codeNum; fee.FeeSched=53; fee.Amount=1279; Fees.Insert(fee); } else { fee.Amount=1279; Fees.Update(fee); } //PPO fees fee=new Fee(); fee.CodeNum=codeNum; fee.FeeSched=feeSchedNum1; fee.Amount=1279; Fees.Insert(fee); fee=new Fee(); fee.CodeNum=codeNum; fee.FeeSched=feeSchedNum2; fee.Amount=110; Fees.Insert(fee); Fees.RefreshCache(); //Carrier Carrier carrier=CarrierT.CreateCarrier(suffix); long planNum1=InsPlanT.CreateInsPlanPPO(carrier.CarrierNum,feeSchedNum1).PlanNum; long planNum2=InsPlanT.CreateInsPlanPPO(carrier.CarrierNum,feeSchedNum2).PlanNum; InsSub sub1=InsSubT.CreateInsSub(pat.PatNum,planNum1); long subNum1=sub1.InsSubNum; InsSub sub2=InsSubT.CreateInsSub(pat.PatNum,planNum2); long subNum2=sub2.InsSubNum; BenefitT.CreateCategoryPercent(planNum1,EbenefitCategory.Restorative,80); BenefitT.CreateCategoryPercent(planNum2,EbenefitCategory.Restorative,80); BenefitT.CreateAnnualMax(planNum1,1200); BenefitT.CreateAnnualMax(planNum2,1200); PatPlanT.CreatePatPlan(1,patNum,subNum1); PatPlanT.CreatePatPlan(2,patNum,subNum2); Procedure proc=ProcedureT.CreateProcedure(pat,"D2160",ProcStat.TP,"19",Fees.GetAmount0(codeNum,53));//amalgam on 19 long procNum=proc.ProcNum; //Lists List<ClaimProc> claimProcs=ClaimProcs.Refresh(patNum); List<ClaimProc> claimProcListOld=new List<ClaimProc>(); Family fam=Patients.GetFamily(patNum); List<InsSub> subList=InsSubs.RefreshForFam(fam); List<InsPlan> planList=InsPlans.RefreshForSubList(subList); List<PatPlan> patPlans=PatPlans.Refresh(patNum); List<Benefit> benefitList=Benefits.Refresh(patPlans,subList); List<ClaimProcHist> histList=new List<ClaimProcHist>();//empty, not used for calcs. List<ClaimProcHist> loopList=new List<ClaimProcHist>();//empty, not used for calcs. List<Procedure> procList=Procedures.Refresh(patNum); Procedure[] ProcListTP=Procedures.GetListTP(procList);//sorted by priority, then toothnum //Set complete and attach to claim ProcedureT.SetComplete(proc,pat,planList,patPlans,claimProcs,benefitList,subList); claimProcs=ClaimProcs.Refresh(patNum); List<Procedure> procsForClaim=new List<Procedure>(); procsForClaim.Add(proc); Claim claim1=ClaimT.CreateClaim("P",patPlans,planList,claimProcs,procList,pat,procsForClaim,benefitList,subList); Claim claim2=ClaimT.CreateClaim("S",patPlans,planList,claimProcs,procList,pat,procsForClaim,benefitList,subList); //Validate string retVal=""; Procedures.ComputeEstimates(ProcListTP[0],pat.PatNum,ref claimProcs,false,planList,patPlans,benefitList, histList,loopList,false,pat.Age,subList); //save changes in the list to the database ClaimProcs.Synch(ref claimProcs,claimProcListOld); claimProcs=ClaimProcs.Refresh(pat.PatNum); ClaimProc claimProc1=ClaimProcs.GetEstimate(claimProcs,proc.ProcNum,planNum1,subNum1); if(claimProc1.InsEstTotal!=1023.20) { throw new Exception("Primary Estimate was "+claimProc1.InsEstTotal+", should be 1023.20.\r\n"); } ClaimProc claimProc2=ClaimProcs.GetEstimate(claimProcs,proc.ProcNum,planNum2,subNum2); /*Is this ok, or do we need to take another look? if(claimProc2.WriteOff!=0) {//Insurance should not cover. throw new Exception("Secondary writeoff was "+claimProc2.WriteOff+", should be 0.\r\n"); } if(claimProc2.InsEstTotal!=0) {//Insurance should not cover. throw new Exception("Secondary Estimate was "+claimProc2.InsEstTotal+", should be 0.\r\n"); }*/ retVal+="14: Passed. Primary estimate are not affected by secondary claim.\r\n"; return retVal; }
///<summary></summary> public static string TestTwelve(int specificTest) { if(specificTest != 0 && specificTest !=12){ return""; } string suffix="12"; Patient pat=PatientT.CreatePatient(suffix); long patNum=pat.PatNum; Patient pat2=PatientT.CreatePatient(suffix); PatientT.SetGuarantor(pat2,pat.PatNum); Carrier carrier=CarrierT.CreateCarrier(suffix); long feeSchedNum=FeeSchedT.CreateFeeSched(FeeScheduleType.Normal,suffix); //Standard Fee Fees.RefreshCache(); long codeNum=ProcedureCodes.GetCodeNum("D2750"); Fee fee=Fees.GetFee(codeNum,53); if(fee==null) { fee=new Fee(); fee.CodeNum=codeNum; fee.FeeSched=53; fee.Amount=1400; Fees.Insert(fee); } else { fee.Amount=1400; Fees.Update(fee); } //PPO fees fee=new Fee(); fee.CodeNum=codeNum; fee.FeeSched=feeSchedNum; fee.Amount=1100; Fees.Insert(fee); Fees.RefreshCache(); InsPlan plan=InsPlanT.CreateInsPlanPPO(carrier.CarrierNum,feeSchedNum); long planNum=plan.PlanNum; InsSub sub=InsSubT.CreateInsSub(pat.PatNum,planNum);//patient is subscriber for plan 1 long subNum=sub.InsSubNum; PatPlanT.CreatePatPlan(1,pat.PatNum,subNum); InsSub sub2=InsSubT.CreateInsSub(pat2.PatNum,planNum);//spouse is subscriber for plan 2 long subNum2=sub2.InsSubNum; PatPlanT.CreatePatPlan(2,pat.PatNum,subNum2);//patient also has spouse's coverage BenefitT.CreateAnnualMax(planNum,1200); BenefitT.CreateDeductibleGeneral(planNum,BenefitCoverageLevel.Individual,0); BenefitT.CreateCategoryPercent(planNum,EbenefitCategory.Crowns,100);//2700-2799 Procedure proc=ProcedureT.CreateProcedure(pat,"D2750",ProcStat.TP,"19",1400); //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>();//empty, not used for calcs. List<ClaimProcHist> loopList=new List<ClaimProcHist>();//empty, not used for calcs. List<Procedure> ProcList=Procedures.Refresh(pat.PatNum); Procedure[] ProcListTP=Procedures.GetListTP(ProcList);//sorted by priority, then toothnum //Validate string retVal=""; Procedures.ComputeEstimates(ProcListTP[0],pat.PatNum,ref claimProcs,false,planList,patPlans,benefitList, histList,loopList,false,pat.Age,subList); //save changes in the list to the database ClaimProcs.Synch(ref claimProcs,claimProcListOld); claimProcs=ClaimProcs.Refresh(pat.PatNum); ClaimProc claimProc1=ClaimProcs.GetEstimate(claimProcs,proc.ProcNum,plan.PlanNum,subNum); if(claimProc1.InsEstTotal!=1100) { throw new Exception("Primary Estimate was "+claimProc1.InsEstTotal+", should be 1100.\r\n"); } ClaimProc claimProc2=ClaimProcs.GetEstimate(claimProcs,proc.ProcNum,plan.PlanNum,subNum2); if(claimProc2.InsEstTotal!=0) {//Insurance should not cover. throw new Exception("Secondary Estimate was "+claimProc2.InsEstTotal+", should be 0.\r\n"); } retVal+="12: Passed. Once family max is reached, additional procs show 0 coverage.\r\n"; return retVal; }
///<summary></summary> public static string TestThirtySeven(int specificTest) { if(specificTest != 0 && specificTest != 37) { return ""; } string suffix="37"; Patient pat=PatientT.CreatePatient(suffix); long patNum=pat.PatNum; long feeSchedNum1=FeeSchedT.CreateFeeSched(FeeScheduleType.Normal,suffix); //Standard Fee (we only insert this value to test that it is not used in the calculations). Fees.RefreshCache(); long codeNum=ProcedureCodes.GetCodeNum("D0270");//1BW //PPO fee Fee fee=new Fee(); fee.CodeNum=codeNum; fee.FeeSched=feeSchedNum1; fee.Amount=40; Fees.Insert(fee); Fees.RefreshCache(); //Copay fee schedule long feeSchedNumCopay=FeeSchedT.CreateFeeSched(FeeScheduleType.CoPay,suffix); fee=new Fee(); fee.CodeNum=codeNum; fee.FeeSched=feeSchedNumCopay; fee.Amount=5; Fees.Insert(fee); Fees.RefreshCache(); //Carrier Carrier carrier=CarrierT.CreateCarrier(suffix); long planNum1=InsPlanT.CreateInsPlanPPO(carrier.CarrierNum,feeSchedNum1,EnumCobRule.Basic).PlanNum; BenefitT.CreateDeductibleGeneral(planNum1,BenefitCoverageLevel.Individual,10); InsSub sub1=InsSubT.CreateInsSub(pat.PatNum,planNum1); long subNum1=sub1.InsSubNum; BenefitT.CreateCategoryPercent(planNum1,EbenefitCategory.DiagnosticXRay,80); PatPlanT.CreatePatPlan(1,patNum,subNum1); Procedure proc=ProcedureT.CreateProcedure(pat,"D0270",ProcStat.C,"",50);//1BW Procedure procOld=proc.Copy(); proc.UnitQty=3; Procedures.Update(proc,procOld);//1BW x 3 long procNum=proc.ProcNum; //Lists List<ClaimProc> claimProcs=ClaimProcs.Refresh(patNum); Family fam=Patients.GetFamily(patNum); List<InsSub> subList=InsSubs.RefreshForFam(fam); List<InsPlan> planList=InsPlans.RefreshForSubList(subList); InsPlan insPlan1=InsPlans.GetPlan(planNum1,planList); insPlan1.CopayFeeSched=feeSchedNumCopay; InsPlans.Update(insPlan1); List<PatPlan> patPlans=PatPlans.Refresh(patNum); List<Benefit> benefitList=Benefits.Refresh(patPlans,subList); List<ClaimProcHist> histList=new List<ClaimProcHist>(); List<ClaimProcHist> loopList=new List<ClaimProcHist>(); //Validate string retVal=""; ClaimProc claimProc; if(specificTest==0 || specificTest==37) { Procedures.ComputeEstimates(proc,patNum,ref claimProcs,false,planList,patPlans,benefitList,histList,loopList,true,pat.Age,subList); claimProcs=ClaimProcs.Refresh(patNum); claimProc=ClaimProcs.GetEstimate(claimProcs,procNum,planNum1,subNum1); if(claimProc.InsEstTotal!=76) { throw new Exception("Primary total estimate should be 76.\r\n"); } if(claimProc.WriteOffEst!=30) { throw new Exception("Primary writeoff estimate should be 30.\r\n"); } retVal+="37: Passed. PPO insurance estimates for procedures with multiple units.\r\n"; } return retVal; }
///<summary>Similar to tests 1 and 2.</summary> public static string TestThirtySix(int specificTest) { if(specificTest != 0 && specificTest != 36) { return ""; } string suffix="36"; Patient pat=PatientT.CreatePatient(suffix); long patNum=pat.PatNum; long feeSchedNum1=FeeSchedT.CreateFeeSched(FeeScheduleType.Normal,suffix); long feeSchedNum2=FeeSchedT.CreateFeeSched(FeeScheduleType.Normal,suffix+"b"); //Standard Fee (we only insert this value to test that it is not used in the calculations). Fees.RefreshCache(); long codeNum=ProcedureCodes.GetCodeNum("D4341"); Fee fee=Fees.GetFee(codeNum,53); if(fee==null) { fee=new Fee(); fee.CodeNum=codeNum; fee.FeeSched=53; fee.Amount=1200; Fees.Insert(fee); } else { fee.Amount=1200; Fees.Update(fee); } //PPO fees fee=new Fee(); fee.CodeNum=codeNum; fee.FeeSched=feeSchedNum1; fee.Amount=206; Fees.Insert(fee); fee=new Fee(); fee.CodeNum=codeNum; fee.FeeSched=feeSchedNum2; fee.Amount=117; Fees.Insert(fee); Fees.RefreshCache(); //Carrier Carrier carrier=CarrierT.CreateCarrier(suffix); long planNum1=InsPlanT.CreateInsPlanPPO(carrier.CarrierNum,feeSchedNum1,EnumCobRule.Standard).PlanNum; long planNum2=InsPlanT.CreateInsPlanPPO(carrier.CarrierNum,feeSchedNum2,EnumCobRule.Standard).PlanNum; InsSub sub1=InsSubT.CreateInsSub(pat.PatNum,planNum1); long subNum1=sub1.InsSubNum; InsSub sub2=InsSubT.CreateInsSub(pat.PatNum,planNum2); long subNum2=sub2.InsSubNum; BenefitT.CreateCategoryPercent(planNum1,EbenefitCategory.Periodontics,50); BenefitT.CreateCategoryPercent(planNum2,EbenefitCategory.Periodontics,80); PatPlanT.CreatePatPlan(1,patNum,subNum1); PatPlanT.CreatePatPlan(2,patNum,subNum2); Procedure proc=ProcedureT.CreateProcedure(pat,"D4341",ProcStat.TP,"",206);//Scaling in undefined/any quadrant. long procNum=proc.ProcNum; //Lists List<ClaimProc> claimProcs=ClaimProcs.Refresh(patNum); Family fam=Patients.GetFamily(patNum); List<InsSub> subList=InsSubs.RefreshForFam(fam); List<InsPlan> planList=InsPlans.RefreshForSubList(subList); List<PatPlan> patPlans=PatPlans.Refresh(patNum); List<Benefit> benefitList=Benefits.Refresh(patPlans,subList); List<ClaimProcHist> histList=new List<ClaimProcHist>(); List<ClaimProcHist> loopList=new List<ClaimProcHist>(); //Validate string retVal=""; ClaimProc claimProc; if(specificTest==0 || specificTest==36) { Procedures.ComputeEstimates(proc,patNum,ref claimProcs,false,planList,patPlans,benefitList,histList,loopList,true,pat.Age,subList); claimProcs=ClaimProcs.Refresh(patNum); claimProc=ClaimProcs.GetEstimate(claimProcs,procNum,planNum1,subNum1); //I don't think allowed can be easily tested on the fly, and it's not that important. if(claimProc.InsEstTotal!=103) { throw new Exception("Primary total estimate should be 103. \r\n"); } if(claimProc.WriteOffEst!=0) { throw new Exception("Primary writeoff estimate should be 0. \r\n"); } claimProc=ClaimProcs.GetEstimate(claimProcs,procNum,planNum2,subNum2); if(claimProc.InsEstTotal!=93.6) { throw new Exception("Secondary total estimate should be 93.60. \r\n"); } if(claimProc.WriteOffEst!=0) { throw new Exception("Secondary writeoff estimate should be 0. \r\n"); } retVal+="36: Passed. Claim proc estimates for dual PPO ins when primary writeoff is zero.\r\n"; } return retVal; }
private void SaveAllowedFees() { //if no allowed fees entered, then nothing to do bool allowedFeesEntered=false; for(int i=0;i<gridMain.Rows.Count;i++){ if(gridMain.Rows[i].Cells[7].Text!=""){ allowedFeesEntered=true; break; } } if(!allowedFeesEntered){ return; } //if no allowed fee schedule, then nothing to do InsPlan plan=InsPlans.GetPlan(ClaimProcsToEdit[0].PlanNum,PlanList); if(plan.AllowedFeeSched==0){//no allowed fee sched //plan.PlanType!="p" && //not ppo, and return; } //ask user if they want to save the fees if(!MsgBox.Show(this,true,"Save the allowed amounts to the allowed fee schedule?")){ return; } //select the feeSchedule long feeSched=-1; //if(plan.PlanType=="p"){//ppo // feeSched=plan.FeeSched; //} //else if(plan.AllowedFeeSched!=0){//an allowed fee schedule exists feeSched=plan.AllowedFeeSched; //} if(FeeScheds.GetIsHidden(feeSched)){ MsgBox.Show(this,"Allowed fee schedule is hidden, so no changes can be made."); return; } Fee FeeCur=null; long codeNum; List<Procedure> ProcList=Procedures.Refresh(PatCur.PatNum); Procedure proc; for(int i=0;i<ClaimProcsToEdit.Length;i++){ //this gives error message if proc not found: proc=Procedures.GetProcFromList(ProcList,ClaimProcsToEdit[i].ProcNum); codeNum=proc.CodeNum; if(codeNum==0){ continue; } FeeCur=Fees.GetFee(codeNum,feeSched); if(FeeCur==null){ FeeCur=new Fee(); FeeCur.FeeSched=feeSched; FeeCur.CodeNum=codeNum; FeeCur.Amount=PIn.Double(gridMain.Rows[i].Cells[7].Text); Fees.Insert(FeeCur); } else{ FeeCur.Amount=PIn.Double(gridMain.Rows[i].Cells[7].Text); Fees.Update(FeeCur); } } //Fees.Refresh();//redundant? DataValid.SetInvalid(InvalidType.Fees); }
///<summary></summary> public FeeUpdate(Fee fee, FeeUpdateType updateType) { Fee = fee; UpdateType = updateType; }
///<summary></summary> public static string TestThirtyNine(int specificTest) { if(specificTest != 0 && specificTest != 39) { return ""; } string suffix="39"; Patient pat=PatientT.CreatePatient(suffix); long patNum=pat.PatNum; long feeSchedNum1=FeeSchedT.CreateFeeSched(FeeScheduleType.Normal,suffix); long feeSchedNum2=FeeSchedT.CreateFeeSched(FeeScheduleType.Normal,suffix+"b"); //Standard Fee (we only insert this value to test that it is not used in the calculations). Fees.RefreshCache(); long codeNum=ProcedureCodes.GetCodeNum("D0270"); //PPO fees Fee fee=new Fee(); fee.CodeNum=codeNum; fee.FeeSched=feeSchedNum1; fee.Amount=40; Fees.Insert(fee); fee=new Fee(); fee.CodeNum=codeNum; fee.FeeSched=feeSchedNum2; fee.Amount=30; Fees.Insert(fee); Fees.RefreshCache(); //Carrier Carrier carrier=CarrierT.CreateCarrier(suffix); long planNum1=InsPlanT.CreateInsPlanPPO(carrier.CarrierNum,feeSchedNum1,EnumCobRule.Basic).PlanNum; long planNum2=InsPlanT.CreateInsPlanPPO(carrier.CarrierNum,feeSchedNum2,EnumCobRule.Basic).PlanNum; InsSub sub1=InsSubT.CreateInsSub(pat.PatNum,planNum1); long subNum1=sub1.InsSubNum; InsSub sub2=InsSubT.CreateInsSub(pat.PatNum,planNum2); long subNum2=sub2.InsSubNum; BenefitT.CreateCategoryPercent(planNum1,EbenefitCategory.DiagnosticXRay,80); BenefitT.CreateCategoryPercent(planNum2,EbenefitCategory.DiagnosticXRay,80); PatPlanT.CreatePatPlan(1,patNum,subNum1); PatPlanT.CreatePatPlan(2,patNum,subNum2); Procedure proc=ProcedureT.CreateProcedure(pat,"D0270",ProcStat.TP,"",50);//Scaling in undefined/any quadrant. Procedure procOld=proc.Copy(); proc.UnitQty=4; Procedures.Update(proc,procOld);//1BW x 4 long procNum=proc.ProcNum; //Lists List<ClaimProc> claimProcs=ClaimProcs.Refresh(patNum); Family fam=Patients.GetFamily(patNum); List<InsSub> subList=InsSubs.RefreshForFam(fam); List<InsPlan> planList=InsPlans.RefreshForSubList(subList); List<PatPlan> patPlans=PatPlans.Refresh(patNum); List<Benefit> benefitList=Benefits.Refresh(patPlans,subList); List<ClaimProcHist> histList=new List<ClaimProcHist>(); List<ClaimProcHist> loopList=new List<ClaimProcHist>(); //Validate string retVal=""; ClaimProc claimProc; if(specificTest==0 || specificTest==39) { Procedures.ComputeEstimates(proc,patNum,ref claimProcs,false,planList,patPlans,benefitList,histList,loopList,true,pat.Age,subList); claimProcs=ClaimProcs.Refresh(patNum); claimProc=ClaimProcs.GetEstimate(claimProcs,procNum,planNum1,subNum1); if(claimProc.InsEstTotal!=128) { throw new Exception("Primary total estimate should be 128. \r\n"); } if(claimProc.WriteOffEst!=40) { throw new Exception("Primary writeoff estimate should be 40. \r\n"); } claimProc=ClaimProcs.GetEstimate(claimProcs,procNum,planNum2,subNum2); if(claimProc.InsEstTotal!=0) { throw new Exception("Secondary total estimate should be 0. \r\n"); } if(claimProc.WriteOffEst!=0) { throw new Exception("Secondary writeoff estimate should be 0. \r\n"); } retVal+="39: Passed. Claim proc writeoff estimates for procedures with multiple units.\r\n"; } return retVal; }
///<summary></summary> public FeeUpdate Copy() { return(new FeeUpdate(Fee.Copy(), UpdateType)); }
///<summary></summary> public static string TestFourty(int specificTest) { if(specificTest != 0 && specificTest != 40) { return ""; } string suffix="40"; Patient pat=PatientT.CreatePatient(suffix); long patNum=pat.PatNum; long feeSchedAllowedNum=FeeSchedT.CreateFeeSched(FeeScheduleType.OutNetwork,suffix+"-allowed"); long feeSchedNum2=FeeSchedT.CreateFeeSched(FeeScheduleType.Normal,suffix+"b"); //Standard Fee (we only insert this value to test that it is not used in the calculations). Fees.RefreshCache(); long codeNum=ProcedureCodes.GetCodeNum("D0272"); Fee fee=Fees.GetFee(codeNum,feeSchedAllowedNum); if(fee==null) { fee=new Fee(); fee.CodeNum=codeNum; fee.FeeSched=feeSchedAllowedNum; fee.Amount=152; Fees.Insert(fee); } else { fee.Amount=152; Fees.Update(fee); } //PPO fees fee=new Fee(); fee.CodeNum=codeNum; fee.FeeSched=feeSchedNum2; fee.Amount=87.99; Fees.Insert(fee); Fees.RefreshCache(); //Carrier Carrier carrier=CarrierT.CreateCarrier(suffix); //Plan 1 - Category Percentage long planNum1=InsPlanT.CreateInsPlan(carrier.CarrierNum).PlanNum; InsPlan insPlan1=InsPlans.RefreshOne(planNum1); insPlan1.FeeSched=0; insPlan1.AllowedFeeSched=feeSchedAllowedNum; InsPlans.Update(insPlan1); InsSub sub1=InsSubT.CreateInsSub(pat.PatNum,planNum1); long subNum1=sub1.InsSubNum; BenefitT.CreateCategoryPercent(planNum1,EbenefitCategory.DiagnosticXRay,80); BenefitT.CreateDeductibleGeneral(planNum1,BenefitCoverageLevel.Individual,50); PatPlanT.CreatePatPlan(1,patNum,subNum1); //Plan 2 - PPO long planNum2=InsPlanT.CreateInsPlanPPO(carrier.CarrierNum,feeSchedNum2,EnumCobRule.Basic).PlanNum; InsSub sub2=InsSubT.CreateInsSub(pat.PatNum,planNum2); long subNum2=sub2.InsSubNum; BenefitT.CreateCategoryPercent(planNum2,EbenefitCategory.DiagnosticXRay,100); PatPlanT.CreatePatPlan(2,patNum,subNum2); Procedure proc=ProcedureT.CreateProcedure(pat,"D0272",ProcStat.TP,"",236); long procNum=proc.ProcNum; //Lists List<ClaimProc> claimProcs=ClaimProcs.Refresh(patNum); Family fam=Patients.GetFamily(patNum); List<InsSub> subList=InsSubs.RefreshForFam(fam); List<InsPlan> planList=InsPlans.RefreshForSubList(subList); List<PatPlan> patPlans=PatPlans.Refresh(patNum); List<Benefit> benefitList=Benefits.Refresh(patPlans,subList); List<ClaimProcHist> histList=new List<ClaimProcHist>(); List<ClaimProcHist> loopList=new List<ClaimProcHist>(); //Validate string retVal=""; ClaimProc claimProc; if(specificTest==0 || specificTest==40) { Procedures.ComputeEstimates(proc,patNum,ref claimProcs,false,planList,patPlans,benefitList,histList,loopList,true,pat.Age,subList); claimProcs=ClaimProcs.Refresh(patNum); claimProc=ClaimProcs.GetEstimate(claimProcs,procNum,planNum1,subNum1); //Test insurance numbers without calculating secondary PPO insurance writeoffs if(claimProc.InsEstTotal!=81.6) { throw new Exception("Primary total estimate should be 81.60. \r\n"); } if(claimProc.WriteOffEst!=-1) { throw new Exception("Primary writeoff estimate should be -1. \r\n"); } claimProc=ClaimProcs.GetEstimate(claimProcs,procNum,planNum2,subNum2); if(claimProc.InsEstTotal!=6.39) { throw new Exception("Secondary total estimate should be 6.39. \r\n"); } if(claimProc.WriteOffEst!=0) { throw new Exception("Secondary writeoff estimate should be 0. \r\n"); } //Now test insurance numbers with calculating secondary PPO insurance writeoffs Prefs.UpdateBool(PrefName.InsPPOsecWriteoffs,true); Procedures.ComputeEstimates(proc,patNum,ref claimProcs,false,planList,patPlans,benefitList,histList,loopList,true,pat.Age,subList); claimProcs=ClaimProcs.Refresh(patNum); claimProc=ClaimProcs.GetEstimate(claimProcs,procNum,planNum1,subNum1); if(claimProc.InsEstTotal!=81.6) { throw new Exception("Primary total estimate should be 81.60. \r\n"); } if(claimProc.WriteOffEst!=-1) { throw new Exception("Primary writeoff estimate should be -1. \r\n"); } claimProc=ClaimProcs.GetEstimate(claimProcs,procNum,planNum2,subNum2); if(claimProc.InsEstTotal!=6.39) { throw new Exception("Secondary total estimate should be 6.39. \r\n"); } if(claimProc.WriteOffEst!=148.01) { throw new Exception("Secondary writeoff estimate should be 148.01. \r\n"); } retVal+="40: Passed. Dual insurance with secondary PPO insurance writeoffs calculated based on preference.\r\n"; } Prefs.UpdateBool(PrefName.InsPPOsecWriteoffs,false); return retVal; }
///<summary></summary> public static string TestEight(int specificTest) { if(specificTest != 0 && specificTest !=8){ return""; } string suffix="8"; Patient pat=PatientT.CreatePatient(suffix); long patNum=pat.PatNum; long feeSchedNum1=FeeSchedT.CreateFeeSched(FeeScheduleType.Normal,suffix); long feeSchedNum2=FeeSchedT.CreateFeeSched(FeeScheduleType.Normal,suffix+"b"); //Standard Fee Fees.RefreshCache(); long codeNum=ProcedureCodes.GetCodeNum("D2750"); Fee fee=Fees.GetFee(codeNum,53); if(fee==null) { fee=new Fee(); fee.CodeNum=codeNum; fee.FeeSched=53; fee.Amount=1200; Fees.Insert(fee); } else { fee.Amount=1200; Fees.Update(fee); } //PPO fees fee=new Fee(); fee.CodeNum=codeNum; fee.FeeSched=feeSchedNum1; fee.Amount=600; Fees.Insert(fee); fee=new Fee(); fee.CodeNum=codeNum; fee.FeeSched=feeSchedNum2; fee.Amount=800; Fees.Insert(fee); Fees.RefreshCache(); //Carrier Carrier carrier=CarrierT.CreateCarrier(suffix); long planNum1=InsPlanT.CreateInsPlanPPO(carrier.CarrierNum,feeSchedNum1).PlanNum; long planNum2=InsPlanT.CreateInsPlanPPO(carrier.CarrierNum,feeSchedNum2).PlanNum; InsSub sub1=InsSubT.CreateInsSub(pat.PatNum,planNum1); long subNum1=sub1.InsSubNum; InsSub sub2=InsSubT.CreateInsSub(pat.PatNum,planNum2); long subNum2=sub2.InsSubNum; BenefitT.CreateCategoryPercent(planNum1,EbenefitCategory.Crowns,50); BenefitT.CreateCategoryPercent(planNum2,EbenefitCategory.Crowns,50); BenefitT.CreateAnnualMax(planNum1,1000); BenefitT.CreateAnnualMax(planNum2,1000); PatPlanT.CreatePatPlan(1,patNum,subNum1); PatPlanT.CreatePatPlan(2,patNum,subNum2); Procedure proc=ProcedureT.CreateProcedure(pat,"D2750",ProcStat.TP,"8",Fees.GetAmount0(codeNum,53));//crown on 8 long procNum=proc.ProcNum; //Lists List<ClaimProc> claimProcs=ClaimProcs.Refresh(patNum); Family fam=Patients.GetFamily(patNum); List<InsSub> subList=InsSubs.RefreshForFam(fam); List<InsPlan> planList=InsPlans.RefreshForSubList(subList); List<PatPlan> patPlans=PatPlans.Refresh(patNum); List<Benefit> benefitList=Benefits.Refresh(patPlans,subList); List<Procedure> procList=Procedures.Refresh(patNum); //Set complete and attach to claim ProcedureT.SetComplete(proc,pat,planList,patPlans,claimProcs,benefitList,subList); claimProcs=ClaimProcs.Refresh(patNum); List<Procedure> procsForClaim=new List<Procedure>(); procsForClaim.Add(proc); Claim claim=ClaimT.CreateClaim("P",patPlans,planList,claimProcs,procList,pat,procsForClaim,benefitList,subList); //Validate string retVal=""; if(claim.WriteOff!=500) { throw new Exception("Should be 500. \r\n"); } retVal+="8: Passed. Completed writeoffs same as estimates for dual PPO ins when Allowed2 greater than Allowed1.\r\n"; return retVal; }
///<summary>Copies one fee schedule to one or more fee schedules. fromClinicNum, fromProvNum, and toProvNum can be zero. Set listClinicNumsTo to copy to multiple clinic overrides. If this list is null or empty, clinicNum 0 will be used.</summary> public static void CopyFeeSchedule(FeeSched fromFeeSched, long fromClinicNum, long fromProvNum, FeeSched toFeeSched, List <long> listClinicNumsTo, long toProvNum) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(), fromFeeSched, fromClinicNum, fromProvNum, toFeeSched, listClinicNumsTo, toProvNum); return; } if (listClinicNumsTo == null) { listClinicNumsTo = new List <long>(); } if (listClinicNumsTo.Count == 0) { listClinicNumsTo.Add(0); } //Store a local copy of the fees from the old FeeSched List <Fee> listFeeLocalCopy = Fees.GetListExact(toFeeSched.FeeSchedNum, listClinicNumsTo, toProvNum); //Delete all fees that exactly match setting in "To" combo selections. foreach (long clinicNum in listClinicNumsTo) { Fees.DeleteFees(toFeeSched.FeeSchedNum, clinicNum, toProvNum); } //Copy: List <Fee> listNewFees = Fees.GetListExact(fromFeeSched.FeeSchedNum, fromClinicNum, fromProvNum); int blockValue = 0; int blockMax = (listNewFees.Count * listClinicNumsTo.Count); object locker = new object(); List <Action> listActions = new List <Action>(); foreach (long clinicNumTo in listClinicNumsTo) { listActions.Add(() => { foreach (Fee fee in listNewFees) { bool isReplacementFee = false; Fee newFee = fee.Copy(); newFee.FeeNum = 0; newFee.ProvNum = toProvNum; newFee.ClinicNum = clinicNumTo; newFee.FeeSched = toFeeSched.FeeSchedNum; Fees.Insert(newFee); //Check to see if this replaced an old fee with the same fee details Fee oldFee = listFeeLocalCopy.Where(x => x.ProvNum == newFee.ProvNum) .Where(x => x.ClinicNum == newFee.ClinicNum) .Where(x => x.CodeNum == newFee.CodeNum) .Where(x => x.FeeSched == newFee.FeeSched) .FirstOrDefault(); if (oldFee != null) { isReplacementFee = true; } ProcedureCode procCode = ProcedureCodes.GetProcCode(fee.CodeNum); string securityLogText = "Fee Schedule \"" + fromFeeSched.Description + "\" copied to Fee Schedule \"" + toFeeSched.Description + "\", "; if (clinicNumTo != 0) { securityLogText += "To Clinic \"" + Clinics.GetDesc(clinicNumTo) + "\", "; } securityLogText += "Proc Code \"" + procCode.ProcCode + "\", Fee \"" + fee.Amount + "\", "; if (isReplacementFee) { securityLogText += "Replacing Previous Fee \"" + oldFee.Amount + "\""; } SecurityLogs.MakeLogEntry(Permissions.FeeSchedEdit, 0, securityLogText); FeeSchedEvent.Fire(ODEventType.FeeSched, new ProgressBarHelper(Lans.g("FormFeeSchedTools", "Copying fees, please wait") + "...", blockValue: blockValue, blockMax: blockMax, progressStyle: ProgBarStyle.Continuous)); lock (locker) { blockValue++; } } }); } //Research and testing will determine whether we can run this on multiple threads. ODThread.RunParallel(listActions, TimeSpan.FromMinutes(30), numThreads: 1); }
///<summary></summary> public static string TestSeventeen(int specificTest) { if(specificTest != 0 && specificTest != 17){ return""; } string suffix="17"; Patient pat=PatientT.CreatePatient(suffix); long patNum=pat.PatNum; long feeSchedNum1=FeeSchedT.CreateFeeSched(FeeScheduleType.Normal,suffix); long feeSchedNum2=FeeSchedT.CreateFeeSched(FeeScheduleType.Normal,suffix+"b"); //Standard Fee Fees.RefreshCache(); long codeNum=ProcedureCodes.GetCodeNum("D2750"); Fee fee=Fees.GetFee(codeNum,53); if(fee==null) { fee=new Fee(); fee.CodeNum=codeNum; fee.FeeSched=53; fee.Amount=1200; Fees.Insert(fee); } else { fee.Amount=1200; Fees.Update(fee); } //PPO fees fee=new Fee(); fee.CodeNum=codeNum; fee.FeeSched=feeSchedNum1; fee.Amount=900; Fees.Insert(fee); fee=new Fee(); fee.CodeNum=codeNum; fee.FeeSched=feeSchedNum2; fee.Amount=650; Fees.Insert(fee); Fees.RefreshCache(); //Carrier Carrier carrier=CarrierT.CreateCarrier(suffix); long planNum1=InsPlanT.CreateInsPlanPPO(carrier.CarrierNum,feeSchedNum1,EnumCobRule.Standard).PlanNum; long planNum2=InsPlanT.CreateInsPlanPPO(carrier.CarrierNum,feeSchedNum2,EnumCobRule.Standard).PlanNum; InsSub sub1=InsSubT.CreateInsSub(pat.PatNum,planNum1); long subNum1=sub1.InsSubNum; InsSub sub2=InsSubT.CreateInsSub(pat.PatNum,planNum2); long subNum2=sub2.InsSubNum; BenefitT.CreateCategoryPercent(planNum1,EbenefitCategory.Crowns,50); BenefitT.CreateCategoryPercent(planNum2,EbenefitCategory.Crowns,50); PatPlanT.CreatePatPlan(1,patNum,subNum1); PatPlanT.CreatePatPlan(2,patNum,subNum2); Procedure proc=ProcedureT.CreateProcedure(pat,"D2750",ProcStat.TP,"8",Fees.GetAmount0(codeNum,53));//crown on 8 long procNum=proc.ProcNum; //Lists List<ClaimProc> claimProcs=ClaimProcs.Refresh(patNum); Family fam=Patients.GetFamily(patNum); List<InsSub> subList=InsSubs.RefreshForFam(fam); List<InsPlan> planList=InsPlans.RefreshForSubList(subList); List<PatPlan> patPlans=PatPlans.Refresh(patNum); List<Benefit> benefitList=Benefits.Refresh(patPlans,subList); List<ClaimProcHist> histList=new List<ClaimProcHist>(); List<ClaimProcHist> loopList=new List<ClaimProcHist>(); //Validate string retVal=""; ClaimProc claimProc; //Test 17 Part 1 (copied from Unit Test 1)---------------------------------------------------------------------------------------------------- Procedures.ComputeEstimates(proc,patNum,ref claimProcs,false,planList,patPlans,benefitList,histList,loopList,true,pat.Age,subList); claimProcs=ClaimProcs.Refresh(patNum); claimProc=ClaimProcs.GetEstimate(claimProcs,procNum,planNum1,subNum1); //I don't think allowed can be easily tested on the fly, and it's not that important. if(claimProc.InsEstTotal!=450) { throw new Exception("Should be 450. \r\n"); } if(claimProc.WriteOffEst!=300) { throw new Exception("Should be 300. \r\n"); } claimProc=ClaimProcs.GetEstimate(claimProcs,procNum,planNum2,subNum2); if(claimProc.InsEstTotal!=325) { throw new Exception("Should be 325. \r\n"); } if(claimProc.WriteOffEst!=0) { throw new Exception("Should be 0. \r\n"); } //Test 17 Part 2 (copied from Unit Test 2)---------------------------------------------------------------------------------------------------- //switch the fees fee=Fees.GetFee(codeNum,feeSchedNum1); fee.Amount=650; Fees.Update(fee); fee=Fees.GetFee(codeNum,feeSchedNum2); fee.Amount=900; Fees.Update(fee); Fees.RefreshCache(); Procedures.ComputeEstimates(proc,patNum,ref claimProcs,false,planList,patPlans,benefitList,histList,loopList,true,pat.Age,subList); //Validate claimProcs=ClaimProcs.Refresh(patNum); claimProc=ClaimProcs.GetEstimate(claimProcs,procNum,planNum1,subNum1); if(claimProc.InsEstTotal!=325) { throw new Exception("Should be 325. \r\n"); } if(claimProc.WriteOffEst!=550) { throw new Exception("Should be 550. \r\n"); } claimProc=ClaimProcs.GetEstimate(claimProcs,procNum,planNum2,subNum2); if(claimProc.InsEstTotal!=325) { throw new Exception("Should be 325. \r\n"); } if(claimProc.WriteOffEst!=0) { throw new Exception("Should be 0. \r\n"); } retVal+="17: Passed. Standard COB with PPOs.\r\n"; return retVal; }
///<summary>Replaces ImportCanadaFeeSchedule. Imports a canadian fee schedule. Called only in FormFeeSchedTools, located here to allow unit testing. ///Fires FeeSchedEvents for a progress bar.</summary> public static List <Fee> ImportCanadaFeeSchedule2(FeeSched feeSched, string feeData, long clinicNum, long provNum, out int numImported, out int numSkipped) { //No need to check RemotingRole; no call to db. string[] feeLines = feeData.Split('\n'); numImported = 0; numSkipped = 0; List <Fee> listFees = Fees.GetListExact(feeSched.FeeSchedNum, clinicNum, provNum); List <Fee> listFeesImported = new List <Fee>(listFees); for (int i = 0; i < feeLines.Length; i++) { string[] fields = feeLines[i].Split('\t'); if (fields.Length > 1) // && fields[1]!=""){//we no longer skip blank fees { string procCode = fields[0]; if (ProcedureCodes.IsValidCode(procCode)) { long codeNum = ProcedureCodes.GetCodeNum(procCode); Fee fee = Fees.GetFee(codeNum, feeSched.FeeSchedNum, clinicNum, provNum, listFees); //gets best match if (fields[1] == "") //an empty entry will delete an existing fee, but not insert a blank override { if (fee == null) //nothing to do { } else { //doesn't matter if the existing fee is an override or not. Fees.Delete(fee); listFeesImported.Remove(fee); } } else //value found in text file { if (fee == null) //no current fee { fee = new Fee(); fee.Amount = PIn.Double(fields[1], doUseEnUSFormat: true); //The fees are always in the format "1.00" so we need to parse accordingly. fee.FeeSched = feeSched.FeeSchedNum; fee.CodeNum = codeNum; fee.ClinicNum = clinicNum; fee.ProvNum = provNum; Fees.Insert(fee); listFeesImported.Add(fee); } else { fee.Amount = PIn.Double(fields[1], doUseEnUSFormat: true); Fees.Update(fee); } } numImported++; } else { numSkipped++; } FeeSchedEvent.Fire(ODEventType.FeeSched, new ProgressBarHelper(Lans.g("FeeScheds", "Processing fees, please wait") + "...", "", (numImported + numSkipped), feeLines.Length, ProgBarStyle.Continuous)); } } return(listFeesImported); }
private void gridMain_CellDoubleClick(object sender,ODGridClickEventArgs e) { if(IsSelectionMode){ SelectedCodeNum=PIn.Long(ProcTable.Rows[e.Row]["CodeNum"].ToString()); DialogResult=DialogResult.OK; return; } //else not selecting a code if(!Security.IsAuthorized(Permissions.Setup,DateTime.MinValue,true)){ return; } long codeNum=PIn.Long(ProcTable.Rows[e.Row]["CodeNum"].ToString()); //string =ProcTable.Rows[e.Row]["ProcCode"].ToString(); if(e.Col>3){//if double clicked on a fee Fee FeeCur=null; long feesched=0; if(e.Col==4){ feesched=FeeSchedC.ListShort[listFeeSched.SelectedIndex].FeeSchedNum; FeeCur=Fees.GetFee(codeNum,feesched); } if(e.Col==5) { if(comboCompare1.SelectedIndex==0){ return; } feesched=FeeSchedC.ListShort[comboCompare1.SelectedIndex-1].FeeSchedNum; FeeCur=Fees.GetFee(codeNum,feesched); } if(e.Col==6) { if(comboCompare2.SelectedIndex==0) { return; } feesched=FeeSchedC.ListShort[comboCompare2.SelectedIndex-1].FeeSchedNum; FeeCur=Fees.GetFee(codeNum,feesched); } FormFeeEdit FormFE=new FormFeeEdit(); if(FeeCur==null) { FeeCur=new Fee(); FeeCur.FeeSched=feesched; FeeCur.CodeNum=codeNum; Fees.Insert(FeeCur); //SecurityLog is updated in FormFeeEdit. FormFE.IsNew=true; } FormFE.FeeCur=FeeCur; FormFE.ShowDialog(); if(FormFE.DialogResult==DialogResult.OK) { Fees.RefreshCache(); changed=true; FillGrid(); } } else {//not on a fee: Edit code instead FormProcCodeEdit FormPCE=new FormProcCodeEdit(ProcedureCodes.GetProcCodeFromDb(codeNum)); FormPCE.IsNew=false; FormPCE.ShowDialog(); if(FormPCE.DialogResult==DialogResult.OK) { //ProcedureCodes.Refresh(); changed=true; //Fees.Refresh();//fees were already refreshed within procCodeEdit FillGrid(); } } }
private void butUpdateAllowed_Click(object sender, System.EventArgs e) { InsPlan plan=InsPlans.GetPlan(ClaimProcCur.PlanNum,PlanList); if(plan==null){ //this should never happen } if(plan.AllowedFeeSched==0 && plan.PlanType!="p"){ MsgBox.Show(this,"Plan must either be a PPO type or it must have an 'Allowed' fee schedule set."); return; } long feeSched=-1; if(plan.AllowedFeeSched!=0) { feeSched=plan.AllowedFeeSched; } else if(plan.PlanType=="p") { //The only other way to manually edit allowed fee schedule amounts is blocked via the Setup permission. //We only want to block PPO patients so that we don't partially break Blue Book users. if(!Security.IsAuthorized(Permissions.Setup)) { return; } feeSched=plan.FeeSched; } if(FeeScheds.GetIsHidden(feeSched)){ MsgBox.Show(this,"Allowed fee schedule is hidden, so no changes can be made."); return; } Fee FeeCur=Fees.GetFee(proc.CodeNum,feeSched); FormFeeEdit FormFE=new FormFeeEdit(); if(FeeCur==null){ FeeCur=new Fee(); FeeCur.FeeSched=feeSched; FeeCur.CodeNum=proc.CodeNum; Fees.Insert(FeeCur); //SecurityLog is updated in FormFeeEdit. FormFE.IsNew=true; } //Make an audit entry that the user manually launched the Fee Edit window from this location. SecurityLogs.MakeLogEntry(Permissions.ProcFeeEdit,0,Lan.g(this,"Procedure")+": "+ProcedureCodes.GetStringProcCode(FeeCur.CodeNum) +", "+Lan.g(this,"Fee: ")+""+FeeCur.Amount.ToString("c")+", "+Lan.g(this,"Fee Schedule")+": "+FeeScheds.GetDescription(FeeCur.FeeSched) +". "+Lan.g(this,"Manually launched Edit Fee window via Edit Claim Procedure window."),FeeCur.CodeNum); FormFE.FeeCur=FeeCur; FormFE.ShowDialog(); if(FormFE.DialogResult==DialogResult.OK){ Fees.RefreshCache(); DataValid.SetInvalid(InvalidType.Fees); } FillAllowed(); ComputeAmounts();//? }
///<summary>schedI is the currently displayed index of the fee schedule to save to. If an amt of -1 is passed in, then it indicates a "blank" entry which will cause deletion of any existing fee.</summary> public static void Import(string codeText,double amt,long feeSchedNum) { //No need to check RemotingRole; no call to db. if(!ProcedureCodes.IsValidCode(codeText)){ return;//skip for now. Possibly insert a code in a future version. } long feeNum=GetFeeNum(ProcedureCodes.GetCodeNum(codeText),feeSchedNum); if(feeNum>0) { Delete(feeNum); } if(amt==-1) { //RefreshCache(); return; } Fee fee=new Fee(); fee.Amount=amt; fee.FeeSched=feeSchedNum; fee.CodeNum=ProcedureCodes.GetCodeNum(codeText); Insert(fee); //RefreshCache();//moved this outside the loop }
///<summary>Construct a new fee key using the properties of the given fee.</summary> public FeeKey(Fee fee) : base(fee.FeeSched, fee.ClinicNum, fee.CodeNum, fee.ProvNum) { }
private void gridFees_CellDoubleClick(object sender,OpenDental.UI.ODGridClickEventArgs e) { Fee FeeCur=Fees.GetFee(ProcCode.CodeNum,FeeSchedC.ListShort[e.Row].FeeSchedNum); //tbFees.SelectedRow=e.Row; //tbFees.ColorRow(e.Row,Color.LightGray); FormFeeEdit FormFE=new FormFeeEdit(); if(FeeCur==null) { FeeCur=new Fee(); FeeCur.FeeSched=FeeSchedC.ListShort[e.Row].FeeSchedNum; FeeCur.CodeNum=ProcCode.CodeNum; Fees.Insert(FeeCur); FormFE.IsNew=true; } FormFE.FeeCur=FeeCur; FormFE.ShowDialog(); if(FormFE.DialogResult==DialogResult.OK) { FeeChanged=true; } Fees.RefreshCache(); //tbFees.SelectedRow=-1; FillFees(); }
private void SaveAllowedFees(){ //if no allowed fees entered, then nothing to do bool allowedFeesEntered=false; for(int i=0;i<gridMain.Rows.Count;i++){ if(gridMain.Rows[i].Cells[_allowedIdx].Text!=""){ allowedFeesEntered=true; break; } } if(!allowedFeesEntered){ return; } //if no allowed fee schedule, then nothing to do InsPlan plan=InsPlans.GetPlan(ClaimProcsToEdit[0].PlanNum,PlanList); if(plan.AllowedFeeSched==0){//no allowed fee sched //plan.PlanType!="p" && //not ppo, and return; } //ask user if they want to save the fees if(!MsgBox.Show(this,true,"Save the allowed amounts to the allowed fee schedule?")){ return; } //select the feeSchedule long feeSched=-1; //if(plan.PlanType=="p"){//ppo // feeSched=plan.FeeSched; //} //else if(plan.AllowedFeeSched!=0){//an allowed fee schedule exists feeSched=plan.AllowedFeeSched; //} if(FeeScheds.GetIsHidden(feeSched)){ MsgBox.Show(this,"Allowed fee schedule is hidden, so no changes can be made."); return; } Fee FeeCur=null; long codeNum; List<Procedure> ProcList=Procedures.Refresh(PatCur.PatNum); Procedure proc; for(int i=0;i<ClaimProcsToEdit.Length;i++){ proc=Procedures.GetProcFromList(ProcList,ClaimProcsToEdit[i].ProcNum); codeNum=proc.CodeNum; //ProcNum not found or 0 for payments if(codeNum==0){ continue; } FeeCur=Fees.GetFee(codeNum,feeSched); if(FeeCur==null){ FeeCur=new Fee(); FeeCur.FeeSched=feeSched; FeeCur.CodeNum=codeNum; FeeCur.Amount=PIn.Double(gridMain.Rows[i].Cells[_allowedIdx].Text); Fees.Insert(FeeCur); } else{ FeeCur.Amount=PIn.Double(gridMain.Rows[i].Cells[_allowedIdx].Text); Fees.Update(FeeCur); } SecurityLogs.MakeLogEntry(Permissions.ProcFeeEdit,0,Lan.g(this,"Procedure")+": "+ProcedureCodes.GetStringProcCode(FeeCur.CodeNum) +", "+Lan.g(this,"Fee: ")+""+FeeCur.Amount.ToString("c")+", "+Lan.g(this,"Fee Schedule")+" "+FeeScheds.GetDescription(FeeCur.FeeSched) +". "+Lan.g(this,"Automatic change to allowed fee in Enter Payment window. Confirmed by user."),FeeCur.CodeNum); } //Fees.Refresh();//redundant? DataValid.SetInvalid(InvalidType.Fees); }