private void butOK_Click(object sender, System.EventArgs e)
        {
            //if(textDate.errorProvider1.GetError(textDate)!=""){
            //	MessageBox.Show(Lan.g(this,"Please fix data entry errors first."));
            //	return;
            //}
            ReportSimpleGrid report = new ReportSimpleGrid();

            report.Query =
                "SELECT " + DbHelper.Concat("patient.LName", "', '", "patient.FName", "' '", "patient.MiddleI") + ",adjamt "
                + "FROM patient,adjustment "
                + "WHERE patient.patnum=adjustment.patnum "
                + "AND adjustment.adjdate = " + POut.Date(PrefC.GetDate(PrefName.FinanceChargeLastRun))
                + "AND adjustment.adjtype = '" + POut.Long(PrefC.GetLong(PrefName.FinanceChargeAdjustmentType)) + "'";
            FormQuery2          = new FormQuery(report);
            FormQuery2.IsReport = true;
            FormQuery2.SubmitReportQuery();
            report.Title = "FINANCE CHARGE REPORT";
            report.SubTitle.Add(PrefC.GetString(PrefName.PracticeTitle));
            report.SubTitle.Add("Date of Charges: " + PrefC.GetDate(PrefName.FinanceChargeLastRun).ToShortDateString());
            report.SetColumn(this, 0, "Patient Name", 180);
            report.SetColumn(this, 1, "Amount", 100, HorizontalAlignment.Right);

            FormQuery2.ShowDialog();
            DialogResult = DialogResult.OK;
        }
Exemple #2
0
        private void FormAging_Load(object sender, System.EventArgs e)
        {
            DateTime dateLastAging = PrefC.GetDate(PrefName.DateLastAging);

            if (dateLastAging.Year < 1880)
            {
                textDateLast.Text = "";
            }
            else
            {
                textDateLast.Text = dateLastAging.ToShortDateString();
            }
            if (PrefC.GetBool(PrefName.AgingCalculatedMonthlyInsteadOfDaily))
            {
                if (dateLastAging < DateTime.Today.AddDays(-15))
                {
                    textDateCalc.Text = dateLastAging.AddMonths(1).ToShortDateString();
                }
                else
                {
                    textDateCalc.Text = dateLastAging.ToShortDateString();
                }
            }
            else
            {
                textDateCalc.Text = DateTime.Today.ToShortDateString();
                if (PrefC.GetBool(PrefName.AgingIsEnterprise))                 //enterprise aging requires daily not monthly calc
                {
                    textDateCalc.ReadOnly  = true;
                    textDateCalc.BackColor = SystemColors.Control;
                }
            }
        }
        private void FillTabMobileSynch()
        {
            textMobileSyncServerURL.Text    = PrefC.GetString(PrefName.MobileSyncServerURL);
            textSynchMinutes.Text           = PrefC.GetInt(PrefName.MobileSyncIntervalMinutes).ToString();
            textDateBefore.Text             = PrefC.GetDate(PrefName.MobileExcludeApptsBeforeDate).ToShortDateString();
            textMobileSynchWorkStation.Text = PrefC.GetString(PrefName.MobileSyncWorkstationName);
            textMobileUserName.Text         = PrefC.GetString(PrefName.MobileUserName);
            textMobilePassword.Text         = "";  //not stored locally, and not pulled from web server
            DateTime lastRun = PrefC.GetDateT(PrefName.MobileSyncDateTimeLastRun);

            if (lastRun.Year > 1880)
            {
                textDateTimeLastRun.Text = lastRun.ToShortDateString() + " " + lastRun.ToShortTimeString();
            }
            //Hide the Old-style Mobile Synch tab and make visible the button that unhides the tab,
            //only if mobile synch has not been used for at least a month. If used again, the clock will reset
            //and the
            if (MiscData.GetNowDateTime().Subtract(lastRun.Date).TotalDays > 30)
            {
                groupNotUsed.Visible         = true;
                butShowOldMobileSych.Visible = true;
                tabControl.TabPages.Remove(tabMobileSynch);
            }
            //Web server is not contacted when loading this form.  That would be too slow.
            //CreateAppointments(5);
        }
 private void FormAccountingLock_Load(object sender, EventArgs e)
 {
     if (PrefC.GetDate(PrefName.AccountingLockDate).Year > 1880)
     {
         textDate.Text = PrefC.GetDate(PrefName.AccountingLockDate).ToShortDateString();
     }
 }
Exemple #5
0
 private void FormRpFinanceCharge_Load(object sender, System.EventArgs e)
 {
     textDateFrom.Text    = PrefC.GetDate(PrefName.FinanceChargeLastRun).ToShortDateString();
     textDateTo.Text      = PrefC.GetDate(PrefName.FinanceChargeLastRun).ToShortDateString();
     _listProviders       = Providers.GetListReports();
     _listBillingTypeDefs = Defs.GetDefsForCategory(DefCat.BillingTypes, true);
     foreach (Def billingType in _listBillingTypeDefs)
     {
         listBillingType.Items.Add(billingType.ItemName);
     }
     if (listBillingType.Items.Count > 0)
     {
         listBillingType.SelectedIndex = 0;
     }
     foreach (Provider prov in _listProviders)
     {
         listProv.Items.Add(prov.GetLongDesc());
     }
     if (listProv.Items.Count > 0)
     {
         listProv.SelectedIndex = 0;
     }
     checkAllProv.Checked    = true;
     checkAllBilling.Checked = true;
     listProv.Visible        = false;
     listBillingType.Visible = false;
 }
Exemple #6
0
 private void radioBillingCharge_CheckedChanged(object sender, EventArgs e)
 {
     textAPR.ReadOnly            = true;
     textAPR.BackColor           = System.Drawing.SystemColors.Control;
     textBillingCharge.ReadOnly  = false;
     textBillingCharge.BackColor = System.Drawing.SystemColors.Window;
     textDateLastRun.Text        = PrefC.GetDate(PrefName.BillingChargeLastRun).ToShortDateString();
     textDateUndo.Text           = PrefC.GetDate(PrefName.BillingChargeLastRun).ToShortDateString();
 }
        ///<summary>If !isPreCharges, a message box will display for any errors instructing users to try again.  If the failed aging attempt is after
        ///charges have been added/deleted, we don't want to inform the user that the transaction failed so run again since the charges were successfully
        ///inserted/deleted and it was only updating the aged balances that failed.  If isPreCharges, this won't run aging again if the last aging run was
        ///today.  If !isPreCharges, we will run aging even if it was run today to update aged bals to include the charges added/deleted.</summary>
        private bool RunAgingEnterprise(bool isOnLoad = false)
        {
            DateTime dtNow         = MiscData.GetNowDateTime();
            DateTime dtToday       = dtNow.Date;
            DateTime dateLastAging = PrefC.GetDate(PrefName.DateLastAging);

            if (isOnLoad && dateLastAging.Date == dtToday)
            {
                return(true);               //this is prior to inserting/deleting charges and aging has already been run for this date
            }
            Prefs.RefreshCache();
            DateTime dateTAgingBeganPref = PrefC.GetDateT(PrefName.AgingBeginDateTime);

            if (dateTAgingBeganPref > DateTime.MinValue)
            {
                if (isOnLoad)
                {
                    MessageBox.Show(this, Lan.g(this, "In order to add finance charges, aging must be calculated, but you cannot run aging until it has finished "
                                                + "the current calculations which began on") + " " + dateTAgingBeganPref.ToString() + ".\r\n" + Lans.g(this, "If you believe the current aging "
                                                                                                                                                       + "process has finished, a user with SecurityAdmin permission can manually clear the date and time by going to Setup | Miscellaneous and "
                                                                                                                                                       + "pressing the 'Clear' button."));
                }
                return(false);
            }
            Prefs.UpdateString(PrefName.AgingBeginDateTime, POut.DateT(dtNow, false)); //get lock on pref to block others
            Signalods.SetInvalid(InvalidType.Prefs);                                   //signal a cache refresh so other computers will have the updated pref as quickly as possible
            Action actionCloseProgress = null;

            try {
                actionCloseProgress = ODProgressOld.ShowProgressStatus("FinanceCharge", this, Lan.g(this, "Calculating enterprise aging for all patients as of") + " "
                                                                       + dtToday.ToShortDateString() + "...");
                Cursor = Cursors.WaitCursor;
                Ledgers.ComputeAging(0, dtToday);
                Prefs.UpdateString(PrefName.DateLastAging, POut.Date(dtToday, false));
            }
            catch (MySqlException ex) {
                actionCloseProgress?.Invoke();                //effectively terminates progress bar
                Cursor = Cursors.Default;
                if (ex == null || ex.Number != 1213)          //not a deadlock error, just throw
                {
                    throw;
                }
                if (isOnLoad)
                {
                    MsgBox.Show(this, "Deadlock error detected in enterprise aging transaction and rolled back. Try again later.");
                }
                return(false);
            }
            finally {
                actionCloseProgress?.Invoke();                       //effectively terminates progress bar
                Cursor = Cursors.Default;
                Prefs.UpdateString(PrefName.AgingBeginDateTime, ""); //clear lock on pref whether aging was successful or not
                Signalods.SetInvalid(InvalidType.Prefs);
            }
            return(true);
        }
Exemple #8
0
 private void FormBackup_Load(object sender, System.EventArgs e)
 {
     if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)           //Archive not supported over MT connection. Show warning if Middle Tier is in use.
     {
         butArchive.Enabled   = false;
         labelWarning.Text    = Lan.g(this, "Not available when using a Middle Tier connection. You may only remove old data when directly connected to the server.");
         labelWarning.Visible = true;
     }
     #region Backup Tab
     //usesInternalImages=(PrefC.GetString(PrefName.ImageStore)=="OpenDental.Imaging.SqlStore");
     checkExcludeImages.Checked          = PrefC.GetBool(PrefName.BackupExcludeImageFolder);
     checkArchiveDoBackupFirst.Checked   = PrefC.GetBool(PrefName.ArchiveDoBackupFirst);
     textBackupFromPath.Text             = PrefC.GetString(PrefName.BackupFromPath);
     textBackupToPath.Text               = PrefC.GetString(PrefName.BackupToPath);
     textBackupRestoreFromPath.Text      = PrefC.GetString(PrefName.BackupRestoreFromPath);
     textBackupRestoreToPath.Text        = PrefC.GetString(PrefName.BackupRestoreToPath);
     textBackupRestoreAtoZToPath.Text    = PrefC.GetString(PrefName.BackupRestoreAtoZToPath);
     textBackupRestoreAtoZToPath.Enabled = ShouldUseAtoZFolder();
     butBrowseRestoreAtoZTo.Enabled      = ShouldUseAtoZFolder();
     if (ProgramProperties.IsAdvertisingDisabled(ProgramName.CentralDataStorage))
     {
         groupManagedBackups.Visible = false;
     }
     #endregion
     #region Archive Tab
     string decryptedPass;
     CDT.Class1.Decrypt(PrefC.GetString(PrefName.ArchivePassHash), out decryptedPass);
     textArchivePass.Text         = decryptedPass;
     textArchivePass.PasswordChar = (textArchivePass.Text == "" ? default(char) : '*');
     textArchiveServerName.Text   = PrefC.GetString(PrefName.ArchiveServerName);
     textArchiveUser.Text         = PrefC.GetString(PrefName.ArchiveUserName);
     //If pref is set, use it.  Otherwise, 3 years ago.
     dateTimeArchive.Value = PrefC.GetDate(PrefName.ArchiveDate) == DateTime.MinValue?DateTime.Today.AddYears(-3):PrefC.GetDate(PrefName.ArchiveDate);
     ToggleBackupSettings();
     #endregion
     #region Supplemental Tab
     checkSupplementalBackupEnabled.Checked = PrefC.GetBool(PrefName.SupplementalBackupEnabled);
     if (PrefC.GetDate(PrefName.SupplementalBackupDateLastComplete).Year > 1880)
     {
         textSupplementalBackupDateLastComplete.Text = PrefC.GetDate(PrefName.SupplementalBackupDateLastComplete).ToString();
     }
     textSupplementalBackupCopyNetworkPath.Text = PrefC.GetString(PrefName.SupplementalBackupNetworkPath);
     #endregion Supplemental Tab
     if (ODBuild.IsWeb())
     {
         //OD Cloud users cannot use this tool because they're InnoDb.
         tabControl1.TabPages.Remove(tabPageBackup);
         //We don't want to allow the user to connect to another server.
         checkArchiveDoBackupFirst.Visible = false;
         checkArchiveDoBackupFirst.Checked = false;
         groupBoxBackupConnection.Visible  = false;
         //We don't want the user to be able to tell if a directory exists.
         tabControl1.TabPages.Remove(tabPageSupplementalBackups);
     }
 }
 private void FormSecurityLock_Load(object sender, EventArgs e)
 {
     if (PrefC.GetDate(PrefName.SecurityLockDate).Year > 1880)
     {
         textDate.Text = PrefC.GetDate(PrefName.SecurityLockDate).ToShortDateString();
     }
     if (PrefC.GetInt(PrefName.SecurityLockDays) > 0)
     {
         textDays.Text = PrefC.GetInt(PrefName.SecurityLockDays).ToString();
     }
     checkAdmin.Checked = PrefC.GetBool(PrefName.SecurityLockIncludesAdmin);
 }
Exemple #10
0
        private bool RunAgingEnterprise(DateTime dateCalc)
        {
            DateTime dateLastAging = PrefC.GetDate(PrefName.DateLastAging);

            if (dateLastAging.Date == dateCalc.Date)
            {
                if (MessageBox.Show(this, Lan.g(this, "Aging has already been calculated for") + " " + dateCalc.ToShortDateString() + " "
                                    + Lan.g(this, "and does not normally need to run more than once per day.\r\n\r\nRun anway?"), "", MessageBoxButtons.YesNo) != DialogResult.Yes)
                {
                    return(false);
                }
            }
            //Refresh prefs because AgingBeginDateTime is very time sensitive
            Prefs.RefreshCache();
            DateTime dateTAgingBeganPref = PrefC.GetDateT(PrefName.AgingBeginDateTime);

            if (dateTAgingBeganPref > DateTime.MinValue)
            {
                MessageBox.Show(this, Lan.g(this, "You cannot run aging until it has finished the current calculations which began on") + " "
                                + dateTAgingBeganPref.ToString() + ".\r\n" + Lans.g(this, "If you believe the current aging process has finished, a user with SecurityAdmin permission "
                                                                                    + "can manually clear the date and time by going to Setup | Miscellaneous and pressing the 'Clear' button."));
                return(false);
            }
            Prefs.UpdateString(PrefName.AgingBeginDateTime, POut.DateT(MiscData.GetNowDateTime(), false)); //get lock on pref to block others
            Signalods.SetInvalid(InvalidType.Prefs);                                                       //signal a cache refresh so other computers will have the updated pref as quickly as possible
            Action actionCloseAgingProgress = null;

            try {
                actionCloseAgingProgress = ODProgressOld.ShowProgressStatus("ComputeAging", this,
                                                                            Lan.g(this, "Calculating enterprise aging for all patients as of") + " " + dateCalc.ToShortDateString() + "...");
                Cursor = Cursors.WaitCursor;
                Ledgers.ComputeAging(0, dateCalc);
                Prefs.UpdateString(PrefName.DateLastAging, POut.Date(dateCalc, false));
            }
            catch (MySqlException ex) {
                actionCloseAgingProgress?.Invoke();
                Cursor = Cursors.Default;
                if (ex == null || ex.Number != 1213)             //not a deadlock error, just throw
                {
                    throw;
                }
                MsgBox.Show(this, "Deadlock error detected in aging transaction and rolled back. Try again later.");
                return(false);
            }
            finally {
                actionCloseAgingProgress?.Invoke();
                Cursor = Cursors.Default;
                Prefs.UpdateString(PrefName.AgingBeginDateTime, "");               //clear lock on pref whether aging was successful or not
                Signalods.SetInvalid(InvalidType.Prefs);
            }
            return(true);
        }
Exemple #11
0
        private void FormRpInsAging_Load(object sender, System.EventArgs e)
        {
            _listProviders = Providers.GetListReports();
            DateTime lastAgingDate = PrefC.GetDate(PrefName.DateLastAging);

            if (lastAgingDate.Year < 1880)
            {
                textDate.Text = "";
            }
            else if (PrefC.GetBool(PrefName.AgingCalculatedMonthlyInsteadOfDaily))
            {
                textDate.Text = lastAgingDate.ToShortDateString();
            }
            else
            {
                textDate.Text = DateTime.Today.ToShortDateString();
            }
            _listBillingTypeDefs = Defs.GetDefsForCategory(DefCat.BillingTypes, true);
            listBillType.Items.AddRange(_listBillingTypeDefs.Select(x => x.ItemName).ToArray());
            listBillType.SelectedIndex = (listBillType.Items.Count > 0?0:-1);
            checkBillTypesAll.Checked  = true;          //all billing types by default, event handler will set visibility
            listProv.Items.AddRange(_listProviders.Select(x => x.GetLongDesc()).ToArray());
            listProv.SelectedIndex = (listProv.Items.Count > 0?0:-1);
            checkProvAll.Checked   = true;         //all provs by default, event handler will set visibility
            if (!PrefC.HasClinicsEnabled)
            {
                checkAllClin.Visible = false;              //event handler may set listClin to visible, so hide explicitly after setting unchecked just in case
                listClin.Visible     = false;
                labelClin.Visible    = false;
            }
            else
            {
                List <Clinic> listClinics = Clinics.GetForUserod(Security.CurUser, true, "Unassigned").ToList();
                if (!listClinics.Exists(x => x.ClinicNum == Clinics.ClinicNum))               //Could have a hidden clinic selected
                {
                    listClinics.Add(Clinics.GetClinic(Clinics.ClinicNum));
                }
                listClin.Items.AddRange(listClinics.Select(x => new ODBoxItem <Clinic>(x.Abbr + (x.IsHidden?(" " + Lan.g(this, "(hidden)")):""), x)).ToArray());
                listClin.SelectedIndex = listClinics.FindIndex(x => x.ClinicNum == Clinics.ClinicNum); //FindIndex could return -1, which is fine
                checkAllClin.Checked   = (Clinics.ClinicNum == 0);                                     //event handler will set visibility
            }
            if (PrefC.GetBool(PrefName.FutureTransDatesAllowed) || PrefC.GetBool(PrefName.AccountAllowFutureDebits) ||
                PrefC.GetBool(PrefName.AllowFutureInsPayments))
            {
                labelFutureTrans.Visible = true;              //Set to false in designer
            }
            if (!checkOnlyShowPatsOutstandingClaims.Checked)
            {
                groupFilter.Visible = false;
            }
        }
Exemple #12
0
 private void FormCentralSecurity_Load(object sender, EventArgs e)
 {
     #region Load Global Settings
     textSyncCode.Text   = PrefC.GetString(PrefName.CentralManagerSyncCode);
     checkEnable.Checked = PrefC.GetBool(PrefName.CentralManagerSecurityLock);
     checkAdmin.Checked  = PrefC.GetBool(PrefName.SecurityLockIncludesAdmin);
     if (PrefC.GetDate(PrefName.SecurityLockDate).Year > 1880)
     {
         textDate.Text = PrefC.GetDate(PrefName.SecurityLockDate).ToShortDateString();
     }
     if (PrefC.GetInt(PrefName.SecurityLockDays) > 0)
     {
         textDays.Text = PrefC.GetInt(PrefName.SecurityLockDays).ToString();
     }
     #endregion
 }
        private void FormRpFinanceCharge_Load(object sender, System.EventArgs e)
        {
            textDate.Text = PrefC.GetDate(PrefName.FinanceChargeLastRun).ToShortDateString();

            /*if(DateTime.Today.Day > 15){
             *      if(DateTime.Today.Month!=12){
             *              textDate.Text=(new DateTime(DateTime.Today.Year,DateTime.Today.Month+1,1)).ToShortDateString();
             *      }
             *      else{
             *              textDate.Text=(new DateTime(DateTime.Today.Year+1,1,1)).ToShortDateString();
             *      }
             * }
             * else{
             *      textDate.Text=(new DateTime(DateTime.Today.Year,DateTime.Today.Month,1)).ToShortDateString();
             * }	*/
        }
Exemple #14
0
        private void FormMobileSetup_Load(object sender, EventArgs e)
        {
            textMobileSyncServerURL.Text    = PrefC.GetString(PrefName.MobileSyncServerURL);
            textSynchMinutes.Text           = PrefC.GetInt(PrefName.MobileSyncIntervalMinutes).ToString();
            textDateBefore.Text             = PrefC.GetDate(PrefName.MobileExcludeApptsBeforeDate).ToShortDateString();
            textMobileSynchWorkStation.Text = PrefC.GetString(PrefName.MobileSyncWorkstationName);
            textMobileUserName.Text         = PrefC.GetString(PrefName.MobileUserName);
            textMobilePassword.Text         = "";  //not stored locally, and not pulled from web server
            DateTime lastRun = PrefC.GetDateT(PrefName.MobileSyncDateTimeLastRun);

            if (lastRun.Year > 1880)
            {
                textDateTimeLastRun.Text = lastRun.ToShortDateString() + " " + lastRun.ToShortTimeString();
            }
            //Web server is not contacted when loading this form.  That would be too slow.
            //CreateAppointments(5);
        }
Exemple #15
0
        private void FormFinanceCharges_Load(object sender, System.EventArgs e)
        {
            if (PrefC.GetLong(PrefName.FinanceChargeAdjustmentType) == 0)
            {
                MsgBox.Show(this, "No finance charge adjustment type has been set.  Please go to Setup | Modules to fix this.");
                DialogResult = DialogResult.Cancel;
                return;
            }
            if (PrefC.GetLong(PrefName.BillingChargeAdjustmentType) == 0)
            {
                MsgBox.Show(this, "No billing charge adjustment type has been set.  Please go to Setup | Modules to fix this.");
                DialogResult = DialogResult.Cancel;
                return;
            }
            Ledgers.RunAging();
            if (DefC.Short[(int)DefCat.BillingTypes].Length == 0)          //highly unlikely that this would happen
            {
                MsgBox.Show(this, "No billing types have been set up or are visible.");
                DialogResult = DialogResult.Cancel;
                return;
            }
            textDate.Text          = DateTime.Today.ToShortDateString();
            textAPR.MaxVal         = 100;
            textAPR.MinVal         = 0;
            textAPR.Text           = PrefC.GetString(PrefName.FinanceChargeAPR);
            textBillingCharge.Text = PrefC.GetString(PrefName.BillingChargeAmount);
            for (int i = 0; i < DefC.Short[(int)DefCat.BillingTypes].Length; i++)
            {
                listBillType.Items.Add(DefC.Short[(int)DefCat.BillingTypes][i].ItemName);
                listBillType.SetSelected(i, true);
            }
            string defaultChargeMethod = PrefC.GetString(PrefName.BillingChargeOrFinanceIsDefault);

            if (defaultChargeMethod == "Finance")
            {
                radioFinanceCharge.Checked = true;
                textDateLastRun.Text       = PrefC.GetDate(PrefName.FinanceChargeLastRun).ToShortDateString();
                textDateUndo.Text          = PrefC.GetDate(PrefName.FinanceChargeLastRun).ToShortDateString();
            }
            else if (defaultChargeMethod == "Billing")
            {
                radioBillingCharge.Checked = true;
                textDateLastRun.Text       = PrefC.GetDate(PrefName.BillingChargeLastRun).ToShortDateString();
                textDateUndo.Text          = PrefC.GetDate(PrefName.BillingChargeLastRun).ToShortDateString();
            }
        }
Exemple #16
0
        private bool RunAgingEnterprise(DateTime dateCalc)
        {
            DateTime dateLastAging = PrefC.GetDate(PrefName.DateLastAging);

            if (dateLastAging.Date == dateCalc.Date)
            {
                if (MessageBox.Show(this, Lan.g(this, "Aging has already been calculated for") + " " + dateCalc.ToShortDateString() + " "
                                    + Lan.g(this, "and does not normally need to run more than once per day.\r\n\r\nRun anyway?"), "", MessageBoxButtons.YesNo) != DialogResult.Yes)
                {
                    return(false);
                }
            }
            //Refresh prefs because AgingBeginDateTime is very time sensitive
            Prefs.RefreshCache();
            DateTime dateTAgingBeganPref = PrefC.GetDateT(PrefName.AgingBeginDateTime);

            if (dateTAgingBeganPref > DateTime.MinValue)
            {
                MessageBox.Show(this, Lan.g(this, "You cannot run aging until it has finished the current calculations which began on") + " "
                                + dateTAgingBeganPref.ToString() + ".\r\n" + Lans.g(this, "If you believe the current aging process has finished, a user with SecurityAdmin permission "
                                                                                    + "can manually clear the date and time by going to Setup | Miscellaneous and pressing the 'Clear' button."));
                return(false);
            }
            SecurityLogs.MakeLogEntry(Permissions.AgingRan, 0, "Aging Ran - Aging Form");
            Prefs.UpdateString(PrefName.AgingBeginDateTime, POut.DateT(MiscData.GetNowDateTime(), false)); //get lock on pref to block others
            Signalods.SetInvalid(InvalidType.Prefs);                                                       //signal a cache refresh so other computers will have the updated pref as quickly as possible
            Cursor = Cursors.WaitCursor;
            bool result = true;

            ODProgress.ShowAction(
                () => {
                Ledgers.ComputeAging(0, dateCalc);
                Prefs.UpdateString(PrefName.DateLastAging, POut.Date(dateCalc, false));
            },
                startingMessage: Lan.g(this, "Calculating enterprise aging for all patients as of") + " " + dateCalc.ToShortDateString() + "...",
                actionException: ex => {
                Ledgers.AgingExceptionHandler(ex, this);
                result = false;
            }
                );
            Cursor = Cursors.Default;
            Prefs.UpdateString(PrefName.AgingBeginDateTime, "");           //clear lock on pref whether aging was successful or not
            Signalods.SetInvalid(InvalidType.Prefs);
            return(result);
        }
        private void FormGlobalSecurity_Load(object sender, EventArgs e)
        {
            textLogOffAfterMinutes.Text                = PrefC.GetInt(PrefName.SecurityLogOffAfterMinutes).ToString();
            checkAllowLogoffOverride.Checked           = PrefC.GetBool(PrefName.SecurityLogOffAllowUserOverride);
            checkPasswordsMustBeStrong.Checked         = PrefC.GetBool(PrefName.PasswordsMustBeStrong);
            checkPasswordsStrongIncludeSpecial.Checked = PrefC.GetBool(PrefName.PasswordsStrongIncludeSpecial);
            checkPasswordForceWeakToStrong.Checked     = PrefC.GetBool(PrefName.PasswordsWeakChangeToStrong);
            checkTimecardSecurityEnabled.Checked       = PrefC.GetBool(PrefName.TimecardSecurityEnabled);
            checkCannotEditOwn.Checked       = PrefC.GetBool(PrefName.TimecardUsersDontEditOwnCard);
            checkCannotEditOwn.Enabled       = checkTimecardSecurityEnabled.Checked;
            checkDomainLoginEnabled.Checked  = PrefC.GetBool(PrefName.DomainLoginEnabled);
            textDomainLoginPath.ReadOnly     = !checkDomainLoginEnabled.Checked;
            textDomainLoginPath.Text         = PrefC.GetString(PrefName.DomainLoginPath);
            checkLogOffWindows.Checked       = PrefC.GetBool(PrefName.SecurityLogOffWithWindows);
            checkUserNameManualEntry.Checked = PrefC.GetBool(PrefName.UserNameManualEntry);
            if (PrefC.GetDate(PrefName.BackupReminderLastDateRun).ToShortDateString() == DateTime.MaxValue.AddMonths(-1).ToShortDateString())
            {
                checkDisableBackupReminder.Checked = true;
            }
            if (PrefC.GetInt(PrefName.SecurityLockDays) > 0)
            {
                textDaysLock.Text = PrefC.GetInt(PrefName.SecurityLockDays).ToString();
            }
            if (PrefC.GetDate(PrefName.SecurityLockDate).Year > 1880)
            {
                textDateLock.Text = PrefC.GetDate(PrefName.SecurityLockDate).ToShortDateString();
            }
            if (PrefC.GetBool(PrefName.CentralManagerSecurityLock))
            {
                butChange.Enabled = false;
                labelGlobalDateLockDisabled.Visible = true;
            }
            List <UserGroup> listGroupsNotAdmin = UserGroups.GetList().FindAll(x => !GroupPermissions.HasPermission(x.UserGroupNum, Permissions.SecurityAdmin, 0));

            for (int i = 0; i < listGroupsNotAdmin.Count; i++)
            {
                comboGroups.Items.Add(listGroupsNotAdmin[i].Description, listGroupsNotAdmin[i]);
                if (PrefC.GetLong(PrefName.DefaultUserGroup) == listGroupsNotAdmin[i].UserGroupNum)
                {
                    comboGroups.SelectedIndex = i;
                }
            }
        }
Exemple #18
0
        private void butSync_Click(object sender, EventArgs e)
        {
            if (!SavePrefs())
            {
                return;
            }
            if (IsSynching)
            {
                MsgBox.Show(this, "A Synch is in progress at the moment. Please try again later.");
                return;
            }
            if (PrefC.GetDate(PrefName.MobileExcludeApptsBeforeDate).Year < 1880)
            {
                MsgBox.Show(this, "Full synch has never been run before.");
                return;
            }
            DateTime changedSince = PrefC.GetDateT(PrefName.MobileSyncDateTimeLastRun);

            ShowProgressForm(changedSince);
        }
Exemple #19
0
        private void butGenerate_Click(object sender, EventArgs e)
        {
            if (textOnlinePassword.ReadOnly)
            {
                MessageBox.Show("Please use the Provide Online Access button first.");
                return;
            }
            Cursor = Cursors.WaitCursor;
            textOnlinePassword.Text = GenerateRandomPassword(8, 10);
            PatCur.OnlinePassword   = textOnlinePassword.Text;
            Patients.Update(PatCur, PatOld);
            PatOld.OnlinePassword = textOnlinePassword.Text;          //so that subsequent Updates will work.
            string interval = PrefC.GetStringSilent(PrefName.MobileSyncIntervalMinutes);

            if (interval == "" || interval == "0")         //not a paid customer or chooses not to synch
            {
                Cursor = Cursors.Default;
                MessageBox.Show("Synch must be setup first from the Tools menu, Mobile and Patient Portal Synch.");
                return;
            }
            //we won't check PrefName.MobileSyncWorkstationName because we are forcing the synch
            if (System.Environment.MachineName.ToUpper() != PrefC.GetStringSilent(PrefName.MobileSyncWorkstationName).ToUpper())
            {
                Cursor = Cursors.Default;
                //Since GetStringSilent returns "" before OD is connected to db, this gracefully loops out
                if (!MsgBox.Show(this, MsgBoxButtons.OKCancel,
                                 "Warning.  Workstation is not entered in the Tools menu, Mobile and Patient Portal Synch.  No automatic synch is taking place.  Continue anyway?"))
                {
                    return;
                }
            }
            if (PrefC.GetDate(PrefName.MobileExcludeApptsBeforeDate).Year < 1880)
            {
                Cursor = Cursors.Default;
                MessageBox.Show("Full Synch must be run first first from the Tools menu, Mobile and Patient Portal Synch.");
                return;
            }
            FormMobile.SynchFromMain(true);
            Cursor = Cursors.Default;
        }
Exemple #20
0
 private void FormSecurity_Load(object sender, System.EventArgs e)
 {
     comboUsers.Items.Add(Lan.g(this, "All Users"));
     comboUsers.Items.Add(Lan.g(this, "Providers"));
     comboUsers.Items.Add(Lan.g(this, "Employees"));
     comboUsers.Items.Add(Lan.g(this, "Other"));
     comboUsers.SelectedIndex = 0;
     if (PrefC.GetBool(PrefName.EasyHideDentalSchools))
     {
         comboSchoolClass.Visible = false;
         labelSchoolClass.Visible = false;
     }
     else
     {
         comboSchoolClass.Items.Add(Lan.g(this, "All"));
         comboSchoolClass.SelectedIndex = 0;
         for (int i = 0; i < SchoolClasses.List.Length; i++)
         {
             comboSchoolClass.Items.Add(SchoolClasses.GetDescript(SchoolClasses.List[i]));
         }
     }
     FillTreePermissionsInitial();
     FillUsers();
     FillTreePerm();
     textLogOffAfterMinutes.Text          = PrefC.GetInt(PrefName.SecurityLogOffAfterMinutes).ToString();
     checkPasswordsMustBeStrong.Checked   = PrefC.GetBool(PrefName.PasswordsMustBeStrong);
     checkTimecardSecurityEnabled.Checked = PrefC.GetBool(PrefName.TimecardSecurityEnabled);
     checkCannotEditOwn.Checked           = PrefC.GetBool(PrefName.TimecardUsersDontEditOwnCard);
     checkCannotEditOwn.Enabled           = checkTimecardSecurityEnabled.Checked;
     checkLogOffWindows.Checked           = PrefC.GetBool(PrefName.SecurityLogOffWithWindows);
     if (PrefC.GetInt(PrefName.SecurityLockDays) > 0)
     {
         textDaysLock.Text = PrefC.GetInt(PrefName.SecurityLockDays).ToString();
     }
     if (PrefC.GetDate(PrefName.SecurityLockDate).Year > 1880)
     {
         textDateLock.Text = PrefC.GetDate(PrefName.SecurityLockDate).ToShortDateString();
     }
 }
        private void butChange_Click(object sender, EventArgs e)
        {
            FormSecurityLock FormS = new FormSecurityLock();

            FormS.ShowDialog();            //prefs are set invalid within that form if needed.
            if (PrefC.GetInt(PrefName.SecurityLockDays) > 0)
            {
                textDaysLock.Text = PrefC.GetInt(PrefName.SecurityLockDays).ToString();
            }
            else
            {
                textDaysLock.Text = "";
            }
            if (PrefC.GetDate(PrefName.SecurityLockDate).Year > 1880)
            {
                textDateLock.Text = PrefC.GetDate(PrefName.SecurityLockDate).ToShortDateString();
            }
            else
            {
                textDateLock.Text = "";
            }
        }
Exemple #22
0
        private void FormAging_Load(object sender, System.EventArgs e)
        {
            DateTime lastAgingDate = PrefC.GetDate(PrefName.DateLastAging);

            if (lastAgingDate.Year < 1880)
            {
                textDate.Text = "";
            }
            else if (PrefC.GetBool(PrefName.AgingCalculatedMonthlyInsteadOfDaily))
            {
                textDate.Text = lastAgingDate.ToShortDateString();
            }
            else
            {
                textDate.Text = DateTime.Today.ToShortDateString();
            }
            for (int i = 0; i < DefC.Short[(int)DefCat.BillingTypes].Length; i++)
            {
                listBillType.Items.Add(DefC.Short[(int)DefCat.BillingTypes][i].ItemName);
            }
            if (listBillType.Items.Count > 0)
            {
                listBillType.SelectedIndex = 0;
            }
            listBillType.Visible      = false;
            checkBillTypesAll.Checked = true;
            for (int i = 0; i < ProviderC.ListShort.Count; i++)
            {
                listProv.Items.Add(ProviderC.ListShort[i].GetLongDesc());
            }
            if (listProv.Items.Count > 0)
            {
                listProv.SelectedIndex = 0;
            }
            checkProvAll.Checked = true;
            listProv.Visible     = false;
        }
        private void butChange_Click(object sender, EventArgs e)
        {
            //Copied from FormGlobalSecurity.
            FormSecurityLock FormS = new FormSecurityLock();

            FormS.ShowDialog();            //prefs are set invalid within that form if needed.
            if (PrefC.GetInt(PrefName.SecurityLockDays) > 0)
            {
                textDaysLock.Text = PrefC.GetInt(PrefName.SecurityLockDays).ToString();
            }
            else
            {
                textDaysLock.Text = "";
            }
            if (PrefC.GetDate(PrefName.SecurityLockDate).Year > 1880)
            {
                textDateLock.Text = PrefC.GetDate(PrefName.SecurityLockDate).ToShortDateString();
            }
            else
            {
                textDateLock.Text = "";
            }
            checkLockIncludesAdmin.Checked = PrefC.GetBool(PrefName.SecurityLockIncludesAdmin);
        }
Exemple #24
0
        ///<summary>This is the function that the worker thread uses to actually perform the upload.  Can also call this method in the ordinary way if the data to be transferred is small.  The timeSynchStarted must be passed in to ensure that no records are skipped due to small time differences.</summary>
        private static void UploadWorker(DateTime changedSince, DateTime timeSynchStarted)
        {
            int totalCount = 100;

            try {            //Dennis: try catch may not work: Does not work in threads, not sure about this. Note that all methods inside this try catch block are without exception handling. This is done on purpose so that when an exception does occur it does not update PrefName.MobileSyncDateTimeLastRun
                //The handling of PrefName.MobileSynchNewTables79 should never be removed in future versions
                DateTime changedProv      = changedSince;
                DateTime changedDeleted   = changedSince;
                DateTime changedPat       = changedSince;
                DateTime changedStatement = changedSince;
                DateTime changedDocument  = changedSince;
                DateTime changedRecall    = changedSince;
                if (!PrefC.GetBoolSilent(PrefName.MobileSynchNewTables79Done, false))
                {
                    changedProv    = DateTime.MinValue;
                    changedDeleted = DateTime.MinValue;
                }
                if (!PrefC.GetBoolSilent(PrefName.MobileSynchNewTables112Done, false))
                {
                    changedPat       = DateTime.MinValue;
                    changedStatement = DateTime.MinValue;
                    changedDocument  = DateTime.MinValue;
                }
                if (!PrefC.GetBoolSilent(PrefName.MobileSynchNewTables121Done, false))
                {
                    changedRecall = DateTime.MinValue;
                    UploadPreference(PrefName.PracticeTitle);                     //done again because the previous upload did not include the prefnum
                }
                bool synchDelPat = true;
                if (PrefC.GetDateT(PrefName.MobileSyncDateTimeLastRun).Hour == timeSynchStarted.Hour)
                {
                    synchDelPat = false;                  // synching delPatNumList is timeconsuming (15 seconds) for a dental office with around 5000 patients and it's mostly the same records that have to be deleted every time a synch happens. So it's done only once hourly.
                }
                //MobileWeb
                List <long> patNumList        = Patientms.GetChangedSincePatNums(changedPat);
                List <long> aptNumList        = Appointmentms.GetChangedSinceAptNums(changedSince, PrefC.GetDate(PrefName.MobileExcludeApptsBeforeDate));
                List <long> rxNumList         = RxPatms.GetChangedSinceRxNums(changedSince);
                List <long> provNumList       = Providerms.GetChangedSinceProvNums(changedProv);
                List <long> pharNumList       = Pharmacyms.GetChangedSincePharmacyNums(changedSince);
                List <long> allergyDefNumList = AllergyDefms.GetChangedSinceAllergyDefNums(changedSince);
                List <long> allergyNumList    = Allergyms.GetChangedSinceAllergyNums(changedSince);
                //exclusively Patient Portal
                List <long> eligibleForUploadPatNumList = Patientms.GetPatNumsEligibleForSynch();
                List <long> labPanelNumList             = LabPanelms.GetChangedSinceLabPanelNums(changedSince, eligibleForUploadPatNumList);
                List <long> labResultNumList            = LabResultms.GetChangedSinceLabResultNums(changedSince);
                List <long> medicationNumList           = Medicationms.GetChangedSinceMedicationNums(changedSince);
                List <long> medicationPatNumList        = MedicationPatms.GetChangedSinceMedicationPatNums(changedSince, eligibleForUploadPatNumList);
                List <long> diseaseDefNumList           = DiseaseDefms.GetChangedSinceDiseaseDefNums(changedSince);
                List <long> diseaseNumList   = Diseasems.GetChangedSinceDiseaseNums(changedSince, eligibleForUploadPatNumList);
                List <long> icd9NumList      = ICD9ms.GetChangedSinceICD9Nums(changedSince);
                List <long> statementNumList = Statementms.GetChangedSinceStatementNums(changedStatement, eligibleForUploadPatNumList, statementLimitPerPatient);
                List <long> documentNumList  = Documentms.GetChangedSinceDocumentNums(changedDocument, statementNumList);
                List <long> recallNumList    = Recallms.GetChangedSinceRecallNums(changedRecall);
                List <long> delPatNumList    = Patientms.GetPatNumsForDeletion();
                //List<DeletedObject> dO=DeletedObjects.GetDeletedSince(changedDeleted);dennis: delete this line later
                List <long> deletedObjectNumList = DeletedObjects.GetChangedSinceDeletedObjectNums(changedDeleted);
                totalCount = patNumList.Count + aptNumList.Count + rxNumList.Count + provNumList.Count + pharNumList.Count
                             + labPanelNumList.Count + labResultNumList.Count + medicationNumList.Count + medicationPatNumList.Count
                             + allergyDefNumList.Count + allergyNumList.Count + diseaseDefNumList.Count + diseaseNumList.Count + icd9NumList.Count
                             + statementNumList.Count + documentNumList.Count + recallNumList.Count
                             + deletedObjectNumList.Count;
                if (synchDelPat)
                {
                    totalCount += delPatNumList.Count;
                }
                double currentVal = 0;
                if (Application.OpenForms["FormProgress"] != null)               // without this line the following error is thrown: "Invoke or BeginInvoke cannot be called on a control until the window handle has been created." or a null pointer exception is thrown when an automatic synch is done by the system.
                {
                    FormP.Invoke(new PassProgressDelegate(PassProgressToDialog),
                                 new object[] { currentVal, "?currentVal of ?maxVal records uploaded", totalCount, "" });
                }
                IsSynching = true;
                SynchGeneric(patNumList, SynchEntity.patient, totalCount, ref currentVal);
                SynchGeneric(aptNumList, SynchEntity.appointment, totalCount, ref currentVal);
                SynchGeneric(rxNumList, SynchEntity.prescription, totalCount, ref currentVal);
                SynchGeneric(provNumList, SynchEntity.provider, totalCount, ref currentVal);
                SynchGeneric(pharNumList, SynchEntity.pharmacy, totalCount, ref currentVal);
                //pat portal
                SynchGeneric(labPanelNumList, SynchEntity.labpanel, totalCount, ref currentVal);
                SynchGeneric(labResultNumList, SynchEntity.labresult, totalCount, ref currentVal);
                SynchGeneric(medicationNumList, SynchEntity.medication, totalCount, ref currentVal);
                SynchGeneric(medicationPatNumList, SynchEntity.medicationpat, totalCount, ref currentVal);
                SynchGeneric(allergyDefNumList, SynchEntity.allergydef, totalCount, ref currentVal);
                SynchGeneric(allergyNumList, SynchEntity.allergy, totalCount, ref currentVal);
                SynchGeneric(diseaseDefNumList, SynchEntity.diseasedef, totalCount, ref currentVal);
                SynchGeneric(diseaseNumList, SynchEntity.disease, totalCount, ref currentVal);
                SynchGeneric(icd9NumList, SynchEntity.icd9, totalCount, ref currentVal);
                SynchGeneric(statementNumList, SynchEntity.statement, totalCount, ref currentVal);
                SynchGeneric(documentNumList, SynchEntity.document, totalCount, ref currentVal);
                SynchGeneric(recallNumList, SynchEntity.recall, totalCount, ref currentVal);
                if (synchDelPat)
                {
                    SynchGeneric(delPatNumList, SynchEntity.patientdel, totalCount, ref currentVal);
                }
                //DeleteObjects(dO,totalCount,ref currentVal);// this has to be done at this end because objects may have been created and deleted between synchs. If this function is place above then the such a deleted object will not be deleted from the server.
                SynchGeneric(deletedObjectNumList, SynchEntity.deletedobject, totalCount, ref currentVal);             // this has to be done at this end because objects may have been created and deleted between synchs. If this function is place above then the such a deleted object will not be deleted from the server.
                if (!PrefC.GetBoolSilent(PrefName.MobileSynchNewTables79Done, true))
                {
                    Prefs.UpdateBool(PrefName.MobileSynchNewTables79Done, true);
                }
                if (!PrefC.GetBoolSilent(PrefName.MobileSynchNewTables112Done, true))
                {
                    Prefs.UpdateBool(PrefName.MobileSynchNewTables112Done, true);
                }
                if (!PrefC.GetBoolSilent(PrefName.MobileSynchNewTables121Done, true))
                {
                    Prefs.UpdateBool(PrefName.MobileSynchNewTables121Done, true);
                }
                Prefs.UpdateDateT(PrefName.MobileSyncDateTimeLastRun, timeSynchStarted);
                IsSynching = false;
            }
            catch (Exception e) {
                IsSynching = false;                                // this will ensure that the synch can start again. If this variable remains true due to an exception then a synch will never take place automatically.
                if (Application.OpenForms["FormProgress"] != null) // without this line the following error is thrown: "Invoke or BeginInvoke cannot be called on a control until the window handle has been created." or a null pointer exception is thrown when an automatic synch is done by the system.
                {
                    FormP.Invoke(new PassProgressDelegate(PassProgressToDialog),
                                 new object[] { 0, "?currentVal of ?maxVal records uploaded", totalCount, e.Message });
                }
            }
        }
Exemple #25
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;
            }
            DateTime date = PIn.Date(textDate.Text);

            if (PrefC.GetDate(PrefName.FinanceChargeLastRun).AddDays(25) > date)
            {
                if (!MsgBox.Show(this, true, "Warning.  Finance charges should not be run more than once per month.  Continue?"))
                {
                    return;
                }
            }
            else if (PrefC.GetDate(PrefName.BillingChargeLastRun).AddDays(25) > date)
            {
                if (!MsgBox.Show(this, true, "Warning.  Billing charges should not be run more than once per month.  Continue?"))
                {
                    return;
                }
            }
            if (listBillType.SelectedIndices.Count == 0)
            {
                MsgBox.Show(this, "Please select at least one billing type first.");
                return;
            }
            if (PIn.Long(textAPR.Text) < 2)
            {
                if (!MsgBox.Show(this, true, "The APR is much lower than normal. Do you wish to proceed?"))
                {
                    return;
                }
            }
            if (PrefC.GetBool(PrefName.AgingCalculatedMonthlyInsteadOfDaily) && PrefC.GetDate(PrefName.DateLastAging).AddMonths(1) <= DateTime.Today)
            {
                if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "It has been more than a month since aging has been run.  It is recommended that you update the aging date and run aging before continuing."))
                {
                    return;
                }
                //we might also consider a warning if textDate.Text does not match DateLastAging.  Probably not needed for daily aging, though.
            }
            PatAging[] AgingList = Patients.GetAgingListArray();
            double     OverallBalance;
            int        rowsAffected = 0;
            bool       billingMatch;

            for (int i = 0; i < AgingList.Length; i++) //loop through each guarantor that owes money.
            {
                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;
                }
                else if (radio60.Checked)
                {
                    OverallBalance = AgingList[i].Bal_61_90 + AgingList[i].BalOver90;
                }
                else if (radio90.Checked)
                {
                    OverallBalance = AgingList[i].BalOver90;
                }
                if (OverallBalance <= .01d)
                {
                    continue;
                }
                billingMatch = false;
                for (int b = 0; b < listBillType.SelectedIndices.Count; b++)
                {
                    if (DefC.Short[(int)DefCat.BillingTypes][listBillType.SelectedIndices[b]].DefNum == AgingList[i].BillingType)
                    {
                        billingMatch = true;
                        break;
                    }
                }
                if (!billingMatch)
                {
                    continue;
                }
                if (radioFinanceCharge.Checked)
                {
                    AddFinanceCharge(AgingList[i].PatNum, date, textAPR.Text, OverallBalance, AgingList[i].PriProv);
                }
                else if (radioBillingCharge.Checked)
                {
                    AddBillingCharge(AgingList[i].PatNum, date, textBillingCharge.Text, AgingList[i].PriProv);
                }
                rowsAffected++;
            }
            if (radioFinanceCharge.Checked)
            {
                if (Prefs.UpdateString(PrefName.FinanceChargeAPR, textAPR.Text)
                    | Prefs.UpdateString(PrefName.FinanceChargeLastRun, POut.Date(date, false)))
                {
                    DataValid.SetInvalid(InvalidType.Prefs);
                }
                if (Prefs.UpdateString(PrefName.BillingChargeOrFinanceIsDefault, "Finance"))
                {
                    DataValid.SetInvalid(InvalidType.Prefs);
                }
                MessageBox.Show(Lan.g(this, "Finance Charges Added: ") + rowsAffected.ToString());
                Ledgers.RunAging();
                DialogResult = DialogResult.OK;
            }
            else if (radioBillingCharge.Checked)
            {
                if (Prefs.UpdateString(PrefName.BillingChargeAmount, textBillingCharge.Text)
                    | Prefs.UpdateString(PrefName.BillingChargeLastRun, POut.Date(date, false)))
                {
                    DataValid.SetInvalid(InvalidType.Prefs);
                }
                if (Prefs.UpdateString(PrefName.BillingChargeOrFinanceIsDefault, "Billing"))
                {
                    DataValid.SetInvalid(InvalidType.Prefs);
                }
                MessageBox.Show(Lan.g(this, "Billing Charges Added: ") + rowsAffected.ToString());
                Ledgers.RunAging();
                DialogResult = DialogResult.OK;
            }
        }
Exemple #26
0
 ///<summary>Retrieves data and uses them to create new UnfinalizedInsPay objects.
 ///Heavy lifting done here once upon load.  This also gets called if the user clicks "Refresh Data".</summary>
 private bool LoadData()
 {
     _listUnfinalizedInsPay = RpUnfinalizedInsPay.GetUnfinalizedInsPay(textCarrier.Text, PrefC.GetDate(PrefName.ClaimPaymentNoShowZeroDate));
     return(true);
 }
 /// <summary>Sets UI for preferences that we know for sure will exist.</summary>
 private void FillStandardPrefs()
 {
     #region Account Tab
     checkAgingMonthly.Checked = PrefC.GetBool(PrefName.AgingCalculatedMonthlyInsteadOfDaily);
     foreach (PayClinicSetting prompt in Enum.GetValues(typeof(PayClinicSetting)))
     {
         comboPaymentClinicSetting.Items.Add(Lan.g(this, prompt.GetDescription()));
     }
     comboPaymentClinicSetting.SelectedIndex = PrefC.GetInt(PrefName.PaymentClinicSetting);
     checkPaymentsPromptForPayType.Checked   = PrefC.GetBool(PrefName.PaymentsPromptForPayType);
     for (int i = 0; i < Enum.GetNames(typeof(AutoSplitPreference)).Length; i++)
     {
         comboAutoSplitPref.Items.Add(Lans.g(this, Enum.GetNames(typeof(AutoSplitPreference))[i]));
     }
     comboAutoSplitPref.SelectedIndex    = PrefC.GetInt(PrefName.AutoSplitLogic);
     checkBillShowTransSinceZero.Checked = PrefC.GetBool(PrefName.BillingShowTransSinceBalZero);
     textClaimIdentifier.Text            = PrefC.GetString(PrefName.ClaimIdPrefix);
     checkReceiveReportsService.Checked  = PrefC.GetBool(PrefName.ClaimReportReceivedByService);
     _claimReportReceiveInterval         = PrefC.GetInt(PrefName.ClaimReportReceiveInterval);
     if (_claimReportReceiveInterval == 0)
     {
         radioTime.Checked = true;
         DateTime fullDateTime = PrefC.GetDateT(PrefName.ClaimReportReceiveTime);
         textReportCheckTime.Text = fullDateTime.ToShortTimeString();
     }
     else
     {
         textReportCheckInterval.Text = POut.Int(_claimReportReceiveInterval);
         radioInterval.Checked        = true;
     }
     List <RigorousAccounting> listEnums = Enum.GetValues(typeof(RigorousAccounting)).OfType <RigorousAccounting>().ToList();
     for (int i = 0; i < listEnums.Count; i++)
     {
         comboRigorousAccounting.Items.Add(listEnums[i].GetDescription());
     }
     comboRigorousAccounting.SelectedIndex = PrefC.GetInt(PrefName.RigorousAccounting);
     List <RigorousAdjustments> listAdjEnums = Enum.GetValues(typeof(RigorousAdjustments)).OfType <RigorousAdjustments>().ToList();
     for (int i = 0; i < listAdjEnums.Count; i++)
     {
         comboRigorousAdjustments.Items.Add(listAdjEnums[i].GetDescription());
     }
     comboRigorousAdjustments.SelectedIndex = PrefC.GetInt(PrefName.RigorousAdjustments);
     checkHidePaysplits.Checked             = PrefC.GetBool(PrefName.PaymentWindowDefaultHideSplits);
     foreach (PayPlanVersions version in Enum.GetValues(typeof(PayPlanVersions)))
     {
         comboPayPlansVersion.Items.Add(Lan.g("enumPayPlanVersions", version.GetDescription()));
     }
     comboPayPlansVersion.SelectedIndex = PrefC.GetInt(PrefName.PayPlansVersion) - 1;
     textBillingElectBatchMax.Text      = PrefC.GetInt(PrefName.BillingElectBatchMax).ToString();
     checkBillingShowProgress.Checked   = PrefC.GetBool(PrefName.BillingShowSendProgress);
     #endregion Account Tab
     #region Advanced Tab
     checkPasswordsMustBeStrong.Checked         = PrefC.GetBool(PrefName.PasswordsMustBeStrong);
     checkPasswordsStrongIncludeSpecial.Checked = PrefC.GetBool(PrefName.PasswordsStrongIncludeSpecial);
     checkPasswordForceWeakToStrong.Checked     = PrefC.GetBool(PrefName.PasswordsWeakChangeToStrong);
     checkLockIncludesAdmin.Checked             = PrefC.GetBool(PrefName.SecurityLockIncludesAdmin);
     textLogOffAfterMinutes.Text      = PrefC.GetInt(PrefName.SecurityLogOffAfterMinutes).ToString();
     checkUserNameManualEntry.Checked = PrefC.GetBool(PrefName.UserNameManualEntry);
     textDateLock.Text = PrefC.GetDate(PrefName.SecurityLockDate).ToShortDateString();
     textDaysLock.Text = PrefC.GetInt(PrefName.SecurityLockDays).ToString();
     long signalInactive = PrefC.GetLong(PrefName.SignalInactiveMinutes);
     textInactiveSignal.Text = (signalInactive == 0 ? "" : signalInactive.ToString());
     long sigInterval = PrefC.GetLong(PrefName.ProcessSigsIntervalInSecs);
     textSigInterval.Text = (sigInterval == 0 ? "" : sigInterval.ToString());
     string patSearchMinChars = PrefC.GetString(PrefName.PatientSelectSearchMinChars);
     textPatSelectMinChars.Text = Math.Min(10, Math.Max(1, PIn.Int(patSearchMinChars, false))).ToString();       //enforce minimum 1 maximum 10
     string patSearchPauseMs = PrefC.GetString(PrefName.PatientSelectSearchPauseMs);
     textPatSelectPauseMs.Text = Math.Min(10000, Math.Max(1, PIn.Int(patSearchPauseMs, false))).ToString();      //enforce minimum 1 maximum 10000
     checkPatientSelectFilterRestrictedClinics.Checked = PrefC.GetBool(PrefName.PatientSelectFilterRestrictedClinics);
     YN searchEmptyParams = PIn.Enum <YN>(PrefC.GetInt(PrefName.PatientSelectSearchWithEmptyParams));
     if (searchEmptyParams != YN.Unknown)
     {
         checkPatSearchEmptyParams.CheckState = CheckState.Unchecked;
         checkPatSearchEmptyParams.Checked    = searchEmptyParams == YN.Yes;
     }
     _usePhonenumTable = PrefC.GetEnum <YN>(PrefName.PatientPhoneUsePhonenumberTable);
     if (_usePhonenumTable != YN.Unknown)
     {
         checkUsePhoneNumTable.CheckState = CheckState.Unchecked;
         checkUsePhoneNumTable.Checked    = _usePhonenumTable == YN.Yes;
     }
     #endregion Advanced Tab
     #region Appts Tab
     checkApptsRequireProcs.Checked  = PrefC.GetBool(PrefName.ApptsRequireProc);
     checkUseOpHygProv.Checked       = PrefC.GetBool(PrefName.ApptSecondaryProviderConsiderOpOnly);
     checkEnterpriseApptList.Checked = PrefC.GetBool(PrefName.EnterpriseApptList);
     checkEnableNoneView.Checked     = PrefC.GetBool(PrefName.EnterpriseNoneApptViewDefaultDisabled);
     #endregion Appts Tab
     #region Family Tab
     checkSuperFam.Checked            = PrefC.GetBool(PrefName.ShowFeatureSuperfamilies);
     checkPatClone.Checked            = PrefC.GetBool(PrefName.ShowFeaturePatientClone);
     checkShowFeeSchedGroups.Checked  = PrefC.GetBool(PrefName.ShowFeeSchedGroups);
     checkSuperFamCloneCreate.Checked = PrefC.GetBool(PrefName.CloneCreateSuperFamily);
     //users should only see the snapshot trigger and service runtime if they have it set to something other than ClaimCreate.
     //if a user wants to be able to change claimsnapshot settings, the following MySQL statement should be run:
     //UPDATE preference SET ValueString = 'Service'	 WHERE PrefName = 'ClaimSnapshotTriggerType'
     if (PIn.Enum <ClaimSnapshotTrigger>(PrefC.GetString(PrefName.ClaimSnapshotTriggerType), true) == ClaimSnapshotTrigger.ClaimCreate)
     {
         groupClaimSnapshot.Visible = false;
     }
     foreach (ClaimSnapshotTrigger trigger in Enum.GetValues(typeof(ClaimSnapshotTrigger)))
     {
         comboClaimSnapshotTrigger.Items.Add(trigger.GetDescription());
     }
     comboClaimSnapshotTrigger.SelectedIndex = (int)PIn.Enum <ClaimSnapshotTrigger>(PrefC.GetString(PrefName.ClaimSnapshotTriggerType), true);
     textClaimSnapshotRunTime.Text           = PrefC.GetDateT(PrefName.ClaimSnapshotRunTime).ToShortTimeString();
     #endregion Family Tab
     #region Reports Tab
     checkUseReportServer.Checked = (PrefC.GetString(PrefName.ReportingServerCompName) != "" || PrefC.GetString(PrefName.ReportingServerURI) != "");
     textServerName.Text          = PrefC.GetString(PrefName.ReportingServerCompName);
     comboDatabase.Text           = PrefC.GetString(PrefName.ReportingServerDbName);
     textMysqlUser.Text           = PrefC.GetString(PrefName.ReportingServerMySqlUser);
     string decryptedPass;
     CDT.Class1.Decrypt(PrefC.GetString(PrefName.ReportingServerMySqlPassHash), out decryptedPass);
     textMysqlPass.Text     = decryptedPass;
     textMiddleTierURI.Text = PrefC.GetString(PrefName.ReportingServerURI);
     FillComboDatabases();
     SetReportServerUIEnabled();
     #endregion Reports Tab
 }
Exemple #28
0
        /// <summary>Creates a check for the claim selected. Copied logic from FormClaimEdit.cs</summary>
        private void createCheckToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!Security.IsAuthorized(Permissions.InsPayCreate))             //date not checked here, but it will be checked when saving the check to prevent backdating
            {
                return;
            }
            if (PrefC.GetBool(PrefName.ClaimPaymentBatchOnly))
            {
                //Is there a permission in the manage module that would block this behavior? Are we sending the user into a TRAP?!
                MsgBox.Show(this, "Please use Batch Insurance in Manage Module to Finalize Payments.");
                return;
            }
            RpUnfinalizedInsPay.UnfinalizedInsPay unfinalPay = (RpUnfinalizedInsPay.UnfinalizedInsPay)gridMain.Rows[gridMain.SelectedIndices[0]].Tag;
            if (unfinalPay.ClaimCur == null)
            {
                MsgBox.Show(this, "Unable to find claim for this partial payment.");
                return;
            }
            List <ClaimProc> listClaimProcForClaim = ClaimProcs.RefreshForClaim(unfinalPay.ClaimCur.ClaimNum);

            if (!listClaimProcForClaim.Any(x => x.Status.In(ClaimProcStatus.Received, ClaimProcStatus.Supplemental)))
            {
                MessageBox.Show(Lan.g(this, "There are no valid received payments for this claim."));
                return;
            }
            ClaimPayment claimPayment = new ClaimPayment();

            claimPayment.CheckDate = MiscData.GetNowDateTime().Date;          //Today's date for easier tracking by the office and to avoid backdating before accounting lock dates.
            claimPayment.IsPartial = true;
            claimPayment.ClinicNum = unfinalPay.ClinicCur.ClinicNum;
            Family         famCur      = Patients.GetFamily(unfinalPay.PatientCur.PatNum);
            List <InsSub>  listInsSub  = InsSubs.RefreshForFam(famCur);
            List <InsPlan> listInsPlan = InsPlans.RefreshForSubList(listInsSub);

            claimPayment.CarrierName = Carriers.GetName(InsPlans.GetPlan(unfinalPay.ClaimCur.PlanNum, listInsPlan).CarrierNum);
            ClaimPayments.Insert(claimPayment);
            double amt = ClaimProcs.AttachAllOutstandingToPayment(claimPayment.ClaimPaymentNum, PrefC.GetDate(PrefName.ClaimPaymentNoShowZeroDate));

            claimPayment.CheckAmt = amt;
            ClaimPayments.Update(claimPayment);
            FormClaimEdit.FormFinalizePaymentHelper(claimPayment, unfinalPay.ClaimCur, unfinalPay.PatientCur, famCur);
            LoadData();
            FillGrid();
        }
Exemple #29
0
        private void FormRpInsAging_Load(object sender, System.EventArgs e)
        {
            _listProviders = Providers.GetListReports();
            DateTime lastAgingDate = PrefC.GetDate(PrefName.DateLastAging);

            if (lastAgingDate.Year < 1880)
            {
                textDate.Text = "";
            }
            else if (PrefC.GetBool(PrefName.AgingCalculatedMonthlyInsteadOfDaily))
            {
                textDate.Text = lastAgingDate.ToShortDateString();
            }
            else
            {
                textDate.Text = DateTime.Today.ToShortDateString();
            }
            _listBillingTypeDefs = Defs.GetDefsForCategory(DefCat.BillingTypes, true);
            for (int i = 0; i < _listBillingTypeDefs.Count; i++)
            {
                listBillType.Items.Add(_listBillingTypeDefs[i].ItemName);
            }
            if (listBillType.Items.Count > 0)
            {
                listBillType.SelectedIndex = 0;
            }
            listBillType.Visible      = false;
            checkBillTypesAll.Checked = true;           //all billing types by default
            for (int i = 0; i < _listProviders.Count; i++)
            {
                listProv.Items.Add(_listProviders[i].GetLongDesc());
            }
            if (listProv.Items.Count > 0)
            {
                listProv.SelectedIndex = 0;
            }
            checkProvAll.Checked = true;           //all provs by default
            listProv.Visible     = false;
            if (!PrefC.HasClinicsEnabled)
            {
                listClin.Visible     = false;
                labelClin.Visible    = false;
                checkAllClin.Visible = false;
            }
            else
            {
                _listClinics = new List <Clinic>();
                if (!Security.CurUser.ClinicIsRestricted)
                {
                    listClin.Items.Add(new ODBoxItem <Clinic>(Lan.g(this, "Unassigned"), new Clinic()
                    {
                        ClinicNum = 0, Description = "Unassigned", Abbr = "Unassigned"
                    }));
                }
                _listClinics = Clinics.GetForUserod(Security.CurUser);
                foreach (Clinic clinic in _listClinics)
                {
                    ODBoxItem <Clinic> boxItemCur = new ODBoxItem <Clinic>(clinic.Abbr, clinic);
                    listClin.Items.Add(boxItemCur);
                    if (clinic.ClinicNum == Clinics.ClinicNum)
                    {
                        listClin.SelectedItem = boxItemCur;
                    }
                }
                if (Clinics.ClinicNum == 0)
                {
                    checkAllClin.Checked = true;                  //event handler will select all indices
                    listClin.Visible     = false;
                }
            }
        }
Exemple #30
0
        private void FormAging_Load(object sender, System.EventArgs e)
        {
            _listProviders = Providers.GetListReports();
            DateTime lastAgingDate = PrefC.GetDate(PrefName.DateLastAging);

            if (lastAgingDate.Year < 1880)
            {
                textDate.Text = "";
            }
            else if (PrefC.GetBool(PrefName.AgingCalculatedMonthlyInsteadOfDaily))
            {
                textDate.Text = lastAgingDate.ToShortDateString();
            }
            else
            {
                textDate.Text = DateTime.Today.ToShortDateString();
            }
            _listBillingTypeDefs = Defs.GetDefsForCategory(DefCat.BillingTypes, true);
            for (int i = 0; i < _listBillingTypeDefs.Count; i++)
            {
                listBillType.Items.Add(_listBillingTypeDefs[i].ItemName);
            }
            if (listBillType.Items.Count > 0)
            {
                listBillType.SelectedIndex = 0;
            }
            listBillType.Visible      = false;
            checkBillTypesAll.Checked = true;
            for (int i = 0; i < _listProviders.Count; i++)
            {
                listProv.Items.Add(_listProviders[i].GetLongDesc());
            }
            if (listProv.Items.Count > 0)
            {
                listProv.SelectedIndex = 0;
            }
            checkProvAll.Checked = true;
            listProv.Visible     = false;
            if (!PrefC.HasClinicsEnabled)
            {
                listClin.Visible     = false;
                labelClin.Visible    = false;
                checkAllClin.Visible = false;
            }
            else
            {
                List <Clinic> listClinics = Clinics.GetForUserod(Security.CurUser, true, "Unassigned").ToList();
                if (!listClinics.Exists(x => x.ClinicNum == Clinics.ClinicNum))               //Could have a hidden clinic selected
                {
                    listClinics.Add(Clinics.GetClinic(Clinics.ClinicNum));
                }
                foreach (Clinic clin in listClinics)
                {
                    ODBoxItem <Clinic> boxItemCur;
                    if (clin.IsHidden)
                    {
                        boxItemCur = new ODBoxItem <Clinic>(clin.Abbr + " " + Lan.g(this, "(hidden)"), clin);
                    }
                    else
                    {
                        boxItemCur = new ODBoxItem <Clinic>(clin.Abbr, clin);
                    }
                    listClin.Items.Add(boxItemCur);
                    if (clin.ClinicNum == Clinics.ClinicNum)
                    {
                        listClin.SelectedItem = boxItemCur;
                    }
                }
                if (Clinics.ClinicNum == 0)
                {
                    checkAllClin.Checked = true;
                    listClin.Visible     = false;
                }
            }
            checkAgeNegAdjs.Checked = PrefC.GetBool(PrefName.AgingNegativeAdjsByAdjDate);
            if (PrefC.GetBool(PrefName.AgingReportShowAgePatPayplanPayments))
            {
                //Visibility set to false in designer, only set to visible here.  No UI for pref, only set true via query for specific customer.
                checkAgePatPayPlanPayments.Visible = true;
            }
            if (PrefC.GetBool(PrefName.FutureTransDatesAllowed) || PrefC.GetBool(PrefName.AccountAllowFutureDebits) ||
                PrefC.GetBool(PrefName.AllowFutureInsPayments))
            {
                labelFutureTrans.Visible = true;              //Set to false in designer
            }
        }