I'm trying to make a script that will allow me to enter a cost, apply a VAT percentage to it, apply a mark-up to this total and then show the final grand total.
Essentially the sum that I'm trying to do is this:
Cost + VAT¹ + Mark-up cost² = Total
1 - To be entered by the user
2 - To be entered by the user
Here's the script that I've written so far:
The problem is that the math isn't currently working.
What should be happening is that the first number, eg: 100 (entered into dialog box 2) should then have a percentage of VAT added (eg: 20 for 20% - added into dialog box 3) followed by a markup of an amount entered into dialog box 4, (eg: 10 for 10%) which should lead the final dialog box to display 132 instead it's displaying 20000.
I'm dyslexic so math was never my strong suite, but I'm stumped as to how to fix this, (although I bet it's really simple!).
Can anyone help please?
Essentially the sum that I'm trying to do is this:
Cost + VAT¹ + Mark-up cost² = Total
1 - To be entered by the user
2 - To be entered by the user
Here's the script that I've written so far:
set r to return as text
display dialog "VAT + Mark-up Costing Tool" & r & r & "A small Applescript to help calculate the total print production costs chargeable to the client." & r & r & "© 2011 Creative19" with icon note buttons {"Let's Go To Work", "Not now"} default button {"Let's Go To Work"}
set opr to the button returned of the result
if opr is "Let's Go To Work" then
display dialog "Production Costs" & r & r & "Enter the total print and finishing" & r & "production costs (Excluding any VAT)" default answer "" buttons {"Next Step", "Cancel"} default button {"Next Step"} --asks for base production cost
set num1 to the text returned of the result
display dialog "Value Added Tax" & r & r & "Enter the current UK VAT rate as a % figure" default answer "" buttons {"Next Step", "Cancel"} default button {"Next Step"} --asks for current rate of VAT
set num2 to the text returned of the result
display dialog "Creative19 Mark-up" & r & r & "Enter the markup to the client as a % figure" default answer "" buttons {"Calculate It", "Cancel"} default button {"Calculate It"} --asks for mark-up percentage
set num3 to the text returned of the result
display dialog "Total Cost to Client: £" & num1 * num2 * num3 buttons {"Thanks!"} default button {"Thanks!"} --displays the equation and calculates the answer
end if
display dialog "VAT + Mark-up Costing Tool" & r & r & "A small Applescript to help calculate the total print production costs chargeable to the client." & r & r & "© 2011 Creative19" with icon note buttons {"Let's Go To Work", "Not now"} default button {"Let's Go To Work"}
set opr to the button returned of the result
if opr is "Let's Go To Work" then
display dialog "Production Costs" & r & r & "Enter the total print and finishing" & r & "production costs (Excluding any VAT)" default answer "" buttons {"Next Step", "Cancel"} default button {"Next Step"} --asks for base production cost
set num1 to the text returned of the result
display dialog "Value Added Tax" & r & r & "Enter the current UK VAT rate as a % figure" default answer "" buttons {"Next Step", "Cancel"} default button {"Next Step"} --asks for current rate of VAT
set num2 to the text returned of the result
display dialog "Creative19 Mark-up" & r & r & "Enter the markup to the client as a % figure" default answer "" buttons {"Calculate It", "Cancel"} default button {"Calculate It"} --asks for mark-up percentage
set num3 to the text returned of the result
display dialog "Total Cost to Client: £" & num1 * num2 * num3 buttons {"Thanks!"} default button {"Thanks!"} --displays the equation and calculates the answer
end if
The problem is that the math isn't currently working.
What should be happening is that the first number, eg: 100 (entered into dialog box 2) should then have a percentage of VAT added (eg: 20 for 20% - added into dialog box 3) followed by a markup of an amount entered into dialog box 4, (eg: 10 for 10%) which should lead the final dialog box to display 132 instead it's displaying 20000.
I'm dyslexic so math was never my strong suite, but I'm stumped as to how to fix this, (although I bet it's really simple!).
Can anyone help please?