hsu take home docu format
TRANSCRIPT
UNIVERSITY OF MAKATIHigher School ng UMAK
TAKE HOME ACTIVITY #2
Student No K11512180 / K11500869Student Name LEE, RONN MICO R./ SAN LUIS, MATT GUIGSY
Elective IT Software – Programming using VB.NetDate/Time Finished 3/7/2016 8:21pm
Instructor Prof. R. Dorin
I/we certify with all honesty that this case study has no other copies and that I/we have dedicated my time and effort for this to be accomplished.
We are confident and willing to answer all questions regarding this case study and I will not take credit on things that I did not do.
_______________________ ________________________ _________________________Student’s Signature Student’s Signature Student’s Signature
SCREEN SHOT
CODE
New User Form Code
Public Class frmNewUser
Private Sub btnExit_Click(sender As System.Object, e As System.EventArgs) Handles btnExit.Click Me.Close() frmLogin.Show() End Sub
Private Sub btnLogin_Click(sender As System.Object, e As System.EventArgs) Handles btnLogin.Click
If txtPass.Text = "" Or txtUser.Text = "" Then MessageBox.Show("Please Fill Up the Form", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error) Else strPass(intFlag) = txtPass.Text strUser(intFlag) = txtUser.Text MessageBox.Show("Your New Account is Made!", "Success!", MessageBoxButtons.OK, MessageBoxIcon.None) intFlag = intFlag + 1 frmLogin.Show() Me.Close() End If
End Sub
Private Sub frmNewUser_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
End SubEnd Class
Log in Form
Class frmLogin
Private Sub btnCreate_Click(sender As System.Object, e As System.EventArgs) Handles btnCreate.Click Me.Hide() frmNewUser.Show() End Sub
Private Sub btnLogin_Click(sender As System.Object, e As System.EventArgs) Handles btnLogin.Click
If txtPass.Text = strDefPass And txtUser.Text = strDefUser Then MessageBox.Show("You have successfully logged in!", "Logged in!", MessageBoxButtons.OK, MessageBoxIcon.Information) frmMain.Show() Me.Close() Else For intRoll As Integer = 0 To intFlag - 1 If txtUser.Text = strUser(intRoll) And txtPass.Text = strPass(intRoll) Then intHit = 1 End If Next
If intHit = 1 Then MessageBox.Show("You have successfully logged in!", "Logged in!", MessageBoxButtons.OK, MessageBoxIcon.Information) frmMain.Show() Me.Close() Else MessageBox.Show("You have entered the wrong username or password!", "Unsuccessful!", MessageBoxButtons.OK, MessageBoxIcon.Information) End If
End If
End Sub
Private Sub btnExit_Click(sender As System.Object, e As System.EventArgs) Handles btnExit.Click frmMain.Show() Me.Close() End Sub
Private Sub frmLogin_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
End SubEnd Class
Main Form
Public Class frmMain Public dblMouse As Double = 100, dblHardDisk As Double = 1000, dblKeyboard As Double = 250, dblMonitor As Double = 2000, dblDiskDrive = 200 Public dblQuantity As Double = 0 Public intTransactions As Integer = 1, intTextFlag As Integer = 1, intItemNumber As Integer = 0 Public dblSubtotal As Double = 0, dblDiscount As Double = 0, dblAmountPayable As Double = 0 Public dblTotalDiscount As Double = 0, intTotalItems As Integer = 0, dblTotalAmountPayable = 0
Private Sub AboutTheApplicationToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles AboutTheApplicationToolStripMenuItem.Click MessageBox.Show(My.Application.Info.Title.ToString & vbNewLine & vbNewLine & My.Application.Info.Description.ToString & vbNewLine & vbNewLine & "Version: " & My.Application.Info.Version.ToString, "About") End Sub
Private Sub ExitToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles ExitToolStripMenuItem.Click btnExit.PerformClick() End Sub
Private Sub ComputeToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles ComputeToolStripMenuItem.Click btnCompute.PerformClick() End Sub
Private Sub NewTransactionToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles NewTransactionToolStripMenuItem.Click btnNewTrans.PerformClick() End Sub
Private Sub LockToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles LockToolStripMenuItem.Click Me.Hide() frmLogin.Show() End Sub
Private Sub btnExit_Click(sender As System.Object, e As System.EventArgs) Handles btnExit.Click If MessageBox.Show("Are you sure you want to close the application?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then Application.Exit() End If End Sub
Private Sub btnCompute_Click(sender As System.Object, e As System.EventArgs) Handles btnCompute.Click lblSubtotal.Text = FormatCurrency(dblSubtotal)
If cboDiscount.SelectedIndex = 1 Then dblDiscount = dblSubtotal * 0.03 ElseIf cboDiscount.SelectedIndex = 2 Then dblDiscount = dblSubtotal * 0.07 ElseIf cboDiscount.SelectedIndex = 3 Then dblDiscount = dblSubtotal * 0.12 End If
lblDiscount.Text = FormatCurrency(dblDiscount) dblAmountPayable = dblSubtotal - dblDiscount
lblAmountPayable.Text = FormatCurrency(dblAmountPayable)
lblTotalItems.Text = intItemNumber
dblTotalAmountPayable += dblAmountPayable dblTotalDiscount += dblDiscount intTotalItems += intItemNumber
rtbOutput.Text += vbNewLine & vbNewLine & "Subtotal: " & dblSubtotal & vbNewLine & "Discount: " & dblDiscount & vbNewLine & vbNewLine & "AMOUNT PAYABLE: " & dblAmountPayable & vbNewLine & vbNewLine & "THANK YOU!"
btnCompute.Enabled = False End Sub
Private Sub lstCompParts_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles lstCompParts.SelectedIndexChanged btnAdd.Enabled = True If lstCompParts.SelectedIndex = 0 Then lblUnitPrice.Text = FormatCurrency(dblDiskDrive) ElseIf lstCompParts.SelectedIndex = 1 Then lblUnitPrice.Text = FormatCurrency(dblHardDisk) ElseIf lstCompParts.SelectedIndex = 2 Then lblUnitPrice.Text = FormatCurrency(dblKeyboard) ElseIf lstCompParts.SelectedIndex = 3 Then lblUnitPrice.Text = FormatCurrency(dblMonitor) ElseIf lstCompParts.SelectedIndex = 4 Then lblUnitPrice.Text = FormatCurrency(dblMouse) End If End Sub
Private Sub frmMain_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load rtbOutput.SelectionAlignment = HorizontalAlignment.Center rtbOutput.Text += "HSU Computer Shop" & vbNewLine & "West Rembo, Makati City" & vbNewLine & "TIN: 123-123-332-112" & vbNewLine & vbNewLine & "Day/Time: " & Format(Now, "mm/dd/yyyy") & " " & Format(Now, "hh:mm:ss tt") & vbNewLine & "----------------------------------------------" & vbNewLine End Sub
Private Sub btnAdd_Click(sender As System.Object, e As System.EventArgs) Handles btnAdd.Click dblQuantity = Val(nudQty.Value) dblSubtotal += lblUnitPrice.Text * dblQuantity intItemNumber += dblQuantity
If intTextFlag = 1 Then
rtbOutput.Text += "Transaction Number: " & intTransactions & vbNewLine rtbOutput.Text += Format(dblQuantity) & " " & lstCompParts.SelectedItem.ToString.PadRight(20) & FormatCurrency(lblUnitPrice.Text * dblQuantity).PadLeft(20).PadRight(20) & vbNewLine intTextFlag -= 1 Else rtbOutput.Text += Format(dblQuantity) & " " & lstCompParts.SelectedItem.ToString.PadRight(20) & FormatCurrency(lblUnitPrice.Text * dblQuantity).PadLeft(20).PadRight(20) & vbNewLine End If End Sub
Private Sub btnNewTrans_Click(sender As System.Object, e As System.EventArgs) Handles btnNewTrans.Click intTransactions += 1 intTextFlag = 1 lstCompParts.SelectedIndex = -1 rtbOutput.Text = "HSU Computer Shop" & vbNewLine & "West Rembo, Makati City" & vbNewLine & "TIN: 123-123-332-112" & vbNewLine & vbNewLine & "Day/Time: " & Format(Now, "mm/dd/yyyy") & " " & Format(Now, "hh:mm:ss tt") & vbNewLine & "----------------------------------------------" & vbNewLine nudQty.Value = 1 lblSubtotal.Text = "" lblDiscount.Text = "" lblAmountPayable.Text = "" cboDiscount.SelectedIndex = -1 lblTotalItems.Text = "" lblUnitPrice.Text = "" nudQty.Value = 0
intItemNumber = 0 dblSubtotal = 0 dblAmountPayable = 0 dblDiscount = 0
btnCompute.Enabled = True End Sub
Private Sub SummaryToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles SummaryToolStripMenuItem.Click MessageBox.Show("SUMMARY" & vbNewLine & "Total Number Of Items Sold: " & intTotalItems & vbNewLine & "Total Discount: " & dblTotalDiscount & vbNewLine & "Total Sales: " & dblTotalAmountPayable, "Sales Summary", MessageBoxButtons.OK, MessageBoxIcon.Information) End Sub
Private Sub grpCompParts_Enter(sender As System.Object, e As System.EventArgs) Handles grpCompParts.Enter
End SubEnd Class