Sunteți pe pagina 1din 4

PEPITO, KRISTYL JOY F.

PCEIT-03-301A
ADVANCED PROG./TF 3pm-4:30pm
ENGR. RONEL PAGLOMUTAN

NOTE:
 Textboxes are restricted from inputting characters
 When Exit button is click, message box will ask to confirm the user’s action
 Pricelists are available at the right corner
 Textboxes are initially disabled when the form is load and it will only enable when the
checkboxes are checked
 Reset button will automatically set the textboxes onto its default
Public Class Form2

Const p_fries As Decimal = 25.01


Const p_salad As Decimal = 50.01
Const p_hamburger As Decimal = 15.01
Const p_onion As Decimal = 20.01
Const p_chick As Decimal = 50.01
''
Const p_fish As Decimal = 30.01
Const p_cheese As Decimal = 30.01
Const p_chicksand As Decimal = 30.01
''
Const p_hash As Decimal = 75.01
Const p_toasted As Decimal = 80.01
Const p_pine As Decimal = 55.01
Const p_muffin As Decimal = 70.01
Const p_pancakes As Decimal = 90.01
''
Const p_tea As Decimal = 45.01
Const p_coke As Decimal = 45.01
Const p_coffee As Decimal = 45.01
Const p_orange As Decimal = 45.01
Const p_water As Decimal = 25.01
''
Const p_vanillacone As Decimal = 40.01
Const p_vanillashake As Decimal = 40.01
Const p_strawberry As Decimal = 40.01
Const p_choco As Decimal = 40.01
''
Const taxrate As Decimal = 0.12
''
Dim iTax As Decimal
Dim iSubtotal As Decimal
Dim iTotal As Decimal
Dim itemcost(22) As Decimal

Private Sub PictureBox5_Click(sender As Object, e As EventArgs) Handles pbexit.Click


Dim iExit As DialogResult

iExit = MessageBox.Show("Are you sure you want to exit?", "Kristyl Restaurant",


MessageBoxButtons.YesNo, MessageBoxIcon.Question)

If iExit = DialogResult.Yes Then


Me.Hide()
Form1.Show()
End If
End Sub

Private Sub Btnreset_Click(sender As Object, e As EventArgs) Handles btnreset.Click


For Each txt In {txtcash, txtchange, txtcheese, txtchicksalad,
txtchicksand, txtchoco, txtcoffee, txtcoke,
txtfish, txtfries, txthamburger, txthash,
txtmuffin, txtonion, txtorange, txtpancake,
txtpine, txtsalad, txtstrawberry, txtsubtotal,
txttax, txttea, txttoasted, txttotal, txtvanillacone,
txtvanillashake, txtwater}
txt.Clear()
txt.Text = "0"
Next

txtchange.Text = "0"
txtsubtotal.Text = "0"
txttax.Text = "0"
txtcash.Text = "0"
cmbpayment.Text = " "
txtcash.Enabled = False
txtcash.Text = "0"
For Each rdbtn In {rdbtncheese, rdbtnchicksalad, rdbtnchicksand,
rdbtnchoco, rdbtncoffee, rdbtncoke, rdbtnfish,
rdbtnfries, rdbtnhamburger, rdbtnhash,
rdbtnmuffin, rdbtnonion, rdbtnorange,
rdbtnpancake, rdbtnpine, rdbtnsalad, rdbtnstrawberry,
rdbtntea, rdbtntoasted, rdbtnvanillacone, rdbtnvanillashake,
rdbtnwater}
rdbtn.Checked = False
Next
End Sub

Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load


For Each txt In {txtcash, txtchange, txtcheese, txtchicksalad,
txtchicksand, txtchoco, txtcoffee, txtcoke,
txtfish, txtfries, txthamburger, txthash,
txtmuffin, txtonion, txtorange, txtpancake,
txtpine, txtsalad, txtstrawberry, txtsubtotal,
txttax, txttea, txttoasted, txttotal, txtvanillacone,
txtvanillashake, txtwater}
txt.Enabled = False

Next

cmbpayment.Items.Add(" ")
cmbpayment.Items.Add("Cash")
cmbpayment.Items.Add("Credit Card")

End Sub

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


cmbpayment.SelectedIndexChanged
If cmbpayment.Text = "Cash" Then
txtcash.Enabled = True
txtcash.Text = ""
txtcash.Focus()
Else
txtcash.Enabled = False
txtcash.Text = "0"
End If
End Sub

Private Sub numbersonly(sender As Object, e As KeyPressEventArgs) Handles txtwater.KeyPress,


txtvanillashake.KeyPress, txtvanillacone.KeyPress, txttoasted.KeyPress, txttea.KeyPress,
txtstrawberry.KeyPress, txtsalad.KeyPress, txtpine.KeyPress, txtpancake.KeyPress,
txtorange.KeyPress, txtonion.KeyPress, txtmuffin.KeyPress, txthash.KeyPress,
txthamburger.KeyPress, txtfries.KeyPress, txtfish.KeyPress, txtcoke.KeyPress, txtcoffee.KeyPress,
txtchoco.KeyPress, txtchicksand.KeyPress, txtchicksalad.KeyPress,
txtcheese.KeyPress, txtcash.KeyPress
If Asc(e.KeyChar) <> 8 Then
If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then
e.Handled = True
End If
End If
End Sub

Private Sub Btntotal_Click(sender As Object, e As EventArgs) Handles btntotal.Click


itemcost(0) = Convert.ToDecimal(txtfries.Text) * p_fries
itemcost(1) = Convert.ToDecimal(txtsalad.Text) * p_salad
itemcost(2) = Convert.ToDecimal(txthamburger.Text) * p_hamburger
itemcost(3) = Convert.ToDecimal(txtonion.Text) * p_onion
itemcost(4) = Convert.ToDecimal(txtchicksalad.Text) * p_chick
itemcost(5) = Convert.ToDecimal(txtfish.Text) * p_fish
itemcost(6) = Convert.ToDecimal(txtcheese.Text) * p_cheese
itemcost(7) = Convert.ToDecimal(txtchicksand.Text) * p_chicksand
itemcost(8) = Convert.ToDecimal(txthash.Text) * p_hash
itemcost(9) = Convert.ToDecimal(txttoasted.Text) * p_toasted
itemcost(10) = Convert.ToDecimal(txtpine.Text) * p_pine
itemcost(11) = Convert.ToDecimal(txtmuffin.Text) * p_muffin
itemcost(12) = Convert.ToDecimal(txtpancake.Text) * p_pancakes
itemcost(13) = Convert.ToDecimal(txttea.Text) * p_tea
itemcost(14) = Convert.ToDecimal(txtcoffee.Text) * p_coffee
itemcost(15) = Convert.ToDecimal(txtcoke.Text) * p_coke
itemcost(16) = Convert.ToDecimal(txtorange.Text) * p_orange
itemcost(17) = Convert.ToDecimal(txtwater.Text) * p_water
itemcost(18) = Convert.ToDecimal(txtvanillacone.Text) * p_vanillacone
itemcost(19) = Convert.ToDecimal(txtvanillashake.Text) * p_vanillashake
itemcost(20) = Convert.ToDecimal(txtstrawberry.Text) * p_strawberry
itemcost(21) = Convert.ToDecimal(txtchoco.Text) * p_choco

Dim cost As Decimal

If cmbpayment.Text = "Cash" Then

iSubtotal = itemcost(0) + itemcost(1) + itemcost(2) + itemcost(3) + itemcost(4) + itemcost(5)


+ itemcost(6) + itemcost(7) + itemcost(8) + itemcost(9) + itemcost(10) + itemcost(11) + itemcost(12) +
itemcost(13) + itemcost(14) + itemcost(15) + itemcost(16) + itemcost(17) + itemcost(18) + itemcost(19)
+ itemcost(20) + itemcost(21)

cost = txtcash.Text - iSubtotal


txtchange.Text = cost
txtsubtotal.Text = iSubtotal
iTax = (iSubtotal * taxrate) / 100
txttax.Text = iTax
txttotal.Text = iTax + iSubtotal

Else
MessageBox.Show("Please Select Payment Method", "Kristyl Restaurant",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation)

For Each txt In {txtcash, txtchange, txtcheese, txtchicksalad,


txtchicksand, txtchoco, txtcoffee, txtcoke,
txtfish, txtfries, txthamburger, txthash,
txtmuffin, txtonion, txtorange, txtpancake,
txtpine, txtsalad, txtstrawberry, txtsubtotal,
txttax, txttea, txttoasted, txttotal, txtvanillacone,
txtvanillashake, txtwater}
txt.Clear()
txt.Text = "0"
Next

End If

End Sub

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


rdbtnfries.CheckedChanged

If rdbtnfries.Checked = True Then


txtfries.Enabled = True
txtfries.Text = ""
txtfries.Focus()
Else
txtfries.Enabled = False

End If
End Sub
End Class

S-ar putea să vă placă și