如果有助于解释我在做什么,第一个函数会计算总收入。第二个计算负面费用,但现在我不知道如何减去总额中的费用?
基本上 - 我有回答A(粗略)的功能。我有功能,答案B(费用)。但是如何从A中减去B?
任何帮助都会很棒!
<script language="javascript" type="text/javascript">
function runGross(grossForm) {
var field1 = Number(grossForm.box1.value);
var field2 = Number(grossForm.box2.value);
var field3 = Number(grossForm.box3.value);
grossForm.total.value = '$' + field1*field2*field3;
}
function runTotal(totalForm) {
var field4 = Number(totalForm.box4.value);
var field5 = Number(totalForm.box5.value);
var field6 = Number(totalForm.box6.value);
var field7 = Number(totalForm.box7.value);
var field8 = Number(totalForm.box8.value);
var field9 = Number(totalForm.box9.value);
var field10 = Number(totalForm.box10.value);
var field11 = Number(totalForm.box11.value);
totalForm.total.value = field4-field5-field6-field7-field8-field9-field10-field11;
}
</script>
<h1>How Much Can You Make as Counselor in Private Practice?</h1>
<h2><span style="color: #339966;">Adding the Total Gross Revenue</span></h2>
Use an average of cash clients and various payers. Remember, that insurance pays a little more for first appointments, and couples counseling / family therapy.
<form><span style="color: #339966;"><strong>Revenue Per Session</strong></span>: <input type="text" name="box1" size="10" maxlength="20" placeholder="Avg 50-150" />
<br/><br/>
30-35 sessions a week is traditionally fulltime. Some clinicians work more, some work less.
<br/>
<span style="color: #339966;"><strong>Sessions Per Week:</strong></span><input type="text" name="box2" size="10" maxlength="20" placeholder="Avg. 30-35"/>
<br/>
<br/>
Recommended: 48 weeks per year. That allows for 4 weeks off per year.
<br/>
<span style="color: #339966;"><strong>Weeks Per Year</strong>:</span> <input type="text" name="box3" size="10" maxlength="20" placeholder="Avg. 48-50" />
<br/>
<br/>
<strong><span style="color: #339966;">Your Total Gross Revenue:</span> </strong>
<input onclick="runGross(this.form)" type="button" value="Calculate My Gross Revenue" />
<input type="text" name="total" size="10" maxlength="20" />
</form>
<h2><span style="color: #ff0000;">Subtracting the Expenses</span></h2>
Remember to include heat, electric, water, and Internet (if applicable).
<form><span style="color: #ff0000;"><strong>Rent & Utilities (per year):</strong></span> <input type="text" name="box4" size="10" maxlength="20" />
<br/>
<br/>
Some providers in private practice spend around 7% of revenue. Others spend 0%.
<br/>
<span style="color: #ff0000;"><strong>Marketing:</strong></span><input type="text" name="box5" size="10" maxlength="20" />
<br/>
<br/>
Will you hire a billing company (calculate 5% of revenue)? Accept credit cards (calculate 2% of revenue)?
<br/>
<span style="color: #ff0000;"><strong>Medical Billing</strong>:</span> <input type="text" name="box6" size="10" maxlength="20" />
<br/>
<br/>
These can be under $300 a year if you’re frugal, or thousands if you plan to attend conferences.
<br/>
<span style="color: #ff0000;"><strong>CEUs and Association Fees:</strong></span> <input type="text" name="box7" size="10" maxlength="20" />
<br/>
<br/>
Professional Liability insurance is approx $150-$350 a year.
<br/>
<span style="color: #ff0000;"><strong>Insurance:</strong></span> <input type="text" name="box8" size="10" maxlength="20" />
<br/>
<br/>
For a solo-practice, can be around $2500 a year.
<br/>
<span style="color: #ff0000;"><strong>Office Expenses:</strong></span> <input type="text" name="box9" size="10" maxlength="20" />
<br/>
<br/>
Approx $500 a year for Legal Expenses.
<br/>
<span style="color: #ff0000;"><strong>Accounting and Legal:</strong></span> <input type="text" name="box10" size="10" maxlength="20" />
<br/>
<br/>
Estimate another $1500 for the unexpected!
<br/>
<span style="color: #ff0000;"><strong>Misc. Expenses:</strong></span> <input type="text" name="box11" size="11" maxlength="20" />
<br/>
<br/>
<strong><span style="color: #339966;">Your Total Pre-Tax (Pre-Tax):</span> </strong>
<strong></strong><input onclick="runTotal(this.form)" type="button" value="Calculate My Total" />
<input type="text" name="total" size="20" maxlength="20" />
</form>
答案 0 :(得分:0)
我认为如果你的函数返回值会有效,如下所示:
var runGross = function (grossForm)
{
//contents here
return grossForm.total.value;
}
和
var runTotal = function (totalForm)
{
//contents here
return totalForm.total.value;
}
然后如果你想要另一个函数找到差异:
var findProfit = function (runGross, runTotal)
{
return runGross - runTotal;
}