Jump to content

Pay Calculator


RichE
 Share

Recommended Posts

ever started a new job and got sick of them mucking your pay up so you don't really know what your suppose to be coming out with per month, I did, so i wrote a program to work it out for you.

note: works in british £

; ---------------------------------------------------------------------------- 
; 
; AutoIt Version: 3.1.0 
; Author:        Richard Easton 
; Script Function: 
;   Calculates tax national insurance and outcome pay 
; 
; ---------------------------------------------------------------------------- 


#include <GuiConstants.au3> 

Opt("GUIOnEventMode", 1) 

GuiCreate("Pay Calculator", 270, 150,(@DesktopWidth-392)/2, (@DesktopHeight-311)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) 

$pay = GUICtrlCreateInput("", 15, 15, 100, 20) 
GUICtrlCreateLabel("Input pay (Before TAX/NI)", 125, 20, 200, 20) 


GUICtrlCreateLabel("TAX PAID", 15, 50, 200, 25) 
$t = GUICtrlCreateLabel("", 125, 50, 200, 25) 

GUICtrlCreateLabel("NI PAID", 15, 70, 200, 25) 
$n = GUICtrlCreateLabel("", 125, 70, 200, 25) 

GUICtrlCreateLabel("Outcome pay", 15, 90, 200, 25) 
$o = GUICtrlCreateLabel("", 125, 90, 200, 25) 

$calc = GUICtrlCreateButton("Calculate", 15, 110, 80, 20) 
GUICtrlSetOnEvent(-1, "calculate") 

$cancel = GUICtrlCreateButton("Close", 160, 110, 80, 20) 
GUICtrlSetOnEvent(-1, "close") 

func calculate() 
   if GUICtrlRead($pay) = "" then 
      msgbox(0, "WARNING!!!", "No Pay Input", 10) 
   Else 
      $calctax = GUICtrlRead($pay) / 1.18 
      $tax = GUICtrlRead($pay) - $calctax 
      $calcNI = GUICtrlRead($pay) / 1.06 
      $NI = GUICtrlRead($pay) - $calcNI 
      $op = GUICtrlRead($pay) - Round($tax,2) - round($NI,2) 
       
      GUICtrlSetData($t, "£" & Round($tax,2)) 
      GUICtrlSetData($n, "£" & round($NI,2)) 
      GUICtrlSetData($o, "£" & round($op,2)) 
   EndIf 
EndFunc    

func close() 
   msgbox(64, "Thanks", "for using Pay Calculator" & @CRLF & "Written by Richard Easton", 5) 
   Exit 
endfunc 

GuiSetState() 
While 1 
   $msg = GuiGetMsg() 
   Select 
   Case $msg = $GUI_EVENT_CLOSE 
      ExitLoop 
   Case Else 
     ;;; 
   EndSelect 
WEnd 
Exit

RichE

[font="'Arial Narrow';"]Current projects[/font]

[font="'Arial Narrow';"]are on my site [/font]Sellostring

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...