Skip to content

Commit

Permalink
Use new period selection functions written by Paul Becker
Browse files Browse the repository at this point in the history
Files changed in commit:
AnalysisHorizontalIncome.php
GLCashFlowsIndirect.php
GLProfit_Loss.php
GLTagProfit_Loss.php
GLTrialBalance.php
SalesGraph.php

On branch master

Add the new selection box and make clear it is alternative to from and to
If something is selected in the new period selection then use calculated
from and to dates

As per this forum thread:
http://www.weberp.org/forum/showthread.php?tid=8131&pid=14707#pid14707
  • Loading branch information
timschofield committed Mar 31, 2018
1 parent e6e56ac commit 4d3e7d3
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 7 deletions.
19 changes: 19 additions & 0 deletions AnalysisHorizontalIncome.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ function RelativeChange($selected_period, $previous_period) {
$_POST['SelectADifferentPeriod']='Select A Different Period';
}

if ($_POST['Period'] != '') {
$_POST['FromPeriod'] = ReportPeriod($_POST['Period'], 'From');
$_POST['ToPeriod'] = ReportPeriod($_POST['Period'], 'To');
}

include('includes/header.php');
if((!isset($_POST['FromPeriod']) AND !isset($_POST['ToPeriod'])) OR isset($_POST['SelectADifferentPeriod'])) {
echo '<p class="page_title_text"><img alt="" src="', $RootPath, '/css/', $Theme,
Expand Down Expand Up @@ -105,6 +110,20 @@ function RelativeChange($selected_period, $previous_period) {
echo '</select></td>
</tr>
<tr>
<td>
<h3>', _('OR'), '</h3>
</td>
</tr>';

if (!isset($_POST['Period'])) {
$_POST['Period'] = '';
}

echo '<tr>
<td>', _('Select Period'), ':</td>
<td>', ReportPeriodList($_POST['Period'], array('l', 't')), '</td>
</tr>
<tr>
<td>', _('Detail or summary'), ':</td>
<td><select name="Detail" required="required" title="', _('Selecting Summary will show on the totals at the account group level'), '" >
<option value="Summary">', _('Summary'), '</option>
Expand Down
24 changes: 22 additions & 2 deletions GLCashFlowsIndirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ function colDebitCredit($Amount) {
prnMsg(_('The period should be 12 months or less in duration. Please select an alternative period range.'), 'error');
}

if ($_POST['Period'] != '') {
$_POST['PeriodFrom'] = ReportPeriod($_POST['Period'], 'From');
$_POST['PeriodTo'] = ReportPeriod($_POST['Period'], 'To');
}

// Main code:
if(isset($_POST['PeriodFrom']) AND isset($_POST['PeriodTo']) AND $_POST['Action']!='New') {// If all parameters are set and valid, generates the report:
echo '<p class="page_title_text"><img alt="" src="', $RootPath, '/css/', $Theme,
Expand Down Expand Up @@ -779,9 +784,24 @@ function colDebitCredit($Amount) {
echo '</select>',
(!isset($_SESSION['ShowFieldHelp']) || $_SESSION['ShowFieldHelp'] ? _('Select the end of the reporting period') : ''), // If it is not set the $_SESSION['ShowFieldHelp'] parameter OR it is TRUE, shows the page help text.
'</td>
</tr>',
</tr>';

echo '<tr>
<td>
<h3>', _('OR'), '</h3>
</td>
</tr>';

if (!isset($_POST['Period'])) {
$_POST['Period'] = '';
}

echo '<tr>
<td>', _('Select Period'), ':</td>
<td>', ReportPeriodList($_POST['Period'], array('l', 't')), '</td>
</tr>';
// Show the budget for the period:
'<tr>',
echo '<tr>',
'<td><label for="ShowBudget">', _('Show the budget for the period'), '</label></td>
<td><input',($_POST['ShowBudget'] ? ' checked="checked"' : ''), ' id="ShowBudget" name="ShowBudget" type="checkbox">', // "Checked" if ShowBudget is set AND it is TRUE.
(!isset($_SESSION['ShowFieldHelp']) || $_SESSION['ShowFieldHelp'] ? _('Check this box to show the budget for the period') : ''), // If it is not set the $_SESSION['ShowFieldHelp'] parameter OR it is TRUE, shows the page help text.
Expand Down
20 changes: 20 additions & 0 deletions GLProfit_Loss.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
$_POST['SelectADifferentPeriod']='Select A Different Period';
}

if ($_POST['Period'] != '') {
$_POST['FromPeriod'] = ReportPeriod($_POST['Period'], 'From');
$_POST['ToPeriod'] = ReportPeriod($_POST['Period'], 'To');
}

if ((!isset($_POST['FromPeriod'])
AND !isset($_POST['ToPeriod']))
OR isset($_POST['SelectADifferentPeriod'])){
Expand Down Expand Up @@ -102,6 +107,21 @@
}
echo '</select></td></tr>';

echo '<tr>
<td>
<h3>', _('OR'), '</h3>
</td>
</tr>';

if (!isset($_POST['Period'])) {
$_POST['Period'] = '';
}

echo '<tr>
<td>', _('Select Period'), ':</td>
<td>', ReportPeriodList($_POST['Period'], array('l', 't')), '</td>
</tr>';

echo '<tr>
<td>' . _('Detail Or Summary').':</td>
<td><select name="Detail">
Expand Down
21 changes: 21 additions & 0 deletions GLTagProfit_Loss.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
$_POST['SelectADifferentPeriod']='Select A Different Period';
}

if ($_POST['Period'] != '') {
$_POST['FromPeriod'] = ReportPeriod($_POST['Period'], 'From');
$_POST['ToPeriod'] = ReportPeriod($_POST['Period'], 'To');
}

if ((!isset($_POST['FromPeriod']) AND !isset($_POST['ToPeriod'])) OR isset($_POST['SelectADifferentPeriod'])){

include('includes/header.php');
Expand Down Expand Up @@ -91,6 +96,22 @@
}
}
echo '</select></td></tr>';

echo '<tr>
<td>
<h3>', _('OR'), '</h3>
</td>
</tr>';

if (!isset($_POST['Period'])) {
$_POST['Period'] = '';
}

echo '<tr>
<td>', _('Select Period'), ':</td>
<td>', ReportPeriodList($_POST['Period'], array('l', 't')), '</td>
</tr>';

//Select the tag
echo '<tr>
<td>' . _('Select tag') . '</td>
Expand Down
15 changes: 10 additions & 5 deletions GLTrialBalance.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
$_POST['SelectADifferentPeriod']=_('Select A Different Period');
}

if ($_POST['Period'] != '') {
$_POST['FromPeriod'] = ReportPeriod($_POST['Period'], 'From');
$_POST['ToPeriod'] = ReportPeriod($_POST['Period'], 'To');
}

if ((! isset($_POST['FromPeriod'])
AND ! isset($_POST['ToPeriod']))
OR isset($_POST['SelectADifferentPeriod'])){
Expand Down Expand Up @@ -107,6 +112,11 @@

echo '</select></td>
</tr>
<tr>
<td>
<h3>', _('OR'), '</h3>
</td>
</tr>
<tr>
<td>' . _('Select Period') . ':</td>
<td>' . ReportPeriodList( $_POST['Period'] ) . '</td>
Expand All @@ -133,11 +143,6 @@
$FontSize = 10;
$line_height = 12;

if ($_POST['Period'] != '') {
$_POST['FromPeriod'] = ReportPeriod($_POST['Period'], 'From');
$_POST['ToPeriod'] = ReportPeriod($_POST['Period'], 'To');
}

$NumberOfMonths = $_POST['ToPeriod'] - $_POST['FromPeriod'] + 1;

$sql = "SELECT lastdate_in_period
Expand Down
20 changes: 20 additions & 0 deletions SalesGraph.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,21 @@
}
echo '</select></td></tr>';

echo '<tr>
<td>
<h3>', _('OR'), '</h3>
</td>
</tr>';

if (!isset($_POST['Period'])) {
$_POST['Period'] = '';
}

echo '<tr>
<td>', _('Select Period'), ':</td>
<td>', ReportPeriodList($_POST['Period'], array('l', 't')), '</td>
</tr>';

$AreasResult = DB_query("SELECT areacode, areadescription FROM areas ORDER BY areadescription");

if (!isset($_POST['SalesArea'])){
Expand Down Expand Up @@ -217,6 +232,11 @@
$SelectClause = 'qty';
}

if ($_POST['Period'] != '') {
$_POST['FromPeriod'] = ReportPeriod($_POST['Period'], 'From');
$_POST['ToPeriod'] = ReportPeriod($_POST['Period'], 'To');
}

$SQL = "SELECT YEAR(`lastdate_in_period`) AS year, MONTHNAME(`lastdate_in_period`) AS month
FROM `periods`
WHERE `periodno`='" . $_POST['FromPeriod'] . "' OR periodno='" . $_POST['ToPeriod'] . "'";
Expand Down

0 comments on commit 4d3e7d3

Please sign in to comment.