Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class CommissionForm
- Const SalesQuota As Decimal = 1000D
- Const CommRate As Decimal = 0.15D
- Const BasePay As Decimal = 250D
- Dim EmpTotalSales As Decimal
- Dim EmpName As String
- Dim EmpPay As Decimal
- Dim EmpComm As Decimal
- Dim MessageSummary As String
- Dim TotalSales As Decimal
- Dim TotalComm As Decimal
- Dim TotalPay As Decimal
- Dim SaleAmt As Decimal
- Dim EmpTotalPay As Decimal
- Private Sub CommissionForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
- TotalTextBox.Text = 0.ToString("c")
- End Sub
- Private Sub PayToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
- Dim MessagePay As String
- EmpName = NameTextBox.Text
- Call CalcComm()
- MessagePay = "Employee Pay Calculation" _
- & Environment.NewLine _
- & Environment.NewLine _
- & "Employee Name: " & EmpName.ToString _
- & Environment.NewLine _
- & Environment.NewLine _
- & "Commission Earned: " & EmpComm.ToString("N") _
- & Environment.NewLine _
- & Environment.NewLine _
- & "Total Pay: " & EmpTotalPay.ToString("N")
- MessageBox.Show(MessagePay, "Employee Weekly Pay Report")
- End Sub
- Private Sub CalcComm()
- If EmpTotalSales < SalesQuota Then
- EmpTotalPay = BasePay
- EmpComm = 0
- Else
- EmpComm = Decimal.Round((EmpTotalSales * CommRate), 2)
- EmpTotalPay = BasePay + EmpComm
- End If
- End Sub
- Private Sub AboutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
- Dim MessageAbout As String
- MessageAbout = "Program Name: Sales Commission Calculator" _
- & Environment.NewLine _
- & "Programmer: Joe Shmoe"
- MessageBox.Show(MessageAbout, "About Commission Calc", MessageBoxButtons.OK, MessageBoxIcon.Information)
- End Sub
- Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
- Me.Close()
- End Sub
- Private Sub SummaryToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SummaryToolStripMenuItem.Click
- TotalPay = TotalPay + EmpTotalPay
- TotalComm = TotalComm + EmpComm
- TotalSales = TotalSales + EmpTotalSales
- MessageSummary = "Employee Sales and Pay Summary" _
- & Environment.NewLine & Environment.NewLine _
- & "Total Sales: " & TotalSales.ToString("c") _
- & Environment.NewLine & Environment.NewLine _
- & "Total Commission: " & TotalComm.ToString("c") _
- & Environment.NewLine & Environment.NewLine _
- & "Total Pay for" _
- & Environment.NewLine _
- & "All Employees: " & TotalPay.ToString("c")
- MessageBox.Show(MessageSummary, "Employee Weekly Summary")
- End Sub
- Private Sub AddButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddButton.Click
- NameTextBox.ReadOnly = True
- SaleAmt = Decimal.Parse(SalesTextBox.Text)
- EmpTotalSales = EmpTotalSales + SaleAmt
- SalesTextBox.Clear()
- SalesTextBox.Focus()
- Call CalcComm()
- TotalTextBox.Text = EmpTotalPay.ToString("c")
- End Sub
- Private Sub ClearToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearToolStripMenuItem.Click
- TotalPay = TotalPay + EmpTotalPay
- TotalComm = TotalComm + EmpComm
- TotalSales = TotalSales + EmpTotalSales
- NameTextBox.ReadOnly = False
- NameTextBox.Clear()
- SalesTextBox.Clear()
- TotalTextBox.Clear()
- NameTextBox.Focus()
- EmpComm = 0
- EmpPay = 0
- EmpTotalSales = 0
- EmpPay = 0
- TotalTextBox.Text = 0.ToString("c")
- End Sub
- Private Sub ColorToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ColorToolStripMenuItem.Click
- With ColorDialog1
- .Color = TotalTextBox.ForeColor
- .ShowDialog()
- TotalTextBox.ForeColor = .Color
- End With
- End Sub
- Private Sub FontToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FontToolStripMenuItem.Click
- With FontDialog1
- .Font = TotalTextBox.Font
- .ShowDialog()
- TotalTextBox.Font = .Font
- End With
- End Sub
- Private Sub FileToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FileToolStripMenuItem.Click
- End Sub
- Private Sub TitleLabel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TitleLabel.Click
- End Sub
- Private Sub ToolStripSeparator2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripSeparator2.Click
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement