fPatientsNew.frm

 VERSION 5.00
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form fPatientsNew
   AutoRedraw      =   -1  'True
   Caption         =   "Pacient Nou"
   ClientHeight    =   8205
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   10800
   Icon            =   "fPatientsNew.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   ScaleHeight     =   8205
   ScaleWidth      =   10800
   StartUpPosition =   2  'CenterScreen
   Begin VB.Frame Frame1
      Height          =   8115
      Left            =   75
      TabIndex        =   0
      Top             =   0
      Width           =   10665
      Begin VB.CommandButton cmdSave
         Caption         =   "&Salveaza"
         Default         =   -1  'True
         Height          =   315
         Left            =   7350
         TabIndex        =   55
         Top             =   7650
         Width           =   1440
      End
      Begin VB.CommandButton cmdClose
         Cancel          =   -1  'True
         Caption         =   "&Inchide"
         Height          =   315
         Left            =   8925
         TabIndex        =   54
         Top             =   7650
         Width           =   1440
      End
      Begin TabDlg.SSTab sstPatient
         Height          =   7365
         Left            =   75
         TabIndex        =   1
         Top             =   150
         Width           =   10515
         _ExtentX        =   18547
         _ExtentY        =   12991
         _Version        =   393216
         Style           =   1
         Tabs            =   2
         TabsPerRow      =   2
         TabHeight       =   520
         TabCaption(0)   =   "Date Personale"
         TabPicture(0)   =   "fPatientsNew.frx":08CA
         Tab(0).ControlEnabled=   -1  'True
         Tab(0).Control(0)=   "Frame2"
         Tab(0).Control(0).Enabled=   0   'False
         Tab(0).ControlCount=   1
         TabCaption(1)   =   "Antecedente"
         TabPicture(1)   =   "fPatientsNew.frx":08E6
         Tab(1).ControlEnabled=   0   'False
         Tab(1).Control(0)=   "Frame3"
         Tab(1).ControlCount=   1
         Begin VB.Frame Frame3
            Height          =   6840
            Left            =   -74850
            TabIndex        =   47
            Top             =   375
            Width           =   10215
            Begin VB.TextBox txtAntecedentsPP
               Height          =   1995
               Left            =   150
               MaxLength       =   1024
               MultiLine       =   -1  'True
               TabIndex        =   50
               Top             =   4710
               Width           =   9840
            End
            Begin VB.TextBox txtAntecedentsPF
               Height          =   1920
               Left            =   150
               MaxLength       =   1024
               MultiLine       =   -1  'True
               TabIndex        =   49
               Top             =   2445
               Width           =   9840
            End
            Begin VB.TextBox txtAntecedentsHC
               Height          =   1695
               Left            =   150
               MaxLength       =   1024
               MultiLine       =   -1  'True
               TabIndex        =   48
               Top             =   465
               Width           =   9840
            End
            Begin VB.Label lblHC
               Caption         =   "Heredo-Coaterale"
               Height          =   255
               Left            =   165
               TabIndex        =   53
               Top             =   225
               Width           =   2415
            End
            Begin VB.Label lblPF
               Caption         =   "Fiziolgice"
               Height          =   255
               Left            =   165
               TabIndex        =   52
               Top             =   2220
               Width           =   1335
            End
            Begin VB.Label lblPP
               Caption         =   "Patologice"
               Height          =   255
               Left            =   165
               TabIndex        =   51
               Top             =   4440
               Width           =   1335
            End
         End
         Begin VB.Frame Frame2
            Height          =   6840
            Left            =   150
            TabIndex        =   2
            Top             =   375
            Width           =   10215
            Begin VB.TextBox txtRegistrationID
               Height          =   315
               Left            =   1800
               TabIndex        =   21
               Top             =   5925
               Width           =   1665
            End
            Begin VB.ComboBox cboCounty
               Height          =   315
               Left            =   6435
               TabIndex        =   20
               Top             =   2895
               Width           =   855
            End
            Begin VB.TextBox txtPostalCode
               Height          =   285
               Left            =   8385
               TabIndex        =   19
               Top             =   2895
               Width           =   1680
            End
            Begin VB.TextBox txtCity
               Height          =   285
               Left            =   6435
               TabIndex        =   18
               Top             =   2550
               Width           =   3630
            End
            Begin VB.TextBox txtAddress
               Height          =   285
               Left            =   6435
               TabIndex        =   17
               Top             =   2190
               Width           =   3630
            End
            Begin VB.ComboBox cboPlaceOfBirthCounty
               Height          =   315
               Left            =   6510
               TabIndex        =   16
               Top             =   1080
               Width           =   855
            End
            Begin VB.TextBox txtPlaceOfBirthCity
               Height          =   285
               Left            =   6510
               TabIndex        =   15
               Top             =   675
               Width           =   3255
            End
            Begin VB.ComboBox cboBloodType
               Height          =   315
               ItemData        =   "fPatientsNew.frx":0902
               Left            =   1725
               List            =   "fPatientsNew.frx":0904
               TabIndex        =   14
               Top             =   3225
               Width           =   1080
            End
            Begin VB.TextBox txtEmployer
               Height          =   285
               Left            =   1755
               TabIndex        =   13
               Top             =   4485
               Width           =   3600
            End
            Begin VB.TextBox txtJobTitle
               Height          =   285
               Left            =   1755
               TabIndex        =   12
               Top             =   4110
               Width           =   3600
            End
            Begin VB.TextBox txtCardID
               Height          =   285
               Left            =   1725
               TabIndex        =   11
               Top             =   2850
               Width           =   3330
            End
            Begin VB.ComboBox cboSex
               Height          =   315
               Left            =   3930
               TabIndex        =   10
               Top             =   3225
               Width           =   615
            End
            Begin VB.TextBox txtAge
               Enabled         =   0   'False
               Height          =   285
               Left            =   1725
               Locked          =   -1  'True
               TabIndex        =   9
               TabStop         =   0   'False
               ToolTipText     =   "Se calculeaza automat in functie de Data Nasterii"
               Top             =   1395
               Width           =   1080
            End
            Begin VB.TextBox txtLastName
               BeginProperty Font
                  Name            =   "Arial"
                  Size            =   8.25
                  Charset         =   238
                  Weight          =   700
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Height          =   315
               Left            =   1725
               MaxLength       =   50
               TabIndex        =   8
               Top             =   315
               Width           =   3330
            End
            Begin VB.TextBox txtCNP
               Height          =   285
               Left            =   1725
               MaxLength       =   13
               TabIndex        =   7
               Top             =   1800
               Width           =   3330
            End
            Begin VB.TextBox txtMotherName
               Height          =   285
               Left            =   1725
               TabIndex        =   6
               Top             =   2490
               Width           =   3330
            End
            Begin VB.TextBox txtFatherName
               Height          =   285
               Left            =   1725
               TabIndex        =   5
               Top             =   2130
               Width           =   3330
            End
            Begin VB.TextBox txtPreviousLastName
               Height          =   285
               Left            =   1725
               Locked          =   -1  'True
               MaxLength       =   50
               TabIndex        =   4
               TabStop         =   0   'False
               Top             =   1035
               Width           =   3330
            End
            Begin VB.TextBox txtFirstName
               BeginProperty Font
                  Name            =   "Arial"
                  Size            =   8.25
                  Charset         =   238
                  Weight          =   700
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Height          =   315
               Left            =   1725
               MaxLength       =   50
               TabIndex        =   3
               Top             =   675
               Width           =   3330
            End
            Begin MSComCtl2.DTPicker dtRegistrationDate
               Height          =   315
               Left            =   1800
               TabIndex        =   22
               Top             =   6300
               Width           =   1440
               _ExtentX        =   2540
               _ExtentY        =   556
               _Version        =   393216
               Format          =   157089793
               CurrentDate     =   37531
            End
            Begin MSComCtl2.DTPicker dtDateOfBirth
               Height          =   315
               Left            =   6525
               TabIndex        =   23
               Top             =   300
               Width           =   1365
               _ExtentX        =   2408
               _ExtentY        =   556
               _Version        =   393216
               Format          =   157089793
               CurrentDate     =   37530
            End
            Begin VB.Label lblRegistrationID
               Caption         =   "Fisa"
               Height          =   240
               Left            =   225
               TabIndex        =   46
               Top             =   6000
               Width           =   1590
            End
            Begin VB.Label lblRegistrationDate
               Caption         =   "Data Inregistrarii"
               Height          =   240
               Left            =   225
               TabIndex        =   45
               Top             =   6375
               Width           =   1515
            End
            Begin VB.Label lblLocation
               Caption         =   "Domiciliul Stabil:"
               Height          =   240
               Left            =   5400
               TabIndex        =   44
               Top             =   1875
               Width           =   2565
            End
            Begin VB.Label lblJob
               Caption         =   "Loc Munca:"
               Height          =   240
               Left            =   225
               TabIndex        =   43
               Top             =   3825
               Width           =   2340
            End
            Begin VB.Label lblSex
               Caption         =   "Sex"
               Height          =   240
               Left            =   3075
               TabIndex        =   42
               Top             =   3225
               Width           =   765
            End
            Begin VB.Label lblPostalCode
               Caption         =   "Cod Postal"
               Height          =   255
               Left            =   7485
               TabIndex        =   41
               Top             =   2940
               Width           =   915
            End
            Begin VB.Label lblCounty
               Caption         =   "Judetul"
               Height          =   375
               Left            =   5400
               TabIndex        =   40
               Top             =   2895
               Width           =   1215
            End
            Begin VB.Label lblCity
               Caption         =   "Localitatea"
               Height          =   255
               Left            =   5400
               TabIndex        =   39
               Top             =   2535
               Width           =   1215
            End
            Begin VB.Label lblAddress
               Caption         =   "Adresa"
               Height          =   255
               Left            =   5400
               TabIndex        =   38
               Top             =   2175
               Width           =   960
            End
            Begin VB.Label lblPlaceofBirthCounty
               Caption         =   "Judetul"
               Height          =   255
               Left            =   5400
               TabIndex        =   37
               Top             =   1080
               Width           =   1215
            End
            Begin VB.Label lblPlaceofBirthCity
               Caption         =   "Localitatea"
               Height          =   255
               Left            =   5400
               TabIndex        =   36
               Top             =   720
               Width           =   1215
            End
            Begin VB.Label lblDateofBirth
               Caption         =   "Data Nasterii"
               Height          =   255
               Left            =   5400
               TabIndex        =   35
               Top             =   360
               Width           =   1080
            End
            Begin VB.Label lblEmployer
               Caption         =   "Loc Munca"
               Height          =   255
               Left            =   225
               TabIndex        =   34
               Top             =   4500
               Width           =   1455
            End
            Begin VB.Label lblJobTitle
               Caption         =   "Ocupatia"
               Height          =   255
               Left            =   225
               TabIndex        =   33
               Top             =   4140
               Width           =   1335
            End
            Begin VB.Label lblBloodType
               Caption         =   "Grupa Sanguina"
               Height          =   255
               Left            =   225
               TabIndex        =   32
               Top             =   3225
               Width           =   1335
            End
            Begin VB.Label lblCardID
               Caption         =   "Buletin Identitate"
               Height          =   255
               Left            =   225
               TabIndex        =   31
               Top             =   2865
               Width           =   1335
            End
            Begin VB.Label lblAge
               Caption         =   "Varsta"
               Height          =   240
               Left            =   225
               TabIndex        =   30
               Top             =   1365
               Width           =   1140
            End
            Begin VB.Label lblCNP
               Caption         =   "CNP"
               Height          =   255
               Left            =   240
               TabIndex        =   29
               Top             =   1755
               Width           =   1455
            End
            Begin VB.Label lblMotherName
               Caption         =   "Nume Mama"
               Height          =   255
               Left            =   240
               TabIndex        =   28
               Top             =   2475
               Width           =   1335
            End
            Begin VB.Label lblFatherName
               Caption         =   "Nume Tata"
               Height          =   255
               Left            =   240
               TabIndex        =   27
               Top             =   2115
               Width           =   1455
            End
            Begin VB.Label lblPreviousName
               Caption         =   "Nume Anterior"
               Height          =   255
               Left            =   240
               TabIndex        =   26
               Top             =   1050
               Width           =   1335
            End
            Begin VB.Label lblFirstName
               Caption         =   "Prenume"
               Height          =   255
               Left            =   240
               TabIndex        =   25
               Top             =   660
               Width           =   1455
            End
            Begin VB.Label lblLastName
               Caption         =   "Nume"
               Height          =   255
               Left            =   240
               TabIndex        =   24
               Top             =   300
               Width           =   1215
            End
         End
      End
   End
End
Attribute VB_Name = "fPatientsNew"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private oPatient As CPatient
Private rsPatient As ADODB.Recordset
Private blnFirstSave As Boolean

Private Sub SetLayoutForm()

    Me.Width = 10920
    Me.Height = 8610
   
End Sub



Private Sub cboCounty_KeyPress(KeyAscii As Integer)
    KeyAscii = 0
End Sub

Private Sub cboPlaceOfBirthCounty_KeyPress(KeyAscii As Integer)
    KeyAscii = 0
End Sub


Private Sub cboSex_KeyPress(KeyAscii As Integer)
    KeyAscii = 0
End Sub

Private Sub cmdClose_Click()

    Unload Me
   
End Sub

Private Sub cmdSave_Click()
    strMessage = oMessage.GetMessage(Get_Module_ID(Me.Name), "cmdSave_Confirmation", oLanguage.Language_Index)
    If MsgBox(strMessage, vbYesNo + vbQuestion, "MedCare") = vbYes Then
        If CheckFields Then
            Call RefreshRS
            If oPatient.Save(rsPatient) Then
                If oPatient.IsNew Then
                    oPatient.IsNew = False
                    txtCNP.Enabled = False
                End If
                strMessage = oMessage.GetMessage(Get_Module_ID(Me.Name), "cmdSave_Yes", oLanguage.Language_Index)
                MsgBox strMessage, vbInformation, "MedCare"
            Else
                strMessage = oMessage.GetMessage(Get_Module_ID(Me.Name), "cmdSave_No", oLanguage.Language_Index)
                MsgBox strMessage, vbInformation, "MedCare"
            End If
        End If
    End If

End Sub
Private Function CheckFirstLastName() As Boolean
    If txtFirstName.Text = "" Or txtLastName = "" Then
        strMessage = oMessage.GetMessage(Get_Module_ID(Me.Name), "CheckFirstLastName", oLanguage.Language_Index)
        MsgBox strMessage, vbInformation, "MedCare"
        CheckFirstLastName = False
        Exit Function
    End If
    CheckFirstLastName = True
End Function

Private Function CheckIsNumericCNP() As Boolean
    If Not IsNumeric(txtCNP.Text) Then
        strMessage = oMessage.GetMessage(Get_Module_ID(Me.Name), "CheckIsNumericCNP", oLanguage.Language_Index)
        MsgBox strMessage, vbInformation, "MedCare"
        CheckIsNumericCNP = False
        txtCNP.SetFocus
        Exit Function
    End If
    CheckIsNumericCNP = True
End Function

Private Function CheckLenCNP() As Boolean
    If Len(txtCNP.Text) <> 13 Then
        strMessage = oMessage.GetMessage(Get_Module_ID(Me.Name), "CheckLenCNP", oLanguage.Language_Index)
        MsgBox strMessage, vbInformation, "MedCare"
        CheckLenCNP = False
        txtCNP.SetFocus
        Exit Function
    End If
    CheckLenCNP = True
End Function

Private Function CheckComboSexNull() As Boolean
    If cboSex.Text <> "M" And cboSex.Text <> "F" Then
        strMessage = oMessage.GetMessage(Get_Module_ID(Me.Name), "CheckComboSexNull", oLanguage.Language_Index)
        MsgBox strMessage, vbInformation, "MedCare"
        CheckComboSexNull = False
        cboSex.SetFocus
        Exit Function
    End If
    CheckComboSexNull = True
End Function

Private Function CheckRegistrationIDisNull() As Boolean
    If txtRegistrationID.Text = "" Then
        strMessage = oMessage.GetMessage(Get_Module_ID(Me.Name), "CheckRegistrationIDisNull", oLanguage.Language_Index)
        MsgBox strMessage, vbInformation, "MedCare"
        CheckRegistrationIDisNull = False
        txtRegistrationID.SetFocus
        Exit Function
    End If
    CheckRegistrationIDisNull = True
End Function

Private Function CheckFields() As Boolean

    If Not CheckFirstLastName Then
        CheckFields = False
        Exit Function
    End If
   
    If Not CheckIsNumericCNP Then
        CheckFields = False
        Exit Function
    End If
   
    If Not CheckLenCNP Then
        CheckFields = False
        Exit Function
    End If
   
    If Not CheckComboSexNull Then
        CheckFields = False
        Exit Function
    End If
   
    If Not CheckRegistrationIDisNull Then
        CheckFields = False
        Exit Function
    End If
   
    If Not CheckDuplicateCNP Then
        CheckFields = False
        Exit Function
    End If
   
    If Not CheckDuplicateRegistrationID Then
        CheckFields = False
        Exit Function
    End If
   
    CheckFields = True
   
End Function

Private Function CheckDuplicateCNP() As Boolean
    If oPatient.CheckDuplicateCNP(txtCNP.Text) And oPatient.IsNew = True Then
        strMessage = oMessage.GetMessage(Get_Module_ID(Me.Name), "CheckDuplicateCNP", oLanguage.Language_Index)
        MsgBox strMessage, vbInformation, "MedCare"
        CheckDuplicateCNP = False
        txtCNP.SetFocus
        Exit Function
    End If
    CheckDuplicateCNP = True
End Function

Private Function CheckDuplicateRegistrationID() As Boolean
    If oPatient.CheckDuplicateRegistrationID(txtRegistrationID.Text, "") And oPatient.IsNew = True Then
        strMessage = oMessage.GetMessage(Get_Module_ID(Me.Name), "CheckDuplicateRegistrationID", oLanguage.Language_Index)
        MsgBox strMessage, vbInformation, "MedCare"
        CheckDuplicateRegistrationID = False
        txtRegistrationID.SetFocus
        Exit Function
    End If
    CheckDuplicateRegistrationID = True
End Function

Private Sub RefreshRS()

    With rsPatient
        !CNP = Trim(txtCNP.Text)
        !FirstName = Trim(txtFirstName.Text)
        !LastName = Trim(txtLastName.Text)
        !RegistrationID = Trim(txtRegistrationID.Text)
        !RegistrationDate = ConvertDate2String(dtRegistrationDate.Value)
        !PreviousLastName = Trim(txtPreviousLastName.Text)
        !FatherName = Trim(txtFatherName.Text)
        !MotherName = Trim(txtMotherName.Text)
        !DateOfBirth = ConvertDate2String(dtDateOfBirth.Value)
        !PlaceOfBirthCity = Trim(txtPlaceOfBirthCity.Text)
        !PlaceOfBirthCounty = cboPlaceOfBirthCounty.Text
        !Address = Trim(txtAddress.Text)
        !City = Trim(txtCity.Text)
        !County = cboCounty.Text
        !PostalCode = Trim(txtPostalCode.Text)
        !CardID = Trim(txtCardID.Text)
        !BloodType = cboBloodType.Text
        !Sex = cboSex.Text
        !JobTitle = Trim(txtJobTitle.Text)
        !Employer = Trim(txtEmployer.Text)
        !AntecedentsHC = Trim(txtAntecedentsHC.Text)
        !AntecedentsPF = Trim(txtAntecedentsPF.Text)
        !AntecedentsPP = Trim(txtAntecedentsPP.Text)
        .Update
    End With
       
End Sub


Private Sub Form_Load()

    Call SetLayoutForm
    Call SetControlsCaption(Me)
    Call LoadCombos
    Call SetPickerControls
    Set oPatient = New CPatient
    Set rsPatient = oPatient.GetNew
    oPatient.IsNew = True
    Call SetTabStart
   
End Sub

Private Sub SetTabStart()
    Me.sstPatient.Tab = 0
End Sub

Private Sub SetPickerControls()

    dtDateOfBirth.Value = FormatDateTime(Now(), vbShortDate)
    dtRegistrationDate.Value = FormatDateTime(Now(), vbShortDate)
   
End Sub

Private Sub LoadCombos()

    Dim i As Integer
   
    With cboCounty
        .Clear
        For i = 0 To 41
            .AddItem strCounty(i)
        Next
    End With
   
    With cboPlaceOfBirthCounty
        .Clear
        For i = 0 To 41
            .AddItem strCounty(i)
        Next
    End With
   
    With cboBloodType
        .Clear
        For i = 0 To 3
            .AddItem strBlood(i)
        Next
    End With
   
    With cboSex
        .Clear
        .AddItem strSex(0)
        .AddItem strSex(1)
    End With
   
End Sub

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

    rsPatient.Close
    Set rsPatient = Nothing
    Set oPatient = Nothing
   
End Sub

Project Homepage: