From: Joe Hunt Date: Wed, 28 Oct 2009 11:11:41 +0000 (+0000) Subject: Changed report Annual Expense Breakdown to follow the fiscal year instead of X-Git-Tag: v2.4.2~19^2~1068 X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=8720456baebdf840339f5ef1537813c898808984;p=fa-stable.git Changed report Annual Expense Breakdown to follow the fiscal year instead of calendar year. The year selector selects the start of the fiscal year. Only the last 12 months are shown. --- diff --git a/CHANGELOG.txt b/CHANGELOG.txt index aa99151e..c49456dc 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -19,6 +19,12 @@ Legend: ! -> Note $ -> Affected files +28-Oct-2009 Joe Hunt +! Changed report Annual Expense Breakdown to follow the fiscal year instead of + calendar year. The year selector selects the start of the fiscal year. + Only the last 12 months are shown. +$ /reporting/rep705.php + 27-Oct-2009 Joe Hunt # Database error when updating item. $ /inventory/includes/db/items_db.inc diff --git a/reporting/rep705.php b/reporting/rep705.php index 0d2c370f..89e18d1d 100644 --- a/reporting/rep705.php +++ b/reporting/rep705.php @@ -29,10 +29,10 @@ print_annual_expense_breakdown(); //---------------------------------------------------------------------------------------------------- -function getPeriods($year, $account, $dimension, $dimension2) +function getPeriods($row, $account, $dimension, $dimension2) { - $yr = $year; - $mo = 12; + $yr = $row['yr']; + $mo = $row['mo']; $date13 = date('Y-m-d',mktime(0,0,0,$mo+1,1,$yr)); $date12 = date('Y-m-d',mktime(0,0,0,$mo,1,$yr)); $date11 = date('Y-m-d',mktime(0,0,0,$mo-1,1,$yr)); @@ -115,8 +115,12 @@ function print_annual_expense_breakdown() //$yr = date('Y'); //$mo = date('m'): // from now - $yr = $year; - $mo = 12; + $sql = "SELECT YEAR(end) AS yr, MONTH(end) AS mo FROM ".TB_PREF."fiscal_year WHERE YEAR(begin)=".db_escape($year); + $result = db_query($sql, "could not get fiscal year"); + $row = db_fetch($result); + + $yr = $row['yr']; + $mo = $row['mo']; $da = 1; if ($date_system == 1) list($yr, $mo, $da) = jalali_to_gregorian($yr, $mo, $da); @@ -211,7 +215,7 @@ function print_annual_expense_breakdown() if ($account['account_code'] != null) { - $bal = getPeriods($year, $account["account_code"], $dimension, $dimension2); + $bal = getPeriods($row, $account["account_code"], $dimension, $dimension2); if (!$bal['per01'] && !$bal['per02'] && !$bal['per03'] && !$bal['per04'] && !$bal['per05'] && !$bal['per06'] && !$bal['per07'] && !$bal['per08'] && !$bal['per09'] && !$bal['per10'] && !$bal['per11'] && !$bal['per12'])