Skip to content

Commit

Permalink
Modified assign of taxRates variable into one line code into Contribu…
Browse files Browse the repository at this point in the history
…tion.php and removed calculateTaxAmount jquery function into Contribution.tpl
  • Loading branch information
pratikshad committed Jul 1, 2014
1 parent 6daab7f commit a1e457f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
4 changes: 1 addition & 3 deletions CRM/Contribute/Form/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -502,9 +502,7 @@ public function buildQuickForm() {
}
$allPanes = array();
//tax rate from financialType
$taxRates = CRM_Core_PseudoConstant::getTaxRates();
$taxRates = json_encode($taxRates);
$this->assign('taxRates', $taxRates);
$this->assign('taxRates', json_encode(CRM_Core_PseudoConstant::getTaxRates()));

// build price set form.
$buildPriceSet = FALSE;
Expand Down
19 changes: 6 additions & 13 deletions templates/CRM/Contribute/Form/Contribution.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -634,23 +634,16 @@ if(event.handled !== true) {
var taxRates = JSON.parse(taxRates);
var taxRate = taxRates[financialType];
var totalAmount = cj('#total_amount').val();
var taxAmount = calculateTaxAmount(totalAmount,taxRate);
var totalTaxAmount = Number(taxAmount)+Number(totalAmount);
if (taxRate) {
var totalTaxAmount = Number((taxRate/100)*totalAmount)+Number(totalAmount);
}
else {
totalTaxAmount = totalAmount ;
}
cj( "#totalTaxAmount" ).html('Total Amount : '+totalTaxAmount);
event.handled = true;
}
return false;
});
function calculateTaxAmount(totalAmount,taxRate) {
var taxAmount = (taxRate/100)*totalAmount;
if(!taxAmount){
cj('#totalTaxAmount').html('Total Amount : '+totalAmount);
return false;
}
else{
return taxAmount;
}
}
</script>
{/literal}

0 comments on commit a1e457f

Please sign in to comment.