|
From: <dai...@us...> - 2013-07-05 22:56:03
|
Revision: 6049
http://sourceforge.net/p/web-erp/reponame/6049
Author: daintree
Date: 2013-07-05 22:56:00 +0000 (Fri, 05 Jul 2013)
Log Message:
-----------
Improvements to GL period selection
Modified Paths:
--------------
trunk/Customers.php
trunk/GLAccountInquiry.php
trunk/GLTrialBalance.php
trunk/SelectGLAccount.php
trunk/includes/session.inc
trunk/sql/mysql/upgrade4.10-4.11.sql
Modified: trunk/Customers.php
===================================================================
--- trunk/Customers.php 2013-07-05 13:53:14 UTC (rev 6048)
+++ trunk/Customers.php 2013-07-05 22:56:00 UTC (rev 6049)
@@ -453,8 +453,7 @@
echo '<tr><td>' . _('Address Line 5 (Postal Code)') . ':</td>
<td><input tabindex="7" type="text" name="Address5" size="22" maxlength="20" /></td></tr>';
-
- if (!isset($_POST['Address6']) AND $CountryName == '') {
+ if (!isset($_POST['Address6'])) {
$_POST['Address6'] = $CountriesArray[$_SESSION['CountryOfOperation']];
}
echo '<tr>
Modified: trunk/GLAccountInquiry.php
===================================================================
--- trunk/GLAccountInquiry.php 2013-07-05 13:53:14 UTC (rev 6048)
+++ trunk/GLAccountInquiry.php 2013-07-05 22:56:00 UTC (rev 6049)
@@ -19,6 +19,18 @@
$SelectedPeriod = $_GET['Period'];
}
+/* Get the start and periods, depending on how this script was called*/
+if (isset($SelectedPeriod)) { //If it was called from itself (in other words an inquiry was run and we wish to leave the periods selected unchanged
+ $FirstPeriodSelected = min($SelectedPeriod);
+ $LastPeriodSelected = max($SelectedPeriod);
+} elseif (isset($_GET['FromPeriod'])) { //If it was called from the Trial Balance/P&L or Balance sheet
+ $FirstPeriodSelected = $_GET['FromPeriod'];
+ $LastPeriodSelected = $_GET['ToPeriod'];
+} else { // Otherwise just highlight the current period
+ $FirstPeriodSelected = GetPeriod(date($_SESSION['DefaultDateFormat']), $db);
+ $LastPeriodSelected = GetPeriod(date($_SESSION['DefaultDateFormat']), $db);
+}
+
echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/transactions.png" title="' . _('General Ledger Account Inquiry') . '" alt="" />' . ' ' . _('General Ledger Account Inquiry') . '</p>';
echo '<div class="page_help_text">' . _('Use the keyboard Shift key to select multiple periods') . '</div><br />';
@@ -77,11 +89,9 @@
$sql = "SELECT periodno, lastdate_in_period FROM periods ORDER BY periodno DESC";
$Periods = DB_query($sql,$db);
-$id=0;
while ($myrow=DB_fetch_array($Periods,$db)){
- if(isset($SelectedPeriod[$id]) and $myrow['periodno'] == $SelectedPeriod[$id]){
+ if (isset($FirstPeriodSelected) AND $myrow['periodno'] >= $FirstPeriodSelected AND $myrow['periodno'] <= $LastPeriodSelected) {
echo '<option selected="selected" value="' . $myrow['periodno'] . '">' . _(MonthAndYearFromSQLDate($myrow['lastdate_in_period'])) . '</option>';
- $id++;
} else {
echo '<option value="' . $myrow['periodno'] . '">' . _(MonthAndYearFromSQLDate($myrow['lastdate_in_period'])) . '</option>';
}
@@ -205,14 +215,14 @@
$RunningTotal =$ChartDetailRow['bfwd'];
if ($RunningTotal < 0 ){ //its a credit balance b/fwd
- echo '<tr style="background-color:#FDFEEF">
+ echo '<tr>
<td colspan="3"><b>' . _('Brought Forward Balance') . '</b></td>
<td></td>
<td class="number"><b>' . locale_number_format(-$RunningTotal,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td>
<td></td>
</tr>';
} else { //its a debit balance b/fwd
- echo '<tr style="background-color:#FDFEEF">
+ echo '<tr>
<td colspan="3"><b>' . _('Brought Forward Balance') . '</b></td>
<td class="number"><b>' . locale_number_format($RunningTotal,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td>
<td colspan="2"></td>
@@ -241,7 +251,7 @@
$ChartDetailsResult = DB_query($sql,$db,$ErrMsg);
$ChartDetailRow = DB_fetch_array($ChartDetailsResult);
- echo '<tr style="background-color:#FDFEEF">
+ echo '<tr>
<td colspan="3"><b>' . _('Total for period') . ' ' . $PeriodNo . '</b></td>';
if ($PeriodTotal < 0 ){ //its a credit balance b/fwd
if ($PandLAccount==True) {
@@ -256,7 +266,7 @@
$RunningTotal = 0;
}
echo '<td class="number"><b>' . locale_number_format($PeriodTotal,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td>
- <td colspan="2"></td>
+ <td colspan="2"></td>
</tr>';
}
$IntegrityReport .= '<br />' . _('Period') . ': ' . $PeriodNo . _('Account movement per transaction') . ': ' . locale_number_format($PeriodTotal,$_SESSION['CompanyRecord']['decimalplaces']) . ' ' . _('Movement per ChartDetails record') . ': ' . locale_number_format($ChartDetailRow['actual'],$_SESSION['CompanyRecord']['decimalplaces']) . ' ' . _('Period difference') . ': ' . locale_number_format($PeriodTotal -$ChartDetailRow['actual'],3);
@@ -312,7 +322,7 @@
}
- echo '<tr style="background-color:#FDFEEF">
+ echo '<tr>
<td colspan="3"><b>';
if ($PandLAccount==True){
echo _('Total Period Movement');
@@ -322,9 +332,13 @@
echo '</b></td>';
if ($RunningTotal >0){
- echo '<td class="number"><b>' . locale_number_format(($RunningTotal),$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td><td colspan="2"></td></tr>';
+ echo '<td class="number"><b>' . locale_number_format(($RunningTotal),$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td>
+ <td colspan="2"></td>
+ </tr>';
}else {
- echo '<td></td><td class="number"><b>' . locale_number_format((-$RunningTotal),$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td><td colspan="2"></td></tr>';
+ echo '<td></td>
+ <td class="number"><b>' . locale_number_format((-$RunningTotal),$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td><td colspan="2"></td>
+ </tr>';
}
echo '</table>';
} /* end of if Show button hit */
Modified: trunk/GLTrialBalance.php
===================================================================
--- trunk/GLTrialBalance.php 2013-07-05 13:53:14 UTC (rev 6048)
+++ trunk/GLTrialBalance.php 2013-07-05 22:56:00 UTC (rev 6049)
@@ -25,6 +25,9 @@
AND ! isset($_POST['ToPeriod']))
OR isset($_POST['SelectADifferentPeriod'])){
+ $ViewTopic = 'GeneralLedger';
+ $BookMark = 'TrialBalance';
+
include ('includes/header.inc');
echo '<p class="page_title_text">
<img src="'.$RootPath.'/css/'.$Theme.'/images/magnifier.png" title="' . _('Trial Balance') . '" alt="" />' . ' ' . $Title . '
@@ -158,6 +161,8 @@
$AccountsResult = DB_query($SQL,$db);
if (DB_error_no($db) !=0) {
$Title = _('Trial Balance') . ' - ' . _('Problem Report') . '....';
+ $ViewTopic = 'GeneralLedger';
+ $BookMark = 'TrialBalance';
include('includes/header.inc');
prnMsg( _('No general ledger accounts were returned by the SQL because') . ' - ' . DB_error_msg($db) );
echo '<br /><a href="' .$RootPath .'/index.php">'. _('Back to the menu'). '</a>';
@@ -169,6 +174,8 @@
}
if (DB_num_rows($AccountsResult)==0){
$Title = _('Print Trial Balance Error');
+ $ViewTopic = 'GeneralLedger';
+ $BookMark = 'TrialBalance';
include('includes/header.inc');
echo '<p>';
prnMsg( _('There were no entries to print out for the selections specified') );
@@ -384,10 +391,10 @@
} else {
include('includes/header.inc');
- echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">';
- echo '<div>';
- echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
- echo '<input type="hidden" name="FromPeriod" value="' . $_POST['FromPeriod'] . '" />
+ echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">
+ <div>
+ <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />
+ <input type="hidden" name="FromPeriod" value="' . $_POST['FromPeriod'] . '" />
<input type="hidden" name="ToPeriod" value="' . $_POST['ToPeriod'] . '" />';
$NumberOfMonths = $_POST['ToPeriod'] - $_POST['FromPeriod'] + 1;
@@ -438,15 +445,16 @@
Account Code , Account Name , Month Actual, Month Budget, Period Actual, Period Budget */
echo '<table cellpadding="2" class="selection">';
- echo '<tr><th colspan="6"><b>'. _('Trial Balance for the month of ') . $PeriodToDate .
- _(' and for the ') . $NumberOfMonths . _(' months to ') . $PeriodToDate .'</b></th></tr>';
+ echo '<tr>
+ <th colspan="6"><b>'. _('Trial Balance for the month of ') . $PeriodToDate . _(' and for the ') . $NumberOfMonths . _(' months to ') . $PeriodToDate .'</b></th>
+ </tr>';
$TableHeader = '<tr>
- <th>' . _('Account') . '</th>
- <th>' . _('Account Name') . '</th>
- <th>' . _('Month Actual') . '</th>
- <th>' . _('Month Budget') . '</th>
- <th>' . _('Period Actual') . '</th>
- <th>' . _('Period Budget') .'</th>
+ <th>' . _('Account') . '</th>
+ <th>' . _('Account Name') . '</th>
+ <th>' . _('Month Actual') . '</th>
+ <th>' . _('Month Budget') . '</th>
+ <th>' . _('Period Actual') . '</th>
+ <th>' . _('Period Budget') .'</th>
</tr>';
$j = 1;
@@ -553,9 +561,9 @@
$ParentGroups[$Level]=$myrow['groupname'];
$ActGrp = $myrow['groupname'];
printf('<tr>
- <td colspan="6"><h2>%s</h2></td>
- </tr>',
- $myrow['groupname']);
+ <td colspan="6"><h2>%s</h2></td>
+ </tr>',
+ $myrow['groupname']);
echo $TableHeader;
$j++;
}
@@ -613,7 +621,7 @@
$CheckPeriodActual += $AccountPeriodActual;
$CheckPeriodBudget += $AccountPeriodBudget;
- $ActEnquiryURL = '<a href="'. $RootPath . '/GLAccountInquiry.php?Period=' . $_POST['ToPeriod'] . '&Account=' . $myrow['accountcode'] . '&Show=Yes">' . $myrow['accountcode'] . '</a>';
+ $ActEnquiryURL = '<a href="'. $RootPath . '/GLAccountInquiry.php?FromPeriod=' . $_POST['FromPeriod'] . '&ToPeriod=' . $_POST['ToPeriod'] . '&Account=' . $myrow['accountcode'] . '&Show=Yes">' . $myrow['accountcode'] . '</a>';
printf('<td>%s</td>
<td>%s</td>
@@ -722,10 +730,12 @@
locale_number_format($CheckPeriodBudget,$_SESSION['CompanyRecord']['decimalplaces']));
echo '</table><br />';
- echo '<div class="centre"><input type="submit" name="SelectADifferentPeriod" value="' . _('Select A Different Period') . '" /></div>';
+ echo '<div class="centre">
+ <input type="submit" name="SelectADifferentPeriod" value="' . _('Select A Different Period') . '" />
+ </div>';
}
-echo '</div>';
-echo '</form>';
+echo '</div>
+ </form>';
include('includes/footer.inc');
?>
\ No newline at end of file
Modified: trunk/SelectGLAccount.php
===================================================================
--- trunk/SelectGLAccount.php 2013-07-05 13:53:14 UTC (rev 6048)
+++ trunk/SelectGLAccount.php 2013-07-05 22:56:00 UTC (rev 6049)
@@ -4,32 +4,15 @@
include('includes/session.inc');
$Title = _('Search GL Accounts');
-
+$ViewTopic = 'GeneralLedger';
+$BookMark = 'GLAccountInquiry';
include('includes/header.inc');
$msg='';
unset($result);
-if (isset($_POST['Select'])) {
+if (isset($_POST['Search'])){
- $result = DB_query("SELECT accountname FROM chartmaster WHERE accountcode=" . $_POST['Select'],$db);
- $myrow = DB_fetch_row($result);
- echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/magnifier.png" title="' . _('Search') . '" alt="" />' . ' ' . _('Search for General Ledger Accounts') . '</p>';
-
- echo '<div class="page_help_text">' . _('Account Code') . ' <b>' . $_POST['Select'] . ' - ' . $myrow[0] . ' </b>' . _('has been selected') . '. <br />' . _('Select one of the links below to operate using this Account') . '.</div>';
- $AccountID = $_POST['Select'];
- $_POST['Select'] = NULL;
-
- echo '<br />
- <div class="centre">
- <a href="' . $RootPath . '/GLAccounts.php?SelectedAccount=' . $AccountID . '">' . _('Edit Account') . '</a>';
- echo '<br />
- <a href="' . $RootPath . '/GLAccountInquiry.php?Account=' . $AccountID . '">' . _('Account Inquiry') . '</a>';
- echo '<br />
- <a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">' . _('New Search') . '</a></div>';
-
-} elseif (isset($_POST['Search'])){
-
if (mb_strlen($_POST['Keywords']>0) AND mb_strlen($_POST['GLCode'])>0) {
$msg=_('Account name keywords have been used in preference to the account code extract entered');
}
@@ -84,12 +67,11 @@
if (!isset($AccountID)) {
- echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/magnifier.png" title="' . _('Search') .
- '" alt="" />' . ' ' . _('Search for General Ledger Accounts') . '</p>';
- echo '<br />
- <form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">';
- echo '<div>';
- echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
+ echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/magnifier.png" title="' . _('Search') . '" alt="" />' . ' ' . _('Search for General Ledger Accounts') . '</p>
+ <br />
+ <form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">
+ <div>
+ <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
if(mb_strlen($msg)>1){
prnMsg($msg,'info');
@@ -120,6 +102,8 @@
<th>' . _('Account Name') . '</th>
<th>' . _('Group') . '</th>
<th>' . _('Account Type') . '</th>
+ <th>' . _('Inquiry') . '</th>
+ <th>' . _('Edit') . '</th>
</tr>';
echo $TableHeader;
@@ -129,15 +113,25 @@
while ($myrow=DB_fetch_array($result)) {
printf('<tr>
- <td><input type="submit" name="Select" value="%s" /></td>
- <td>%s</td>
- <td>%s</td>
- <td>%s</td>
- </tr>',
- $myrow['accountcode'],
- htmlspecialchars($myrow['accountname'],ENT_QUOTES,'UTF-8',false),
- $myrow['group_'],
- $myrow['pl']);
+ <td>%s</td>
+ <td>%s</td>
+ <td>%s</td>
+ <td>%s</td>
+ <td><a href="%s/GLAccountInquiry.php?Account=%s&Show=Yes"><img src="%s/css/%s/images/magnifier.png" title="' . _('Inquiry') . '" alt="' . _('Inquiry') . '" /></td>
+ <td><a href="%s/GLAccounts.php?SelectedAccount=%s"><img src="%s/css/%s/images/maintenance.png" title="' . _('Edit') . '" alt="' . _('Edit') . '" /></a>
+ </tr>',
+ htmlspecialchars($myrow['accountcode'],ENT_QUOTES,'UTF-8',false),
+ htmlspecialchars($myrow['accountname'],ENT_QUOTES,'UTF-8',false),
+ $myrow['group_'],
+ $myrow['pl'],
+ $RootPath,
+ $myrow['accountcode'],
+ $RootPath,
+ $Theme,
+ $RootPath,
+ $myrow['accountcode'],
+ $RootPath,
+ $Theme);
$j++;
if ($j == 12){
Modified: trunk/includes/session.inc
===================================================================
--- trunk/includes/session.inc 2013-07-05 13:53:14 UTC (rev 6048)
+++ trunk/includes/session.inc 2013-07-05 22:56:00 UTC (rev 6049)
@@ -42,10 +42,7 @@
include($PathPrefix . 'includes/ConnectDB.inc');
include($PathPrefix . 'includes/DateFunctions.inc');
-// Uncomment to turn off attempts counter
-//$_SESSION['AttemptsCounter'] = 0;
-
-if (!isset($_SESSION['AttemptsCounter'])){
+if (!isset($_SESSION['AttemptsCounter']) OR $AllowDemoMode==true){
$_SESSION['AttemptsCounter'] = 0;
}
Modified: trunk/sql/mysql/upgrade4.10-4.11.sql
===================================================================
--- trunk/sql/mysql/upgrade4.10-4.11.sql 2013-07-05 13:53:14 UTC (rev 6048)
+++ trunk/sql/mysql/upgrade4.10-4.11.sql 2013-07-05 22:56:00 UTC (rev 6049)
@@ -159,6 +159,8 @@
INSERT INTO config VALUES ('ShopMode','test');
INSERT INTO config VALUES ('ShopContactUs','');
+ALTER TABLE `purchorderauth` CHANGE `authlevel` `authlevel` DOUBLE NOT NULL DEFAULT '0';
+
INSERT INTO config VALUES ('ShopShowOnlyAvailableItems','0');
INSERT INTO config VALUES ('ShopShowQOHColumn','1');
INSERT INTO config VALUES ('ShopAdditionalStockLocations','');
|