private void FormProcEditAll_Load(object sender, EventArgs e) { ProcOldList = new List <Procedure>(); for (int i = 0; i < ProcList.Count; i++) { ProcOldList.Add(ProcList[i].Copy()); } _hasCompletedProc = false; _hasExistingProc = false; DateTime oldestProcDate = DateTime.Today; bool datesAreSame = true; bool areAllBypass = true; for (int i = 0; i < ProcList.Count; i++) { if (ProcList[i].ProcStatus == ProcStat.C) { _hasCompletedProc = true; if (ProcList[i].ProcDate < oldestProcDate) { oldestProcDate = ProcList[i].ProcDate; } } else if (ProcList[i].ProcStatus.In(ProcStat.EO, ProcStat.EC)) { _hasExistingProc = true; if (ProcList[i].ProcDate < oldestProcDate) { oldestProcDate = ProcList[i].ProcDate; } } if (ProcList[0].ProcDate != ProcList[i].ProcDate) { datesAreSame = false; } if (!ProcedureCodes.CanBypassLockDate(ProcList[i].CodeNum, ProcList[i].ProcFee)) { areAllBypass = false; } } if (_hasCompletedProc || _hasExistingProc) { if (areAllBypass) { if ((_hasCompletedProc && !Security.IsAuthorized(Permissions.ProcComplEdit, oldestProcDate, ProcList[0].CodeNum, 0)) || (_hasExistingProc && !Security.IsAuthorized(Permissions.ProcExistingEdit, oldestProcDate, ProcList[0].CodeNum, 0))) { butOK.Enabled = false; butEditAnyway.Enabled = false; } } else if ((_hasCompletedProc && !Security.IsAuthorized(Permissions.ProcComplEdit, oldestProcDate)) || (_hasExistingProc && !Security.IsAuthorized(Permissions.ProcExistingEdit, oldestProcDate))) { butOK.Enabled = false; butEditAnyway.Enabled = false; } } List <ClaimProc> ClaimProcList = ClaimProcs.Refresh(ProcList[0].PatNum); if (Procedures.IsAttachedToClaim(ProcList, ClaimProcList)) { //StartedAttachedToClaim=true; //however, this doesn't stop someone from creating a claim while this window is open, //so this is checked at the end, too. textDate.Enabled = false; butToday.Enabled = false; butEditAnyway.Visible = true; labelClaim.Visible = true; } if (datesAreSame) { textDate.Text = ProcList[0].ProcDate.ToShortDateString(); } }
private void FormProcEditAll_Load(object sender, EventArgs e) { _procOldList = new List <Procedure>(); for (int i = 0; i < ProcList.Count; i++) { _procOldList.Add(ProcList[i].Copy()); } _hasCompletedProc = false; _hasExistingProc = false; _canAllBypass = true; DateTime oldestProcDate = DateTime.Today; bool dateLoadedWithValue = true; foreach (Procedure proc in ProcList) { if (proc.ProcStatus == ProcStat.C) { _hasCompletedProc = true; if (proc.ProcDate < oldestProcDate) { oldestProcDate = proc.ProcDate; } } else if (proc.ProcStatus.In(ProcStat.EO, ProcStat.EC)) { _hasExistingProc = true; if (proc.ProcDate < oldestProcDate) { oldestProcDate = proc.ProcDate; } } if (ProcList[0].ProcDate != proc.ProcDate) { dateLoadedWithValue = false; } if (!ProcedureCodes.CanBypassLockDate(proc.CodeNum, proc.ProcFee)) { _canAllBypass = false; } } if (!IsUserAuthorizedForProcDate(oldestProcDate)) { butOK.Enabled = false; butEditAnyway.Enabled = false; } List <ClaimProc> ClaimProcList = ClaimProcs.Refresh(ProcList[0].PatNum); if (Procedures.IsAttachedToClaim(ProcList, ClaimProcList)) { //StartedAttachedToClaim=true; //however, this doesn't stop someone from creating a claim while this window is open, //so this is checked at the end, too. textDate.Enabled = false; butToday.Enabled = false; butEditAnyway.Visible = true; labelClaim.Visible = true; } if (dateLoadedWithValue) { textDate.Text = ProcList[0].ProcDate.ToShortDateString(); } if (PrefC.HasClinicsEnabled) { labelClinic.Visible = true; comboClinic.Visible = true; FillComboClinic(); //Must be called before FillProviderCombo(). } FillComboProv(); }