Пример #1
0
 private void FormRecallTypes_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (changed)
     {
         DataValid.SetInvalid(InvalidType.RecallTypes);
         if (MessageBox.Show(Lan.g(this, "Recalls for all patients should be synchronized.  Synchronize now?"), "", MessageBoxButtons.YesNo)
             == DialogResult.Yes)
         {
             Cursor = Cursors.WaitCursor;
             GC.Collect();                    //free up resources since this could take a lot of memory
             _actionCloseRecallSyncProgress = ODProgressOld.ShowProgressStatus("RecallSyncEvent"
                                                                               , typeof(RecallSyncEvent)
                                                                               , tag: new ProgressBarHelper(Lan.g(this, "Running Prep Queries") + "...", null, 0, 100, ProgBarStyle.Marquee
                                                                                                            , progressBarEventType: ProgBarEventType.Header)
                                                                               , currentForm: this);
             bool syncSuccessful = Recalls.SynchAllPatients();
             _actionCloseRecallSyncProgress?.Invoke();
             GC.Collect();                    //clean up resources, force the garbage collector to collect since resources may remain tied-up
             Cursor = Cursors.Default;
             if (!syncSuccessful)
             {
                 MsgBox.Show(this, "Synch is currently running from a different workstation.  Recalls should be synchronized again later.");
             }
         }
     }
 }
Пример #2
0
        private void butDelete_Click(object sender, System.EventArgs e)
        {
            //Before deleting the actual type, we would need to check special types.

            /*if(RecallCur.IsNew){
             *      DialogResult=DialogResult.Cancel;
             *      return;
             * }
             * if(!MsgBox.Show(this,true,"Delete this RecallType?")) {
             *      return;
             * }
             * try{
             *      Pharmacies.DeleteObject(PharmCur.PharmacyNum);
             *      DialogResult=DialogResult.OK;
             * }
             * catch(Exception ex){
             *      MessageBox.Show(ex.Message);
             * }*/
            if (!Security.IsAuthorized(Permissions.SecurityAdmin))
            {
                return;
            }
            if (listTriggers.Items.Count > 0)
            {
                MsgBox.Show(this, "All triggers must first be deleted.");
                return;
            }
            if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Are you absolutely sure you want to delete all recalls of this type?"))
            {
                return;
            }
            Recalls.DeleteAllOfType(RecallTypeCur.RecallTypeNum);
            CountForType = Recalls.GetCountForType(RecallTypeCur.RecallTypeNum);
            MsgBox.Show(this, "Done.");
        }
Пример #3
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (textMedicalCode.Text != "" && !ProcedureCodes.HList.Contains(textMedicalCode.Text))
            {
                MsgBox.Show(this, "Invalid medical code.  It must refer to an existing procedure code entered separately");
                return;
            }
            if (textSubstitutionCode.Text != "" && !ProcedureCodes.HList.Contains(textSubstitutionCode.Text))
            {
                MsgBox.Show(this, "Invalid substitution code.  It must refer to an existing procedure code entered separately");
                return;
            }
            bool DoSynchRecall = false;

            if (IsNew && checkSetRecall.Checked)
            {
                DoSynchRecall = true;
            }
            else if (ProcCode.SetRecall != checkSetRecall.Checked)          //set recall changed
            {
                DoSynchRecall = true;
            }
            if (DoSynchRecall)
            {
                if (!MsgBox.Show(this, true, "Because you have changed the recall setting for this procedure code, all your patient recalls will be resynchronized, which can take a minute or two.  Do you want to continue?"))
                {
                    return;
                }
            }
            ProcCode.AlternateCode1   = textAlternateCode1.Text;
            ProcCode.MedicalCode      = textMedicalCode.Text;
            ProcCode.SubstitutionCode = textSubstitutionCode.Text;
            ProcCode.SubstOnlyIf      = (SubstitutionCondition)comboSubstOnlyIf.SelectedIndex;
            ProcCode.Descript         = textDescription.Text;
            ProcCode.AbbrDesc         = textAbbrev.Text;
            ProcCode.LaymanTerm       = textLaymanTerm.Text;
            ProcCode.ProcTime         = strBTime.ToString();
            ProcCode.GraphicColor     = butColor.BackColor;
            ProcCode.SetRecall        = checkSetRecall.Checked;
            ProcCode.NoBillIns        = checkNoBillIns.Checked;
            ProcCode.IsProsth         = checkIsProsth.Checked;
            ProcCode.IsHygiene        = checkIsHygiene.Checked;
            ProcCode.IsCanadianLab    = checkIsCanadianLab.Checked;
            ProcCode.DefaultNote      = textNote.Text;
            ProcCode.PaintType        = (ToothPaintingType)listPaintType.SelectedIndex;
            ProcCode.TreatArea        = (TreatmentArea)listTreatArea.SelectedIndex + 1;
            ProcCode.BaseUnits        = Int16.Parse(textBaseUnits.Text.ToString());
            if (listCategory.SelectedIndex != -1)
            {
                ProcCode.ProcCat = DefB.Short[(int)DefCat.ProcCodeCats][listCategory.SelectedIndex].DefNum;
            }
            ProcedureCodes.Update(ProcCode);            //whether new or not.
            if (DoSynchRecall)
            {
                Cursor = Cursors.WaitCursor;
                Recalls.SynchAllPatients();
                Cursor = Cursors.Default;
            }
            DialogResult = DialogResult.OK;
        }
Пример #4
0
        private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            SelectedPatNum = PIn.PInt(table.Rows[e.Row]["PatNum"].ToString());
            Recall[]           recalls = Recalls.GetList(new int[] { SelectedPatNum });
            FormRecallListEdit FormRE  = new FormRecallListEdit(recalls[0]);

            FormRE.ShowDialog();
            if (FormRE.PinClicked)
            {
                PinClicked   = true;
                AptSelected  = FormRE.AptSelected;
                DialogResult = DialogResult.OK;
                return;
            }
            else
            {
                FillMain();
            }
            for (int i = 0; i < gridMain.Rows.Count; i++)
            {
                if (PIn.PInt(table.Rows[i]["PatNum"].ToString()) == SelectedPatNum)
                {
                    gridMain.SetSelected(i, true);
                }
            }
            SetFamilyColors();
        }
Пример #5
0
 private void butLabels_Click(object sender, System.EventArgs e)
 {
     if (gridMain.Rows.Count < 1)
     {
         MessageBox.Show(Lan.g(this, "There are no Patients in the Recall table.  Must have at least one to print."));
         return;
     }
     if (gridMain.SelectedIndices.Length == 0)
     {
         gridMain.SetSelected(true);
     }
     int[] PatNums;
     PatNums = new int[gridMain.SelectedIndices.Length];
     for (int i = 0; i < PatNums.Length; i++)
     {
         PatNums[i] = PIn.PInt(table.Rows[gridMain.SelectedIndices[i]]["PatNum"].ToString());
         //((RecallItem)gridMain.Rows[gridMain.SelectedIndices[i]].Tag).PatNum;
     }
     AddrTable       = Recalls.GetAddrTable(PatNums, false);   //can never group by family because there's no room to display the list.
     pagesPrinted    = 0;
     patientsPrinted = 0;
     pd                             = new PrintDocument();
     pd.PrintPage                  += new PrintPageEventHandler(this.pdLabels_PrintPage);
     pd.OriginAtMargins             = true;
     pd.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0);
     printPreview                   = new OpenDental.UI.PrintPreview(PrintSituation.LabelSheet
                                                                     , pd, (int)Math.Ceiling((double)AddrTable.Rows.Count / 30));
     //printPreview.Document=pd;
     //printPreview.TotalPages=;
     printPreview.ShowDialog();
 }
Пример #6
0
 private void butSetStatus_Click(object sender, System.EventArgs e)
 {
     if (comboStatus.SelectedIndex == -1)
     {
         return;
     }
     int[] originalRecalls = new int[gridMain.SelectedIndices.Length];
     for (int i = 0; i < gridMain.SelectedIndices.Length; i++)
     {
         originalRecalls[i] = PIn.PInt(table.Rows[gridMain.SelectedIndices[i]]["RecallNum"].ToString());
         //((RecallItem)gridMain.Rows[gridMain.SelectedIndices[i]].Tag).RecallNum;
         Recalls.UpdateStatus(
             PIn.PInt(table.Rows[gridMain.SelectedIndices[i]]["RecallNum"].ToString()),
             //((RecallItem)gridMain.Rows[gridMain.SelectedIndices[i]].Tag).RecallNum,
             DefB.Short[(int)DefCat.RecallUnschedStatus][comboStatus.SelectedIndex].DefNum);
         //((RecallItem)MainAL[tbMain.SelectedIndices[i]]).up
     }
     FillMain();
     for (int i = 0; i < gridMain.Rows.Count; i++)
     {
         for (int j = 0; j < originalRecalls.Length; j++)
         {
             if (originalRecalls[j] == PIn.PInt(table.Rows[i]["RecallNum"].ToString()))
             {
                 //((RecallItem)gridMain.Rows[i].Tag).RecallNum){
                 gridMain.SetSelected(i, true);
             }
         }
     }
 }
Пример #7
0
 private void FormRecallTypeEdit_Load(object sender, System.EventArgs e)
 {
     textDescription.Text = RecallTypeCur.Description;
     defaultIntervalOld   = RecallTypeCur.DefaultInterval;
     comboSpecial.Items.Add(Lan.g(this, "none"));
     comboSpecial.Items.Add(Lan.g(this, "Prophy"));
     comboSpecial.Items.Add(Lan.g(this, "ChildProphy"));
     comboSpecial.Items.Add(Lan.g(this, "Perio"));
     SetSpecialIdx();
     CountForType = Recalls.GetCountForType(RecallTypeCur.RecallTypeNum);
     TriggerList  = RecallTriggers.GetForType(RecallTypeCur.RecallTypeNum);         //works if 0, too.
     SetSpecialText();
     FillTriggers();
     if (PrefC.GetLong(PrefName.RecallTypeSpecialChildProphy) == RecallTypeCur.RecallTypeNum)
     {
         textRecallAgeAdult.Text = PrefC.GetInt(PrefName.RecallAgeAdult).ToString();
     }
     textYears.Text               = RecallTypeCur.DefaultInterval.Years.ToString();
     textMonths.Text              = RecallTypeCur.DefaultInterval.Months.ToString();
     textWeeks.Text               = RecallTypeCur.DefaultInterval.Weeks.ToString();
     textDays.Text                = RecallTypeCur.DefaultInterval.Days.ToString();
     textPattern.Text             = RecallTypeCur.TimePattern;
     checkAppendToSpecial.Checked = RecallTypeCur.AppendToSpecial;
     FillProcs();
 }
Пример #8
0
        private void butRecall_Click(object sender, System.EventArgs e)
        {
            Procedure[] procList   = Procedures.Refresh(PatCur.PatNum);
            Recall[]    recallList = Recalls.GetList(new int[] { PatCur.PatNum });     //get the recall for this pt
            if (recallList.Length == 0)
            {
                MsgBox.Show(this, "This patient does not have any recall due.");
                return;
            }
            Recall recallCur = recallList[0];

            InsPlan[]   planList = InsPlans.Refresh(FamCur);
            Appointment apt      = Appointments.CreateRecallApt(PatCur, procList, recallCur, planList);

            AptSelected = apt.AptNum;
            oResult     = OtherResult.PinboardAndSearch;
            if (recallCur.DateDue < DateTime.Today)
            {
                DateJumpToString = DateTime.Today.ToShortDateString();              //they are overdue
            }
            else
            {
                DateJumpToString = recallCur.DateDue.ToShortDateString();
            }
            DialogResult = DialogResult.OK;
        }
Пример #9
0
        private void butSynch_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            GC.Collect();            //free up resources since this could take a lot of memory
            DataValid.SetInvalid(InvalidType.RecallTypes);
            _actionCloseRecallSyncProgress = ODProgressOld.ShowProgressStatus("RecallSyncEvent"
                                                                              , typeof(RecallSyncEvent)
                                                                              , tag: new ProgressBarHelper(Lan.g(this, "Running Prep Queries") + "...", null, 0, 100, ProgBarStyle.Marquee
                                                                                                           , progressBarEventType: ProgBarEventType.Header)
                                                                              , currentForm: this);
            bool syncCompleted = Recalls.SynchAllPatients();

            _actionCloseRecallSyncProgress?.Invoke();
            GC.Collect();            //clean up resources, force the garbage collector to collect since resources may remain tied-up
            Cursor = Cursors.Default;
            if (syncCompleted)
            {
                changed = false;
                MsgBox.Show(this, "Done.");
            }
            else
            {
                MsgBox.Show(this, "Synch is currently running from a different workstation.");
            }
        }
Пример #10
0
 private void butSynch_Click(object sender, EventArgs e)
 {
     Cursor = Cursors.WaitCursor;
     DataValid.SetInvalid(InvalidType.RecallTypes);
     Recalls.SynchAllPatients();
     changed = false;
     Cursor  = Cursors.Default;
     MsgBox.Show(this, "Done.");
 }
Пример #11
0
 private void butPerio_Click(object sender, EventArgs e)
 {
     //make sure we have both special types properly setup.
     if (!RecallTypes.PerioAndProphyBothHaveTriggers())
     {
         MsgBox.Show(this, "Prophy and Perio special recall types are not setup properly.  They must both exist, and they must both have a trigger.");
         return;
     }
     if (IsPerio)
     {
         //change the perio types to prophy
         for (int i = 0; i < RecallList.Count; i++)
         {
             if (PrefC.GetLong(PrefName.RecallTypeSpecialPerio) == RecallList[i].RecallTypeNum)
             {
                 RecallList[i].RecallTypeNum  = PrefC.GetLong(PrefName.RecallTypeSpecialProphy);
                 RecallList[i].RecallInterval = RecallTypes.GetInterval(PrefC.GetLong(PrefName.RecallTypeSpecialProphy));
                 //previous date will be reset below in synch, but probably won't change since similar triggers.
                 Recalls.Update(RecallList[i]);
                 SecurityLogs.MakeLogEntry(Permissions.RecallEdit, RecallList[i].PatNum, "Recall changed to Prophy from the Recalls for Patient window.");
                 break;
             }
         }
     }
     else
     {
         bool found = false;
         //change any prophy types to perio
         for (int i = 0; i < RecallList.Count; i++)
         {
             if (PrefC.GetLong(PrefName.RecallTypeSpecialProphy) == RecallList[i].RecallTypeNum)
             {
                 RecallList[i].RecallTypeNum  = PrefC.GetLong(PrefName.RecallTypeSpecialPerio);
                 RecallList[i].RecallInterval = RecallTypes.GetInterval(PrefC.GetLong(PrefName.RecallTypeSpecialPerio));
                 //previous date will be reset below in synch, but probably won't change since similar triggers.
                 Recalls.Update(RecallList[i]);
                 SecurityLogs.MakeLogEntry(Permissions.RecallEdit, RecallList[i].PatNum, "Recall changed to Perio from the Recalls for Patient window.");
                 found = true;
                 break;
             }
         }
         //if none found, then add a perio
         if (!found)
         {
             Recall recall = new Recall();
             recall.PatNum         = PatNum;
             recall.RecallInterval = RecallTypes.GetInterval(PrefC.GetLong(PrefName.RecallTypeSpecialPerio));
             recall.RecallTypeNum  = PrefC.GetLong(PrefName.RecallTypeSpecialPerio);
             Recalls.Insert(recall);
             SecurityLogs.MakeLogEntry(Permissions.RecallEdit, recall.PatNum, "Perio recall added from the Recalls for Patient window.");
         }
     }
     FillGrid();
 }
Пример #12
0
 private void butOK_Click(object sender, EventArgs e)
 {
     if (textDate.errorProvider1.GetError(textDate) != "")
     {
         MsgBox.Show(this, "Please fix data entry errors first.");
         return;
     }
     if (textDate.Text != "")
     {
         DateTime    procDate = PIn.Date(textDate.Text);
         Appointment apt;
         for (int i = 0; i < ProcList.Count; i++)
         {
             if (ProcList[i].AptNum == 0)
             {
                 continue;
             }
             apt = Appointments.GetOneApt(ProcList[i].AptNum);
             if (ProcList[i].ProcDate != procDate)
             {
                 if (!MsgBox.Show(this, true, "Date does not match appointment date.  Continue anyway?"))
                 {
                     return;
                 }
                 break;
             }
         }
         for (int i = 0; i < ProcList.Count; i++)
         {
             ProcList[i].ProcDate = procDate;
             Procedures.Update(ProcList[i], ProcOldList[i]);
         }
         Recalls.Synch(ProcList[0].PatNum);
         if (AnyAreC)
         {
             Patient       pat   = Patients.GetPat(ProcList[0].PatNum);
             string        codes = "";
             ProcedureCode ProcedureCode2;
             for (int i = 0; i < ProcList.Count; i++)
             {
                 if (i > 0)
                 {
                     codes += ", ";
                 }
                 ProcedureCode2 = ProcedureCodes.GetProcCode(ProcList[i].CodeNum);
                 codes         += ProcedureCode2.ProcCode;
             }
             SecurityLogs.MakeLogEntry(Permissions.ProcComplEdit, ProcList[0].PatNum,
                                       pat.GetNameLF() + codes + ", New date:" + procDate.ToShortDateString());
         }
     }
     DialogResult = DialogResult.OK;
 }
Пример #13
0
        private void butPostcards_Click(object sender, System.EventArgs e)
        {
            if (gridMain.Rows.Count < 1)
            {
                MessageBox.Show(Lan.g(this, "There are no Patients in the Recall table.  Must have at least one to print."));
                return;
            }
            if (gridMain.SelectedIndices.Length == 0)
            {
                gridMain.SetSelected(true);
            }
            int[] PatNums;
            PatNums = new int[gridMain.SelectedIndices.Length];
            for (int i = 0; i < PatNums.Length; i++)
            {
                PatNums[i] = PIn.PInt(table.Rows[gridMain.SelectedIndices[i]]["PatNum"].ToString());
                //((RecallItem)gridMain.Rows[gridMain.SelectedIndices[i]].Tag).PatNum;
            }
            if (MsgBox.Show(this, true, "Make a commlog entry of 'postcard sent' for all of the selected patients?"))
            {
                for (int i = 0; i < PatNums.Length; i++)
                {
                    //make commlog entries for each patient
                    Commlogs.InsertForRecallPostcard(PatNums[i]);
                }
            }
            AddrTable       = Recalls.GetAddrTable(PatNums, checkGroupFamilies.Checked);
            pagesPrinted    = 0;
            patientsPrinted = 0;
            pd                             = new PrintDocument();
            pd.PrintPage                  += new PrintPageEventHandler(this.pdCards_PrintPage);
            pd.OriginAtMargins             = true;
            pd.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0);
            if (PrefB.GetInt("RecallPostcardsPerSheet") == 1)
            {
                pd.DefaultPageSettings.PaperSize = new PaperSize("Postcard", 400, 600);
                pd.DefaultPageSettings.Landscape = true;
            }
            else if (PrefB.GetInt("RecallPostcardsPerSheet") == 3)
            {
                pd.DefaultPageSettings.PaperSize = new PaperSize("Postcard", 850, 1100);
            }
            else             //4
            {
                pd.DefaultPageSettings.PaperSize = new PaperSize("Postcard", 850, 1100);
                pd.DefaultPageSettings.Landscape = true;
            }
            int totalPages = (int)Math.Ceiling((double)AddrTable.Rows.Count / (double)PrefB.GetInt("RecallPostcardsPerSheet"));

            printPreview = new OpenDental.UI.PrintPreview(PrintSituation.Postcard, pd, totalPages);
            printPreview.ShowDialog();
        }
Пример #14
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (textDateDue.errorProvider1.GetError(textDateDue) != "" ||
         textYears.errorProvider1.GetError(textYears) != "" ||
         textMonths.errorProvider1.GetError(textMonths) != "" ||
         textWeeks.errorProvider1.GetError(textWeeks) != "" ||
         textDays.errorProvider1.GetError(textDays) != ""
         )
     {
         MessageBox.Show(Lan.g(this, "Please fix data entry errors first."));
         return;
     }
     RecallCur.IsDisabled            = checkIsDisabled.Checked;
     RecallCur.DateDue               = PIn.PDate(textDateDue.Text);
     RecallCur.RecallInterval.Years  = PIn.PInt(textYears.Text);
     RecallCur.RecallInterval.Months = PIn.PInt(textMonths.Text);
     RecallCur.RecallInterval.Weeks  = PIn.PInt(textWeeks.Text);
     RecallCur.RecallInterval.Days   = PIn.PInt(textDays.Text);
     if (comboStatus.SelectedIndex == 0)
     {
         RecallCur.RecallStatus = 0;
     }
     else
     {
         RecallCur.RecallStatus
             = DefB.Short[(int)DefCat.RecallUnschedStatus][comboStatus.SelectedIndex - 1].DefNum;
     }
     RecallCur.Note = textNote.Text;
     if (IsNew)
     {
         if (!Recalls.IsAllDefault(RecallCur))                //only save if something meaningful
         {
             Recalls.Insert(RecallCur);
         }
     }
     else
     {
         if (Recalls.IsAllDefault(RecallCur))
         {
             Recalls.Delete(RecallCur);
             DialogResult = DialogResult.OK;
             return;
         }
         else
         {
             Recalls.Update(RecallCur);
         }
     }
     Recalls.Synch(PatCur.PatNum, RecallCur);
     DialogResult = DialogResult.OK;
 }
Пример #15
0
 private void FormRecallTypes_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (changed)
     {
         DataValid.SetInvalid(InvalidType.RecallTypes);
         if (MessageBox.Show(Lan.g(this, "Recalls for all patients should be synchronized.  Synchronize now?"), "", MessageBoxButtons.YesNo)
             == DialogResult.Yes)
         {
             Cursor = Cursors.WaitCursor;
             Recalls.SynchAllPatients();
             Cursor = Cursors.Default;
         }
     }
 }
Пример #16
0
        /// <summary>Helper method to send given appt to the unscheduled list.
        /// Creates SecurityLogs and considers HL7.</summary>
        public static void SetApptUnschedHelper(Appointment appt, Patient pat = null, bool doFireApptEvent = true)
        {
            DateTime datePrevious = appt.DateTStamp;

            Appointments.SetAptStatus(appt, ApptStatus.UnschedList); //Appointments S-Class handles Signalods
            #region SecurityLogs
            if (appt.AptStatus != ApptStatus.Complete)               //seperate log entry for editing completed appts.
            {
                SecurityLogs.MakeLogEntry(Permissions.AppointmentMove, appt.PatNum,
                                          appt.ProcDescript + ", " + appt.AptDateTime.ToString() + ", Sent to Unscheduled List",
                                          appt.AptNum, datePrevious);
            }
            else
            {
                SecurityLogs.MakeLogEntry(Permissions.AppointmentCompleteEdit, appt.PatNum,
                                          appt.ProcDescript + ", " + appt.AptDateTime.ToString() + ", Sent to Unscheduled List",
                                          appt.AptNum, datePrevious);
            }
            #endregion
            #region HL7
            //If there is an existing HL7 def enabled, send a SIU message if there is an outbound SIU message defined
            if (HL7Defs.IsExistingHL7Enabled())
            {
                if (pat == null)
                {
                    pat = Patients.GetPat(appt.PatNum);
                }
                //S15 - Appt Cancellation event
                MessageHL7 messageHL7 = MessageConstructor.GenerateSIU(pat, Patients.GetPat(pat.Guarantor), EventTypeHL7.S15, appt);
                //Will be null if there is no outbound SIU message defined, so do nothing
                if (messageHL7 != null)
                {
                    HL7Msg hl7Msg = new HL7Msg();
                    hl7Msg.AptNum    = appt.AptNum;
                    hl7Msg.HL7Status = HL7MessageStatus.OutPending;                  //it will be marked outSent by the HL7 service.
                    hl7Msg.MsgText   = messageHL7.ToString();
                    hl7Msg.PatNum    = pat.PatNum;
                    HL7Msgs.Insert(hl7Msg);
#if DEBUG
                    MessageBox.Show("Appointments", messageHL7.ToString());
#endif
                }
            }
            #endregion
            if (doFireApptEvent)
            {
                AppointmentEvent.Fire(ODEventType.AppointmentEdited, appt);
            }
            Recalls.SynchScheduledApptFull(appt.PatNum);
        }
Пример #17
0
        private void butMaunal_Click(object sender, EventArgs e)
        {
            if (!Security.IsAuthorized(Permissions.ProcComplCreate))
            {
                return;
            }
            if (textChargeAmt.Text == null || textChargeAmt.Text == "")
            {
                MsgBox.Show(this, "You must first enter a charge amount.");
                return;
            }
            double procFee;

            try {
                procFee = Double.Parse(textChargeAmt.Text);
            }
            catch {
                MsgBox.Show(this, "Invalid charge amount.");
                return;
            }
            Procedures.SetDateFirstVisit(DateTime.Today, 1, Patients.GetPat(RepeatCur.PatNum));
            Procedure proc = new Procedure();

            proc.CodeNum        = ProcedureCodes.GetCodeNum(textCode.Text);
            proc.DateEntryC     = DateTimeOD.Today;
            proc.PatNum         = RepeatCur.PatNum;
            proc.ProcDate       = DateTimeOD.Today;
            proc.DateTP         = DateTimeOD.Today;
            proc.ProcFee        = procFee;
            proc.ProcStatus     = ProcStat.C;
            proc.ProvNum        = PrefC.GetLong(PrefName.PracticeDefaultProv);
            proc.MedicalCode    = ProcedureCodes.GetProcCode(proc.CodeNum).MedicalCode;
            proc.BaseUnits      = ProcedureCodes.GetProcCode(proc.CodeNum).BaseUnits;
            proc.DiagnosticCode = PrefC.GetString(PrefName.ICD9DefaultForNewProcs);
            //Check if the repeating charge has been flagged to copy it's note into the billing note of the procedure.
            if (RepeatCur.CopyNoteToProc)
            {
                proc.BillingNote = RepeatCur.Note;
            }
            Procedures.Insert(proc);
            Recalls.Synch(RepeatCur.PatNum);
            MsgBox.Show(this, "Procedure added.");
        }
Пример #18
0
		///<summary></summary>
		public static string ReplaceTemplateFields(string templateText,Patient pat,Appointment aptNext,Clinic clinic) {
			//patient information
			templateText=Patients.ReplacePatient(templateText,pat);
			//Guarantor Information
			templateText=Patients.ReplaceGuarantor(templateText,pat);
			//Family Information
			templateText=Family.ReplaceFamily(templateText,pat);
			//Next Scheduled Appointment Information
			templateText=Appointments.ReplaceAppointment(templateText,aptNext); //handles null nextApts.
			//Currently Logged in User Information
			templateText=FormMessageReplacements.ReplaceUser(templateText,Security.CurUser);
			//Clinic Information
			templateText=Clinics.ReplaceOffice(templateText,clinic);
			//Misc Information
			templateText=FormMessageReplacements.ReplaceMisc(templateText);
			//Referral Information
			templateText=Referrals.ReplaceRefProvider(templateText,pat);
			//Recall Information
			return Recalls.ReplaceRecall(templateText,pat);
		}
Пример #19
0
        private void butSynch_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            GC.Collect();            //free up resources since this could take a lot of memory
            DataValid.SetInvalid(InvalidType.RecallTypes);
            Action actionCloseRecallSyncProgress = ODProgress.Show(ODEventType.RecallSync, typeof(RecallSyncEvent), Lan.g(this, "Running Prep Queries") + "...", false, true);
            bool   isSyncCompleted = Recalls.SynchAllPatients();

            actionCloseRecallSyncProgress?.Invoke();
            GC.Collect();            //clean up resources, force the garbage collector to collect since resources may remain tied-up
            Cursor = Cursors.Default;
            if (isSyncCompleted)
            {
                changed = false;
                MsgBox.Show(this, "Done.");
            }
            else
            {
                MsgBox.Show(this, "Synch is currently running from a different workstation.");
            }
        }
Пример #20
0
 private void butDelete_Click(object sender, System.EventArgs e)
 {
     if (IsNew)
     {
         DialogResult = DialogResult.Cancel;
         return;
     }
     if (RecallCur.DatePrevious.Year > 1880)
     {
         if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "This recall should not normally be deleted because the Previous Date has a value.  You should use the Disabled checkBox instead.  But if you are just deleting a duplicate, it's ok to continue.  Continue?"))
         {
             return;
         }
     }
     else if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Delete this recall?"))
     {
         return;
     }
     Recalls.Delete(RecallCur);
     DialogResult = DialogResult.OK;
 }
Пример #21
0
        private void comboSpecial_SelectionChangeCommitted(object sender, EventArgs e)
        {
            if (CountForType > 0)
            {
                MessageBox.Show(Lan.g(this, "Cannot change Special Type. Patients using this recall type: ") + CountForType.ToString());
                SetSpecialIdx();                //sets back to what it was when form opened
                return;
            }
            //cannot change a special type to one that is already in set for another recall type if that recall type is in use by patients
            long recallTypeNumPrev = 0;

            switch (comboSpecial.SelectedIndex)
            {
            case 1:
                recallTypeNumPrev = PrefC.GetLong(PrefName.RecallTypeSpecialProphy);
                break;

            case 2:
                recallTypeNumPrev = PrefC.GetLong(PrefName.RecallTypeSpecialChildProphy);
                break;

            case 3:
                recallTypeNumPrev = PrefC.GetLong(PrefName.RecallTypeSpecialPerio);
                break;
            }
            int countForTypePrev = 0;

            if (recallTypeNumPrev > 0)
            {
                countForTypePrev = Recalls.GetCountForType(recallTypeNumPrev);
            }
            if (countForTypePrev > 0)
            {
                MessageBox.Show(Lan.g(this, "Cannot change Special Type to one that is set for another recall type and in use by patients.  "
                                      + "Patients using the other recall type: ") + countForTypePrev.ToString());
                SetSpecialIdx();                //sets back to what it was when form opened
                return;
            }
            SetSpecialText();
        }
Пример #22
0
 private void butDelete_Click(object sender, System.EventArgs e)
 {
     if (RecallCur.DatePrevious.Year < 1880)          //Can only be deleted if DatePrevious is blank.
     {
         if (IsNew)
         {
             DialogResult = DialogResult.Cancel;
         }
         else
         {
             if (!MsgBox.Show(this, true, "Delete this recall?"))
             {
                 return;
             }
             Recalls.Delete(RecallCur);
             DialogResult = DialogResult.OK;
         }
     }
     else
     {
         MsgBox.Show(this, "This recall can not be deleted because Previous Date has a value.  You should use the Disabled checkBox instead.");
     }
 }
Пример #23
0
        private void FillMain()
        {
            if (textDateStart.errorProvider1.GetError(textDateStart) != "" ||
                textDateEnd.errorProvider1.GetError(textDateEnd) != "")
            {
                //MessageBox.Show(Lan.g(this,"Please fix data entry errors first."));
                return;
            }

            /*if(checkGroupFamilies.Checked){
             *      textFamilyMessage.Visible=true;
             *      labelFamilyMessage.Visible=true;
             * }
             * else{
             *      textFamilyMessage.Visible=false;
             *      labelFamilyMessage.Visible=false;
             * }*/
            DateTime fromDate;
            DateTime toDate;

            if (textDateStart.Text == "")
            {
                fromDate = DateTime.MinValue.AddDays(1);              //because we don't want to include 010101
            }
            else
            {
                fromDate = PIn.PDate(textDateStart.Text);
            }
            if (textDateEnd.Text == "")
            {
                toDate = DateTime.MaxValue;
            }
            else
            {
                toDate = PIn.PDate(textDateEnd.Text);
            }
            table = Recalls.GetRecallList(fromDate, toDate, checkGroupFamilies.Checked);
            int scrollval = gridMain.ScrollValue;

            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g("TableRecallList", "Due Date"), 75);

            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableRecallList", "Patient"), 120);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableRecallList", "Age"), 30);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableRecallList", "Interval"), 50);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableRecallList", "Contact"), 120);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableRecallList", "Status"), 130);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableRecallList", "Note"), 200);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(table.Rows[i]["dueDate"].ToString());
                row.Cells.Add(table.Rows[i]["patientName"].ToString());
                row.Cells.Add(table.Rows[i]["age"].ToString());
                row.Cells.Add(table.Rows[i]["recallInterval"].ToString());
                row.Cells.Add(table.Rows[i]["contactMethod"].ToString());
                row.Cells.Add(table.Rows[i]["status"].ToString());
                //DefB.GetName(DefCat.RecallUnschedStatus,RecallList[i].RecallStatus));
                row.Cells.Add(table.Rows[i]["Note"].ToString());
                row.Tag = table.Rows[i];              //although not used yet.
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
Пример #24
0
        ///<summary>Creates appointments for each patient in _famCur.  MsgBox informs user of anyone skipped.  StringDateJumpTo will contain the due date (of the last family member) to jump to.  ListAptNumsSelected will contain the AptNums of the new appointments on the pinboard.</summary>
        public void MakeRecallFamily()
        {
            List <Recall>  listPatRecalls;
            List <InsPlan> listInsPlans;
            List <InsSub>  listInsSubs;
            Appointment    apt = null;
            Recall         recall;
            int            countAlreadySched           = 0;
            int            countNoRecalls              = 0;
            int            countPatsRestricted         = 0;
            int            countPatsArchivedOrDeceased = 0;

            for (int i = 0; i < _famCur.ListPats.Length; i++)
            {
                Patient patCur = _famCur.ListPats[i];
                if (PatRestrictionL.IsRestricted(patCur.PatNum, PatRestrict.ApptSchedule, true))
                {
                    countPatsRestricted++;
                    continue;
                }
                if (patCur.PatStatus.In(PatientStatus.Archived, PatientStatus.Deceased))
                {
                    countPatsArchivedOrDeceased++;
                    continue;
                }
                listPatRecalls = Recalls.GetList(patCur.PatNum);              //get the recall for this pt
                //Check to see if the special type recall is disabled or already scheduled.  This is also done in AppointmentL.CreateRecallApt() below so I'm
                //	not sure why we do it here.
                List <Recall> listRecalls = listPatRecalls.FindAll(x => x.RecallTypeNum == RecallTypes.PerioType || x.RecallTypeNum == RecallTypes.ProphyType);
                if (listRecalls.Count == 0 || listRecalls.Exists(x => x.IsDisabled))
                {
                    countNoRecalls++;
                    continue;
                }
                if (listRecalls.Exists(x => x.DateScheduled.Year > 1880))
                {
                    countAlreadySched++;
                    continue;
                }
                listInsSubs  = InsSubs.RefreshForFam(_famCur);
                listInsPlans = InsPlans.RefreshForSubList(listInsSubs);
                try {
                    apt = AppointmentL.CreateRecallApt(patCur, listInsPlans, -1, listInsSubs);
                }
                catch (Exception ex) {
                    ex.DoNothing();
                    continue;
                }
                ListAptNumsSelected.Add(apt.AptNum);
                _otherResult = OtherResult.PinboardAndSearch;
                recall       = Recalls.GetRecallProphyOrPerio(patCur.PatNum);        //should not return null
                if (recall.DateDue < DateTime.Today)
                {
                    StringDateJumpTo = DateTime.Today.ToShortDateString();                  //they are overdue
                }
                else
                {
                    StringDateJumpTo = recall.DateDue.ToShortDateString();
                }
                //Log will be made when appointment dragged off of the pinboard.
                //SecurityLogs.MakeLogEntry(Permissions.AppointmentCreate,apt.PatNum,apt.AptDateTime.ToString(),apt.AptNum);
            }
            List <string> listUserMsgs = new List <string>();

            if (countPatsRestricted > 0)
            {
                listUserMsgs.Add(Lan.g(this, "Family members skipped due to patient restriction") + " "
                                 + PatRestrictions.GetPatRestrictDesc(PatRestrict.ApptSchedule) + ": " + countPatsRestricted + ".");
            }
            if (countNoRecalls > 0)
            {
                listUserMsgs.Add(Lan.g(this, "Family members skipped because recall disabled") + ": " + countNoRecalls + ".");
            }
            if (countAlreadySched > 0)
            {
                listUserMsgs.Add(Lan.g(this, "Family members skipped because already scheduled") + ": " + countAlreadySched + ".");
            }
            if (countPatsArchivedOrDeceased > 0)
            {
                listUserMsgs.Add(Lan.g(this, "Family members skipped because status is archived or deceased") + ": " + countPatsArchivedOrDeceased + ".");
            }
            if (ListAptNumsSelected.Count == 0)
            {
                listUserMsgs.Add(Lan.g(this, "There are no recall appointments to schedule."));
            }
            if (listUserMsgs.Count > 0)
            {
                MessageBox.Show(string.Join("\r\n", listUserMsgs));
                if (ListAptNumsSelected.Count == 0)
                {
                    return;
                }
            }
            DialogResult = DialogResult.OK;
        }
Пример #25
0
        ///<summary>Creates a single recall appointment. If it's from a double click, then it will end up on that spot in the Appts module.  If not, it will end up on the pinboard with StringDateJumpTo as due date to jump to.  ListAptNumsSelected will contain the AptNum of the new appointment.</summary>
        public void MakeRecallAppointment()
        {
            List <InsSub>  listInsSubs  = InsSubs.RefreshForFam(_famCur);
            List <InsPlan> listInsPlans = InsPlans.RefreshForSubList(listInsSubs);
            Appointment    apt          = null;
            DateTime       dateTimeApt  = DateTime.MinValue;

            if (this.IsInitialDoubleClick)
            {
                dateTimeApt = DateTimeClicked;
            }
            try{
                apt = AppointmentL.CreateRecallApt(_patCur, listInsPlans, -1, listInsSubs, dateTimeApt);
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
                return;
            }
            DateTime datePrevious = apt.DateTStamp;

            ListAptNumsSelected.Add(apt.AptNum);
            if (IsInitialDoubleClick)
            {
                Appointment oldApt = apt.Copy();
                if (_patCur.AskToArriveEarly > 0)
                {
                    apt.DateTimeAskedToArrive = apt.AptDateTime.AddMinutes(-_patCur.AskToArriveEarly);
                    MessageBox.Show(Lan.g(this, "Ask patient to arrive") + " " + _patCur.AskToArriveEarly
                                    + " " + Lan.g(this, "minutes early at") + " " + apt.DateTimeAskedToArrive.ToShortTimeString() + ".");
                }
                apt.AptStatus = ApptStatus.Scheduled;
                apt.ClinicNum = _patCur.ClinicNum;
                apt.Op        = OpNumClicked;
                apt           = Appointments.AssignFieldsForOperatory(apt);
                //Use apt.ClinicNum because it was just set based on Op.ClinicNum in AssignFieldsForOperatory().
                if (!AppointmentL.IsSpecialtyMismatchAllowed(_patCur.PatNum, apt.ClinicNum))
                {
                    return;
                }
                Appointments.Update(apt, oldApt);
                _otherResult = OtherResult.CreateNew;
                SecurityLogs.MakeLogEntry(Permissions.AppointmentCreate, apt.PatNum, apt.AptDateTime.ToString(), apt.AptNum, datePrevious);
                //If there is an existing HL7 def enabled, send a SIU message if there is an outbound SIU message defined
                if (HL7Defs.IsExistingHL7Enabled())
                {
                    //S12 - New Appt Booking event
                    MessageHL7 messageHL7 = MessageConstructor.GenerateSIU(_patCur, _famCur.GetPatient(_patCur.Guarantor), EventTypeHL7.S12, apt);
                    //Will be null if there is no outbound SIU message defined, so do nothing
                    if (messageHL7 != null)
                    {
                        HL7Msg hl7Msg = new HL7Msg();
                        hl7Msg.AptNum    = apt.AptNum;
                        hl7Msg.HL7Status = HL7MessageStatus.OutPending;                      //it will be marked outSent by the HL7 service.
                        hl7Msg.MsgText   = messageHL7.ToString();
                        hl7Msg.PatNum    = _patCur.PatNum;
                        HL7Msgs.Insert(hl7Msg);
#if DEBUG
                        MessageBox.Show(this, messageHL7.ToString());
#endif
                    }
                }
                DialogResult = DialogResult.OK;
                return;
            }
            //not initialClick
            _otherResult = OtherResult.PinboardAndSearch;
            Recall recall = Recalls.GetRecallProphyOrPerio(_patCur.PatNum);          //shouldn't return null.
            if (recall.DateDue < DateTime.Today)
            {
                StringDateJumpTo = DateTime.Today.ToShortDateString();              //they are overdue
            }
            else
            {
                StringDateJumpTo = recall.DateDue.ToShortDateString();
            }
            //no securitylog entry needed here.  That will happen when it's dragged off pinboard.
            DialogResult = DialogResult.OK;
        }
Пример #26
0
        ///<summary>Synchronizes all recall for one patient. If datePrevious has changed, then it completely deletes the old recall information and sets a new dateDueCalc and DatePrevious.  Also updates dateDue to match dateDueCalc if not disabled.  The supplied recall can be null if patient has no existing recall. Deletes or creates any recalls as necessary.</summary>
        public static void Synch(int patNum, Recall recall)
        {
            DateTime previousDate = GetPreviousDate(patNum);

            if (recall != null &&
                !recall.IsDisabled &&
                previousDate.Year > 1880 &&              //this protects recalls that were manually added as part of a conversion
                previousDate != recall.DatePrevious)                     //if datePrevious has changed, reset
            {
                recall.RecallStatus = 0;
                recall.Note         = "";
                recall.DateDue      = recall.DateDueCalc; //now it is allowed to be changed in the steps below
            }
            if (previousDate.Year < 1880)                 //if no previous date
            {
                if (recall == null)                       //no recall present
                //do nothing.
                {
                }
                else
                {
                    recall.DatePrevious = DateTime.MinValue;
                    if (recall.DateDue == recall.DateDueCalc)                  //user did not enter a DateDue
                    {
                        recall.DateDue = DateTime.MinValue;
                    }
                    recall.DateDueCalc = DateTime.MinValue;
                    Recalls.Update(recall);
                    if (Recalls.IsAllDefault(recall))                    //no useful info
                    {
                        Recalls.Delete(recall);
                        recall = null;
                    }
                }
            }
            else                    //if previous date is a valid date
            {
                if (recall == null) //no recall present
                {
                    recall                = new Recall();
                    recall.PatNum         = patNum;
                    recall.DatePrevious   = previousDate;
                    recall.RecallInterval = new Interval(0, 0, 6, 0);
                    recall.DateDueCalc    = previousDate + recall.RecallInterval;
                    recall.DateDue        = recall.DateDueCalc;
                    Recalls.Insert(recall);
                    return;
                }
                else
                {
                    recall.DatePrevious = previousDate;
                    if (recall.IsDisabled)                  //if the existing recall is disabled
                    {
                        recall.DateDue = DateTime.MinValue; //DateDue is always blank
                    }
                    else                                    //but if not disabled
                    {
                        if (recall.DateDue == recall.DateDueCalc ||                  //if user did not enter a DateDue
                            recall.DateDue.Year < 1880)                                   //or DateDue was blank
                        {
                            recall.DateDue = recall.DatePrevious + recall.RecallInterval; //set same as DateDueCalc
                        }
                    }
                    recall.DateDueCalc = recall.DatePrevious + recall.RecallInterval;
                    Recalls.Update(recall);
                }
            }
        }
Пример #27
0
        ///<summary>raised for each page to be printed.  One page per appointment.</summary>
        private void pd_PrintPage(object sender, PrintPageEventArgs ev)
        {
            if (ApptNum != 0)           //just for one appointment
            {
                date = Appointments.DateSelected;
            }
            Graphics   g = ev.Graphics;
            float      y = 50;
            float      x = 0;
            string     str;
            float      sizeW;       //used when measuring text for placement
            Font       fontTitle   = new Font(FontFamily.GenericSansSerif, 11, FontStyle.Bold);
            Font       fontHeading = new Font(FontFamily.GenericSansSerif, 9, FontStyle.Bold);
            Font       font        = new Font(FontFamily.GenericSansSerif, 8);
            SolidBrush brush       = new SolidBrush(Color.Black);

            //Title----------------------------------------------------------------------------------------------------------
            str   = Lan.g(this, "Routing Slip");
            sizeW = g.MeasureString(str, fontTitle).Width;
            x     = 425 - sizeW / 2;
            g.DrawString(str, fontTitle, brush, x, y);
            y += 35;
            x  = 75;
            //Today's appointment, including procedures-----------------------------------------------------------------------
            Family  fam = Patients.GetFamily(Appts[pagesPrinted].PatNum);
            Patient pat = fam.GetPatient(Appts[pagesPrinted].PatNum);

            str = pat.GetNameFL();
            g.DrawString(str, fontHeading, brush, x, y);
            y  += 18;
            str = Appts[pagesPrinted].AptDateTime.ToShortTimeString() + "  " + Appts[pagesPrinted].AptDateTime.ToShortDateString();
            g.DrawString(str, fontHeading, brush, x, y);
            y  += 18;
            str = (Appts[pagesPrinted].Pattern.Length * 5).ToString() + " " + Lan.g(this, "minutes");
            g.DrawString(str, font, brush, x, y);
            y  += 15;
            str = Providers.GetAbbr(Appts[pagesPrinted].ProvNum);
            g.DrawString(str, font, brush, x, y);
            y += 15;
            if (Appts[pagesPrinted].ProvHyg != 0)
            {
                str = Providers.GetAbbr(Appts[pagesPrinted].ProvHyg);
                g.DrawString(str, font, brush, x, y);
                y += 15;
            }
            str = Lan.g(this, "Procedures:");
            g.DrawString(str, font, brush, x, y);
            y += 15;
            Procedure[] procsAll = Procedures.Refresh(pat.PatNum);
            Procedure[] procsApt = Procedures.GetProcsOneApt(Appts[pagesPrinted].AptNum, procsAll);
            for (int i = 0; i < procsApt.Length; i++)
            {
                str = "   " + Procedures.GetDescription(procsApt[i]);
                g.DrawString(str, font, brush, x, y);
                y += 15;
            }
            str = Lan.g(this, "Note:") + " " + Appts[pagesPrinted].Note;
            g.DrawString(str, font, brush, x, y);
            y += 25;
            //Patient/Family Info---------------------------------------------------------------------------------------------
            g.DrawLine(Pens.Black, 75, y, 775, y);
            str = Lan.g(this, "Patient Info");
            g.DrawString(str, fontHeading, brush, x, y);
            y  += 18;
            str = Lan.g(this, "PatNum:") + " " + pat.PatNum.ToString();
            g.DrawString(str, font, brush, x, y);
            y  += 15;
            str = Lan.g(this, "Age:") + " ";
            if (pat.Age > 0)
            {
                str += pat.Age.ToString();
            }
            g.DrawString(str, font, brush, x, y);
            y  += 15;
            str = Lan.g(this, "Date of First Visit:") + " ";
            if (pat.DateFirstVisit.Year < 1880)
            {
                str += "?";
            }
            else if (pat.DateFirstVisit == Appts[pagesPrinted].AptDateTime.Date)
            {
                str += Lan.g(this, "New Patient");
            }
            else
            {
                str += pat.DateFirstVisit.ToShortDateString();
            }
            g.DrawString(str, font, brush, x, y);
            y  += 15;
            str = Lan.g(this, "Billing Type:") + " " + DefB.GetName(DefCat.BillingTypes, pat.BillingType);
            g.DrawString(str, font, brush, x, y);
            y += 15;
            Recall[] recallList = Recalls.GetList(new int[] { pat.PatNum });
            str = Lan.g(this, "Recall Due Date:") + " ";
            if (recallList.Length > 0)
            {
                str += recallList[0].DateDue.ToShortDateString();
            }
            g.DrawString(str, font, brush, x, y);
            y  += 15;
            str = Lan.g(this, "Medical notes:") + " " + pat.MedUrgNote;
            g.DrawString(str, font, brush, x, y);
            y += 25;
            //Other Family Members
            str = Lan.g(this, "Other Family Members");
            g.DrawString(str, fontHeading, brush, x, y);
            y += 18;
            for (int i = 0; i < fam.List.Length; i++)
            {
                if (fam.List[i].PatNum == pat.PatNum)
                {
                    continue;
                }
                str = fam.List[i].GetNameFL();
                if (fam.List[i].Age > 0)
                {
                    str += ",   " + fam.List[i].Age.ToString();
                }
                g.DrawString(str, font, brush, x, y);
                y += 15;
            }
            y += 10;
            //Insurance Info--------------------------------------------------------------------------------------------------
            g.DrawLine(Pens.Black, 75, y, 775, y);
            str = Lan.g(this, "Insurance");
            g.DrawString(str, fontHeading, brush, x, y);
            y += 18;
            PatPlan[]   patPlanList   = PatPlans.Refresh(pat.PatNum);
            InsPlan[]   plans         = InsPlans.Refresh(fam);
            ClaimProc[] claimProcList = ClaimProcs.Refresh(pat.PatNum);
            Benefit[]   benefits      = Benefits.Refresh(patPlanList);
            InsPlan     plan;
            Carrier     carrier;
            string      subscriber;
            double      max;
            double      deduct;

            if (patPlanList.Length == 0)
            {
                str = Lan.g(this, "none");
                g.DrawString(str, font, brush, x, y);
                y += 15;
            }
            for (int i = 0; i < patPlanList.Length; i++)
            {
                plan    = InsPlans.GetPlan(patPlanList[i].PlanNum, plans);
                carrier = Carriers.GetCarrier(plan.CarrierNum);
                str     = carrier.CarrierName;
                g.DrawString(str, fontHeading, brush, x, y);
                y         += 18;
                subscriber = fam.GetNameInFamFL(plan.Subscriber);
                if (subscriber == "")               //subscriber from another family
                {
                    subscriber = Patients.GetLim(plan.Subscriber).GetNameLF();
                }
                str = Lan.g(this, "Subscriber:") + " " + subscriber;
                g.DrawString(str, font, brush, x, y);
                y += 15;
                bool isFamMax = Benefits.GetIsFamMax(benefits, plan.PlanNum);
                str = "";
                if (isFamMax)
                {
                    str += Lan.g(this, "Family ");
                }
                str += Lan.g(this, "Annual Max:") + " ";
                max  = Benefits.GetAnnualMax(benefits, plan.PlanNum, patPlanList[i].PatPlanNum);
                if (max != -1)
                {
                    str += max.ToString("n0") + " ";
                }
                str += "   ";
                bool isFamDed = Benefits.GetIsFamDed(benefits, plan.PlanNum);
                if (isFamDed)
                {
                    str += Lan.g(this, "Family ");
                }
                str   += Lan.g(this, "Deductible:") + " ";
                deduct = Benefits.GetDeductible(benefits, plan.PlanNum, patPlanList[i].PatPlanNum);
                if (deduct != -1)
                {
                    str += deduct.ToString("n0");
                }
                g.DrawString(str, font, brush, x, y);
                y  += 15;
                str = "";
                for (int j = 0; j < benefits.Length; j++)
                {
                    if (benefits[j].PlanNum != plan.PlanNum)
                    {
                        continue;
                    }
                    if (benefits[j].BenefitType != InsBenefitType.Percentage)
                    {
                        continue;
                    }
                    if (str != "")
                    {
                        str += ",  ";
                    }
                    str += CovCats.GetDesc(benefits[j].CovCatNum) + " " + benefits[j].Percent.ToString() + "%";
                }
                if (str != "")
                {
                    g.DrawString(str, font, brush, x, y);
                    y += 15;
                }
                double pend = 0;
                double used = 0;
                if (isFamMax || isFamDed)
                {
                    ClaimProc[] claimProcsFam = ClaimProcs.RefreshFam(plan.PlanNum);
                    used = InsPlans.GetInsUsed(claimProcsFam, date, plan.PlanNum, patPlanList[i].PatPlanNum, -1, plans, benefits);
                    pend = InsPlans.GetPending(claimProcsFam, date, plan, patPlanList[i].PatPlanNum, -1, benefits);
                }
                else
                {
                    used = InsPlans.GetInsUsed(claimProcList, date, plan.PlanNum, patPlanList[i].PatPlanNum, -1, plans, benefits);
                    pend = InsPlans.GetPending(claimProcList, date, plan, patPlanList[i].PatPlanNum, -1, benefits);
                }
                str = Lan.g(this, "Ins Used:") + " " + used.ToString("n");
                g.DrawString(str, font, brush, x, y);
                y  += 15;
                str = Lan.g(this, "Ins Pending:") + " " + pend.ToString("n");
                g.DrawString(str, font, brush, x, y);
                y += 15;
            }
            y += 10;
            //Account Info---------------------------------------------------------------------------------------------------
            g.DrawLine(Pens.Black, 75, y, 775, y);
            str = Lan.g(this, "Account Info");
            g.DrawString(str, fontHeading, brush, x, y);
            y  += 18;
            str = Lan.g(this, "Guarantor:") + " " + fam.List[0].GetNameFL();
            g.DrawString(str, font, brush, x, y);
            y  += 15;
            str = Lan.g(this, "Balance:") + (fam.List[0].BalTotal - fam.List[0].InsEst).ToString("c");
            if (fam.List[0].InsEst > .01)
            {
                str += "  (" + fam.List[0].BalTotal.ToString("c") + " - "
                       + fam.List[0].InsEst.ToString("c") + " " + Lan.g(this, "InsEst") + ")";
            }
            g.DrawString(str, font, brush, x, y);
            y  += 15;
            str = Lan.g(this, "Aging:")
                  + "  0-30:" + fam.List[0].Bal_0_30.ToString("c")
                  + "  31-60:" + fam.List[0].Bal_31_60.ToString("c")
                  + "  61-90:" + fam.List[0].Bal_61_90.ToString("c")
                  + "  90+:" + fam.List[0].BalOver90.ToString("c");
            g.DrawString(str, font, brush, x, y);
            y  += 15;
            str = Lan.g(this, "Fam Urgent Fin Note:")
                  + fam.List[0].FamFinUrgNote;
            g.DrawString(str, font, brush, x, y);
            y += 15;
            y += 10;
            //Treatment Plan--------------------------------------------------------------------------------------------------
            g.DrawLine(Pens.Black, 75, y, 775, y);
            str = Lan.g(this, "Treatment Plan");
            g.DrawString(str, fontHeading, brush, x, y);
            y += 18;
            for (int i = 0; i < procsAll.Length; i++)
            {
                if (procsAll[i].ProcStatus != ProcStat.TP)
                {
                    continue;
                }
                str = Procedures.GetDescription(procsAll[i]);
                g.DrawString(str, font, brush, x, y);
                y += 15;
            }
            pagesPrinted++;
            if (pagesPrinted == Appts.Length)
            {
                ev.HasMorePages = false;
                pagesPrinted    = 0;
            }
            else
            {
                ev.HasMorePages = true;
            }
        }
Пример #28
0
        private void FillFamily()
        {
            PatNumSelected = _patCur.PatNum;          //just in case user has selected a different family member
            _listRecalls   = Recalls.GetList(_famCur.ListPats.ToList());
            //Appointment[] aptsOnePat;
            List <PatientLink> listLinks = PatientLinks.GetLinks(_famCur.ListPats.Select(x => x.PatNum).ToList(), PatientLinkType.Merge);

            listViewFamily.Items.Clear();
            ListViewItem item;
            DateTime     dateDue;
            DateTime     dateSched;

            for (int i = 0; i < _famCur.ListPats.Length; i++)
            {
                if (PatientLinks.WasPatientMerged(_famCur.ListPats[i].PatNum, listLinks))
                {
                    continue;                    //Do not include Merged patients in the displayed list.
                }
                item     = new ListViewItem(_famCur.GetNameInFamFLI(i));
                item.Tag = _famCur.ListPats[i];
                if (_famCur.ListPats[i].PatNum == _patCur.PatNum)
                {
                    item.BackColor = Color.Silver;
                }
                item.SubItems.Add(_famCur.ListPats[i].Age.ToString());
                item.SubItems.Add(_famCur.ListPats[i].Gender.ToString());
                dateDue   = DateTime.MinValue;
                dateSched = DateTime.MinValue;
                bool isdisabled = false;
                for (int j = 0; j < _listRecalls.Count; j++)
                {
                    if (_listRecalls[j].PatNum == _famCur.ListPats[i].PatNum &&
                        (_listRecalls[j].RecallTypeNum == RecallTypes.PerioType ||
                         _listRecalls[j].RecallTypeNum == RecallTypes.ProphyType))
                    {
                        dateDue    = _listRecalls[j].DateDue;
                        dateSched  = _listRecalls[j].DateScheduled;
                        isdisabled = _listRecalls[j].IsDisabled;
                    }
                }
                if (isdisabled)
                {
                    item.SubItems.Add(Lan.g(this, "disabled"));
                }
                else if (dateDue.Year < 1880)
                {
                    item.SubItems.Add("");
                }
                else
                {
                    item.SubItems.Add(dateDue.ToShortDateString());
                }
                if (dateDue <= DateTime.Today)
                {
                    item.ForeColor = Color.Red;
                }
                if (dateSched.Year < 1880)
                {
                    item.SubItems.Add("");
                }
                else
                {
                    item.SubItems.Add(dateSched.ToShortDateString());
                }
                listViewFamily.Items.Add(item);
            }
            checkDone.Checked = _patCur.PlannedIsDone;
            textFinUrg.Text   = _famCur.ListPats[0].FamFinUrgNote;
        }