From 49a7fa0300718dbe32e4786544a57f2e06347731 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Chac=C3=B3n?= Date: Sat, 19 Jan 2019 20:51:22 -0600 Subject: [PATCH] Standardise buttons Standardise buttons in AnalysisHorizontalIncome.php and AnalysisHorizontalPosition.php. --- AnalysisHorizontalIncome.php | 366 +++++++++++++++++++-------------- AnalysisHorizontalPosition.php | 293 +++++++++++++++----------- 2 files changed, 380 insertions(+), 279 deletions(-) diff --git a/AnalysisHorizontalIncome.php b/AnalysisHorizontalIncome.php index 5ee2f8aa6..2ef5c111b 100644 --- a/AnalysisHorizontalIncome.php +++ b/AnalysisHorizontalIncome.php @@ -1,7 +1,23 @@ 0) { @@ -10,46 +26,80 @@ function RelativeChange($selected_period, $previous_period) { return _('N/A'); } } -// END: Functions division ----------------------------------------------------- +// END: Functions division ===================================================== -// BEGIN: Procedure division --------------------------------------------------- +// BEGIN: Procedure division =================================================== include ('includes/session.php'); $Title = _('Horizontal Analysis of Statement of Comprehensive Income'); $ViewTopic= 'GeneralLedger'; $BookMark = 'AnalysisHorizontalIncome'; +include('includes/header.php'); + +// Merges gets into posts: +if(isset($_GET['PeriodFrom'])) { + $_POST['PeriodFrom'] = $_GET['PeriodFrom']; +} +if(isset($_GET['PeriodTo'])) { + $_POST['PeriodTo'] = $_GET['PeriodTo']; +} +if(isset($_GET['Period'])) { + $_POST['Period'] = $_GET['Period']; +} +if(isset($_GET['ShowDetail'])) { + $_POST['ShowDetail'] = $_GET['ShowDetail']; +} +if(isset($_GET['ShowZeroBalance'])) { + $_POST['ShowZeroBalance'] = $_GET['ShowZeroBalance']; +} +if(isset($_GET['NewReport'])) { + $_POST['NewReport'] = $_GET['NewReport']; +} + include('includes/SQL_CommonFunctions.inc'); include('includes/AccountSectionsDef.php');// This loads the $Sections variable. -if(isset($_POST['FromPeriod']) and ($_POST['FromPeriod'] > $_POST['ToPeriod'])) { +if(isset($_POST['PeriodFrom']) and ($_POST['PeriodFrom'] > $_POST['PeriodTo'])) { prnMsg(_('The selected period from is actually after the period to') . '! ' . _('Please reselect the reporting period'),'error'); - $_POST['SelectADifferentPeriod']='Select A Different Period'; + $_POST['NewReport'] = 'on'; } if ($_POST['Period'] != '') { - $_POST['FromPeriod'] = ReportPeriod($_POST['Period'], 'From'); - $_POST['ToPeriod'] = ReportPeriod($_POST['Period'], 'To'); + $_POST['PeriodFrom'] = ReportPeriod($_POST['Period'], 'From'); + $_POST['PeriodTo'] = ReportPeriod($_POST['Period'], 'To'); } -include('includes/header.php'); -if((!isset($_POST['FromPeriod']) AND !isset($_POST['ToPeriod'])) OR isset($_POST['SelectADifferentPeriod'])) { - echo '

', // Icon title. - _('Horizontal Analysis of Statement of Comprehensive Income'), '

';// Page title. - - echo '
', - _('Horizontal analysis (also known as trend analysis) is a financial statement analysis technique that shows changes in the amounts of corresponding financial statement items over a period of time. It is a useful tool to evaluate trend situations.'), '
', - _('The statements for two periods are used in horizontal analysis. The earliest period is used as the base period. The items on the later statement are compared with items on the statement of the base period. The changes are shown both in currency (actual change) and percentage (relative change).'), '
', - _('webERP is an "accrual" based system (not a "cash based" system). Accrual systems include items when they are invoiced to the customer, and when expenses are owed based on the supplier invoice date.'), '
', - // Show a form to allow input of criteria for the report to show: - '
', - '', - '
', - ' +if((!isset($_POST['PeriodFrom']) or !isset($_POST['PeriodTo'])) or isset($_POST['NewReport'])) { + echo '

', // Icon title. + $Title, '

';// Page title. + fShowPageHelp(// Shows the page help text if $_SESSION['ShowFieldHelp'] is TRUE or is not set + _('Shows the horizontal analysis of the statement of comprehensive income.') . '
' . + _('Horizontal analysis (also known as trend analysis) is a financial statement analysis technique that shows changes in the amounts of corresponding financial statement items over a period of time. It is a useful tool to evaluate trend situations.'). '
' . + _('The statements for two periods are used in horizontal analysis. The earliest period is used as the base period. The items on the later statement are compared with items on the statement of the base period. The changes are shown both in currency (actual change) and percentage (relative change).') . '
' . + _('webERP is an "accrual" based system (not a "cash based" system). Accrual systems include items when they are invoiced to the customer, and when expenses are owed based on the supplier invoice date.'));// Function fShowPageHelp() in ~/includes/MiscFunctions.php + // BEGIN ReportParametersFormStart: + echo // Shows a form to input the report parameters: + '', + '', // Input table: + '
', // Content of the header and footer of the input table: + ' + ', + ' + + ', + ''; + // END ReportParametersFormStart. + // Content of the body of the input table: + echo ' - - - - - + ', + // Select period to: + ' + + @@ -119,35 +170,34 @@ function RelativeChange($selected_period, $previous_period) { $_POST['Period'] = ''; } - echo ' - - - - + echo ' + + + ', + // Show all accounts instead a summary: + ' - - - - - - -
', _('Report Parameters'), '
', + '
', + '', // "Submit" button. + '', // "Return" button. + '
', + '
', _('Select period from'), ':
', _('Select period to'), ':
', _('Select Period'), ':', ReportPeriodList($_POST['Period'], array('l', 't')), '
', _('Select Period'), ':', ReportPeriodList($_POST['Period'], array('l', 't')), '
', _('Detail or summary'), ':
', _('Show all accounts including zero balances'), '
-
', // Form buttons: - '
', - ' ', // "Show on Screen (HTML)" button. - '', // "Return" button. - '
'; - + ', + // Show accounts with zero balance: + ' + + ', // "Checked" if ShowZeroBalance is set AND it is TRUE. + fShowFieldHelp(_('Check this box to show accounts with zero balance')), // Function fShowFieldHelp() in ~/includes/MiscFunctions.php + ' + '; + // BEGIN ReportParametersFormEnd: + echo '', + ''; + // END ReportParametersFormEnd. // Now do the posting while the user is thinking about the period to select: include ('includes/GLPostings.inc'); } else { - $NumberOfMonths = $_POST['ToPeriod'] - $_POST['FromPeriod'] + 1; + $NumberOfMonths = $_POST['PeriodTo'] - $_POST['PeriodFrom'] + 1; if($NumberOfMonths >12) { echo '
'; prnMsg(_('A period up to 12 months in duration can be specified') . ' - ' . _('the system automatically shows a comparative for the same period from the previous year') . ' - ' . _('it cannot do this if a period of more than 12 months is specified') . '. ' . _('Please select an alternative period range'),'error'); @@ -155,25 +205,24 @@ function RelativeChange($selected_period, $previous_period) { exit; } - $sql = "SELECT lastdate_in_period FROM periods WHERE periodno='" . $_POST['ToPeriod'] . "'"; - $PrdResult = DB_query($sql); - $myrow = DB_fetch_row($PrdResult); - $PeriodToDate = MonthAndYearFromSQLDate($myrow[0]); + $SQL = "SELECT lastdate_in_period FROM periods WHERE periodno='" . $_POST['PeriodTo'] . "'"; + $PrdResult = DB_query($SQL); + $MyRow = DB_fetch_row($PrdResult); + $PeriodToDate = MonthAndYearFromSQLDate($MyRow[0]); // Page title as IAS 1, numerals 10 and 51: include_once('includes/CurrenciesArray.php');// Array to retrieve currency name. echo '
', // Division to identify the report block. - '

', // Icon title. - _('Horizontal Analysis of Statement of Comprehensive Income'), '
', // Page title, reporting statement. + '

', // Icon title. + $Title, '
', // Page title, reporting statement. stripslashes($_SESSION['CompanyRecord']['coyname']), '
', // Page title, reporting entity. _('For'), ' ', $NumberOfMonths, ' ', _('months to'), ' ', $PeriodToDate, '
', // Page title, reporting period. _('All amounts stated in'), ': ', _($CurrencyName[$_SESSION['CompanyRecord']['currencydefault']]), '

';// Page title, reporting presentation currency and level of rounding used. echo ''; - if($_POST['Detail']=='Detailed') {// Detailed report: + if($_POST['ShowDetail']=='Detailed') {// Detailed report: echo ''; } else {// Summary report: @@ -201,10 +250,10 @@ function RelativeChange($selected_period, $previous_period) { accountgroups.groupname, chartdetails.accountcode, chartmaster.accountname, - SUM(CASE WHEN chartdetails.period='" . $_POST['FromPeriod'] . "' THEN chartdetails.bfwd ELSE 0 END) AS firstprdbfwd, - SUM(CASE WHEN chartdetails.period='" . $_POST['ToPeriod'] . "' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS lastprdcfwd, - SUM(CASE WHEN chartdetails.period='" . ($_POST['FromPeriod'] - 12) . "' THEN chartdetails.bfwd ELSE 0 END) AS firstprdbfwdly, - SUM(CASE WHEN chartdetails.period='" . ($_POST['ToPeriod']-12) . "' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS lastprdcfwdly + SUM(CASE WHEN chartdetails.period='" . $_POST['PeriodFrom'] . "' THEN chartdetails.bfwd ELSE 0 END) AS firstprdbfwd, + SUM(CASE WHEN chartdetails.period='" . $_POST['PeriodTo'] . "' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS lastprdcfwd, + SUM(CASE WHEN chartdetails.period='" . ($_POST['PeriodFrom'] - 12) . "' THEN chartdetails.bfwd ELSE 0 END) AS firstprdbfwdly, + SUM(CASE WHEN chartdetails.period='" . ($_POST['PeriodTo']-12) . "' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS lastprdcfwdly FROM chartmaster INNER JOIN accountgroups ON chartmaster.group_ = accountgroups.groupname INNER JOIN chartdetails ON chartmaster.accountcode= chartdetails.accountcode @@ -221,19 +270,19 @@ function RelativeChange($selected_period, $previous_period) { chartdetails.accountcode"; $AccountsResult = DB_query($SQL,_('No general ledger accounts were returned by the SQL because'),_('The SQL that failed was')); - $PeriodTotal=0; - $PeriodTotalLY=0; + $PeriodTotal= 0; + $PeriodTotalLY= 0; - $Section=''; - $SectionTotal=0; - $SectionTotalLY=0; + $Section= ''; + $SectionTotal= 0; + $SectionTotalLY= 0; - $ActGrp=''; + $ActGrp= ''; $GrpTotal=array(0); $GrpTotalLY=array(0); - $Level=0; + $Level= 0; $ParentGroups=array(); - $ParentGroups[$Level]=''; + $ParentGroups[$Level]= ''; $DrawTotalLine = ' @@ -243,11 +292,11 @@ function RelativeChange($selected_period, $previous_period) { '; - while($myrow=DB_fetch_array($AccountsResult)) { - if($myrow['groupname']!= $ActGrp) { - if($myrow['parentgroupname']!=$ActGrp AND $ActGrp!='') { - while($myrow['groupname']!=$ParentGroups[$Level] AND $Level>0) { - if($_POST['Detail']=='Detailed') { + while($MyRow=DB_fetch_array($AccountsResult)) { + if($MyRow['groupname']!= $ActGrp) { + if($MyRow['parentgroupname']!=$ActGrp AND $ActGrp!='') { + while($MyRow['groupname']!=$ParentGroups[$Level] AND $Level>0) { + if($_POST['ShowDetail']=='Detailed') { echo $DrawTotalLine; $ActGrpLabel = str_repeat('___',$Level) . $ParentGroups[$Level] . ' *' . _('total'); } else { @@ -260,15 +309,15 @@ function RelativeChange($selected_period, $previous_period) { '; - $GrpTotal[$Level]=0; - $GrpTotalLY[$Level]=0; - $ParentGroups[$Level]=''; + $GrpTotal[$Level] = 0; + $GrpTotalLY[$Level] = 0; + $ParentGroups[$Level]= ''; $Level--; }// End while. //still need to print out the old group totals - if($_POST['Detail']=='Detailed') { + if($_POST['ShowDetail']=='Detailed') { echo $DrawTotalLine; $ActGrpLabel = str_repeat('___',$Level) . $ParentGroups[$Level] . ' ' . _('total'); } else { @@ -296,13 +345,13 @@ function RelativeChange($selected_period, $previous_period) { // ---> } // <--- - $GrpTotalLY[$Level]=0; - $GrpTotal[$Level]=0; - $ParentGroups[$Level]=''; + $GrpTotalLY[$Level] = 0; + $GrpTotal[$Level] = 0; + $ParentGroups[$Level]= ''; } } - if($myrow['sectioninaccounts']!= $Section) { + if($MyRow['sectioninaccounts']!= $Section) { if($SectionTotal+$SectionTotalLY !=0) { @@ -351,37 +400,37 @@ function RelativeChange($selected_period, $previous_period) { } } - $Section = $myrow['sectioninaccounts']; - $SectionTotal=0; - $SectionTotalLY=0; + $Section = $MyRow['sectioninaccounts']; + $SectionTotal= 0; + $SectionTotalLY= 0; - if($_POST['Detail']=='Detailed') { + if($_POST['ShowDetail']=='Detailed') { echo ' - + '; } } - if($myrow['groupname']!= $ActGrp) { - if($myrow['parentgroupname']==$ActGrp AND $ActGrp !='') {// Adding another level of nesting + if($MyRow['groupname']!= $ActGrp) { + if($MyRow['parentgroupname']==$ActGrp AND $ActGrp !='') {// Adding another level of nesting $Level++; } - $ActGrp = $myrow['groupname']; - $ParentGroups[$Level] = $myrow['groupname']; - if($_POST['Detail']=='Detailed') { + $ActGrp = $MyRow['groupname']; + $ParentGroups[$Level] = $MyRow['groupname']; + if($_POST['ShowDetail']=='Detailed') { echo ' - + '; } } // Set totals for account, groups, section and period: - $AccountTotal = $myrow['lastprdcfwd'] - $myrow['firstprdbfwd']; - $AccountTotalLY = $myrow['lastprdcfwdly'] - $myrow['firstprdbfwdly']; - for ($i=0;$i<=$Level;$i++) { - if(!isset($GrpTotalLY[$i])) {$GrpTotalLY[$i]=0;} + $AccountTotal = $MyRow['lastprdcfwd'] - $MyRow['firstprdbfwd']; + $AccountTotalLY = $MyRow['lastprdcfwdly'] - $MyRow['firstprdbfwdly']; + for ($i= 0;$i<=$Level;$i++) { + if(!isset($GrpTotalLY[$i])) {$GrpTotalLY[$i] = 0;} $GrpTotalLY[$i] += $AccountTotalLY; - if(!isset($GrpTotal[$i])) {$GrpTotal[$i]=0;} + if(!isset($GrpTotal[$i])) {$GrpTotal[$i] = 0;} $GrpTotal[$i] += $AccountTotal; } $SectionTotal += $AccountTotal; @@ -389,13 +438,13 @@ function RelativeChange($selected_period, $previous_period) { $PeriodTotal += $AccountTotal; $PeriodTotalLY += $AccountTotalLY; - if($_POST['Detail']=='Detailed') { - if(isset($_POST['ShowZeroBalances']) OR (!isset($_POST['ShowZeroBalances']) AND ($AccountTotal <> 0 OR $AccountTotalLY <> 0))) { + if($_POST['ShowDetail']=='Detailed') { + if(isset($_POST['ShowZeroBalance']) OR (!isset($_POST['ShowZeroBalance']) AND ($AccountTotal <> 0 OR $AccountTotalLY <> 0))) { echo ' - '; + '; // ---> if($Section ==1) { - echo ' + echo ' @@ -403,7 +452,7 @@ function RelativeChange($selected_period, $previous_period) { '; } else { // <--- - echo ' + echo ' @@ -414,10 +463,10 @@ function RelativeChange($selected_period, $previous_period) { } }// End of loop. - if($myrow['groupname']!= $ActGrp) { - if($myrow['parentgroupname']!=$ActGrp AND $ActGrp!='') { - while($myrow['groupname']!=$ParentGroups[$Level] AND $Level>0) { - if($_POST['Detail']=='Detailed') { + if($MyRow['groupname']!= $ActGrp) { + if($MyRow['parentgroupname']!=$ActGrp AND $ActGrp!='') { + while($MyRow['groupname']!=$ParentGroups[$Level] AND $Level>0) { + if($_POST['ShowDetail']=='Detailed') { echo $DrawTotalLine; $ActGrpLabel = str_repeat('___',$Level) . $ParentGroups[$Level] . ' ' . _('total'); } else { @@ -442,13 +491,13 @@ function RelativeChange($selected_period, $previous_period) { '; } - $GrpTotal[$Level]=0; - $GrpTotalLY[$Level]=0; - $ParentGroups[$Level]=''; + $GrpTotal[$Level] = 0; + $GrpTotalLY[$Level] = 0; + $ParentGroups[$Level]= ''; $Level--; }// End while. //still need to print out the old group totals - if($_POST['Detail']=='Detailed') { + if($_POST['ShowDetail']=='Detailed') { echo $DrawTotalLine; $ActGrpLabel = str_repeat('___',$Level) . $ParentGroups[$Level] . ' ' . _('total'); } else { @@ -461,13 +510,13 @@ function RelativeChange($selected_period, $previous_period) { '; - $GrpTotal[$Level]=0; - $GrpTotalLY[$Level]=0; - $ParentGroups[$Level]=''; + $GrpTotal[$Level] = 0; + $GrpTotalLY[$Level] = 0; + $ParentGroups[$Level]= ''; } } - if($myrow['sectioninaccounts']!= $Section) { + if($MyRow['sectioninaccounts']!= $Section) { if($Section==1) {// Income. echo $DrawTotalLine, @@ -500,13 +549,13 @@ function RelativeChange($selected_period, $previous_period) { '; } - $Section = $myrow['sectioninaccounts']; - $SectionTotal=0; - $SectionTotalLY=0; + $Section = $MyRow['sectioninaccounts']; + $SectionTotal= 0; + $SectionTotalLY= 0; - if($_POST['Detail']=='Detailed' and isset($Sections[$myrow['sectioninaccounts']])) { + if($_POST['ShowDetail']=='Detailed' and isset($Sections[$MyRow['sectioninaccounts']])) { echo ' - + '; } } @@ -520,23 +569,24 @@ function RelativeChange($selected_period, $previous_period) { '; echo $DrawTotalLine; - echo '', // See comment at the begin of the table. - '
', _('Account'), ' ', _('Account Name'), '
 
', locale_number_format(-$GrpTotal[$Level]+$GrpTotalLY[$Level],$_SESSION['CompanyRecord']['decimalplaces']), ' ', RelativeChange(-$GrpTotal[$Level],-$GrpTotalLY[$Level]), '

', $Sections[$myrow['sectioninaccounts']], '

', $Sections[$MyRow['sectioninaccounts']], '

', $myrow['groupname'], '

', $MyRow['groupname'], '

', $myrow['accountcode'], '', $MyRow['accountcode'], '', htmlspecialchars($myrow['accountname'],ENT_QUOTES,'UTF-8',false), '', htmlspecialchars($MyRow['accountname'],ENT_QUOTES,'UTF-8',false), ' ', locale_number_format(-$AccountTotal,$_SESSION['CompanyRecord']['decimalplaces']), ' ', locale_number_format(-$AccountTotalLY,$_SESSION['CompanyRecord']['decimalplaces']), ' ', locale_number_format(-$AccountTotal+$AccountTotalLY,$_SESSION['CompanyRecord']['decimalplaces']), '
', htmlspecialchars($myrow['accountname'],ENT_QUOTES,'UTF-8',false), '', htmlspecialchars($MyRow['accountname'],ENT_QUOTES,'UTF-8',false), ' ', locale_number_format(-$AccountTotal,$_SESSION['CompanyRecord']['decimalplaces']), ' ', locale_number_format(-$AccountTotalLY,$_SESSION['CompanyRecord']['decimalplaces']), ' ', locale_number_format(-$AccountTotal+$AccountTotalLY,$_SESSION['CompanyRecord']['decimalplaces']), '', RelativeChange(-$GrpTotal[$Level],-$GrpTotalLY[$Level]), '
', locale_number_format(-$GrpTotal[$Level]+$GrpTotalLY[$Level],$_SESSION['CompanyRecord']['decimalplaces']), ' ', RelativeChange(-$GrpTotal[$Level],-$GrpTotalLY[$Level]), '

', RelativeChange(-($GPIncome+$SectionTotal),-($GPIncomeLY+$SectionTotalLY)), '

', $Sections[$myrow['sectioninaccounts']], '

', $Sections[$MyRow['sectioninaccounts']], '

', RelativeChange(-$PeriodTotal,-$PeriodTotalLY), '

-
';// End div id="Report". - echo '
', - '
', - '', - '', - '', + echo '', + '';// End div id="Report". + // BEGIN ReportDocEndButtons: + echo // Shows a form to select an action after the report was shown: + '', + '', // Resend report parameters: + '', + '', + '', + '', '
', // Form buttons: - '', // "Print" button. - ' ', // "Select A Different Period" button. - '', // "Return" button. - '
'; + '', // "Print" button. + '', // "New Report" button. + '', // "Return" button. + '', + '
'; + // END ReportDocEndButtons. } -echo ''; + include('includes/footer.php'); ?> diff --git a/AnalysisHorizontalPosition.php b/AnalysisHorizontalPosition.php index 32ac532b1..9d34b7f9a 100644 --- a/AnalysisHorizontalPosition.php +++ b/AnalysisHorizontalPosition.php @@ -1,6 +1,23 @@ 0) { @@ -9,87 +26,121 @@ function RelativeChange($selected_period, $previous_period) { return _('N/A'); } } +// END: Functions division ===================================================== +// BEGIN: Procedure division =================================================== include ('includes/session.php'); -$Title = _('Horizontal Analysis of Statement of Financial Position');// Screen identification. -$ViewTopic = 'GeneralLedger';// Filename's id in ManualContents.php's TOC. -$BookMark = 'AnalysisHorizontalPosition';// Anchor's id in the manual's html document. +$Title = _('Horizontal Analysis of Statement of Financial Position'); +$ViewTopic = 'GeneralLedger'; +$BookMark = 'AnalysisHorizontalPosition'; + +include('includes/header.php'); + +// Merges gets into posts: +if(isset($_GET['PeriodFrom'])) { + $_POST['PeriodFrom'] = $_GET['PeriodFrom']; +} +if(isset($_GET['PeriodTo'])) { + $_POST['PeriodTo'] = $_GET['PeriodTo']; +} +if(isset($_GET['Period'])) { + $_POST['Period'] = $_GET['Period']; +} +if(isset($_GET['ShowDetail'])) { + $_POST['ShowDetail'] = $_GET['ShowDetail']; +} +if(isset($_GET['ShowZeroBalance'])) { + $_POST['ShowZeroBalance'] = $_GET['ShowZeroBalance']; +} +if(isset($_GET['NewReport'])) { + $_POST['NewReport'] = $_GET['NewReport']; +} + include('includes/SQL_CommonFunctions.inc'); include('includes/AccountSectionsDef.php'); // This loads the $Sections variable -if(! isset($_POST['BalancePeriodEnd']) or isset($_POST['SelectADifferentPeriod'])) { +if(!isset($_POST['PeriodTo']) or isset($_POST['NewReport'])) { /*Show a form to allow input of criteria for TB to show */ - include('includes/header.php'); - echo '

', // Icon title. - _('Horizontal Analysis of Statement of Financial Position'), '

';// Page title. - - echo '
', - _('Horizontal analysis (also known as trend analysis) is a financial statement analysis technique that shows changes in the amounts of corresponding financial statement items over a period of time. It is a useful tool to evaluate trend situations.'), '
', - _('The statements for two periods are used in horizontal analysis. The earliest period is used as the base period. The items on the later statement are compared with items on the statement of the base period. The changes are shown both in currency (actual change) and percentage (relative change).'), '
', - _('webERP is an "accrual" based system (not a "cash based" system). Accrual systems include items when they are invoiced to the customer, and when expenses are owed based on the supplier invoice date.'), '
', - // Show a form to allow input of criteria for the report to show: - '
', - '', - '
', - ' + echo '

', // Icon title. + $Title, '

';// Page title. + fShowPageHelp(// Shows the page help text if $_SESSION['ShowFieldHelp'] is TRUE or is not set + _('Shows the horizontal analysis of the statement of financial position.') . '
' . + _('Horizontal analysis (also known as trend analysis) is a financial statement analysis technique that shows changes in the amounts of corresponding financial statement items over a period of time. It is a useful tool to evaluate trend situations.'). '
' . + _('The statements for two periods are used in horizontal analysis. The earliest period is used as the base period. The items on the later statement are compared with items on the statement of the base period. The changes are shown both in currency (actual change) and percentage (relative change).') . '
' . + _('webERP is an "accrual" based system (not a "cash based" system). Accrual systems include items when they are invoiced to the customer, and when expenses are owed based on the supplier invoice date.'));// Function fShowPageHelp() in ~/includes/MiscFunctions.php + // BEGIN ReportParametersFormStart: + echo // Shows a form to input the report parameters: + '', + '', // Input table: + '
', // Content of the header and footer of the input table: + ' + ', + ' - - + ', + ''; + // END ReportParametersFormStart. + // Content of the body of the input table: + // Select period to: + echo ' + + - - - - - - -
', _('Report Parameters'), '
', _('Select the balance date'), ':', + '
', + '', // "Submit" button. + '', // "Return" button. + '
', + '
', _('Detail or summary'), ':
', _('Show all accounts including zero balances'), '
-
', // Form buttons: - '
', - ' ', // "Show on Screen (HTML)" button. - '', // "Return" button. - '
'; - + ', + // Show accounts with zero balance: + '', + ' + ', // "Checked" if ShowZeroBalance is set AND it is TRUE. + fShowFieldHelp(_('Check this box to show accounts with zero balance')), // Function fShowFieldHelp() in ~/includes/MiscFunctions.php + ' + '; + // BEGIN ReportParametersFormEnd: + echo '', + ''; + // END ReportParametersFormEnd. // Now do the posting while the user is thinking about the period to select: include ('includes/GLPostings.inc'); } else { - include('includes/header.php'); $RetainedEarningsAct = $_SESSION['CompanyRecord']['retainedearnings']; - $sql = "SELECT lastdate_in_period FROM periods WHERE periodno='" . $_POST['BalancePeriodEnd'] . "'"; - $PrdResult = DB_query($sql); - $myrow = DB_fetch_row($PrdResult); - $BalanceDate = ConvertSQLDate($myrow[0]); + $SQL = "SELECT lastdate_in_period FROM periods WHERE periodno='" . $_POST['PeriodTo'] . "'"; + $PrdResult = DB_query($SQL); + $MyRow = DB_fetch_row($PrdResult); + $BalanceDate = ConvertSQLDate($MyRow[0]); // Page title as IAS 1, numerals 10 and 51: include_once('includes/CurrenciesArray.php');// Array to retrieve currency name. @@ -104,7 +155,7 @@ function RelativeChange($selected_period, $previous_period) { echo ''; - if($_POST['Detail']=='Detailed') {// Detailed report: + if($_POST['ShowDetail']=='Detailed') {// Detailed report: echo ''; } else {// Summary report: @@ -128,8 +179,8 @@ function RelativeChange($selected_period, $previous_period) { ';// thead and tfoot used in conjunction with tbody enable scrolling of the table body independently of the header and footer. Also, when printing a large table that spans multiple pages, these elements can enable the table header to be printed at the top of each page. // Calculate B/Fwd retained earnings: - $SQL = "SELECT Sum(CASE WHEN chartdetails.period='" . $_POST['BalancePeriodEnd'] . "' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS accumprofitbfwd, - Sum(CASE WHEN chartdetails.period='" . ($_POST['BalancePeriodEnd'] - 12) . "' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS accumprofitbfwdly + $SQL = "SELECT Sum(CASE WHEN chartdetails.period='" . $_POST['PeriodTo'] . "' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS accumprofitbfwd, + Sum(CASE WHEN chartdetails.period='" . ($_POST['PeriodTo'] - 12) . "' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS accumprofitbfwdly FROM chartmaster INNER JOIN accountgroups ON chartmaster.group_ = accountgroups.groupname INNER JOIN chartdetails ON chartmaster.accountcode= chartdetails.accountcode @@ -144,8 +195,8 @@ function RelativeChange($selected_period, $previous_period) { accountgroups.parentgroupname, chartdetails.accountcode, chartmaster.accountname, - Sum(CASE WHEN chartdetails.period='" . $_POST['BalancePeriodEnd'] . "' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS balancecfwd, - Sum(CASE WHEN chartdetails.period='" . ($_POST['BalancePeriodEnd'] - 12) . "' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS balancecfwdly + Sum(CASE WHEN chartdetails.period='" . $_POST['PeriodTo'] . "' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS balancecfwd, + Sum(CASE WHEN chartdetails.period='" . ($_POST['PeriodTo'] - 12) . "' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS balancecfwdly FROM chartmaster INNER JOIN accountgroups ON chartmaster.group_ = accountgroups.groupname INNER JOIN chartdetails ON chartmaster.accountcode= chartdetails.accountcode @@ -164,17 +215,17 @@ function RelativeChange($selected_period, $previous_period) { $AccountsResult = DB_query($SQL,_('No general ledger accounts were returned by the SQL because')); - $CheckTotal=0; - $CheckTotalLY=0; + $CheckTotal= 0; + $CheckTotalLY= 0; - $Section=''; + $Section= ''; $SectionBalance= 0; - $SectionBalanceLY=0; + $SectionBalanceLY= 0; - $ActGrp=''; - $Level=0; + $ActGrp= ''; + $Level= 0; $ParentGroups=array(); - $ParentGroups[$Level]=''; + $ParentGroups[$Level]= ''; $GroupTotal = array(0); $GroupTotalLY = array(0); @@ -186,19 +237,19 @@ function RelativeChange($selected_period, $previous_period) { '; - while($myrow=DB_fetch_array($AccountsResult)) { - $AccountBalance = $myrow['balancecfwd']; - $AccountBalanceLY = $myrow['balancecfwdly']; + while($MyRow=DB_fetch_array($AccountsResult)) { + $AccountBalance = $MyRow['balancecfwd']; + $AccountBalanceLY = $MyRow['balancecfwdly']; - if($myrow['accountcode'] == $RetainedEarningsAct) { + if($MyRow['accountcode'] == $RetainedEarningsAct) { $AccountBalance += $AccumProfitRow['accumprofitbfwd']; $AccountBalanceLY += $AccumProfitRow['accumprofitbfwdly']; } - if($myrow['groupname']!= $ActGrp AND $ActGrp != '') { - if($myrow['parentgroupname']!=$ActGrp) { - while($myrow['groupname']!=$ParentGroups[$Level] AND $Level>0) { - if($_POST['Detail']=='Detailed') { + if($MyRow['groupname']!= $ActGrp AND $ActGrp != '') { + if($MyRow['parentgroupname']!=$ActGrp) { + while($MyRow['groupname']!=$ParentGroups[$Level] AND $Level>0) { + if($_POST['ShowDetail']=='Detailed') { echo $DrawTotalLine; } echo ' @@ -208,12 +259,12 @@ function RelativeChange($selected_period, $previous_period) { '; - $GroupTotal[$Level]=0; - $GroupTotalLY[$Level]=0; - $ParentGroups[$Level]=''; + $GroupTotal[$Level] = 0; + $GroupTotalLY[$Level] = 0; + $ParentGroups[$Level]= ''; $Level--; } - if($_POST['Detail']=='Detailed') { + if($_POST['ShowDetail']=='Detailed') { echo $DrawTotalLine; } echo ' @@ -223,12 +274,12 @@ function RelativeChange($selected_period, $previous_period) { '; - $GroupTotal[$Level]=0; - $GroupTotalLY[$Level]=0; - $ParentGroups[$Level]=''; + $GroupTotal[$Level] = 0; + $GroupTotalLY[$Level] = 0; + $ParentGroups[$Level]= ''; } } - if($myrow['sectioninaccounts'] != $Section ) { + if($MyRow['sectioninaccounts'] != $Section ) { if($Section!='') { echo $DrawTotalLine; echo ' @@ -239,48 +290,48 @@ function RelativeChange($selected_period, $previous_period) { '; } - $SectionBalance=0; - $SectionBalanceLY=0; - $Section = $myrow['sectioninaccounts']; - if($_POST['Detail']=='Detailed') { + $SectionBalance= 0; + $SectionBalanceLY= 0; + $Section = $MyRow['sectioninaccounts']; + if($_POST['ShowDetail']=='Detailed') { echo ' - + '; } } - if($myrow['groupname'] != $ActGrp) { + if($MyRow['groupname'] != $ActGrp) { - if($ActGrp!='' AND $myrow['parentgroupname']==$ActGrp) { + if($ActGrp!='' AND $MyRow['parentgroupname']==$ActGrp) { $Level++; } - if($_POST['Detail']=='Detailed') { - $ActGrp = $myrow['groupname']; + if($_POST['ShowDetail']=='Detailed') { + $ActGrp = $MyRow['groupname']; echo ' - + '; } - $GroupTotal[$Level]=0; - $GroupTotalLY[$Level]=0; - $ActGrp = $myrow['groupname']; - $ParentGroups[$Level] = $myrow['groupname']; + $GroupTotal[$Level] = 0; + $GroupTotalLY[$Level] = 0; + $ActGrp = $MyRow['groupname']; + $ParentGroups[$Level] = $MyRow['groupname']; } $SectionBalance += $AccountBalance; $SectionBalanceLY += $AccountBalanceLY; - for ($i=0;$i<=$Level;$i++) { + for ($i= 0;$i<=$Level;$i++) { $GroupTotalLY[$i] += $AccountBalanceLY; $GroupTotal[$i] += $AccountBalance; } $CheckTotal += $AccountBalance; $CheckTotalLY += $AccountBalanceLY; - if($_POST['Detail']=='Detailed') { - if(isset($_POST['ShowZeroBalances']) OR (!isset($_POST['ShowZeroBalances']) AND (round($AccountBalance,$_SESSION['CompanyRecord']['decimalplaces']) <> 0 OR round($AccountBalanceLY,$_SESSION['CompanyRecord']['decimalplaces']) <> 0))) { + if($_POST['ShowDetail']=='Detailed') { + if(isset($_POST['ShowZeroBalance']) OR (!isset($_POST['ShowZeroBalance']) AND (round($AccountBalance,$_SESSION['CompanyRecord']['decimalplaces']) <> 0 OR round($AccountBalanceLY,$_SESSION['CompanyRecord']['decimalplaces']) <> 0))) { echo ' - - + + @@ -290,8 +341,8 @@ function RelativeChange($selected_period, $previous_period) { } }// End of loop. - while($myrow['groupname']!=$ParentGroups[$Level] AND $Level>0) { - if($_POST['Detail']=='Detailed') { + while($MyRow['groupname']!=$ParentGroups[$Level] AND $Level>0) { + if($_POST['ShowDetail']=='Detailed') { echo $DrawTotalLine; } echo ' @@ -303,7 +354,7 @@ function RelativeChange($selected_period, $previous_period) { '; $Level--; } - if($_POST['Detail']=='Detailed') { + if($_POST['ShowDetail']=='Detailed') { echo $DrawTotalLine; } echo ' @@ -322,11 +373,11 @@ function RelativeChange($selected_period, $previous_period) { '; - $Section = $myrow['sectioninaccounts']; + $Section = $MyRow['sectioninaccounts']; - if(isset($myrow['sectioninaccounts']) and $_POST['Detail']=='Detailed') { + if(isset($MyRow['sectioninaccounts']) and $_POST['ShowDetail']=='Detailed') { echo ' - + '; } echo $DrawTotalLine; @@ -338,22 +389,22 @@ function RelativeChange($selected_period, $previous_period) { '; echo $DrawTotalLine; - echo '', // See comment at the begin of the table. - '
', _('Account'), ' ', _('Account Name'), '

', locale_number_format(-$GroupTotal[$Level]+$GroupTotalLY[$Level],$_SESSION['CompanyRecord']['decimalplaces']), ' ', RelativeChange(-$GroupTotal[$Level],-$GroupTotalLY[$Level]), '
', locale_number_format(-$GroupTotal[$Level]+$GroupTotalLY[$Level],$_SESSION['CompanyRecord']['decimalplaces']), ' ', RelativeChange(-$GroupTotal[$Level],-$GroupTotalLY[$Level]), '

', RelativeChange(-$SectionBalance,-$SectionBalanceLY), '

', $Sections[$myrow['sectioninaccounts']], '

', $Sections[$MyRow['sectioninaccounts']], '

', $myrow['groupname'], '

', $MyRow['groupname'], '

', $myrow['accountcode'], '', htmlspecialchars($myrow['accountname'],ENT_QUOTES,'UTF-8',false), '', $MyRow['accountcode'], '', htmlspecialchars($MyRow['accountname'],ENT_QUOTES,'UTF-8',false), ' ', locale_number_format($AccountBalance,$_SESSION['CompanyRecord']['decimalplaces']), ' ', locale_number_format($AccountBalanceLY,$_SESSION['CompanyRecord']['decimalplaces']), ' ', locale_number_format(-$AccountBalance+$AccountBalanceLY,$_SESSION['CompanyRecord']['decimalplaces']), '

', RelativeChange(-$SectionBalance,-$SectionBalanceLY), '

', $Sections[$myrow['sectioninaccounts']], '

', $Sections[$MyRow['sectioninaccounts']], '

', RelativeChange(-$CheckTotal,-$CheckTotalLY), '

- '; // Close div id="Report". - echo '
', - '
', - '', - '', + echo '', + '';// End div id="Report". + // BEGIN ReportDocEndButtons: + echo // Shows a form to select an action after the report was shown: + '', + '', // Resend report parameters: + '', + '', + '', '
', // Form buttons: - '', // "Print" button. - ' ', // "Select A Different Period" button. - '', // "Return" button. - '
'; + '', // "Print" button. + '', // "New Report" button. + '', // "Return" button. + '', + '
'; + // END ReportDocEndButtons. } -echo ''; include('includes/footer.php'); ?>