Sign in to follow this  
Followers 0
drunkfux

Need Help With Simple Tax Calculator

7 posts in this topic

I really need your help with a simple tax calculator i made for use here @ work (probably something very simple for you guys)

It calculates tax and a profit margin based on a value you can input..

the 5,10,15 and 20 percent buttons already work but i need help with the custom input

here's my code:

#include <GuiConstants.au3>

$clipboardcontent = ClipGet()

GuiCreate("BTW Calc", 181, 173, (@DesktopWidth-178)/2, (@DesktopHeight-158)/2, -1)

WinSetOnTop ( "BTW Calc", "", 1 )

$InkoopLabel = GuiCtrlCreateLabel("Inkoop ex BTW     ", 10, 12, 100, 20)
$Inkoop = GuiCtrlCreateInput($clipboardcontent, 110, 9, 60, 20)

$Mark1 = GuiCtrlCreateLabel("-----------------------------------------------------", 10, 32, 210, 20)

$WinstMarge = GuiCtrlCreateLabel("WinstMarge", 60, 50, 85, 20)

$5percentbutton = GuiCtrlCreateButton("5%", 10, 70, 40, 20)
$10percentbutton = GuiCtrlCreateButton("10%", 50, 70, 40, 20)
$15percentbutton = GuiCtrlCreateButton("15%", 90, 70, 40, 20)
$20percentbutton = GuiCtrlCreateButton("20%", 130, 70, 40, 20)
$custompercentinput = GUICtrlCreateInput("", 10, 95, 40, 20)
$custompercentbutton = GuiCtrlCreateButton("Select", 50, 95, 80, 20)

$Mark2 = GuiCtrlCreateLabel("-----------------------------------------------------", 10, 123, 210, 20)

$VerkoopincBTWLabelinclBTW = GuiCtrlCreateLabel("Verkoop incl BTW ", 10, 143, 100, 20)
$VerkoopincBTW = GuiCtrlCreateInput("", 110, 140, 60, 20)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    
    Case $msg = $5percentbutton
        $inkoopprijs = GUICtrlRead($Inkoop)
        $InkoopBTW = $inkoopprijs * 1.19
        $5percentbuttonProfit = $InkoopBTW * 1.05
        GUICtrlSetData ($VerkoopincBTW, $5percentbuttonProfit)
        ClipPut($5percentbuttonProfit)

    Case $msg = $10percentbutton
        $inkoopprijs = GUICtrlRead($Inkoop)
        $InkoopBTW = $inkoopprijs * 1.19
        $10percentbuttonProfit = $InkoopBTW * 1.10
        GUICtrlSetData ($VerkoopincBTW, $10percentbuttonProfit)
        ClipPut($10percentbuttonProfit)

    Case $msg = $15percentbutton
        $inkoopprijs = GUICtrlRead($Inkoop)
        $InkoopBTW = $inkoopprijs * 1.19
        $15percentbuttonProfit = $InkoopBTW * 1.15
        GUICtrlSetData ($VerkoopincBTW, $15percentbuttonProfit)
        ClipPut($15percentbuttonProfit)

    Case $msg = $20percentbutton
        $inkoopprijs = GUICtrlRead($Inkoop)
        $InkoopBTW = $inkoopprijs * 1.19
        $20percentbuttonProfit = $InkoopBTW * 1.20
        GUICtrlSetData ($VerkoopincBTW, $20percentbuttonProfit)
        ClipPut($20percentbuttonProfit)
        
    Case $msg = $custompercentbutton
        $inkoopprijs = GUICtrlRead($Inkoop)
        $InkoopBTW = $inkoopprijs * 1.19
        $custompercentbuttonProfit = $InkoopBTW * 1.&(GUICtrlRead($custompercentinput));behind the 1. it should put the number i entered in the custompercentinput box
        GUICtrlSetData ($VerkoopincBTW, $custompercentbuttonProfit)
        ClipPut($custompercentbuttonProfit)
    
    Case Else
    ;;;
    EndSelect
WEnd
Exit

Share this post


Link to post
Share on other sites



This should do it for ya.

-Simucal

#include <GuiConstants.au3>

$clipboardcontent = ClipGet()

GuiCreate("BTW Calc", 181, 173, (@DesktopWidth-178)/2, (@DesktopHeight-158)/2, -1)

WinSetOnTop ( "BTW Calc", "", 1 )

$InkoopLabel = GuiCtrlCreateLabel("Inkoop ex BTW     ", 10, 12, 100, 20)
$Inkoop = GuiCtrlCreateInput($clipboardcontent, 110, 9, 60, 20)

$Mark1 = GuiCtrlCreateLabel("-----------------------------------------------------", 10, 32, 210, 20)

$WinstMarge = GuiCtrlCreateLabel("WinstMarge", 60, 50, 85, 20)

$5percentbutton = GuiCtrlCreateButton("5%", 10, 70, 40, 20)
$10percentbutton = GuiCtrlCreateButton("10%", 50, 70, 40, 20)
$15percentbutton = GuiCtrlCreateButton("15%", 90, 70, 40, 20)
$20percentbutton = GuiCtrlCreateButton("20%", 130, 70, 40, 20)
$custompercentinput = GUICtrlCreateInput("", 10, 95, 40, 20)
$custompercentbutton = GuiCtrlCreateButton("Select", 50, 95, 80, 20)

$Mark2 = GuiCtrlCreateLabel("-----------------------------------------------------", 10, 123, 210, 20)

$VerkoopincBTWLabelinclBTW = GuiCtrlCreateLabel("Verkoop incl BTW ", 10, 143, 100, 20)
$VerkoopincBTW = GuiCtrlCreateInput("", 110, 140, 60, 20)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    
    Case $msg = $5percentbutton
        $inkoopprijs = GUICtrlRead($Inkoop)
        $InkoopBTW = $inkoopprijs * 1.19
        $5percentbuttonProfit = $InkoopBTW * 1.05
        GUICtrlSetData ($VerkoopincBTW, $5percentbuttonProfit)
        ClipPut($5percentbuttonProfit)

    Case $msg = $10percentbutton
        $inkoopprijs = GUICtrlRead($Inkoop)
        $InkoopBTW = $inkoopprijs * 1.19
        $10percentbuttonProfit = $InkoopBTW * 1.10
        GUICtrlSetData ($VerkoopincBTW, $10percentbuttonProfit)
        ClipPut($10percentbuttonProfit)

    Case $msg = $15percentbutton
        $inkoopprijs = GUICtrlRead($Inkoop)
        $InkoopBTW = $inkoopprijs * 1.19
        $15percentbuttonProfit = $InkoopBTW * 1.15
        GUICtrlSetData ($VerkoopincBTW, $15percentbuttonProfit)
        ClipPut($15percentbuttonProfit)

    Case $msg = $20percentbutton
        $inkoopprijs = GUICtrlRead($Inkoop)
        $InkoopBTW = $inkoopprijs * 1.19
        $20percentbuttonProfit = $InkoopBTW * 1.20
        GUICtrlSetData ($VerkoopincBTW, $20percentbuttonProfit)
        ClipPut($20percentbuttonProfit)
        
    Case $msg = $custompercentbutton
        $inkoopprijs = GUICtrlRead($Inkoop)
        $InkoopBTW = $inkoopprijs * 1.19
        $custompercentbuttonProfit = $InkoopBTW * (((GUICtrlRead($custompercentinput))*.1)+1);behind the 1. it should put the number i entered in the custompercentinput box
        GUICtrlSetData ($VerkoopincBTW, $custompercentbuttonProfit)
        ClipPut($custompercentbuttonProfit)
    
    Case Else
   ;;;
    EndSelect
WEnd
Exit

AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)

Share this post


Link to post
Share on other sites

I really need your help with a simple tax calculator i made for use here @ work (probably something very simple for you guys)

It calculates tax and a profit margin based on a value you can input..

the 5,10,15 and 20 percent buttons already work but i need help with the custom input

here's my code:

Case $msg = $custompercentbutton
        $inkoopprijs = GUICtrlRead($Inkoop)
        $InkoopBTW = $inkoopprijs * 1.19
        $custompercentbuttonProfit = $InkoopBTW * 1.&(GUICtrlRead($custompercentinput));behind the 1. it should put the number i entered in the custompercentinput box
Yeah, you get an error. Concatenate as a string and use try Number() to convert it.

Case $msg = $custompercentbutton
        $inkoopprijs = GUICtrlRead($Inkoop)
        $InkoopBTW = $inkoopprijs * 1.19
        $custompercentbuttonProfit = $InkoopBTW * Number('1.' & GUICtrlRead($custompercentinput));behind the 1. it should put the number i entered in the custompercentinput box

Share this post


Link to post
Share on other sites

Yeah, you get an error. Concatenate as a string and use try Number() to convert it.

Case $msg = $custompercentbutton
        $inkoopprijs = GUICtrlRead($Inkoop)
        $InkoopBTW = $inkoopprijs * 1.19
        $custompercentbuttonProfit = $InkoopBTW * Number('1.' & GUICtrlRead($custompercentinput));behind the 1. it should put the number i entered in the custompercentinput box
Thx very much guys, works great now..

Share this post


Link to post
Share on other sites

Changed the layout a bit and got 1 more question..

How do i make that the results at the -BTW and +BTW only show 2 decimals behind the comma?

#include <GuiConstants.au3>

$clipboardcontent = ClipGet()

GuiCreate("BTW Calc", 195, 200, (@DesktopWidth-178)/2, (@DesktopHeight-158)/2, -1)

WinSetOnTop ( "BTW Calc", "", 1 )

$InkoopLabel = GuiCtrlCreateLabel("Inkoop ex BTW   ", 10, 12, 100, 20)
$Inkoop = GuiCtrlCreateInput($clipboardcontent, 105, 9, 80, 20)

$Mark1 = GuiCtrlCreateLabel("------------------------------------------------------------", 5, 32, 180, 20)

$VastPercentage = GuiCtrlCreateLabel("Vast Percentage", 10, 45, 85, 20)

$5percentbutton = GuiCtrlCreateButton("5%", 10, 63, 40, 20)
$10percentbutton = GuiCtrlCreateButton("10%", 55, 63, 40, 20)
$15percentbutton = GuiCtrlCreateButton("15%", 101, 63, 40, 20)
$20percentbutton = GuiCtrlCreateButton("20%", 146, 63, 40, 20)

$EigenPercentage = GuiCtrlCreateLabel("Eigen Percentage", 10, 90, 95, 20)

$custompercentinput = GUICtrlCreateInput("", 146, 88, 40, 20)
$custompercentbutton = GuiCtrlCreateButton("OK", 101, 88, 40, 20)

$Mark2 = GuiCtrlCreateLabel("------------------------------------------------------------", 5, 110, 180, 20)

$verkoopadviesexprijs = GuiCtrlCreateInput("", 105, 125, 80, 20)
$verkoopadviesexprijsLabel = GuiCtrlCreateLabel("Verkoop -- BTW  ", 10, 128, 90, 20)

$verkoopadviesprijs = GuiCtrlCreateInput("", 105, 150, 80, 20)
$verkoopadviesprijsLabel = GuiCtrlCreateLabel("Verkoop + BTW  ", 10, 153, 90, 20)

$Copyright = GuiCtrlCreateLabel("Copyright DAM Computers Lemmer BV", 5, 180, 190, 20)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    
Case $msg = $5percentbutton
        $prijs1 = GUICtrlRead($Inkoop)
        $prijs2 = $prijs1 / 100
        $prijs3 = $prijs2 * 119
        $prijs4 = $prijs3 / 100
        $5percentbuttonProfit = $prijs4 * 105
        GUICtrlSetData ($verkoopadviesprijs, $5percentbuttonProfit)
        $prijs1 = GUICtrlRead($Inkoop)
        $prijs4 = $prijs1 / 100
        $5percentbuttonProfit = $prijs4 * 105
        GUICtrlSetData ($verkoopadviesexprijs, $5percentbuttonProfit)
        ControlClick("BTW Calc","Inkoop ex BTW","Edit4")
        Send("{HOME}")
        ClipPut($5percentbuttonProfit)

    Case $msg = $10percentbutton
        $prijs1 = GUICtrlRead($Inkoop)
        $prijs2 = $prijs1 / 100
        $prijs3 = $prijs2 * 119
        $prijs4 = $prijs3 / 100
        $10percentbuttonProfit = $prijs4 * 110
        GUICtrlSetData ($verkoopadviesprijs, $10percentbuttonProfit)
        $prijs1 = GUICtrlRead($Inkoop)
        $prijs4 = $prijs1 / 100
        $10percentbuttonProfit = $prijs4 * 110
        GUICtrlSetData ($verkoopadviesexprijs, $10percentbuttonProfit)
        ControlClick("BTW Calc","Inkoop ex BTW","Edit4")
        Send("{HOME}")
        ClipPut($10percentbuttonProfit)

    Case $msg = $15percentbutton
        $prijs1 = GUICtrlRead($Inkoop)
        $prijs2 = $prijs1 / 100
        $prijs3 = $prijs2 * 119
        $prijs4 = $prijs3 / 100
        $15percentbuttonProfit = $prijs4 * 115
        GUICtrlSetData ($verkoopadviesprijs, $15percentbuttonProfit)
        $prijs1 = GUICtrlRead($Inkoop)
        $prijs4 = $prijs1 / 100
        $15percentbuttonProfit = $prijs4 * 115
        GUICtrlSetData ($verkoopadviesexprijs, $15percentbuttonProfit)
        ControlClick("BTW Calc","Inkoop ex BTW","Edit4")
        Send("{HOME}")
        ClipPut($15percentbuttonProfit)

    Case $msg = $20percentbutton
        $prijs1 = GUICtrlRead($Inkoop)
        $prijs2 = $prijs1 / 100
        $prijs3 = $prijs2 * 119
        $prijs4 = $prijs3 / 100
        $20percentbuttonProfit = $prijs4 * 120
        GUICtrlSetData ($verkoopadviesprijs, $20percentbuttonProfit)
        $prijs1 = GUICtrlRead($Inkoop)
        $prijs4 = $prijs1 / 100
        $20percentbuttonProfit = $prijs4 * 120
        GUICtrlSetData ($verkoopadviesexprijs, $20percentbuttonProfit)
        ControlClick("BTW Calc","Inkoop ex BTW","Edit4")
        Send("{HOME}")
        ClipPut($20percentbuttonProfit)
        
    Case $msg = $custompercentbutton
        $prijs1 = GUICtrlRead($Inkoop)
        $prijs2 = $prijs1 / 100
        $prijs3 = $prijs2 * 119
        $prijs4 = $prijs3 / 100
        $custompercentbuttonProfit = $prijs4 * Number(100 + Number(GUICtrlRead($custompercentinput)))
        GUICtrlSetData ($verkoopadviesprijs, $custompercentbuttonProfit)
        $prijs1 = GUICtrlRead($Inkoop)
        $prijs4 = $prijs1 / 100
        $custompercentbuttonProfit = $prijs4 * Number(100 + Number(GUICtrlRead($custompercentinput)))
        GUICtrlSetData ($verkoopadviesexprijs, $custompercentbuttonProfit)
        ControlClick("BTW Calc","Inkoop ex BTW","Edit4")
        Send("{HOME}")
        ClipPut($custompercentbuttonProfit)
    
    Case Else
  ;;;
    EndSelect
WEnd
Exit

Share this post


Link to post
Share on other sites

Perhaps Round() can help you. It will not pad with zero's, else you would need to look at StringFormat() perhaps.

Share this post


Link to post
Share on other sites

Perhaps Round() can help you. It will not pad with zero's, else you would need to look at StringFormat() perhaps.

Again a great answer Mhz, i really should try looking a bit better myself... :think:

Share this post


Link to post
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
Sign in to follow this  
Followers 0