$date_ = Today();
$rate = get_exchange_rate_from_home_currency($currency, $date_);
$result = db_query("SELECT SUM(amount) FROM ".TB_PREF."bank_trans WHERE
- bank_act='$acc_id' AND trans_date<='".date2sql($date_)."'",
+ bank_act=".db_escape($acc_id)." AND trans_date<='".date2sql($date_)."'",
"Transactions for account $account could not be calculated");
$row = db_fetch_row($result);
$foreign_amount = $row[0];
function add_exchange_variation_all()
{
- $trans_no = get_next_trans_no(0);
+ $trans_no = get_next_trans_no(ST_JOURNAL);
$sql = "SELECT * FROM ".TB_PREF."bank_accounts";
$result = db_query($sql, "could not retreive bank accounts");
while ($myrow = db_fetch($result))
- add_exchange_variation(0, $trans_no, null, $myrow['id'], $myrow['account_code'],
+ add_exchange_variation(ST_JOURNAL, $trans_no, null, $myrow['id'], $myrow['account_code'],
$myrow['currency_code']);
}
//----------------------------------------------------------------------------------
{
$is_bank_to = is_bank_account($gl_item->code_id);
- if ($trans_type == 1 AND $is_bank_to)
+ if ($trans_type == ST_BANKPAYMENT AND $is_bank_to)
{
// we don't allow payments to go to a bank account. use transfer for this !
display_db_error("invalid payment entered. Cannot pay to another bank account", "");