Index: Scheduling/trunk/cs/bsdx0200GUISourceCode/CGView.cs
===================================================================
--- Scheduling/trunk/cs/bsdx0200GUISourceCode/CGView.cs	(revision 1110)
+++ Scheduling/trunk/cs/bsdx0200GUISourceCode/CGView.cs	(revision 1111)
@@ -1264,12 +1264,6 @@
 
             CGAppointment a = (CGAppointment) this.Appointments.AppointmentTable[apptID];
-            
-            PrintDocument pd = new PrintDocument() { DocumentName = "Appointment Slip for Appt " + apptID };  //Autoinit for DocName
-            pd.PrintPage += (s, pe) =>  //son of a lambda
-            {
-                CGDocumentManager.Current.PrintingObject.PrintAppointmentSlip(a, pe);
-            };
-            
-            pd.Print();
+
+            PrintAppointmentSlip(a);
         }
         //end new code
@@ -1930,5 +1924,4 @@
 		private void AppointmentCheckIn()
 		{
-			
 			int nApptID = this.calendarGrid1.SelectedAppointment;
 			Debug.Assert(nApptID != 0);
@@ -1950,33 +1943,7 @@
 					return;
 				}
-				//Find the default provider for the resource & load into combo box
-				DataView rv = new DataView(this.m_DocManager.GlobalDataSet.Tables["Resources"]);
-				rv.Sort="RESOURCE_NAME ASC";
-				int nFind = rv.Find((string) a.Resource);
-				DataRowView drv = rv[nFind];
-				
-				string sHospLoc = drv["HOSPITAL_LOCATION_ID"].ToString();
-				sHospLoc = (sHospLoc == "")?"0":sHospLoc;
-				int nHospLoc = 0;
-				try
-				{
-					nHospLoc = Convert.ToInt32(sHospLoc);
-				}
-				catch(Exception ex)
-				{
-					Debug.Write("CGView.AppointmentCheckIn Error: " + ex.Message);
-				}
-				
-				string sProv = "";
-
-				if (nHospLoc > 0)
-				{
-					DataRow dr = drv.Row;
-					DataRow drHL = dr.GetParentRow(m_DocManager.GlobalDataSet.Relations["HospitalLocationResource"]);
-					sProv = drHL["DEFAULT_PROVIDER"].ToString();
-				}
 
 				DCheckIn dlgCheckin = new DCheckIn();
-				dlgCheckin.InitializePage(a, this.m_DocManager, sProv, nHospLoc);
+				dlgCheckin.InitializePage(a);
 				calendarGrid1.CGToolTip.Active = false;
 				if (dlgCheckin.ShowDialog(this) != DialogResult.OK)
@@ -1992,14 +1959,17 @@
 				DateTime dtCheckIn = dlgCheckin.CheckInTime;
 
-				//Save to Database
+                //Tell appointment that it is checked in, for proper coloring;
+                //When you refresh from the DB, it will have this property.
+                a.CheckInTime = DateTime.Now;
+                
+                //Save to Database
                 this.Document.CheckInAppointment(nApptID, dtCheckIn);
 
-                //Tell appointment that it is checked in
-                a.CheckInTime = DateTime.Now;
-
-                //smh new code
+                //Get Provider (XXXXXXXX: NOT SAVED TO THE DATABASE RIGHT NOW)
+                a.Provider = dlgCheckin.Provider;
+
+                // Print Routing Slip if user checks that box...
                 if (dlgCheckin.PrintRouteSlip)
-                 //   this.printRoutingSlip.Print();
-                // end new code
+                    this.PrintRoutingSlip(a);
 
                 //redraw grid
@@ -2218,10 +2188,8 @@
 				this.Document.CreateAppointment(appt);
 
-                //Experimental now.
+                
                 if (dAppt.PrintAppointmentSlip)
                 {
-                    System.Drawing.Printing.PrintDocument pd = new System.Drawing.Printing.PrintDocument();
-                    pd.PrintPage += (object s, System.Drawing.Printing.PrintPageEventArgs e) => CGDocumentManager.Current.PrintingObject.PrintAppointmentSlip(appt, e);
-                    pd.Print();
+                    PrintAppointmentSlip(appt);
                 }
 
@@ -3247,9 +3215,16 @@
         }
 
-        private void printRoutingSlip_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
+        private void PrintRoutingSlip(CGAppointment appt)
         {
-            int nApptID = this.calendarGrid1.SelectedAppointment;
-            CGAppointment a = (CGAppointment)this.Appointments.AppointmentTable[nApptID];
-            CGDocumentManager.Current.PrintingObject.PrintRoutingSlip(a, "Routing Slip", e);
+            PrintDocument pd = new PrintDocument() { DocumentName = "Routing Slip for Appt " + appt.AppointmentKey };
+            pd.PrintPage += (object s, System.Drawing.Printing.PrintPageEventArgs e) => CGDocumentManager.Current.PrintingObject.PrintRoutingSlip(appt, "Routing Slip", e);
+            pd.Print();
+        }
+
+        private void PrintAppointmentSlip(CGAppointment appt)
+        {
+            PrintDocument pd = new PrintDocument() { DocumentName = "Appointment Slip for Appt " + appt.AppointmentKey };  //Autoinit for DocName
+            pd.PrintPage += (object s, System.Drawing.Printing.PrintPageEventArgs e) => CGDocumentManager.Current.PrintingObject.PrintAppointmentSlip(appt, e);
+            pd.Print();
         }
 
@@ -3311,4 +3286,7 @@
         #endregion events
 
+        /// <summary>
+        /// Refresh grid if needed. 
+        /// </summary>
         void RequestRefreshGrid()
         {
