Added missing field for bank charges in bank_trans, rewritten bank transaction views...
[fa-stable.git] / sales / includes / db / cust_trans_db.inc
index 453a3b3f2f1748d5583734bc0269d2c921adbc7c..cb1b4b646afde08b15115aebf74f7335ef1c5cc2 100644 (file)
@@ -135,7 +135,7 @@ function get_customer_trans($trans_id, $trans_type, $customer_id=null)
                $sql .= ",bank_act,".TB_PREF."bank_accounts.bank_name, ".TB_PREF."bank_accounts.bank_account_name,
                        ".TB_PREF."bank_accounts.account_type AS BankTransType,
                        ".TB_PREF."bank_accounts.bank_curr_code,
-                       ".TB_PREF."bank_trans.amount as bank_amount";
+                       bt.amount as bank_amount, bt.charge bank_charge";
        }
 
        if ($trans_type == ST_SALESINVOICE || $trans_type == ST_CUSTCREDIT || $trans_type == ST_CUSTDELIVERY) {
@@ -160,7 +160,7 @@ function get_customer_trans($trans_id, $trans_type, $customer_id=null)
 
        if ($trans_type == ST_CUSTPAYMENT || $trans_type == ST_BANKDEPOSIT) {
                // it's a payment so also get the bank account
-               $sql .= ", ".TB_PREF."bank_trans, ".TB_PREF."bank_accounts";
+               $sql .= ", ".TB_PREF."bank_trans bt, ".TB_PREF."bank_accounts";
        }
 
        if ($trans_type == ST_SALESINVOICE || $trans_type == ST_CUSTCREDIT || $trans_type == ST_CUSTDELIVERY) {
@@ -182,10 +182,10 @@ function get_customer_trans($trans_id, $trans_type, $customer_id=null)
 
        if ($trans_type == ST_CUSTPAYMENT || $trans_type == ST_BANKDEPOSIT) {
                // it's a payment so also get the bank account
-               $sql .= " AND ".TB_PREF."bank_trans.trans_no =".db_escape($trans_id)."
-                       AND ".TB_PREF."bank_trans.type=$trans_type
-                       AND ".TB_PREF."bank_trans.amount != 0
-                       AND ".TB_PREF."bank_accounts.id=".TB_PREF."bank_trans.bank_act ";
+               $sql .= " AND bt.trans_no =".db_escape($trans_id)."
+                       AND bt.type=$trans_type
+                       AND bt.amount != 0
+                       AND ".TB_PREF."bank_accounts.id=bt.bank_act ";
        }
        if ($trans_type == ST_SALESINVOICE || $trans_type == ST_CUSTCREDIT || $trans_type == ST_CUSTDELIVERY) {
                // it's an invoice so also get the shipper