# Need Help With Simple Tax Calculator

## Recommended Posts

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
\$InkoopBTW = \$inkoopprijs * 1.19
\$5percentbuttonProfit = \$InkoopBTW * 1.05
GUICtrlSetData (\$VerkoopincBTW, \$5percentbuttonProfit)
ClipPut(\$5percentbuttonProfit)

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

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

Case \$msg = \$20percentbutton
\$InkoopBTW = \$inkoopprijs * 1.19
\$20percentbuttonProfit = \$InkoopBTW * 1.20
GUICtrlSetData (\$VerkoopincBTW, \$20percentbuttonProfit)
ClipPut(\$20percentbuttonProfit)

Case \$msg = \$custompercentbutton
\$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 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
\$InkoopBTW = \$inkoopprijs * 1.19
\$5percentbuttonProfit = \$InkoopBTW * 1.05
GUICtrlSetData (\$VerkoopincBTW, \$5percentbuttonProfit)
ClipPut(\$5percentbuttonProfit)

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

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

Case \$msg = \$20percentbutton
\$InkoopBTW = \$inkoopprijs * 1.19
\$20percentbuttonProfit = \$InkoopBTW * 1.20
GUICtrlSetData (\$VerkoopincBTW, \$20percentbuttonProfit)
ClipPut(\$20percentbuttonProfit)

Case \$msg = \$custompercentbutton
\$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 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
\$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
\$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 on other sites

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

```Case \$msg = \$custompercentbutton
\$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 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)

GuiSetState()
While 1
\$msg = GuiGetMsg()
Select

Case \$msg = \$GUI_EVENT_CLOSE
ExitLoop

Case \$msg = \$5percentbutton
\$prijs2 = \$prijs1 / 100
\$prijs3 = \$prijs2 * 119
\$prijs4 = \$prijs3 / 100
\$5percentbuttonProfit = \$prijs4 * 105
\$prijs4 = \$prijs1 / 100
\$5percentbuttonProfit = \$prijs4 * 105
ControlClick("BTW Calc","Inkoop ex BTW","Edit4")
Send("{HOME}")
ClipPut(\$5percentbuttonProfit)

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

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

Case \$msg = \$20percentbutton
\$prijs2 = \$prijs1 / 100
\$prijs3 = \$prijs2 * 119
\$prijs4 = \$prijs3 / 100
\$20percentbuttonProfit = \$prijs4 * 120
\$prijs4 = \$prijs1 / 100
\$20percentbuttonProfit = \$prijs4 * 120
ControlClick("BTW Calc","Inkoop ex BTW","Edit4")
Send("{HOME}")
ClipPut(\$20percentbuttonProfit)

Case \$msg = \$custompercentbutton
\$prijs2 = \$prijs1 / 100
\$prijs3 = \$prijs2 * 119
\$prijs4 = \$prijs3 / 100
\$custompercentbuttonProfit = \$prijs4 * Number(100 + Number(GUICtrlRead(\$custompercentinput)))
\$prijs4 = \$prijs1 / 100
\$custompercentbuttonProfit = \$prijs4 * Number(100 + Number(GUICtrlRead(\$custompercentinput)))
ControlClick("BTW Calc","Inkoop ex BTW","Edit4")
Send("{HOME}")
ClipPut(\$custompercentbuttonProfit)

Case Else
;;;
EndSelect
WEnd
Exit```

##### 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 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...

## Create an account

Register a new account

• ### Recently Browsing   0 members

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...