Seriously, fuck prototype. Trying jQuery

This commit is contained in:
Karl Cordes 2010-01-31 13:23:34 -07:00
parent deaea4a18e
commit 5a3de45560
2 changed files with 11 additions and 47 deletions

View file

@ -41,3 +41,6 @@
<li><?php echo $html->link(__('New Purchase Currency', true), array('controller' => 'currencies', 'action' => 'add')); ?> </li>
</ul>
</div>
<div id="protodebug">RAH</div>

View file

@ -3,57 +3,18 @@ function buildup() {
//Fetch all the relevent inputs from the form
//Form.Element.setValue($('CostingFobCountryOfExport'), 'FUCK');
quantity = +($F('CostingQuantity'));
$F('CostingFobCountryOfExport').setValue('FUCK YOU');
costprice = +($F('CostingUnitCostPrice'));
ourdiscount_percentage = +($F('CostingOurDiscountPercent'));
packing_each = +($F('CostingPacking'));
exchange_rate = +($F('CostingExchangeRate'));
shipping_cost = +($F('CostingShippingCost'));
duty = +($F('CostingDutyPercent'));
sellprice_each = +($F('sellprice_each'));
customs = +($F('CostingCustoms'));
misc_cost = +($F('CostingMiscCosts'));
finance = +($F('CostingFinancePercent'));
if(ourdiscount_percentage != 0) {
discount = ourdiscount_percentage / 100;
}
else {
discount = 0;
}
discountamount = discount * costprice;
net_foreign_price = costprice - discountamount;
total_foreign_price = net_foreign_price + packing_each;
$F('CostingFobCountryOfExport').value = total_foreign_price;
domestic_cost = total_foreign_price / exchange_rate;
//$('convert_to_aud').value = domestic_cost.toFixed(2);
dutyamount = (duty / 100) * domestic_cost;
total_landed_cost = domestic_cost + dutyamount + customs + misc_cost + shipping_cost;
financeamount = (finance / 100) * domestic_cost;
financeamount = financeamount.toFixed(2);
//$('financeamount').update('Finance amount: ' + financeamount);
total_landed_cost += (+financeamount);
total_landed_cost = total_landed_cost.toFixed(2);
//$('total_landed_cost').value = total_landed_cost;
gross_profit_dollars = sellprice_each - total_landed_cost;
//$('gross_profit_dollars').value = gross_profit_dollars;
//$('gross_profit_percent').value = ((gross_profit_dollars / sellprice_each)*100).toFixed(2);
//Form.Element.setValue('CostingFobCountryOfExport', 'FUCK YOU JS');
alert('fuck this');
return;
}
//new Form.Observer('CostingAddForm', 0.5, buildup());
new Form.Element.EventObserver('CostingPacking', 0.5, buildup());
new Form.Observer('CostingAddForm', 0.5, buildup());
//new Form.Element.EventObserver('CostingPacking', buildup());