- $sql= "SELECT curr_default FROM ".TB_PREF."company";
- $result = db_query($sql, "retreive company currency");
-
- if (db_num_rows($result) == 0)
- display_db_error("Could not find the requested currency. Fatal.", $sql);
-
- $myrow = db_fetch_row($result);
- return $myrow[0];
+ return get_company_pref('curr_default');
function exchange_variation($pyt_type, $pyt_no, $type, $trans_no, $pyt_date, $amount, $person_type, $neg=false)
{
function exchange_variation($pyt_type, $pyt_no, $type, $trans_no, $pyt_date, $amount, $person_type, $neg=false)
{
{
$trans = get_customer_trans($trans_no, $type);
$pyt_trans = get_customer_trans($pyt_no, $pyt_type);
{
$trans = get_customer_trans($trans_no, $type);
$pyt_trans = get_customer_trans($pyt_no, $pyt_type);
$diff = -$diff;
if ($neg)
$diff = -$diff;
$exc_var_act = get_company_pref('exchange_diff_act');
if (date1_greater_date2($date, $pyt_date))
{
$diff = -$diff;
if ($neg)
$diff = -$diff;
$exc_var_act = get_company_pref('exchange_diff_act');
if (date1_greater_date2($date, $pyt_date))
{
add_gl_trans($type, $trans_no, $date, $ar_ap_act, 0, 0, $memo, -$diff, null, $person_type, $person_id);
add_gl_trans($type, $trans_no, $date, $exc_var_act, 0, 0, $memo, $diff, null, $person_type, $person_id);
}
else
{
add_gl_trans($type, $trans_no, $date, $ar_ap_act, 0, 0, $memo, -$diff, null, $person_type, $person_id);
add_gl_trans($type, $trans_no, $date, $exc_var_act, 0, 0, $memo, $diff, null, $person_type, $person_id);
}
else
{
add_gl_trans($pyt_type, $pyt_no, $pyt_date, $ar_ap_act, 0, 0, $memo, -$diff, null, $person_type, $person_id);
add_gl_trans($pyt_type, $pyt_no, $pyt_date, $exc_var_act, 0, 0, $memo, $diff, null, $person_type, $person_id);
}
add_gl_trans($pyt_type, $pyt_no, $pyt_date, $ar_ap_act, 0, 0, $memo, -$diff, null, $person_type, $person_id);
add_gl_trans($pyt_type, $pyt_no, $pyt_date, $exc_var_act, 0, 0, $memo, $diff, null, $person_type, $person_id);
}