javascript - Discount calculation based on type of buyer -
i'm learning javascript , working on javascript function calculate discount based on type of buyer i.e retailer/wholesaler & if it's cash or check payment. here function
<script> function sell() { var gross,net,tax,discount,unitprice,quatity,select2,select3; unitprice=parseint(form9.unitprice.value); quantity=parseint(form9.quantity.value); select3=parseint(form9.select3.value); select2=parseint(form9.select2.value); gross=parseint(form9.gross.value); gross=unitprice*quantity form9.gross.value=gross; tax=0.16*gross form9.tax.value=tax; if(select2='cash' && select3='retailer') discount=0.07*gross; else if(select2='cash' && select3='wholesaler') discount=0.1*gross; else if(select2='check') discount=0*gross; form9.discount.value=discount; net=(gross-(discount+tax)); form9.net.value=net; } </script>
i created dropdown menu type of buyer, named select2
<select name="select2"> <?php { ?> <option value="<?php echo $row_rscustomercategory['type']?>"><?php echo $row_rscustomercategory['type']?></option> <?php } while ($row_rscustomercategory = mysql_fetch_assoc($rscustomercategory)); $rows = mysql_num_rows($rscustomercategory); if($rows > 0) { mysql_data_seek($rscustomercategory, 0); $row_rscustomercategory = mysql_fetch_assoc($rscustomercategory); } ?> </select>
the select menu type of sale select3
<select name="select3" id="select3"> <?php { ?> <option value="<?php echo $row_rssaletype['type']?>"><?php echo $row_rssaletype['type']?></option> <?php } while ($row_rssaletype = mysql_fetch_assoc($rssaletype)); $rows = mysql_num_rows($rssaletype); if($rows > 0) { mysql_data_seek($rssaletype, 0); $row_rssaletype = mysql_fetch_assoc($rssaletype); } ?> </select>
cash sales discount @ 7% retailer , 10% wholesaler, no discount payment check.
the problem that: upon viewing in browser , clicking on "calculate" button nothing happens. why this? appreciate whatsoever.
Comments
Post a Comment