Attribute VB_Name = "modBilling" Option Explicit Global strgRevenueID As String Public Const coColumns = 15 Public Const coDepartment = 1 Public Const coItemID = 2 Public Const coItem = 3 Public Const coPrice = 4 Public Const coQuantity = 5 Public Const coAmount = 6 Public Const coWithItems = 7 Public strQuery As String Public Const coCanEdit = 8 Public Const coSearchInventory = 9 Public Const coLocationID = 10 Public Const coStat = 11 Public Const colSpecimen = 12 Public Const coLabsectionid = 13 Public Const coDiscount = 14 Public Const coRequestNum = 15 Global isLabAutoMarkUpExam As Boolean '------FOR HOLIDAY RATE--------' Global HolidayCheckDate As String Global myHolidayGreeting As String Global myHolidayName As String Global isHolidayToday As Boolean Global dtHolidayStatStart As String Global dtHolidayStatEnd As String Global dtWeekendStatStart As String Global dtWeekendStatEnd As String Global strPackageID As String Global blnIsPackage As Boolean Public blnIsAssessment As Boolean Public blnIsResultPrint As Boolean Global fltDiscountRate As Double 'Public pclsuser.medsysclasses.Sstationname, pclsuser.medsysclasses.sstationid, mServer, mUserid, mPassword As String Global strgSectionID As String Global strgSection As String Global isPostChargeMarkUp As Boolean Public frmPostCharge As Form Global frmAssessment As Form Global frmAssessStatus As Form Global frmOPDPackage As Form Global frmCashCM As Form Global frmFinal As Form Global frmCSREntry As Form Global frmRequest As Form Global frmRemarks As Form Global blnLBDirectCharging As Boolean Global blnXRDirectCharging As Boolean Global blnUSDirectCharging As Boolean Global blnCTDirectCharging As Boolean Global blnHSDirectCharging As Boolean Public strRoomRate As String 'Public strStationName As String Public strMembership As String Public strADMType As String Public blnJoneltaPatient As Boolean ' not used Public clsAppendLogBookN As New clsAppendLogBook Public Sub ComputeRate() Select Case strgRevenueID Case "GC" ComputeRateCA Case "OP" ComputeRateOP Case Else MsgBox "no calling module" End Select End Sub Public Sub CancelCharges() Select Case strgRevenueID Case "GC" CancelChargesCA Case "OP" ComputeRateOP Case Else MsgBox "no calling module" End Select End Sub Public Function blnLabAutomarkUpItem(strItemID As String) Dim search As String Dim recC As New ADODB.Recordset search = "Build_file..spBuild_ValidateLabAutoMarkUp '" & strItemID & "'" With recC If .State > 0 Then .Close .Open search, pclsUser.sqlconnection, adOpenStatic, adLockOptimistic If Not .EOF Then If !Automarkup = "Y" Then isLabAutoMarkUpExam = True Else isLabAutoMarkUpExam = False End If .Close End If End With Set recC = Nothing End Function Public Function Check_WithDiscount(strRefNum As String, strIdNum As String) As Boolean Dim recC As New ADODB.Recordset Dim SQL As String Check_WithDiscount = False ' SQL = "Select idnum, refnum, amount from Billing..tbBillOPDailyOut WITH (NOLOCK) where DRCR = 'C' and RefNum = '" & Trim$(strRefNum) & "'" _ ' & " and IDNum = '" & Trim$(strIdNum) & "' union all Select idnum, refnum, amount from Billing..tbBillDailybill WITH (NOLOCK) where DRCR = 'C' and RefNum = '" & Trim$(strRefNum) & "'" _ ' & " and IDNum = '" & Trim$(strIdNum) & "'" ' Select Case myclsbilling.MyclsPatient.InOut Case "I" SQL = "Select idnum, refnum, amount from Billing..tbBillOPDailyOut WITH (NOLOCK) where DRCR = 'C' and RefNum = '" & Trim$(strRefNum) & "'" _ & " and IDNum = '" & Trim$(strIdNum) & "' " Case "O" SQL = "Select idnum, refnum, amount from Billing..tbBillDailybill WITH (NOLOCK) where DRCR = 'C' and RefNum = '" & Trim$(strRefNum) & "'" _ & " and IDNum = '" & Trim$(strIdNum) & "'" End Select With recC .CursorType = adOpenStatic .LockType = adLockReadOnly .Open SQL, pclsUser.sqlconnection If .EOF = False Then Check_WithDiscount = True End If .Close End With End Function Public Function Check_IfJonelta(strIdNum As String) As Boolean Dim SQL As String Dim Rec As New ADODB.Recordset Check_IfJonelta = False SQL = "Select isnull(Jonelta,0) Jonelta from Patient_Data..tbOutpatient WITH (NOLOCK) where IDNum = '" & Trim$(strIdNum) & "'" With Rec If .State > 0 Then .Close .CursorType = adOpenStatic .LockType = adLockReadOnly .Open SQL, pclsUser.sqlconnection If .EOF = False Then Check_IfJonelta = !Jonelta End If .Close End With blnJoneltaPatient = Check_IfJonelta Set Rec = Nothing End Function Public Function Get_JoneltaRate(strRevenueID As String, strItemID As String) As Double Dim recClass As New ADODB.Recordset Dim StrSQL As String Dim dblrateF As Double If recClass.State > 0 Then recClass.Close StrSQL = "Patient_data..spOPD_Get_RateF '" & strRevenueID & "', '" & strItemID & "'" recClass.Open StrSQL, pclsUser.sqlconnection, adOpenStatic, adLockReadOnly If recClass.EOF = False Then dblrateF = recClass!RateF End If Get_JoneltaRate = dblrateF Set recClass = Nothing End Function Public Function GetLabSectionID(strItemID As String) As String GetLabSectionID = pclsUser.medsysclasses.GetLabSectionID(strItemID) ' Dim Rec As New ADODB.Recordset ' Dim SQL As String ' Dim strSectionID As String ' ' SQL = "Select isnull(LabSectionID,'') LabSectionID from Build_File..tbcoLabExam where LabExamID = '" & strItemId & "'" ' ' With Rec ' If .State > 0 Then .Close ' .CursorLocation = adUseClient ' .CursorType = adopenstatic ' .LockType = adLockReadOnly ' .Open SQL, pclsUser.sqlconnection ' ' If Not .EOF Then ' strSectionID = !LabSectionID & "" ' End If ' .Close ' End With ' Set Rec = Nothing ' GetLabSectionID = Trim$(strSectionID) End Function ' 'Public Function myclsbilling.Get_strType() As String ' Dim strType As String ' ' If (Check_ifHoliday = True And NewValidateAfterFivePm = True And NewValidateWeekend = True) Then ' strType = "7" ''Holidayrate and Weekend and after 5pm ' ElseIf (Check_ifHoliday = True And NewValidateAfterFivePm = True) Then ' strType = "6" ''Holiday and after 5pm ' ElseIf (Check_ifHoliday = True And NewValidateWeekend = True) Then ' strType = "5" ''Holiday and Weekend ' ElseIf (NewValidateWeekend = True And NewValidateAfterFivePm = True) Then ' strType = "4" ''Weekend and after 5pm ' ElseIf (NewValidateWeekend = True) Then ' strType = "3" ''Weekend Rate only ' ElseIf (NewValidateAfterFivePm = True) Then ' strType = "2" ''After Five Pm Rate Only ' ElseIf (Check_ifHoliday = True) Then ' strType = "1" ''Holiday Rate only ' Else ' strType = "X" ' End If ' ' Get_strType = strType ' 'End Function Public Function Check_ifHoliday() As Boolean Dim recQ As New ADODB.Recordset Dim mysearch As String If HolidayCheckDate = Format(Now, "mm/dd/yyy") Then Exit Function Else HolidayCheckDate = Format(Now, "mm/dd/yyy") End If mysearch = "Build_file..Build_GetHolidayToday" With recQ .Open mysearch, pclsUser.sqlconnection, adOpenStatic, adLockReadOnly If .EOF = False Then isHolidayToday = True myHolidayName = !HolidayName myHolidayGreeting = !HolidayGreeting End If End With Check_ifHoliday = isHolidayToday Set recQ = Nothing End Function Public Function NewValidateAfterFivePm() As Boolean Dim recTime As New ADODB.Recordset Dim search As String If isAllowAfterFivePMRate Then If isAllowAfterFiveAllRevenues Then search = "Select getdate() as Time " ' & from patient_data..tbhospitalinfo" With recTime If .State > 0 Then .Close .Open search, pclsUser.sqlconnection, adOpenStatic, adLockReadOnly If Not .EOF Then If (Format(!Time, "HH:MM:SS") >= "17:00:01") Then NewValidateAfterFivePm = True Else NewValidateAfterFivePm = False End If End If .Close Set recTime = Nothing End With ElseIf (isAllowAfterFiveLabChemOnly = True And isLabAutoMarkUpExam = True And (strLabSectionID = "2" Or strLabSectionID = "H")) Then search = "Select getdate() as Time " ' from patient_data..tbhospitalinfo" With recTime If .State > 0 Then .Close .Open search, pclsUser.sqlconnection, adOpenStatic, adLockReadOnly If Not .EOF Then If (Format(!Time, "HH:MM:SS") >= "17:00:01") Then NewValidateAfterFivePm = True Else NewValidateAfterFivePm = False End If End If .Close Set recTime = Nothing End With Else NewValidateAfterFivePm = False End If Else NewValidateAfterFivePm = False End If End Function Public Function NewValidateWeekend() As Boolean Dim recTime As New ADODB.Recordset Dim search As String NewValidateWeekend = False If isAllowWeekendRate Then search = "select getdate()as Time, * from patient_data..tbOPD_settings" With recTime If .State > 0 Then .Close .Open search, pclsUser.sqlconnection, adOpenStatic, adLockOptimistic If Not .EOF Then If (isAllowAfterFiveLabChemOnly = True And isLabAutoMarkUpExam = True And (strLabSectionID = "2" Or strLabSectionID = "H")) Then If (Format(!Time, "dddd") = "Saturday") Then If (Format(!Time, "HH:MM:SS") >= Format(!dtWeekendStartMarkup, "HH:MM:SS") And Format(!Time, "HH:MM:SS") <= Format(!dtWeekendEndMarkup, "HH:MM:SS")) Then NewValidateWeekend = True Else NewValidateWeekend = False End If ElseIf (Format(!Time, "dddd") = "Sunday") Then If (Format(!Time, "HH:MM:SS") >= Format(!dtWeekendStartMarkup2, "HH:MM:SS") And Format(!Time, "HH:MM:SS") <= Format(!dtWeekendEndMarkup2, "HH:MM:SS")) Then NewValidateWeekend = True Else NewValidateWeekend = False End If Else NewValidateWeekend = False End If ElseIf isAllowAfterFiveAllRevenues Then If (Format(!Time, "dddd") = "Saturday") Then If (Format(!Time, "HH:MM:SS") >= Format(!dtWeekendStartMarkup, "HH:MM:SS") Or Format(!Time, "HH:MM:SS") <= Format(!dtWeekendEndMarkup, "HH:MM:SS")) Then NewValidateWeekend = True Else NewValidateWeekend = False End If ElseIf (Format(!Time, "dddd") = "Sunday") Then If (Format(!Time, "HH:MM:SS") >= Format(!dtWeekendStartMarkup2, "HH:MM:SS") Or Format(!Time, "HH:MM:SS") <= Format(!dtWeekendEndMarkup2, "HH:MM:SS")) Then NewValidateWeekend = True Else NewValidateWeekend = False End If Else NewValidateWeekend = False End If End If End If .Close Set recTime = Nothing End With Else NewValidateWeekend = False End If End Function Public Function get_MarkUpRate() As Double Dim recClass As New ADODB.Recordset Dim StrSQL As String Dim dblMarkUpRate As Double Dim strType As String Dim HolidayRate As Double Dim AfterFivePmRate As Double Dim WeekendRate As Double Dim HolidayAndWeekendRate As Double Dim HolidayAndAfterFivePmRate As Double Dim AfterFiveAndWeekend As Double Dim MaxMarkupRate As Double StrSQL = "Select * from patient_data..tbopd_settings WITH (NOLOCK)" With recClass If .State > 0 Then .Close .Open StrSQL, pclsUser.sqlconnection, adOpenStatic, adLockReadOnly If .EOF = False Then HolidayRate = !HolidayRate & "" AfterFivePmRate = !AfterFivePmRate & "" WeekendRate = !WeekendRate & "" HolidayAndWeekendRate = !HolidayAndWeekend & "" HolidayAndAfterFivePmRate = !HolidayAndAfterFivePmRate & "" AfterFiveAndWeekend = !WeekendAfterFive & "" MaxMarkupRate = !MaxMarkupRate & "" End If .Close End With strType = myclsbilling.Get_strType() Select Case strType Case "1" dblMarkUpRate = Val(FirstRate) + Val(FirstRate) * (Val(HolidayRate / 100)) Case "2" dblMarkUpRate = Val(FirstRate) + Val(FirstRate) * (Val(AfterFivePmRate / 100)) Case "3" dblMarkUpRate = Val(FirstRate) + Val(FirstRate) * (Val(WeekendRate / 100)) Case "4" dblMarkUpRate = Val(FirstRate) + Val(FirstRate) * (Val(AfterFiveAndWeekend / 100)) Case "5" dblMarkUpRate = Val(FirstRate) + Val(FirstRate) * (Val(HolidayAndWeekendRate / 100)) Case "6" dblMarkUpRate = Val(FirstRate) + Val(FirstRate) * (Val(HolidayAndAfterFivePmRate / 100)) Case "7" dblMarkUpRate = Val(FirstRate) + Val(FirstRate) * (Val(MaxMarkupRate / 100)) Case "X" dblMarkUpRate = FirstRate End Select Set recClass = Nothing get_MarkUpRate = dblMarkUpRate End Function Public Sub OpenChargeSlipNew(strRefNum As String, strIdNum As String, strTitle As String, strDiscount As String) 'plcsuser.medsysclasses Dim blnWithDiscount As Boolean If strDiscount = "" Then If pclsUser.medysclasses.clsBilling.Check_WithDiscount(strRefNum, Trim$(strIdNum)) = True Then blnWithDiscount = True End If End If ' If Check_WithDiscount(Trim$(grdPrevious.TextMatrix(grdPrevious.Row, 6)), Trim$(ctlPHead1.IdNum)) Then ' blnWithDiscount = True ' End If ' OpenChargeSlipNew Trim$(grdPrevious.TextMatrix(grdPrevious.Row, 6)), Trim$(ctlPHead1.IdNum), "OPD Registration Cost Center Slip " + Trim$(grdPrevious.TextMatrix(grdPrevious.Row, 6)), "N" ' 'OpenMainReport App.Path & "\Reports\ChargeSlip.RPT", "OPD Registration Cost Center Slip " + Trim$(mshflexList.TextMatrix(mshflexList.Row, 6)), Trim$(mshflexList.TextMatrix(mshflexList.Row, 6)), Trim$(frmFinal.txtId.Text) ' ShowReportViewer False, "Print ChargeSlip", False Dim strReportFileName As String If isReprint = False Then If strDiscount = "Y" Then strReportFileName = "ChargeSlipNewDiscount.RPT" Else strReportFileName = "ChargeSlipNew.RPT" End If Else If blnWithDiscount Then strReportFileName = "ChargeSlipNewDiscount.RPT" Else strReportFileName = "ChargeSlipNew_Reprint.RPT" End If End If pclsUser.medsysclasses.ParamClear pclsUser.medsysclasses.paramadd "RefNum", strRefNum pclsUser.medsysclasses.paramadd "IdNum", strIdNum With pclsUser.medsysclasses .ParamClear .autoparameter = True .paramadd "@RefNum", strRefNum .paramadd "@IDNum", strIdNum .paramadd "HospName", pclsUser.CompanyName .paramadd "Title", strTitle .paramadd "HospAddress", pclsUser.companyaddress .autoparameterver = 1 End With ' pclsUser.MEDSYSClasses.OpenMainReport strReportFileName ' ' ' If crxParameterField.ParameterFieldName = "@RefNum" Then ' crxParameterField.AddCurrentValue strRefNum ' ElseIf crxParameterField.ParameterFieldName = "@IdNum" Then ' crxParameterField.AddCurrentValue strIDNum ' ElseIf crxParameterField.ParameterFieldName = "Title" Then ' crxParameterField.AddCurrentValue strTitle ' ElseIf crxParameterField.ParameterFieldName = "HospName" Then ' crxParameterField.AddCurrentValue pstrHospitalName ' ElseIf crxParameterField.ParameterFieldName = "HospAddress" Then ' crxParameterField.AddCurrentValue pstrHospitalAddress ' Else ' crxParameterField.AddCurrentValue "" ' End If 'pclsUser.medsysclasses.openmainreport "ChargeSlipNew.rpt", pclsUser.CompanyName, pclsUser.CompanyAddress, Trim$(mshflexList.TextMatrix(mshflexList.Row, 6)), Trim$(myClsBilling.MyclsPatient.idnum) 'pclsUser.medsysclasses.openmainreport "ChargeSlipNew.rpt", pclsUser.CompanyName, pclsUser.CompanyAddress, Trim$(mshflexList.TextMatrix(mshflexList.Row, 6)), Trim$(myclsbilling.MyclsPatient.IdNum) 'MsgBox pclsUser.medsysclasses.clsBilling.MyclsPatient.IdNum ' pclsUser.medsysclasses.openmainreport "ChargeSlipNew.rpt" ', "", "", "", pclsUser.CompanyName, pclsUser.CompanyAddress, Trim$(mshflexList.TextMatrix(mshflexList.Row, 6)), Trim$(pclsUser.medsysclasses.clsBilling.MyclsPatient.IdNum) ' pclsUser.medsysclasses.openmainreport "AssessmentSlipNew.RPT", "", "", strAssessnum, myclsbilling.MyclsPatient.IdNum, "OPD Registration Cost Center Slip " + strAssessnum, pclsUser.CompanyName, pclsUser.CompanyAddress, pclsUser.employeecode 'MsgBox pclsUser.medsysclasses.clsBilling.MyclsPatient.IdNum pclsUser.medsysclasses.OpenMainReport "ChargeSlipNew.rpt", "", "", pclsUser.CompanyName, pclsUser.companyaddress, strRefNum, strIdNum 'pclsUser.medsysclasses.clsBilling.MyclsPatient.IdNum 'ByVal strReportFileName As String, RecordSelectionFormula As String, ReportSettings As String, ParamArray strParameters()) ''ShowReportViewer False, "Print ChargeSlip", False ' Dim crxParameterField As CRAXDRT.ParameterFieldDefinition ' Dim intCtr As Integer ' Dim intTotalParam As Integer ' Dim crxtable As CRAXDRT.DatabaseTable ' Dim crxApplication As New CRAXDRT.Application ' Dim strReportFileName As String ' ' If isReprint = False Then ' If strDiscount = "Y" Then ' strReportFileName = App.Path & "ChargeSlipNewDiscount.RPT" ' Else ' strReportFileName = App.Path & "ChargeSlipNew.RPT" ' End If ' Else ' If blnWithDiscount Then ' strReportFileName = App.Path & "ChargeSlipNewDiscount.RPT" ' Else ' strReportFileName = App.Path & "ChargeSlipNew_Reprint.RPT" ' End If ' End If ' ' Set Report = crxApplication.OpenReport(strReportFileName, 1) ' ' Report.ReportTitle = pclsuser.CompanyName ' For Each crxtable In Report.Database.Tables ' crxtable.SetLogOnInfo pclsUser.ServerName, "Patient_Data", pclsUser.UserId, pclsUser.serverpassword ' Next ' ' For Each crxParameterField In Report.ParameterFields ' crxParameterField.ClearCurrentValueAndRange ' If crxParameterField.ParameterFieldName = "@RefNum" Then ' crxParameterField.AddCurrentValue strRefNum ' ElseIf crxParameterField.ParameterFieldName = "@IdNum" Then ' crxParameterField.AddCurrentValue strIDNum ' ElseIf crxParameterField.ParameterFieldName = "Title" Then ' crxParameterField.AddCurrentValue strTitle ' ElseIf crxParameterField.ParameterFieldName = "HospName" Then ' crxParameterField.AddCurrentValue pclsuser.CompanyName ' ElseIf crxParameterField.ParameterFieldName = "HospAddress" Then ' crxParameterField.AddCurrentValue pclsuser.CompanyAddress ' Else ' crxParameterField.AddCurrentValue "" ' End If ' Next ' ' Set crxParameterField = Nothing ' Set crxtable = Nothing ' Set crxApplication = Nothing End Sub Public Function PatientBilled() As Boolean PatientBilled = False If myclsbilling.MyclsPatient.InOut = "I" Then pclsUser.medsysclasses.clsPatientSearch.Admission.Refresh Else pclsUser.medsysclasses.clsPatientSearch.patientclass.clsOutPatient.Refresh End If If (IIf(myclsbilling.MyclsPatient.InOut = "I", pclsUser.medsysclasses.clsPatientSearch.Admission.BillingDatestr <> "", pclsUser.medsysclasses.clsPatientSearch.patientclass.clsOutPatient.BillingDatestr <> "")) Then MsgBox "The patient's account has already been closed. " & vbCrLf & vbCrLf & _ "If you have transactions to make, please notify the Billing staff" & _ " immediately for further instructions.", vbExclamation, "Notification" PatientBilled = True End If End Function