From: <tim...@us...> - 2010-07-04 22:00:19
|
Revision: 3556 http://web-erp.svn.sourceforge.net/web-erp/?rev=3556&view=rev Author: tim_schofield Date: 2010-07-04 22:00:12 +0000 (Sun, 04 Jul 2010) Log Message: ----------- Corrections to sql statements and layout changes Modified Paths: -------------- trunk/COGSGLPostings.php trunk/doc/Change.log.html Modified: trunk/COGSGLPostings.php =================================================================== --- trunk/COGSGLPostings.php 2010-07-04 21:59:47 UTC (rev 3555) +++ trunk/COGSGLPostings.php 2010-07-04 22:00:12 UTC (rev 3556) @@ -17,6 +17,8 @@ $SelectedCOGSPostingID=$_GET['SelectedCOGSPostingID']; } +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="">' . ' ' . $title.'<br>'; + if (isset($_POST['submit'])) { /* actions to take once the user has clicked the submit button @@ -31,7 +33,7 @@ area = '" . $_POST['Area'] . "', stkcat = '" . $_POST['StkCat'] . "', salestype='" . $_POST['SalesType'] . "' - WHERE id = $SelectedCOGSPostingID"; + WHERE id ='" .$SelectedCOGSPostingID."'"; $msg = _('Cost of sales GL posting code has been updated'); } else { @@ -44,7 +46,7 @@ stkcat, salestype) VALUES ( - " . $_POST['GLCode'] . ", + '" . $_POST['GLCode'] . "', '" . $_POST['Area'] . "', '" . $_POST['StkCat'] . "', '" . $_POST['SalesType'] . "' @@ -55,14 +57,16 @@ $result = DB_query($sql,$db); prnMsg ($msg,'info'); + echo '<br>'; unset ($SelectedCOGSPostingID); } elseif (isset($_GET['delete'])) { //the link to delete a selected record was clicked instead of the submit button - $sql="DELETE FROM cogsglpostings WHERE id=$SelectedCOGSPostingID"; + $sql="DELETE FROM cogsglpostings WHERE id='".$SelectedCOGSPostingID."'"; $result = DB_query($sql,$db); prnMsg( _('The cost of sales posting code record has been deleted'),'info'); + echo '<br>'; unset ($SelectedCOGSPostingID); } @@ -70,28 +74,28 @@ if (!isset($SelectedCOGSPostingID)) { $ShowLivePostingRecords = true; - + $sql = 'SELECT cogsglpostings.id, cogsglpostings.area, cogsglpostings.stkcat, cogsglpostings.salestype, chartmaster.accountname - FROM cogsglpostings LEFT JOIN chartmaster + FROM cogsglpostings LEFT JOIN chartmaster ON cogsglpostings.glcode = chartmaster.accountcode WHERE chartmaster.accountcode IS NULL'; - + $result = DB_query($sql,$db); if (DB_num_rows($result)>0){ $ShowLivePostingRecords = false; prnMsg (_('The following cost of sales posting records that do not have valid general ledger code specified - these records must be amended.'),'error'); - echo '<table border=1>'; + echo '<table class=selection>'; echo "<tr><th>" . _('Area') . "</th> <th>" . _('Stock Category') . "</th> <th>" . _('Sales Type') . "</th> <th>" . _('COGS Account') . "</th> </tr>"; $k=0; //row colour counter - + while ($myrow = DB_fetch_row($result)) { if ($k==1){ echo '<tr class="EvenTableRows">'; @@ -100,7 +104,7 @@ echo '<tr class="OddTableRows">'; $k=1; } - + printf("<td>%s</td> <td>%s</td> <td>%s</td> @@ -115,7 +119,7 @@ $myrow[0], $_SERVER['PHP_SELF']. '?' . SID . '&', $myrow[0]); - }//end while + }//end while echo '</table>'; } @@ -124,7 +128,7 @@ cogsglpostings.stkcat, cogsglpostings.salestype FROM cogsglpostings'; - + $result = DB_query($sql,$db); if (DB_num_rows($result)==0){ @@ -135,18 +139,18 @@ if (DB_num_rows($result)==0){ /* The required group does not seem to exist so we create it */ $sql = "INSERT INTO accountgroups ( - groupname, - sectioninaccounts, - pandl, - sequenceintb + groupname, + sectioninaccounts, + pandl, + sequenceintb ) VALUES ( 'Sales', 1, 1, 10)"; - - $result = DB_query($sql,$db); - } + + $result = DB_query($sql,$db); + } $sql = 'SELECT accountcode FROM chartmaster WHERE accountcode =1'; $result = DB_query($sql,$db); if (DB_num_rows($result)==0){ @@ -170,9 +174,9 @@ salestype, glcode) VALUES ('AN', - 'ANY', + 'ANY', 'AN', - 1)"; + 1)"; $result = DB_query($sql,$db); } @@ -185,10 +189,10 @@ FROM cogsglpostings, chartmaster WHERE cogsglpostings.glcode = chartmaster.accountcode'; - + $result = DB_query($sql,$db); - - echo '<table border=1>'; + + echo '<table class=selection>'; echo '<tr><th>' . _('Area') . '</th><th>' . _('Stock Category') . '</th><th>' . _('Sales Type') . @@ -196,7 +200,7 @@ '</th></tr>'; $k = 0; - + while ($myrow = DB_fetch_row($result)) { if ($k==1){ echo '<tr class="EvenTableRows">'; @@ -205,7 +209,7 @@ echo '<tr class="OddTableRows">'; $k++; } - + printf("<td>%s</td> <td>%s</td> <td>%s</td> @@ -221,127 +225,124 @@ $myrow[0], $_SERVER['PHP_SELF'] . '?' . SID . '&', $myrow[0]); - + }//END WHILE LIST LOOP echo '</table>'; } } //end of ifs and buts! -if (isset($SelectedCOGSPostingID)) { +if (isset($SelectedCOGSPostingID)) { echo "<div class='centre'><a href=" . $_SERVER['PHP_SELF'] .">" . _('Show all cost of sales posting records') . "</a></div>"; } echo "<p>"; -if (!isset($_GET['delete'])) { +echo "<form method='post' action=" . $_SERVER['PHP_SELF'] . ">"; - echo "<form method='post' action=" . $_SERVER['PHP_SELF'] . ">"; +if (isset($SelectedCOGSPostingID)) { + //editing an existing cost of sales posting record - if (isset($SelectedCOGSPostingID)) { - //editing an existing cost of sales posting record + $sql = "SELECT stkcat, + glcode, + area, + salestype + FROM cogsglpostings + WHERE id='".$SelectedCOGSPostingID."'"; - $sql = "SELECT stkcat, - glcode, - area, - salestype - FROM cogsglpostings - WHERE id=$SelectedCOGSPostingID"; + $result = DB_query($sql, $db); + $myrow = DB_fetch_array($result); - $result = DB_query($sql, $db); - $myrow = DB_fetch_array($result); + $_POST['GLCode'] = $myrow['glcode']; + $_POST['Area'] = $myrow['area']; + $_POST['StkCat'] = $myrow['stkcat']; + $_POST['SalesType'] = $myrow['salestype']; - $_POST['GLCode'] = $myrow['glcode']; - $_POST['Area'] = $myrow['area']; - $_POST['StkCat'] = $myrow['stkcat']; - $_POST['SalesType'] = $myrow['salestype']; + echo '<input type=hidden name="SelectedCOGSPostingID" VALUE="' . $SelectedCOGSPostingID . '">'; - echo '<input type=hidden name="SelectedCOGSPostingID" VALUE="' . $SelectedCOGSPostingID . '">'; +} //end of if $SelectedCOGSPostingID only do the else when a new record is being entered - } //end of if $SelectedCOGSPostingID only do the else when a new record is being entered +$sql = "SELECT areacode, + areadescription + FROM areas"; +$result = DB_query($sql,$db); - $sql = "SELECT areacode, - areadescription - FROM areas"; - $result = DB_query($sql,$db); +echo "<table class=selection><tr><td>" . _('Area') . ":</td><td><select tabindex=1 name='Area'><option value='AN'>" . _('Any Other'); - echo "<table><tr><td>" . _('Area') . ":</td><td><select tabindex=1 name='Area'><option value='AN'>" . _('Any Other'); +while ($myrow = DB_fetch_array($result)) { + if (isset($_POST['Area']) and $myrow['areacode']==$_POST['Area']) { + echo "<option selected VALUE='"; + } else { + echo "<option VALUE='"; + } + echo $myrow['areacode'] . "'>" . $myrow['areadescription']; - while ($myrow = DB_fetch_array($result)) { - if (isset($_POST['Area']) and $myrow['areacode']==$_POST['Area']) { - echo "<option selected VALUE='"; - } else { - echo "<option VALUE='"; - } - echo $myrow['areacode'] . "'>" . $myrow['areadescription']; +} //end while loop +DB_free_result($result); - } //end while loop - DB_free_result($result); +$sql = 'SELECT categoryid, categorydescription FROM stockcategory'; +$result = DB_query($sql,$db); - $sql = 'SELECT categoryid, categorydescription FROM stockcategory'; - $result = DB_query($sql,$db); +echo "</select></td></tr><tr><td>" . _('Stock Category') . ":</td><td><select tabindex=2 name='StkCat'> + <option VALUE='ANY'>" . _('Any Other'); - echo "</select></td></tr><tr><td>" . _('Stock Category') . ":</td><td><select tabindex=2 name='StkCat'> - <option VALUE='ANY'>" . _('Any Other'); +while ($myrow = DB_fetch_array($result)) { + if (isset($_POST['StkCat']) and $myrow["categoryid"]==$_POST['StkCat']) { + echo "<option selected VALUE='"; + } else { + echo "<option VALUE='"; + } + echo $myrow['categoryid'] . "'>" . $myrow['categorydescription']; - while ($myrow = DB_fetch_array($result)) { - if (isset($_POST['StkCat']) and $myrow["categoryid"]==$_POST['StkCat']) { - echo "<option selected VALUE='"; - } else { - echo "<option VALUE='"; - } - echo $myrow['categoryid'] . "'>" . $myrow['categorydescription']; +} //end while loop - } //end while loop +DB_free_result($result); - DB_free_result($result); +$sql = 'SELECT typeabbrev, sales_type FROM salestypes'; +$result = DB_query($sql,$db); - $sql = 'SELECT typeabbrev, sales_type FROM salestypes'; - $result = DB_query($sql,$db); +echo "</select></td></tr><tr><td>" . _('Sales Type') . " / " . _('Price List') . ":</td> + <td><select tabindex=3 name='SalesType'><option VALUE='AN'>" . _('Any Other'); - echo "</select></td></tr><tr><td>" . _('Sales Type') . " / " . _('Price List') . ":</td> - <td><select tabindex=3 name='SalesType'><option VALUE='AN'>" . _('Any Other'); +while ($myrow = DB_fetch_array($result)) { + if (isset($_POST['SalesType']) and $myrow['typeabbrev']==$_POST['SalesType']) { + echo "<option selected VALUE='"; + } else { + echo "<option VALUE='"; + } + echo $myrow["typeabbrev"] . "'>" . $myrow['sales_type']; - while ($myrow = DB_fetch_array($result)) { - if (isset($_POST['SalesType']) and $myrow['typeabbrev']==$_POST['SalesType']) { - echo "<option selected VALUE='"; - } else { - echo "<option VALUE='"; - } - echo $myrow["typeabbrev"] . "'>" . $myrow['sales_type']; +} //end while loop - } //end while loop +echo "</select></td></tr><tr><td>" . _('Post to GL account') . ":</td><td><select tabindex=4 name='GLCode'>"; - echo "</select></td></tr><tr><td>" . _('Post to GL account') . ":</td><td><select tabindex=4 name='GLCode'>"; +DB_free_result($result); +$sql = "SELECT chartmaster.accountcode, + chartmaster.accountname + FROM chartmaster, + accountgroups + WHERE chartmaster.group_=accountgroups.groupname + AND accountgroups.pandl=1 + ORDER BY accountgroups.sequenceintb, + chartmaster.accountcode, + chartmaster.accountname"; +$result = DB_query($sql,$db); - DB_free_result($result); - $sql = "SELECT chartmaster.accountcode, - chartmaster.accountname - FROM chartmaster, - accountgroups - WHERE chartmaster.group_=accountgroups.groupname - AND accountgroups.pandl=1 - ORDER BY accountgroups.sequenceintb, - chartmaster.accountcode, - chartmaster.accountname"; - $result = DB_query($sql,$db); +while ($myrow = DB_fetch_array($result)) { + if (isset($_POST['GLCode']) and $myrow['accountcode']==$_POST['GLCode']) { + echo "<option selected VALUE='"; + } else { + echo "<option VALUE='"; + } + echo $myrow['accountcode'] . "'>" . $myrow['accountcode'] . ' - ' . $myrow['accountname']; - while ($myrow = DB_fetch_array($result)) { - if (isset($_POST['GLCode']) and $myrow['accountcode']==$_POST['GLCode']) { - echo "<option selected VALUE='"; - } else { - echo "<option VALUE='"; - } - echo $myrow['accountcode'] . "'>" . $myrow['accountcode'] . ' - ' . $myrow['accountname']; +} //end while loop - } //end while loop +DB_free_result($result); - DB_free_result($result); +echo "</select></td></tr></table>"; +echo "<br><div class='centre'><input tabindex=5 type='Submit' name='submit' value=" . _('Enter Information') . "></form></div>"; - echo "</select></td></tr></table><div class='centre'><input tabindex=5 type='Submit' name='submit' value=" . _('Enter Information') . "></form></div>"; - -} //end if record deleted no point displaying form to add record - include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-04 21:59:47 UTC (rev 3555) +++ trunk/doc/Change.log.html 2010-07-04 22:00:12 UTC (rev 3556) @@ -1,6 +1,7 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> -<p>03/07/10 Tim: BOMs.php - Corrections to sql statements and layout changes</p> +<p>04/07/10 Tim: COGSGLPostings.php - Corrections to sql statements and layout changes</p> +<p>04/07/10 Tim: BOMs.php - Corrections to sql statements and layout changes</p> <p>03/07/10 Tim: BOMListing.php - Minor layout changes </p> <p>03/07/10 Tim: BOMInquiry.php - Minor bug fixes and layout changes </p> <p>03/07/10 Tim: BOMIndentedReverse.php - Layout changes </p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |