Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Sep 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    quote calculator needed

    if anyone could help me with this I'd be extremely grateful. I'm slowly teaching myself HTML and CSS but anything more complex and I struggle!

    I'm trying to incorporate an online "instant quote" calculator for a cleaning services website I am building for my father, but really struggling.

    Basically I am trying to achieve the following...

    •Step 1 - the customer selects from one of 6 surface types to be cleaned (either radio buttons or a drop-down list), with the first 3 options carrying a 10% premium.

    •Step 2 - the customer specifies the surface area in two boxes. The first box represents Length [] and the second box represents Width [] - This instantly generates a "total surface area" value in a box, which is simply Length multiplied by Width.

    •Step 3 - the customer specifies an option for water feed, simply selecting Yes or No

    •Step 4 - the customer specifies an option for after-care treatment, again simply selecting Yes or No

    Once the customer has inputted thier information in these 4 steps, the form should generate two values...... the first being a total, and the second being a total including VAT (which is basically the total, multiplied by 1.2)

    I hope that makes sense so far :-)

    Ok so in terms of the actual calculations required, they would be as follows....

    If the "total surface area" value is equal to or less than 9, then the "base" value will be £99

    If the "total surface area" value is greater than 9, then the base value will be £99 + an additional £60 for every extra 9 (or part thereof) that the "total surface area" is showing. I will give some examples...

    If the "total surface area" value is 0-9, then the "base" value is £99
    If the "total surface area" value is 10-18, then the "base" value is £99+£60
    If the "total surface area" value is 19-27, then the "base" value is £99+£60+£60
    If the "total surface area" value is 28-36, then the "base" value is £99+£60+£60+£60
    If the "total surface area" value is 37-45, then the "base" value is £99+£60+£60+£60+£60
    etc, etc.Hopefully you get what I mean :-)

    Ok so now we have a base value calculated baed on total surface area, I would need to also include the options selected in step 3 and step 4.

    If the customer selects "Yes" in step 3, then an additional 40% needs to be added to the base price.

    so as an example, if the "total surface area" value was 40, then the base value would be £339... and because the customer selected "Yes" from step 3, then an extra 40% is added (£135.60), which takes the price up to £474.60.

    The same calculation applies for step 4, with the only difference being that an additional 15% needs to be applied to the "base" price if "Yes" is selected in step 4.

    So in this instance, if the customer selected "Yes" for both step 3 AND step 4, the total price would be - base price(£339) + 40% of base price(£135.60) + 15% of base price(£50.85) = £525.45

    So in conclusion, it would show the value of £525.45 and then just below would also show the value including VAT(20%) which would be £630.54

    The only other thing to mention are the first three options in step 1 which carry a 10% premium. If the customer selects one of these three surface types, then the "base" values would be £108.90 + an additional £66 for every extra 9 (or part thereof) that the "total surface area" is showing.

    This is what I'm trying to do :-)

    As I say, if anyone could help with this, I'd be really grateful.

    thanks

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,037
    Thanks
    0
    Thanked 250 Times in 246 Posts
    Welcome to the CF forums. In order to get free help from the members here, you have to show what you have and not just ask for someone to do the whole thing for you.

    You have very detailed requirements and I think this may fit more on paid forums (if you are willing to pay):

    http://www.codingforums.com/web-projects/

  • #3
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,918
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    This forum is not a free coding service. As a general rule, the people helping out in this forum don't write code for others (especially code that appears to be for commercial use), but try to help with fixing code that doesn't work. You may perhaps get someone to write this script for you, but you'll be far more likely to get help if you have made a substantial effort and written some/most of the code yourself. Then someone here will almost certainly help you correct/improve your work.

    As glenngv says, your best plan is do what you would do if your car or a domestic appliance broke down or you had toothache - pay a professional who understands what they are doing to fix it. You can post in the Web Projects section of this forum.
    Last edited by Philip M; 09-20-2013 at 07:40 AM.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    Flint, Michigan, USA
    Posts
    620
    Thanks
    1
    Thanked 20 Times in 20 Posts
    I was bored, so here is a place to start. It has some problems and has only been tested in Opera. You get to work out the rest:
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
      <head>
    
        <title>Cleaning Services Quote Calculator</title>
    <!-- http://www.codingforums.com/showthread.php?t=302009 -->
    
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta http-equiv="Content-Script-Type" content="text/javascript" />
        <meta http-equiv="Content-Style-Type" content="text/css" />
        <meta http-equiv="Content-Language" content="en-US" />
        <meta name="Author" content="James Alarie - jalarie@umich.edu" />
        <meta name="description" content="Cleaning Services Quote Calculator." />
        <meta name="keywords" content="cleaning,services,quote,calculator" />
        
        <link rel="icon" href="favicon.ico" />
        <link rev="made" href="mailto:jalarie@umich.edu" />
        
    <!--
        Author:    James Alarie
        Company:   -independent-
        Address:   3391 N Genesee Rd
                   Flint  MI  48506
                   Latitude: 42.9663  Longitude: -83.7769
        Telephone: +1-810-736-8259
        Fax:       -none-
        Web Site:  http://spruce.flint.umich.edu/~jalarie/
        E-Mail:    jalarie@umich.edu
        Comments:  Having said that, I've probably told you more than I know.
    -->
    
        <style type="text/css">
          /*<![CDATA[*/
    
      body.body1 {
        background-image: url(backgrnd.jpg);
        background-color: #ffffee;
        color: black;                                   /* text */
        direction: ltr;                                 /* left-to-right */
      }
      #body {
        position: static;
      }
      #header {
        position: relative;
      }
      #content {
        position: relative;
      }
      #footer {
        position: relative;
        clear: both;
      }
      #header h1 {
        text-align: center;
      }
      .Column1 {
        display: inline-block;
        width: 200px;
      }
      .Column2 {
        display: inline-block;
        width: 300px;
      }
    
          /*]]>*/
        </style>
        
        <script type="text/javascript">
          /*<![CDATA[*/
    
      function CalcArea() {
        f1=document.forms[0];                           // abbrevation
        ILength=f1.Length.value;                        // get the Length
        IWidth=f1.Width.value;                          // ...Width
        OArea=ILength*IWidth;                           // figure the area
        f1.Area.value=OArea;                            // display the area
        return true;
      } // CalcArea
      
      function CalcTotal() {
        f1=document.forms[0];                           // abbrevation
        IxSurface=f1.Surface.selectedIndex;             // which Surface index
        ISurface=f1.Surface.options[IxSurface].value;   // ...value
        IArea=f1.Area.value;                            // get the Area
        IWaterFeed=f1.WaterFeed.checked;                // true or false
        IAfterCare=f1.AfterCare.checked;                // true or false
        
        if ((ISurface == 1)                             // Surface value is 1
        ||  (ISurface == 2)                             // ...or 2
        ||  (ISurface == 3)) {                          // ...or 3
          ISurfacePremium=0.10;                         // then 10% premium
        } else {
          ISurfacePremium=0;                            // ...0% premium
        }
        IBase=99+Math.floor((IArea-1)/8)*60;            // calculate the Base
        IBase=IBase*(1+ISurfacePremium);                // add the Premium
        if (IWaterFeed) { IBase*=1.40; }                // Water Feed -> add 40%
        if (IAfterCare) { IBase*=1.15; }                // After Care -> add 15%
    
        OTotal=IBase;                                   // show the Total
        OVat=OTotal*1.2;                                // ...and Total+VAT
        f1.Total.value=OTotal;
        f1.VAT.value=OVat;
        return true;
      } // CalcTotal
    
          /*]]>*/
        </script>
    
      </head>
    
      <body class="body1">
       <div id="body">
    <!-- Page Header -->
        <div id="header">
          <h1>Cleaning Services Quote Calculator</h1>
          <hr />
        </div>
    
    <!-- Content -->
        <div id="content">
          <br />
          <noscript>
            <p class="notice">
              You must have scripting enabled to make full use of this page.
            </p>
          </noscript>
          
          <form method="post" action="javascript:void(0);" onsubmit="CalcTotal();">
           <div class="form">
            <div class="Column1">
              <label for="Surface">Surface Type</label>
            </div>
            <div class="Column2">
              <select name="Surface" id="Surface">
                <option value="0">- pick surface -</option>
                <option value="1">Solid Rock</option>
                <option value="2">Porus Rock</option>
                <option value="3">Liquid Rock</option>
                <option value="4">Sand</option>
                <option value="5">Paper</option>
                <option value="6">Whatever</option>
              </select>
            </div>
            
            <br />
            <div class="Column1">
              <label for="Length">Length</label>
            </div>
            <div class="Column2">
              <input type="text" size="20" value="0" name="Length" id="Length" onblur="CalcArea();" onfocus="this.select();" />
            </div>
            
            <br />
            <div class="Column1">
              <label for="Width">Width</label>
            </div>
            <div class="Column2">
              <input type="text" size="20" value="0" name="Width" id="Width" onblur="CalcArea();" onfocus="this.select();" />
            </div>
            
            <br />
            <div class="Column1">
              <label for="Area">Area</label>
            </div>
            <div class="Column2">
              <input type="text" size="20" value="0" name="Area" id="Area" onfocus="this.select();" />
            </div>
            
            <br />
            <div class="Column1">
              <label for="WaterFeed">Water Feed</label>
            </div>
            <div class="Column2">
              <input type="checkbox" name="WaterFeed" id="WaterFeed" />
            </div>
            
            <br />
            <div class="Column1">
              <label for="AfterCare">After Care</label>
            </div>
            <div class="Column2">
              <input type="checkbox" name="AfterCare" id="AfterCare" />
            </div>
            
            <br />
            <input type="submit" value="Compute" title="Compute" />&nbsp;
            <input type="reset" value="Reset" title="Reset" />&nbsp; 
            
            <br />
            <div class="Column1">
              <label for="Total">Total</label>
            </div>
            <div class="Column2">
              <input type="text" size="20" value="0" name="Total" id="Total" onfocus="this.select();" />
            </div>
            
            <br />
            <div class="Column1">
              <label for="VAT">Total plus VAT</label>
            </div>
            <div class="Column2">
              <input type="text" size="20" value="0" name="VAT" id="VAT" onfocus="this.select();" />
            </div>
           </div><!-- form -->
          </form>
      
        </div>
      
    <!-- Page Footer -->
        <div id="footer">
          <br clear="all" /><hr />
          Written on September 23, 2013, by:&nbsp;
          <a href="mailto:jalarie@umich.edu">James Alarie</a>.
        </div>
    
       </div>
      </body>
    
    </html>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •