private void butOK_Click(object sender, EventArgs e)
 {
     if (textDatePlaced.errorProvider1.GetError(textDatePlaced) != "" ||
         textAmountTotal.errorProvider1.GetError(textAmountTotal) != "")
     {
         MsgBox.Show(this, "Please fix data entry errors first.");
         return;
     }
     if (textDatePlaced.Text == "")
     {
         Order.DatePlaced = new DateTime(2500, 1, 1);
     }
     else
     {
         Order.DatePlaced = PIn.Date(textDatePlaced.Text);
     }
     Order.AmountTotal = PIn.Double(textAmountTotal.Text);
     Order.Note        = textNote.Text;
     SupplyOrders.Update(Order);            //never new
     DialogResult = DialogResult.OK;
 }
        private void butRun_Click(object sender, EventArgs e)
        {
            if (textDateStart.errorProvider1.GetError(textDateStart) != "" ||
                textDateEnd.errorProvider1.GetError(textDateEnd) != "" ||
                textDateStart.Text == "" ||
                textDateEnd.Text == ""
                )
            {
                MsgBox.Show(this, "Please enter a valid date range.");
                return;
            }
            if (comboEncCodes.SelectedIndex == -1 &&
                textEncCodeValue.Text == "")
            {
                MsgBox.Show(this, "Please select a code.");
                return;
            }
            string codeValue;

            if (comboEncCodes.SelectedIndex == -1)
            {
                codeValue = textEncCodeValue.Text;
            }
            else
            {
                codeValue = comboEncCodes.SelectedItem.ToString();
            }
            long encInserted = Encounters.InsertEncsFromProcDates(PIn.Date(textDateStart.Text), PIn.Date(textDateEnd.Text), codeValue, EncCodeSystem);

            MessageBox.Show(Lan.g("FormEncounterTool", "Number of encounters inserted:") + " " + encInserted.ToString());
            if (PrefC.GetString(PrefName.CQMDefaultEncounterCodeValue) == "none")
            {
                if (MsgBox.Show(this, MsgBoxButtons.YesNo, "Do you want to set this code as the default encounter code?"))
                {
                    Prefs.UpdateString(PrefName.CQMDefaultEncounterCodeValue, codeValue);
                    Prefs.UpdateString(PrefName.CQMDefaultEncounterCodeSystem, EncCodeSystem);
                }
            }
            DialogResult = DialogResult.OK;
        }
Exemple #3
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     //the first 6 fields are handled when the ScreenGroup is saved.
     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.Race             = (PatientRaceOld)listRace.SelectedIndex;
     ScreenCur.GradeLevel       = (PatientGrade)comboGradeLevel.SelectedIndex;
     ScreenCur.Age              = PIn.Byte(textAge.Text);//"" is OK
     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, System.EventArgs e)
 {
     if (textDateStart.errorProvider1.GetError(textDateStart) != "" ||
         textDateStop.errorProvider1.GetError(textDateStop) != "" ||
         textDatePaycheck.errorProvider1.GetError(textDatePaycheck) != "")
     {
         MsgBox.Show(this, "Please fix data entry errors first.");
         return;
     }
     if (textDateStart.Text == "" || textDateStop.Text == "")
     {
         MsgBox.Show(this, "Start and end dates are required.");
         return;
     }
     _payPeriodCur.DateStart    = PIn.Date(textDateStart.Text);
     _payPeriodCur.DateStop     = PIn.Date(textDateStop.Text);
     _payPeriodCur.DatePaycheck = PIn.Date(textDatePaycheck.Text);
     PayPeriods.RefreshCache();             //Refresh the cache to include any other changes that might have been made in FormTimeCardSetup.
     if (PayPeriods.AreAnyOverlapping(PayPeriods.GetDeepCopy(), new List <PayPeriod>()
     {
         _payPeriodCur
     }))
     {
         MsgBox.Show(this, "This pay period overlaps with existing pay periods. Please fix this pay period first.");
         return;
     }
     if (IsSaveToDb)
     {
         if (IsNew)
         {
             PayPeriods.Insert(_payPeriodCur);
         }
         else
         {
             PayPeriods.Update(_payPeriodCur);
         }
     }
     DialogResult = DialogResult.OK;
 }
        private void butOK_Click(object sender, EventArgs e)
        {
            if (!Security.IsAuthorized(Permissions.Setup))
            {
                return;
            }
            if (textDate1.errorProvider1.GetError(textDate1) != "" ||
                textDate2.errorProvider1.GetError(textDate2) != "")
            {
                MsgBox.Show(this, "Please fix data entry errors first.");
                return;
            }
            DateTime date1 = PIn.Date(textDate1.Text);
            DateTime date2 = PIn.Date(textDate2.Text);

            if (date1 > date2)
            {
                MsgBox.Show(this, "Date 1 cannot be greater than Date 2.");
                return;
            }
            if (date1.AddDays(7) < date2)
            {
                if (!Security.IsAuthorized(Permissions.SecurityAdmin, true))
                {
                    MsgBox.Show(this, "Admin permission is required for date spans greater than 7 days.");
                    return;
                }
            }
            Procedures.Lock(date1, date2);
            if (date1.AddDays(7) < date2)
            {
                SecurityLogs.MakeLogEntry(Permissions.SecurityAdmin, 0, "Proc Lock Tool " + date1.ToShortDateString() + " - " + date2.ToShortDateString());
            }
            else
            {
                SecurityLogs.MakeLogEntry(Permissions.Setup, 0, "Proc Lock Tool " + date1.ToShortDateString() + " - " + date2.ToShortDateString());
            }
            DialogResult = DialogResult.OK;
        }
        ///<summary>Validates the fields on the form.  Returns false is something is not filled out correctly.</summary>
        private bool IsValid()
        {
            //validate user input
            if (textDateFrom.errorProvider1.GetError(textDateFrom) != "" ||
                textDateTo.errorProvider1.GetError(textDateTo) != "")
            {
                MessageBox.Show(Lan.g(this, "Please fix data entry errors first."));
                return(false);
            }
            if (textDateFrom.Text.Length == 0 ||
                textDateTo.Text.Length == 0)
            {
                MessageBox.Show(Lan.g(this, "From and To dates are required."));
                return(false);
            }
            DateTime dateFrom = PIn.Date(textDateFrom.Text);
            DateTime dateTo   = PIn.Date(textDateTo.Text);

            if (dateTo < dateFrom)
            {
                MessageBox.Show(Lan.g(this, "To date cannot be before From date."));
                return(false);
            }
            if (!checkAllProvs.Checked && listProvs.SelectedIndices.Count == 0)
            {
                MessageBox.Show(Lan.g(this, "You must select at least one provider."));
                return(false);
            }
            if (_hasClinicsEnabled)             //Not no clinics.
            {
                if (!checkAllClinics.Checked && listClinics.SelectedIndices.Count == 0)
                {
                    MsgBox.Show(this, "You must select at least one clinic.");
                    return(false);
                }
            }
            return(true);
        }
Exemple #7
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (textDate.errorProvider1.GetError(textDate) != "" ||
         textPrincipal.errorProvider1.GetError(textPrincipal) != "" ||
         textInterest.errorProvider1.GetError(textInterest) != ""
         )
     {
         MessageBox.Show(Lan.g(this, "Please fix data entry errors first."));
         return;
     }
     //if(comboProvNum.SelectedIndex==-1){
     //	MsgBox.Show(this,"Please select a provider first.");
     //	return;
     //}
     if (textPrincipal.Text == "")
     {
         textPrincipal.Text = "0";
     }
     if (textInterest.Text == "")
     {
         textInterest.Text = "0";
     }
     //todo: test dates?  The day of the month should be the same as all others
     PayPlanChargeCur.ChargeDate = PIn.Date(textDate.Text);
     PayPlanChargeCur.Principal  = PIn.Double(textPrincipal.Text);
     PayPlanChargeCur.Interest   = PIn.Double(textInterest.Text);
     PayPlanChargeCur.Note       = textNote.Text;
     //not allowed to change provnum or clinicNum here.
     if (IsNew)
     {
         PayPlanCharges.Insert(PayPlanChargeCur);
     }
     else
     {
         PayPlanCharges.Update(PayPlanChargeCur);
     }
     DialogResult = DialogResult.OK;
 }
Exemple #8
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (textDate.errorProvider1.GetError(textDate) != "" ||
         textInsUsed.errorProvider1.GetError(textInsUsed) != "" ||
         textDedUsed.errorProvider1.GetError(textDedUsed) != ""
         )
     {
         MessageBox.Show(Lan.g("All", "Please fix data entry errors first."));
         return;
     }
     ClaimProcCur.ProcDate   = PIn.Date(textDate.Text);
     ClaimProcCur.InsPayAmt  = PIn.Double(textInsUsed.Text);
     ClaimProcCur.DedApplied = PIn.Double(textDedUsed.Text);
     if (IsNew)
     {
         ClaimProcs.Insert(ClaimProcCur);
     }
     else
     {
         ClaimProcs.Update(ClaimProcCur);
     }
     DialogResult = DialogResult.OK;
 }
Exemple #9
0
        private void butCopyDay_Click(object sender, EventArgs e)
        {
            if (textDateFrom.errorProvider1.GetError(textDateFrom) != "" ||
                textDateTo.errorProvider1.GetError(textDateTo) != "")
            {
                MsgBox.Show(this, "Please fix errors first.");
                return;
            }
            if (gridMain.SelectedCell.X == -1)
            {
                MsgBox.Show(this, "Please select a date first.");
                return;
            }
            int selectedCol = gridMain.SelectedCell.X;

            if (!checkWeekend.Checked)
            {
                selectedCol++;
            }
            DateCopyStart      = Schedules.GetDateCal(PIn.Date(textDateFrom.Text), gridMain.SelectedCell.Y, selectedCol);
            DateCopyEnd        = DateCopyStart;
            textClipboard.Text = DateCopyStart.ToShortDateString();
        }
Exemple #10
0
        private void FillGrid()
        {
            _listScreenGroups = ScreenGroups.Refresh(PIn.Date(textDateFrom.Text), PIn.Date(textDateTo.Text));
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col;

            col = new ODGridColumn(Lan.g(this, "Date"), 70);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Description"), 140);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow row;

            foreach (ScreenGroup screenGroup in _listScreenGroups)
            {
                row = new ODGridRow();
                row.Cells.Add(screenGroup.SGDate.ToShortDateString());
                row.Cells.Add(screenGroup.Description);
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
Exemple #11
0
 ///<summary>Surround with try-catch.  Attempts to take the data on the form and set the values of RefAttachCur.</summary>
 private void DataToCur()
 {
     if (textOrder.errorProvider1.GetError(textOrder) != "" ||
         textRefDate.errorProvider1.GetError(textRefDate) != "" ||
         textDateProcCompleted.errorProvider1.GetError(textDateProcCompleted) != "")
     {
         throw new ApplicationException(Lan.g(this, "Please fix data entry errors first."));
     }
     if (listFromTo.SelectedIndex == 0)
     {
         RefAttachCur.IsFrom = true;
     }
     else
     {
         RefAttachCur.IsFrom = false;
     }
     RefAttachCur.RefDate            = PIn.Date(textRefDate.Text);
     RefAttachCur.ItemOrder          = PIn.Int(textOrder.Text);
     RefAttachCur.RefToStatus        = (ReferralToStatus)comboRefToStatus.SelectedIndex;
     RefAttachCur.Note               = textNote.Text;
     RefAttachCur.IsTransitionOfCare = checkIsTransitionOfCare.Checked;
     RefAttachCur.DateProcComplete   = PIn.Date(textDateProcCompleted.Text);
 }
Exemple #12
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (textDateStart.errorProvider1.GetError(textDateStart) != "" ||
         textDateStop.errorProvider1.GetError(textDateStop) != "")
     {
         MsgBox.Show(this, "Please fix date.");
         return;
     }
     DiseaseCur.DateStart  = PIn.Date(textDateStart.Text);
     DiseaseCur.DateStop   = PIn.Date(textDateStop.Text);
     DiseaseCur.ProbStatus = (ProblemStatus)comboStatus.SelectedIndex;
     DiseaseCur.PatNote    = textNote.Text;
     //Todo: Save DateStop and DateStart values.
     if (IsNew)
     {
         Diseases.Insert(DiseaseCur);
     }
     else
     {
         Diseases.Update(DiseaseCur);
     }
     DialogResult = DialogResult.OK;
 }
        private void butIntervention_Click(object sender, EventArgs e)
        {
            if (comboSmokeStatus.SelectedIndex == 0)           //None
            {
                MessageBox.Show("You must select a smoking status.");
                return;
            }
            FormInterventionEdit FormInt = new FormInterventionEdit();

            FormInt.InterventionCur           = new Intervention();
            FormInt.InterventionCur.IsNew     = true;
            FormInt.InterventionCur.PatNum    = PatCur.PatNum;
            FormInt.InterventionCur.ProvNum   = PatCur.PriProv;
            FormInt.InterventionCur.DateEntry = PIn.Date(textDateAssessed.Text);
            FormInt.InterventionCur.CodeSet   = InterventionCodeSet.TobaccoCessation;
            FormInt.IsAllTypes      = false;
            FormInt.IsSelectionMode = true;
            FormInt.ShowDialog();
            if (FormInt.DialogResult == DialogResult.OK)
            {
                FillGrid();
            }
        }
Exemple #14
0
 ///<summary>Attempts to save, returning true if successful.</summary>
 private bool SaveRx()
 {
     if (textDate.errorProvider1.GetError(textDate) != ""
         //|| textRxNorm.errorProvider1.GetError(textRxNorm)!=""
         )
     {
         MessageBox.Show(Lan.g(this, "Please fix data entry errors first."));
         return(false);
     }
     RxPatCur.ProvNum      = _provNumSelected;
     RxPatCur.RxDate       = PIn.Date(textDate.Text);
     RxPatCur.Drug         = textDrug.Text;
     RxPatCur.IsControlled = checkControlled.Checked;
     RxPatCur.Sig          = textSig.Text;
     RxPatCur.Disp         = textDisp.Text;
     RxPatCur.Refills      = textRefills.Text;
     RxPatCur.DosageCode   = textDosageCode.Text;
     RxPatCur.Notes        = textNotes.Text;
     RxPatCur.SendStatus   = (RxSendStatus)comboSendStatus.SelectedIndex;
     //pharmacy is set when using pick button.
     if (IsNew)
     {
         RxPatCur.RxNum = RxPats.Insert(RxPatCur);
         //SecurityLogs.MakeLogEntry("Prescription Create",RxPats.cmd.CommandText,user);
         if (FormProcGroup.IsOpen)
         {
             FormProcGroup.RxNum = RxPatCur.RxNum;
         }
     }
     else
     {
         RxPats.Update(RxPatCur);
         //SecurityLogs.MakeLogEntry("Prescription Edit",RxPats.cmd.CommandText,user);
     }
     IsNew = false;          //so that we can save it again after printing if needed.
     return(true);
 }
Exemple #15
0
 private void ToggleCalendars()
 {
     if (calendarFrom.Visible)
     {
         //hide the calendars
         calendarFrom.Visible = false;
         calendarTo.Visible   = false;
         FillGrid();
     }
     else
     {
         //set the date on the calendars to match what's showing in the boxes
         if (textDateFrom.errorProvider1.GetError(textDateFrom) == "" &&
             textDateTo.errorProvider1.GetError(textDateTo) == "")
         {                //if no date errors
             if (textDateFrom.Text == "")
             {
                 calendarFrom.SetDate(DateTime.Today);
             }
             else
             {
                 calendarFrom.SetDate(PIn.Date(textDateFrom.Text));
             }
             if (textDateTo.Text == "")
             {
                 calendarTo.SetDate(DateTime.Today);
             }
             else
             {
                 calendarTo.SetDate(PIn.Date(textDateTo.Text));
             }
         }
         //show the calendars
         calendarFrom.Visible = true;
         calendarTo.Visible   = true;
     }
 }
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (textDateEntry.Text == "" || textDateEntry.errorProvider1.GetError(textDateEntry) != "")
            {
                MsgBox.Show(this, "Please fix data entry errors first.");
                return;
            }
            //user brought in an existing entry and may have modified it so get rid of it and recreate it in its entirety
            //EG...
            //user brought in 9/27/13 Checked: TRUE...
            //then changed date to 9/28/13 Checked: FALSE...
            //user has expectation that the 9/27 entry will be gone and new 9/28 entry will be created
            if (!PhoneGraphCur.IsNew)
            {
                PhoneGraphs.Delete(PhoneGraphCur.PhoneGraphNum);
            }
            PhoneGraph pg = new PhoneGraph();

            pg.EmployeeNum = EmployeeNum;
            pg.DateEntry   = PIn.Date(textDateEntry.Text);
            pg.IsGraphed   = checkIsGraphed.Checked;
            PhoneGraphs.InsertOrUpdate(pg);
            DialogResult = DialogResult.OK;
        }
Exemple #17
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (PayPlanChargeCur.Principal < 0 &&      //Payment plan adjustments are always negative
         textPrincipal.errorProvider1.GetError(textPrincipal) != "")                 //This will ensure number is negative due to defined range.
     {
         MsgBox.Show(this, "Adjustments must be negative.");
         return;
     }
     if (textDate.errorProvider1.GetError(textDate) != "" ||
         textPrincipal.errorProvider1.GetError(textPrincipal) != "" ||
         textInterest.errorProvider1.GetError(textInterest) != ""
         )
     {
         MessageBox.Show(Lan.g(this, "Please fix data entry errors first."));
         return;
     }
     //if(comboProvNum.SelectedIndex==-1){
     //	MsgBox.Show(this,"Please select a provider first.");
     //	return;
     //}
     if (textPrincipal.Text == "")
     {
         textPrincipal.Text = "0";
     }
     if (textInterest.Text == "")
     {
         textInterest.Text = "0";
     }
     //todo: test dates?  The day of the month should be the same as all others
     PayPlanChargeCur.ChargeDate = PIn.Date(textDate.Text);
     PayPlanChargeCur.Principal  = PIn.Double(textPrincipal.Text);
     PayPlanChargeCur.Interest   = PIn.Double(textInterest.Text);
     PayPlanChargeCur.Note       = textNote.Text;
     //not allowed to change provnum or clinicNum here.
     DialogResult = DialogResult.OK;
 }
Exemple #18
0
 ///<summary>Remember that this can only happen if IsNew</summary>
 private void butRefresh_Click(object sender, System.EventArgs e)
 {
     if (textDateStart.errorProvider1.GetError(textDate) != "")
     {
         MsgBox.Show(this, "Please fix data entry errors first.");
         return;
     }
     FillGrids();
     gridPat.SetSelected(true);
     gridIns.SetSelected(true);
     ComputeAmt();
     if (comboClinic.SelectedIndex == 0)
     {
         textBankAccountInfo.Text = PrefC.GetString(PrefName.PracticeBankNumber);
     }
     else
     {
         textBankAccountInfo.Text = Clinics.List[comboClinic.SelectedIndex - 1].BankNumber;
     }
     if (Prefs.UpdateString(PrefName.DateDepositsStarted, POut.Date(PIn.Date(textDateStart.Text), false)))
     {
         changed = true;
     }
 }
Exemple #19
0
        private void FillGrid()
        {
            ScreenGroupList = ScreenGroups.Refresh(PIn.Date(textDateFrom.Text), PIn.Date(textDateTo.Text));
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col;

            col = new ODGridColumn(Lan.g(this, "Date"), 70);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Description"), 140);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow row;

            ListViewItem[] items = new ListViewItem[ScreenGroupList.Count];
            for (int i = 0; i < items.Length; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(ScreenGroupList[i].SGDate.ToShortDateString());
                row.Cells.Add(ScreenGroupList[i].Description);
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
Exemple #20
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (textProcDate.errorProvider1.GetError(textProcDate) != "" ||
                textAmount.errorProvider1.GetError(textAmount) != "")
            {
                MsgBox.Show(this, "Please fix data entry errors first.");
                return;
            }
            if (textProcDate.Text == "")
            {
                MsgBox.Show(this, "Please enter a date first.");
                return;
            }
            if (_procCur.ProcStatus == ProcStat.C && PIn.Date(textProcDate.Text) > DateTime.Today.Date && !PrefC.GetBool(PrefName.FutureTransDatesAllowed))
            {
                MsgBox.Show(this, "Completed procedures cannot be set for future dates.");
                return;
            }
            if (textAmount.Text == "")
            {
                MsgBox.Show(this, "Please enter an amount.");
                return;
            }
            _procCur.ProcDate    = PIn.Date(textProcDate.Text);
            _procCur.ProcFee     = PIn.Double(textAmount.Text);
            _procCur.Note        = textChartNotes.Text;
            _procCur.BillingNote = textAccountNotes.Text;
            _procCur.ProvNum     = _selectedProvNum;
            _procCur.ClinicNum   = _selectedClinicNum;
            Procedures.Update(_procCur, _procOld);
            ProcedureCode procedureCode = ProcedureCodes.GetProcCode(_procCur.CodeNum);
            string        logText       = procedureCode.ProcCode + " (" + _procCur.ProcStatus + "), " + Lan.g(this, "Fee") + ": " + _procCur.ProcFee.ToString("c") + ", " + procedureCode.Descript;

            SecurityLogs.MakeLogEntry(Permissions.ProcComplEdit, _procCur.PatNum, logText);
            DialogResult = DialogResult.OK;
        }
Exemple #21
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (comboType.SelectedIndex == -1)
            {
                MsgBox.Show(this, "Please pick a type first.");
                return;
            }
            if (textDateDue.errorProvider1.GetError(textDateDue) != "" ||
                textYears.errorProvider1.GetError(textYears) != "" ||
                textMonths.errorProvider1.GetError(textMonths) != "" ||
                textWeeks.errorProvider1.GetError(textWeeks) != "" ||
                textDays.errorProvider1.GetError(textDays) != "" ||
                textBalance.errorProvider1.GetError(textBalance) != "" ||
                textDisableDate.errorProvider1.GetError(textDisableDate) != "")
            {
                MsgBox.Show(this, "Please fix data entry errors first.");
                return;
            }
            double disableUntilBalance = PIn.Double(textBalance.Text);

            if (disableUntilBalance < 0)
            {
                MsgBox.Show(this, "Disabled balance must be greater than zero.");
                return;
            }
            RecallCur.RecallTypeNum         = _listRecallTypes[comboType.SelectedIndex].RecallTypeNum;
            RecallCur.IsDisabled            = checkIsDisabled.Checked;
            RecallCur.DisableUntilBalance   = disableUntilBalance;
            RecallCur.DisableUntilDate      = PIn.Date(textDisableDate.Text);
            RecallCur.DateDue               = PIn.Date(textDateDue.Text);
            RecallCur.RecallInterval.Years  = PIn.Int(textYears.Text);
            RecallCur.RecallInterval.Months = PIn.Int(textMonths.Text);
            RecallCur.RecallInterval.Weeks  = PIn.Int(textWeeks.Text);
            RecallCur.RecallInterval.Days   = PIn.Int(textDays.Text);
            if (comboStatus.SelectedIndex == 0)
            {
                RecallCur.RecallStatus = 0;
            }
            else
            {
                RecallCur.RecallStatus
                    = _listRecallUnschedStatusDefs[comboStatus.SelectedIndex - 1].DefNum;
            }
            RecallCur.Note     = textNote.Text;
            RecallCur.Priority = (checkASAP.Checked ? RecallPriority.ASAP : RecallPriority.Normal);
            if (IsNew)
            {
                //if(Recalls.IsAllDefault(RecallCur)){//only save if something meaningful
                //	MsgBox.Show(this,"Recall cannot be saved if all values are still default.");
                //	return;
                //}
                Recalls.Insert(RecallCur);
                SecurityLogs.MakeLogEntry(Permissions.RecallEdit, RecallCur.PatNum, "Recall added from the Edit Recall window.");
            }
            else
            {
                /*if(Recalls.IsAllDefault(RecallCur)){
                 *      if(!MsgBox.Show(this,true,"All values are default.  This recall will be deleted.  Continue?")){
                 *              return;
                 *      }
                 *      Recalls.Delete(RecallCur);
                 *      DialogResult=DialogResult.OK;
                 *      return;
                 * }
                 * else{*/
                Recalls.Update(RecallCur);
                SecurityLogs.MakeLogEntry(Permissions.RecallEdit, RecallCur.PatNum, "Recall edited from the Edit Recall window.");
                //}
            }
            //Recalls.Synch(PatCur.PatNum,RecallCur);//This was moved up into FormRecallsPat.FillGrid.  This is the only way to access a recall.
            DialogResult = DialogResult.OK;
        }
        ///<summary>Gets all unsent claims in the database between the user entered date range and with the appropriate user selected filters.</summary>
        private void FillGrid()
        {
            if (!ValidateFilters())
            {
                return;
            }
            List <long> listClinicNums = GetSelectedClinicNums();
            DataTable   table          = RpClaimNotSent.GetClaimsNotSent(_startDate, _endDate, listClinicNums, false
                                                                         , (ClaimNotSentStatuses)comboBoxInsFilter.SelectedItem);//this query can get slow with a large number of clinics (like NADG)

            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col;

            if (PrefC.HasClinicsEnabled)
            {
                col = new ODGridColumn(Lan.g(gridMain.TranslationName, "Clinic"), 90);
                gridMain.Columns.Add(col);
            }
            col = new ODGridColumn(Lan.g(gridMain.TranslationName, "Date of Service"), 90, GridSortingStrategy.DateParse);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(gridMain.TranslationName, "Claim Type"), 90);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(gridMain.TranslationName, "Claim Status"), 100);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(gridMain.TranslationName, "Patient Name"), 150);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(gridMain.TranslationName, "Carrier Name"), 150);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(gridMain.TranslationName, "Claim Fee"), 90, GridSortingStrategy.AmountParse);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(gridMain.TranslationName, "Proc Codes"), 100);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                row = new ODGridRow();
                if (PrefC.HasClinicsEnabled)
                {
                    row.Cells.Add(table.Rows[i]["Clinic"].ToString());
                }
                DateTime dateService = PIn.Date(table.Rows[i]["DateService"].ToString());
                row.Cells.Add(dateService.ToShortDateString());
                string type = table.Rows[i]["ClaimType"].ToString();
                switch (type)
                {
                case "P":
                    type = "Pri";
                    break;

                case "S":
                    type = "Sec";
                    break;

                case "PreAuth":
                    type = "Preauth";
                    break;

                case "Other":
                    type = "Other";
                    break;

                case "Cap":
                    type = "Cap";
                    break;

                case "Med":
                    type = "Medical";                          //For possible future use.
                    break;

                default:
                    type = "Error";                          //Not allowed to be blank.
                    break;
                }
                row.Cells.Add(type);
                row.Cells.Add(table.Rows[i]["ClaimStatus"].ToString());
                row.Cells.Add(table.Rows[i]["Patient Name"].ToString());
                row.Cells.Add(table.Rows[i]["CarrierName"].ToString());
                row.Cells.Add(PIn.Double(table.Rows[i]["ClaimFee"].ToString()).ToString("c"));
                row.Cells.Add(table.Rows[i]["ProcCodes"].ToString());
                UnsentInsClaim unsentClaim = new UnsentInsClaim();
                unsentClaim.ClaimNum = PIn.Long(table.Rows[i]["ClaimNum"].ToString());
                unsentClaim.PatNum   = PIn.Long(table.Rows[i]["PatNum"].ToString());
                ClaimTracking claimTrackingCur = _listNewClaimTrackings.FirstOrDefault(x => x.ClaimNum == unsentClaim.ClaimNum);
                if (claimTrackingCur != null)
                {
                    unsentClaim.ClaimTrackingNum = claimTrackingCur.ClaimTrackingNum;
                }
                row.Tag = unsentClaim;
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
Exemple #23
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            string  bDate;
            string  eDate;
            decimal rcvStart      = 0;
            decimal rcvProd       = 0;
            decimal rcvAdj        = 0;
            decimal rcvWriteoff   = 0;
            decimal rcvPayment    = 0;
            decimal rcvInsPayment = 0;
            decimal runningRcv    = 0;
            decimal rcvDaily      = 0;

            decimal[] ColTotal = new decimal[8];
            string    wMonth;
            string    wYear;
            string    wDay = "01";
            string    wDate;

            // Get the year / month and instert the 1st of the month for stop point for calculated running balance
            wYear  = date1.SelectionStart.Year.ToString();
            wMonth = date1.SelectionStart.Month.ToString();
            if (wMonth.Length < 2)
            {
                wMonth = "0" + wMonth;
            }
            wDate = wYear + "-" + wMonth + "-" + wDay;

            ReportSimpleGrid report = new ReportSimpleGrid();
            //
            // Create temperary tables for sorting data
            //
            DataTable TableCharge      = new DataTable();      //charges
            DataTable TableCapWriteoff = new DataTable();      //capComplete writeoffs
            DataTable TableInsWriteoff = new DataTable();      //ins writeoffs
            DataTable TablePay         = new DataTable();      //payments - Patient
            DataTable TableIns         = new DataTable();      //payments - Ins, added SPK
            DataTable TableAdj         = new DataTable();      //adjustments

            //
            // Main Loop:  This will loop twice 1st loop gets running balance to start of month selected
            //             2nd will break the numbers dow by day and calculate the running balances
            //
            for (int j = 0; j <= 1; j++)
            {
                if (j == 0)
                {
                    bDate = "0001-01-01";
                    eDate = wDate;
                }
                else
                {
                    bDate = wDate;
                    eDate = POut.Date(date1.SelectionStart.AddDays(1)).Substring(1, 10); // Needed because all Queries are < end date to get correct Starting AR
                }
                string whereProv;                                                        //used as the provider portion of the where clauses.
                //each whereProv needs to be set up separately for each query
                string whereProvx;                                                       //Extended for more than 4 names
                whereProv = "";
                if (listProv.SelectedIndices[0] != 0)
                {
                    for (int i = 0; i < listProv.SelectedIndices.Count; i++)
                    {
                        if (i == 0)
                        {
                            whereProv += " AND (";
                        }
                        else
                        {
                            whereProv += "OR ";
                        }
                        whereProv += "procedurelog.ProvNum = "
                                     + POut.Long(ProviderC.ListShort[listProv.SelectedIndices[i] - 1].ProvNum) + " ";
                    }
                    whereProv += ") ";
                }
                report.Query = "SELECT procedurelog.ProcDate, "
                               + "SUM(procedurelog.ProcFee*(CASE procedurelog.UnitQty+procedurelog.BaseUnits WHEN 0 THEN 1 ELSE procedurelog.UnitQty+procedurelog.BaseUnits END)) "
                               + "FROM procedurelog "
                               + "WHERE procedurelog.ProcDate >= '" + bDate + "' "
                               + "AND procedurelog.ProcDate < '" + eDate + "' "
                               + "AND procedurelog.ProcStatus = '2' "
                               + whereProv
                               + "GROUP BY procedurelog.ProcDate "
                               + "ORDER BY procedurelog.ProcDate";
                TableCharge = report.GetTempTable();
                whereProv   = "";
                if (listProv.SelectedIndices[0] != 0)
                {
                    for (int i = 0; i < listProv.SelectedIndices.Count; i++)
                    {
                        if (i == 0)
                        {
                            whereProv += " AND (";
                        }
                        else
                        {
                            whereProv += "OR ";
                        }
                        whereProv += "claimproc.ProvNum = "
                                     + POut.Long(ProviderC.ListShort[listProv.SelectedIndices[i] - 1].ProvNum) + " ";
                    }
                    whereProv += ") ";
                }
                if (radioWriteoffPay.Checked)
                {
                    report.Query = "SELECT DateCP, "
                                   + "SUM(WriteOff) FROM claimproc WHERE "
                                   + "DateCP >= '" + bDate + "' "
                                   + "AND DateCP < '" + eDate + "' "
                                   + "AND Status = '7' "//CapComplete
                                   + whereProv
                                   + " GROUP BY DateCP "
                                   + "ORDER BY DateCP";
                }
                else
                {
                    report.Query = "SELECT ProcDate, "
                                   + "SUM(WriteOff) FROM claimproc WHERE "
                                   + "ProcDate >= '" + bDate + "' "
                                   + "AND ProcDate < '" + eDate + "' "
                                   + "AND Status = '7' "//CapComplete
                                   + whereProv
                                   + " GROUP BY ProcDate "
                                   + "ORDER BY ProcDate";
                }

                TableCapWriteoff = report.GetTempTable();
                whereProv        = "";
                if (listProv.SelectedIndices[0] != 0)
                {
                    for (int i = 0; i < listProv.SelectedIndices.Count; i++)
                    {
                        if (i == 0)
                        {
                            whereProv += " AND (";
                        }
                        else
                        {
                            whereProv += "OR ";
                        }
                        whereProv += "ProvNum = "
                                     + POut.Long(ProviderC.ListShort[listProv.SelectedIndices[i] - 1].ProvNum) + " ";
                    }
                    whereProv += ") ";
                }
                if (radioWriteoffPay.Checked)
                {
                    report.Query = "SELECT DateCP, "
                                   + "SUM(WriteOff) FROM claimproc WHERE "
                                   + "DateCP >= '" + bDate + "' "
                                   + "AND DateCP < '" + eDate + "' "
                                   + "AND Status IN (1,4,5) "//Recieved, supplemental, capclaim. Otherwise, it's only an estimate. 7-CapCompl handled above.
                                   + whereProv
                                   + " GROUP BY DateCP "
                                   + "ORDER BY DateCP";
                }
                else
                {
                    report.Query = "SELECT ProcDate, "
                                   + "SUM(WriteOff) FROM claimproc WHERE "
                                   + "ProcDate >= '" + bDate + "' "
                                   + "AND ProcDate < '" + eDate + "' "
                                   + "AND Status IN (0,1,4,5) " //Notreceived, received, supplemental, capclaim. 7-CapCompl handled above.
                                   + whereProv
                                   + " GROUP BY ProcDate "
                                   + "ORDER BY ProcDate";
                }
                TableInsWriteoff = report.GetTempTable();
                whereProv        = "";
                if (listProv.SelectedIndices[0] != 0)
                {
                    for (int i = 0; i < listProv.SelectedIndices.Count; i++)
                    {
                        if (i == 0)
                        {
                            whereProv += " AND (";
                        }
                        else
                        {
                            whereProv += "OR ";
                        }
                        whereProv += "paysplit.ProvNum = "
                                     + POut.Long(ProviderC.ListShort[listProv.SelectedIndices[i] - 1].ProvNum) + " ";
                    }
                    whereProv += ") ";
                }
                report.Query = "SELECT paysplit.DatePay,SUM(paysplit.splitamt) FROM paysplit "
                               + "WHERE paysplit.PayPlanNum=0 "
                               + "AND paysplit.DatePay >= '" + bDate + "' "
                               + "AND paysplit.DatePay < '" + eDate + "' "
                               + whereProv
                               + " GROUP BY paysplit.DatePay ORDER BY DatePay";
                TablePay  = report.GetTempTable();
                whereProv = "";
                if (listProv.SelectedIndices[0] != 0)
                {
                    for (int i = 0; i < listProv.SelectedIndices.Count; i++)
                    {
                        if (i == 0)
                        {
                            whereProv += " AND (";
                        }
                        else
                        {
                            whereProv += "OR ";
                        }
                        whereProv += "claimproc.ProvNum = "
                                     + POut.Long(ProviderC.ListShort[listProv.SelectedIndices[i] - 1].ProvNum) + " ";
                    }
                    whereProv += ") ";
                }
                report.Query = "SELECT DateCP,SUM(InsPayamt) "
                               + "FROM claimproc WHERE "
                               + "Status IN (1,4,5,7) "//Received, supplemental, capclaim, capcomplete.
                               + "AND DateCP >= '" + bDate + "' "
                               + "AND DateCP < '" + eDate + "' "
                               + whereProv
                               + " GROUP BY DateCP ORDER BY DateCP";
                TableIns  = report.GetTempTable();
                whereProv = "";
                if (listProv.SelectedIndices[0] != 0)
                {
                    for (int i = 0; i < listProv.SelectedIndices.Count; i++)
                    {
                        if (i == 0)
                        {
                            whereProv += " AND (";
                        }
                        else
                        {
                            whereProv += "OR ";
                        }
                        whereProv += "ProvNum = "
                                     + POut.Long(ProviderC.ListShort[listProv.SelectedIndices[i] - 1].ProvNum) + " ";
                    }
                    whereProv += ") ";
                }
                report.Query = "SELECT adjdate, SUM(adjamt) FROM adjustment WHERE "
                               + "adjdate >= '" + bDate + "' "
                               + "AND adjdate < '" + eDate + "' "
                               + whereProv
                               + " GROUP BY adjdate ORDER BY adjdate";
                TableAdj = report.GetTempTable();
                //1st Loop Calculate running Accounts Receivable upto the 1st of the Month Selected
                //2nd Loop Calculate the Daily Accounts Receivable upto the Date Selected
                //Finaly Generate Report showing the breakdown upto the date specified with totals for what is on the report
                if (j == 0)
                {
                    for (int k = 0; k < TableCharge.Rows.Count; k++)
                    {
                        rcvProd += PIn.Decimal(TableCharge.Rows[k][1].ToString());
                    }
                    for (int k = 0; k < TableCapWriteoff.Rows.Count; k++)
                    {
                        rcvWriteoff += PIn.Decimal(TableCapWriteoff.Rows[k][1].ToString());
                    }
                    for (int k = 0; k < TableInsWriteoff.Rows.Count; k++)
                    {
                        rcvWriteoff += PIn.Decimal(TableInsWriteoff.Rows[k][1].ToString());
                    }
                    for (int k = 0; k < TablePay.Rows.Count; k++)
                    {
                        rcvPayment += PIn.Decimal(TablePay.Rows[k][1].ToString());
                    }
                    for (int k = 0; k < TableIns.Rows.Count; k++)
                    {
                        rcvInsPayment += PIn.Decimal(TableIns.Rows[k][1].ToString());
                    }
                    for (int k = 0; k < TableAdj.Rows.Count; k++)
                    {
                        rcvAdj += PIn.Decimal(TableAdj.Rows[k][1].ToString());
                    }
                    TableCharge.Clear();
                    TableCapWriteoff.Clear();
                    TableInsWriteoff.Clear();
                    TablePay.Clear();
                    TableIns.Clear();
                    TableAdj.Clear();
                    rcvStart = (rcvProd + rcvAdj - rcvWriteoff) - (rcvPayment + rcvInsPayment);
                }
                else
                {
                    rcvAdj        = 0;
                    rcvInsPayment = 0;
                    rcvPayment    = 0;
                    rcvProd       = 0;
                    rcvWriteoff   = 0;
                    rcvDaily      = 0;
                    runningRcv    = rcvStart;
                    report.TableQ = new DataTable(null);                         //new table with 7 columns
                    for (int l = 0; l < 8; l++)                                  //add columns
                    {
                        report.TableQ.Columns.Add(new System.Data.DataColumn()); //blank columns
                    }
                    report.InitializeColumns();
                    eDate = POut.Date(date1.SelectionStart).Substring(1, 10); // Reset EndDate to Selected Date
                    DateTime[] dates = new DateTime[(PIn.Date(eDate) - PIn.Date(bDate)).Days + 1];
                    for (int i = 0; i < dates.Length; i++)                    //usually 31 days in loop
                    {
                        dates[i] = PIn.Date(bDate).AddDays(i);
                        //create new row called 'row' based on structure of TableQ
                        DataRow row = report.TableQ.NewRow();
                        row[0] = dates[i].ToShortDateString();
                        for (int k = 0; k < TableCharge.Rows.Count; k++)
                        {
                            if (dates[i] == (PIn.Date(TableCharge.Rows[k][0].ToString())))
                            {
                                rcvProd += PIn.Decimal(TableCharge.Rows[k][1].ToString());
                            }
                        }
                        for (int k = 0; k < TableCapWriteoff.Rows.Count; k++)
                        {
                            if (dates[i] == (PIn.Date(TableCapWriteoff.Rows[k][0].ToString())))
                            {
                                rcvWriteoff += PIn.Decimal(TableCapWriteoff.Rows[k][1].ToString());
                            }
                        }
                        for (int k = 0; k < TableAdj.Rows.Count; k++)
                        {
                            if (dates[i] == (PIn.Date(TableAdj.Rows[k][0].ToString())))
                            {
                                rcvAdj += PIn.Decimal(TableAdj.Rows[k][1].ToString());
                            }
                        }
                        for (int k = 0; k < TableInsWriteoff.Rows.Count; k++)
                        {
                            if (dates[i] == (PIn.Date(TableInsWriteoff.Rows[k][0].ToString())))
                            {
                                rcvWriteoff += PIn.Decimal(TableInsWriteoff.Rows[k][1].ToString());
                            }
                        }
                        for (int k = 0; k < TablePay.Rows.Count; k++)
                        {
                            if (dates[i] == (PIn.Date(TablePay.Rows[k][0].ToString())))
                            {
                                rcvPayment += PIn.Decimal(TablePay.Rows[k][1].ToString());
                            }
                        }
                        for (int k = 0; k < TableIns.Rows.Count; k++)
                        {
                            if (dates[i] == (PIn.Date(TableIns.Rows[k][0].ToString())))
                            {
                                rcvInsPayment += PIn.Decimal(TableIns.Rows[k][1].ToString());
                            }
                        }
                        rcvDaily     = (rcvProd + rcvAdj - rcvWriteoff) - (rcvPayment + rcvInsPayment);
                        runningRcv  += (rcvProd + rcvAdj - rcvWriteoff) - (rcvPayment + rcvInsPayment);
                        row[1]       = rcvProd.ToString("n");
                        row[2]       = rcvAdj.ToString("n");
                        row[3]       = rcvWriteoff.ToString("n");
                        row[4]       = rcvPayment.ToString("n");
                        row[5]       = rcvInsPayment.ToString("n");
                        row[6]       = rcvDaily.ToString("n");
                        row[7]       = runningRcv.ToString("n");
                        ColTotal[1] += rcvProd;
                        ColTotal[2] += rcvAdj;
                        ColTotal[3] += rcvWriteoff;
                        ColTotal[4] += rcvPayment;
                        ColTotal[5] += rcvInsPayment;
                        ColTotal[6] += rcvDaily;
                        ColTotal[7]  = runningRcv;
                        report.TableQ.Rows.Add(row);                          //adds row to table Q
                        rcvAdj        = 0;
                        rcvInsPayment = 0;
                        rcvPayment    = 0;
                        rcvProd       = 0;
                        rcvWriteoff   = 0;
                    }
                    report.ColTotal[1]  = PIn.Decimal(ColTotal[1].ToString("n"));
                    report.ColTotal[2]  = PIn.Decimal(ColTotal[2].ToString("n"));
                    report.ColTotal[3]  = PIn.Decimal(ColTotal[3].ToString("n"));
                    report.ColTotal[4]  = PIn.Decimal(ColTotal[4].ToString("n"));
                    report.ColTotal[5]  = PIn.Decimal(ColTotal[5].ToString("n"));
                    report.ColTotal[6]  = PIn.Decimal(ColTotal[6].ToString("n"));
                    report.ColTotal[7]  = PIn.Decimal(ColTotal[7].ToString("n"));
                    FormQuery2          = new FormQuery(report);
                    FormQuery2.IsReport = true;
                    FormQuery2.ResetGrid();
                    report.Title = "Receivables Breakdown Report";
                    report.SubTitle.Add(PrefC.GetString(PrefName.PracticeTitle));
                    whereProv  = "Report for: Practice";
                    whereProvx = "";
                    if (listProv.SelectedIndices[0] != 0)
                    {
                        int nameCount = 0;
                        whereProv = "Report Includes:  ";
                        for (int i = 0; i < listProv.SelectedIndices.Count; i++)
                        {
                            if (nameCount < 3)
                            {
                                whereProv += " " + ProviderC.ListShort[listProv.SelectedIndices[i] - 1].GetFormalName() + " /";
                            }
                            else
                            {
                                whereProvx += " " + ProviderC.ListShort[listProv.SelectedIndices[i] - 1].GetFormalName() + " /";
                            }
                            nameCount += 1;
                        }
                        whereProv = whereProv.Substring(0, whereProv.Length - 1);
                        if (whereProvx.Length > 0)
                        {
                            whereProvx = whereProvx.Substring(0, whereProvx.Length - 1);
                        }
                    }
                    report.SubTitle.Add(whereProv);
                    report.SubTitle.Add(whereProvx);
                    report.SetColumnPos(this, 0, "Day", 80);
                    report.SetColumnPos(this, 1, "Production", 160, HorizontalAlignment.Right);
                    report.SetColumnPos(this, 2, "Adjustment", 260, HorizontalAlignment.Right);
                    report.SetColumnPos(this, 3, "Writeoff", 360, HorizontalAlignment.Right);
                    report.SetColumnPos(this, 4, "Payment", 470, HorizontalAlignment.Right);
                    report.SetColumnPos(this, 5, "InsPayment", 570, HorizontalAlignment.Right);
                    report.SetColumnPos(this, 6, "Daily A/R", 680, HorizontalAlignment.Right);
                    report.SetColumnPos(this, 7, "Ending A/R", 779, HorizontalAlignment.Right);
                    report.Summary.Add(
                        Lan.g(this, "Receivables Calculation: (Production + Adjustments - Writeoffs) - (Payments + Insurance Payments)"));
                    FormQuery2.ShowDialog();
                    DialogResult = DialogResult.OK;
                } //END If
            }     // END For Loop
        }         //END OK button Clicked
Exemple #24
0
 ///<summary>Returns false if validation failed.  This also makes sure the web service exists, the customer is paid, and the registration key is correct.</summary>
 private bool SavePrefs()
 {
     //validation
     if (textSynchMinutes.errorProvider1.GetError(textSynchMinutes) != "" ||
         textDateBefore.errorProvider1.GetError(textDateBefore) != "")
     {
         MsgBox.Show(this, "Please fix data entry errors first.");
         return(false);
     }
     //yes, workstation is allowed to be blank.  That's one way for user to turn off auto synch.
     //if(textMobileSynchWorkStation.Text=="") {
     //	MsgBox.Show(this,"WorkStation cannot be empty");
     //	return false;
     //}
     // the text field is read because the keyed in values have not been saved yet
     if (textMobileSyncServerURL.Text.Contains("192.168.0.196") || textMobileSyncServerURL.Text.Contains("localhost"))
     {
         IgnoreCertificateErrors();                // done so that TestWebServiceExists() does not thow an error.
     }
     // if this is not done then an old non-functional url prevents any new url from being saved.
     Prefs.UpdateString(PrefName.MobileSyncServerURL, textMobileSyncServerURL.Text);
     if (!TestWebServiceExists())
     {
         MsgBox.Show(this, "Web service not found.");
         return(false);
     }
     if (mb.GetCustomerNum(PrefC.GetString(PrefName.RegistrationKey)) == 0)
     {
         MsgBox.Show(this, "Registration key is incorrect.");
         return(false);
     }
     if (!VerifyPaidCustomer())
     {
         return(false);
     }
     //Minimum 10 char.  Must contain uppercase, lowercase, numbers, and symbols. Valid symbols are: !@#$%^&+=
     //The set of symbols checked was far too small, not even including periods, commas, and parentheses.
     //So I rewrote it all.  New error messages say exactly what's wrong with it.
     if (textMobileUserName.Text != "")           //allowed to be blank
     {
         if (textMobileUserName.Text.Length < 10)
         {
             MsgBox.Show(this, "User Name must be at least 10 characters long.");
             return(false);
         }
         if (!Regex.IsMatch(textMobileUserName.Text, "[A-Z]+"))
         {
             MsgBox.Show(this, "User Name must contain an uppercase letter.");
             return(false);
         }
         if (!Regex.IsMatch(textMobileUserName.Text, "[a-z]+"))
         {
             MsgBox.Show(this, "User Name must contain an lowercase letter.");
             return(false);
         }
         if (!Regex.IsMatch(textMobileUserName.Text, "[0-9]+"))
         {
             MsgBox.Show(this, "User Name must contain a number.");
             return(false);
         }
         if (!Regex.IsMatch(textMobileUserName.Text, "[^0-9a-zA-Z]+"))                //absolutely anything except number, lower or upper.
         {
             MsgBox.Show(this, "User Name must contain punctuation or symbols.");
             return(false);
         }
     }
     if (textDateBefore.Text == "")          //default to one year if empty
     {
         textDateBefore.Text = DateTime.Today.AddYears(-1).ToShortDateString();
         //not going to bother informing user.  They can see it.
     }
     //save to db------------------------------------------------------------------------------------
     if (Prefs.UpdateString(PrefName.MobileSyncServerURL, textMobileSyncServerURL.Text)
         | Prefs.UpdateInt(PrefName.MobileSyncIntervalMinutes, PIn.Int(textSynchMinutes.Text))                        //blank entry allowed
         | Prefs.UpdateString(PrefName.MobileExcludeApptsBeforeDate, POut.Date(PIn.Date(textDateBefore.Text), false)) //blank
         | Prefs.UpdateString(PrefName.MobileSyncWorkstationName, textMobileSynchWorkStation.Text)
         | Prefs.UpdateString(PrefName.MobileUserName, textMobileUserName.Text)
         )
     {
         changed = true;
         Prefs.RefreshCache();
     }
     //Username and password-----------------------------------------------------------------------------
     mb.SetMobileWebUserPassword(PrefC.GetString(PrefName.RegistrationKey), textMobileUserName.Text.Trim(), textMobilePassword.Text.Trim());
     return(true);
 }
Exemple #25
0
        private void FillGrid()
        {
            if (IsDisposed)             //This can happen if an auto logoff happens with FormMedLabEdit open
            {
                return;
            }
            if (textDateStart.errorProvider1.GetError(textDateStart) != "" ||
                textDateEnd.errorProvider1.GetError(textDateEnd) != "")
            {
                return;
            }
            textPatient.Text = "";
            if (_selectedPat != null)
            {
                textPatient.Text       = _selectedPat.GetNameLF();
                checkOnlyNoPat.Checked = false;
            }
            Application.DoEvents();
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            gridMain.Columns.Add(new ODGridColumn("Date & Time Reported", 135, GridSortingStrategy.DateParse));          //most recent date and time a result came in
            gridMain.Columns.Add(new ODGridColumn("Date & Time Entered", 135, GridSortingStrategy.DateParse));
            gridMain.Columns.Add(new ODGridColumn("Status", 75));
            gridMain.Columns.Add(new ODGridColumn("Patient", 180));
            gridMain.Columns.Add(new ODGridColumn("Provider", 70));
            gridMain.Columns.Add(new ODGridColumn("Specimen ID", 100));           //should be the ID sent on the specimen container to lab
            gridMain.Columns.Add(new ODGridColumn("Test(s) Description", 235));   //description of the test ordered
            if (PrefC.HasClinicsEnabled)
            {
                gridMain.Columns.Add(new ODGridColumn("Clinic", 150));
            }
            gridMain.Rows.Clear();
            ODGridRow row;
            DateTime  dateEnd = PIn.Date(textDateEnd.Text);

            if (dateEnd == DateTime.MinValue)
            {
                dateEnd = DateTime.MaxValue;
            }
            Cursor = Cursors.WaitCursor;
            Clinic clinCur = new Clinic();

            if (PrefC.HasClinicsEnabled)
            {
                clinCur = _listUserClinics[comboClinic.SelectedIndex];
            }
            List <Clinic> listClinicsSelected = new List <Clinic>();

            if (clinCur.ClinicNum == -1)                                               //"All" clinic
            {
                listClinicsSelected = _listUserClinics.FindAll(x => x.ClinicNum > -1); //will include ClinicNum 0 ("Unassigned" clinic) if user is unrestricted
            }
            else                                                                       //a single clinic was selected, either the "Unassigned" clinic or a regular clinic
            {
                listClinicsSelected.Add(clinCur);
            }
            List <MedLab> listMedLabs = MedLabs.GetOrdersForPatient(_selectedPat, checkIncludeNoPat.Checked, checkOnlyNoPat.Checked, PIn.Date(textDateStart.Text),
                                                                    dateEnd, listClinicsSelected);
            Dictionary <long, Patient> dictPats = Patients.GetLimForPats(listMedLabs.Select(x => x.PatNum).Where(x => x > 0).Distinct().ToList())
                                                  .ToDictionary(x => x.PatNum);

            foreach (MedLab medLabCur in listMedLabs)
            {
                row = new ODGridRow();
                row.Cells.Add(medLabCur.DateTimeReported.ToString("MM/dd/yyyy hh:mm tt"));
                row.Cells.Add(medLabCur.DateTimeEntered.ToString("MM/dd/yyyy hh:mm tt"));
                if (medLabCur.IsPreliminaryResult)                 //check whether the test or any of the most recent results for the test is marked as preliminary
                {
                    row.Cells.Add(MedLabs.GetStatusDescript(ResultStatus.P));
                }
                else
                {
                    row.Cells.Add(MedLabs.GetStatusDescript(medLabCur.ResultStatus));
                }
                string nameFL = "";
                if (dictPats.ContainsKey(medLabCur.PatNum))
                {
                    nameFL = dictPats[medLabCur.PatNum].GetNameFLnoPref();
                }
                row.Cells.Add(nameFL);
                row.Cells.Add(Providers.GetAbbr(medLabCur.ProvNum));                //will be blank if ProvNum=0
                row.Cells.Add(medLabCur.SpecimenID);
                row.Cells.Add(medLabCur.ObsTestDescript);
                if (PrefC.HasClinicsEnabled)
                {
                    string clinicDesc = "";
                    if (_dictLabAcctClinic.ContainsKey(medLabCur.PatAccountNum))
                    {
                        clinicDesc = _dictLabAcctClinic[medLabCur.PatAccountNum];
                    }
                    row.Cells.Add(clinicDesc);
                }
                row.Tag = medLabCur.PatNum.ToString() + "," + medLabCur.SpecimenID + "," + medLabCur.SpecimenIDFiller;
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
            Cursor = Cursors.Default;
        }
Exemple #26
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;
        }
        private void FillGrid()
        {
            if (textDateTo.errorProvider1.GetError(textDateTo) != "" || textDateFrom.errorProvider1.GetError(textDateFrom) != "")               //Test To and From dates
            {
                MsgBox.Show(this, "Please enter valid To and From dates.");
                return;
            }
            DateFrom = PIn.Date(textDateFrom.Text);
            DateTo   = PIn.Date(textDateTo.Text);
            if (DateTo < DateFrom)
            {
                MsgBox.Show(this, "Date To cannot be before Date From.");
                return;
            }
//todo: checkbox
            RefAttachList = RefAttaches.RefreshForReferralProcTrack(DateFrom, DateTo, checkComplete.Checked);
            Table         = Procedures.GetReferred(DateFrom, DateTo, checkComplete.Checked);
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col;

            col = new ODGridColumn(Lan.g(this, "Patient"), 125);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Referred To"), 125);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Description"), 125);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Note"), 125);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Date Referred"), 86);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Date Done"), 86);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Status"), 84);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow row;
            DateTime  date;

            for (int i = 0; i < Table.Rows.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(Patients.GetPat(PIn.Long(Table.Rows[i]["PatNum"].ToString())).GetNameLF());
                row.Cells.Add(Table.Rows[i]["LName"].ToString() + ", " + Table.Rows[i]["FName"].ToString() + " " + Table.Rows[i]["MName"].ToString());
                row.Cells.Add(ProcedureCodes.GetLaymanTerm(PIn.Long(Table.Rows[i]["CodeNum"].ToString())));
                row.Cells.Add(Table.Rows[i]["Note"].ToString());
                date = PIn.Date(Table.Rows[i]["RefDate"].ToString());
                if (date.Year < 1880)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(date.ToShortDateString());
                }
                date = PIn.Date(Table.Rows[i]["DateProcComplete"].ToString());
                if (date.Year < 1880)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(date.ToShortDateString());
                }
                ReferralToStatus refStatus = (ReferralToStatus)PIn.Int(Table.Rows[i]["RefToStatus"].ToString());
                if (refStatus == ReferralToStatus.None)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(refStatus.ToString());
                }
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
Exemple #28
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (textAdjDate.errorProvider1.GetError(textAdjDate) != "" ||
         textProcDate.errorProvider1.GetError(textProcDate) != "" ||
         textAmount.errorProvider1.GetError(textAmount) != ""
         )
     {
         MsgBox.Show(this, "Please fix data entry errors first.");
         return;
     }
     if (textAmount.Text == "")
     {
         MessageBox.Show(Lan.g(this, "Please enter an amount."));
         return;
     }
     if (listTypeNeg.SelectedIndex == -1 && listTypePos.SelectedIndex == -1)
     {
         MsgBox.Show(this, "Please select a type first.");
         return;
     }
     if (IsNew)
     {
         //prevents backdating of initial adjustment
         if (!Security.IsAuthorized(Permissions.AdjustmentCreate, PIn.Date(textAdjDate.Text), true)) //Give message later.
         {
             if (!checkZeroAmount)                                                                   //Let user create as long as Amount is zero and has edit zero permissions.  This was checked on load.
             {
                 MessageBox.Show(Lans.g("Security", "Not authorized for") + "\r\n" + GroupPermissions.GetDesc(Permissions.AdjustmentCreate));
                 return;
             }
         }
     }
     else
     {
         //Editing an old entry will already be blocked if the date was too old, and user will not be able to click OK button
         //This catches it if user changed the date to be older.
         if (!Security.IsAuthorized(Permissions.AdjustmentEdit, PIn.Date(textAdjDate.Text)))
         {
             return;
         }
     }
     //DateEntry not allowed to change
     AdjustmentCur.AdjDate  = PIn.Date(textAdjDate.Text);
     AdjustmentCur.ProcDate = PIn.Date(textProcDate.Text);
     if (comboProv.SelectedIndex == -1)           //might be a hidden provider, so don't change.
     //	AdjustmentCur.ProvNum=PatCur.PriProv;
     {
     }
     else
     {
         AdjustmentCur.ProvNum = ProviderC.ListShort[comboProv.SelectedIndex].ProvNum;
     }
     if (!PrefC.GetBool(PrefName.EasyNoClinics))
     {
         if (comboClinic.SelectedIndex == 0)
         {
             AdjustmentCur.ClinicNum = 0;
         }
         else
         {
             AdjustmentCur.ClinicNum = Clinics.List[comboClinic.SelectedIndex - 1].ClinicNum;
         }
     }
     if (listTypePos.SelectedIndex != -1)
     {
         AdjustmentCur.AdjType = DefC.Short[(int)DefCat.AdjTypes][(int)PosIndex[listTypePos.SelectedIndex]].DefNum;
     }
     if (listTypeNeg.SelectedIndex != -1)
     {
         AdjustmentCur.AdjType = DefC.Short[(int)DefCat.AdjTypes][(int)NegIndex[listTypeNeg.SelectedIndex]].DefNum;
     }
     if (DefC.GetValue(DefCat.AdjTypes, AdjustmentCur.AdjType) == "+")         //pos
     {
         AdjustmentCur.AdjAmt = PIn.Double(textAmount.Text);
     }
     else             //neg
     {
         AdjustmentCur.AdjAmt = -PIn.Double(textAmount.Text);
     }
     if (checkZeroAmount)
     {
         if (AdjustmentCur.AdjAmt != 0)
         {
             MsgBox.Show(this, "Amount has to be 0.00 due to security permission.");
             return;
         }
     }
     AdjustmentCur.AdjNote = textNote.Text;
     try{
         if (IsNew)
         {
             Adjustments.Insert(AdjustmentCur);
         }
         else
         {
             Adjustments.Update(AdjustmentCur);
         }
     }
     catch (Exception ex) {          //even though it doesn't currently throw any exceptions
         MessageBox.Show(ex.Message);
         return;
     }
     if (IsNew)
     {
         SecurityLogs.MakeLogEntry(Permissions.AdjustmentCreate, AdjustmentCur.PatNum,
                                   Patients.GetLim(AdjustmentCur.PatNum).GetNameLF() + ", "
                                   + AdjustmentCur.AdjAmt.ToString("c"));
     }
     else
     {
         SecurityLogs.MakeLogEntry(Permissions.AdjustmentEdit, AdjustmentCur.PatNum,
                                   Patients.GetLim(AdjustmentCur.PatNum).GetNameLF() + ", "
                                   + AdjustmentCur.AdjAmt.ToString("c"));
     }
     DialogResult = DialogResult.OK;
 }
Exemple #29
0
        private void FillGrid()
        {
            if (textDateStart.errorProvider1.GetError(textDateStart) != "" ||
                textDateEnd.errorProvider1.GetError(textDateEnd) != "")
            {
                return;
            }
            DateTime fromDate;
            DateTime toDate;

            if (textDateStart.Text == "")
            {
                fromDate = DateTime.MinValue.AddDays(1);              //because we don't want to include 010101
            }
            else
            {
                fromDate = PIn.Date(textDateStart.Text);
            }
            if (textDateEnd.Text == "")
            {
                toDate = DateTime.MaxValue;
            }
            else
            {
                toDate = PIn.Date(textDateEnd.Text);
            }
            EnumEquipmentDisplayMode display = EnumEquipmentDisplayMode.All;

            if (radioPurchased.Checked)
            {
                display = EnumEquipmentDisplayMode.Purchased;
            }
            if (radioSold.Checked)
            {
                display = EnumEquipmentDisplayMode.Sold;
            }
            listEquip = Equipments.GetList(fromDate, toDate, display, textSnDesc.Text);
            gridMain.BeginUpdate();
            if (radioPurchased.Checked)
            {
                gridMain.HScrollVisible = true;
            }
            else
            {
                gridMain.HScrollVisible = false;
            }
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g(this, "Description"), 150);

            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "SerialNumber"), 90);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Yr"), 40);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "DatePurchased"), 90);
            gridMain.Columns.Add(col);
            if (display != EnumEquipmentDisplayMode.Purchased)           //Purchased mode is designed for submission to tax authority, only certain columns
            {
                col = new ODGridColumn(Lan.g(this, "DateSold"), 90);
                gridMain.Columns.Add(col);
            }
            col = new ODGridColumn(Lan.g(this, "Cost"), 80, HorizontalAlignment.Right);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Est Value"), 80, HorizontalAlignment.Right);
            gridMain.Columns.Add(col);
            if (display != EnumEquipmentDisplayMode.Purchased)
            {
                col = new ODGridColumn(Lan.g(this, "Location"), 80);
                gridMain.Columns.Add(col);
            }
            gridMain.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < listEquip.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(listEquip[i].Description);
                row.Cells.Add(listEquip[i].SerialNumber);
                row.Cells.Add(listEquip[i].ModelYear);
                row.Cells.Add(listEquip[i].DatePurchased.ToShortDateString());
                if (display != EnumEquipmentDisplayMode.Purchased)
                {
                    if (listEquip[i].DateSold.Year < 1880)
                    {
                        row.Cells.Add("");
                    }
                    else
                    {
                        row.Cells.Add(listEquip[i].DateSold.ToShortDateString());
                    }
                }
                row.Cells.Add(listEquip[i].PurchaseCost.ToString("f"));
                row.Cells.Add(listEquip[i].MarketValue.ToString("f"));
                if (display != EnumEquipmentDisplayMode.Purchased)
                {
                    row.Cells.Add(listEquip[i].Location);
                }
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
        private void butOK_Click(object sender, EventArgs e)
        {
            if (textValue.Text.Trim() == "")
            {
                MsgBox.Show(this, "Missing value.");
                return;
            }
            VaccineObsType vaccineObsType = (VaccineObsType)listValueType.SelectedIndex;

            if (vaccineObsType == VaccineObsType.Coded)
            {
                //Any value is allowed.
            }
            else if (vaccineObsType == VaccineObsType.Dated)
            {
                try {
                    DateTime.Parse(textValue.Text);
                }
                catch (Exception) {
                    MsgBox.Show(this, "Value must be a valid date.");
                    return;
                }
            }
            else if (vaccineObsType == VaccineObsType.Numeric)
            {
                try {
                    double.Parse(textValue.Text);
                }
                catch (Exception) {
                    MsgBox.Show(this, "Value must be a valid number.");
                    return;
                }
            }
            else if (vaccineObsType == VaccineObsType.Text)
            {
                //Any value is allowed.
            }
            else               //DateAndTime
            {
                try {
                    DateTime.Parse(textValue.Text);
                }
                catch (Exception) {
                    MsgBox.Show(this, "Value must be a valid date and time.");
                    return;
                }
            }
            if (comboUnits.Enabled && comboUnits.SelectedIndex == 0)
            {
                MsgBox.Show(this, "Missing units.");
                return;
            }
            if (textDateObserved.errorProvider1.GetError(textDateObserved) != "")
            {
                MessageBox.Show(Lan.g(this, "Please fix data entry errors first."));
                return;
            }
            if (!textMethodCode.ReadOnly && textMethodCode.Text.Trim() == "")
            {
                MsgBox.Show(this, "Missing method code.");
                return;
            }
            _vaccineObsCur.IdentifyingCode = (VaccineObsIdentifier)comboObservationQuestion.SelectedIndex;
            _vaccineObsCur.ValType         = (VaccineObsType)listValueType.SelectedIndex;
            _vaccineObsCur.ValCodeSystem   = (VaccineObsValCodeSystem)listCodeSystem.SelectedIndex;
            _vaccineObsCur.ValReported     = textValue.Text;
            _vaccineObsCur.UcumCode        = "";
            if (comboUnits.Enabled)
            {
                _vaccineObsCur.UcumCode = comboUnits.Items[comboUnits.SelectedIndex].ToString();
            }
            _vaccineObsCur.DateObs = DateTime.MinValue;
            if (textDateObserved.Text != "")
            {
                _vaccineObsCur.DateObs = PIn.Date(textDateObserved.Text);
            }
            _vaccineObsCur.MethodCode = textMethodCode.Text;
            DialogResult = DialogResult.OK;
        }