Attribute VB_Name = "modSettingsConfig" Option Explicit Private CASettingsLoaded As Boolean Private OPSettingsLoaded As Boolean Private GenericSettingsChecked As Boolean Private GotHospitalInfo As Boolean Private ConfigFilesLoaded As Boolean Private UserRightsID As String Private GotOPDSettings As Boolean Private GotOPDStatInfo As Boolean 'billing 'Public blnisAllowRequestChargeOnCashPatient As Boolean 'Public blnisAllowPromptApprovalNumEntry As Boolean 'Public blnAllowCodeIncVitalSigns As Boolean 'Public blnAllowDischargeWithPending As Boolean 'Public blnAllowDoubleClickPxList As Boolean 'Public blnisRequirePhysician As Boolean' 'Public blnAllowCF4Entries As Boolean 'Global blnAllowSameExamRequest As Boolean Public Sub LoadCASettings(Optional Force As Boolean) If Force = False Then If CASettingsLoaded = True Then Exit Sub CASettingsLoaded = True End If ' todo reload after a day strQuery = "Select top 1 * from clinical_area..tbGenericModuleSettings WITH (NOLOCK)" Dim RecX As New ADODB.Recordset With RecX If .State > 0 Then .Close .Open strQuery, pclsUser.SQLConnection, adOpenStatic, adLockReadOnly If .EOF = False Then dblStatRate = IIf(IsNull(!STATRATE), 0, !STATRATE) '!StatRate MaxMarkupRate = IIf(IsNull(!MaxMarkupRate), 0, !MaxMarkupRate) StatAndWeekendRate = IIf(IsNull(!StatAndWeekendRate), 0, !StatAndWeekendRate) StatAndAfterFivePmRate = IIf(IsNull(!StatAndAfterFivePmRate), 0, !StatAndAfterFivePmRate) End If .Close End With End Sub Public Sub LoadOPSettings(Optional Force As Boolean) If Force = False Then If OPSettingsLoaded = True Then Exit Sub OPSettingsLoaded = True End If Dim strSQL As String strSQL = "Select * from patient_data..tbopd_settings WITH (NOLOCK)" Dim recClass As New ADODB.Recordset Set recClass = Nothing With recClass If .State > 0 Then .Close .Open strSQL, pclsUser.SQLConnection, adOpenStatic, adLockReadOnly If .EOF = False Then dblStatRate = Val(!OPDStatRAte & "") MaxMarkupRate = Val(!MaxMarkupRate & "") StatAndWeekendRate = Val(!StatAndWeekendRate & "") StatAndAfterFivePmRate = Val(!StatAndAfterFivePmRate & "") End If .Close End With End Sub Public Function GetOPDSettings(Optional Force As Boolean) As String If Force = False Then If GotOPDSettings = False Then GotOPDSettings = True Else Exit Function End If End If On Error GoTo ErrTrap Dim SQL As String Dim recS As New ADODB.Recordset 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,isnull(AllowZeroOnHand,0)AllowZeroOnHand from Patient_Data..tbHospitalInfo" With recS .Open SQL, pclsUser.SQLConnection, adOpenStatic, adLockReadOnly If .EOF = False Then GetOPDSettings = !ClientName & "" isHmoRate = IIf(!isHmoRate = 0, False, True) isOPDStatRate = IIf(!isOPDStatRate = 0, False, True) IsShowLabSpecimen = IIf(!IsAllowOPDShowLabSpecimen = 0, False, True) myclsbilling.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) myclsbilling.isAllowEndConsultation = IIf(!allowEndConsultation = 0, False, True) myclsbilling.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) myclsbilling.isAllowSpecializedCompanyRate = IIf(!isAllowSpecializedCompanyRate = 0, False, True) isAllowAssessmentDiscount = IIf(!isAllowAssessmentDiscount = 0, False, True) myclsbilling.isAllowZeroOnHand = IIf(!AllowZeroOnHand = 0, False, True) ''08.24.16 VBB If True Check,According to Cost Center Programmers. End If .Close End With 'pstrClientName = GetOPDSettings Get_MarkUpSettingsOP Exit Function ErrTrap: MsgBox "GetOPDSettings " & Err.Description Resume Next End Function Public Function Get_MarkUpSettingsOP() On Error GoTo ErrTrap Dim RecX As New ADODB.Recordset Dim search As String Dim intQ As Integer search = "Select isnull(isAllowAfterFivePMRate, 0)isAllowAfterFivePMRate, isnull(isAllowHolidayRate,0)isAllowHolidayRate, " & _ "isnull(isAllowNewOPStatRate,0) isAllowNewOPStatRate, isnull(isAllowWeekendRate,0) isAllowWeekendRate, isnull(isAllowAfterFiveLabChemOnly,0) isAllowAfterFiveLabChemOnly, " & _ "isnull(isAllowAfterFiveAllRevenues, 0) isAllowAfterFiveAllRevenues, dtWeekendStartMarkup, dtWeekendEndMarkup, isAssesmentMarkUp, isPostChargeMarkUp, " & _ "isnull(isAllowHomeService,0) isAllowHomeService,isnull(isAllowSocializeHMORate,0)isAllowSocializeHMORate, " & _ "isAllowRequestChargeOnCashPatient,isAllowPromptApprovalNumEntry,isAllowCodeIncVitalSigns,isAllowDischargeWithPending,isAllowDOubleClickPxList " & _ "from Patient_data..tbOPD_settings" With RecX .Open search, pclsUser.SQLConnection, adOpenStatic, adLockReadOnly If .EOF = False Then isAllowAfterFivePMRate = IIf(!isAllowAfterFivePMRate = 0, False, True) isAllowHolidayRate = IIf(!isAllowHolidayRate = 0, False, True) isAllowNewOPStatRate = IIf(!isAllowNewOPStatRate = 0, False, True) isAllowWeekendRate = IIf(!isAllowWeekendRate = 0, False, True) isAllowAfterFiveLabChemOnly = IIf(!isAllowAfterFiveLabChemOnly = 0, False, True) isAllowAfterFiveAllRevenues = IIf(!isAllowAfterFiveAllRevenues = 0, False, True) dtWeekendStartMarkup = IIf(!dtWeekendStartMarkup = Null, "12:01:00", "12:01:00") dtWeekendEndMarkup = IIf(!dtWeekendEndMarkup = Null, "11:59:59", "11:59:59") isAssessmentMarkUp = IIf(!isAssesmentMarkUp = 0, False, True) isPostChargeMarkUp = IIf(!isPostChargeMarkUp = 0, False, True) isAllowHomeService = IIf(!isAllowHomeService = 0, False, True) myclsbilling.isAllowSocializeHMORate = IIf(!isAllowSocializeHMORate = 0, False, True) Dim Field As String Field = "isAllowRequestChargeOnCashPatient" myclsbilling.blnisAllowRequestChargeOnCashPatient = Val(.Fields(Field) & "") Field = "isAllowPromptApprovalNumEntry" myclsbilling.blnisAllowPromptApprovalNumEntry = Val(.Fields(Field) & "") Field = "isAllowCodeIncVitalSigns" myclsbilling.blnAllowCodeIncVitalSigns = Val(.Fields(Field) & "") ' blnisRequirePhysician = !isRequirePhysician Field = "isAllowDischargeWithPending" myclsbilling.blnAllowDischargeWithPending = Val(.Fields(Field) & "") Field = "isAllowDOubleClickPxList" myclsbilling.blnAllowDoubleClickPxList = Val(.Fields(Field) & "") ' isSocializedHMORate = True ''01.31.18 VBB for Carmona only End If End With Set RecX = Nothing Exit Function ErrTrap: 'MsgBox "LoadOPDSetting " & Err.Description & ". Adding fields, please run program again." pclsUser.addlog "LoadOPDSetting " & Err.Description & ". " & Field 'On Error Resume Next If Mid(Field, 1, 2) = "is" Then pclsUser.SQLConnection.Execute "ALTER TABLE PATIENT_DATA..tbOPD_settings ADD " & Field & " bit default(0)" End If Resume Next End Function Public Sub GetOPDStatInfo() If GotOPDStatInfo = True Then Exit Sub Else GotOPDStatInfo = True End If On Error GoTo ErrTrap Dim SQL As String Dim RecO As New ADODB.Recordset SQL = "Select top 1 OPDWeekendStatTimeStart, OPDWeekendStatTimeEnd, OPDHolidayStatTimeStart, OPDHolidayStatTimeEnd from Patient_Data..tbHospitalInfo WITH (NOLOCK) " With RecO If .State > 0 Then .Close .Open SQL, pclsUser.SQLConnection, adOpenStatic, adLockReadOnly If .EOF = False Then dtWeekendStatStart = !OPDWeekendStatTimeStart & "" dtWeekendStatEnd = !OPDWeekendStatTimeEnd & "" dtHolidayStatStart = !OPDHolidayStatTimeStart & "" dtHolidayStatEnd = !OPDHolidayStatTimeEnd & "" End If .Close End With Exit Sub ErrTrap: pclsUser.addlog "GetOPDStatInfo " & Err.Description 'Resume Next End Sub Public Function GetHospitalInfo(Optional Force As Boolean) As Boolean Dim RatesPart As Boolean If Force = False Then If GotHospitalInfo = True Then Exit Function End If On Error GoTo ErrTrap Dim recHosp As New ADODB.Recordset Dim SQLQuery As String GetHospitalInfo = False SQLQuery = "Select * From Clinical_Area..tbHospitalInfo WITH (NOLOCK)" With recHosp If .State > 0 Then .Close '.CursorLocation = adUseClient .Open SQLQuery, pclsUser.SQLConnection If .EOF = False Then myclsbilling.isAllowZeroOnHand = !AllowZeroOnHand myclsbilling.isAllowHMORate = !isAllowHMORate myclsbilling.isAllowHMOPriceToAllPatients = !isAllowHMOPriceToAllPatients myclsbilling.isAllowHmoSocializedPricing = !AllowHmoSocializedPricing RatesPart = True myclsbilling.RatesUpdatedOn = !RatesUpdatedOn & "" ' strPhoneNumber = !PhoneNum GetHospitalInfo = True End If If .State > 0 Then .Close End With GotHospitalInfo = True Exit Function ErrTrap: MsgBox "GetHospitalInfo " & Err.Description If RatesPart = False Then pclsUser.addlog "GetHospitalInfo " & Err.Description Else AddFields myclsbilling.RatesUpdatedOn = Now End If Resume Next End Function Private Sub AddFields() On Error Resume Next pclsUser.SQLConnection.Execute "ALTER TABLE Clinical_Area..tbHospitalInfo ADD RatesUpdatedOn datetime " pclsUser.SQLConnection.Execute "UPDATE Clinical_Area..tbhospitalinfo set RatesUpdatedOn = GetDate() " End Sub Public Sub CheckGenericSettings(Optional Force As Boolean) If Force = False Then If GenericSettingsChecked = True Then Exit Sub Else GenericSettingsChecked = True End If End If myclsbilling.blnAllowCashCreditMemo = False Dim recC As New ADODB.Recordset With recC ' If .State > 0 Then ' .Close ' End If ' .CursorLocation = adUseClient .Open "select [Status] from Clinical_Area..tblGenericSettings WITH (NOLOCK) where [ID] = '2'", pclsUser.SQLConnection, adOpenStatic, adLockReadOnly If .EOF = False Then If ![Status] = 1 Then myclsbilling.blnAllowCashCreditMemo = True Else myclsbilling.blnAllowCashCreditMemo = False End If End If .Close Set recC = Nothing End With End Sub Public Sub Get_ConfigurationFiles() If ConfigFilesLoaded = True Then Exit Sub ConfigFilesLoaded = True Dim recHospital As ADODB.Recordset blnIsResultPrint = False Set recHospital = New ADODB.Recordset recHospital.Open "Select * from PATIENT_DATA..tbHospitalInfo", pclsUser.SQLConnection, adOpenStatic, adLockReadOnly If Not recHospital.EOF Then 'pstrHospitalName = recHospital!Company & "" 'strAddress = recHospital!Address1 & "" 'IsGeneric = recHospital!Bygeneric 'pstrHospitalMTS = recHospital!MTSServerName & "" blnIsResultPrint = recHospital!IsNursePrint & "" ' strPhoneNumber = recHospital!PhoneNum 'direct charging blnLBDirectCharging = recHospital!IsLBDirectCharging blnXRDirectCharging = recHospital!IsXRDirectCharging blnUSDirectCharging = recHospital!IsUSDirectCharging blnCTDirectCharging = recHospital!IsCTDirectCharging blnHSDirectCharging = recHospital!IsHSDirectCharging End If recHospital.Close Set recHospital = Nothing End Sub Public Sub GetRights() If UserRightsID = pclsUser.employeecode Then Exit Sub End If Dim SQLStr As String SQLStr = "select m.DepartmentID [Code], d.Department, m.Right_Code1 [Right1], m.Right_Code2 [Right2], m.Position, m.OriginalDepartment [OldCode],WOMS.Department as DefaultDept " & _ " from Password..tbpasswordmain m with(NOLOCK) " & _ " left join Password..tbpassworddepartment d with(NOLOCK) on m.DepartmentID = d.DepartmentID " & _ " left outer join Password..tbPasswordWoms as WOMS with(NOLOCK) ON M.EmployeeID = WOMS.EmployeeID " & _ " where m.EmployeeID = '" & pclsUser.employeecode & "'" Dim recQ As New ADODB.Recordset Dim HasAllRights As Boolean Set recQ = pclsUser.SQLConnection.Execute(SQLStr) With recQ If .EOF = False Then DefaultDepartmentCode = recQ.Fields("Code") & "" DefaultDepartmentDesc = recQ.Fields("Department") & "" End If Do While Not .EOF If recQ.Fields("Code") = "00" Then HasAllRights = True Else End If If recQ.Fields("Code") <> "20" Then '20=password If UCase(recQ.Fields("DefaultDept")) = UCase(recQ.Fields("Department")) Then DefaultDepartmentCode = recQ.Fields("Code") & "" DefaultDepartmentDesc = recQ.Fields("Department") & "" End If End If .MoveNext Loop End With UserRightsID = pclsUser.employeecode ' ' If no department... ' If DefaultDepartmentCode = "" Then ' If HasAllRights = True Then ' DefaultDepartmentCode = "00" ' DefaultDepartmentDesc = "All Rights" ' Else ' DefaultDepartmentCode = "" ' DefaultDepartmentDesc = "No Rights" ' End If ' Else ' End If End Sub