fConsultationsPatientHistory.frm

 VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form fConsultationsPatientHistory
   Caption         =   "Istoric Consultatii Pacient"
   ClientHeight    =   8505
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   12045
   Icon            =   "fConsultationsPatientHistory.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   ScaleHeight     =   8505
   ScaleWidth      =   12045
   Begin VB.Frame Frame1
      Height          =   8340
      Left            =   75
      TabIndex        =   0
      Top             =   75
      Width           =   11865
      Begin VB.CommandButton cmdPrint
         Caption         =   "&Tipareste"
         Height          =   315
         Left            =   8250
         TabIndex        =   9
         Top             =   7725
         Width           =   1440
      End
      Begin VB.CommandButton cmdViewConsultationDetails
         Caption         =   "&Detalii Consult"
         Height          =   315
         Left            =   6675
         TabIndex        =   8
         Top             =   7725
         Width           =   1440
      End
      Begin VB.CommandButton cmdClose
         Cancel          =   -1  'True
         Caption         =   "&Inchide"
         Height          =   315
         Left            =   10200
         TabIndex        =   7
         Top             =   7725
         Width           =   1440
      End
      Begin VB.CommandButton cmdViewConsultations
         Caption         =   "&Vezi Consultatii"
         Default         =   -1  'True
         Height          =   315
         Left            =   4875
         TabIndex        =   6
         Top             =   7725
         Width           =   1665
      End
      Begin MSComCtl2.DTPicker dtDateTo
         Height          =   315
         Left            =   3300
         TabIndex        =   5
         Top             =   7725
         Width           =   1365
         _ExtentX        =   2408
         _ExtentY        =   556
         _Version        =   393216
         Format          =   22806529
         CurrentDate     =   37534
      End
      Begin MSComCtl2.DTPicker dtDateFrom
         Height          =   315
         Left            =   825
         TabIndex        =   2
         Top             =   7725
         Width           =   1365
         _ExtentX        =   2408
         _ExtentY        =   556
         _Version        =   393216
         Format          =   22806529
         CurrentDate     =   37534
      End
      Begin MSComctlLib.ListView lstConsultations
         Height          =   7290
         Left            =   75
         TabIndex        =   1
         Top             =   225
         Width           =   11640
         _ExtentX        =   20532
         _ExtentY        =   12859
         MultiSelect     =   -1  'True
         LabelWrap       =   -1  'True
         HideSelection   =   0   'False
         AllowReorder    =   -1  'True
         FullRowSelect   =   -1  'True
         GridLines       =   -1  'True
         HoverSelection  =   -1  'True
         _Version        =   393217
         ForeColor       =   -2147483640
         BackColor       =   -2147483643
         BorderStyle     =   1
         Appearance      =   1
         NumItems        =   0
      End
      Begin VB.Label lblDateTo
         Caption         =   "Pana La"
         Height          =   240
         Left            =   2550
         TabIndex        =   4
         Top             =   7800
         Width           =   690
      End
      Begin VB.Label lblDateFrom
         Caption         =   "De la:"
         Height          =   240
         Left            =   150
         TabIndex        =   3
         Top             =   7800
         Width           =   990
      End
   End
End
Attribute VB_Name = "fConsultationsPatientHistory"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private m_strCNP As String
Private oConsultationHistory As CConsultationPatientHistory
Private rsConsultations As ADODB.Recordset

Public Property Get CNP() As String
    CNP = m_strCNP
End Property

Public Property Let CNP(ByVal vNewValue As String)
    m_strCNP = vNewValue
End Property

Private Sub cmdClose_Click()

    Unload Me
   
End Sub

Private Sub cmdViewConsultations_Click()

    If Not rsConsultations Is Nothing Then
        rsConsultations.Close
        Set rsConsultations = Nothing
    End If
    Set rsConsultations = New ADODB.Recordset
    If oConsultationHistory.GetConsultations(dtDateFrom.Value, dtDateTo.Value, rsConsultations) Then
        Call LoadListView(rsConsultations)
    Else
        Call ClearListView
    End If
   
End Sub


Private Sub LoadListView(ByVal rs As ADODB.Recordset)
    ' Declare a variable to add ListItem objects.
    Dim itmX As ListItem
   
    'clear the List View
    lstConsultations.ListItems.Clear

    ' While the record is not the last record,
    ' add a ListItem object.

    While Not rs.EOF
        Set itmX = lstConsultations.ListItems. _
        Add(, , CStr(rs!ID))   ' consult ID

        itmX.SubItems(1) = CStr(FormatDateTime(rs!consult_date, vbShortDate))
       
        If Not IsNull(rs!Diagnostic) Then
            itmX.SubItems(2) = CStr(rs!Diagnostic)
        End If
        If Not IsNull(rs!Disease_Code) Then
            itmX.SubItems(3) = CStr(rs!Disease_Code)
        End If
        If Not IsNull(rs!Treatment) Then
            itmX.SubItems(4) = CStr(rs!Treatment)
        End If
       
        rs.MoveNext   ' Move to next record.
    Wend


End Sub

Private Sub ClearListView()

    ' Declare a variable to add ListItem objects.
    Dim itmX As ListItem
   
    'clear the List View
    lstConsultations.ListItems.Clear
   
End Sub

Private Sub Form_Load()

    Call SetLayoutForm
    Set oConsultationHistory = colConsultationsPatientHistory.Add(m_strCNP)
    oConsultationHistory.CNP = m_strCNP
    Call SetFormCaption(m_strCNP)
    Call LoadHeaderList
    Call SetControlsCaption(Me)
   
End Sub

Private Sub SetFormCaption(ByVal strCNP As String)
   
    Me.Caption = "Istoric Consultatii: " & GetPatientFullName(strCNP)
   
End Sub

Private Sub LoadHeaderList()

    ' Add ColumnHeaders. The width of the columns is
    ' the width of the control divided by the number of
    ' ColumnHeader objects.
    lstConsultations.ColumnHeaders. _
    Add , , "ID", 0
    lstConsultations.ColumnHeaders. _
    Add , , "Data Consult", lstConsultations.Width / 7
    lstConsultations.ColumnHeaders. _
    Add , , "Diagnostic", 2 * (lstConsultations.Width) / 7
    lstConsultations.ColumnHeaders. _
    Add , , "Cod Boala", lstConsultations.Width / 7
    lstConsultations.ColumnHeaders. _
    Add , , "Tratament", 3 * (lstConsultations.Width) / 7
    ' Set View property to Report.
    lstConsultations.View = lvwReport
   
End Sub

Private Sub SetLayoutForm()

    Me.Width = 12165
    Me.Height = 8910
   
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)

    colConsultationsPatientHistory.Remove (m_strCNP)
    Set oConsultationHistory = Nothing
    Set rsConsultations = Nothing
   
End Sub

Private Sub lstConsultations_BeforeLabelEdit(Cancel As Integer)
    Cancel = True
End Sub

Project Homepage: