From: <dai...@us...> - 2011-10-06 09:16:53
|
Revision: 4714 http://web-erp.svn.sourceforge.net/web-erp/?rev=4714&view=rev Author: daintree Date: 2011-10-06 09:16:44 +0000 (Thu, 06 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/Prices.php trunk/Prices_Customer.php trunk/PrintCustOrder.php trunk/PrintCustTrans.php trunk/PrintCustTransPortrait.php trunk/PurchData.php trunk/SecurityTokens.php trunk/SelectSalesOrder.php trunk/includes/MiscFunctions.php Modified: trunk/Prices.php =================================================================== --- trunk/Prices.php 2011-10-06 07:52:38 UTC (rev 4713) +++ trunk/Prices.php 2011-10-06 09:16:44 UTC (rev 4714) @@ -193,7 +193,7 @@ prices.currabrev, prices.startdate, prices.enddate, - currencies.decimalplaces + currencies.decimalplaces AS currdecimalplaces FROM prices INNER JOIN salestypes ON prices.typeabbrev = salestypes.typeabbrev @@ -211,7 +211,7 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '"> <table class=selection> <tr> - <th colspan=7> + <th colspan="7"> <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />' . _('Pricing for part') . ': <input type="text" name="Item" size="22" value="' . $Item . '" maxlength="20"> @@ -245,7 +245,7 @@ if (in_array(5,$_SESSION['AllowedPageSecurityTokens'])) { echo '<td>' . $myrow['currency'] . '</td> <td>' . $myrow['sales_type'] . '</td> - <td class="number">' . locale_number_format($myrow['price'],$myrow['decimalplaces']) . '</td> + <td class="number">' . locale_number_format($myrow['price'],$myrow['currdecimalplaces']) . '</td> <td>' . ConvertSQLDate($myrow['startdate']) . '</td> <td>' . $EndDateDisplay . '</td> <td><a href="' . $_SERVER['PHP_SELF'] . '?Item=' . $myrow['stockid'] . '&TypeAbbrev=' .$myrow['typeabbrev'] . '&CurrAbrev=' . $myrow['currabrev'] . '&Price=' . $myrow['price'] . '&StartDate=' . $myrow['startdate'] . '&EndDate=' . $myrow['enddate'] . '&Edit=1">' . _('Edit') . '</td> @@ -254,7 +254,7 @@ } else { echo '<td>' . $myrow['currency'] . '</td> <td>' . $myrow['sales_type'] . '</td> - <td class="number">' . locale_number_format($myrow['price'],$myrow['decimalplaces']) . '</td> + <td class="number">' . locale_number_format($myrow['price'],$myrow['currdecimalplaces']) . '</td> <td>' . ConvertSQLDate($myrow['startdate']) . '</td> <td>' . $EndDateDisplay . '</td></tr>'; } @@ -269,10 +269,10 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($_GET['Edit'])){ - echo '<input type=hidden name="OldTypeAbbrev" value="' . $_GET['TypeAbbrev'] .'">'; - echo '<input type=hidden name="OldCurrAbrev" value="' . $_GET['CurrAbrev'] . '">'; - echo '<input type=hidden name="OldStartDate" value="' . $_GET['StartDate'] . '">'; - echo '<input type=hidden name="OldEndDate" value="' . $_GET['EndDate'] . '">'; + echo '<input type="hidden" name="OldTypeAbbrev" value="' . $_GET['TypeAbbrev'] .'">'; + echo '<input type="hidden" name="OldCurrAbrev" value="' . $_GET['CurrAbrev'] . '">'; + echo '<input type="hidden" name="OldStartDate" value="' . $_GET['StartDate'] . '">'; + echo '<input type="hidden" name="OldEndDate" value="' . $_GET['EndDate'] . '">'; $_POST['CurrAbrev'] = $_GET['CurrAbrev']; $_POST['TypeAbbrev'] = $_GET['TypeAbbrev']; /*the price sent with the get is sql format price so no need to filter */ @@ -291,7 +291,7 @@ $result = DB_query($SQL,$db); echo '<br /><table class="selection">'; - echo '<tr><th colspan=5><font color=BLUE size=3><b>' . $Item . ' - ' . $PartDescription . '</b></font></th></tr>'; + echo '<tr><th colspan="5"><font color="blue" size="3"><b>' . $Item . ' - ' . $PartDescription . '</b></font></th></tr>'; echo '<tr><td>' . _('Currency') . ':</td> <td><select name="CurrAbrev">'; while ($myrow = DB_fetch_array($result)) { Modified: trunk/Prices_Customer.php =================================================================== --- trunk/Prices_Customer.php 2011-10-06 07:52:38 UTC (rev 4713) +++ trunk/Prices_Customer.php 2011-10-06 09:16:44 UTC (rev 4714) @@ -5,12 +5,13 @@ $result = DB_query("SELECT debtorsmaster.name, debtorsmaster.currcode, - debtorsmaster.salestype + debtorsmaster.salestype, + currencies.decimalplaces AS currdecimalplaces FROM debtorsmaster WHERE debtorsmaster.debtorno='" . $_SESSION['CustomerID'] . "'",$db); -$myrow = DB_fetch_row($result); +$myrow = DB_fetch_array($result); -$title = _('Special Prices for') . ' '. $myrow[0]; +$title = _('Special Prices for') . ' '. $myrow['name']; include('includes/header.inc'); @@ -20,7 +21,7 @@ $Item = $_POST['Item']; } -if (!isset($Item) OR !isset($_SESSION['CustomerID']) OR $_SESSION['CustomerID']==""){ +if (!isset($Item) OR !isset($_SESSION['CustomerID']) OR $_SESSION['CustomerID']==''){ prnMsg( _('A customer must be selected from the customer selection screen') . ', ' . _('then an item must be selected before this page is called') . '. ' @@ -30,18 +31,13 @@ exit; } -$result = DB_query("SELECT debtorsmaster.name, - debtorsmaster.currcode, - debtorsmaster.salestype - FROM debtorsmaster - WHERE debtorsmaster.debtorno='" . $_SESSION['CustomerID'] . "'",$db); -$myrow = DB_fetch_row($result); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . _('Special Customer Prices').'</p><br />'; -echo '<font color=BLUE><b>' . $myrow[0] . ' ' . _('in') . ' ' . $myrow[1] . '<br />' . ' ' . _('for') . ' '; +echo '<font color=BLUE><b>' . $myrow['name'] . ' ' . _('in') . ' ' . $myrow['currcode'] . '<br />' . ' ' . _('for') . ' '; -$CurrCode = $myrow[1]; -$SalesType = $myrow[2]; +$CurrCode = $myrow['currcode']; +$SalesType = $myrow['salestype']; +$CurrDecimalPlaces = $myrow['currdecimalplaces']; $result = DB_query("SELECT stockmaster.description, stockmaster.mbflag @@ -216,16 +212,16 @@ $EndDateDisplay = ConvertSQLDate($myrow['enddate']); } printf('<tr class="EvenTableRows"> - <td class=number>%0.2f</td> - <td class=date>%s</td> - <td class=date>%s</td></tr>', - $myrow['price'], + <td class="number">%s</td> + <td class="date">%s</td> + <td class="date">%s</td></tr>', + locale_number_format($myrow['price'],$CurrDecimalPlaces), ConvertSQLDate($myrow['startdate']), $EndDateDisplay); } } -echo '</table></td><td valign=top>'; +echo '</table></td><td valign="top">'; //now get the prices for the customer selected @@ -234,7 +230,8 @@ custbranch.brname, prices.startdate, prices.enddate - FROM prices LEFT JOIN custbranch ON prices.branchcode= custbranch.branchcode + FROM prices LEFT JOIN custbranch + ON prices.branchcode= custbranch.branchcode WHERE prices.typeabbrev = '".$SalesType."' AND prices.stockid='".$Item."' AND prices.debtorno='" . $_SESSION['CustomerID'] . "' @@ -242,13 +239,13 @@ AND (custbranch.debtorno='" . $_SESSION['CustomerID'] . "' OR custbranch.debtorno IS NULL) ORDER BY prices.branchcode, - prices.startdate"; + prices.startdate"; $ErrMsg = _('Could not retrieve the special prices set up because'); $DbgMsg = _('The SQL used to retrieve these records was'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg); -echo '<table class=selection>'; +echo '<table class="selection">'; if (DB_num_rows($result) == 0) { echo '<tr><td>' . _('There are no special prices set up for this part') . '</td></tr>'; @@ -270,10 +267,10 @@ $EndDateDisplay = ConvertSQLDate($myrow['enddate']); } echo '<tr bgcolor="#CCCCCC"> - <td class=number>'.locale_number_format($myrow['price'],2).'</td> - <td>'.$Branch.'</td> + <td class="number">'.locale_number_format($myrow['price'],$CurrDecimalPlaces).'</td> + <td>' . $Branch.'</td> <td>'.$myrow['units'].'</td> - <td class=number>'.$myrow['conversionfactor'].'</td> + <td class="number">'.$myrow['conversionfactor'].'</td> <td>'.ConvertSQLDate($myrow['startdate']).'</td> <td>'.$EndDateDisplay.'</td> <td><a href="'.$_SERVER['PHP_SELF'].'?Item='.$Item.'&Price='.$myrow['price'].'&Branch='.$myrow['branchcode']. @@ -288,13 +285,13 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<input type=hidden name="Item" value="' . $Item . '">'; +echo '<input type="hidden" name="Item" value="' . $Item . '" />'; if (isset($_GET['Edit']) and $_GET['Edit']==1){ - echo '<input type=hidden name="Editing" value="Yes">'; - echo '<input type=hidden name="OldStartDate" value="' . $_GET['StartDate'] .'">'; - echo '<input type=hidden name="OldEndDate" value="' . $_GET['EndDate'] . '">'; - $_POST['Price']=filter_number_format($_GET['Price']); + echo '<input type="hidden" name="Editing" value="Yes" />'; + echo '<input type="hidden" name="OldStartDate" value="' . $_GET['StartDate'] .'" />'; + echo '<input type="hidden" name="OldEndDate" value="' . $_GET['EndDate'] . '" />'; + $_POST['Price']=$_GET['Price']; $_POST['Branch']=$_GET['Branch']; $_POST['StartDate'] = ConvertSQLDate($_GET['StartDate']); if (Is_Date($_GET['EndDate'])){ @@ -322,11 +319,14 @@ branchcode, brname FROM custbranch - WHERE debtorno='".$_SESSION['CustomerID'] ."'"; + WHERE debtorno='" . $_SESSION['CustomerID'] . "'"; $result = DB_query($sql, $db); -echo '<table class=selection>'; -echo '<tr><td>' . _('Branch') . ':</td>'; -echo '<td><select name="Branch">'; + +echo '<table class="selection"> + <tr> + <td>' . _('Branch') . ':</td> + <td><select name="Branch">'; + while ($myrow=DB_fetch_array($result)) { if ($myrow['branchcode']==$_POST['branch']) { echo '<option selected value='.$myrow['branchcode'].'>'.$myrow['brname'].'</option>'; @@ -335,22 +335,28 @@ } } echo '</select></td></tr>'; -echo '<tr><td>' . _('Start Date') . ':</td> - <td><input type="Text" name="StartDate" class=date alt='.$_SESSION['DefaultDateFormat']. - ' size=11 maxlength=10 value="' . $_POST['StartDate'] . '"></td></tr>'; -echo '<tr><td>' . _('End Date') . ':</td> - <td><input type="Text" name="EndDate" class=date alt='.$_SESSION['DefaultDateFormat']. - ' size=11 maxlength=10 value="' . $_POST['EndDate'] . '"></td></tr>'; +echo '<tr> + <td>' . _('Start Date') . ':</td> + <td><input type="text" name="StartDate" class="date" alt='.$_SESSION['DefaultDateFormat']. ' size="11" maxlength="10" value="' . $_POST['StartDate'] . '"></td> + </tr>'; +echo '<tr> + <td>' . _('End Date') . ':</td> + <td><input type="text" name="EndDate" class=date alt='.$_SESSION['DefaultDateFormat']. ' size="11" maxlength="10" value="' . $_POST['EndDate'] . '" /></td></tr>'; echo '<tr><td>' . _('Price') . ':</td> - <td><input type="Text" class=number name="Price" size=11 maxlength=10 value=' . $_POST['Price'] . '></td> - </tr></table>'; + <td><input type="text" class="number" name="Price" size="11" maxlength="10" value="' . locale_number_format($_POST['Price'],2) . '"></td> + </tr> + </table>'; -echo '<br /><div class="centre"><input type="Submit" name="submit" value="' . _('Enter Information') . '"></div>'; - -echo '</form>'; +echo '<br /> + <div class="centre"> + <input type="submit" name="submit" value="' . _('Enter Information') . '" /> + </div> + </form>'; + include('includes/footer.inc'); +exit; function ReSequenceEffectiveDates ($Item, $PriceList, $CurrAbbrev, $CustomerID, $db) { Modified: trunk/PrintCustOrder.php =================================================================== --- trunk/PrintCustOrder.php 2011-10-06 07:52:38 UTC (rev 4713) +++ trunk/PrintCustOrder.php 2011-10-06 09:16:44 UTC (rev 4714) @@ -20,15 +20,15 @@ <br /> <table class="table_index"> <tr><td class="menu_group_item"> - <li><a href="'. $rootpath . '/SelectSalesOrder.php?'. SID .'">' . _('Outstanding Sales Orders') . '</a></li> - <li><a href="'. $rootpath . '/SelectCompletedOrder.php?'. SID .'">' . _('Completed Sales Orders') . '</a></li> - </td> - </tr> - </table> - </div> - <br /> - <br /> - <br />'; + <li><a href="'. $rootpath . '/SelectSalesOrder.php">' . _('Outstanding Sales Orders') . '</a></li> + <li><a href="'. $rootpath . '/SelectCompletedOrder.php">' . _('Completed Sales Orders') . '</a></li> + </td> + </tr> + </table> + </div> + <br /> + <br /> + <br />'; include('includes/footer.inc'); exit; } Modified: trunk/PrintCustTrans.php =================================================================== --- trunk/PrintCustTrans.php 2011-10-06 07:52:38 UTC (rev 4713) +++ trunk/PrintCustTrans.php 2011-10-06 09:16:44 UTC (rev 4714) @@ -692,11 +692,13 @@ <td bgcolor="#BBBBBB"><b>'; if ($InvOrCredit=='Invoice') { - echo '<font size=4>' . _('TAX INVOICE') . ' '; + echo '<font size="4">' . _('TAX INVOICE') . ' '; } else { - echo '<font color=RED size=4>' . _('TAX CREDIT NOTE') . ' '; + echo '<font color="red" size="4">' . _('TAX CREDIT NOTE') . ' '; } - echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br /><font size=1>' . _('Tax Authority Ref') . '. ' . $_SESSION['CompanyRecord']['gstno'] . '</td></tr></table>'; + echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br /><font size=1>' . _('Tax Authority Ref') . '. ' . $_SESSION['CompanyRecord']['gstno'] . '</td> + </tr> + </table>'; /* Now print out the logo and company name and address */ echo '<table class="table1"> @@ -711,13 +713,16 @@ echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br />'; echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br />'; - echo '</td><td WIDTH=50% class=number>'; + echo '</td><td width="50%" class="number">'; /* Now the customer charged to details in a sub table within a cell of the main table*/ echo '<table class="table1"> - <tr><td align=left bgcolor="#BBBBBB"><b>' . _('Charge To') . ':</b></td> - </tr><tr><td bgcolor="#EEEEEE">'; + <tr> + <td align=left bgcolor="#BBBBBB"><b>' . _('Charge To') . ':</b></td> + </tr> + <tr> + <td bgcolor="#EEEEEE">'; echo $myrow['name'] . '<br />' . $myrow['address1'] . '<br />' . $myrow['address2'] . @@ -725,10 +730,14 @@ '<br />' . $myrow['address4'] . '<br />' . $myrow['address5'] . '<br />' . $myrow['address6']; - echo '</td></tr></table>'; + echo '</td> + </tr> + </table>'; /*end of the small table showing charge to account details */ echo _('Page') . ': ' . $PageNumber; - echo '</td></tr></table>'; + echo '</td> + </tr> + </table>'; /*end of the main table showing the company name and charge to details */ if ($InvOrCredit=='Invoice') { @@ -755,7 +764,8 @@ '<br />' . $myrow['deladd5'] . '<br />' . $myrow['deladd6'] . '</td> </tr> - </table><hr>'; + </table> + <hr>'; echo '<table class="table1"> <tr> @@ -880,22 +890,22 @@ $DisplayDiscount = locale_number_format($myrow2['discountpercent']*100,2) . '%'; } - printf ('<td>%s</td> - <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - </tr>', - $myrow2['stockid'], - $myrow2['description'], - $DisplayQty, - $myrow2['units'], - $DisplayPrice, - $DisplayDiscount, - $DisplayNet); - + printf ('<td>%s</td> + <td>%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + </tr>', + $myrow2['stockid'], + $myrow2['description'], + $DisplayQty, + $myrow2['units'], + $DisplayPrice, + $DisplayDiscount, + $DisplayNet); + if (mb_strlen($myrow2['narrative'])>1){ echo $RowStarter . '<td></td><td colspan=6>' . $myrow2['narrative'] . '</td></tr>'; $LineCounter++; @@ -981,7 +991,7 @@ echo _('Telephone') . ': ' . $_SESSION['CompanyRecord']['telephone'] . '<br />'; echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br />'; echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br />'; - echo '</td><td class=number>' . _('Page') . ': ' . $PageNumber . '</td></tr></table>'; + echo '</td><td class="number">' . _('Page') . ': ' . $PageNumber . '</td></tr></table>'; echo '<table class="table1"> <tr> <th>' . _('Item Code') . '</th> @@ -1023,18 +1033,22 @@ /*Print out the invoice text entered */ echo '<table class=table1><tr> - <td class=number>' . _('Sub Total') . '</td> - <td class=number bgcolor="#EEEEEE" width=15%>' . $DisplaySubTot . '</td></tr>'; - echo '<tr><td class=number>' . _('Freight') . '</td> - <td class=number bgcolor="#EEEEEE">' . $DisplayFreight . '</td></tr>'; - echo '<tr><td class=number>' . _('Tax') . '</td> - <td class=number bgcolor="#EEEEEE">' . $DisplayTax . '</td></tr>'; + <td class="number">' . _('Sub Total') . '</td> + <td class="number" bgcolor="#EEEEEE" width=15%>' . $DisplaySubTot . '</td></tr>'; + echo '<tr><td class="number">' . _('Freight') . '</td> + <td class="number" bgcolor="#EEEEEE">' . $DisplayFreight . '</td></tr>'; + echo '<tr><td class="number">' . _('Tax') . '</td> + <td class="number" bgcolor="#EEEEEE">' . $DisplayTax . '</td></tr>'; if ($InvOrCredit=='Invoice'){ - echo '<tr><td class=number><b>' . _('TOTAL INVOICE') . '</b></td> - <td class=number bgcolor="#EEEEEE"><U><b>' . $DisplayTotal . '</b></U></td></tr>'; + echo '<tr> + <td class="number"><b>' . _('TOTAL INVOICE') . '</b></td> + <td class="number" bgcolor="#EEEEEE"><U><b>' . $DisplayTotal . '</b></U></td> + </tr>'; } else { - echo '<tr><td class=number><font color=RED><b>' . _('TOTAL CREDIT') . '</b></font></td> - <td class=number bgcolor="#EEEEEE"><font color="red"><U><b>' . $DisplayTotal . '</b></U></font></td></tr>'; + echo '<tr> + <td class="number"><font color=RED><b>' . _('TOTAL CREDIT') .'</b></font></td> + <td class="number" bgcolor="#EEEEEE"><font color="red"><U><b>' . $DisplayTotal . '</b></U></font></td> + </tr>'; } echo '</table>'; } /* end of check to see that there was an invoice record to print */ Modified: trunk/PrintCustTransPortrait.php =================================================================== --- trunk/PrintCustTransPortrait.php 2011-10-06 07:52:38 UTC (rev 4713) +++ trunk/PrintCustTransPortrait.php 2011-10-06 09:16:44 UTC (rev 4714) @@ -334,8 +334,8 @@ $GetControlMovts = DB_query("SELECT moveqty, serialno - FROM stockserialmoves - WHERE stockmoveno='" . $myrow2['stkmoveno'] . "'",$db); + FROM stockserialmoves + WHERE stockmoveno='" . $myrow2['stkmoveno'] . "'",$db); if ($myrow2['serialised']==1){ while ($ControlledMovtRow = DB_fetch_array($GetControlMovts)){ @@ -358,7 +358,6 @@ PrintLinesToBottom (); include ('includes/PDFTransPageHeaderPortrait.inc'); } //end if need a new page headed up - } } } @@ -487,7 +486,6 @@ $FromTransNo++; } /* end loop to print invoices */ - if (isset($_GET['Email'])){ //email the invoice to address supplied include('includes/header.inc'); @@ -523,14 +521,18 @@ if (!isset($FromTransNo) OR $FromTransNo=='') { - /*if FromTransNo is not set then show a form to allow input of either a single invoice number or a range of invoices to be printed. Also get the last invoice number created to show the user where the current range is up to */ - echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="POST"><table class="selection">'; + echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt="" />' . ' ' . _('Print Invoices or Credit Notes (Portrait Mode)') . '</p>'; - echo '<tr><td>' . _('Print Invoices or Credit Notes') . '</td> - <td><select name="InvOrCredit">'; + + echo '<table class="selection"> + <tr> + <td>' . _('Print Invoices or Credit Notes') . '</td> + <td><select name="InvOrCredit">'; + if ($InvOrCredit=='Invoice' OR !isset($InvOrCredit)){ echo '<option selected value="Invoice">' . _('Invoices') . '</option>'; @@ -539,9 +541,13 @@ echo '<option selected value="Credit">' . _('Credit Notes') . '</option>'; echo '<option value="Invoice">' . _('Invoices') . '</option>'; } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; - echo '<tr><td>' . _('Print EDI Transactions') . '</td><td><select name="PrintEDI">'; + echo '<tr> + <td>' . _('Print EDI Transactions') . '</td> + <td><select name="PrintEDI">'; + if ($InvOrCredit=='Invoice' OR !isset($InvOrCredit)){ echo '<option selected value="No">' . _('Do not Print PDF EDI Transactions') . '</option>'; @@ -554,14 +560,23 @@ } - echo '</select></td></tr>'; - echo '<tr><td>' . _('Start invoice/credit note number to print') . '</td> - <td><input class="number" type="text" max="6" size="7" name="FromTransNo"></td></tr>'; - echo '<tr><td>' . _('End invoice/credit note number to print') . '</td> - <td><input class="number" type="text" max="6" size="7" name="ToTransNo"></td></tr> + echo '</select></td> + </tr>'; + echo '<tr> + <td>' . _('Start invoice/credit note number to print') . '</td> + <td><input class="number" type="text" max="6" size="7" name="FromTransNo"></td> + </tr>'; + echo '<tr> + <td>' . _('End invoice/credit note number to print') . '</td> + <td><input class="number" type="text" max="6" size="7" name="ToTransNo"></td> + </tr> </table>'; - echo '<div class="centre"><br /><input type="submit" name="Print" value="' . _('Print Preview') . '"><p>'; - echo '<input type="submit" name="PrintPDF" value="' . _('Print PDF') . '"></div>'; + echo '<div class="centre"> + <br /> + <input type="submit" name="Print" value="' . _('Print Preview') . '" /> + <br /> + <input type="submit" name="PrintPDF" value="' . _('Print PDF') . '" /> + </div>'; $sql = "SELECT typeno FROM systypes WHERE typeid=10"; @@ -700,7 +715,7 @@ $myrow = DB_fetch_array($result); /* Then there's an invoice (or credit note) to print. So print out the invoice header and GST Number from the company record */ if (count($_SESSION['AllowedPageSecurityTokens'])==1 AND in_array(1, $_SESSION['AllowedPageSecurityTokens']) AND $myrow['debtorno'] != $_SESSION['CustomerID']){ - echo '<p><font color=RED size=4>' . _('This transaction is addressed to another customer and cannot be displayed for privacy reasons') . '. ' . _('Please select only transactions relevant to your company'); + echo '<p><font color="red" size="4">' . _('This transaction is addressed to another customer and cannot be displayed for privacy reasons') . '. ' . _('Please select only transactions relevant to your company'); exit; } @@ -708,17 +723,25 @@ $PageNumber = 1; echo '<table class="table1"> - <tr><td valign=top width=10%><img src="' . $_SESSION['LogoFile'] . '"></td><td bgcolor="#bbb"><b>'; + <tr> + <td valign=top width=10%><img src="' . $_SESSION['LogoFile'] . '"></td> + <td bgcolor="#bbb"><b>'; if ($InvOrCredit=='Invoice') { - echo '<font size=4>' . _('TAX INVOICE') . ' '; + echo '<font size="4">' . _('TAX INVOICE') . ' '; } else { - echo '<font color=RED size=4>' . _('TAX CREDIT NOTE') . ' '; + echo '<font color="red" size="4">' . _('TAX CREDIT NOTE') . ' '; } - echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br /><font size=1>' . _('Tax Authority Ref') . '. ' . $_SESSION['CompanyRecord']['gstno'] . '</td></tr></table>'; + echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font> + <br /><font size="1">' . _('Tax Authority Ref') . '. ' . $_SESSION['CompanyRecord']['gstno'] . '</td> + </tr> + </table>'; /*Now print out the logo and company name and address */ - echo '<table class"table1"><tr><td><font size=4 color="#333"><b>' . $_SESSION['CompanyRecord']['coyname'] . '</b></font><br />'; + echo '<table class"table1"> + <tr> + <td><font size="4" color="#333"><b>' . $_SESSION['CompanyRecord']['coyname'] . '</b></font> + <br />'; echo $_SESSION['CompanyRecord']['regoffice1'] . '<br />'; echo $_SESSION['CompanyRecord']['regoffice2'] . '<br />'; echo $_SESSION['CompanyRecord']['regoffice3'] . '<br />'; @@ -729,11 +752,17 @@ echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br />'; echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br />'; - echo '</td><td width=50% class+"number">'; + echo '</td> + <td width="50%" class="number">'; /*Now the customer charged to details in a sub table within a cell of the main table*/ - echo '<table class="table1"><tr><td align="left" bgcolor="#bbb"><b>' . _('Charge To') . ':</b></td></tr><tr><td bgcolor="#eee">'; + echo '<table class="table1"> + <tr> + <td align="left" bgcolor="#bbb"><b>' . _('Charge To') . ':</b></td> + </tr> + <tr> + <td bgcolor="#eee">'; echo $myrow['name'] . '<br />' . $myrow['address1'] . '<br />' . $myrow['address2'] . @@ -742,10 +771,14 @@ '<br />' . $myrow['address5'] . '<br />' . $myrow['address6']; - echo '</td></tr></table>'; + echo '</td> + </tr> + </table>'; /*end of the small table showing charge to account details */ echo _('Page') . ': ' . $PageNumber; - echo '</td></tr></table>'; + echo '</td> + </tr> + </table>'; /*end of the main table showing the company name and charge to details */ if ($InvOrCredit=='Invoice') { @@ -814,11 +847,12 @@ } else { /* then its a credit note */ - echo '<table WIDTH=50%><tr> - <td align=left bgcolor="#BBBBBB"><b>' . _('Branch') . ':</b></td> + echo '<table width="50%"> + <tr> + <td align=left bgcolor="#BBBBBB"><b>' . _('Branch') . ':</b></td> </tr>'; echo '<tr> - <td bgcolor="#EEEEEE">' .$myrow['brname'] . + <td bgcolor="#EEEEEE">' . $myrow['brname'] . '<br />' . $myrow['braddress1'] . '<br />' . $myrow['braddress2'] . '<br />' . $myrow['braddress3'] . @@ -827,14 +861,17 @@ '<br />' . $myrow['braddress6'] . '</td> </tr></table>'; - echo '<hr><table class="table1"><tr> - <td align=left bgcolor="#bbbbbb"><b>' . _('Date') . '</b></td> - <td align=left bgcolor="#BBBBBB"><b>' . _('Sales Person') . '</font></b></td> - </tr>'; + echo '<hr> + <table class="table1"> + <tr> + <td align="left" bgcolor="#bbbbbb"><b>' . _('Date') . '</b></td> + <td align=left bgcolor="#BBBBBB"><b>' . _('Sales Person') . '</font></b></td> + </tr>'; echo '<tr> - <td bgcolor="#EEEEEE">' . ConvertSQLDate($myrow['trandate']) . '</td> - <td bgcolor="#EEEEEE">' . $myrow['salesmanname'] . '</td> - </tr></table>'; + <td bgcolor="#EEEEEE">' . ConvertSQLDate($myrow['trandate']) . '</td> + <td bgcolor="#EEEEEE">' . $myrow['salesmanname'] . '</td> + </tr> + </table>'; $sql ="SELECT stockmoves.stockid, @@ -903,11 +940,11 @@ printf ('<td>%s</td> <td>%s</td> - <td class+"number">%s</td> - <td class+"number">%s</td> - <td class+"number">%s</td> - <td class+"number">%s</td> - <td class+"number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> </tr>', $myrow2['stockid'], $myrow2['description'], @@ -918,7 +955,10 @@ $DisplayNet); if (mb_strlen($myrow2['narrative'])>1){ - echo $RowStarter . '<td></td><td colspan=6>' . $myrow2['narrative'] . '</td></tr>'; + echo $RowStarter . + '<td></td> + <td colspan=6>' . $myrow2['narrative'] . '</td> + </tr>'; $LineCounter++; } @@ -929,17 +969,25 @@ /* head up a new invoice/credit note page */ $PageNumber++; - echo '</table><table class="table1"><tr><td VALIGN=TOP><img src="' . $_SESSION['LogoFile'] . '"></td><td bgcolor="#bbb"><b>'; + echo '</table> + <table class="table1"> + <tr> + <td valign="top"><img src="' . $_SESSION['LogoFile'] . '"></td> + <td bgcolor="#bbb"><b>'; + if ($InvOrCredit=='Invoice') { - echo '<font size=4>' . _('TAX INVOICE') . ' '; + echo '<font size="4">' . _('TAX INVOICE') . ' '; } else { - echo '<font color=RED size=4>' . _('TAX CREDIT NOTE') . ' '; + echo '<font color="red" size="4">' . _('TAX CREDIT NOTE') . ' '; } - echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br /><font size=1>' . _('GST Number') . ' - ' . $_SESSION['CompanyRecord']['gstno'] . '</td></tr></table>'; + echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br /><font size=1>' . _('GST Number') . ' - ' . $_SESSION['CompanyRecord']['gstno'] . '</td> + </tr> + </table>'; /*Now print out company name and address */ - echo '<table class="table1"><tr> - <td><font size=4 color="#333"><b>' . $_SESSION['CompanyRecord']['coyname'] . '</b></font><br />'; + echo '<table class="table1"> + <tr> + <td><font size=4 color="#333"><b>' . $_SESSION['CompanyRecord']['coyname'] . '</b></font><br />'; echo $_SESSION['CompanyRecord']['regoffice1'] . '<br />'; echo $_SESSION['CompanyRecord']['regoffice2'] . '<br />'; echo $_SESSION['CompanyRecord']['regoffice3'] . '<br />'; @@ -949,7 +997,9 @@ echo _('Telephone') . ': ' . $_SESSION['CompanyRecord']['telephone'] . '<br />'; echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br />'; echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br />'; - echo '</td><td class+"number">' . _('Page') . ': ' . $PageNumber . '</td></tr></table>'; + echo '</td><td class+"number">' . _('Page') . ': ' . $PageNumber . '</td> + </tr> + </table>'; echo '<table class="table1"> <tr> <th>' . _('Item Code') . '</th> @@ -976,13 +1026,20 @@ /* head up a new invoice/credit note page */ $PageNumber++; - echo '<table class="table1"><tr><td VALIGN="TOP"><img src="' . $_SESSION['LogoFile'] . '"></td><td bgcolor="#bbb"><b>'; + echo '<table class="table1"> + <tr> + <td valign="top"><img src="' . $_SESSION['LogoFile'] . '"></td> + <td bgcolor="#bbb"><b>'; if ($InvOrCredit=='Invoice') { - echo '<font size=4>' . _('TAX INVOICE') .' '; + echo '<font size="4">' . _('TAX INVOICE') .' '; } else { - echo '<font color=RED size=4>' . _('TAX CREDIT NOTE') . ' '; + echo '<font color="red" size="4">' . _('TAX CREDIT NOTE') . ' '; } - echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br /><font size=1>' . _('GST Number') . ' - ' . $_SESSION['CompanyRecord']['gstno'] . '</td></tr></table>'; + echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font> + <br /> + <font size=1>' . _('GST Number') . ' - ' . $_SESSION['CompanyRecord']['gstno'] . '</td> + </tr> + </table>'; /*Print out the logo and company name and address */ echo '<table class="table1"> Modified: trunk/PurchData.php =================================================================== --- trunk/PurchData.php 2011-10-06 07:52:38 UTC (rev 4713) +++ trunk/PurchData.php 2011-10-06 09:16:44 UTC (rev 4714) @@ -207,12 +207,12 @@ $myrow['suppname'], locale_number_format($myrow['price'], $myrow['currdecimalplaces']), $myrow['suppliersuom'], - $myrow['conversionfactor'], + locale_number_format($myrow['conversionfactor'],'Variable'), locale_number_format($myrow['price']/$myrow['conversionfactor'],$myrow['currdecimalplaces']), $myrow['currcode'], ConvertSQLDate($myrow['effectivefrom']), - $myrow['minorderqty'], - $myrow['leadtime'], + locale_number_format($myrow['minorderqty'],'Variable'), + locale_number_format($myrow['leadtime'],'Variable'), $DisplayPreferred, $_SERVER['PHP_SELF'], $StockID, @@ -262,14 +262,17 @@ <table cellpadding="3" colspan="4" class="selection"> <tr>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<input type="hidden" name="StockID" value="' . $StockID . '">'; + echo '<input type="hidden" name="StockID" value="' . $StockID . '" />'; echo '<td>' . _('Text in the Supplier') . ' <b>' . _('NAME') . '</b>:</font></td>'; - echo '<td><input type="text" name="Keywords" size="20" maxlength="25"></td>'; + echo '<td><input type="text" name="Keywords" size="20" maxlength="25" /></td>'; echo '<td><font size=3><b>' . _('OR') . '</b></font></td>'; echo '<td>' . _('Text in Supplier') . ' <b>' . _('CODE') . '</b>:</font></td>'; echo '<td><input type="text" name="SupplierCode" size=15 maxlength=18></td>'; echo '</tr></table><br />'; - echo '<div class="centre"><input type="submit" name="SearchSupplier" value="' . _('Find Suppliers Now') . '"></div></form>'; + echo '<div class="centre"> + <input type="submit" name="SearchSupplier" value="' . _('Find Suppliers Now') . '" /> + </div> + </form>'; include ('includes/footer.inc'); exit; }; @@ -292,21 +295,24 @@ $SearchString = '%' . str_replace(' ', '%', $_POST['Keywords']) . '%'; $SQL = "SELECT suppliers.supplierid, - suppliers.suppname, - suppliers.currcode, - suppliers.address1, - suppliers.address2, - suppliers.address3 - FROM suppliers WHERE suppliers.suppname " . LIKE . " '".$SearchString."'"; + suppliers.suppname, + suppliers.currcode, + suppliers.address1, + suppliers.address2, + suppliers.address3 + FROM suppliers + WHERE suppliers.suppname " . LIKE . " '".$SearchString."'"; + } elseif (mb_strlen($_POST['SupplierCode']) > 0) { $SQL = "SELECT suppliers.supplierid, - suppliers.suppname, - suppliers.currcode, - suppliers.address1, - suppliers.address2, - suppliers.address3 - FROM suppliers - WHERE suppliers.supplierid " . LIKE . " '%" . $_POST['SupplierCode'] . "%'"; + suppliers.suppname, + suppliers.currcode, + suppliers.address1, + suppliers.address2, + suppliers.address3 + FROM suppliers + WHERE suppliers.supplierid " . LIKE . " '%" . $_POST['SupplierCode'] . "%'"; + } //one of keywords or SupplierCode was more than a zero length string $ErrMsg = _('The suppliers matching the criteria entered could not be retrieved because'); $DbgMsg = _('The SQL to retrieve supplier details that failed was'); @@ -337,10 +343,11 @@ $StockID = ''; $StockUOM = 'each'; } - echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post> + echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post"> <table cellpadding="2" colspan="7" class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - $TableHeader = '<tr><th>' . _('Code') . '</th> + $TableHeader = '<tr> + <th>' . _('Code') . '</th> <th>' . _('Supplier Name') . '</th> <th>' . _('Currency') . '</th> <th>' . _('Address 1') . '</th> @@ -406,22 +413,24 @@ WHERE purchdata.supplierno='".$SupplierID."' AND purchdata.stockid='".$StockID."' AND purchdata.effectivefrom='" . $_GET['EffectiveFrom'] . "'"; + $ErrMsg = _('The supplier purchasing details for the selected supplier and item could not be retrieved because'); $EditResult = DB_query($sql, $db, $ErrMsg); $myrow = DB_fetch_array($EditResult); $SuppName = $myrow['suppname']; - $_POST['Price'] = $myrow['price']; + $_POST['Price'] = locale_number_format(round($myrow['price'],$myrow['currdecimalplaces']),$myrow['currdecimalplaces']); $_POST['EffectiveFrom'] = ConvertSQLDate($myrow['effectivefrom']); $CurrCode = $myrow['currcode']; $CurrDecimalPlaces = $myrow['currdecimalplaces']; $_POST['SuppliersUOM'] = $myrow['suppliersuom']; $_POST['SupplierDescription'] = $myrow['supplierdescription']; - $_POST['LeadTime'] = $myrow['leadtime']; - $_POST['ConversionFactor'] = $myrow['conversionfactor']; + $_POST['LeadTime'] = locale_number_format($myrow['leadtime'],'Variable'); + + $_POST['ConversionFactor'] = locale_number_format($myrow['conversionfactor'],'Variable'); $_POST['Preferred'] = $myrow['preferred']; - $_POST['MinOrderQty'] = $myrow['minorderqty']; + $_POST['MinOrderQty'] = locale_number_format($myrow['minorderqty'],'Variable'); $_POST['SupplierCode'] = $myrow['suppliers_partno']; - $StockUOM=$myrow['units']; + $StockUOM=$myrow['units']; } echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post"> <table class="selection">'; @@ -431,10 +440,12 @@ } if (isset($_GET['Edit'])) { echo '<tr><td>' . _('Supplier Name') . ':</td> - <td><input type=hidden name="SupplierID" value="' . $SupplierID . '">' . $SupplierID . ' - ' . $SuppName . '<input type=hidden name="WasEffectiveFrom" value="' . $myrow['effectivefrom'] . '" /></td></tr>'; + <td><input type="hidden" name="SupplierID" value="' . $SupplierID . '" />' . $SupplierID . ' - ' . $SuppName . '<input type=hidden name="WasEffectiveFrom" value="' . $myrow['effectivefrom'] . '" /></td> + </tr>'; } else { - echo '<tr><td>' . _('Supplier Name') . ':</td> - <input type=hidden name="SupplierID" maxlength=10 size=11 value="' . $SupplierID . '" />'; + echo '<tr> + <td>' . _('Supplier Name') . ':</td> + <input type="hidden" name="SupplierID" maxlength=10 size=11 value="' . $SupplierID . '" />'; if ($SupplierID!='') { echo '<td>'.$SuppName; } @@ -445,7 +456,7 @@ } echo '</td></tr>'; } - echo '<td><input type=hidden name="StockID" maxlength=10 size=11 value="' . $StockID . '" />'; + echo '<td><input type="hidden" name="StockID" maxlength=10 size=11 value="' . $StockID . '" />'; if (!isset($CurrCode)) { $CurrCode = ''; } @@ -468,11 +479,11 @@ $_POST['MinOrderQty'] = '1'; } echo '<tr><td>' . _('Currency') . ':</td> - <td><input type=hidden name="CurrCode" . value="' . $CurrCode . '">' . $CurrCode . '</td></tr>'; + <td><input type="hidden" name="CurrCode" . value="' . $CurrCode . '">' . $CurrCode . '</td></tr>'; echo '<tr><td>' . _('Price') . ' (' . _('in Supplier Currency') . '):</td> - <td><input type="text" class="number" name="Price" maxlength=12 size=12 value=' . locale_number_format(round($_POST['Price'], $CurrDecimalPlaces),$CurrDecimalPlaces) . ' /></td></tr>'; + <td><input type="text" class="number" name="Price" maxlength="12" size="12" value=' . $_POST['Price'] . ' /></td></tr>'; echo '<tr><td>' . _('Date Updated') . ':</td> - <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="EffectiveFrom" maxlength=10 size=11 value="' . $_POST['EffectiveFrom'] . '"></td></tr>'; + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="EffectiveFrom" maxlength="10" size="11" value="' . $_POST['EffectiveFrom'] . '"></td></tr>'; echo '<tr><td>' . _('Our Unit of Measure') . ':</td>'; if (isset($SupplierID)) { echo '<td>' . $StockUOM . '</td></tr>'; @@ -480,7 +491,8 @@ echo '<tr><td>' . _('Suppliers Unit of Measure') . ':</td>'; echo '<td><input type="text" name="SuppliersUOM" size="20" maxlength="20" value ="' . $_POST['SuppliersUOM'] . '"/>'; echo '</td></tr>'; - if (!isset($_POST['ConversionFactor']) OR $_POST['ConversionFactor'] == '') { + if (!isset($_POST['ConversionFactor']) + OR $_POST['ConversionFactor'] == '') { $_POST['ConversionFactor'] = 1; } echo '<tr><td>' . _('Conversion Factor (to our UOM)') . ':</td> @@ -507,9 +519,9 @@ } echo '</select></td></tr></table><br /><div class="centre">'; if (isset($_GET['Edit'])) { - echo '<input type=submit name="UpdateRecord" value="' . _('Update') . '">'; + echo '<input type=submit name="UpdateRecord" value="' . _('Update') . '" />'; } else { - echo '<input type=submit name="AddRecord" value="' . _('Add') . '">'; + echo '<input type=submit name="AddRecord" value="' . _('Add') . '" />'; } echo '</div>'; echo '<div class="centre">'; Modified: trunk/SecurityTokens.php =================================================================== --- trunk/SecurityTokens.php 2011-10-06 07:52:38 UTC (rev 4713) +++ trunk/SecurityTokens.php 2011-10-06 09:16:44 UTC (rev 4714) @@ -92,15 +92,16 @@ if (isset($_GET['Action']) and $_GET['Action']=='edit') { echo '<td>'. _('Description') . '</td> - <td><input type="text" size=30 maxlength=30 name="TokenDescription" value="'.$_POST['TokenDescription'] .'"></td> - <td><input type="hidden" name="TokenID" value="'.$_GET['SelectedToken'].'"><input type="submit" name="Update" value="' . _('Update') . '" />'; + <td><input type="text" size="50" maxlength="50" name="TokenDescription" value="'.$_POST['TokenDescription'] .'"></td> + <td><input type="hidden" name="TokenID" value="'.$_GET['SelectedToken'].'" /> + <input type="submit" name="Update" value="' . _('Update') . '" />'; } else { echo '<td>'._('Token ID') . '</td> <td><input type="text" name="TokenID" value="'.$_POST['TokenID'].'" /></td> </tr> <tr> <td>'. _('Description') . '</td> - <td><input type="text" size=30 maxlength=30 name="TokenDescription" value="'.$_POST['TokenDescription'] .'" /></td> + <td><input type="text" size="50" maxlength="50" name="TokenDescription" value="'.$_POST['TokenDescription'] .'" /></td> <td><input type="submit" name="Submit" value="' . _('Insert') . '" />'; } @@ -125,7 +126,7 @@ <td>'.$myrow['tokenid'].'</td> <td>'.$myrow['tokenname'].'</td> <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedToken=' . $myrow['tokenid'] . '&Action=edit">' . _('Edit') . '</a></td> - <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedToken=' . $myrow['tokenid'] . '&Action=delete">' . _('Delete') . '</a></td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedToken=' . $myrow['tokenid'] . '&Action=delete" onclick="return confirm(\'' . _('Are you sure you wish to delete this security token?') . '\');">' . _('Delete') . '</a></td> </tr>'; } Modified: trunk/SelectSalesOrder.php =================================================================== --- trunk/SelectSalesOrder.php 2011-10-06 07:52:38 UTC (rev 4713) +++ trunk/SelectSalesOrder.php 2011-10-06 09:16:44 UTC (rev 4714) @@ -25,39 +25,40 @@ } else { /* Now build SQL of items to purchase with purchasing data and preferred suppliers - sorted by preferred supplier */ $sql = "SELECT purchdata.supplierno, - purchdata.stockid, - purchdata.price, - purchdata.suppliers_partno, - purchdata.supplierdescription, - purchdata.conversionfactor, - purchdata.leadtime, - purchdata.suppliersuom, - stockmaster.kgs, - stockmaster.volume, - stockcategory.stockact, - SUM(salesorderdetails.quantity-salesorderdetails.qtyinvoiced) AS orderqty - FROM purchdata INNER JOIN salesorderdetails ON - purchdata.stockid = salesorderdetails.stkcode - INNER JOIN stockmaster ON - purchdata.stockid = stockmaster.stockid - INNER JOIN stockcategory ON - stockmaster.categoryid = stockcategory.categoryid - WHERE purchdata.preferred=1 - AND purchdata.effectivefrom <='" . Date('Y-m-d') . "' - AND (" . $OrdersToPlacePOFor . ") - GROUP BY purchdata.supplierno, - purchdata.stockid, - purchdata.price, - purchdata.suppliers_partno, - purchdata.supplierdescription, - purchdata.conversionfactor, - purchdata.leadtime, - purchdata.suppliersuom, - stockmaster.kgs, - stockmaster.volume, - stockcategory.stockact - ORDER BY purchdata.supplierno, - purchdata.stockid"; + purchdata.stockid, + purchdata.price, + purchdata.suppliers_partno, + purchdata.supplierdescription, + purchdata.conversionfactor, + purchdata.leadtime, + purchdata.suppliersuom, + stockmaster.kgs, + stockmaster.volume, + stockcategory.stockact, + SUM(salesorderdetails.quantity-salesorderdetails.qtyinvoiced) AS orderqty + FROM purchdata INNER JOIN salesorderdetails ON + purchdata.stockid = salesorderdetails.stkcode + INNER JOIN stockmaster ON + purchdata.stockid = stockmaster.stockid + INNER JOIN stockcategory ON + stockmaster.categoryid = stockcategory.categoryid + WHERE purchdata.preferred=1 + AND purchdata.effectivefrom <='" . Date('Y-m-d') . "' + AND (" . $OrdersToPlacePOFor . ") + GROUP BY purchdata.supplierno, + purchdata.stockid, + purchdata.price, + purchdata.suppliers_partno, + purchdata.supplierdescription, + purchdata.conversionfactor, + purchdata.leadtime, + purchdata.suppliersuom, + stockmaster.kgs, + stockmaster.volume, + stockcategory.stockact + ORDER BY purchdata.supplierno, + purchdata.stockid"; + $ErrMsg = _('Unable to retrieve the items on the selected orders for creating purchase orders for'); $ItemResult = DB_query($sql,$db,$ErrMsg); @@ -66,16 +67,16 @@ } else { /*Now get the default delivery address details from the users default stock location */ $sql = "SELECT locationname, - deladd1, - deladd2, - deladd3, - deladd4, - deladd5, - deladd6, - tel, - contact - FROM locations - WHERE loccode = '" .$_SESSION['UserStockLocation'] . "'"; + deladd1, + deladd2, + deladd3, + deladd4, + deladd5, + deladd6, + tel, + contact + FROM locations + WHERE loccode = '" .$_SESSION['UserStockLocation'] . "'"; $ErrMsg = _('The delivery address for the order could not be obtained from the user default stock location'); $DelAddResult = DB_query($sql, $db,$ErrMsg); $DelAddRow = DB_fetch_array($DelAddResult); @@ -97,9 +98,9 @@ /* if an order is/has been created already and the supplier of this item has changed - so need to finish off the order */ //if the user has authority to authorise the PO then it should be created as authorised $AuthSQL ="SELECT authlevel - FROM purchorderauth - WHERE userid='".$_SESSION['UserID']."' - AND currabrev='".$SuppRow['currcode']."'"; + FROM purchorderauth + WHERE userid='".$_SESSION['UserID']."' + AND currabrev='".$SuppRow['currcode']."'"; $AuthResult=DB_query($AuthSQL,$db); $AuthRow=DB_fetch_array($AuthResult); @@ -120,7 +121,7 @@ if (DB_num_rows($AuthResult) ==0){ $AuthMessage = _('Your authority to approve purchase orders in') . ' ' .$SuppRow['currcode'] . ' ' . _('has not yet been set up') . '<br />'; } else { - $AuthMessage = _('You can only authorise up to').' '.$SuppRow['currcode'].' '.$AuthRow['authlevel'].'.<br />'; + $AuthMessage = _('You can only authorise up to') . ' ' . $SuppRow['currcode'] . ' ' . $AuthRow['authlevel'] . '.<br />'; } prnMsg( _('You do not have permission to authorise this purchase order').'.<br />'. _('This order is for').' '. @@ -136,7 +137,7 @@ DB_Txn_Commit($db); } - /*Starting a new purchase order with a different supplier */ + /*Starting a new purchase order with a different supplier */ $result = DB_Txn_Begin($db); $PO_OrderNo = GetNextTransNo(18, $db); //get the next PO number @@ -331,10 +332,10 @@ } else { if (isset($_REQUEST['SelectedCustomer'])) { echo _('For customer') . ': ' . $_REQUEST['SelectedCustomer'] . ' ' . _('and') . ' '; - echo "<input type=hidden name='SelectedCustomer' value=" . $_REQUEST['SelectedCustomer'] . '>'; + echo '<input type="hidden" name="SelectedCustomer" value="' . $_REQUEST['SelectedCustomer'] . '" />'; } if (isset($_REQUEST['SelectedStockItem'])) { - echo _('for the part') . ': ' . $_REQUEST['SelectedStockItem'] . ' ' . _('and') . " <input type=hidden name='SelectedStockItem' value='" . $_REQUEST['SelectedStockItem'] . "'>"; + echo _('for the part') . ': ' . $_REQUEST['SelectedStockItem'] . ' ' . _('and') . ' <input type="hidden" name="SelectedStockItem" value="' . $_REQUEST['SelectedStockItem'] . '" />'; } } @@ -349,46 +350,49 @@ $SQL = "SELECT stockmaster.stockid, stockmaster.description, + stockmaster.decimalplaces, SUM(locstock.quantity) AS qoh, stockmaster.units - FROM stockmaster, - locstock - WHERE stockmaster.stockid=locstock.stockid - AND stockmaster.description " . LIKE . " '" . $SearchString . "' + FROM stockmaster INNER JOIN locstock + ON stockmaster.stockid=locstock.stockid + WHERE stockmaster.description " . LIKE . " '" . $SearchString . "' AND stockmaster.categoryid='" . $_POST['StockCat']. "' GROUP BY stockmaster.stockid, stockmaster.description, + stockmaster.decimalplaces, stockmaster.units ORDER BY stockmaster.stockid"; } elseif (isset($_POST['StockCode'])){ $SQL = "SELECT stockmaster.stockid, - stockmaster.description, - sum(locstock.quantity) as qoh, - stockmaster.units - FROM stockmaster, - locstock - WHERE stockmaster.stockid=locstock.stockid - AND stockmaster.stockid " . LIKE . " '%" . $_POST['StockCode'] . "%' - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - GROUP BY stockmaster.stockid, - stockmaster.description, - stockmaster.units - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.decimalplaces, + SUM(locstock.quantity) AS qoh, + stockmaster.units + FROM stockmaster INNER JOIN locstock + ON stockmaster.stockid=locstock.stockid + WHERE stockmaster.stockid " . LIKE . " '%" . $_POST['StockCode'] . "%' + AND stockmaster.categoryid='" . $_POST['StockCat'] . "' + GROUP BY stockmaster.stockid, + stockmaster.description, + stockmaster.decimalplaces, + stockmaster.units + ORDER BY stockmaster.stockid"; } elseif (!isset($_POST['StockCode']) AND !isset($_POST['Keywords'])) { $SQL = "SELECT stockmaster.stockid, - stockmaster.description, - sum(locstock.quantity) as qoh, - stockmaster.units - FROM stockmaster, - locstock - WHERE stockmaster.stockid=locstock.stockid - AND stockmaster.categoryid='" . $_POST['StockCat'] ."' - GROUP BY stockmaster.stockid, - stockmaster.description, - stockmaster.units - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.decimalplaces, + SUM(locstock.quantity) AS qoh, + stockmaster.units + FROM stockmaster INNER JOIN locstock + ON stockmaster.stockid=locstock.stockid + WHERE stockmaster.categoryid='" . $_POST['StockCat'] ."' + GROUP BY stockmaster.stockid, + stockmaster.description, + stockmaster.decimalplaces, + stockmaster.units + ORDER BY stockmaster.stockid"; } $ErrMsg = _('No stock items were returned by the SQL because'); @@ -412,10 +416,12 @@ if (!isset($_REQUEST['OrderNumber']) or $_REQUEST['OrderNumber']==''){ - echo '<table class=selection>'; - echo '<tr><td>' . _('Order number') . ': </td> - <td><input type="text" name="OrderNumber" maxlength="8" size="9"></td> - <td>' . _('From Stock Location') . ':</td><td><select name="StockLocation"> '; + echo '<table class="selection"> + <tr> + <td>' . _('Order number') . ': </td> + <td><input type="text" name="OrderNumber" maxlength="8" size="9" /></td> + <td>' . _('From Stock Location') . ':</td> + <td><select name="StockLocation"> '; $sql = "SELECT loccode, locationname FROM locations"; @@ -424,36 +430,37 @@ while ($myrow=DB_fetch_array($resultStkLocs)){ if (isset($_POST['StockLocation'])){ if ($myrow['loccode'] == $_POST['StockLocation']){ - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname']. '</option>'; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname']. '</option>'; } } elseif ($myrow['loccode']==$_SESSION['UserStockLocation']){ - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname']. '</option>'; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname']. '</option>'; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname']. '</option>'; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname']. '</option>'; } } - echo '</select></td><td>'; - echo '<select name="Quotations">'; + echo '</select></td> + <td><select name="Quotations">'; if ($_GET['Quotations']=='Quotes_Only'){ $_POST['Quotations']='Quotes_Only'; } if ($_POST['Quotations']=='Quotes_Only'){ - echo '<option selected value="Quotes_Only">' . _('Quotations Only'); - echo '<option value="Orders_Only">' . _('Orders Only'); + echo '<option selected value="Quotes_Only">' . _('Quotations Only') . '</option>'; + echo '<option value="Orders_Only">' . _('Orders Only') . '</option>'; } else { - echo '<option selected value="Orders_Only">' . _('Orders Only'); - echo '<option value="Quotes_Only">' . _('Quotations Only'); + echo '<option selected value="Orders_Only">' . _('Orders Only') . '</option>'; + echo '<option value="Quotes_Only">' . _('Quotations Only') . '</option>'; } - echo '</select> </td><td>'; - echo '<input type=submit name="SearchOrders" value="' . _('Search') . '"></td>'; - echo ' <td><a href="' . $rootpath . '/SelectOrderItems.php?' . SID . '&NewOrder=Yes">' . - _('Add Sales Order') . '</a></td></tr></table>'; + echo '</select> </td> + <td><input type=submit name="SearchOrders" value="' . _('Search') . '"></td> + <td><a href="' . $rootpath . '/SelectOrderItems.php?NewOrder=Yes">' . _('Add Sales Order') . '</a></td> + </tr> + </table>'; } $SQL="SELECT categoryid, @@ -463,10 +470,12 @@ $result1 = DB_query($SQL,$db); - echo '<br /><table class="selection">'; - echo '<tr><th colspan=6><font size=3 color=navy>' . _('To search for sales orders for a specific part use the part selection facilities below'); - echo '</th></tr>'; - echo '<tr> + echo '<br /> + <table class="selection"> + <tr> + <th colspan="6"><font size="3" color="navy">' . _('To search for sales orders for a specific part use the part selection facilities below') . '</th> + </tr> + <tr> <td><font size="1">' . _('Select a stock category') . ':</font> <select name="StockCat">'; @@ -474,27 +483,32 @@ echo '<option value="'. $myrow1['categoryid'] . '">' . $myrow1['categorydescription'] . '</option>'; } - echo '</select> - <td><font size=1>' . _('Enter text extract(s) in the description') . ":</font></td> - <td><input type='Text' name='Keywords' size=20 maxlength=25></td> - </tr> - <tr><td></td> - <td><font size 3><b>" . _('OR') . ' </b></font><font size=1>' . _('Enter extract of the Stock Code') . "</b>:</font></td> - <td><input type='Text' name='StockCode' size=15 maxlength=18></td> + echo '</select></td> + <td><font size=1>' . _('Enter text extract(s) in the description') . ':</font></td> + <td><input type="text" name="Keywords" size="20" maxlength="25" /></td> + </tr> + <tr> + <td></td> + <td><font size="3"><b>' . _('OR') . ' </b></font><font size="1">' . _('Enter extract of the Stock Code') . '</b>:</font></td> + <td><input type="text" name="StockCode" size="15" maxlength="18" /></td> </tr> - </table>"; - echo "<br /><input type=submit name='SearchParts' value='" . _('Search Parts Now') . - "'><input type=submit name='ResetPart' value='" . _('Show All') . "'></div><br />"; + </table>'; + echo '<br /> + <input type="submit" name="SearchParts" value="' . _('Search Parts Now') . '" /> + <input type="submit" name="ResetPart" value="' . _('Show All') . '" /> + </div> + <br />'; -if (isset($StockItemsResult) and DB_num_rows($StockItemsResult)>0) { +if (isset($StockItemsResult) + AND DB_num_rows($StockItemsResult)>0) { - echo '<table cellpadding=2 colspan=7 class=selection>'; + echo '<table cellpadding="2" colspan="7" class="selection">'; $TableHeader = '<tr> - <th>' . _('Code') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('On Hand') . '</th> - <th>' . _('Units') . '</th> - </tr>'; + <th>' . _('Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('On Hand') . '</th> + <th>' . _('Units') . '</th> + </tr>'; echo $TableHeader; $j = 1; @@ -510,15 +524,15 @@ $k++; } - printf("<td><input type=submit name='SelectedStockItem' value='%s'</td> - <td>%s</td> - <td class=number>%s</td> - <td>%s</td> - </tr>", - $myrow['stockid'], - $myrow['description'], - $myrow['qoh'], - $myrow['units']); + printf('<td><input type="submit" name="SelectedStockItem" value="%s" /></td> + <td>%s</td> + <td class="number">%s</td> + <td>%s</td> + </tr>', + $myrow['stockid'], + $myrow['description'], + locale_number_format($myrow['qoh'],$myrow['decimalplaces']), + $myrow['units']); $j++; if ($j == 12){ @@ -544,7 +558,8 @@ if(!isset($_POST['StockLocation'])) { $_POST['StockLocation'] = ''; } - if (isset($_REQUEST['OrderNumber']) && $_REQUEST['OrderNumber'] !='') { + if (isset($_REQUEST['OrderNumber']) + AND $_REQUEST['OrderNumber'] !='') { $SQL = "SELECT salesorders.orderno, debtorsmaster.name, custbranch.brname, @@ -734,20 +749,21 @@ $AuthResult=DB_query($AuthSQL,$db); $AuthRow=DB_fetch_array($AuthResult); - echo '<table cellpadding="2" colspan="7" width="95%" class="selection">'; + echo '<table cellpadding="2" colspan="7" width="95%" class="selection">'; if (isset($_POST['Quotations']) AND $_POST['Quotations']=='Orders_Only'){ $tableheader = '<tr> - <th>' . _('Modify') . '</th> - <th>' . _('Invoice') . '</th> - <th>' . _('Dispatch Note') . '</th> - <th>' . _('Customer') . '</th> - <th>' . _('Branch') . '</th> - <th>' . _('Cust Order') . ' #</th> - <th>' . _('Order Date') . '</th> - <th>' . _('Req Del Date') . '</th> - <th>' . _('Delivery To') . '</th> - <th>' . _('Order Total') . '<br />' . $_SESSION['CompanyRecord']['currencydefault'] . '</th>'; + <th>' . _('Modify') . '</th> + <th>' . _('... [truncated message content] |