示例#1
0
 private void butOK_Click(object sender, EventArgs e)
 {
     if (textDate.errorProvider1.GetError(textDate) != "")
     {
         MsgBox.Show(this, "Please fix data entry errors first.");
         return;
     }
     if (textDate.Text != "")
     {
         DateTime    procDate = PIn.Date(textDate.Text);
         Appointment apt;
         for (int i = 0; i < ProcList.Count; i++)
         {
             if (ProcList[i].AptNum == 0)
             {
                 continue;
             }
             apt = Appointments.GetOneApt(ProcList[i].AptNum);
             if (ProcList[i].ProcDate != procDate)
             {
                 if (!MsgBox.Show(this, true, "Date does not match appointment date.  Continue anyway?"))
                 {
                     return;
                 }
                 break;
             }
         }
         for (int i = 0; i < ProcList.Count; i++)
         {
             ProcList[i].ProcDate = procDate;
             Procedures.Update(ProcList[i], ProcOldList[i]);
         }
         Recalls.Synch(ProcList[0].PatNum);
         if (AnyAreC)
         {
             Patient       pat   = Patients.GetPat(ProcList[0].PatNum);
             string        codes = "";
             ProcedureCode ProcedureCode2;
             for (int i = 0; i < ProcList.Count; i++)
             {
                 if (i > 0)
                 {
                     codes += ", ";
                 }
                 ProcedureCode2 = ProcedureCodes.GetProcCode(ProcList[i].CodeNum);
                 codes         += ProcedureCode2.ProcCode;
             }
             SecurityLogs.MakeLogEntry(Permissions.ProcComplEdit, ProcList[0].PatNum,
                                       pat.GetNameLF() + codes + ", New date:" + procDate.ToShortDateString());
         }
     }
     DialogResult = DialogResult.OK;
 }
示例#2
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (textDateDue.errorProvider1.GetError(textDateDue) != "" ||
         textYears.errorProvider1.GetError(textYears) != "" ||
         textMonths.errorProvider1.GetError(textMonths) != "" ||
         textWeeks.errorProvider1.GetError(textWeeks) != "" ||
         textDays.errorProvider1.GetError(textDays) != ""
         )
     {
         MessageBox.Show(Lan.g(this, "Please fix data entry errors first."));
         return;
     }
     RecallCur.IsDisabled            = checkIsDisabled.Checked;
     RecallCur.DateDue               = PIn.PDate(textDateDue.Text);
     RecallCur.RecallInterval.Years  = PIn.PInt(textYears.Text);
     RecallCur.RecallInterval.Months = PIn.PInt(textMonths.Text);
     RecallCur.RecallInterval.Weeks  = PIn.PInt(textWeeks.Text);
     RecallCur.RecallInterval.Days   = PIn.PInt(textDays.Text);
     if (comboStatus.SelectedIndex == 0)
     {
         RecallCur.RecallStatus = 0;
     }
     else
     {
         RecallCur.RecallStatus
             = DefB.Short[(int)DefCat.RecallUnschedStatus][comboStatus.SelectedIndex - 1].DefNum;
     }
     RecallCur.Note = textNote.Text;
     if (IsNew)
     {
         if (!Recalls.IsAllDefault(RecallCur))                //only save if something meaningful
         {
             Recalls.Insert(RecallCur);
         }
     }
     else
     {
         if (Recalls.IsAllDefault(RecallCur))
         {
             Recalls.Delete(RecallCur);
             DialogResult = DialogResult.OK;
             return;
         }
         else
         {
             Recalls.Update(RecallCur);
         }
     }
     Recalls.Synch(PatCur.PatNum, RecallCur);
     DialogResult = DialogResult.OK;
 }
示例#3
0
        private void butMaunal_Click(object sender, EventArgs e)
        {
            if (!Security.IsAuthorized(Permissions.ProcComplCreate))
            {
                return;
            }
            if (textChargeAmt.Text == null || textChargeAmt.Text == "")
            {
                MsgBox.Show(this, "You must first enter a charge amount.");
                return;
            }
            double procFee;

            try {
                procFee = Double.Parse(textChargeAmt.Text);
            }
            catch {
                MsgBox.Show(this, "Invalid charge amount.");
                return;
            }
            Procedures.SetDateFirstVisit(DateTime.Today, 1, Patients.GetPat(RepeatCur.PatNum));
            Procedure proc = new Procedure();

            proc.CodeNum        = ProcedureCodes.GetCodeNum(textCode.Text);
            proc.DateEntryC     = DateTimeOD.Today;
            proc.PatNum         = RepeatCur.PatNum;
            proc.ProcDate       = DateTimeOD.Today;
            proc.DateTP         = DateTimeOD.Today;
            proc.ProcFee        = procFee;
            proc.ProcStatus     = ProcStat.C;
            proc.ProvNum        = PrefC.GetLong(PrefName.PracticeDefaultProv);
            proc.MedicalCode    = ProcedureCodes.GetProcCode(proc.CodeNum).MedicalCode;
            proc.BaseUnits      = ProcedureCodes.GetProcCode(proc.CodeNum).BaseUnits;
            proc.DiagnosticCode = PrefC.GetString(PrefName.ICD9DefaultForNewProcs);
            //Check if the repeating charge has been flagged to copy it's note into the billing note of the procedure.
            if (RepeatCur.CopyNoteToProc)
            {
                proc.BillingNote = RepeatCur.Note;
            }
            Procedures.Insert(proc);
            Recalls.Synch(RepeatCur.PatNum);
            MsgBox.Show(this, "Procedure added.");
        }
示例#4
0
        private void FillGrid()
        {
            Recalls.Synch(PatNum);
            RecallList = Recalls.GetList(PatNum);
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g("TableRecallsPat", "Type"), 90);

            gridMain.Columns.Add(col);
            //col=new ODGridColumn(Lan.g("TableRecallsPat","Disabled"),60,HorizontalAlignment.Center);
            //gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableRecallsPat", "PreviousDate"), 80);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableRecallsPat", "Due Date"), 80);
            gridMain.Columns.Add(col);
            //col=new ODGridColumn(Lan.g("TableRecallsPat","Sched Date"),80);
            //gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableRecallsPat", "Interval"), 70);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableRecallsPat", "Status"), 80);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableRecallsPat", "Note"), 100);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow  row;
            ODGridCell cell;

            IsPerio       = false;
            butPerio.Text = Lan.g(this, "Set Perio");
            string cellStr;

            for (int i = 0; i < RecallList.Count; i++)
            {
                if (PrefC.GetLong(PrefName.RecallTypeSpecialPerio) == RecallList[i].RecallTypeNum)
                {
                    IsPerio       = true;
                    butPerio.Text = Lan.g(this, "Set Prophy");
                }
                row = new ODGridRow();
                row.Cells.Add(RecallTypes.GetDescription(RecallList[i].RecallTypeNum));
                //if(RecallList[i].IsDisabled){
                //	row.Cells.Add("X");
                //}
                //else{
                //	row.Cells.Add("");
                //}
                if (RecallList[i].DatePrevious.Year < 1880)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(RecallList[i].DatePrevious.ToShortDateString());
                }
                if (RecallList[i].DateDue.Year < 1880)
                {
                    row.Cells.Add("");
                }
                else
                {
                    cell = new ODGridCell(RecallList[i].DateDue.ToShortDateString());
                    if (RecallList[i].DateDue < DateTime.Today)
                    {
                        cell.Bold      = YN.Yes;
                        cell.ColorText = Color.Firebrick;
                    }
                    row.Cells.Add(cell);
                }
                //row.Cells.Add("");//sched
                row.Cells.Add(RecallList[i].RecallInterval.ToString());
                row.Cells.Add(DefC.GetValue(DefCat.RecallUnschedStatus, RecallList[i].RecallStatus));
                cellStr = "";
                if (RecallList[i].IsDisabled)
                {
                    cellStr += Lan.g(this, "Disabled");
                }
                if (RecallList[i].DisableUntilDate.Year > 1880)
                {
                    if (cellStr != "")
                    {
                        cellStr += ", ";
                    }
                    cellStr += Lan.g(this, "Disabled until ") + RecallList[i].DisableUntilDate.ToShortDateString();
                }
                if (RecallList[i].DisableUntilBalance > 0)
                {
                    if (cellStr != "")
                    {
                        cellStr += ", ";
                    }
                    cellStr += Lan.g(this, "Disabled until balance ") + RecallList[i].DisableUntilBalance.ToString("c");
                }
                if (RecallList[i].Note != "")
                {
                    if (cellStr != "")
                    {
                        cellStr += ", ";
                    }
                    cellStr += RecallList[i].Note;
                }
                row.Cells.Add(cellStr);
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
示例#5
0
        private void butAdd_Click(object sender, EventArgs e)
        {
            FormProcCodes FormP = new FormProcCodes();

            FormP.IsSelectionMode = true;
            FormP.ShowDialog();
            if (FormP.DialogResult != DialogResult.OK)
            {
                return;
            }
            Procedure ProcCur;

            ProcCur         = new Procedure();  //going to be an insert, so no need to set Procedures.CurOld
            ProcCur.CodeNum = FormP.SelectedCodeNum;
            //procnum
            ProcCur.PatNum = AptCur.PatNum;
            //aptnum
            //proccode
            //ProcCur.CodeNum=ProcedureCodes.GetProcCode(ProcCur.OldCode).CodeNum;//already set
            ProcCur.ProcDate = DateTime.Today;
            ProcCur.DateTP   = ProcCur.ProcDate;
            //int totUnits = ProcCur.BaseUnits + ProcCur.UnitQty;
            Family         fam         = Patients.GetFamily(AptCur.PatNum);
            Patient        pat         = fam.GetPatient(AptCur.PatNum);
            List <InsSub>  subList     = InsSubs.RefreshForFam(fam);
            List <InsPlan> planList    = InsPlans.RefreshForSubList(subList);
            List <PatPlan> patPlanList = PatPlans.Refresh(pat.PatNum);
            ProcedureCode  procCodeCur = ProcedureCodes.GetProcCode(ProcCur.CodeNum);

            ProcCur.MedicalCode = procCodeCur.MedicalCode;
            if (procCodeCur.IsHygiene && pat.SecProv != 0)
            {
                ProcCur.ProvNum = pat.SecProv;
            }
            else
            {
                ProcCur.ProvNum = pat.PriProv;
            }
            ProcCur.ClinicNum = pat.ClinicNum;
            ProcCur.ProcFee   = Procedures.GetProcFee(pat, patPlanList, subList, planList, ProcCur.CodeNum, ProcCur.ProvNum, ProcCur.ClinicNum, ProcCur.MedicalCode);
            //surf
            //ToothNum
            //Procedures.Cur.ToothRange
            //ProcCur.NoBillIns=ProcedureCodes.GetProcCode(ProcCur.ProcCode).NoBillIns;
            ProcCur.Priority   = 0;
            ProcCur.ProcStatus = ProcStat.TP;
            ProcCur.Note       = "";
            //dx
            //nextaptnum
            ProcCur.DateEntryC     = DateTime.Now;
            ProcCur.BaseUnits      = procCodeCur.BaseUnits;
            ProcCur.SiteNum        = pat.SiteNum;
            ProcCur.RevCode        = procCodeCur.RevenueCodeDefault;
            ProcCur.DiagnosticCode = PrefC.GetString(PrefName.ICD9DefaultForNewProcs);
            ProcCur.PlaceService   = (PlaceOfService)PrefC.GetInt(PrefName.DefaultProcedurePlaceService);        //Default proc place of service for the Practice is used.
            if (Userods.IsUserCpoe(Security.CurUser))
            {
                //This procedure is considered CPOE because the provider is the one that has added it.
                ProcCur.IsCpoe = true;
            }
            Procedures.Insert(ProcCur);
            List <Benefit> benefitList = Benefits.Refresh(patPlanList, subList);

            Procedures.ComputeEstimates(ProcCur, pat.PatNum, new List <ClaimProc>(), true, planList, patPlanList, benefitList, pat.Age, subList);
            FormProcEdit FormPE = new FormProcEdit(ProcCur, pat.Copy(), fam);

            FormPE.IsNew = true;
            FormPE.ShowDialog();
            if (FormPE.DialogResult == DialogResult.Cancel)
            {
                //any created claimprocs are automatically deleted from within procEdit window.
                try{
                    Procedures.Delete(ProcCur.ProcNum);                    //also deletes the claimprocs
                }
                catch (Exception ex) {
                    MessageBox.Show(ex.Message);
                }
            }
            else if (Programs.UsingOrion)
            {
                //No need to synch with Orion mode.
            }
            else
            {
                //Default is set to TP, so Synch is usually not needed.
                if (ProcCur.ProcStatus == ProcStat.C || ProcCur.ProcStatus == ProcStat.EC || ProcCur.ProcStatus == ProcStat.EO)
                {
                    Recalls.Synch(pat.PatNum);
                }
            }
            FillGrid();
        }
示例#6
0
        private void butAdd_Click(object sender, EventArgs e)
        {
            FormProcCodes FormP = new FormProcCodes();

            FormP.IsSelectionMode = true;
            FormP.ShowDialog();
            if (FormP.DialogResult != DialogResult.OK)
            {
                return;
            }
            Procedure ProcCur;

            ProcCur         = new Procedure();  //going to be an insert, so no need to set Procedures.CurOld
            ProcCur.CodeNum = FormP.SelectedCodeNum;
            //procnum
            ProcCur.PatNum = AptCur.PatNum;
            //aptnum
            //proccode
            //ProcCur.CodeNum=ProcedureCodes.GetProcCode(ProcCur.OldCode).CodeNum;//already set
            ProcCur.ProcDate = DateTime.Today;
            ProcCur.DateTP   = ProcCur.ProcDate;
            //int totUnits = ProcCur.BaseUnits + ProcCur.UnitQty;
            InsPlan        priplan     = null;
            InsSub         prisub      = null;
            Family         fam         = Patients.GetFamily(AptCur.PatNum);
            Patient        pat         = fam.GetPatient(AptCur.PatNum);
            List <InsSub>  subList     = InsSubs.RefreshForFam(fam);
            List <InsPlan> planList    = InsPlans.RefreshForSubList(subList);
            List <PatPlan> patPlanList = PatPlans.Refresh(pat.PatNum);

            if (patPlanList.Count > 0)
            {
                prisub  = InsSubs.GetSub(patPlanList[0].InsSubNum, subList);
                priplan = InsPlans.GetPlan(prisub.PlanNum, planList);
            }
            //Check if it's a medical procedure.
            double insfee;
            bool   isMed = false;

            ProcCur.MedicalCode = ProcedureCodes.GetProcCode(ProcCur.CodeNum).MedicalCode;
            if (ProcCur.MedicalCode != null && ProcCur.MedicalCode != "")
            {
                isMed = true;
            }
            //Get fee schedule for medical or dental.
            long feeSch;

            if (isMed)
            {
                feeSch = Fees.GetMedFeeSched(pat, planList, patPlanList, subList);
            }
            else
            {
                feeSch = Fees.GetFeeSched(pat, planList, patPlanList, subList);
            }
            //Get the fee amount for medical or dental.
            if (PrefC.GetBool(PrefName.MedicalFeeUsedForNewProcs) && isMed)
            {
                insfee = Fees.GetAmount0(ProcedureCodes.GetProcCode(ProcCur.MedicalCode).CodeNum, feeSch);
            }
            else
            {
                insfee = Fees.GetAmount0(ProcCur.CodeNum, feeSch);
            }
            if (priplan != null && priplan.PlanType == "p")         //PPO
            {
                double standardfee = Fees.GetAmount0(ProcCur.CodeNum, Providers.GetProv(Patients.GetProvNum(pat)).FeeSched);
                if (standardfee > insfee)
                {
                    ProcCur.ProcFee = standardfee;
                }
                else
                {
                    ProcCur.ProcFee = insfee;
                }
            }
            else
            {
                ProcCur.ProcFee = insfee;
            }
            //surf
            //ToothNum
            //Procedures.Cur.ToothRange
            //ProcCur.NoBillIns=ProcedureCodes.GetProcCode(ProcCur.ProcCode).NoBillIns;
            ProcCur.Priority   = 0;
            ProcCur.ProcStatus = ProcStat.TP;
            if (ProcedureCodes.GetProcCode(ProcCur.CodeNum).IsHygiene &&
                pat.SecProv != 0)
            {
                ProcCur.ProvNum = pat.SecProv;
            }
            else
            {
                ProcCur.ProvNum = pat.PriProv;
            }
            ProcCur.Note      = "";
            ProcCur.ClinicNum = pat.ClinicNum;
            //dx
            //nextaptnum
            ProcCur.DateEntryC     = DateTime.Now;
            ProcCur.BaseUnits      = ProcedureCodes.GetProcCode(ProcCur.CodeNum).BaseUnits;
            ProcCur.SiteNum        = pat.SiteNum;
            ProcCur.RevCode        = ProcedureCodes.GetProcCode(ProcCur.CodeNum).RevenueCodeDefault;
            ProcCur.DiagnosticCode = PrefC.GetString(PrefName.ICD9DefaultForNewProcs);
            Procedures.Insert(ProcCur);
            List <Benefit> benefitList = Benefits.Refresh(patPlanList, subList);

            Procedures.ComputeEstimates(ProcCur, pat.PatNum, new List <ClaimProc>(), true, planList, patPlanList, benefitList, pat.Age, subList);
            FormProcEdit FormPE = new FormProcEdit(ProcCur, pat.Copy(), fam);

            FormPE.IsNew = true;
            FormPE.ShowDialog();
            if (FormPE.DialogResult == DialogResult.Cancel)
            {
                //any created claimprocs are automatically deleted from within procEdit window.
                try{
                    Procedures.Delete(ProcCur.ProcNum);                    //also deletes the claimprocs
                }
                catch (Exception ex) {
                    MessageBox.Show(ex.Message);
                }
            }
            else if (Programs.UsingOrion)
            {
                //No need to synch with Orion mode.
            }
            else
            {
                //Default is set to TP, so Synch is usually not needed.
                if (ProcCur.ProcStatus == ProcStat.C || ProcCur.ProcStatus == ProcStat.EC || ProcCur.ProcStatus == ProcStat.EO)
                {
                    Recalls.Synch(pat.PatNum);
                }
            }
            FillGrid();
        }
        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;
        }
        private void butManual_Click(object sender, EventArgs e)
        {
            Prefs.RefreshCache();            //Refresh the cache in case another machine has updated this pref
            if (PrefC.GetString(PrefName.RepeatingChargesBeginDateTime) != "")
            {
                MsgBox.Show(this, "Repeating charges already running on another workstation, you must wait for them to finish before continuing.");
                return;
            }
            if (string.IsNullOrEmpty(textChargeAmt.Text))
            {
                MsgBox.Show(this, "You must first enter a charge amount.");
                return;
            }
            double procFee;

            try {
                procFee = Double.Parse(textChargeAmt.Text);
            }
            catch {
                MsgBox.Show(this, "Invalid charge amount.");
                return;
            }
            if (!Security.IsAuthorized(Permissions.ProcComplCreate, DateTimeOD.Today, ProcedureCodes.GetCodeNum(textCode.Text), procFee))
            {
                return;
            }
            Procedures.SetDateFirstVisit(DateTime.Today, 1, Patients.GetPat(RepeatCur.PatNum));
            Procedure proc = new Procedure();

            proc.CodeNum         = ProcedureCodes.GetCodeNum(textCode.Text);
            proc.DateEntryC      = DateTimeOD.Today;
            proc.PatNum          = RepeatCur.PatNum;
            proc.ProcDate        = DateTimeOD.Today;
            proc.DateTP          = DateTimeOD.Today;
            proc.ProcFee         = procFee;
            proc.ProcStatus      = ProcStat.C;
            proc.ProvNum         = PrefC.GetLong(PrefName.PracticeDefaultProv);
            proc.MedicalCode     = ProcedureCodes.GetProcCode(proc.CodeNum).MedicalCode;
            proc.BaseUnits       = ProcedureCodes.GetProcCode(proc.CodeNum).BaseUnits;
            proc.DiagnosticCode  = PrefC.GetString(PrefName.ICD9DefaultForNewProcs);
            proc.RepeatChargeNum = RepeatCur.RepeatChargeNum;
            proc.PlaceService    = (PlaceOfService)PrefC.GetInt(PrefName.DefaultProcedurePlaceService);       //Default Proc Place of Service for the Practice is used.
            //Check if the repeating charge has been flagged to copy it's note into the billing note of the procedure.
            if (checkCopyNoteToProc.Checked)
            {
                if (_isErx)
                {
                    proc.BillingNote = "NPI=" + textNpi.Text + "  " + "ErxAccountId=" + textErxAccountId.Text;
                    if (!string.IsNullOrEmpty(textProvName.Text))                     //Provider name would be empty if older and no longer updated from eRx.
                    {
                        proc.BillingNote += "\r\nProvider=" + textProvName.Text;
                    }
                    proc.BillingNote += "\r\n" + textNote.Text;
                }
                else
                {
                    proc.BillingNote = textNote.Text;
                }
            }
            if (!PrefC.GetBool(PrefName.EasyHidePublicHealth))
            {
                Patient pat = Patients.GetPat(RepeatCur.PatNum);
                proc.SiteNum = pat.SiteNum;
            }
            Procedures.Insert(proc);
            Recalls.Synch(RepeatCur.PatNum);
            MsgBox.Show(this, "Procedure added.");
        }
示例#9
0
 private void butOK_Click(object sender, EventArgs e)
 {
     if (textDate.errorProvider1.GetError(textDate) != "")
     {
         MsgBox.Show(this, "Please fix data entry errors first.");
         return;
     }
     if (textDate.Text != "")
     {
         DateTime    procDate = PIn.Date(textDate.Text);
         Appointment apt;
         for (int i = 0; i < ProcList.Count; i++)
         {
             if (ProcList[i].AptNum == 0)
             {
                 continue;
             }
             apt = Appointments.GetOneApt(ProcList[i].AptNum);
             if (ProcList[i].ProcDate != procDate)
             {
                 if (!MsgBox.Show(this, true, "Date does not match appointment date.  Continue anyway?"))
                 {
                     return;
                 }
                 break;
             }
         }
         for (int i = 0; i < ProcList.Count; i++)
         {
             if (ProcList[i].ProcStatus == ProcStat.C && ProcList[i].ProcDate > DateTime.Today.Date && !PrefC.GetBool(PrefName.FutureTransDatesAllowed))
             {
                 MsgBox.Show(this, "Completed procedures cannot be set for future dates.");
                 return;
             }
             ProcList[i].ProcDate = procDate;
             Procedures.Update(ProcList[i], ProcOldList[i]);
         }
         ClaimProcs.UpdateProcDate(ProcList.Select(x => x.ProcNum).ToList(), procDate);
         Recalls.Synch(ProcList[0].PatNum);
         if (_hasCompletedProc || _hasExistingProc)
         {
             Patient pat = Patients.GetPat(ProcList[0].PatNum);
             if (_hasCompletedProc)
             {
                 string completeCodes = string.Join(", ",
                                                    ProcList.Where(x => x.ProcStatus == ProcStat.C).Select(x => ProcedureCodes.GetProcCode(x.CodeNum))
                                                    );
                 SecurityLogs.MakeLogEntry(Permissions.ProcComplEdit, ProcList[0].PatNum,
                                           pat.GetNameLF() + " " + completeCodes + ", New date:" + procDate.ToShortDateString());
             }
             if (_hasExistingProc)
             {
                 string existingCodes = string.Join(", ",
                                                    ProcList.Where(x => x.ProcStatus.In(ProcStat.EO, ProcStat.EC)).Select(x => ProcedureCodes.GetProcCode(x.CodeNum))
                                                    );
                 SecurityLogs.MakeLogEntry(Permissions.ProcExistingEdit, ProcList[0].PatNum,
                                           pat.GetNameLF() + " " + existingCodes + ", New date:" + procDate.ToShortDateString());
             }
         }
     }
     DialogResult = DialogResult.OK;
 }
示例#10
0
        private void butOK_Click(object sender, EventArgs e)
        {
            if (!EntriesAreValid())
            {
                return;
            }
            //This list should only contain a single patNum, but just in case.
            List <long> listDistinctPatNums = ProcList.Select(x => x.PatNum).Distinct().ToList();
            DateTime    procDate            = DateTime.MinValue;

            if (textDate.Text != "" && ProcList.Any(x => x.ProcDate != PIn.Date(textDate.Text)))
            {
                procDate = PIn.Date(textDate.Text);
            }
            #region Update ProcList and DB to reflect selections
            List <ClaimProc> listClaimProcsAll = ClaimProcs.RefreshForProcs(ProcList.Select(x => x.ProcNum).ToList());
            //Get data for any OrthoCases that may be linked to procs in ProcList
            List <OrthoProcLink>             listOrthoProcLinksAllForPat   = new List <OrthoProcLink>();
            Dictionary <long, OrthoProcLink> dictOrthoProcLinksForProcList = new Dictionary <long, OrthoProcLink>();
            Dictionary <long, OrthoCase>     dictOrthoCases     = new Dictionary <long, OrthoCase>();
            Dictionary <long, OrthoSchedule> dictOrthoSchedules = new Dictionary <long, OrthoSchedule>();
            OrthoCases.GetDataForListProcs(ref listOrthoProcLinksAllForPat, ref dictOrthoProcLinksForProcList, ref dictOrthoCases, ref dictOrthoSchedules, ProcList);
            OrthoCase            orthoCase     = null;
            OrthoSchedule        orthoSchedule = null;
            List <OrthoProcLink> listOrthoProcLinksForOrthoCase = null;
            foreach (Procedure proc in ProcList)
            {
                bool             hasChanged            = false;
                bool             hasDateChanged        = false;
                List <ClaimProc> listClaimProcsForProc = ClaimProcs.GetForProc(listClaimProcsAll, proc.ProcNum);
                Procedure        procOld = _procOldList.Find(x => x.ProcNum == proc.ProcNum); //this shouldn't fail, it needs to be in this list.
                if (procDate != DateTime.MinValue && proc.ProcDate != procDate)               //Using value entered in the textbox.
                {
                    proc.ProcDate = procDate;
                    //ClaimProc.ProcDate will be "synched" in Procedures.ComputeEstimates(), but only if not attached to a claim.  Mimics FormprocEdit.
                    hasDateChanged = true;
                    hasChanged     = true;
                }
                if (comboProv.GetSelected <Provider>() != null && comboProv.GetSelected <Provider>().ProvNum != proc.ProvNum)           //Using selection
                {
                    proc.ProvNum = comboProv.GetSelected <Provider>().ProvNum;
                    //Mimics FormProcEdit, uses different criteria than Procedures.ComputeEstimates().
                    ClaimProcs.TrySetProvFromProc(proc, listClaimProcsForProc);
                    hasChanged = true;
                }
                if (comboClinic.GetSelected <Clinic>() != null && comboClinic.GetSelected <Clinic>().ClinicNum != proc.ClinicNum)           //Using selection
                {
                    proc.ClinicNum = comboClinic.GetSelected <Clinic>().ClinicNum;
                    listClaimProcsForProc.ForEach(x => x.ClinicNum = proc.ClinicNum);
                    hasChanged = true;
                }
                if (hasChanged)
                {
                    Procedures.Update(proc, procOld);
                    if (hasDateChanged)
                    {
                        List <ClaimProc> listNewClaimProcs;
                        dictOrthoProcLinksForProcList.TryGetValue(proc.ProcNum, out OrthoProcLink orthoProcLink);
                        //If proc is linked to an OrthoCase, update dates for OrthoCase.
                        if (orthoProcLink != null)
                        {
                            OrthoCases.UpdateDatesByLinkedProc(orthoProcLink, proc);
                        }
                        OrthoCases.FillOrthoCaseObjectsForProc(proc.ProcNum, ref orthoProcLink, ref orthoCase, ref orthoSchedule, ref listOrthoProcLinksForOrthoCase,
                                                               dictOrthoProcLinksForProcList, dictOrthoCases, dictOrthoSchedules, listOrthoProcLinksAllForPat);
                        RecomputeEstimates(proc, listClaimProcsForProc, out listNewClaimProcs, orthoProcLink, orthoCase, orthoSchedule, listOrthoProcLinksForOrthoCase);
                        ClaimProcs.InsertMany(listNewClaimProcs);                        //Only insert claimProcs that were newly added.
                    }
                }
            }
            ClaimProcs.UpdateMany(listClaimProcsAll);            //Does not contain new claimProcs.
            foreach (long patNum in listDistinctPatNums)         //Should be a single patient.
            {
                Recalls.Synch(patNum);
            }
            #endregion
            #region Security Log Entries
            string logTextProcComplete = "";       //To make security log for procs that were C (specific permission)
            string logTextProcExisting = "";       //To make a security log for procs that were EO,EC (specific permission)
            string logTextProcOther    = "";       //All other procedures (general permission)
            foreach (long patNum in listDistinctPatNums)
            {
                foreach (Procedure proc in ProcList)                 //necessary because of different original values
                {
                    Procedure procOld = _procOldList.FirstOrDefault(x => x.ProcNum == proc.ProcNum);
                    if (procOld == null)
                    {
                        continue;
                    }
                    //If proc has not been changed then a blank string will be returned.
                    //Only changed procs will be reflected in security log entries.
                    switch (procOld.ProcStatus)
                    {
                    case ProcStat.C:
                        logTextProcComplete += ConstructSecurityLogForProcType(proc, procOld);
                        break;

                    case ProcStat.EO:
                    case ProcStat.EC:
                        logTextProcExisting += ConstructSecurityLogForProcType(proc, procOld);
                        break;

                    default:
                        logTextProcOther += ConstructSecurityLogForProcType(proc, procOld);
                        break;
                    }
                }
                if (logTextProcComplete != "")
                {
                    SecurityLogs.MakeLogEntry(Permissions.ProcComplEdit, patNum, logTextProcComplete);
                }
                if (logTextProcExisting != "")
                {
                    SecurityLogs.MakeLogEntry(Permissions.ProcExistingEdit, patNum, logTextProcExisting);
                }
                if (logTextProcOther != "")
                {
                    SecurityLogs.MakeLogEntry(Permissions.ProcEdit, patNum, logTextProcOther);
                }
            }
            #endregion
            DialogResult = DialogResult.OK;
        }