Example #1
0
        ///<summary>Returns -1 if no allowed feeschedule or fee unknown for this procCode. Otherwise, returns the allowed fee including 0. Can handle a planNum of 0.  Tooth num is used for posterior composites.  It can be left blank in some situations.  Provider must be supplied in case plan has no assigned fee schedule.  Then it will use the fee schedule for the provider.</summary>
        public static double GetAllowed(string procCode, int planNum, InsPlan[] PlanList, string toothNum, int provNum)
        {
            if (planNum == 0)
            {
                return(-1);
            }
            InsPlan plan = GetPlan(planNum, PlanList);

            if (plan == null)
            {
                return(-1);
            }
            int codeNum      = ProcedureCodes.GetCodeNum(procCode);
            int substCodeNum = ProcedureCodes.GetSubstituteCodeNum(procCode, toothNum);         //for posterior composites

            if (plan.PlanType == "p")
            {
                return(Fees.GetAmount(codeNum, plan.FeeSched));
            }
            if (plan.AllowedFeeSched != 0)                                  //if an allowed fee schedule exists
            {
                return(Fees.GetAmount(substCodeNum, plan.AllowedFeeSched)); //whether post composite or not
            }
            //ordinary fee schedule
            if (codeNum == substCodeNum)
            {
                return(-1);
            }
            //posterior composite
            //we're going to make a little shortcut here.  If the fe
            if (plan.FeeSched == 0)
            {
                return(Fees.GetAmount(substCodeNum, Providers.GetProv(provNum).FeeSched));
            }
            return(Fees.GetAmount(substCodeNum, plan.FeeSched));
        }