JAVA - Autosumm Dillema

Discussion in 'Software' started by apexonelove, Jan 8, 2006.

  1. apexonelove

    apexonelove Private E-2

    :eek: :mad: :confused: Hi all!

    I'm currently trying to finish a site for a group who's doing a registration for an event. Basically, those who wish to be members get a $30 discount from only the "Conference Registration: $150"

    I've gotten the scripting to look find and dandy, except for if they decide to get single registrations, or if they wish to be members and, for example, get a $15 single ticket, then the result shows back with -15

    (also, a 3% surchage is going into effect, so when you see the * 1.03, that's that)


    Here's the code i'm working with so far....I WOULD TOTALLY APPRECIATE ANY HELP, I'M DESPARATE!!!!!!!!!!!!!!!!!!!!


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>PriceTest</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
    <!--
    .style2 {color: #666666;

    font-size: 11px;
    }
    .style2 {color: #006699;

    font-weight: bold;
    }
    .style15 {color: #006699}
    .hider {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    font-weight: bold;
    color: #333333;
    background-color: #FFFFFF;
    border: thin solid #FFFFFF;
    }
    -->
    </style>
    <link href="CSS/FOIstyle.css" rel="stylesheet" type="text/css">
    </head>

    <body>

    <SCRIPT language="javascript">
    function cent(amount) {
    return (amount == Math.floor(amount)) ? amount + '.00' : ( (amount*10 == Math.floor(amount*10)) ? amount + '0' : amount);
    }

    function calculate() {
    var p1, p3, p5, p6, p72, p7;
    p72 = test.price72.value * 1;
    p1 = (test.price1.value * 1.03);
    p3 = test.price3.value * 1;

    p5 = test.price5.value * 1;
    p6 = test.price6.value * 1;
    p7 = test.price7.value * 1;


    total_price = ((p1-p72) + p5 + p6+ p7);
    test.total_price.value = cent(Math.round(total_price*Math.pow(10,2))/Math.pow(10,2));
    }

    </SCRIPT>

    <form action="" method="post" name="test" class="tableTEXT">
    <p><strong>ICOG Membership</strong></p>
    <table width="488" border="0" cellspacing="0" cellpadding="10">
    <tr>
    <td width="255" valign="top"><input name="72" type="radio" value="30" onclick="this.form.price72.value='30.00';calculate();">
    YES<br />
    <input name="72" type="radio" value="0" onclick="this.form.price72.value='0';calculate();">
    NO<br />
    <input name="price72" type="hidden" id="price72"></td>
    <td width="193" valign="top">&nbsp;</td>
    </tr>
    </table>
    <p><strong> Registration</strong><br>
    </p>
    <table width="488" border="0" cellspacing="0" cellpadding="10">
    <tr>
    <td width="255" valign="top">Conference Registration:<span class="style2"> $150</span><br />
    <strong><em>(includes Friday lunch, Saturday breakfast, Saturday lunch, and the Saturday evening reception)</em></strong></td>
    <td width="193" valign="top"><input name="1" type="radio" onClick="this.form.price1.value='150.00';calculate();" value="150">
    YES<br>
    <input name="1" type="radio" onClick="this.form.price1.value='0.00';calculate();" value="0">
    NO<br>
    <input type="hidden" name="price1"></td>
    </tr>
    </table>
    <table width="488" border="0" cellspacing="0" cellpadding="10">
    <tr>
    <td colspan="2" valign="top"><strong>Single Ticket Options </strong><br>
    <strong><em>(The public is welcome to all single ticket events. Conference attendees will have access to the Friday lunch and Saturday evening reception at no additional charge.)</em></strong></td>
    </tr>
    <tr>
    <td width="255" valign="top"> Friday Lunch Event: <span class="style2"><span class="style15"> $50</span></span> <br>
    <em>Title and details</em></td>
    <td width="193" valign="top" class="tableTEXT"><input name="5" type="radio" value="50" onclick="this.form.price5.value='50.00';calculate();">
    YES<em></em><br />
    <input name="5" type="radio" value="0" onclick="this.form.price5.value='0';calculate();">
    NO <br />
    <input name="price5" type="hidden" id="price5"></td>
    </tr>
    <tr>
    <td valign="top">ICOG Fundraiser: <span class="style2">$75</span><br>
    <em>Title and details</em></td>
    <td valign="top"><input name="6" type="radio" value="75" onclick="this.form.price6.value='75.00';calculate();">
    YES<br />
    <input name="6" type="radio" value="0" onclick="this.form.price6.value='0';calculate();">
    NO<br />
    <input name="price6" type="hidden" id="price6"></td>
    </tr>
    <tr>
    <td valign="top">Saturday evening reception: <span class="style2">$15</span><br>
    <em>Details</em></td>
    <td valign="top"><input name="7" type="radio" value="15" onclick="this.form.price7.value='15.00';calculate();">
    YES<br />
    <input name="7" type="radio" value="0" onclick="this.form.price7.value='0';calculate();">
    NO<br />
    <input name="price7" type="hidden" id="price7"></td>
    </tr>
    </table>
    <table width="488" border="0" cellspacing="0" cellpadding="10">
    <tr>
    <td colspan="2" valign="top">&nbsp;</td>
    </tr>
    <tr>
    <td colspan="2" valign="top">&nbsp;</td>
    </tr>
    <tr>
    <td colspan="2" valign="top"><strong>Terms and Agreement</strong></td>
    </tr>
    <tr>
    <td width="20" valign="top"><input name="3" type="radio" value="1.03" onClick="this.form.price3.value='1.03';calculate();">
    <input type="hidden" name="price3"></td>
    <td width="428" valign="top"><u>You must click here to agree to the terms and conditions before checking out.</u> By completing registration, you are agreeing to pay the total amount which will be calculated below. That amount includes a 3 percent surcharge for credit card processing. </td>
    </tr>
    </table>
    <p><br>Total Price:
    <input name="total_price" type="textfield" class="hider">
    </p>
    <p>
    <input name="Submit" type="submit" class="Form" value="Complete Registration">
    </p>
    </form>

    </body>
    </html>
     
  2. Jodi

    Jodi Private First Class

    Hi there, I am creating the sme sort of form as well. Have a look if you wish, I fianlly have mine working (for the most part,) if you would like when viewing the form, just go to "View" and then to "Source" on the menu bar, to see the script.
    Here is my form
    My problem is that I cannot get the total to show as dollars AND cents.
    Well good luck to you!
     
  3. Jodi

    Jodi Private First Class

    Oh yea...feel free to play with the form I have up, its just a test form, it goes to my email.
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds