+
+ db_query($sql, "could not void supp transactions for type=$type and trans_no=$type_no");
+}
+
+//----------------------------------------------------------------------------------------
+function get_alloc_supp_sql($extra_fields=null, $extra_conditions=null, $extra_tables=null)
+{
+ $sql = "SELECT
+ trans.type,
+ trans.trans_no,
+ trans.reference,
+ trans.tran_date,
+ supplier.supp_name,
+ supplier.curr_code,
+ ov_amount+ov_gst+ov_discount AS Total,
+ trans.alloc,
+ trans.due_date,
+ trans.supplier_id,
+ supplier.address";
+/* $sql = "SELECT trans.*,
+ ov_amount+ov_gst+ov_discount AS Total,
+ supplier.supp_name, supplier.address,
+ supplier.curr_code ";
+*/
+ if ($extra_fields)
+ $sql .= ", $extra_fields ";
+
+ $sql .= " FROM ".TB_PREF."supp_trans as trans, ".TB_PREF."suppliers as supplier";
+ if ($extra_tables)
+ $sql .= " ,$extra_tables ";
+
+ $sql .= " WHERE trans.supplier_id=supplier.supplier_id";
+
+ if ($extra_conditions)
+ $sql .= " AND $extra_conditions ";
+
+ return $sql;