///<summary>Gets the fee schedule from the primary MEDICAL insurance plan, ///the first insurance plan, the patient, or the provider in that order.</summary> public static long GetMedFeeSched(Patient pat, List <InsPlan> planList, List <PatPlan> patPlans, List <InsSub> subList, long procProvNum) { //No need to check RemotingRole; no call to db. long retVal = 0; if (PatPlans.GetInsSubNum(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 bool hasMedIns = false; //Keep track of whether we found a medical insurance plan, if not use dental insurance fee schedule. InsSub subCur; foreach (PatPlan patplan in patPlans) { subCur = InsSubs.GetSub(patplan.InsSubNum, subList); if (patplan.Ordinal < planOrdinal && InsPlans.GetPlan(subCur.PlanNum, planList).IsMedical) { planOrdinal = patplan.Ordinal; hasMedIns = true; } } if (!hasMedIns) //If this patient doesn't have medical insurance (under ordinal 10) { return(GetFeeSched(pat, planList, patPlans, subList, procProvNum)); //Use dental insurance fee schedule } subCur = InsSubs.GetSub(PatPlans.GetInsSubNum(patPlans, planOrdinal), subList); InsPlan PlanCur = InsPlans.GetPlan(subCur.PlanNum, 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 = Providers.GetFirst(true).FeeSched; } else { Provider providerFirst = Providers.GetFirst(); //Used in order to preserve old behavior... If this fails, then old code would have failed. Provider provider = Providers.GetFirstOrDefault(x => x.ProvNum == pat.PriProv) ?? providerFirst; retVal = provider.FeeSched; } } } return(retVal); }
///<summary>Gets the fee schedule from the primary MEDICAL insurance plan, the patient, or the provider in that order.</summary> public static long GetMedFeeSched(Patient pat, List <InsPlan> planList, List <PatPlan> patPlans, List <InsSub> subList) { //No need to check RemotingRole; no call to db. ?? long retVal = 0; if (PatPlans.GetInsSubNum(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 InsSub subCur; foreach (PatPlan patplan in patPlans) { subCur = InsSubs.GetSub(patplan.InsSubNum, subList); if (patplan.Ordinal < planOrdinal && InsPlans.GetPlan(subCur.PlanNum, planList).IsMedical) { planOrdinal = patplan.Ordinal; } } subCur = InsSubs.GetSub(PatPlans.GetInsSubNum(patPlans, planOrdinal), subList); InsPlan PlanCur = InsPlans.GetPlan(subCur.PlanNum, 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.ListShort[0].FeeSched; } else { //MessageBox.Show(Providers.GetIndex(Patients.Cur.PriProv).ToString()); retVal = ProviderC.ListLong[Providers.GetIndexLong(pat.PriProv)].FeeSched; } } } return(retVal); }
///<summary>Gets the fee schedule from the first insplan, the patient, or the provider in that order. Either returns a fee schedule (fk to definition.DefNum) or 0.</summary> public static long GetFeeSched(Patient pat, List <InsPlan> planList, List <PatPlan> patPlans, List <InsSub> subList) { //No need to check RemotingRole; no call to db. //there's not really a good place to put this function, so it's here. long retVal = 0; if (PatPlans.GetInsSubNum(patPlans, 1) != 0) { InsSub SubCur = InsSubs.GetSub(PatPlans.GetInsSubNum(patPlans, 1), subList); InsPlan PlanCur = InsPlans.GetPlan(SubCur.PlanNum, 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.ListShort[0].FeeSched; } else { //MessageBox.Show(Providers.GetIndex(Patients.Cur.PriProv).ToString()); retVal = ProviderC.ListLong[Providers.GetIndexLong(pat.PriProv)].FeeSched; } } } return(retVal); }