X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=gl%2Fincludes%2Fdb%2Fgl_db_trans.inc;h=fc581e088be037aaca8abc86075471ad24dc7b95;hb=a4f5314521187b67feb7742ed1b6c51aa199a6b0;hp=7677fa3ec328042f5ed988f47db09d8acab7c552;hpb=87f5cfdf12ef6fc279e2eae9b85191d7ae3e4246;p=fa-stable.git diff --git a/gl/includes/db/gl_db_trans.inc b/gl/includes/db/gl_db_trans.inc index 7677fa3e..fc581e08 100644 --- a/gl/includes/db/gl_db_trans.inc +++ b/gl/includes/db/gl_db_trans.inc @@ -100,6 +100,8 @@ function get_gl_transactions($from_date, $to_date, $trans_no=0, $account=null, $dimension=0, $dimension2=0, $filter_type=null, $amount_min=null, $amount_max=null) { + global $show_voided_gl_trans; + $from = date2sql($from_date); $to = date2sql($to_date); @@ -113,6 +115,8 @@ function get_gl_transactions($from_date, $to_date, $trans_no=0, AND ISNULL(v.date_) AND tran_date >= '$from' AND tran_date <= '$to'"; + if (isset($show_voided_gl_trans) && $show_voided_gl_trans == 1) + $sql .= " AND ".TB_PREF."gl_trans.amount <> 0"; if ($trans_no > 0) $sql .= " AND ".TB_PREF."gl_trans.type_no LIKE ".db_escape('%'.$trans_no); @@ -335,7 +339,7 @@ function get_only_budget_trans_from_to($from_date, $to_date, $account, $dimensio //-------------------------------------------------------------------------------- // Stores journal/bank transaction tax details if applicable // -function add_gl_tax_details($gl_code, $trans_type, $trans_no, $amount, $ex_rate, $date, $memo, $included=0) +function add_gl_tax_details($gl_code, $trans_type, $trans_no, $amount, $ex_rate, $date, $memo, $included=0, $net_amount = null) { $tax_type = is_tax_account($gl_code); if(!$tax_type) return; // $gl_code is not tax account @@ -345,15 +349,16 @@ function add_gl_tax_details($gl_code, $trans_type, $trans_no, $amount, $ex_rate, if ($trans_type == ST_SALESINVOICE || $trans_type == ST_CUSTDELIVERY || $trans_type == ST_CUSTCREDIT) $amount = -$amount; // we have to restore net amount as we cannot know the base amount - if ($tax['rate'] == 0) { -// display_warning(_("You should not post gl transactions -// to tax account with zero tax rate.")); - $net_amount = 0; - } else { - // calculate net amount - $net_amount = $amount/$tax['rate']*100; + if ($net_amount===null) { + if ($tax['rate'] == 0) { +// display_warning(_("You should not post gl transactions +// to tax account with zero tax rate.")); + $net_amount = 0; + } else { + // calculate net amount + $net_amount = $amount/$tax['rate']*100; + } } - add_trans_tax_details($trans_type, $trans_no, $tax['id'], $tax['rate'], $included, $amount, $net_amount, $ex_rate, $date, $memo);