Changeset 1110


Ignore:
Timestamp:
Mar 21, 2011, 8:47:45 AM (13 years ago)
Author:
Sam Habiel
Message:

CGDocument:

CGDocumentManager:

CGView: (Changes to support printing of Appointment Slip)

  • Changed name and text of context menu to say "print appointment slip"
  • Logic to Print Appointment Slip

CustomPrinting.cs renamed to Printing.cs; old Printing.Cs removed.
DAppointPage:

  • New checkbox to request printing of Appointment Slip
  • Sex of patient now pulled and included in form.

DPatientLetter:

  • Redirected to use new Printing framework.

Patient:

Printing:

Location:
Scheduling/trunk/cs/bsdx0200GUISourceCode
Files:
1 deleted
12 edited

Legend:

Unmodified
Added
Removed
  • Scheduling/trunk/cs/bsdx0200GUISourceCode/CGDocument.cs

    r1106 r1110  
    177177        /// <returns>Clears and repopluates m_appointments</returns>
    178178        /// </summary>
    179         private bool RefreshDaysSchedule()
     179        private bool RefreshAppointments()
    180180        {
    181181            try
     
    239239                    bWalkIn = (sWalkIn == "1") ? true : false;
    240240
     241                    Patient pt = new Patient()
     242                    {
     243                        DFN = Convert.ToInt32(sPatientID),
     244                        Name = sPatientName,
     245                        DOB = (DateTime)r["DOB"],
     246                        ID = r["PID"].ToString(),
     247                        HRN = sHRN,
     248                        Sex = r["SEX"].ToString() == "MALE" ? Sex.Male : Sex.Female
     249                    };
     250
    241251                    pAppointment = new CGAppointment();
     252                    pAppointment.Patient = pt;
    242253                    pAppointment.CreateAppointment(dStart, dEnd, sNote, nKeyID, sResource);
    243254                    pAppointment.PatientName = sPatientName;
     
    396407        {
    397408            this.RefreshAvailabilitySchedule();
    398             this.RefreshDaysSchedule();
     409            this.RefreshAppointments();
    399410            return true;
    400411        }
  • Scheduling/trunk/cs/bsdx0200GUISourceCode/CGDocumentManager.cs

    r1106 r1110  
    4242
    4343        //Custom Printing
    44         private CustomPrinting                          m_PrintingObject = null;
     44        private Printing                          m_PrintingObject = null;
    4545                #endregion
    4646
     
    134134        }
    135135
    136         public CustomPrinting PrintingObject
     136        public Printing PrintingObject
    137137        {
    138138            get
     
    445445            if (DllLocation == string.Empty)
    446446            {
    447                 this.m_PrintingObject = new CustomPrinting();
     447                this.m_PrintingObject = new Printing();
    448448            }
    449449            else
  • Scheduling/trunk/cs/bsdx0200GUISourceCode/CGView.cs

    r1106 r1110  
    11using System;
    2 using System.Drawing;
    32using System.Collections;
    43using System.ComponentModel;
     
    98using IndianHealthService.BMXNet;
    109using System.Runtime.InteropServices;
     10using System.Drawing.Printing;
    1111
    1212namespace IndianHealthService.ClinicalScheduling
     
    9797                private System.Windows.Forms.MenuItem mnuDisplayWalkIns;
    9898        private System.Windows.Forms.MenuItem mnuRPMSDivision;
    99         private System.Drawing.Printing.PrintDocument printRoutingSlip;
    10099        private MenuItem menuItem10;
    101         private MenuItem ctxCalGridReprintRoutingSlip;
     100        private MenuItem ctxCalGridReprintApptSlip;
    102101        private IContainer components;
    103102
     
    233232            this.lblResource = new System.Windows.Forms.Label();
    234233            this.panelCenter = new System.Windows.Forms.Panel();
     234            this.calendarGrid1 = new IndianHealthService.ClinicalScheduling.CalendarGrid();
    235235            this.ctxCalendarGrid = new System.Windows.Forms.ContextMenu();
    236236            this.ctxCalGridAdd = new System.Windows.Forms.MenuItem();
     
    244244            this.ctxCalGridWalkin = new System.Windows.Forms.MenuItem();
    245245            this.menuItem10 = new System.Windows.Forms.MenuItem();
    246             this.ctxCalGridReprintRoutingSlip = new System.Windows.Forms.MenuItem();
     246            this.ctxCalGridReprintApptSlip = new System.Windows.Forms.MenuItem();
    247247            this.panelBottom = new System.Windows.Forms.Panel();
    248248            this.statusBar1 = new System.Windows.Forms.StatusBar();
    249249            this.splitter1 = new System.Windows.Forms.Splitter();
    250250            this.splitter2 = new System.Windows.Forms.Splitter();
    251             this.printRoutingSlip = new System.Drawing.Printing.PrintDocument();
    252             this.calendarGrid1 = new IndianHealthService.ClinicalScheduling.CalendarGrid();
    253251            this.panelRight.SuspendLayout();
    254252            this.panelClip.SuspendLayout();
     
    763761            this.panelCenter.Size = new System.Drawing.Size(857, 345);
    764762            this.panelCenter.TabIndex = 7;
    765             //
    766             // ctxCalendarGrid
    767             //
    768             this.ctxCalendarGrid.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
    769             this.ctxCalGridAdd,
    770             this.ctxCalGridEdit,
    771             this.ctxCalGridDelete,
    772             this.ctxCalGridCheckIn,
    773             this.menuItem2,
    774             this.ctxCalGridNoShow,
    775             this.ctxCalGridNoShowUndo,
    776             this.menuItem9,
    777             this.ctxCalGridWalkin,
    778             this.menuItem10,
    779             this.ctxCalGridReprintRoutingSlip});
    780             this.ctxCalendarGrid.Popup += new System.EventHandler(this.ctxCalendarGrid_Popup);
    781             //
    782             // ctxCalGridAdd
    783             //
    784             this.ctxCalGridAdd.Index = 0;
    785             this.ctxCalGridAdd.Text = "Add Appointment";
    786             this.ctxCalGridAdd.Click += new System.EventHandler(this.ctxCalGridAdd_Click);
    787             //
    788             // ctxCalGridEdit
    789             //
    790             this.ctxCalGridEdit.Index = 1;
    791             this.ctxCalGridEdit.Text = "Edit Appointment";
    792             this.ctxCalGridEdit.Click += new System.EventHandler(this.ctxCalGridEdit_Click);
    793             //
    794             // ctxCalGridDelete
    795             //
    796             this.ctxCalGridDelete.Index = 2;
    797             this.ctxCalGridDelete.Text = "Cancel Appointment";
    798             this.ctxCalGridDelete.Click += new System.EventHandler(this.ctxCalGridDelete_Click);
    799             //
    800             // ctxCalGridCheckIn
    801             //
    802             this.ctxCalGridCheckIn.Index = 3;
    803             this.ctxCalGridCheckIn.Text = "Check In Patient";
    804             this.ctxCalGridCheckIn.Click += new System.EventHandler(this.ctxCalGridCheckIn_Click);
    805             //
    806             // menuItem2
    807             //
    808             this.menuItem2.Index = 4;
    809             this.menuItem2.Text = "-";
    810             //
    811             // ctxCalGridNoShow
    812             //
    813             this.ctxCalGridNoShow.Index = 5;
    814             this.ctxCalGridNoShow.Text = "Mark as No Show";
    815             this.ctxCalGridNoShow.Click += new System.EventHandler(this.ctxCalGridNoShow_Click);
    816             //
    817             // ctxCalGridNoShowUndo
    818             //
    819             this.ctxCalGridNoShowUndo.Index = 6;
    820             this.ctxCalGridNoShowUndo.Text = "Undo NoShow";
    821             this.ctxCalGridNoShowUndo.Click += new System.EventHandler(this.ctxCalGridNoShowUndo_Click);
    822             //
    823             // menuItem9
    824             //
    825             this.menuItem9.Index = 7;
    826             this.menuItem9.Text = "-";
    827             //
    828             // ctxCalGridWalkin
    829             //
    830             this.ctxCalGridWalkin.Index = 8;
    831             this.ctxCalGridWalkin.Text = "Create Wal&k-In Appointment";
    832             this.ctxCalGridWalkin.Click += new System.EventHandler(this.ctxCalGridWalkin_Click);
    833             //
    834             // menuItem10
    835             //
    836             this.menuItem10.Index = 9;
    837             this.menuItem10.Text = "-";
    838             //
    839             // ctxCalGridReprintRoutingSlip
    840             //
    841             this.ctxCalGridReprintRoutingSlip.Index = 10;
    842             this.ctxCalGridReprintRoutingSlip.Text = "&Reprint Routing Slip";
    843             this.ctxCalGridReprintRoutingSlip.Click += new System.EventHandler(this.ctxCalGridReprintRoutingSlip_Click);
    844             //
    845             // panelBottom
    846             //
    847             this.panelBottom.Controls.Add(this.statusBar1);
    848             this.panelBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
    849             this.panelBottom.Location = new System.Drawing.Point(136, 369);
    850             this.panelBottom.Name = "panelBottom";
    851             this.panelBottom.Size = new System.Drawing.Size(857, 24);
    852             this.panelBottom.TabIndex = 8;
    853             //
    854             // statusBar1
    855             //
    856             this.statusBar1.Dock = System.Windows.Forms.DockStyle.Fill;
    857             this.statusBar1.Location = new System.Drawing.Point(0, 0);
    858             this.statusBar1.Name = "statusBar1";
    859             this.statusBar1.Size = new System.Drawing.Size(857, 24);
    860             this.statusBar1.SizingGrip = false;
    861             this.statusBar1.TabIndex = 0;
    862             //
    863             // splitter1
    864             //
    865             this.splitter1.Location = new System.Drawing.Point(128, 24);
    866             this.splitter1.Name = "splitter1";
    867             this.splitter1.Size = new System.Drawing.Size(8, 369);
    868             this.splitter1.TabIndex = 9;
    869             this.splitter1.TabStop = false;
    870             //
    871             // splitter2
    872             //
    873             this.splitter2.Dock = System.Windows.Forms.DockStyle.Right;
    874             this.splitter2.Location = new System.Drawing.Point(993, 24);
    875             this.splitter2.Name = "splitter2";
    876             this.splitter2.Size = new System.Drawing.Size(3, 369);
    877             this.splitter2.TabIndex = 10;
    878             this.splitter2.TabStop = false;
    879             //
    880             // printRoutingSlip
    881             //
    882             this.printRoutingSlip.DocumentName = "Routing Slip";
    883             this.printRoutingSlip.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.printRoutingSlip_PrintPage);
    884763            //
    885764            // calendarGrid1
     
    912791            this.calendarGrid1.MouseEnter += new System.EventHandler(this.calendarGrid1_MouseEnter);
    913792            //
     793            // ctxCalendarGrid
     794            //
     795            this.ctxCalendarGrid.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
     796            this.ctxCalGridAdd,
     797            this.ctxCalGridEdit,
     798            this.ctxCalGridDelete,
     799            this.ctxCalGridCheckIn,
     800            this.menuItem2,
     801            this.ctxCalGridNoShow,
     802            this.ctxCalGridNoShowUndo,
     803            this.menuItem9,
     804            this.ctxCalGridWalkin,
     805            this.menuItem10,
     806            this.ctxCalGridReprintApptSlip});
     807            this.ctxCalendarGrid.Popup += new System.EventHandler(this.ctxCalendarGrid_Popup);
     808            //
     809            // ctxCalGridAdd
     810            //
     811            this.ctxCalGridAdd.Index = 0;
     812            this.ctxCalGridAdd.Text = "Add Appointment";
     813            this.ctxCalGridAdd.Click += new System.EventHandler(this.ctxCalGridAdd_Click);
     814            //
     815            // ctxCalGridEdit
     816            //
     817            this.ctxCalGridEdit.Index = 1;
     818            this.ctxCalGridEdit.Text = "Edit Appointment";
     819            this.ctxCalGridEdit.Click += new System.EventHandler(this.ctxCalGridEdit_Click);
     820            //
     821            // ctxCalGridDelete
     822            //
     823            this.ctxCalGridDelete.Index = 2;
     824            this.ctxCalGridDelete.Text = "Cancel Appointment";
     825            this.ctxCalGridDelete.Click += new System.EventHandler(this.ctxCalGridDelete_Click);
     826            //
     827            // ctxCalGridCheckIn
     828            //
     829            this.ctxCalGridCheckIn.Index = 3;
     830            this.ctxCalGridCheckIn.Text = "Check In Patient";
     831            this.ctxCalGridCheckIn.Click += new System.EventHandler(this.ctxCalGridCheckIn_Click);
     832            //
     833            // menuItem2
     834            //
     835            this.menuItem2.Index = 4;
     836            this.menuItem2.Text = "-";
     837            //
     838            // ctxCalGridNoShow
     839            //
     840            this.ctxCalGridNoShow.Index = 5;
     841            this.ctxCalGridNoShow.Text = "Mark as No Show";
     842            this.ctxCalGridNoShow.Click += new System.EventHandler(this.ctxCalGridNoShow_Click);
     843            //
     844            // ctxCalGridNoShowUndo
     845            //
     846            this.ctxCalGridNoShowUndo.Index = 6;
     847            this.ctxCalGridNoShowUndo.Text = "Undo NoShow";
     848            this.ctxCalGridNoShowUndo.Click += new System.EventHandler(this.ctxCalGridNoShowUndo_Click);
     849            //
     850            // menuItem9
     851            //
     852            this.menuItem9.Index = 7;
     853            this.menuItem9.Text = "-";
     854            //
     855            // ctxCalGridWalkin
     856            //
     857            this.ctxCalGridWalkin.Index = 8;
     858            this.ctxCalGridWalkin.Text = "Create Wal&k-In Appointment";
     859            this.ctxCalGridWalkin.Click += new System.EventHandler(this.ctxCalGridWalkin_Click);
     860            //
     861            // menuItem10
     862            //
     863            this.menuItem10.Index = 9;
     864            this.menuItem10.Text = "-";
     865            //
     866            // ctxCalGridReprintApptSlip
     867            //
     868            this.ctxCalGridReprintApptSlip.Index = 10;
     869            this.ctxCalGridReprintApptSlip.Text = "&Reprint Appointment Slip";
     870            this.ctxCalGridReprintApptSlip.Click += new System.EventHandler(this.ctxCalGridReprintApptSlip_Click);
     871            //
     872            // panelBottom
     873            //
     874            this.panelBottom.Controls.Add(this.statusBar1);
     875            this.panelBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
     876            this.panelBottom.Location = new System.Drawing.Point(136, 369);
     877            this.panelBottom.Name = "panelBottom";
     878            this.panelBottom.Size = new System.Drawing.Size(857, 24);
     879            this.panelBottom.TabIndex = 8;
     880            //
     881            // statusBar1
     882            //
     883            this.statusBar1.Dock = System.Windows.Forms.DockStyle.Fill;
     884            this.statusBar1.Location = new System.Drawing.Point(0, 0);
     885            this.statusBar1.Name = "statusBar1";
     886            this.statusBar1.Size = new System.Drawing.Size(857, 24);
     887            this.statusBar1.SizingGrip = false;
     888            this.statusBar1.TabIndex = 0;
     889            //
     890            // splitter1
     891            //
     892            this.splitter1.Location = new System.Drawing.Point(128, 24);
     893            this.splitter1.Name = "splitter1";
     894            this.splitter1.Size = new System.Drawing.Size(8, 369);
     895            this.splitter1.TabIndex = 9;
     896            this.splitter1.TabStop = false;
     897            //
     898            // splitter2
     899            //
     900            this.splitter2.Dock = System.Windows.Forms.DockStyle.Right;
     901            this.splitter2.Location = new System.Drawing.Point(993, 24);
     902            this.splitter2.Name = "splitter2";
     903            this.splitter2.Size = new System.Drawing.Size(3, 369);
     904            this.splitter2.TabIndex = 10;
     905            this.splitter2.TabStop = false;
     906            //
    914907            // CGView
    915908            //
     
    12241217                        ctxCalGridWalkin.Enabled = ctxCalGridAdd.Enabled;
    12251218            //smh new code
    1226             ctxCalGridReprintRoutingSlip.Enabled = ctxCalGridEdit.Enabled;
     1219            ctxCalGridReprintApptSlip.Enabled = ctxCalGridEdit.Enabled;
    12271220                    //end new code
    12281221        }
     
    12651258
    12661259        //new code smh
    1267         private void ctxCalGridReprintRoutingSlip_Click(object sender, EventArgs e)
     1260        private void ctxCalGridReprintApptSlip_Click(object sender, EventArgs e)
    12681261        {
    1269             printRoutingSlip.Print();
     1262            int apptID = this.CGrid.SelectedAppointment;
     1263            if (apptID <= 0) return;
     1264
     1265            CGAppointment a = (CGAppointment) this.Appointments.AppointmentTable[apptID];
     1266           
     1267            PrintDocument pd = new PrintDocument() { DocumentName = "Appointment Slip for Appt " + apptID };  //Autoinit for DocName
     1268            pd.PrintPage += (s, pe) =>  //son of a lambda
     1269            {
     1270                CGDocumentManager.Current.PrintingObject.PrintAppointmentSlip(a, pe);
     1271            };
     1272           
     1273            pd.Print();
    12701274        }
    12711275        //end new code
     
    19962000                //smh new code
    19972001                if (dlgCheckin.PrintRouteSlip)
    1998                     this.printRoutingSlip.Print();
     2002                 //   this.printRoutingSlip.Print();
    19992003                // end new code
    20002004
     
    32473251            int nApptID = this.calendarGrid1.SelectedAppointment;
    32483252            CGAppointment a = (CGAppointment)this.Appointments.AppointmentTable[nApptID];
    3249             ClinicalScheduling.Printing.PrintRoutingSlip(a, "Routing Slip", e);
     3253            CGDocumentManager.Current.PrintingObject.PrintRoutingSlip(a, "Routing Slip", e);
    32503254        }
    32513255
  • Scheduling/trunk/cs/bsdx0200GUISourceCode/CGView.resx

    r1066 r1110  
    136136</value>
    137137  </data>
    138   <metadata name="printRoutingSlip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    139     <value>512, 17</value>
    140   </metadata>
    141138  <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    142139    <value>75</value>
  • Scheduling/trunk/cs/bsdx0200GUISourceCode/ClinicalScheduling.csproj

    r1106 r1110  
    303303    <Compile Include="Options.cs" />
    304304    <Compile Include="Patient.cs" />
    305     <Compile Include="Printing.cs" />
    306305    <Compile Include="UCPatientAppts.cs">
    307306      <SubType>UserControl</SubType>
  • Scheduling/trunk/cs/bsdx0200GUISourceCode/DAppointPage.cs

    r1106 r1110  
    6464        private TextBox txtCountry;
    6565        private CheckBox chkPrint;
     66        private Label label18;
     67        private TextBox txtSex;
    6668        private IContainer components;
    6769
     
    121123            this.txtStreet = new System.Windows.Forms.TextBox();
    122124            this.panel1 = new System.Windows.Forms.Panel();
     125            this.chkPrint = new System.Windows.Forms.CheckBox();
    123126            this.cmdCancel = new System.Windows.Forms.Button();
    124127            this.cmdOK = new System.Windows.Forms.Button();
     
    126129            this.dsPatientApptDisplay2BindingSource = new System.Windows.Forms.BindingSource(this.components);
    127130            this.dsPatientApptDisplay2 = new IndianHealthService.ClinicalScheduling.dsPatientApptDisplay2();
    128             this.chkPrint = new System.Windows.Forms.CheckBox();
     131            this.label18 = new System.Windows.Forms.Label();
     132            this.txtSex = new System.Windows.Forms.TextBox();
    129133            this.tabControl1.SuspendLayout();
    130134            this.tabAppointment.SuspendLayout();
     
    260264            // groupBox1
    261265            //
     266            this.groupBox1.Controls.Add(this.txtSex);
     267            this.groupBox1.Controls.Add(this.label18);
    262268            this.groupBox1.Controls.Add(this.label14);
    263269            this.groupBox1.Controls.Add(this.txtHRN);
     
    277283            // label14
    278284            //
    279             this.label14.Location = new System.Drawing.Point(56, 64);
     285            this.label14.Location = new System.Drawing.Point(50, 64);
    280286            this.label14.Name = "label14";
    281287            this.label14.Size = new System.Drawing.Size(40, 16);
     
    294300            // label6
    295301            //
    296             this.label6.Location = new System.Drawing.Point(224, 40);
     302            this.label6.Location = new System.Drawing.Point(227, 65);
    297303            this.label6.Name = "label6";
    298304            this.label6.Size = new System.Drawing.Size(40, 16);
     
    303309            // txtPID
    304310            //
    305             this.txtPID.Location = new System.Drawing.Point(272, 40);
     311            this.txtPID.Location = new System.Drawing.Point(272, 63);
    306312            this.txtPID.Name = "txtPID";
    307313            this.txtPID.ReadOnly = true;
     
    311317            // label5
    312318            //
    313             this.label5.Location = new System.Drawing.Point(64, 40);
     319            this.label5.Location = new System.Drawing.Point(58, 41);
    314320            this.label5.Name = "label5";
    315321            this.label5.Size = new System.Drawing.Size(32, 16);
     
    328334            // label2
    329335            //
    330             this.label2.Location = new System.Drawing.Point(56, 16);
     336            this.label2.Location = new System.Drawing.Point(50, 16);
    331337            this.label2.Name = "label2";
    332338            this.label2.Size = new System.Drawing.Size(40, 16);
     
    543549            this.panel1.TabIndex = 1;
    544550            //
     551            // chkPrint
     552            //
     553            this.chkPrint.AutoSize = true;
     554            this.chkPrint.Location = new System.Drawing.Point(13, 14);
     555            this.chkPrint.Name = "chkPrint";
     556            this.chkPrint.Size = new System.Drawing.Size(144, 17);
     557            this.chkPrint.TabIndex = 2;
     558            this.chkPrint.Text = "Print Appointment Letter";
     559            this.chkPrint.UseVisualStyleBackColor = true;
     560            //
    545561            // cmdCancel
    546562            //
     
    577593            this.dsPatientApptDisplay2.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
    578594            //
    579             // chkPrint
    580             //
    581             this.chkPrint.AutoSize = true;
    582             this.chkPrint.Location = new System.Drawing.Point(13, 14);
    583             this.chkPrint.Name = "chkPrint";
    584             this.chkPrint.Size = new System.Drawing.Size(144, 17);
    585             this.chkPrint.TabIndex = 2;
    586             this.chkPrint.Text = "Print Appointment Letter";
    587             this.chkPrint.UseVisualStyleBackColor = true;
     595            // label18
     596            //
     597            this.label18.AutoSize = true;
     598            this.label18.Location = new System.Drawing.Point(238, 44);
     599            this.label18.Name = "label18";
     600            this.label18.Size = new System.Drawing.Size(29, 13);
     601            this.label18.TabIndex = 14;
     602            this.label18.Text = "Sex:";
     603            //
     604            // txtSex
     605            //
     606            this.txtSex.BackColor = System.Drawing.SystemColors.Control;
     607            this.txtSex.Location = new System.Drawing.Point(273, 41);
     608            this.txtSex.Name = "txtSex";
     609            this.txtSex.ReadOnly = true;
     610            this.txtSex.Size = new System.Drawing.Size(160, 20);
     611            this.txtSex.TabIndex = 15;
    588612            //
    589613            // DAppointPage
     
    623647
    624648                private string                  m_sPatientName;
     649        private Sex             m_enumPatientSex;
    625650                private string                  m_sPatientHRN;
    626651                private string                  m_sPatientIEN;
     
    674699                                DataRow r = tb.Rows[0];
    675700                                this.m_sPatientName = r["NAME"].ToString();
     701                this.m_enumPatientSex = r["SEX"].ToString() == "MALE" ? Sex.Male : Sex.Female;
    676702                                this.m_sPatientHRN = r["HRN"].ToString();
    677703                                this.m_sPatientIEN = r["IEN"].ToString();
     
    716742                                txtNote.Text = this.m_sNote;
    717743                                txtPatientName.Text = m_sPatientName;
     744                txtSex.Text = m_enumPatientSex.ToString();
    718745                                txtPhoneHome.Text = this.m_sPhoneHome;
    719746                                txtPhoneOffice.Text = this.m_sPhoneOffice;
     
    797824                    DFN = Int32.Parse(m_sPatientIEN),
    798825                    Name = m_sPatientName,
     826                    Sex = m_enumPatientSex,
    799827                    DOB = m_dPatientDOB,
    800828                    ID = m_sPatientPID,
  • Scheduling/trunk/cs/bsdx0200GUISourceCode/DAppointPage.resx

    r1106 r1110  
    124124    <value>179, 17</value>
    125125  </metadata>
     126  <metadata name="dsPatientApptDisplay2BindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     127    <value>179, 17</value>
     128  </metadata>
     129  <metadata name="dsPatientApptDisplay2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     130    <value>17, 17</value>
     131  </metadata>
    126132  <metadata name="dsPatientApptDisplay2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    127133    <value>17, 17</value>
  • Scheduling/trunk/cs/bsdx0200GUISourceCode/DPatientLetter.cs

    r884 r1110  
    302302           
    303303            // _currentResourcePrinting starts with zero. There will be at least this one.
    304             ClinicalScheduling.Printing.PrintAppointments(_dsApptDisplay, e, _dtBegin, _dtEnd,
     304            CGDocumentManager.Current.PrintingObject.PrintAppointments(_dsApptDisplay, e, _dtBegin, _dtEnd,
    305305                    _currentResourcePrinting, ref _currentApptPrinting, _pageNumber);
    306306
     
    332332            if (_dsApptDisplay.PatientAppts.Count == 0)
    333333            {
    334                 ClinicalScheduling.Printing.PrintMessage("No Appointments found", e);
     334                CGDocumentManager.Current.PrintingObject.PrintMessage("No Appointments found", e);
    335335                return;
    336336            }
     
    340340                dsPatientApptDisplay2.BSDXResourceRow c = (dsPatientApptDisplay2.BSDXResourceRow)
    341341                   _dsApptDisplay.PatientAppts[_currentApptPrinting].GetParentRow(_dsApptDisplay.Relations[0]);
    342                 ClinicalScheduling.Printing.PrintReminderLetter(_dsApptDisplay.PatientAppts[_currentApptPrinting], e, c.LETTER_TEXT, "Reminder Letter");
     342                CGDocumentManager.Current.PrintingObject.PrintReminderLetter(_dsApptDisplay.PatientAppts[_currentApptPrinting], e, c.LETTER_TEXT, "Reminder Letter");
    343343                _currentApptPrinting++;
    344344                if (_currentApptPrinting < _dsApptDisplay.PatientAppts.Count)
     
    359359            if (_dsRebookAppts.PatientAppts.Count == 0)
    360360            {
    361                 ClinicalScheduling.Printing.PrintMessage("No Appointments found", e);
     361                CGDocumentManager.Current.PrintingObject.PrintMessage("No Appointments found", e);
    362362                return;
    363363            }
     
    367367                dsRebookAppts.BSDXResourceRow c = (dsRebookAppts.BSDXResourceRow)
    368368                   _dsRebookAppts.PatientAppts[_currentApptPrinting].GetParentRow(_dsRebookAppts.Relations[0]);
    369                 ClinicalScheduling.Printing.PrintCancelLetter(_dsRebookAppts.PatientAppts[_currentApptPrinting], e, c.CLINIC_CANCELLATION_LETTER, "Cancellation Letter");
     369                CGDocumentManager.Current.PrintingObject.PrintCancelLetter(_dsRebookAppts.PatientAppts[_currentApptPrinting], e, c.CLINIC_CANCELLATION_LETTER, "Cancellation Letter");
    370370                _currentApptPrinting++;
    371371                if (_currentApptPrinting < _dsRebookAppts.PatientAppts.Count)
     
    384384            if (_dsRebookAppts.PatientAppts.Count == 0)
    385385            {
    386                 ClinicalScheduling.Printing.PrintMessage("No Appointments found", e);
     386                CGDocumentManager.Current.PrintingObject.PrintMessage("No Appointments found", e);
    387387                return;
    388388            }
     
    393393                   _dsRebookAppts.PatientAppts[_currentApptPrinting].GetParentRow(_dsRebookAppts.Relations[0]);
    394394                //XXX: Rebook letter rather oddly currently stored in NO SHOW LETTER field. What gives???
    395                 ClinicalScheduling.Printing.PrintRebookLetter(_dsRebookAppts.PatientAppts[_currentApptPrinting], e, c.NO_SHOW_LETTER, "Rebook Letter");
     395                CGDocumentManager.Current.PrintingObject.PrintRebookLetter(_dsRebookAppts.PatientAppts[_currentApptPrinting], e, c.NO_SHOW_LETTER, "Rebook Letter");
    396396                _currentApptPrinting++;
    397397                if (_currentApptPrinting < _dsRebookAppts.PatientAppts.Count)
  • Scheduling/trunk/cs/bsdx0200GUISourceCode/Patient.cs

    r1107 r1110  
    66namespace IndianHealthService.ClinicalScheduling
    77{
     8
     9    /// <summary>
     10    /// You guessed it.
     11    /// </summary>
     12    public enum Sex
     13    {
     14        Male, Female
     15    };
     16
    817    /// <summary>
    918    /// Puppet standing for a Real Patient
     
    1322        public int DFN { get; set; }
    1423        public string Name { get; set; }
     24        public Sex Sex;
    1525        public DateTime DOB { get; set; }
    1626        public string ID { get; set; }
     
    2636        public string WorkPHone { get; set; }
    2737        public string CellPhone { get; set; }
     38        public TimeSpan Age
     39        {
     40            get
     41            {
     42                return (DateTime.Today - this.DOB);
     43            }
     44        }
     45
     46        public string UserFriendlyAge
     47        {
     48            get
     49            {
     50                if (Age.TotalDays / 365.24 > 5)
     51                    return Math.Floor((Age.TotalDays / 365.24)).ToString() + " years";
     52                else
     53                    return Math.Floor((Age.TotalDays / 365.24)).ToString() + " years & "
     54                     + Math.Floor(Age.TotalDays % 365.24 / 30).ToString() + " months";
     55            }
     56        }
    2857    }
    2958}
  • Scheduling/trunk/cs/bsdx0200GUISourceCode/Printing.cs

    r900 r1110  
    11using System;
    2 using System.Collections.Generic;
    3 using System.Linq;
    4 using System.Text;
    52using System.Drawing.Printing;
    63using System.Drawing;
     4using System.Text;
     5using System.Drawing.Drawing2D;
     6using System.Linq;
    77using System.Data;
    8 using System.Drawing.Drawing2D;
    98
    109namespace IndianHealthService.ClinicalScheduling
    1110{
    12     /// <summary>
    13     /// Class that encapsulates printing functions in Clinical Scheduling
    14     /// </summary>
    15     public static class Printing
    16     {
     11    public class Printing
     12    {
    1713        /// <summary>
    1814        /// Print Appointments
     
    2622        /// <param name="pageNumber">Current page number</param>
    2723        /// <remarks>beg and end have no effect on operation--they are there for documentation for user only</remarks>
    28         public static void PrintAppointments(dsPatientApptDisplay2 ds, PrintPageEventArgs e, DateTime beg, DateTime end,
    29             int resourceToPrint, ref int apptPrinting, int pageNumber)
     24        public virtual void PrintAppointments(dsPatientApptDisplay2 ds, PrintPageEventArgs e, DateTime beg, DateTime end, int resourceToPrint, ref int apptPrinting, int pageNumber)
    3025        {
    3126            Graphics g = e.Graphics;
     
    122117
    123118        /// <summary>
     119        /// Prints a single appointment slip to give to the patient
     120        /// </summary>
     121        /// <param name="appt">The Appointment to print</param>
     122        /// <param name="e">PrintPageEventArgs from PrintDocument Print handler</param>
     123        public virtual void PrintAppointmentSlip(CGAppointment appt, PrintPageEventArgs e)
     124        {
     125            // Prep
     126            Graphics g = e.Graphics;
     127            Rectangle printArea = e.MarginBounds;
     128            Rectangle pageArea = e.PageBounds;
     129            Rectangle headerArea = new Rectangle()
     130            {
     131                X = e.MarginBounds.X,
     132                Y = e.PageBounds.Y,
     133                Height = e.MarginBounds.Y - e.PageBounds.Y,
     134                Width = e.MarginBounds.Width
     135            };
     136
     137            // A few fonts
     138            Font fTitle = new Font(FontFamily.GenericSerif, 24, FontStyle.Bold); //for title
     139            Font fBody = new Font(FontFamily.GenericSerif, 12);
     140            Font fGroupTitle = new Font(FontFamily.GenericSansSerif, 10, FontStyle.Bold);
     141
     142            StringFormat sf0 = new StringFormat()
     143            {
     144                 Alignment = StringAlignment.Center,
     145                 LineAlignment = StringAlignment.Center
     146            };
     147           
     148            // Draw Header
     149            string division = CGDocumentManager.Current.ConnectInfo.DivisionName;
     150            g.DrawString(division, fBody, Brushes.Black, headerArea, sf0);
     151           
     152            // Draw Title
     153            StringFormat sf = new StringFormat();
     154            sf.Alignment = StringAlignment.Center; //for title & header
     155
     156            string s = "Appointment Reminder Slip";
     157            g.DrawString(s, fTitle, Brushes.Black, printArea, sf); //title
     158
     159            // move down
     160            int titleHeight = (int)g.MeasureString(s, fTitle, printArea.Width).Height;
     161            printArea.Y += titleHeight;
     162            printArea.Height -= titleHeight;
     163
     164            // draw underline
     165            g.DrawLine(Pens.Black, printArea.Location, new Point(printArea.Right, printArea.Y));
     166            printArea.Y += 15;
     167            printArea.Height -= 15;
     168
     169            // draw curved rectangle.
     170            Rectangle personalInfoRectangle = new Rectangle(e.MarginBounds.X, printArea.Y + 30, 280, 300);
     171            using (GraphicsPath path = GetRoundedRectPath(personalInfoRectangle, 10))
     172            {
     173                g.DrawPath(Pens.Black, path);
     174            }
     175
     176            // group header
     177            g.DrawString("Patient Information", fGroupTitle, Brushes.Black, new Point(personalInfoRectangle.X, personalInfoRectangle.Y - 20));
     178           
     179            // inner rectangle for drawing strings:
     180            Rectangle personalInfoInnerRectangle = new Rectangle(personalInfoRectangle.X + 20, personalInfoRectangle.Y + 20, 280 - 40, 300 - 40);
     181           
     182            // Strings to write
     183            StringBuilder sb = new StringBuilder(500);
     184            sb.AppendLine("Name:" + "\t" + appt.Patient.Name);
     185            sb.AppendLine();
     186            sb.AppendLine("ID#:" + "\t" + appt.Patient.ID);
     187            sb.AppendLine();
     188            sb.AppendLine("DOB:" + "\t" + appt.Patient.DOB.ToShortDateString());
     189            sb.AppendLine();
     190            sb.AppendLine("Age:" + "\t" + appt.Patient.UserFriendlyAge);
     191            sb.AppendLine();
     192            sb.AppendLine("Sex:" + "\t" + appt.Patient.Sex.ToString());
     193           
     194            // Draw them
     195            g.DrawString(sb.ToString(), fBody, Brushes.Black, personalInfoInnerRectangle);
     196
     197            // draw curved rectangle
     198            Rectangle apptInfoRectangle = new Rectangle(e.MarginBounds.X + e.MarginBounds.Width - 280, printArea.Y + 30, 280, 300);
     199            using (GraphicsPath path = GetRoundedRectPath(apptInfoRectangle, 10))
     200            {
     201                g.DrawPath(Pens.Black, path);
     202            }
     203
     204            // group header
     205            g.DrawString("Appointment Information", fGroupTitle, Brushes.Black, new Point(apptInfoRectangle.X, apptInfoRectangle.Y - 20));
     206
     207            // Strings to write
     208            sb = new StringBuilder();
     209            sb.AppendLine("Clinic: " + "\t" + appt.Resource);
     210            sb.AppendLine();
     211            sb.AppendLine("Date: " + "\t" + appt.StartTime.ToShortDateString());
     212            sb.AppendLine();
     213            sb.AppendLine("Day: " + "\t" + appt.StartTime.DayOfWeek.ToString());
     214            sb.AppendLine();
     215            sb.AppendLine("Time: " + "\t" + appt.StartTime.ToShortTimeString());
     216
     217            // Draw them
     218            Rectangle apptInfoInnerRectangle = new Rectangle(apptInfoRectangle.X + 20, apptInfoRectangle.Y + 20, 280 - 40, 300 - 40);
     219
     220            // Draw them
     221            g.DrawString(sb.ToString(), fBody, Brushes.Black, apptInfoInnerRectangle);
     222
     223            // Move Drawing Rectangle Down
     224            printArea.Y += 300 + 30 + 20;
     225            printArea.Height -= 300 + 30 + 20;
     226
     227            // Draw New Line
     228            g.DrawLine(Pens.Black, printArea.Location, new Point(printArea.Right, printArea.Y));
     229            printArea.Y += 5;
     230            printArea.Height -= 5;
     231
     232            // Draw new Title
     233            s = "Clinic Instructions";
     234            g.DrawString(s, fTitle, Brushes.Black, printArea, sf); //title
     235
     236            // move down
     237            titleHeight = (int)g.MeasureString(s, fTitle, printArea.Width).Height;
     238            printArea.Y += titleHeight;
     239            printArea.Height -= titleHeight;
     240
     241            // Draw New Line
     242            g.DrawLine(Pens.Black, printArea.Location, new Point(printArea.Right, printArea.Y));
     243            printArea.Y += 15;
     244            printArea.Height -= 15;
     245
     246            // Get Resource Clinic Appointment Letter Text
     247            DataTable resources = CGDocumentManager.Current.GlobalDataSet.Tables["Resources"];
     248
     249            string ltrTxt = (from resource in resources.AsEnumerable()
     250                             where resource.Field<string>("RESOURCE_NAME") == appt.Resource
     251                             select resource.Field<string>("LETTER_TEXT")).SingleOrDefault<string>();
     252
     253            if (String.IsNullOrWhiteSpace(ltrTxt)) ltrTxt = "(no instructions provided)";
     254
     255            g.DrawString(ltrTxt, fBody, Brushes.Black, printArea);
     256
     257            int ltrTxtHeight = (int)g.MeasureString(ltrTxt, fBody).Height;
     258
     259            printArea.Y += ltrTxtHeight + 15;
     260            printArea.Height -= ltrTxtHeight + 15;
     261
     262            g.DrawLine(Pens.Black, printArea.Location, new Point(printArea.Right, printArea.Y));
     263            printArea.Y += 5;
     264            printArea.Height -= 5;
     265
     266            s = "Notes";
     267            g.DrawString(s, fTitle, Brushes.Black, printArea, sf); // Notes title
     268           
     269            // move down
     270            titleHeight = (int)g.MeasureString(s, fTitle, printArea.Width).Height;
     271            printArea.Y += titleHeight;
     272            printArea.Height -= titleHeight;
     273
     274            // Draw New Line
     275            g.DrawLine(Pens.Black, printArea.Location, new Point(printArea.Right, printArea.Y));
     276            printArea.Y += 15;
     277            printArea.Height -= 15;
     278
     279            // Draw Notes Area
     280            using (GraphicsPath path = GetRoundedRectPath(printArea, 15))
     281            {
     282                g.DrawPath(Pens.Black, path);
     283            }
     284
     285            // Draw Footer
     286            // Get footer rectangle
     287            Rectangle footerArea = new Rectangle()
     288            {
     289                X = e.MarginBounds.X,
     290                Y = e.MarginBounds.Height + headerArea.Height,
     291                Width = e.MarginBounds.Width,
     292                Height = pageArea.Height - (e.MarginBounds.Height + headerArea.Height)
     293            };
     294
     295            //use sf0 to print the footer (center all the way)
     296            s = "Printed: " + DateTime.Now.ToString();
     297            Font fFooter = new Font(FontFamily.GenericSerif, 7);
     298            g.DrawString(s, fFooter, Brushes.Black, footerArea, sf0);
     299
     300        }
     301
     302
     303        private GraphicsPath GetRoundedRectPath(Rectangle rect, int radius)
     304        {
     305            int diameter = 2 * radius;
     306           
     307            Rectangle arcRect = new Rectangle(rect.Location, new Size(diameter, diameter));
     308            GraphicsPath path = new GraphicsPath();
     309           
     310            path.AddArc(arcRect, 180, 90); //top left
     311            arcRect.X = rect.Right - diameter;
     312            path.AddArc(arcRect, 270, 90); // top right
     313            arcRect.Y = rect.Bottom - diameter;
     314            path.AddArc(arcRect, 0, 90); // bottom right
     315            arcRect.X = rect.Left;
     316            path.AddArc(arcRect, 90, 90); // bottom left
     317
     318            path.CloseFigure();
     319
     320            return path;
     321        }
     322
     323        /// <summary>
    124324        /// Print Letter to be given or mailed to the patient
    125325        /// </summary>
     
    128328        /// <param name="letter">Contains letter string</param>
    129329        /// <param name="title">Title of the letter</param>
    130         public static void PrintReminderLetter(dsPatientApptDisplay2.PatientApptsRow ptRow, PrintPageEventArgs e, string letter, string title)
     330        public virtual void PrintReminderLetter(dsPatientApptDisplay2.PatientApptsRow ptRow, PrintPageEventArgs e, string letter, string title)
    131331        {
    132332
     
    177377            g.DrawString(address.ToString(), fBody, Brushes.Black, printArea, sf);
    178378        }
    179 
     379       
    180380        /// <summary>
    181381        /// Cancellation Letter to be given or mailed to the patient
     
    185385        /// <param name="letter">Contains letter string</param>
    186386        /// <param name="title">Title of the letter</param>
    187         public static void PrintCancelLetter(dsRebookAppts.PatientApptsRow ptRow, PrintPageEventArgs e, string letter, string title)
     387        public virtual void PrintCancelLetter(dsRebookAppts.PatientApptsRow ptRow, PrintPageEventArgs e, string letter, string title)
    188388        {
    189389            Rectangle printArea = e.MarginBounds;
     
    241441        /// <param name="letter">Text of the letter to print</param>
    242442        /// <param name="title">Title to print at the top of the letter</param>
    243         public static void PrintRebookLetter(dsRebookAppts.PatientApptsRow ptRow, PrintPageEventArgs e, string letter, string title)
     443        public virtual void PrintRebookLetter(dsRebookAppts.PatientApptsRow ptRow, PrintPageEventArgs e, string letter, string title)
    244444        {
    245445            Rectangle printArea = e.MarginBounds;
     
    298498        /// <param name="msg">The exact string to print.</param>
    299499        /// <param name="e">Print Page event args</param>
    300         public static void PrintMessage(string msg, PrintPageEventArgs e)
     500        public virtual void PrintMessage(string msg, PrintPageEventArgs e)
    301501        {
    302502            e.Graphics.DrawString(msg, new Font(FontFamily.GenericSerif, 14),
     
    310510        /// <param name="title">String to print for title</param>
    311511        /// <param name="e">etc</param>
    312         public static void PrintRoutingSlip(CGAppointment a, string title, PrintPageEventArgs e)
     512        public virtual void PrintRoutingSlip(CGAppointment a, string title, PrintPageEventArgs e)
    313513        {
    314514            Rectangle printArea = e.MarginBounds;
     
    354554            Font fFooter = new Font(FontFamily.GenericSerif, 8);
    355555            g.DrawString("Printed: " + DateTime.Now, fFooter, Brushes.Black, printArea, sf2);
    356 
    357         }
     556        }
     557
    358558    }
     559    public abstract class PrintingCreator
     560    {
     561        public abstract Printing PrintFactory();
     562    }
     563
    359564}
Note: See TracChangeset for help on using the changeset viewer.