コード例 #1
0
        /*public static void SetToothNum(Procedure procedure,string toothNum){
         *      Procedure oldProcedure=procedure.Copy();
         *      procedure.ToothNum=toothNum;
         *      Procedures.Update(procedure,oldProcedure);
         * }*/

        public static void SetPriority(Procedure procedure, int priority)
        {
            Procedure oldProcedure = procedure.Copy();

            procedure.Priority = Defs.GetDefsForCategory(DefCat.TxPriorities, true)[priority].DefNum;
            Procedures.Update(procedure, oldProcedure);
        }
コード例 #2
0
ファイル: ProcedureT.cs プロジェクト: steev90/opendental
        /*public static void SetToothNum(Procedure procedure,string toothNum){
         *      Procedure oldProcedure=procedure.Copy();
         *      procedure.ToothNum=toothNum;
         *      Procedures.Update(procedure,oldProcedure);
         * }*/

        public static void SetPriority(Procedure procedure, int priority)
        {
            Procedure oldProcedure = procedure.Copy();

            procedure.Priority = DefC.Short[(int)DefCat.TxPriorities][priority].DefNum;
            Procedures.Update(procedure, oldProcedure);
        }
コード例 #3
0
        public void ProcMultiVisitTests_Crown_PseudoStatusStages()
        {
            string           suffix       = MethodBase.GetCurrentMethod().Name;
            Patient          pat          = PatientT.CreatePatient(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);
            ProcMultiVisits.CreateGroup(listProcs);
            Assert.IsFalse(ProcMultiVisits.IsProcInProcess(procBillable.ProcNum));            //This proc is not in process because there must be at least one complete procedure.
            Assert.IsFalse(ProcMultiVisits.IsProcInProcess(procDelivery.ProcNum));            //This proc is not in process because there must be at least one complete procedure.
            Procedure procBillableOld = procBillable.Copy();

            procBillable.ProcStatus = ProcStat.C;
            Procedures.Update(procBillable, procBillableOld);
            Assert.IsTrue(ProcMultiVisits.IsProcInProcess(procBillable.ProcNum));            //This proc is In Process because it is set complete, while at the same time no all procs in the group are complete.
            Assert.IsFalse(ProcMultiVisits.IsProcInProcess(procDelivery.ProcNum));           //This proc is not In Process because not set to complete.
            Procedure procDeliveryOld = procDelivery.Copy();

            procDelivery.ProcStatus = ProcStat.C;
            Procedures.Update(procDelivery, procDeliveryOld);
            Assert.IsFalse(ProcMultiVisits.IsProcInProcess(procBillable.ProcNum));            //Both procedures complete means the group is now complete (not In Process).
            Assert.IsFalse(ProcMultiVisits.IsProcInProcess(procDelivery.ProcNum));            //Both procedures complete means the group is now complete (not In Process).
        }
コード例 #4
0
ファイル: FormProcBroken.cs プロジェクト: kjb7749/testImport
 public FormProcBroken(Procedure proc)
 {
     _procCur = proc;
     _procOld = proc.Copy();
     InitializeComponent();
     Lan.F(this);
 }
コード例 #5
0
ファイル: ProcTC.cs プロジェクト: kjb7749/testImport
        public static void AttachLabProc(long procNum, Procedure procLab)
        {
            Procedure oldProc = procLab.Copy();

            procLab.ProcNumLab = procNum;
            Procedures.Update(procLab, oldProc);
        }
コード例 #6
0
 public FormProcBroken(Procedure proc, bool isNonRefundable)
 {
     _procCur         = proc;
     _procOld         = proc.Copy();
     _isNonRefundable = isNonRefundable;
     InitializeComponent();
     Lan.F(this);
 }
コード例 #7
0
        public static void SetComplete(Procedure proc, Patient pat, List <InsPlan> planList, List <PatPlan> patPlanList, List <ClaimProc> claimProcList, List <Benefit> benefitList, List <InsSub> subList)
        {
            Procedure     procOld  = proc.Copy();
            ProcedureCode procCode = ProcedureCodes.GetProcCode(proc.CodeNum);

            proc.DateEntryC = DateTime.Now;
            proc.ProcStatus = ProcStat.C;
            Procedures.Update(proc, procOld);
            Procedures.ComputeEstimates(proc, proc.PatNum, claimProcList, false, planList, patPlanList, benefitList, pat.Age, subList);
        }
コード例 #8
0
        private void butOK_Click(object sender, EventArgs e)
        {
            Procedure procOld = ProcCur.Copy();

            ProcCur.UserNum = Security.CurUser.UserNum;
            ProcCur.Note    = textNotes.Text + "\r\n"
                              + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + " " + Security.CurUser.UserName + ":  "
                              + textAppended.Text;
            try {
                SaveSignature();
            }
            catch (Exception ex) {
                MessageBox.Show(Lan.g(this, "Error saving signature.") + "\r\n" + ex.Message);
                //and continue with the rest of this method
            }
            Procedures.Update(ProcCur, procOld);
            DialogResult = DialogResult.OK;
        }
コード例 #9
0
        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);
        }
コード例 #10
0
        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.
        }
コード例 #11
0
        private void butYes_Click(object sender, System.EventArgs e)
        {
            //Customers have been complaining about procedurelog entries changing their CodeNum column to 0.
            //Based on a security log provided by a customer, we were able to determine that this is one of two potential violators.
            //The following code is here simply to try and get the user to call us so that we can have proof and hopefully find the core of the issue.
            try {
                if (_verifyCode < 1)
                {
                    throw new ApplicationException("Invalid Verify Code");
                }
            }
            catch (ApplicationException ae) {
                string error = "Please notify support with the following information.\r\n"
                               + "Error: " + ae.Message + "\r\n"
                               + "_verifyCode: " + _verifyCode.ToString() + "\r\n"
                               + "_procCur.CodeNum: " + (_procCur == null ? "NULL" : _procCur.CodeNum.ToString()) + "\r\n"
                               + "_procCodeCur.CodeNum: " + (_procCodeCur == null ? "NULL" : _procCodeCur.CodeNum.ToString()) + "\r\n"
                               + "\r\n"
                               + "StackTrace:\r\n" + ae.StackTrace;
                MsgBoxCopyPaste MsgBCP = new MsgBoxCopyPaste(error);
                MsgBCP.Text = "Fatal Error!!!";
                MsgBCP.Show();                //Use .Show() to make it easy for the user to keep this window open while they call in.
                return;
            }
            //Moved from FormProcEdit.SaveAndClose() in version 16.3+
            Procedure procOld = _procCur.Copy();

            _procCur.CodeNum = _verifyCode;
            if (new[] { ProcStat.TP, ProcStat.C, ProcStat.TPi }.Contains(_procCur.ProcStatus))           //Only change the fee if Complete or TP
            {
                InsSub  prisub  = null;
                InsPlan priplan = null;
                if (_listPatPlans.Count > 0)
                {
                    prisub  = InsSubs.GetSub(_listPatPlans[0].InsSubNum, _listInsSubs);
                    priplan = InsPlans.GetPlan(prisub.PlanNum, _listInsPlans);
                }
                _procCur.ProcFee = Fees.GetAmount0(_procCur.CodeNum, FeeScheds.GetFeeSched(_patCur, _listInsPlans, _listPatPlans, _listInsSubs, _procCur.ProvNum),
                                                   _procCur.ClinicNum, _procCur.ProvNum);
                if (priplan != null && priplan.PlanType == "p")             //PPO
                {
                    double standardfee = Fees.GetAmount0(_procCur.CodeNum, Providers.GetProv(Patients.GetProvNum(_patCur)).FeeSched, _procCur.ClinicNum,
                                                         _procCur.ProvNum);
                    _procCur.ProcFee = Math.Max(_procCur.ProcFee, standardfee);
                }
            }
            Procedures.Update(_procCur, procOld);
            //Compute estimates required, otherwise if adding through quick add, it could have incorrect WO or InsEst if code changed.
            Procedures.ComputeEstimates(_procCur, _patCur.PatNum, _listClaimProcs, false, _listInsPlans, _listPatPlans, _listBenefits, _patCur.Age, _listInsSubs);
            Recalls.Synch(_procCur.PatNum);
            if (_procCur.ProcStatus.In(ProcStat.C, ProcStat.EO, ProcStat.EC))
            {
                string logText = _procCodeCur.ProcCode + " (" + _procCur.ProcStatus + "), ";
                if (_teethText != null && _teethText.Trim() != "")
                {
                    logText += Lan.g(this, "Teeth") + ": " + _teethText + ", ";
                }
                logText += Lan.g(this, "Fee") + ": " + _procCur.ProcFee.ToString("F") + ", " + _procCodeCur.Descript;
                Permissions perm = Permissions.ProcComplEdit;
                if (_procCur.ProcStatus.In(ProcStat.EO, ProcStat.EC))
                {
                    perm = Permissions.ProcExistingEdit;
                }
                SecurityLogs.MakeLogEntry(perm, _patCur.PatNum, logText);
            }
            DialogResult = DialogResult.OK;
        }
コード例 #12
0
ファイル: AppointmentT.cs プロジェクト: ChemBrain/OpenDental
        ///<summary>Most of the logic for breaking an appointment. Pass in the brokenFee (the number the user enters in the brokenAppointment window),
        ///Optionally pass in if the brokenappointment procedure is being deleted. Returns the broken procedure that was created.</summary>
        public static Procedure BreakAppointment(Appointment appt, Patient pat, ProcedureCode procCode, double feeOverride, bool isDeleteBrokenProc = false)
        {
            //suppressHistory is true due to below logic creating a log with a specific HistAppointmentAction instead of the generic changed.
            DateTime datePrevious    = appt.DateTStamp;
            bool     suppressHistory = false;

            if (procCode != null)
            {
                suppressHistory = procCode.ProcCode == "D9986" || procCode.ProcCode == "D9987";
            }
            Appointments.SetAptStatus(appt, ApptStatus.Broken, suppressHistory); //Appointments S-Class handles Signalods
            if (appt.AptStatus != ApptStatus.Complete)                           //seperate log entry for completed appointments.
            {
                SecurityLogs.MakeLogEntry(Permissions.AppointmentEdit, pat.PatNum,
                                          appt.ProcDescript + ", " + appt.AptDateTime.ToString()
                                          + ", Broken from the Appts module.", appt.AptNum, datePrevious);
            }
            else
            {
                SecurityLogs.MakeLogEntry(Permissions.AppointmentCompleteEdit, pat.PatNum,
                                          appt.ProcDescript + ", " + appt.AptDateTime.ToString()
                                          + ", Broken from the Appts module.", appt.AptNum, datePrevious);
            }
            List <Procedure> listProcedures = Procedures.GetProcsForSingle(appt.AptNum, false);
            //splits should only exist on procs if they are using tp pre-payments
            List <PaySplit> listSplitsForApptProcs = new List <PaySplit>();
            bool            isNonRefundable        = false;
            double          brokenProcAmount       = 0;

            if (listProcedures.Count > 0)
            {
                listSplitsForApptProcs = PaySplits.GetPaySplitsFromProcs(listProcedures.Select(x => x.ProcNum).ToList());
            }
            Procedure brokenProcedure = new Procedure();

            #region Charting the proc
            if (procCode != null)
            {
                switch (procCode.ProcCode)
                {
                case "D9986":                        //Missed
                    HistAppointments.CreateHistoryEntry(appt.AptNum, HistAppointmentAction.Missed);
                    break;

                case "D9987":                        //Cancelled
                    HistAppointments.CreateHistoryEntry(appt.AptNum, HistAppointmentAction.Cancelled);
                    break;
                }
                brokenProcedure.PatNum       = pat.PatNum;
                brokenProcedure.ProvNum      = (procCode.ProvNumDefault > 0 ? procCode.ProvNumDefault : appt.ProvNum);
                brokenProcedure.CodeNum      = procCode.CodeNum;
                brokenProcedure.ProcDate     = DateTime.Today;
                brokenProcedure.DateEntryC   = DateTime.Now;
                brokenProcedure.ProcStatus   = ProcStat.C;
                brokenProcedure.ClinicNum    = appt.ClinicNum;
                brokenProcedure.UserNum      = Security.CurUser.UserNum;
                brokenProcedure.Note         = Lans.g("AppointmentEdit", "Appt BROKEN for") + " " + appt.ProcDescript + "  " + appt.AptDateTime.ToString();
                brokenProcedure.PlaceService = (PlaceOfService)PrefC.GetInt(PrefName.DefaultProcedurePlaceService);              //Default proc place of service for the Practice is used.
                List <InsSub>  listInsSubs    = InsSubs.RefreshForFam(Patients.GetFamily(pat.PatNum));
                List <InsPlan> listInsPlans   = InsPlans.RefreshForSubList(listInsSubs);
                List <PatPlan> listPatPlans   = PatPlans.Refresh(pat.PatNum);
                InsPlan        insPlanPrimary = null;
                InsSub         insSubPrimary  = null;
                if (listPatPlans.Count > 0)
                {
                    insSubPrimary  = InsSubs.GetSub(listPatPlans[0].InsSubNum, listInsSubs);
                    insPlanPrimary = InsPlans.GetPlan(insSubPrimary.PlanNum, listInsPlans);
                }
                double procFee;
                long   feeSch;
                if (insPlanPrimary == null || procCode.NoBillIns)
                {
                    feeSch = FeeScheds.GetFeeSched(0, pat.FeeSched, brokenProcedure.ProvNum);
                }
                else                  //Only take into account the patient's insurance fee schedule if the D9986 procedure is not marked as NoBillIns
                {
                    feeSch = FeeScheds.GetFeeSched(insPlanPrimary.FeeSched, pat.FeeSched, brokenProcedure.ProvNum);
                }
                procFee = Fees.GetAmount0(brokenProcedure.CodeNum, feeSch, brokenProcedure.ClinicNum, brokenProcedure.ProvNum);
                if (insPlanPrimary != null && insPlanPrimary.PlanType == "p" && !insPlanPrimary.IsMedical)         //PPO
                {
                    double provFee = Fees.GetAmount0(brokenProcedure.CodeNum, Providers.GetProv(brokenProcedure.ProvNum).FeeSched, brokenProcedure.ClinicNum,
                                                     brokenProcedure.ProvNum);
                    brokenProcedure.ProcFee = Math.Max(provFee, procFee);
                }
                else
                {
                    brokenProcedure.ProcFee = procFee;
                }
                if (!PrefC.GetBool(PrefName.EasyHidePublicHealth))
                {
                    brokenProcedure.SiteNum = pat.SiteNum;
                }
                Procedures.Insert(brokenProcedure);
                Procedure procOld = brokenProcedure.Copy();
                //Now make a claimproc if the patient has insurance.  We do this now for consistency because a claimproc could get created in the future.
                List <Benefit>   listBenefits          = Benefits.Refresh(listPatPlans, listInsSubs);
                List <ClaimProc> listClaimProcsForProc = ClaimProcs.RefreshForProc(brokenProcedure.ProcNum);
                Procedures.ComputeEstimates(brokenProcedure, pat.PatNum, listClaimProcsForProc, false, listInsPlans, listPatPlans, listBenefits, pat.Age, listInsSubs);
                if (listSplitsForApptProcs.Count > 0 && PrefC.GetBool(PrefName.TpPrePayIsNonRefundable) && procCode.ProcCode == "D9986")
                {
                    //if there are pre-payments, non-refundable pre-payments is turned on, and the broken appointment is a missed code then auto-fill
                    //the window with the sum of the procs for the appointment. Transfer money below after broken procedure is confirmed by the user.
                    //normally goes to the form to let the user speficy, this is the auto filled amount for the form.
                    brokenProcedure.ProcFee = feeOverride;                  //listSplitsForApptProcs.Sum(x => x.SplitAmt);
                    isNonRefundable         = true;
                }
                if (isDeleteBrokenProc)
                {
                    brokenProcedure.ProcStatus = ProcStat.D;
                }
                brokenProcedure.ProcFee = feeOverride;
                brokenProcAmount        = feeOverride;
                Procedures.Update(brokenProcedure, procOld);
            }
            #endregion
            //Note this MUST come after FormProcBroken since clicking cancel in that window will delete the procedure.
            if (isNonRefundable && !isDeleteBrokenProc && listSplitsForApptProcs.Count > 0)
            {
                //transfer what the user specified in the broken appointment window.
                //transfer up to the amount specified by the user
                foreach (Procedure proc in listProcedures)
                {
                    if (brokenProcAmount == 0)
                    {
                        break;
                    }
                    List <PaySplit> listSplitsForAppointmentProcedure = listSplitsForApptProcs.FindAll(x => x.ProcNum == proc.ProcNum);
                    foreach (PaySplit split in listSplitsForAppointmentProcedure)
                    {
                        if (brokenProcAmount == 0)
                        {
                            break;
                        }
                        double amt = Math.Min(brokenProcAmount, split.SplitAmt);
                        Payments.CreateTransferForTpProcs(proc, new List <PaySplit> {
                            split
                        }, brokenProcedure, amt);
                        brokenProcAmount -= amt;
                    }
                }
            }
            return(brokenProcedure);
        }