Code: Select all
Index: OpenDental/Main Modules/ContrChart.cs
===================================================================
--- OpenDental/Main Modules/ContrChart.cs (revision 2972)
+++ OpenDental/Main Modules/ContrChart.cs (working copy)
@@ -4681,10 +4681,25 @@
}
else {
InsPlan priplan=null;
- if(PatPlanList.Count>0) {
- priplan=InsPlans.GetPlan(PatPlanList[0].PlanNum,PlanList);
- }
- double insfee=Fees.GetAmount0(ProcCur.CodeNum,Fees.GetFeeSched(PatCur,PlanList,PatPlanList));
+ //check code to see if it is a medical code
+ double insfee;
+ bool isMed = false;
+ if (ProcCur.MedicalCode != ""){
+ isMed = true;
+ }
+ //get fee schedule for medical ins or Fees.GetFeeSched if dental
+ int feeSch;
+ if (isMed){
+ feeSch = Fees.GetMedFeeSched(PatCur, PlanList, PatPlanList);
+ } else {
+ feeSch = Fees.GetFeeSched(PatCur, PlanList, PatPlanList);
+ }
+
+ insfee = Fees.GetAmount0(ProcCur.CodeNum, feeSch);
+ //if(PatPlanList.Count>0) {
+ // priplan=InsPlans.GetPlan(PatPlanList[0].PlanNum,PlanList);
+ //}
+ //double insfee=Fees.GetAmount0(ProcCur.CodeNum,Fees.GetFeeSched(PatCur,PlanList,PatPlanList));
if(priplan!=null && priplan.PlanType=="p") {//PPO
double standardfee=Fees.GetAmount0(ProcCur.CodeNum,Providers.GetProv(Patients.GetProvNum(PatCur)).FeeSched);
if(standardfee>insfee) {
Index: OpenDental/Main Modules/ContrTreat.cs
===================================================================
--- OpenDental/Main Modules/ContrTreat.cs (revision 2972)
+++ OpenDental/Main Modules/ContrTreat.cs (working copy)
@@ -2320,7 +2320,25 @@
procCur=ProcListTP[i];
//procOld=procCur.Copy();
//first the fees
- insfee=Fees.GetAmount0(procCur.CodeNum,Fees.GetFeeSched(PatCur,InsPlanList,PatPlanList));
+ //check code to see if it is a medical code
+ bool isMed = false;
+ if (procCur.MedicalCode != "")
+ {
+ isMed = true;
+ }
+ //get fee schedule for medical ins or Fees.GetFeeSched if dental
+ int feeSch;
+ if (isMed)
+ {
+ feeSch = Fees.GetMedFeeSched(PatCur, InsPlanList, PatPlanList);
+ }
+ else
+ {
+ feeSch = Fees.GetFeeSched(PatCur, InsPlanList, PatPlanList);
+ }
+
+ insfee = Fees.GetAmount0(procCur.CodeNum, feeSch);
+
if(priplan!=null && priplan.PlanType=="p") {//PPO
standardfee=Fees.GetAmount0(procCur.CodeNum,Providers.GetProv(Patients.GetProvNum(PatCur)).FeeSched);
if(standardfee>insfee) {
Index: OpenDentBusiness/Data Interface/Fees.cs
===================================================================
--- OpenDentBusiness/Data Interface/Fees.cs (revision 2972)
+++ OpenDentBusiness/Data Interface/Fees.cs (working copy)
@@ -190,6 +190,50 @@
return ProviderC.ListLong[Providers.GetIndexLong(patPriProvNum)].FeeSched;
}
+ ///<summary>Gets the fee schedule from the primary MEDICAL insurance plan, the patient, or the provider in that order.</summary>
+ public static int GetMedFeeSched(Patient pat,List <InsPlan> PlanList,List <PatPlan> patPlans){
+ //No need to check RemotingRole; no call to db. ??
+ int retVal = 0;
+ if (PatPlans.GetPlanNum(patPlans, 1) != 0)
+ {
+ //Pick the medinsplan with the ordinal closest to zero
+ int planOrdinal=10; //This is a hack, but I doubt anyone would have more than 10 plans
+ foreach(PatPlan plan in patPlans){
+ if(plan.Ordinal<planOrdinal && InsPlans.GetPlan(plan.PlanNum,PlanList).IsMedical)
+ planOrdinal=plan.Ordinal;
+ }
+ InsPlan PlanCur = InsPlans.GetPlan(PatPlans.GetPlanNum(patPlans, planOrdinal), PlanList);
+ if (PlanCur == null)
+ {
+ retVal = 0;
+ }
+ else
+ {
+ retVal = PlanCur.FeeSched;
+ }
+ }
+ if (retVal == 0)
+ {
+ if (pat.FeeSched != 0)
+ {
+ retVal = pat.FeeSched;
+ }
+ else
+ {
+ if (pat.PriProv == 0)
+ {
+ retVal = ProviderC.List[0].FeeSched;
+ }
+ else
+ {
+ //MessageBox.Show(Providers.GetIndex(Patients.Cur.PriProv).ToString());
+ retVal = ProviderC.ListLong[Providers.GetIndexLong(pat.PriProv)].FeeSched;
+ }
+ }
+ }
+ return retVal;
+ }
+
///<summary>Clears all fees from one fee schedule. Supply the DefNum of the feeSchedule.</summary>
public static void ClearFeeSched(int schedNum){
if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
@@ -263,4 +307,4 @@
public int feeSchedNum;
}
-}
\ No newline at end of file
+}