Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Public Class ShirtOrderForm
  2.     Dim ClientOrder(5) As String
  3.     Dim ClientName, Address, PhNo, Delivery, Pickup, order, MasterValue, ShowMaster, neworder, ListSpace As String
  4.     Dim PlainCost, GourmetCost, TotalCost, DeliveryFee As Single
  5.     Dim LF, OutTxt, OutTxt2 As String
  6.     Dim MaxOrder, PCount As Integer
  7.     Dim OrderDone, OrderType As Boolean
  8.  
  9.     Private Sub cmdQuit_Click(sender As Object, e As EventArgs) Handles cmdQuit.Click
  10.         End
  11.     End Sub
  12.  
  13.     Private Sub cmdNewOrder_Click(sender As Object, e As EventArgs) Handles cmdNewOrder.Click
  14.         TotalCost = 0
  15.         neworder = 1
  16.         ProgressBar1.Value = 0
  17.         Label1.Text = "Pizzas Ordered = 0"
  18.         initialise()
  19.         OutTxt = ("Pick Order Type" & LF & "now")
  20.         OutText.Text = OutTxt
  21.         getContacts()
  22.         OutTxt = OutTxt & vbCrLf & vbCrLf & "Enter order via buttons"
  23.         OutText.Text = OutTxt
  24.         OutText2.Text = OutTxt2
  25.     End Sub
  26.     Private Sub initialise()
  27.         Dim i As Integer
  28.         ListSpace = "    "
  29.         Delivery = "Delivery"
  30.         Pickup = "Pickup"
  31.         ClientName = ""
  32.         Address = ""
  33.         PhNo = ""
  34.         LF = vbCrLf
  35.         For i = 1 To 5
  36.             ClientOrder(i) = ""
  37.         Next
  38.         PCount = 0
  39.         TotalCost = 0
  40.         PlainCost = 8.5
  41.         GourmetCost = PlainCost + 5
  42.         MaxOrder = 5
  43.         DeliveryFee = 3
  44.         OrderDone = False
  45.     End Sub
  46.  
  47.     Private Sub getContacts()
  48.         order = Pickup
  49.     End Sub
  50.  
  51.     Private Sub cmdPizza1_Click(sender As Object, e As EventArgs) Handles cmdPizza1.Click
  52.         If Len(ClientName) < 1 Then
  53.             MsgBox("Please press 'New Order' to start an order")
  54.         Else
  55.             If PCount < 5 Then
  56.                 PCount += 1
  57.                 TotalCost = TotalCost + PlainCost
  58.                 ClientOrder(PCount) = cmdPizza1.Text & ListSpace & "$" & PlainCost
  59.                 OutText.Text = OutText.Text & LF & cmdPizza1.Text & ListSpace & "$" & PlainCost
  60.                 Orderprogress()
  61.             Else
  62.                 MsgBox("Maximum order is Five Pizzas. Press DONE to continue.")
  63.             End If
  64.         End If
  65.     End Sub
  66.  
  67.     Private Sub cmdPizza2_Click(sender As Object, e As EventArgs) Handles cmdPizza2.Click
  68.         If Len(ClientName) < 1 Then
  69.             MsgBox("Please press 'New Order' to start an order")
  70.         Else
  71.             If PCount < 5 Then
  72.                 PCount += 1
  73.                 TotalCost = TotalCost + PlainCost
  74.                 ClientOrder(PCount) = cmdPizza2.Text & ListSpace & "$" & PlainCost
  75.                 OutText.Text = OutText.Text & LF & cmdPizza2.Text & ListSpace & "$" & PlainCost
  76.                 Orderprogress()
  77.             Else
  78.                 MsgBox("Maximum order is Five Pizzas. Press DONE to continue.")
  79.             End If
  80.         End If
  81.     End Sub
  82.  
  83.     Private Sub cmdPizza3_Click(sender As Object, e As EventArgs) Handles cmdPizza3.Click
  84.         If Len(ClientName) < 1 Then
  85.             MsgBox("Please press 'New Order' to start an order")
  86.         Else
  87.             If PCount < 5 Then
  88.                 PCount += 1
  89.                 TotalCost = TotalCost + PlainCost
  90.                 ClientOrder(PCount) = cmdPizza3.Text & ListSpace & "$" & PlainCost
  91.                 OutText.Text = OutText.Text & LF & cmdPizza3.Text & ListSpace & "$" & PlainCost
  92.                 Orderprogress()
  93.             Else
  94.                 MsgBox("Maximum order is Five Pizzas. Press DONE to continue.")
  95.             End If
  96.         End If
  97.     End Sub
  98.  
  99.     Private Sub cmdPizza4_Click(sender As Object, e As EventArgs) Handles cmdPizza4.Click
  100.         If Len(ClientName) < 1 Then
  101.             MsgBox("Please press 'New Order' to start an order")
  102.         Else
  103.             If PCount < 5 Then
  104.                 PCount += 1
  105.                 TotalCost = TotalCost + PlainCost
  106.                 ClientOrder(PCount) = cmdPizza4.Text & ListSpace & "$" & PlainCost
  107.                 OutText.Text = OutText.Text & LF & cmdPizza4.Text & ListSpace & "$" & PlainCost
  108.                 Orderprogress()
  109.             Else
  110.                 MsgBox("Maximum order is Five Pizzas. Press DONE to continue.")
  111.             End If
  112.         End If
  113.     End Sub
  114.  
  115.     Private Sub cmdPizza5_Click(sender As Object, e As EventArgs) Handles cmdPizza5.Click
  116.         If Len(ClientName) < 1 Then
  117.             MsgBox("Please press 'New Order' to start an order")
  118.         Else
  119.             If PCount < 5 Then
  120.                 PCount += 1
  121.                 TotalCost = TotalCost + PlainCost
  122.                 ClientOrder(PCount) = cmdPizza5.Text & ListSpace & "$" & PlainCost
  123.                 OutText.Text = OutText.Text & LF & cmdPizza5.Text & ListSpace & "$" & PlainCost
  124.                 Orderprogress()
  125.             Else
  126.                 MsgBox("Maximum order is Five Pizzas. Press DONE to continue.")
  127.             End If
  128.         End If
  129.     End Sub
  130.  
  131.     Private Sub cmdPizza6_Click(sender As Object, e As EventArgs) Handles cmdPizza6.Click
  132.         If Len(ClientName) < 1 Then
  133.             MsgBox("Please press 'New Order' to start an order")
  134.         Else
  135.             If PCount < 5 Then
  136.                 PCount += 1
  137.                 TotalCost = TotalCost + PlainCost
  138.                 ClientOrder(PCount) = cmdPizza6.Text & ListSpace & "$" & PlainCost
  139.                 OutText.Text = OutText.Text & LF & cmdPizza6.Text & ListSpace & "$" & PlainCost
  140.                 Orderprogress()
  141.             Else
  142.                 MsgBox("Maximum order is Five Pizzas. Press DONE to continue.")
  143.             End If
  144.         End If
  145.     End Sub
  146.  
  147.     Private Sub cmdPizza7_Click(sender As Object, e As EventArgs) Handles cmdPizza7.Click
  148.         If Len(ClientName) < 1 Then
  149.             MsgBox("Please press 'New Order' to start an order")
  150.         Else
  151.             If PCount < 5 Then
  152.                 PCount += 1
  153.                 TotalCost = TotalCost + PlainCost
  154.                 ClientOrder(PCount) = cmdPizza7.Text & ListSpace & "$" & PlainCost
  155.                 OutText.Text = OutText.Text & LF & cmdPizza7.Text & ListSpace & "$" & PlainCost
  156.                 Orderprogress()
  157.             Else
  158.                 MsgBox("Maximum order is Five Pizzas. Press DONE to continue.")
  159.             End If
  160.         End If
  161.     End Sub
  162.  
  163.     Private Sub cmdPizza8_Click(sender As Object, e As EventArgs) Handles cmdPizza8.Click
  164.         If Len(ClientName) < 1 Then
  165.             MsgBox("Please press 'New Order' to start an order")
  166.         Else
  167.             If PCount < 5 Then
  168.                 PCount += 1
  169.                 TotalCost = TotalCost + GourmetCost
  170.                 ClientOrder(PCount) = cmdPizza8.Text & ListSpace & "$" & GourmetCost
  171.                 OutText.Text = OutText.Text & LF & cmdPizza8.Text & ListSpace & "$" & GourmetCost
  172.                 Orderprogress()
  173.             Else
  174.                 MsgBox("Maximum order is Five Pizzas. Press DONE to continue.")
  175.             End If
  176.         End If
  177.     End Sub
  178.  
  179.     Private Sub cmdPizza9_Click(sender As Object, e As EventArgs) Handles cmdPizza9.Click
  180.         If Len(ClientName) < 1 Then
  181.             MsgBox("Please press 'New Order' to start an order")
  182.         Else
  183.             If PCount < 5 Then
  184.                 PCount += 1
  185.                 TotalCost = TotalCost + GourmetCost
  186.                 ClientOrder(PCount) = cmdPizza9.Text & ListSpace & "$" & GourmetCost
  187.                 OutText.Text = OutText.Text & LF & cmdPizza9.Text & ListSpace & "$" & GourmetCost
  188.                 Orderprogress()
  189.             Else
  190.                 MsgBox("Maximum order is Five Pizzas. Press DONE to continue.")
  191.             End If
  192.         End If
  193.     End Sub
  194.  
  195.     Private Sub cmdPizza10_Click(sender As Object, e As EventArgs) Handles cmdPizza10.Click
  196.         If Len(ClientName) < 1 Then
  197.             MsgBox("Please press 'New Order' to start an order")
  198.         Else
  199.             If PCount < 5 Then
  200.                 PCount += 1
  201.                 TotalCost = TotalCost + GourmetCost
  202.                 ClientOrder(PCount) = cmdPizza10.Text & ListSpace & "$" & GourmetCost
  203.                 OutText.Text = OutText.Text & LF & cmdPizza10.Text & ListSpace & "$" & GourmetCost
  204.                 Orderprogress()
  205.             Else
  206.                 MsgBox("Maximum order is Five Pizzas. Press DONE to continue.")
  207.             End If
  208.         End If
  209.     End Sub
  210.  
  211.     Private Sub cmdPizza11_Click(sender As Object, e As EventArgs) Handles cmdPizza11.Click
  212.         If Len(ClientName) < 1 Then
  213.             MsgBox("Please press 'New Order' to start an order")
  214.         Else
  215.             If PCount < 5 Then
  216.                 PCount += 1
  217.                 TotalCost = TotalCost + GourmetCost
  218.                 ClientOrder(PCount) = cmdPizza11.Text & ListSpace & "$" & GourmetCost
  219.                 OutText.Text = OutText.Text & LF & cmdPizza11.Text & ListSpace & "$" & GourmetCost
  220.                 Orderprogress()
  221.             Else
  222.                 MsgBox("Maximum order is Five Pizzas. Press DONE to continue.")
  223.             End If
  224.         End If
  225.     End Sub
  226.  
  227.     Private Sub cmdPizza12_Click(sender As Object, e As EventArgs) Handles cmdPizza12.Click
  228.         If Len(ClientName) < 1 Then
  229.             MsgBox("Please press 'New Order' to start an order")
  230.         Else
  231.             If PCount < 5 Then
  232.                 PCount += 1
  233.                 TotalCost = TotalCost + GourmetCost
  234.                 ClientOrder(PCount) = cmdPizza12.Text & ListSpace & "$" & GourmetCost
  235.                 OutText.Text = OutText.Text & LF & cmdPizza12.Text & ListSpace & "$" & GourmetCost
  236.                 Orderprogress()
  237.             Else
  238.                 MsgBox("Maximum order is Five Pizzas. Press DONE to continue.")
  239.             End If
  240.         End If
  241.     End Sub
  242.  
  243.     Private Sub cmdPickup_Click(sender As Object, e As EventArgs) Handles cmdPickup.Click
  244.         If neworder = 1 Then
  245.             initialise()
  246.             order = Pickup
  247.             ClientName = InputBox("Enter Client Name:")
  248.             PhNo = InputBox("Enter client ph no:")
  249.             OutTxt = ClientName & LF & PhNo & LF & cmdPickup.Text
  250.             OutTxt2 = ClientName & LF & PhNo
  251.             OutTxt2 = OutTxt2 & LF & cmdPickup.Text
  252.             OutTxt = OutTxt & vbCrLf & vbCrLf & "Enter order via buttons"
  253.             OutTxt2 = OutTxt2 & vbCrLf & vbCrLf & "Enter order via buttons"
  254.             OutText.Text = OutTxt
  255.             OutText2.Text = OutTxt2
  256.             RecallArray.Items.Add(ClientName & ListSpace & PhNo)
  257.         ElseIf neworder = 0 Then
  258.             MsgBox("Please press 'New Order' to start an order")
  259.         End If
  260.     End Sub
  261.  
  262.     Private Sub cmdDelivery_Click(sender As Object, e As EventArgs) Handles cmdDelivery.Click
  263.         If neworder = 1 Then
  264.             initialise()
  265.             ClientName = InputBox("Enter Client Name:")
  266.             Address = InputBox("Enter client address:")
  267.             PhNo = InputBox("Enter client ph no:")
  268.             TotalCost = TotalCost + DeliveryFee
  269.             order = Delivery
  270.             OutTxt2 = cmdDelivery.Text & LF & ClientName & LF & Address & LF & PhNo
  271.             OutTxt = cmdDelivery.Text & LF & ClientName & LF & Address & LF & PhNo
  272.             OutTxt = OutTxt & vbCrLf & vbCrLf & "Enter order via buttons"
  273.             OutTxt2 = OutTxt2 & vbCrLf & vbCrLf & "Enter order via buttons"
  274.             OutText.Text = OutTxt
  275.             OutText2.Text = OutTxt2
  276.             RecallArray.Items.Add(ClientName & ListSpace & PhNo)
  277.         ElseIf neworder = 0 Then
  278.             MsgBox("Please press 'New Order' to start an order")
  279.         End If
  280.     End Sub
  281.  
  282.     Private Sub cmdDone_Click(sender As Object, e As EventArgs) Handles cmdDone.Click
  283.         Dim i As Integer
  284.         OutTxt = OutTxt & LF & "Number of Pizzas ordered = " & PCount & LF
  285.         For i = 1 To PCount
  286.             OutTxt = OutTxt & ClientOrder(i) & vbCrLf
  287.         Next
  288.         If TotalCost < 3 Then
  289.             MsgBox("Please Select Pizzas")
  290.         ElseIf TotalCost > 3 Then
  291.             OutTxt = OutTxt & vbCrLf & "TOTAL Cost= $" & TotalCost & vbCrLf
  292.             If order = Delivery Then
  293.                 OutTxt = OutTxt & "Delivery Fee Added"
  294.             ElseIf order = Pickup Then
  295.                 OutTxt = OutTxt & "No Delivery Fee Added"
  296.             End If
  297.             OutText.Text = OutTxt
  298.             neworder = 0
  299.  
  300.         End If
  301.     End Sub
  302.  
  303.     Private Sub cmdTest_Click(sender As Object, e As EventArgs) Handles cmdTest.Click
  304.         If MasterValue = 1 Then
  305.             initialise()
  306.             neworder = 1
  307.             ClientName = "test"
  308.             Address = "gdfgsdg"
  309.             PhNo = "1234567890"
  310.             TotalCost = TotalCost + DeliveryFee
  311.             order = Delivery
  312.             OutTxt = cmdDelivery.Text & LF & ClientName & LF & Address & LF & PhNo
  313.             OutTxt2 = cmdDelivery.Text & LF & ClientName & LF & Address & LF & PhNo
  314.             OutTxt = OutTxt & vbCrLf & vbCrLf & "Enter order via buttons"
  315.             OutTxt2 = OutTxt2 & vbCrLf & vbCrLf & "Enter order via buttons"
  316.             OutText2.Text = OutTxt
  317.             OutText.Text = OutTxt2
  318.             RecallArray.Items.Add(ClientName & ListSpace & PhNo)
  319.         ElseIf MasterValue = 0 Then
  320.             MsgBox("Master Mode Is Off Please Enable To Use This Function")
  321.         End If
  322.     End Sub
  323.  
  324.     Private Sub cmdReset_Click(sender As Object, e As EventArgs) Handles cmdReset.Click
  325.         If MasterValue = 1 Then
  326.             order = " "
  327.             ClientName = " "
  328.             Address = " "
  329.             PhNo = " "
  330.             OutTxt = ""
  331.             OutTxt2 = " "
  332.             OutText.Text = "Output Displayed here"
  333.             OutText2.Text = "Ouptut Displayed here"
  334.             neworder = 0
  335.             TotalCost = 0
  336.         ElseIf MasterValue = 0 Then
  337.             MsgBox("Master Mode Is Off Please Enable To Use This Function")
  338.         End If
  339.     End Sub
  340.  
  341.     Private Sub cmdMaster_Click(sender As Object, e As EventArgs) Handles cmdMaster.Click
  342.         If cmdMaster.CheckState = CheckState.Checked Then
  343.             MasterValue = 1
  344.             MasterOut.Text = "on"
  345.             cmdReset.Visible = True
  346.             cmdTest.Visible = True
  347.         ElseIf cmdMaster.CheckState = CheckState.Unchecked Then
  348.             MasterValue = 0
  349.             MasterOut.Text = "off"
  350.             cmdReset.Visible = False
  351.             cmdTest.Visible = False
  352.         End If
  353.     End Sub
  354.  
  355.     Private Sub Orderprogress()
  356.         'Sets the progress bar's Maximum property to the total number of pizzas that can be ordered
  357.         ProgressBar1.Maximum = 5
  358.  
  359.         'Increases the value displayed by the progress bar.
  360.         ProgressBar1.Value += 1
  361.         Label1.Text = "Pizzas Ordered = " & ProgressBar1.Value.ToString()
  362.     End Sub
  363.  
  364.     Private Sub RegularPizzas_Click(sender As Object, e As EventArgs) Handles cmdRegularPizzas.Click
  365.         MsgBox("Set New Order To One")
  366.         neworder = 1
  367.     End Sub
  368.  
  369.     Private Sub cmdGourmetPizzas_click(sender As Object, e As EventArgs) Handles cmdGourmetPizzas.Click
  370.         MsgBox("you found my secret, do you want a prize?")
  371.         MsgBox("well there is none")
  372.     End Sub
  373.  
  374.     Private Sub ProgressBar1_click(sender As Object, e As EventArgs) Handles ProgressBar1.Click
  375.         cmdMaster.Visible = False
  376.         MasterOut.Visible = False
  377.         cmdReset.Visible = False
  378.         cmdTest.Visible = False
  379.         cmdMaster.CheckState = CheckState.Unchecked
  380.         MasterValue = 0
  381.         MasterOut.Text = "off"
  382.     End Sub
  383.  
  384.     Private Sub Label1_click(sender As Object, e As EventArgs) Handles Label1.Click
  385.         MasterOut.Text = "off"
  386.         MasterValue = 0
  387.         cmdMaster.Visible = True
  388.         MasterOut.Visible = True
  389.     End Sub
  390.  
  391.     Public Sub ShirtOrderForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  392.         MasterValue = 0
  393.         ProgressBar1.Maximum = 5
  394.         Label1.Text = "Pizzas Ordered = 0"
  395.         cmdReset.Visible = False
  396.         cmdTest.Visible = False
  397.         cmdMaster.Visible = False
  398.         MasterOut.Visible = False
  399.         RecallArray.Visible = False
  400.         Label2.Visible = False
  401.         neworder = 0
  402.     End Sub
  403.  
  404.     Private Sub cmdOrderRecall_click(sender As Object, e As EventArgs) Handles cmdOrderRecall.Click
  405.         If cmdOrderRecall.CheckState = CheckState.Checked Then
  406.             RecallArray.Visible = True
  407.             Label2.Visible = True
  408.         ElseIf cmdOrderRecall.CheckState = CheckState.Unchecked Then
  409.             RecallArray.Visible = False
  410.             Label2.Visible = False
  411.         End If
  412.     End Sub
  413.  
  414. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement