Advertisement
Go0dtry

Sales Commission

Jul 17th, 2012
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 4.97 KB | None | 0 0
  1. Public Class CommissionForm
  2.     Const SalesQuota As Decimal = 1000D
  3.     Const CommRate As Decimal = 0.15D
  4.     Const BasePay As Decimal = 250D
  5.     Dim EmpTotalSales As Decimal
  6.     Dim EmpName As String
  7.     Dim EmpPay As Decimal
  8.     Dim EmpComm As Decimal
  9.     Dim MessageSummary As String
  10.     Dim TotalSales As Decimal
  11.     Dim TotalComm As Decimal
  12.     Dim TotalPay As Decimal
  13.     Dim SaleAmt As Decimal
  14.     Dim EmpTotalPay As Decimal
  15.     Private Sub CommissionForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
  16.         TotalTextBox.Text = 0.ToString("c")
  17.     End Sub
  18.  
  19.     Private Sub PayToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
  20.         Dim MessagePay As String
  21.         EmpName = NameTextBox.Text
  22.  
  23.         Call CalcComm()
  24.         MessagePay = "Employee Pay Calculation" _
  25.         & Environment.NewLine _
  26.         & Environment.NewLine _
  27.         & "Employee Name: " & EmpName.ToString _
  28.         & Environment.NewLine _
  29.         & Environment.NewLine _
  30.         & "Commission Earned: " & EmpComm.ToString("N") _
  31.         & Environment.NewLine _
  32.         & Environment.NewLine _
  33.         & "Total Pay: " & EmpTotalPay.ToString("N")
  34.  
  35.         MessageBox.Show(MessagePay, "Employee Weekly Pay Report")
  36.  
  37.  
  38.     End Sub
  39.     Private Sub CalcComm()
  40.         If EmpTotalSales < SalesQuota Then
  41.             EmpTotalPay = BasePay
  42.             EmpComm = 0
  43.         Else
  44.             EmpComm = Decimal.Round((EmpTotalSales * CommRate), 2)
  45.             EmpTotalPay = BasePay + EmpComm
  46.         End If
  47.  
  48.  
  49.  
  50.     End Sub
  51.  
  52.     Private Sub AboutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
  53.         Dim MessageAbout As String
  54.         MessageAbout = "Program Name: Sales Commission Calculator" _
  55.         & Environment.NewLine _
  56.         & "Programmer: Joe Shmoe"
  57.         MessageBox.Show(MessageAbout, "About Commission Calc", MessageBoxButtons.OK, MessageBoxIcon.Information)
  58.     End Sub
  59.  
  60.     Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
  61.         Me.Close()
  62.     End Sub
  63.  
  64.     Private Sub SummaryToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SummaryToolStripMenuItem.Click
  65.         TotalPay = TotalPay + EmpTotalPay
  66.         TotalComm = TotalComm + EmpComm
  67.         TotalSales = TotalSales + EmpTotalSales
  68.  
  69.         MessageSummary = "Employee Sales and Pay Summary" _
  70.         & Environment.NewLine & Environment.NewLine _
  71.         & "Total Sales: " & TotalSales.ToString("c") _
  72.         & Environment.NewLine & Environment.NewLine _
  73.         & "Total Commission: " & TotalComm.ToString("c") _
  74.         & Environment.NewLine & Environment.NewLine _
  75.         & "Total Pay for" _
  76.         & Environment.NewLine _
  77.         & "All Employees: " & TotalPay.ToString("c")
  78.  
  79.  
  80.         MessageBox.Show(MessageSummary, "Employee Weekly Summary")
  81.  
  82.  
  83.     End Sub
  84.  
  85.     Private Sub AddButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddButton.Click
  86.         NameTextBox.ReadOnly = True
  87.         SaleAmt = Decimal.Parse(SalesTextBox.Text)
  88.         EmpTotalSales = EmpTotalSales + SaleAmt
  89.         SalesTextBox.Clear()
  90.         SalesTextBox.Focus()
  91.         Call CalcComm()
  92.         TotalTextBox.Text = EmpTotalPay.ToString("c")
  93.  
  94.  
  95.  
  96.     End Sub
  97.  
  98.     Private Sub ClearToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearToolStripMenuItem.Click
  99.         TotalPay = TotalPay + EmpTotalPay
  100.         TotalComm = TotalComm + EmpComm
  101.         TotalSales = TotalSales + EmpTotalSales
  102.         NameTextBox.ReadOnly = False
  103.         NameTextBox.Clear()
  104.         SalesTextBox.Clear()
  105.         TotalTextBox.Clear()
  106.         NameTextBox.Focus()
  107.         EmpComm = 0
  108.         EmpPay = 0
  109.         EmpTotalSales = 0
  110.         EmpPay = 0
  111.         TotalTextBox.Text = 0.ToString("c")
  112.     End Sub
  113.  
  114.     Private Sub ColorToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ColorToolStripMenuItem.Click
  115.         With ColorDialog1
  116.             .Color = TotalTextBox.ForeColor
  117.             .ShowDialog()
  118.             TotalTextBox.ForeColor = .Color
  119.         End With
  120.  
  121.     End Sub
  122.  
  123.     Private Sub FontToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FontToolStripMenuItem.Click
  124.         With FontDialog1
  125.             .Font = TotalTextBox.Font
  126.             .ShowDialog()
  127.             TotalTextBox.Font = .Font
  128.         End With
  129.     End Sub
  130.  
  131.     Private Sub FileToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FileToolStripMenuItem.Click
  132.  
  133.     End Sub
  134.  
  135.     Private Sub TitleLabel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TitleLabel.Click
  136.  
  137.     End Sub
  138.  
  139.     Private Sub ToolStripSeparator2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripSeparator2.Click
  140.  
  141.     End Sub
  142. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement