Exemplo n.º 1
0
        public void InsPlan_GetPendingDisplay_LimitationsOverrideGeneralLimitations()
        {
            string  suffix     = "31";
            Patient pat        = PatientT.CreatePatient(suffix);
            long    patNum     = pat.PatNum;
            Carrier carrier    = CarrierT.CreateCarrier(suffix);
            InsPlan plan       = InsPlanT.CreateInsPlan(carrier.CarrierNum);
            long    planNum    = plan.PlanNum;
            InsSub  sub        = InsSubT.CreateInsSub(pat.PatNum, planNum); //guarantor is subscriber
            long    subNum     = sub.InsSubNum;
            long    patPlanNum = PatPlanT.CreatePatPlan(1, pat.PatNum, subNum).PatPlanNum;

            BenefitT.CreateAnnualMax(planNum, 1000);
            BenefitT.CreateCategoryPercent(planNum, EbenefitCategory.RoutinePreventive, 100);
            BenefitT.CreateLimitation(planNum, EbenefitCategory.RoutinePreventive, 1000);        //Changing this amount would affect patient portion vs ins portion.  But regardless of the amount, this should prevent any pending from showing in the box, which is for general pending only.
            Procedure proc = ProcedureT.CreateProcedure(pat, "D1110", ProcStat.C, "", 125);      //Prophy
            //Lists
            List <ClaimProc>     claimProcs  = ClaimProcs.Refresh(pat.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(pat.PatNum);
            Claim                claim       = ClaimT.CreateClaim("P", patPlans, planList, claimProcs, ProcList, pat, ProcList, benefitList, subList);//Creates the claim in the same manner as the account module, including estimates and status NotReceived.
            List <ClaimProcHist> histList    = ClaimProcs.GetHistList(patNum, benefitList, patPlans, planList, DateTime.Today, subList);

            //Validate
            Assert.AreEqual(0, InsPlans.GetPendingDisplay(histList, DateTime.Today, plan, patPlanNum, -1, patNum, subNum, benefitList));
        }
Exemplo n.º 2
0
        public void InsPlan_GetInsUsedDisplay_LimitationsOverride()
        {
            string  suffix     = "6";
            Patient pat        = PatientT.CreatePatient(suffix);
            long    patNum     = pat.PatNum;
            Carrier carrier    = CarrierT.CreateCarrier(suffix);
            InsPlan plan       = InsPlanT.CreateInsPlan(carrier.CarrierNum);
            long    planNum    = plan.PlanNum;
            InsSub  sub        = InsSubT.CreateInsSub(pat.PatNum, planNum); //guarantor is subscriber
            long    subNum     = sub.InsSubNum;
            long    patPlanNum = PatPlanT.CreatePatPlan(1, pat.PatNum, subNum).PatPlanNum;

            BenefitT.CreateAnnualMax(planNum, 1000);
            BenefitT.CreateLimitation(planNum, EbenefitCategory.Diagnostic, 1000);
            Procedure proc    = ProcedureT.CreateProcedure(pat, "D0120", ProcStat.C, "", 50);   //An exam
            long      procNum = proc.ProcNum;
            Procedure proc2   = ProcedureT.CreateProcedure(pat, "D2750", ProcStat.C, "8", 830); //create a crown

            ClaimProcT.AddInsPaid(patNum, planNum, procNum, 50, subNum, 0, 0);
            ClaimProcT.AddInsPaid(patNum, planNum, proc2.ProcNum, 400, subNum, 0, 0);
            //Lists
            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    = ClaimProcs.GetHistList(patNum, benefitList, patPlans, planList, DateTime.Today, subList);
            //Validate
            double insUsed = InsPlans.GetInsUsedDisplay(histList, DateTime.Today, planNum, patPlanNum, -1, planList, benefitList, patNum, subNum);

            Assert.AreEqual(400, insUsed);
        }
Exemplo n.º 3
0
        public void InsPlan_GetInsUsedDisplay_OrthoProcsNotAffectInsUsed()
        {
            string  suffix  = "13";
            Patient pat     = PatientT.CreatePatient(suffix);
            Carrier carrier = CarrierT.CreateCarrier(suffix);
            InsPlan plan    = InsPlanT.CreateInsPlan(carrier.CarrierNum);
            InsSub  sub     = InsSubT.CreateInsSub(pat.PatNum, plan.PlanNum);
            long    subNum  = sub.InsSubNum;
            PatPlan patPlan = PatPlanT.CreatePatPlan(1, pat.PatNum, subNum);

            BenefitT.CreateAnnualMax(plan.PlanNum, 100);
            BenefitT.CreateOrthoMax(plan.PlanNum, 500);
            BenefitT.CreateCategoryPercent(plan.PlanNum, EbenefitCategory.Diagnostic, 100);
            BenefitT.CreateCategoryPercent(plan.PlanNum, EbenefitCategory.Orthodontics, 100);
            Procedure proc1 = ProcedureT.CreateProcedure(pat, "D0140", ProcStat.C, "", 59);      //limEx
            Procedure proc2 = ProcedureT.CreateProcedure(pat, "D8090", ProcStat.C, "", 348);     //Comprehensive ortho

            ClaimProcT.AddInsPaid(pat.PatNum, plan.PlanNum, proc1.ProcNum, 59, subNum, 0, 0);
            ClaimProcT.AddInsPaid(pat.PatNum, plan.PlanNum, proc2.ProcNum, 348, subNum, 0, 0);
            //Lists
            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    = ClaimProcs.GetHistList(pat.PatNum, benefitList, patPlans, planList, DateTime.Today, subList);
            //Validate
            double insUsed = InsPlans.GetInsUsedDisplay(histList, DateTime.Today, plan.PlanNum, patPlan.PatPlanNum, -1, planList, benefitList, pat.PatNum, subNum);

            Assert.AreEqual(59, insUsed);
        }
Exemplo n.º 4
0
        public void InsPlans_ComputeEstimatesForSubscriber_CanadianLabFees()
        {
            string      suffix     = MethodBase.GetCurrentMethod().Name;
            CultureInfo curCulture = CultureInfo.CurrentCulture;

            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-CA");          //Canada
            try {
                //Create a patient and treatment plan a procedure with a lab fee.
                Patient pat = PatientT.CreatePatient();
                ProcedureCodeT.AddIfNotPresent("14611");
                ProcedureCodeT.AddIfNotPresent("99111", isCanadianLab: true);
                Procedure proc    = ProcedureT.CreateProcedure(pat, "14611", ProcStat.TP, "", 250);
                Procedure procLab = ProcedureT.CreateProcedure(pat, "99111", ProcStat.TP, "", 149, procNumLab: proc.ProcNum);
                //Create a new primary insurance plan for this patient.
                //It is important that we add the insurance plan after the procedure has already been created for this particular scenario.
                Carrier carrier = CarrierT.CreateCarrier(suffix);
                InsPlan plan    = InsPlanT.CreateInsPlan(carrier.CarrierNum);
                InsSub  sub     = InsSubT.CreateInsSub(pat.PatNum, plan.PlanNum);
                PatPlan patPlan = PatPlanT.CreatePatPlan(1, pat.PatNum, sub.InsSubNum);
                //Invoking ComputeEstimatesForAll() will simulate the logic of adding a new insurance plan from the Family module.
                //The bug that this unit test is preventing is that a duplicate claimproc was being created for the lab fee.
                //This was causing a faux line to show up when a claim was created for the procedure in question.
                //It ironically doesn't matter if the procedures above are even covered by insurance because they'll get claimprocs created regardless.
                InsPlans.ComputeEstimatesForSubscriber(sub.Subscriber);
                //Check to see how many claimproc enteries there are for the current patient.  There should only be two.
                List <ClaimProc> listClaimProcs = ClaimProcs.Refresh(pat.PatNum);
                Assert.AreEqual(2, listClaimProcs.Count);
            }
            finally {
                Thread.CurrentThread.CurrentCulture = curCulture;
            }
        }
Exemplo n.º 5
0
        public void InsPlans_GetAllowed_NoFeeSched()
        {
            Carrier carrier = CarrierT.CreateCarrier(MethodBase.GetCurrentMethod().Name);
            InsPlan plan    = new InsPlan();

            plan.CarrierNum = carrier.CarrierNum;
            plan.PlanType   = "";
            plan.CobRule    = EnumCobRule.Basic;
            plan.PlanNum    = InsPlans.Insert(plan);
            ProcedureCode procCode = _listProcCodes[13];

            procCode.SubstitutionCode = _listProcCodes[14].ProcCode;
            ProcedureCodes.Update(procCode);
            ProcedureCodes.RefreshCache();
            Provider prov         = Providers.GetProv(PrefC.GetLong(PrefName.PracticeDefaultProv));
            long     provFeeSched = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, MethodBase.GetCurrentMethod().Name);

            prov.FeeSched = provFeeSched;
            Providers.Update(prov);
            Providers.RefreshCache();
            Fee defaultFee = FeeT.GetNewFee(Providers.GetProv(PrefC.GetLong(PrefName.PracticeDefaultProv)).FeeSched,
                                            ProcedureCodes.GetSubstituteCodeNum(procCode.ProcCode, "", plan.PlanNum), 80);
            double amt = InsPlans.GetAllowed(procCode.ProcCode, plan.FeeSched, plan.AllowedFeeSched, plan.CodeSubstNone, plan.PlanType, "", 0, 0, plan.PlanNum);

            Assert.AreEqual(defaultFee.Amount, amt);
        }
Exemplo n.º 6
0
        public void Fees_GetListFromObjects_InsPlanCopayFeeSched()
        {
            string        suffix        = MethodBase.GetCurrentMethod().Name;
            ProcedureCode procedureCode = ProcedureCodeT.CreateProcCode("D1110");
            Fee           fee           = CreateSingleFee(suffix, (_defaultFeeAmt * _rand.NextDouble()), hasProv: true, codeNum: procedureCode.CodeNum);
            //Create an insurance plan and associate the copay fee schedule to the fee schedule that was just created.
            InsPlan insPlan = InsPlanT.CreateInsPlan(0, copayFeeSched: fee.FeeSched);
            //Act like an ins plan has our fee schedule which should return the corresponding fees by GetListFromObjects().
            List <Fee> listFees = Fees.GetListFromObjects(new List <ProcedureCode>()
            {
                procedureCode
            },
                                                          null,
                                                          null,
                                                          0,
                                                          0,
                                                          0,
                                                          new List <InsPlan>()
            {
                insPlan
            },
                                                          null,
                                                          null,
                                                          null,
                                                          0);

            Assert.IsTrue(listFees.Exists(x => x.FeeNum == fee.FeeNum));
        }
Exemplo n.º 7
0
 ///<summary>Inserts one InsPlan into the database.  Returns the new priKey.</summary>
 internal static long Insert(InsPlan insPlan)
 {
     if(DataConnection.DBtype==DatabaseType.Oracle) {
         insPlan.PlanNum=DbHelper.GetNextOracleKey("insplan","PlanNum");
         int loopcount=0;
         while(loopcount<100){
             try {
                 return Insert(insPlan,true);
             }
             catch(Oracle.DataAccess.Client.OracleException ex){
                 if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){
                     insPlan.PlanNum++;
                     loopcount++;
                 }
                 else{
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else {
         return Insert(insPlan,false);
     }
 }
Exemplo n.º 8
0
        ///<summary>Attempts to request benefits.  If successful the 270 request is returned.
        ///Otherwise null is returned and the out error string will contain more information.  Mimics FormInsPlan.butGetElectronic_Click().</summary>
        public static Etrans TryInsVerifyRequest(InsVerify insVerify, InsPlan insPlan, Carrier carrier, InsSub insSub, out string error)
        {
            error = "";
            Etrans        etrans270Request = null;
            Clearinghouse clearinghouseHq  = Clearinghouses.GetDefaultEligibility();

            if (clearinghouseHq == null)
            {
                error = "No clearinghouse is set as default.";
                return(null);
            }
            if (!clearinghouseHq.CommBridge.In(EclaimsCommBridge.ClaimConnect, EclaimsCommBridge.EDS, EclaimsCommBridge.WebMD))
            {
                error = "So far, eligibility checks only work with ClaimConnect, EDS, WebMD (Emdeon Dental), and CDAnet.";
                return(null);
            }
            error = X271.ValidateSettings();
            if (error.IsNullOrEmpty())
            {
                Clearinghouse clearinghouse = Clearinghouses.OverrideFields(clearinghouseHq, insVerify.ClinicNum);             //ClinicNum pulled from appointment.
                try {
                    //Can return null, can throw exceptions
                    etrans270Request = x270Controller.RequestBenefits(clearinghouse, insPlan, insVerify.PatNum, carrier, insSub, out error);
                }
                catch (Exception ex) {
                    error = ex.Message;
                }
            }
            return(etrans270Request);
        }
Exemplo n.º 9
0
        private List <InsPlan> MapReaderToInsPlanList(SqlDataReader reader, bool includeIcd9Status)
        {
            var     data = new List <InsPlan>();
            InsPlan plan = null;

            if (reader != null && !reader.IsClosed)
            {
                while (reader.Read())
                {
                    var planId        = reader.GetString(reader.GetOrdinal("InsPlanId"));
                    var insCoId       = reader.GetString(reader.GetOrdinal("InsCoId"));
                    var insCoDesc     = reader.GetString(reader.GetOrdinal("InsCoDesc"));
                    var icd9Count     = reader.GetInt32(reader.GetOrdinal("Icd9Count"));
                    var insCoIdAlt    = !reader.IsDBNull(reader.GetOrdinal("InsCoIdAlternate")) ? reader.GetString(reader.GetOrdinal("InsCoIdAlternate")) : null;
                    var insCoDescAlt  = !reader.IsDBNull(reader.GetOrdinal("InsCoDescAlternate")) ? reader.GetString(reader.GetOrdinal("InsCoDescAlternate")) : null;
                    var enabledOnIcd9 = includeIcd9Status ? reader.GetInt32(reader.GetOrdinal("EnabledOnIcd9")) : 0;

                    plan = new InsPlan()
                    {
                        planId        = planId,
                        insCoId       = insCoId,
                        insCoDesc     = insCoDesc,
                        icd9Count     = icd9Count,
                        insCoIdAlt    = insCoIdAlt,
                        insCoDescAlt  = insCoDescAlt,
                        enabledOnIcd9 = enabledOnIcd9 == 1 ? true : false
                    };
                    data.Add(plan);
                }
                reader.Close();
            }
            return(data);
        }
Exemplo n.º 10
0
        public static string RunOne(bool showForms)
        {
            string  retVal  = "";
            long    provNum = ProviderC.ListShort[0].ProvNum;       //dentist #1
            Patient pat     = Patients.GetPat(PatientTC.PatNum1);   //patient#1

            if (pat.PriProv != provNum)
            {
                Patient oldPat = pat.Copy();
                pat.PriProv = provNum;              //this script uses the primary provider for the patient
                Patients.Update(pat, oldPat);
            }
            PatPlan patplan = PatPlans.GetPatPlan(pat.PatNum, 1);
            InsSub  sub     = InsSubs.GetOne(patplan.InsSubNum);
            InsPlan plan    = InsPlans.GetPlan(sub.PlanNum, new List <InsPlan>());
            //the UI would block this due to carrier not supporting this transaction type.
            Clearinghouse    clearinghouseHq   = Clearinghouses.GetDefaultDental();
            Clearinghouse    clearinghouseClin = Clearinghouses.OverrideFields(clearinghouseHq, Clinics.ClinicNum);
            long             etransNum         = CanadianOutput.SendElegibility(clearinghouseClin, pat.PatNum, plan, new DateTime(1999, 1, 1), patplan.Relationship, patplan.PatID, showForms, sub);
            Etrans           etrans            = Etranss.GetEtrans(etransNum);
            string           message           = EtransMessageTexts.GetMessageText(etrans.EtransMessageTextNum);
            CCDFieldInputter formData          = new CCDFieldInputter(message);
            string           responseStatus    = formData.GetValue("G05");

            if (responseStatus != "R")
            {
                throw new Exception("Should be R");
            }
            retVal += "Eligibility #1 successful.\r\n";
            return(retVal);
        }
Exemplo n.º 11
0
        ///<summary>Creates a general deductible of $50, a deductible of $50 on D0220, sets a $30 D0220 complete and creates a claim,
        ///creates a $100 D2750, that is TP'ed, and then creates a $30 D0220 that is TP'ed.</summary>
        ///<param name="actAssert">The first claimproc is for the D2750 and the second claimproc is for the second D0220.</param>
        public void GetDeductibleByCodeDeductLessThanGeneral(string suffix, Action <ClaimProc, ClaimProc> actAssert)
        {
            Patient pat = PatientT.CreatePatient(suffix);

            InsuranceT.AddInsurance(pat, suffix);
            List <InsSub>  listSubs     = InsSubT.GetInsSubs(pat);
            List <InsPlan> listPlans    = InsPlans.RefreshForSubList(listSubs);
            List <PatPlan> listPatPlans = PatPlans.Refresh(pat.PatNum);
            InsPlan        plan         = InsPlanT.GetPlanForPriSecMed(PriSecMed.Primary, listPatPlans, listPlans, listSubs);

            BenefitT.CreateDeductibleGeneral(plan.PlanNum, BenefitCoverageLevel.Individual, 50);
            BenefitT.CreateCategoryPercent(plan.PlanNum, EbenefitCategory.Diagnostic, 100);
            BenefitT.CreateCategoryPercent(plan.PlanNum, EbenefitCategory.Crowns, 50);
            BenefitT.CreateDeductible(plan.PlanNum, EbenefitCategory.Diagnostic, 0);
            BenefitT.CreateDeductible(plan.PlanNum, "D0220", 50);
            List <Benefit> listBens = Benefits.Refresh(listPatPlans, listSubs);
            Procedure      proc1    = ProcedureT.CreateProcedure(pat, "D0220", ProcStat.C, "", 30);//proc1 - Intraoral - periapical first film

            ClaimT.CreateClaim("P", listPatPlans, listPlans, new List <ClaimProc>(), new List <Procedure> {
                proc1
            }, pat, new List <Procedure> {
                proc1
            }, listBens,
                               listSubs);
            Procedure        proc2      = ProcedureT.CreateProcedure(pat, "D2750", ProcStat.TP, "", 100, priority: 0); //proc2 - Crown
            Procedure        proc3      = ProcedureT.CreateProcedure(pat, "D0220", ProcStat.TP, "", 30, priority: 1);  //proc3 - Intraoral - periapical first film
            List <ClaimProc> claimProcs = ProcedureT.ComputeEstimates(pat, listPatPlans, listPlans, listSubs, listBens);
            ClaimProc        claimProc2 = claimProcs.FirstOrDefault(x => x.ProcNum == proc2.ProcNum);
            ClaimProc        claimProc3 = claimProcs.FirstOrDefault(x => x.ProcNum == proc3.ProcNum);

            actAssert(claimProc2, claimProc3);
        }
Exemplo n.º 12
0
 private InsPlan InsertOrUpdateInsPlan(InsPlan insPlan, Hx834_Member member, Carrier carrier, bool isInsertAllowed = true)
 {
     //The code below mimics how insurance plans are created in ContrFamily.ToolButIns_Click().
     if (insPlan == null)
     {
         insPlan = new InsPlan();
         if (member.InsFiling != null)
         {
             insPlan.FilingCode = member.InsFiling.InsFilingCodeNum;
         }
         insPlan.GroupName            = "";
         insPlan.GroupNum             = member.GroupNum;
         insPlan.PlanNote             = "";
         insPlan.FeeSched             = 0;
         insPlan.PlanType             = "";
         insPlan.ClaimFormNum         = PrefC.GetLong(PrefName.DefaultClaimForm);
         insPlan.UseAltCode           = false;
         insPlan.ClaimsUseUCR         = false;
         insPlan.CopayFeeSched        = 0;
         insPlan.EmployerNum          = 0;
         insPlan.CarrierNum           = carrier.CarrierNum;
         insPlan.AllowedFeeSched      = 0;
         insPlan.TrojanID             = "";
         insPlan.DivisionNo           = "";
         insPlan.IsMedical            = false;
         insPlan.FilingCode           = 0;
         insPlan.DentaideCardSequence = 0;
         insPlan.ShowBaseUnits        = false;
         insPlan.CodeSubstNone        = false;
         insPlan.IsHidden             = false;
         insPlan.MonthRenew           = 0;
         insPlan.FilingCodeSubtype    = 0;
         insPlan.CanadianPlanFlag     = "";
         insPlan.CobRule            = EnumCobRule.Basic;
         insPlan.HideFromVerifyList = false;
         if (isInsertAllowed)
         {
             InsPlans.Insert(insPlan);
             SecurityLogs.MakeLogEntry(Permissions.InsPlanCreate, 0, "Insurance plan for carrier '" + carrier.CarrierName + "' and groupnum "
                                       + "'" + insPlan.GroupNum + "' created from Import Ins Plans 834.", insPlan.PlanNum, LogSources.InsPlanImport834,
                                       DateTime.MinValue);   //new insplan, no date needed
         }
     }
     else
     {
         InsPlan insPlanOld = insPlan.Copy();
         if (member.InsFiling != null)
         {
             insPlan.FilingCode = member.InsFiling.InsFilingCodeNum;
         }
         insPlan.GroupNum = member.GroupNum;
         if (OpenDentBusiness.Crud.InsPlanCrud.UpdateComparison(insPlan, insPlanOld))
         {
             InsPlans.Update(insPlan, insPlanOld);
             SecurityLogs.MakeLogEntry(Permissions.InsPlanEdit, 0, "Insurance plan for carrier '" + carrier.CarrierName + "' and groupnum "
                                       + "'" + insPlan.GroupNum + "' edited from Import Ins Plans 834.", insPlan.PlanNum, LogSources.InsPlanImport834, insPlanOld.SecDateTEdit);
         }
     }
     return(insPlan);
 }
Exemplo n.º 13
0
 ///<summary></summary>
 public FormInsPlanSelect(long patNum)
 {
     InitializeComponent();
     PatNum = patNum;
     //usage: eg. from coverage.  Since can be totally new subscriber, get all plans for them.
     FamCur              = Patients.GetFamily(PatNum);
     PatCur              = FamCur.GetPatient(PatNum);
     SubList             = InsSubs.RefreshForFam(FamCur);
     PlanList            = InsPlans.RefreshForSubList(SubList);
     _listPatCurPatPlans = PatPlans.Refresh(PatNum);
     if (_listPatCurPatPlans.Count == 1)
     {
         try {
             PatRelat     = _listPatCurPatPlans[0].Relationship;
             SelectedSub  = SubList.FirstOrDefault(x => x.InsSubNum == _listPatCurPatPlans[0].InsSubNum);
             SelectedPlan = InsPlans.GetPlan(SelectedSub.PlanNum, PlanList);
             if (SelectedSub == null || SelectedPlan == null)
             {
                 throw new ApplicationException();
             }
         }
         catch {
             PatRelat     = 0;
             SelectedSub  = null;
             SelectedPlan = null;
         }
     }
     //tbPlans.CellDoubleClicked += new OpenDental.ContrTable.CellEventHandler(tbPlans_CellDoubleClicked);
     Lan.F(this);
 }
Exemplo n.º 14
0
        public static InsuranceInfo AddInsurance(Patient pat, string carrierName, string planType = "", long feeSchedNum = 0, int ordinal = 1, bool isMedical = false,
                                                 EnumCobRule cobRule = EnumCobRule.Basic, long copayFeeSchedNum          = 0)
        {
            Carrier carrier = CarrierT.CreateCarrier(carrierName);
            InsPlan plan    = InsPlanT.CreateInsPlan(carrier.CarrierNum, cobRule);
            InsPlan planOld = plan.Copy();

            plan.PlanType      = planType;
            plan.FeeSched      = feeSchedNum;
            plan.IsMedical     = isMedical;
            plan.CopayFeeSched = copayFeeSchedNum;
            InsPlans.Update(plan, planOld);
            InsSub  sub     = InsSubT.CreateInsSub(pat.PatNum, plan.PlanNum);
            PatPlan patPlan = PatPlanT.CreatePatPlan((byte)ordinal, pat.PatNum, sub.InsSubNum);

            return(new InsuranceInfo {
                ListCarriers = new List <Carrier> {
                    carrier
                },
                ListInsPlans = new List <InsPlan> {
                    plan
                },
                ListInsSubs = new List <InsSub> {
                    sub
                },
                ListPatPlans = new List <PatPlan> {
                    patPlan
                },
            });
        }
Exemplo n.º 15
0
        ///<summary>Updates one InsPlan in the database.</summary>
        internal static void Update(InsPlan insPlan)
        {
            string command = "UPDATE insplan SET "
                             + "GroupName              = '" + POut.String(insPlan.GroupName) + "', "
                             + "GroupNum               = '" + POut.String(insPlan.GroupNum) + "', "
                             + "PlanNote               = '" + POut.String(insPlan.PlanNote) + "', "
                             + "FeeSched               =  " + POut.Long(insPlan.FeeSched) + ", "
                             + "PlanType               = '" + POut.String(insPlan.PlanType) + "', "
                             + "ClaimFormNum           =  " + POut.Long(insPlan.ClaimFormNum) + ", "
                             + "UseAltCode             =  " + POut.Bool(insPlan.UseAltCode) + ", "
                             + "ClaimsUseUCR           =  " + POut.Bool(insPlan.ClaimsUseUCR) + ", "
                             + "CopayFeeSched          =  " + POut.Long(insPlan.CopayFeeSched) + ", "
                             + "EmployerNum            =  " + POut.Long(insPlan.EmployerNum) + ", "
                             + "CarrierNum             =  " + POut.Long(insPlan.CarrierNum) + ", "
                             + "AllowedFeeSched        =  " + POut.Long(insPlan.AllowedFeeSched) + ", "
                             + "TrojanID               = '" + POut.String(insPlan.TrojanID) + "', "
                             + "DivisionNo             = '" + POut.String(insPlan.DivisionNo) + "', "
                             + "IsMedical              =  " + POut.Bool(insPlan.IsMedical) + ", "
                             + "FilingCode             =  " + POut.Long(insPlan.FilingCode) + ", "
                             + "DentaideCardSequence   =  " + POut.Byte(insPlan.DentaideCardSequence) + ", "
                             + "ShowBaseUnits          =  " + POut.Bool(insPlan.ShowBaseUnits) + ", "
                             + "CodeSubstNone          =  " + POut.Bool(insPlan.CodeSubstNone) + ", "
                             + "IsHidden               =  " + POut.Bool(insPlan.IsHidden) + ", "
                             + "MonthRenew             =  " + POut.Byte(insPlan.MonthRenew) + ", "
                             + "FilingCodeSubtype      =  " + POut.Long(insPlan.FilingCodeSubtype) + ", "
                             + "CanadianPlanFlag       = '" + POut.String(insPlan.CanadianPlanFlag) + "', "
                             + "CanadianDiagnosticCode = '" + POut.String(insPlan.CanadianDiagnosticCode) + "', "
                             + "CanadianInstitutionCode= '" + POut.String(insPlan.CanadianInstitutionCode) + "', "
                             + "RxBIN                  = '" + POut.String(insPlan.RxBIN) + "', "
                             + "CobRule                =  " + POut.Int((int)insPlan.CobRule) + " "
                             + "WHERE PlanNum = " + POut.Long(insPlan.PlanNum);

            Db.NonQ(command);
        }
Exemplo n.º 16
0
        private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            InsPlan plan = InsPlans.GetPlan(PIn.Long(table.Rows[e.Row]["PlanNum"].ToString()), null);

            if (plan == null || plan.PlanNum == 0)
            {
                MsgBox.Show(this, "Insurance plan selected no longer exists.");
                FillGrid();
                return;
            }
            if (IsSelectMode)
            {
                SelectedPlan = plan.Copy();
                DialogResult = DialogResult.OK;
                return;
            }
            FormInsPlan FormIP = new FormInsPlan(plan, null, null);

            FormIP.ShowDialog();
            if (FormIP.DialogResult != DialogResult.OK)
            {
                return;
            }
            FillGrid();
        }
Exemplo n.º 17
0
        ///<summary>Called from FormInsPlan when applying changes to all identical insurance plans. This updates the synchronized fields for all plans like the specified insPlan.  Current InsPlan must be set to the new values that we want.  BenefitNotes and SubscNote are specific to subscriber and are not changed.  PlanNotes are handled separately in a different function after this one is complete.</summary>
        public static void UpdateForLike(InsPlan like, InsPlan plan)
        {
            string command = "UPDATE insplan SET "
                             + "EmployerNum = '" + POut.PInt(plan.EmployerNum) + "'"
                             + ",GroupName = '" + POut.PString(plan.GroupName) + "'"
                             + ",GroupNum = '" + POut.PString(plan.GroupNum) + "'"
                             + ",DivisionNo = '" + POut.PString(plan.DivisionNo) + "'"
                             + ",CarrierNum = '" + POut.PInt(plan.CarrierNum) + "'"
                             + ",PlanType = '" + POut.PString(plan.PlanType) + "'"
                             + ",UseAltCode = '" + POut.PBool(plan.UseAltCode) + "'"
                             + ",IsMedical = '" + POut.PBool(plan.IsMedical) + "'"
                             + ",ClaimsUseUCR = '" + POut.PBool(plan.ClaimsUseUCR) + "'"
                             + ",FeeSched = '" + POut.PInt(plan.FeeSched) + "'"
                             + ",CopayFeeSched = '" + POut.PInt(plan.CopayFeeSched) + "'"
                             + ",ClaimFormNum = '" + POut.PInt(plan.ClaimFormNum) + "'"
                             + ",AllowedFeeSched= '" + POut.PInt(plan.AllowedFeeSched) + "'"
                             + ",TrojanID = '" + POut.PString(plan.TrojanID) + "'"
                             + ",FilingCode = '" + POut.PInt((int)plan.FilingCode) + "'"
                             + " WHERE "
                             + "EmployerNum = '" + POut.PInt(like.EmployerNum) + "' "
                             + "AND GroupName = '" + POut.PString(like.GroupName) + "' "
                             + "AND GroupNum = '" + POut.PString(like.GroupNum) + "' "
                             + "AND DivisionNo = '" + POut.PString(like.DivisionNo) + "'"
                             + "AND CarrierNum = '" + POut.PInt(like.CarrierNum) + "' "
                             + "AND IsMedical = '" + POut.PBool(like.IsMedical) + "'";

            General.NonQ(command);
        }
Exemplo n.º 18
0
        public void PaymentEdit_Init_AutoSplitWithClaimPayments()          //Legacy_TestFortyEight
        {
            string    suffix     = "48";
            Patient   pat        = PatientT.CreatePatient(suffix);
            long      patNum     = pat.PatNum;
            InsPlan   insPlan    = InsPlanT.CreateInsPlan(CarrierT.CreateCarrier(suffix).CarrierNum);
            InsSub    insSub     = InsSubT.CreateInsSub(patNum, insPlan.PlanNum);
            PatPlan   patPlan    = PatPlanT.CreatePatPlan(1, patNum, insSub.InsSubNum);
            Procedure procedure1 = ProcedureT.CreateProcedure(pat, "D1110", ProcStat.C, "", 50, DateTime.Now.AddDays(-1));
            Procedure procedure2 = ProcedureT.CreateProcedure(pat, "D0120", ProcStat.C, "", 40, DateTime.Now.AddDays(-2));
            Procedure procedure3 = ProcedureT.CreateProcedure(pat, "D0220", ProcStat.C, "", 60, DateTime.Now.AddDays(-3));

            ClaimProcT.AddInsPaid(patNum, insPlan.PlanNum, procedure1.ProcNum, 20, insSub.InsSubNum, 0, 0);
            ClaimProcT.AddInsPaid(patNum, insPlan.PlanNum, procedure2.ProcNum, 5, insSub.InsSubNum, 5, 0);
            ClaimProcT.AddInsPaid(patNum, insPlan.PlanNum, procedure3.ProcNum, 20, insSub.InsSubNum, 0, 10);
            Payment        payment       = PaymentT.MakePaymentNoSplits(patNum, 150, DateTime.Today);
            Family         famForPat     = Patients.GetFamily(patNum);
            List <Patient> listFamForPat = famForPat.ListPats.ToList();

            PaymentEdit.InitData init = PaymentEdit.Init(listFamForPat, famForPat, new Family {
            }, payment, new List <PaySplit>(), new List <Procedure>(), patNum);
            //Auto Splits will be in opposite order from least recent to most recent.
            //ListSplitsCur should contain four splits, 30, 35, and 30, then one unallocated for the remainder of the payment 55.
            Assert.AreEqual(4, init.AutoSplitData.ListSplitsCur.Count);
            Assert.IsFalse(init.AutoSplitData.ListSplitsCur[0].SplitAmt != 40 || init.AutoSplitData.ListSplitsCur[0].ProcNum != procedure3.ProcNum ||
                           init.AutoSplitData.ListSplitsCur[0].PatNum != patNum);
            Assert.IsFalse(init.AutoSplitData.ListSplitsCur[1].SplitAmt != 35 || init.AutoSplitData.ListSplitsCur[1].ProcNum != procedure2.ProcNum ||
                           init.AutoSplitData.ListSplitsCur[1].PatNum != patNum);
            Assert.IsFalse(init.AutoSplitData.ListSplitsCur[2].SplitAmt != 30 || init.AutoSplitData.ListSplitsCur[2].ProcNum != procedure1.ProcNum ||
                           init.AutoSplitData.ListSplitsCur[2].PatNum != patNum);
            Assert.IsFalse(init.AutoSplitData.ListSplitsCur[3].SplitAmt != 45 || init.AutoSplitData.ListSplitsCur[3].ProcNum != 0);
        }
Exemplo n.º 19
0
        public void ProcedureCodes_GetSubstituteCodeNum_InsPlanOverrideAlways()
        {
            //First, setup the test scenario.
            string  suffix  = MethodBase.GetCurrentMethod().Name;
            Patient pat     = PatientT.CreatePatient(suffix);
            Carrier carrier = CarrierT.CreateCarrier(MethodBase.GetCurrentMethod().Name);
            InsPlan plan    = new InsPlan();

            plan.CarrierNum = carrier.CarrierNum;
            plan.PlanType   = "";
            plan.CobRule    = EnumCobRule.Basic;
            plan.PlanNum    = InsPlans.Insert(plan);
            //Add a substitution code on the procedure level.
            ProcedureCode originalProcCode  = ProcedureCodes.GetProcCode("D2330");
            ProcedureCode downgradeProcCode = ProcedureCodes.GetProcCode("D2140");

            originalProcCode.SubstitutionCode = "D2140";
            originalProcCode.SubstOnlyIf      = SubstitutionCondition.Always;
            ProcedureCodeT.Update(originalProcCode);
            //Add an override for the inplan above for the originalProcCode
            ProcedureCode downgradeProcCodeForIns = ProcedureCodes.GetProcCode("D2150");

            SubstitutionLinkT.CreateSubstitutionLink(originalProcCode.CodeNum, downgradeProcCodeForIns.ProcCode, SubstitutionCondition.Always, plan.PlanNum);
            //Next, perform the thing you're trying to test.
            Procedure proc       = ProcedureT.CreateProcedure(pat, originalProcCode.ProcCode, ProcStat.C, "9", 100);//Tooth 9
            long      subCodeNum = ProcedureCodes.GetSubstituteCodeNum(originalProcCode.ProcCode, proc.ToothNum, plan.PlanNum);

            //Finally, use one or more asserts to verify the results.
            Assert.AreEqual(downgradeProcCodeForIns.CodeNum, subCodeNum);
        }
Exemplo n.º 20
0
        ///<summary></summary>
        public static void Update(InsPlan plan)
        {
            string command = "UPDATE insplan SET "
                             + "Subscriber = '" + POut.PInt(plan.Subscriber) + "'"
                             + ",DateEffective = " + POut.PDate(plan.DateEffective)
                             + ",DateTerm = " + POut.PDate(plan.DateTerm)
                             + ",GroupName = '" + POut.PString(plan.GroupName) + "'"
                             + ",GroupNum = '" + POut.PString(plan.GroupNum) + "'"
                             + ",PlanNote = '" + POut.PString(plan.PlanNote) + "'"
                             + ",FeeSched = '" + POut.PInt(plan.FeeSched) + "'"
                             + ",ReleaseInfo = '" + POut.PBool(plan.ReleaseInfo) + "'"
                             + ",AssignBen = '" + POut.PBool(plan.AssignBen) + "'"
                             + ",PlanType = '" + POut.PString(plan.PlanType) + "'"
                             + ",ClaimFormNum = '" + POut.PInt(plan.ClaimFormNum) + "'"
                             + ",UseAltcode = '" + POut.PBool(plan.UseAltCode) + "'"
                             + ",ClaimsUseUCR = '" + POut.PBool(plan.ClaimsUseUCR) + "'"
                             + ",CopayFeeSched = '" + POut.PInt(plan.CopayFeeSched) + "'"
                             + ",SubscriberID = '" + POut.PString(plan.SubscriberID) + "'"
                             + ",EmployerNum = '" + POut.PInt(plan.EmployerNum) + "'"
                             + ",CarrierNum = '" + POut.PInt(plan.CarrierNum) + "'"
                             + ",AllowedFeeSched='" + POut.PInt(plan.AllowedFeeSched) + "'"
                             + ",TrojanID='" + POut.PString(plan.TrojanID) + "'"
                             + ",DivisionNo='" + POut.PString(plan.DivisionNo) + "'"
                             + ",BenefitNotes='" + POut.PString(plan.BenefitNotes) + "'"
                             + ",IsMedical='" + POut.PBool(plan.IsMedical) + "'"
                             + ",SubscNote='" + POut.PString(plan.SubscNote) + "'"
                             + ",FilingCode='" + POut.PInt((int)plan.FilingCode) + "'"
                             + ",DentaideCardSequence='" + POut.PInt(plan.DentaideCardSequence) + "'"
                             + " WHERE PlanNum = '" + POut.PInt(plan.PlanNum) + "'";

            General.NonQ(command);
        }
Exemplo n.º 21
0
        public void ProcedureCodes_GetSubstituteCodeNum_Posterior()
        {
            //First, setup the test scenario.
            string  suffix  = MethodBase.GetCurrentMethod().Name;
            Patient pat     = PatientT.CreatePatient(suffix);
            Carrier carrier = CarrierT.CreateCarrier(MethodBase.GetCurrentMethod().Name);
            InsPlan plan    = new InsPlan();

            plan.CarrierNum = carrier.CarrierNum;
            plan.PlanType   = "";
            plan.CobRule    = EnumCobRule.Basic;
            plan.PlanNum    = InsPlans.Insert(plan);
            //Add a substitution code on the procedure level.
            ProcedureCode originalProcCode  = ProcedureCodes.GetProcCode("D2740");
            ProcedureCode downgradeProcCode = ProcedureCodes.GetProcCode("D2750");

            originalProcCode.SubstitutionCode = "D2750";
            originalProcCode.SubstOnlyIf      = SubstitutionCondition.Posterior;
            ProcedureCodeT.Update(originalProcCode);
            //Posterior Procedure= ToothNum 4
            Procedure proc       = ProcedureT.CreateProcedure(pat, originalProcCode.ProcCode, ProcStat.C, "4", 100);//Tooth 4
            long      subCodeNum = ProcedureCodes.GetSubstituteCodeNum(originalProcCode.ProcCode, proc.ToothNum, plan.PlanNum);

            //Finally, use one or more asserts to verify the results.
            Assert.AreEqual(downgradeProcCode.CodeNum, subCodeNum);
        }
Exemplo n.º 22
0
        public void ProcedureCodes_GetSubstituteCodeNum_InsPlanOverridePosterior()
        {
            //First, setup the test scenario.
            string  suffix  = MethodBase.GetCurrentMethod().Name;
            Patient pat     = PatientT.CreatePatient(suffix);
            Carrier carrier = CarrierT.CreateCarrier(MethodBase.GetCurrentMethod().Name);
            InsPlan plan    = new InsPlan();

            plan.CarrierNum = carrier.CarrierNum;
            plan.PlanType   = "";
            plan.CobRule    = EnumCobRule.Basic;
            plan.PlanNum    = InsPlans.Insert(plan);
            //Procedure code does not have a substitution code
            ProcedureCode originalProcCode = ProcedureCodes.GetProcCode("D2740");

            //clear out any substitution codes on this procedure
            originalProcCode.SubstitutionCode = "";
            ProcedureCodeT.Update(originalProcCode);
            //Add an override for the inplan above for the originalProcCode to substitute if posterior
            ProcedureCode downgradeProcCodeForIns = ProcedureCodes.GetProcCode("D2750");

            SubstitutionLinkT.CreateSubstitutionLink(originalProcCode.CodeNum, downgradeProcCodeForIns.ProcCode, SubstitutionCondition.Posterior, plan.PlanNum);
            //Posterior procedure
            Procedure proc       = ProcedureT.CreateProcedure(pat, originalProcCode.ProcCode, ProcStat.C, "4", 100);//Tooth 4
            long      subCodeNum = ProcedureCodes.GetSubstituteCodeNum(originalProcCode.ProcCode, proc.ToothNum, plan.PlanNum);

            //The ins override is set to substitute only if posterior.
            Assert.AreEqual(downgradeProcCodeForIns.CodeNum, subCodeNum);
        }
Exemplo n.º 23
0
        public void ProcedureCodes_GetSubstituteCodeNum_InsPlanOverrideNever()
        {
            //First, setup the test scenario.
            string  suffix  = MethodBase.GetCurrentMethod().Name;
            Patient pat     = PatientT.CreatePatient(suffix);
            Carrier carrier = CarrierT.CreateCarrier(MethodBase.GetCurrentMethod().Name);
            InsPlan plan    = new InsPlan();

            plan.CarrierNum = carrier.CarrierNum;
            plan.PlanType   = "";
            plan.CobRule    = EnumCobRule.Basic;
            plan.PlanNum    = InsPlans.Insert(plan);
            //Add a substitution code on the procedure level that has SubstitutionCondition.Never.
            ProcedureCode originalProcCode = ProcedureCodes.GetProcCode("D2330");

            //clear out any substitution codes on this procedure
            originalProcCode.SubstitutionCode = "";
            ProcedureCodeT.Update(originalProcCode);
            //Add an override for the inplan above for the originalProcCode to never substitute
            ProcedureCode downgradeProcCodeForIns = ProcedureCodes.GetProcCode("D2150");

            SubstitutionLinkT.CreateSubstitutionLink(originalProcCode.CodeNum, downgradeProcCodeForIns.ProcCode, SubstitutionCondition.Never, plan.PlanNum);
            //Next, perform the thing you're trying to test.
            Procedure proc       = ProcedureT.CreateProcedure(pat, originalProcCode.ProcCode, ProcStat.C, "9", 100);//Tooth 9
            long      subCodeNum = ProcedureCodes.GetSubstituteCodeNum(originalProcCode.ProcCode, proc.ToothNum, plan.PlanNum);

            //The procedure level and ins override is set SubstitutionCondition.Never so it should use originalProcCode.CodeNum
            Assert.AreEqual(originalProcCode.CodeNum, subCodeNum);
        }
Exemplo n.º 24
0
 public PayPlanExtended(PayPlan payPlan, Patient patCur, List <PayPlanCharge> listPayPlanCharges, List <ClaimProc> listClaimProcs, InsPlan insPlan)
 {
     //assign passed-in values
     PayPlan = payPlan;
     if (patCur == null)
     {
         PatientCur = new Patient();
     }
     else
     {
         PatientCur = patCur;
     }
     ListPayPlanCharges = listPayPlanCharges;
     ListClaimProcs     = listClaimProcs;
     if (insPlan == null)
     {
         InsPlanCur = new InsPlan();
     }
     else
     {
         InsPlanCur = insPlan;
     }
     //find carrierCur. GetCarrier uses the H List if possible.
     CarrierCur = Carriers.GetCarrier(InsPlanCur.CarrierNum);
     CalculateOverdues();
 }
Exemplo n.º 25
0
        private InsPlan MapReaderToInsPlan(SqlDataReader reader)
        {
            InsPlan data = null;

            if (reader != null && !reader.IsClosed && reader.Read())
            {
                var planId       = reader.GetString(reader.GetOrdinal("InsPlanId"));
                var insCoId      = reader.GetString(reader.GetOrdinal("InsCoId"));
                var insCoDesc    = reader.GetString(reader.GetOrdinal("InsCoDesc"));
                var icd9Count    = reader.GetInt32(reader.GetOrdinal("Icd9Count"));
                var insCoIdAlt   = !reader.IsDBNull(reader.GetOrdinal("InsCoIdAlternate")) ? reader.GetString(reader.GetOrdinal("InsCoIdAlternate")) : null;
                var insCoDescAlt = !reader.IsDBNull(reader.GetOrdinal("InsCoDescAlternate")) ? reader.GetString(reader.GetOrdinal("InsCoDescAlternate")) : null;

                data = new InsPlan()
                {
                    planId       = planId,
                    insCoId      = insCoId,
                    insCoDesc    = insCoDesc,
                    icd9Count    = icd9Count,
                    insCoIdAlt   = insCoIdAlt,
                    insCoDescAlt = insCoDescAlt
                };

                reader.Close();
            }
            return(data);
        }
Exemplo n.º 26
0
 ///<summary>Inserts one InsPlan into the database.  Returns the new priKey.</summary>
 internal static long Insert(InsPlan insPlan)
 {
     if (DataConnection.DBtype == DatabaseType.Oracle)
     {
         insPlan.PlanNum = DbHelper.GetNextOracleKey("insplan", "PlanNum");
         int loopcount = 0;
         while (loopcount < 100)
         {
             try {
                 return(Insert(insPlan, true));
             }
             catch (Oracle.DataAccess.Client.OracleException ex) {
                 if (ex.Number == 1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated"))
                 {
                     insPlan.PlanNum++;
                     loopcount++;
                 }
                 else
                 {
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else
     {
         return(Insert(insPlan, false));
     }
 }
Exemplo n.º 27
0
 ///<summary>Only use pri or sec, not tot.  Used from ClaimProc.ComputeBaseEst. This is a low level function to get the percent to store in a claimproc.  It does not consider any percentOverride.  Always returns a number between 0 and 100.  The supplied benefit list should be sorted frirst.</summary>
 public static int GetPercent(string myCode, InsPlan insPlan, PatPlan patPlan, Benefit[] benList)
 {
     if (insPlan.PlanType == "f" || insPlan.PlanType == "c")
     {
         return(100);               //flat and cap are always covered 100%
     }
     CovSpan[] spansForCat;
     //loop through benefits starting at bottom (most specific)
     for (int i = benList.Length - 1; i >= 0; i--)
     {
         //if plan benefit, but no match
         if (benList[i].PlanNum != 0 && insPlan.PlanNum != benList[i].PlanNum)
         {
             continue;
         }
         //if patplan benefit, but no match
         if (benList[i].PatPlanNum != 0 && patPlan.PatPlanNum != benList[i].PatPlanNum)
         {
             continue;
         }
         if (benList[i].BenefitType != InsBenefitType.Percentage)
         {
             continue;
         }
         spansForCat = CovSpans.GetForCat(benList[i].CovCatNum);
         for (int j = 0; j < spansForCat.Length; j++)
         {
             if (String.Compare(myCode, spansForCat[j].FromCode) >= 0 && String.Compare(myCode, spansForCat[j].ToCode) <= 0)
             {
                 return(benList[i].Percent);
             }
         }
     }
     return(0);
 }
Exemplo n.º 28
0
 ///<summary>Opens the window with the passed-in parameters set as the default.</summary>
 public FormInsEditLogs(InsPlan insPlan, List <Benefit> listBenefits)
 {
     InitializeComponent();
     Lan.F(this);
     _insPlan      = insPlan;
     _listBenefits = listBenefits;
 }
Exemplo n.º 29
0
        ///<summary>This form does NOT take care of updating the patplan table for you.
        ///It passes around the patPlan you passed in by reference, so you can call update on the same patplan you passed in to update.</summary>
        public FormOrthoPat(PatPlan patPlanCur, InsPlan insPlanCur, string carrierName, string subID, double defaultFee)
        {
            InitializeComponent();
            Lan.F(this);
            _patPlanCur = patPlanCur;
            _insPlanCur = insPlanCur;
            Patient patCur = Patients.GetLim(patPlanCur.PatNum);

            textPatient.Text = patCur.GetNameLF();
            textCarrier.Text = carrierName;
            textSubID.Text   = subID;
            if (patPlanCur.OrthoAutoFeeBilledOverride == -1)
            {
                checkUseDefaultFee.Checked = true;
                textFee.ReadOnly           = true;
                textFee.Text = defaultFee.ToString();
            }
            else
            {
                checkUseDefaultFee.Checked = false;
                textFee.ReadOnly           = false;
                textFee.Text = patPlanCur.OrthoAutoFeeBilledOverride.ToString();
            }
            if (patPlanCur.OrthoAutoNextClaimDate.Date != DateTime.MinValue.Date)
            {
                textDateNextClaim.Text = patPlanCur.OrthoAutoNextClaimDate.ToShortDateString();
            }
            else               //there is no initial procedure or claim, so showing when the "next" claim will be would be misleading.
            {
                textDateNextClaim.Text = "";
            }
        }
Exemplo n.º 30
0
        ///<summary>Creates a procedure and computes estimates for a patient where the secondary insurance has a COB rule of Medicaid.</summary>
        private void ComputeEstimatesMedicaidCOB(string suffix, double procFee, double priAllowed, double secAllowed, int priPercentCovered,
                                                 int secPercentCovered, Action <ClaimProc /*Primary*/, ClaimProc /*Secondary*/, Procedure> assertAct)
        {
            Patient pat            = PatientT.CreatePatient(suffix);
            long    ppoFeeSchedNum = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, "PPO " + suffix);

            InsuranceT.AddInsurance(pat, suffix, "p", ppoFeeSchedNum);
            long medicaidFeeSchedNum = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, "PPO " + suffix);

            InsuranceT.AddInsurance(pat, suffix, "p", medicaidFeeSchedNum, 2, cobRule: EnumCobRule.SecondaryMedicaid);
            List <InsSub>  listSubs     = InsSubT.GetInsSubs(pat);
            List <InsPlan> listPlans    = InsPlans.RefreshForSubList(listSubs);
            List <PatPlan> listPatPlans = PatPlans.Refresh(pat.PatNum);
            InsPlan        priPlan      = InsPlanT.GetPlanForPriSecMed(PriSecMed.Primary, listPatPlans, listPlans, listSubs);

            BenefitT.CreateCategoryPercent(priPlan.PlanNum, EbenefitCategory.Diagnostic, priPercentCovered);
            InsPlan secPlan = InsPlanT.GetPlanForPriSecMed(PriSecMed.Secondary, listPatPlans, listPlans, listSubs);

            BenefitT.CreateCategoryPercent(secPlan.PlanNum, EbenefitCategory.Diagnostic, secPercentCovered);
            List <Benefit> listBens = Benefits.Refresh(listPatPlans, listSubs);
            string         procStr  = "D0150";
            Procedure      proc     = ProcedureT.CreateProcedure(pat, procStr, ProcStat.TP, "", procFee);
            ProcedureCode  procCode = ProcedureCodes.GetProcCode(procStr);

            FeeT.CreateFee(ppoFeeSchedNum, procCode.CodeNum, priAllowed);
            FeeT.CreateFee(medicaidFeeSchedNum, procCode.CodeNum, secAllowed);
            Procedures.ComputeEstimates(proc, pat.PatNum, new List <ClaimProc>(), false, listPlans, listPatPlans, listBens, pat.Age, listSubs);
            List <ClaimProc> listClaimProcs = ClaimProcs.Refresh(pat.PatNum);

            assertAct(listClaimProcs.FirstOrDefault(x => x.PlanNum == priPlan.PlanNum), listClaimProcs.FirstOrDefault(x => x.PlanNum == secPlan.PlanNum), proc);
        }
Exemplo n.º 31
0
        public static string RunFour(bool showForms)
        {
            string  retVal  = "";
            long    provNum = ProviderC.ListShort[1].ProvNum;       //dentist #2
            Patient pat     = Patients.GetPat(PatientTC.PatNum6);   //patient#6

            if (pat.PriProv != provNum)
            {
                Patient oldPat = pat.Copy();
                pat.PriProv = provNum;              //this script uses the primary provider for the patient
                Patients.Update(pat, oldPat);
            }
            PatPlan          patplan        = PatPlans.GetPatPlan(pat.PatNum, 1);
            InsSub           sub            = InsSubs.GetOne(patplan.InsSubNum);
            InsPlan          plan           = InsPlans.GetPlan(sub.PlanNum, new List <InsPlan>());
            long             etransNum      = CanadianOutput.SendElegibility(pat.PatNum, plan, new DateTime(1999, 1, 1), patplan.Relationship, patplan.PatID, showForms, sub);
            Etrans           etrans         = Etranss.GetEtrans(etransNum);
            string           message        = EtransMessageTexts.GetMessageText(etrans.EtransMessageTextNum);
            CCDFieldInputter formData       = new CCDFieldInputter(message);
            string           responseStatus = formData.GetValue("G05");

            if (responseStatus != "M")
            {
                throw new Exception("Should be M");
            }
            retVal += "Eligibility #4 successful.\r\n";
            return(retVal);
        }
Exemplo n.º 32
0
 ///<summary>Inserts one InsPlan into the database.  Provides option to use the existing priKey.</summary>
 internal static long Insert(InsPlan insPlan,bool useExistingPK)
 {
     if(!useExistingPK && PrefC.RandomKeys) {
         insPlan.PlanNum=ReplicationServers.GetKey("insplan","PlanNum");
     }
     string command="INSERT INTO insplan (";
     if(useExistingPK || PrefC.RandomKeys) {
         command+="PlanNum,";
     }
     command+="GroupName,GroupNum,PlanNote,FeeSched,PlanType,ClaimFormNum,UseAltCode,ClaimsUseUCR,CopayFeeSched,EmployerNum,CarrierNum,AllowedFeeSched,TrojanID,DivisionNo,IsMedical,FilingCode,DentaideCardSequence,ShowBaseUnits,CodeSubstNone,IsHidden,MonthRenew,FilingCodeSubtype,CanadianPlanFlag,CanadianDiagnosticCode,CanadianInstitutionCode,RxBIN,CobRule) VALUES(";
     if(useExistingPK || PrefC.RandomKeys) {
         command+=POut.Long(insPlan.PlanNum)+",";
     }
     command+=
          "'"+POut.String(insPlan.GroupName)+"',"
         +"'"+POut.String(insPlan.GroupNum)+"',"
         +"'"+POut.String(insPlan.PlanNote)+"',"
         +    POut.Long  (insPlan.FeeSched)+","
         +"'"+POut.String(insPlan.PlanType)+"',"
         +    POut.Long  (insPlan.ClaimFormNum)+","
         +    POut.Bool  (insPlan.UseAltCode)+","
         +    POut.Bool  (insPlan.ClaimsUseUCR)+","
         +    POut.Long  (insPlan.CopayFeeSched)+","
         +    POut.Long  (insPlan.EmployerNum)+","
         +    POut.Long  (insPlan.CarrierNum)+","
         +    POut.Long  (insPlan.AllowedFeeSched)+","
         +"'"+POut.String(insPlan.TrojanID)+"',"
         +"'"+POut.String(insPlan.DivisionNo)+"',"
         +    POut.Bool  (insPlan.IsMedical)+","
         +    POut.Long  (insPlan.FilingCode)+","
         +    POut.Byte  (insPlan.DentaideCardSequence)+","
         +    POut.Bool  (insPlan.ShowBaseUnits)+","
         +    POut.Bool  (insPlan.CodeSubstNone)+","
         +    POut.Bool  (insPlan.IsHidden)+","
         +    POut.Byte  (insPlan.MonthRenew)+","
         +    POut.Long  (insPlan.FilingCodeSubtype)+","
         +"'"+POut.String(insPlan.CanadianPlanFlag)+"',"
         +"'"+POut.String(insPlan.CanadianDiagnosticCode)+"',"
         +"'"+POut.String(insPlan.CanadianInstitutionCode)+"',"
         +"'"+POut.String(insPlan.RxBIN)+"',"
         +    POut.Int   ((int)insPlan.CobRule)+")";
     if(useExistingPK || PrefC.RandomKeys) {
         Db.NonQ(command);
     }
     else {
         insPlan.PlanNum=Db.NonQ(command,true);
     }
     return insPlan.PlanNum;
 }
Exemplo n.º 33
0
		///<summary>Converts a DataTable to a list of objects.</summary>
		public static List<InsPlan> TableToList(DataTable table){
			List<InsPlan> retVal=new List<InsPlan>();
			InsPlan insPlan;
			for(int i=0;i<table.Rows.Count;i++) {
				insPlan=new InsPlan();
				insPlan.PlanNum                = PIn.Long  (table.Rows[i]["PlanNum"].ToString());
				insPlan.GroupName              = PIn.String(table.Rows[i]["GroupName"].ToString());
				insPlan.GroupNum               = PIn.String(table.Rows[i]["GroupNum"].ToString());
				insPlan.PlanNote               = PIn.String(table.Rows[i]["PlanNote"].ToString());
				insPlan.FeeSched               = PIn.Long  (table.Rows[i]["FeeSched"].ToString());
				insPlan.PlanType               = PIn.String(table.Rows[i]["PlanType"].ToString());
				insPlan.ClaimFormNum           = PIn.Long  (table.Rows[i]["ClaimFormNum"].ToString());
				insPlan.UseAltCode             = PIn.Bool  (table.Rows[i]["UseAltCode"].ToString());
				insPlan.ClaimsUseUCR           = PIn.Bool  (table.Rows[i]["ClaimsUseUCR"].ToString());
				insPlan.CopayFeeSched          = PIn.Long  (table.Rows[i]["CopayFeeSched"].ToString());
				insPlan.EmployerNum            = PIn.Long  (table.Rows[i]["EmployerNum"].ToString());
				insPlan.CarrierNum             = PIn.Long  (table.Rows[i]["CarrierNum"].ToString());
				insPlan.AllowedFeeSched        = PIn.Long  (table.Rows[i]["AllowedFeeSched"].ToString());
				insPlan.TrojanID               = PIn.String(table.Rows[i]["TrojanID"].ToString());
				insPlan.DivisionNo             = PIn.String(table.Rows[i]["DivisionNo"].ToString());
				insPlan.IsMedical              = PIn.Bool  (table.Rows[i]["IsMedical"].ToString());
				insPlan.FilingCode             = PIn.Long  (table.Rows[i]["FilingCode"].ToString());
				insPlan.DentaideCardSequence   = PIn.Byte  (table.Rows[i]["DentaideCardSequence"].ToString());
				insPlan.ShowBaseUnits          = PIn.Bool  (table.Rows[i]["ShowBaseUnits"].ToString());
				insPlan.CodeSubstNone          = PIn.Bool  (table.Rows[i]["CodeSubstNone"].ToString());
				insPlan.IsHidden               = PIn.Bool  (table.Rows[i]["IsHidden"].ToString());
				insPlan.MonthRenew             = PIn.Byte  (table.Rows[i]["MonthRenew"].ToString());
				insPlan.FilingCodeSubtype      = PIn.Long  (table.Rows[i]["FilingCodeSubtype"].ToString());
				insPlan.CanadianPlanFlag       = PIn.String(table.Rows[i]["CanadianPlanFlag"].ToString());
				insPlan.CanadianDiagnosticCode = PIn.String(table.Rows[i]["CanadianDiagnosticCode"].ToString());
				insPlan.CanadianInstitutionCode= PIn.String(table.Rows[i]["CanadianInstitutionCode"].ToString());
				insPlan.RxBIN                  = PIn.String(table.Rows[i]["RxBIN"].ToString());
				insPlan.CobRule                = (OpenDentBusiness.EnumCobRule)PIn.Int(table.Rows[i]["CobRule"].ToString());
				insPlan.SopCode                = PIn.String(table.Rows[i]["SopCode"].ToString());
				retVal.Add(insPlan);
			}
			return retVal;
		}
Exemplo n.º 34
0
		///<summary>Only for creating the IN1 segment(s).</summary>
		public static string GenerateFieldIN1(HL7Def def,string fieldName,int sequenceNum,PatPlan patplanCur,InsSub inssubCur,InsPlan insplanCur,Carrier carrierCur,int patplanCount,Patient patSub) {
			switch(fieldName) {
				#region Carrier
				case "carrier.addressCityStateZip":
					if(carrierCur==null) {
						return "";
					}
					return gConcat(def.ComponentSeparator,carrierCur.Address,carrierCur.Address2,carrierCur.City,carrierCur.State,carrierCur.Zip);
				case "carrier.CarrierName":
					if(carrierCur==null) {
						return "";
					}
					return carrierCur.CarrierName;
				case "carrier.ElectID":
					if(carrierCur==null) {
						return "";
					}
					return carrierCur.ElectID;
				case "carrier.Phone":
					//Example: ^WPN^PH^^^800^3635432
					if(carrierCur==null) {
						return "";
					}
					string carrierPh=gXTN(carrierCur.Phone,10);
					if(carrierPh=="") {
						return "";
					}
					return gConcat(def.ComponentSeparator,"","WPN","PH","","",carrierPh.Substring(0,3),carrierPh.Substring(3));//carrierPh guaranteed to be 10 digits or blank
				#endregion Carrier
				#region InsPlan
				case "insplan.cob":
					if(insplanCur==null) {
						return "";
					}
					if(patplanCount>1) {
						return "CO";
					}
					return "IN";
				case "insplan.coverageType":
					if(insplanCur==null) {
						return "";
					}
					if(insplanCur.IsMedical) {
						return "M";
					}
					return "D";
				case "insplan.empName":
					if(insplanCur==null) {
						return "";
					}
					return Employers.GetName(insplanCur.EmployerNum);//will return empty string if EmployerNum=0 or not found
				case "insplan.GroupName":
					if(insplanCur==null) {
						return "";
					}
					return insplanCur.GroupName;
				case "insplan.GroupNum":
					if(insplanCur==null) {
						return "";
					}
					return insplanCur.GroupNum;
				case "insplan.planNum":
					//Example: 2.16.840.1.113883.3.4337.1486.6566.7.1234
					//If OID for insplan is not set, then it will be ODInsPlan.1234 (where 1234=PlanNum)
					if(insplanCur==null) {
						return "";
					}
					OIDInternal insplanOid=OIDInternals.GetForType(IdentifierType.InsPlan);//returns root+".7" or whatever they have set in their oidinternal table for type InsPlan
					string insplanOidRoot="ODInsPlan";
					if(insplanOid!=null && insplanOid.IDRoot!="") {
						insplanOidRoot=insplanOid.IDRoot;
					}
					return insplanOidRoot+"."+insplanCur.PlanNum;//tack on "."+PlanNum for extension
				case "insplan.PlanType":
					if(insplanCur==null) {
						return "";
					}
					if(insplanCur.PlanType=="p") {
						return "PPO Percentage";
					}
					if(insplanCur.PlanType=="f") {
						return "Medicaid or Flat Copay";
					}
					if(insplanCur.PlanType=="c") {
						return "Capitation";
					}
					return "Category Percentage";
				#endregion InsPlan
				#region InsSub
				case "inssub.AssignBen":
					if(inssubCur==null) {
						return "";
					}
					if(inssubCur.AssignBen) {
						return "Y";
					}
					return "N";
				case "inssub.DateEffective":
					if(inssubCur==null || inssubCur.DateEffective==DateTime.MinValue) {
						return "";
					}
					return gDTM(inssubCur.DateEffective,8);
				case "inssub.DateTerm":
					if(inssubCur==null || inssubCur.DateTerm==DateTime.MinValue) {
						return "";
					}
					return gDTM(inssubCur.DateTerm,8);
				case "inssub.ReleaseInfo":
					if(inssubCur==null) {
						return "";
					}
					if(inssubCur.ReleaseInfo) {
						return "Y";
					}
					return "N";
				case "inssub.subAddrCityStateZip":
					if(patSub==null) {
						return "";
					}
					return gConcat(def.ComponentSeparator,patSub.Address,patSub.Address2,patSub.City,patSub.State,patSub.Zip);
				case "inssub.subBirthdate":
					if(patSub==null) {
						return "";
					}
					return gDTM(patSub.Birthdate,8);
				case "inssub.SubscriberID":
					if(inssubCur==null) {
						return "";
					}
					return inssubCur.SubscriberID;
				case "inssub.subscriberName":
					if(patSub==null) {
						return "";
					}
					return gConcat(def.ComponentSeparator,patSub.LName,patSub.FName,patSub.MiddleI);
				#endregion InsSub
				#region PatPlan
				case "patplan.Ordinal":
					if(patplanCur==null) {
						return "";
					}
					return patplanCur.Ordinal.ToString();
				case "patplan.policyNum":
					if(patplanCur==null || inssubCur==null) {
						return "";
					}
					if(patplanCur.PatID!="") {
						return patplanCur.PatID;
					}
					return inssubCur.SubscriberID;
				case "patplan.subRelationToPat":
					//SEL-Self, SPO-Spouse, DOM-LifePartner, CHD-Child (PAR-Parent), EME-Employee (EMR-Employer)
					//DEP-HandicapDep (GRD-Guardian), DEP-Dependent, OTH-SignifOther (OTH-Other), OTH-InjuredPlantiff
					//We store relationship to subscriber and they want subscriber's relationship to patient, therefore
					//Relat.Child will return "PAR" for Parent, Relat.Employee will return "EMR" for Employer, and Relat.HandicapDep and Relat.Dependent will return "GRD" for Guardian
					//Example: |PAR^Parent|
					if(patplanCur==null) {
						return "";
					}
					if(patplanCur.Relationship==Relat.Self) {
						return gConcat(def.ComponentSeparator,"SEL","Self");
					}
					if(patplanCur.Relationship==Relat.Spouse) {
						return gConcat(def.ComponentSeparator,"SPO","Spouse");
					}
					if(patplanCur.Relationship==Relat.LifePartner) {
						return gConcat(def.ComponentSeparator,"DOM","Life Partner");
					}
					if(patplanCur.Relationship==Relat.Child) {
						return gConcat(def.ComponentSeparator,"PAR","Parent");
					}
					if(patplanCur.Relationship==Relat.Employee) {
						return gConcat(def.ComponentSeparator,"EMR","Employer");
					}
					if(patplanCur.Relationship==Relat.Dependent || patplanCur.Relationship==Relat.HandicapDep) {
						return gConcat(def.ComponentSeparator,"GRD","Guardian");
					}
					//if Relat.SignifOther or Relat.InjuredPlaintiff or any others
					return gConcat(def.ComponentSeparator,"OTH","Other");
				#endregion PatPlan
				case "sequenceNum":
					return sequenceNum.ToString();
				default:
					return "";
			}
		}
Exemplo n.º 35
0
		///<summary>Updates one InsPlan in the database.</summary>
		public static void Update(InsPlan insPlan){
			string command="UPDATE insplan SET "
				+"GroupName              = '"+POut.String(insPlan.GroupName)+"', "
				+"GroupNum               = '"+POut.String(insPlan.GroupNum)+"', "
				+"PlanNote               = '"+POut.String(insPlan.PlanNote)+"', "
				+"FeeSched               =  "+POut.Long  (insPlan.FeeSched)+", "
				+"PlanType               = '"+POut.String(insPlan.PlanType)+"', "
				+"ClaimFormNum           =  "+POut.Long  (insPlan.ClaimFormNum)+", "
				+"UseAltCode             =  "+POut.Bool  (insPlan.UseAltCode)+", "
				+"ClaimsUseUCR           =  "+POut.Bool  (insPlan.ClaimsUseUCR)+", "
				+"CopayFeeSched          =  "+POut.Long  (insPlan.CopayFeeSched)+", "
				+"EmployerNum            =  "+POut.Long  (insPlan.EmployerNum)+", "
				+"CarrierNum             =  "+POut.Long  (insPlan.CarrierNum)+", "
				+"AllowedFeeSched        =  "+POut.Long  (insPlan.AllowedFeeSched)+", "
				+"TrojanID               = '"+POut.String(insPlan.TrojanID)+"', "
				+"DivisionNo             = '"+POut.String(insPlan.DivisionNo)+"', "
				+"IsMedical              =  "+POut.Bool  (insPlan.IsMedical)+", "
				+"FilingCode             =  "+POut.Long  (insPlan.FilingCode)+", "
				+"DentaideCardSequence   =  "+POut.Byte  (insPlan.DentaideCardSequence)+", "
				+"ShowBaseUnits          =  "+POut.Bool  (insPlan.ShowBaseUnits)+", "
				+"CodeSubstNone          =  "+POut.Bool  (insPlan.CodeSubstNone)+", "
				+"IsHidden               =  "+POut.Bool  (insPlan.IsHidden)+", "
				+"MonthRenew             =  "+POut.Byte  (insPlan.MonthRenew)+", "
				+"FilingCodeSubtype      =  "+POut.Long  (insPlan.FilingCodeSubtype)+", "
				+"CanadianPlanFlag       = '"+POut.String(insPlan.CanadianPlanFlag)+"', "
				+"CanadianDiagnosticCode = '"+POut.String(insPlan.CanadianDiagnosticCode)+"', "
				+"CanadianInstitutionCode= '"+POut.String(insPlan.CanadianInstitutionCode)+"', "
				+"RxBIN                  = '"+POut.String(insPlan.RxBIN)+"', "
				+"CobRule                =  "+POut.Int   ((int)insPlan.CobRule)+", "
				+"SopCode                = '"+POut.String(insPlan.SopCode)+"' "
				+"WHERE PlanNum = "+POut.Long(insPlan.PlanNum);
			Db.NonQ(command);
		}
Exemplo n.º 36
0
		///<summary>Updates one InsPlan in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.  Returns true if an update occurred.</summary>
		public static bool Update(InsPlan insPlan,InsPlan oldInsPlan){
			string command="";
			if(insPlan.GroupName != oldInsPlan.GroupName) {
				if(command!=""){ command+=",";}
				command+="GroupName = '"+POut.String(insPlan.GroupName)+"'";
			}
			if(insPlan.GroupNum != oldInsPlan.GroupNum) {
				if(command!=""){ command+=",";}
				command+="GroupNum = '"+POut.String(insPlan.GroupNum)+"'";
			}
			if(insPlan.PlanNote != oldInsPlan.PlanNote) {
				if(command!=""){ command+=",";}
				command+="PlanNote = '"+POut.String(insPlan.PlanNote)+"'";
			}
			if(insPlan.FeeSched != oldInsPlan.FeeSched) {
				if(command!=""){ command+=",";}
				command+="FeeSched = "+POut.Long(insPlan.FeeSched)+"";
			}
			if(insPlan.PlanType != oldInsPlan.PlanType) {
				if(command!=""){ command+=",";}
				command+="PlanType = '"+POut.String(insPlan.PlanType)+"'";
			}
			if(insPlan.ClaimFormNum != oldInsPlan.ClaimFormNum) {
				if(command!=""){ command+=",";}
				command+="ClaimFormNum = "+POut.Long(insPlan.ClaimFormNum)+"";
			}
			if(insPlan.UseAltCode != oldInsPlan.UseAltCode) {
				if(command!=""){ command+=",";}
				command+="UseAltCode = "+POut.Bool(insPlan.UseAltCode)+"";
			}
			if(insPlan.ClaimsUseUCR != oldInsPlan.ClaimsUseUCR) {
				if(command!=""){ command+=",";}
				command+="ClaimsUseUCR = "+POut.Bool(insPlan.ClaimsUseUCR)+"";
			}
			if(insPlan.CopayFeeSched != oldInsPlan.CopayFeeSched) {
				if(command!=""){ command+=",";}
				command+="CopayFeeSched = "+POut.Long(insPlan.CopayFeeSched)+"";
			}
			if(insPlan.EmployerNum != oldInsPlan.EmployerNum) {
				if(command!=""){ command+=",";}
				command+="EmployerNum = "+POut.Long(insPlan.EmployerNum)+"";
			}
			if(insPlan.CarrierNum != oldInsPlan.CarrierNum) {
				if(command!=""){ command+=",";}
				command+="CarrierNum = "+POut.Long(insPlan.CarrierNum)+"";
			}
			if(insPlan.AllowedFeeSched != oldInsPlan.AllowedFeeSched) {
				if(command!=""){ command+=",";}
				command+="AllowedFeeSched = "+POut.Long(insPlan.AllowedFeeSched)+"";
			}
			if(insPlan.TrojanID != oldInsPlan.TrojanID) {
				if(command!=""){ command+=",";}
				command+="TrojanID = '"+POut.String(insPlan.TrojanID)+"'";
			}
			if(insPlan.DivisionNo != oldInsPlan.DivisionNo) {
				if(command!=""){ command+=",";}
				command+="DivisionNo = '"+POut.String(insPlan.DivisionNo)+"'";
			}
			if(insPlan.IsMedical != oldInsPlan.IsMedical) {
				if(command!=""){ command+=",";}
				command+="IsMedical = "+POut.Bool(insPlan.IsMedical)+"";
			}
			if(insPlan.FilingCode != oldInsPlan.FilingCode) {
				if(command!=""){ command+=",";}
				command+="FilingCode = "+POut.Long(insPlan.FilingCode)+"";
			}
			if(insPlan.DentaideCardSequence != oldInsPlan.DentaideCardSequence) {
				if(command!=""){ command+=",";}
				command+="DentaideCardSequence = "+POut.Byte(insPlan.DentaideCardSequence)+"";
			}
			if(insPlan.ShowBaseUnits != oldInsPlan.ShowBaseUnits) {
				if(command!=""){ command+=",";}
				command+="ShowBaseUnits = "+POut.Bool(insPlan.ShowBaseUnits)+"";
			}
			if(insPlan.CodeSubstNone != oldInsPlan.CodeSubstNone) {
				if(command!=""){ command+=",";}
				command+="CodeSubstNone = "+POut.Bool(insPlan.CodeSubstNone)+"";
			}
			if(insPlan.IsHidden != oldInsPlan.IsHidden) {
				if(command!=""){ command+=",";}
				command+="IsHidden = "+POut.Bool(insPlan.IsHidden)+"";
			}
			if(insPlan.MonthRenew != oldInsPlan.MonthRenew) {
				if(command!=""){ command+=",";}
				command+="MonthRenew = "+POut.Byte(insPlan.MonthRenew)+"";
			}
			if(insPlan.FilingCodeSubtype != oldInsPlan.FilingCodeSubtype) {
				if(command!=""){ command+=",";}
				command+="FilingCodeSubtype = "+POut.Long(insPlan.FilingCodeSubtype)+"";
			}
			if(insPlan.CanadianPlanFlag != oldInsPlan.CanadianPlanFlag) {
				if(command!=""){ command+=",";}
				command+="CanadianPlanFlag = '"+POut.String(insPlan.CanadianPlanFlag)+"'";
			}
			if(insPlan.CanadianDiagnosticCode != oldInsPlan.CanadianDiagnosticCode) {
				if(command!=""){ command+=",";}
				command+="CanadianDiagnosticCode = '"+POut.String(insPlan.CanadianDiagnosticCode)+"'";
			}
			if(insPlan.CanadianInstitutionCode != oldInsPlan.CanadianInstitutionCode) {
				if(command!=""){ command+=",";}
				command+="CanadianInstitutionCode = '"+POut.String(insPlan.CanadianInstitutionCode)+"'";
			}
			if(insPlan.RxBIN != oldInsPlan.RxBIN) {
				if(command!=""){ command+=",";}
				command+="RxBIN = '"+POut.String(insPlan.RxBIN)+"'";
			}
			if(insPlan.CobRule != oldInsPlan.CobRule) {
				if(command!=""){ command+=",";}
				command+="CobRule = "+POut.Int   ((int)insPlan.CobRule)+"";
			}
			if(insPlan.SopCode != oldInsPlan.SopCode) {
				if(command!=""){ command+=",";}
				command+="SopCode = '"+POut.String(insPlan.SopCode)+"'";
			}
			if(command==""){
				return false;
			}
			command="UPDATE insplan SET "+command
				+" WHERE PlanNum = "+POut.Long(insPlan.PlanNum);
			Db.NonQ(command);
			return true;
		}