Beispiel #1
0
        private void FormPayPeriods_FormClosing(object sender, FormClosingEventArgs e)
        {
            //validation on Form_Closing to account for if the user doesn't use the close button to close the form.
            string errors = TimeCardRules.ValidateOvertimeRules();

            if (!string.IsNullOrEmpty(errors))
            {
                errors = "Fix the following errors:\r\n" + errors;
                MessageBox.Show(errors);
                e.Cancel = true;
            }
            if (textADPCompanyCode.Text != "" && !Regex.IsMatch(textADPCompanyCode.Text, "^[a-zA-Z0-9]{2,3}$"))
            {
                MsgBox.Show(this, "ADP Company Code must be two or three alpha-numeric characters.\r\nFix or clear before continuing.");
                e.Cancel = true;
            }
            if (Prefs.UpdateString(PrefName.ADPCompanyCode, textADPCompanyCode.Text))
            {
                changed = true;
            }
            if (changed)
            {
                DataValid.SetInvalid(InvalidType.Employees, InvalidType.Prefs, InvalidType.TimeCardRules);
            }
        }
        private void butOK_Click(object sender, System.EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            if (!Directory.Exists(textExportFolder.Text))
            {
                Cursor = Cursors.Default;
                MsgBox.Show(this, "Export folder does not exist.");
                return;
            }
            if (comboBillType.SelectedIndex == -1)
            {
                Cursor = Cursors.Default;
                MsgBox.Show(this, "Please select a billing type.");
                return;
            }
            int billtype = DefB.Short[(int)DefCat.BillingTypes][comboBillType.SelectedIndex].DefNum;

            if (Prefs.UpdateString("TrojanExpressCollectPath", textExportFolder.Text)
                | Prefs.UpdateInt("TrojanExpressCollectBillingType", billtype))
            {
                DataValid.SetInvalid(InvalidTypes.Prefs);
            }
            Cursor       = Cursors.Default;
            DialogResult = DialogResult.OK;
        }
 private void butSave_Click(object sender, EventArgs e)
 {
     if (Prefs.UpdateString("BirthdayPostcardMsg", textPostcardMsg.Text))
     {
         DataValid.SetInvalid(InvalidTypes.Prefs);
     }
 }
Beispiel #4
0
 private void butOK_Click(object sender, EventArgs e)
 {
     Prefs.UpdateBool(PrefName.EhrRxAlertHighSeverity, checkAlertHighSeverity.Checked);
     Prefs.UpdateInt(PrefName.MeaningfulUseTwo, comboMU2.SelectedIndex);
     Prefs.UpdateString(PrefName.CQMDefaultEncounterCodeSystem, NewEncCodeSystem);
     Prefs.UpdateString(PrefName.PregnancyDefaultCodeSystem, NewPregCodeSystem);
     Prefs.UpdateBool(PrefName.AutomaticSummaryOfCareWebmail, checkAutoWebmails.Checked);
     if (comboEncCodes.SelectedIndex == -1)
     {
         Prefs.UpdateString(PrefName.CQMDefaultEncounterCodeValue, textEncCodeValue.Text);
     }
     else
     {
         Prefs.UpdateString(PrefName.CQMDefaultEncounterCodeValue, comboEncCodes.SelectedItem.ToString());
     }
     if (comboPregCodes.SelectedIndex == -1)
     {
         Prefs.UpdateString(PrefName.PregnancyDefaultCodeValue, textPregCodeValue.Text);
     }
     else
     {
         Prefs.UpdateString(PrefName.PregnancyDefaultCodeValue, comboPregCodes.SelectedItem.ToString());
     }
     //A diseasedef with this default pregnancy code will be inserted if needed the first time they check the pregnant box on a vitalsign.  The DiseaseName will be "Pregnant" with the correct codevalue/system.
     DialogResult = DialogResult.OK;
 }
Beispiel #5
0
 private bool SaveToDb()
 {
     if (textProgDesc.Text == "")
     {
         MsgBox.Show(this, "Description may not be blank.");
         return(false);
     }
     if (radioModeTight.Checked && comboDefaultUserGroup.SelectedIndex == -1)
     {
         MsgBox.Show(this, "Please select a default user group first.");
         return(false);
     }
     if (textHL7FolderOut.Text == "")
     {
         MsgBox.Show(this, "HL7 out folder may not be blank.");
         return(false);
     }
     if (radioModeTight.Checked && textHL7FolderIn.Text == "")
     {
         MsgBox.Show(this, "HL7 in folder may not be blank.");
         return(false);
     }
     ProgramCur.ProgDesc = textProgDesc.Text;
     ProgramCur.Enabled  = checkEnabled.Checked;
     Programs.Update(ProgramCur);
     Prefs.UpdateString(PrefName.HL7FolderOut, textHL7FolderOut.Text);
     if (radioModeTight.Checked)
     {
         ProgramProperties.SetProperty(ProgramCur.ProgramNum, "IsStandalone", "0");
         Prefs.UpdateString(PrefName.HL7FolderIn, textHL7FolderIn.Text);
         ProgramProperties.SetProperty(ProgramCur.ProgramNum, "DefaultUserGroup",
                                       UserGroups.List[comboDefaultUserGroup.SelectedIndex].UserGroupNum.ToString());
         if (checkShowImages.Checked)
         {
             ProgramProperties.SetProperty(ProgramCur.ProgramNum, "ShowImagesModule", "1");
         }
         else
         {
             ProgramProperties.SetProperty(ProgramCur.ProgramNum, "ShowImagesModule", "0");
         }
         if (this.checkFeeSchedules.Checked)
         {
             ProgramProperties.SetProperty(ProgramCur.ProgramNum, "FeeSchedulesSetManually", "1");
         }
         else
         {
             ProgramProperties.SetProperty(ProgramCur.ProgramNum, "FeeSchedulesSetManually", "0");
         }
     }
     else              //standalone
     {
         ProgramProperties.SetProperty(ProgramCur.ProgramNum, "IsStandalone", "1");
         Prefs.UpdateString(PrefName.HL7FolderIn, "");
         ProgramProperties.SetProperty(ProgramCur.ProgramNum, "DefaultUserGroup", "0");
         ProgramProperties.SetProperty(ProgramCur.ProgramNum, "ShowImagesModule", "1");
         ProgramProperties.SetProperty(ProgramCur.ProgramNum, "FeeSchedulesSetManually", "0");
     }
     DataValid.SetInvalid(InvalidType.Programs, InvalidType.Prefs);
     return(true);
 }
Beispiel #6
0
 private void butOK_Click(object sender, EventArgs e)
 {
     if (textOrthoMonthsTreat.errorProvider1.GetError(textOrthoMonthsTreat) != "")
     {
         MsgBox.Show(this, "Default months treatment must be between 0 and 255 months.");
         return;
     }
     if (PrefC.GetBool(PrefName.ShowFeaturePatientClone) != checkPatClone.Checked)
     {
         MsgBox.Show(this, "You will need to restart OpenDental for this change to take effect.");
     }
     if (Prefs.UpdateBool(PrefName.ShowFeaturePatientClone, checkPatClone.Checked)
         | Prefs.UpdateBool(PrefName.ApptModuleShowOrthoChartItem, checkApptModuleShowOrthoChartItem.Checked)
         | Prefs.UpdateBool(PrefName.OrthoEnabled, checkOrthoEnabled.Checked)
         | Prefs.UpdateBool(PrefName.OrthoCaseInfoInOrthoChart, checkOrthoFinancialInfoInChart.Checked)
         | Prefs.UpdateBool(PrefName.OrthoClaimMarkAsOrtho, checkOrthoClaimMarkAsOrtho.Checked)
         | Prefs.UpdateBool(PrefName.OrthoClaimUseDatePlacement, checkOrthoClaimUseDatePlacement.Checked)
         | Prefs.UpdateByte(PrefName.OrthoDefaultMonthsTreat, PIn.Byte(textOrthoMonthsTreat.Text))
         | Prefs.UpdateBool(PrefName.OrthoInsPayConsolidated, checkConsolidateInsPayment.Checked)
         | Prefs.UpdateLong(PrefName.OrthoAutoProcCodeNum, _orthoAutoProcCodeNum)
         | Prefs.UpdateString(PrefName.OrthoPlacementProcsList, string.Join(",", _listOrthoPlacementCodeNums))
         | Prefs.UpdateString(PrefName.OrthoBandingCodes, PIn.String(textBandingCodes.Text))
         | Prefs.UpdateString(PrefName.OrthoVisitCodes, PIn.String(textVisitCodes.Text))
         | Prefs.UpdateString(PrefName.OrthoDebondCodes, PIn.String(textDebondCodes.Text))
         )
     {
         _hasChanges = true;
     }
     DialogResult = DialogResult.OK;
 }
Beispiel #7
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (textKey1.Text != "" &&
                !Regex.IsMatch(textKey1.Text, @"^[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}$") &&
                !Regex.IsMatch(textKey1.Text, @"^[A-Z0-9]{16}$"))
            {
                MsgBox.Show(this, "Invalid registration key format.");
                return;
            }
            string regkey = "";

            if (Regex.IsMatch(textKey1.Text, @"^[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}$"))
            {
                regkey = textKey1.Text.Substring(0, 4) + textKey1.Text.Substring(5, 4) + textKey1.Text.Substring(10, 4) + textKey1.Text.Substring(15, 4);
            }
            else if (Regex.IsMatch(textKey1.Text, @"^[A-Z0-9]{16}$"))
            {
                regkey = textKey1.Text;
            }
            if (!ValidateKey(regkey))            //a blank registration key will only be valid if the CDT.dll is foreign
            {
                MsgBox.Show(this, "Invalid registration key.");
                return;
            }
            Prefs.UpdateString(PrefName.RegistrationKey, regkey);
            FormOpenDental.RegKeyIsForTesting = PrefL.IsRegKeyForTesting();
            //prefs refresh automatically in the calling class anyway.
            DialogResult = DialogResult.OK;
        }
Beispiel #8
0
 private void ButSupplementalSaveDefaults_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(textSupplementalBackupCopyNetworkPath.Text) && !Directory.Exists(textSupplementalBackupCopyNetworkPath.Text))
     {
         MsgBox.Show(this, "Invalid or inaccessible " + labelSupplementalBackupCopyNetworkPath.Text + ".");           //This label text will rarely change.
         return;
     }
     if (Prefs.UpdateBool(PrefName.SupplementalBackupEnabled, checkSupplementalBackupEnabled.Checked))
     {
         try {
             //Inform HQ when the supplemental backups are enabled/disabled and which security admin performed the change.
             PayloadItem pliStatus = new PayloadItem(
                 (int)(checkSupplementalBackupEnabled.Checked?SupplementalBackupStatuses.Enabled:SupplementalBackupStatuses.Disabled),
                 "SupplementalBackupStatus");
             PayloadItem pliAdminUserName = new PayloadItem(Security.CurUser.UserName, "AdminUserName");
             string      officeData       = PayloadHelper.CreatePayload(new List <PayloadItem>()
             {
                 pliStatus, pliAdminUserName
             }, eServiceCode.SupplementalBackup);
             WebServiceMainHQProxy.GetWebServiceMainHQInstance().SetSupplementalBackupStatus(officeData);
         }
         catch (Exception ex) {
             ex.DoNothing();                    //Internet probably is unavailble right now.
         }
         SecurityLogs.MakeLogEntry(Permissions.SupplementalBackup, 0,
                                   "Supplemental backup has been " + (checkSupplementalBackupEnabled.Checked?"Enabled":"Disabled") + ".");
     }
     if (Prefs.UpdateString(PrefName.SupplementalBackupNetworkPath, textSupplementalBackupCopyNetworkPath.Text))
     {
         SecurityLogs.MakeLogEntry(Permissions.SupplementalBackup, 0,
                                   labelSupplementalBackupCopyNetworkPath.Text + " changed to '" + textSupplementalBackupCopyNetworkPath.Text + "'.");
     }
     MsgBox.Show(this, "Saved");
 }
Beispiel #9
0
        /// <summary>Updates some preferences in Open Dental according to the enabled state of the Benco bridge</summary>
        private void UpdateBencoSettings()
        {
            bool   hasPrefChanged = false;
            string odTitle        = "Open Dental";
            string odSoftware     = "Open Dental Software";
            string bencoTitle     = "Benco Practice Management powered by Open Dental";
            string bencoSoftware  = "Benco Practice Management";

            if (_prog.Enabled)
            {
                if (PrefC.GetString(PrefName.MainWindowTitle) == odTitle)
                {
                    hasPrefChanged |= Prefs.UpdateString(PrefName.MainWindowTitle, bencoTitle);
                }
                if (PrefC.GetString(PrefName.SoftwareName) != bencoSoftware)
                {
                    hasPrefChanged |= Prefs.UpdateString(PrefName.SoftwareName, bencoSoftware);
                }
            }
            else
            {
                if (PrefC.GetString(PrefName.MainWindowTitle) == bencoTitle)
                {
                    hasPrefChanged |= Prefs.UpdateString(PrefName.MainWindowTitle, odTitle);
                }
                if (PrefC.GetString(PrefName.SoftwareName) != odSoftware)
                {
                    hasPrefChanged |= Prefs.UpdateString(PrefName.SoftwareName, odSoftware);
                }
            }
            if (hasPrefChanged)
            {
                Signalods.SetInvalid(InvalidType.Prefs);
            }
        }
 ///<summary>Refresh all time displays and labels.</summary>
 private void refreshDisplays()
 {
     if (_timeNist == DateTime.MinValue || _timeServer == DateTime.MinValue || _timeLocal == DateTime.MinValue)
     {
         textLocalTime.Text  = "";
         textNistTime.Text   = "";
         textServerTime.Text = "";
         textMessage.Text    = "";
         return;
     }
     textNistTime.Text   = _timeNist.ToString("hh:mm:ss.fff tt");
     textServerTime.Text = _timeServer.ToString("hh:mm:ss.fff tt");
     textLocalTime.Text  = _timeLocal.ToString("hh:mm:ss.fff tt");
     //Update NistURL preference
     Prefs.UpdateString(PrefName.NistTimeServerUrl, textNistUrl.Text);
     //Update message textbox
     if (!LocalInSynch())              //This should not happen, time is updated automatically. If you get to this point, you should have already had a message box pop up saying there was an error updating your local time.
     {
         textMessage.Text = "Your local machine time is out of synch.  Please ensure Open Dental is running with Administrator Windows privileges.  If you have done this and you still see this message, please call Open Dental support.";
     }
     else if (!ServerInSynch())
     {
         textMessage.Text = "Your database time is out of synch with your local machine.  Please start the Open Dental application on your database server and leave it running to keep times synchronized as required for EHR compliance.  If you have done this and you still see this message, please call Open Dental support.";
     }
     else              //All times in synch
     {
         textMessage.Text = "All times synchronized within one second.  You may close this window.";
     }
 }
Beispiel #11
0
 ///<summary>Refresh all time displays and labels.</summary>
 private void refreshDisplays()
 {
     if (_timeNist == DateTime.MinValue || _timeServer == DateTime.MinValue || _timeLocal == DateTime.MinValue)
     {
         textLocalTime.Text              = "";
         textNistTime.Text               = "";
         textServerTime.Text             = "";
         labelDatabaseOutOfSynch.Visible = false;
         labelLocalOutOfSynch.Visible    = false;
         labelAllSynched.Visible         = false;
         return;
     }
     textNistTime.Text   = _timeNist.ToString("hh:mm:ss.fff tt");
     textServerTime.Text = _timeServer.ToString("hh:mm:ss.fff tt");
     textLocalTime.Text  = _timeLocal.ToString("hh:mm:ss.fff tt");
     //Update NistURL preference
     Prefs.UpdateString(PrefName.NistTimeServerUrl, textNistUrl.Text);
     //Display labels if out of synch.
     labelDatabaseOutOfSynch.Visible = !ServerInSynch();
     labelLocalOutOfSynch.Visible    = !LocalInSynch();
     if (labelDatabaseOutOfSynch.Visible || labelLocalOutOfSynch.Visible)
     {
         labelAllSynched.Visible = false;
     }
     else
     {
         labelAllSynched.Visible = true;               //All times in synch
     }
 }
        private void butWebSchedRecallBlockouts_Click(object sender, EventArgs e)
        {
            string[]    arrayDefNums      = PrefC.GetString(PrefName.WebSchedRecallIgnoreBlockoutTypes).Split(new char[] { ',' }); //comma-delimited list.
            List <long> listBlockoutTypes = new List <long>();

            foreach (string strDefNum in arrayDefNums)
            {
                listBlockoutTypes.Add(PIn.Long(strDefNum));
            }
            List <Def>           listBlockoutTypeDefs = Defs.GetDefs(DefCat.BlockoutTypes, listBlockoutTypes);
            FormDefinitionPicker FormDP = new FormDefinitionPicker(DefCat.BlockoutTypes, listBlockoutTypeDefs);

            FormDP.HasShowHiddenOption  = true;
            FormDP.IsMultiSelectionMode = true;
            FormDP.ShowDialog();
            if (FormDP.DialogResult == DialogResult.OK)
            {
                listboxWebSchedRecallIgnoreBlockoutTypes.Items.Clear();
                foreach (Def defCur in FormDP.ListSelectedDefs)
                {
                    listboxWebSchedRecallIgnoreBlockoutTypes.Items.Add(defCur.ItemName);
                }
                string strListWebSChedRecallIgnoreBlockoutTypes = String.Join(",", FormDP.ListSelectedDefs.Select(x => x.DefNum));
                Prefs.UpdateString(PrefName.WebSchedRecallIgnoreBlockoutTypes, strListWebSChedRecallIgnoreBlockoutTypes);
            }
        }
        ///<summary>Launches the account pick window and lets user choose several accounts.  Returns null if anything went wrong or user canceled out.</summary>
        private List <string> GetAccountsQB()
        {
            if (textCompanyFileQB.Text.Trim() == "")
            {
                MsgBox.Show(this, "Browse to your QuickBooks company file first.");
                return(null);
            }
            if (Prefs.UpdateString(PrefName.QuickBooksCompanyFile, textCompanyFileQB.Text))
            {
                DataValid.SetInvalid(InvalidType.Prefs);
            }
            FormAccountPick FormA = new FormAccountPick();

            FormA.IsQuickBooks = true;
            FormA.ShowDialog();
            if (FormA.DialogResult != DialogResult.OK)
            {
                return(null);
            }
            if (FormA.SelectedAccountsQB != null)
            {
                return(FormA.SelectedAccountsQB);
            }
            return(null);
        }
Beispiel #14
0
        private void SaveTabMisc()
        {
            Prefs.UpdateDateT(PrefName.AutomaticCommunicationTimeStart, dateRunStart.Value);
            Prefs.UpdateDateT(PrefName.AutomaticCommunicationTimeEnd, dateRunEnd.Value);
            string dateFormat;

            if (radioDateShortDate.Checked)
            {
                dateFormat = _shortDateFormat;
            }
            else if (radioDateLongDate.Checked)
            {
                dateFormat = _longDateFormat;
            }
            else if (radioDateMMMMdyyyy.Checked)
            {
                dateFormat = _dateFormatMMMMdyyyy;
            }
            else if (radioDatem.Checked)
            {
                dateFormat = _dateFormatm;
            }
            else
            {
                dateFormat = textDateCustom.Text;
            }
            Prefs.UpdateString(PrefName.PatientCommunicationDateFormat, dateFormat);
        }
Beispiel #15
0
        ///<summary>Save template changes made in WebSchedVerify.</summary>
        private void SaveTabWebSchedVerify()
        {
            List <long> listClinics = Clinics.GetForUserod(Security.CurUser).Select(x => x.ClinicNum).ToList();

            foreach (PrefName prefName in _listWebSchedVerifyPrefNames)
            {
                foreach (long clinicNum in listClinics)
                {
                    ClinicPref newClinicPref = _listWebSchedVerifyClinicPrefs.FirstOrDefault(x => x.PrefName == prefName && x.ClinicNum == clinicNum);
                    ClinicPref oldClinicPref = _listWebSchedVerifyClinicPrefs_Old.FirstOrDefault(x => x.PrefName == prefName && x.ClinicNum == clinicNum);
                    if (oldClinicPref == null && newClinicPref == null)                  //skip items not in either list
                    {
                        continue;
                    }
                    else if (oldClinicPref == null && newClinicPref != null)                  //insert items in the new list and not the old list
                    {
                        ClinicPrefs.Insert(newClinicPref);
                    }
                    else if (oldClinicPref != null && newClinicPref == null)                  //delete items in the old list and not the new list
                    {
                        ClinicPrefs.Delete(oldClinicPref.ClinicPrefNum);
                    }
                    else                       //update items that have changed
                    {
                        ClinicPrefs.Update(newClinicPref, oldClinicPref);
                    }
                }
                ClinicPref newPref = _listWebSchedVerifyClinicPrefs.FirstOrDefault(x => x.PrefName == prefName && x.ClinicNum == CLINIC_NUM_DEFAULT);
                if (newPref != null)
                {
                    Prefs.UpdateString(prefName, newPref.ValueString);
                }
            }
        }
Beispiel #16
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (textDateCalc.errorProvider1.GetError(textDateCalc) != ""
         )
     {
         MsgBox.Show(this, "Please fix data entry errors first.");
         return;
     }
     if (!MsgBox.Show(this, true, "Click OK to update aging."))
     {
         return;
     }
     Cursor = Cursors.WaitCursor;
     Patients.ResetAging();
     int[] allGuarantors = Ledgers.GetAllGuarantors();
     for (int i = 0; i < allGuarantors.Length; i++)
     {
         Ledgers.ComputeAging(allGuarantors[i], PIn.PDate(textDateCalc.Text));
         Patients.UpdateAging(allGuarantors[i], Ledgers.Bal[0], Ledgers.Bal[1], Ledgers.Bal[2]
                              , Ledgers.Bal[3], Ledgers.InsEst, Ledgers.BalTotal);
     }
     if (Prefs.UpdateString("DateLastAging", POut.PDate(DateTime.Today, false)))
     {
         DataValid.SetInvalid(InvalidTypes.Prefs);
     }
     Cursor = Cursors.Default;
     MsgBox.Show(this, "Aging Complete");
     DialogResult = DialogResult.OK;
 }
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (!Directory.Exists(textLocation.Text))
            {
                MsgBox.Show(this, "Location does not exist.");
                return;
            }
            if (Directory.Exists(ODFileUtils.CombinePaths(textLocation.Text, textName.Text)))
            {
                MsgBox.Show(this, "Folder already exists.");
                return;
            }
            try {
                FileSystemAccessRule fsar = new FileSystemAccessRule("everyone", FileSystemRights.FullControl, AccessControlType.Allow);
                DirectorySecurity    ds   = new DirectorySecurity();
                ds.AddAccessRule(fsar);
                string requestDir     = textLocation.Text;
                string rootFolderName = textName.Text;
                string rootDir        = ODFileUtils.CombinePaths(requestDir, rootFolderName);
                //Enable file sharing for the A to Z folder.
                if (Environment.OSVersion.Platform == PlatformID.Unix)
                {
                    //Process.Start("net","usershare add OpenDentImages \""+rootDir+"\"");//for future use.
                }
                else                  //Windows
                {
                    Process.Start("NET", "SHARE OpenDentImages=\"" + rootDir + "\"");
                }
                //All folder names to be created should be put in this list, so that each folder is created exactly
                //the same way.
                string[] aToZFolderNames = new string[] {
                    "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N",
                    "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
                    "EmailAttachments", "Forms", "Reports", "Sounds",
                };
                //Create A to Z folders in root folder.
                for (int i = 0; i < aToZFolderNames.Length; i++)
                {
                    string pathToCreate = ODFileUtils.CombinePaths(rootDir, aToZFolderNames[i]);
                    if (!Directory.Exists(pathToCreate))
                    {
                        // Mono does support Directory.CreateDirectory(string, DirectorySecurity)
#if !LINUX
                        Directory.CreateDirectory(pathToCreate, ds);
#else
                        Directory.CreateDirectory(pathToCreate);
#endif
                    }
                }
                //Save new image path into the DocPath and
                //set "use A to Z folders" check-box to checked.
                Prefs.UpdateString("DocPath", rootDir);
                Prefs.UpdateString("AtoZfolderNotRequired", "0");
                Prefs.Refresh();
            }
            catch (Exception ex) {
                Logger.openlog.LogMB("Failed to create A to Z folders: " + ex.ToString(), Logger.Severity.ERROR);
            }
            DialogResult = DialogResult.OK;
        }
        private void butOK_Click(object sender, System.EventArgs e)
        {
            string depStr = "";

            for (int i = 0; i < depAL.Count; i++)
            {
                if (i > 0)
                {
                    depStr += ",";
                }
                depStr += depAL[i].ToString();
            }
            if (Prefs.UpdateString("AccountingDepositAccounts", depStr))
            {
                DataValid.SetInvalid(InvalidTypes.Prefs);
            }
            if (Prefs.UpdateInt("AccountingIncomeAccount", PickedDepAccountNum))
            {
                DataValid.SetInvalid(InvalidTypes.Prefs);
            }
            //pay------------------------------------------------------------------------------------------
            AccountingAutoPays.SaveList(payAL);            //just deletes them all and starts over
            DataValid.SetInvalid(InvalidTypes.Operatories);
            if (Prefs.UpdateInt("AccountingCashIncomeAccount", PickedPayAccountNum))
            {
                DataValid.SetInvalid(InvalidTypes.Prefs);
            }
            DialogResult = DialogResult.OK;
        }
Beispiel #19
0
        private void butAddAccountsQB_Click(object sender, EventArgs e)
        {
            if (textCompanyFileQB.Text.Trim() == "")
            {
                MsgBox.Show(this, "Browse to your QuickBooks company file first.");
                return;
            }
            if (Prefs.UpdateString(PrefName.QuickBooksCompanyFile, textCompanyFileQB.Text))
            {
                DataValid.SetInvalid(InvalidType.Prefs);
            }
            FormAccountPick FormA = new FormAccountPick();

            FormA.IsQuickBooks = true;
            FormA.ShowDialog();
            if (FormA.DialogResult != DialogResult.OK)
            {
                return;
            }
            if (FormA.SelectedAccountsQB != null)
            {
                listAccountsQB.AddRange(FormA.SelectedAccountsQB);
                FillAccountListQB();
            }
        }
Beispiel #20
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (listSoftware.SelectedIndex == -1)
     {
         MsgBox.Show(this, "Must select an accounting software.");
         return;
     }
     if (listSoftware.SelectedIndex == 0)           //Open Dental
     {
         string depStr = "";
         for (int i = 0; i < depAL.Count; i++)
         {
             if (i > 0)
             {
                 depStr += ",";
             }
             depStr += depAL[i].ToString();
         }
         if (Prefs.UpdateString(PrefName.AccountingDepositAccounts, depStr))
         {
             DataValid.SetInvalid(InvalidType.Prefs);
         }
         if (Prefs.UpdateLong(PrefName.AccountingIncomeAccount, PickedDepAccountNum))
         {
             DataValid.SetInvalid(InvalidType.Prefs);
         }
         //pay------------------------------------------------------------------------------------------
         AccountingAutoPays.SaveList(payList);                //just deletes them all and starts over
         DataValid.SetInvalid(InvalidType.AccountingAutoPays);
         if (Prefs.UpdateLong(PrefName.AccountingCashIncomeAccount, PickedPayAccountNum))
         {
             DataValid.SetInvalid(InvalidType.Prefs);
         }
     }
     else              //QuickBooks
     {
         string depStr = "";
         for (int i = 0; i < listBoxAccountsQB.Items.Count; i++)
         {
             if (i > 0)
             {
                 depStr += ",";
             }
             depStr += listBoxAccountsQB.Items[i].ToString();
         }
         if (Prefs.UpdateString(PrefName.QuickBooksCompanyFile, textCompanyFileQB.Text)
             | Prefs.UpdateString(PrefName.QuickBooksDepositAccounts, depStr)
             | Prefs.UpdateString(PrefName.QuickBooksIncomeAccount, textIncomeAccountQB.Text))
         {
             DataValid.SetInvalid(InvalidType.Prefs);
         }
     }
     //Update the selected accounting software.
     if (Prefs.UpdateInt(PrefName.AccountingSoftware, listSoftware.SelectedIndex))
     {
         DataValid.SetInvalid(InvalidType.Prefs);
     }
     DialogResult = DialogResult.OK;
 }
Beispiel #21
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (textDate.errorProvider1.GetError(textDate) != "" ||
                textAPR.errorProvider1.GetError(textAPR) != "")
            {
                MessageBox.Show(Lan.g(this, "Please fix data entry errors first."));
                return;
            }

            if (PIn.PInt(textAPR.Text) < 2)
            {
                if (MessageBox.Show(Lan.g(this, "The APR is much lower than normal. Do you wish to proceed?"), "", MessageBoxButtons.OKCancel) != DialogResult.OK)
                {
                    return;
                }
            }
            //Patients.ResetAging();
            //Ledgers.UpdateFinanceCharges(PIn.PDate(textDate.Text));
            PatAging[] AgingList = Patients.GetAgingList();
            double     OverallBalance;

            for (int i = 0; i < AgingList.Length; i++)
            {
                OverallBalance = 0;              //this WILL NOT be the same as the patient's total balance
                if (radio30.Checked)
                {
                    OverallBalance = AgingList[i].Bal_31_60 + AgingList[i].Bal_61_90 + AgingList[i].BalOver90;
                }
                if (radio60.Checked)
                {
                    OverallBalance = AgingList[i].Bal_61_90 + AgingList[i].BalOver90;
                }
                if (radio90.Checked)
                {
                    OverallBalance = AgingList[i].BalOver90;
                }
                if (OverallBalance > 0)
                {
                    Adjustment AdjustmentCur = new Adjustment();
                    AdjustmentCur.PatNum = AgingList[i].PatNum;
                    //AdjustmentCur.DateEntry=PIn.PDate(textDate.Text);//automatically handled
                    AdjustmentCur.AdjDate  = PIn.PDate(textDate.Text);
                    AdjustmentCur.ProcDate = PIn.PDate(textDate.Text);
                    AdjustmentCur.AdjType  = DefB.Short[(int)DefCat.AdjTypes]
                                             [(int)ALPosIndices[listAdjType.SelectedIndex]].DefNum;
                    AdjustmentCur.AdjNote = "Finance Charge";
                    AdjustmentCur.AdjAmt  = Math.Round(((PIn.PDouble(textAPR.Text) * .01 / 12) * OverallBalance), 2);
                    AdjustmentCur.ProvNum = AgingList[i].PriProv;
                    Adjustments.InsertOrUpdate(AdjustmentCur, true);
                }
            }
            Prefs.UpdateString("FinanceChargeAPR", textAPR.Text);
            Prefs.UpdateInt("FinanceChargeAdjustmentType",
                            DefB.Short[(int)DefCat.AdjTypes][(int)ALPosIndices[listAdjType.SelectedIndex]].DefNum);
            Prefs.UpdateString("FinanceChargeLastRun", POut.PDate(DateTime.Today, false));
            DataValid.SetInvalid(InvalidTypes.Prefs);
            MessageBox.Show(Lan.g(this, "Finance Charges Added."));
            DialogResult = DialogResult.OK;
        }
 private void FormTerminalManager_FormClosing(object sender, FormClosingEventArgs e)
 {
     PatientChangedEvent.Fired -= PatientChangedEvent_Fired;
     if (Prefs.UpdateString(PrefName.TerminalClosePassword, textPassword.Text))
     {
         Signalods.SetInvalid(InvalidType.Prefs);
     }
 }
 private void FormLanguagesUsed_FormClosing(object sender, FormClosingEventArgs e)
 {
     //if LanguagesUsedByPatients does not contain LanguagesIndicateNone clear LanguagesIndicateNone
     if (!PrefC.GetString(PrefName.LanguagesUsedByPatients).Contains(PrefC.GetString(PrefName.LanguagesIndicateNone)))
     {
         Prefs.UpdateString(PrefName.LanguagesIndicateNone, "");
     }
 }
Beispiel #24
0
 private void butOK_Click(object sender, EventArgs e)
 {
     if (Prefs.UpdateString(PrefName.EmailMasterTemplate, textMaster.Text))
     {
         DataValid.SetInvalid(InvalidType.Prefs);
     }
     DialogResult = DialogResult.OK;
 }
Beispiel #25
0
 private void butSave_Click(object sender, EventArgs e)
 {
     if (Prefs.UpdateString(PrefName.TerminalClosePassword, textPassword.Text))
     {
         DataValid.SetInvalid(InvalidType.Prefs);
     }
     MsgBox.Show(this, "Done.");
 }
Beispiel #26
0
        ///<summary>This ONLY runs when first opening the program.  Gets run early in the sequence. Returns false if the program should exit.</summary>
        public static bool CheckMySqlVersion()
        {
            if (DataConnection.DBtype != DatabaseType.MySql)
            {
                return(true);
            }
            string thisVersion  = MiscData.GetMySqlVersion();
            float  floatVersion = PIn.Float(thisVersion.Substring(0, 3));

            if (floatVersion < 5.0f)
            {
                //We will force users to upgrade to 5.0, but not yet to 5.5
                MessageBox.Show(Lan.g("Prefs", "Your version of MySQL won't work with this program") + ": " + thisVersion
                                + ".  " + Lan.g("Prefs", "You should upgrade to MySQL 5.0 using the installer on our website."));
                Application.Exit();
                return(false);
            }
            if (!PrefC.ContainsKey("MySqlVersion"))             //db has not yet been updated to store this pref
            //We're going to skip this.  We will recommend that people first upgrade OD, then MySQL, so this won't be an issue.
            {
            }
            else if (Prefs.UpdateString(PrefName.MySqlVersion, floatVersion.ToString("f1")))
            {
                if (!MsgBox.Show("Prefs", MsgBoxButtons.OKCancel, "Tables will now be optimized.  This will take a minute or two."))
                {
                    Application.Exit();
                    return(false);
                }
                DatabaseMaintenance.RepairAndOptimize();
            }
            if (PrefC.ContainsKey("DatabaseConvertedForMySql41"))
            {
                return(true);               //already converted
            }
            if (!MsgBox.Show("Prefs", true, "Your database will now be converted for use with MySQL 4.1."))
            {
                Application.Exit();
                return(false);
            }
            //ClassConvertDatabase CCD=new ClassConvertDatabase();
            try {
                MiscData.MakeABackup();
            }
            catch (Exception e) {
                if (e.Message != "")
                {
                    MessageBox.Show(e.Message);
                }
                MsgBox.Show("Prefs", "Backup failed. Your database has not been altered.");
                Application.Exit();
                return(false);               //but this should never happen
            }
            MessageBox.Show("Backup performed");
            Prefs.ConvertToMySqlVersion41();
            MessageBox.Show("converted");
            //Refresh();
            return(true);
        }
        private void butOK_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(textSftpPort.errorProvider1.GetError(textSftpPort)))
            {
                MsgBox.Show(this, "Please enter a valid integer for the Sftp Server Port.");
                return;
            }
            int      sendFreq = (int)numericSendFrequency.Value;
            DateTime accountUpdatesRuntime = DateTime.MinValue;

            if (!string.IsNullOrWhiteSpace(textUpdatesTimeOfDay.Text) && !DateTime.TryParse(textUpdatesTimeOfDay.Text, out accountUpdatesRuntime))
            {
                MsgBox.Show(this, "Account Updates Run Time must be blank or a valid time of day.");
                return;
            }
            if (comboSendFrequencyUnits.SelectedIndex < 0 || comboSendFrequencyUnits.SelectedIndex >= Enum.GetNames(typeof(FrequencyUnit)).Length)
            {
                //shouldn't be possible, but just in case
                MsgBox.Show(this, "Please select a valid unit of measurement for the Account Activity Updates repeat frequency.");
                return;
            }
            if (numericSendFrequency.Value < 1 || numericSendFrequency.Value > new[] { 30, 24, 60 }[comboSendFrequencyUnits.SelectedIndex])
            {
                //shouldn't be possible, but just in case
                MsgBox.Show(this, "Please enter a valid value for the Account Activity Updates repeat frequency.");
                return;
            }
            long billTypePaidInFullDefNum = comboPaidInFullBillType.GetSelectedDefNum();

            if (billTypePaidInFullDefNum == 0 && checkEnabled.Checked)
            {
                MsgBox.Show(this, "Please select a Paid in Full Billing Type.");
                return;
            }
            SyncWithHQ();                                 //will remove any clinic from the dict if all props exactly match the HQ props, or add clinic props if different
            if (_progCur.Enabled != checkEnabled.Checked) //only update the program if the IsEnabled flag has changed
            {
                _progCur.Enabled = checkEnabled.Checked;
                Programs.Update(_progCur);
            }
            ProgramProperties.Sync(_dictClinicListProgProps.Where(x => _listUserClinicNums.Contains(x.Key)).SelectMany(x => x.Value).ToList(), _progCur.ProgramNum, _listUserClinicNums);
            DataValid.SetInvalid(InvalidType.Programs);
            string updateFreq = numericSendFrequency.Value + " " + (FrequencyUnit)comboSendFrequencyUnits.SelectedIndex;
            bool   hasChanged = false;

            if (Prefs.UpdateString(PrefName.TransworldServiceTimeDue, accountUpdatesRuntime == DateTime.MinValue?"":POut.Time(accountUpdatesRuntime.TimeOfDay, false))
                | Prefs.UpdateString(PrefName.TransworldServiceSendFrequency, updateFreq))
            {
                Prefs.UpdateDateT(PrefName.TransworldDateTimeLastUpdated, DateTime.MinValue);
                hasChanged = true;
            }
            if (Prefs.UpdateLong(PrefName.TransworldPaidInFullBillingType, billTypePaidInFullDefNum) | hasChanged)
            {
                DataValid.SetInvalid(InvalidType.Prefs);
            }
            DialogResult = DialogResult.OK;
        }
        private void butOK_Click(object sender, EventArgs e)
        {
            if (textDays.errorProvider1.GetError(textDays) != "")
            {
                MsgBox.Show(this, "Please fix data entry errors first.");
                return;
            }
            string cc = "";

            if (checkMC.Checked)
            {
                cc = "MC";
            }
            if (checkV.Checked)
            {
                if (cc != "")
                {
                    cc += ",";
                }
                cc += "V";
            }
            if (checkD.Checked)
            {
                if (cc != "")
                {
                    cc += ",";
                }
                cc += "D";
            }
            if (checkAmEx.Checked)
            {
                if (cc != "")
                {
                    cc += ",";
                }
                cc += "A";
            }
            string billingUseElectronic = listElectBilling.SelectedIndex.ToString();

            if (Prefs.UpdateLong(PrefName.BillingDefaultsLastDays, PIn.Long(textDays.Text))
                | Prefs.UpdateBool(PrefName.BillingDefaultsIntermingle, checkIntermingled.Checked)
                | Prefs.UpdateString(PrefName.BillingDefaultsNote, textNote.Text)
                | Prefs.UpdateString(PrefName.BillingUseElectronic, billingUseElectronic)
                | Prefs.UpdateString(PrefName.BillingEmailSubject, textBillingEmailSubject.Text)
                | Prefs.UpdateString(PrefName.BillingEmailBodyText, textBillingEmailBody.Text)
                | Prefs.UpdateString(PrefName.BillingElectVendorId, textVendorId.Text)
                | Prefs.UpdateString(PrefName.BillingElectVendorPMSCode, textVendorPMScode.Text)
                | Prefs.UpdateString(PrefName.BillingElectCreditCardChoices, cc)
                | Prefs.UpdateString(PrefName.BillingElectClientAcctNumber, textClientAcctNumber.Text)
                | Prefs.UpdateString(PrefName.BillingElectUserName, textUserName.Text)
                | Prefs.UpdateString(PrefName.BillingElectPassword, textPassword.Text)
                | Prefs.UpdateString(PrefName.BillingDefaultsInvoiceNote, textInvoiceNote.Text))
            {
                DataValid.SetInvalid(InvalidType.Prefs);
            }
            DialogResult = DialogResult.OK;
        }
 private void butOK_Click(object sender, EventArgs e)
 {
     _defaultCCProcs = string.Join(",", _listCCProcs);
     if (Prefs.UpdateString(PrefName.DefaultCCProcs, _defaultCCProcs))
     {
         DataValid.SetInvalid(InvalidType.Prefs);
     }
     DialogResult = DialogResult.OK;
 }
        private void butOK_Click(object sender, EventArgs e)
        {
            if (textLogOffAfterMinutes.Text != "")
            {
                try {
                    int logOffMinutes = Int32.Parse(textLogOffAfterMinutes.Text);
                    if (logOffMinutes < 0)                   //Automatic log off must be a positive numerical value.
                    {
                        throw new Exception();
                    }
                }
                catch {
                    MsgBox.Show(this, "Log off after minutes is invalid.");
                    return;
                }
            }
            DataValid.SetInvalid(InvalidType.Security);
            bool invalidatePrefs = false;

            if (            //Prefs.UpdateBool(PrefName.PasswordsMustBeStrong,checkPasswordsMustBeStrong.Checked) //handled when box clicked.
                Prefs.UpdateBool(PrefName.TimecardSecurityEnabled, checkTimecardSecurityEnabled.Checked)
                | Prefs.UpdateBool(PrefName.TimecardUsersDontEditOwnCard, checkCannotEditOwn.Checked)
                | Prefs.UpdateBool(PrefName.SecurityLogOffWithWindows, checkLogOffWindows.Checked)
                | Prefs.UpdateBool(PrefName.UserNameManualEntry, checkUserNameManualEntry.Checked)
                | Prefs.UpdateBool(PrefName.PasswordsStrongIncludeSpecial, checkPasswordsStrongIncludeSpecial.Checked)
                | Prefs.UpdateBool(PrefName.PasswordsWeakChangeToStrong, checkPasswordForceWeakToStrong.Checked)
                | Prefs.UpdateInt(PrefName.SecurityLogOffAfterMinutes, PIn.Int(textLogOffAfterMinutes.Text))
                | Prefs.UpdateString(PrefName.DomainLoginPath, PIn.String(textDomainLoginPath.Text))
                | Prefs.UpdateString(PrefName.DomainLoginPath, textDomainLoginPath.Text)
                | Prefs.UpdateString(PrefName.DomainLoginPath, textDomainLoginPath.Text)
                | Prefs.UpdateBool(PrefName.DomainLoginEnabled, checkDomainLoginEnabled.Checked)
                | Prefs.UpdateLong(PrefName.DefaultUserGroup, comboGroups.SelectedIndex == -1?0:comboGroups.GetSelected <UserGroup>().UserGroupNum)
                | Prefs.UpdateBool(PrefName.SecurityLogOffAllowUserOverride, checkAllowLogoffOverride.Checked)
                )
            {
                invalidatePrefs = true;
            }
            //if PasswordsMustBeStrong was unchecked, then reset the strong password flags.
            if (Prefs.UpdateBool(PrefName.PasswordsMustBeStrong, checkPasswordsMustBeStrong.Checked) && !checkPasswordsMustBeStrong.Checked)
            {
                invalidatePrefs = true;
                Userods.ResetStrongPasswordFlags();
            }
            if (checkDisableBackupReminder.Checked)
            {
                invalidatePrefs |= Prefs.UpdateDateT(PrefName.BackupReminderLastDateRun, DateTime.MaxValue.AddMonths(-1));              //if MaxValue, gives error on startup.
            }
            else
            {
                invalidatePrefs |= Prefs.UpdateDateT(PrefName.BackupReminderLastDateRun, DateTimeOD.Today);
            }
            if (invalidatePrefs)
            {
                DataValid.SetInvalid(InvalidType.Prefs);
            }
            DialogResult = DialogResult.OK;
        }