function get_supp_trans($trans_no, $trans_type=-1)
{
$sql = "SELECT ".TB_PREF."supp_trans.*, (".TB_PREF."supp_trans.ov_amount+".TB_PREF."supp_trans.ov_gst+".TB_PREF."supp_trans.ov_discount) AS Total,
function get_supp_trans($trans_no, $trans_type=-1)
{
$sql = "SELECT ".TB_PREF."supp_trans.*, (".TB_PREF."supp_trans.ov_amount+".TB_PREF."supp_trans.ov_gst+".TB_PREF."supp_trans.ov_discount) AS Total,
{
// it's a payment so also get the bank account
$sql .= ", ".TB_PREF."bank_accounts.bank_name, ".TB_PREF."bank_accounts.bank_account_name, ".TB_PREF."bank_accounts.bank_curr_code,
{
// it's a payment so also get the bank account
$sql .= ", ".TB_PREF."bank_accounts.bank_name, ".TB_PREF."bank_accounts.bank_account_name, ".TB_PREF."bank_accounts.bank_curr_code,
- ".TB_PREF."bank_accounts.account_type AS BankTransType, ".TB_PREF."bank_trans.amount AS BankAmount,
+ ".TB_PREF."bank_accounts.account_type AS BankTransType, ".TB_PREF."bank_trans.amount AS bank_amount,
".TB_PREF."bank_trans.ref ";
}
$sql .= " FROM ".TB_PREF."supp_trans, ".TB_PREF."suppliers ";
".TB_PREF."bank_trans.ref ";
}
$sql .= " FROM ".TB_PREF."supp_trans, ".TB_PREF."suppliers ";
{
// it's a payment so also get the bank account
$sql .= ", ".TB_PREF."bank_trans, ".TB_PREF."bank_accounts";
{
// it's a payment so also get the bank account
$sql .= ", ".TB_PREF."bank_trans, ".TB_PREF."bank_accounts";
{
// it's a payment so also get the bank account
$sql .= " AND ".TB_PREF."bank_trans.trans_no =".db_escape($trans_no)."
{
// it's a payment so also get the bank account
$sql .= " AND ".TB_PREF."bank_trans.trans_no =".db_escape($trans_no)."
- if ($_POST['supplier_id'] != ALL_TEXT) {
- $sql .= " AND trans.supplier_id = ".db_escape($_POST['supplier_id']);
- $sql2 .= " AND trans.supplier_id = ".db_escape($_POST['supplier_id']);
+ if ($supplier_id != ALL_TEXT) {
+ $sql .= " AND trans.supplier_id = ".db_escape($supplier_id);
+ $sql2 .= " AND trans.supplier_id = ".db_escape($supplier_id);
- elseif (!isset($_POST['filterType']) || $_POST['filterType'] == ALL_TEXT || $_POST['filterType'] == '6') {
- $sql = "SELECT * FROM (($sql) UNION ($sql2)) as tr";
+ elseif (!isset($filter) || $filter == ALL_TEXT || $filter == '6') {
+ $sql = "SELECT * FROM (($sql) UNION ($sql2)) as tr WHERE 1";