示例#1
0
        private void butAttachProc_Click(object sender, System.EventArgs e)
        {
            FormProcSelect formPS = new FormProcSelect(_adjustmentCur.PatNum, false);

            formPS.ShowDialog();
            if (formPS.DialogResult != DialogResult.OK)
            {
                return;
            }
            if (OrthoProcLinks.IsProcLinked(formPS.ListSelectedProcs[0].ProcNum))
            {
                MsgBox.Show(this, "Adjustments cannot be attached to a procedure that is linked to an ortho case.");
                return;
            }
            if (PrefC.GetInt(PrefName.RigorousAdjustments) < 2)           //Enforce Linking
            //_selectedProvNum=FormPS.ListSelectedProcs[0].ProvNum;
            {
                comboClinic.SelectedClinicNum = formPS.ListSelectedProcs[0].ClinicNum;
                comboProv.SetSelectedProvNum(formPS.ListSelectedProcs[0].ProvNum);
                if (PrefC.GetInt(PrefName.RigorousAdjustments) == (int)RigorousAdjustments.EnforceFully && !_isEditAnyway)
                {
                    if (Security.IsAuthorized(Permissions.Setup, true))
                    {
                        labelEditAnyway.Visible = true;
                        butEditAnyway.Visible   = true;
                    }
                    comboProv.Enabled   = false;                //Don't allow changing if enforce fully
                    butPickProv.Enabled = false;
                    comboClinic.Enabled = false;                //this is a separate issue from the internal edit blocking for comboClinic with no permission for a clinic
                }
            }
            _adjustmentCur.ProcNum = formPS.ListSelectedProcs[0].ProcNum;
            FillProcedure();
            textProcDate.Text = formPS.ListSelectedProcs[0].ProcDate.ToShortDateString();
        }
        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;
            }
            //Don't change code if proc is linked to OrthoCase
            if (OrthoProcLinks.IsProcLinked(_procCur.ProcNum))
            {
                MsgBox.Show("This procedure is attached to an ortho case and its code cannot be changed.");
                return;
            }
            //Moved from FormProcEdit.SaveAndClose() in version 16.3+
            Procedure procOld = _procCur.Copy();

            _procCur.CodeNum = _verifyCode;
            if (new[] { ProcStat.TP, ProcStat.C, ProcStat.TPi, ProcStat.Cn }.Contains(_procCur.ProcStatus))          //Only change the fee if Complete, TP, TPi, or Cn.
            {
                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, true, _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;
        }