473,233 Members | 1,457 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,233 software developers and data experts.

New Code to Compute Retail Values

I started working on a script that would take the cost of something
and suggest a retail amount.
I usually figure Retail on Margins. So Retail equals Cost divided by
(Margin-100)% plus Cost.
So if Cost is $50 and Margin is 40%
50/(40-100)%+50=80
or
(50/60%)+50=80
But now I have to go to work...

</FORM>
<table border="1" cellpadding="0" cellspacing="0" style="border-
collapse: collapse" bordercolor="#111111" width="48%">
<tr>
<td width="20%"><FORM NAME="Calc">
<TABLE BORDER=4>
<TR>
<TD>
<INPUT TYPE="text" NAME="Input" Size="16">
<br>
</TD>
</TR>
<TR>
<TD>
<INPUT TYPE="button" NAME="one" VALUE=" 1 "
OnClick="Calc.Input.value += '1'">
<INPUT TYPE="button" NAME="two" VALUE=" 2 "
OnCLick="Calc.Input.value += '2'">
<INPUT TYPE="button" NAME="three" VALUE=" 3 "
OnClick="Calc.Input.value += '3'">
<INPUT TYPE="button" NAME="plus" VALUE=" + "
OnClick="Calc.Input.value += ' + '">
<br>
<INPUT TYPE="button" NAME="four" VALUE=" 4 "
OnClick="Calc.Input.value += '4'">
<INPUT TYPE="button" NAME="five" VALUE=" 5 "
OnCLick="Calc.Input.value += '5'">
<INPUT TYPE="button" NAME="six" VALUE=" 6 "
OnClick="Calc.Input.value += '6'">
<INPUT TYPE="button" NAME="minus" VALUE=" - "
OnClick="Calc.Input.value += ' - '">
<br>
<INPUT TYPE="button" NAME="seven" VALUE=" 7 "
OnClick="Calc.Input.value += '7'">
<INPUT TYPE="button" NAME="eight" VALUE=" 8 "
OnCLick="Calc.Input.value += '8'">
<INPUT TYPE="button" NAME="nine" VALUE=" 9 "
OnClick="Calc.Input.value += '9'">
<INPUT TYPE="button" NAME="times" VALUE=" x "
OnClick="Calc.Input.value += ' * '">
<br>
<INPUT TYPE="button" NAME="clear" VALUE=" c "
OnClick="Calc.Input.value = ''">
<INPUT TYPE="button" NAME="zero" VALUE=" 0 "
OnClick="Calc.Input.value += '0'">
<INPUT TYPE="button" NAME="DoIt" VALUE=" = "
OnClick="Calc.Input.value = eval(Calc.Input.value)">
<INPUT TYPE="button" NAME="div" VALUE=" / "
OnClick="Calc.Input.value += ' / '">
<br>
</TD>
</TR>
</TABLE></td>
<td width="80%"><script language="JavaScript"><!--
function setForm2Value() {
var selectedItem =
document.formName1.selectName1.selectedIndex;
var selectedItemValue =
document.formName1.selectName1.options[selectedItem].value;
var selectedItemText =
document.formName1.selectName1.options[selectedItem].text;

if (selectedItem != 0) {
document.formName2.textboxName1.value = selectedItemText;
document.formName2.textboxName2.value = selectedItemValue;
}
else {
document.formName2.textboxName1.value = "";
document.formName2.textboxName2.value = "";
}
}
//--></script>
<form>
<input type="text" name="T1" size="20" value="0.00">&nbsp;
</form>
<p>
<form name="formName1">
<input type="button" value="30%" name="B1">&nbsp;
<input type="button" value="40%" name="B2">&nbsp;
<input type="button" value="50%" name="B3">&nbsp;
<input type="text" name="T1" size="20"><br>
$.00<input type="radio" value="V1" checked name="R1">&nbsp;&nbsp;
<input type="radio" name="R1" value="V2">$.95&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" name="R1" value="V3">$.99<br>
&nbsp;</form>

<p>

<form name="formName2">
Cost of
<input type="textbox" name="textboxName1" value="" size="10">
at
<input type="textbox" name="textboxName2" value="" size="10">%
Margin<br>
&nbsp;is
<input type="textbox" name="textboxName3" value="$.99" size="10">
</form></td>
</tr>
</table>
Jun 27 '08 #1
4 1328
wutzke wrote:
I started working on a script that would take the cost of something
and suggest a retail amount.
I usually figure Retail on Margins. So Retail equals Cost divided by
(Margin-100)% plus Cost.
So if Cost is $50 and Margin is 40%
50/(40-100)%+50=80
or
(50/60%)+50=80
But now I have to go to work...

[code]
http://catb.org/~esr/faqs/smart-questions.html
PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Jun 27 '08 #2
On Apr 23, 3:26 am, wutzke <michael.wut...@gmail.comwrote:
I started working on a script that would take the cost of something
and suggest a retail amount.
I usually figure Retail on Margins. So Retail equals Cost divided by
(Margin-100)% plus Cost.
So if Cost is $50 and Margin is 40%
50/(40-100)%+50=80
or
(50/60%)+50=80
Either your equation is defective or I don't understand it. If your
retail price is cost plus margin, where margin is expressed as a
percentage of the cost, then for a 60% margin:

var margin = 60;
var rrp = cost * (1 + margin/100);
If margin is expressed as a decimal number (i.e. 0.6 rather than 60)
the formula becomes:

var margin = 0.6;
var rrp = cost * (1 + margin);
For rounding to a set number of decimal place, see the FAQ:

<URL http://www.jibbering.com/faq/ >
--
Rob
Jun 27 '08 #3

Thanks.
That linked lesson was helpful
Jun 27 '08 #4
You Are Right
I guess I didn't explain it right
This Google Calculator may explain it better
http://www.google.com/search?hl=en&q...00&btnG=Search
On Apr 22, 11:14 pm, RobG <rg...@iinet.net.auwrote:
On Apr 23, 3:26 am, wutzke <michael.wut...@gmail.comwrote:
I started working on a script that would take the cost of something
and suggest a retail amount.
I usually figure Retail on Margins. So Retail equals Cost divided by
(Margin-100)% plus Cost.
So if Cost is $50 and Margin is 40%
50/(40-100)%+50=80
or
(50/60%)+50=80

Either your equation is defective or I don't understand it. If your
retail price is cost plus margin, where margin is expressed as a
percentage of the cost, then for a 60% margin:

var margin = 60;
var rrp = cost * (1 + margin/100);

If margin is expressed as a decimal number (i.e. 0.6 rather than 60)
the formula becomes:

var margin = 0.6;
var rrp = cost * (1 + margin);

For rounding to a set number of decimal place, see the FAQ:

<URLhttp://www.jibbering.com/faq/>

--
Rob
Jun 27 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

38
by: jrlen balane | last post by:
basically what the code does is transmit data to a hardware and then receive data that the hardware will transmit. import serial import string import time from struct import * ser =...
5
by: Obantec Support | last post by:
Hi i leached some code and strung together a popup i need for a page with 5 help buttons. Now i could use 5 scripts and pre-load the values but i would rather get a better understanding of how...
8
by: ben | last post by:
i have a bit of code, that works absolutely fine as is, but seems over complicated/long winded. is there anyway to shorten/simplify it? the code is below. description of it: it's like strcpy in...
143
by: suri | last post by:
Hello I downloaded glibc and tried looking for the code that implements the sine function i couldnt find the file. i went to the math directory and found math.h.. i guess that needs to be...
136
by: Merrill & Michele | last post by:
A derangement is a mapping of a set onto itself leaving no element fixed. I realized that that was what I was programming when I was asked to randomly determine who buys presents for whom this...
2
by: Maciej Bliziński | last post by:
Hello, I started to write the query that should compute the median. Surprisingly, I get following error message: "server closed the connection unexpectedly This probably means the server...
232
by: robert maas, see http://tinyurl.com/uh3t | last post by:
I'm working on examples of programming in several languages, all (except PHP) running under CGI so that I can show both the source files and the actually running of the examples online. The first...
5
by: gracia | last post by:
I need to compute the value of binomial(n, k)=n!/k!(n-k)! * (1-p)^n * p^k. When n and k is very big (e.g. n 160), the step to compute n!/k!(n- k)! is always overflow even when I used unsigned...
1
by: aprillynn82 | last post by:
I am making a retail price calculator for a school project. We are to write an application that accepts the wholesale cost and its markup percentage. We have to verify the values entered for...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.