V 3 Code

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 47

Public Class Form1

Private Sub DateTimePicker1_ValueChanged(sender As Object, e As EventArgs) Handles


DateTimePicker1.ValueChanged

DateTimePicker1.Format = DateTimePickerFormat.Custom

DateTimePicker1.CustomFormat = "dd/ MMM /yyyy"

End Sub

Private Sub ComboBox1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles


ComboBox1.KeyPress

e.Handled = True

End Sub

Private Sub ComboBox2_KeyPress(sender As Object, e As KeyPressEventArgs) Handles


ComboBox2.KeyPress

e.Handled = True

End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles btnCompute.Click

Dim presentRead As Integer

Dim prevRead As Integer

Dim days As String

days = DateTimePicker1.Value.Day - DateTime.Now.Day

Label5.Text = days
If days >= 1 And days <= 10 Then

If ComboBox1.Text = "Residential/Government" Then

presentRead = txtPresRead.Text

prevRead = txtPrevRead.Text

lblConsumpt.Visible = True

lblTotalAmount.Visible = True

Label5.Visible = True

If prevRead > presentRead Then

MsgBox("Input Incorrect! Enter correct reading.")

txtPresRead.Clear()

txtPrevRead.Clear()

lblConsumpt.Visible = False

lblTotalAmount.Visible = False

Label5.Visible = False

Else

Dim consumption As Integer

Dim total As Double

consumption = presentRead - prevRead

lblConsumpt.Text = consumption
If ComboBox2.Text = "1/2" Then

If consumption > 40 Then

consumption = consumption - 40

total = 172.5 + (consumption * 28.8) + (24.65 * 10) + (21.4 * 10) + (18.9 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 30 And consumption <= 40 Then

consumption = consumption - 30

total = 172.5 + (24.65 * consumption) + (21.4 * 10) + (18.9 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 20 And consumption <= 30 Then

consumption = consumption - 20

total = 172.5 + (21.4 * consumption) + (18.9 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 10 And consumption <= 20 Then

consumption = consumption - 10

total = 172.5 + (18.9 * consumption)

lblTotalAmount.Text = total + 10 - (total * 0.1)

Else lblTotalAmount.Text = 172.5 + 10 - (182.5 * 0.1)

End If
ElseIf ComboBox2.Text = "3/4" Then

If consumption > 40 Then

consumption = consumption - 40

total = 276.0 + (consumption * 28.8) + (24.65 * 10) + (21.4 * 10) + (18.9 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 30 And consumption <= 40 Then

consumption = consumption - 30

total = 276.0 + (24.65 * consumption) + (21.4 * 10) + (18.9 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 20 And consumption <= 30 Then

consumption = consumption - 20

total = 276.0 + (21.4 * consumption) + (18.9 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 10 And consumption <= 20 Then

consumption = consumption - 10

total = 276.0 + (18.9 * consumption)

lblTotalAmount.Text = total + 10 - (total * 0.1)

Else

lblTotalAmount.Text = 276.0 + 10 - (286 * 0.1)

End If

ElseIf ComboBox2.Text = "1" Then

If consumption > 40 Then

consumption = consumption - 40
total = 552.0 + (consumption * 28.8) + (24.65 * 10) + (21.4 * 10) + (18.9 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 30 And consumption <= 40 Then

consumption = consumption - 30

total = 552.0 + (24.65 * consumption) + (21.4 * 10) + (18.9 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 20 And consumption <= 30 Then

consumption = consumption - 20

total = 552.0 + (21.4 * consumption) + (18.9 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 10 And consumption <= 20 Then

consumption = consumption - 10

total = 552.0 + (18.9 * consumption)

lblTotalAmount.Text = total + 10 - (total * 0.1)

Else

lblTotalAmount.Text = 552.0 + 10 - (562 * 0.1)

End If

ElseIf ComboBox2.Text = "1 1/2" Then

If consumption > 40 Then

consumption = consumption - 40

total = 1380.0 + (consumption * 28.8) + (24.65 * 10) + (21.4 * 10) + (18.9 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 30 And consumption <= 40 Then


consumption = consumption - 30

total = 1380.0 + (24.65 * consumption) + (21.4 * 10) + (18.9 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 20 And consumption <= 30 Then

consumption = consumption - 20

total = 1380.0 + (21.4 * consumption) + (18.9 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 10 And consumption <= 20 Then

consumption = consumption - 10

total = 1380.0 + (18.9 * consumption)

lblTotalAmount.Text = total + 10 - (total * 0.1)

Else

lblTotalAmount.Text = 1380.0 + 10 - (1390 * 0.1)

End If

ElseIf ComboBox2.Text = "2" Then

If consumption > 40 Then

consumption = consumption - 40

total = 3450.0 + (consumption * 28.8) + (24.65 * 10) + (21.4 * 10) + (18.9 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 30 And consumption <= 40 Then

consumption = consumption - 30

total = 3450.0 + (24.65 * consumption) + (21.4 * 10) + (18.9 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.1)


ElseIf consumption > 20 And consumption <= 30 Then

consumption = consumption - 20

total = 3450.0 + (21.4 * consumption) + (18.9 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 10 And consumption <= 20 Then

consumption = consumption - 10

total = 3450.0 + (18.9 * consumption)

lblTotalAmount.Text = total + 10 - (total * 0.1)

Else

lblTotalAmount.Text = 3450.0 + 10 - (3460 * 0.1)

End If

ElseIf ComboBox2.Text = "3" Then

If consumption > 40 Then

consumption = consumption - 40

total = 6210.0 + (consumption * 28.8) + (24.65 * 10) + (21.4 * 10) + (18.9 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 30 And consumption <= 40 Then

consumption = consumption - 30

total = 6210.0 + (24.65 * consumption) + (21.4 * 10) + (18.9 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 20 And consumption <= 30 Then

consumption = consumption - 20

total = 6210.0 + (21.4 * consumption) + (18.9 * 10)


lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 10 And consumption <= 20 Then

consumption = consumption - 10

total = 6210.0 + (18.9 * consumption)

lblTotalAmount.Text = total + 10 - (total * 0.1)

Else

lblTotalAmount.Text = 6210.0 + 10 - (6220 * 0.1)

End If

ElseIf ComboBox2.Text = "4" Then

If consumption > 40 Then

consumption = consumption - 40

total = 12420.0 + (consumption * 28.8) + (24.65 * 10) + (21.4 * 10) + (18.9 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 30 And consumption <= 40 Then

consumption = consumption - 30

total = 12420.0 + (24.65 * consumption) + (21.4 * 10) + (18.9 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 20 And consumption <= 30 Then

consumption = consumption - 20

total = 12420.0 + (21.4 * consumption) + (18.9 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 10 And consumption <= 20 Then

consumption = consumption - 10
total = 12420.0 + (18.9 * consumption)

lblTotalAmount.Text = total + 10 - (total * 0.1)

Else

lblTotalAmount.Text = 12420.0 + 10 - (12430 * 0.1)

End If

End If

End If

ElseIf ComboBox1.Text = "Commercial/Industrial" Then

presentRead = txtPresRead.Text

prevRead = txtPrevRead.Text

lblConsumpt.Visible = True

lblTotalAmount.Visible = True

Label5.Visible = True

If prevRead > presentRead Then

MsgBox("Input Incorrect! Enter correct reading.")

txtPresRead.Clear()

txtPrevRead.Clear()

lblConsumpt.Visible = False

lblTotalAmount.Visible = False

Label5.Visible = False
Else

Dim consumption As Integer

Dim total As Double

consumption = presentRead - prevRead

lblConsumpt.Text = consumption

If ComboBox2.Text = "1/2" Then

If consumption > 40 Then

consumption = consumption - 40

total = 172.5 + (consumption * 57.6) + (49.3 * 10) + (42.8 * 10) + (37.8 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 30 And consumption <= 40 Then

consumption = consumption - 30

total = 172.5 + (49.3 * consumption) + (42.8 * 10) + (37.8 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 20 And consumption <= 30 Then

consumption = consumption - 20

total = 172.5 + (42.8 * consumption) + (37.8 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 10 And consumption <= 20 Then

consumption = consumption - 10
total = 172.5 + (37.8 * consumption)

lblTotalAmount.Text = total + 10 - (total * 0.1)

Else

lblTotalAmount.Text = 345.0 + 10 - (355 * 0.1)

End If

ElseIf ComboBox2.Text = "3/4" Then

If consumption > 40 Then

consumption = consumption - 40

total = 552.0 + (consumption * 57.6) + (49.3 * 10) + (42.8 * 10) + (37.8 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 30 And consumption <= 40 Then

consumption = consumption - 30

total = 552.0 + (49.3 * consumption) + (42.8 * 10) + (37.8 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 20 And consumption <= 30 Then

consumption = consumption - 20

total = 552.0 + (42.8 * consumption) + (37.8 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 10 And consumption <= 20 Then

consumption = consumption - 10

total = 552.0 + (37.8 * consumption)

lblTotalAmount.Text = total + 10 - (total * 0.1)

Else
lblTotalAmount.Text = 552.0 + 10 - (562 * 0.1)

End If

ElseIf ComboBox2.Text = "1" Then

If consumption > 40 Then

consumption = consumption - 40

total = 1104.0 + (consumption * 57.6) + (49.3 * 10) + (42.8 * 10) + (37.8 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 30 And consumption <= 40 Then

consumption = consumption - 30

total = 1104.0 + (49.3 * consumption) + (42.8 * 10) + (37.8 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 20 And consumption <= 30 Then

consumption = consumption - 20

total = 1104.0 + (42.8 * consumption) + (37.8 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 10 And consumption <= 20 Then

consumption = consumption - 10

total = 1104.0 + (37.8 * consumption)

lblTotalAmount.Text = total + 10 - (total * 0.1)

Else

lblTotalAmount.Text = 1104.0 + 10 - (1114 * 0.1)

End If
ElseIf ComboBox2.Text = "1 1/2" Then

If consumption > 40 Then

consumption = consumption - 40

total = 2760.0 + (consumption * 57.6) + (49.3 * 10) + (42.8 * 10) + (37.8 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 30 And consumption <= 40 Then

consumption = consumption - 30

total = 2760.0 + (49.3 * consumption) + (42.8 * 10) + (37.8 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 20 And consumption <= 30 Then

consumption = consumption - 20

total = 2760.0 + (42.8 * consumption) + (37.8 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 10 And consumption <= 20 Then

consumption = consumption - 10

total = 2760.0 + (37.8 * consumption)

lblTotalAmount.Text = total + 10 - (total * 0.1)

Else

lblTotalAmount.Text = 2760.0 + 10 - (2770 * 0.1)

End If

ElseIf ComboBox2.Text = "2" Then

If consumption > 40 Then


consumption = consumption - 40

total = 6900.0 + (consumption * 57.6) + (49.3 * 10) + (42.8 * 10) + (37.8 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 30 And consumption <= 40 Then

consumption = consumption - 30

total = 6900.0 + (49.3 * consumption) + (42.8 * 10) + (37.8 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 20 And consumption <= 30 Then

consumption = consumption - 20

total = 6900.0 + (42.8 * consumption) + (37.8 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 10 And consumption <= 20 Then

consumption = consumption - 10

total = 6900.0 + (37.8 * consumption)

lblTotalAmount.Text = total + 10 - (total * 0.1)

Else

lblTotalAmount.Text = 6900.0 + 10 - (6910 * 0.1)

End If

ElseIf ComboBox2.Text = "3" Then

If consumption > 40 Then

consumption = consumption - 40

total = 12420.0 + (consumption * 57.6) + (49.3 * 10) + (42.8 * 10) + (37.8 * 10)
lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 30 And consumption <= 40 Then

consumption = consumption - 30

total = 12420.0 + (49.3 * consumption) + (42.8 * 10) + (37.8 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 20 And consumption <= 30 Then

consumption = consumption - 20

total = 12420.0 + (42.8 * consumption) + (37.8 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 10 And consumption <= 20 Then

consumption = consumption - 10

total = 12420.0 + (37.8 * consumption)

lblTotalAmount.Text = total + 10 - (total * 0.1)

Else

lblTotalAmount.Text = 12420.0 + 10 - (12430 * 0.1)

End If

ElseIf ComboBox2.Text = "4" Then

If consumption > 40 Then

consumption = consumption - 40

total = 24840.0 + (consumption * 57.6) + (49.3 * 10) + (42.8 * 10) + (37.8 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 30 And consumption <= 40 Then


consumption = consumption - 30

total = 24840.0 + (49.3 * consumption) + (42.8 * 10) + (37.8 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 20 And consumption <= 30 Then

consumption = consumption - 20

total = 24840.0 + (42.8 * consumption) + (37.8 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.1)

ElseIf consumption > 10 And consumption <= 20 Then

consumption = consumption - 10

total = 24840.0 + (37.8 * consumption)

lblTotalAmount.Text = total + 10 - (total * 0.1)

Else

lblTotalAmount.Text = 24840.0 + 10 - (24850 * 0.1)

End If

End If

End If

End If

ElseIf days >= 11 And days <= 15 Then

If ComboBox1.Text = "Residential/Government" Then

presentRead = txtPresRead.Text
prevRead = txtPrevRead.Text

lblConsumpt.Visible = True

lblTotalAmount.Visible = True

Label5.Visible = True

If prevRead > presentRead Then

MsgBox("Input Incorrect! Enter correct reading.")

txtPresRead.Clear()

txtPrevRead.Clear()

lblConsumpt.Visible = False

lblTotalAmount.Visible = False

Label5.Visible = False

Else

Dim consumption As Integer

Dim total As Double

consumption = presentRead - prevRead

lblConsumpt.Text = consumption

If ComboBox2.Text = "1/2" Then

If consumption > 40 Then

consumption = consumption - 40
total = 172.5 + (consumption * 28.8) + (24.65 * 10) + (21.4 * 10) + (18.9 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.05)

ElseIf consumption > 30 And consumption <= 40 Then

consumption = consumption - 30

total = 172.5 + (24.65 * consumption) + (21.4 * 10) + (18.9 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.05)

ElseIf consumption > 20 And consumption <= 30 Then

consumption = consumption - 20

total = 172.5 + (21.4 * consumption) + (18.9 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.05)

ElseIf consumption > 10 And consumption <= 20 Then

consumption = consumption - 10

total = 172.5 + (18.9 * consumption)

lblTotalAmount.Text = total + 10 - (total * 0.05)

Else

lblTotalAmount.Text = 172.5 + 10 - (182.5 * 0.05)

End If

ElseIf ComboBox2.Text = "3/4" Then

If consumption > 40 Then

consumption = consumption - 40

total = 276.0 + (consumption * 28.8) + (24.65 * 10) + (21.4 * 10) + (18.9 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.05)


ElseIf consumption > 30 And consumption <= 40 Then

consumption = consumption - 30

total = 276.0 + (24.65 * consumption) + (21.4 * 10) + (18.9 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.05)

ElseIf consumption > 20 And consumption <= 30 Then

consumption = consumption - 20

total = 276.0 + (21.4 * consumption) + (18.9 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.05)

ElseIf consumption > 10 And consumption <= 20 Then

consumption = consumption - 10

total = 276.0 + (18.9 * consumption)

lblTotalAmount.Text = total + 10 - (total * 0.05)

Else

lblTotalAmount.Text = 276.0 + 10 - (286 * 0.05)

End If

ElseIf ComboBox2.Text = "1" Then

If consumption > 40 Then

consumption = consumption - 40

total = 552.0 + (consumption * 28.8) + (24.65 * 10) + (21.4 * 10) + (18.9 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.05)

ElseIf consumption > 30 And consumption <= 40 Then

consumption = consumption - 30

total = 552.0 + (24.65 * consumption) + (21.4 * 10) + (18.9 * 10)


lblTotalAmount.Text = total + 10 - (total * 0.05)

ElseIf consumption > 20 And consumption <= 30 Then

consumption = consumption - 20

total = 552.0 + (21.4 * consumption) + (18.9 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.05)

ElseIf consumption > 10 And consumption <= 20 Then

consumption = consumption - 10

total = 552.0 + (18.9 * consumption)

lblTotalAmount.Text = total + 10 - (total * 0.05)

Else

lblTotalAmount.Text = 552.0 + 10 - (562 * 0.05)

End If

ElseIf ComboBox2.Text = "1 1/2" Then

If consumption > 40 Then

consumption = consumption - 40

total = 1380.0 + (consumption * 28.8) + (24.65 * 10) + (21.4 * 10) + (18.9 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.05)

ElseIf consumption > 30 And consumption <= 40 Then

consumption = consumption - 30

total = 1380.0 + (24.65 * consumption) + (21.4 * 10) + (18.9 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.05)

ElseIf consumption > 20 And consumption <= 30 Then

consumption = consumption - 20
total = 1380.0 + (21.4 * consumption) + (18.9 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.05)

ElseIf consumption > 10 And consumption <= 20 Then

consumption = consumption - 10

total = 1380.0 + (18.9 * consumption)

lblTotalAmount.Text = total + 10 - (total * 0.05)

Else

lblTotalAmount.Text = 1380.0 + 10 - (1390 * 0.05)

End If

ElseIf ComboBox2.Text = "2" Then

If consumption > 40 Then

consumption = consumption - 40

total = 3450.0 + (consumption * 28.8) + (24.65 * 10) + (21.4 * 10) + (18.9 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.05)

ElseIf consumption > 30 And consumption <= 40 Then

consumption = consumption - 30

total = 3450.0 + (24.65 * consumption) + (21.4 * 10) + (18.9 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.05)

ElseIf consumption > 20 And consumption <= 30 Then

consumption = consumption - 20

total = 3450.0 + (21.4 * consumption) + (18.9 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.05)

ElseIf consumption > 10 And consumption <= 20 Then


consumption = consumption - 10

total = 3450.0 + (18.9 * consumption)

lblTotalAmount.Text = total + 10 - (total * 0.05)

Else

lblTotalAmount.Text = 3450.0 + 10 - (3460 * 0.05)

End If

ElseIf ComboBox2.Text = "3" Then

If consumption > 40 Then

consumption = consumption - 40

total = 6210.0 + (consumption * 28.8) + (24.65 * 10) + (21.4 * 10) + (18.9 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.05)

ElseIf consumption > 30 And consumption <= 40 Then

consumption = consumption - 30

total = 6210.0 + (24.65 * consumption) + (21.4 * 10) + (18.9 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.05)

ElseIf consumption > 20 And consumption <= 30 Then

consumption = consumption - 20

total = 6210.0 + (21.4 * consumption) + (18.9 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.05)

ElseIf consumption > 10 And consumption <= 20 Then

consumption = consumption - 10

total = 6210.0 + (18.9 * consumption)

lblTotalAmount.Text = total + 10 - (total * 0.05)


Else

lblTotalAmount.Text = 6210.0 + 10 - (6220 * 0.05)

End If

ElseIf ComboBox2.Text = "4" Then

If consumption > 40 Then

consumption = consumption - 40

total = 12420.0 + (consumption * 28.8) + (24.65 * 10) + (21.4 * 10) + (18.9 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.05)

ElseIf consumption > 30 And consumption <= 40 Then

consumption = consumption - 30

total = 12420.0 + (24.65 * consumption) + (21.4 * 10) + (18.9 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.05)

ElseIf consumption > 20 And consumption <= 30 Then

consumption = consumption - 20

total = 12420.0 + (21.4 * consumption) + (18.9 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.05)

ElseIf consumption > 10 And consumption <= 20 Then

consumption = consumption - 10

total = 12420.0 + (18.9 * consumption)

lblTotalAmount.Text = total + 10 - (total * 0.05)

Else

lblTotalAmount.Text = 12420.0 + 10 - (12430 * 0.05)


End If

End If

End If

ElseIf ComboBox1.Text = "Commercial/Industrial" Then

presentRead = txtPresRead.Text

prevRead = txtPrevRead.Text

lblConsumpt.Visible = True

lblTotalAmount.Visible = True

Label5.Visible = True

If prevRead > presentRead Then

MsgBox("Input Incorrect! Enter correct reading.")

txtPresRead.Clear()

txtPrevRead.Clear()

lblConsumpt.Visible = False

lblTotalAmount.Visible = False

Label5.Visible = True

Else

Dim consumption As Integer

Dim total As Double

consumption = presentRead - prevRead


lblConsumpt.Text = consumption

If ComboBox2.Text = "1/2" Then

If consumption > 40 Then

consumption = consumption - 40

total = 172.5 + (consumption * 57.6) + (49.3 * 10) + (42.8 * 10) + (37.8 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.05)

ElseIf consumption > 30 And consumption <= 40 Then

consumption = consumption - 30

total = 172.5 + (49.3 * consumption) + (42.8 * 10) + (37.8 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.05)

ElseIf consumption > 20 And consumption <= 30 Then

consumption = consumption - 20

total = 172.5 + (42.8 * consumption) + (37.8 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.05)

ElseIf consumption > 10 And consumption <= 20 Then

consumption = consumption - 10

total = 172.5 + (37.8 * consumption)

lblTotalAmount.Text = total + 10 - (total * 0.05)

Else

lblTotalAmount.Text = 345.0 + 10 - (355 * 0.05)

End If
ElseIf ComboBox2.Text = "3/4" Then

If consumption > 40 Then

consumption = consumption - 40

total = 552.0 + (consumption * 57.6) + (49.3 * 10) + (42.8 * 10) + (37.8 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.05)

ElseIf consumption > 30 And consumption <= 40 Then

consumption = consumption - 30

total = 552.0 + (49.3 * consumption) + (42.8 * 10) + (37.8 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.05)

ElseIf consumption > 20 And consumption <= 30 Then

consumption = consumption - 20

total = 552.0 + (42.8 * consumption) + (37.8 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.05)

ElseIf consumption > 10 And consumption <= 20 Then

consumption = consumption - 10

total = 552.0 + (37.8 * consumption)

lblTotalAmount.Text = total + 10 - (total * 0.05)

Else

lblTotalAmount.Text = 552.0 + 10 - (562 * 0.05)

End If

ElseIf ComboBox2.Text = "1" Then

If consumption > 40 Then


consumption = consumption - 40

total = 1104.0 + (consumption * 57.6) + (49.3 * 10) + (42.8 * 10) + (37.8 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.05)

ElseIf consumption > 30 And consumption <= 40 Then

consumption = consumption - 30

total = 1104.0 + (49.3 * consumption) + (42.8 * 10) + (37.8 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.05)

ElseIf consumption > 20 And consumption <= 30 Then

consumption = consumption - 20

total = 1104.0 + (42.8 * consumption) + (37.8 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.05)

ElseIf consumption > 10 And consumption <= 20 Then

consumption = consumption - 10

total = 1104.0 + (37.8 * consumption)

lblTotalAmount.Text = total + 10 - (total * 0.05)

Else

lblTotalAmount.Text = 1104.0 + 10 - (1114 * 0.05)

End If

ElseIf ComboBox2.Text = "1 1/2" Then

If consumption > 40 Then

consumption = consumption - 40

total = 2760.0 + (consumption * 57.6) + (49.3 * 10) + (42.8 * 10) + (37.8 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.05)


ElseIf consumption > 30 And consumption <= 40 Then

consumption = consumption - 30

total = 2760.0 + (49.3 * consumption) + (42.8 * 10) + (37.8 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.05)

ElseIf consumption > 20 And consumption <= 30 Then

consumption = consumption - 20

total = 2760.0 + (42.8 * consumption) + (37.8 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.05)

ElseIf consumption > 10 And consumption <= 20 Then

consumption = consumption - 10

total = 2760.0 + (37.8 * consumption)

lblTotalAmount.Text = total + 10 - (total * 0.05)

Else

lblTotalAmount.Text = 2760.0 + 10 - (2770 * 0.05)

End If

ElseIf ComboBox2.Text = "2" Then

If consumption > 40 Then

consumption = consumption - 40

total = 6900.0 + (consumption * 57.6) + (49.3 * 10) + (42.8 * 10) + (37.8 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.05)

ElseIf consumption > 30 And consumption <= 40 Then

consumption = consumption - 30

total = 6900.0 + (49.3 * consumption) + (42.8 * 10) + (37.8 * 10)


lblTotalAmount.Text = total + 10 - (total * 0.05)

ElseIf consumption > 20 And consumption <= 30 Then

consumption = consumption - 20

total = 6900.0 + (42.8 * consumption) + (37.8 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.05)

ElseIf consumption > 10 And consumption <= 20 Then

consumption = consumption - 10

total = 6900.0 + (37.8 * consumption)

lblTotalAmount.Text = total + 10 - (total * 0.05)

Else

lblTotalAmount.Text = 6900.0 + 10 - (6910 * 0.05)

End If

ElseIf ComboBox2.Text = "3" Then

If consumption > 40 Then

consumption = consumption - 40

total = 12420.0 + (consumption * 57.6) + (49.3 * 10) + (42.8 * 10) + (37.8 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.05)

ElseIf consumption > 30 And consumption <= 40 Then

consumption = consumption - 30

total = 12420.0 + (49.3 * consumption) + (42.8 * 10) + (37.8 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.05)

ElseIf consumption > 20 And consumption <= 30 Then


consumption = consumption - 20

total = 12420.0 + (42.8 * consumption) + (37.8 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.05)

ElseIf consumption > 10 And consumption <= 20 Then

consumption = consumption - 10

total = 12420.0 + (37.8 * consumption)

lblTotalAmount.Text = total + 10 - (total * 0.05)

Else

lblTotalAmount.Text = 12420.0 + 10 - (12430 * 0.05)

End If

ElseIf ComboBox2.Text = "4" Then

If consumption > 40 Then

consumption = consumption - 40

total = 24840.0 + (consumption * 57.6) + (49.3 * 10) + (42.8 * 10) + (37.8 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.05)

ElseIf consumption > 30 And consumption <= 40 Then

consumption = consumption - 30

total = 24840.0 + (49.3 * consumption) + (42.8 * 10) + (37.8 * 10)

lblTotalAmount.Text = total + 10 - (total * 0.05)

ElseIf consumption > 20 And consumption <= 30 Then

consumption = consumption - 20

total = 24840.0 + (42.8 * consumption) + (37.8 * 10)


lblTotalAmount.Text = total + 10 - (total * 0.05)

ElseIf consumption > 10 And consumption <= 20 Then

consumption = consumption - 10

total = 24840.0 + (37.8 * consumption)

lblTotalAmount.Text = total + 10 - (total * 0.05)

Else

lblTotalAmount.Text = 24840.0 + 10 - (24850 * 0.05)

End If

End If

End If

End If

Else

If ComboBox1.Text = "Residential/Government" Then

presentRead = txtPresRead.Text

prevRead = txtPrevRead.Text

lblConsumpt.Visible = True

lblTotalAmount.Visible = True

Label5.Visible = True
If prevRead > presentRead Then

MsgBox("Input Incorrect! Enter correct reading.")

txtPresRead.Clear()

txtPrevRead.Clear()

lblConsumpt.Visible = False

lblTotalAmount.Visible = False

Label5.Visible = False

Else

Dim consumption As Integer

Dim total As Double

consumption = presentRead - prevRead

lblConsumpt.Text = consumption

If ComboBox2.Text = "1/2" Then

If consumption > 40 Then

consumption = consumption - 40

total = 172.5 + (consumption * 28.8) + (24.65 * 10) + (21.4 * 10) + (18.9 * 10)

lblTotalAmount.Text = total + 10

ElseIf consumption > 30 And consumption <= 40 Then

consumption = consumption - 30

total = 172.5 + (24.65 * consumption) + (21.4 * 10) + (18.9 * 10)


lblTotalAmount.Text = total + 10

ElseIf consumption > 20 And consumption <= 30 Then

consumption = consumption - 20

total = 172.5 + (21.4 * consumption) + (18.9 * 10)

lblTotalAmount.Text = total + 10

ElseIf consumption > 10 And consumption <= 20 Then

consumption = consumption - 10

total = 172.5 + (18.9 * consumption)

lblTotalAmount.Text = total + 10

Else

lblTotalAmount.Text = 172.5 + 10

End If

ElseIf ComboBox2.Text = "3/4" Then

If consumption > 40 Then

consumption = consumption - 40

total = 276.0 + (consumption * 28.8) + (24.65 * 10) + (21.4 * 10) + (18.9 * 10)

lblTotalAmount.Text = total + 10

ElseIf consumption > 30 And consumption <= 40 Then

consumption = consumption - 30

total = 276.0 + (24.65 * consumption) + (21.4 * 10) + (18.9 * 10)

lblTotalAmount.Text = total + 10

ElseIf consumption > 20 And consumption <= 30 Then


consumption = consumption - 20

total = 276.0 + (21.4 * consumption) + (18.9 * 10)

lblTotalAmount.Text = total + 10

ElseIf consumption > 10 And consumption <= 20 Then

consumption = consumption - 10

total = 276.0 + (18.9 * consumption)

lblTotalAmount.Text = total + 10

Else

lblTotalAmount.Text = 276.0 + 10

End If

ElseIf ComboBox2.Text = "1" Then

If consumption > 40 Then

consumption = consumption - 40

total = 552.0 + (consumption * 28.8) + (24.65 * 10) + (21.4 * 10) + (18.9 * 10)

lblTotalAmount.Text = total + 10

ElseIf consumption > 30 And consumption <= 40 Then

consumption = consumption - 30

total = 552.0 + (24.65 * consumption) + (21.4 * 10) + (18.9 * 10)

lblTotalAmount.Text = total + 10

ElseIf consumption > 20 And consumption <= 30 Then

consumption = consumption - 20

total = 552.0 + (21.4 * consumption) + (18.9 * 10)

lblTotalAmount.Text = total + 10
ElseIf consumption > 10 And consumption <= 20 Then

consumption = consumption - 10

total = 552.0 + (18.9 * consumption)

lblTotalAmount.Text = total + 10

Else

lblTotalAmount.Text = 552.0 + 10

End If

ElseIf ComboBox2.Text = "1 1/2" Then

If consumption > 40 Then

consumption = consumption - 40

total = 1380.0 + (consumption * 28.8) + (24.65 * 10) + (21.4 * 10) + (18.9 * 10)

lblTotalAmount.Text = total + 10

ElseIf consumption > 30 And consumption <= 40 Then

consumption = consumption - 30

total = 1380.0 + (24.65 * consumption) + (21.4 * 10) + (18.9 * 10)

lblTotalAmount.Text = total + 10

ElseIf consumption > 20 And consumption <= 30 Then

consumption = consumption - 20

total = 1380.0 + (21.4 * consumption) + (18.9 * 10)

lblTotalAmount.Text = total + 10

ElseIf consumption > 10 And consumption <= 20 Then

consumption = consumption - 10

total = 1380.0 + (18.9 * consumption)


lblTotalAmount.Text = total + 10

Else

lblTotalAmount.Text = 1380.0 + 10

End If

ElseIf ComboBox2.Text = "2" Then

If consumption > 40 Then

consumption = consumption - 40

total = 3450.0 + (consumption * 28.8) + (24.65 * 10) + (21.4 * 10) + (18.9 * 10)

lblTotalAmount.Text = total + 10

ElseIf consumption > 30 And consumption <= 40 Then

consumption = consumption - 30

total = 3450.0 + (24.65 * consumption) + (21.4 * 10) + (18.9 * 10)

lblTotalAmount.Text = total + 10

ElseIf consumption > 20 And consumption <= 30 Then

consumption = consumption - 20

total = 3450.0 + (21.4 * consumption) + (18.9 * 10)

lblTotalAmount.Text = total + 10

ElseIf consumption > 10 And consumption <= 20 Then

consumption = consumption - 10

total = 3450.0 + (18.9 * consumption)

lblTotalAmount.Text = total + 10

Else

lblTotalAmount.Text = 3450.0 + 10
End If

ElseIf ComboBox2.Text = "3" Then

If consumption > 40 Then

consumption = consumption - 40

total = 6210.0 + (consumption * 28.8) + (24.65 * 10) + (21.4 * 10) + (18.9 * 10)

lblTotalAmount.Text = total + 10

ElseIf consumption > 30 And consumption <= 40 Then

consumption = consumption - 30

total = 6210.0 + (24.65 * consumption) + (21.4 * 10) + (18.9 * 10)

lblTotalAmount.Text = total + 10

ElseIf consumption > 20 And consumption <= 30 Then

consumption = consumption - 20

total = 6210.0 + (21.4 * consumption) + (18.9 * 10)

lblTotalAmount.Text = total + 10

ElseIf consumption > 10 And consumption <= 20 Then

consumption = consumption - 10

total = 6210.0 + (18.9 * consumption)

lblTotalAmount.Text = total + 10

Else

lblTotalAmount.Text = 6210.0 + 10

End If
ElseIf ComboBox2.Text = "4" Then

If consumption > 40 Then

consumption = consumption - 40

total = 12420.0 + (consumption * 28.8) + (24.65 * 10) + (21.4 * 10) + (18.9 * 10)

lblTotalAmount.Text = total + 10

ElseIf consumption > 30 And consumption <= 40 Then

consumption = consumption - 30

total = 12420.0 + (24.65 * consumption) + (21.4 * 10) + (18.9 * 10)

lblTotalAmount.Text = total + 10

ElseIf consumption > 20 And consumption <= 30 Then

consumption = consumption - 20

total = 12420.0 + (21.4 * consumption) + (18.9 * 10)

lblTotalAmount.Text = total + 10

ElseIf consumption > 10 And consumption <= 20 Then

consumption = consumption - 10

total = 12420.0 + (18.9 * consumption)

lblTotalAmount.Text = total + 10

Else

lblTotalAmount.Text = 12420.0 + 10

End If

End If

End If
ElseIf ComboBox1.Text = "Commercial/Industrial" Then

presentRead = txtPresRead.Text

prevRead = txtPrevRead.Text

lblConsumpt.Visible = True

lblTotalAmount.Visible = True

Label5.Visible = True

If prevRead > presentRead Then

MsgBox("Input Incorrect! Enter correct reading.")

txtPresRead.Clear()

txtPrevRead.Clear()

lblConsumpt.Visible = False

lblTotalAmount.Visible = False

Label5.Visible = False

Else

Dim consumption As Integer

Dim total As Double

consumption = presentRead - prevRead

lblTotalAmount.Text = consumption

If ComboBox2.Text = "1/2" Then

If consumption > 40 Then


consumption = consumption - 40

total = 172.5 + (consumption * 57.6) + (49.3 * 10) + (42.8 * 10) + (37.8 * 10)

lblTotalAmount.Text = total + 10

ElseIf consumption > 30 And consumption <= 40 Then

consumption = consumption - 30

total = 172.5 + (49.3 * consumption) + (42.8 * 10) + (37.8 * 10)

lblTotalAmount.Text = total + 10

ElseIf consumption > 20 And consumption <= 30 Then

consumption = consumption - 20

total = 172.5 + (42.8 * consumption) + (37.8 * 10)

lblTotalAmount.Text = total + 10

ElseIf consumption > 10 And consumption <= 20 Then

consumption = consumption - 10

total = 172.5 + (37.8 * consumption)

lblTotalAmount.Text = total + 10

Else

lblTotalAmount.Text = 345.0 + 10

End If

ElseIf ComboBox2.Text = "3/4" Then

If consumption > 40 Then

consumption = consumption - 40

total = 552.0 + (consumption * 57.6) + (49.3 * 10) + (42.8 * 10) + (37.8 * 10)

lblTotalAmount.Text = total + 10
ElseIf consumption > 30 And consumption <= 40 Then

consumption = consumption - 30

total = 552.0 + (49.3 * consumption) + (42.8 * 10) + (37.8 * 10)

lblTotalAmount.Text = total + 10

ElseIf consumption > 20 And consumption <= 30 Then

consumption = consumption - 20

total = 552.0 + (42.8 * consumption) + (37.8 * 10)

lblTotalAmount.Text = total + 10

ElseIf consumption > 10 And consumption <= 20 Then

consumption = consumption - 10

total = 552.0 + (37.8 * consumption)

lblTotalAmount.Text = total + 10

Else

lblTotalAmount.Text = 552.0 + 10

End If

ElseIf ComboBox2.Text = "1" Then

If consumption > 40 Then

consumption = consumption - 40

total = 1104.0 + (consumption * 57.6) + (49.3 * 10) + (42.8 * 10) + (37.8 * 10)

lblTotalAmount.Text = total + 10

ElseIf consumption > 30 And consumption <= 40 Then

consumption = consumption - 30

total = 1104.0 + (49.3 * consumption) + (42.8 * 10) + (37.8 * 10)


lblTotalAmount.Text = total + 10

ElseIf consumption > 20 And consumption <= 30 Then

consumption = consumption - 20

total = 1104.0 + (42.8 * consumption) + (37.8 * 10)

lblTotalAmount.Text = total + 10

ElseIf consumption > 10 And consumption <= 20 Then

consumption = consumption - 10

total = 1104.0 + (37.8 * consumption)

lblTotalAmount.Text = total + 10

Else

lblTotalAmount.Text = 1104.0 + 10

End If

ElseIf ComboBox2.Text = "1 1/2" Then

If consumption > 40 Then

consumption = consumption - 40

total = 2760.0 + (consumption * 57.6) + (49.3 * 10) + (42.8 * 10) + (37.8 * 10)

lblTotalAmount.Text = total + 10

ElseIf consumption > 30 And consumption <= 40 Then

consumption = consumption - 30

total = 2760.0 + (49.3 * consumption) + (42.8 * 10) + (37.8 * 10)

lblTotalAmount.Text = total + 10

ElseIf consumption > 20 And consumption <= 30 Then

consumption = consumption - 20
total = 2760.0 + (42.8 * consumption) + (37.8 * 10)

lblTotalAmount.Text = total + 10

ElseIf consumption > 10 And consumption <= 20 Then

consumption = consumption - 10

total = 2760.0 + (37.8 * consumption)

lblTotalAmount.Text = total + 10

Else

lblTotalAmount.Text = 2760.0 + 10

End If

ElseIf ComboBox2.Text = "2" Then

If consumption > 40 Then

consumption = consumption - 40

total = 6900.0 + (consumption * 57.6) + (49.3 * 10) + (42.8 * 10) + (37.8 * 10)

lblTotalAmount.Text = total + 10

ElseIf consumption > 30 And consumption <= 40 Then

consumption = consumption - 30

total = 6900.0 + (49.3 * consumption) + (42.8 * 10) + (37.8 * 10)

lblTotalAmount.Text = total + 10

ElseIf consumption > 20 And consumption <= 30 Then

consumption = consumption - 20

total = 6900.0 + (42.8 * consumption) + (37.8 * 10)

lblTotalAmount.Text = total + 10

ElseIf consumption > 10 And consumption <= 20 Then


consumption = consumption - 10

total = 6900.0 + (37.8 * consumption)

lblTotalAmount.Text = total + 10

Else

lblTotalAmount.Text = 6900.0 + 10

End If

ElseIf ComboBox2.Text = "3" Then

If consumption > 40 Then

consumption = consumption - 40

total = 12420.0 + (consumption * 57.6) + (49.3 * 10) + (42.8 * 10) + (37.8 * 10)

lblTotalAmount.Text = total + 10

ElseIf consumption > 30 And consumption <= 40 Then

consumption = consumption - 30

total = 12420.0 + (49.3 * consumption) + (42.8 * 10) + (37.8 * 10)

lblTotalAmount.Text = total + 10

ElseIf consumption > 20 And consumption <= 30 Then

consumption = consumption - 20

total = 12420.0 + (42.8 * consumption) + (37.8 * 10)

lblTotalAmount.Text = total + 10

ElseIf consumption > 10 And consumption <= 20 Then

consumption = consumption - 10

total = 12420.0 + (37.8 * consumption)


lblTotalAmount.Text = total + 10

Else

lblTotalAmount.Text = 12420.0 + 10

End If

ElseIf ComboBox2.Text = "4" Then

If consumption > 40 Then

consumption = consumption - 40

total = 24840.0 + (consumption * 57.6) + (49.3 * 10) + (42.8 * 10) + (37.8 * 10)

lblTotalAmount.Text = total + 10

ElseIf consumption > 30 And consumption <= 40 Then

consumption = consumption - 30

total = 24840.0 + (49.3 * consumption) + (42.8 * 10) + (37.8 * 10)

lblTotalAmount.Text = total + 10

ElseIf consumption > 20 And consumption <= 30 Then

consumption = consumption - 20

total = 24840.0 + (42.8 * consumption) + (37.8 * 10)

lblTotalAmount.Text = total + 10

ElseIf consumption > 10 And consumption <= 20 Then

consumption = consumption - 10

total = 24840.0 + (37.8 * consumption)

lblTotalAmount.Text = total + 10

Else
lblTotalAmount.Text = 24840.0 + 10

End If

End If

End If

End If

End If

End Sub

Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click

ComboBox1.Text = ""

ComboBox2.Text = ""

txtPresRead.Text = ""

txtPrevRead.Text = ""

lblConsumpt.Text = ""

lblTotalAmount.Text = ""

Label5.Text = ""

End Sub

Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click

Me.Close()

End Sub
End Class

You might also like