Attribute VB_Name = "modBillingClinicalArea" Option Explicit Public DefaultDepartmentCode As String Public DefaultDepartmentDesc As String Private GotMarkupSettings As Boolean Public Function Get_MarkUpSettingsCA() If GotMarkupSettings = True Then Exit Function Else GotMarkupSettings = True End If Dim recx As New ADODB.Recordset Dim strSQL As String Dim intQ As Integer On Error GoTo ErrTrap ' search = "Select isnull(isAllowAfterFivePMRate, 0)isAllowAfterFivePMRate, isnull(isAllowHolidayRate,0)isAllowHolidayRate, " & _ ' "isnull(isAllowNewStatRate,0) isAllowNewStatRate, isnull(isAllowWeekendRate,0) isAllowWeekendRate, isnull(isAllowAfterFiveLabChemOnly,0) isAllowAfterFiveLabChemOnly, " & _ ' "isnull(isAllowAfterFiveAllRevenues, 0) isAllowAfterFiveAllRevenues from Clinical_Area..tbGenericModuleSettings WITH (NOLOCK)" strSQL = "Select * from Clinical_Area..tbGenericModuleSettings WITH (NOLOCK)" With recx If .State > 0 Then .Close '.CursorLocation = adUseClient .Open strSQL, pclsUser.sqlconnection, adOpenDynamic, adLockReadOnly If .EOF = False Then isAllowAfterFivePMRate = IIf(!isAllowAfterFivePMRate = 0, False, True) isAllowHolidayRate = IIf(!isAllowHolidayRate = 0, False, True) isAllowNewStatRate = IIf(!isAllowNewStatRate = 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") HolidayRate = !HolidayRate AfterFivePmRate = !AfterFivePmRate WeekendRate = !WeekendRate HolidayAndWeekendRate = !HolidayAndWeekend HolidayAndAfterFivePmRate = !HolidayAndAfterFivePmRate AfterFiveAndWeekend = !WeekendAfterFive MaxMarkupRate = !MaxMarkupRate frmPatInfo.Grid1.Rows = 0 frmPatInfo.Grid1.AddItem "isAllowAfterFivePMRate" & vbTab & isAllowAfterFivePMRate frmPatInfo.Grid1.AddItem "isAllowHolidayRate" & vbTab & isAllowHolidayRate frmPatInfo.Grid1.AddItem "isAllowNewStatRate" & vbTab & isAllowNewStatRate frmPatInfo.Grid1.AddItem "isAllowWeekendRate" & vbTab & isAllowWeekendRate frmPatInfo.Grid1.AddItem "isAllowAfterFiveLabChemOnly" & vbTab & isAllowAfterFiveLabChemOnly frmPatInfo.Grid1.AddItem "isAllowAfterFiveAllRevenues" & vbTab & isAllowAfterFiveAllRevenues frmPatInfo.Grid1.AddItem "dtWeekendStartMarkup" & vbTab & dtWeekendStartMarkup frmPatInfo.Grid1.AddItem "dtWeekendEndMarkup" & vbTab & dtWeekendEndMarkup frmPatInfo.Grid1.AddItem "HolidayRate" & vbTab & HolidayRate frmPatInfo.Grid1.AddItem "AfterFivePmRate" & vbTab & AfterFivePmRate frmPatInfo.Grid1.AddItem "WeekendRate" & vbTab & WeekendRate frmPatInfo.Grid1.AddItem "HolidayAndWeekendRate" & vbTab & HolidayAndWeekendRate frmPatInfo.Grid1.AddItem "HolidayAndAfterFivePmRate" & vbTab & HolidayAndAfterFivePmRate frmPatInfo.Grid1.AddItem "AfterFiveAndWeekend" & vbTab & AfterFiveAndWeekend frmPatInfo.Grid1.AddItem "MaxMarkupRate" & vbTab & MaxMarkupRate End If .Close End With Set recx = Nothing Exit Function ErrTrap: MsgBox "Get_MarkUpSettings " & Err.Description Resume Next End Function Public Sub ComputeRateCA() 'NewShowAmount Dim dblAmount As Double Dim intA As Integer Dim strQuery As String Dim strSQL As String Dim recx As New ADODB.Recordset Dim myType As String Dim FirstRate As Double With frmPostCharge.grdTable If frmPostCharge.chkstat.Value = 1 Then ''''if stat For intA = 1 To .Rows - 1 If .TextMatrix(intA, coItemID) <> "" Then If .TextMatrix(intA, coDepartment) <> "MD" Then myType = pclsUser.medsysclasses.clsBilling.Get_strType If myType = "X" Then ''no added mark up rate dblAmount = Val(.TextMatrix(intA, coQuantity)) * Val(.TextMatrix(intA, coPrice)) + (Val(.TextMatrix(intA, coQuantity)) * Val(.TextMatrix(intA, coPrice)) * Val(dblStatRate) / 100) .TextMatrix(intA, coAmount) = Format(dblAmount, "######0.00") ElseIf myType = "2" Then ''stat and after five pm rate dblAmount = Val(.TextMatrix(intA, coQuantity)) * Val(.TextMatrix(intA, coPrice)) + (Val(.TextMatrix(intA, coQuantity)) * Val(.TextMatrix(intA, coPrice)) * Val(StatAndAfterFivePmRate) / 100) .TextMatrix(intA, coAmount) = Format(dblAmount, "######0.00") ElseIf myType = "3" Then ''stat and weekend rate dblAmount = Val(.TextMatrix(intA, coQuantity)) * Val(.TextMatrix(intA, coPrice)) + (Val(.TextMatrix(intA, coQuantity)) * Val(.TextMatrix(intA, coPrice)) * Val(StatAndWeekendRate) / 100) .TextMatrix(intA, coAmount) = Format(dblAmount, "######0.00") Else '' stat rate and any markup rates = maxrate FirstRate = pclsUser.medsysclasses.clsBilling.get_FirstRate(.TextMatrix(intA, coDepartment), (.TextMatrix(intA, coItemID))) dblAmount = Val(.TextMatrix(intA, coQuantity)) * Val(FirstRate) + ((Val(.TextMatrix(intA, coQuantity)) * Val(FirstRate) * Val(MaxMarkupRate) / 100)) .TextMatrix(intA, coAmount) = Format(dblAmount, "######0.00") End If If isRequest = False Then .TextMatrix(.Row - (intA), coStat) = "Y" Else .TextMatrix(intA, coStat) = "Y" End If Else .TextMatrix(intA, coAmount) = Format(.TextMatrix(intA, coAmount), "######0.00") End If End If Next Else ''' if not stat - unchecked stat button For intA = 1 To .Rows - 1 If .TextMatrix(intA, coItemID) <> "" Then If .TextMatrix(intA, coDepartment) <> "MD" Then dblAmount = Val(.TextMatrix(intA, coQuantity)) * Val(.TextMatrix(intA, coPrice)) '4 = price, 5=quantity .TextMatrix(intA, coAmount) = Format(dblAmount, "0.00") .TextMatrix(intA, coStat) = "N" Else .TextMatrix(intA, coAmount) = Format(.TextMatrix(intA, coAmount), "0.00") End If End If Next End If End With Set recx = Nothing End Sub Public Sub CancelChargesCA() With frmPostCharge Dim recUpdateArCode As New ADODB.Recordset Dim strUpdaterecArcode As String Dim strAmt As String Dim recCancel As New ADODB.Recordset Dim intZero As Double Dim tmpRevenueID As String Dim strPType As String .cmdReprint.Visible = True .cmdCancelCharge.Visible = True 'Verify if can cancel the charge intZero = 0# recCancel.Open "Clinical_Area..spGeneric_CancelCharges '" & .txtId.Text & "','" & .mshflexList.TextMatrix(.mshflexList.Row, 2) & "','" & .mshflexList.TextMatrix(.mshflexList.Row, 6) & "','" & .mshflexList.TextMatrix(.mshflexList.Row, 1) & "'", pclsUser.sqlconnection, adOpenForwardOnly, adLockOptimistic If Not recCancel.EOF Then If recCancel!Amount <= intZero Then MsgBox "Can't Cancel this Charges. The Total Amount is already Zero!", vbCritical + vbOKOnly, "Message" recCancel.Close Set recCancel = Nothing Exit Sub End If recCancel.Close Set recCancel = Nothing End If If MsgBox("Are you sure you want to Cancel this Charge?", vbQuestion + vbYesNo) = vbYes Then Else 'Me.tmrTimer.Enabled = True Exit Sub End If With frmPostCharge strAmt = .mshflexList.TextMatrix(.mshflexList.Row, 5) recUpdateArCode.Open "station..sp_OPD_ArCode'" & .mshflexList.TextMatrix(.mshflexList.Row, 1) & "'", pclsUser.sqlconnection, adOpenDynamic, adLockOptimistic If Not recUpdateArCode.EOF Then strUpdaterecArcode = IIf(IsNull(recUpdateArCode!cmcode), "", recUpdateArCode!cmcode) End If If Trim$(.mshflexList.TextMatrix(.mshflexList.Row, 9)) <> "" Then tmpRevenueID = Get_StockCardRevenueID(Trim$(.mshflexList.TextMatrix(.mshflexList.Row, 1))) End If If .mshflexList.TextMatrix(.mshflexList.Row, 9) <> "" Then pclsUser.medsysclasses.clsDrug.Drug.AppendStockCard .txtPno.Text, _ .txtId.Text, _ .mshflexList.TextMatrix(.mshflexList.Row, 2), _ Format(pclsUser.medsysclasses.Get_TransactionDate, "mm/dd/yyyy hh:mm:ss AM/PM"), _ .mshflexList.TextMatrix(.mshflexList.Row, 6), _ Val(.mshflexList.TextMatrix(.mshflexList.Row, 4) * (-1)), _ 0, _ Val(.mshflexList.TextMatrix(.mshflexList.Row, 5) * (-1)), _ pclsUser.EmployeeCode, _ "", _ "", _ .mshflexList.TextMatrix(.mshflexList.Row, 9), _ "", _ .txtRoom.Text, _ 1, _ tmpRevenueID, tmpRevenueID, , , , , "O", , , , 0 'IIf(.TextMatrix(.Row, 1) = "CS" Or .TextMatrix(.Row, 1) = "OS" Or .TextMatrix(.Row, 1) = "DZ" Or .TextMatrix(.Row, 1) = "FF", "CS", "PH"), _ 'IIf(.TextMatrix(.Row, 1) = "CS" Or .TextMatrix(.Row, 1) = "OM" Or .TextMatrix(.Row, 1) = "DA" Or .TextMatrix(.Row, 1) = "FF", "PH", "CS"), , , , , "O", , , , 0 Else If Check_WithDiscount(Trim$(.mshflexList.TextMatrix(.mshflexList.Row, 6)), Trim$(.txtId.Text)) Then pclsUser.sqlconnection.Execute "Patient_data..opd_autorecompute_discount '" & .mshflexList.TextMatrix(.mshflexList.Row, 6) & _ "','" & .txtId.Text & "','" & strAmt & "'" End If If Right(.txtId.Text, 1) = "B" Then strPType = "O" Else strPType = "I" End If pclsUser.sqlconnection.Execute "STATION..OPDRegistration_UpdateCharging '" & .txtPno.Text & _ "','" & .txtId.Text & "','" & .mshflexList.TextMatrix(.mshflexList.Row, 2) & _ "','" & strAmt & "','" & .mshflexList.TextMatrix(.mshflexList.Row, 4) & _ "','" & Format$(pclsUser.medsysclasses.Get_TransactionDate, "MM/DD/YYYY hh:mm:ss AM/PM") & "','" & .mshflexList.TextMatrix(.mshflexList.Row, 1) & _ "','" & pclsUser.EmployeeCode & "','" & strPType & _ "','" & "C" & "','" & .txtRoom.Text & _ "','" & .mshflexList.TextMatrix(.mshflexList.Row, 6) & "','" & strUpdaterecArcode & "'" End If End With .mshflexList.Refresh .Get_Charges End With Exit Sub End Sub