private void FormRpRouting_Load(object sender, System.EventArgs e) { _listProviders = Providers.GetListReports(); if (IsAutoRunForDateSelected) { //Creates routing slips for the defined DateSelected, currently selected clinic (if Clinics is enabled), not filtered by providers. List <long> emptyProvNumList = new List <long>(); List <long> listClinicNums = new List <long>(); if (PrefC.HasClinicsEnabled) { listClinicNums.Add(Clinics.ClinicNum); } //Run for all providers and the currently selected day List <long> aptNums = RpRouting.GetRouting(DateSelected, emptyProvNumList, listClinicNums); PrintRoutingSlipsForAppts(aptNums); DialogResult = DialogResult.OK; return; } if (IsAutoRunForListAptNums) { //Creates routing slips for the entire view in ContrAppt PrintRoutingSlipsForAppts(ListAptNums); DialogResult = DialogResult.OK; return; } if (AptNum != 0) { List <long> aptNums = new List <long>(); aptNums.Add(AptNum); PrintRoutingSlips(aptNums, SheetDefNum); DialogResult = DialogResult.OK; return; } for (int i = 0; i < _listProviders.Count; i++) { listProv.Items.Add(_listProviders[i].GetLongDesc()); } checkProvAll.Checked = true; textDate.Text = DateTime.Today.ToShortDateString(); if (!PrefC.HasClinicsEnabled) { listClin.Visible = false; listClin.Visible = false; checkClinAll.Visible = false; labelClin.Visible = false; } else { _listClinics = Clinics.GetForUserod(Security.CurUser, true, Lan.g(this, "Unassigned")); foreach (Clinic clinic in _listClinics) { listClin.Items.Add(clinic.Abbr); listClin.SetSelected(listClin.Items.Count - 1, (Clinics.ClinicNum != 0 && Clinics.ClinicNum == clinic.ClinicNum)); } if (Clinics.ClinicNum == 0) { checkClinAll.Checked = true; } } }
private void butOK_Click(object sender, System.EventArgs e) { //validate user input if (textDate.errorProvider1.GetError(textDate) != "") { MsgBox.Show(this, "Please fix data entry errors first."); return; } if (textDate.Text.Length == 0) { MessageBox.Show(Lan.g(this, "Date is required.")); return; } date = PIn.Date(textDate.Text); if (listProv.SelectedIndices.Count == 0 && !checkProvAll.Checked) { MsgBox.Show(this, "You must select at least one provider."); return; } if (PrefC.HasClinicsEnabled && listClin.SelectedIndices.Count == 0 && !checkClinAll.Checked) { MsgBox.Show(this, "You must select at least one clinic."); return; } List <long> listProvNums = new List <long>(); if (!checkProvAll.Checked) { listProvNums = listProv.SelectedIndices.OfType <int>().Select(x => _listProviders[x].ProvNum).ToList(); } List <long> listClinicNums = new List <long>(); if (PrefC.HasClinicsEnabled) { if (checkClinAll.Checked) { listClinicNums = _listClinics.Select(x => x.ClinicNum).Distinct().ToList(); } else { listClinicNums = listClin.SelectedIndices.OfType <int>().Select(x => _listClinics[x].ClinicNum).ToList(); } } List <long> aptNums = RpRouting.GetRouting(date, listProvNums, listClinicNums); PrintRoutingSlipsForAppts(aptNums); DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, System.EventArgs e) { //validate user input if (textDate.errorProvider1.GetError(textDate) != "") { MsgBox.Show(this, "Please fix data entry errors first."); return; } if (textDate.Text.Length == 0) { MessageBox.Show(Lan.g(this, "Date is required.")); return; } date = PIn.Date(textDate.Text); if (listProv.SelectedIndices.Count == 0 && !checkProvAll.Checked) { MsgBox.Show(this, "You must select at least one provider."); return; } if (PrefC.HasClinicsEnabled && listClin.SelectedIndices.Count == 0 && !checkClinAll.Checked) { MsgBox.Show(this, "You must select at least one clinic."); return; } List <long> listProvNums = new List <long>(); if (checkProvAll.Checked) { listProvNums = _listProviders.Select(x => x.ProvNum).Distinct().ToList(); } else { for (int i = 0; i < listProv.SelectedIndices.Count; i++) { listProvNums.Add(_listProviders[listProv.SelectedIndices[i]].ProvNum); } } List <long> listClinicNums = new List <long>(); if (PrefC.HasClinicsEnabled) { if (checkClinAll.Checked) { listClinicNums = _listClinics.Select(x => x.ClinicNum).Distinct().ToList(); listClinicNums.Add(0); } else { for (int i = 0; i < listClin.SelectedIndices.Count; i++) { if (Security.CurUser.ClinicIsRestricted) { listClinicNums.Add(_listClinics[listClin.SelectedIndices[i]].ClinicNum); //We know that the list is a 1:1 to _listClinics } else { if (listClin.SelectedIndices[i] == 0) { listClinicNums.Add(0); } else { listClinicNums.Add(_listClinics[listClin.SelectedIndices[i] - 1].ClinicNum); //Minus 1 from the selected index } } } } } List <long> aptNums = RpRouting.GetRouting(date, listProvNums, listClinicNums, checkProvAll.Checked); PrintRoutingSlipsForAppts(aptNums); DialogResult = DialogResult.OK; }
private void FormRpRouting_Load(object sender, System.EventArgs e) { _listProviders = Providers.GetListReports(); if (IsAutoRunForDateSelected) { //Creates routing slips for the defined DateSelected, currently selected clinic (if Clinics is enabled), not filtered by providers. List <long> emptyProvNumList = new List <long>(); List <long> listClinicNums = new List <long>(); if (PrefC.HasClinicsEnabled) { listClinicNums.Add(Clinics.ClinicNum); } //Run for all providers and the currently selected day List <long> aptNums = RpRouting.GetRouting(DateSelected, emptyProvNumList, listClinicNums, true); PrintRoutingSlipsForAppts(aptNums); DialogResult = DialogResult.OK; return; } if (IsAutoRunForListAptNums) { //Creates routing slips for the entire view in ContrAppt PrintRoutingSlipsForAppts(ListAptNums); DialogResult = DialogResult.OK; return; } if (AptNum != 0) { /* * SheetDef sheetDef=null; * if(SheetDefNum==0) { * sheetDef=SheetsInternal.GetSheetDef(SheetInternalType.RoutingSlip); * } * else { * sheetDef=SheetDefs.GetSheetDef(SheetDefNum); * } * Sheet sheet=SheetUtil.CreateSheet(sheetDef); * SheetParameter.SetParameter(sheet,"AptNum",AptNum); * SheetFiller.FillFields(sheet); * using(Graphics g=this.CreateGraphics()) { * SheetUtil.CalculateHeights(sheet,g); * } * FormSheetFillEdit FormS=new FormSheetFillEdit(sheet); * FormS.ShowDialog();*/ List <long> aptNums = new List <long>(); aptNums.Add(AptNum); PrintRoutingSlips(aptNums, SheetDefNum); DialogResult = DialogResult.OK; return; } for (int i = 0; i < _listProviders.Count; i++) { listProv.Items.Add(_listProviders[i].GetLongDesc()); } checkProvAll.Checked = true; textDate.Text = DateTime.Today.ToShortDateString(); if (!PrefC.HasClinicsEnabled) { listClin.Visible = false; listClin.Visible = false; checkClinAll.Visible = false; labelClin.Visible = false; } else { _listClinics = Clinics.GetForUserod(Security.CurUser); if (!Security.CurUser.ClinicIsRestricted) { listClin.Items.Add(Lan.g(this, "Unassigned")); } for (int i = 0; i < _listClinics.Count; i++) { int curIndex = listClin.Items.Add(_listClinics[i].Abbr); if (Clinics.ClinicNum == 0) { //listBoxClin.SetSelected(curIndex,true); //Do not select all clinics because we are checking the checkbox. checkClinAll.Checked = true; } if (_listClinics[i].ClinicNum == Clinics.ClinicNum) { listClin.SelectedIndices.Clear(); listClin.SetSelected(curIndex, true); } } } }