From: <dai...@us...> - 2011-10-08 09:45:06
|
Revision: 4715 http://web-erp.svn.sourceforge.net/web-erp/?rev=4715&view=rev Author: daintree Date: 2011-10-08 09:44:56 +0000 (Sat, 08 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/PcAuthorizeExpenses.php trunk/PcExpenses.php trunk/RecurringSalesOrders.php trunk/ReorderLevel.php trunk/ReorderLevelLocation.php trunk/ReprintGRN.php trunk/ReverseGRN.php trunk/SalesAnalReptCols.php trunk/SalesAnalRepts.php trunk/SalesAnalysis_UserDefined.php trunk/SelectSalesOrder.php trunk/doc/Change.log trunk/includes/ConnectDB.inc trunk/includes/ConstructSQLForUserDefinedSalesReport.inc trunk/includes/PDFSalesAnalysis.inc trunk/sql/mysql/upgrade4.05-4.06.sql Modified: trunk/PcAuthorizeExpenses.php =================================================================== --- trunk/PcAuthorizeExpenses.php 2011-10-06 09:16:44 UTC (rev 4714) +++ trunk/PcAuthorizeExpenses.php 2011-10-08 09:44:56 UTC (rev 4715) @@ -57,7 +57,7 @@ echo '<br /><table class=selection>'; echo '<tr><th colspan=7>' . _('Detail Of Movement For Last ') .': '; echo '<input type="text" class="number" name="Days" value="' . $Days . '" maxlength="3" size="4" />' . _('Days'); - echo '<input type=submit name="Go" value="' . _('Go') . '"></tr></th>'; + echo '<input type="submit" name="Go" value="' . _('Go') . '"></tr></th>'; echo '</form>'; $sql = "SELECT pcashdetails.counterindex, @@ -101,7 +101,9 @@ while ($myrow=DB_fetch_array($result)) { $CurrDecimalPlaces = $myrow['decimalplaces']; //update database if update pressed - if ((isset($_POST['Submit']) AND $_POST['Submit']=='Update') AND isset($_POST[$myrow['counterindex']])){ + if ((isset($_POST['Submit']) + AND $_POST['Submit']=='Update') + AND isset($_POST[$myrow['counterindex']])){ $PeriodNo = GetPeriod(ConvertSQLDate($myrow['date']), $db); @@ -119,12 +121,14 @@ $type = 1; $Amount = -$Amount; $AccountFrom = $myrow['glaccountpcash']; - $SQLAccExp = "SELECT glaccount + $SQLAccExp = "SELECT glaccount, + tag FROM pcexpenses WHERE codeexpense = '".$myrow['codeexpense']."'"; $ResultAccExp = DB_query($SQLAccExp,$db); $myrowAccExp = DB_fetch_array($ResultAccExp); $AccountTo = $myrowAccExp['glaccount']; + $TagTo = $myrowAccExp['tag']; } //get typeno @@ -158,7 +162,7 @@ '".-$Amount."', 0, '', - 0)"; + '" . $TagTo ."')"; $ResultFrom = DB_Query($sqlFrom, $db, '', '', true); @@ -185,7 +189,7 @@ '".$Amount."', 0, '', - 0)"; + '" . $TagTo ."')"; $ResultTo = DB_Query($sqlTo, $db, '', '', true); @@ -253,13 +257,13 @@ if(($Authoriser!='00/00/0000')){ echo'<td>'.ConvertSQLDate($myrow['authorized']).'</td>'; }else{ - echo '<td align=right><input type="checkbox" name="'.$myrow['counterindex'].'">'; + echo '<td align=right><input type="checkbox" name="'.$myrow['counterindex'].'" /></td>'; } } - echo '<input type="hidden" name="SelectedIndex" value="' . $myrow['counterindex']. '">'; - echo '<input type="hidden" name="SelectedTabs" value="' . $SelectedTabs . '">'; - echo '<input type="hidden" name="Days" value="' .$Days. '">'; + echo '<input type="hidden" name="SelectedIndex" value="' . $myrow['counterindex']. '" />'; + echo '<input type="hidden" name="SelectedTabs" value="' . $SelectedTabs . '" />'; + echo '<input type="hidden" name="Days" value="' .$Days. '" />'; echo'</tr>'; Modified: trunk/PcExpenses.php =================================================================== --- trunk/PcExpenses.php 2011-10-06 09:16:44 UTC (rev 4714) +++ trunk/PcExpenses.php 2011-10-08 09:44:56 UTC (rev 4715) @@ -20,6 +20,7 @@ unset($_POST['CodeExpense']); unset($_POST['Description']); unset($_POST['GLAccount']); + unset($_POST['Tag']); } @@ -85,10 +86,11 @@ if (isset($SelectedExpense) AND $InputError !=1) { - $sql = "UPDATE pcexpenses - SET description = '" . DB_escape_string($_POST['Description']) . "', - glaccount = '" . $_POST['GLAccount'] . "' - WHERE codeexpense = '" . $SelectedExpense . "'"; + $sql = "UPDATE pcexpenses + SET description = '" . DB_escape_string($_POST['Description']) . "', + glaccount = '" . $_POST['GLAccount'] . "', + tag = '" . $_POST['Tag'] . "' + WHERE codeexpense = '" . $SelectedExpense . "'"; $msg = _('The Expenses type') . ' ' . $SelectedExpense . ' ' . _('has been updated'); } elseif ( $InputError !=1 ) { @@ -111,11 +113,14 @@ $sql = "INSERT INTO pcexpenses (codeexpense, - description,glaccount) + description, + glaccount, + tag) VALUES ('" . $_POST['CodeExpense'] . "', '" . DB_escape_string($_POST['Description']) . "', - '" . $_POST['GLAccount'] . "')"; - + '" . $_POST['GLAccount'] . "', + '" . $_POST['Tag'] . "')"; + $msg = _('Expense ') . ' ' . $_POST['CodeExpense'] . ' ' . _('has been created'); $checkSql = "SELECT count(codeexpense) FROM pcexpenses"; @@ -134,6 +139,7 @@ unset($_POST['CodeExpense']); unset($_POST['Description']); unset($_POST['GLAccount']); + unset($_POST['Tag']); } } elseif ( isset($_GET['delete']) ) { @@ -181,6 +187,7 @@ <th>' . _('Description') . '</th> <th>' . _('Account Code') . '</th> <th>' . _('Account Description') . '</th> + <th>' . _('Tag') . '</th> </tr>'; $k=0; //row colour counter @@ -200,20 +207,29 @@ $ResultDes = DB_query($sqldesc,$db); $Description=DB_fetch_array($ResultDes); + + $SqlDescTag="SELECT tagdescription + FROM tags + WHERE tagref='". $myrow[3] . "'"; + $ResultDesTag = DB_query($SqlDescTag,$db); + $DescriptionTag=DB_fetch_array($ResultDesTag); + printf('<td>%s</td> - <td>%s</td> - <td class="number">%s</td> - <td>%s</td> - <td><a href="%sSelectedExpense=%s">' . _('Edit') . '</td> - <td><a href="%sSelectedExpense=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this expense code and all the details it may have set up?') . '\');">' . _('Delete') . '</td> - </tr>', - $myrow[0], - $myrow[1], - $myrow[2], - $Description[0], - $_SERVER['PHP_SELF'] . '?', $myrow[0], - $_SERVER['PHP_SELF'] . '?', $myrow[0]); + <td>%s</td> + <td class="number">%s</td> + <td>%s</td> + <td>%s</td> + <td><a href="%sSelectedExpense=%s">' . _('Edit') . '</td> + <td><a href="%sSelectedExpense=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this expense code and all the details it may have set up?') . '\');">' . _('Delete') . '</td> + </tr>', + $myrow[0], + $myrow[1], + $myrow[2], + $Description['accountname'], + $DescriptionTag['tagdesciption'], + $_SERVER['PHP_SELF'] . '?', $myrow[0], + $_SERVER['PHP_SELF'] . '?', $myrow[0]); } //END WHILE LIST LOOP echo '</table>'; @@ -228,14 +244,15 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<p><table class=selection>'; //Main table + echo '<p><table class="selection">'; //Main table // The user wish to EDIT an existing type if ( isset($SelectedExpense) AND $SelectedExpense!='' ){ $sql = "SELECT codeexpense, description, - glaccount + glaccount, + tag FROM pcexpenses WHERE codeexpense='" . $SelectedExpense . "'"; @@ -245,6 +262,7 @@ $_POST['CodeExpense'] = $myrow['codeexpense']; $_POST['Description'] = $myrow['description']; $_POST['GLAccount'] = $myrow['glaccount']; + $_POST['Tag'] = $myrow['tag']; echo '<input type=hidden name="SelectedExpense" value="' . $SelectedExpense . '">'; echo '<input type=hidden name="CodeExpense" VALUE="' . $_POST['CodeExpense']. '">'; @@ -274,7 +292,9 @@ <td><input type="text" ' . (in_array('Description',$Errors) ? 'class="inputerror"' : '' ) . ' name="Description" size=50 maxlength=49 value="' . $_POST['Description'] . '"></td> </tr>'; - echo '<tr><td>' . _('Account Code') . ':</td><td><select name="GLAccount">'; + echo '<tr> + <td>' . _('Account Code') . ':</td> + <td><select name="GLAccount">'; DB_free_result($result); $SQL = "SELECT accountcode, @@ -294,11 +314,34 @@ } //end while loop echo '</select></td></tr>'; + + //Select the tag + DB_free_result($result); + echo '<tr> + <td>' . _('Tag') . ':</td> + <td><select name="Tag">'; + $SQL = "SELECT tagref, + tagdescription + FROM tags + ORDER BY tagref"; + + $result=DB_query($SQL,$db); + echo '<option value="0">0 - ' . _('None') . '</option>'; + while ($myrow=DB_fetch_array($result)){ + if (isset($_POST['Tag']) and $_POST['Tag']==$myrow['tagref']){ + echo '<option selected value="' . $myrow['tagref'] . '">' . $myrow['tagref'].' - ' .$myrow['tagdescription'].'</option>'; + } else { + echo '<option value="' . $myrow['tagref'] . '">' . $myrow['tagref'].' - ' .$myrow['tagdescription'] . '</option>'; + } + } + echo '</select></td>'; + // End select tag + 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/RecurringSalesOrders.php =================================================================== --- trunk/RecurringSalesOrders.php 2011-10-06 09:16:44 UTC (rev 4714) +++ trunk/RecurringSalesOrders.php 2011-10-08 09:44:56 UTC (rev 4715) @@ -160,11 +160,11 @@ if (isset($_POST['DeleteRecurringOrder'])){ - $sql = "DELETE FROM recurrsalesorderdetails WHERE recurrorderno='" . filter_number_format($_POST['ExistingRecurrOrderNo']) . "'"; + $sql = "DELETE FROM recurrsalesorderdetails WHERE recurrorderno='" . $_POST['ExistingRecurrOrderNo'] . "'"; $ErrMsg = _('Could not delete recurring sales order lines for the recurring order template') . ' ' . $_POST['ExistingRecurrOrderNo']; $result = DB_query($sql,$db,$ErrMsg); - $sql = "DELETE FROM recurringsalesorders WHERE recurrorderno='" . filter_number_format($_POST['ExistingRecurrOrderNo']) . "'"; + $sql = "DELETE FROM recurringsalesorders WHERE recurrorderno='" . $_POST['ExistingRecurrOrderNo'] . "'"; $ErrMsg = _('Could not delete the recurring sales order template number') . ' ' . $_POST['ExistingRecurrOrderNo']; $result = DB_query($sql,$db,$ErrMsg); @@ -287,7 +287,7 @@ stopdate = '" . FormatDateforSQL($_POST['StopDate']) . "', frequency = '" . $_POST['Frequency'] . "', autoinvoice = '" . $_POST['AutoInvoice'] . "' - WHERE recurrorderno = '" . filter_number_format($_POST['ExistingRecurrOrderNo']) . "'"; + WHERE recurrorderno = '" . $_POST['ExistingRecurrOrderNo'] . "'"; $ErrMsg = _('The recurring order cannot be updated because'); $UpdateQryResult = DB_query($HeaderSQL,$db,$ErrMsg); @@ -420,7 +420,7 @@ echo '<tr> <td>'. _('Last Recurrence') . ':</td> <td>' . $_POST['StartDate'] . '</td></tr>'; - echo '<input type=hidden name="StartDate" value="' . $_POST['StartDate'] . '">'; + echo '<input type="hidden" name="StartDate" value="' . $_POST['StartDate'] . '">'; } if (!isset($_POST['StopDate'])){ @@ -486,7 +486,7 @@ } echo '</select></td></tr>'; } else { - echo '<input type=hidden name="AutoInvoice" value=0>'; + echo '<input type="hidden" name="AutoInvoice" value=0>'; } echo '</table>'; @@ -496,8 +496,8 @@ echo '<input type="hidden" name="NewRecurringOrder" value="Yes" />'; echo '<input type="submit" name="Process" value="' . _('Create Recurring Order') . '" />'; } else { - echo '<input type=hidden name="NewRecurringOrder" value="No">'; - echo '<input type=hidden name="ExistingRecurrOrderNo" value="' . $_POST['ExistingRecurrOrderNo'] . '" />'; + echo '<input type="hidden" name="NewRecurringOrder" value="No">'; + echo '<input type="hidden" name="ExistingRecurrOrderNo" value="' . $_POST['ExistingRecurrOrderNo'] . '" />'; echo '<input type="submit" name="Process" value="' . _('Update Recurring Order Details') . '" />'; echo '<hr>'; Modified: trunk/ReorderLevel.php =================================================================== --- trunk/ReorderLevel.php 2011-10-06 09:16:44 UTC (rev 4714) +++ trunk/ReorderLevel.php 2011-10-08 09:44:56 UTC (rev 4715) @@ -170,7 +170,10 @@ locationname FROM locations"; $resultStkLocs = DB_query($sql,$db); - echo '<table class=selection><tr><td>' . _('From Stock Location') . ':</td><td><select name="StockLocation"> '; + echo '<table class="selection"> + <tr> + <td>' . _('From Stock Location') . ':</td> + <td><select name="StockLocation"> '; if (!isset($_POST['StockLocation'])){ $_POST['StockLocation']='All'; } @@ -200,7 +203,9 @@ exit; } - echo '<tr><td>' . _('In Stock Category') . ':</td><td><select name="StockCat">'; + echo '<tr> + <td>' . _('In Stock Category') . ':</td> + <td><select name="StockCat">'; if (!isset($_POST['StockCat'])){ $_POST['StockCat']='All'; } @@ -217,7 +222,11 @@ } } echo '</select></td></tr>'; - echo '</table><br /><div class="centre"><input type=submit name="PrintPDF" value="' . _('Print PDF') . '"></div>'; + echo '</table> + <br /> + <div class="centre"> + <input type=submit name="PrintPDF" value="' . _('Print PDF') . '" /> + </div>'; include('includes/footer.inc'); Modified: trunk/ReorderLevelLocation.php =================================================================== --- trunk/ReorderLevelLocation.php 2011-10-06 09:16:44 UTC (rev 4714) +++ trunk/ReorderLevelLocation.php 2011-10-08 09:44:56 UTC (rev 4715) @@ -60,19 +60,20 @@ $Location=DB_fetch_array($ResultLocation); echo'<p class="page_title_text" align="center"><strong>' . _('Location : ') . '' . $Location['locationname'] . ' </strong></p>'; - echo'<p class="page_title_text" align="center"><strong>' . _('Number Of Days Sales : ') . '' . $_POST['NumberOfDays'] . '' . _(' Days ') . ' </strong></p>'; + echo'<p class="page_title_text" align="center"><strong>' . _('Number Of Days Sales : ') . '' . locale_number_format($_POST['NumberOfDays'],0) . '' . _(' Days ') . ' </strong></p>'; echo '<table>'; - echo '<tr><th>' . _('Code') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Total Invoiced').'<br />'._('At All Locations') . '</th> - <th>' . _('Total Invoiced').'<br />'._('At Location') . '</th> - <th>' . _('On Hand') .'<br />'._('At All Locations') . '</th> - <th>' . _('On Hand') .'<br />' ._('At Location') . '</th> - <th>' . _('Reorder Level') . '</th> - <tr>'; + echo '<tr> + <th>' . _('Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Total Invoiced').'<br />'._('At All Locations') . '</th> + <th>' . _('Total Invoiced').'<br />'._('At Location') . '</th> + <th>' . _('On Hand') .'<br />'._('At All Locations') . '</th> + <th>' . _('On Hand') .'<br />' ._('At Location') . '</th> + <th>' . _('Reorder Level') . '</th> + <tr>'; $k=0; //row colour counter - echo'<form action="ReorderLevelLocation.php" method="POST" name="update">'; + echo'<form action="ReorderLevelLocation.php" method="post" name="update">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; $i=1; while ($myrow=DB_fetch_array($result)) { @@ -88,9 +89,9 @@ //variable for update data echo'<input type="hidden" value=' . $_POST['order'] . ' name='. _('order').' /> - <input type="hidden" value="' . $_POST['StockLocation'] . '" name="StockLocation" /> - <input type="hidden" value="' . $_POST['StockCat'] . '" name="StockCat" /> - <input type="hidden" value="' . $_POST['NumberOfDays'] . '" name="NumberOfDays" />'; + <input type="hidden" value="' . $_POST['StockLocation'] . '" name="StockLocation" /> + <input type="hidden" value="' . $_POST['StockCat'] . '" name="StockCat" /> + <input type="hidden" value="' . locale_number_format($_POST['NumberOfDays'],0) . '" name="NumberOfDays" />'; //get qtyinvoice all $sqlinv="SELECT sum(salesorderdetails.qtyinvoiced)as qtyinvoice @@ -138,13 +139,13 @@ <td class="number">'.$QtyInvoice.'</td> <td class="number">'.$ohRow['0'].'</td> <td class="number">'.$ohinRow['0'].'</td> - <td><input type="text" class="number" name="ReorderLevel' . $i .'" maxlength="3" size="4" value="'. $myrow['reorderlevel'] .'" /> + <td><input type="text" class="number" name="ReorderLevel' . $i .'" maxlength="3" size="4" value="'. locale_number_format($myrow['reorderlevel'],0) .'" /> <input type="hidden" name="StockID' . $i . '" value="' . $myrow['stockid'] . '" /></td> </tr> '; $i++; } //end of looping echo'<tr> - <td style="text-align:center" colspan=7><input type="submit" name="submit" value=' . _('Update') . ' /></td> + <td style="text-align:center" colspan="7"><input type="submit" name="submit" value=' . _('Update') . ' /></td> </tr> </form>'; @@ -191,14 +192,21 @@ echo'<tr> <td>' . _('Number Of Days Sales') . ':</td> <td><input type="text" class="number" name="NumberOfDays" maxlength="3" size="4" value="0" /></td>'; - echo '<tr><td>' . _('Order By') . ':</td> - <td><select name="order">'; - echo '<option value="1">'. _('Total Invoiced') . '</option>'; - echo '<option value="2">'. _('Item Code') . '</option>'; + echo '<tr> + <td>' . _('Order By') . ':</td> + <td><select name="order"> + <option value="1">'. _('Total Invoiced') . '</option> + <option value="2">'. _('Item Code') . '</option> + </select></td> + </tr>'; + echo '</table> + <br /> + <p> + <div class="centre"> + <input type="submit" name="submit" value="' . _('Submit') . '"> + </div> + </p>'; - echo '</select></td></tr>'; - echo '</table><br /><p><div class="centre"><input type="submit" name="submit" value="' . _('Submit') . '"></div></p>'; - } /*end of else not submit */ include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/ReprintGRN.php =================================================================== --- trunk/ReprintGRN.php 2011-10-06 09:16:44 UTC (rev 4714) +++ trunk/ReprintGRN.php 2011-10-08 09:44:56 UTC (rev 4715) @@ -13,15 +13,20 @@ echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<table class="selection">'; -echo '<tr><th colspan="2"><font size="2" color="navy">' . _('Select a purchase order') . '</th></tr>'; -echo '<tr><td>' . _('Enter a Purchase Order Number') . '</td>'; -echo '<td>' . '<input type="text" name="PONumber" class="number" size="7" value="'.$_POST['PONumber'].'" /></td></tr>'; -echo '<tr><td colspan=2 style="text-align: center"><input type="submit" name="Show" value="Show GRNs" /></td></tr>'; +echo '<table class="selection"> + <tr> + <th colspan="2"><font size="2" color="navy">' . _('Select a purchase order') . '</th> + </tr> + <tr> + <td>' . _('Enter a Purchase Order Number') . '</td> + <td>' . '<input type="text" name="PONumber" class="number" size="7" value="'.$_POST['PONumber'].'" /></td> + </tr> + <tr> + <td colspan="2" style="text-align: center"><input type="submit" name="Show" value="' . _('Show GRNs') . '" /></td> + </tr> + </table> + </form>'; -echo '</table>'; -echo '</form>'; - if (isset($_POST['Show'])) { if ($_POST['PONumber']=='') { echo '<br />'; @@ -64,15 +69,21 @@ exit; } $k=0; - echo '<br /><table class="selection">'; - echo '<tr><th colspan="8"><font size="2" color="navy">' . _('GRNs for Purchase Order No') .' ' . $_POST['PONumber'] . '</th></tr>'; - echo '<tr><th>' . _('Supplier') . '</th>'; - echo '<th>' . _('PO Order line') . '</th>'; - echo '<th>' . _('GRN Number') . '</th>'; - echo '<th>' . _('Item Code') . '</th>'; - echo '<th>' . _('Item Description') . '</th>'; - echo '<th>' . _('Delivery Date') . '</th>'; - echo '<th>' . _('Quantity Received') . '</th></tr>'; + echo '<br /> + <table class="selection"> + <tr> + <th colspan="8"><font size="2" color="navy">' . _('GRNs for Purchase Order No') .' ' . $_POST['PONumber'] . '</th> + </tr> + <tr> + <th>' . _('Supplier') . '</th> + <th>' . _('PO Order line') . '</th> + <th>' . _('GRN Number') . '</th> + <th>' . _('Item Code') . '</th> + <th>' . _('Item Description') . '</th> + <th>' . _('Delivery Date') . '</th> + <th>' . _('Quantity Received') . '</th> + </tr>'; + while ($myrow=DB_fetch_array($result)) { if ($k==1){ echo '<tr class="EvenTableRows">'; @@ -81,15 +92,15 @@ echo '<tr class="OddTableRows">'; $k=1; } - echo '<td>' . $myrow['suppname'] . '</td>'; - echo '<td class="number">' . $myrow['podetailitem'] . '</td>'; - echo '<td class="number">' . $myrow['grnbatch'] . '</td>'; - echo '<td>' . $myrow['itemcode'] . '</td>'; - echo '<td>' . $myrow['itemdescription'] . '</td>'; - echo '<td>' . $myrow['deliverydate'] . '</td>'; - echo '<td class="number">' . locale_number_format($myrow['qtyrecd'], $myrow['decimalplaces']) . '</td>'; - echo '<td><a href="PDFGrn.php?GRNNo=' . $myrow['grnbatch'] .'&PONo=' . $_POST['PONumber'] . '">' . _('Reprint') . '</a></td>'; - echo '</tr>'; + echo '<td>' . $myrow['suppname'] . '</td> + <td class="number">' . $myrow['podetailitem'] . '</td> + <td class="number">' . $myrow['grnbatch'] . '</td> + <td>' . $myrow['itemcode'] . '</td> + <td>' . $myrow['itemdescription'] . '</td> + <td>' . $myrow['deliverydate'] . '</td> + <td class="number">' . locale_number_format($myrow['qtyrecd'], $myrow['decimalplaces']) . '</td> + <td><a href="PDFGrn.php?GRNNo=' . $myrow['grnbatch'] .'&PONo=' . $_POST['PONumber'] . '">' . _('Reprint') . '</a></td> + </tr>'; } echo '</table>'; } Modified: trunk/ReverseGRN.php =================================================================== --- trunk/ReverseGRN.php 2011-10-06 09:16:44 UTC (rev 4714) +++ trunk/ReverseGRN.php 2011-10-08 09:44:56 UTC (rev 4715) @@ -12,8 +12,11 @@ if ((isset($_SESSION['SupplierID']) AND $_SESSION['SupplierID']!='') OR (!isset($_POST['SupplierID']) OR $_POST['SupplierID'])==''){ + $_POST['SupplierID']=$_SESSION['SupplierID']; + } + if (!isset($_POST['SupplierID']) OR $_POST['SupplierID']==""){ echo '<br />' . _('This page is expected to be called after a supplier has been selected'); echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/SelectSupplier.php">'; @@ -25,8 +28,7 @@ $_POST['SuppName'] = $SuppRow[0]; } -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Sales') . - '" alt="" />' . ' ' . _('Reverse Goods Received from') . ' ' . $_POST['SuppName'] . '</p> '; +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Sales') . '" alt="" />' . ' ' . _('Reverse Goods Received from') . ' ' . $_POST['SuppName'] . '</p> '; if (isset($_GET['GRNNo']) AND isset($_POST['SupplierID'])){ /* SQL to process the postings for the GRN reversal.. */ @@ -48,7 +50,7 @@ ON grns.podetailitem=purchorderdetails.podetailitem INNER JOIN purchorders ON purchorderdetails.orderno = purchorders.orderno - WHERE AND grnno='" . filter_number_format($_GET['GRNNo']) . "'"; + WHERE AND grnno='" . $_GET['GRNNo'] . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Could not get the details of the GRN selected for reversal because') . ' '; $DbgMsg = _('The following SQL to retrieve the GRN details was used') . ':'; @@ -59,7 +61,8 @@ $QtyToReverse = $GRN['qtyrecd'] - $GRN['quantityinv']; if ($QtyToReverse ==0){ - echo '<br /><br />' . _('The GRN') . ' ' . $_GET['GRNNo'] . ' ' . _('has already been reversed or fully invoiced by the supplier - it cannot be reversed - stock quantities must be corrected by stock adjustments - the stock is paid for'); + echo '<br /> + <br />' . _('The GRN') . ' ' . $_GET['GRNNo'] . ' ' . _('has already been reversed or fully invoiced by the supplier - it cannot be reversed - stock quantities must be corrected by stock adjustments - the stock is paid for'); include ('includes/footer.inc'); exit; } @@ -118,7 +121,7 @@ /*Now the SQL to do the update to the PurchOrderDetails */ $SQL = "UPDATE purchorderdetails - SET quantityrecd = quantityrecd - '" . filter_number_format($QtyToReverse) . "', + SET quantityrecd = quantityrecd - '" . $QtyToReverse . "', completed=0 WHERE purchorderdetails.podetailitem = '" . $GRN['podetailitem'] . "'"; @@ -144,9 +147,9 @@ $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The GRN record could not be deleted because'); $DbgMsg = _('The following SQL to delete the GRN record was used'); - $result = DB_query("DELETE FROM grns WHERE grnno='" . filter_number_format($_GET['GRNNo']) . "'",$db,$ErrMsg,$DbgMsg,true); + $result = DB_query("DELETE FROM grns WHERE grnno='" . $_GET['GRNNo'] . "'",$db,$ErrMsg,$DbgMsg,true); } else { - $SQL = "UPDATE grns SET qtyrecd = qtyrecd - " . filter_number_format($QtyToReverse) . " + $SQL = "UPDATE grns SET qtyrecd = qtyrecd - " . $QtyToReverse . " WHERE grns.grnno='" . $_GET['GRNNo'] . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The GRN record could not be updated') . '. ' . _('This reversal of goods received has not been processed because'); @@ -163,18 +166,18 @@ inputdate, cost) VALUES ('" . $GRN['assetid'] . "', - 25, - '" . $_GET['GRNNo'] . "', - '" . $GRN['deliverydate'] . "', - '" . $PeriodNo . "', - '" . Date('Y-m-d') . "', - '" . filter_number_format((-$GRN['stdcostunit'] * $QtyToReverse)) . "')"; + '25', + '" . $_GET['GRNNo'] . "', + '" . $GRN['deliverydate'] . "', + '" . $PeriodNo . "', + '" . Date('Y-m-d') . "', + '" . (-$GRN['stdcostunit'] * $QtyToReverse) . "')"; $ErrMsg = _('CRITICAL ERROR! NOTE DOWN THIS ERROR AND SEEK ASSISTANCE The fixed asset transaction could not be inserted because'); $DbgMsg = _('The following SQL to insert the fixed asset transaction record was used'); $Result = DB_query($SQL,$db,$ErrMsg, $DbgMsg, true); /*now reverse the cost put to fixedassets */ - $SQL = "UPDATE fixedassets SET cost = cost - " . filter_number_format($GRN['stdcostunit'] * $QtyToReverse) . " + $SQL = "UPDATE fixedassets SET cost = cost - " . $GRN['stdcostunit'] * $QtyToReverse . " WHERE assetid = '" . $GRN['assetid'] . "'"; $ErrMsg = _('CRITICAL ERROR! NOTE DOWN THIS ERROR AND SEEK ASSISTANCE. The fixed asset cost addition could not be reversed:'); $DbgMsg = _('The following SQL was used to attempt the reduce the cost of the asset was:'); @@ -237,9 +240,9 @@ '" . $GRN['deliverydate'] . "', '" . $PeriodNo . "', '" . _('Reversal') . ' - ' . $_POST['SupplierID'] . ' - ' . $GRN['orderno'] . "', - '" . filter_number_format(-$QtyToReverse) . "', + '" . -$QtyToReverse . "', '" . $GRN['stdcostunit'] . "', - '" . filter_number_format($QtyOnHandPrior - $QtyToReverse) . "' + '" . $QtyOnHandPrior - $QtyToReverse . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Stock movement records could not be inserted because'); @@ -260,6 +263,7 @@ '" . $GRN['itemcode'] . "', '" . $SerialStockMoves['serialno'] . "', '" . -$SerialStockMoves['moveqty'] . "')"; + $result = DB_query($SQL,$db,_('Could not insert the reversing stock movements for the batch/serial numbers'),_('The SQL used but failed was') . ':',true); $SQL = "UPDATE stockserialitems @@ -274,9 +278,14 @@ /* If GLLink_Stock then insert GLTrans to debit the GL Code and credit GRN Suspense account at standard cost*/ - if ($_SESSION['CompanyRecord']['gllink_stock']==1 AND $GRN['glcode'] !=0 AND $GRN['stdcostunit']!=0){ /*GLCode is set to 0 when the GLLink is not activated - this covers a situation where the GLLink is now active but it wasn't when this PO was entered */ - /*first the credit using the GLCode in the PO detail record entry*/ + if ($_SESSION['CompanyRecord']['gllink_stock']==1 + AND $GRN['glcode'] !=0 + AND $GRN['stdcostunit']!=0){ + + /*GLCode is set to 0 when the GLLink is not activated + this covers a situation where the GLLink is now active but it wasn't when this PO was entered + + First the credit using the GLCode in the PO detail record entry*/ $SQL = "INSERT INTO gltrans (type, typeno, @@ -292,7 +301,7 @@ '" . $PeriodNo . "', '" . $GRN['glcode'] . "', '" . _('GRN Reversal for PO') .": " . $GRN['orderno'] . " " . $_POST['SupplierID'] . " - " . $GRN['itemcode'] . "-" . $GRN['itemdescription'] . " x " . $QtyToReverse . " @ " . locale_number_format($GRN['stdcostunit'],$_SESSION['CompanyRecord']['decimalplaces']) . "', - '" . filter_number_format(-($GRN['stdcostunit'] * $QtyToReverse)) . "')"; + '" . -($GRN['stdcostunit'] * $QtyToReverse) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The purchase GL posting could not be inserted for the reversal of the received item because'); $DbgMsg = _('The following SQL to insert the purchase GLTrans record was used'); @@ -313,7 +322,7 @@ '" . $PeriodNo . "', '" . $_SESSION['CompanyRecord']['grnact'] . "', '" . _('GRN Reversal PO') . ': ' . $GRN['orderno'] . " " . $_POST['SupplierID'] . " - " . $GRN['itemcode'] . "-" . $GRN['itemdescription'] . " x " . $QtyToReverse . " @ " . locale_number_format($GRN['stdcostunit'],$_SESSION['CompanyRecord']['decimalplaces']) . "', - '" . filter_number_format($GRN['stdcostunit'] * $QtyToReverse) . "' + '" . $GRN['stdcostunit'] * $QtyToReverse . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The GRN suspense side of the GL posting could not be inserted because'); @@ -326,7 +335,7 @@ echo '<br />' . _('GRN number') . ' ' . $_GET['GRNNo'] . ' ' . _('for') . ' ' . $QtyToReverse . ' x ' . $GRN['itemcode'] . ' - ' . $GRN['itemdescription'] . ' ' . _('has been reversed') . '<br />'; unset($_GET['GRNNo']); // to ensure it cant be done again!! - echo '<a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '">' . _('Select another GRN to Reverse') . '</a>'; + echo '<a href="' . $_SERVER['PHP_SELF'] . '">' . _('Select another GRN to Reverse') . '</a>'; /*end of Process Goods Received Reversal entry */ } else { @@ -337,14 +346,17 @@ $_POST['RecdAfterDate'] = Date($_SESSION['DefaultDateFormat'],Mktime(0,0,0,Date("m")-3,Date("d"),Date("Y"))); } echo '<table class="selection"><tr>'; - echo '<input type="hidden" name="SupplierID" valuE="' . $_POST['SupplierID'] . '">'; - echo '<input type="hidden" name="SuppName" value="' . $_POST['SuppName'] . '">'; + echo '<input type="hidden" name="SupplierID" valuE="' . $_POST['SupplierID'] . '" />'; + echo '<input type="hidden" name="SuppName" value="' . $_POST['SuppName'] . '" />'; echo '<td>'._('Show all goods received after') . ': </td> - <td><input type="text" class="date" alt="'. - $_SESSION['DefaultDateFormat'].'" name="RecdAfterDate" value="' . $_POST['RecdAfterDate'] . - '" MAXLENGTH =10 size=10></td></tr>';; - echo '</table>'; - echo '<br /><div class=centre><input type=submit name="ShowGRNS" value=' . _('Show Outstanding Goods Received') . '></div>'; + <td><input type="text" class="date" alt="'. $_SESSION['DefaultDateFormat'].'" name="RecdAfterDate" value="' . $_POST['RecdAfterDate'] . '" maxlength="10" size="10" /></td> + </tr> + </table> + <br /> + <div class="centre"> + <input type="submit" name="ShowGRNS" value="' . _('Show Outstanding Goods Received') . '" /> + </div>'; + if (isset($_POST['ShowGRNS'])){ $sql = "SELECT grnno, @@ -368,15 +380,15 @@ echo '<br /><table cellpadding=2 colspan=7 class="selection">'; $TableHeader = '<tr> - <th>' . _('GRN') . ' #</th> - <th>' . _('Item Code') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Date') . '<br />' . _('Received') . '</th> - <th>' . _('Quantity') . '<br />' . _('Received') . '</th> - <th>' . _('Quantity') . '<br />' . _('Invoiced') . '</th> - <th>' . _('Quantity To') . '<br />' . _('Reverse') . '</th> - </tr>'; - + <th>' . _('GRN') . ' #</th> + <th>' . _('Item Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Date') . '<br />' . _('Received') . '</th> + <th>' . _('Quantity') . '<br />' . _('Received') . '</th> + <th>' . _('Quantity') . '<br />' . _('Invoiced') . '</th> + <th>' . _('Quantity To') . '<br />' . _('Reverse') . '</th> + </tr>'; + echo $TableHeader; /* show the GRNs outstanding to be invoiced that could be reversed */ @@ -391,29 +403,29 @@ $k=1; } - $DisplayQtyRecd = locale_number_format($myrow['qtyrecd'],2); - $DisplayQtyInv = locale_number_format($myrow['quantityinv'],2); - $DisplayQtyRev = locale_number_format($myrow['qtytoreverse'],2); + $DisplayQtyRecd = locale_number_format($myrow['qtyrecd'],'Variable'); + $DisplayQtyInv = locale_number_format($myrow['quantityinv'],'Variable'); + $DisplayQtyRev = locale_number_format($myrow['qtytoreverse'],'Variable'); $DisplayDateDel = ConvertSQLDate($myrow['deliverydate']); $LinkToRevGRN = '<a href="' . $_SERVER['PHP_SELF'] . '?GRNNo=' . $myrow['grnno'] . '">' . _('Reverse') . '</a>'; printf('<td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td class="number">%s</td> - <td class="number">%s</td> - <td class="number">%s</td> - <td>%s</td> - </tr>', - $myrow['grnno'], - $myrow['itemcode'], - $myrow['itemdescription'], - $DisplayDateDel, - $DisplayQtyRecd, - $DisplayQtyInv, - $DisplayQtyRev, - $LinkToRevGRN); + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td>%s</td> + </tr>', + $myrow['grnno'], + $myrow['itemcode'], + $myrow['itemdescription'], + $DisplayDateDel, + $DisplayQtyRecd, + $DisplayQtyInv, + $DisplayQtyRev, + $LinkToRevGRN); $RowCounter++; if ($RowCounter >20){ Modified: trunk/SalesAnalReptCols.php =================================================================== --- trunk/SalesAnalReptCols.php 2011-10-06 09:16:44 UTC (rev 4714) +++ trunk/SalesAnalReptCols.php 2011-10-08 09:44:56 UTC (rev 4715) @@ -2,8 +2,6 @@ /* $Id$*/ -//$PageSecurity = 2; - include('includes/session.inc'); $title = _('Sales Analysis Report Columns'); @@ -15,39 +13,41 @@ /*Sales analysis headers group by data options */ if ($DataX == 'Quantity'){ - echo '<option selected Value="Quantity">' . _('Quantity') . '</option>'; + echo '<option selected value="Quantity">' . _('Quantity') . '</option>'; } else { - echo '<option Value="Quantity">' . _('Quantity') . '</option>'; + echo '<option value="Quantity">' . _('Quantity') . '</option>'; } if ($DataX == 'Gross Value'){ - echo '<option selected Value="Gross Value">' . _('Gross Value') . '</option>'; + echo '<option selected value="Gross Value">' . _('Gross Value') . '</option>'; } else { - echo '<option Value="Gross Value">' . _('Gross Value') . '</option>'; + echo '<option value="Gross Value">' . _('Gross Value') . '</option>'; } if ($DataX == 'Net Value'){ - echo '<option selected Value="Net Value">' . _('Net Value') . '</option>'; + echo '<option selected value="Net Value">' . _('Net Value') . '</option>'; } else { - echo '<option Value="Net Value">' . _('Net Value') . '</option>'; + echo '<option value="Net Value">' . _('Net Value') . '</option>'; } if ($DataX == 'Gross Profit'){ - echo '<option selected Value="Gross Profit">' . _('Gross Profit') . '</option>'; + echo '<option selected value="Gross Profit">' . _('Gross Profit') . '</option>'; } else { - echo '<option Value="Gross Profit">' . _('Gross Profit') . '</option>'; + echo '<option value="Gross Profit">' . _('Gross Profit') . '</option>'; } if ($DataX == 'Cost'){ - echo '<option selected Value="Cost">' . _('Cost') . '</option>'; + echo '<option selected value="Cost">' . _('Cost') . '</option>'; } else { - echo '<option Value="Cost">' . _('Cost') . '</option>'; + echo '<option value="Cost">' . _('Cost') . '</option>'; } if ($DataX == 'Discount'){ - echo '<option selected Value="Discount">' . _('Discount') . '</option>'; + echo '<option selected value="Discount">' . _('Discount') . '</option>'; } else { - echo '<option Value="Discount">' . _('Discount') . '</option>'; + echo '<option value="Discount">' . _('Discount') . '</option>'; } } /* end of functions -Right ... now to the meat */ + +Right ... now to the meat */ + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Search') . '" alt="" />' . ' ' . $title . '</p>'; if (isset($_GET['SelectedCol'])){ @@ -246,18 +246,23 @@ if (DB_num_rows($result)!=0){ $myrow = DB_fetch_array($result); - echo '<div class="centre"><b>' . $myrow['reportheading'] . '</b><br /></div><table class=selection>'; - echo '<tr><th>' . _('Col') . ' #</th> + echo '<div class="centre"><b>' . $myrow['reportheading'] . '</b> + <br /> + </div> + <table class="selection"> + <tr> + <th>' . _('Col') . ' #</th> <th>' . _('Heading 1') . '</th> - <th>' . _('Heading 2') . '</th>'; - echo '<th>' . _('Calc') . '</th> - <th>' . _('Prd From') . '</th> - <th>' . _('Prd To') . '</th>'; - echo '<th>' . _('Data') . '</th> - <th>' . _('Col') . ' #<br /><font size=1>' . _('Numerator') . '</font></th> - <th>' . _('Col') . ' #<br /><font size=1>' . _('Denominator') . '</font></th>'; - echo '<th>' . _('Operator') . '</th> - <th>' . _('Budget') . '<br />' . _('Or Actual') . '</th></tr>'; + <th>' . _('Heading 2') . '</th> + <th>' . _('Calc') . '</th> + <th>' . _('Prd From') . '</th> + <th>' . _('Prd To') . '</th> + <th>' . _('Data') . '</th> + <th>' . _('Col') . ' #<br /><font size=1>' . _('Numerator') . '</font></th> + <th>' . _('Col') . ' #<br /><font size=1>' . _('Denominator') . '</font></th> + <th>' . _('Operator') . '</th> + <th>' . _('Budget') . '<br />' . _('Or Actual') . '</th> + </tr>'; $k=0; //row colour counter do { @@ -292,7 +297,7 @@ <td>%s</td> <td>%s</td> <td><a href="%sReportID=%s&SelectedCol=%s&delete=1">' . _('Delete') . '</td></tr>', - $_SERVER['PHP_SELF'] . "?" . SID, + $_SERVER['PHP_SELF'] . '?', $ReportID, $myrow[1], $myrow[1], @@ -306,7 +311,7 @@ $myrow[9], $myrow[10], $BudOrAct, - $_SERVER['PHP_SELF'] . "?" . SID, + $_SERVER['PHP_SELF'] . '?', $ReportID, $myrow[1]); @@ -314,7 +319,11 @@ //END WHILE LIST LOOP } -echo '</table><br /><div class="centre"><a href="' . $rootpath . '/SalesAnalRepts.php">' . _('Maintain Report Headers') . '</a></div><p>'; +echo '</table> + <br /> + <div class="centre"> + <a href="' . $rootpath . '/SalesAnalRepts.php">' . _('Maintain Report Headers') . '</a> + </div>'; if (DB_num_rows($result)>10){ prnMsg(_('WARNING') . ': ' . _('User defined reports can have up to 10 columns defined') . '. ' . _('The report will not be able to be run until some columns are deleted'),'warn'); } @@ -327,8 +336,8 @@ $ReportHeading=$myrow['reportheading']; echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<input type="hidden" name="ReportHeading" value='.$ReportHeading.'>'; - echo '<input type=hidden name="ReportID" VALUE=' . $ReportID . '>'; + echo '<input type="hidden" name="ReportHeading" value="'.$ReportHeading.'" />'; + echo '<input type=hidden name="ReportID" value="' . $ReportID . '" />'; if (isset($SelectedCol)) { //editing an existing Column @@ -373,44 +382,55 @@ $_POST['BudgetOrActual']=$myrow['budgetoractual']; $_POST['ValFormat']=$myrow['valformat']; - echo '<input type=hidden name="SelectedCol" VALUE=' . $SelectedCol . '>'; - echo '<table class=selection>'; + echo '<input type=hidden name="SelectedCol" value="' . $SelectedCol . '" />'; + echo '<table class="selection">'; } else { - echo '<table class=selection>'; + echo '<table class="selection">'; if (!isset($_POST['ColID'])) { $_POST['ColID']=1; } - echo '<tr><td>' . _('Column Number') . ':</td> - <td><input type="text" class=number name=ColID size=3 maxlength=3 Value=' . $_POST['ColID'] . '> <font size=1>(' . _('A number between 1 and 10 is expected') . ')</td>'; + echo '<tr> + <td>' . _('Column Number') . ':</td> + <td><input type="text" class="number" name=ColID size=3 maxlength=3 value="' . $_POST['ColID'] . '"> <font size=1>(' . _('A number between 1 and 10 is expected') . ')</font></td> + </tr>'; } if (!isset($_POST['Heading1'])) { $_POST['Heading1']=''; } - echo '<tr><td>' . _('Heading line 1') . ':</td> - <td><input type="TEXT" size=16 maxlength=15 name="Heading1" value="' . $_POST['Heading1'] . '"></td></tr>'; + echo '<tr> + <td>' . _('Heading line 1') . ':</td> + <td><input type="text" size=16 maxlength=15 name="Heading1" value="' . $_POST['Heading1'] . '"></td> + </tr>'; if (!isset($_POST['Heading2'])) { $_POST['Heading2']=''; } - echo '<tr><td>' . _('Heading line 2') . ':</td><td><input type="TEXT" size=16 maxlength=15 name="Heading2" value="' . $_POST['Heading2'] . '"></td></tr>'; - echo '<tr><td>' . _('Calculation') . ':</td><td><select name="Calculation">'; + echo '<tr> + <td>' . _('Heading line 2') . ':</td> + <td><input type="text" size="16" maxlength="15" name="Heading2" value="' . $_POST['Heading2'] . '" /></td> + </tr>'; + echo '<tr> + <td>' . _('Calculation') . ':</td> + <td><select name="Calculation">'; if (!isset($_POST['Calculation'])) { $_POST['Calculation']=0; } if ($_POST['Calculation'] ==1){ - echo '<option selected Value=1>' . _('Yes'); - echo '<option Value=0>' . _('No'); + echo '<option selected value="1">' . _('Yes') . '</option>'; + echo '<option value="0">' . _('No') . '</option>'; } else { - echo '<option Value=1>' . _('Yes'); - echo '<option selected Value=0>' . _('No'); + echo '<option value="1">' . _('Yes') . '</option>'; + echo '<option selected value="0">' . _('No') . '</option>'; } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; if ($_POST['Calculation']==0){ /*Its not a calculated column */ - echo '<tr><td>' . _('From Period') . ':</td> - <td><select name="PeriodFrom"'; - $sql = 'SELECT periodno, lastdate_in_period FROM periods ORDER BY periodno DESC'; + echo '<tr> + <td>' . _('From Period') . ':</td> + <td><select name="PeriodFrom"'; + $sql = "SELECT periodno, lastdate_in_period FROM periods ORDER BY periodno DESC"; $ErrMsg = _('Could not load periods table'); $result = DB_query($sql,$db,$ErrMsg); while ($PeriodRow = DB_fetch_row($result)){ @@ -420,11 +440,13 @@ echo '<option value="' . $PeriodRow[0] . '">' . ConvertSQLDate($PeriodRow[1]) . '</option>'; } } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; - echo '<tr><td>' . _('ToPeriod') . ':</td> - <td><select name="PeriodTo"'; - $sql = 'SELECT periodno, lastdate_in_period FROM periods ORDER BY periodno DESC'; + echo '<tr> + <td>' . _('ToPeriod') . ':</td> + <td><select name="PeriodTo"'; + $sql = "SELECT periodno, lastdate_in_period FROM periods ORDER BY periodno DESC"; $ErrMsg = _('Could not load periods table'); $result = DB_query($sql,$db,$ErrMsg); while ($PeriodRow = DB_fetch_row($result)){ @@ -434,34 +456,46 @@ echo '<option value="' . $PeriodRow[0] . '">' . ConvertSQLDate($PeriodRow[1]) . '</option>'; } } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; - echo '<tr><td>' . _('Data to show') . ':</td><td><select name="DataType">'; + echo '<tr> + <td>' . _('Data to show') . ':</td> + <td><select name="DataType">'; DataOptions($_POST['DataType']); - echo '</select></td></tr>'; - echo '<tr><td>' . _('Budget or Actual') . ':</td><td><select name=BudgetOrActual>'; + echo '</select></td> + </tr>'; + echo '<tr> + <td>' . _('Budget or Actual') . ':</td> + <td><select name="BudgetOrActual">'; if ($_POST['BudgetOrActual']==0){ - echo '<option selected Value=0>' . _('Budget') . '</option>'; - echo '<option Value=1>' . _('Actual') . '</option>'; + echo '<option selected value="0">' . _('Budget') . '</option>'; + echo '<option value="1">' . _('Actual') . '</option>'; } else { - echo '<option Value=0>' . _('Budget') . '</option>'; - echo '<option selected Value=1>' . _('Actual') . '</option>'; + echo '<option value="0">' . _('Budget') . '</option>'; + echo '<option selected value="1">' . _('Actual') . '</option>'; } - echo '</select></td></tr>'; - echo '<input type=hidden name="ValFormat" Value="N"> - <input type=hidden name="ColNumerator" Value=0> - <input type=hidden name="ColDenominator" Value=0> - <input type=hidden name="CalcOperator" Value=""> - <input type=hidden name="Constant" Value=0>'; + echo '</select></td> + </tr>'; + echo '<input type=hidden name="ValFormat" value="N" /> + <input type=hidden name="ColNumerator" value="0" /> + <input type=hidden name="ColDenominator" value="0" /> + <input type=hidden name="CalcOperator" value="" /> + <input type=hidden name="Constant" value="0" />'; } else { /*it IS a calculated column */ - echo '<tr><td>' . _('Numerator Column') . ' #:</td> - <td><input type="TEXT" size=4 maxlength=3 name="ColNumerator" value=' . $_POST['ColNumerator'] . '></td></tr>'; - echo '<tr><td>' . _('Denominator Column') . ' #:</td> - <td><input type="TEXT" size=4 maxlength=3 name="ColDenominator" value=' . $_POST['ColDenominator'] . '></td></tr>'; - echo '<tr><td>' . _('Calculation Operator') . ':</td> - <td><select name="CalcOperator">'; + echo '<tr> + <td>' . _('Numerator Column') . ' #:</td> + <td><input type="text" size="4" maxlength="3" name="ColNumerator" value="' . $_POST['ColNumerator'] . '" /></td> + </tr>'; + echo '<tr> + <td>' . _('Denominator Column') . ' #:</td> + <td><input type="text" size="4" maxlength="3" name="ColDenominator" value="' . $_POST['ColDenominator'] . '" /></td> + </tr>'; + echo '<tr> + <td>' . _('Calculation Operator') . ':</td> + <td><select name="CalcOperator">'; if ($_POST['CalcOperator'] == '/'){ echo '<option selected value="/">' . _('Numerator Divided By Denominator') . '</option>'; } else { @@ -488,26 +522,36 @@ echo '<option value="-">' . _('Numerator Minus Denominator') . '</option>'; } - echo '</select></td></tr>'; - echo '<tr><td>' . _('Constant') . ':</td><td><input type="TEXT" size=10 maxlength=10 name="Constant" value=' . $_POST['Constant'] . '></td></tr>'; - echo '<tr><td>' . _('Format Type') . ':</td><td><select name="ValFormat">'; + echo '</select></td> + </tr>'; + echo '<tr> + <td>' . _('Constant') . ':</td> + <td><input type="text" size="10" maxlength="10" name="Constant" value="' . $_POST['Constant'] . '" /></td> + </tr>'; + echo '<tr> + <td>' . _('Format Type') . ':</td> + <td><select name="ValFormat">'; if ($_POST['ValFormat']=='N'){ - echo '<option selected Value="N">' . _('Numeric'); - echo '<option Value="P">' . _('Percentage'); + echo '<option selected value="N">' . _('Numeric') . '</option>'; + echo '<option value="P">' . _('Percentage') . '</option>'; } else { - echo '<option Value="N">' . _('Numeric'); - echo '<option selected Value="P">' . _('Percentage'); + echo '<option value="N">' . _('Numeric') . '</option>'; + echo '<option selected value="P">' . _('Percentage') . '</option>'; } - echo '</select></td></tr><input type=hidden name="BudgetOrActual" Value=0> - <input type=hidden name="DataType" Value=""> - <input type=hidden name="PeriodFrom" Value=0> - <input type=hidden name="PeriodTo" Value=0>'; + echo '</select></td></tr> + <input type=hidden name="BudgetOrActual" value="0" /> + <input type=hidden name="DataType" value="" /> + <input type=hidden name="PeriodFrom" value="0" /> + <input type=hidden name="PeriodTo" value="0" />'; } - echo '</table>'; - echo '<br /><div class="centre"><input type="Submit" name="submit" value="' . _('Enter Information') . '"></div></form>'; + echo '<br /> + <div class="centre"> + <input type="submit" name="submit" value="' . _('Enter Information') . '" /> + </div> + </form>'; } //end if record deleted no point displaying form to add record Modified: trunk/SalesAnalRepts.php =================================================================== --- trunk/SalesAnalRepts.php 2011-10-06 09:16:44 UTC (rev 4714) +++ trunk/SalesAnalRepts.php 2011-10-08 09:44:56 UTC (rev 4715) @@ -100,15 +100,15 @@ $InputError = 1; prnMsg (_('Group by Level 1 is set but the upper and lower limits are not set') . ' - ' . _('these must be specified for the report to have any output'),'error',_('Upper/Lower limits not set')); } - if (($_POST['GroupByData2']!='Not Used') AND ($_POST['Lower2']=='' || $_POST['Upper2']=='')) { + if (($_POST['GroupByData2']!='Not Used') AND ($_POST['Lower2']=='' OR $_POST['Upper2']=='')) { $InputError = 1; prnMsg( _('Group by Level 2 is set but the upper and lower limits are not set') . ' - ' . _('these must be specified for the report to have any output'),'error',_('Upper/Lower Limits not set')); } - if (($_POST['GroupByData3']!='Not Used') AND ($_POST['Lower3']=='' || $_POST['Upper3']=='')) { + if (($_POST['GroupByData3']!='Not Used') AND ($_POST['Lower3']=='' OR $_POST['Upper3']=='')) { $InputError = 1; prnMsg( _('Group by Level 3 is set but the upper and lower limits are not set') . ' - ' . _('these must be specified for the report to have any output'),'error',_('Upper/Lower Limits not set')); } - if (($_POST['GroupByData4']!='Not Used') AND ($_POST['Lower4']=='' || $_POST['Upper4']=='')) { + if (($_POST['GroupByData4']!='Not Used') AND ($_POST['Lower4']=='' OR $_POST['Upper4']=='')) { $InputError = 1; prnMsg( _('Group by Level 4 is set but the upper and lower limits are not set') . ' - ' . _('these must be specified for the report to have any output'),'error',_('Upper/Lower Limits not set')); } @@ -138,23 +138,23 @@ delete code below*/ $sql = "UPDATE reportheaders SET - reportheading='" . $_POST['ReportHeading'] . "', - groupbydata1='" . $_POST['GroupByData1'] . "', - groupbydata2='" . $_POST['GroupByData2'] . "', - groupbydata3='" . $_POST['GroupByData3'] . "', - groupbydata4='" . $_POST['GroupByData4'] . "', - newpageafter1='" . $_POST['NewPageAfter1'] . "', - newpageafter2='" . $_POST['NewPageAfter2'] . "', - newpageafter3='" . $_POST['NewPageAfter3'] . "', - lower1='" . $_POST['Lower1'] . "', - upper1='" . $_POST['Upper1'] . "', - lower2='" . $_POST['Lower2'] . "', - upper2='" . $_POST['Upper2'] . "', - lower3='" . $_POST['Lower3'] . "', - upper3='" . $_POST['Upper3'] . "', - lower4='" . $_POST['Lower4'] . "', - upper4='" . $_POST['Upper4'] . "' - WHERE reportid = " . $SelectedReport; + reportheading='" . $_POST['ReportHeading'] . "', + groupbydata1='" . $_POST['GroupByData1'] . "', + groupbydata2='" . $_POST['GroupByData2'] . "', + groupbydata3='" . $_POST['GroupByData3'] . "', + groupbydata4='" . $_POST['GroupByData4'] . "', + newpageafter1='" . $_POST['NewPageAfter1'] . "', + newpageafter2='" . $_POST['NewPageAfter2'] . "', + newpageafter3='" . $_POST['NewPageAfter3'] . "', + lower1='" . filter_number_format($_POST['Lower1']) . "', + upper1='" . filter_number_format($_POST['Upper1']) . "', + lower2='" . filter_number_format($_POST['Lower2']) . "', + upper2='" . filter_number_format($_POST['Upper2']) . "', + lower3='" . filter_number_format($_POST['Lower3']) . "', + upper3='" . filter_number_format($_POST['Upper3']) . "', + lower4='" . filter_number_format($_POST['Lower4']) . "', + upper4='" . filter_number_format($_POST['Upper4']) . "' + WHERE reportid = " . $SelectedReport; $ErrMsg = _('The report could not be updated because'); $DbgMsg = _('The SQL used to update the report headers was'); @@ -209,14 +209,14 @@ '" . $_POST['NewPageAfter1'] . "', '" . $_POST['NewPageAfter2'] . "', '" . $_POST['NewPageAfter3'] . "', - '" . $_POST['Lower1'] . "', - '" . $_POST['Upper1'] . "', - '" . $_POST['Lower2'] . "', - '" . $_POST['Upper2'] . "', - '" . $_POST['Lower3'] . "', - '" . $_POST['Upper3'] . "', - '" . $_POST['Lower4'] . "', - '" . $_POST['Upper4'] . "' + '" . filter_number_format($_POST['Lower1']) . "', + '" . filter_number_format($_POST['Upper1']) . "', + '" . filter_number_format($_POST['Lower2']) . "', + '" . filter_number_format($_POST['Upper2']) . "', + '" . filter_number_format($_POST['Lower3']) . "', + '" . filter_number_format($_POST['Upper3']) . "', + '" . filter_number_format($_POST['Lower4']) . "', + '" . filter_number_format($_POST['Upper4']) . "' )"; $ErrMsg = _('The report could not be added because'); @@ -277,9 +277,10 @@ $result = DB_query("SELECT reportid, reportheading FROM reportheaders ORDER BY reportid",$db); - echo '<table class=selection>'; - echo '<tr><th>' . _('Report No') . '</th> - <th>' . _('Report Title') . '</th>'; + echo '<table class="selection">'; + echo '<tr> + <th>' . _('Report No') . '</th> + <th>' . _('Report Title') . '</th>'; $k=0; //row colour counter @@ -293,27 +294,27 @@ } - printf("<td>%s</td> - <td>%s</td> - <td><a href=\"%s&SelectedReport=%s\">" . _('Design') . "</a></td> - <td><a href=\"%s/SalesAnalReptCols.php?ReportID=%s\">" . _('Define Columns') . "</a></td> - <td><a href=\"%s/SalesAnalysis_UserDefined.php?ReportID=%s&ProducePDF=True\">" . _('Make PDF Report') . "</a></td> - <td><a href=\"%s/SalesAnalysis_UserDefined.php?ReportID=%s&ProduceCVSFile=True\">" . _('Make CSV File') . "</a></td> - <td><a href=\"%s&SelectedReport=%s&delete=1\" onclick=\"return confirm('" . _('Are you sure you wish to remove this report design?') . "');\">" . _('Delete') . "</td> - </tr>", - $myrow[0], - $myrow[1], - $_SERVER['PHP_SELF'] . '?', - $myrow[0], - $rootpath, - $myrow[0], - $rootpath, - $myrow[0], - $rootpath, - $myrow[0], - $_SERVER['PHP_SELF'] . '?', - $myrow[0]); - + printf('<td>%s</td> + <td>%s</td> + <td><a href="%s&SelectedReport=%s">' . _('Design') . '</a></td> + <td><a href="%s/SalesAnalReptCols.php?ReportID=%s">' . _('Define Columns') . '</a></td> + <td><a href="%s/SalesAnalysis_UserDefined.php?ReportID=%s&ProducePDF=True">' . _('Make PDF Report') . '</a></td> + <td><a href="%s/SalesAnalysis_UserDefined.php?ReportID=%s&ProduceCVSFile=True">' . _('Make CSV File') . '</a></td> + <td><a href="%s&SelectedReport=%s&delete=1" onclick="return confirm(\"' . _('Are you sure you wish to remove this report design?') . '\");">' . _('Delete') . '</td> + </tr>', + $myrow[0], + $myrow[1], + $_SERVER['PHP_SELF'] . '?', + $myrow[0], + $rootpath, + $myrow[0], + $rootpath, + $myrow[0], + $rootpath, + $myrow[0], + $_SERVER['PHP_SELF'] . '?', + $myrow[0]); + } //END WHILE LIST LOOP echo '</table><p>'; @@ -324,7 +325,7 @@ if (isset($SelectedReport)) { - echo '<a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '">' . _('Show All Defined Reports') . '</a>'; + echo '<a href="' . $_SERVER['PHP_SELF'] . '">' . _('Show All Defined Reports') . '</a>'; } echo '<p />'; @@ -338,24 +339,24 @@ //editing an existing Report $sql = "SELECT reportid, - reportheading, - groupbydata1, - newpageafter1, - upper1, - lower1, - groupbydata2, - newpageafter2, - upper2, - lower2, - groupbydata3, - upper3, - lower3, - newpageafter3, - groupbydata4, - upper4, - lower4 - FROM reportheaders - WHERE reportid='".$SelectedReport."'"; + reportheading, + groupbydata1, + newpageafter1, + upper1, + lower1, + groupbydata2, + newpageafter2, + upper2, + lower2, + groupbydata3, + upper3, + lower3, + newpageafter3, + groupbydata4, + upper4, + lower4 + FROM reportheaders + WHERE reportid='".$SelectedReport."'"; $ErrMsg = _('The reports for display could not be retrieved because'); $DbgMsg = _('The SQL used to retrieve the report headers was'); @@ -380,31 +381,41 @@ $_POST['Upper4'] = $myrow['upper4']; $_POST['Lower4'] = $myrow['lower4']; - echo '<input type="hidden" name="SelectedReport" value="' . $SelectedReport . '">'; - echo '<input type="hidden" name="ReportID" value="' . $ReportID . '">'; - echo '<table width=98% colspan=4 class=selection><tr><th colspan=8><font size=3 color=BLUE>' . _('Edit The Selected Report') . '</font></th></tr>'; + echo '<input type="hidden" name="SelectedReport" value="' . $SelectedReport . '" />'; + echo '<input type="hidden" name="ReportID" value="' . $ReportID . '" />'; + echo '<table width="98%" colspan="4" class="selection"> + <tr> + <th colspan="8"><font size=3 color="blue">' . _('Edit The Selected Report') . '</font></th> + </tr>'; } else { - echo '<table width=98% colspan=4 class=selection><tr><th colspan=8><font size=3 color=BLUE>' . _('Define A New Report') . '</font></th></tr>'; + echo '<table width="98%" colspan="4" class="selection"> + <tr> + <th colspan="8"><font size="3" color="blue">' . _('Define A New Report') . '</font></th> + </tr>'; } if (!isset($_POST['ReportHeading'])) { $_POST['ReportHeading']=''; } - echo '<tr><td class=number>' . _('Report Heading') . ':</td> - <td colspan=2><input type="text" size=80 maxlength=80 name="ReportHeading" value="' . $_POST['ReportHeading'] . '"></td></tr>'; + echo '<tr> + <td class="number">' . _('Report Heading') . ':</td> + <td colspan="2"><input type="text" size="80" maxlength="80" name="ReportHeading" value="' . $_POST['ReportHeading'] . '" /></td> + </tr>'; - echo '<tr><td>' . _('Group By 1') . ': <select name=GroupByData1>'; + echo '<tr> + <td>' . _('Group By 1') . ': <select name="GroupByData1">'; GrpByDataOptions($_POST['GroupByData1']); - echo '</select></td><td>' . _('Page Break After') . ': <select name="NewPageAfter1">'; + echo '</select></td> + <td>' . _('Page Break After') . ': <select name="NewPageAfter1">'; if ($_POST['NewPageAfter1']==0){ echo '<option selected value="0">' . _('No') . '</option>'; echo '<option value="1">' . _('Yes') . '</option>'; } Else { - echo '<option value=0>' . _('No') . '</option>'; - echo '<option selected value=1>' . _('Yes') . '</option>'; + echo '<option value="0">' . _('No') . '</option>'; + echo '<option selected value="1">' . _('Yes') . '</option>'; } echo '</select></td>'; @@ -416,21 +427,23 @@ if (!isset($_POST['Upper1'])) { $_POST['Upper1'] = ''; } - echo '<td>' . _('From') . ': <input type="text" name="Lower1" size=10 maxlength=10 value="' . $_POST['Lower1'] . '"></td>'; - echo '<td>' . _('To') . ': <input type="text" name="Upper1" size=10 maxlength=10 value="' . $_POST['Upper1'] . '"></td></tr>'; + echo '<td>' . _('From') . ': <input type="text" name="Lower1" size="10" maxlength="10" value="' . $_POST['Lower1'] . '" /></td> + <td>' . _('To') . ': <inp... [truncated message content] |