Attribute VB_Name = "modMain" Option Explicit Public MyclsRegistreation As clsRegistration Public blnLoadSearcher As Boolean Public IsInitialized As Boolean Public pclsUser As Object Public clsMEDSYS As Object Public objWebCam As Object Global Searcher As Object Public pclsCodeSearch As Object Global PatientSearch As Object '--for validation Public pstrEmployeeID As String Public pstrEmployeePassword As String Global gbMasterFileRegistrationOnly As Boolean Global isAllowChargeChangeAmount As Boolean Global isAllowRegisterInpatient As Boolean Global IsAllowOPDCheckLabSection As Boolean Global IsAllowOPDAssessmentRateG As Boolean Global IsAllowJonelta As Boolean Global isAllowOPDSearchBarangay As Boolean Global IsAllowOPDSearchCardNumber As Boolean Global IsAllowOPDMABRate As Boolean Global isWalkinValidate As Boolean Global IsAllowOPDUpdateHMOLOA As Boolean Global IsAllowOPDExportReport As Boolean Global IsAllowOPDSearchDocBySched As Boolean Global IsAllowOPDPatientClass As Boolean Global IsAllowOPDShowDiscount As Boolean Global isAllowOPDPayCode As Boolean Global isAllowHomeService As Boolean Global isAllowEndConsultation As Boolean Global isAllowOPFileNumbering As Boolean Public pblnBottonClick As Boolean Public pdCurDate As Date Global isHMORate As Boolean Global isOPDStatRate As Boolean Global IsShowLabSpecimen As Boolean Global isAllowMultipleRequest As Boolean Global gbAutoDoctorAssignment As Boolean '-----Avoid double registration----' Global isAllowCreateNewIDnum As Boolean Global blnIsAutoSearch As Boolean Global strMasterLastName As String '-----For specialized rate -----' Global isAllowSpecializedCompanyRate As Boolean Global strOtherRevenueID As String Global isAllowAssessmentDiscount As Boolean Public strRoomclass As String Global strAdmDate As String Global strDsdate As String Global strRoom As String Global FSO As Object Public ChildCount As Integer Public strHospPlan As String Public pstrClientName As String Global rec As New ADODB.Recordset Public NewPatientSelected As Boolean Public HospNumSelected As String Global strFormElips As String Global strFormName As String Global strFormType As String Global strEvent As String Public ProgEXEPath As String Public ProgEXEName As String Public intPediaAgeLimit As String Public pclsICD As Object 'Public prjOPDRegistration As Object Public Sub InitClass() If IsInitialized = True Then Exit Sub End If Set FSO = CreateObject("Scripting.FileSystemObject") Set objWebCam = CreateObject("prjMedSysWebCam.ClsMedSysWebCam") objWebCam.SetMedsysUser pclsUser Set clsMEDSYS = CreateObject("MEDSYSClasses.clsMEDSYS") clsMEDSYS.MedsysUser = pclsUser Set Searcher = CreateObject("CodeSearchForm.clsCodeSearch") Set pclsCodeSearch = CreateObject("CodeSearchForm.clsCodeSearch") pclsCodeSearch.SearchMode = True pclsCodeSearch.Initialize_Classes pclsCodeSearch.Connection = pclsUser.SQLConnection pclsCodeSearch.CompanyName = pclsUser.CompanyName Set PatientSearch = CreateObject("MasterSearch.clsPatientSearch") Set pclsICD = CreateObject("ICD10.ICDCodeSearch", "") If PatientSearch.InitConnection(pclsUser.SQLConnection, "") Then End If ' Set prjOPDRegistration = CreateObject("clsOPDMain.modFunctions") pstrEmployeeID = pclsUser.EmployeeCode '--added 5/28/2012 pstrEmployeePassword = pclsUser.Password InitOptions IsInitialized = True End Sub Public Sub InitOptions() Dim rec As New ADODB.Recordset Dim SQL As String SQL = "Select top 1 isnull(ClientName,'') as ClientName, isnull(IsHMORate,0) isHMORate, isnull(IsOPDstatRate,0) IsOPDstatRate, " & _ "isnull(IsAllowOPDShowLabSpecimen,0) IsAllowOPDShowLabSpecimen, isnull(IsAllowOPDChargeChangePrice,0) IsAllowOPDChargeChangePrice, " & _ "isnull(isAllowOPDRegisterInpatient,0) isAllowOPDRegisterInpatient, isnull(IsAllowOPDCheckLabSection,0) IsAllowOPDCheckLabSection, " & _ "isnull(IsAllowOPDAssessmentRateG,0) IsAllowOPDAssessmentRateG, isnull(isAllowJonelta,0) isAllowJonelta, " & _ "isnull(isAllowOPDSearchBarangay,0) isAllowOPDSearchBarangay, Isnull(isAllowOPDSearchCardNumber,0) isAllowOPDSearchCardNumber, " & _ "isnull(IsAllowOPDMABRate,0) IsAllowOPDMABRate, isnull(IsAllowOPDUpdateHMOLOA,0) IsAllowOPDUpdateHMOLOA, " & _ "IsNull(IsAllowOPDExportReport,0) IsAllowOPDExportReport, IsNull(IsAllowOPDSearchDocBySched,0) IsAllowOPDSearchDocBySched, " & _ "IsNull(IsAllowOPDPatientClass,0) IsAllowOPDPatientClass, IsNull(IsAllowOPDShowDiscount,0) IsAllowOPDShowDiscount, isnull(isAllowOPDPayCode,0) isAllowOPDPayCode, " & _ "isnull(isAllowMultipleRequest,0) isAllowMultipleRequest, isnull(allowEndConsultation,0) allowEndConsultation, " & _ "isnull(isAllowOPFileNumbering,0) isAllowOPFileNumbering, isnull(isAllowCreateNewIDnum,0)isAllowCreateNewIDnum, isnull(isAllowSpecializedCompanyRate,0)isAllowSpecializedCompanyRate, " & _ "isnull(isAllowAssessmentDiscount, 0)isAllowAssessmentDiscount,PediaAgeLimit from Patient_Data..tbHospitalInfo" With rec If .State > 0 Then .Close .CursorLocation = adUseClient .Open SQL, pclsUser.SQLConnection, adOpenDynamic, adLockReadOnly If .RecordCount > 0 Then pstrClientName = !ClientName & "" isHMORate = IIf(!isHMORate = 0, False, True) isOPDStatRate = IIf(!isOPDStatRate = 0, False, True) IsShowLabSpecimen = IIf(!IsAllowOPDShowLabSpecimen = 0, False, True) isAllowChargeChangeAmount = IIf(!IsAllowOPDChargeChangePrice = 0, False, True) isAllowRegisterInpatient = IIf(!isAllowOPDRegisterInpatient = 0, False, True) IsAllowOPDCheckLabSection = IIf(!IsAllowOPDCheckLabSection = 0, False, True) IsAllowOPDAssessmentRateG = IIf(!IsAllowOPDAssessmentRateG = 0, False, True) IsAllowJonelta = IIf(!IsAllowJonelta = 0, False, True) isAllowOPDSearchBarangay = IIf(!isAllowOPDSearchBarangay = 0, False, True) IsAllowOPDSearchCardNumber = IIf(!IsAllowOPDSearchCardNumber = 0, False, True) IsAllowOPDMABRate = IIf(!IsAllowOPDMABRate = 0, False, True) isAllowEndConsultation = IIf(!allowEndConsultation = 0, False, True) isAllowOPFileNumbering = IIf(!isAllowOPFileNumbering = 0, False, True) IsAllowOPDUpdateHMOLOA = IIf(!IsAllowOPDUpdateHMOLOA = 0, False, True) IsAllowOPDExportReport = IIf(!IsAllowOPDExportReport = 0, False, True) IsAllowOPDSearchDocBySched = IIf(!IsAllowOPDSearchDocBySched = 0, False, True) IsAllowOPDPatientClass = IIf(!IsAllowOPDPatientClass = 0, False, True) IsAllowOPDShowDiscount = IIf(!IsAllowOPDShowDiscount = 0, False, True) isAllowOPDPayCode = IIf(!isAllowOPDPayCode = 0, False, True) isAllowMultipleRequest = IIf(!isAllowMultipleRequest = 0, False, True) isAllowCreateNewIDnum = IIf(!isAllowCreateNewIDnum = 0, False, True) isAllowSpecializedCompanyRate = IIf(!isAllowSpecializedCompanyRate = 0, False, True) isAllowAssessmentDiscount = IIf(!isAllowAssessmentDiscount = 0, False, True) intPediaAgeLimit = !PediaAgeLimit End If .Close End With 'pstrClientName = GetClientName End Sub Public Function StringLen(ByVal strVar As String) As Integer StringLen = Len(Trim$(strVar)) End Function Public Function CheckHMOAccount(strAccountNum As String) As Boolean Dim rec As New ADODB.Recordset Dim SQL As String CheckHMOAccount = False SQL = "Patient_Data..SP_AOPD_CheckCompanyAccount '" & strAccountNum & "'" With rec If .State > 0 Then .Close .CursorLocation = adUseClient .Open SQL, pclsUser.SQLConnection, adOpenDynamic, adLockReadOnly If .RecordCount > 0 Then CheckHMOAccount = True End If .Close End With Set rec = Nothing End Function Public Function CheckService(ByVal cServCode As String, Optional ByVal cSex As String = "", Optional ByVal cAge As String) As Boolean Dim nServCode As Integer nServCode = val(cServCode) CheckService = True If cSex = "M" And (nServCode = 9 Or nServCode = 16) Then MsgBox "Cannot use this service for male patient...", vbCritical CheckService = False ElseIf nServCode = 13 And val(cAge) > 0 Then MsgBox "Patient's age indicates that Newborn is not a valid service...", vbCritical CheckService = False ' ElseIf nServCode = 14 And val(cAge) > 15 Then ElseIf nServCode = 14 And val(cAge) > intPediaAgeLimit Then MsgBox "Patient's age indicates that Pediatrics is not a valid service...", vbCritical CheckService = False ElseIf nServCode = 16 And val(cAge) < 15 Then If MsgBox("Patient's age indicates that this is a Pediatric case. Are you sure this is an obsteric case?", vbQuestion + vbYesNo) = vbNo Then _ CheckService = False End If End Function Public Function CheckIfAlreadyBilled(IDNum As String) As Boolean Dim rec As New ADODB.Recordset Dim SQL As String CheckIfAlreadyBilled = False SQL = "Select BillingDate from Patient_Data..tbOutPatient where IDNum = '" & IDNum & "'" With rec If .State > 0 Then .Close .CursorLocation = adUseClient .Open SQL, pclsUser.SQLConnection, adOpenDynamic, adLockReadOnly If Not .EOF Then If IsNull(!BillingDate) = False Then CheckIfAlreadyBilled = True End If End If .Close End With Set rec = Nothing End Function Public Sub AppendMessage(ByRef rstrLine As String, _ ByVal pstrMessage As String) If Trim$(rstrLine) = vbNullString Then rstrLine = pstrMessage Else rstrLine = rstrLine & vbCrLf & pstrMessage End If End Sub Public Function isEmployeesMedsAccount(strHospnum As String) As Boolean Dim recSQL As New ADODB.Recordset Dim strSQL As String strSQL = "Patient_Data..sp_AOPD_CheckPatientsMasterAccount '" & strHospnum & "'" isEmployeesMedsAccount = False With recSQL If .State > 0 Then .Close .CursorLocation = adUseClient .Open strSQL, pclsUser.SQLConnection, adOpenDynamic, adLockOptimistic If .RecordCount > 0 Then isEmployeesMedsAccount = True End If If .State > 0 Then .Close End With End Function Public Sub CenterForm(Anyform As Form) 'Centers a Form relative to the screen Anyform.Move (Screen.Width - Anyform.Width) / 2, (Screen.Height - Anyform.Height) / 2 End Sub Public Sub UnloadMdiForm() Dim intI As Integer intI = 1 Do While intI < Forms.Count If Forms(intI).MDIChild = False Then Unload Forms(intI) Else intI = intI + 1 End If Loop ChildCount = 0 End Sub Public Function Upper(nKeyAscii) Upper = Asc(UCase(Chr(nKeyAscii))) End Function Public Function File_Exists(FileName As String) As Boolean Dim fs As Object Dim blnResult As Boolean On Error GoTo errHandle Set fs = CreateObject("Scripting.FileSystemObject") blnResult = fs.FileExists(FileName) Set fs = Nothing File_Exists = blnResult Exit Function errHandle: File_Exists = True End Function