context: /*=============================================================================================================
  Open Dental GPL license Copyright (C) 2003  Jordan Sparks, DMD.  http://www.open-dent.com,  www.docsparks.com
  See header in FormOpenDental.cs for complete text.  Redistributions must retain this text.
  ===============================================================================================================*/
  using System;
  using System.Collections.Generic;
  using System.Data;
  using System.Diagnostics;
  using System.Drawing;
  using System.Drawing.Printing;
  using System.Collections;
  using System.ComponentModel;
  using System.Globalization;
  using System.Windows.Forms;
  using OpenDental.UI;
  using OpenDentBusiness;
  
  namespace OpenDental{
  ///<summary></summary>
  	public class FormConfirmList : System.Windows.Forms.Form{
  		private OpenDental.UI.Button butClose;
  		private OpenDental.UI.Button butRefresh;
  		private System.Windows.Forms.GroupBox groupBox1;
  		private System.Windows.Forms.Label label1;
  		private System.Windows.Forms.Label label2;
  		private System.ComponentModel.Container components = null;
  		///<summary>Will be set to true when form closes if user click Send to Pinboard.</summary>
  		public bool PinClicked=false;
  		private OpenDental.UI.Button butReport;
  		private int pagesPrinted;
  		private DataTable AddrTable;
  		private int patientsPrinted;
  		private System.Windows.Forms.GroupBox groupBox3;
  		private System.Windows.Forms.ComboBox comboStatus;
  		private OpenDental.UI.Button butLabels;
  		private OpenDental.UI.Button butPostcards;
  		private OpenDental.ValidDate textDateFrom;
  		private OpenDental.ValidDate textDateTo;
  		private OpenDental.UI.ODGrid gridMain;
  		///<summary>When this form closes, this will be the patNum of the last patient viewed.  The calling form should then make use of this to refresh to that patient.  If 0, then calling form should not refresh.</summary>
  		public long SelectedPatNum;
  		///<summary>This list of appointments displayed</summary>
  		private DataTable Table;
  		private PrintDocument pd;
  		private OpenDental.UI.Button butPrint;
  		private OpenDental.UI.FormPrintPreview printPreview;
  		private bool headingPrinted;
  		private int headingPrintH;
  		private ComboBox comboProv;
  		private Label label4;
  		private OpenDental.UI.Button butEmail;
  		private ComboBox comboClinic;
  		private Label labelClinic;
  		private ComboBox comboShowRecall;
  		private UI.Button butText;
  		///<summary>Only used if PinClicked=true</summary>
  		public long AptSelected;
  		private List<Clinic> _listUserClinics;
  
  		///<summary></summary>
  		public FormConfirmList(){
  			InitializeComponent();// Required for Windows Form Designer support
  			Lan.F(this);
  		}
  
  		///<summary></summary>
  		protected override void Dispose( bool disposing ){
  			if( disposing ){
  				if(components != null){
  					components.Dispose();
  				}
  			}
  			base.Dispose( disposing );
  		}
  
  		#region Windows Form Designer generated code
  
  		private void InitializeComponent()
  		{
  			System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormConfirmList));
  			this.butClose = new OpenDental.UI.Button();
  			this.butRefresh = new OpenDental.UI.Button();
  			this.groupBox1 = new System.Windows.Forms.GroupBox();
  			this.comboShowRecall = new System.Windows.Forms.ComboBox();
  			this.comboClinic = new System.Windows.Forms.ComboBox();
  			this.labelClinic = new System.Windows.Forms.Label();
  			this.comboProv = new System.Windows.Forms.ComboBox();
  			this.label4 = new System.Windows.Forms.Label();
  			this.textDateTo = new OpenDental.ValidDate();
  			this.textDateFrom = new OpenDental.ValidDate();
  			this.label2 = new System.Windows.Forms.Label();
  			this.label1 = new System.Windows.Forms.Label();
  			this.butReport = new OpenDental.UI.Button();
  			this.butLabels = new OpenDental.UI.Button();
  			this.groupBox3 = new System.Windows.Forms.GroupBox();
  			this.comboStatus = new System.Windows.Forms.ComboBox();
  			this.butPostcards = new OpenDental.UI.Button();
  			this.gridMain = new OpenDental.UI.ODGrid();
  			this.butPrint = new OpenDental.UI.Button();
  			this.butEmail = new OpenDental.UI.Button();
  			this.butText = new OpenDental.UI.Button();
  			this.groupBox1.SuspendLayout();
  			this.groupBox3.SuspendLayout();
  			this.SuspendLayout();
  			// 
  			// butClose
  			// 
  			this.butClose.AdjustImageLocation = new System.Drawing.Point(0, 0);
  			this.butClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
  			this.butClose.Autosize = true;
  			this.butClose.BtnShape = OpenDental.UI.enumType.BtnShape.Rectangle;
  			this.butClose.BtnStyle = OpenDental.UI.enumType.XPStyle.Silver;
  			this.butClose.CornerRadius = 4F;
  			this.butClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
  			this.butClose.Location = new System.Drawing.Point(895, 659);
  			this.butClose.Name = "butClose";
  			this.butClose.Size = new System.Drawing.Size(75, 24);
  			this.butClose.TabIndex = 2;
  			this.butClose.Text = "&Close";
  			this.butClose.Click += new System.EventHandler(this.butClose_Click);
  			// 
  			// butRefresh
  			// 
  			this.butRefresh.AdjustImageLocation = new System.Drawing.Point(0, 0);
  			this.butRefresh.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  			this.butRefresh.Autosize = true;
  			this.butRefresh.BtnShape = OpenDental.UI.enumType.BtnShape.Rectangle;
  			this.butRefresh.BtnStyle = OpenDental.UI.enumType.XPStyle.Silver;
  			this.butRefresh.CornerRadius = 4F;
  			this.butRefresh.Location = new System.Drawing.Point(47, 12);
  			this.butRefresh.Name = "butRefresh";
  			this.butRefresh.Size = new System.Drawing.Size(84, 24);
  			this.butRefresh.TabIndex = 2;
  			this.butRefresh.Text = "&Refresh";
  			this.butRefresh.Click += new System.EventHandler(this.butRefresh_Click);
  			// 
  			// groupBox1
  			// 
  			this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  			this.groupBox1.Controls.Add(this.comboShowRecall);
  			this.groupBox1.Controls.Add(this.comboClinic);
  			this.groupBox1.Controls.Add(this.labelClinic);
  			this.groupBox1.Controls.Add(this.comboProv);
  			this.groupBox1.Controls.Add(this.label4);
  			this.groupBox1.Controls.Add(this.textDateTo);
  			this.groupBox1.Controls.Add(this.textDateFrom);
  			this.groupBox1.Controls.Add(this.label2);
  			this.groupBox1.Controls.Add(this.label1);
  			this.groupBox1.Controls.Add(this.butRefresh);
  			this.groupBox1.FlatStyle = System.Windows.Forms.FlatStyle.System;
  			this.groupBox1.Location = new System.Drawing.Point(5, 4);
  			this.groupBox1.Name = "groupBox1";
  			this.groupBox1.Size = new System.Drawing.Size(632, 63);
  			this.groupBox1.TabIndex = 1;
  			this.groupBox1.TabStop = false;
  			this.groupBox1.Text = "View";
  			// 
  			// comboShowRecall
  			// 
  			this.comboShowRecall.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
  			this.comboShowRecall.FormattingEnabled = true;
  			this.comboShowRecall.Items.AddRange(new object[] {
              "All",
              "Recall Only",
              "Exclude Recall",
  						"Hygiene Prescheduled"});
  			this.comboShowRecall.Location = new System.Drawing.Point(29, 38);
  			this.comboShowRecall.Name = "comboShowRecall";
  			this.comboShowRecall.Size = new System.Drawing.Size(121, 21);
  			this.comboShowRecall.TabIndex = 26;
  			// 
  			// comboClinic
  			// 
  			this.comboClinic.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
  			this.comboClinic.Location = new System.Drawing.Point(439, 36);
  			this.comboClinic.MaxDropDownItems = 40;
  			this.comboClinic.Name = "comboClinic";
  			this.comboClinic.Size = new System.Drawing.Size(181, 21);
  			this.comboClinic.TabIndex = 25;
  			// 
  			// labelClinic
  			// 
  			this.labelClinic.Location = new System.Drawing.Point(346, 40);
  			this.labelClinic.Name = "labelClinic";
  			this.labelClinic.Size = new System.Drawing.Size(91, 14);
  			this.labelClinic.TabIndex = 24;
  			this.labelClinic.Text = "Clinic";
  			this.labelClinic.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
  			// 
  			// comboProv
  			// 
  			this.comboProv.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
  			this.comboProv.Location = new System.Drawing.Point(439, 12);
  			this.comboProv.MaxDropDownItems = 40;
  			this.comboProv.Name = "comboProv";
  			this.comboProv.Size = new System.Drawing.Size(181, 21);
  			this.comboProv.TabIndex = 23;
  			// 
  			// label4
  			// 
  			this.label4.Location = new System.Drawing.Point(346, 16);
  			this.label4.Name = "label4";
  			this.label4.Size = new System.Drawing.Size(91, 14);
  			this.label4.TabIndex = 22;
  			this.label4.Text = "Provider";
  			this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
  			// 
  			// textDateTo
  			// 
  			this.textDateTo.Location = new System.Drawing.Point(232, 38);
  			this.textDateTo.Name = "textDateTo";
  			this.textDateTo.Size = new System.Drawing.Size(94, 20);
  			this.textDateTo.TabIndex = 14;
  			// 
  			// textDateFrom
  			// 
  			this.textDateFrom.Location = new System.Drawing.Point(232, 16);
  			this.textDateFrom.Name = "textDateFrom";
  			this.textDateFrom.Size = new System.Drawing.Size(94, 20);
  			this.textDateFrom.TabIndex = 13;
  			// 
  			// label2
  			// 
  			this.label2.Location = new System.Drawing.Point(161, 40);
  			this.label2.Name = "label2";
  			this.label2.Size = new System.Drawing.Size(68, 14);
  			this.label2.TabIndex = 12;
  			this.label2.Text = "To Date";
  			this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
  			// 
  			// label1
  			// 
  			this.label1.Location = new System.Drawing.Point(152, 19);
  			this.label1.Name = "label1";
  			this.label1.Size = new System.Drawing.Size(77, 14);
  			this.label1.TabIndex = 11;
  			this.label1.Text = "From Date";
  			this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
  			// 
  			// butReport
  			// 
  			this.butReport.AdjustImageLocation = new System.Drawing.Point(0, 0);
  			this.butReport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  			this.butReport.Autosize = true;
  			this.butReport.BtnShape = OpenDental.UI.enumType.BtnShape.Rectangle;
  			this.butReport.BtnStyle = OpenDental.UI.enumType.XPStyle.Silver;
  			this.butReport.CornerRadius = 4F;
  			this.butReport.Location = new System.Drawing.Point(621, 659);
  			this.butReport.Name = "butReport";
  			this.butReport.Size = new System.Drawing.Size(87, 24);
  			this.butReport.TabIndex = 13;
  			this.butReport.Text = "R&un Report";
  			this.butReport.Click += new System.EventHandler(this.butReport_Click);
  			// 
  			// butLabels
  			// 
  			this.butLabels.AdjustImageLocation = new System.Drawing.Point(0, 0);
  			this.butLabels.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  			this.butLabels.Autosize = true;
  			this.butLabels.BtnShape = OpenDental.UI.enumType.BtnShape.Rectangle;
  			this.butLabels.BtnStyle = OpenDental.UI.enumType.XPStyle.Silver;
  			this.butLabels.CornerRadius = 4F;
  			this.butLabels.Image = global::OpenDental.Properties.Resources.butLabel;
  			this.butLabels.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
  			this.butLabels.Location = new System.Drawing.Point(129, 659);
  			this.butLabels.Name = "butLabels";
  			this.butLabels.Size = new System.Drawing.Size(102, 24);
  			this.butLabels.TabIndex = 14;
  			this.butLabels.Text = "Label Preview";
  			this.butLabels.Click += new System.EventHandler(this.butLabels_Click);
  			// 
  			// groupBox3
  			// 
  			this.groupBox3.Controls.Add(this.comboStatus);
  			this.groupBox3.FlatStyle = System.Windows.Forms.FlatStyle.System;
  			this.groupBox3.Location = new System.Drawing.Point(643, 4);
  			this.groupBox3.Name = "groupBox3";
  			this.groupBox3.Size = new System.Drawing.Size(143, 63);
  			this.groupBox3.TabIndex = 15;
  			this.groupBox3.TabStop = false;
  			this.groupBox3.Text = "Set Status";
  			// 
  			// comboStatus
  			// 
  			this.comboStatus.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
  			this.comboStatus.Location = new System.Drawing.Point(7, 22);
  			this.comboStatus.MaxDropDownItems = 40;
  			this.comboStatus.Name = "comboStatus";
  			this.comboStatus.Size = new System.Drawing.Size(128, 21);
  			this.comboStatus.TabIndex = 15;
  			this.comboStatus.SelectedIndexChanged += new System.EventHandler(this.comboStatus_SelectedIndexChanged);
  			this.comboStatus.SelectionChangeCommitted += new System.EventHandler(this.comboStatus_SelectionChangeCommitted);
  			// 
  			// butPostcards
  			// 
  			this.butPostcards.AdjustImageLocation = new System.Drawing.Point(0, 0);
  			this.butPostcards.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  			this.butPostcards.Autosize = true;
  			this.butPostcards.BtnShape = OpenDental.UI.enumType.BtnShape.Rectangle;
  			this.butPostcards.BtnStyle = OpenDental.UI.enumType.XPStyle.Silver;
  			this.butPostcards.CornerRadius = 4F;
  			this.butPostcards.Image = global::OpenDental.Properties.Resources.butPrintSmall;
  			this.butPostcards.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
  			this.butPostcards.Location = new System.Drawing.Point(4, 659);
  			this.butPostcards.Name = "butPostcards";
  			this.butPostcards.Size = new System.Drawing.Size(119, 24);
  			this.butPostcards.TabIndex = 16;
  			this.butPostcards.Text = "Postcard Preview";
  			this.butPostcards.Click += new System.EventHandler(this.butPostcards_Click);
  			// 
  			// grid
  			// 
  			this.gridMain.HScrollVisible = false;
  			this.gridMain.Location = new System.Drawing.Point(4, 69);
  			this.gridMain.Name = "grid";
  			this.gridMain.ScrollValue = 0;
  			this.gridMain.SelectionMode = OpenDental.UI.GridSelectionMode.MultiExtended;
  			this.gridMain.Size = new System.Drawing.Size(963, 585);
  			this.gridMain.TabIndex = 0;
  			this.gridMain.Title = "Confirmation List";
  			this.gridMain.TranslationName = "TableConfirmList";
  			this.gridMain.CellDoubleClick += new OpenDental.UI.ODGridClickEventHandler(this.grid_CellDoubleClick);
  			this.gridMain.CellClick += new OpenDental.UI.ODGridClickEventHandler(this.grid_CellClick);
  			this.gridMain.Click += new System.EventHandler(this.grid_Click);
  			// 
  			// butPrint
  			// 
  			this.butPrint.AdjustImageLocation = new System.Drawing.Point(0, 0);
  			this.butPrint.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
  			this.butPrint.Autosize = true;
  			this.butPrint.BtnShape = OpenDental.UI.enumType.BtnShape.Rectangle;
  			this.butPrint.BtnStyle = OpenDental.UI.enumType.XPStyle.Silver;
  			this.butPrint.CornerRadius = 4F;
  			this.butPrint.Image = global::OpenDental.Properties.Resources.butPrintSmall;
  			this.butPrint.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
  			this.butPrint.Location = new System.Drawing.Point(714, 659);
  			this.butPrint.Name = "butPrint";
  			this.butPrint.Size = new System.Drawing.Size(87, 24);
  			this.butPrint.TabIndex = 20;
  			this.butPrint.Text = "Print List";
  			this.butPrint.Click += new System.EventHandler(this.butPrint_Click);
  			// 
  			// butEmail
  			// 
  			this.butEmail.AdjustImageLocation = new System.Drawing.Point(0, 0);
  			this.butEmail.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
  			this.butEmail.Autosize = true;
  			this.butEmail.BtnShape = OpenDental.UI.enumType.BtnShape.Rectangle;
  			this.butEmail.BtnStyle = OpenDental.UI.enumType.XPStyle.Silver;
  			this.butEmail.CornerRadius = 4F;
  			this.butEmail.Image = global::OpenDental.Properties.Resources.email1;
  			this.butEmail.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
  			this.butEmail.Location = new System.Drawing.Point(237, 659);
  			this.butEmail.Name = "butEmail";
  			this.butEmail.Size = new System.Drawing.Size(91, 24);
  			this.butEmail.TabIndex = 61;
  			this.butEmail.Text = "E-Mail";
  			this.butEmail.Click += new System.EventHandler(this.butEmail_Click);
  			// 
  			// butText
  			// 
  			this.butText.AdjustImageLocation = new System.Drawing.Point(0, 0);
  			this.butText.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
  			this.butText.Autosize = false;
  			this.butText.BtnShape = OpenDental.UI.enumType.BtnShape.Rectangle;
  			this.butText.BtnStyle = OpenDental.UI.enumType.XPStyle.Silver;
  			this.butText.CornerRadius = 4F;
  			this.butText.Image = global::OpenDental.Properties.Resources.Text;
  			this.butText.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
  			this.butText.Location = new System.Drawing.Point(333, 659);
  			this.butText.Name = "butText";
  			this.butText.Size = new System.Drawing.Size(79, 24);
  			this.butText.TabIndex = 61;
  			this.butText.Text = "Text";
  			this.butText.Click += new System.EventHandler(this.butText_Click);
  			// 
  			// FormConfirmList
  			// 
  			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
  			this.CancelButton = this.butClose;
  			this.ClientSize = new System.Drawing.Size(975, 688);
  			this.Controls.Add(this.butText);
  			this.Controls.Add(this.butEmail);
  			this.Controls.Add(this.butPrint);
  			this.Controls.Add(this.butPostcards);
  			this.Controls.Add(this.gridMain);
  			this.Controls.Add(this.groupBox3);
  			this.Controls.Add(this.butLabels);
  			this.Controls.Add(this.butReport);
  			this.Controls.Add(this.groupBox1);
  			this.Controls.Add(this.butClose);
  			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
  			this.MaximizeBox = false;
  			this.MinimizeBox = false;
  			this.Name = "FormConfirmList";
  			this.ShowInTaskbar = false;
  			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
  			this.Text = "Confirmation List";
  			this.Load += new System.EventHandler(this.FormConfirmList_Load);
  			this.groupBox1.ResumeLayout(false);
  			this.groupBox1.PerformLayout();
  			this.groupBox3.ResumeLayout(false);
  			this.ResumeLayout(false);
  
  		}
  		#endregion
  
  		private void FormConfirmList_Load(object sender, System.EventArgs e) {
  			comboShowRecall.SelectedIndex=0;//Default to show all.
  			textDateFrom.Text=AddWorkDays(1,DateTime.Today).ToShortDateString();
  			textDateTo.Text=AddWorkDays(2,DateTime.Today).ToShortDateString();
  			comboProv.Items.Add(Lan.g(this,"All"));
  			comboProv.SelectedIndex=0;
  			for(int i=0;i<ProviderC.ListShort.Count;i++) {
  				comboProv.Items.Add(ProviderC.ListShort[i].GetLongDesc());
  			}
  			//textPostcardMessage.Text=PrefC.GetString(PrefName.ConfirmPostcardMessage");
  			comboStatus.Items.Clear();
  			for(int i=0;i<DefC.Short[(int)DefCat.ApptConfirmed].Length;i++){
  				comboStatus.Items.Add(DefC.Short[(int)DefCat.ApptConfirmed][i].ItemName);
  			}
  			if(PrefC.GetBool(PrefName.EasyNoClinics)) {
  				comboClinic.Visible=false;
  				labelClinic.Visible=false;
  			}
  			else {
  				if(!Security.CurUser.ClinicIsRestricted) {
  					comboClinic.Items.Add(Lan.g(this,"All"));
  					comboClinic.SelectedIndex=0;
  				}
  				_listUserClinics=Clinics.GetForUserod(Security.CurUser);
  				for(int i=0;i<_listUserClinics.Count;i++) {
  					comboClinic.Items.Add(_listUserClinics[i].Description);
  					if(_listUserClinics[i].ClinicNum==FormOpenDental.ClinicNum) {
  						comboClinic.SelectedIndex=i;
  						if(!Security.CurUser.ClinicIsRestricted) {
  							comboClinic.SelectedIndex++;//add 1 for "All"
  						}
  					}
  				}
  			}
  			if(!Programs.IsEnabled(ProgramName.CallFire)) {
  				butText.Enabled=false;
  			}
  			FillMain();
  			Plugins.HookAddCode(this,"FormConfirmList.Load_End",butText);
  		}
  
  		///<summary>Adds the specified number of work days, skipping saturday and sunday.</summary>
  		private DateTime AddWorkDays(int days,DateTime date){
  			DateTime retVal=date;
  			for(int i=0;i<days;i++){
  				retVal=retVal.AddDays(1);
  				//then, this part jumps to monday if on a sat or sun
  				while(retVal.DayOfWeek==DayOfWeek.Saturday || retVal.DayOfWeek==DayOfWeek.Sunday){
  					retVal=retVal.AddDays(1);
  				}
  			}
  			return retVal;
  		}
  
  		private void FillMain(){
  			DateTime dateFrom=PIn.Date(textDateFrom.Text);
  			DateTime dateTo=PIn.Date(textDateTo.Text);
  			long provNum=0;
  			if(comboProv.SelectedIndex!=0) {
  				provNum=ProviderC.ListShort[comboProv.SelectedIndex-1].ProvNum;
  			}
  			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 && comboClinic.SelectedIndex>-1) {
  				clinicNum=_listUserClinics[comboClinic.SelectedIndex].ClinicNum;
  			}
  			else if(comboClinic.SelectedIndex > 0) {//if user is not restricted, clinicNum will be 0 and the query will get all clinic data
  				clinicNum=_listUserClinics[comboClinic.SelectedIndex-1].ClinicNum;//if user is not restricted, comboClinic will contain "All" so minus 1
  			}
  			bool showRecalls=false;
  			bool showNonRecalls=false;
  			bool showHygienePrescheduled=false;
  			if(comboShowRecall.SelectedIndex==0 || comboShowRecall.SelectedIndex==1) {//All or Recall Only
  				showRecalls=true;
  			}
  			if(comboShowRecall.SelectedIndex==0 || comboShowRecall.SelectedIndex==2) {//All or Exclude Recalls
  				showNonRecalls=true;
  			}
  			if(comboShowRecall.SelectedIndex==0 || comboShowRecall.SelectedIndex==3) {//All or Hygiene Prescheduled
  				showHygienePrescheduled=true;
  			}
  			Table=Appointments.GetConfirmList(dateFrom,dateTo,provNum,clinicNum,showRecalls,showNonRecalls,showHygienePrescheduled);
  			int scrollVal=gridMain.ScrollValue;
  			gridMain.BeginUpdate();
  			gridMain.Columns.Clear();
  			ODGridColumn col=new ODGridColumn(Lan.g("TableConfirmList","Date Time"),70);
  			gridMain.Columns.Add(col);
  			col=new ODGridColumn(Lan.g("TableConfirmList","DateSched"),80);
  			gridMain.Columns.Add(col);
  			col=new ODGridColumn(Lan.g("TableConfirmList","Patient"),80);
  			gridMain.Columns.Add(col);
  			col=new ODGridColumn(Lan.g("TableConfirmList","Age"),30);
  			gridMain.Columns.Add(col);
  			col=new ODGridColumn(Lan.g("TableConfirmList","Contact"),150);
  			gridMain.Columns.Add(col);
  			col=new ODGridColumn(Lan.g("TableConfirmList","Addr/Ph Note"),100);
  			gridMain.Columns.Add(col);
  			col=new ODGridColumn(Lan.g("TableConfirmList","Status"),80);//confirmed
  			gridMain.Columns.Add(col);
  			col=new ODGridColumn(Lan.g("TableConfirmList","Procs"),110);
  			gridMain.Columns.Add(col);
  			col=new ODGridColumn(Lan.g("TableConfirmList","Medical"),80);
  			gridMain.Columns.Add(col);
  
gt: 			col=new ODGridColumn(Lan.g("TableConfirmList","Appt Note"),124);