Page 1 of 1

Patch...

Posted: Tue Aug 25, 2009 4:09 am
by fdscadmin
Where do I send a proposed patch? This will pull fees from the medical ins if it is a medical procedure...thanks. I know the formatting is ugly, and I can correct it. I just want to get an idea of the process. I used to have commit priv, but don't think I still do.

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
+}

Re: Patch...

Posted: Tue Aug 25, 2009 8:07 am
by jordansparks
There's something wrong with that patch. I saved it to the the head as med.patch, right click, apply patch. It tries to apply the patch to revision 2972, but the patch doesn't match revision 2972. I'm assuming you did an update before creating the patch, so I'm not quite sure what the problem is. There also does seem to be whitespace formatting issues in the patch, leading spaces instead of tabs. I could manually cut and paste, or you could try again. Either way works fine for me.

Re: Patch...

Posted: Tue Aug 25, 2009 7:16 pm
by fdscadmin
Ok, I will re-submit the patch with the formatting corrected. I just wasn't exactly sure of the commit process anymore. I was also working with the latest stable version (6.6.25). I will create a patch from HEAD. Is there any way to "deploy" a stable (6.6.25) version with a patch and still stay inline with Open-Dent main? I ask because I don't like to be on the bleeding edge, but I do need this patch.

thanks
david

Re: Patch...

Posted: Tue Aug 25, 2009 8:48 pm
by jordansparks
We can't be adding new features to anything but the head. So this would go into 6.8. That explains why the patch wasn't working for me. We release pretty quickly. Seems like the users could just manually change the numbers until 6.8 comes out.

Re: Patch...

Posted: Wed Aug 26, 2009 12:12 am
by fdscadmin
OK, I fixed the tab to space conversion and did the commit. Is 6.8 going to be rolled out soon?

Re: Patch...

Posted: Wed Aug 26, 2009 1:11 am
by jordansparks
Well, that's interesting. Looks like you are still able to commit. You know I can't answer a question like that.

Re: Patch...

Posted: Wed Aug 26, 2009 1:17 am
by fdscadmin
You know I can't answer a question like that.
Oh, I didn't know. I'm not on the boards a lot so I am a bit out of the loop.