Beispiel #1
0
        private void butOK_Click(object sender, EventArgs e)
        {
            if (!CheckBeginDateTime())
            {
                return;
            }
            //If the AvaTax API is not available at HQ show popup and return.
            if (AvaTax.IsEnabled() && !AvaTax.PingAvaTax())
            {
                MsgBox.Show(this, "Unable to connect to AvaTax API.");
                return;
            }
            Cursor = Cursors.WaitCursor;
            RepeatChargeResult result  = RepeatCharges.RunRepeatingCharges(MiscData.GetNowDateTime(), checkRunAging.Checked);
            string             metrics = result.ProceduresAddedCount + " " + Lan.g(this, "procedures added.") + "\r\n" + result.ClaimsAddedCount + " "
                                         + Lan.g(this, "claims added.");

            SecurityLogs.MakeLogEntry(Permissions.RepeatChargeTool, 0, "Repeat Charge Tool ran.\r\n" + metrics);
            Cursor = Cursors.Default;
            MessageBox.Show(metrics);
            if (!string.IsNullOrEmpty(result.ErrorMsg))
            {
                SecurityLogs.MakeLogEntry(Permissions.RepeatChargeTool, 0, "Repeat Charge Tool Error: " + result.ErrorMsg);
                MessageBox.Show(result.ErrorMsg);
            }
            DialogResult = DialogResult.OK;
        }
Beispiel #2
0
        ///<summary>Checks if Repeating Charges are already running on another workstation or by the OpenDental Service.  If less than 24 hours have
        ///passed since the tool was started, user will be blocked from running Repeating Charges.  Otherwise, SecurityAdmin users can restart the tool.
        ///</summary>
        private bool CheckBeginDateTime()
        {
            Prefs.RefreshCache();            //Just to be sure we don't miss someone who has just started running repeating charges.
            if (PrefC.GetString(PrefName.RepeatingChargesBeginDateTime) == "")
            {
                return(true);
            }
            DateTime repeatingChargesBeginDateTime = PrefC.GetDateT(PrefName.RepeatingChargesBeginDateTime);

            if ((MiscData.GetNowDateTime() - repeatingChargesBeginDateTime).TotalHours < 24)
            {
                MsgBox.Show(this, "Repeating charges already running on another workstation, you must wait for them to finish before continuing.");
                return(false);
            }
            //It's been more than 24 hours since repeat charges started.
            if (Security.IsAuthorized(Permissions.SecurityAdmin, true))
            {
                string message = Lans.g(this, "Repeating Charges last started on") + " " + repeatingChargesBeginDateTime.ToString()
                                 + Lans.g(this, ".  Restart repeating charges?");
                if (MsgBox.Show(MsgBoxButtons.OKCancel, message))
                {
                    SecurityLogs.MakeLogEntry(Permissions.SecurityAdmin, 0, "Restarted repeating charges. Previous Repeating Charges Begin DateTime was "
                                              + repeatingChargesBeginDateTime.ToString() + ".");
                    return(true);
                }
                return(false);               //Security admin doesn't want to restart repeat charges.
            }
            //User isn't a security admin.
            MsgBox.Show(Lans.g(this, "Repeating Charges last started on") + " " + repeatingChargesBeginDateTime.ToString()
                        + Lans.g(this, ".  Contact a user with SecurityAdmin permission to restart repeating charges."));
            return(false);
        }
Beispiel #3
0
 private void FormPhoneTiles_Load(object sender, EventArgs e)
 {
                 #if !DEBUG
     if (Environment.MachineName.ToLower() != "jordans")
     {
         checkBoxAll.Visible = false;                      //so this will also be visible in debug
     }
                 #endif
     timeDelta = MiscData.GetNowDateTime() - DateTime.Now;
     PhoneTile tile;
     int       x = 0;
     int       y = 0;
     for (int i = 0; i < 26; i++)
     {
         tile                  = new PhoneTile();
         tile.Name             = "phoneTile" + (i + 1).ToString();
         tile.LayoutHorizontal = true;
         tile.Location         = new Point(tile.Width * x, 26 + (tile.Height * y));
         //((PhoneTile)Controls.Find("phoneTile"+(i+1).ToString(),false)[0]);
         tile.GoToChanged         += new System.EventHandler(this.phoneTile_GoToChanged);
         tile.SelectedTileChanged += new System.EventHandler(this.phoneTile_SelectedTileChanged);
         tile.ScreenshotClick     += new EventHandler(this.phoneTile_ScreenshotClick);
         tile.MenuNumbers          = menuNumbers;
         tile.MenuStatus           = menuStatus;
         this.Controls.Add(tile);
         y++;
         if (y == 13)
         {
             y = 0;
             x++;
         }
     }
     FillTiles(true);            //initial fast load and anytime data changes.  After this, pumped in from main form.
 }
Beispiel #4
0
        ///<summary>Used when printing recall cards to make a commlog entry for everyone at once.</summary>
        public static void InsertForRecallPostcard(int patNum)
        {
            int    recallType = Commlogs.GetTypeAuto(CommItemTypeAuto.RECALL);
            string command;

            if (recallType != 0)
            {
                command = "SELECT COUNT(*) FROM  commlog WHERE ";
                if (FormChooseDatabase.DBtype == DatabaseType.Oracle)
                {
                    command += "TO_DATE(CommDateTime) = " + POut.PDate(MiscData.GetNowDateTime());
                }
                else                  //Assume MySQL
                {
                    command += "DATE(CommDateTime) = CURDATE()";
                }
                command += " AND PatNum=" + POut.PInt(patNum) + " AND CommType=" + POut.PInt(recallType)
                           + " AND Mode_=2 AND SentOrReceived=1";
                if (General.GetCount(command) != "0")
                {
                    return;
                }
            }
            Commlog com = new Commlog();

            com.PatNum         = patNum;
            com.CommDateTime   = DateTime.Now;
            com.CommType       = recallType;
            com.Mode_          = CommItemMode.Mail;
            com.SentOrReceived = CommSentOrReceived.Sent;
            com.Note           = Lan.g("FormRecallList", "Sent recall postcard");
            Insert(com);
        }
        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);
        }
Beispiel #6
0
        private void ShowProgressForm(DateTime changedSince)
        {
            if (checkTroubleshooting.Checked)
            {
                IsTroubleshootMode = true;
            }
            else
            {
                IsTroubleshootMode = false;
            }
            DateTime timeSynchStarted = MiscData.GetNowDateTime();

            FormP        = new FormProgress();
            FormP.MaxVal = 100;          //to keep the form from closing until the real MaxVal is set.
            FormP.NumberMultiplication = 1;
            FormP.DisplayText          = "Preparing records for upload.";
            FormP.NumberFormat         = "F0";
            //start the thread that will perform the upload
            ThreadStart uploadDelegate = delegate { UploadWorker(changedSince, timeSynchStarted); };
            Thread      workerThread   = new Thread(uploadDelegate);

            workerThread.Start();
            //display the progress dialog to the user:
            FormP.ShowDialog();
            if (FormP.DialogResult == DialogResult.Cancel)
            {
                workerThread.Abort();
            }
            changed = true;
            textDateTimeLastRun.Text = PrefC.GetDateT(PrefName.MobileSyncDateTimeLastRun).ToShortDateString() + " " + PrefC.GetDateT(PrefName.MobileSyncDateTimeLastRun).ToShortTimeString();
        }
Beispiel #7
0
 public FormMapHQ()
 {
     InitializeComponent();
     //Do not do anything to do with database or control init here. We will be using this ctor later in order to create a temporary object so we can figure out what size the form should be when the user comes back from full screen mode. Wait until FormMapHQ_Load to do anything meaningful.
     _isFullScreen = false;
     _timeDelta    = MiscData.GetNowDateTime() - DateTime.Now;
 }
Beispiel #8
0
        private static DateTime GetDateLimit(Permissions permType, int userGroupNum)
        {
            DateTime nowDate = MiscData.GetNowDateTime().Date;
            DateTime retVal  = DateTime.MinValue;

            for (int i = 0; i < GroupPermissions.List.Length; i++)
            {
                if (GroupPermissions.List[i].UserGroupNum != userGroupNum || GroupPermissions.List[i].PermType != permType)
                {
                    continue;
                }
                //this should only happen once.  One match.
                if (GroupPermissions.List[i].NewerDate.Year > 1880)
                {
                    retVal = GroupPermissions.List[i].NewerDate;
                }
                if (GroupPermissions.List[i].NewerDays == 0)              //do not restrict by days
                //do not change retVal
                {
                }
                else if (nowDate.AddDays(-GroupPermissions.List[i].NewerDays) > retVal)
                {
                    retVal = nowDate.AddDays(-GroupPermissions.List[i].NewerDays);
                }
            }
            return(retVal);
        }
        public FormAnestheticMedsIntake()
        {
            InitializeComponent();
            //Binds date to the textDate textbox.
            textDate.Text = MiscData.GetNowDateTime().ToString("yyyy-MM-dd");
            //Binds the combobox comboBoxAnesthMed with Medication names from the database.
            this.comboAnesthMedName.Items.Clear();
            this.comboAnesthMedName.Items.Insert(0, "");
            int noOfRows = AnestheticQueries.bindAMedName().Tables[0].Rows.Count;

            for (int i = 0; i <= noOfRows - 1; i++)
            {
                this.comboAnesthMedName.Items.Add(AnestheticQueries.bindAMedName().Tables[0].Rows[i][0].ToString());
                this.comboAnesthMedName.SelectedIndex = 0;
            }
            //Binds the combobox comboBoxSupplier with Medication names from the database.
            this.comboSupplierName.Items.Clear();
            this.comboSupplierName.Items.Insert(0, "");
            int noOfRows2 = AnestheticQueries.bindSuppliers().Tables[0].Rows.Count;

            for (int i = 0; i <= noOfRows2 - 1; i++)
            {
                this.comboSupplierName.Items.Add(AnestheticQueries.bindSuppliers().Tables[0].Rows[i][0].ToString());
                this.comboSupplierName.SelectedIndex = 0;
            }
            Lan.F(this);
        }
Beispiel #10
0
        private MigraDoc.DocumentObjectModel.Document CreatePrintDocument(PrintDocument pd)
        {
            string text;

            MigraDoc.DocumentObjectModel.Document doc = new MigraDoc.DocumentObjectModel.Document();
            doc.DefaultPageSetup.PageWidth    = Unit.FromInch((double)pd.DefaultPageSettings.PaperSize.Width / 100);
            doc.DefaultPageSetup.PageHeight   = Unit.FromInch((double)pd.DefaultPageSettings.PaperSize.Height / 100);
            doc.DefaultPageSetup.TopMargin    = Unit.FromInch((double)pd.DefaultPageSettings.Margins.Top / 100);
            doc.DefaultPageSetup.LeftMargin   = Unit.FromInch((double)pd.DefaultPageSettings.Margins.Left / 100);
            doc.DefaultPageSetup.RightMargin  = Unit.FromInch((double)pd.DefaultPageSettings.Margins.Right / 100);
            doc.DefaultPageSetup.BottomMargin = Unit.FromInch((double)pd.DefaultPageSettings.Margins.Bottom / 100);
            MigraDoc.DocumentObjectModel.Section section = doc.AddSection();
            section.PageSetup.StartingNumber = 1;
            MigraDoc.DocumentObjectModel.Font headingFont = MigraDocHelper.CreateFont(13, true);
            MigraDoc.DocumentObjectModel.Font bodyFontx   = MigraDocHelper.CreateFont(9, false);
            MigraDoc.DocumentObjectModel.Font nameFontx   = MigraDocHelper.CreateFont(9, true);
            MigraDoc.DocumentObjectModel.Font totalFontx  = MigraDocHelper.CreateFont(9, true);
            Paragraph pageNumParag = new Paragraph();

            pageNumParag.AddText(Lan.g(this, "Page") + " ");
            pageNumParag.AddPageField();
            pageNumParag.AddText(" " + Lan.g(this, "of") + " ");
            pageNumParag.AddNumPagesField();
            section.Footers.Primary.Add(pageNumParag);
            Paragraph       par       = section.AddParagraph();
            ParagraphFormat parformat = new ParagraphFormat();

            parformat.Alignment = ParagraphAlignment.Center;
            parformat.Font      = MigraDocHelper.CreateFont(14, true);
            par.Format          = parformat;
            //Render the reconcile grid.
            par = section.AddParagraph();
            par.Format.Alignment = ParagraphAlignment.Center;
            par.AddFormattedText(Lan.g(this, "RECONCILE"), totalFontx);
            par.AddLineBreak();
            text = Accounts.GetAccount(ReconcileCur.AccountNum).Description.ToUpper();
            par.AddFormattedText(text, totalFontx);
            par.AddLineBreak();
            text = PrefC.GetString(PrefName.PracticeTitle);
            par.AddText(text);
            par.AddLineBreak();
            text = PrefC.GetString(PrefName.PracticePhone);
            if (text.Length == 10 && Application.CurrentCulture.Name == "en-US")
            {
                text = "(" + text.Substring(0, 3) + ")" + text.Substring(3, 3) + "-" + text.Substring(6);
            }
            par.AddText(text);
            par.AddLineBreak();
            par.AddText(MiscData.GetNowDateTime().ToShortDateString());
            par.AddLineBreak();
            par.AddText(Lan.g(this, "Reconcile Date") + ": " + PIn.Date(textDate.Text).ToShortDateString());
            par.AddLineBreak();
            par.AddText(labelStart.Text + ": " + PIn.Double(textStart.Text).ToString("n"));
            par.AddLineBreak();
            par.AddText(labelEnd.Text + ": " + PIn.Double(textEnd.Text).ToString("n"));
            MigraDocHelper.InsertSpacer(section, 10);
            MigraDocHelper.DrawGrid(section, gridMain);
            return(doc);
        }
Beispiel #11
0
 private void UserControlPhonePanel_Load(object sender, EventArgs e)
 {
     timer1.Enabled    = true;
     timerMsgs.Enabled = true;
     SetLabelMsg();
     timeDelta = MiscData.GetNowDateTime() - DateTime.Now;
     FillEmps();
 }
Beispiel #12
0
        private void FormPhoneTiles_Load(object sender, EventArgs e)
        {
#if !DEBUG
            if (Environment.MachineName.ToLower() != "jordans" &&
                Environment.MachineName.ToLower() != "nathan")
            {
                checkBoxAll.Visible = false;                      //so this will also be visible in debug
            }
#endif
            timeDelta = MiscData.GetNowDateTime() - DateTime.Now;
            PhoneTile tile;
            int       x = 0;
            int       y = 0;
            SetPhoneList(PhoneEmpDefaults.Refresh(), Phones.GetPhoneList(), ChatUsers.GetAll(), false);         //Do not call FillTiles() yet. Need to create PhoneTile controls first.
            for (int i = 1; i < TileCount + 1; i++)
            {
                tile                      = new PhoneTile();
                tile.Name                 = "phoneTile" + (i).ToString();
                tile.Location             = new Point(tile.Width * x, butOverride.Bottom + 15 + (tile.Height * y));
                tile.GoToChanged         += new System.EventHandler(this.phoneTile_GoToChanged);
                tile.SelectedTileChanged += new System.EventHandler(this.phoneTile_SelectedTileChanged);
                tile.MenuNumbers          = menuNumbers;
                tile.MenuStatus           = menuStatus;
                //adding this in case we ever want to show the NeedsHelp button in the big phones. Currently, it is hidden.
                tile.NeedsHelpClicked += new System.EventHandler(this.tiletoggleHelp_Click);
                this.Controls.Add(tile);
                y++;
                if (i % (TilesPerColumn) == 0)             //If number is divisble by the number of tiles per column, move over to a new column.  TilesPerColumn subtracts one because i is zero based.
                {
                    y = 0;
                    x++;
                }
            }
            FillTiles(false);            //initial fast load and anytime data changes.  After this, pumped in from main form.
            Control[] topLeftMatch = Controls.Find("phoneTile1", false);
            if (PhoneList.Count >= 1 &&
                topLeftMatch != null &&
                topLeftMatch.Length >= 1)
            {
                //Size the window to fit contents
                tile = ((PhoneTile)topLeftMatch[0]);
                int columns    = (int)Math.Ceiling((double)PhoneList.Count / TilesPerColumn);
                int autoWidth  = columns * tile.Width;
                int autoHeight = tile.Top + (tile.Height * TilesPerColumn);
                if (autoWidth > 1650)                 //Window was going off side of screen.  1650 chosen to accommodate side mounted windows taskbar.
                //Resize window to fit, add height for showing horizontal scrollbar.
                //Doesn't use #*column width here because the column width is changing soon, and want to show partial columns so user knows to scroll.
                {
                    autoWidth  = 1650;
                    autoHeight = autoHeight + 20;
                }
                this.ClientSize = new Size(autoWidth, autoHeight);
            }
            radioByExt.CheckedChanged  += radioSort_CheckedChanged;
            radioByName.CheckedChanged += radioSort_CheckedChanged;
        }
        ///<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);
        }
Beispiel #14
0
 private void FormTimeCardBenefitRp_Load(object sender, EventArgs e)
 {
     _dtNow     = MiscData.GetNowDateTime();
     this.Text += " - " + _dtNow.ToLongDateString();
     _monthT0   = new DateTime(_dtNow.Year, _dtNow.Month, 1);        //.AddMonths(-0);
     _monthT1   = _monthT0.AddMonths(-1);
     _monthT2   = _monthT0.AddMonths(-2);
     lightRed   = Color.FromArgb(254, 235, 233);      //light red
     FillGridMain();
 }
 private void FormRecurringCharges_Load(object sender, EventArgs e)
 {
     nowDateTime       = MiscData.GetNowDateTime();
     prog              = Programs.GetCur(ProgramName.Xcharge);
     labelCharged.Text = Lan.g(this, "Charged=") + "0";
     labelFailed.Text  = Lan.g(this, "Failed=") + "0";
     FillGrid();
     gridMain.SetSelected(true);
     labelSelected.Text = Lan.g(this, "Selected=") + gridMain.SelectedIndices.Length.ToString();
 }
Beispiel #16
0
 private void butNow2_Click(object sender, EventArgs e)
 {
     textTimeDisplayed2.Text = DateTime.Now.ToString();
     if (textTimeEntered2.Text == "")           //only set the time entered if it's blank
     {
         textTimeEntered2.Text      = MiscData.GetNowDateTime().ToString();
         ClockEventCur.TimeEntered2 = MiscData.GetNowDateTime();
     }
     FillTimeSpans();            //not really needed because of the TextChanged event, but might prevent a bug.
 }
Beispiel #17
0
        private void butRun_Click(object sender, EventArgs e)
        {
            List <ClaimPaySplit> splits = Claims.GetInsPayNotAttachedForFixTool();

            if (splits.Count == 0)
            {
                MsgBox.Show(this, "There are currently no insurance payments that are not attached to an insurance check.");
                DialogResult = DialogResult.OK;              //Close the window because there is nothing else to do
                return;
            }
            Cursor = Cursors.WaitCursor;
            string   invalidClaimDate = "";
            DateTime curDate          = MiscData.GetNowDateTime().Date;

            for (int i = 0; i < splits.Count; i++)
            {
                Claim claim = Claims.GetClaim(splits[i].ClaimNum);
                if (claim == null)
                {
                    continue;
                }
                if (claim.DateReceived.Date > curDate && !PrefC.GetBool(PrefName.AllowFutureInsPayments) && !PrefC.GetBool(PrefName.FutureTransDatesAllowed))
                {
                    invalidClaimDate += "\r\n" + Lan.g(this, "PatNum") + " " + claim.PatNum + ", " + claim.DateService.ToShortDateString();
                    continue;
                }
                ClaimPayment cp = new ClaimPayment();
                cp.CheckDate   = claim.DateReceived;
                cp.CheckAmt    = splits[i].InsPayAmt;
                cp.ClinicNum   = claim.ClinicNum;
                cp.CarrierName = splits[i].Carrier;
                cp.PayType     = Defs.GetFirstForCategory(DefCat.InsurancePaymentType, true).DefNum;
                ClaimPayments.Insert(cp);
                List <ClaimProc> claimP = ClaimProcs.RefreshForClaim(splits[i].ClaimNum);
                for (int j = 0; j < claimP.Count; j++)
                {
                    if (claimP[j].ClaimPaymentNum != 0 || claimP[j].InsPayAmt == 0) //If claimpayment already attached to claimproc or ins didn't pay.
                    {
                        continue;                                                   //Do not change
                    }
                    claimP[j].DateCP          = claim.DateReceived;
                    claimP[j].ClaimPaymentNum = cp.ClaimPaymentNum;
                    ClaimProcs.Update(claimP[j]);
                }
            }
            Cursor = Cursors.Default;
            if (invalidClaimDate != "")
            {
                invalidClaimDate = "\r\n" + Lan.g(this, "Cannot make future-dated insurance payments for these claims:") + invalidClaimDate;
            }
            MsgBoxCopyPaste messageBox = new MsgBoxCopyPaste(Lan.g(this, "Insurance checks created:") + " " + splits.Count + invalidClaimDate);

            messageBox.Show();
            DialogResult = DialogResult.OK;          //Close the window because there is nothing else to do
        }
Beispiel #18
0
 public FormMapHQ()
 {
     InitializeComponent();
     //Do not do anything to do with database or control init here. We will be using this ctor later in order to create a temporary object so we can figure out what size the form should be when the user comes back from full screen mode. Wait until FormMapHQ_Load to do anything meaningful.
     _isFullScreen = false;
     _timeDelta    = MiscData.GetNowDateTime() - DateTime.Now;
     //Add the mousewheel event to allow mousewheel scrolling to repaint the grid as well.
     mapAreaPanelHQ.MouseWheel         += new MouseEventHandler(mapAreaPanelHQ_Scroll);
     mapAreaPanelHQ.RoomControlClicked += MapAreaPanelHQ_RoomControlClicked;
     mapAreaPanelHQ.GoToChanged        += new System.EventHandler(this.MapAreaRoomControl_GoToChanged);
 }
Beispiel #19
0
        ///<summary>Called from FormOpenDental and from FormEhrOnlineAccess.  doForce is set to false to follow regular synching interval.</summary>
        public static void SynchFromMain(bool doForce)
        {
            if (Application.OpenForms["FormMobile"] != null)           //tested.  This prevents main synch whenever this form is open.
            {
                return;
            }
            if (IsSynching)
            {
                return;
            }
            DateTime timeSynchStarted = MiscData.GetNowDateTime();

            if (!doForce)             //if doForce, we skip checking the interval
            {
                if (timeSynchStarted < PrefC.GetDateT(PrefName.MobileSyncDateTimeLastRun).AddMinutes(PrefC.GetInt(PrefName.MobileSyncIntervalMinutes)))
                {
                    return;
                }
            }
            //if(PrefC.GetString(PrefName.MobileSyncServerURL).Contains("192.168.0.196") || PrefC.GetString(PrefName.MobileSyncServerURL).Contains("localhost")) {
            if (PrefC.GetString(PrefName.MobileSyncServerURL).Contains("10.10.1.196") || PrefC.GetString(PrefName.MobileSyncServerURL).Contains("localhost"))
            {
                IgnoreCertificateErrors();
            }
            if (!TestWebServiceExists())
            {
                if (!doForce)                 //if being used from FormOpenDental as part of timer
                {
                    if (IsServerAvail)        //this will only happen the first time to prevent multiple windows.
                    {
                        IsServerAvail = false;
                        DialogResult res = MessageBox.Show("Mobile synch server not available.  Synch failed.  Turn off synch?", "", MessageBoxButtons.YesNo);
                        if (res == DialogResult.Yes)
                        {
                            Prefs.UpdateInt(PrefName.MobileSyncIntervalMinutes, 0);
                        }
                    }
                }
                return;
            }
            else
            {
                IsServerAvail = true;
            }
            DateTime changedSince = PrefC.GetDateT(PrefName.MobileSyncDateTimeLastRun);
            //FormProgress FormP=new FormProgress();//but we won't display it.
            //FormP.NumberFormat="";
            //FormP.DisplayText="";
            //start the thread that will perform the upload
            ThreadStart uploadDelegate = delegate { UploadWorker(changedSince, timeSynchStarted); };
            Thread      workerThread   = new Thread(uploadDelegate);

            workerThread.Start();
        }
 private void UserControlPhonePanel_Load(object sender, EventArgs e)
 {
     if (!PrefC.GetBool(PrefName.ClockEventAllowBreak))             //Breaks turned off, Lunch is now "Break", but maintains Lunch functionality.
     {
         menuStatus.Items.RemoveByKey(menuItemBreak.Name);
     }
     timer1.Enabled    = true;
     timerMsgs.Enabled = true;
     SetLabelMsg();
     timeDelta = MiscData.GetNowDateTime() - DateTime.Now;
     FillEmps();
 }
Beispiel #21
0
        private void listTurnaround_Click(object sender, EventArgs e)
        {
            if (listTurnaround.SelectedIndex == -1)
            {
                return;
            }
            DateTime duedate = LabTurnarounds.ComputeDueDate
                                   (MiscData.GetNowDateTime().Date, turnaroundList[listTurnaround.SelectedIndex].DaysActual);

            textDateDue.Text             = duedate.ToShortDateString() + " " + duedate.ToShortTimeString();
            listTurnaround.SelectedIndex = -1;
        }
Beispiel #22
0
        ///<summary>When user clicks on a colored light, they intend to ack it to turn it off.  This acks all signals with the specified index.  This is in case multiple signals have been created from different workstations.  This acks them all in one shot.  Must specify a time because you only want to ack signals earlier than the last time this workstation was refreshed.  A newer signal would not get acked.
        ///If this seems slow, then I will need to check to make sure all these tables are properly indexed.</summary>
        public static void AckButton(int buttonIndex, DateTime time)
        {
            //FIXME:UPDATE-MULTIPLE-TABLES

            /*string command= "UPDATE signal,sigelement,sigelementdef "
             +"SET signal.AckTime = ";
             *      if(FormChooseDatabase.DBtype==DatabaseType.Oracle) {
             *              command+="(SELECT CURRENT_TIMESTAMP FROM DUAL)";
             *      }else{//Assume MySQL
             *              command+="NOW()";
             *      }
             *      command+=" "
             +"WHERE signal.AckTime < '1880-01-01' "
             +"AND SigDateTime <= '"+POut.PDateT(time)+"' "
             +"AND signal.SignalNum=sigelement.SignalNum "
             +"AND sigelement.SigElementDefNum=sigelementdef.SigElementDefNum "
             +"AND sigelementdef.LightRow="+POut.PInt(buttonIndex);
             * General.NonQ(command);*/

            //Rewritten so that the SQL is compatible with both Oracle and MySQL.

            string command = "SELECT signal.SignalNum FROM signal,sigelement,sigelementdef "
                             + "WHERE signal.AckTime < '1880-01-01' "
                             + "AND SigDateTime <= " + POut.PDateT(time) + " "
                             + "AND signal.SignalNum=sigelement.SignalNum "
                             + "AND sigelement.SigElementDefNum=sigelementdef.SigElementDefNum "
                             + "AND sigelementdef.LightRow=" + POut.PInt(buttonIndex);
            DataTable table = General.GetTable(command);

            if (table.Rows.Count == 0)
            {
                return;
            }
            command = "UPDATE signal SET AckTime = ";
            if (FormChooseDatabase.DBtype == DatabaseType.Oracle)
            {
                command += POut.PDateT(MiscData.GetNowDateTime());
            }
            else               //Assume MySQL
            {
                command += "NOW()";
            }
            command += " WHERE ";
            for (int i = 0; i < table.Rows.Count; i++)
            {
                command += "SignalNum=" + table.Rows[i][0].ToString();
                if (i < table.Rows.Count - 1)
                {
                    command += " OR ";
                }
            }
            General.NonQ(command);
        }
Beispiel #23
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);
        }
        /// <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.ListGridRows[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(ClaimProcs.GetInsPaidStatuses())))
            {
                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.DateClaimReceivedAfter);

            claimPayment.CheckAmt = amt;
            try {
                ClaimPayments.Update(claimPayment);
            }
            catch (ApplicationException ex) {
                MessageBox.Show(ex.Message);
                return;
            }
            FormClaimEdit.FormFinalizePaymentHelper(claimPayment, unfinalPay.ClaimCur, unfinalPay.PatientCur, famCur);
            LoadData();
            FillGrid();
        }
Beispiel #25
0
        private void butOK_Click(object sender, EventArgs e)
        {
            Prefs.RefreshCache();            //Just to be sure we don't miss someone who has just started running repeating charges.
            if (PrefC.GetString(PrefName.RepeatingChargesBeginDateTime) != "")
            {
                MsgBox.Show(this, "Repeating charges already running on another workstation, you must wait for them to finish before continuing.");
                return;
            }
            RepeatChargeResult result = RepeatCharges.RunRepeatingCharges(MiscData.GetNowDateTime());

            SecurityLogs.MakeLogEntry(Permissions.RepeatChargeTool, 0, "Repeat Charge Tool ran.");
            MessageBox.Show(result.ProceduresAddedCount + " " + Lan.g(this, "procedures added.") + "\r\n" + result.ClaimsAddedCount + " "
                            + Lan.g(this, "claims added."));
            DialogResult = DialogResult.OK;
        }
Beispiel #26
0
        ///<summary></summary>
        public static void Insert(Signal sig)
        {
            //we need to explicitly get the server time in advance rather than using NOW(),
            //because we need to update the signal object soon after creation.
            //DateTime now=ClockEvents.GetServerTime();
            if (PrefB.RandomKeys)
            {
                sig.SignalNum = MiscData.GetKey("signal", "SignalNum");
            }
            string command = "INSERT INTO signal (";

            if (PrefB.RandomKeys)
            {
                command += "SignalNum,";
            }
            command += "FromUser,ITypes,DateViewing,SigType,SigText,SigDateTime,ToUser,AckTime"
                       + ") VALUES(";
            if (PrefB.RandomKeys)
            {
                command += "'" + POut.PInt(sig.SignalNum) + "', ";
            }
            command +=
                "'" + POut.PString(sig.FromUser) + "', "
                + "'" + POut.PInt((int)sig.ITypes) + "', "
                + POut.PDate(sig.DateViewing) + ", "
                + "'" + POut.PInt((int)sig.SigType) + "', "
                + "'" + POut.PString(sig.SigText) + "', ";
            //+"'"+POut.PDateT (now)+"', "
            if (FormChooseDatabase.DBtype == DatabaseType.Oracle)
            {
                command += POut.PDateT(MiscData.GetNowDateTime());
            }
            else              //Assume MySQL
            {
                command += "NOW()";
            }
            command += ", "
                       + "'" + POut.PString(sig.ToUser) + "', "
                       + POut.PDateT(sig.AckTime) + ")";
            if (PrefB.RandomKeys)
            {
                General.NonQ(command);
            }
            else
            {
                sig.SignalNum = General.NonQ(command, true);
            }
        }
Beispiel #27
0
        ///<summary></summary>
        public static void Insert(PaySplit split)
        {
            if (PrefB.RandomKeys)
            {
                split.SplitNum = MiscData.GetKey("paysplit", "SplitNum");
            }
            string command = "INSERT INTO paysplit (";

            if (PrefB.RandomKeys)
            {
                command += "SplitNum,";
            }
            command += "SplitAmt,PatNum,ProcDate, "
                       + "PayNum,IsDiscount,DiscountType,ProvNum,PayPlanNum,DatePay,ProcNum,DateEntry) VALUES(";
            if (PrefB.RandomKeys)
            {
                command += "'" + POut.PInt(split.SplitNum) + "', ";
            }
            command +=
                "'" + POut.PDouble(split.SplitAmt) + "', "
                + "'" + POut.PInt(split.PatNum) + "', "
                + POut.PDate(split.ProcDate) + ", "
                + "'" + POut.PInt(split.PayNum) + "', "
                + "'0', "               //IsDiscount
                + "'0', "               //DiscountType
                + "'" + POut.PInt(split.ProvNum) + "', "
                + "'" + POut.PInt(split.PayPlanNum) + "', "
                + POut.PDate(split.DatePay) + ", "
                + "'" + POut.PInt(split.ProcNum) + "', ";
            if (FormChooseDatabase.DBtype == DatabaseType.Oracle)
            {
                command += POut.PDateT(MiscData.GetNowDateTime());
            }
            else              //Assume MySQL
            {
                command += "NOW()";
            }
            command += ")";          //DateEntry: date of server
            if (PrefB.RandomKeys)
            {
                General.NonQ(command);
            }
            else
            {
                split.SplitNum = General.NonQ(command, true);
            }
        }
        ///<summary>Called from FormOpenDental.Load.  Updates local time and checks to see if server time is in synch, with a fast db call (only acurate to seconds, not miliseconds).</summary>
        public bool TimesInSynchFast()
        {
            this.Cursor      = Cursors.WaitCursor;
            textNistUrl.Text = PrefC.GetString(PrefName.NistTimeServerUrl);
            double nistOffset = GetNistOffset();

            if (nistOffset == double.MaxValue)            //Timed out
            {
                MsgBox.Show(this, "No response received from NIST time server.  Click synch time after four seconds.");
                this.Cursor = Cursors.Default;
                return(false);
            }
            if (nistOffset == double.MinValue)            //Invalid Nist Server Address
            {
                this.Cursor = Cursors.Default;
                return(false);
            }
            //Get current times from offsets
            _timeLocal = DateTime.Now;
            Stopwatch stopwatch = new Stopwatch();             //Used to keep NIST time in time even when system fails to set local machine time (Can't pull it later)

            stopwatch.Start();
            _timeNist = _timeLocal.AddMilliseconds(nistOffset);
            try {
                WindowsTime.SetTime(_timeNist);                 //Sets local machine time
            }
            catch {
                MsgBox.Show(this, "Error setting local machine time.");
            }
            _timeLocal = DateTime.Now;                                                     //Update time since it has now been set
            double serverOffset = (MiscData.GetNowDateTime() - DateTime.Now).TotalSeconds; //Cannot get milliseconds from Now() in Mysql Pre-5.6.4, Only gets whole seconds.

            _timeServer = _timeLocal.AddSeconds(serverOffset);
            if (ServerInSynchFast() && LocalInSynch())              //All times in synch
            {
                return(true);
            }
            //Some times out of synch, so form will open, but we don't want to make another call to NIST server.
            serverOffset = (MiscData.GetNowDateTimeWithMilli() - DateTime.Now).TotalSeconds;         //_timeServer needs to be more accurate before displaying
            _timeLocal   = DateTime.Now;
            stopwatch.Stop();
            _timeServer = _timeLocal.AddSeconds(serverOffset);
            _timeNist   = _timeNist.AddMilliseconds(stopwatch.ElapsedMilliseconds);
            this.Cursor = Cursors.Default;
            return(false);
        }
Beispiel #29
0
        ///<summary>There's only one place in the program where this is called from.  Date is today, so no need to validate the date.</summary>
        public static void Insert(Payment pay)
        {
            if (PrefB.RandomKeys)
            {
                pay.PayNum = MiscData.GetKey("payment", "PayNum");
            }
            string command = "INSERT INTO payment (";

            if (PrefB.RandomKeys)
            {
                command += "PayNum,";
            }
            command += "PayType,PayDate,PayAmt, "
                       + "CheckNum,BankBranch,PayNote,IsSplit,PatNum,ClinicNum,DateEntry,DepositNum) VALUES(";
            if (PrefB.RandomKeys)
            {
                command += "'" + POut.PInt(pay.PayNum) + "', ";
            }
            command +=
                "'" + POut.PInt(pay.PayType) + "', "
                + POut.PDate(pay.PayDate) + ", "
                + "'" + POut.PDouble(pay.PayAmt) + "', "
                + "'" + POut.PString(pay.CheckNum) + "', "
                + "'" + POut.PString(pay.BankBranch) + "', "
                + "'" + POut.PString(pay.PayNote) + "', "
                + "'" + POut.PBool(pay.IsSplit) + "', "
                + "'" + POut.PInt(pay.PatNum) + "', "
                + "'" + POut.PInt(pay.ClinicNum) + "', ";
            if (FormChooseDatabase.DBtype == DatabaseType.Oracle)
            {
                command += POut.PDateT(MiscData.GetNowDateTime());
            }
            else              //Assume MySQL
            {
                command += "NOW()";
            }
            command += ", '" + POut.PInt(pay.DepositNum) + "')";
            if (PrefB.RandomKeys)
            {
                General.NonQ(command);
            }
            else
            {
                pay.PayNum = General.NonQ(command, true);
            }
        }
Beispiel #30
0
        ///<summary>DateTimeTrans is always handled automatically here.  No need to set it in advance.</summary>
        private static void Insert(Etrans etrans)
        {
            if (PrefB.RandomKeys)
            {
                etrans.EtransNum = MiscData.GetKey("etrans", "EtransNum");
            }
            string command = "INSERT INTO etrans (";

            if (PrefB.RandomKeys)
            {
                command += "EtransNum,";
            }
            command += "DateTimeTrans,ClearinghouseNum,Etype,ClaimNum,OfficeSequenceNumber,CarrierTransCounter,"
                       + "CarrierTransCounter2,CarrierNum,CarrierNum2,PatNum,MessageText) VALUES(";
            if (PrefB.RandomKeys)
            {
                command += "'" + POut.PInt(etrans.EtransNum) + "', ";
            }
            if (FormChooseDatabase.DBtype == DatabaseType.Oracle)
            {
                command += POut.PDateT(MiscData.GetNowDateTime());
            }
            else              //Assume MySQL
            {
                command += "NOW()";
            }
            command += ", "           //"'"+POut.PDateT (etrans.DateTimeTrans)+"', "
                       + "'" + POut.PInt(etrans.ClearinghouseNum) + "', "
                       + "'" + POut.PInt((int)etrans.Etype) + "', "
                       + "'" + POut.PInt(etrans.ClaimNum) + "', "
                       + "'" + POut.PInt(etrans.OfficeSequenceNumber) + "', "
                       + "'" + POut.PInt(etrans.CarrierTransCounter) + "', "
                       + "'" + POut.PInt(etrans.CarrierTransCounter2) + "', "
                       + "'" + POut.PInt(etrans.CarrierNum) + "', "
                       + "'" + POut.PInt(etrans.CarrierNum2) + "', "
                       + "'" + POut.PInt(etrans.PatNum) + "', "
                       + "'" + POut.PString(etrans.MessageText) + "')";
            if (PrefB.RandomKeys)
            {
                General.NonQ(command);
            }
            else
            {
                etrans.EtransNum = General.NonQ(command, true);
            }
        }