Index: Scheduling/trunk/cs/bsdx0200GUISourceCode/CGView.cs
===================================================================
--- Scheduling/trunk/cs/bsdx0200GUISourceCode/CGView.cs	(revision 1106)
+++ Scheduling/trunk/cs/bsdx0200GUISourceCode/CGView.cs	(revision 1110)
@@ -1,4 +1,3 @@
 using System;
-using System.Drawing;
 using System.Collections;
 using System.ComponentModel;
@@ -9,4 +8,5 @@
 using IndianHealthService.BMXNet;
 using System.Runtime.InteropServices;
+using System.Drawing.Printing;
 
 namespace IndianHealthService.ClinicalScheduling
@@ -97,7 +97,6 @@
 		private System.Windows.Forms.MenuItem mnuDisplayWalkIns;
         private System.Windows.Forms.MenuItem mnuRPMSDivision;
-        private System.Drawing.Printing.PrintDocument printRoutingSlip;
         private MenuItem menuItem10;
-        private MenuItem ctxCalGridReprintRoutingSlip;
+        private MenuItem ctxCalGridReprintApptSlip;
         private IContainer components;
 
@@ -233,4 +232,5 @@
             this.lblResource = new System.Windows.Forms.Label();
             this.panelCenter = new System.Windows.Forms.Panel();
+            this.calendarGrid1 = new IndianHealthService.ClinicalScheduling.CalendarGrid();
             this.ctxCalendarGrid = new System.Windows.Forms.ContextMenu();
             this.ctxCalGridAdd = new System.Windows.Forms.MenuItem();
@@ -244,11 +244,9 @@
             this.ctxCalGridWalkin = new System.Windows.Forms.MenuItem();
             this.menuItem10 = new System.Windows.Forms.MenuItem();
-            this.ctxCalGridReprintRoutingSlip = new System.Windows.Forms.MenuItem();
+            this.ctxCalGridReprintApptSlip = new System.Windows.Forms.MenuItem();
             this.panelBottom = new System.Windows.Forms.Panel();
             this.statusBar1 = new System.Windows.Forms.StatusBar();
             this.splitter1 = new System.Windows.Forms.Splitter();
             this.splitter2 = new System.Windows.Forms.Splitter();
-            this.printRoutingSlip = new System.Drawing.Printing.PrintDocument();
-            this.calendarGrid1 = new IndianHealthService.ClinicalScheduling.CalendarGrid();
             this.panelRight.SuspendLayout();
             this.panelClip.SuspendLayout();
@@ -763,123 +761,4 @@
             this.panelCenter.Size = new System.Drawing.Size(857, 345);
             this.panelCenter.TabIndex = 7;
-            // 
-            // ctxCalendarGrid
-            // 
-            this.ctxCalendarGrid.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
-            this.ctxCalGridAdd,
-            this.ctxCalGridEdit,
-            this.ctxCalGridDelete,
-            this.ctxCalGridCheckIn,
-            this.menuItem2,
-            this.ctxCalGridNoShow,
-            this.ctxCalGridNoShowUndo,
-            this.menuItem9,
-            this.ctxCalGridWalkin,
-            this.menuItem10,
-            this.ctxCalGridReprintRoutingSlip});
-            this.ctxCalendarGrid.Popup += new System.EventHandler(this.ctxCalendarGrid_Popup);
-            // 
-            // ctxCalGridAdd
-            // 
-            this.ctxCalGridAdd.Index = 0;
-            this.ctxCalGridAdd.Text = "Add Appointment";
-            this.ctxCalGridAdd.Click += new System.EventHandler(this.ctxCalGridAdd_Click);
-            // 
-            // ctxCalGridEdit
-            // 
-            this.ctxCalGridEdit.Index = 1;
-            this.ctxCalGridEdit.Text = "Edit Appointment";
-            this.ctxCalGridEdit.Click += new System.EventHandler(this.ctxCalGridEdit_Click);
-            // 
-            // ctxCalGridDelete
-            // 
-            this.ctxCalGridDelete.Index = 2;
-            this.ctxCalGridDelete.Text = "Cancel Appointment";
-            this.ctxCalGridDelete.Click += new System.EventHandler(this.ctxCalGridDelete_Click);
-            // 
-            // ctxCalGridCheckIn
-            // 
-            this.ctxCalGridCheckIn.Index = 3;
-            this.ctxCalGridCheckIn.Text = "Check In Patient";
-            this.ctxCalGridCheckIn.Click += new System.EventHandler(this.ctxCalGridCheckIn_Click);
-            // 
-            // menuItem2
-            // 
-            this.menuItem2.Index = 4;
-            this.menuItem2.Text = "-";
-            // 
-            // ctxCalGridNoShow
-            // 
-            this.ctxCalGridNoShow.Index = 5;
-            this.ctxCalGridNoShow.Text = "Mark as No Show";
-            this.ctxCalGridNoShow.Click += new System.EventHandler(this.ctxCalGridNoShow_Click);
-            // 
-            // ctxCalGridNoShowUndo
-            // 
-            this.ctxCalGridNoShowUndo.Index = 6;
-            this.ctxCalGridNoShowUndo.Text = "Undo NoShow";
-            this.ctxCalGridNoShowUndo.Click += new System.EventHandler(this.ctxCalGridNoShowUndo_Click);
-            // 
-            // menuItem9
-            // 
-            this.menuItem9.Index = 7;
-            this.menuItem9.Text = "-";
-            // 
-            // ctxCalGridWalkin
-            // 
-            this.ctxCalGridWalkin.Index = 8;
-            this.ctxCalGridWalkin.Text = "Create Wal&k-In Appointment";
-            this.ctxCalGridWalkin.Click += new System.EventHandler(this.ctxCalGridWalkin_Click);
-            // 
-            // menuItem10
-            // 
-            this.menuItem10.Index = 9;
-            this.menuItem10.Text = "-";
-            // 
-            // ctxCalGridReprintRoutingSlip
-            // 
-            this.ctxCalGridReprintRoutingSlip.Index = 10;
-            this.ctxCalGridReprintRoutingSlip.Text = "&Reprint Routing Slip";
-            this.ctxCalGridReprintRoutingSlip.Click += new System.EventHandler(this.ctxCalGridReprintRoutingSlip_Click);
-            // 
-            // panelBottom
-            // 
-            this.panelBottom.Controls.Add(this.statusBar1);
-            this.panelBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
-            this.panelBottom.Location = new System.Drawing.Point(136, 369);
-            this.panelBottom.Name = "panelBottom";
-            this.panelBottom.Size = new System.Drawing.Size(857, 24);
-            this.panelBottom.TabIndex = 8;
-            // 
-            // statusBar1
-            // 
-            this.statusBar1.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.statusBar1.Location = new System.Drawing.Point(0, 0);
-            this.statusBar1.Name = "statusBar1";
-            this.statusBar1.Size = new System.Drawing.Size(857, 24);
-            this.statusBar1.SizingGrip = false;
-            this.statusBar1.TabIndex = 0;
-            // 
-            // splitter1
-            // 
-            this.splitter1.Location = new System.Drawing.Point(128, 24);
-            this.splitter1.Name = "splitter1";
-            this.splitter1.Size = new System.Drawing.Size(8, 369);
-            this.splitter1.TabIndex = 9;
-            this.splitter1.TabStop = false;
-            // 
-            // splitter2
-            // 
-            this.splitter2.Dock = System.Windows.Forms.DockStyle.Right;
-            this.splitter2.Location = new System.Drawing.Point(993, 24);
-            this.splitter2.Name = "splitter2";
-            this.splitter2.Size = new System.Drawing.Size(3, 369);
-            this.splitter2.TabIndex = 10;
-            this.splitter2.TabStop = false;
-            // 
-            // printRoutingSlip
-            // 
-            this.printRoutingSlip.DocumentName = "Routing Slip";
-            this.printRoutingSlip.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.printRoutingSlip_PrintPage);
             // 
             // calendarGrid1
@@ -912,4 +791,118 @@
             this.calendarGrid1.MouseEnter += new System.EventHandler(this.calendarGrid1_MouseEnter);
             // 
+            // ctxCalendarGrid
+            // 
+            this.ctxCalendarGrid.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+            this.ctxCalGridAdd,
+            this.ctxCalGridEdit,
+            this.ctxCalGridDelete,
+            this.ctxCalGridCheckIn,
+            this.menuItem2,
+            this.ctxCalGridNoShow,
+            this.ctxCalGridNoShowUndo,
+            this.menuItem9,
+            this.ctxCalGridWalkin,
+            this.menuItem10,
+            this.ctxCalGridReprintApptSlip});
+            this.ctxCalendarGrid.Popup += new System.EventHandler(this.ctxCalendarGrid_Popup);
+            // 
+            // ctxCalGridAdd
+            // 
+            this.ctxCalGridAdd.Index = 0;
+            this.ctxCalGridAdd.Text = "Add Appointment";
+            this.ctxCalGridAdd.Click += new System.EventHandler(this.ctxCalGridAdd_Click);
+            // 
+            // ctxCalGridEdit
+            // 
+            this.ctxCalGridEdit.Index = 1;
+            this.ctxCalGridEdit.Text = "Edit Appointment";
+            this.ctxCalGridEdit.Click += new System.EventHandler(this.ctxCalGridEdit_Click);
+            // 
+            // ctxCalGridDelete
+            // 
+            this.ctxCalGridDelete.Index = 2;
+            this.ctxCalGridDelete.Text = "Cancel Appointment";
+            this.ctxCalGridDelete.Click += new System.EventHandler(this.ctxCalGridDelete_Click);
+            // 
+            // ctxCalGridCheckIn
+            // 
+            this.ctxCalGridCheckIn.Index = 3;
+            this.ctxCalGridCheckIn.Text = "Check In Patient";
+            this.ctxCalGridCheckIn.Click += new System.EventHandler(this.ctxCalGridCheckIn_Click);
+            // 
+            // menuItem2
+            // 
+            this.menuItem2.Index = 4;
+            this.menuItem2.Text = "-";
+            // 
+            // ctxCalGridNoShow
+            // 
+            this.ctxCalGridNoShow.Index = 5;
+            this.ctxCalGridNoShow.Text = "Mark as No Show";
+            this.ctxCalGridNoShow.Click += new System.EventHandler(this.ctxCalGridNoShow_Click);
+            // 
+            // ctxCalGridNoShowUndo
+            // 
+            this.ctxCalGridNoShowUndo.Index = 6;
+            this.ctxCalGridNoShowUndo.Text = "Undo NoShow";
+            this.ctxCalGridNoShowUndo.Click += new System.EventHandler(this.ctxCalGridNoShowUndo_Click);
+            // 
+            // menuItem9
+            // 
+            this.menuItem9.Index = 7;
+            this.menuItem9.Text = "-";
+            // 
+            // ctxCalGridWalkin
+            // 
+            this.ctxCalGridWalkin.Index = 8;
+            this.ctxCalGridWalkin.Text = "Create Wal&k-In Appointment";
+            this.ctxCalGridWalkin.Click += new System.EventHandler(this.ctxCalGridWalkin_Click);
+            // 
+            // menuItem10
+            // 
+            this.menuItem10.Index = 9;
+            this.menuItem10.Text = "-";
+            // 
+            // ctxCalGridReprintApptSlip
+            // 
+            this.ctxCalGridReprintApptSlip.Index = 10;
+            this.ctxCalGridReprintApptSlip.Text = "&Reprint Appointment Slip";
+            this.ctxCalGridReprintApptSlip.Click += new System.EventHandler(this.ctxCalGridReprintApptSlip_Click);
+            // 
+            // panelBottom
+            // 
+            this.panelBottom.Controls.Add(this.statusBar1);
+            this.panelBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
+            this.panelBottom.Location = new System.Drawing.Point(136, 369);
+            this.panelBottom.Name = "panelBottom";
+            this.panelBottom.Size = new System.Drawing.Size(857, 24);
+            this.panelBottom.TabIndex = 8;
+            // 
+            // statusBar1
+            // 
+            this.statusBar1.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.statusBar1.Location = new System.Drawing.Point(0, 0);
+            this.statusBar1.Name = "statusBar1";
+            this.statusBar1.Size = new System.Drawing.Size(857, 24);
+            this.statusBar1.SizingGrip = false;
+            this.statusBar1.TabIndex = 0;
+            // 
+            // splitter1
+            // 
+            this.splitter1.Location = new System.Drawing.Point(128, 24);
+            this.splitter1.Name = "splitter1";
+            this.splitter1.Size = new System.Drawing.Size(8, 369);
+            this.splitter1.TabIndex = 9;
+            this.splitter1.TabStop = false;
+            // 
+            // splitter2
+            // 
+            this.splitter2.Dock = System.Windows.Forms.DockStyle.Right;
+            this.splitter2.Location = new System.Drawing.Point(993, 24);
+            this.splitter2.Name = "splitter2";
+            this.splitter2.Size = new System.Drawing.Size(3, 369);
+            this.splitter2.TabIndex = 10;
+            this.splitter2.TabStop = false;
+            // 
             // CGView
             // 
@@ -1224,5 +1217,5 @@
 			ctxCalGridWalkin.Enabled = ctxCalGridAdd.Enabled;
             //smh new code
-            ctxCalGridReprintRoutingSlip.Enabled = ctxCalGridEdit.Enabled;
+            ctxCalGridReprintApptSlip.Enabled = ctxCalGridEdit.Enabled;
 		    //end new code
         }
@@ -1265,7 +1258,18 @@
 
         //new code smh
-        private void ctxCalGridReprintRoutingSlip_Click(object sender, EventArgs e)
+        private void ctxCalGridReprintApptSlip_Click(object sender, EventArgs e)
         {
-            printRoutingSlip.Print();
+            int apptID = this.CGrid.SelectedAppointment;
+            if (apptID <= 0) return;
+
+            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();
         }
         //end new code
@@ -1996,5 +2000,5 @@
                 //smh new code
                 if (dlgCheckin.PrintRouteSlip)
-                    this.printRoutingSlip.Print();
+                 //   this.printRoutingSlip.Print();
                 // end new code
 
@@ -3247,5 +3251,5 @@
             int nApptID = this.calendarGrid1.SelectedAppointment;
             CGAppointment a = (CGAppointment)this.Appointments.AppointmentTable[nApptID];
-            ClinicalScheduling.Printing.PrintRoutingSlip(a, "Routing Slip", e);
+            CGDocumentManager.Current.PrintingObject.PrintRoutingSlip(a, "Routing Slip", e);
         }
 
