{
global $SysPrefs, $path_to_root, $Refs;
- begin_transaction();
+ begin_transaction(__FUNCTION__, func_get_args());
hook_db_prewrite($order, $order->trans_type);
$order_no = get_next_trans_no($order->trans_type);
$del_date = date2sql($order->due_date);
function delete_sales_order($order_no, $trans_type)
{
- begin_transaction();
+ begin_transaction(__FUNCTION__, func_get_args());
hook_db_prevoid($trans_type, $order_no);
$sql = "DELETE FROM ".TB_PREF."sales_orders WHERE order_no=" . db_escape($order_no)
$version= current($order->trans_no);
$total = $order->get_trans_total();
- begin_transaction();
+ begin_transaction(__FUNCTION__, func_get_args());
hook_db_prewrite($order, $order->trans_type);
if ($order->trans_type == ST_SALESORDER)
stype.id AS sales_type_id,
stype.tax_included,
stype.factor,
- ship.shipper_name,
+ ship.description as shipping,
tax_group.name AS tax_group_name,
tax_group.id AS tax_group_id,
cust.tax_id,
LEFT JOIN (SELECT order_, sum(alloc) inv_allocs FROM ".TB_PREF."debtor_trans
WHERE type=".ST_SALESINVOICE." AND order_=".db_escape($order_no)." GROUP BY order_)
inv ON sorder.trans_type=".ST_SALESORDER." AND inv.order_=sorder.order_no
- LEFT JOIN ".TB_PREF."shippers ship ON ship.shipper_id = sorder.ship_via,"
+ LEFT JOIN ".TB_PREF."stock_master ship ON ship.stock_id = sorder.ship_via,"
.TB_PREF."debtors_master cust,"
.TB_PREF."sales_types stype, "
.TB_PREF."tax_groups tax_group, "
return $row[0];
}
+function get_sales_vat_category($trans_no, $type=ST_SALESINVOICE)
+{
+ $sql = "SELECT vat_category
+ FROM ".TB_PREF."debtor_trans_details line
+ LEFT JOIN ".TB_PREF."stock_master stock ON line.stock_id=stock.stock_id
+ WHERE debtor_trans_type=".db_escape($type)." AND debtor_trans_no=".db_escape($trans_no);
+ $result = db_query($sql, 'cannot check invoice category');
+ $line = db_fetch($result);
+ return $line['vat_category'];
+}
+