private void Filltb() { SelectedPatNum = PatCur.PatNum; //just in case user has selected a different family member RecallList = Recalls.GetList(FamCur.List); Appointment[] aptsOnePat; listFamily.Items.Clear(); ListViewItem item; DateTime dateDue; for (int i = 0; i < FamCur.List.Length; i++) { item = new ListViewItem(FamCur.GetNameInFamFLI(i)); if (FamCur.List[i].PatNum == PatCur.PatNum) { item.BackColor = Color.Silver; } item.SubItems.Add(FamCur.List[i].Age.ToString()); item.SubItems.Add(FamCur.List[i].Gender.ToString()); dateDue = DateTime.MinValue; for (int j = 0; j < RecallList.Length; j++) { if (RecallList[j].PatNum == FamCur.List[i].PatNum) { dateDue = RecallList[j].DateDue; } } if (dateDue.Year < 1880) { item.SubItems.Add(""); } else { item.SubItems.Add(dateDue.ToShortDateString()); } if (dateDue <= DateTime.Today) { item.ForeColor = Color.Red; } aptsOnePat = Appointments.GetForPat(FamCur.List[i].PatNum); for (int a = 0; a < aptsOnePat.Length; a++) { if (aptsOnePat[a].AptDateTime.Date <= DateTime.Today) { continue; //disregard old appts. } item.SubItems.Add(aptsOnePat[a].AptDateTime.ToShortDateString()); break; //we only want one appt //could add condition here to add blank subitem if no date found } listFamily.Items.Add(item); } if (PatCur.NextAptNum == -1) { checkDone.Checked = true; } else { checkDone.Checked = false; } ListOth = Appointments.GetForPat(PatCur.PatNum); tbApts.ResetRows(ListOth.Length); tbApts.SetGridColor(Color.DarkGray); for (int i = 0; i < ListOth.Length; i++) { tbApts.Cell[0, i] = ListOth[i].AptStatus.ToString(); if (ListOth[i].AptDateTime.Year > 1880) { //only regular still scheduled appts if (ListOth[i].AptStatus != ApptStatus.Planned && ListOth[i].AptStatus != ApptStatus.PtNote && ListOth[i].AptStatus != ApptStatus.PtNoteCompleted && ListOth[i].AptStatus != ApptStatus.UnschedList && ListOth[i].AptStatus != ApptStatus.Broken) { tbApts.Cell[1, i] = ListOth[i].AptDateTime.ToString("d"); tbApts.Cell[2, i] = ListOth[i].AptDateTime.ToString("t"); if (ListOth[i].AptDateTime < DateTime.Today) //Past { tbApts.SetBackColorRow(i, (DefB.Long[(int)DefCat.ProgNoteColors][11].ItemColor)); tbApts.SetTextColorRow(i, (DefB.Long[(int)DefCat.ProgNoteColors][10].ItemColor)); } else if (ListOth[i].AptDateTime.Date == DateTime.Today.Date) //Today { tbApts.SetBackColorRow(i, (DefB.Long[(int)DefCat.ProgNoteColors][9].ItemColor)); tbApts.SetTextColorRow(i, (DefB.Long[(int)DefCat.ProgNoteColors][8].ItemColor)); tbApts.Cell[0, i] = Lan.g(this, "Today"); } else if (ListOth[i].AptDateTime > DateTime.Today) //Future { tbApts.SetBackColorRow(i, DefB.Long[(int)DefCat.ProgNoteColors][13].ItemColor); tbApts.SetTextColorRow(i, (DefB.Long[(int)DefCat.ProgNoteColors][12].ItemColor)); } } else if (ListOth[i].AptStatus == ApptStatus.Planned) //show line for planned appt { tbApts.SetTextColorRow(i, DefB.Long[(int)DefCat.ProgNoteColors][16].ItemColor); tbApts.SetBackColorRow(i, DefB.Long[(int)DefCat.ProgNoteColors][17].ItemColor); tbApts.Cell[0, i] = Lan.g("enumApptStatus", "Planned"); } else if (ListOth[i].AptStatus == ApptStatus.PtNote) { tbApts.SetTextColorRow(i, DefB.Long[(int)DefCat.ProgNoteColors][18].ItemColor); tbApts.SetBackColorRow(i, DefB.Long[(int)DefCat.ProgNoteColors][19].ItemColor); tbApts.Cell[0, i] = Lan.g("enumApptStatus", "PtNote"); } else if (ListOth[i].AptStatus == ApptStatus.PtNoteCompleted) { tbApts.SetTextColorRow(i, DefB.Long[(int)DefCat.ProgNoteColors][20].ItemColor); tbApts.SetBackColorRow(i, DefB.Long[(int)DefCat.ProgNoteColors][21].ItemColor); tbApts.Cell[0, i] = Lan.g("enumApptStatus", "PtNoteCompleted"); } else if (ListOth[i].AptStatus == ApptStatus.Broken | ListOth[i].AptStatus == ApptStatus.UnschedList) { if (ListOth[i].AptStatus == ApptStatus.Broken) { tbApts.Cell[0, i] = Lan.g("enumApptStatus", "Broken"); } else { tbApts.Cell[0, i] = Lan.g("enumApptStatus", "UnschedList"); } tbApts.SetTextColorRow(i, DefB.Long[(int)DefCat.ProgNoteColors][14].ItemColor); tbApts.SetBackColorRow(i, DefB.Long[(int)DefCat.ProgNoteColors][15].ItemColor); } } else { tbApts.Cell[1, i] = ""; tbApts.Cell[2, i] = ""; } tbApts.Cell[3, i] = (ListOth[i].Pattern.Length * 5).ToString(); tbApts.Cell[4, i] = ListOth[i].ProcDescript; tbApts.Cell[5, i] = ListOth[i].Note; } textFinUrg.Text = PatCur.FamFinUrgNote; tbApts.LayoutTables(); }
private void Filltb() { RecallList = Recalls.GetList(FamCur.List); Appointment[] aptsOnePat; listFamily.Items.Clear(); ListViewItem item; DateTime dateDue; for (int i = 0; i < FamCur.List.Length; i++) { item = new ListViewItem(FamCur.GetNameInFamFLI(i)); if (FamCur.List[i].PatNum == PatCur.PatNum) { item.BackColor = Color.Silver; } item.SubItems.Add(FamCur.List[i].Age.ToString()); item.SubItems.Add(FamCur.List[i].Gender.ToString()); dateDue = DateTime.MinValue; for (int j = 0; j < RecallList.Length; j++) { if (RecallList[j].PatNum == FamCur.List[i].PatNum) { dateDue = RecallList[j].DateDue; } } if (dateDue.Year < 1880) { item.SubItems.Add(""); } else { item.SubItems.Add(dateDue.ToShortDateString()); } if (dateDue <= DateTime.Today) { item.ForeColor = Color.Red; } aptsOnePat = Appointments.GetForPat(FamCur.List[i].PatNum); for (int a = 0; a < aptsOnePat.Length; a++) { if (aptsOnePat[a].AptDateTime.Date <= DateTime.Today) { continue; //disregard old appts. } item.SubItems.Add(aptsOnePat[a].AptDateTime.ToShortDateString()); break; //we only want one appt //could add condition here to add blank subitem if no date found } listFamily.Items.Add(item); } if (PatCur.NextAptNum == -1) { checkDone.Checked = true; } else { checkDone.Checked = false; } ListOth = Appointments.GetForPat(PatCur.PatNum); tbApts.ResetRows(ListOth.Length); tbApts.SetGridColor(Color.DarkGray); for (int i = 0; i < ListOth.Length; i++) { tbApts.Cell[0, i] = ListOth[i].AptStatus.ToString(); if (ListOth[i].AptDateTime.Year > 1880) { if (ListOth[i].AptStatus != ApptStatus.Planned) //don't show date/time for planned appts. { tbApts.Cell[1, i] = ListOth[i].AptDateTime.ToString("d"); tbApts.Cell[2, i] = ListOth[i].AptDateTime.ToString("t"); } } else { tbApts.Cell[1, i] = ""; tbApts.Cell[2, i] = ""; } tbApts.Cell[3, i] = (ListOth[i].Pattern.Length * 5).ToString(); tbApts.Cell[4, i] = ListOth[i].ProcDescript; tbApts.Cell[5, i] = ListOth[i].Note; } tbApts.LayoutTables(); }