From: <tim...@us...> - 2010-07-19 11:51:53
|
Revision: 3639 http://web-erp.svn.sourceforge.net/web-erp/?rev=3639&view=rev Author: tim_schofield Date: 2010-07-19 11:51:46 +0000 (Mon, 19 Jul 2010) Log Message: ----------- Layout changes, sql quoting Modified Paths: -------------- trunk/PcAssignCashToTab.php trunk/doc/Change.log.html Modified: trunk/PcAssignCashToTab.php =================================================================== --- trunk/PcAssignCashToTab.php 2010-07-18 10:30:59 UTC (rev 3638) +++ trunk/PcAssignCashToTab.php 2010-07-19 11:51:46 UTC (rev 3639) @@ -4,7 +4,7 @@ $PageSecurity = 6; include('includes/session.inc'); -$title = _('Assignation of Cash to Petty Cash Tab'); +$title = _('Assignment of Cash to Petty Cash Tab'); include('includes/header.inc'); if (isset($_POST['SelectedTabs'])){ @@ -35,6 +35,9 @@ //initialise no input errors assumed initially before we test $InputError = 0; + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . + _('Search') . '" alt="">' . ' ' . $title. '</p>'; + /* actions to take once the user has clicked the submit button ie the page has called itself with some user input */ @@ -49,13 +52,13 @@ $sqlLimit = "SELECT tablimit FROM pctabs - WHERE tabcode='$SelectedTabs'"; + WHERE tabcode='" . $SelectedTabs . "'"; $ResultLimit = DB_query($sqlLimit,$db); $Limit=DB_fetch_array($ResultLimit); if (($_POST['CurrentAmount']+$_POST['Amount'])>$Limit['tablimit']){ - prnMsg('<br>' . _('The balance after this assignation would be greater than the specified limit for this PC tab'),'warning'); + prnMsg('<br>' . _('The balance after this assignment would be greater than the specified limit for this PC tab'),'warning'); } if ($InputError !=1 AND isset($SelectedIndex) ) { @@ -66,8 +69,8 @@ authorized = '0000-00-00', notes = '" . $_POST['Notes'] . "', receipt = '" . $_POST['Receipt'] . "' - WHERE counterindex = '$SelectedIndex'"; - $msg = _('Assignation of cash to PC Tab ') . ' ' . $SelectedTabs . ' ' . _('has been updated'); + WHERE counterindex = '" . $SelectedIndex . "'"; + $msg = _('Assignment of cash to PC Tab ') . ' ' . $SelectedTabs . ' ' . _('has been updated'); } elseif ($InputError !=1 ) { // Add new record on submit @@ -86,12 +89,12 @@ '".FormatDateForSQL($_POST['Date'])."', 'ASSIGNCASH', '" .$_POST['Amount'] . "', - '0000-00-00', + authorized = '0000-00-00', '0', '" . $_POST['Notes'] . "', '" . $_POST['Receipt'] . "' )"; - $msg = _('Assignation of cash to PC Tab ') . ' ' . $_POST["SelectedTabs"] . ' ' . _('has been created'); + $msg = _('Assignment of cash to PC Tab ') . ' ' . $_POST["SelectedTabs"] . ' ' . _('has been created'); } if ( $InputError !=1) { @@ -105,11 +108,14 @@ } } elseif ( isset($_GET['delete']) ) { + + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . + _('Search') . '" alt="">' . ' ' . $title. '</p>'; $sql="DELETE FROM pcashdetails - WHERE counterindex='$SelectedIndex'"; - $ErrMsg = _('The assignation of cash record could not be deleted because'); + WHERE counterindex='" . $SelectedIndex . "'"; + $ErrMsg = _('The assignment of cash record could not be deleted because'); $result = DB_query($sql,$db,$ErrMsg); - prnMsg(_('Assignation of cash to PC Tab ') . ' ' . $SelectedTabs . ' ' . _('has been deleted') ,'success'); + prnMsg(_('Assignment of cash to PC Tab ') . ' ' . $SelectedTabs . ' ' . _('has been deleted') ,'success'); unset($_GET['delete']); } @@ -119,10 +125,11 @@ then none of the above are true and the list of sales types 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*/ + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . + _('Search') . '" alt="">' . ' ' . $title. '</p>'; echo "<form method='post' action=" . $_SERVER['PHP_SELF'] . '?' . SID . '>'; - echo '<p><table border=1>'; //Main table - echo '<td><table>'; // First column + echo '<p><table class=selection>'; //Main table echo '<tr><td>' . _('Petty Cash Tab To Assign Cash') . ":</td><td><select name='SelectedTabs'>"; @@ -136,37 +143,30 @@ while ($myrow = DB_fetch_array($result)) { if (isset($_POST['SelectTabs']) and $myrow['tabcode']==$_POST['SelectTabs']) { - echo "<option selected VALUE='"; + echo "<option selected value='"; } else { - echo "<option VALUE='"; + echo "<option value='"; } echo $myrow['tabcode'] . "'>" . $myrow['tabcode']; } echo '</select></td></tr>'; - echo '</table>'; // close table in first column echo '</td></tr></table>'; // close main table - echo '<p><div class="centre"><input type=submit name=process VALUE="' . _('Accept') . '"><input type=submit name=Cancel VALUE="' . _('Cancel') . '"></div>'; + echo '<p><div class="centre"><input type=submit name=process VALUE="' . _('Accept') . '"><input type=submit name=Cancel value="' . _('Cancel') . '"></div>'; echo '</form>'; } //end of ifs and buts! -if (isset($_POST['process'])OR isset($SelectedTabs)) { +if (isset($_POST['process']) OR isset($SelectedTabs)) { - echo '<p><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '">' . _('Details Of Petty Cash Tab ') . '' .$SelectedTabs. '<a/></div><p>'; + if (!isset($_POST['submit'])) { + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . + _('Search') . '" alt="">' . ' ' . $title. '</p>'; + } + echo '<p><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '">' . _('Details Of Petty Cash Tab ') . '' .$SelectedTabs. '<a/></div>'; if (! isset($_GET['edit']) OR isset ($_POST['GO'])){ - echo "<form method='post' action=" . $_SERVER['PHP_SELF'] . '?' . SID . '>'; - echo "<div class='centre'><p>" . _('Detail Of PC Tab Movements For Last ') .': '; - if(!isset ($Days)){ - $Days=30; - } - echo "<input type=hidden name='SelectedTabs' VALUE=" . $SelectedTabs . ">"; - echo "<input type=text class=number name='Days' VALUE=" . $Days . " MAXLENGTH =3 size=4> Days "; - echo '<input type=submit name="Go" value="' . _('Go') . '">'; - echo '<p></div></form>'; - if (isset($_POST['Cancel'])) { unset($_POST['Amount']); unset($_POST['Date']); @@ -188,20 +188,29 @@ AND pcashdetails.date >=DATE_SUB(CURDATE(), INTERVAL ".$Days." DAY) ORDER BY pcashdetails.counterindex Asc"; */ + if(!isset ($Days)){ + $Days=30; + } $sql = "SELECT * FROM pcashdetails - WHERE tabcode='$SelectedTabs' - AND date >=DATE_SUB(CURDATE(), INTERVAL ".$Days." DAY) + WHERE tabcode='" . $SelectedTabs . "' + AND date >=DATE_SUB(CURDATE(), INTERVAL '".$Days."' DAY) ORDER BY date, counterindex ASC"; $result = DB_query($sql,$db); - echo '<br><table BORDER=1>'; + echo '<table class=selection>'; + echo "<form method='post' action=" . $_SERVER['PHP_SELF'] . '?' . SID . '>'; + echo "<tr><th colspan=8>" . _('Detail Of PC Tab Movements For Last ') .': '; + echo "<input type=hidden name='SelectedTabs' value=" . $SelectedTabs . ">"; + echo "<input type=text class=number name='Days' value=" . $Days . " maxlength =3 size=4> Days "; + echo '<input type=submit name="Go" value="' . _('Go') . '">'; + echo '</th></tr></form>'; echo "<tr> <th>" . _('Date') . "</th> <th>" . _('Expense Code') . "</th> <th>" . _('Amount') . "</th> - <th>" . _('Authorized') . "</th> + <th>" . _('Authorised') . "</th> <th>" . _('Notes') . "</th> <th>" . _('Receipt') . "</th> </tr>"; @@ -230,44 +239,34 @@ if (($myrow['5'] == "0000-00-00") and ($Description['0'] == 'ASSIGNCASH')){ // only cash assignations NOT authorized can be modified or deleted - printf("<td>%s</td> - <td>%s</td> - <td class=number>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td><a href='%sSelectedIndex=%s&SelectedTabs=$SelectedTabs&Days=$Days&edit=yes'>" . _('Edit') . "</td> - <td><a href='%sSelectedIndex=%s&SelectedTabs=$SelectedTabs&Days=$Days&delete=yes' onclick=\"return confirm('" . _('Are you sure you wish to delete this code and the expense it may have set up?') . "');\">" . _('Delete') . "</td> - </tr>", - ConvertSQLDate($myrow['2']), - $Description['0'], - number_format($myrow['4'],2), - ConvertSQLDate($myrow['5']), - $myrow['7'], - $myrow['8'], - $_SERVER['PHP_SELF'] . '?' . SID, $myrow['0'], - $_SERVER['PHP_SELF'] . '?' . SID, $myrow['0']); + echo "<td>".ConvertSQLDate($myrow['2'])."</td> + <td>".$Description['0']."</td> + <td class=number>".number_format($myrow['4'],2)."</td> + <td>".ConvertSQLDate($myrow['5'])."</td> + <td>".$myrow['7']."</td> + <td>".$myrow['8']."</td> + <td><a href='".$_SERVER['PHP_SELF'] . '?' . SID ."SelectedIndex=".$myrow['0']."&SelectedTabs=" . + $SelectedTabs . "&Days=" . $Days . "&edit=yes'>" . _('Edit') . "</td> + <td><a href='".$_SERVER['PHP_SELF'] . '?' . SID ."SelectedIndex=".$myrow['0']."&SelectedTabs=" . + $SelectedTabs . "&Days=" . $Days . "&delete=yes' onclick=\"return confirm('" . + _('Are you sure you wish to delete this code and the expense it may have set up?') . "');\">" . + _('Delete') . "</td> + </tr>"; }else{ - printf("<td>%s</td> - <td>%s</td> - <td class=number>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - </tr>", - ConvertSQLDate($myrow['2']), - $Description['0'], - number_format($myrow['4'],2), - ConvertSQLDate($myrow['5']), - $myrow['7'], - $myrow['8']); + echo "<td>".ConvertSQLDate($myrow['2'])."</td> + <td>".$Description['0']."</td> + <td class=number>".number_format($myrow['4'],2)."</td> + <td>".ConvertSQLDate($myrow['5'])."</td> + <td>".ConvertSQLDate($myrow['5'])."</td> + <td>".$myrow['7']."</td> + </tr>"; } } //END WHILE LIST LOOP $sqlamount="SELECT sum(amount) FROM pcashdetails - WHERE tabcode='$SelectedTabs'"; + WHERE tabcode='".$SelectedTabs."'"; $ResultAmount = DB_query($sqlamount,$db); $Amount=DB_fetch_array($ResultAmount); @@ -276,8 +275,8 @@ $Amount['0']=0; } - echo "<tr><td colspan=4 style=text-align:right >" . _('Current balance') . ":</td> - <td colspan=2>".number_format($Amount['0'],2)."</td></tr>"; + echo "<tr><td colspan=2 style=text-align:right ><b>" . _('Current balance') . ":</b></td> + <td>".number_format($Amount['0'],2)."</td></tr>"; echo '</table>'; @@ -285,14 +284,21 @@ if (! isset($_GET['delete'])) { + if (!isset($Amount['0'])) { + $Amount['0']=0; + } + echo "<form method='post' action=" . $_SERVER['PHP_SELF'] . '?' . SID . '>'; - echo '<p><table border=1>'; //Main table - echo '<td><table>'; // First column - + echo '<p><table class=selection>'; //Main table + if (isset($_GET['SelectedIndex'])) { + echo "<tr><th colspan=2><font color=blue size=3>"._('Update Cash Assignment')."</font></th></tr>"; + } else { + echo "<tr><th colspan=2><font color=blue size=3>"._('New Cash Assignment')."</font></th></tr>"; + } if ( isset($_GET['edit'])) { $sql = "SELECT * FROM pcashdetails - WHERE counterindex='$SelectedIndex'"; + WHERE counterindex='".$SelectedIndex."'"; $result = DB_query($sql, $db); $myrow = DB_fetch_array($result); @@ -303,10 +309,10 @@ $_POST['Notes'] = $myrow['notes']; $_POST['Receipt'] = $myrow['receipt']; - echo "<input type=hidden name='SelectedTabs' VALUE=" . $SelectedTabs . ">"; - echo "<input type=hidden name='SelectedIndex' VALUE=" . $SelectedIndex. ">"; - echo "<input type=hidden name='CurrentAmount' VALUE=" . $Amount['0']. ">"; - echo "<input type=hidden name='Days' VALUE=" .$Days. ">"; + echo "<input type=hidden name='SelectedTabs' value=" . $SelectedTabs . ">"; + echo "<input type=hidden name='SelectedIndex' value=" . $SelectedIndex. ">"; + echo "<input type=hidden name='CurrentAmount' value=" . $Amount[0]. ">"; + echo "<input type=hidden name='Days' value=" .$Days. ">"; } /* Ricard: needs revision of this date initialization */ @@ -337,14 +343,13 @@ echo "<tr><td>" . _('Receipt') . ":</td><td><input type='Text' name='Receipt' size=50 maxlength=49 value='" . $_POST['Receipt'] . "'></td></tr>"; - echo "<input type=hidden name='CurrentAmount' VALUE=" . $Amount['0']. ">"; - echo "<input type=hidden name='SelectedTabs' VALUE=" . $SelectedTabs . ">"; - echo "<input type=hidden name='Days' VALUE=" .$Days. ">"; + echo "<input type=hidden name='CurrentAmount' value=" . $Amount['0']. ">"; + echo "<input type=hidden name='SelectedTabs' value=" . $SelectedTabs . ">"; + echo "<input type=hidden name='Days' value=" .$Days. ">"; - echo '</table>'; // close table in first column echo '</td></tr></table>'; // close main table - echo '<p><div class="centre"><input type=submit name=submit VALUE="' . _('Accept') . '"><input type=submit name=Cancel VALUE="' . _('Cancel') . '"></div>'; + echo '<p><div class="centre"><input type=submit name=submit value="' . _('Accept') . '"><input type=submit name=Cancel value="' . _('Cancel') . '"></div>'; echo '</form>'; Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-18 10:30:59 UTC (rev 3638) +++ trunk/doc/Change.log.html 2010-07-19 11:51:46 UTC (rev 3639) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>18/07/10 Tim: PCAssignCashToTab.php - Layout changes, sql quoting</p> <p>18/07/10 Tim: StockAdjustments.php - Provide option for tagging stock adjustments, change layout, allow for searching for a part code, and sql quoting</p> <p>18/07/10 Phil: CounterSales.php - was not retrieving ReceiptNumber if the debtor integration was disabled - also the correct period was not retrieved because the date format was not in the correct DateFormat because of a typo in SESSION['DefaultDateFormat'] </p> <p>18/07/10 Phil: New script ContractBOM.php to allow defining the bill of materials for a contract</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |