$sql = "UPDATE ".TB_PREF."supp_trans SET alloc=alloc - " . $row['amt'] . "
WHERE (type= " . $row['trans_type_from'] . " AND trans_no=" . $row['trans_no_from'] . ")
OR (type=" . $row['trans_type_to'] . " AND trans_no=" . $row['trans_no_to'] . ")";
- //$sql = "UPDATE ".TB_PREF."supp_trans SET alloc=alloc - " . $row['amt'] . "
- // WHERE type=" . $row['trans_type_to'] . " AND trans_no=" . $row['trans_no_to'];
db_query($sql, "could not clear allocation");
+
// 2008-09-20 Joe Hunt
if ($date != "")
exchange_variation($type, $type_no, $row['trans_type_to'], $row['trans_no_to'], $date,
$row['amt'], PT_SUPPLIER, true);
+ // 2014-01-16 Joe Hunt. Fix for voiding allocated currency supp_invoices.
+ elseif ($type == ST_SUPPINVOICE && $row['trans_type_to'] == $type && $row['trans_no_to'] == $type_no)
+ exchange_variation($row['trans_type_from'], $row['trans_no_from'], $row['trans_type_to'], $row['trans_no_to'],
+ sql2date($row['date_alloc']), $row['amt'], PT_SUPPLIER, true);
//////////////////////
}
if ($date != "")
exchange_variation($type, $type_no, $row['trans_type_to'], $row['trans_no_to'], $date,
$row['amt'], PT_CUSTOMER, true);
+ // 2014-01-16 Joe Hunt. Fix for voiding allocated currency sales_invoices.
+ elseif ($type == ST_SALESINVOICE && $row['trans_type_to'] == $type && $row['trans_no_to'] == $type_no)
+ exchange_variation($row['trans_type_from'], $row['trans_no_from'], $row['trans_type_to'], $row['trans_no_to'],
+ sql2date($row['date_alloc']), $row['amt'], PT_SUPPLIER, true);
//////////////////////
}