Example #1
0
        private void butRun_Click(object sender, EventArgs e)
        {
            if (!checkTcodes.Checked && !checkNcodes.Checked && !checkDcodes.Checked && !checkAutocodes.Checked &&
                !checkProcButtons.Checked && !checkApptProcsQuickAdd.Checked && !checkRecallTypes.Checked)
            {
                MsgBox.Show(this, "Please select at least one tool first.");
                return;
            }
            Changed = false;
            int rowsInserted = 0;

            #region N Codes
            if (checkNcodes.Checked)
            {
                try {
                    rowsInserted += FormProcCodes.ImportProcCodes("", null, Properties.Resources.NoFeeProcCodes);
                }
                catch (ApplicationException ex) {
                    MessageBox.Show(ex.Message);
                }
                Changed = true;
                DataValid.SetInvalid(InvalidType.Defs, InvalidType.ProcCodes, InvalidType.Fees);
                //fees are included because they are grouped by defs.
            }
            #endregion
            #region D Codes
            if (checkDcodes.Checked)
            {
                try {
                    if (CultureInfo.CurrentCulture.Name.EndsWith("CA"))                     //Canadian. en-CA or fr-CA
                    {
                        if (_codeList == null)
                        {
                            CanadaDownloadProcedureCodes();
                        }
                    }
                    rowsInserted += FormProcCodes.ImportProcCodes("", _codeList, "");
                    Changed       = true;
                    int descriptionsFixed = ProcedureCodes.ResetADAdescriptions();
                    MessageBox.Show("Procedure code descriptions updated: " + descriptionsFixed.ToString());
                }
                catch (ApplicationException ex) {
                    MessageBox.Show(ex.Message);
                }
                DataValid.SetInvalid(InvalidType.Defs, InvalidType.ProcCodes, InvalidType.Fees);
            }
            #endregion
            if (checkNcodes.Checked || checkDcodes.Checked)
            {
                MessageBox.Show("Procedure codes inserted: " + rowsInserted);
            }
            #region Auto Codes
            if (checkAutocodes.Checked)
            {
                //checking for any AutoCodes and prompting the user if they exist
                if (AutoCodes.GetCount() > 0)
                {
                    string msgText = Lan.g(this, "This tool will delete all current autocodes and then add in the default autocodes.") + "\r\n";
                    //If the proc tool isn't going to put the procedure buttons back to default, warn them that they will need to reassociate them.
                    if (!checkProcButtons.Checked)
                    {
                        msgText += Lan.g(this, "Any procedure buttons associated with the current autocodes will be dissociated and will need to be reassociated manually.") + "\r\n";
                    }
                    msgText += Lan.g(this, "Continue?");
                    if (MsgBox.Show(this, MsgBoxButtons.YesNo, msgText))
                    {
                        AutoCodes.SetToDefault();
                        Changed = true;
                        DataValid.SetInvalid(InvalidType.AutoCodes);
                    }
                    else
                    {
                        checkAutocodes.Checked = false;                       //if the user hits no on the popup, uncheck and continue
                    }
                }
                //If there are no autocodes then add the defaults
                else
                {
                    AutoCodes.SetToDefault();
                    Changed = true;
                    DataValid.SetInvalid(InvalidType.AutoCodes);
                }
            }
            #endregion
            #region Proc Buttons
            if (checkProcButtons.Checked)
            {
                //checking for any custom proc button categories and prompting the user if they exist
                if (Defs.HasCustomCategories())
                {
                    if (MsgBox.Show(this, MsgBoxButtons.YesNo, "This tool will delete all current ProcButtons from the Chart Module and add in the defaults. Continue?"))
                    {
                        ProcButtons.SetToDefault();
                        Changed = true;
                        DataValid.SetInvalid(InvalidType.ProcButtons, InvalidType.Defs);
                    }
                    else
                    {
                        checkProcButtons.Checked = false;                      //continue and uncheck if user hits no on the popup
                    }
                }
                //no ProcButtons found, run normally
                else
                {
                    ProcButtons.SetToDefault();
                    Changed = true;
                    DataValid.SetInvalid(InvalidType.ProcButtons, InvalidType.Defs);
                }
            }
            #endregion
            #region Appt Procs Quick Add
            if (checkApptProcsQuickAdd.Checked)
            {
                //checking for any ApptProcsQuickAdd and prompting the user if they exist
                if (Defs.GetDefsForCategory(DefCat.ApptProcsQuickAdd).Count > 0)
                {
                    if (MsgBox.Show(this, MsgBoxButtons.YesNo, "This tool will reset the list of procedures in the appointment edit window to the defaults. Continue?"))
                    {
                        ProcedureCodes.ResetApptProcsQuickAdd();
                        Changed = true;
                        DataValid.SetInvalid(InvalidType.Defs);
                    }
                    else
                    {
                        checkApptProcsQuickAdd.Checked = false;                      //uncheck and continue if no is selected on the popup
                    }
                }
                //run normally if no customizations are found
                else
                {
                    ProcedureCodes.ResetApptProcsQuickAdd();
                    Changed = true;
                    DataValid.SetInvalid(InvalidType.Defs);
                }
            }
            #endregion
            #region Recall Types
            if (checkRecallTypes.Checked &&
                (!RecallTypes.IsUsingManuallyAddedTypes() ||                 //If they have any manually added types, ask them if they are sure they want to delete them.
                 MsgBox.Show(this, MsgBoxButtons.OKCancel, "This will delete all patient recalls for recall types which were manually added.  Continue?")))
            {
                RecallTypes.SetToDefault();
                Changed = true;
                DataValid.SetInvalid(InvalidType.RecallTypes, InvalidType.Prefs);
                SecurityLogs.MakeLogEntry(Permissions.RecallEdit, 0, "Recall types set to default.");
            }
            #endregion
            #region T Codes
            if (checkTcodes.Checked)            //Even though this is first in the interface, we need to run it last, since other regions need the T codes above.
            {
                ProcedureCodes.TcodesClear();
                Changed = true;
                //yes, this really does refresh before moving on.
                DataValid.SetInvalid(InvalidType.Defs, InvalidType.ProcCodes, InvalidType.Fees);
                SecurityLogs.MakeLogEntry(Permissions.ProcCodeEdit, 0, "T-Codes deleted.");
            }
            #endregion
            if (Changed)
            {
                MessageBox.Show(Lan.g(this, "Done."));
                SecurityLogs.MakeLogEntry(Permissions.Setup, 0, "New Customer Procedure codes tool was run.");
            }
        }
Example #2
0
        private void butRun_Click(object sender, EventArgs e)
        {
            //The updating of CDT codes takes place towards the end of the year, while we typically do it in December, we have
            //done it as early as Novemeber before. This warning will inform users that using the new codes will cause rejection
            //on their claims if they try to use them before the first of the new year.
            DateTime datePromptStart = new DateTime(2019, 12, 20);
            DateTime datePromptEnd   = new DateTime(datePromptStart.Year, 12, 31);

            if (DateTime.Now.Between(datePromptStart, datePromptEnd) && checkDcodes.Checked) //Only validate if attempting to update D Codes
            {
                if (MessageBox.Show(                                                         //Still between datePromptStart and the first of the next year, prompt that these codes may cause problems.
                        Lan.g(this, "Updating D Codes at this time could result in acquiring codes which are not valid until ")
                        + datePromptEnd.AddDays(1).ToShortDateString() + Lan.g(this, ". Using these codes could cause claims to be rejected, continue?")
                        , Lan.g(this, "D Codes"), MessageBoxButtons.YesNo) == DialogResult.No)
                {
                    return;                    //Early return if the user is between datePromptStart and the first of the next year and they've said no to updating D Codes.
                }
            }
            if (!checkTcodes.Checked && !checkNcodes.Checked && !checkDcodes.Checked && !checkAutocodes.Checked &&
                !checkProcButtons.Checked && !checkApptProcsQuickAdd.Checked && !checkRecallTypes.Checked)
            {
                MsgBox.Show(this, "Please select at least one tool first.");
                return;
            }
            Changed = false;
            int rowsInserted = 0;

            #region N Codes
            if (checkNcodes.Checked)
            {
                try {
                    rowsInserted += FormProcCodes.ImportProcCodes("", null, Properties.Resources.NoFeeProcCodes);
                }
                catch (ApplicationException ex) {
                    MessageBox.Show(ex.Message);
                }
                Changed = true;
                DataValid.SetInvalid(InvalidType.Defs, InvalidType.ProcCodes);
            }
            #endregion
            #region D Codes
            if (checkDcodes.Checked)
            {
                try {
                    if (CultureInfo.CurrentCulture.Name.EndsWith("CA"))                     //Canadian. en-CA or fr-CA
                    {
                        if (_codeList == null)
                        {
                            CanadaDownloadProcedureCodes();
                        }
                    }
                    rowsInserted += FormProcCodes.ImportProcCodes("", _codeList, "");
                    Changed       = true;
                    int descriptionsFixed = ProcedureCodes.ResetADAdescriptions();
                    MessageBox.Show("Procedure code descriptions updated: " + descriptionsFixed.ToString());
                }
                catch (ApplicationException ex) {
                    MessageBox.Show(ex.Message);
                }
                DataValid.SetInvalid(InvalidType.Defs, InvalidType.ProcCodes);
            }
            #endregion
            if (checkNcodes.Checked || checkDcodes.Checked)
            {
                MessageBox.Show("Procedure codes inserted: " + rowsInserted);
            }
            #region Auto Codes
            if (checkAutocodes.Checked)
            {
                //checking for any AutoCodes and prompting the user if they exist
                if (AutoCodes.GetCount() > 0)
                {
                    string msgText = Lan.g(this, "This tool will delete all current autocodes and then add in the default autocodes.") + "\r\n";
                    //If the proc tool isn't going to put the procedure buttons back to default, warn them that they will need to reassociate them.
                    if (!checkProcButtons.Checked)
                    {
                        msgText += Lan.g(this, "Any procedure buttons associated with the current autocodes will be dissociated and will need to be reassociated manually.") + "\r\n";
                    }
                    msgText += Lan.g(this, "Continue?");
                    if (MsgBox.Show(this, MsgBoxButtons.YesNo, msgText))
                    {
                        AutoCodes.SetToDefault();
                        Changed = true;
                        DataValid.SetInvalid(InvalidType.AutoCodes);
                    }
                    else
                    {
                        checkAutocodes.Checked = false;                       //if the user hits no on the popup, uncheck and continue
                    }
                }
                //If there are no autocodes then add the defaults
                else
                {
                    AutoCodes.SetToDefault();
                    Changed = true;
                    DataValid.SetInvalid(InvalidType.AutoCodes);
                }
            }
            #endregion
            #region Proc Buttons
            if (checkProcButtons.Checked)
            {
                //checking for any custom proc button categories and prompting the user if they exist
                if (Defs.HasCustomCategories())
                {
                    if (MsgBox.Show(this, MsgBoxButtons.YesNo, "This tool will delete all current ProcButtons from the Chart Module and add in the defaults. Continue?"))
                    {
                        ProcButtons.SetToDefault();
                        Changed = true;
                        DataValid.SetInvalid(InvalidType.ProcButtons, InvalidType.Defs);
                    }
                    else
                    {
                        checkProcButtons.Checked = false;                      //continue and uncheck if user hits no on the popup
                    }
                }
                //no ProcButtons found, run normally
                else
                {
                    ProcButtons.SetToDefault();
                    Changed = true;
                    DataValid.SetInvalid(InvalidType.ProcButtons, InvalidType.Defs);
                }
            }
            #endregion
            #region Appt Procs Quick Add
            if (checkApptProcsQuickAdd.Checked)
            {
                //checking for any ApptProcsQuickAdd and prompting the user if they exist
                if (Defs.GetDefsForCategory(DefCat.ApptProcsQuickAdd).Count > 0)
                {
                    if (MsgBox.Show(this, MsgBoxButtons.YesNo, "This tool will reset the list of procedures in the appointment edit window to the defaults. Continue?"))
                    {
                        ProcedureCodes.ResetApptProcsQuickAdd();
                        Changed = true;
                        DataValid.SetInvalid(InvalidType.Defs);
                    }
                    else
                    {
                        checkApptProcsQuickAdd.Checked = false;                      //uncheck and continue if no is selected on the popup
                    }
                }
                //run normally if no customizations are found
                else
                {
                    ProcedureCodes.ResetApptProcsQuickAdd();
                    Changed = true;
                    DataValid.SetInvalid(InvalidType.Defs);
                }
            }
            #endregion
            #region Recall Types
            if (checkRecallTypes.Checked &&
                (!RecallTypes.IsUsingManuallyAddedTypes() ||                 //If they have any manually added types, ask them if they are sure they want to delete them.
                 MsgBox.Show(this, MsgBoxButtons.OKCancel, "This will delete all patient recalls for recall types which were manually added.  Continue?")))
            {
                RecallTypes.SetToDefault();
                Changed = true;
                DataValid.SetInvalid(InvalidType.RecallTypes, InvalidType.Prefs);
                SecurityLogs.MakeLogEntry(Permissions.RecallEdit, 0, "Recall types set to default.");
            }
            #endregion
            #region T Codes
            if (checkTcodes.Checked)            //Even though this is first in the interface, we need to run it last, since other regions need the T codes above.
            {
                ProcedureCodes.TcodesClear();
                Changed = true;
                //yes, this really does refresh before moving on.
                DataValid.SetInvalid(InvalidType.Defs, InvalidType.ProcCodes);
                SecurityLogs.MakeLogEntry(Permissions.ProcCodeEdit, 0, "T-Codes deleted.");
            }
            #endregion
            if (Changed)
            {
                MessageBox.Show(Lan.g(this, "Done."));
                SecurityLogs.MakeLogEntry(Permissions.Setup, 0, "New Customer Procedure codes tool was run.");
            }
        }