X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=gl%2Fincludes%2Fdb%2Fgl_db_trans.inc;h=60b173d6902b80e5d2e9cf47a4d63117ce0f717b;hb=21a54e6ceb2149d31ab7738af30f731f6fe10251;hp=fe547a8954957706cad7c195aac1e7b44101bf82;hpb=d266769382e3bed5a87101346b461b8e261205eb;p=fa-stable.git diff --git a/gl/includes/db/gl_db_trans.inc b/gl/includes/db/gl_db_trans.inc index fe547a89..60b173d6 100644 --- a/gl/includes/db/gl_db_trans.inc +++ b/gl/includes/db/gl_db_trans.inc @@ -18,10 +18,10 @@ function add_gl_trans($type, $trans_id, $date_, $account, $dimension, $dimension if ($rate == 0) $amount_in_home_currency = to_home_currency($amount, $currency, $date_); else - $amount_in_home_currency = round($amount * $rate, user_price_dec()); + $amount_in_home_currency = round2($amount * $rate, user_price_dec()); } else - $amount_in_home_currency = round($amount, user_price_dec()); + $amount_in_home_currency = round2($amount, user_price_dec()); if ($dimension == null || $dimension < 0) $dimension = 0; if ($dimension2 == null || $dimension2 < 0) @@ -72,6 +72,17 @@ function add_gl_trans_std_cost($type, $trans_id, $date_, $account, $dimension, $ return 0; } +// Function for even out rounding problems +function add_gl_balance($type, $trans_id, $date_, $amount, $person_type_id=null, $person_id=null) +{ + $amount = round2($amount, user_price_dec()); + if ($amount != 0) + return add_gl_trans($type, $trans_id, $date_, get_company_pref('exchange_diff_act'), 0, 0, "", + $amount, null, $person_type_id, $person_id, "The balanced GL transaction could not be inserted"); + else + return 0; +} + //-------------------------------------------------------------------------------- function get_gl_transactions($from_date, $to_date, $trans_no=0,