From: <rc...@us...> - 2016-05-13 04:47:10
|
Revision: 7518 http://sourceforge.net/p/web-erp/reponame/7518 Author: rchacon Date: 2016-05-13 04:47:08 +0000 (Fri, 13 May 2016) Log Message: ----------- Completes and standardise tables; clean up code. Modified Paths: -------------- trunk/AccountGroups.php trunk/AccountSections.php Modified: trunk/AccountGroups.php =================================================================== --- trunk/AccountGroups.php 2016-05-12 17:07:21 UTC (rev 7517) +++ trunk/AccountGroups.php 2016-05-13 04:47:08 UTC (rev 7518) @@ -1,12 +1,12 @@ <?php /* $Id$*/ +/* Defines the groupings of general ledger accounts */ include('includes/session.inc'); - $Title = _('Account Groups'); -$ViewTopic= 'GeneralLedger';// Filename in ManualContents.php's TOC. -$BookMark = 'AccountGroups';// Anchor's id in the manual's html document. -include('includes/header.inc');// Manual links before header.inc. +$ViewTopic= 'GeneralLedger'; +$BookMark = 'AccountGroups'; +include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); @@ -260,12 +260,12 @@ if (!isset($_GET['SelectedAccountGroup']) AND !isset($_POST['SelectedAccountGroup'])) { -/* An account group could be posted when one has been edited and is being updated or GOT when selected for modification - SelectedAccountGroup will exist because it was sent with the page in a GET . - If its the first time the page has been displayed with no parameters -then none of the above are true and the list of account groups will be displayed with -links to delete or edit each. These will call the same page again and allow update/input -or deletion of the records*/ +/* An account group could be posted when one has been edited and is being updated or GOT when selected for modification + SelectedAccountGroup will exist because it was sent with the page in a GET . + If its the first time the page has been displayed with no parameters + then none of the above are true and the list of account groups will be displayed with + links to delete or edit each. These will call the same page again and allow update/input + or deletion of the records*/ $sql = "SELECT groupname, sectionname, @@ -364,11 +364,16 @@ $_POST['PandL'] = $myrow['pandl']; $_POST['ParentGroupName'] = $myrow['parentgroupname']; - echo '<table class="selection">'; - echo '<tr> - <th colspan="2">' . _('Edit Account Group Details') . '</th> - </tr>'; - echo '<input type="hidden" name="SelectedAccountGroup" value="' . $_GET['SelectedAccountGroup'] . '" />'; + echo '<table class="selection"> + <thead> + <tr> + <th colspan="2">', _('Edit Account Group Details'), '</th> + </tr> + </thead> + <tbody> + <tr> + <td><input name="SelectedAccountGroup" type="hidden" value="', $_GET['SelectedAccountGroup'], '" /></td> + </tr>'; } elseif (!isset($_POST['MoveGroup'])) { //end of if $_POST['SelectedAccountGroup'] only do the else when a new record is being entered @@ -388,29 +393,33 @@ $_POST['PandL']=''; } - echo '<br /><table class="selection">'; - echo '<tr> - <th colspan="2">' . _('New Account Group Details') . '</th> + echo '<br /> + <table class="selection"> + <thead> + <tr> + <th colspan="2">', _('New Account Group Details'), '</th> + </tr> + </thead> + <tbody> + <tr> + <td><input name="SelectedAccountGroup" type="hidden" value="', $_POST['SelectedAccountGroup'], '" /></td> </tr>'; - echo '<tr> - <td><input type="hidden" name="SelectedAccountGroup" value="' . $_POST['SelectedAccountGroup'] . '" /></td> - </tr>'; } echo '<tr> - <td>' . _('Account Group Name') . ':' . '</td> - <td><input tabindex="1" autofocus="autofocus" required="required" data-type="no-illegal-chars" placeholder="' . _('Enter the account group name') . '" ' . (in_array('GroupName',$Errors) ? '"class=inputerror"' : '' ) . ' type="text" name="GroupName" size="30" minlength="3" maxlength="30" value="' . $_POST['GroupName'] . '" title="' . _('A unique name for the account group must be entered - at least 3 characters long and less than 30 characters long. Only alpha numeric characters can be used.') . '" /></td> + <td>', _('Account Group Name'), ':</td> + <td><input autofocus="autofocus" data-type="no-illegal-chars" placeholder="' . _('Enter the account group name') . '" ' . (in_array('GroupName',$Errors) ? '"class=inputerror" ' : '' ) . 'maxlength="30" minlength="3" name="GroupName" required="required" size="30" tabindex="1" type="text" value="' . $_POST['GroupName'] . '" title="' . _('A unique name for the account group must be entered - at least 3 characters long and less than 30 characters long. Only alpha numeric characters can be used.') . '" /></td> </tr> <tr> - <td>' . _('Parent Group') . ':' . '</td> - <td><select tabindex="2" ' . (in_array('ParentGroupName',$Errors) ? 'class="selecterror"' : '' ) . ' name="ParentGroupName">'; + <td>', _('Parent Group'), ':</td> + <td><select ', + ( in_array('ParentGroupName',$Errors) ? 'class="selecterror" ' : '' ), + 'name="ParentGroupName" tabindex="2">'; $sql = "SELECT groupname FROM accountgroups"; $groupresult = DB_query($sql,$ErrMsg,$DbgMsg); - if (!isset($_POST['ParentGroupName'])){ - echo '<option selected="selected" value="">' ._('Top Level Group') . '</option>'; - } else { - echo '<option value="">' ._('Top Level Group') . '</option>'; - } + echo '<option ', + ( !isset($_POST['ParentGroupName']) ? 'selected="selected" ' : '' ), + 'value="">', _('Top Level Group'), '</option>'; while ( $grouprow = DB_fetch_array($groupresult) ) { @@ -423,8 +432,10 @@ echo '</select></td> </tr> <tr> - <td>' . _('Section In Accounts') . ':' . '</td> - <td><select tabindex="3" ' . (in_array('SectionInAccounts',$Errors) ? 'class="selecterror"' : '' ) . ' name="SectionInAccounts">'; + <td>', _('Section In Accounts'), ':</td> + <td><select ', + ( in_array('SectionInAccounts',$Errors) ? 'class="selecterror" ' : '' ), + 'name="SectionInAccounts" tabindex="3">'; $sql = "SELECT sectionid, sectionname FROM accountsection ORDER BY sectionid"; $secresult = DB_query($sql,$ErrMsg,$DbgMsg); @@ -438,8 +449,8 @@ echo '</select></td> </tr> <tr> - <td>' . _('Profit and Loss') . ':' . '</td> - <td><select tabindex="4" name="PandL" title="' . _('Select YES if this account group will contain accounts that will consist of only profit and loss accounts or NO if the group will contain balance sheet account') . '">'; + <td>', _('Profit and Loss'), ':</td> + <td><select name="PandL" tabindex="4" title="', _('Select YES if this account group will contain accounts that will consist of only profit and loss accounts or NO if the group will contain balance sheet account'), '">'; if ($_POST['PandL']!=0 ) { echo '<option selected="selected" value="1">' . _('Yes') . '</option>'; @@ -455,17 +466,18 @@ echo '</select></td> </tr> <tr> - <td>' . _('Sequence In TB') . ':' . '</td> - <td><input tabindex="5" type="text" maxlength="4" name="SequenceInTB" required="required" class="number" value="' . $_POST['SequenceInTB'] . '" title="' . _('Enter the sequence number that this account group and its child general ledger accounts should display in the trial balance') . '" /></td> + <td>', _('Sequence In TB'), ':</td> + <td><input class="number" maxlength="4" name="SequenceInTB" required="required" tabindex="5" type="text" value="', $_POST['SequenceInTB'], '" title="', _('Enter the sequence number that this account group and its child general ledger accounts should display in the trial balance'), '" /></td> </tr> <tr> - <td colspan="2"><div class="centre"><input tabindex="6" type="submit" name="submit" value="' . _('Enter Information') . '" /></div></td> + <td class="centre" colspan="2"><input name="submit" tabindex="6" type="submit" value="', _('Enter Information'), '" /></td> </tr> - </table> - <br /> + </tbody> + </table> + <br /> </div> </form>'; } //end if record deleted no point displaying form to add record include('includes/footer.inc'); -?> \ No newline at end of file +?> Modified: trunk/AccountSections.php =================================================================== --- trunk/AccountSections.php 2016-05-12 17:07:21 UTC (rev 7517) +++ trunk/AccountSections.php 2016-05-13 04:47:08 UTC (rev 7518) @@ -1,6 +1,6 @@ <?php /* $Id$*/ -/* Defines the sections in the general ledger reports. */ +/* Defines the sections in the general ledger reports */ include('includes/session.inc'); $Title = _('Account Sections'); @@ -90,7 +90,7 @@ if(isset($_POST['SelectedSectionID']) AND $_POST['SelectedSectionID']!='' AND $InputError !=1) { - /*SelectedSectionID could also exist if submit had not been clicked this code would not run in this case cos submit is false of course see the delete code below*/ + /*SelectedSectionID could also exist if submit had not been clicked this code would not run in this case cos submit is false of course see the delete code below*/ $sql = "UPDATE accountsection SET sectionname='" . $_POST['SectionName'] . "' WHERE sectionid = '" . $_POST['SelectedSectionID'] . "'"; @@ -126,9 +126,9 @@ $myrow = DB_fetch_array($result); if($myrow['sections']>0) { prnMsg( _('Cannot delete this account section because general ledger accounts groups have been created using this section'),'warn'); - echo '<div>'; - echo '<br />' . _('There are') . ' ' . $myrow['sections'] . ' ' . _('general ledger accounts groups that refer to this account section'); - echo '</div>'; + echo '<div>', + '<br />', _('There are'), ' ', $myrow['sections'], ' ', _('general ledger accounts groups that refer to this account section'), + '</div>'; } else { //Fetch section name @@ -151,13 +151,13 @@ if(!isset($_GET['SelectedSectionID']) AND !isset($_POST['SelectedSectionID'])) { -/* An account section could be posted when one has been edited and is being updated - or GOT when selected for modification - SelectedSectionID will exist because it was sent with the page in a GET . - If its the first time the page has been displayed with no parameters - then none of the above are true and the list of account groups will be displayed with - links to delete or edit each. These will call the same page again and allow update/input - or deletion of the records*/ +/* An account section could be posted when one has been edited and is being updated + or GOT when selected for modification + SelectedSectionID will exist because it was sent with the page in a GET . + If its the first time the page has been displayed with no parameters + then none of the above are true and the list of account groups will be displayed with + links to delete or edit each. These will call the same page again and allow update/input + or deletion of the records*/ $sql = "SELECT sectionid, sectionname @@ -191,15 +191,17 @@ $k++; } - echo '<td class="number">', $myrow['sectionid'], '</td> + echo '<td class="number">', $myrow['sectionid'], '</td> <td class="text">', $myrow['sectionname'], '</td> - <td class="noprint"><a href="', htmlspecialchars($_SERVER['PHP_SELF'], '?SelectedSectionID=', urlencode($myrow['sectionid']), ENT_QUOTES, 'UTF-8'), '">', _('Edit'), '</a></td>'; + <td class="noprint"><a href="', htmlspecialchars($_SERVER['PHP_SELF'].'?SelectedSectionID='.urlencode($myrow['sectionid']), ENT_QUOTES, 'UTF-8'), '">', _('Edit'), '</a></td> + <td class="noprint">'; if( $myrow['sectionid'] == '1' or $myrow['sectionid'] == '2' ) { - echo '<td class="noprint"><b>', _('Restricted'), '</b></td>'; + echo '<b>', _('Restricted'), '</b>'; } else { - echo '<td class="noprint"><a href="', htmlspecialchars($_SERVER['PHP_SELF'], '?SelectedSectionID=', urlencode($myrow['sectionid']), '&delete=1', ENT_QUOTES, 'UTF-8'), '">', _('Delete'), '</a></td>'; + echo '<a href="', htmlspecialchars($_SERVER['PHP_SELF'].'?SelectedSectionID='.urlencode($myrow['sectionid']).'&delete=1', ENT_QUOTES, 'UTF-8'), '">', _('Delete'), '</a>'; } - echo '</tr>'; + echo '</td> + </tr>'; } //END WHILE LIST LOOP echo '</table>'; /* echo '</div>';// End div id="Report".*/ @@ -212,9 +214,9 @@ if(! isset($_GET['delete'])) { - echo '<form action="', htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8'), '" id="AccountSections" method="post">'; - echo '<div class="noprint"><br />'; - echo '<input name="FormID" type="hidden" value="', $_SESSION['FormID'], '" />'; + echo '<form action="', htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8'), '" id="AccountSections" method="post">', + '<div class="noprint"><br />', + '<input name="FormID" type="hidden" value="', $_SESSION['FormID'], '" />'; if(isset($_GET['SelectedSectionID'])) { //editing an existing section @@ -232,17 +234,23 @@ $myrow = DB_fetch_array($result); $_POST['SectionID'] = $myrow['sectionid']; - $_POST['SectionName'] = $myrow['sectionname']; + $_POST['SectionName'] = $myrow['sectionname']; - echo '<input type="hidden" name="SelectedSectionID" value="' . $_POST['SectionID'] . '" />'; - echo '<table class="selection"> + echo '<input name="SelectedSectionID" type="hidden" value="', $_POST['SectionID'], '" /> + <table class="selection"> + <thead> <tr> - <td>' . _('Section Number') . ':' . '</td> - <td>' . $_POST['SectionID'] . '</td> + <th colspan="2">', _('Edit Account Section Details'), '</th> + </tr> + </thead> + <tbody> + <tr> + <td>', _('Section Number'), ':</td> + <td>', $_POST['SectionID'], '</td> </tr>'; } - } else { + } else { if(!isset($_POST['SelectedSectionID'])) { $_POST['SelectedSectionID']=''; @@ -254,24 +262,33 @@ $_POST['SectionName']=''; } echo '<table class="selection"> + <thead> + <tr> + <th colspan="2">', _('New Account Section Details'), '</th> + </tr> + </thead> + <tbody> + <tr> + <td>', _('Section Number'), ':</td> + <td><input autofocus="autofocus" ', + ( in_array('SectionID',$Errors) ? 'class="inputerror number"' : 'class="number" ' ), + 'maxlength="4" name="SectionID" required="required" size="4" tabindex="1" type="text" value="', $_POST['SectionID'], '" /></td> + </tr>'; + } + echo '<tr> + <td>', _('Section Description'), ':</td> + <td><input ', + ( in_array('SectionName',$Errors) ? 'class="inputerror text" ' : 'class="text" ' ), + 'maxlength="30" name="SectionName" required="required" size="30" tabindex="2" type="text" value="', $_POST['SectionName'], '" /></td> + </tr> <tr> - <td>' . _('Section Number') . ':' . '</td> - <td><input tabindex="1" ' . (in_array('SectionID',$Errors) ? 'class="inputerror"' : '' ) .' type="text" autofocus="autofocus" required="required" name="SectionID" class="number" size="4" maxlength="4" value="' . $_POST['SectionID'] . '" /></td> - </tr>'; - } - echo '<tr> - <td>' . _('Section Description') . ':' . '</td> - <td><input tabindex="2" ' . (in_array('SectionName',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="SectionName" required="required" size="30" maxlength="30" value="' . $_POST['SectionName'] . '" /></td> - </tr>'; - - echo '<tr> - <td colspan="2"><div class="centre"><input tabindex="3" type="submit" name="submit" value="' . _('Enter Information') . '" /></div></td> - </tr> + <td class="centre" colspan="2"><input name="submit" tabindex="3" type="submit" value="', _('Enter Information'), '" /></td> + </tr> + </tbody> </table> <br /> </div> </form>'; - } //end if record deleted no point displaying form to add record include('includes/footer.inc'); |