Example #1
0
    public int Delete_InsInfo(InsuranceInfo insInfo,string userID)
    {
        int flag = 0;
        try
        {
            SqlConnection con = new SqlConnection(ConStr);
            SqlCommand sqlCmd = new SqlCommand();
            sqlCmd.Connection = con;
            sqlCmd.CommandText = "sp_delete_Insurance_Info";
            sqlCmd.CommandType = CommandType.StoredProcedure;

            SqlParameter InsuranceID = sqlCmd.Parameters.Add("@Ins_ID", SqlDbType.Int);
            InsuranceID.Value = insInfo.InsID;

            SqlParameter pUserID = sqlCmd.Parameters.Add("@UserID", SqlDbType.VarChar, 20);
            pUserID.Value = userID;

            con.Open();
            sqlCmd.ExecuteNonQuery();
            flag = 1;
            con.Close();

        }

        catch (Exception ex)
        {
            objNLog.Error("Exception : " + ex.Message);

        }

        return flag;
    }
Example #2
0
        public void InsPlan_PpoNoSubWriteoffsNoSub()
        {
            string        suffix         = MethodBase.GetCurrentMethod().Name;
            Patient       pat            = PatientT.CreatePatient(suffix);
            long          ucrFeeSchedNum = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, "UCR Fees" + suffix);
            long          ppoFeeSchedNum = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, "PPO " + suffix);
            InsuranceInfo ins            = InsuranceT.AddInsurance(pat, suffix, planType: "p", feeSchedNum: ppoFeeSchedNum);

            ins.PriInsPlan.HasPpoSubstWriteoffs = false;
            InsPlans.Update(ins.PriInsPlan);
            BenefitT.CreateCategoryPercent(ins.PriInsPlan.PlanNum, EbenefitCategory.Restorative, 50);
            ProcedureCode originalProcCode  = ProcedureCodes.GetProcCode("D2330");
            ProcedureCode downgradeProcCode = ProcedureCodes.GetProcCode("D2140");

            originalProcCode.SubstitutionCode = "";          //NOT substituting
            originalProcCode.SubstOnlyIf      = SubstitutionCondition.Always;
            ProcedureCodeT.Update(originalProcCode);
            FeeT.CreateFee(ucrFeeSchedNum, originalProcCode.CodeNum, 100);
            FeeT.CreateFee(ucrFeeSchedNum, downgradeProcCode.CodeNum, 80);
            FeeT.CreateFee(ppoFeeSchedNum, originalProcCode.CodeNum, 60);
            FeeT.CreateFee(ppoFeeSchedNum, downgradeProcCode.CodeNum, 50);
            Procedure        proc           = ProcedureT.CreateProcedure(pat, "D2330", ProcStat.C, "9", 100);//Tooth 9
            List <ClaimProc> listClaimProcs = ClaimProcs.Refresh(pat.PatNum);
            List <Procedure> listProcs      = Procedures.Refresh(pat.PatNum);

            ins.RefreshBenefits();
            Claim     claim  = ClaimT.CreateClaim("P", ins.ListPatPlans, ins.ListInsPlans, listClaimProcs, listProcs, pat, listProcs, ins.ListBenefits, ins.ListInsSubs);
            ClaimProc clProc = ClaimProcs.Refresh(pat.PatNum)[0];          //Should only be one

            Assert.AreEqual(50, clProc.Percentage);
            Assert.AreEqual(30, clProc.BaseEst);
            Assert.AreEqual(30, clProc.InsPayEst);
            Assert.AreEqual(40, clProc.WriteOffEst);
        }
Example #3
0
        private void InsuranceSummary()
        {
            Insurance = (InsuranceInfo)Order.Products["Insurance"];
            if (Order.Lines.Total == 0)
            {
                //67811A0  - PCI Remediation for Payment systems CH2:START- set visibility to column1 to true and commented the code which sets visibility to column2 as False.
                // INS_SummaryView.Columns[2].Visible=false;
                INS_SummaryView.Columns[1].Visible = false;
                //67811A0  - PCI Remediation for Payment systems CH2:END- set visibility to column1 to true and commented the code which sets visibility to column2 as False.
            }
            else
            {
                //67811A0  - PCI Remediation for Payment systems CH1: Start - Commented the below code lined to remove the Total Amount field in the payment confirmation screen.
                //INS_SummaryView.Columns[2].FooterText = "Total Amount";
                //INS_SummaryView.Columns[3].FooterText = Insurance.Lines.Total.ToString("C");
                //67811A0  - PCI Remediation for Payment systems CH1: End - Commented the below code lined to remove the Total Amount field in the payment confirmation screen.

                INS_SummaryView.Columns[1].Visible = false;
            }
            DataTable  dtInsSummary  = Insurance.Lines.Data;
            DataColumn dcProductDesc = new DataColumn("ProductDesc");

            dtInsSummary.Columns.Add(dcProductDesc);

            foreach (DataRow dr in dtInsSummary.Rows)
            {
                DataRow[] drDesc = ((DataTable)Cache["INS_Product_Type"]).Select("ID = '" + dr["ProductType"] + "'");
                dr["ProductDesc"] = drDesc[0]["Description"].ToString();
            }


            INS_SummaryView.DataSource = dtInsSummary;
            INS_SummaryView.DataBind();
        }
Example #4
0
        public void Test002()
        {
            // Arrange
            ContactInfo contactInfoModel = new ContactInfo {
                FirstName = "FirstName", Index = UserInfoIndex.Applicant
            };
            ContactInfo mailingInfoModel = new ContactInfo {
                FirstName = "FirstName", Index = UserInfoIndex.MailRecipient
            };
            InsuranceInfo insuranceInfoModel = new InsuranceInfo {
                NameOfInsurer = "InsurerName"
            };
            VesselInfo vesselInfoModel = new VesselInfo {
                Name = "VesselName"
            };

            _appStateManager.SetClientApplicationContext(new EditContext(contactInfoModel));
            _appStateManager.SetClientApplicationContext(new EditContext(mailingInfoModel));
            _appStateManager.SetClientApplicationContext(new EditContext(insuranceInfoModel));
            _appStateManager.SetClientApplicationContext(new EditContext(vesselInfoModel));

            // Act
            _appStateManager.Clear();

            // Assert
            Assert.Null(_appState.ClientApplicationState.ApplicantContext);
            Assert.Null(_appState.ClientApplicationState.MailRecipientContext);
            Assert.True(_appState.ClientApplicationState.VesselInfoContexts.Count < 1);
        }
Example #5
0
        public void X834_ImportInsurancePlans_ReplacePatPlan()
        {
            Patient pat    = Createx834Patient();
            string  suffix = MethodBase.GetCurrentMethod().Name;
            //Create old insurance plan and associate it to them.
            InsuranceInfo insuranceOld = InsuranceT.AddInsurance(pat, "Old Carrier" + suffix);
            //Create x834
            X834 x834 = new X834(new X12object(Properties.Resources.x834Test));
            int  createdPatsCount, updatedPatsCount, skippedPatsCount, createdCarrierCount, createdInsPlanCount, updatedInsPlanCount, createdInsSubCount,
                 updatedInsSubCount, createdPatPlanCount, droppedPatPlanCount, updatedPatPlanCount;
            StringBuilder sbErrorMessages;

            //Pass in true for dropExistingInsurance
            EtransL.ImportInsurancePlans(x834, new List <Patient> {
                pat
            }, true, true, out createdPatsCount,
                                         out updatedPatsCount, out skippedPatsCount, out createdCarrierCount, out createdInsPlanCount, out updatedInsPlanCount, out createdInsSubCount,
                                         out updatedInsSubCount, out createdPatPlanCount, out droppedPatPlanCount, out updatedPatPlanCount, out sbErrorMessages);
            //Get the pat plans for this patient from the database.
            List <PatPlan> listPatPlans = PatPlans.GetPatPlansForPat(pat.PatNum);

            Assert.AreEqual(1, listPatPlans.Count);
            Assert.AreEqual(1, droppedPatPlanCount);
            InsSub subForPatPlan        = InsSubs.GetOne(listPatPlans[0].InsSubNum);

            //These should be different as a new plan was created and the old plan was dropped.
            Assert.AreNotEqual(insuranceOld.PriInsPlan.PlanNum, subForPatPlan.PlanNum);
        }
        public void RpProcNotBilledIns_GetProcsNotBilled_MedicalInsOnly()
        {
            string        suffix        = MethodBase.GetCurrentMethod().Name;
            Patient       patient       = PatientT.CreatePatient(suffix);
            Carrier       carrier       = CarrierT.CreateCarrier(suffix);
            ProcedureCode procedureCode = ProcedureCodeT.CreateProcCode("T7782");
            //Create a primary medical insurance plan
            InsuranceInfo insuranceInfo = InsuranceT.AddInsurance(patient, carrier.CarrierName, ordinal: 1, isMedical: true);

            insuranceInfo.AddBenefit(BenefitT.CreatePercentForProc(insuranceInfo.MedInsPlan.PlanNum, procedureCode.CodeNum, 80));
            Procedure procedure = ProcedureT.CreateProcedure(patient, procedureCode.ProcCode, ProcStat.TP, "", 55, procDate: DateTime.Now.AddDays(-3));

            ProcedureT.ComputeEstimates(patient, insuranceInfo);
            ProcedureT.SetComplete(procedure, patient, insuranceInfo);
            //Run the procs not billed report with "includeMedProcs" set to false.
            //The patient should not be returned due to not having any dental insurance estimates.
            DataTable table = RpProcNotBilledIns.GetProcsNotBilled(new List <long>(), false, DateTime.Now.AddDays(-10), DateTime.Now, false, false);

            Assert.IsNotNull(table);
            Assert.IsFalse(table.Select().Select(x => PIn.Long(x["PatNum"].ToString())).Contains(patient.PatNum));
            //Run the procs not billed report with "includeMedProcs" set to true.
            //The patient should be returned due to the medical insurance estimates.
            table = RpProcNotBilledIns.GetProcsNotBilled(new List <long>(), true, DateTime.Now.AddDays(-10), DateTime.Now, false, false);
            Assert.IsNotNull(table);
            Assert.IsTrue(table.Rows.Count > 0);
            Assert.IsTrue(table.Select().Select(x => PIn.Long(x["PatNum"].ToString())).Contains(patient.PatNum));
        }
Example #7
0
        public void X834_ImportInsurancePlans_ReplaceSecondaryPatPlan()
        {
            Patient pat    = Createx834Patient();
            string  suffix = MethodBase.GetCurrentMethod().Name;
            //Create primary insurance plan that appears in the 834.
            InsuranceInfo insurancePrimary = InsuranceT.AddInsurance(pat, "Old Carrier" + suffix, subscriberID: "CG00000B");
            //Create secondary insurance that does not appear in the 834.
            InsuranceInfo insuranceSecondary = InsuranceT.AddInsurance(pat, "Secondary Carrier" + suffix);
            //Get the pat plans for this patient from the database.
            List <PatPlan> listPatPlans = PatPlans.GetPatPlansForPat(pat.PatNum);

            Assert.AreEqual(2, listPatPlans.Count);
            //Create x834
            X834 x834 = new X834(new X12object(Properties.Resources.x834Test));
            int  createdPatsCount, updatedPatsCount, skippedPatsCount, createdCarrierCount, createdInsPlanCount, updatedInsPlanCount, createdInsSubCount,
                 updatedInsSubCount, createdPatPlanCount, droppedPatPlanCount, updatedPatPlanCount;
            StringBuilder sbErrorMessages;

            //Pass in true for dropExistingInsurance
            EtransL.ImportInsurancePlans(x834, new List <Patient> {
                pat
            }, true, true, out createdPatsCount,
                                         out updatedPatsCount, out skippedPatsCount, out createdCarrierCount, out createdInsPlanCount, out updatedInsPlanCount, out createdInsSubCount,
                                         out updatedInsSubCount, out createdPatPlanCount, out droppedPatPlanCount, out updatedPatPlanCount, out sbErrorMessages);
            //Get the pat plans for this patient from the database.
            listPatPlans = PatPlans.GetPatPlansForPat(pat.PatNum);
            Assert.AreEqual(1, listPatPlans.Count);
            Assert.AreEqual(1, droppedPatPlanCount);
            //These should be different as a new plan was created and the old plan was dropped.
            Assert.AreEqual(insurancePrimary.ListPatPlans[0].PatPlanNum, listPatPlans[0].PatPlanNum);
        }
Example #8
0
        private bool AddSinglePatient(out Guid newPatientId)
        {
            var rand = new Random();

            newPatientId = Guid.Empty;

            string name = commonNames[rand.Next(commonNames.Length - 1)];
            // Create a random patient info
            PatientInfo patIfno = new PatientInfo(name, rand.Next(11111, 99999),
                                                  name + "@" + "abcd.com", "aaaa", Guid.Empty);


            InsuranceInfo insuranceInfo = new InsuranceInfo(patIfno.m_patientId, "BasicMedicalPlan");

            patIfno.m_insuranceId = insuranceInfo.m_insuranceId;
            PhysicianDetails physicianDetails =
                new PhysicianDetails(commonNames[rand.Next(commonNames.Length - 1)], "General Medicine");

            if (!DBOperations.GetInstance().CreateNewPatient(patIfno, insuranceInfo, physicianDetails))
            {
                return(false);
            }

            newPatientId = patIfno.m_patientId;

            return(true);
        }
Example #9
0
        public void X834_ImportInsurancePlans_DoNotReplacePatPlan()
        {
            Patient pat    = Createx834Patient();
            string  suffix = MethodBase.GetCurrentMethod().Name;
            //Create old insurance plan and associate it to them.
            InsuranceInfo insuranceOld = InsuranceT.AddInsurance(pat, "Old Carrier" + suffix);
            //Create x834
            X834 x834 = new X834(new X12object(Properties.Resources.x834Test));
            int  createdPatsCount, updatedPatsCount, skippedPatsCount, createdCarrierCount, createdInsPlanCount, updatedInsPlanCount, createdInsSubCount,
                 updatedInsSubCount, createdPatPlanCount, droppedPatPlanCount, updatedPatPlanCount;
            StringBuilder sbErrorMessages;

            EtransL.ImportInsurancePlans(x834, new List <Patient> {
                pat
            }, true, false, out createdPatsCount,
                                         out updatedPatsCount, out skippedPatsCount, out createdCarrierCount, out createdInsPlanCount, out updatedInsPlanCount, out createdInsSubCount,
                                         out updatedInsSubCount, out createdPatPlanCount, out droppedPatPlanCount, out updatedPatPlanCount, out sbErrorMessages);
            //Get the pat plans for this patient from the database.
            List <PatPlan> listPatPlans = PatPlans.GetPatPlansForPat(pat.PatNum);

            //No patient was created. Should have matched the one we created.
            Assert.AreEqual(0, createdPatsCount);
            //There should be two now as the old was kept.
            Assert.AreEqual(2, listPatPlans.Count);
            Assert.AreEqual(1, createdPatPlanCount);
        }
Example #10
0
        public void AddOrUpdateClient(InsuranceInfo info)
        {
            using (var conn = OpenConnection())
            {
                conn.Open();

                string cmdText;
                if (Crashed(info, conn) != null)
                {
                    cmdText = "UPDATE Clients SET Crashed = 0";
                }
                else
                {
                    cmdText =
                        @"INSERT INTO Clients 
					(FirstName, LastName, MiddleName, ModelName, Passport, StateId, Crashed) VALUES (@fn, @ln, @mn, @modName, @pass, @stId, 0)"                    ;
                }
                using (var cmd = conn.CreateCommand())
                {
                    cmd.CommandText = cmdText;
                    cmd.Parameters.AddWithValue("@fn", info.PersonalDetails.FirstName);
                    cmd.Parameters.AddWithValue("@ln", info.PersonalDetails.LastName);
                    cmd.Parameters.AddWithValue("@mn", info.PersonalDetails.MiddleName);
                    cmd.Parameters.AddWithValue("@modName", info.CarDetails.ModelName);
                    cmd.Parameters.AddWithValue("@pass", info.CarDetails.Passport);
                    cmd.Parameters.AddWithValue("@stId", info.CarDetails.StateId);

                    cmd.ExecuteNonQuery();
                }
            }
        }
        public void FeeSchedTools_GlobalUpdateWriteoffEstimates_SubscriberInDifferentFamily()
        {
            string        suffix   = MethodBase.GetCurrentMethod().Name;
            string        procStr  = "D0145";
            double        procFee  = 100;
            ProcedureCode procCode = ProcedureCodes.GetProcCode(procStr);
            //Set up clinic, prov, pat
            Clinic  clinic        = ClinicT.CreateClinic(suffix);
            long    feeSchedNum   = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, suffix);
            long    provNum       = ProviderT.CreateProvider(suffix, feeSchedNum: feeSchedNum);
            Fee     fee           = FeeT.GetNewFee(feeSchedNum, procCode.CodeNum, procFee, clinic.ClinicNum, provNum);
            Patient pat           = PatientT.CreatePatient(suffix, provNum, clinic.ClinicNum);
            Patient patSubscriber = PatientT.CreatePatient(suffix + "_Subscriber", provNum, clinic.ClinicNum);
            //Set up insurance
            InsuranceInfo info = InsuranceT.AddInsurance(pat, suffix, "p", feeSchedNum);

            info.PriInsSub.Subscriber = patSubscriber.PatNum;
            InsSubs.Update(info.PriInsSub);
            info.ListBenefits.Add(BenefitT.CreatePercentForProc(info.PriInsPlan.PlanNum, procCode.CodeNum, 100));
            //Create the procedure and claimproc
            Procedure proc         = ProcedureT.CreateProcedure(pat, procStr, ProcStat.TP, "", procFee);
            ClaimProc priClaimProc = ClaimProcT.CreateClaimProc(pat.PatNum, proc.ProcNum, info.PriInsPlan.PlanNum, info.PriInsSub.InsSubNum, DateTime.Today,
                                                                -1, -1, -1, ClaimProcStatus.CapEstimate);

            Procedures.ComputeEstimates(proc, pat.PatNum, new List <ClaimProc>(), true, info.ListInsPlans, info.ListPatPlans, info.ListBenefits, pat.Age,
                                        info.ListInsSubs);
            priClaimProc = ClaimProcs.Refresh(pat.PatNum).FirstOrDefault(x => x.ProcNum == proc.ProcNum);
            Assert.AreEqual(procFee, priClaimProc.InsPayEst);
            GlobalUpdateWriteoffs(clinic.ClinicNum);
            priClaimProc = ClaimProcs.Refresh(pat.PatNum).FirstOrDefault(x => x.ClaimProcNum == priClaimProc.ClaimProcNum);
            Assert.AreEqual(procFee, priClaimProc.InsPayEst);
        }
Example #12
0
        protected override void SavePageData()
        {
            InsuranceInfo I = new InsuranceInfo();

            I.Lines = new ArrayOfInsuranceLineItem();
            I.Lines.Add(new InsuranceLineItem());
            Order.Products.Add(I);
        }
Example #13
0
        // GET: InsuranceInfoes
        public ActionResult GenerateIVPartial(int id)
        {
            var           DatabaseSelection = from x in db.InsuranceInfoDatabase where x.GroupingID == id select x;
            InsuranceInfo insuranceInfo     = DatabaseSelection.First();

            TempData["insuranceInfo"] = insuranceInfo;
            return(RedirectToAction("GeneratePDFforIV", "InsuranceVerifications", new { id = id }));
        }
Example #14
0
 public bool WasWithoutCrashes(InsuranceInfo info)
 {
     using (var conn = OpenConnection())
     {
         conn.Open();
         return(Crashed(info, conn) == false);
     }
 }
Example #15
0
        public ActionResult DeleteConfirmed(int id, int groupingid)
        {
            InsuranceInfo insuranceInfo = db.InsuranceInfoDatabase.Find(id);

            db.InsuranceInfoDatabase.Remove(insuranceInfo);
            db.SaveChanges();
            //return RedirectToAction("Index");
            return(RedirectToAction("PatientInsuranceIndex", "InsuranceInfoes", new { id = groupingid }));
        }
Example #16
0
        // GET: InsuranceInfoes/Edit/5
        public ActionResult Edit(int?id)
        {
            InsuranceInfo insuranceInfo = db.InsuranceInfoDatabase.Find(id);

            if (insuranceInfo == null)
            {
                return(HttpNotFound());
            }
            return(View(insuranceInfo));
        }
Example #17
0
        /// <summary>
        /// Restores state data.
        /// </summary>
        protected override void RestorePageData()
        {
            InsuranceInfo I = (InsuranceInfo)Order["Insurance"];

            if (I == null)
            {
                return;
            }
            Items.CopyFrom(I.Lines);
        }
        /// <summary>
        /// Inserts a record into the customer orders table.
        /// </summary>
        private int Insert_Order(InsuranceInfo Order)
        {
            SqlCommand Cmd = GetCommand("INS_Insert_Order");

            Order.Detail.CopyTo(Cmd);
            Order.User.CopyTo(Cmd);
            Order.S.CopyTo(Cmd);
            Cmd.Parameters["@OrderId"].Direction = ParameterDirection.Output;
            Cmd.ExecuteNonQuery();
            return((int)Cmd.Parameters["@OrderId"].Value);
        }
Example #19
0
 public ActionResult Edit([Bind(Include = "ID,GroupingID,PatientName,DOB,PrimaryInsurer,InsuranceHolder,GroupNumber,IDNumber,PlanName")] InsuranceInfo insuranceInfo)
 {
     if (ModelState.IsValid)
     {
         db.Entry(insuranceInfo).State = EntityState.Modified;
         db.SaveChanges();
         //return RedirectToAction("Index");
         return(RedirectToAction("Index", "Subjects"));
     }
     return(View(insuranceInfo));
 }
Example #20
0
        /// <summary>
        /// Saves state data.
        /// </summary>
        protected override void SavePageData()
        {
            InsuranceInfo I = (InsuranceInfo)Order["Insurance"];

            if (I == null)
            {
                I = new InsuranceInfo();
                Order.Products.Add(I);
            }
            I.Lines = (ArrayOfInsuranceLineItem)Items.CopyTo(new ArrayOfInsuranceLineItem());
            Order.UpdateLines("Insurance");
        }
Example #21
0
        public ActionResult Create([Bind(Include = "ID,PatientName,DOB,PrimaryInsurer,InsuranceHolder,GroupNumber,IDNumber,PlanName")] InsuranceInfo insuranceInfo)
        {
            if (ModelState.IsValid)
            {
                insuranceInfo.GroupingID = (int)TempData["InsuranceCreationKey"];

                db.InsuranceInfoDatabase.Add(insuranceInfo);
                db.SaveChanges();

                return(RedirectToAction("Index", "Subjects"));
            }

            return(View(insuranceInfo));
        }
Example #22
0
        public void LedgersTests_ComputeAging_PayPlanDynamicCreditsWithClaimProcs()
        {
            List <Procedure>  listProcs = new List <Procedure>();
            List <Adjustment> listAdjs  = new List <Adjustment>();
            long          provNum       = ProviderT.CreateProvider("Aging_PayPlanDynamic");
            string        suffix        = MethodBase.GetCurrentMethod().Name;
            Patient       pat           = PatientT.CreatePatient(fName: "Aging_PayPlanDynamic", suffix: suffix);
            Family        fam           = Patients.GetFamily(pat.PatNum);
            Procedure     proc45        = ProcedureT.CreateProcedure(pat, "D0210", ProcStat.C, "", 45, DateTime.Today.AddDays(-61), provNum: provNum);
            ClaimProc     cp45          = new ClaimProc();
            InsuranceInfo insInfo       = InsuranceT.AddInsurance(pat, "DynPayPlan");

            ClaimProcs.CreateEst(cp45, proc45, insInfo.PriInsPlan, insInfo.PriInsSub);
            cp45.Status      = ClaimProcStatus.NotReceived;
            cp45.InsEstTotal = -1;
            cp45.InsPayEst   = 15;
            cp45.WriteOffEst = 0;
            cp45.WriteOff    = 0;
            ClaimProcs.Update(cp45);
            listProcs.AddRange(new List <Procedure> {
                proc45
            });
            PayPlan payPlan = PayPlanT.CreateDynamicPaymentPlan(pat.PatNum, pat.PatNum, DateTime.Today.AddDays(-1), 0, 0, 30, listProcs, listAdjs);
            //make two non payplan productions to put on the account
            Procedure procUnattached = ProcedureT.CreateProcedure(pat, "D0210", ProcStat.C, "", 35, DateTime.Today.AddDays(-91), provNum: provNum);
            //Run pay plan logic to generate first set of charges
            List <PayPlanCharge> listChargesDb = PayPlanCharges.GetForPayPlan(payPlan.PayPlanNum);
            List <PayPlanLink>   listEntries   = PayPlanLinks.GetForPayPlans(new List <long> {
                payPlan.PayPlanNum
            });
            PayPlanTerms         terms = PayPlanT.GetTerms(payPlan, listEntries);
            List <PayPlanCharge> listChargesThisPeriod = PayPlanEdit.GetListExpectedCharges(listChargesDb, terms, fam, listEntries, payPlan, true);

            Assert.AreEqual(30, listChargesThisPeriod.Sum(x => x.Principal));
            foreach (PayPlanCharge charge in listChargesThisPeriod)
            {
                PayPlanCharges.Insert(charge);
            }
            int payPlansVersionPrev = PrefC.GetInt(PrefName.PayPlansVersion);

            try {
                PrefT.UpdateInt(PrefName.PayPlansVersion, (int)PayPlanVersions.AgeCreditsAndDebits);
                CheckAgingProcLifo(pat.PatNum, 30, 0, 15, 35, 30, YN.Yes);        //new - pay plan credit of $30 gets applied to cooresponding procedure
                CheckAgingProcLifo(pat.PatNum, 30, 0, 45, 5, 30, YN.No);          //old - pay plan credit gets applied to oldest production on the account
                CheckAgingProcLifo(pat.PatNum, 30, 0, 45, 5, 30, YN.Unknown);
            }
            finally {
                PrefT.UpdateInt(PrefName.PayPlansVersion, payPlansVersionPrev);
            }
        }
Example #23
0
        public PermitView(Services services, NancyContext context)
        {
            User = context.CurrentUser as AuthUser;

            Hauler    = User.ToHaulerInfo();
            Company   = new CompanyInfo();
            Insurance = new InsuranceInfo();
            Vehicle   = new VehicleInfo();
            Truck     = new TruckInfo();
            Axle      = new AxleInfo();
            Trailer   = new TrailerInfo();
            Load      = new LoadInfo();
            Movement  = new MovementInfo();
        }
Example #24
0
        public void Benefits_OverAgeWithLifetimeMax()
        {
            string        suffix = MethodBase.GetCurrentMethod().Name;
            Patient       pat    = PatientT.CreatePatient(suffix, birthDate: DateTime.Now.AddYears(-20));
            InsuranceInfo ins    = InsuranceT.AddInsurance(pat, suffix);

            BenefitT.CreateCategoryPercent(ins.PrimaryInsPlan.PlanNum, EbenefitCategory.Orthodontics, 50);
            BenefitT.CreateAgeLimitation(ins.PrimaryInsPlan.PlanNum, EbenefitCategory.Orthodontics, 18);
            BenefitT.CreateOrthoMax(ins.PrimaryInsPlan.PlanNum, 1000);
            ins.RefreshBenefits();
            Procedure        proc           = ProcedureT.CreateProcedure(pat, "D8090", ProcStat.TP, "", 3000);//comprehensive orthodontic treatment
            List <ClaimProc> listClaimProcs = ProcedureT.ComputeEstimates(pat, ins);

            Assert.AreEqual(0, listClaimProcs.First().InsEstTotal);
        }
        public int Begin_Transaction(InsuranceInfo Order)
        {
            //Start the transaction.
            if (LogInsert)
            {
                CSAAWeb.AppLogger.Logger.Log(Order.ToString());
            }
            StartTransaction();
            try
            {
                //START Changed by Cognizant on 05/25/2004 for checking the Payment and Product Type Combination for each line Item.
                for (int i = 0; i < Order.Lines.Count; i++)
                {
                    SqlCommand CmdCheck = GetCommand("Check_Payment_Product");
                    CmdCheck.Parameters.Add("@Payment_Type_ID", Order.Detail.PaymentType);
                    CmdCheck.Parameters.Add("@Product_Type_Code", Order.Lines[i].ProductType);

                    SqlParameter P = CmdCheck.Parameters.Add("@Match", SqlDbType.Int);
                    P.Direction = ParameterDirection.Output;

                    CmdCheck.ExecuteNonQuery();
                    if ((int)CmdCheck.Parameters["@Match"].Value == 0)
                    {
                        throw new Exception("Payment Type and Product Type doesn't Match");
                    }
                }
                //END
                int OrderId = Insert_Order(Order);
                // Build the command here for next one which is called repeatedly.
                SqlCommand Cmd = GetCommand("INS_Insert_Item");
                for (int i = 0; i < Order.Lines.Count; i++)
                {
                    Insert_Record(Cmd, OrderId, Order.Lines[i]);
                }
                Cmd = GetCommand("INS_Insert_Address");
                for (int i = 0; i < Order.Addresses.Count; i++)
                {
                    Insert_Record(Cmd, OrderId, Order.Addresses[i]);
                }
                CompleteTransaction(true);
                return(OrderId);
            }
            catch
            {
                CompleteTransaction(false);
                throw;
            }
        }
Example #26
0
        public void LedgersTests_ComputeAgingProcLifo_InsWoEst_And_InsPayEst()
        {
            string        suffix  = MethodBase.GetCurrentMethod().Name;
            Patient       pat     = PatientT.CreatePatient(fName: "Aging_InsEst", suffix: suffix);
            InsuranceInfo insInfo = InsuranceT.AddInsurance(pat, "AgingInsEst");
            Procedure     proc95  = ProcedureT.CreateProcedure(pat, "D0270", ProcStat.C, "", 1000, DateTime.Today.AddDays(-95));
            ClaimProc     cp95    = new ClaimProc();

            ClaimProcs.CreateEst(cp95, proc95, insInfo.PriInsPlan, insInfo.PriInsSub);
            cp95.Status      = ClaimProcStatus.NotReceived;
            cp95.InsEstTotal = 800;
            cp95.InsPayEst   = 800;
            cp95.WriteOffEst = 200;
            cp95.WriteOff    = 200;
            ClaimProcs.Update(cp95);
            Procedure proc85 = ProcedureT.CreateProcedure(pat, "D1110", ProcStat.C, "", 100, DateTime.Today.AddDays(-85));
            ClaimProc cp85   = new ClaimProc();

            ClaimProcs.CreateEst(cp85, proc85, insInfo.PriInsPlan, insInfo.PriInsSub);
            cp85.Status      = ClaimProcStatus.NotReceived;
            cp85.InsEstTotal = 60;
            cp85.InsPayEst   = 60;
            cp85.WriteOffEst = 40;
            cp85.WriteOff    = 40;
            ClaimProcs.Update(cp85);
            int agingProcLifoPrev = PrefC.GetInt(PrefName.AgingProcLifo);

            try {
                PrefT.UpdateInt(PrefName.AgingProcLifo, (int)YN.No);
                Dictionary <long, DataRow> dictAging = Ledgers.GetAgingGuarTransTable(DateTime.Today, new List <long> {
                    pat.Guarantor
                });
                Assert.AreEqual(PIn.Double(dictAging[pat.Guarantor]["InsPayEst"].ToString()), 860);
                Assert.AreEqual(PIn.Double(dictAging[pat.Guarantor]["InsWoEst"].ToString()), 240);
                PrefT.UpdateInt(PrefName.AgingProcLifo, (int)YN.Yes);
                dictAging = Ledgers.GetAgingGuarTransTable(DateTime.Today, new List <long> {
                    pat.Guarantor
                });
                Assert.AreEqual(PIn.Double(dictAging[pat.Guarantor]["InsPayEst"].ToString()), 860);
                Assert.AreEqual(PIn.Double(dictAging[pat.Guarantor]["InsWoEst"].ToString()), 240);
            }
            finally {
                PrefT.UpdateInt(PrefName.AgingProcLifo, agingProcLifoPrev);
            }
        }
Example #27
0
 static bool?Crashed(InsuranceInfo info, SqlConnection conn)
 {
     using (var cmd = conn.CreateCommand())
     {
         cmd.CommandText = "SELECT Crashed FROM Clients WHERE FirstName = @fn AND LastName = @ln AND MiddleName = @mn";
         cmd.Parameters.AddWithValue("@fn", info.PersonalDetails.FirstName);
         cmd.Parameters.AddWithValue("@ln", info.PersonalDetails.LastName);
         cmd.Parameters.AddWithValue("@mn", info.PersonalDetails.MiddleName);
         using (var reader = cmd.ExecuteReader())
         {
             if (reader.Read())
             {
                 return((bool)reader["Crashed"]);
             }
         }
     }
     return(null);
 }
Example #28
0
 public DataTable getInsSearch(InsuranceInfo insInfo)
 {
     DataTable dtable = new DataTable();
     try
     {
         SqlConnection con = new SqlConnection(ConStr);
         SqlCommand sqlCmd = new SqlCommand("select * from Insurance_Info where Ins_Name = '" + insInfo.InsName + "'", con);
         SqlDataReader sqlDr;
         con.Open();
         sqlDr = sqlCmd.ExecuteReader();
         dtable.Load(sqlDr);
         con.Close();
     }
     catch (Exception ex)
     {
         objNLog.Error("Exception : " + ex.Message);
     }
     return dtable;
 }
        public void ProcMultiVisitTests_CrownGroupComplete_ClaimDates()
        {
            string           suffix       = MethodBase.GetCurrentMethod().Name;
            Patient          pat          = PatientT.CreatePatient(suffix);
            InsuranceInfo    insInfo      = InsuranceT.AddInsurance(pat, suffix);
            List <Procedure> listProcs    = new List <Procedure>();
            Procedure        procBillable = ProcedureT.CreateProcedure(pat, "D2750", ProcStat.TP, "1", 100, new DateTime(2018, 5, 1));//PFM

            listProcs.Add(procBillable);
            Procedure procDelivery = ProcedureT.CreateProcedure(pat, "N4118", ProcStat.TP, "1", 0, new DateTime(2018, 8, 20));   //Seat - usually completed several months later.

            listProcs.Add(procDelivery);
            List <ClaimProc> listClaimProcs = ProcedureT.ComputeEstimates(pat, insInfo);

            ProcMultiVisits.CreateGroup(listProcs);
            Procedure procBillableOld = procBillable.Copy();

            procBillable.ProcStatus = ProcStat.C;
            Procedures.Update(procBillable, procBillableOld);
            Procedure procDeliveryOld = procDelivery.Copy();

            procDelivery.ProcStatus = ProcStat.C;
            Procedures.Update(procDelivery, procDeliveryOld);
            Assert.AreEqual(ProcMultiVisits.IsProcInProcess(procBillable.ProcNum), false);           //Both procedures complete means the group is now complete (not In Process).
            Assert.AreEqual(ProcMultiVisits.IsProcInProcess(procDelivery.ProcNum), false);           //Both procedures complete means the group is now complete (not In Process).
            Claim claim = new Claim();

            claim.DateSent     = DateTimeOD.Today;
            claim.DateSentOrig = DateTime.MinValue;
            claim.ClaimStatus  = "W";
            //Dates of service are calculated inside AccountModules.CreateClaim().
            //The procDelivery cannot be attached to the claim in the UI, because $0 procs are blocked by UI.  Therefore, we only attach the procBilled to the claim here.
            ODTuple <bool, Claim, string> clmResult = AccountModules.CreateClaim(claim, "P", insInfo.ListPatPlans, insInfo.ListInsPlans, listClaimProcs, listProcs,
                                                                                 insInfo.ListInsSubs, pat, null, new List <Procedure> {
                procBillable
            }, "", insInfo.PriInsPlan, insInfo.PriInsSub, Relat.Self);

            Assert.AreEqual(clmResult.Item3, "");                                //Ensure no validation errors creating the claim.  This is to verify the integrity of the unit test design.
            Assert.AreEqual(clmResult.Item2.DateService, procDelivery.ProcDate); //Claim date of service must always be the greatest date in the multi visit group.
            listClaimProcs = ClaimProcs.RefreshForClaim(clmResult.Item2.ClaimNum);
            Assert.AreEqual(listClaimProcs[0].ProcDate, procDelivery.ProcDate);  //Proc date of service must always be the greatest date in the multi visit group, even if performed on a different day.
        }
        public void FeeSchedTools_GlobalUpdateWriteoffEstimates()
        {
            string        suffix   = MethodBase.GetCurrentMethod().Name;
            string        procStr  = "D0145";
            double        procFee  = 100;
            ProcedureCode procCode = ProcedureCodes.GetProcCode(procStr);
            //Set up clinic, prov, pat
            Clinic  clinic      = ClinicT.CreateClinic(suffix);
            long    feeSchedNum = FeeSchedT.CreateFeeSched(FeeScheduleType.FixedBenefit, suffix);
            long    provNum     = ProviderT.CreateProvider(suffix, feeSchedNum: feeSchedNum);
            Fee     fee         = FeeT.GetNewFee(feeSchedNum, procCode.CodeNum, procFee, clinic.ClinicNum, provNum);
            Patient pat         = PatientT.CreatePatient(suffix, provNum, clinic.ClinicNum);
            //Set up insurance
            InsuranceInfo  info         = InsuranceT.AddInsurance(pat, suffix, "c", feeSchedNum);
            List <InsSub>  listSubs     = info.ListInsSubs;
            List <InsPlan> listPlans    = info.ListInsPlans;
            List <PatPlan> listPatPlans = info.ListPatPlans;
            InsPlan        priPlan      = info.PriInsPlan;
            InsSub         priSub       = info.PriInsSub;

            info.ListBenefits.Add(BenefitT.CreatePercentForProc(priPlan.PlanNum, procCode.CodeNum, 90));
            //Create the procedure and claimproc
            Procedure proc         = ProcedureT.CreateProcedure(pat, procStr, ProcStat.TP, "", procFee);
            ClaimProc priClaimProc = ClaimProcT.CreateClaimProc(pat.PatNum, proc.ProcNum, priPlan.PlanNum, priSub.InsSubNum, DateTime.Today, -1, -1, -1,
                                                                ClaimProcStatus.CapEstimate);

            Procedures.ComputeEstimates(proc, pat.PatNum, new List <ClaimProc>(), true, listPlans, listPatPlans, info.ListBenefits, pat.Age, info.ListInsSubs);
            priClaimProc = ClaimProcs.Refresh(pat.PatNum).FirstOrDefault(x => x.ProcNum == proc.ProcNum);
            Assert.AreEqual(procFee, priClaimProc.WriteOff);
            procFee = 50;
            Procedure procNew = proc.Copy();

            procNew.ProcFee = procFee;
            Procedures.Update(procNew, proc);
            //GlobalUpdate
            long updated = GlobalUpdateWriteoffs(clinic.ClinicNum);

            Assert.AreEqual(1, updated);
            ClaimProc priClaimProcDb = ClaimProcs.Refresh(pat.PatNum).FirstOrDefault(x => x.ClaimProcNum == priClaimProc.ClaimProcNum);

            Assert.AreEqual(procFee, priClaimProcDb.WriteOff);
        }
        public void RpProcNotBilledIns_GetProcsNotBilled_ShowProcsBeforeIns()
        {
            string        suffix        = MethodBase.GetCurrentMethod().Name;
            Patient       patient       = PatientT.CreatePatient(suffix);
            Carrier       carrier       = CarrierT.CreateCarrier(suffix);
            ProcedureCode procedureCode = ProcedureCodeT.CreateProcCode("T7782");
            Procedure     procedure     = ProcedureT.CreateProcedure(patient, procedureCode.ProcCode, ProcStat.C, "", 55, procDate: DateTime.Now.AddDays(-3));
            //Add insurance after the procedure has been set complete.
            InsuranceInfo insuranceInfo = InsuranceT.AddInsurance(patient, carrier.CarrierName, ordinal: 1, isMedical: true);
            //The patient should not be returned when 'showProcsBeforeIns' is set to false.
            DataTable table = RpProcNotBilledIns.GetProcsNotBilled(new List <long>(), false, DateTime.Now.AddDays(-10), DateTime.Now, false, false);

            Assert.IsNotNull(table);
            Assert.IsFalse(table.Select().Select(x => PIn.Long(x["PatNum"].ToString())).Contains(patient.PatNum));
            //The patient should be returned when 'showProcsBeforeIns' is set to true.
            table = RpProcNotBilledIns.GetProcsNotBilled(new List <long>(), true, DateTime.Now.AddDays(-10), DateTime.Now, true, false);
            Assert.IsNotNull(table);
            Assert.IsTrue(table.Rows.Count > 0);
            Assert.IsTrue(table.Select().Select(x => PIn.Long(x["PatNum"].ToString())).Contains(patient.PatNum));
        }
Example #32
0
        private void RenderInsuranceInfo(JToken attachments)
        {
            JToken        attachment  = attachments[0];
            string        type        = Convert.ToString(attachment["type"]);
            StringBuilder description = new StringBuilder();

            string title = string.Empty;

            if (type == "quote")
            {
                string quote = string.Format("Type: {1}{0}Car model: {2} {3}{0}Car cost: {4}{0}Start date: {5}", Environment.NewLine, attachment["coverage"],
                                             attachment["make"], attachment["model"], attachment["worth"], attachment["startDate"]);
                description.Append(quote);

                title = "Your car insurance" + Environment.NewLine + "will be:";
            }
            else if (type == "payment_plan")
            {
                foreach (var row in attachment["rows"])
                {
                    description.AppendLine(string.Format("{0} {1}", row["text"], row["value"]));
                }

                var lastTextMessage = this.chat.Items.LastOrDefault(a => a is ChatMessage && ((ChatMessage)a).Author == this.chat.Author) as TextMessage;
                if (lastTextMessage != null)
                {
                    title = lastTextMessage.Text;
                }
            }

            InsuranceInfo insuranceInfo = new InsuranceInfo();

            insuranceInfo.Title       = title;
            insuranceInfo.Description = description.ToString();
            insuranceInfo.TotalValue  = string.Format("Total: {0}", attachment["premium"]);

            ChatItem insuranceInfoMessage = new ChatItem();

            insuranceInfoMessage.Data = insuranceInfo;
            this.chat.Items.Add(insuranceInfoMessage);
        }
Example #33
0
 public int getInsuranceID(InsuranceInfo insInfo)
 {
     int InsuranceID = 0;
     try
     {
         SqlConnection con = new SqlConnection(ConStr);
         SqlCommand sqlCmd = new SqlCommand("select Ins_ID from Insurance_Info where Ins_Name = '" + insInfo.InsName + "'", con);
         con.Open();
         InsuranceID = Convert.ToInt32(sqlCmd.ExecuteScalar());
         con.Close();
     }
     catch (Exception ex)
     {
         objNLog.Error("Exception : " + ex.Message);
     }
     return InsuranceID;
 }
Example #34
0
    public int Update_InsInfo(InsuranceInfo insInfo,string userID)
    {
        int flag = 0;
        try
        {
            SqlConnection con = new SqlConnection(ConStr);
            SqlCommand sqlCmd = new SqlCommand();
            sqlCmd.Connection = con;
            sqlCmd.CommandText = "sp_update_Insurance_Info";
            sqlCmd.CommandType = CommandType.StoredProcedure;

            sqlCmd.CommandType = CommandType.StoredProcedure;
            SqlParameter InsuranceID = sqlCmd.Parameters.Add("@Ins_ID", SqlDbType.Int);
            InsuranceID.Value = insInfo.InsID;
            SqlParameter InsuranceNumber = sqlCmd.Parameters.Add("@Ins_Number", SqlDbType.VarChar, 50);
            if (insInfo.InsNumber != null)
                InsuranceNumber.Value = insInfo.InsNumber;
            else
                InsuranceNumber.Value = Convert.DBNull;

            SqlParameter InsuranceCompany = sqlCmd.Parameters.Add("@Ins_Company", SqlDbType.VarChar, 50);
            if (insInfo.InsCompany != null)
                InsuranceCompany.Value = insInfo.InsCompany;
            else
                InsuranceCompany.Value = Convert.DBNull;
            SqlParameter InsuranceAddress1 = sqlCmd.Parameters.Add("@Ins_Address1", SqlDbType.VarChar, 50);
            if (insInfo.InsAddress1 != null)
                InsuranceAddress1.Value = insInfo.InsAddress1;
            else
                InsuranceAddress1.Value = Convert.DBNull;
            SqlParameter InsuranceAddress2 = sqlCmd.Parameters.Add("@Ins_Address2", SqlDbType.VarChar, 50);
            if (insInfo.InsAddress2 != null)
                InsuranceAddress2.Value = insInfo.InsAddress2;
            else
                InsuranceAddress2.Value = Convert.DBNull;
            SqlParameter InsuranceCity = sqlCmd.Parameters.Add("@Ins_City", SqlDbType.VarChar, 50);
            if (insInfo.InsCity != null)
                InsuranceCity.Value = insInfo.InsCity;
            else
                InsuranceCity.Value = Convert.DBNull;
            SqlParameter InsuranceState = sqlCmd.Parameters.Add("@Ins_State", SqlDbType.VarChar, 50);
            if (insInfo.InsState != null)
                InsuranceState.Value = insInfo.InsState;
            else
                InsuranceState.Value = Convert.DBNull;
            SqlParameter InsuranceZip = sqlCmd.Parameters.Add("@Ins_Zip", SqlDbType.VarChar, 50);
            if (insInfo.InsZip != null)
                InsuranceZip.Value = insInfo.InsZip;
            else
                InsuranceZip.Value = Convert.DBNull;
            SqlParameter InsurancePhone = sqlCmd.Parameters.Add("@Ins_Phone", SqlDbType.VarChar, 50);
            if (insInfo.InsPhone != null)
                InsurancePhone.Value = insInfo.InsPhone;
            else
                InsurancePhone.Value = Convert.DBNull;
            SqlParameter InsuranceFax = sqlCmd.Parameters.Add("@Ins_Fax", SqlDbType.VarChar, 50);
            if (insInfo.InsFax != null)
                InsuranceFax.Value = insInfo.InsFax;
            else
                InsuranceFax.Value = Convert.DBNull;

            SqlParameter pUserID= sqlCmd.Parameters.Add("@UserID", SqlDbType.VarChar, 20);
            pUserID.Value = userID;

            con.Open();
            sqlCmd.ExecuteNonQuery();
            flag = 1;
            con.Close();

        }

        catch (Exception ex)
        {
            objNLog.Error("Exception : " + ex.Message);

        }

        return flag;
    }