PDA

View Full Version : Need help a.s.a.p - desperate


jasontansley
11-12-2002, 09:31 PM
I need some help with a script i'm working on.
it's for a calculator with multiple calculations, subtotals and total.
the first three totals are to be times by 0.025 if the total is greater than 1050, other wise total is zero.
the final total is the first three totals added together, and then times by 0.025 if the total is greater than 1050.

my scripting probably isn't the best, i'm kinda new to this.
any help anyone could give me would be greatly appreciated.

jasontansley
11-12-2002, 09:33 PM
here is my source code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Zakat Calaculator</TITLE>
<META content="text/html; charset=windows-1252" http-equiv=Content-Type>
<STYLE>A:link {
TEXT-DECORATION: none
}
A:visited {
TEXT-DECORATION: none
}
A:hover {
TEXT-DECORATION: underline
}
</STYLE>

<SCRIPT>

<!--
// -------------------------------------------------------------------
// for Muslim Aid Australia
//
// by jasontansley@yahoo.com.au http://www.freewebz.com/jasontansley/
// -------------------------------------------------------------------



// Function to Format
function fmtPrice(value)
{
result="$"+Math.floor(value)+".";
var cents=100*(value-Math.floor(value))+0.5;
result += Math.floor(cents/10);
result += Math.floor(cents%10);
return result;
}


// Function computit to calculate zakat
function computeIt(form)
{

// var units = form.unit.options[myindex1].value;
// var cost = form.cost.options[myindex2].value;
// var tax = form.tax.options[myindex3].value;

// Computations

var Zakatgold = document.forms[0].Zakatgold.value;
var Zakattrade = document.forms[0].Zakattrade.value;
var Zakatcash = document.forms[0].Zakatcash.value;


var total = eval( Zakatgold ) + eval( Zakattrade ) + eval( Zakatcash);

// Display formatted values.

document.forms[0].Total.value = fmtPrice(total);
if (total >= 1051)
document.forms[0].Zakat.value = fmtPrice(eval(total) * 0.025);
else
document.forms[0].Zakat.value = fmtPrice(0);
}


// -->
</SCRIPT>
<SCRIPT>

<!--
// -------------------------------------------------------------------
// for Muslim Aid Australia
//
// by jasontansley@yahoo.com.au http://www.freewebz.com/jasontansley/
// -------------------------------------------------------------------



// Function to Format
function fmtPrice(value)
{
result="$"+Math.floor(value)+".";
var cents=100*(value-Math.floor(value))+0.5;
result += Math.floor(cents/10);
result += Math.floor(cents%10);
return result;
}


// Function computit to calculate zakatgold
function computeIt(form)
{

// var units = form.unit.options[myindex1].value;
// var cost = form.cost.options[myindex2].value;
// var tax = form.tax.options[myindex3].value;

// Computations

var A = document.forms[0].A.value;
var B = document.forms[0].B.value;
var C = document.forms[0].C.value;
var D = document.forms[0].D.value;
var E = document.forms[0].E.value;
var F = document.forms[0].F.value;


var total = eval( A ) + eval( B ) + eval( C) + eval( D ) + eval( E ) + eval( F );

// Display formatted values.

document.forms[0].Total.value = fmtPrice(total1);
if (total >= 1051)
document.forms[0].Zakatgold.value = fmtPrice(eval(total1) * 0.025);
else
document.forms[0].Zakatgold.value = fmtPrice(0);
}


// -->
</SCRIPT>
<SCRIPT>

<!--
// -------------------------------------------------------------------
// for Muslim Aid Australia
//
// by jasontansley@yahoo.com.au http://www.freewebz.com/jasontansley/
// -------------------------------------------------------------------



// Function to Format
function fmtPrice(value)
{
result="$"+Math.floor(value)+".";
var cents=100*(value-Math.floor(value))+0.5;
result += Math.floor(cents/10);
result += Math.floor(cents%10);
return result;
}


// Function computit to calculate zakatrtade
function computeIt(form)
{

// var units = form.unit.options[myindex1].value;
// var cost = form.cost.options[myindex2].value;
// var tax = form.tax.options[myindex3].value;

// Computations

var A2 = document.forms[0].A2.value;
var B2 = document.forms[0].B2.value;
var C2 = document.forms[0].C2.value;
var D2 = document.forms[0].D2.value;


var total = eval( A2 ) + eval( B2 ) + eval( C2) + eval(D2);

// Display formatted values.

document.forms[0].Total.value = fmtPrice(total2);
if (total >= 1051)
document.forms[0].Zakattrade.value = fmtPrice(eval(total2) * 0.025);
else
document.forms[0].Zakattrade.value = fmtPrice(0);
}


// -->
</SCRIPT>
<SCRIPT>

<!--
// -------------------------------------------------------------------
// for Muslim Aid Australia
//
// by jasontansley@yahoo.com.au http://www.freewebz.com/jasontansley/
// -------------------------------------------------------------------



// Function to Format
function fmtPrice(value)
{
result="$"+Math.floor(value)+".";
var cents=100*(value-Math.floor(value))+0.5;
result += Math.floor(cents/10);
result += Math.floor(cents%10);
return result;
}


// Function computit to calculate zakatcash
function computeIt(form)
{

// var units = form.unit.options[myindex1].value;
// var cost = form.cost.options[myindex2].value;
// var tax = form.tax.options[myindex3].value;

// Computations

var A3 = document.forms[0].A3.value;
var B3 = document.forms[0].B3.value;
var C3 = document.forms[0].C3.value;
var D3 = document.forms[0].D3.value;
var E3 = document.forms[0].E3.value;
var F3 = document.forms[0].F3.value;
var G3 = document.forms[0].G3.value;
var H3 = document.forms[0].H3.value;
var I3 = document.forms[0].I3.value;
var J3 = document.forms[0].J3.value;


var total = eval( A3) + eval( B3 ) + eval( C3) + eval( D3) + eval( E3 ) + eval( F3) + eval( G3) + eval( H3 ) + eval( I3) + eval(J3);

// Display formatted values.

document.forms[0].Total.value = fmtPrice(total3);
if (total >= 1051)
document.forms[0].Zakatcash.value = fmtPrice(eval(total3) * 0.025);
else
document.forms[0].Zakatcash.value = fmtPrice(0);
}


// -->
</SCRIPT>



<META content="MSHTML 5.00.2614.3500" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff leftMargin=0 text=#00000 topMargin=0 marginwidth="0"
marginheight="0">

jasontansley
11-12-2002, 09:34 PM
<FORM id=form1 name=form1>
<BLOCKQUOTE>
<DIV align=center>
<table border=0 width=519>
<tr>
<td><img src="zakat.JPG" width="515" height="47"></td>
</tr>
</table>
<table border=0 cellpadding=7 width=518>
<tbody>
<tr>
<td colspan=2 height=28><b>Gold</b></td>
</tr>
<tr>
<td bgcolor=#eeeeee height=15 width=236><font
face="Arial, Helvetica, sans-serif" size=2>Gold in hand </font></td>
<td height=15 width=248>
<div align=left>$
<input name=A value=0>
</div>
</td>
</tr>
<tr>
<td bgcolor=#eeeeee height=34 width=236><font
face="Arial, Helvetica, sans-serif" size=2>Gold amount </font></td>
<td height=34 width=248>
<div align=left>$
<input name=B value=0>
</div>
</td>
</tr>
<tr>
<td bgcolor=#eeeeee height=3 width=236><font
face="Arial, Helvetica, sans-serif" size=2>Gold cerificates</font></td>
<td height=3 width=248>$
<input name=C tabindex=2 value=0>
</td>
</tr>
<tr>
<td bgcolor=#eeeeee height=11 width=236><font
face="Arial, Helvetica, sans-serif" size=2>Men's gold jewelry</font><font size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>
<td height=11 width=248>$
<input name=D tabindex=2 value=0>
</td>
</tr>
<tr>
<td bgcolor=#eeeeee height=11 width=236><font
face="Arial, Helvetica, sans-serif" size=2>Woman's gold jewelry</font><font face="Arial, Helvetica, sans-serif" size=2>
</font><font size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>
<td height=11 width=248>$
<input name=E tabindex=2 value=0>
</td>
</tr>
<tr>
<td bgcolor=#eeeeee height=30 width=236><font
face="Arial, Helvetica, sans-serif" size=2>Gold utensils and tools</font></td>
<td height=30 width=248>$
<input name=F tabindex=2 value=0>
</td>
</tr>
<tr>
<td bgcolor=#eeeeee height=35 width=236><font
face="Arial, Helvetica, sans-serif" size=-2>If total is more than 1050
AUD then pay Zakat</font></td>
</tr>
<TR>
<TD height=36 width=239>
<P align=right>&nbsp;</P></TD>
<TD height=36 width=249><FONT color=#ffffff>$</FONT> <INPUT id=reset1 name=reset12 type=reset value=" Reset "> <INPUT id=button1 name=button1 onclick=computeIt() type=button value=CALCULATE>
</TD></TR>
<TR>
<TD bgColor=#eeeeee height=28 width=239><FONT
face="Arial, Helvetica, sans-serif" size=2><B>Total Gold</B></FONT></TD>
<TD height=28 width=249>$ <INPUT name=Total1 tabIndex=2> </TD></TR>
<TR>
<TD bgColor=#eeeeee width=239><FONT face="Arial, Helvetica, sans-serif"
size=2><B>Total Zakat on Gold = Total x 0.025 =</B></FONT></TD>
<TD width=249>$ <INPUT name=Zakatgold size=16
style="BACKGROUND-COLOR: rgb(255,255,255); COLOR: rgb(0,0,0); FONT-SIZE: 16pt"
tabIndex=2> </TD></TR>
</tbody>
</table>
<TABLE border=0 cellPadding=7 width=518>
<TBODY>
<TR></TR>
<TR>
<TD colSpan=2 height=28><B>Trade</B></TD>
</TR>
<TR>
<TD bgColor=#eeeeee height=15 width=239><FONT
face="Arial, Helvetica, sans-serif" size=2>Trade items </FONT></TD>
<TD height=15 width=249>
<DIV align=left>$
<INPUT name=A2 value=0>
</DIV>
</TD>
</TR>
<TR>
<TD bgColor=#eeeeee height=34 width=239><FONT
face="Arial, Helvetica, sans-serif" size=2>Business bank account</FONT></TD>
<TD height=34 width=249>
<DIV align=left>$
<INPUT name=B2 value=0>
</DIV>
</TD>
</TR>
<TR>
<TD bgColor=#eeeeee height=3 width=239><FONT
face="Arial, Helvetica, sans-serif" size=2>Stocks</FONT></TD>
<TD height=3 width=249>$
<INPUT name=C2 tabIndex=2 value=0>
</TD>
</TR>
<TR>
<TD bgColor=#eeeeee height=11 width=239><FONT
face="Arial, Helvetica, sans-serif" size=2>Inventory accounts receivable</FONT></TD>
<TD height=11 width=249>$
<INPUT name=D2 tabIndex=2 value=0>
</TD>
</TR>
<TR>
<TD bgColor=#eeeeee height=37 width=237><font
face="Arial, Helvetica, sans-serif" size=-2>If total is more than 1050
AUD then pay Zakat</font></TD>
</TR>
<TR>
<TD height=36 width=239>
<P align=right>&nbsp;</P></TD>
<TD height=36 width=249><FONT color=#ffffff>$</FONT> <INPUT id=reset1 name=reset12 type=reset value=" Reset "> <INPUT id=button2 name=button2 onclick=computeIt() type=button value=CALCULATE>
</TD></TR>
<TR>
<TD bgColor=#eeeeee height=28 width=239><FONT
face="Arial, Helvetica, sans-serif" size=2><B>Total Trade</B></FONT></TD>
<TD height=28 width=249>$ <INPUT name=Total2 tabIndex=2> </TD></TR>
<TR>
<TD bgColor=#eeeeee width=239><FONT face="Arial, Helvetica, sans-serif"
size=2><B>Total Zakat on Trade = Total x 0.025 =</B></FONT></TD>

jasontansley
11-12-2002, 09:36 PM
<TD width=249>$ <INPUT name=Zakattrade size=16
style="BACKGROUND-COLOR: rgb(255,255,255); COLOR: rgb(0,0,0); FONT-SIZE: 16pt"
tabIndex=2> </TD></TR>
<TR>

<TD colSpan=2 height=28><B>Cash</B></TD>
</TR>
<TR>

<TD bgColor=#eeeeee height=15 width=239><FONT
face="Arial, Helvetica, sans-serif" size=2>Cheque account</FONT></TD>
<TD height=15 width=249>
<DIV align=left>$ <INPUT name=A3 value=0> </DIV></TD></TR>
<TR>

<TD bgColor=#eeeeee height=34 width=239><FONT
face="Arial, Helvetica, sans-serif" size=2>Savings account</FONT></TD>
<TD height=34 width=249>
<DIV align=left>$ <INPUT name=B3 value=0> </DIV></TD></TR>
<TR>

<TD bgColor=#eeeeee height=3 width=239><FONT
face="Arial, Helvetica, sans-serif" size=2>Cash in hand</FONT></TD>
<TD height=3 width=249>$ <INPUT name=C3 tabIndex=2 value=0> </TD></TR>
<TR>

<TD bgColor=#eeeeee height=11 width=239><FONT
face="Arial, Helvetica, sans-serif" size=2>Regular income</FONT></TD>
<TD height=11 width=249>$ <INPUT name=D3 tabIndex=2 value=0> </TD></TR>
<TR>

<TD bgColor=#eeeeee height=15 width=239><FONT
face="Arial, Helvetica, sans-serif" size=2>Non-delinquent loans</FONT></TD>
<TD height=15 width=249>
<DIV align=left>$ <INPUT name=E3 value=0> </DIV></TD></TR>
<TR>

<TD bgColor=#eeeeee height=34 width=239><FONT
face="Arial, Helvetica, sans-serif" size=2>Refundable deposits</FONT></TD>
<TD height=34 width=249>
<DIV align=left>$ <INPUT name=F3 value=0> </DIV></TD></TR>
<TR>

<TD bgColor=#eeeeee height=3 width=239><FONT
face="Arial, Helvetica, sans-serif" size=2>Tax return</FONT></TD>
<TD height=3 width=249>$ <INPUT name=G3 tabIndex=2 value=0> </TD></TR>
<TR>

<TD bgColor=#eeeeee height=11 width=239><FONT
face="Arial, Helvetica, sans-serif" size=2>Bonds</FONT></TD>
<TD height=11 width=249>$ <INPUT name=H3 tabIndex=2 value=0> </TD></TR>
<TR>

<TD bgColor=#eeeeee height=15 width=239><FONT
face="Arial, Helvetica, sans-serif" size=2>Pension Funds</FONT></TD>
<TD height=15 width=249>
<DIV align=left>$ <INPUT name=I3 value=0> </DIV></TD></TR>
<TR>

<TD bgColor=#eeeeee height=34 width=239><FONT
face="Arial, Helvetica, sans-serif" size=2>Debts</FONT></TD>
<TD height=34 width=249>
<DIV align=left>$ <INPUT name=J3 value=0> </DIV></TD></TR>

<TR>
<TD bgColor=#eeeeee height=16 width=239><FONT
face="Arial, Helvetica, sans-serif" size=-2>If total is more than 1050
AUD then pay Zakat</FONT></TD></TR>
<TR>
<TD height=36 width=239>
<P align=right>&nbsp;</P></TD>
<TD height=36 width=249><FONT color=#ffffff>$</FONT> <INPUT id=reset1 name=reset12 type=reset value=" Reset "> <INPUT id=button3 name=button3 onclick=computeIt() type=button value=CALCULATE>
</TD></TR>
<TR>
<TD bgColor=#eeeeee height=28 width=239><FONT
face="Arial, Helvetica, sans-serif" size=2><B>Total Cash</B></FONT></TD>
<TD height=28 width=249>$ <INPUT name=Total3 tabIndex=2> </TD></TR>
<TR>
<TD bgColor=#eeeeee width=239><FONT face="Arial, Helvetica, sans-serif"
size=2><B>Total Zakat on Cash= Total x 0.025 =</B></FONT></TD>
<TD width=249>$ <INPUT name=Zakatcash size=16
style="BACKGROUND-COLOR: rgb(255,255,255); COLOR: rgb(0,0,0); FONT-SIZE: 16pt"
tabIndex=2> </TD></TR>
<TR>
<TD colspan=2 bgColor=#eeeeee height="17"><font face="Arial, Helvetica, sans-serif" size="1"><b>Calculation
for silver is similar to gold using 21 oz of pure silver as the Nisab.</b></font></TD>
</TR>
<TR>
<TD height=36 width=239>
<P align=right>&nbsp;</P></TD>
<TD height=36 width=249><FONT color=#ffffff>$</FONT> <INPUT id=reset1 name=reset12 type=reset value=" Reset "> <INPUT id=button4 name=button4 onclick=computeIt() type=button value=CALCULATE>
</TD></TR>
<TR>
<TD bgColor=#eeeeee height=28 width=239><FONT
face="Arial, Helvetica, sans-serif" size=2><B>Total </B></FONT></TD>
<TD height=28 width=249>$ <INPUT name=Total tabIndex=2> </TD></TR>
<TR>
<TD bgColor=#eeeeee width=239><FONT face="Arial, Helvetica, sans-serif"
size=2><B>Total Zakat = Total x 0.025 =</B></FONT></TD>
<TD width=249>$ <INPUT name=Zakat size=16
style="BACKGROUND-COLOR: rgb(255,255,255); COLOR: rgb(0,0,0); FONT-SIZE: 16pt"
tabIndex=2> </TD></TR>
</TBODY>
</TABLE>
</DIV></BLOCKQUOTE></FORM>
<FORM id=form1 name=form1>
<BLOCKQUOTE>
<DIV align=center><BR>
<table width="79%" border="0" cellpadding="7" align="center">
<tr>
<td height="19" width="9%"><font size="3" face="Arial, Helvetica, sans-serif"><a href="#top">top</a>
</font>
<td height="19" width="15%"><font size="3" face="Arial, Helvetica, sans-serif"><a href="al_amana.htm">Al
Amana</a> </font>
<td height="19" width="37%"><font size="3" face="Arial, Helvetica, sans-serif"><a target="new" href="http://www.kitco.com">Gold
to Dollars Conversion</a> </font>
<td width="22%"><font size="3" face="Arial, Helvetica, sans-serif"><a href="donation_form.htm">Donation
Form</a> </font></td>
<td width="17%"><font size="3" face="Arial, Helvetica, sans-serif"><a href="http://www.muslim-aid.org.au/contact_maa.cfm">contact
us</a></font></td>
</tr>
</table>
</DIV>
<DIV align=center>
<P>&nbsp;</P>
<P>&nbsp;</P></DIV></BLOCKQUOTE></FORM></BODY></HTML>