示例#1
0
 public override bool TryGetModelFromView(out CommItemModel model)
 {
     model = null;
     _model.CommlogCur.DateTimeEnd  = PIn.DateT(textDateTimeEnd.Text);
     _model.CommlogCur.CommDateTime = PIn.DateT(textDateTime.Text);
     //there may not be a commtype selected.
     if (listType.SelectedIndex == -1)
     {
         _model.CommlogCur.CommType = 0;
     }
     else
     {
         _model.CommlogCur.CommType = _model.ListCommlogTypeDefs[listType.SelectedIndex].DefNum;
     }
     _model.CommlogCur.Mode_          = (CommItemMode)listMode.SelectedIndex;
     _model.CommlogCur.SentOrReceived = (CommSentOrReceived)listSentOrReceived.SelectedIndex;
     _model.CommlogCur.Note           = textNote.Text;
     try {
         if (_sigChanged)
         {
             string keyData = GetSignatureKey();
             _model.CommlogCur.Signature  = signatureBoxWrapper.GetSignature(keyData);
             _model.CommlogCur.SigIsTopaz = signatureBoxWrapper.GetSigIsTopaz();
         }
     }
     catch (Exception) {
         return(false);
     }
     model = _model.Copy();
     return(true);
 }
示例#2
0
 private bool SyncCommlogWithUI(bool showMsg)
 {
     if (!IsValid(showMsg))
     {
         return(false);
     }
     _commlogCur.DateTimeEnd  = PIn.DateT(textDateTimeEnd.Text);
     _commlogCur.CommDateTime = PIn.DateT(textDateTime.Text);
     //there may not be a commtype selected.
     if (listType.SelectedIndex == -1)
     {
         _commlogCur.CommType = 0;
     }
     else
     {
         _commlogCur.CommType = _listCommlogTypeDefs[listType.SelectedIndex].DefNum;
     }
     _commlogCur.Mode_          = (CommItemMode)listMode.SelectedIndex;
     _commlogCur.SentOrReceived = (CommSentOrReceived)listSentOrReceived.SelectedIndex;
     _commlogCur.Note           = textNote.Text;
     try {
         if (_sigChanged)
         {
             string keyData = GetSignatureKey();
             _commlogCur.Signature  = signatureBoxWrapper.GetSignature(keyData);
             _commlogCur.SigIsTopaz = signatureBoxWrapper.GetSigIsTopaz();
         }
     }
     catch (Exception) {
         //Currently the only way for this method to fail is when saving the signature.
         MsgBox.Show(this, "Error saving signature.");
         return(false);
     }
     return(true);
 }
示例#3
0
        private void butOK_Click(object sender, EventArgs e)
        {
            bool changed = false;

            if (!ValidEntries())
            {
                return;
            }
            if (PIn.DateT(textStartTime.Text).Hour != PrefC.GetDateT(PrefName.ApptPrintTimeStart).Hour ||
                PIn.DateT(textStopTime.Text).Hour != PrefC.GetDateT(PrefName.ApptPrintTimeStop).Hour ||
                textFontSize.Text != PrefC.GetString(PrefName.ApptPrintFontSize) ||
                textColumnsPerPage.Text != PrefC.GetInt(PrefName.ApptPrintColumnsPerPage).ToString())
            {
                changed = true;
            }
            if (changed)
            {
                if (MsgBox.Show(this, MsgBoxButtons.YesNo, "Save the changes that were made?"))
                {
                    SaveChanges(true);
                }
            }
            ApptPrintStartTime   = PIn.DateT(textStartTime.Text);
            ApptPrintStopTime    = PIn.DateT(textStopTime.Text);
            ApptPrintFontSize    = PIn.Int(textFontSize.Text);
            ApptPrintColsPerPage = PIn.Int(textColumnsPerPage.Text);
            DialogResult         = DialogResult.OK;
        }
        private void butAssessed_Click(object sender, EventArgs e)
        {
            if (comboSmokeStatus.SelectedIndex == 0)           //None
            {
                MessageBox.Show("You must select a smoking status.");
                return;
            }
            DateTime dateTEntered = PIn.DateT(textDateAssessed.Text);

            for (int i = 0; i < _ListEvents.Count; i++)
            {
                if (_ListEvents[i].DateTEvent.Date == dateTEntered.Date)
                {
                    MessageBox.Show("A Tobacco Assessment entry already exists with the selected date.");
                    return;
                }
            }
            EhrMeasureEvent meas = new EhrMeasureEvent();

            meas.DateTEvent       = dateTEntered;
            meas.EventType        = EhrMeasureEventType.TobaccoUseAssessed;
            meas.PatNum           = PatCur.PatNum;
            meas.CodeValueEvent   = _ListAssessmentCodes[comboAssessmentType.SelectedIndex].CodeValue;
            meas.CodeSystemEvent  = _ListAssessmentCodes[comboAssessmentType.SelectedIndex].CodeSystem;
            meas.CodeValueResult  = _TobaccoCodeSelected;
            meas.CodeSystemResult = "SNOMEDCT";          //only allow SNOMEDCT codes for now.
            meas.MoreInfo         = "";
            EhrMeasureEvents.Insert(meas);
            FillGrid();
        }
        private void comboSmokeStatus_SelectionChangeCommitted(object sender, EventArgs e)
        {
            if (comboSmokeStatus.SelectedIndex < 1)           //If None or text set to other selected Snomed code so -1, do not create an event
            {
                return;
            }
            //Insert measure event if one does not already exist for this date
            DateTime        dateTEntered = PIn.DateT(textDateAssessed.Text);   //will be set to DateTime.Now when form loads
            EhrMeasureEvent eventCur;

            foreach (ODGridRow row in gridAssessments.Rows)
            {
                eventCur = (EhrMeasureEvent)row.Tag;
                if (eventCur.DateTEvent.Date == dateTEntered.Date)               //one already exists for this date, don't auto insert event
                {
                    return;
                }
            }
            //no entry for the date entered, so insert one
            eventCur                 = new EhrMeasureEvent();
            eventCur.DateTEvent      = dateTEntered;
            eventCur.EventType       = EhrMeasureEventType.TobaccoUseAssessed;
            eventCur.PatNum          = PatCur.PatNum;
            eventCur.CodeValueEvent  = _listAssessmentCodes[comboAssessmentType.SelectedIndex].CodeValue;
            eventCur.CodeSystemEvent = _listAssessmentCodes[comboAssessmentType.SelectedIndex].CodeSystem;
            //SelectedIndex guaranteed to be greater than 0
            eventCur.CodeValueResult  = ((SmokingSnoMed)comboSmokeStatus.SelectedIndex - 1).ToString().Substring(1);
            eventCur.CodeSystemResult = "SNOMEDCT";          //only allow SNOMEDCT codes for now.
            eventCur.MoreInfo         = "";
            EhrMeasureEvents.Insert(eventCur);
            FillGridAssessments();
        }
        private void comboSmokeStatus_SelectionChangeCommitted(object sender, EventArgs e)
        {
            if (comboSmokeStatus.SelectedIndex <= 0)           //If None or text set to other selected Snomed code so -1, do not create an event
            {
                return;
            }
            //SelectedIndex guaranteed to be greater than 0
            _TobaccoCodeSelected = ((SmokingSnoMed)comboSmokeStatus.SelectedIndex - 1).ToString().Substring(1);
            DateTime dateTEntered = PIn.DateT(textDateAssessed.Text);          //will be set to DateTime.Now when form loads

            //Automatically make an entry
            for (int i = 0; i < _ListEvents.Count; i++)
            {
                if (_ListEvents[i].DateTEvent.Date == dateTEntered.Date)
                {
                    return;                    //if assessment already exists for date set, do not auto insert
                }
            }
            //an entry for the date entered does not yet exist
            EhrMeasureEvent meas = new EhrMeasureEvent();

            meas.DateTEvent       = dateTEntered;
            meas.EventType        = EhrMeasureEventType.TobaccoUseAssessed;
            meas.PatNum           = PatCur.PatNum;
            meas.CodeValueEvent   = _ListAssessmentCodes[comboAssessmentType.SelectedIndex].CodeValue;
            meas.CodeSystemEvent  = _ListAssessmentCodes[comboAssessmentType.SelectedIndex].CodeSystem;
            meas.CodeValueResult  = _TobaccoCodeSelected;
            meas.CodeSystemResult = "SNOMEDCT";          //only allow SNOMEDCT codes for now.
            meas.MoreInfo         = "";
            EhrMeasureEvents.Insert(meas);
            FillGrid();
        }
        private void FillGrid()
        {
            if (comboType.SelectedIndex == 0)
            {
                _listEhrMeasureEvents = EhrMeasureEvents.GetAllByTypeFromDB(PIn.DateT(textDateStart.Text), PIn.DateT(textDateEnd.Text), (EhrMeasureEventType)comboType.SelectedIndex, true);
            }
            else
            {
                _listEhrMeasureEvents = EhrMeasureEvents.GetAllByTypeFromDB(PIn.DateT(textDateStart.Text), PIn.DateT(textDateEnd.Text), (EhrMeasureEventType)comboType.SelectedIndex - 1, false);
            }
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g("TableProviders", "Event Type"), 140);

            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableProviders", "Date"), 80);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableProviders", "PatNum"), 60);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableProviders", "More Info"), 160);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < _listEhrMeasureEvents.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(_typeNames[(int)_listEhrMeasureEvents[i].EventType]);
                row.Cells.Add(_listEhrMeasureEvents[i].DateTEvent.ToShortDateString());
                row.Cells.Add(_listEhrMeasureEvents[i].PatNum.ToString());
                row.Cells.Add(_listEhrMeasureEvents[i].MoreInfo);
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
        private bool PrintViewSetup()
        {
            bool changed = false;

            if (!ValidEntries())
            {
                return(false);
            }
            if (PIn.DateT(comboStart.SelectedItem.ToString()).Hour != PrefC.GetDateT(PrefName.ApptPrintTimeStart).Hour ||
                PIn.DateT(comboStop.SelectedItem.ToString()).Hour != PrefC.GetDateT(PrefName.ApptPrintTimeStop).Hour ||
                textFontSize.Text != PrefC.GetString(PrefName.ApptPrintFontSize) ||
                textColumnsPerPage.Text != PrefC.GetInt(PrefName.ApptPrintColumnsPerPage).ToString())
            {
                changed = true;
            }
            if (changed)
            {
                if (MsgBox.Show(this, MsgBoxButtons.YesNo, "Save the changes that were made?"))
                {
                    SaveChanges(true);
                }
            }
            ApptPrintStartTime   = PIn.DateT(comboStart.SelectedItem.ToString());
            ApptPrintStopTime    = PIn.DateT(comboStop.SelectedItem.ToString());
            ApptPrintFontSize    = PIn.Int(textFontSize.Text);
            ApptPrintColsPerPage = PIn.Int(textColumnsPerPage.Text);
            return(true);
        }
        private void FillGrid()
        {
            gridMain.BeginUpdate();
            gridMain.ListGridColumns.Clear();
            GridColumn col = new GridColumn(Lan.g("TableInvoiceItems", "Date"), 70);

            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableInvoiceItems", "PatName"), 100);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableInvoiceItems", "Prov"), 55);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableInvoiceItems", "Code"), 55);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableInvoiceItems", "Tooth"), 50);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableInvoiceItems", "Description"), 150);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableInvoiceItems", "Fee"), 60, HorizontalAlignment.Right);
            gridMain.ListGridColumns.Add(col);
            gridMain.ListGridRows.Clear();
            GridRow row;
            List <ProcedureCode> listProcCodes = ProcedureCodes.GetAllCodes();

            foreach (DataRow tableRow in _tableSuperFamAcct.Rows)
            {
                row = new GridRow();
                row.Cells.Add(PIn.DateT(tableRow["Date"].ToString()).ToShortDateString());
                row.Cells.Add(tableRow["PatName"].ToString());
                row.Cells.Add(Providers.GetAbbr(PIn.Long(tableRow["Prov"].ToString())));
                if (!string.IsNullOrWhiteSpace(tableRow["AdjType"].ToString()))                             //It's an adjustment
                {
                    row.Cells.Add(Lan.g(this, "Adjust"));                                                   //Adjustment
                    row.Cells.Add(Tooth.ToInternat(tableRow["Tooth"].ToString()));
                    row.Cells.Add(Defs.GetName(DefCat.AdjTypes, PIn.Long(tableRow["AdjType"].ToString()))); //Adjustment type
                }
                else if (!string.IsNullOrWhiteSpace(tableRow["ChargeType"].ToString()))                     //It's a payplan charge
                {
                    if (PrefC.GetInt(PrefName.PayPlansVersion) != (int)PayPlanVersions.AgeCreditsAndDebits)
                    {
                        continue;                        //They can only attach debits to invoices and they can only do so if they're on version 2.
                    }
                    row.Cells.Add(Lan.g(this, "Pay Plan"));
                    row.Cells.Add(Tooth.ToInternat(tableRow["Tooth"].ToString()));
                    row.Cells.Add(PIn.Enum <PayPlanChargeType>(PIn.Int(tableRow["ChargeType"].ToString())).GetDescription()); //Pay Plan charge type
                }
                else                                                                                                          //It's a procedure
                {
                    ProcedureCode procCode = ProcedureCodes.GetProcCode(PIn.Long(tableRow["Code"].ToString()), listProcCodes);
                    row.Cells.Add(procCode.ProcCode);
                    row.Cells.Add(Tooth.ToInternat(tableRow["Tooth"].ToString()));
                    row.Cells.Add(procCode.Descript);
                }
                row.Cells.Add(PIn.Double(tableRow["Amount"].ToString()).ToString("F"));
                row.Tag = tableRow;
                gridMain.ListGridRows.Add(row);
            }
            gridMain.EndUpdate();
        }
示例#10
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     //button not enabled if no permission
     if (textDateTime.Text == "")
     {
         MsgBox.Show(this, "Please enter a date first.");
         return;
     }
     try{
         DateTime.Parse(textDateTime.Text);
     }
     catch {
         MsgBox.Show(this, "Date / Time invalid.");
         return;
     }
     if (textDateTimeEnd.Text != "")
     {
         try {
             DateTime.Parse(textDateTimeEnd.Text);
         }
         catch {
             MsgBox.Show(this, "End date and time invalid.");
             return;
         }
         CommlogCur.DateTimeEnd = PIn.DateT(textDateTimeEnd.Text);
     }
     CommlogCur.CommDateTime = PIn.DateT(textDateTime.Text);
     //there may not be a commtype selected.
     if (listType.SelectedIndex == -1)
     {
         CommlogCur.CommType = 0;
     }
     else
     {
         CommlogCur.CommType = DefC.Short[(int)DefCat.CommLogTypes][listType.SelectedIndex].DefNum;
     }
     CommlogCur.Mode_          = (CommItemMode)listMode.SelectedIndex;
     CommlogCur.SentOrReceived = (CommSentOrReceived)listSentOrReceived.SelectedIndex;
     CommlogCur.Note           = textNote.Text;
     try {
         SaveSignature();
     }
     catch (Exception ex) {
         MessageBox.Show(Lan.g(this, "Error saving signature.") + "\r\n" + ex.Message);
         return;
     }
     if (IsNew)
     {
         Commlogs.Insert(CommlogCur);
         SecurityLogs.MakeLogEntry(Permissions.CommlogEdit, CommlogCur.PatNum, "Insert");
     }
     else
     {
         Commlogs.Update(CommlogCur);
         SecurityLogs.MakeLogEntry(Permissions.CommlogEdit, CommlogCur.PatNum, "");
     }
     DialogResult = DialogResult.OK;
 }
 private void ConstructListFromTable()
 {
     foreach (DataRow tableRow in _tableAccount.Rows)
     {
         LimitedRow row = new LimitedRow();
         row.PatNum      = PIn.Long(tableRow["PatNum"].ToString());
         row.PatientName = tableRow["patient"].ToString();
         row.DateTime    = PIn.DateT(tableRow["DateTime"].ToString());
         row.Description = tableRow["description"].ToString();
         row.ProcCode    = tableRow["ProcCode"].ToString();           //isn't just a proc code. Can be "Claim" etc...
         row.Charges     = tableRow["charges"].ToString();
         row.Credits     = tableRow["credits"].ToString();
         row.ProvName    = tableRow["prov"].ToString();
         row.Tooth       = Tooth.ToInternat(tableRow["ToothNum"].ToString());
         row.ColorText   = Color.FromArgb(PIn.Int(tableRow["colorText"].ToString()));
         if (PrefC.HasClinicsEnabled)
         {
             row.ClinicNum = PIn.Long(tableRow["ClinicNum"].ToString());
         }
         if (tableRow["AdjNum"].ToString() != "0")
         {
             row.PrimaryKey = PIn.Long(tableRow["AdjNum"].ToString());
             row.Type       = AccountEntryType.Adjustment;
         }
         else if (tableRow["ProcNum"].ToString() != "0")
         {
             row.PrimaryKey = PIn.Long(tableRow["ProcNum"].ToString());
             row.Type       = AccountEntryType.Procedure;
         }
         else if (tableRow["PayNum"].ToString() != "0")
         {
             row.PrimaryKey = PIn.Long(tableRow["PayNum"].ToString());
             row.Type       = AccountEntryType.Payment;
         }
         else if (tableRow["ClaimNum"].ToString() != "0")
         {
             //can mean that this is either a claim or a claim payment.
             //we really only care about claim payments, but we need procedure from the claim.
             row.PrimaryKey = PIn.Long(tableRow["ClaimNum"].ToString());
             row.Type       = AccountEntryType.Claim;
             if (tableRow["ClaimPaymentNum"].ToString() == "1")
             {
                 row.Type = AccountEntryType.ClaimPayment;
             }
         }
         else
         {
             //type is not one that is currently supported, skip it.
             continue;
         }
         row.ListProcsOnObject = tableRow["procsOnObj"].ToString().Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(x => PIn.Long(x)).ToList();
         row.ListAdjustsOnObj  = tableRow["adjustsOnObj"].ToString().Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(x => PIn.Long(x)).ToList();
         row.ListPaymentsOnObj = tableRow["paymentsOnObj"].ToString().Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(x => PIn.Long(x)).ToList();
         row.ProcNumLab        = PIn.Long(tableRow["ProcNumLab"].ToString());
         _listLimitedRows.Add(row);
     }
 }
示例#12
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     //the first 6 fields are handled when the ScreenGroup is saved.
     if (!_isValid)             //If validation failed and they still want to continue, do Cancel instead.
     {
         DialogResult = DialogResult.Cancel;
         return;
     }
     ScreenCur.ScreenGroupOrder = PIn.Int(textScreenGroupOrder.Text);
     ScreenCur.ScreenGroupNum   = ScreenGroupCur.ScreenGroupNum;
     if (radioUnknown.Checked)
     {
         ScreenCur.Gender = PatientGender.Unknown;
     }
     else if (radioM.Checked)
     {
         ScreenCur.Gender = PatientGender.Male;
     }
     else if (radioF.Checked)
     {
         ScreenCur.Gender = PatientGender.Female;
     }
     ScreenCur.RaceOld    = (PatientRaceOld)listRace.SelectedIndex;
     ScreenCur.GradeLevel = (PatientGrade)comboGradeLevel.SelectedIndex;
     if (textBirthdate.Text != "" && textAge.Text == "")         //Birthdate is present but age isn't entered, calculate it.
     {
         ScreenCur.Age = PIn.Byte(Patients.DateToAge(PIn.DateT(textBirthdate.Text)).ToString());
     }
     else if (textAge.Text != "")           //Age was manually entered, use it.
     {
         ScreenCur.Age = PIn.Byte(textAge.Text);
     }
     else              //No age information was entered at all.
     {
         ScreenCur.Age = 0;
     }
     ScreenCur.Urgency          = (TreatmentUrgency)listUrgency.SelectedIndex;
     ScreenCur.HasCaries        = GetCheckState(checkHasCaries);
     ScreenCur.NeedsSealants    = GetCheckState(checkNeedsSealants);
     ScreenCur.CariesExperience = GetCheckState(checkCariesExperience);
     ScreenCur.EarlyChildCaries = GetCheckState(checkEarlyChildCaries);
     ScreenCur.ExistingSealants = GetCheckState(checkExistingSealants);
     ScreenCur.MissingAllTeeth  = GetCheckState(checkMissingAllTeeth);
     ScreenCur.Birthdate        = PIn.Date(textBirthdate.Text);   //"" is OK
     ScreenCur.Comments         = textComments.Text;
     if (IsNew)
     {
         Screens.Insert(ScreenCur);
     }
     else
     {
         Screens.Update(ScreenCur);
     }
     DialogResult = DialogResult.OK;
 }
        private void butOK_Click(object sender, EventArgs e)
        {
            //inserts never happen here.  Only updates.
            DateTime dateTEvent = PIn.DateT(textDateTime.Text);

            if (dateTEvent == DateTime.MinValue)
            {
                MsgBox.Show(this, "Please enter a valid date time.");               //because this must always be valid
                return;
            }
            if (textTobaccoStartDate.Visible &&         //only visible for tobacco use assessments
                textTobaccoStartDate.errorProvider1.GetError(textTobaccoStartDate) != "")
            {
                MsgBox.Show(this, "Please fix data entry errors first.");
                return;
            }
            if (textTobaccoDesireToQuit.Visible &&         //only visible for tobacco use assessments
                textTobaccoDesireToQuit.errorProvider1.GetError(textTobaccoDesireToQuit) != "")
            {
                MsgBox.Show(this, "Please fix data entry errors first.");
                return;
            }
            List <string> listLogEdits = new List <string>();

            if (_measureEventCur.MoreInfo != textMoreInfo.Text)
            {
                listLogEdits.Add(Lan.g(this, "More Info was changed."));
                _measureEventCur.MoreInfo = textMoreInfo.Text;
            }
            if (_measureEventCur.DateTEvent != dateTEvent)
            {
                listLogEdits.Add(Lan.g(this, "Date was changed from") + ": " + _measureEventCur.DateTEvent.ToString() + " " + Lan.g(this, "to") + ": " + dateTEvent.ToString() + ".");
                _measureEventCur.DateTEvent = dateTEvent;
            }
            if (textTobaccoStartDate.Visible && textTobaccoDesireToQuit.Visible)
            {
                _measureEventCur.DateStartTobacco       = PIn.Date(textTobaccoStartDate.Text);
                _measureEventCur.TobaccoCessationDesire = PIn.Byte(textTobaccoDesireToQuit.Text);
            }
            if (listLogEdits.Count > 0)
            {
                listLogEdits.Insert(0, Lan.g(this, "EHR Measure Event was edited."));
                SecurityLogs.MakeLogEntry(Permissions.EhrMeasureEventEdit, _measureEventCur.PatNum, string.Join("  ", listLogEdits));
            }
            if (_measureEventCur.IsNew)             //should never happen, only updates happen here
            {
                EhrMeasureEvents.Insert(_measureEventCur);
            }
            else
            {
                EhrMeasureEvents.Update(_measureEventCur);
            }
            DialogResult = DialogResult.OK;
        }
示例#14
0
 private void SaveChanges(bool suppressMessage)
 {
     if (ValidEntries())
     {
         Prefs.UpdateDateT(PrefName.ApptPrintTimeStart, PIn.DateT(textStartTime.Text));
         Prefs.UpdateDateT(PrefName.ApptPrintTimeStop, PIn.DateT(textStopTime.Text));
         Prefs.UpdateString(PrefName.ApptPrintFontSize, textFontSize.Text);
         Prefs.UpdateInt(PrefName.ApptPrintColumnsPerPage, PIn.Int(textColumnsPerPage.Text));
         if (!suppressMessage)
         {
             MsgBox.Show(this, "Settings saved.");
         }
     }
 }
        private void butDelete_Click(object sender, EventArgs e)
        {
            if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Delete?"))
            {
                return;
            }
            string logEntry = Lan.g(this, "Ehr Measure Event was deleted.") + "  "
                              + Lan.g(this, "Date") + ": " + PIn.DateT(textDateTime.Text) + "  "
                              + Lan.g(this, "Type") + ": " + _measureEventCur.EventType.ToString() + "  "
                              + Lan.g(this, "Patient") + ": " + textPatient.Text;

            SecurityLogs.MakeLogEntry(Permissions.EhrMeasureEventEdit, _measureEventCur.PatNum, logEntry);
            EhrMeasureEvents.Delete(_measureEventCur.EhrMeasureEventNum);
            DialogResult = DialogResult.Cancel;
        }
示例#16
0
        private bool ValidEntries()
        {
            DateTime start = PIn.DateT(comboStart.SelectedItem.ToString());
            DateTime stop  = PIn.DateT(comboStop.SelectedItem.ToString());

            if (start.Minute > 0 || stop.Minute > 0)
            {
                MsgBox.Show(this, "Please use hours only, no minutes.");
                return(false);
            }
            //If stop time is the same as start time and not midnight to midnight.
            if (stop.Hour == start.Hour && (stop.Hour != 0 && start.Hour != 0))
            {
                MsgBox.Show(this, "Start time must be different than stop time.");
                return(false);
            }
            if (stop.Hour != 0 && stop.Hour < start.Hour)         //If stop time is earlier than start time.
            {
                MsgBox.Show(this, "Start time cannot exceed stop time.");
                return(false);
            }
            if (start == DateTime.MinValue)
            {
                MsgBox.Show(this, "Please enter a valid start time.");
                return(false);
            }
            if (stop == DateTime.MinValue)
            {
                MsgBox.Show(this, "Please enter a valid stop time.");
                return(false);
            }
            if (textColumnsPerPage.errorProvider1.GetError(textColumnsPerPage) != "" ||
                textFontSize.errorProvider1.GetError(textFontSize) != "")
            {
                MsgBox.Show(this, "Please fix data entry errors first.");
                return(false);
            }
            if (PIn.Int(textColumnsPerPage.Text) < 1)
            {
                MsgBox.Show(this, "Columns per page cannot be 0 or less.");
                return(false);
            }
            return(true);
        }
示例#17
0
        public static GridRow CreateRowForClaimProcs(DataRow rowBundleClaimProc, bool isDynamic = false)
        {
            //Either a claimpayment or a bundle of claimprocs with no claimpayment that were on the same date.
            string descript = Defs.GetName(DefCat.InsurancePaymentType, PIn.Long(rowBundleClaimProc["PayType"].ToString()));

            if (rowBundleClaimProc["CheckNum"].ToString() != "")
            {
                descript += " #" + rowBundleClaimProc["CheckNum"];
            }
            if (PIn.Long(rowBundleClaimProc["ClaimPaymentNum"].ToString()) == 0)
            {
                descript += "No Finalized Payment";
            }
            else
            {
                double checkAmt = PIn.Double(rowBundleClaimProc["CheckAmt"].ToString());
                descript += " " + checkAmt.ToString("c");
                double insPayAmt = PIn.Double(rowBundleClaimProc["InsPayAmt"].ToString());
                if (checkAmt != insPayAmt)
                {
                    descript += " " + Lans.g("PayPlanL", "(split)");
                }
            }
            GridRow row = new GridRow();

            row.Cells.Add(PIn.DateT(rowBundleClaimProc["DateCP"].ToString()).ToShortDateString()); //0 Date
            row.Cells.Add(Providers.GetLName(PIn.Long(rowBundleClaimProc["ProvNum"].ToString()))); //1 Prov Abbr
            row.Cells.Add(descript);                                                               //2 Descript
            row.Cells.Add("");                                                                     //3 Principal
            row.Cells.Add("");                                                                     //4 Interest
            row.Cells.Add("");                                                                     //5 Due
            row.Cells.Add(PIn.Double(rowBundleClaimProc["InsPayAmt"].ToString()).ToString("n"));   //6 Payment
            if (!isDynamic)
            {
                row.Cells.Add("");        //7 Adjustment
            }
            row.Cells.Add("");            //8 Balance (filled later)
            row.Tag       = rowBundleClaimProc;
            row.ColorText = Defs.GetDefByExactName(DefCat.AccountColors, "Insurance Payment").ItemColor;
            return(row);
        }
        private void butOK_Click(object sender, EventArgs e)
        {
            if (textDescription.Text == "")
            {
                MessageBox.Show(this, "Please enter a description.");
                return;
            }
            try {
                MedOrderCur.DateTimeOrder = PIn.DateT(textDateTime.Text);
            }
            catch {
                MessageBox.Show(this, "Please enter a Date Time with format DD/MM/YYYY HH:mm AM/PM");
            }
            MedOrderCur.Description    = textDescription.Text;
            MedOrderCur.IsDiscontinued = checkIsDiscontinued.Checked;
            if (comboProv.SelectedIndex == -1)
            {
                //don't make any changes to provnum.  0 is ok, but should never happen.  ProvNum might also be for a hidden prov.
            }
            else
            {
                MedOrderCur.ProvNum = _listProviders[comboProv.SelectedIndex].ProvNum;
            }
            if (IsNew)
            {
                MedicalOrders.Insert(MedOrderCur);
                EhrMeasureEvent newMeasureEvent = new EhrMeasureEvent();
                newMeasureEvent.DateTEvent = DateTime.Now;
                newMeasureEvent.EventType  = EhrMeasureEventType.CPOE_RadOrdered;
                newMeasureEvent.PatNum     = MedOrderCur.PatNum;
                newMeasureEvent.MoreInfo   = "";
                newMeasureEvent.FKey       = MedOrderCur.MedicalOrderNum;
                EhrMeasureEvents.Insert(newMeasureEvent);
            }
            else
            {
                MedicalOrders.Update(MedOrderCur);
            }

            DialogResult = DialogResult.OK;
        }
示例#19
0
        private void butAssessed_Click(object sender, EventArgs e)
        {
            if (comboTobaccoStatus.SelectedIndex < 0 || comboTobaccoStatus.SelectedIndex >= _listTobaccoStatuses.Count)
            {
                MsgBox.Show(this, "You must select a tobacco status.");
                return;
            }
            DateTime        dateTEntered = PIn.DateT(textDateAssessed.Text);
            EhrMeasureEvent meas         = new EhrMeasureEvent();

            meas.DateTEvent       = dateTEntered;
            meas.EventType        = EhrMeasureEventType.TobaccoUseAssessed;
            meas.PatNum           = PatCur.PatNum;
            meas.CodeValueEvent   = _listAssessmentCodes[comboAssessmentType.SelectedIndex].CodeValue;
            meas.CodeSystemEvent  = _listAssessmentCodes[comboAssessmentType.SelectedIndex].CodeSystem;
            meas.CodeValueResult  = _listTobaccoStatuses[comboTobaccoStatus.SelectedIndex].CodeValue;
            meas.CodeSystemResult = "SNOMEDCT";          //only allow SNOMEDCT codes for now.
            meas.MoreInfo         = "";
            EhrMeasureEvents.Insert(meas);
            comboTobaccoStatus.SelectedIndex = -1;
            FillGridAssessments();
        }
示例#20
0
        private bool ValidEntries()
        {
            DateTime start = PIn.DateT(textStartTime.Text);
            DateTime stop  = PIn.DateT(textStopTime.Text);

            if (start.Minute > 0 || stop.Minute > 0)
            {
                MsgBox.Show(this, "Please use hours only, no minutes.");
                return(false);
            }
            if (stop.Hour != 0 && stop.Hour < start.Hour)         //If stop time is earlier than start time.
            {
                MsgBox.Show(this, "Start time cannot excede stop time.");
                return(false);
            }
            if (start == DateTime.MinValue)
            {
                MsgBox.Show(this, "Please enter a valid start time.");
                return(false);
            }
            if (stop == DateTime.MinValue)
            {
                MsgBox.Show(this, "Please enter a valid stop time.");
                return(false);
            }
            if (textColumnsPerPage.errorProvider1.GetError(textColumnsPerPage) != "" ||
                textFontSize.errorProvider1.GetError(textFontSize) != "")
            {
                MsgBox.Show(this, "Please fix data entry errors first.");
                return(false);
            }
            if (PIn.Int(textColumnsPerPage.Text) < 1)
            {
                MsgBox.Show(this, "Columns per page cannot be 0 or less.");
                return(false);
            }
            return(true);
        }
示例#21
0
 ///<summary>Called when we want to refresh form list and data. Also calls FillGrid().
 ///Set hasFilters to true when we want to refresh and apply current filters.</summary>
 private void RefreshAndFillGrid()
 {
     _listAllEtrans = new List <Etrans>();
     if (ValidateFields())
     {
         DataTable table = Etranss.RefreshHistory(_reportDateFrom, _reportDateTo, new List <EtransType>()
         {
             EtransType.ERA_835
         });
         foreach (DataRow row in table.Rows)
         {
             Etrans etrans = new Etrans();
             etrans.EtransNum            = PIn.Long(row["EtransNum"].ToString());
             etrans.ClaimNum             = PIn.Long(row["ClaimNum"].ToString());
             etrans.Note                 = row["Note"].ToString();
             etrans.EtransMessageTextNum = PIn.Long(row["EtransMessageTextNum"].ToString());
             etrans.TranSetId835         = row["TranSetId835"].ToString();
             etrans.UserNum              = Security.CurUser.UserNum;
             etrans.DateTimeTrans        = PIn.DateT(row["dateTimeTrans"].ToString());
             _listAllEtrans.Add(etrans);
         }
     }
     FilterAndFillGrid(true);
 }
示例#22
0
        private void butOK_Click(object sender, EventArgs e)
        {
            if (textDateExpiration.errorProvider1.GetError(textDateExpiration) != "")
            {
                MessageBox.Show(Lan.g(this, "Please fix data entry errors first."));
                return;
            }
            VaccineCompletionStatus vaccineCompletionStatus = (VaccineCompletionStatus)listCompletionStatus.SelectedIndex;

            if (comboVaccine.SelectedIndex == -1 && vaccineCompletionStatus != VaccineCompletionStatus.NotAdministered)
            {
                //When the vaccine is not administered, the CVX code is automatically assumed to be 998 and there is no manufacturer.  Therefore, no vaccine def is needed.
                MessageBox.Show(this, "Please select a vaccine.");
                return;
            }
            if (vaccineCompletionStatus == VaccineCompletionStatus.NotAdministered)
            {
                if (textNote.Text == "")
                {
                    MessageBox.Show(this, "Please enter documentation in the note.");
                    return;
                }
                VaccinePatCur.VaccineDefNum = 0;              //Written for clarity
            }
            else
            {
                VaccinePatCur.VaccineDefNum = _listVaccineDefs[comboVaccine.SelectedIndex].VaccineDefNum;
            }
            try {
                VaccinePatCur.DateTimeStart = PIn.DateT(textDateTimeStart.Text);
                VaccinePatCur.DateTimeEnd   = PIn.DateT(textDateTimeStop.Text);
            }
            catch {
                MessageBox.Show(this, "Please enter start and end times in format DD/MM/YYYY HH:mm AM/PM");
            }
            if (textAmount.Text == "")
            {
                VaccinePatCur.AdministeredAmt = 0;
            }
            else
            {
                try {
                    VaccinePatCur.AdministeredAmt = PIn.Float(textAmount.Text);
                }
                catch {
                    MessageBox.Show(this, "Please enter a valid amount.");
                }
            }
            if (comboUnits.SelectedIndex == 0)           //'none'
            {
                VaccinePatCur.DrugUnitNum = 0;
            }
            else
            {
                VaccinePatCur.DrugUnitNum = _listDrugUnits[comboUnits.SelectedIndex - 1].DrugUnitNum;
            }
            VaccinePatCur.LotNumber        = textLotNum.Text;
            VaccinePatCur.DateExpire       = PIn.Date(textDateExpiration.Text);
            VaccinePatCur.RefusalReason    = (VaccineRefusalReason)listRefusalReason.SelectedIndex;
            VaccinePatCur.CompletionStatus = (VaccineCompletionStatus)listCompletionStatus.SelectedIndex;
            VaccinePatCur.Note             = textNote.Text;
            VaccinePatCur.FilledCity       = textFilledCity.Text;
            VaccinePatCur.FilledST         = textFilledSt.Text;
            //VaccinePatCur.UserNum;//Was set when loading and cannot be edited by the user.
            VaccinePatCur.ProvNumOrdering        = _provNumSelectedOrdering;
            VaccinePatCur.ProvNumAdminister      = _provNumSelectedAdministering;
            VaccinePatCur.AdministrationRoute    = (VaccineAdministrationRoute)comboAdministrationRoute.SelectedIndex;
            VaccinePatCur.AdministrationSite     = (VaccineAdministrationSite)comboAdministrationSite.SelectedIndex;
            VaccinePatCur.AdministrationNoteCode = (VaccineAdministrationNote)listAdministrationNote.SelectedIndex;
            VaccinePatCur.ActionCode             = (VaccineAction)listAction.SelectedIndex;
            if (IsNew)
            {
                VaccinePats.Insert(VaccinePatCur);
            }
            else
            {
                VaccinePats.Update(VaccinePatCur);
            }
            //We must delete then update/insert the observations after we insert the vaccinepat record, in case the vaccinepat is new.
            VaccineObses.DeleteForVaccinePat(VaccinePatCur.VaccinePatNum);
            for (int i = 0; i < _listVaccineObservations.Count; i++)
            {
                VaccineObs vaccineObs = _listVaccineObservations[i];
                vaccineObs.VaccinePatNum = VaccinePatCur.VaccinePatNum;
                VaccineObses.Insert(vaccineObs);
            }
            //Update the vaccine observation group ids, now that the vaccine observation records have been inserted.
            for (int i = 0; i < _listVaccineObservations.Count; i++)
            {
                VaccineObs vaccineObs = _listVaccineObservations[i];
                vaccineObs.VaccineObsNumGroup = _listVaccineObservationGroups[i].VaccineObsNum;
                VaccineObses.Update(vaccineObs);
            }
            DialogResult = DialogResult.OK;
        }
示例#23
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     #region Validation
     DateTime startDateT = DateTime.MinValue;
     DateTime stopDateT  = DateTime.MinValue;
     if (!_isHolidayOrNote)
     {
         if (listOps.SelectedIndices.Count == 0)
         {
             MsgBox.Show(this, "Please select ops first.");
             return;
         }
         if (listOps.SelectedIndices.Count > 1 && listOps.SelectedIndices.Contains(0))
         {
             MsgBox.Show(this, "Invalid selection of ops.");
             return;
         }
         startDateT = PIn.DateT(comboStart.Text);
         stopDateT  = PIn.DateT(comboStop.Text);
         if (startDateT == DateTime.MinValue || stopDateT == DateTime.MinValue)
         {
             MsgBox.Show(this, "Incorrect time format");
             return;
         }
         if (startDateT > stopDateT)
         {
             MsgBox.Show(this, "Stop time must be later than start time.");
             return;
         }
         List <long>     listSelectedOps    = new List <long>();
         List <Schedule> listProvSchedsOnly = ListScheds.FindAll(x => x.SchedType == ScheduleType.Provider);
         if (!listOps.SelectedIndices.Contains(0))                 //add selected operatories into listSelectedOps
         {
             listSelectedOps = listOps.SelectedIndices.OfType <int>().Select(x => _listOps[x - 1].OperatoryNum).ToList();
         }
         SchedCur.Ops       = listSelectedOps.ToList();        //deep copy of list. (because it is value type.)
         SchedCur.StartTime = startDateT.TimeOfDay;
         SchedCur.StopTime  = stopDateT.TimeOfDay;
         List <long> listProvsOverlap = new List <long>();
         foreach (long provNum in ListProvNums)                 //Potentially check each provider for overlap.
         {
             Schedule schedTemp = SchedCur.Copy();
             schedTemp.ProvNum = provNum;
             if (schedTemp.IsNew)
             {
                 listProvSchedsOnly.Add(schedTemp);                        //new scheds will be added to check if overlap.
             }
             bool isOverlapDetected = false;
             //====================Pre-Emptive Overlaps====================
             isOverlapDetected = ListProvNums.Count > 1 && listSelectedOps.Count > 0;
             //====================SIMPLE OVERLAP, No-Ops====================
             if (!isOverlapDetected)
             {
                 isOverlapDetected = schedTemp.Ops.Count == 0 &&                  //only look at schedules without operatories
                                     listProvSchedsOnly.FindAll(x => x.ProvNum == schedTemp.ProvNum &&           //Only consider current provider for overlaps w/o Ops
                                                                x.Ops.Count == 0 && //Also doesn't have an operatory
                                                                schedTemp.StartTime <= x.StopTime && //Overlapping Time
                                                                schedTemp.StopTime >= x.StartTime) //Overlapping Time
                                     .Count > 1;                                                   //count scheds that overlap that also do not have operatories.
             }
             //====================COMPLEX OVERLAP, Ops and All====================
             if (!isOverlapDetected)                     //If we did not find a simple overlap, attemptto find a "complicated" overlap
             {
                 isOverlapDetected = schedTemp.Ops.Count > 0 &&
                                     listProvSchedsOnly                                                                    //Select into groups of overlapping comparable schedule objects.
                                     .FindAll(x => x.Ops.Count > 0)                                                        //can only overlap if Ops are involved
                                     .FindAll(x => schedTemp.StartTime <= x.StopTime && schedTemp.StopTime >= x.StartTime) //Find all overlaps
                                     .SelectMany(x => x.Ops.Intersect(listSelectedOps))                                    //can/must contain duplicates. Intersect ignores Ops not used by SchedCur
                                     .GroupBy(x => x)                                                                      //group each overlapping list into operatories and flatten into large collection
                                     .Any(x => x.Count() > 1);                                                             //count any group that has more tha one schedule for the same time and operatory
             }
             if (isOverlapDetected)
             {
                 listProvsOverlap.Add(provNum);
             }
         }                //End foraech ProvNum
         listProvsOverlap = listProvsOverlap.Distinct().ToList();
         if (listProvsOverlap.Count > 0 && MessageBox.Show(Lan.g(this, "Overlapping provider schedules detected, would you like to continue anyway?") + "\r\n" + Lan.g(this, "Providers affected") + ":\r\n  "
                                                           + string.Join("\r\n  ", listProvsOverlap.Select(x => Providers.GetLongDesc(x))), "", MessageBoxButtons.YesNo) != DialogResult.Yes)
         {
             return;
         }
     }
     else if (SchedCur.Status != SchedStatus.Holiday && textNote.Text == "")         //don't allow blank schedule notes
     {
         MsgBox.Show(this, "Please enter a note first.");
         return;
     }
     long clinicNum = 0;
     if (_isHolidayOrNote && SchedCur.SchedType == ScheduleType.Practice && PrefC.HasClinicsEnabled)           //prov notes do not have a clinic
     {
         int indexCur = comboClinic.SelectedIndex;
         if (!Security.CurUser.ClinicIsRestricted)                 //user isn't restricted, -1 for HQ
         {
             indexCur--;
         }
         if (indexCur > -1)               //will be -1 if HQ is selected, leave clinicNum=0
         {
             clinicNum = _listClinics[indexCur].ClinicNum;
         }
         if (SchedCur.Status == SchedStatus.Holiday)                                                                                        //duplicate holiday check
         {
             List <Schedule> listScheds = ListScheds.FindAll(x => x.SchedType == ScheduleType.Practice && x.Status == SchedStatus.Holiday); //scheds in local list
             listScheds.AddRange(Schedules.GetAllForDateAndType(SchedCur.SchedDate, ScheduleType.Practice)
                                 .FindAll(x => x.ScheduleNum != SchedCur.ScheduleNum &&
                                          x.Status == SchedStatus.Holiday &&
                                          listScheds.All(y => y.ScheduleNum != x.ScheduleNum))); //add any in db that aren't in local list
             if (listScheds.Any(x => x.ClinicNum == 0 || x.ClinicNum == clinicNum) ||            //already a holiday for HQ in db or duplicate holiday for a clinic
                 (clinicNum == 0 && listScheds.Count > 0))                                       //OR trying to create a HQ holiday when a clinic already has one for this day
             {
                 MsgBox.Show(this, "There is already a Holiday for the practice or clinic on this date.");
                 return;
             }
         }
     }
     #endregion Validation
     #region Set Schedule Fields
     SchedCur.Note = textNote.Text;
     SchedCur.Ops  = new List <long>();
     if (listOps.SelectedIndices.Count > 0 && !listOps.SelectedIndices.Contains(0))
     {
         listOps.SelectedIndices.OfType <int>().ToList().ForEach(x => SchedCur.Ops.Add(_listOps[x - 1].OperatoryNum));
     }
     SchedCur.ClinicNum = clinicNum;          //0 if HQ selected or clinics not enabled or not a holiday or practice note
     #endregion Set Schedule Fields
     DialogResult = DialogResult.OK;
 }
示例#24
0
        private void butClose_Click(object sender, System.EventArgs e)
        {
            if (textReportComputerName.Text.Trim().ToLower() == "localhost" || textReportComputerName.Text.Trim() == "127.0.0.1")
            {
                MsgBox.Show(this, "Computer name to fetch new reports from cannot be localhost or 127.0.0.1 or any other loopback address.");
                return;
            }
            int reportCheckIntervalMinuteCount = 0;

            try {
                reportCheckIntervalMinuteCount = PIn.Int(textReportCheckInterval.Text);
                if (textReportCheckInterval.Enabled && (reportCheckIntervalMinuteCount < 5 || reportCheckIntervalMinuteCount > 60))
                {
                    throw new ApplicationException("Invalid value.");                    //User never sees this message.
                }
            }
            catch {
                MsgBox.Show(this, "Report check interval must be between 5 and 60 inclusive.");
                return;
            }
            if (radioTime.Checked && (textReportCheckTime.Text == "" || !textReportCheckTime.IsEntryValid))
            {
                MsgBox.Show(this, "Please enter a time to receive reports.");
                return;
            }
            bool doRestartToShowChanges = false;
            bool doInvalidateCache      = false;

            if (Prefs.UpdateString(PrefName.ClaimReportComputerName, textReportComputerName.Text))
            {
                doRestartToShowChanges = true;
                //No point in invalidating prefs since this only affects a workstation on startup.
            }
            if (Prefs.UpdateInt(PrefName.ClaimReportReceiveInterval, reportCheckIntervalMinuteCount))
            {
                doInvalidateCache = true;
            }
            if (radioTime.Checked)
            {
                if (Prefs.UpdateDateT(PrefName.ClaimReportReceiveTime, PIn.DateT(textReportCheckTime.Text)))
                {
                    doInvalidateCache = true;
                }
            }
            else if (textReportCheckTime.Text == "" && Prefs.UpdateDateT(PrefName.ClaimReportReceiveTime, DateTime.MinValue))
            {
                doInvalidateCache = true;
            }
            if (Prefs.UpdateBool(PrefName.ClaimReportReceivedByService, checkReceiveReportsService.Checked))
            {
                if (checkReceiveReportsService.Checked)
                {
                    doInvalidateCache = true;
                }
                else
                {
                    doRestartToShowChanges = true;
                }
            }
            if (doRestartToShowChanges)
            {
                MsgBox.Show(this, "You will need to restart the program for changes to take effect.");
            }
            if (doInvalidateCache)
            {
                DataValid.SetInvalid(InvalidType.Prefs);
            }
            Close();
        }
示例#25
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (textDateFrom.errorProvider1.GetError(textDateFrom) != "" ||
                textDateTo.errorProvider1.GetError(textDateTo) != ""
                )
            {
                MessageBox.Show(Lan.g(this, "Please fix data entry errors first."));
                return;
            }
            DateTime FromDate;
            DateTime ToDate;

            if (textDateFrom.Text == "")
            {
                MessageBox.Show(Lan.g(this, "From Date cannot be left blank."));
                return;
            }
            FromDate = PIn.Date(textDateFrom.Text);
            if (textDateTo.Text == "")
            {
                ToDate = DateTime.MaxValue.AddDays(-1);
            }
            else
            {
                ToDate = PIn.Date(textDateTo.Text);
            }
            //Create the file and first row--------------------------------------------------------
            List <ProgramProperty> ForProgram = ProgramProperties.GetForProgram(ProgramCur.ProgramNum);
            ProgramProperty        PPCur      = ProgramProperties.GetCur(ForProgram, "Export Path");
            string fileName = PPCur.PropertyValue + "Appt.txt";

            if (!Directory.Exists(PPCur.PropertyValue))
            {
                Directory.CreateDirectory(PPCur.PropertyValue);
            }
            StreamWriter sr = File.CreateText(fileName);

            sr.WriteLine("\"LastName\",\"FirstName\",\"PatientNumber\",\"HomePhone\",\"WorkNumber\","
                         + "\"EmailAddress\",\"SendEmail\",\"Address\",\"Address2\",\"City\",\"State\",\"Zip\","
                         + "\"ApptDate\",\"ApptTime\",\"ApptReason\",\"DoctorNumber\",\"DoctorName\",\"IsNewPatient\",\"WirelessPhone\"");
            DataTable table     = HouseCallsQueries.GetHouseCalls(FromDate, ToDate);
            bool      usePatNum = false;

            PPCur = ProgramProperties.GetCur(ForProgram, "Enter 0 to use PatientNum, or 1 to use ChartNum");;
            if (PPCur.PropertyValue == "0")
            {
                usePatNum = true;
            }
            DateTime aptDT;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                sr.Write("\"" + Dequote(PIn.String(table.Rows[i][0].ToString())) + "\",");     //0-LastName
                if (table.Rows[i][2].ToString() != "")                                         //if Preferred Name exists
                {
                    sr.Write("\"" + Dequote(PIn.String(table.Rows[i][2].ToString())) + "\","); //2-PrefName
                }
                else
                {
                    sr.Write("\"" + Dequote(PIn.String(table.Rows[i][1].ToString())) + "\",");                //1-FirstName
                }
                if (usePatNum)
                {
                    sr.Write("\"" + table.Rows[i][3].ToString() + "\",");                //3-PatNum
                }
                else
                {
                    sr.Write("\"" + Dequote(PIn.String(table.Rows[i][4].ToString())) + "\","); //4-ChartNumber
                }
                sr.Write("\"" + Dequote(PIn.String(table.Rows[i][5].ToString())) + "\",");     //5-HomePhone
                sr.Write("\"" + Dequote(PIn.String(table.Rows[i][6].ToString())) + "\",");     //6-WorkNumber
                sr.Write("\"" + Dequote(PIn.String(table.Rows[i][7].ToString())) + "\",");     //7-EmailAddress
                if (table.Rows[i][7].ToString() != "")                                         //if an email exists
                {
                    sr.Write("\"T\",");                                                        //SendEmail
                }
                else
                {
                    sr.Write("\"F\",");
                }
                sr.Write("\"" + Dequote(PIn.String(table.Rows[i][8].ToString())) + "\",");  //8-Address
                sr.Write("\"" + Dequote(PIn.String(table.Rows[i][9].ToString())) + "\",");  //9-Address2
                sr.Write("\"" + Dequote(PIn.String(table.Rows[i][10].ToString())) + "\","); //10-City
                sr.Write("\"" + Dequote(PIn.String(table.Rows[i][11].ToString())) + "\","); //11-State
                sr.Write("\"" + Dequote(PIn.String(table.Rows[i][12].ToString())) + "\","); //12-Zip
                aptDT = PIn.DateT(table.Rows[i][13].ToString());
                sr.Write("\"" + aptDT.ToString("MM/dd/yyyy") + "\",");                      //13-ApptDate
                sr.Write("\"" + aptDT.ToString("hh:mm tt") + "\",");                        //13-ApptTime eg 01:30 PM
                sr.Write("\"" + Dequote(PIn.String(table.Rows[i][14].ToString())) + "\","); //14-ApptReason
                sr.Write("\"" + table.Rows[i][15].ToString() + "\",");                      //15-DoctorNumber. might possibly be 0
                //15-DoctorName. Can handle 0 without any problem.
                sr.Write("\"" + Dequote(Providers.GetLName(PIn.Long(table.Rows[i][15].ToString()))) + "\",");
                if (table.Rows[i][16].ToString() == "1")   //16-IsNewPatient
                {
                    sr.Write("\"T\",");                    //SendEmail
                }
                else
                {
                    sr.Write("\"F\",");
                }
                sr.Write("\"" + Dequote(PIn.String(table.Rows[i][17].ToString())) + "\""); //17-WirelessPhone
                sr.WriteLine();                                                            //Must be last.
            }
            sr.Close();
            MessageBox.Show("Done");
            DialogResult = DialogResult.OK;
        }
示例#26
0
        ///<summary>Set all fields of this control. This is an alternative to constructing an entirely new instance.
        ///All uses of this control currently construct as Visible=false so that is the default here.</summary>
        public void ResetData(DataRow rowApt, DataTable tableApptFields, DataTable tablePatFields, Point location, bool visible = false)
        {
            DataRoww        = rowApt;
            TableApptFields = tableApptFields;
            TablePatFields  = tablePatFields;
            Pattern         = PIn.String(DataRoww["Pattern"].ToString());
            PatternShowing  = ApptSingleDrawing.GetPatternShowing(Pattern);
            Location        = location;
            Size            = ApptSingleDrawing.SetSize(Pattern);
            //These controls are always drawn as their Shadow bitmap.
            //They never actually render as a control.
            //Always set Visible to false here so that parent panel/form doesn't account for them when drawings it's controls.
            //In the case where it is a draggable control or on the pinboard, then it will be set to Visible=true.
            Visible = visible;
            //These are used heavily so deserialize here once to save time when accessing.
            AptNum           = PIn.Long(DataRoww["AptNum"].ToString());
            PatNum           = PIn.Long(DataRoww["PatNum"].ToString());
            AptDateTime      = PIn.DateT(DataRoww["AptDateTime"].ToString());
            OpNum            = PIn.Long(DataRoww["Op"].ToString());
            ClinicNum        = PIn.Long(DataRoww["ClinicNum"].ToString());
            ProvNum          = PIn.Long(DataRoww["ProvNum"].ToString());
            ProvHyg          = PIn.Long(DataRoww["ProvHyg"].ToString());
            Confirmed        = PIn.Long(DataRoww["Confirmed"].ToString());
            IsHygiene        = PIn.Bool(DataRoww["IsHygiene"].ToString());
            GrossProduction  = PIn.Decimal(DataRoww["productionVal"].ToString());
            WriteoffPPO      = PIn.Decimal(DataRoww["writeoffPPO"].ToString());
            AdjustmentTotal  = PIn.Decimal(DataRoww["adjustmentTotal"].ToString());
            ImageFolder      = PIn.String(DataRoww["ImageFolder"].ToString());
            PatientName      = PIn.String(DataRoww["patientName"].ToString());
            AptDate          = PIn.String(DataRoww["aptDate"].ToString());
            AptDay           = PIn.String(DataRoww["aptDay"].ToString());
            AptLength        = PIn.String(DataRoww["aptLength"].ToString());
            AptTime          = PIn.String(DataRoww["aptTime"].ToString());
            Email            = PIn.String(DataRoww["Email"].ToString());
            Language         = PIn.String(DataRoww["language"].ToString());
            ReferralTo       = PIn.String(DataRoww["referralTo"].ToString());
            ReferralFrom     = PIn.String(DataRoww["referralFrom"].ToString());
            ApptModNote      = PIn.String(DataRoww["apptModNote"].ToString());
            FamFinUrgNote    = PIn.String(DataRoww["famFinUrgNote"].ToString());
            AddrNote         = PIn.String(DataRoww["addrNote"].ToString());
            Insurance        = PIn.String(DataRoww["insurance"].ToString());
            ContactMethods   = PIn.String(DataRoww["contactMethods"].ToString());
            WirelessPhone    = PIn.String(DataRoww["wirelessPhone"].ToString());
            WkPhone          = PIn.String(DataRoww["wkPhone"].ToString());
            HmPhone          = PIn.String(DataRoww["hmPhone"].ToString());
            Age              = PIn.String(DataRoww["age"].ToString());
            BillingType      = PIn.String(DataRoww["billingType"].ToString());
            ChartNumber      = PIn.String(DataRoww["chartNumber"].ToString());
            Note             = PIn.String(DataRoww["Note"].ToString());
            Procs            = PIn.String(DataRoww["procs"].ToString());
            Lab              = PIn.String(DataRoww["lab"].ToString());
            MedUrgNote       = PIn.String(DataRoww["MedUrgNote"].ToString());
            PreMedFlag       = PIn.String(DataRoww["preMedFlag"].ToString());
            ConfirmedFromDef = PIn.String(DataRoww["confirmed"].ToString());
            Production       = PIn.String(DataRoww["production"].ToString());
            Provider         = PIn.String(DataRoww["provider"].ToString());
            ApptStatus aptStatus;

            if (Enum.TryParse(PIn.String(DataRoww["AptStatus"].ToString()), out aptStatus))
            {
                AptStatus = aptStatus;
            }
            else
            {
                AptStatus = ApptStatus.None;
            }
            ApptPriority priority;

            if (Enum.TryParse(PIn.String(DataRoww["Priority"].ToString()), out priority))
            {
                Priority = priority;
            }
            else
            {
                Priority = ApptPriority.Normal;
            }
        }
示例#27
0
        private void UpdatePreferenceChanges()
        {
            bool hasChanges = false;

            if (Prefs.UpdateBool(PrefName.AgingCalculatedMonthlyInsteadOfDaily, checkAgingMonthly.Checked)
                | Prefs.UpdateBool(PrefName.ApptSecondaryProviderConsiderOpOnly, checkUseOpHygProv.Checked)
                | Prefs.UpdateBool(PrefName.ApptsRequireProc, checkApptsRequireProcs.Checked)
                | Prefs.UpdateBool(PrefName.BillingShowSendProgress, checkBillingShowProgress.Checked)
                | Prefs.UpdateBool(PrefName.BillingShowTransSinceBalZero, checkBillShowTransSinceZero.Checked)
                | Prefs.UpdateBool(PrefName.ClaimReportReceivedByService, checkReceiveReportsService.Checked)
                | Prefs.UpdateBool(PrefName.CloneCreateSuperFamily, checkSuperFamCloneCreate.Checked)
                | Prefs.UpdateBool(PrefName.EnterpriseApptList, checkEnterpriseApptList.Checked)
                | Prefs.UpdateBool(PrefName.EnterpriseNoneApptViewDefaultDisabled, checkEnableNoneView.Checked)
                | Prefs.UpdateBool(PrefName.PasswordsMustBeStrong, checkPasswordsMustBeStrong.Checked)
                | Prefs.UpdateBool(PrefName.PasswordsStrongIncludeSpecial, checkPasswordsStrongIncludeSpecial.Checked)
                | Prefs.UpdateBool(PrefName.PasswordsWeakChangeToStrong, checkPasswordForceWeakToStrong.Checked)
                | Prefs.UpdateBool(PrefName.PaymentWindowDefaultHideSplits, checkHidePaysplits.Checked)
                | Prefs.UpdateBool(PrefName.PaymentsPromptForPayType, checkPaymentsPromptForPayType.Checked)
                | Prefs.UpdateBool(PrefName.SecurityLockIncludesAdmin, checkLockIncludesAdmin.Checked)
                | Prefs.UpdateBool(PrefName.ShowFeaturePatientClone, checkPatClone.Checked)
                | Prefs.UpdateBool(PrefName.ShowFeatureSuperfamilies, checkSuperFam.Checked)
                | Prefs.UpdateBool(PrefName.ShowFeeSchedGroups, checkShowFeeSchedGroups.Checked)
                | Prefs.UpdateBool(PrefName.UserNameManualEntry, checkUserNameManualEntry.Checked)
                | Prefs.UpdateInt(PrefName.BillingElectBatchMax, PIn.Int(textBillingElectBatchMax.Text))
                | Prefs.UpdateString(PrefName.ClaimIdPrefix, textClaimIdentifier.Text)
                | Prefs.UpdateInt(PrefName.ClaimReportReceiveInterval, PIn.Int(textReportCheckInterval.Text))
                | Prefs.UpdateDateT(PrefName.ClaimReportReceiveTime, PIn.DateT(textReportCheckTime.Text))
                | Prefs.UpdateLong(PrefName.ProcessSigsIntervalInSecs, PIn.Long(textSigInterval.Text))
                //SecurityLockDate and SecurityLockDays are handled in FormSecurityLock
                //| Prefs.UpdateString(PrefName.SecurityLockDate,POut.Date(PIn.Date(textDateLock.Text),false))
                //| Prefs.UpdateInt(PrefName.SecurityLockDays,PIn.Int(textDaysLock.Text))
                | Prefs.UpdateInt(PrefName.SecurityLogOffAfterMinutes, PIn.Int(textLogOffAfterMinutes.Text))
                | Prefs.UpdateLong(PrefName.SignalInactiveMinutes, PIn.Long(textInactiveSignal.Text))
                | Prefs.UpdateInt(PrefName.AutoSplitLogic, comboAutoSplitPref.SelectedIndex)
                | Prefs.UpdateInt(PrefName.PayPlansVersion, comboPayPlansVersion.SelectedIndex + 1)
                | Prefs.UpdateInt(PrefName.PaymentClinicSetting, comboPaymentClinicSetting.SelectedIndex)
                | Prefs.UpdateInt(PrefName.PatientSelectSearchMinChars, PIn.Int(textPatSelectMinChars.Text))
                | Prefs.UpdateInt(PrefName.PatientSelectSearchPauseMs, PIn.Int(textPatSelectPauseMs.Text))
                | Prefs.UpdateBool(PrefName.PatientSelectFilterRestrictedClinics, checkPatientSelectFilterRestrictedClinics.Checked)
                )
            {
                hasChanges = true;
            }
            if (checkPatSearchEmptyParams.CheckState != CheckState.Indeterminate)
            {
                hasChanges |= Prefs.UpdateInt(PrefName.PatientSelectSearchWithEmptyParams, (int)(checkPatSearchEmptyParams.Checked ? YN.Yes : YN.No));
            }
            if (checkUsePhoneNumTable.CheckState != CheckState.Indeterminate)
            {
                hasChanges |= Prefs.UpdateYN(PrefName.PatientPhoneUsePhonenumberTable, checkUsePhoneNumTable.Checked ? YN.Yes : YN.No);
            }
            int prefRigorousAccounting = PrefC.GetInt(PrefName.RigorousAccounting);

            //Copied logging for RigorousAccounting and RigorousAdjustments from FormModuleSetup.
            if (Prefs.UpdateInt(PrefName.RigorousAccounting, comboRigorousAccounting.SelectedIndex))
            {
                hasChanges = true;
                SecurityLogs.MakeLogEntry(Permissions.Setup, 0, "Rigorous accounting changed from " +
                                          ((RigorousAccounting)prefRigorousAccounting).GetDescription() + " to "
                                          + ((RigorousAccounting)comboRigorousAccounting.SelectedIndex).GetDescription() + ".");
            }
            int prefRigorousAdjustments = PrefC.GetInt(PrefName.RigorousAdjustments);

            if (Prefs.UpdateInt(PrefName.RigorousAdjustments, comboRigorousAdjustments.SelectedIndex))
            {
                hasChanges = true;
                SecurityLogs.MakeLogEntry(Permissions.Setup, 0, "Rigorous adjustments changed from " +
                                          ((RigorousAdjustments)prefRigorousAdjustments).GetDescription() + " to "
                                          + ((RigorousAdjustments)comboRigorousAdjustments.SelectedIndex).GetDescription() + ".");
            }
            hasChanges |= UpdateReportingServer();
            hasChanges |= UpdateClaimSnapshotRuntime();
            hasChanges |= UpdateClaimSnapshotTrigger();
            if (hasChanges)
            {
                DataValid.SetInvalid(InvalidType.Prefs);
            }
        }
示例#28
0
        ///<summary>Tests to see if this appointment will create a double booking. Returns arrayList with no items in it if no double bookings for this appt.  But if double booking, then it returns an arrayList of codes which would be double booked.  You must supply the appointment being scheduled as well as a list of all appointments for that day.  The list can include the appointment being tested if user is moving it to a different time on the same day.  The ProcsForOne list of procedures needs to contain the procedures for the apt becauese procsMultApts won't necessarily, especially if it's a planned appt on the pinboard.</summary>
        public static ArrayList GetDoubleBookedCodes(Appointment apt, DataTable dayTable, List <Procedure> procsMultApts, Procedure[] procsForOne)
        {
            ArrayList retVal = new ArrayList();          //codes
            //figure out which provider we are testing for
            long provNum;

            if (apt.IsHygiene)
            {
                provNum = apt.ProvHyg;
            }
            else
            {
                provNum = apt.ProvNum;
            }
            //compute the starting row of this appt
            int convertToY = (int)(((double)apt.AptDateTime.Hour * (double)60
                                    / (double)PrefC.GetLong(PrefName.AppointmentTimeIncrement)
                                    + (double)apt.AptDateTime.Minute
                                    / (double)PrefC.GetLong(PrefName.AppointmentTimeIncrement)
                                    ) * (double)ApptDrawing.LineH * ApptDrawing.RowsPerIncr);
            int    startIndex = convertToY / ApptDrawing.LineH;     //rounds down
            string pattern    = ApptSingleDrawing.GetPatternShowing(apt.Pattern);
            //keep track of which rows in the entire day would be occupied by provider time for this appt
            ArrayList aptProvTime = new ArrayList();

            for (int k = 0; k < pattern.Length; k++)
            {
                if (pattern.Substring(k, 1) == "X")
                {
                    aptProvTime.Add(startIndex + k);                  //even if it extends past midnight, we don't care
                }
            }
            //Now, loop through all the other appointments for the day, and see if any would overlap this one
            bool overlaps;

            Procedure[] procs;
            bool        doubleBooked = false;   //applies to all appts, not just one at a time.
            DateTime    aptDateTime;

            for (int i = 0; i < dayTable.Rows.Count; i++)
            {
                if (dayTable.Rows[i]["AptNum"].ToString() == apt.AptNum.ToString())              //ignore current apt in its old location
                {
                    continue;
                }
                //ignore other providers
                if (dayTable.Rows[i]["IsHygiene"].ToString() == "1" && dayTable.Rows[i]["ProvHyg"].ToString() != provNum.ToString())
                {
                    continue;
                }
                if (dayTable.Rows[i]["IsHygiene"].ToString() == "0" && dayTable.Rows[i]["ProvNum"].ToString() != provNum.ToString())
                {
                    continue;
                }
                if (dayTable.Rows[i]["AptStatus"].ToString() == ((int)ApptStatus.Broken).ToString())              //ignore broken appts
                {
                    continue;
                }
                aptDateTime = PIn.DateT(dayTable.Rows[i]["AptDateTime"].ToString());
                if (ApptDrawing.IsWeeklyView && aptDateTime.Date != apt.AptDateTime.Date)              //These appointments are on different days.
                {
                    continue;
                }
                //calculate starting row
                //this math is copied from another section of the program, so it's sloppy. Safer than trying to rewrite it:
                convertToY = (int)(((double)aptDateTime.Hour * (double)60
                                    / (double)PrefC.GetLong(PrefName.AppointmentTimeIncrement)
                                    + (double)aptDateTime.Minute
                                    / (double)PrefC.GetLong(PrefName.AppointmentTimeIncrement)
                                    ) * (double)ApptDrawing.LineH * ApptDrawing.RowsPerIncr);
                startIndex = convertToY / ApptDrawing.LineH;            //rounds down
                pattern    = ApptSingleDrawing.GetPatternShowing(dayTable.Rows[i]["Pattern"].ToString());
                //now compare it to apt
                overlaps = false;
                for (int k = 0; k < pattern.Length; k++)
                {
                    if (pattern.Substring(k, 1) == "X")
                    {
                        if (aptProvTime.Contains(startIndex + k))
                        {
                            overlaps     = true;
                            doubleBooked = true;
                        }
                    }
                }
                if (overlaps)
                {
                    //we need to add all codes for this appt to retVal
                    procs = Procedures.GetProcsOneApt(PIn.Long(dayTable.Rows[i]["AptNum"].ToString()), procsMultApts);
                    for (int j = 0; j < procs.Length; j++)
                    {
                        retVal.Add(ProcedureCodes.GetStringProcCode(procs[j].CodeNum));
                    }
                }
            }
            //now, retVal contains all double booked procs except for this appt
            //need to all procs for this appt.
            if (doubleBooked)
            {
                for (int j = 0; j < procsForOne.Length; j++)
                {
                    retVal.Add(ProcedureCodes.GetStringProcCode(procsForOne[j].CodeNum));
                }
            }
            return(retVal);
        }
示例#29
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     #region Validation
     DateTime startDateT = DateTime.MinValue;
     DateTime stopDateT  = DateTime.MinValue;
     if (!_isHolidayOrNote)
     {
         if (listOps.SelectedIndices.Count == 0)
         {
             MsgBox.Show(this, "Please select ops first.");
             return;
         }
         if (listOps.SelectedIndices.Count > 1 && listOps.SelectedIndices.Contains(0))
         {
             MsgBox.Show(this, "Invalid selection of ops.");
             return;
         }
         startDateT = PIn.DateT(comboStart.Text);
         stopDateT  = PIn.DateT(comboStop.Text);
         if (startDateT == DateTime.MinValue || stopDateT == DateTime.MinValue)
         {
             MsgBox.Show(this, "Incorrect time format");
             return;
         }
         if (startDateT > stopDateT)
         {
             MsgBox.Show(this, "Stop time must be later than start time.");
             return;
         }
         List <long>     listSelectedOps    = new List <long>();
         List <Schedule> listProvSchedsOnly = ListScheds.FindAll(x => x.SchedType == ScheduleType.Provider);
         if (!listOps.SelectedIndices.Contains(0))                 //add selected operatories into listSelectedOps
         {
             listSelectedOps = listOps.SelectedIndices.OfType <int>().Select(x => _listOps[x - 1].OperatoryNum).ToList();
         }
         SchedCur.Ops       = listSelectedOps.ToList();        //deep copy of list. (because it is value type.)
         SchedCur.StartTime = startDateT.TimeOfDay;
         SchedCur.StopTime  = stopDateT.TimeOfDay;
         List <long> listProvsOverlap;
         //====================Pre-Emptive Overlaps====================
         //Because this window is explicitly designed for one start and one stop time we know that there will be overlapping if multiple providers are
         //selected with at least one specific operatory selected.
         if (ListProvNums.Count > 1 && listSelectedOps.Count > 0)
         {
             listProvsOverlap = ListProvNums.Distinct().ToList();
         }
         else                  //Go see if there is going to be overlapping issues with this new schedule.
         {
             listProvsOverlap = Schedules.GetOverlappingSchedProvNums(ListProvNums, SchedCur, listProvSchedsOnly, listSelectedOps);
         }
         if (listProvsOverlap.Count > 0 && MessageBox.Show(Lan.g(this, "Overlapping provider schedules detected, would you like to continue anyway?") + "\r\n" + Lan.g(this, "Providers affected") + ":\r\n  "
                                                           + string.Join("\r\n  ", listProvsOverlap.Select(x => Providers.GetLongDesc(x))), "", MessageBoxButtons.YesNo) != DialogResult.Yes)
         {
             return;
         }
     }
     else if (SchedCur.Status != SchedStatus.Holiday && textNote.Text == "")         //don't allow blank schedule notes
     {
         MsgBox.Show(this, "Please enter a note first.");
         return;
     }
     long clinicNum = 0;
     if (_isHolidayOrNote && SchedCur.SchedType == ScheduleType.Practice && PrefC.HasClinicsEnabled)           //prov notes do not have a clinic
     {
         int indexCur = comboClinic.SelectedIndex;
         if (!Security.CurUser.ClinicIsRestricted)                 //user isn't restricted, -1 for HQ
         {
             indexCur--;
         }
         if (indexCur > -1)               //will be -1 if HQ is selected, leave clinicNum=0
         {
             clinicNum = _listClinics[indexCur].ClinicNum;
         }
         if (SchedCur.Status == SchedStatus.Holiday)                                                                                        //duplicate holiday check
         {
             List <Schedule> listScheds = ListScheds.FindAll(x => x.SchedType == ScheduleType.Practice && x.Status == SchedStatus.Holiday); //scheds in local list
             listScheds.AddRange(Schedules.GetAllForDateAndType(SchedCur.SchedDate, ScheduleType.Practice)
                                 .FindAll(x => x.ScheduleNum != SchedCur.ScheduleNum &&
                                          x.Status == SchedStatus.Holiday &&
                                          listScheds.All(y => y.ScheduleNum != x.ScheduleNum))); //add any in db that aren't in local list
             if (listScheds.Any(x => x.ClinicNum == 0 || x.ClinicNum == clinicNum) ||            //already a holiday for HQ in db or duplicate holiday for a clinic
                 (clinicNum == 0 && listScheds.Count > 0))                                       //OR trying to create a HQ holiday when a clinic already has one for this day
             {
                 MsgBox.Show(this, "There is already a Holiday for the practice or clinic on this date.");
                 return;
             }
         }
     }
     #endregion Validation
     #region Set Schedule Fields
     SchedCur.Note = textNote.Text;
     SchedCur.Ops  = new List <long>();
     if (listOps.SelectedIndices.Count > 0 && !listOps.SelectedIndices.Contains(0))
     {
         listOps.SelectedIndices.OfType <int>().ToList().ForEach(x => SchedCur.Ops.Add(_listOps[x - 1].OperatoryNum));
     }
     SchedCur.ClinicNum = clinicNum;          //0 if HQ selected or clinics not enabled or not a holiday or practice note
     #endregion Set Schedule Fields
     DialogResult = DialogResult.OK;
 }
示例#30
0
        public static string GetChanges(Procedure procCur, Procedure procOld, OrionProc orionProcCur, OrionProc orionProcOld)
        {
            Changes = "";
            if (orionProcOld.DPC != orionProcCur.DPC)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "DPC changed from " + POut.String(orionProcOld.DPC.ToString()) + " to " + POut.String(orionProcCur.DPC.ToString()) + ".";
            }
            if (orionProcOld.DPCpost != orionProcCur.DPCpost)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "DPC Post Visit changed from " + POut.String(orionProcOld.DPCpost.ToString()) + " to " + POut.String(orionProcCur.DPCpost.ToString()) + ".";
            }
            //PatNum, AptNum, PlannedAptNum should never change---------------------------------------------------------------------------------------------
            if (procOld.PatNum != procCur.PatNum)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Patient Num changed from " + procOld.PatNum + " to " + procCur.PatNum + ".";
            }
            if (procOld.AptNum != procCur.AptNum)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Apt Num changed from " + procOld.AptNum + " to " + procCur.AptNum + ".";
            }
            if (procOld.PlannedAptNum != procCur.PlannedAptNum)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Planned Apt Num changed from " + procOld.PlannedAptNum + " to " + procCur.PlannedAptNum + ".";
            }
            //Date and time related fields------------------------------------------------------------------------------------------------------------------
            if (procOld.DateEntryC.Date != procCur.DateEntryC.Date)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Date Entry changed from " + procOld.DateEntryC.ToShortDateString() + " to " + procCur.DateEntryC.ToShortDateString() + ".";
            }
            if (procOld.ProcDate.Date != procCur.ProcDate.Date)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Proc Date changed from " + procOld.ProcDate.ToShortDateString() + " to " + procCur.ProcDate.ToShortDateString() + ".";
            }
            //if(procOld.StartTime != procCur.StartTime) {
            //  if(Changes!=""){ Changes+="\r\n";}
            //  Changes+="Start Time changed from "+procOld.StartTime+" to "+procCur.StartTime+".";
            //}
            //if(procOld.StopTime != procCur.StopTime) {
            //  if(Changes!=""){ Changes+="\r\n";}
            //  Changes+="Stop Time changed from "+procOld.StopTime+" to "+procCur.StopTime+".";
            //}
            if (procOld.ProcTime != procCur.ProcTime)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Procedure Time changed from "
                           + (PIn.DateT(procOld.ProcTime.ToString()).ToShortTimeString() == "12:00 AM"?"none":PIn.DateT(procOld.ProcTime.ToString()).ToShortTimeString())
                           + " to " + (PIn.DateT(procCur.ProcTime.ToString()).ToShortTimeString() == "12:00 AM"?"none":PIn.DateT(procCur.ProcTime.ToString()).ToShortTimeString()) + ".";
            }
            if (procOld.ProcTimeEnd != procCur.ProcTimeEnd)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Procedure End Time changed from "
                           + (PIn.DateT(procOld.ProcTimeEnd.ToString()).ToShortTimeString() == "12:00 AM"?"none":PIn.DateT(procOld.ProcTimeEnd.ToString()).ToShortTimeString())
                           + " to " + (PIn.DateT(procCur.ProcTimeEnd.ToString()).ToShortTimeString() == "12:00 AM"?"none":PIn.DateT(procCur.ProcTimeEnd.ToString()).ToShortTimeString()) + ".";
            }
            //Procedure, related areas, amount, hide graphics, etc.-----------------------------------------------------------------------------------------
            if (procOld.CodeNum != procCur.CodeNum)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Procedure changed from " + ProcedureCodes.GetLaymanTerm(procOld.CodeNum) + " to " + ProcedureCodes.GetLaymanTerm(procCur.CodeNum) + ".";
            }
            if (procOld.ProcFee != procCur.ProcFee)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Proc Fee changed from $" + procOld.ProcFee.ToString("F") + " to $" + procCur.ProcFee.ToString("F") + ".";
            }
            if (procOld.ToothNum != procCur.ToothNum)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Tooth Num changed from " + procOld.ToothNum + " to " + procCur.ToothNum + ".";
            }
            if (procOld.Surf != procCur.Surf)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Surface changed from " + procOld.Surf + " to " + procCur.Surf + ".";
            }
            if (procOld.ToothRange != procCur.ToothRange)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Tooth Range changed from " + procOld.ToothRange + " to " + procCur.ToothRange + ".";
            }
            if (procOld.HideGraphics != procCur.HideGraphics)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Hide Graphics changed from " + (procOld.HideGraphics?"Hide Graphics":"Do Not Hide Graphics")
                           + " to " + (procCur.HideGraphics?"Hide Graphics":"Do Not Hide Graphics") + ".";
            }
            //Provider, Diagnosis, Priority, Place of Service, Clinic, Site---------------------------------------------------------------------------------
            if (procOld.ProvNum != procCur.ProvNum)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Provider changed from " + Providers.GetAbbr(procOld.ProvNum) + " to " + Providers.GetAbbr(procCur.ProvNum) + ".";
            }
            if (procOld.Dx != procCur.Dx)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Diagnosis changed from " + Defs.GetDef(DefCat.Diagnosis, procOld.Dx).ItemName
                           + " to " + Defs.GetDef(DefCat.Diagnosis, procCur.Dx).ItemName + ".";
            }
            if (procOld.Priority != procCur.Priority)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Priority changed from " + ((procOld.Priority != 0)?Defs.GetDef(DefCat.TxPriorities, procOld.Priority).ItemName:"no priority")
                           + " to " + ((procCur.Priority != 0)?Defs.GetDef(DefCat.TxPriorities, procCur.Priority).ItemName:"no priority") + ".";
            }
            if (procOld.PlaceService != procCur.PlaceService)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Place of Service changed from " + procOld.PlaceService.ToString() + " to " + procCur.PlaceService.ToString() + ".";
            }
            if (procOld.ClinicNum != procCur.ClinicNum)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Clinic changed from " + Clinics.GetAbbr(procOld.ClinicNum) + " to " + Clinics.GetAbbr(procCur.ClinicNum) + ".";
            }
            if (procOld.SiteNum != procCur.SiteNum)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Site changed from " + (procOld.SiteNum == 0?"none":Sites.GetDescription(procOld.SiteNum))
                           + " to " + (procCur.SiteNum == 0?"none":Sites.GetDescription(procCur.SiteNum)) + ".";
            }
            //Prosthesis reverse lookup---------------------------------------------------------------------------------------------------------------------
            if (procOld.Prosthesis != procCur.Prosthesis)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                string prosthesisOld;
                switch (procOld.Prosthesis.ToString())
                {
                case "": prosthesisOld = "no"; break;

                case "I":       prosthesisOld = "Initial"; break;

                case "R": prosthesisOld = "Replacement"; break;

                default: prosthesisOld = "error"; break;
                }
                string prosthesisCur;
                switch (procCur.Prosthesis.ToString())
                {
                case "": prosthesisCur = "no"; break;

                case "I": prosthesisCur = "Initial"; break;

                case "R": prosthesisCur = "Replacement"; break;

                default: prosthesisCur = "error"; break;
                }
                Changes += "Prosthesis changed from " + prosthesisOld + " to " + prosthesisCur + ".";
            }
            if (procOld.DateOriginalProsth.Date != procCur.DateOriginalProsth.Date)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Date of Original Prosthesis changed from " + procOld.DateOriginalProsth.ToShortDateString()
                           + " to " + procCur.DateOriginalProsth.ToShortDateString() + ".";
            }
            //Claim Note & Orion Proc Fields----------------------------------------------------------------------------------------------------------------
            if (procOld.ClaimNote != procCur.ClaimNote)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Claim Note changed from " + (procOld.ClaimNote == ""?"none":"'" + procOld.ClaimNote + "'")
                           + " to " + (procCur.ClaimNote == ""?"none":"'" + procCur.ClaimNote + "'");
            }
            if (orionProcOld.OrionProcNum != orionProcCur.OrionProcNum)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Orion Proc Num changed from " + POut.Long(orionProcOld.OrionProcNum) + " to " + POut.Long(orionProcCur.OrionProcNum) + ".";
            }
            if (orionProcOld.ProcNum != orionProcCur.ProcNum)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Proc Num changed from " + POut.Long(orionProcOld.ProcNum) + " to " + POut.Long(orionProcCur.ProcNum) + ".";
            }
            //Orion Status Reverse Lookup for Description----------------------------------//None is equivalent to TP---------------------------------------
            if (orionProcOld.Status2 != orionProcCur.Status2 && !(orionProcOld.Status2 == OrionStatus.None && orionProcCur.Status2 == OrionStatus.TP))
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                string[] status2     = new string[2];
                string[] status2Desc = new string[2];
                status2[0] = orionProcOld.Status2.ToString();
                status2[1] = orionProcCur.Status2.ToString();
                for (int i = 0; i < 2; i++)
                {
                    switch (status2[i])
                    {
                    case "None":            status2Desc[i] = "TP-treatment planned"; break;

                    case "TP":                      status2Desc[i] = "TP-treatment planned"; break;

                    case "C":                               status2Desc[i] = "C-completed";   break;

                    case "E":                               status2Desc[i] = "E-existing prior to incarceration"; break;

                    case "R":                               status2Desc[i] = "R-refused treatment"; break;

                    case "RO":                      status2Desc[i] = "RO-referred out to specialist"; break;

                    case "CS":                      status2Desc[i] = "CS-completed by specialist"; break;

                    case "CR":                      status2Desc[i] = "CR-completed by registry"; break;

                    case "CA_Tx":           status2Desc[i] = "CA_Tx-cancelled, tx plan changed"; break;

                    case "CA_EPRD": status2Desc[i] = "CA_EPRD-cancelled, eligible parole"; break;

                    case "CA_P/D":  status2Desc[i] = "CA_P/D--cancelled, parole/discharge"; break;

                    case "S":                               status2Desc[i] = "S-suspended, unacceptable plaque"; break;

                    case "ST":                      status2Desc[i] = "ST-stop clock, multi visit"; break;

                    case "W":                               status2Desc[i] = "W-watch"; break;

                    case "A":                               status2Desc[i] = "A-alternative"; break;

                    default:                                status2Desc[i] = "error"; break;
                    }
                }
                Changes += "Orion Procedure Status changed from " + status2Desc[0] + " to " + status2Desc[1] + ".";
            }
            //Other orion fields----------------------------------------------------------------------------------------------------------------------------
            if (orionProcOld.DateScheduleBy.Date != orionProcCur.DateScheduleBy.Date)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Date Schedule By changed from " + orionProcOld.DateScheduleBy.ToShortDateString()
                           + " to " + orionProcCur.DateScheduleBy.ToShortDateString() + ".";
            }
            if (orionProcOld.DateStopClock.Date != orionProcCur.DateStopClock.Date)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Date Stop Clock changed from " + orionProcOld.DateStopClock.ToShortDateString()
                           + " to " + orionProcCur.DateStopClock.ToShortDateString() + ".";
            }
            if (orionProcOld.IsOnCall != orionProcCur.IsOnCall)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Is On Call changed from " + (orionProcOld.IsOnCall?"Is On Call":"Is Not On Call")
                           + " to " + (orionProcCur.IsOnCall?"Is On Call":"Is Not On Call") + ".";
            }
            if (orionProcOld.IsEffectiveComm != orionProcCur.IsEffectiveComm)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Is Effective Comm changed from " + (orionProcOld.IsEffectiveComm?"Is an Effective Communicator":"Is Not an Effective Communicator")
                           + " to " + (orionProcCur.IsEffectiveComm?"Is an Effective Communicator":"Is Not an Effective Communicator") + ".";
            }
            if (orionProcOld.IsRepair != orionProcCur.IsRepair)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Is Repair changed from " + (orionProcOld.IsRepair?"Is a Repair":"Is Not a Repair")
                           + " to " + (orionProcCur.IsRepair?"Is a Repair":"Is Not a Repair") + ".";
            }
            //Medical fields--------------------------------------------------------------------------------------------------------------------------------
            if (procOld.MedicalCode != procCur.MedicalCode)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Medical Code changed from " + (procOld.MedicalCode == ""?"none":procOld.MedicalCode)
                           + " to " + (procCur.MedicalCode == ""?"none":procCur.MedicalCode) + ".";
            }
            if (procOld.DiagnosticCode != procCur.DiagnosticCode)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Diagnostic Code changed from " + (procOld.DiagnosticCode == ""?"none":procOld.DiagnosticCode)
                           + " to " + (procCur.DiagnosticCode == ""?"none":procCur.DiagnosticCode) + ".";
            }
            if (procOld.IsPrincDiag != procCur.IsPrincDiag)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Is Princ Diag changed from " + (procOld.IsPrincDiag?"Principal Diagnosis":"Not Principal Diagnosis")
                           + " to " + (procCur.IsPrincDiag?"Principal Diagnosis":"Not Principal Diagnosis") + ".";
            }
            //if(procOld.RevCode != procCur.RevCode) {
            //  if(Changes!=""){ Changes+="\r\n";}
            //  Changes+="Rev Code changed from "+POut.String(procOld.RevCode)+"' to '"+POut.String(procCur.RevCode)+".";
            //}
            //Proc status and billing fields----------------------------------------------------------------------------------------------------------------
            if (procOld.ProcStatus != procCur.ProcStatus)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Procedure Status changed from " + procOld.ProcStatus.ToString() + " to " + procCur.ProcStatus.ToString() + ".";
            }
            if (procOld.DateTP.Date != procCur.DateTP.Date && procOld.DateTP.Date != DateTime.MinValue.Date)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Date TP changed from " + procOld.DateTP.ToShortDateString() + " to " + procCur.DateTP.ToShortDateString() + ".";
            }
            //if(procOld.BillingTypeOne != procCur.BillingTypeOne) {
            //  if(Changes!=""){ Changes+="\r\n";}
            //  Changes+="Billing Type One changed from "+(procOld.BillingTypeOne!=0?Defs.GetDef(DefCat.BillingTypes,procOld.BillingTypeOne).ItemName:"none")
            //		+" to "+(procCur.BillingTypeOne!=0?Defs.GetDef(DefCat.BillingTypes,procCur.BillingTypeOne).ItemName:"none")+".";
            //}
            //if(procOld.BillingTypeTwo != procCur.BillingTypeTwo) {
            //  if(Changes!=""){ Changes+="\r\n";}
            //  Changes+="Billing Type Two changed from "+(procOld.BillingTypeTwo!=0?Defs.GetDef(DefCat.BillingTypes,procOld.BillingTypeTwo).ItemName:"none")
            //		+" to "+(procCur.BillingTypeTwo!=0?Defs.GetDef(DefCat.BillingTypes,procCur.BillingTypeTwo).ItemName:"none")+".";
            //}
            if (procOld.ProcNumLab != procCur.ProcNumLab)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Proc Num Lab changed from " + POut.Long(procOld.ProcNumLab) + " to " + POut.Long(procCur.ProcNumLab) + ".";
            }
            //if(procOld.UnitCode != procCur.UnitCode) {
            //  if(Changes!=""){ Changes+="\r\n";}
            //  Changes+="Unit Code changed from "+POut.String(procOld.UnitCode)+" to "+POut.String(procCur.UnitCode)+".";
            //}
            //UnitQty, Canadian Type Codes, and Note--------------------------------------------------------------------------------------------------------
            if (procOld.UnitQty != procCur.UnitQty)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Unit Quantity changed from " + POut.Int(procOld.UnitQty) + " to " + POut.Int(procCur.UnitQty) + ".";
            }
            //if(procOld.CanadianTypeCodes != procCur.CanadianTypeCodes) {
            //  if(Changes!=""){ Changes+="\r\n";}
            //  Changes+="Canadian Code Type changed from "+POut.String(procOld.CanadianTypeCodes)+" to "+POut.String(procCur.CanadianTypeCodes)+".";
            // }
            if (procOld.Note != procCur.Note && !(procOld.Note == null && procCur.Note == ""))         //Null note is equivalent to an empty note string.
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Note changed from " + (procOld.Note == ""?"none":"'" + procOld.Note + "'")
                           + " to " + (procCur.Note == ""?"none":"'" + procCur.Note + "'");
            }
            return(Changes);
        }