Attribute VB_Name = "mod_Global" Option Explicit Global conFA As New ADODB.Connection Global CurrentUser As Object Global Const gDatabase = "FIXEDASSET" Global gblHospName As String Global gblHospAddress As String Global gblCompanyName As String Global gblHospContact As String Global gblIsShowPOApprovedBySelection As Boolean Global gblIsSeparateSeriesForJobOrder As Boolean Global gblRivPrefix As String Global gblPrefixSeparator As String Global gblAssetTagSeparator As String Global gblPOPrefix As String Global gblJOPrefix As String Global gblCAPrefix As String Global gblYearLength As Integer Global gblUseClientCodeAssetPrefix As Boolean Global gblIsShowAssetRetiredEntry As Boolean Global gblAssetSeriesDigitLength As Integer Global gblShowCountSheetByCategory As Integer Global gblUseCrystalReportViewer13 As Boolean Global gblFetchFromInventoryIAR As Boolean Global glbPropertyAcknowledgementReceipt As Boolean Global gblNotedBy As String Global gblCheckedBy As String Global gblReviewedBy As String Global gblApprovedBy As String Global gblPropCus As String Global gblReceivingOfficer As String Global gblValidatingOfficer As String Global gblDateTime As String Global gblDate As String Global gblUser As String Global gblStartDate As String Global gblEndDate As String Global RIVNum As String Global PONum As String Global CANum As String Global ControlNum As String Global gblErrorName As String Global strSQL As String Global intCtr As Integer Global mvarFAUserType As String Global mvarFAUserType2 As String Global AcqDateValidated As String Global AcqDateWarrantyStart As String Global AcqDateWarrantyEnd As String 'HOSPITAL ENABILITIES/*PROGRAM SETTINGS Global gblDelMaster As Boolean Global gblDelManager As Boolean Global gblEditName As Boolean Global gblEditAccountCode As Boolean Global gblEditDetails As Boolean Global gblQueryFromInv As Boolean Global gblcanPR As Boolean Global gblcanPO As Boolean Global gblcanCA As Boolean Global gblcanGetFAfromInv As Boolean Global gblcanRepair As Boolean Global gblcanTransfer As Boolean Global gblIsAssetReportDetailed As Boolean Global gblcanPrintTag As Boolean Global gblisBegBal As Boolean Global gblCanGeneratePAR As Boolean Global gblAutoGenerateDetails As Boolean Global gblIsRptFile As Boolean Global gbldepartmentFrom As String Global gblQuerySupplierFromCode As String Global gblIsPropertyTagSequential As Boolean Global gblcanBulkEdit As Boolean Global gblcanUpdateStatus As Boolean Global gblIsSeparatePropSequencePerYear As Boolean Global gblOverrideMajorAndAccountCode As Boolean Global gblAllowEmptyPONumOnManualRR As Boolean Global gblAllowManualAddOfItemInJo As Boolean 'REPORT Global gblBlnPrint As Boolean Global gblTitleReport As String Global gblBlnExport As Boolean Global sortReport As Boolean Global sortType As String Global sortItemBy As String Global gblClient As String Global arrayStatus As String Global blnShowReport As Boolean Global ReportFileName As String Global strReportPath As String Global cls_global As New cls_global 'Export to Excel Global fs As Object Global intCounter As Integer Global cls_Common As New clsCommon Public Report As CRAXDRT.Report 'Public Merlin As IAgentCtlCharacter Public MerlinStatus As String Public NotedBy As String Public CheckedBy As String Public ApprovedBy As String Global strRptFileName As String Public ServerDate As String Public isBegBal As Boolean Public mvarTransType As String Public mvarPONum As String Public mvarPOType As String Global m_SortColumn As Integer Global m_SortOrder As SortSettings '--------------------------------- Public Const GotFocus_color = &HC0FFFF Public Const LostFocus_color = &H80000005 Global webCam As Object Global rec As New ADODB.Recordset 'IN ACKNOWLEDGEMENT POSTING FROM RECEIVING REPORT. ENABLE TO QUERY RECEIVED ITEMS FROM MEDSYS INVENTORY MODULE Global getRRfromInventory As Boolean Global gblenablephoto As Boolean 'ALLOW USER TO SHOW THE MIGRATED DATA TO DEPARTMENT DESCRIPTION FIELD AT FA LEDGER 'THEN REASSIGN DEPARTMENT FROM BUILDFILE Global FreeTypedDepartment As Boolean 'ALLOW USER TO UPDATE DETAILS FROM LEDGER. '-ENABLE THIS WHEN ITEMS WAS MIGRATED FROM EXCEL. NEEDS CONSTANT UPDATES. '-DISABLED WHEN REPORT WAS UPLOADED AT ACCOUNTING. FUCKING DEPRECIATION EXPENSE VALUES WILL AFFECT! Global manualUpdateDeTAILS As Boolean 'MANUAL ENTRY OF ITEM TO ASSETMANAGELIST Global gblIsManualEntryOfItem As Boolean 'IN MANUAL ENTRY OF ITEM, REQUIRE RECEIVING DOCUMENT NUMBER FIELD Global gblRequireRRNumNewItem As Boolean 'WHEN gblIsManualEntryOfItem IS ENABLED. 'REFER TO SAME DATA AT TBFACAHEADER Global sameRRDetails As Boolean Global gblenableYearPrefixOntransactions As Boolean Global gblenableMonthPrefixOntransactions As Boolean Global gblSetAssetSeriesDigitLength As Boolean Global gblenableWarrantyCheck As Boolean Public Sub CenterMe(myForm As Form) Dim ScWidth%, ScHeight% ScWidth% = Screen.Width / Screen.TwipsPerPixelX ScHeight% = Screen.Height / Screen.TwipsPerPixelY If ScWidth% >= 1024 And ScHeight >= 768 Then myForm.Left = (Screen.Width - myForm.Width) / 2 myForm.Top = 1500 Else myForm.Left = (12000 - myForm.Width) / 2 myForm.Top = 1500 End If End Sub Public Sub Focus(TextBoxControl As TextBox) TextBoxControl.SelStart = 0 TextBoxControl.SelLength = Len(TextBoxControl.text) End Sub Public Sub color_GotFocus(TextBoxControl As TextBox) TextBoxControl.BackColor = GotFocus_color End Sub Public Sub color_LostFocus(TextBoxControl As TextBox) TextBoxControl.BackColor = LostFocus_color End Sub Public Function Get_Department(ItemID As String) As String Dim recGetDepartment As New ADODB.Recordset With recGetDepartment If .State > 0 Then .close .CursorLocation = adUseClient .Open "FixedAsset..spFA_SearchDepartment '" & ItemID & "' ", conFA If .RecordCount > 0 Then Get_Department = !Description End If End With Set recGetDepartment = Nothing End Function Public Sub CenterForm(Anyform As Form) Anyform.Left = (Screen.Width - Anyform.Width) / 2 Anyform.Top = 250 End Sub Public Function Get_Supplier(ItemID As String) As String Dim recGetSupplier As New ADODB.Recordset With recGetSupplier If .State > 0 Then .close .CursorLocation = adUseClient .Open "FixedAsset..spFA_SearchSupplier '" & ItemID & "' ", conFA If .RecordCount > 0 Then Get_Supplier = !supplierName End If End With Set recGetSupplier = Nothing End Function Public Function Get_Employee(ItemID As String) As String Dim recGetEmployee As New ADODB.Recordset If Trim$(ItemID) = "" Then Get_Employee = "" Exit Function End If With recGetEmployee If .State > 0 Then .close .CursorLocation = adUseClient .Open "FixedAsset..spFA_SearchEmployee '" & ItemID & "' ", conFA If .RecordCount > 0 Then Get_Employee = ![Employee Name] End If End With Set recGetEmployee = Nothing End Function Public Function Get_UOM(ItemID As String) As String Dim recGetUOM As New ADODB.Recordset With recGetUOM If .State > 0 Then .close .CursorLocation = adUseClient .Open "FixedAsset..spFA_SearchUOM '" & ItemID & "' ", conFA If .RecordCount > 0 Then Get_UOM = !UnitofMeasure End If End With Set recGetUOM = Nothing End Function Public Function Get_Item(ItemID As String) As String Dim recGetItem As New ADODB.Recordset With recGetItem If .State > 0 Then .close .CursorLocation = adUseClient .Open "FixedAsset..spFA_SearchItem '" & ItemID & "','0' ", conFA If .RecordCount > 0 Then Get_Item = !item End If End With Set recGetItem = Nothing End Function Public Function Get_Term(ItemID As String) As String Dim recGetTerm As New ADODB.Recordset With recGetTerm If .State > 0 Then .close .CursorLocation = adUseClient .Open "FixedAsset..spFA_SearchItem '" & ItemID & "' ", conFA If .RecordCount > 0 Then Get_Term = !Terms End If End With Set recGetTerm = Nothing End Function Public Function EndTrim(strText As String) As String Dim intC As Integer Dim intA As Integer intC = Len(strText) For intA = intC To 1 Step -1 If Mid$(strText, intA, 1) <> Chr$(10) And Mid$(strText, intA, 1) <> Chr$(13) Then Exit For End If Next intA EndTrim = Mid$(strText, 1, intA) End Function Public Function IsSafe_AccountCode(AccountCode As String) As Boolean Dim recCode As New ADODB.Recordset IsSafe_AccountCode = True With recCode If .State > 0 Then .close .CursorLocation = adUseClient .Open "Select top 1 * from FixedAsset..tbFacategory Where categoryid = '" & AccountCode & "' ", conFA If .RecordCount > 0 Then IsSafe_AccountCode = False MsgBox "Account code " + CStr(AccountCode) + " already exist.", vbExclamation, "Message" Exit Function End If End With Set recCode = Nothing End Function Public Function IsExisting_AccountCode(AccountCode As String) As Boolean Dim recCode As New ADODB.Recordset IsExisting_AccountCode = False With recCode If .State > 0 Then .close .CursorLocation = adUseClient .Open "Select top 1 categoryid from FixedAsset..tbFacategory Where categoryid = '" & AccountCode & "' ", conFA If .RecordCount > 0 Then IsExisting_AccountCode = True Exit Function Else MsgBox "Account code " + CStr(AccountCode) + " does not exist.", vbCritical Exit Function End If End With Set recCode = Nothing End Function Public Function IsExisting_Department(DepartmentID As String) As Boolean Dim recDept As New ADODB.Recordset IsExisting_Department = False With recDept If .State > 0 Then .close .CursorLocation = adUseClient .Open "Select top 1 code From vw_department Where code = '" & DepartmentID & "' ", conFA If .RecordCount > 0 Then IsExisting_Department = True Exit Function Else MsgBox "Department ID " + CStr(DepartmentID) + " does not exist.", vbExclamation, "Message" Exit Function End If End With Set recDept = Nothing End Function Public Function IsExisting_PDepartment(pDepartmentID As String) As Boolean Dim recPDept As New ADODB.Recordset IsExisting_PDepartment = False With recPDept If .State > 0 Then .close .CursorLocation = adUseClient .Open "Select top 1 pdeptid From FixedAsset..tbFAParentDepartment Where Pdeptid = '" & pDepartmentID & "' ", conFA If .RecordCount > 0 Then IsExisting_PDepartment = True Exit Function Else MsgBox "Parent Department ID " + CStr(pDepartmentID) + " does not exist.", vbExclamation, "Message" Exit Function End If End With Set recPDept = Nothing End Function Public Function IsExisting_UOMID(UomID As String) As Boolean Dim recUOM As New ADODB.Recordset IsExisting_UOMID = False With recUOM If .State > 0 Then .close .CursorLocation = adUseClient .Open "Select top 1 UnitofmeasureID from tbfaUnitOfMeasure Where unitofmeasureid = '" & UomID & "' ", conFA If Not (.EOF Or .BOF) Then IsExisting_UOMID = True Exit Function Else MsgBox "Unit of Measure ID " + CStr(UomID) + " does not exist.", vbExclamation, "Message" Exit Function End If End With Set recUOM = Nothing End Function Public Function IsExisting_SupplierID(supplierID As String) As Boolean Dim recSupplierID As New ADODB.Recordset IsExisting_SupplierID = False With recSupplierID If .State > 0 Then .close .CursorLocation = adUseClient .Open "Select top 1 supplierID from tbfasupplier Where supplierid = '" & supplierID & "' ", conFA If .RecordCount > 0 Then IsExisting_SupplierID = True Exit Function Else MsgBox "Supplier ID " + CStr(supplierID) + " does not exist.", vbExclamation, "Message" Exit Function End If End With Set recSupplierID = Nothing End Function Public Function IsExisting_MajorCode(MajorCode As String) As Boolean Dim recMajor As New ADODB.Recordset IsExisting_MajorCode = False With recMajor If .State > 0 Then .close .CursorLocation = adUseClient strSQL = "Select top 1 majorcode From FixedAsset..tbfamajorcategory where cast(majorcode as int) = cast( '" & CInt(MajorCode) & "' as int)" .Open strSQL, conFA If .RecordCount > 0 Then IsExisting_MajorCode = True Exit Function Else MsgBox "Major code " + CStr(MajorCode) + " does not exist.", vbExclamation, "Message" Exit Function End If End With Set recMajor = Nothing End Function Public Function Get_LifeYears(AccountCode As String) As String Dim recLife As New ADODB.Recordset With recLife If .State > 0 Then .close .CursorLocation = adUseClient .Open "Select isnull(Life,'') Life From fixedasset..tbfacategory Where categoryid = '" & AccountCode & "' ", conFA If .RecordCount > 0 Then Get_LifeYears = CStr(!Life & "") End If End With Set recLife = Nothing End Function Public Function Get_KeyNum() As String Dim recKeyNum As New ADODB.Recordset With recKeyNum If .State > 0 Then .close .CursorLocation = adUseClient .Open "Select KeyNum From FixedAsset..tbFALastSequence", conFA If .RecordCount > 0 Then Get_KeyNum = CStr(Year(CDate(gblDate))) + CStr(!KeyNum) End If End With Set recKeyNum = Nothing End Function Public Function IsValid_Num(strX As String) As Boolean IsValid_Num = True strX = Trim$(strX) If Len(strX) <> 9 Then IsValid_Num = False Exit Function End If If Mid$(strX, 3, 1) <> " " Then IsValid_Num = False Exit Function End If If IsNumeric(Left(strX, 2)) = False Then IsValid_Num = False Exit Function End If If IsNumeric(Right(strX, 6)) = False Then IsValid_Num = False Exit Function End If End Function Public Function Replicate_Str(strX As String) As String Dim X As Integer Dim strY As String If Mid$(Left(strX, 3), 3, 3) = "" Then strY = Left(strX, 2) Else strY = Mid$(strX, 1, 2) If strY <> Right(Year(gblDate), 2) Then strY = Right(Year(gblDate), 2) strX = strY + " " + strX End If End If strX = Mid$(strX, 4, Len(strX)) For X = 1 To 6 If Len(strX) < 6 Then strX = "0" + strX End If Next X Replicate_Str = strY + " " + strX End Function Public Function StockCardRecNum() As String strSQL = "select top 1 cast(isnull(recordnumber,'1') as int) RecordNumber from tbFAStockCard order by cast(recorDnumber as int) desc" With conFA.Execute(strSQL) If .RecordCount > 0 Then StockCardRecNum = CStr(!RecordNumber) Else StockCardRecNum = "1" End If End With End Function Function Save_UserLog(strRemarks As String) Dim strSQL As String strSQL = "FixedAsset..spFa_SaveUserLogs '" & gblUser & "', 'Fixed Asset', '" & strRemarks & "'" conFA.Execute strSQL End Function Public Function GetEmployeeNameFromPayroll(strEmpNum As String) As String Dim recGetName As New ADODB.Recordset With recGetName If .State > 0 Then .close .CursorLocation = adUseClient .Open "spFA_LoadEmployeeName " & strEmpNum, conFA If .RecordCount > 0 Then GetEmployeeNameFromPayroll = !FULLNAME & "" End If End With Set recGetName = Nothing End Function Public Function value(strNumber As String) As Double If IsNumeric(strNumber) Then value = CDbl(strNumber) Else value = 0 End If End Function 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 Function ValidateNullValue(ByVal value As Object) As String ValidateNullValue = IIf(IsNull(value), "", value) End Function