From 5a3de455601fec5edcff374a15281e634344a37e Mon Sep 17 00:00:00 2001 From: Karl Cordes Date: Sun, 31 Jan 2010 13:23:34 -0700 Subject: [PATCH] Seriously, fuck prototype. Trying jQuery --- views/costings/add.ctp | 3 +++ webroot/js/add_costing.js | 55 ++++++--------------------------------- 2 files changed, 11 insertions(+), 47 deletions(-) diff --git a/views/costings/add.ctp b/views/costings/add.ctp index a8b6eeea..0032c201 100755 --- a/views/costings/add.ctp +++ b/views/costings/add.ctp @@ -41,3 +41,6 @@
  • link(__('New Purchase Currency', true), array('controller' => 'currencies', 'action' => 'add')); ?>
  • + + +
    RAH
    \ No newline at end of file diff --git a/webroot/js/add_costing.js b/webroot/js/add_costing.js index 8dff1c38..be52c548 100644 --- a/webroot/js/add_costing.js +++ b/webroot/js/add_costing.js @@ -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()); \ No newline at end of file