<?
include '../scat.php';
include '../lib/txn.php';

$txn_id= (int)$_REQUEST['txn'];
if (!$txn_id)
  die_jsonp("no transaction specified.");

$txn= txn_load($db, $txn_id);
if ($txn['paid']) {
  die_jsonp("This order is already paid!");
}

$tax_rate= (float)$_REQUEST['tax_rate'];
if (!strcmp($_REQUEST['tax_rate'], 'def')) {
  $tax_rate= DEFAULT_TAX_RATE;
}

$q= "UPDATE txn SET tax_rate = $tax_rate WHERE id = $txn_id";
$r= $db->query($q)
  or die_jsonp($db->error);

$txn= txn_load($db, $txn);

echo jsonp(array("success" => "Updated tax rate.", "txn" => $txn));

<?
include '../scat.php';
include '../lib/txn.php';

$txn_id= (int)$_REQUEST['txn'];
if (!$txn_id)
  die_jsonp("no transaction specified.");

$txn= txn_load($db, $txn_id);
if ($txn['paid']) {
  die_jsonp("This order is already paid!");
}

$tax_rate= (float)$_REQUEST['tax_rate'];
if (!strcmp($_REQUEST['tax_rate'], 'def')) {
  $tax_rate= DEFAULT_TAX_RATE;
}

$q= "UPDATE txn SET tax_rate = $tax_rate WHERE id = $txn_id";
$r= $db->query($q)
  or die_jsonp($db->error);

$txn= txn_load($db, $txn_id);

echo jsonp(array("success" => "Updated tax rate.", "txn" => $txn));

Fix loading of update transaction after changing tax rate
Fix loading of update transaction after changing tax rate
