Advertisement
Guest User

Untitled

a guest
Mar 24th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.35 KB | None | 0 0
  1. Public Class FrmShawn
  2.  
  3. Const cManual As Decimal = 10500
  4. Const cAutomatic As Decimal = 14500
  5. Const Turbo As Decimal = 6500
  6. Const SuperCharger As Decimal = 8500
  7. Const Throttles As Decimal = 5500
  8. Const SideDrafts As Decimal = 7500
  9. Const VAT As Decimal = 14%
  10. Dim decDiscount As Decimal
  11. Dim GearBox As Decimal
  12. Dim PerformanceParts As Decimal
  13. Dim Counter As Integer
  14. Dim decTotalAmount As Decimal
  15. Dim decSalesTax As Decimal
  16. Dim AfterTax As Decimal
  17. Dim strName As String
  18. Dim strSurname As String
  19. Dim decTotalItems As Decimal
  20. Private Sub ExitApp()
  21. Me.close()
  22. End Sub
  23. Private Sub ClearingControls()
  24. txtName.Text = Nothing
  25. txtSurname.Text = Nothing
  26. txtID.Text = Nothing
  27. lblTotalItems.Text = Nothing
  28. lblDiscountDisplay.Text = Nothing
  29. lblSalesDisplay.Text = Nothing
  30. lblTotalDisplay.Text = Nothing
  31. cboCarBrand.Text = Nothing
  32. radManual.Checked = False
  33. radAutomatic.Checked = False
  34. chkSideDrafts.Checked = False
  35. chkThrottles.Checked = False
  36. chkTurbo.Checked = False
  37. chkSuperCharger.Checked = False
  38. lstItems.Items.Clear()
  39. End Sub
  40. Function TotalItems() As Decimal
  41. Dim decTotalItems As Decimal
  42.  
  43. decTotalItems = GearBox + PerformanceParts
  44.  
  45.  
  46. Return decTotalItems
  47. End Function
  48.  
  49. Function SalesTax() As Decimal
  50. Dim decSalesTax As Decimal
  51. decSalesTax = GearBox + PerformanceParts / 14 * 100
  52.  
  53. Return decSalesTax
  54. End Function
  55. Function Discount() As Decimal
  56. Dim decDiscount As Decimal
  57. If Counter = 8 Then
  58. decDiscount = decTotalItems - (decTotalItems * (1 / 100))
  59. ElseIf Counter = 10 Then
  60. decDiscount = decTotalItems - (decTotalItems * (2 / 100))
  61. ElseIf Counter = 11 Then
  62. decDiscount = decTotalItems - (decTotalItems * (3 / 100))
  63. ElseIf Counter = 13 Then
  64. decDiscount = decTotalItems - (decTotalItems * (4 / 100))
  65. End If
  66. Return decDiscount
  67. End Function
  68. Function TotalAmount() As Decimal
  69. Dim decTotalAmount As Decimal
  70.  
  71. decTotalAmount = (decTotalItems + decSalesTax) - decDiscount
  72.  
  73. Return decTotalAmount
  74. End Function
  75. Private Sub FrmShawn_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  76. cboCarBrand.SelectedIndex = 0
  77. txtName.Focus()
  78.  
  79.  
  80. End Sub
  81.  
  82. Private Sub btnPromotion_Click(sender As Object, e As EventArgs) Handles btnPromotion.Click
  83. 'Displaying names
  84. strName = CStr(txtName.Text)
  85. strSurname = CStr(txtSurname.Text)
  86. Dim ID As Long
  87. If IsNumeric(txtID.Text) = False Then
  88. MessageBox.Show("Enter Numeric Number")
  89. txtID.Focus()
  90. Exit Sub
  91. Else
  92. ID = txtID.Text
  93. End If
  94.  
  95. 'STUFSS
  96. decTotalItems = TotalItems()
  97. decSalesTax = SalesTax()
  98. decDiscount = Discount()
  99. decTotalAmount = TotalAmount()
  100.  
  101.  
  102.  
  103. lstItems.Items.Add("ID NUMBER:" & " " & ID.ToString())
  104. lstItems.Items.Add("Name of Customer:" & " " & strName.ToString())
  105. lstItems.Items.Add("Surname of Customer:" & " " & strSurname.ToString())
  106.  
  107. If cboCarBrand.SelectedIndex = 1 Then
  108. lstItems.Items.Add("VW")
  109. ElseIf cboCarBrand.SelectedIndex = 2 Then
  110. lstItems.Items.Add("Honda")
  111. ElseIf cboCarBrand.SelectedIndex = 3 Then
  112. lstItems.Items.Add("BMW")
  113. ElseIf cboCarBrand.SelectedIndex = 4 Then
  114. lstItems.Items.Add("FORD")
  115. End If
  116.  
  117. If radManual.Checked = True Then
  118. lstItems.Items.Add("Manual")
  119. ElseIf radAutomatic.Checked = True Then
  120. lstItems.Items.Add("Automatic")
  121. End If
  122.  
  123.  
  124. If chkTurbo.Checked = True Then
  125. lstItems.Items.Add("Turbo")
  126. ElseIf chkSuperCharger.Checked = True Then
  127. lstItems.Items.Add("Super Charger")
  128. End If
  129. If chkThrottles.Checked = True Then
  130. lstItems.Items.Add("Throttles")
  131. ElseIf chkSideDrafts.Checked = True Then
  132. lstItems.Items.Add("Side Drafts")
  133.  
  134. End If
  135.  
  136.  
  137. lblTotalItems.Text = decTotalItems.ToString("C2")
  138. lblSalesDisplay.Text = decSalesTax.ToString("C2")
  139. lblDiscountDisplay.Text = decDiscount.ToString("C2")
  140. lblTotalDisplay.Text = decTotalAmount.ToString("C2")
  141.  
  142.  
  143. End Sub
  144.  
  145. Private Sub radManual_CheckedChanged(sender As Object, e As EventArgs) Handles radManual.CheckedChanged
  146. If radManual.Checked = True Then
  147. GearBox = GearBox + cManual
  148.  
  149. End If
  150. End Sub
  151.  
  152. Private Sub radAutomatic_CheckedChanged(sender As Object, e As EventArgs) Handles radAutomatic.CheckedChanged
  153. If radAutomatic.Checked = True Then
  154. GearBox = GearBox + cAutomatic
  155. End If
  156. End Sub
  157. Private Sub chkTurbo_CheckedChanged(sender As Object, e As EventArgs) Handles chkTurbo.CheckedChanged
  158. If chkTurbo.Checked = True Then
  159. PerformanceParts = PerformanceParts + Turbo
  160. Counter = Counter + 2
  161.  
  162. End If
  163. End Sub
  164. Private Sub chkSuperCharger_CheckedChanged(sender As Object, e As EventArgs) Handles chkSuperCharger.CheckedChanged
  165. If chkSuperCharger.Checked = True Then
  166. PerformanceParts = PerformanceParts + SuperCharger
  167. Counter = Counter + 4
  168. End If
  169. End Sub
  170.  
  171. Private Sub chkThrottles_CheckedChanged(sender As Object, e As EventArgs) Handles chkThrottles.CheckedChanged
  172. If chkThrottles.Checked = True Then
  173. PerformanceParts = PerformanceParts + Throttles
  174. Counter = Counter + 6
  175. End If
  176. End Sub
  177.  
  178. Private Sub chkSideDrafts_CheckedChanged(sender As Object, e As EventArgs) Handles chkSideDrafts.CheckedChanged
  179. If chkSideDrafts.Checked = True Then
  180. PerformanceParts = PerformanceParts + SideDrafts
  181. Counter = Counter + 9
  182. End If
  183. End Sub
  184.  
  185.  
  186. Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click
  187. ClearingControls()
  188.  
  189. End Sub
  190.  
  191. Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
  192. ExitApp()
  193. End Sub
  194. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement