Salary Calculation Visual Basic
Design interface program to calculate the net salary of an employee with some of the following provisions:
-an employee has a NIM attribute, name, jenkel, marital status, number of children, class, position.
Devise a program interface as shown below:
When pressed F5 (to run the VB program) then
a. empty all textbox, option radion and combo box
b. disable all the textbox, cmbproses, cmbbatal
At the moment we press the F5 key, then the translator (compiler), Visual Basic first working Form_Load event. To the right lay the source code gives the initial value of each variable used in both textbox, option radion, combobox and command.
Private Sub Form_Load ()
'Clear the textbox
txtNip.Text = ""
txtNama.Text = ""
txtJAnak.Text = ""
txtGPokok.Text = ""
txtTIstri.Text = ""
txtTAnak.Text = ""
txtTJabatan.Text = ""
txtGKotor.Text = ""
txtPPN.Text = ""
txtGBersih.Text = ""
'Clear the radio option
OptKawin.Value = False
OptTKawin.Value = False
'Disable the textbox, radio options
'The following program code to be used again when the desired charging
'Data. To code a program that would make a great repeatedly invoked
'A block of programs, whether the procedure or function.
txtNip.Enabled = False
txtNama.Enabled = False
txtJAnak.Enabled = False
txtGPokok.Enabled = False
txtTIstri.Enabled = False
txtTAnak.Enabled = False
txtTJabatan.Enabled = False
txtGKotor.Enabled = False
txtPPN.Enabled = False
txtGBersih.Enabled = False
OptKawin.Enabled = False
OptTKawin.Enabled = False
'Fill groups
cboGol.AddItem ("Select Group")
cboGol.AddItem ("I")
cboGol.AddItem ("II")
cboGol.AddItem ("III")
cboGol.AddItem ("IV")
'Fill Position
cboJabatan.AddItem ("Select Title")
cboJabatan.AddItem ("Operational")
cboJabatan.AddItem ("Tactics")
cboJabatan.AddItem ("Strategic")
'Activate data information in both combobox and Position Classification
cboGol.ListIndex = 0
cboJabatan.ListIndex = 0
'Disable combobox
cboGol.Enabled = False
cboJabatan.Enabled = False
'Non-switch command canceled, the process
cmdBatal.Enabled = False
cmdProses.Enabled = False
End Sub
3. When you Command-click the process in
a. Test whether the textbox and combobox is filled
b. Determine salary basic salary, allowances wife, children,
Define VAT, gross salary and net salary
c. Disable command Process
d. Activate New command
Private Sub cmdBaru_Click ()
'Activate the option not to marry radion
OptTKawin.Value = True
'Disable textbox field of child
txtJAnak.Enabled = False
'Clear the textbox
txtNip.Text = ""
txtNama.Text = ""
txtJAnak.Text = ""
txtGPokok.Text = ""
txtTIstri.Text = ""
txtTAnak.Text = ""
txtTJabatan.Text = ""
txtGKotor.Text = ""
txtPPN.Text = ""
txtGBersih.Text = ""
'Enabled textbox
txtNip.Enabled = True
txtNama.Enabled = True
txtGPokok.Enabled = True
txtTIstri.Enabled = True
txtTAnak.Enabled = True
txtTJabatan.Enabled = True
txtGKotor.Enabled = True
txtPPN.Enabled = True
txtGBersih.Enabled = True
OptKawin.Enabled = True
OptTKawin.Enabled = True
'Enabled combobox
cboGol.Enabled = True
cboJabatan.Enabled = True
'Activate and cancel process command
cmdProses.Enabled = True
cmdBatal.Enabled = True
'Disable the new command
cmdBaru.Enabled = False
'Focus to the textbox Nip kurson
txtNip.SetFocus
End Sub
4. Number of children can be charged if the mating status
Private Sub OptKawin_Click ()
txtJAnak.Enabled = True
txtJAnak.SetFocus
End Sub
5.If unmarried status of the child can not fill and empty values
Private Sub OptTKawin_Click ()
txtJAnak.Enabled = False
'Clear the number of children
txtJAnak.Text = ""
End Sub
7. If clicked, the process is calculated then verify
a. whether the data Nip, has condition name, class and positions have been selected
b. determine the basic salary, allowances of office, benefits and wife,
child allowances, gross salaries, VAT, and net salary
c. Show the basic salary, position allowance, allowances for wives,
child allowances, gross salaries, VAT, and net salary
d. disable command Process
e. New command Aktikan
Private Sub cmdProses_Click ()
Dim GajiPokok, GajiKotor, VAT As Single
Dim TunjanganJabatan, TunjanganIstri, TunjanganAnak As Long
'Test whether the charged Nip
If (Trim (txtNip.Text = "")) Then
MsgBox ("Nip Empty")
txtNip.SetFocus
Exit Sub
End If
'Test whether the name is already filled
If (Trim (txtNama.Text = "")) Then
MsgBox ("Empty Names")
txtNama.SetFocus
Exit Sub
End If
'Test whether the group has been selected
If (cboGol.ListIndex = 0) Then
MsgBox ("Select Group")
cboGol.SetFocus
Exit Sub
End If
'Test whether the position has been selected
If (cboJabatan.ListIndex = 0) Then
MsgBox ("Select Group")
cboJabatan.SetFocus
Exit Sub
End If
'Test whether jlhanak already filled when the mating status
If (OptKawin.Value = True) Then
If (Trim (txtJAnak.Text = "")) Then
MsgBox ("Enter Number of Children")
txtJAnak.SetFocus
Exit Sub
End If
End If
'Determine the basic salary
If (cboGol.Text = "I") Then
GajiPokok = 1000000
Elseif (cboGol.Text = "II") Then
GajiPokok = 2000000
Elseif (cboGol.Text = "II") Then
GajiPokok = 3000000
Else
GajiPokok = 4000000
End If
'Determine the allowances of office
If (cboJabatan.ListIndex = 1) Then 'If Not Have a Job
TunjanganJabatan = 0
Elseif (cboJabatan.ListIndex = 1) Then 'If Not Have a Job
TunjanganJabatan = 500 000
Elseif (cboJabatan.ListIndex = 1) Then 'If Not Have a Job
TunjanganJabatan = 1000000
Else
TunjanganJabatan = 1500000
End If
'Define Allowances wife
If (OptKawin.Value = True) Then
TunjanganIstri = 100 000
'Define the Child Benefit
If (txtJAnak.Text> 3) Then 'Children> 3
TunjanganAnak = 3 * 50 000
Else
TunjanganAnak = txtJAnak.Text * 50 000
End If
Else
TunjanganIstri = 0
TunjanganAnak = 0
End If
'Determine the Gross Salaries, VAT
GajiKotor = GajiPokok + TunjanganJabatan + TunjanganIstri + TunjanganAnak
VAT = 0.1 * GajiKotor
GajiBersih = GajiKotor - VAT
'Move to the textbox Basic Salary, Allowances Wife
'Benefit Children, Position Allowance
'Gross Salaries, VAT, Net Salary
txtGPokok.Text = Str (GajiPokok)
txtTJabatan.Text = Str (TunjanganJabatan)
txtTIstri.Text = Str (TunjanganIstri)
txtTAnak.Text = Str (TunjanganAnak)
txtGKotor.Text = Str (GajiKotor)
txtPPN.Text = Str (VAT)
txtGBersih.Text = Str (GajiBersih)
'Disable the command process
cmdProses.Enabled = False
'New command switch
cmdBaru.Enabled = True
End Sub
8. If the command is clicked Cancel
'Clear the textbox, radio option, combobox
'Disable textbox, radio option, combobox
'Non-switch command and cancel the process
'All the functionality available in the form load event
'Call Form_Load event
Form_Load
'New command switch
cmdBaru.Enabled = True
End Sub
9. If the click command Exit
Test whether completely out, if so close the application, if not re-
to the application
Private Sub cmdTutup_Click ()
If MsgBox ("Yakin Exit", vbOKCancel + vbDefaultButton2, "Close Application") = vbOK Then
End
End If
End Sub
Monday, June 6, 2011
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment