private void FormPayPlanCharge_Load(object sender, System.EventArgs e)
 {
     textDate.Text = PayPlanChargeCur.ChargeDate.ToShortDateString();
     //comboProvNum.Items.Clear();
     //for(int i=0;i<ProviderC.List.Length;i++) {
     //	comboProvNum.Items.Add(ProviderC.List[i].Abbr);
     //	if(ProviderC.List[i].ProvNum==PayPlanChargeCur.ProvNum)
     //		comboProvNum.SelectedIndex=i;
     //}
     textPrincipal.Text = PayPlanChargeCur.Principal.ToString("n");
     textInterest.Text  = PayPlanChargeCur.Interest.ToString("n");
     textNote.Text      = PayPlanChargeCur.Note;
     textProv.Text      = Providers.GetAbbr(PayPlanChargeCur.ProvNum);
     textDateEntry.Text = POut.DateT(PayPlanChargeCur.SecDateTEntry, false);
     textDateEdit.Text  = POut.DateT(PayPlanChargeCur.SecDateTEdit, false);
     if (PrefC.GetBool(PrefName.EasyNoClinics))
     {
         labelClinic.Visible = false;
         textClinic.Visible  = false;
     }
     else
     {
         textClinic.Text = Clinics.GetAbbr(PayPlanChargeCur.ClinicNum);
     }
 }
Esempio n. 2
0
        ///<summary>Used to update the main title bar when neither the patient nor the clinic need to change.
        ///Currently only used to refresh the title bar when the timer ticks for the update time countdown.</summary>
        public static string GetMainTitleSamePat()
        {
            string retVal = PrefC.GetString(PrefName.MainWindowTitle);

            if (!PrefC.GetBool(PrefName.EasyNoClinics) && _clinSelectedCur > 0)
            {
                if (retVal != "")
                {
                    retVal += " - " + Lan.g("FormOpenDental", "Clinic") + ": ";
                }
                if (PrefC.GetBool(PrefName.TitleBarClinicUseAbbr))
                {
                    retVal += Clinics.GetAbbr(_clinSelectedCur);
                }
                else
                {
                    retVal += Clinics.GetDesc(_clinSelectedCur);
                }
            }
            if (Security.CurUser != null)
            {
                retVal += " {" + Security.CurUser.UserName + "}";
            }
            if (_patSelectedCur == null || _patSelectedCur.PatNum == 0 || _patSelectedCur.PatNum == -1)
            {
                retVal += MainTitleUpdateCountdown();
                if (FormOpenDental.RegKeyIsForTesting)
                {
                    retVal += " - " + Lan.g("FormOpenDental", "Developer Only License") + " - " + Lan.g("FormOpenDental", "Not for use with live patient data") + " - ";
                }
                return(retVal);
            }
            retVal += " - " + _patSelectedCur.GetNameLF();
            if (PrefC.GetLong(PrefName.ShowIDinTitleBar) == 1)
            {
                retVal += " - " + _patSelectedCur.PatNum.ToString();
            }
            else if (PrefC.GetLong(PrefName.ShowIDinTitleBar) == 2)
            {
                retVal += " - " + _patSelectedCur.ChartNumber;
            }
            else if (PrefC.GetLong(PrefName.ShowIDinTitleBar) == 3)
            {
                if (_patSelectedCur.Birthdate.Year > 1880)
                {
                    retVal += " - " + _patSelectedCur.Birthdate.ToShortDateString();
                }
            }
            if (_patSelectedCur.SiteNum != 0)
            {
                retVal += " - " + Sites.GetDescription(_patSelectedCur.SiteNum);
            }
            retVal += MainTitleUpdateCountdown();
            if (FormOpenDental.RegKeyIsForTesting)
            {
                retVal += " - " + Lan.g("FormOpenDental", "Developer Only License") + " - " + Lan.g("FormOpenDental", "Not for use with live patient data") + " - ";
            }
            return(retVal);
        }
Esempio n. 3
0
        private void butMovePats_Click(object sender, EventArgs e)
        {
            if (gridMain.SelectedIndices.Length < 1)
            {
                MsgBox.Show(this, "You must select at least one clinic to move patients from.");
                return;
            }
            List <Clinic> listClinicsFrom = gridMain.SelectedIndices.OfType <int>().Select(x => (Clinic)gridMain.Rows[x].Tag).ToList();
            List <Clinic> listClinicsTo   = gridMain.Rows.Select(x => x.Tag as Clinic).ToList();

            if (_clinicNumTo == -1)
            {
                MsgBox.Show(this, "You must pick a 'To' clinic in the box above to move patients to.");
                return;
            }
            Clinic clinicTo = listClinicsTo.FirstOrDefault(x => x.ClinicNum == _clinicNumTo);

            if (clinicTo == null)
            {
                MsgBox.Show(this, "The clinic could not be found.");
                return;
            }
            Action actionCloseProgress = ODProgressOld.ShowProgressStatus("ClinicReassign", this, Lan.g(this, "Gathering patient data") + "...");
            Dictionary <long, List <long> > dictClinicPats = Patients.GetPatNumsByClinic(listClinicsFrom.Select(x => x.ClinicNum).ToList()).Select()
                                                             .GroupBy(x => PIn.Long(x["ClinicNum"].ToString()), x => PIn.Long(x["PatNum"].ToString()))
                                                             .ToDictionary(x => x.Key, x => x.ToList());

            actionCloseProgress?.Invoke();
            int totalPatCount = dictClinicPats.Sum(x => x.Value.Count);

            if (totalPatCount == 0)
            {
                MsgBox.Show(this, "The selected clinics are not clinics for any patients.");
                return;
            }
            string strClinicFromDesc = string.Join(", ", listClinicsFrom.FindAll(x => dictClinicPats.ContainsKey(x.ClinicNum)).Select(x => (x.ClinicNum == 0?"HQ":x.Abbr)));
            string strClinicToDesc   = clinicTo.Abbr;
            string msg = Lan.g(this, "Move all patients to") + " " + strClinicToDesc + " " + Lan.g(this, "from the following clinics") + ": " + strClinicFromDesc + "?";

            if (MessageBox.Show(msg, "", MessageBoxButtons.OKCancel) != DialogResult.OK)
            {
                return;
            }
            actionCloseProgress = ODProgressOld.ShowProgressStatus("ClinicReassign", this, Lan.g(this, "Moving patients") + "...");
            int           patsMoved   = 0;
            List <Action> listActions = dictClinicPats.Select(x => new Action(() => {
                patsMoved += x.Value.Count;
                ODEvent.Fire(new ODEventArgs("ClinicReassign", Lan.g(this, "Moving patients") + ": " + patsMoved + " out of " + totalPatCount));
                Patients.ChangeClinicsForAll(x.Key, clinicTo.ClinicNum);               //update all clinicNums to new clinic
                SecurityLogs.MakeLogEntry(Permissions.PatientEdit, 0, "Clinic changed for " + x.Value.Count + " patients from "
                                          + (x.Key == 0 ? "HQ" : Clinics.GetAbbr(x.Key)) + " to " + clinicTo.Abbr + ".");
            })).ToList();

            ODThread.RunParallel(listActions, TimeSpan.FromMinutes(2));
            actionCloseProgress?.Invoke();
            _dictClinicalCounts = Clinics.GetClinicalPatientCount();
            FillGrid();
            MsgBox.Show(this, "Done");
        }
        private void FillGrid()
        {
            RefreshReport();
            gridMain.BeginUpdate();
            ODGridColumn col = null;

            if (gridMain.Columns.Count == 0)
            {
                col = new ODGridColumn(Lan.g(this, "Patient Name"), _colWidthPatName);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g(this, "Procedure Date"), _colWidthProcDate);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g(this, "Procedure Descipion"), 0);            //Dynaimc width
                gridMain.Columns.Add(col);
                if (PrefC.HasClinicsEnabled)
                {
                    col = new ODGridColumn(Lan.g(this, "Clinic"), _colWidthClinic);
                    gridMain.Columns.Add(col);
                }
                col = new ODGridColumn(Lan.g(this, "Amount"), _colWidthAmount, HorizontalAlignment.Right);
                gridMain.Columns.Add(col);
            }
            gridMain.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < _myReport.ReportObjects.Count; i++)
            {
                if (_myReport.ReportObjects[i].ObjectType != ReportObjectType.QueryObject)
                {
                    continue;
                }
                QueryObject queryObj = (QueryObject)_myReport.ReportObjects[i];
                for (int j = 0; j < queryObj.ReportTable.Rows.Count; j++)
                {
                    row = new ODGridRow();
                    row.Cells.Add(queryObj.ReportTable.Rows[j][0].ToString());                               //Procedure Name
                    row.Cells.Add(PIn.Date(queryObj.ReportTable.Rows[j][1].ToString()).ToShortDateString()); //Procedure Date
                    row.Cells.Add(queryObj.ReportTable.Rows[j][2].ToString());                               //Procedure Description
                    if (PrefC.HasClinicsEnabled)
                    {
                        long clinicNum = PIn.Long(queryObj.ReportTable.Rows[j][5].ToString());
                        if (clinicNum == 0)
                        {
                            row.Cells.Add("Unassigned");
                        }
                        else
                        {
                            row.Cells.Add(Clinics.GetAbbr(clinicNum));
                        }
                    }
                    row.Cells.Add(PIn.Double(queryObj.ReportTable.Rows[j][3].ToString()).ToString("c")); //Amount
                    _procTotalAmt += PIn.Decimal(queryObj.ReportTable.Rows[j][3].ToString());
                    row.Tag        = PIn.Long(queryObj.ReportTable.Rows[j][4].ToString());               //Tag set to ProcNum.  Used in butNewClaims_Click().
                    gridMain.Rows.Add(row);
                }
            }
            gridMain.EndUpdate();
        }
        ///<summary>Fills gridUsers. Public so that it can be called from the Form that implements this control.</summary>
        public void FillGridUsers()
        {
            _isFillingList = true;
            Userod selectedUser = SelectedUser;          //preserve user selection.

            gridUsers.BeginUpdate();
            gridUsers.Columns.Clear();
            string tableName = "TableSecurity";

            gridUsers.Columns.Add(new ODGridColumn(Lan.g(tableName, "Username"), 90));
            gridUsers.Columns.Add(new ODGridColumn(Lan.g(tableName, "Employee"), 90));
            gridUsers.Columns.Add(new ODGridColumn(Lan.g(tableName, "Provider"), 90));
            if (!PrefC.GetBool(PrefName.EasyNoClinics))
            {
                gridUsers.Columns.Add(new ODGridColumn(Lan.g(tableName, "Clinic"), 80));
                gridUsers.Columns.Add(new ODGridColumn(Lan.g(tableName, "Clinic\r\nRestr"), 38, HorizontalAlignment.Center));
            }
            gridUsers.Columns.Add(new ODGridColumn(Lan.g(tableName, "Strong\r\nPwd"), 45, HorizontalAlignment.Center));
            gridUsers.Rows.Clear();
            List <Userod> listFilteredUsers = GetFilteredUsersHelper();

            foreach (Userod user in listFilteredUsers)
            {
                ODGridRow row = new ODGridRow();
                row.Cells.Add(user.UserName);
                row.Cells.Add(Employees.GetNameFL(user.EmployeeNum));
                row.Cells.Add(Providers.GetLongDesc(user.ProvNum));
                if (!PrefC.GetBool(PrefName.EasyNoClinics))
                {
                    row.Cells.Add(Clinics.GetAbbr(user.ClinicNum));
                    row.Cells.Add(user.ClinicIsRestricted?"X":"");
                }
                row.Cells.Add(user.PasswordIsStrong?"X":"");
                row.Tag = user;
                gridUsers.Rows.Add(row);
            }
            gridUsers.EndUpdate();
            _isFillingList = false;          //Done filling the grid.
            //Selection logic has to occur after ODGrid.EndUpdate().
            if (selectedUser == null || !listFilteredUsers.Any(x => x.UserNum == selectedUser.UserNum))
            {
                //No previously selected user, or previous selection not in filtered list.
                gridUsers.SetSelected(0, true); //Default to first user.
            }
            else                                //Previous selection still exists in grid, so select it again.
            {
                SelectedUser = selectedUser;    //Reselect previously selected user.
            }
            RefreshUserTabGroups();
        }
Esempio n. 6
0
        ///<summary>Fills gridUsers. Public so that it can be called from the Form that implements this control.</summary>
        public void FillGridUsers()
        {
            _isFillingList = true;
            Userod selectedUser = SelectedUser;          //preserve user selection.

            gridUsers.BeginUpdate();
            gridUsers.ListGridColumns.Clear();
            string tableName = "TableSecurity";

            gridUsers.ListGridColumns.Add(new GridColumn(Lan.g(tableName, "Username"), 90));
            gridUsers.ListGridColumns.Add(new GridColumn(Lan.g(tableName, "Employee"), 90));
            gridUsers.ListGridColumns.Add(new GridColumn(Lan.g(tableName, "Provider"), 90));
            if (PrefC.HasClinicsEnabled)
            {
                gridUsers.ListGridColumns.Add(new GridColumn(Lan.g(tableName, "Clinic"), 80));
                gridUsers.ListGridColumns.Add(new GridColumn(Lan.g(tableName, "Clinic\r\nRestr"), 38, HorizontalAlignment.Center));
            }
            gridUsers.ListGridColumns.Add(new GridColumn(Lan.g(tableName, "Strong\r\nPwd"), 45, HorizontalAlignment.Center));
            gridUsers.ListGridRows.Clear();
            List <Userod> listFilteredUsers = GetFilteredUsersHelper();

            foreach (Userod user in listFilteredUsers)
            {
                GridRow row = new GridRow();
                row.Cells.Add(user.UserName);
                row.Cells.Add(Employees.GetNameFL(user.EmployeeNum));
                row.Cells.Add(Providers.GetLongDesc(user.ProvNum));
                if (PrefC.HasClinicsEnabled)
                {
                    row.Cells.Add(Clinics.GetAbbr(user.ClinicNum));
                    row.Cells.Add(user.ClinicIsRestricted?"X":"");
                }
                row.Cells.Add(user.PasswordIsStrong?"X":"");
                row.Tag = user;
                gridUsers.ListGridRows.Add(row);
            }
            gridUsers.EndUpdate();
            _isFillingList = false;          //Done filling the grid.
            //Selection logic has to occur after ODGrid.EndUpdate().
            if (selectedUser != null)
            {
                //Reselect previously selected user.  SelectedUser is allowed to be null (ex. on load).
                SelectedUser = listFilteredUsers.FirstOrDefault(x => x.UserNum == selectedUser.UserNum);
            }
            RefreshUserTabGroups();
        }
Esempio n. 7
0
        private void FillGridWebSchedNewPatApptOps()
        {
            int opNameWidth = 150;
            int clinicWidth = 150;

            if (!PrefC.HasClinicsEnabled)
            {
                opNameWidth += clinicWidth;
            }
            gridWebSchedNewPatApptOps.BeginUpdate();
            gridWebSchedNewPatApptOps.ListGridColumns.Clear();
            gridWebSchedNewPatApptOps.ListGridColumns.Add(new GridColumn(Lan.g("FormEServicesSetup", "Op Name"), opNameWidth));
            gridWebSchedNewPatApptOps.ListGridColumns.Add(new GridColumn(Lan.g("FormEServicesSetup", "Abbrev"), 60));
            if (PrefC.HasClinicsEnabled)
            {
                gridWebSchedNewPatApptOps.ListGridColumns.Add(new GridColumn(Lan.g("FormEServicesSetup", "Clinic"), clinicWidth));
            }
            gridWebSchedNewPatApptOps.ListGridColumns.Add(new GridColumn(Lan.g("FormEServicesSetup", "Provider"), 60));
            gridWebSchedNewPatApptOps.ListGridColumns.Add(new GridColumn(Lan.g("FormEServicesSetup", "Hygienist"), 60));
            gridWebSchedNewPatApptOps.ListGridColumns.Add(new GridColumn(Lan.g("FormEServicesSetup", "ApptTypes"), 0));
            gridWebSchedNewPatApptOps.ListGridRows.Clear();
            //A list of all operatories that are considered for web sched new pat appt.
            List <Operatory> listWSNPAOps     = Operatories.GetOpsForWebSchedNewPatAppts();
            List <long>      listWSNPADefNums = listWSNPAOps.SelectMany(x => x.ListWSNPAOperatoryDefNums).Distinct().ToList();
            List <Def>       listWSNPADefs    = Defs.GetDefs(DefCat.WebSchedNewPatApptTypes, listWSNPADefNums);
            GridRow          row;

            foreach (Operatory op in listWSNPAOps)
            {
                row = new GridRow();
                row.Cells.Add(op.OpName);
                row.Cells.Add(op.Abbrev);
                if (PrefC.HasClinicsEnabled)
                {
                    row.Cells.Add(Clinics.GetAbbr(op.ClinicNum));
                }
                row.Cells.Add(Providers.GetAbbr(op.ProvDentist));
                row.Cells.Add(Providers.GetAbbr(op.ProvHygienist));
                //Display the name of all "appointment types" (definition.ItemName) that are associated with the current operatory.
                row.Cells.Add(string.Join(", ", listWSNPADefs.Where(x => op.ListWSNPAOperatoryDefNums.Any(y => y == x.DefNum)).Select(x => x.ItemName)));
                row.Tag = op;
                gridWebSchedNewPatApptOps.ListGridRows.Add(row);
            }
            gridWebSchedNewPatApptOps.EndUpdate();
        }
Esempio n. 8
0
        private string ConstructSecurityLogForProcType(Procedure proc, Procedure procOld)
        {
            string logTextForProc = "";
            string code           = ProcedureCodes.GetProcCode(proc.CodeNum).ProcCode;
            string procDateStrOld = POut.Date(procOld.ProcDate);
            string procDateStrNew = POut.Date(proc.ProcDate);

            logTextForProc += SecurityLogEntryHelper(code, SecurityLogFields.ProcDate, procDateStrOld, procDateStrNew);
            string provNumStrOld = Providers.GetAbbr(procOld.ProvNum);
            string provNumStrNew = Providers.GetAbbr(proc.ProvNum);

            logTextForProc += SecurityLogEntryHelper(code, SecurityLogFields.ProvNum, provNumStrOld, provNumStrNew);
            string clinicNumStrOld = Clinics.GetAbbr(procOld.ClinicNum);
            string clinicNumStrNew = Clinics.GetAbbr(proc.ClinicNum);

            logTextForProc += SecurityLogEntryHelper(code, SecurityLogFields.ClinicNum, clinicNumStrOld, clinicNumStrNew);
            return(logTextForProc);
        }
Esempio n. 9
0
 private void FormPayPlanCharge_Load(object sender, System.EventArgs e)
 {
     textDate.Text = PayPlanChargeCur.ChargeDate.ToShortDateString();
     //comboProvNum.Items.Clear();
     //for(int i=0;i<ProviderC.List.Length;i++) {
     //	comboProvNum.Items.Add(ProviderC.List[i].Abbr);
     //	if(ProviderC.List[i].ProvNum==PayPlanChargeCur.ProvNum)
     //		comboProvNum.SelectedIndex=i;
     //}
     textPrincipal.Text = PayPlanChargeCur.Principal.ToString("n");
     textInterest.Text  = PayPlanChargeCur.Interest.ToString("n");
     textNote.Text      = PayPlanChargeCur.Note;
     textProv.Text      = Providers.GetAbbr(PayPlanChargeCur.ProvNum);
     if (PayPlanChargeCur.SecDateTEntry == DateTime.MinValue)
     {
         //First time form is ever opened and the date isn't saved to the db yet, show the current datetime
         textDateEntry.Text = POut.DateT(DateTime.Now, false);
     }
     else
     {
         //Returning to the form, pull the stored datetime
         textDateEntry.Text = POut.DateT(PayPlanChargeCur.SecDateTEntry, false);
     }
     if (PayPlanChargeCur.SecDateTEdit == DateTime.MinValue)
     {
         //Until job B15806 is complete, regaurding how MySQL 5.7 handles timestamps, SectDateTEdit will always show as MinValue for the user.
         textDateEdit.Text = "";
     }
     else
     {
         //Edits exist, show stored datetime
         textDateEdit.Text = POut.DateT(PayPlanChargeCur.SecDateTEdit, false);
     }
     if (!PrefC.HasClinicsEnabled)
     {
         labelClinic.Visible = false;
         textClinic.Visible  = false;
     }
     else
     {
         textClinic.Text = Clinics.GetAbbr(PayPlanChargeCur.ClinicNum);
     }
     Plugins.HookAddCode(this, "FormPayPlanChargeEdit.Load_end");
 }
Esempio n. 10
0
 private void FormOperatoryEdit_Load(object sender, System.EventArgs e)
 {
     textOpName.Text       = OpCur.OpName;
     textAbbrev.Text       = OpCur.Abbrev;
     checkIsHidden.Checked = OpCur.IsHidden;
     if (PrefC.GetBool(PrefName.EasyNoClinics))
     {
         labelClinic.Visible = false;
         comboClinic.Visible = false;
         butPickClin.Visible = false;
     }
     _listClinics = new List <Clinic>()
     {
         new Clinic()
         {
             Abbr = Lan.g(this, "None")
         }
     };                                                                        //Seed with "None"
     Clinics.GetForUserod(Security.CurUser).ForEach(x => _listClinics.Add(x)); //do not re-organize from cache. They could either be alphabetizeded or sorted by item order.
     _listClinics.ForEach(x => comboClinic.Items.Add(x.Abbr));                 //Add to UI control
     //Set Selected nums
     _selectedClinicNum  = OpCur.ClinicNum;                                    //can be 0
     _selectedProvNum    = OpCur.ProvDentist;
     _selectedProvHygNum = OpCur.ProvHygienist;
     //Set comboindexes for compatibility with fillComboProvHyg
     comboProv.SelectedIndex = -1;
     comboHyg.SelectedIndex  = -1;
     comboClinic.IndexSelectOrSetText(_listClinics.FindIndex(x => x.ClinicNum == _selectedClinicNum)
                                      , () => { return(Clinics.GetAbbr(_selectedClinicNum)); });
     if (OpCur.ListWSNPAOperatoryDefNums != null)
     {
         //This is an existing operatory with WSNPA appointment types associated.  Go get them in order to display to the user.
         _listWSNPAOperatoryDefs = Defs.GetDefs(DefCat.WebSchedNewPatApptTypes, OpCur.ListWSNPAOperatoryDefNums);
     }
     FillWSNPAApptTypes();
     FillComboProvHyg();
     checkIsHygiene.Checked      = OpCur.IsHygiene;
     checkSetProspective.Checked = OpCur.SetProspective;
     checkIsWebSched.Checked     = OpCur.IsWebSched;
 }
        private void FillGridWebSchedOperatories()
        {
            _listWebSchedRecallOps = Operatories.GetOpsForWebSched();
            int opNameWidth = 170;
            int clinicWidth = 80;

            if (!PrefC.HasClinicsEnabled)
            {
                opNameWidth += clinicWidth;
            }
            gridWebSchedOperatories.BeginUpdate();
            gridWebSchedOperatories.Columns.Clear();
            gridWebSchedOperatories.Columns.Add(new ODGridColumn(Lan.g("TableOperatories", "Op Name"), opNameWidth));
            gridWebSchedOperatories.Columns.Add(new ODGridColumn(Lan.g("TableOperatories", "Abbrev"), 70));
            if (PrefC.HasClinicsEnabled)
            {
                gridWebSchedOperatories.Columns.Add(new ODGridColumn(Lan.g("TableOperatories", "Clinic"), clinicWidth));
            }
            gridWebSchedOperatories.Columns.Add(new ODGridColumn(Lan.g("TableOperatories", "Provider"), 90));
            gridWebSchedOperatories.Columns.Add(new ODGridColumn(Lan.g("TableOperatories", "Hygienist"), 90));
            gridWebSchedOperatories.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < _listWebSchedRecallOps.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(_listWebSchedRecallOps[i].OpName);
                row.Cells.Add(_listWebSchedRecallOps[i].Abbrev);
                if (PrefC.HasClinicsEnabled)
                {
                    row.Cells.Add(Clinics.GetAbbr(_listWebSchedRecallOps[i].ClinicNum));
                }
                row.Cells.Add(Providers.GetAbbr(_listWebSchedRecallOps[i].ProvDentist));
                row.Cells.Add(Providers.GetAbbr(_listWebSchedRecallOps[i].ProvHygienist));
                gridWebSchedOperatories.Rows.Add(row);
            }
            gridWebSchedOperatories.EndUpdate();
        }
Esempio n. 12
0
        private void FillGrid()
        {
            gridAdjusts.BeginUpdate();
            gridAdjusts.ListGridRows.Clear();
            gridAdjusts.ListGridColumns.Clear();
            GridColumn col = new GridColumn(Lan.g("TableAdjustSelect", "Date"), 70);

            gridAdjusts.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableAdjustSelect", "Prov"), 55);
            gridAdjusts.ListGridColumns.Add(col);
            if (PrefC.HasClinicsEnabled)
            {
                col = new GridColumn(Lan.g("TableAdjustSelect", "Clinic"), 55);
                gridAdjusts.ListGridColumns.Add(col);
            }
            col = new GridColumn(Lan.g("TableProcSelect", "Amt Orig"), 60, HorizontalAlignment.Right);
            gridAdjusts.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableProcSelect", "Amt End"), 60, HorizontalAlignment.Right);
            gridAdjusts.ListGridColumns.Add(col);
            GridRow row;

            foreach (AccountEntry entry in _listAdjusts)
            {
                row = new GridRow();
                row.Cells.Add(((Adjustment)entry.Tag).AdjDate.ToShortDateString());
                row.Cells.Add(Providers.GetAbbr(((Adjustment)entry.Tag).ProvNum));
                if (PrefC.HasClinicsEnabled)
                {
                    row.Cells.Add(Clinics.GetAbbr(((Adjustment)entry.Tag).ClinicNum));
                }
                row.Cells.Add(entry.AmountOriginal.ToString("F"));             //Amt Orig
                row.Cells.Add(entry.AmountStart.ToString("F"));                //Amt Available
                row.Tag = entry;
                gridAdjusts.ListGridRows.Add(row);
            }
            gridAdjusts.EndUpdate();
        }
Esempio n. 13
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);
        }
Esempio n. 14
0
        private void FormScheduleEdit_Load(object sender, System.EventArgs e)
        {
            _isHolidayOrNote = (SchedCur.StartTime == TimeSpan.Zero && SchedCur.StopTime == TimeSpan.Zero);
            if (PrefC.HasClinicsEnabled)
            {
                if (ClinicNum == 0)
                {
                    Text += " - " + Lan.g(this, "Headquarters");
                }
                else
                {
                    string abbr = Clinics.GetAbbr(ClinicNum);
                    if (!string.IsNullOrWhiteSpace(abbr))
                    {
                        Text += " - " + abbr;
                    }
                }
                //if clinics are enabled and this is a holiday or practice note, set visible and fill the clinic combobox and private list of clinics
                if (_isHolidayOrNote && SchedCur.SchedType == ScheduleType.Practice)
                {
                    comboClinic.Visible = true;                  //only visible for holidays and practice notes and only if clinics are enabled
                    labelClinic.Visible = true;
                    _listClinics        = Clinics.GetForUserod(Security.CurUser);
                    if (!Security.CurUser.ClinicIsRestricted)
                    {
                        comboClinic.Items.Add(Lan.g(this, "Headquarters"));
                        if (SchedCur.ClinicNum == 0)                       //new sched and HQ selected or opened one from db for HQ
                        {
                            comboClinic.SelectedIndex = 0;
                        }
                    }
                    foreach (Clinic clinicCur in _listClinics)
                    {
                        comboClinic.Items.Add(clinicCur.Abbr);
                        if (clinicCur.ClinicNum == SchedCur.ClinicNum)
                        {
                            comboClinic.SelectedIndex = comboClinic.Items.Count - 1;
                        }
                    }
                    if (comboClinic.SelectedIndex < 0)                                                                                                 //current sched's clinic not found or set to 0 and user is restricted, default to clinic sent in
                    {
                        comboClinic.SelectedIndex = _listClinics.FindIndex(x => x.ClinicNum == ClinicNum) + (Security.CurUser.ClinicIsRestricted?0:1); //add one for HQ if not restricted
                    }
                }
            }
            textNote.Text = SchedCur.Note;
            if (_isHolidayOrNote)
            {
                comboStart.Visible = false;
                labelStart.Visible = false;
                comboStop.Visible  = false;
                labelStop.Visible  = false;
                listOps.Visible    = false;
                labelOps.Visible   = false;
                textNote.Select();
                return;
            }
            //from here on, NOT a practice note or holiday
            DateTime time;

            for (int i = 0; i < 24; i++)
            {
                time = DateTime.Today + TimeSpan.FromHours(7) + TimeSpan.FromMinutes(30 * i);
                comboStart.Items.Add(time.ToShortTimeString());
                comboStop.Items.Add(time.ToShortTimeString());
            }
            comboStart.Text = SchedCur.StartTime.ToShortTimeString();
            comboStop.Text  = SchedCur.StopTime.ToShortTimeString();
            listOps.Items.Add(Lan.g(this, "not specified"));
            //filter list if using clinics and if a clinic filter was passed in to only ops assigned to the specified clinic, otherwise all non-hidden ops
            _listOps = Operatories.GetDeepCopy(true);
            if (PrefC.HasClinicsEnabled && ClinicNum > 0)
            {
                _listOps.RemoveAll(x => x.ClinicNum != ClinicNum);
            }
            foreach (Operatory opCur in _listOps)
            {
                int curIndex = listOps.Items.Add(opCur.OpName);
                //Select the item that was just added if the schedule's Ops contains the current OpNum.
                listOps.SetSelected(curIndex, SchedCur.Ops.Contains(opCur.OperatoryNum));
            }
            listOps.SetSelected(0, listOps.SelectedIndices.Count == 0);         //select 'not specified' if no ops were selected in the loop
            comboStart.Select();
        }
        private void FillGrid()
        {
            gridMain.BeginUpdate();
            gridMain.ListGridColumns.Clear();
            List <DisplayField> fieldsForGrid = DisplayFields.GetForCategory(DisplayFieldCategory.AccountModule);

            if (!PrefC.HasClinicsEnabled)
            {
                //remove clinics from displayfields if clinics are disabled
                fieldsForGrid.RemoveAll(x => x.InternalName.ToLower().Contains("clinic"));
            }
            fieldsForGrid.RemoveAll(x => x.InternalName.In("Abbr", "Balance", "Signed"));
            HorizontalAlignment align;
            GridSortingStrategy sort;

            for (int i = 0; i < fieldsForGrid.Count; i++)
            {
                align = HorizontalAlignment.Left;
                sort  = GridSortingStrategy.StringCompare;
                if (fieldsForGrid[i].InternalName.In("Charges", "Credits"))
                {
                    align = HorizontalAlignment.Right;
                    sort  = GridSortingStrategy.AmountParse;
                }
                if (fieldsForGrid[i].InternalName == "Tth")
                {
                    sort = GridSortingStrategy.ToothNumberParse;
                }
                if (fieldsForGrid[i].InternalName == "Date")
                {
                    sort = GridSortingStrategy.DateParse;
                }
                gridMain.ListGridColumns.Add(new GridColumn(fieldsForGrid[i].Description == ""?fieldsForGrid[i].InternalName:fieldsForGrid[i].Description,
                                                            fieldsForGrid[i].ColumnWidth, align, sort));
            }
            if (gridMain.ListGridColumns.Sum(x => x.ColWidth) > gridMain.Width)
            {
                gridMain.HScrollVisible = true;
            }
            gridMain.ListGridRows.Clear();
            GridRow row;

            for (int i = 0; i < _listLimitedRows.Count; i++)
            {
                LimitedRow limitedRow = _listLimitedRows[i];
                if (!limitedRow.Type.In(listBoxTransTypes.GetListSelected <AccountEntryType>()))
                {
                    continue;
                }
                DateTime date = limitedRow.DateTime.Date;
                if (date.Date < odDatePickerFrom.GetDateTime().Date || date.Date > odDatePickerTo.GetDateTime().Date)
                {
                    continue;                    //do not add to grid if it is outside the filtered date range.
                }
                row = new GridRow();
                for (int f = 0; f < fieldsForGrid.Count; f++)
                {
                    switch (fieldsForGrid[f].InternalName)
                    {
                    case "Date":
                        row.Cells.Add(date.ToShortDateString());
                        break;

                    case "Patient":
                        row.Cells.Add(limitedRow.PatientName);
                        break;

                    case "Prov":
                        row.Cells.Add(limitedRow.ProvName);
                        break;

                    case "Clinic":
                        row.Cells.Add(Clinics.GetAbbr(limitedRow.ClinicNum));
                        break;

                    case "ClinicDesc":
                        row.Cells.Add(Clinics.GetDesc(limitedRow.ClinicNum));
                        break;

                    case "Code":
                        row.Cells.Add(limitedRow.ProcCode);
                        break;

                    case "Tth":
                        row.Cells.Add(limitedRow.Tooth);
                        break;

                    case "Description":
                        row.Cells.Add(limitedRow.Description);
                        break;

                    case "Charges":
                        row.Cells.Add(limitedRow.Charges);
                        break;

                    case "Credits":
                        row.Cells.Add(limitedRow.Credits);
                        break;

                    default:
                        row.Cells.Add("");
                        break;
                    }
                }
                row.ColorText = limitedRow.ColorText;
                if (i == _listLimitedRows.Count - 1 || limitedRow.DateTime.Date != _listLimitedRows[i + 1].DateTime.Date)
                {
                    row.ColorLborder = Color.Black;
                }
                row.Tag = limitedRow;
                gridMain.ListGridRows.Add(row);
            }
            gridMain.EndUpdate();
            for (int i = 0; i < gridMain.ListGridRows.Count; i++)
            {
                LimitedRow lRow = gridMain.ListGridRows[i].Tag as LimitedRow;
                gridMain.SetSelected(i, _dictSelectedRows.TryGetValue(lRow.Type, out List <long> listPriKeys) && listPriKeys.Contains(lRow.PrimaryKey));
            }
            //this will refresh _dictSelectedRows and add any associated trans to the previously selected rows
            SelectAssociatedTrans();
        }
Esempio n. 16
0
        private void FillGrid()
        {
            long selectedApptOtherNum = SelectedApptOther?.AptNum ?? -1;
            int  selectedIndex        = -1;

            gridMain.BeginUpdate();
            gridMain.ListGridColumns.Clear();
            GridColumn col = new GridColumn(Lan.g("FormApptsOther", "Appt Status"), 100);

            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("FormApptsOther", "Prov"), 50);
            gridMain.ListGridColumns.Add(col);
            if (PrefC.HasClinicsEnabled)
            {
                col = new GridColumn(Lan.g("FormApptsOther", "Clinic"), 80);
                gridMain.ListGridColumns.Add(col);
            }
            col = new GridColumn(Lan.g("FormApptsOther", "Date"), 70);        //If the order changes, reflect the change for dateIndex below.
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("FormApptsOther", "Time"), 70);        //Must immediately follow Date column.
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("FormApptsOther", "Min"), 40);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("FormApptsOther", "Procedures"), 150);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("FormApptsOther", "Notes"), 320);
            gridMain.ListGridColumns.Add(col);
            gridMain.ListGridRows.Clear();
            GridRow row;
            int     dateIndex = 3;

            if (!PrefC.HasClinicsEnabled)
            {
                dateIndex = 2;
            }
            for (int i = 0; i < _listApptOthers.Count; i++)
            {
                row = new GridRow();
                row.Cells.Add(_listApptOthers[i].AptStatus.ToString());
                row.Cells.Add(Providers.GetAbbr(_listApptOthers[i].ProvNum));
                if (PrefC.HasClinicsEnabled)
                {
                    row.Cells.Add(Clinics.GetAbbr(_listApptOthers[i].ClinicNum));
                }
                row.Cells.Add("");                //Date
                row.Cells.Add("");                //Time
                if (_listApptOthers[i].AptDateTime.Year > 1880)
                {
                    //only regular still scheduled appts
                    if (_listApptOthers[i].AptStatus != ApptStatus.Planned && _listApptOthers[i].AptStatus != ApptStatus.PtNote &&
                        _listApptOthers[i].AptStatus != ApptStatus.PtNoteCompleted && _listApptOthers[i].AptStatus != ApptStatus.UnschedList &&
                        _listApptOthers[i].AptStatus != ApptStatus.Broken)
                    {
                        row.Cells[dateIndex].Text     = _listApptOthers[i].AptDateTime.ToString("d");
                        row.Cells[dateIndex + 1].Text = _listApptOthers[i].AptDateTime.ToString("t");
                        if (_listApptOthers[i].AptDateTime < DateTime.Today)                          //Past
                        {
                            row.ColorBackG = _listProgNoteColorDefs[11].ItemColor;
                            row.ColorText  = _listProgNoteColorDefs[10].ItemColor;
                        }
                        else if (_listApptOthers[i].AptDateTime.Date == DateTime.Today.Date)                        //Today
                        {
                            row.ColorBackG    = _listProgNoteColorDefs[9].ItemColor;
                            row.ColorText     = _listProgNoteColorDefs[8].ItemColor;
                            row.Cells[0].Text = Lan.g(this, "Today");
                        }
                        else if (_listApptOthers[i].AptDateTime > DateTime.Today)                          //Future
                        {
                            row.ColorBackG = _listProgNoteColorDefs[13].ItemColor;
                            row.ColorText  = _listProgNoteColorDefs[12].ItemColor;
                        }
                    }
                    else if (_listApptOthers[i].AptStatus == ApptStatus.Planned)                    //show line for planned appt
                    {
                        row.ColorBackG = _listProgNoteColorDefs[17].ItemColor;
                        row.ColorText  = _listProgNoteColorDefs[16].ItemColor;
                        string txt           = Lan.g("enumApptStatus", "Planned") + " ";
                        int    plannedAptIdx = _listPlannedIncompletes.FindIndex(x => x.AptNum == _listApptOthers[i].AptNum);
                        if (IsShowCompletePlanned)
                        {
                            for (int p = 0; p < _listPlannedAppts.Count; p++)
                            {
                                if (_listPlannedAppts[p].AptNum == _listApptOthers[i].AptNum)
                                {
                                    txt += "#" + _listPlannedAppts[p].ItemOrder.ToString();
                                }
                            }
                        }
                        else
                        {
                            if (plannedAptIdx >= 0)
                            {
                                txt += "#" + (plannedAptIdx + 1);
                            }
                            else
                            {
                                continue;
                            }
                        }
                        if (plannedAptIdx < 0)                       //attached to a completed appointment
                        {
                            txt += " (" + Lan.g("enumApptStatus", ApptStatus.Complete.ToString()) + ")";
                        }
                        if (_listApptOthers.ToList().FindAll(x => x.NextAptNum == _listApptOthers[i].AptNum)
                            .Exists(x => x.AptStatus == ApptStatus.Scheduled))                           //attached to a scheduled appointment
                        {
                            txt += " (" + Lan.g("enumApptStatus", ApptStatus.Scheduled.ToString()) + ")";
                        }
                        row.Cells[0].Text = txt;
                    }
                    else if (_listApptOthers[i].AptStatus == ApptStatus.PtNote)
                    {
                        row.ColorBackG    = _listProgNoteColorDefs[19].ItemColor;
                        row.ColorText     = _listProgNoteColorDefs[18].ItemColor;
                        row.Cells[0].Text = Lan.g("enumApptStatus", "PtNote");
                    }
                    else if (_listApptOthers[i].AptStatus == ApptStatus.PtNoteCompleted)
                    {
                        row.ColorBackG    = _listProgNoteColorDefs[21].ItemColor;
                        row.ColorText     = _listProgNoteColorDefs[20].ItemColor;
                        row.Cells[0].Text = Lan.g("enumApptStatus", "PtNoteCompleted");
                    }
                    else if (_listApptOthers[i].AptStatus == ApptStatus.Broken)
                    {
                        row.Cells[0].Text             = Lan.g("enumApptStatus", "Broken");
                        row.Cells[dateIndex].Text     = _listApptOthers[i].AptDateTime.ToString("d");
                        row.Cells[dateIndex + 1].Text = _listApptOthers[i].AptDateTime.ToString("t");
                        row.ColorBackG = _listProgNoteColorDefs[15].ItemColor;
                        row.ColorText  = _listProgNoteColorDefs[14].ItemColor;
                    }
                    else if (_listApptOthers[i].AptStatus == ApptStatus.UnschedList)
                    {
                        row.Cells[0].Text = Lan.g("enumApptStatus", "UnschedList");
                        row.ColorBackG    = _listProgNoteColorDefs[15].ItemColor;
                        row.ColorText     = _listProgNoteColorDefs[14].ItemColor;
                    }
                }
                row.Cells.Add((_listApptOthers[i].Pattern.Length * 5).ToString());
                row.Cells.Add(_listApptOthers[i].ProcDescript);
                row.Cells.Add(_listApptOthers[i].Note);
                row.Tag = _listApptOthers[i].AptNum;
                gridMain.ListGridRows.Add(row);
                if ((long)row.Tag == selectedApptOtherNum)
                {
                    selectedIndex = i;
                }
            }
            gridMain.EndUpdate();
            if (selectedIndex > -1)
            {
                gridMain.SetSelected(selectedIndex, true);
            }
        }
Esempio n. 17
0
        private void FillGrid()
        {
            long clinicNum = 0;

            //if clinics are not enabled, comboClinic.SelectedIndex will be -1, so clinicNum will be 0 and list will not be filtered by clinic
            if (Security.CurUser.ClinicIsRestricted && comboClinics.SelectedIndex > -1)
            {
                clinicNum = _listClinics[comboClinics.SelectedIndex].ClinicNum;
            }
            else if (comboClinics.SelectedIndex > 0)                                //if user is not restricted, clinicNum will be 0 and the query will get all clinic data
            {
                clinicNum = _listClinics[comboClinics.SelectedIndex - 1].ClinicNum; //if user is not restricted, comboClinic will contain "All" so minus 1
            }
            int clinicWidth  = 80;
            int patientWidth = 180;
            int carrierWidth = 220;

            if (PrefC.HasClinicsEnabled)
            {
                patientWidth = 140;
                carrierWidth = 200;
            }
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g("TableAutoOrthoClaims", "Patient"), patientWidth);

            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableAutoOrthoClaims", "Carrier"), carrierWidth);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableAutoOrthoClaims", "TxMonths"), 70);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableAutoOrthoClaims", "Banding"), 80, HorizontalAlignment.Center);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableAutoOrthoClaims", "MonthsRem"), 100);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableAutoOrthoClaims", "#Sent"), 60);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableAutoOrthoClaims", "LastSent"), 80, HorizontalAlignment.Center);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableAutoOrthoClaims", "NextClaim"), 80, HorizontalAlignment.Center);
            gridMain.Columns.Add(col);
            if (PrefC.HasClinicsEnabled)              //clinics is turned on
            {
                col = new ODGridColumn(Lan.g("TableAutoOrthoClaims", "Clinic"), clinicWidth, HorizontalAlignment.Center);
                gridMain.Columns.Add(col);
            }
            gridMain.Rows.Clear();
            ODGridRow row;

            foreach (DataRow rowCur in _tableOutstandingAutoClaims.Rows)
            {
                //need a check for if clinics is on here
                if (PrefC.HasClinicsEnabled &&             //Clinics are enabled
                    (Security.CurUser.ClinicIsRestricted || comboClinics.SelectedIndex != 0) &&                   //"All" is not selected
                    clinicNum != PIn.Long(rowCur["ClinicNum"].ToString()))                        //currently selected clinic doesn't match the row's clinic
                {
                    continue;
                }
                row = new ODGridRow();
                DateTime   dateLastSeen   = PIn.Date(rowCur["LastSent"].ToString());
                DateTime   dateBanding    = PIn.Date(rowCur["DateBanding"].ToString());
                DateTime   dateNextClaim  = PIn.Date(rowCur["OrthoAutoNextClaimDate"].ToString());
                DateTimeOD dateTMonthsRem = new DateTimeOD(PIn.Date(rowCur["DateBanding"].ToString()).AddMonths(PIn.Int(rowCur["MonthsTreat"].ToString())), DateTimeOD.Today);
                row.Cells.Add(PIn.String(rowCur["Patient"].ToString()));
                row.Cells.Add(PIn.String(rowCur["CarrierName"].ToString()));
                row.Cells.Add(PIn.String(rowCur["MonthsTreat"].ToString()));
                row.Cells.Add(dateBanding.Year < 1880 ? "" : dateBanding.ToShortDateString()); //add blank if there is no banding
                if (dateBanding.Year < 1880)                                                   //add blank if there is no banding
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(((dateTMonthsRem.YearsDiff * 12) + dateTMonthsRem.MonthsDiff) + " " + Lan.g(this, "months")
                                  + ", " + dateTMonthsRem.DaysDiff + " " + Lan.g(this, "days"));
                }
                row.Cells.Add(PIn.String(rowCur["NumSent"].ToString()));
                row.Cells.Add(dateLastSeen.Year < 1880 ? "" : dateLastSeen.ToShortDateString());
                row.Cells.Add(dateNextClaim.Year < 1880 ? "" : dateNextClaim.ToShortDateString());
                if (PrefC.HasClinicsEnabled)                  //clinics is turned on
                //Use the long list of clinics so that hidden clinics can be shown for unrestricted users.
                {
                    row.Cells.Add(Clinics.GetAbbr(PIn.Long(rowCur["ClinicNum"].ToString())));
                }
                row.Tag = rowCur;
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
Esempio n. 18
0
        private void FillGrid()
        {
            gridMain.BeginUpdate();
            gridMain.ListGridColumns.Clear();
            int opNameWidth = 180;
            int clinicWidth = 85;

            if (!PrefC.HasClinicsEnabled)
            {
                //Clinics are hidden so add the width of the clinic column to the Op Name column because the clinic column will not show.
                opNameWidth += clinicWidth;
            }
            GridColumn col = new GridColumn(Lan.g("TableOperatories", "Op Name"), opNameWidth);

            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableOperatories", "Abbrev"), 70);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableOperatories", "IsHidden"), 64, HorizontalAlignment.Center);
            gridMain.ListGridColumns.Add(col);
            if (PrefC.HasClinicsEnabled)
            {
                col = new GridColumn(Lan.g("TableOperatories", "Clinic"), clinicWidth);
                gridMain.ListGridColumns.Add(col);
            }
            col = new GridColumn(Lan.g("TableOperatories", "Provider"), 70);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableOperatories", "Hygienist"), 70);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableOperatories", "IsHygiene"), 64, HorizontalAlignment.Center);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableOperatories", "IsWebSched"), 74, HorizontalAlignment.Center);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableOperatories", "IsNewPat"), 0, HorizontalAlignment.Center);
            gridMain.ListGridColumns.Add(col);
            gridMain.ListGridRows.Clear();
            GridRow     row;
            List <long> listWSNPAOperatoryNums = Operatories.GetOpsForWebSchedNewPatAppts().Select(x => x.OperatoryNum).ToList();

            foreach (Operatory opCur in _listOps)
            {
                row = new GridRow();
                row.Cells.Add(opCur.OpName);
                row.Cells.Add(opCur.Abbrev);
                if (opCur.IsHidden)
                {
                    row.Cells.Add("X");
                }
                else
                {
                    row.Cells.Add("");
                }
                if (PrefC.HasClinicsEnabled)
                {
                    row.Cells.Add(Clinics.GetAbbr(opCur.ClinicNum));
                }
                row.Cells.Add(Providers.GetAbbr(opCur.ProvDentist));
                row.Cells.Add(Providers.GetAbbr(opCur.ProvHygienist));
                if (opCur.IsHygiene)
                {
                    row.Cells.Add("X");
                }
                else
                {
                    row.Cells.Add("");
                }
                row.Cells.Add(opCur.IsWebSched?"X":"");
                row.Cells.Add(listWSNPAOperatoryNums.Contains(opCur.OperatoryNum) ? "X" : "");
                row.Tag = opCur;
                gridMain.ListGridRows.Add(row);
            }
            gridMain.EndUpdate();
        }
Esempio n. 19
0
        ///<summary>Used to update the main title bar when neither the patient nor the clinic need to change.
        ///Currently only used to refresh the title bar when the timer ticks for the update time countdown.</summary>
        public static string GetMainTitleSamePat()
        {
            string retVal = PrefC.GetString(PrefName.MainWindowTitle);

            if (PrefC.HasClinicsEnabled && _clinSelectedCur > 0)
            {
                if (retVal != "")
                {
                    retVal += " - " + Lan.g("FormOpenDental", "Clinic") + ": ";
                }
                if (PrefC.GetBool(PrefName.TitleBarClinicUseAbbr))
                {
                    retVal += Clinics.GetAbbr(_clinSelectedCur);
                }
                else
                {
                    retVal += Clinics.GetDesc(_clinSelectedCur);
                }
            }
            if (Security.CurUser != null)
            {
                retVal += " {" + Security.CurUser.UserName + "}";
            }
            if (_patSelectedCur == null || _patSelectedCur.PatNum == 0 || _patSelectedCur.PatNum == -1)
            {
                retVal += MainTitleUpdateCountdown();
                if (FormOpenDental.RegKeyIsForTesting)
                {
                    retVal += " - " + Lan.g("FormOpenDental", "Developer Only License") + " - " + Lan.g("FormOpenDental", "Not for use with live patient data") + " - ";
                }
                //Now check to see if this database has been put into "Testing Mode"
                if (Introspection.IsTestingMode)
                {
                    retVal += " <TESTING MODE ENABLED> ";
                }
                return(retVal);
            }
            retVal += " - " + _patSelectedCur.GetNameLF();
            if (PrefC.GetBool(PrefName.TitleBarShowSpecialty))
            {
                retVal += string.IsNullOrWhiteSpace(_patSelectedCur.Specialty) ? "" : " (" + _patSelectedCur.Specialty + ")";
            }
            if (PrefC.GetLong(PrefName.ShowIDinTitleBar) == 1)
            {
                retVal += " - " + _patSelectedCur.PatNum.ToString();
            }
            else if (PrefC.GetLong(PrefName.ShowIDinTitleBar) == 2)
            {
                retVal += " - " + _patSelectedCur.ChartNumber;
            }
            else if (PrefC.GetLong(PrefName.ShowIDinTitleBar) == 3)
            {
                if (_patSelectedCur.Birthdate.Year > 1880)
                {
                    retVal += " - " + _patSelectedCur.Birthdate.ToShortDateString();
                }
            }
            if (_patSelectedCur.SiteNum != 0)
            {
                retVal += " - " + Sites.GetDescription(_patSelectedCur.SiteNum);
            }
            retVal += MainTitleUpdateCountdown();
            if (FormOpenDental.RegKeyIsForTesting)
            {
                retVal += " - " + Lan.g("FormOpenDental", "Developer Only License") + " - " + Lan.g("FormOpenDental", "Not for use with live patient data") + " - ";
            }
            //Now check to see if this database has been put into "Testing Mode"
            if (Introspection.IsTestingMode)
            {
                retVal += " <TESTING MODE ENABLED> ";
            }
            return(retVal);
        }
Esempio n. 20
0
        private void FillGrid()
        {
            Cursor = Cursors.WaitCursor;
            datePicker.HideCalendars();
            List <int> listLogIndexesFiltered = GetListIndexesFiltered();

            #region Set Grid Columns
            gridMain.BeginUpdate();
            gridMain.ListGridColumns.Clear();
            gridMain.ListGridColumns.Add(new GridColumn("Guarantor", PrefC.HasClinicsEnabled?-200:-300));
            if (PrefC.HasClinicsEnabled)
            {
                gridMain.ListGridColumns.Add(new GridColumn("Clinic", -100));
            }
            gridMain.ListGridColumns.Add(new GridColumn("User", -100));
            gridMain.ListGridColumns.Add(new GridColumn("Trans Type", -80));
            gridMain.ListGridColumns.Add(new GridColumn("Trans Date Time", -120, HorizontalAlignment.Center, GridSortingStrategy.DateParse));
            gridMain.ListGridColumns.Add(new GridColumn("Demand Type", -85));
            gridMain.ListGridColumns.Add(new GridColumn("Service Code", -85));
            gridMain.ListGridColumns.Add(new GridColumn("Client ID", -75));
            gridMain.ListGridColumns.Add(new GridColumn("Trans Amt", -70, HorizontalAlignment.Right, GridSortingStrategy.AmountParse));
            gridMain.ListGridColumns.Add(new GridColumn("Account Bal", -80, HorizontalAlignment.Right, GridSortingStrategy.AmountParse));
            gridMain.ListGridColumns.Add(new GridColumn("Key Type", -100));
            #endregion Set Grid Columns
            #region Fill Grid Rows
            List <Patient> listFilteredPatLims = listLogIndexesFiltered.Where(x => _dictPatLims.ContainsKey(_listTsiTransLogsAll[x].PatNum))         //Just in case.
                                                 .Select(x => _dictPatLims[_listTsiTransLogsAll[x].PatNum]).DistinctBy(x => x.PatNum).ToList();
            Dictionary <long, string> dictPatNames       = listFilteredPatLims.ToDictionary(x => x.PatNum, x => x.GetNameLF());
            Dictionary <long, string> dictClinicAbbrs    = _listClinics.Where(x => x.ClinicNum > 0).ToDictionary(x => x.ClinicNum, x => x.Abbr);
            Dictionary <long, string> dictPatClinicAbbrs = listFilteredPatLims.ToDictionary(x => x.PatNum, x => Clinics.GetAbbr(x.ClinicNum));
            Dictionary <long, string> dictUserNames      = Userods.GetUsers(listLogIndexesFiltered.Select(x => _listTsiTransLogsAll[x].UserNum).Distinct().ToList())
                                                           .ToDictionary(x => x.UserNum, x => x.UserName);
            gridMain.ListGridRows.Clear();
            int     rowToReselect = -1;
            GridRow row;
            foreach (int i in listLogIndexesFiltered)
            {
                TsiTransLog logCur = _listTsiTransLogsAll[i];
                row = new GridRow();
                string patName = "";
                row.Cells.Add((checkShowPatNums.Checked?(logCur.PatNum.ToString() + " - "):"")
                              + (dictPatNames.TryGetValue(logCur.PatNum, out patName)?patName:Patients.GetNameLF(logCur.PatNum)));
                if (PrefC.HasClinicsEnabled)
                {
                    string clinicAbbr = "";
                    row.Cells.Add((dictClinicAbbrs.TryGetValue(logCur.ClinicNum, out clinicAbbr) || dictPatClinicAbbrs.TryGetValue(logCur.PatNum, out clinicAbbr))?clinicAbbr:"");
                }
                string userName = "";
                row.Cells.Add(dictUserNames.TryGetValue(logCur.UserNum, out userName)?userName:"");
                row.Cells.Add(logCur.TransType.GetDescription());
                row.Cells.Add(logCur.TransDateTime.ToString("g"));
                row.Cells.Add(logCur.DemandType.GetDescription());
                row.Cells.Add(logCur.ServiceCode.GetDescription());
                row.Cells.Add(logCur.ClientId);
                row.Cells.Add(logCur.TransAmt.ToString("n"));
                row.Cells.Add(logCur.AccountBalance.ToString("n"));
                row.Cells.Add(logCur.FKeyType.GetDescription());
                row.Tag = i;
                gridMain.ListGridRows.Add(row);
                if (_selectedLog != null && _selectedLog.TsiTransLogNum == logCur.TsiTransLogNum)
                {
                    rowToReselect = gridMain.ListGridRows.Count - 1;
                }
            }
            #endregion Fill Grid Rows
            gridMain.EndUpdate();
            if (_selectedLog != null)           //row was selected before call to FillGrid
            {
                if (rowToReselect > -1)
                {
                    gridMain.SetSelected(rowToReselect, true);
                }
                else                  //row was selected but is no longer in the grid
                {
                    textSelectedFieldName.Clear();
                    textSelectedFieldDetails.Clear();
                    textRawMsg.SelectionChanged -= textRawMsg_SelectionChanged;
                    textRawMsg.Clear();
                    textRawMsg.SelectionChanged += textRawMsg_SelectionChanged;
                    _selectedLog = null;
                }
            }
            Cursor = Cursors.Default;
        }
Esempio n. 21
0
            public ODGridRow ToGridRow()
            {
                ODGridRow  row = new ODGridRow();
                ODGridCell cell;

                if (Proc != null && Adj == null)             //A procedure row
                //Date
                {
                    cell = new ODGridCell(Proc.ProcDate.ToShortDateString());
                    row.Cells.Add(cell);
                    //Provider
                    cell = new ODGridCell(Providers.GetAbbr(Proc.ProvNum));
                    row.Cells.Add(cell);
                    //Clinic
                    if (PrefC.HasClinicsEnabled)
                    {
                        cell = new ODGridCell(Clinics.GetAbbr(Proc.ClinicNum));
                        row.Cells.Add(cell);
                    }
                    //Code
                    cell = new ODGridCell(ProcedureCodes.GetStringProcCode(Proc.CodeNum));
                    row.Cells.Add(cell);
                    //Fee;
                    cell           = new ODGridCell(Proc.ProcFee.ToString("c"));
                    cell.CellColor = Color.LightYellow;
                    row.Cells.Add(cell);
                    //Rem Before
                    cell           = new ODGridCell(RemBefore.ToString("c"));
                    cell.CellColor = Color.LightYellow;
                    row.Cells.Add(cell);
                    //Adj Amt
                    cell           = new ODGridCell("");
                    cell.CellColor = Color.White;
                    row.Cells.Add(cell);
                    //Rem After
                    cell           = new ODGridCell("");
                    cell.CellColor = Color.White;
                    row.Cells.Add(cell);
                }
                else if (IsUnattachedRowHeader())                 //The row header for unattached adjustments
                {
                    row.ColorBackG = Color.LightYellow;
                    //Date
                    cell = new ODGridCell("Unassigned");
                    row.Cells.Add(cell);
                    //Provider
                    cell = new ODGridCell("");
                    row.Cells.Add(cell);
                    //Clinic
                    if (PrefC.HasClinicsEnabled)
                    {
                        cell = new ODGridCell("");
                        row.Cells.Add(cell);
                    }
                    //Code
                    cell = new ODGridCell("");
                    row.Cells.Add(cell);
                    //Fee;
                    cell = new ODGridCell("");
                    row.Cells.Add(cell);
                    //Rem Before
                    cell = new ODGridCell("");
                    row.Cells.Add(cell);
                    //Adj Amt
                    cell = new ODGridCell("");
                    row.Cells.Add(cell);
                    //Rem After
                    cell = new ODGridCell("");
                    row.Cells.Add(cell);
                }
                else                  //An adjustment row
                                      //Adj Date
                {
                    cell = new ODGridCell(Adj.AdjDate.ToShortDateString());
                    row.Cells.Add(cell);
                    //Provider
                    cell = new ODGridCell(Providers.GetAbbr(Adj.ProvNum));
                    row.Cells.Add(cell);
                    //Clinic
                    if (PrefC.HasClinicsEnabled)
                    {
                        cell = new ODGridCell(Clinics.GetAbbr(Adj.ClinicNum));
                        row.Cells.Add(cell);
                    }
                    //Adj Type
                    cell = new ODGridCell(GetAdjustmentType(Adj));
                    row.Cells.Add(cell);
                    //Fee
                    cell = new ODGridCell();
                    row.Cells.Add(cell);
                    //Rem Before
                    cell = new ODGridCell();
                    row.Cells.Add(cell);
                    //Adj Amt
                    cell           = new ODGridCell(Math.Round(Adj.AdjAmt, 2).ToString());
                    cell.CellColor = Color.LightCyan;
                    row.Cells.Add(cell);
                    //Rem After
                    cell = new ODGridCell(Math.Round(RemAfter, 2).ToString());
                    if (Proc == null)                   //Unassigned adj
                    {
                        cell = new ODGridCell();
                    }
                    cell.CellColor = Color.LightCyan;
                    row.Cells.Add(cell);
                }
                return(row);
            }
Esempio n. 22
0
        ///<summary>Fills grid based on values in _listEtrans.
        ///Set isRefreshNeeded to true when we need to reinitialize local dictionarys after in memory list is also updated. Required true for first time running.
        ///Also allows you to passed in predetermined filter options.</summary>
        private void FillGrid(bool isRefreshNeeded, List <string> listSelectedStatuses, List <long> listSelectedClinicNums,
                              string carrierName, string checkTraceNum, string amountMin, string amountMax)
        {
            Action actionCloseProgress = null;

            if (isRefreshNeeded)
            {
                actionCloseProgress = ODProgressOld.ShowProgressStatus("Etrans835", this, Lan.g(this, "Gathering data") + "...", false);
                _dictEtrans835s.Clear();
                _dictEtransClaims.Clear();
                _dictClaimPayExists.Clear();
                List <Etrans835Attach>    listAttached        = Etrans835Attaches.GetForEtrans(_listEtranss.Select(x => x.EtransNum).ToArray());
                Dictionary <long, string> dictEtransMessages  = new Dictionary <long, string>();
                List <X12ClaimMatch>      list835ClaimMatches = new List <X12ClaimMatch>();
                Dictionary <long, int>    dictClaimMatchCount = new Dictionary <long, int>(); //1:1 with _listEtranss. Stores how many claim matches each 835 has.
                int batchQueryInterval = 500;                                                 //Every 500 rows we get the next 500 message texts to save memory.
                int rowCur             = 0;
                foreach (Etrans etrans in _listEtranss)
                {
                    if (rowCur % batchQueryInterval == 0)
                    {
                        int range = Math.Min(batchQueryInterval, _listEtranss.Count - rowCur);                   //Either the full batchQueryInterval amount or the remaining amount of etrans.
                        dictEtransMessages = EtransMessageTexts.GetMessageTexts(_listEtranss.GetRange(rowCur, range).Select(x => x.EtransMessageTextNum).ToList(), false);
                    }
                    rowCur++;
                    ODEvent.Fire(new ODEventArgs("Etrans835", Lan.g(this, "Processing 835: ") + ": " + rowCur + " out of " + _listEtranss.Count));
                    List <Etrans835Attach> listAttachedTo835 = listAttached.FindAll(x => x.EtransNum == etrans.EtransNum);
                    X835 x835 = new X835(etrans, dictEtransMessages[etrans.EtransMessageTextNum], etrans.TranSetId835, listAttachedTo835, true);
                    _dictEtrans835s.Add(etrans.EtransNum, x835);
                    List <X12ClaimMatch> listClaimMatches = x835.GetClaimMatches();
                    dictClaimMatchCount.Add(etrans.EtransNum, listClaimMatches.Count);
                    list835ClaimMatches.AddRange(listClaimMatches);
                }
                #region Set 835 unattached in batch and build _dictEtransClaims and _dictClaimPayCheckNums.
                ODEvent.Fire(new ODEventArgs("Etrans835", Lan.g(this, "Gathering internal claim matches.")));
                List <long> listClaimNums = Claims.GetClaimFromX12(list835ClaimMatches);             //Can return null.
                ODEvent.Fire(new ODEventArgs("Etrans835", Lan.g(this, "Building data sets.")));
                int         claimIndexCur        = 0;
                List <long> listMatchedClaimNums = new List <long>();
                foreach (Etrans etrans in _listEtranss)
                {
                    X835 x835 = _dictEtrans835s[etrans.EtransNum];
                    if (listClaimNums != null)
                    {
                        x835.SetClaimNumsForUnattached(listClaimNums.GetRange(claimIndexCur, dictClaimMatchCount[etrans.EtransNum]));
                    }
                    claimIndexCur += dictClaimMatchCount[etrans.EtransNum];
                    listMatchedClaimNums.AddRange(x835.ListClaimsPaid.FindAll(x => x.ClaimNum != 0).Select(x => x.ClaimNum).ToList());
                }
                List <Claim> listClaims = Claims.GetClaimsFromClaimNums(listMatchedClaimNums.Distinct().ToList());
                _dictClaimPayExists = ClaimPayments.HasClaimPayment(listMatchedClaimNums);              //Every claim num is associated to a bool. True when there is an existing claimPayment.
                foreach (Etrans etrans in _listEtranss)
                {
                    X835 x835 = _dictEtrans835s[etrans.EtransNum];
                    #region _dictEtransClaims, _dictClaimPayCheckNums
                    _dictEtransClaims.Add(etrans.EtransNum, new List <Claim>());
                    List <long>  listSubClaimNums = x835.ListClaimsPaid.FindAll(x => x.ClaimNum != 0).Select(y => y.ClaimNum).ToList();
                    List <Claim> listClaimsFor835 = listClaims.FindAll(x => listSubClaimNums.Contains(x.ClaimNum));
                    foreach (Hx835_Claim claim in x835.ListClaimsPaid)
                    {
                        Claim claimCur = listClaimsFor835.FirstOrDefault(x => x.ClaimNum == claim.ClaimNum);                    //Can be null.
                        if (claimCur == null && claim.IsAttachedToClaim && claim.ClaimNum == 0)
                        {
                            claimCur = new Claim();                          //Create empty claim since user detached claim manually, will not be considered in GetStringStatus(...).
                        }
                        if (claimCur != null && claim.IsPreauth)             //User attached preauth to internal claim, no payment needed to be considered 'Finalized' in GetStringStatus(...).
                        {
                            _dictClaimPayExists[claim.ClaimNum] = true;
                        }
                        _dictEtransClaims[etrans.EtransNum].Add(claimCur);
                    }
                    #endregion
                }
                ODEvent.Fire(new ODEventArgs("Etrans835", Lan.g(this, "Filling Grid.")));
                #endregion
            }
            gridMain.BeginUpdate();
            #region Initilize columns only once
            if (gridMain.Columns.Count == 0)
            {
                ODGridColumn col;
                col = new ODGridColumn(Lan.g("TableEtrans835s", "Patient Name"), 250);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g("TableEtrans835s", "Carrier Name"), 190);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g("TableEtrans835s", "Status"), 80);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g("TableEtrans835s", "Date"), 80);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g("TableEtrans835s", "Amount"), 80);
                gridMain.Columns.Add(col);
                if (PrefC.HasClinicsEnabled)
                {
                    col = new ODGridColumn(Lan.g("TableEtrans835s", "Clinic"), 70);
                    gridMain.Columns.Add(col);
                }
                col = new ODGridColumn(Lan.g("TableEtrans835s", "Code"), 37, HorizontalAlignment.Center);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g("TableEtrans835s", "Note"), 0);
                gridMain.Columns.Add(col);
            }
            #endregion
            gridMain.Rows.Clear();
            foreach (Etrans etrans in _listEtranss)
            {
                X835 x835 = _dictEtrans835s[etrans.EtransNum];
                #region Filter: Carrier Name
                if (carrierName != "" && !x835.PayerName.ToLower().Contains(carrierName.ToLower()))
                {
                    continue;
                }
                #endregion
                string status = GetStringStatus(etrans.EtransNum);
                #region Filter: Status
                if (!listSelectedStatuses.Contains(status.Replace("*", "")))                //The filter will ignore finalized with detached claims.
                {
                    continue;
                }
                #endregion
                //List of ClinicNums for the current etrans.ListClaimsPaid from the DB.
                List <long> listClinicNums = _dictEtransClaims[etrans.EtransNum].Select(x => x == null? 0 :x.ClinicNum).Distinct().ToList();
                #region Filter: Clinics
                if (PrefC.HasClinicsEnabled && !listClinicNums.Exists(x => listSelectedClinicNums.Contains(x)))
                {
                    continue;                    //The ClinicNums associated to the 835 do not match any of the selected ClinicNums, so nothing to show in this 835.
                }
                #endregion
                #region Filter: Check and Trace Value
                if (checkTraceNum != "" && !x835.TransRefNum.Contains(checkTraceNum))               //Trace Number does not match
                {
                    continue;
                }
                #endregion
                #region Filter: Insurance Check Range Min and Max
                if (amountMin != "" && x835.InsPaid < PIn.Decimal(amountMin) || amountMax != "" && x835.InsPaid > PIn.Decimal(amountMax))
                {
                    continue;                    //Either the InsPaid is below or above our range.
                }
                #endregion
                ODGridRow row = new ODGridRow();
                #region Column: Patient Name
                List <string> listPatNames = x835.ListClaimsPaid.Select(x => x.PatientName.ToString()).Distinct().ToList();
                string        patName      = (listPatNames.Count > 0 ? listPatNames[0] : "");
                if (listPatNames.Count > 1)
                {
                    patName = "(" + POut.Long(listPatNames.Count) + ")";
                }
                row.Cells.Add(patName);
                #endregion
                row.Cells.Add(x835.PayerName);
                row.Cells.Add(status);                //See GetStringStatus(...) for possible values.
                row.Cells.Add(POut.Date(etrans.DateTimeTrans));
                row.Cells.Add(POut.Decimal(x835.InsPaid));
                #region Column: Clinic
                if (PrefC.HasClinicsEnabled)
                {
                    string clinicAbbr = "";
                    if (listClinicNums.Count == 1)
                    {
                        if (listClinicNums[0] == 0)
                        {
                            clinicAbbr = Lan.g(this, "Unassigned");
                        }
                        else
                        {
                            clinicAbbr = Clinics.GetAbbr(listClinicNums[0]);
                        }
                    }
                    else if (listClinicNums.Count > 1)
                    {
                        clinicAbbr = "(" + Lan.g(this, "Multiple") + ")";
                    }
                    row.Cells.Add(clinicAbbr);
                }
                #endregion
                row.Cells.Add(x835._paymentMethodCode);
                row.Cells.Add(etrans.Note);
                row.Tag = etrans;
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
            actionCloseProgress?.Invoke();
        }
Esempio n. 23
0
        private void butPickClin_Click(object sender, EventArgs e)
        {
            FormClinics FormC = new FormClinics()
            {
                ListClinics = _listClinics
            };

            FormC.IsSelectionMode = true;
            FormC.ShowDialog();
            if (FormC.DialogResult != DialogResult.OK)
            {
                return;
            }
            _selectedClinicNum = FormC.SelectedClinicNum;
            comboClinic.IndexSelectOrSetText(_listClinics.FindIndex(x => x.ClinicNum == _selectedClinicNum), () => { return(Clinics.GetAbbr(_selectedClinicNum)); });
        }
        private List <GridRow> CreateChargeRows(List <AccountEntry> listEntries, List <int> listExpandedRows)
        {
            List <GridRow> listRows = new List <GridRow>();
            //Parent row
            GridRow row = new GridRow();

            //A placeholder accountEntry.  The Tag being null tells us it's a parent row.
            row.Tag = new AccountEntry()
            {
                ProvNum = listEntries[0].ProvNum, PatNum = listEntries[0].PatNum, ClinicNum = listEntries[0].ClinicNum
            };
            row.Cells.Add(Providers.GetAbbr(listEntries[0].ProvNum));            //Provider
            Patient pat;

            if (!_dictPatients.TryGetValue(listEntries[0].PatNum, out pat))
            {
                pat = Patients.GetLim(listEntries[0].PatNum);
                _dictPatients[pat.PatNum] = pat;
            }
            row.Cells.Add(pat.LName + ", " + pat.FName);        //Patient
            if (PrefC.HasClinicsEnabled)
            {
                row.Cells.Add(Clinics.GetAbbr(listEntries[0].ClinicNum));
            }
            string procCodes  = "";
            int    addedCodes = 0;

            for (int i = 0; i < listEntries.Count; i++)
            {
                if (Math.Round(listEntries[i].AmountStart, 3) == 0)
                {
                    continue;
                }
                if (listEntries[i].GetType() == typeof(Procedure))
                {
                    if (procCodes != "")
                    {
                        procCodes += ", ";
                    }
                    procCodes += ProcedureCodes.GetStringProcCode(((Procedure)listEntries[i].Tag).CodeNum);
                    addedCodes++;
                }
                else if (listEntries[i].GetType() == typeof(PaySplit) && ((PaySplit)listEntries[i].Tag).ProcNum != 0)
                {
                    if (procCodes != "")
                    {
                        procCodes += ", ";
                    }
                    //Look for the procedure in AccountEntries (it should be there) - We don't want to go to the DB
                    AccountEntry entry = _results.ListAccountCharges.Find(x => x.GetType() == typeof(Procedure) && x.PriKey == ((PaySplit)listEntries[i].Tag).ProcNum);
                    if (entry != null)                   //Can be null if paysplit is on a procedure that's outside the family.
                    {
                        procCodes += ProcedureCodes.GetStringProcCode(((Procedure)entry.Tag).CodeNum);
                        addedCodes++;
                    }
                }
                else if (listEntries[i].GetType() == typeof(Adjustment) && ((Adjustment)listEntries[i].Tag).ProcNum != 0)
                {
                    if (procCodes != "")
                    {
                        procCodes += ", ";
                    }
                    //Look for the procedure in AccountEntries (it should be there) - We don't want to go to the DB
                    AccountEntry entry = _results.ListAccountCharges.Find(x => x.GetType() == typeof(Procedure) && x.PriKey == ((Adjustment)listEntries[i].Tag).ProcNum);
                    if (entry != null)                   //Can be null if paysplit is on a procedure that's outside the family.
                    {
                        procCodes += ProcedureCodes.GetStringProcCode(((Procedure)entry.Tag).CodeNum);
                        addedCodes++;
                    }
                }
                if (addedCodes == 9)               //1 less than above, this column is shorter when filtering by prov + clinic
                {
                    procCodes += ", (...)";
                    break;
                }
            }
            row.Cells.Add(procCodes);
            //parent row should be sum of all child rows, and we skip entries that have an amount start of 0 for children so skip for parent as well.
            List <AccountEntry> listEntriesWithAmountStart = listEntries.FindAll(x => !x.AmountStart.IsEqual(0));

            row.Cells.Add(listEntriesWithAmountStart.Sum(x => x.AmountOriginal).ToString("f"));       //Amount Original
            row.Cells.Add(listEntriesWithAmountStart.Sum(x => x.AmountStart).ToString("f"));          //Amount Start
            row.Cells.Add(listEntriesWithAmountStart.Sum(x => x.AmountEnd).ToString("f"));            //Amount End
            row.Bold = true;
            listRows.Add(row);
            if (listExpandedRows.Contains(listRows.Count - 1))
            {
                row.DropDownInitiallyDown = true;              //If the expanded rows contains the one we just added, expand it
            }
            //Child rows
            foreach (AccountEntry entryCharge in listEntries)
            {
                if (Math.Round(entryCharge.AmountStart, 3) == 0)
                {
                    continue;
                }
                GridRow childRow = new GridRow();
                childRow.Tag = entryCharge;
                childRow.Cells.Add("     " + Providers.GetAbbr(entryCharge.ProvNum)); //Provider
                childRow.Cells.Add(pat.LName + ", " + pat.FName);                     //Patient
                if (PrefC.HasClinicsEnabled)
                {
                    childRow.Cells.Add(Clinics.GetAbbr(entryCharge.ClinicNum));
                }
                procCodes = "";
                if (entryCharge.GetType() == typeof(Procedure))
                {
                    procCodes = ((Procedure)entryCharge.Tag).ProcDate.ToShortDateString() + " " + ProcedureCodes.GetStringProcCode(((Procedure)entryCharge.Tag).CodeNum);
                }
                else if (entryCharge.GetType() == typeof(PayPlanCharge))
                {
                    procCodes = "PayPlanCharge";
                }
                else if (entryCharge.GetType() == typeof(PaySplit) && ((PaySplit)entryCharge.Tag).UnearnedType != 0)
                {
                    PaySplit split = (PaySplit)entryCharge.Tag;
                    if (split.ProvNum == 0)
                    {
                        procCodes = entryCharge.Date.ToShortDateString() + " Unallocated";
                    }
                    else
                    {
                        procCodes = entryCharge.Date.ToShortDateString() + " " + Defs.GetName(DefCat.PaySplitUnearnedType, split.UnearnedType);
                    }
                }
                else if (entryCharge.GetType() == typeof(PaySplit) && ((PaySplit)entryCharge.Tag).ProcNum != 0)
                {
                    AccountEntry entry = _results.ListAccountCharges.Find(x => x.GetType() == typeof(Procedure) && x.PriKey == ((PaySplit)entryCharge.Tag).ProcNum);
                    if (entry != null)                   //Entry can be null if there is a split for X patient and the attached procedure is for Y patient outside family.  Possible with old data.
                    {
                        procCodes = entryCharge.Date.ToShortDateString() + " PaySplit: " + ProcedureCodes.GetStringProcCode(((Procedure)entry.Tag).CodeNum);
                    }
                }
                else if (entryCharge.GetType() == typeof(Adjustment) && ((Adjustment)entryCharge.Tag).ProcNum != 0)
                {
                    AccountEntry entry = _results.ListAccountCharges.Find(x => x.GetType() == typeof(Procedure) && x.PriKey == ((Adjustment)entryCharge.Tag).ProcNum);
                    if (entry != null)                   //Entry can be null if there is a split for X patient and the attached procedure is for Y patient outside family.  Possible with old data.
                    {
                        procCodes = entryCharge.Date.ToShortDateString() + " Adjustment: " + ProcedureCodes.GetStringProcCode(((Procedure)entry.Tag).CodeNum);
                    }
                }
                else if (entryCharge.GetType() == typeof(PaySplit) && ((PaySplit)entryCharge.Tag).PayPlanNum != 0)             //Don't need this really
                {
                    procCodes = entryCharge.Date.ToShortDateString() + " PayPlan Split";
                }
                else if (entryCharge.GetType() == typeof(Adjustment))
                {
                    procCodes = entryCharge.Date.ToShortDateString() + " Adjustment";
                }
                else if (entryCharge.GetType() == typeof(ClaimProc))
                {
                    procCodes = entryCharge.Date.ToShortDateString() + " Claim Payment";
                }
                else
                {
                    procCodes = entryCharge.Date.ToShortDateString() + " " + entryCharge.GetType().Name;
                }
                childRow.Cells.Add(procCodes);                                //ProcCodes
                childRow.Cells.Add(entryCharge.AmountOriginal.ToString("f")); //Amount Original
                childRow.Cells.Add(entryCharge.AmountStart.ToString("f"));    //Amount Start
                childRow.Cells.Add(entryCharge.AmountEnd.ToString("f"));      //Amount End
                childRow.DropDownParent = row;
                listRows.Add(childRow);
            }
            return(listRows);
        }
Esempio n. 25
0
        ///<summary>Fills grid based on values in _listEtrans.
        ///Set isRefreshNeeded to true when we need to reinitialize local dictionarys after in memory list is also updated. Required true for first time running.
        ///Also allows you to passed in predetermined filter options.</summary>
        private void FillGrid(bool isRefreshNeeded, List <string> listSelectedStatuses, List <long> listSelectedClinicNums,
                              string carrierName, string checkTraceNum, string amountMin, string amountMax, string controlId)
        {
            Cursor = Cursors.WaitCursor;
            labelControlId.Visible = PrefC.GetBool(PrefName.EraShowControlIdFilter);
            textControlId.Visible  = PrefC.GetBool(PrefName.EraShowControlIdFilter);
            Action actionCloseProgress = null;

            if (isRefreshNeeded)
            {
                actionCloseProgress = ODProgress.Show(ODEventType.Etrans, typeof(EtransEvent), Lan.g(this, "Gathering data") + "...");
                _dictEtrans835s.Clear();
                _dictEtransClaims.Clear();
                List <Etrans835Attach>    listAttached        = Etrans835Attaches.GetForEtrans(_listAllEtrans.Select(x => x.EtransNum).ToArray());
                Dictionary <long, string> dictEtransMessages  = new Dictionary <long, string>();
                List <X12ClaimMatch>      list835ClaimMatches = new List <X12ClaimMatch>();
                Dictionary <long, int>    dictClaimMatchCount = new Dictionary <long, int>(); //1:1 with _listEtranss. Stores how many claim matches each 835 has.
                int batchQueryInterval = 500;                                                 //Every 500 rows we get the next 500 message texts to save memory.
                int rowCur             = 0;
                foreach (Etrans etrans in _listAllEtrans)
                {
                    if (rowCur % batchQueryInterval == 0)
                    {
                        int range = Math.Min(batchQueryInterval, _listAllEtrans.Count - rowCur);                   //Either the full batchQueryInterval amount or the remaining amount of etrans.
                        dictEtransMessages = EtransMessageTexts.GetMessageTexts(_listAllEtrans.GetRange(rowCur, range).Select(x => x.EtransMessageTextNum).ToList(), false);
                    }
                    rowCur++;
                    EtransEvent.Fire(ODEventType.Etrans, Lan.g(this, "Processing 835: ") + ": " + rowCur + " out of " + _listAllEtrans.Count);
                    List <Etrans835Attach> listAttachedTo835 = listAttached.FindAll(x => x.EtransNum == etrans.EtransNum);
                    X835 x835 = new X835(etrans, dictEtransMessages[etrans.EtransMessageTextNum], etrans.TranSetId835, listAttachedTo835, true);
                    _dictEtrans835s.Add(etrans.EtransNum, x835);
                    List <X12ClaimMatch> listClaimMatches = x835.GetClaimMatches();
                    dictClaimMatchCount.Add(etrans.EtransNum, listClaimMatches.Count);
                    list835ClaimMatches.AddRange(listClaimMatches);
                }
                #region Set 835 unattached in batch and build _dictEtransClaims and _dictClaimPayCheckNums.
                EtransEvent.Fire(ODEventType.Etrans, Lan.g(this, "Gathering internal claim matches."));
                List <long> listClaimNums = Claims.GetClaimFromX12(list835ClaimMatches);             //Can return null.
                EtransEvent.Fire(ODEventType.Etrans, Lan.g(this, "Building data sets."));
                int         claimIndexCur        = 0;
                List <long> listMatchedClaimNums = new List <long>();
                foreach (Etrans etrans in _listAllEtrans)
                {
                    X835 x835 = _dictEtrans835s[etrans.EtransNum];
                    if (listClaimNums != null)
                    {
                        x835.SetClaimNumsForUnattached(listClaimNums.GetRange(claimIndexCur, dictClaimMatchCount[etrans.EtransNum]));
                    }
                    claimIndexCur += dictClaimMatchCount[etrans.EtransNum];
                    listMatchedClaimNums.AddRange(x835.ListClaimsPaid.FindAll(x => x.ClaimNum != 0).Select(x => x.ClaimNum).ToList());
                }
                List <Claim> listClaims = Claims.GetClaimsFromClaimNums(listMatchedClaimNums.Distinct().ToList());
                //The following line includes manually detached and split attaches.
                _listAllAttaches   = Etrans835Attaches.GetForEtransNumOrClaimNums(false, _listAllEtrans.Select(x => x.EtransNum).ToList(), listMatchedClaimNums.ToArray());
                _listAllClaimProcs = ClaimProcs.RefreshForClaims(listMatchedClaimNums);
                foreach (Etrans etrans in _listAllEtrans)
                {
                    X835 x835 = _dictEtrans835s[etrans.EtransNum];
                    #region _dictEtransClaims, _dictClaimPayCheckNums
                    _dictEtransClaims.Add(etrans.EtransNum, new List <Claim>());
                    List <long>  listSubClaimNums = x835.ListClaimsPaid.FindAll(x => x.ClaimNum != 0).Select(y => y.ClaimNum).ToList();
                    List <Claim> listClaimsFor835 = listClaims.FindAll(x => listSubClaimNums.Contains(x.ClaimNum));
                    foreach (Hx835_Claim claim in x835.ListClaimsPaid)
                    {
                        Claim claimCur = listClaimsFor835.FirstOrDefault(x => x.ClaimNum == claim.ClaimNum);                    //Can be null.
                        _dictEtransClaims[etrans.EtransNum].Add(claimCur);
                    }
                    #endregion
                }
                EtransEvent.Fire(ODEventType.Etrans, Lan.g(this, "Filling Grid."));
                #endregion
            }
            gridMain.BeginUpdate();
            #region Initilize columns
            gridMain.ListGridColumns.Clear();
            gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableEtrans835s", "Patient Name"), 250));
            gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableEtrans835s", "Carrier Name"), 190));
            gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableEtrans835s", "Status"), 80));
            gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableEtrans835s", "Date"), 80, GridSortingStrategy.DateParse));
            gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableEtrans835s", "Amount"), 80, GridSortingStrategy.AmountParse));
            if (PrefC.HasClinicsEnabled)
            {
                gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableEtrans835s", "Clinic"), 70));
            }
            gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableEtrans835s", "Code"), 37, HorizontalAlignment.Center));
            if (PrefC.GetBool(PrefName.EraShowControlIdFilter))
            {
                gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableEtrans835s", "ControlID"), -1));
            }
            gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableEtrans835s", "Note"), -2));
            #endregion
            gridMain.ListGridRows.Clear();
            foreach (Etrans etrans in _listAllEtrans)
            {
                X835 x835 = _dictEtrans835s[etrans.EtransNum];
                #region Filter: Carrier Name
                if (carrierName != "" && !x835.PayerName.ToLower().Contains(carrierName.ToLower().Trim()))
                {
                    continue;
                }
                #endregion
                string status = GetStringStatus(etrans.EtransNum);
                #region Filter: Status
                if (!listSelectedStatuses.Contains(status.Replace("*", "")))                //The filter will ignore finalized with detached claims.
                {
                    continue;
                }
                #endregion
                //List of ClinicNums for the current etrans.ListClaimsPaid from the DB.
                List <long> listClinicNums = _dictEtransClaims[etrans.EtransNum].Select(x => x == null? 0 :x.ClinicNum).Distinct().ToList();
                #region Filter: Clinics
                if (PrefC.HasClinicsEnabled && !listClinicNums.Exists(x => listSelectedClinicNums.Contains(x)))
                {
                    continue;                    //The ClinicNums associated to the 835 do not match any of the selected ClinicNums, so nothing to show in this 835.
                }
                #endregion
                #region Filter: Check and Trace Value
                if (checkTraceNum != "" && !x835.TransRefNum.ToLower().Contains(checkTraceNum.ToLower().Trim()))               //Trace Number does not match
                {
                    continue;
                }
                #endregion
                #region Filter: Insurance Check Range Min and Max
                if (amountMin != "" && x835.InsPaid < PIn.Decimal(amountMin) || amountMax != "" && x835.InsPaid > PIn.Decimal(amountMax))
                {
                    continue;                    //Either the InsPaid is below or above our range.
                }
                #endregion
                #region Filter: ControlID
                if (controlId != "" && !x835.ControlId.ToLower().Contains(controlId.ToLower()))
                {
                    continue;
                }
                #endregion
                GridRow row = new GridRow();
                #region Column: Patient Name
                List <string> listPatNames = x835.ListClaimsPaid.Select(x => x.PatientName.ToString()).Distinct().ToList();
                string        patName      = (listPatNames.Count > 0 ? listPatNames[0] : "");
                if (listPatNames.Count > 1)
                {
                    patName = "(" + POut.Long(listPatNames.Count) + ")";
                }
                row.Cells.Add(patName);
                #endregion
                row.Cells.Add(x835.PayerName);
                row.Cells.Add(status);                //See GetStringStatus(...) for possible values.
                row.Cells.Add(POut.Date(etrans.DateTimeTrans));
                row.Cells.Add(POut.Decimal(x835.InsPaid));
                #region Column: Clinic
                if (PrefC.HasClinicsEnabled)
                {
                    string clinicAbbr = "";
                    if (listClinicNums.Count == 1)
                    {
                        if (listClinicNums[0] == 0)
                        {
                            clinicAbbr = Lan.g(this, "Unassigned");
                        }
                        else
                        {
                            clinicAbbr = Clinics.GetAbbr(listClinicNums[0]);
                        }
                    }
                    else if (listClinicNums.Count > 1)
                    {
                        clinicAbbr = "(" + Lan.g(this, "Multiple") + ")";
                    }
                    row.Cells.Add(clinicAbbr);
                }
                #endregion
                row.Cells.Add(x835._paymentMethodCode);
                if (PrefC.GetBool(PrefName.EraShowControlIdFilter))
                {
                    row.Cells.Add(x835.ControlId);
                }
                row.Cells.Add(etrans.Note);
                row.Tag = etrans;
                gridMain.ListGridRows.Add(row);
            }
            gridMain.EndUpdate();
            actionCloseProgress?.Invoke();            //When this function executes quickly this can fail rarely, fail silently because of WaitCursor.
            Cursor = Cursors.Default;
        }
Esempio n. 26
0
        private void FillGrid()
        {
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            int opNameWidth = 180;
            int clinicWidth = 85;

            if (!PrefC.HasClinicsEnabled)
            {
                //Clinics are hidden so add the width of the clinic column to the Op Name column because the clinic column will not show.
                opNameWidth += clinicWidth;
            }
            ODGridColumn col = new ODGridColumn(Lan.g("TableOperatories", "Op Name"), opNameWidth);

            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableOperatories", "Abbrev"), 70);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableOperatories", "IsHidden"), 64, HorizontalAlignment.Center);
            gridMain.Columns.Add(col);
            if (PrefC.HasClinicsEnabled)
            {
                col = new ODGridColumn(Lan.g("TableOperatories", "Clinic"), clinicWidth);
                gridMain.Columns.Add(col);
            }
            col = new ODGridColumn(Lan.g("TableOperatories", "Provider"), 70);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableOperatories", "Hygienist"), 70);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableOperatories", "IsHygiene"), 64, HorizontalAlignment.Center);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableOperatories", "IsWebSched"), 74, HorizontalAlignment.Center);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableOperatories", "IsNewPat"), 0, HorizontalAlignment.Center);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            UI.ODGridRow row;
            for (int i = 0; i < _listOps.Count; i++)
            {
                if (PrefC.HasClinicsEnabled &&
                    !comboClinic.IsAllSelected &&
                    _listOps[i].ClinicNum != comboClinic.SelectedClinicNum)
                {
                    continue;
                }
                row = new OpenDental.UI.ODGridRow();
                row.Cells.Add(_listOps[i].OpName);
                row.Cells.Add(_listOps[i].Abbrev);
                if (_listOps[i].IsHidden)
                {
                    row.Cells.Add("X");
                }
                else
                {
                    row.Cells.Add("");
                }
                if (PrefC.HasClinicsEnabled)
                {
                    row.Cells.Add(Clinics.GetAbbr(_listOps[i].ClinicNum));
                }
                row.Cells.Add(Providers.GetAbbr(_listOps[i].ProvDentist));
                row.Cells.Add(Providers.GetAbbr(_listOps[i].ProvHygienist));
                if (_listOps[i].IsHygiene)
                {
                    row.Cells.Add("X");
                }
                else
                {
                    row.Cells.Add("");
                }
                row.Cells.Add(_listOps[i].IsWebSched?"X":"");
                row.Cells.Add((_listOps[i].ListWSNPAOperatoryDefNums != null && _listOps[i].ListWSNPAOperatoryDefNums.Count > 0) ? "X" : "");
                row.Tag = _listOps[i];
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
Esempio n. 27
0
        ///<summary>Accepts null for pat and 0 for clinicNum.</summary>
        public static string GetMainTitle(Patient pat, long clinicNum)
        {
            string retVal = PrefC.GetString(PrefName.MainWindowTitle);

            object[] parameters = { retVal };
            Plugins.HookAddCode(null, "PatientL.GetMainTitle_beginning", parameters);
            retVal           = (string)parameters[0];
            _patSelectedCur  = pat;
            _clinSelectedCur = clinicNum;
            if (!PrefC.GetBool(PrefName.EasyNoClinics) && clinicNum > 0)
            {
                if (retVal != "")
                {
                    retVal += " - " + Lan.g("FormOpenDental", "Clinic") + ": ";
                }
                if (PrefC.GetBool(PrefName.TitleBarClinicUseAbbr))
                {
                    retVal += Clinics.GetAbbr(clinicNum);
                }
                else
                {
                    retVal += Clinics.GetDesc(clinicNum);
                }
            }
            if (Security.CurUser != null)
            {
                retVal += " {" + Security.CurUser.UserName + "}";
            }
            if (pat == null || pat.PatNum == 0 || pat.PatNum == -1)
            {
                retVal += MainTitleUpdateCountdown();
                if (FormOpenDental.RegKeyIsForTesting)
                {
                    retVal += " - " + Lan.g("FormOpenDental", "Developer Only License") + " - " + Lan.g("FormOpenDental", "Not for use with live patient data") + " - ";
                }
                return(retVal);
            }
            retVal += " - " + pat.GetNameLF();
            if (PrefC.GetLong(PrefName.ShowIDinTitleBar) == 1)
            {
                retVal += " - " + pat.PatNum.ToString();
            }
            else if (PrefC.GetLong(PrefName.ShowIDinTitleBar) == 2)
            {
                retVal += " - " + pat.ChartNumber;
            }
            else if (PrefC.GetLong(PrefName.ShowIDinTitleBar) == 3)
            {
                if (pat.Birthdate.Year > 1880)
                {
                    retVal += " - " + pat.Birthdate.ToShortDateString();
                }
            }
            if (pat.SiteNum != 0)
            {
                retVal += " - " + Sites.GetDescription(pat.SiteNum);
            }
            retVal += MainTitleUpdateCountdown();
            if (FormOpenDental.RegKeyIsForTesting)
            {
                retVal += " - " + Lan.g("FormOpenDental", "Developer Only License") + " - " + Lan.g("FormOpenDental", "Not for use with live patient data") + " - ";
            }
            return(retVal);
        }
        private void FillGrid()
        {
            //Sets bools for which filters to add
            bool includeTPProc        = listOptions.SelectedIndices.Contains(0);
            bool includeCompletedProc = listOptions.SelectedIndices.Contains(1);
            bool includeAppointments  = listOptions.SelectedIndices.Contains(2);
            //Gets clinic selection
            List <long> listClinicNums = new List <long>();

            if (PrefC.HasClinicsEnabled)
            {
                if (comboClinic.IsAllSelected)
                {
                    listClinicNums = comboClinic.ListSelectedClinicNums;
                }
                else
                {
                    listClinicNums.Add(comboClinic.SelectedClinicNum);
                }
            }
            List <Patient> listPatients = Patients.GetPatsToChangeStatus(_isConvertToPatient, odDatePickerSince.GetDateTime()
                                                                         , includeTPProc, includeCompletedProc, includeAppointments, listClinicNums);

            gridMain.BeginUpdate();
            if (gridMain.ListGridColumns.Count == 0)
            {
                gridMain.ListGridColumns.Add(new GridColumn(Lan.g(this, "PatNum"), 75, GridSortingStrategy.AmountParse));
                gridMain.ListGridColumns.Add(new GridColumn(Lan.g(this, "PatStatusCur"), 100, GridSortingStrategy.StringCompare));
                gridMain.ListGridColumns.Add(new GridColumn(Lan.g(this, "PatStatusNew"), 100, GridSortingStrategy.StringCompare));
                gridMain.ListGridColumns.Add(new GridColumn(Lan.g(this, "First Name"), 125, GridSortingStrategy.StringCompare));
                gridMain.ListGridColumns.Add(new GridColumn(Lan.g(this, "Last Name"), 125, GridSortingStrategy.StringCompare));
                gridMain.ListGridColumns.Add(new GridColumn(Lan.g(this, "Birthdate"), 75, GridSortingStrategy.DateParse));
                if (PrefC.HasClinicsEnabled)
                {
                    gridMain.ListGridColumns.Add(new GridColumn(Lan.g(this, "Clinic"), 75, GridSortingStrategy.StringCompare));
                }
            }
            gridMain.ListGridRows.Clear();
            //Mimics FormPatientEdit
            string  patientStatus  = Lan.g("enumPatientStatus", "Patient");
            string  inactiveStatus = Lan.g("enumPatientStatus", "Inactive");
            GridRow row;

            foreach (Patient pat in listPatients)
            {
                row = new GridRow();
                row.Cells.Add(POut.Long(pat.PatNum));
                row.Cells.Add(pat.PatStatus == PatientStatus.Patient ? patientStatus : inactiveStatus);
                row.Cells.Add(pat.PatStatus == PatientStatus.Patient ? inactiveStatus : patientStatus);
                row.Cells.Add(pat.FName);
                row.Cells.Add(pat.LName);
                row.Cells.Add(pat.Birthdate.ToShortDateString() == "01/01/0001"?"": pat.Birthdate.ToShortDateString());
                if (PrefC.HasClinicsEnabled)
                {
                    row.Cells.Add(Clinics.GetAbbr(pat.ClinicNum));
                }
                row.Tag = pat;
                gridMain.ListGridRows.Add(row);
            }
            gridMain.EndUpdate();
        }
Esempio n. 29
0
        private void FillGrid()
        {
            List <Payment> listPaymentsClinic = new List <Payment>();

            if (PrefC.HasClinicsEnabled && comboClinic.SelectedIndex != 0)           //Not 'All' selected
            {
                if (Security.CurUser.ClinicIsRestricted)
                {
                    long clinicNum = _listClinics[comboClinic.SelectedIndex - 1].ClinicNum;                //Minus 1 for 'All'
                    listPaymentsClinic = _listPayments.FindAll(x => x.ClinicNum == clinicNum);
                }
                else
                {
                    if (comboClinic.SelectedIndex == 1)                   //'Unassigned' selected
                    {
                        listPaymentsClinic = _listPayments.FindAll(x => x.ClinicNum == 0);
                    }
                    else if (comboClinic.SelectedIndex > 1)
                    {
                        long clinicNum = _listClinics[comboClinic.SelectedIndex - 2].ClinicNum;                    //Minus 2 for 'All' and 'Unassigned'
                        listPaymentsClinic = _listPayments.FindAll(x => x.ClinicNum == clinicNum);
                    }
                }
            }
            else
            {
                listPaymentsClinic = _listPayments;              //Use all clinics
            }
            listPaymentsClinic = listPaymentsClinic.OrderBy(x => Clinics.GetAbbr(x.ClinicNum))
                                 .ThenBy(x => x.PayDate)
                                 .ThenBy(x => Patients.GetOnePat(_arrayPats, x.PatNum).GetNameLFnoPref()).ToList();
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col;

            if (PrefC.HasClinicsEnabled)
            {
                col = new ODGridColumn(Lan.g(this, "Clinic"), 100);
                gridMain.Columns.Add(col);
            }
            col = new ODGridColumn(Lan.g(this, "Patient"), 110);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Date"), 70);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Amount"), 70, HorizontalAlignment.Right);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Note"), 200);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow row;

            foreach (Payment pay in listPaymentsClinic)
            {
                row = new ODGridRow();
                if (PrefC.HasClinicsEnabled)
                {
                    string clinicAbbr = Clinics.GetAbbr(pay.ClinicNum);
                    row.Cells.Add(clinicAbbr == "" ? Lan.g(this, "Unassigned") : clinicAbbr);
                }
                row.Cells.Add(Patients.GetOnePat(_arrayPats, pay.PatNum).GetNameLFnoPref());
                row.Cells.Add(pay.PayDate.ToShortDateString());
                row.Cells.Add(pay.PayAmt.ToString("F"));
                row.Cells.Add(pay.PayNote);
                row.Tag = pay;
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
Esempio n. 30
0
        private void FillGrid()
        {
            DateTime dateFrom  = PIn.Date(textDateFrom.Text);
            DateTime dateTo    = PIn.Date(textDateTo.Text);
            long     clinicNum = 0;

            if (comboClinic.SelectedIndex > 0)
            {
                clinicNum = _listClinics[comboClinic.SelectedIndex - 1].ClinicNum;
            }
            long selectedGroupNum = 0;

            if (comboPayGroup.SelectedIndex != 0)
            {
                selectedGroupNum = _listCPGroups[comboPayGroup.SelectedIndex - 1].DefNum;
            }
            DataTable tableClaimPayments = ClaimPayments.GetForDateRange(dateFrom, dateTo, clinicNum, selectedGroupNum);

            ListClaimPay = ClaimPaymentCrud.TableToList(tableClaimPayments);
            gridMain.BeginUpdate();
            gridMain.ListGridColumns.Clear();
            GridColumn col = new GridColumn(Lan.g(this, "Date"), 65);

            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g(this, "Type"), 70);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g(this, "Amount"), 75, HorizontalAlignment.Right);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g(this, "Partial"), 40, HorizontalAlignment.Center);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g(this, "Carrier"), 180);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g(this, "PayGroup"), 80);
            gridMain.ListGridColumns.Add(col);
            if (PrefC.HasClinicsEnabled)
            {
                col = new GridColumn(Lan.g(this, "Clinic"), 80);
                gridMain.ListGridColumns.Add(col);
            }
            col = new GridColumn(Lan.g(this, "Note"), 180);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g(this, "Scanned"), 40, HorizontalAlignment.Center);
            gridMain.ListGridColumns.Add(col);
            gridMain.ListGridRows.Clear();
            GridRow row;

            for (int i = 0; i < ListClaimPay.Count; i++)
            {
                row = new GridRow();
                if (ListClaimPay[i].CheckDate.Year < 1800)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(ListClaimPay[i].CheckDate.ToShortDateString());
                }
                row.Cells.Add(Defs.GetName(DefCat.InsurancePaymentType, ListClaimPay[i].PayType));
                row.Cells.Add(ListClaimPay[i].CheckAmt.ToString("c"));
                row.Cells.Add(ListClaimPay[i].IsPartial?"X":"");
                row.Cells.Add(ListClaimPay[i].CarrierName);
                row.Cells.Add(Defs.GetName(DefCat.ClaimPaymentGroups, ListClaimPay[i].PayGroup));
                if (PrefC.HasClinicsEnabled)
                {
                    row.Cells.Add(Clinics.GetAbbr(ListClaimPay[i].ClinicNum));
                }
                row.Cells.Add(ListClaimPay[i].Note);
                row.Cells.Add((tableClaimPayments.Rows[i]["hasEobAttach"].ToString() == "1")?"X":"");
                gridMain.ListGridRows.Add(row);
            }
            gridMain.EndUpdate();
            gridMain.ScrollToEnd();
        }