Attribute VB_Name = "mod_Main" Option Explicit Sub Main() Dim recHospInfo As New ADODB.Recordset Dim recDateTime As New ADODB.Recordset Dim a As New clsAssetManager On Error GoTo loadCurrentUserError: ' Check if Program is already loaded If App.PrevInstance Then MsgBox "Fixed Asset Program is Already Loaded." & vbCrLf & "Check on Windows Task Manager.", vbCritical + vbOKOnly Exit Sub End If Set fs = CreateObject("Scripting.FileSystemObject") Set CurrentUser = CreateObject("Medsys_User.clsCurrentUser") CurrentUser.PasswordDeptCode = "FA" CurrentUser.ShowMain If CurrentUser.Connected Then CurrentUser.SQLConnection.DefaultDatabase = "FIXEDASSET" Set conFA = CurrentUser.SQLConnection gblUser = CurrentUser.EmployeeCode conFA.CursorLocation = adUseClient On Error GoTo loadFASysError: Call HospitalInfo With conFA.Execute("select ClientName from PATIENT_DATA..tbHospitalInfo") If Not (.EOF And .BOF) Then gblClient = !clientname & "" End If End With ' if not (exists(select * from sys.databases where name = 'PAYROLL') and exists(select * from sys.databases where name = 'PAYROLL_HOSPITAL')) ' BEGIN ' Print 'C' ' End ' 'ELSE if not exists(select * from sys.databases where name = 'PAYROLL') ' ' BEGIN ' Print 'A' ' End ' 'ELSE if not exists(select * from sys.databases where name = 'PAYROLL_HOSPITAL') ' ' BEGIN ' Print 'B' ' End With recDateTime If .State > 0 Then .close .CursorLocation = adUseClient .Open "Select getdate() as [CurrentDateTime], convert(varchar(10),getdate(),101) as [CurrentDate]", CurrentUser.SQLConnection gblDateTime = CStr(![CurrentDateTime]) gblDate = Format$(![CurrentDate], "mm/dd/yy") ServerDate = Format$(![CurrentDate], "mm/dd/yy") End With Set recHospInfo = Nothing Set recDateTime = Nothing strReportPath = App.Path & "\Reports" On Error GoTo loadSystemRightError: strSQL = "select isnull(right_code1,'')right_code1, isnull(right_code2,'') right_code2 from PASSWORD..TBPASSWORDMAIN WHERE EMPLOYEEID = '" & Trim$(gblUser) & "' and DepartmentID in ('FA')" With conFA.Execute(strSQL) If Not .EOF = True Then mvarFAUserType = !right_code1 & "" mvarFAUserType2 = !right_code2 & "" ' frmSplash.Show vbModal Else mvarFAUserType = "F" ' frmSplash.Show vbModal 'MsgBox "For GatePass access, please contact EDP for assistance.", vbCritical + vbOKOnly, "Fixed Asset and Management System" End If End With If mvarFAUserType <> "F" Then With mdiFixedAsset .Show End With Else With mfrmRequestsForm .Show .Caption = "Requests Form" End With End If On Error GoTo initClassError: 'Set webCam = CreateObject("prjMedsysWebcam.clsMedSysWebCam") End If Exit Sub loadCurrentUserError: MsgBox Err.Description + ". Check login DLL(currentuser.dll)", vbCritical, App.Title & ".Sub Main Loading" Exit Sub loadFASysError: MsgBox Err.Description + ". Check FA System Data", vbCritical, App.Title & ".Sub Main Loading" Exit Sub loadSystemRightError: MsgBox Err.Description + ". Check User's Right Setting", vbCritical, App.Title & ".Sub Main Loading" Exit Sub initClassError: MsgBox Err.Description + ". InitClass().", vbCritical, App.Title & ".Sub Main Loading" End Sub Function Program_Is_Already_Running() As Boolean 'set defaults Program_Is_Already_Running = False 'determine if a previous instance of this application 'is running using VB app object If (App.PrevInstance = True) Then Program_Is_Already_Running = True End If End Function Public Sub HospitalInfo() On Error GoTo ErrHandler: Dim a As New clsAssetManager strSQL = "SELECT" strSQL = strSQL + " ISNULL(HospName,'') as HospName, " strSQL = strSQL + " ISNULL(HospAddress, '') as HospAddress, " strSQL = strSQL + " ISNULL(PropCusID,'') as PropCusID, " strSQL = strSQL + " ISNULL(NotedByID,'') as NotedBy, " strSQL = strSQL + " ISNULL(CheckedByID,'') as CheckedBy, " strSQL = strSQL + " ISNULL(ReviewedByID,'') as ReviewedBy, " strSQL = strSQL + " ISNULL(ApprovedByID,'') as ApprovedBy, " strSQL = strSQL + " ISNULL(ValidatingOfficer,'') as FAValidatingOfficerName, " strSQL = strSQL + " ISNULL(ReceivingOfficer,'') as FAReceivingOfficerName, " strSQL = strSQL + " ISNULL(HospContact,'') as HospContact, " strSQL = strSQL + " ISNULL(UseClientCodeAssetPrefix, '') as UseClientCodeAssetPrefix, " strSQL = strSQL + " ISNULL(RIVPrefix, '') as RIVPrefix, " strSQL = strSQL + " ISNULL(YearLength, '') as YearLength, " strSQL = strSQL + " ISNULL(POPrefix, '') as POPrefix, " strSQL = strSQL + " ISNULL(JOPrefix, '') as JOPrefix, " strSQL = strSQL + " ISNULL(CAPrefix, '') as CAPrefix, " strSQL = strSQL + " ISNULL(AssetSeriesLength, '') as AssetSeriesLength, " strSQL = strSQL + " ISNULL(PrefixSeparator, '') as PrefixSeparator, " strSQL = strSQL + " ISNULL(AssetTagSeparator, '') as AssetTagSeparator, " strSQL = strSQL + " ISNULL(ShowCountSheetByCategory, 0) as ShowCountSheetByCategory" strSQL = strSQL + " FROM FIXEDASSET..tbFAAssigna " ' strSQL = "fixedasset..spFA_Load_System" With conFA.Execute(strSQL) If Not (.EOF And .BOF) Then gblCompanyName = CurrentUser.CompanyName '!HospName & "" gblHospName = CurrentUser.CompanyName '!HospName & "" gblHospAddress = !HospAddress & "" gblHospContact = !HospContact & "" gblRivPrefix = !RIVPrefix gblPrefixSeparator = !PrefixSeparator gblAssetTagSeparator = !AssetTagSeparator gblPOPrefix = !POPrefix gblJOPrefix = !JOPrefix gblCAPrefix = !CAPrefix gblYearLength = !YearLength gblUseClientCodeAssetPrefix = !UseClientCodeAssetPrefix gblAssetSeriesDigitLength = !AssetSeriesLength gblShowCountSheetByCategory = !ShowCountSheetByCategory If a.SearchEmp_byEmp(!PropCusID & "") Then gblPropCus = a.Description If a.SearchEmp_byEmp(!NotedBy & "") Then gblNotedBy = a.Description If a.SearchEmp_byEmp(!CheckedBy & "") Then gblCheckedBy = a.Description If a.SearchEmp_byEmp(!ReviewedBy & "") Then gblReviewedBy = a.Description If a.SearchEmp_byEmp(!ApprovedBy & "") Then gblApprovedBy = a.Description If a.SearchEmp_byEmp(!FAReceivingOfficerName & "") Then gblReceivingOfficer = a.Description If a.SearchEmp_byEmp(!FAValidatingOfficerName & "") Then gblValidatingOfficer = a.Description .close Else mfrmMainProgSettings.strMode = "1" mfrmMainProgSettings.Show Exit Sub End If End With Exit Sub ErrHandler: MsgBox Err.Description & "in Sub HospitalInfo Loading", vbCritical, "" End Sub