VAT fixes

This commit is contained in:
Albert Santoni 2014-06-26 17:44:53 -04:00
parent 18c828defd
commit d785d92953
2 changed files with 8 additions and 6 deletions

View File

@ -40,7 +40,11 @@ class BillingController extends Zend_Controller_Action {
if ($form->isValid($formData)) { if ($form->isValid($formData)) {
$credentials = self::getAPICredentials(); $credentials = self::getAPICredentials();
$apply_vat = BillingController::checkIfVatShouldBeApplied($formData["customfields"]["7"], $formData["country"]); if (in_array("7", $formData["customfields"])) {
$apply_vat = BillingController::checkIfVatShouldBeApplied($formData["customfields"]["7"], $formData["country"]);
} else {
$apply_vat = false;
}
$postfields = array(); $postfields = array();
$postfields["username"] = $credentials["username"]; $postfields["username"] = $credentials["username"];
@ -251,7 +255,7 @@ class BillingController extends Zend_Controller_Action {
$postfields["action"] = "updateinvoice"; $postfields["action"] = "updateinvoice";
$postfields["invoiceid"] = $invoice_id; $postfields["invoiceid"] = $invoice_id;
$postfields["tax"] = "$vat_amount"; $postfields["tax"] = "$vat_amount";
$postfields["taxrate"] = "$vat_rate"; $postfields["taxrate"] = strval(VAT_RATE);
$postfields["total"] = "$invoice_total"; $postfields["total"] = "$invoice_total";
$postfields["responsetype"] = "json"; $postfields["responsetype"] = "json";

View File

@ -149,10 +149,8 @@ $(document).ready(function() {
return; return;
} }
vatFieldChangeTimer = setTimeout(function() { vatFieldChangeTimer = setTimeout(function() {
//TODO: validate VAT number validateVATNumber(); //Validate and recalculate the totals
validateVATNumber(); }, 1500); //Wait 1.5 seconds before validating the VAT number
recalculateTotals();
}, 2000);
}); });
$("#hobbyist_grid_price").text("$" + products[0].pricing["USD"]["monthly"] + " / month"); $("#hobbyist_grid_price").text("$" + products[0].pricing["USD"]["monthly"] + " / month");