Public Class Form1
Private decLabFee As Decimal ' To hold Lab fee.
Private decMeds As Decimal 'To hold Medication cost.
Private decSurgical As Decimal 'To hold Surgical cost.
Private intLengthOfStay As Integer 'Amount of days stayed at hospital.
Private decPhycical As Decimal 'Hold Amount of Physical Cost.
Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
Me.Close()
End Sub
Private Sub btnCalculate_Click(sender As Object, e As EventArgs) Handles btnCalculate.Click
'This Procedure calculate the total amount of a hospital stay
Dim txtLengthOfStay As Integer
Dim decLabFee As Decimal
Dim decMeds As Decimal
Dim decSurgical As Decimal
Dim decPhysical As Decimal
Dim decTotalCharge As Decimal
'This procedure calculates the total misc expenses of a hospital stay
If Not Decimal.TryParse(txtSurgical.Text, decSurgical) Then
MessageBox.Show("Please enter numeric value for surgical charges")
ElseIf Not Decimal.TryParse(txtLabFee.Text, decLabFee) Then
MessageBox.Show("Please enter numeric value for Lab Fees")
ElseIf Not Decimal.TryParse(txtMeds.Text, decMeds) Then
MessageBox.Show("Please enter numeric value for Medication Charge")
ElseIf Not Decimal.TryParse(txtPhysical.Text, decPhycical) Then
MessageBox.Show("Please enter numeric value for Physical Charge")
ElseIf Not Integer.TryParse(txtLengthOfStay.ToString, intLengthOfStay) Then
MessageBox.Show("Please enter numeric value for Lenth of stay")
Else
'Calculate total charges
lblTotalCost.Text = () '<~~Not sure what epression I should use here or if I even need it at all
End If
End Sub
Function CalcStayCharge(ByVal Days As Double) As Double
'Calcuate Stay Charges.
Dim StayCharge As Double
StayCharge = Days * 350
CalcStayCharge = CDbl(StayCharge.ToString)
MessageBox.Show(CalcStayCharge.ToString("c"))
lblTotalCost.Text = CStr(CalcStayCharge.ToString)
Return CalcStayCharge
End Function
Function CalcMiscCharges(ByVal Meds As Decimal, ByVal LabFee As Decimal,
ByVal Physical As Decimal, ByVal Surgical As Decimal) As Decimal
Dim MiscCharges As Decimal
Meds = CDec(txtMeds.Text)
Surgical = CDec(txtSurgical.Text)
Physical = CDec(txtPhysical.Text)
LabFee = CDec(txtLabFee.Text)
'Calculation for Misc Charge
MiscCharges = Meds + Surgical + Physical + LabFee
CalcMiscCharges = CDec(MiscCharges.ToString)
MessageBox.Show(CalcMiscCharges.ToString)
Return CalcMiscCharges
End Function
Function CalcTotalCharges(ByVal TotalCost As Decimal) As Decimal
Dim StayCharges As Decimal
Dim MiscCharges As Decimal
TotalCost = StayCharges + MiscCharges
CalcTotalCharges = CDec(TotalCost.ToString)
Return CalcTotalCharges + MiscCharges
End Function
Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click
'Clears all text boxes
txtLengthOfStay.Clear()
txtMeds.Clear()
txtSurgical.Clear()
txtLabFee.Clear()
txtPhysical.Clear()
'Clear label boxes
lblTotalCost.Text = String.Empty
End Sub
End Class
Soutta 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.