From: <dai...@us...> - 2011-10-30 05:51:00
|
Revision: 4737 http://web-erp.svn.sourceforge.net/web-erp/?rev=4737&view=rev Author: daintree Date: 2011-10-30 05:50:51 +0000 (Sun, 30 Oct 2011) Log Message: ----------- number_formatting Modified Paths: -------------- trunk/BOMs.php trunk/ContractBOM.php trunk/ContractOtherReqts.php trunk/Contracts.php trunk/CreditStatus.php trunk/Currencies.php trunk/CustLoginSetup.php trunk/CustWhereAlloc.php trunk/CustomerAllocations.php trunk/CustomerBranches.php trunk/CustomerInquiry.php trunk/SalesPeople.php trunk/Stocks.php trunk/doc/Change.log trunk/includes/DefineCustAllocsClass.php Modified: trunk/BOMs.php =================================================================== --- trunk/BOMs.php 2011-10-29 09:51:53 UTC (rev 4736) +++ trunk/BOMs.php 2011-10-30 05:50:51 UTC (rev 4737) @@ -9,7 +9,7 @@ include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); -function display_children($parent, $level, &$BOMTree) { +function display_children($Parent, $Level, &$BOMTree) { global $db; global $i; @@ -17,25 +17,25 @@ // retrive all children of parent $c_result = DB_query("SELECT parent, component - FROM bom WHERE parent='" . $parent. "'" + FROM bom WHERE parent='" . $Parent. "'" ,$db); if (DB_num_rows($c_result) > 0) { while ($row = DB_fetch_array($c_result)) { - //echo '<br />Parent: ' . $parent . ' Level: ' . $level . ' row[component]: ' . $row['component'] .'<br />'; - if ($parent != $row['component']) { + //echo '<br />Parent: ' . $Parent . ' Level: ' . $Level . ' row[component]: ' . $row['component'] .'<br />'; + if ($Parent != $row['component']) { // indent and display the title of this child - $BOMTree[$i]['Level'] = $level; // Level - if ($level > 15) { + $BOMTree[$i]['Level'] = $Level; // Level + if ($Level > 15) { prnMsg(_('A maximum of 15 levels of bill of materials only can be displayed'),'error'); exit; } - $BOMTree[$i]['Parent'] = $parent; // Assemble + $BOMTree[$i]['Parent'] = $Parent; // Assemble $BOMTree[$i]['Component'] = $row['component']; // Component // call this function again to display this // child's children $i++; - display_children($row['component'], $level + 1, $BOMTree); + display_children($row['component'], $Level + 1, $BOMTree); } } } @@ -53,11 +53,11 @@ $result = DB_query($sql,$db,$ErrMsg,$DbgMsg); if (DB_num_rows($result)!=0) { - while ($myrow=DB_fetch_row($result)){ - if ($myrow[0]==$UltimateParent){ + while ($myrow=DB_fetch_array($result)){ + if ($myrow['component']==$UltimateParent){ return 1; } - if (CheckForRecursiveBOM($UltimateParent, $myrow[0],$db)){ + if (CheckForRecursiveBOM($UltimateParent, $myrow['component'],$db)){ return 1; } } //(while loop) @@ -70,11 +70,10 @@ function DisplayBOMItems($UltimateParent, $Parent, $Component,$Level, $db) { global $ParentMBflag; - // Modified by POPAD&T $sql = "SELECT bom.component, - stockmaster.description, + stockmaster.description as itemdescription, locations.locationname, - workcentres.description, + workcentres.description as workcentrename, bom.quantity, bom.effectiveafter, bom.effectiveto, @@ -83,19 +82,17 @@ stockmaster.controlled, locstock.quantity AS qoh, stockmaster.decimalplaces - FROM bom, - stockmaster, - locations, - workcentres, - locstock - WHERE bom.component='".$Component."' - AND bom.parent = '".$Parent."' - AND bom.component=stockmaster.stockid - AND bom.loccode = locations.loccode - AND locstock.loccode=bom.loccode - AND bom.component = locstock.stockid - AND bom.workcentreadded=workcentres.code - AND stockmaster.stockid=bom.component"; + FROM bom INNER JOIN stockmaster + ON bom.component=stockmaster.stockid + INNER JOIN locations ON + bom.loccode = locations.loccode + INNER JOIN workcentres + ON bom.workcentreadded=workcentres.code + INNER JOIN locstock + ON bom.loccode=locstock.loccode + AND bom.component = locstock.stockid + WHERE bom.component='".$Component."' + AND bom.parent = '".$Parent."'"; $ErrMsg = _('Could not retrieve the BOM components because'); $DbgMsg = _('The SQL used to retrieve the components was'); @@ -104,33 +101,41 @@ //echo $TableHeader; $RowCounter =0; - while ($myrow=DB_fetch_row($result)) { + while ($myrow=DB_fetch_array($result)) { $Level1 = str_repeat('- ',$Level-1).$Level; - if( $myrow[7]=='B' OR $myrow[7]=='K' OR $myrow[7]=='D') { + if( $myrow['mbflag']=='B' + OR $myrow['mbflag']=='K' + OR $myrow['mbflag']=='D') { + $DrillText = '%s%s'; $DrillLink = '<div class="centre">'._('No lower levels').'</div>'; $DrillID=''; } else { $DrillText = '<a href="%s&Select=%s">' . _('Drill Down'); $DrillLink = htmlspecialchars($_SERVER['PHP_SELF']) . '?'; - $DrillID=$myrow[0]; + $DrillID=$myrow['component']; } if ($ParentMBflag!='M' AND $ParentMBflag!='G'){ $AutoIssue = _('N/A'); - } elseif ($myrow[9]==0 AND $myrow[8]==1){//autoissue and not controlled + } elseif ($myrow['controlled']==0 AND $myrow['autoissue']==1){//autoissue and not controlled $AutoIssue = _('Yes'); - } elseif ($myrow[9]==0) { + } elseif ($myrow['controlled']==1) { $AutoIssue = _('No'); } else { $AutoIssue = _('N/A'); } - if ($myrow[7]=='D' OR $myrow[7]=='K' OR $myrow[7]=='A' OR $myrow[7]=='G'){ + if ($myrow['mbflag']=='D' //dummy orservice + OR $myrow['mbflag']=='K' //kit-set + OR $myrow['mbflag']=='A' // assembly + OR $myrow['mbflag']=='G') /* ghost */ { + $QuantityOnHand = _('N/A'); } else { - $QuantityOnHand = locale_number_format($myrow[10],$myrow[11]); - } + $QuantityOnHand = locale_number_format($myrow['qoh'],$myrow['decimalplaces']); + } + printf('<td>%s</td> <td>%s</td> <td>%s</td> @@ -146,23 +151,23 @@ <td><a href="%s&Select=%s&SelectedComponent=%s&delete=1&ReSelect=%s" onclick="return confirm(\'' . _('Are you sure you wish to delete this component from the bill of material?') . '\');">' . _('Delete') . '</a></td> </tr>', $Level1, - $myrow[0], - $myrow[1], - $myrow[2], - $myrow[3], - locale_number_format($myrow[4],'Variable'), - ConvertSQLDate($myrow[5]), - ConvertSQLDate($myrow[6]), + $myrow['component'], + $myrow['itemdescription'], + $myrow['locationname'], + $myrow['workcentrename'], + locale_number_format($myrow['quantity'],'Variable'), + ConvertSQLDate($myrow['effectiveafter']), + ConvertSQLDate($myrow['effectiveto']), $AutoIssue, $QuantityOnHand, htmlspecialchars($_SERVER['PHP_SELF']) . '?', $Parent, - $myrow[0], + $myrow['component'], $DrillLink, $DrillID, htmlspecialchars($_SERVER['PHP_SELF']) . '?', $Parent, - $myrow[0], + $myrow['component'], $UltimateParent); } //END WHILE LIST LOOP @@ -246,7 +251,7 @@ $Errors[$i] = 'EffectiveTo'; $i++; } - if($_POST['AutoIssue']==1 and isset($_POST['Component'])){ + if($_POST['AutoIssue']==1 AND isset($_POST['Component'])){ $sql = "SELECT controlled FROM stockmaster WHERE stockid='" . $_POST['Component'] . "'"; $CheckControlledResult = DB_query($sql,$db); $CheckControlledRow = DB_fetch_row($CheckControlledResult); Modified: trunk/ContractBOM.php =================================================================== --- trunk/ContractBOM.php 2011-10-29 09:51:53 UTC (rev 4736) +++ trunk/ContractBOM.php 2011-10-30 05:50:51 UTC (rev 4737) @@ -14,7 +14,7 @@ */ if (!isset($_SESSION['Contract'.$identifier])){ - header('Location:' . $rootpath . '/Contracts.php?' . SID); + header('Location:' . $rootpath . '/Contracts.php'); exit; } include('includes/header.inc'); @@ -22,11 +22,11 @@ if (isset($_POST['UpdateLines']) OR isset($_POST['BackToHeader'])) { if($_SESSION['Contract'.$identifier]->Status!=2){ //dont do anything if the customer has committed to the contract foreach ($_SESSION['Contract'.$identifier]->ContractBOM as $ContractComponent) { - if ($_POST['Qty'.$ContractComponent->ComponentID]==0){ + if (filter_number_format($_POST['Qty'.$ContractComponent->ComponentID])==0){ //this is the same as deleting the line - so delete it $_SESSION['Contract'.$identifier]->Remove_ContractComponent($ContractComponent->ComponentID); } else { - $_SESSION['Contract'.$identifier]->ContractBOM[$ContractComponent->ComponentID]->Quantity=$_POST['Qty'.$ContractComponent->ComponentID]; + $_SESSION['Contract'.$identifier]->ContractBOM[$ContractComponent->ComponentID]->Quantity=filter_number_format($_POST['Qty'.$ContractComponent->ComponentID]); } } // end loop around the items on the contract BOM } // end if the contract is not currently committed to by the customer @@ -53,29 +53,29 @@ if ($_POST['StockCat']=='All'){ $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - WHERE stockmaster.mbflag!='D' - AND stockmaster.mbflag!='A' - AND stockmaster.mbflag!='K' - and stockmaster.discontinued!=1 - AND stockmaster.description " . LIKE . " '$SearchString' - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE stockmaster.mbflag!='D' + AND stockmaster.mbflag!='A' + AND stockmaster.mbflag!='K' + and stockmaster.discontinued!=1 + AND stockmaster.description " . LIKE . " '$SearchString' + ORDER BY stockmaster.stockid"; } else { $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - WHERE stockmaster.mbflag!='D' - AND stockmaster.mbflag!='A' - AND stockmaster.mbflag!='K' - and stockmaster.discontinued!=1 - AND stockmaster.description " . LIKE . " '$SearchString' - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE stockmaster.mbflag!='D' + AND stockmaster.mbflag!='A' + AND stockmaster.mbflag!='K' + and stockmaster.discontinued!=1 + AND stockmaster.description " . LIKE . " '$SearchString' + AND stockmaster.categoryid='" . $_POST['StockCat'] . "' + ORDER BY stockmaster.stockid"; } } elseif ($_POST['StockCode']){ @@ -84,55 +84,55 @@ if ($_POST['StockCat']=='All'){ $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - WHERE stockmaster.mbflag!='D' - AND stockmaster.mbflag!='A' - AND stockmaster.mbflag!='K' - and stockmaster.discontinued!=1 - AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "' - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE stockmaster.mbflag!='D' + AND stockmaster.mbflag!='A' + AND stockmaster.mbflag!='K' + AND stockmaster.discontinued!=1 + AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "' + ORDER BY stockmaster.stockid"; } else { $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - WHERE stockmaster.mbflag!='D' - AND stockmaster.mbflag!='A' - AND stockmaster.mbflag!='K' - and stockmaster.discontinued!=1 - AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "' - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE stockmaster.mbflag!='D' + AND stockmaster.mbflag!='A' + AND stockmaster.mbflag!='K' + AND stockmaster.discontinued!=1 + AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "' + AND stockmaster.categoryid='" . $_POST['StockCat'] . "' + ORDER BY stockmaster.stockid"; } } else { if ($_POST['StockCat']=='All'){ $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - WHERE stockmaster.mbflag!='D' - AND stockmaster.mbflag!='A' - AND stockmaster.mbflag!='K' - and stockmaster.discontinued!=1 - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE stockmaster.mbflag!='D' + AND stockmaster.mbflag!='A' + AND stockmaster.mbflag!='K' + AND stockmaster.discontinued!=1 + ORDER BY stockmaster.stockid"; } else { $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - WHERE stockmaster.mbflag!='D' - AND stockmaster.mbflag!='A' - AND stockmaster.mbflag!='K' - and stockmaster.discontinued!=1 - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE stockmaster.mbflag!='D' + AND stockmaster.mbflag!='A' + AND stockmaster.mbflag!='K' + AND stockmaster.discontinued!=1 + AND stockmaster.categoryid='" . $_POST['StockCat'] . "' + ORDER BY stockmaster.stockid"; } } @@ -160,52 +160,48 @@ } } - - if (isset($_POST['NewItem'])){ /* NewItem is set from the part selection list as the part code selected */ -/* take the form entries and enter the data from the form into the PurchOrder class variable */ - foreach ($_POST as $ItemCode => $Quantity) { - if (mb_substr($ItemCode, 0, 3)=='Qty') { - $ItemCode=mb_substr($ItemCode, 3, mb_strlen($ItemCode)-3); - $AlreadyOnThisBOM = 0; - + for ($i=0;$i < $_POST['CountOfItems'];$i++) { + $AlreadyOnThisBOM = 0; + if (filter_number_format($_POST['Qty'.$i])>0){ if (count($_SESSION['Contract'.$identifier]->ContractBOM)!=0){ - + foreach ($_SESSION['Contract'.$identifier]->ContractBOM AS $Component) { - + /* do a loop round the items on the order to see that the item is not already on this order */ - if ($Component->StockID == $ItemCode) { + if ($Component->StockID == trim($_POST['StockID'.$i])) { $AlreadyOnThisBOM = 1; - prnMsg( _('The item') . ' ' . $ItemCode . ' ' . _('is already in the bill of material for this contract. The system will not allow the same item on the contract more than once. However you can change the quantity required for the item.'),'error'); + prnMsg( _('The item') . ' ' . trim($_POST['StockID'.$i]) . ' ' . _('is already in the bill of material for this contract. The system will not allow the same item on the contract more than once. However you can change the quantity required for the item.'),'error'); } } /* end of the foreach loop to look for preexisting items of the same code */ } - - if ($AlreadyOnThisBOM!=1 and $Quantity>0){ - + + if ($AlreadyOnThisBOM!=1){ + $sql = "SELECT stockmaster.description, stockmaster.stockid, stockmaster.units, stockmaster.decimalplaces, stockmaster.materialcost+labourcost+overheadcost AS unitcost FROM stockmaster - WHERE stockmaster.stockid = '". $ItemCode . "'"; - + WHERE stockmaster.stockid = '". trim($_POST['StockID'.$i]) . "'"; + $ErrMsg = _('The item details could not be retrieved'); $DbgMsg = _('The SQL used to retrieve the item details but failed was'); $result1 = DB_query($sql,$db,$ErrMsg,$DbgMsg); - + if ($myrow = DB_fetch_array($result1)){ - - $_SESSION['Contract'.$identifier]->Add_To_ContractBOM ($ItemCode, + + $_SESSION['Contract'.$identifier]->Add_To_ContractBOM (trim($_POST['StockID'.$i]), $myrow['description'], - $DefaultWorkCentre, - $Quantity, /* Qty */ + '', + filter_number_format($_POST['Qty'.$i]), /* Qty */ $myrow['unitcost'], - $myrow['units']); + $myrow['units'], + $myrow['decimalplaces']); } else { - prnMsg (_('The item code') . ' ' . $ItemCode . ' ' . _('does not exist in the database and therefore cannot be added to the contract BOM'),'error'); + prnMsg (_('The item code') . ' ' . trim($_POST['StockID'.$i]) . ' ' . _('does not exist in the database and therefore cannot be added to the contract BOM'),'error'); if ($debug==1){ echo '<br />' . $sql; } @@ -213,7 +209,7 @@ exit; } } /* end of if not already on the contract BOM */ - } + } /* the quantity of the item is > 0 */ } } /* end of if its a new item */ @@ -223,21 +219,25 @@ echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (count($_SESSION['Contract'.$identifier]->ContractBOM)>0){ - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/contract.png" title="' . _('Contract Bill of Material') . '" alt="" /> '.$_SESSION['Contract'.$identifier]->CustomerName . '</p>'; + echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/contract.png" title="' . _('Contract Bill of Material') . '" alt="" /> '.$_SESSION['Contract'.$identifier]->CustomerName . ' + </p>'; - echo '<table cellpadding="2" class="selection">'; + echo '<table class="selection">'; if (isset($_SESSION['Contract'.$identifier]->ContractRef)) { - echo '<tr><th colspan="7"><font color="navy" size="2">' . _('Contract Reference:') .' '. $_SESSION['Contract'.$identifier]->ContractRef.'</font></th></tr>'; + echo '<tr> + <th colspan="7"><font color="navy" size="2">' . _('Contract Reference:') .' '. $_SESSION['Contract'.$identifier]->ContractRef.'</font></th> + </tr>'; } echo '<tr> - <th>' . _('Item Code') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Quantity') . '</th> - <th>' . _('UOM') .'</th> - <th>' . _('Unit Cost') . '</th> - <th>' . _('Sub-total') . '</th> + <th>' . _('Item Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('UOM') .'</th> + <th>' . _('Unit Cost') . '</th> + <th>' . _('Sub-total') . '</th> </tr>'; $_SESSION['Contract'.$identifier]->total = 0; @@ -247,7 +247,7 @@ $LineTotal = $ContractComponent->Quantity * $ContractComponent->ItemCost; - $DisplayLineTotal = locale_number_format($LineTotal,2); + $DisplayLineTotal = locale_number_format($LineTotal,$_SESSION['CompanyRecord']['decimalplaces']); if ($k==1){ echo '<tr class="EvenTableRows">'; @@ -259,17 +259,17 @@ echo '<td>' . $ContractComponent->StockID . '</td> <td>' . $ContractComponent->ItemDescription . '</td> - <td><input type="text" class="number" name="Qty' . $ContractComponent->ComponentID . '" size="11" value="' . $ContractComponent->Quantity . '" /></td> + <td><input type="text" class="number" name="Qty' . $ContractComponent->ComponentID . '" size="11" value="' . locale_number_format($ContractComponent->Quantity,$ContractComponent->DecimalPlaces) . '" /></td> <td>' . $ContractComponent->UOM . '</td> - <td class="number">' . $ContractComponent->ItemCost . '</td> + <td class="number">' . locale_number_format($ContractComponent->ItemCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . $DisplayLineTotal . '</td> - <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?identifier='.$identifier. '&Delete=' . $ContractComponent->ComponentID . '">' . _('Delete') . '</a></td></tr>'; + <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?identifier='.$identifier. '&Delete=' . $ContractComponent->ComponentID . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this item from the contract BOM?') . '\');">' . _('Delete') . '</a></td></tr>'; $TotalCost += $LineTotal; } - $DisplayTotal = locale_number_format($TotalCost,2); + $DisplayTotal = locale_number_format($TotalCost,$_SESSION['CompanyRecord']['decimalplaces']); echo '<tr> - <td colspan="6" class="number">' . _('Total Cost') . '</td> + <td colspan="5" class="number">' . _('Total Cost') . '</td> <td class="number"><b>' . $DisplayTotal . '</b></td> </tr> </table>'; @@ -281,11 +281,11 @@ if (!isset($_GET['Edit'])) { $sql="SELECT categoryid, - categorydescription - FROM stockcategory - WHERE stocktype<>'L' - AND stocktype<>'D' - ORDER BY categorydescription"; + categorydescription + FROM stockcategory + WHERE stocktype<>'L' + AND stocktype<>'D' + ORDER BY categorydescription"; $ErrMsg = _('The supplier category details could not be retrieved because'); $DbgMsg = _('The SQL used to retrieve the category details but failed was'); $result1 = DB_query($sql,$db,$ErrMsg,$DbgMsg); @@ -316,21 +316,25 @@ } echo '</select></td> - <td><font size="2">' . _('Enter text extracts in the description') . ':</font></td> - <td><input type="text" name="Keywords" size="20" maxlength="25" value="' . $_POST['Keywords'] . '" /></td></tr> - <tr><td></td> - <td><font size="3"> <b>' . _('OR') . ' </b></font><font size="2">' . _('Enter extract of the Stock Code') . - ':</font></td> - <td><input type="text" name="StockCode" size="15" maxlength="18" value="' . $_POST['StockCode'] . '" /></td> + <td><font size="2">' . _('Enter text extracts in the description') . ':</font></td> + <td><input type="text" name="Keywords" size="20" maxlength="25" value="' . $_POST['Keywords'] . '" /></td> </tr> - <tr><td></td> - <td><font size="3"><b>' . _('OR') . ' </b></font><font size="2"><a target="_blank" href="'.$rootpath.'/Stocks.php">' . _('Create a New Stock Item') . '</a></font></td></tr> - </table><br /> - <div class="centre"><input type="submit" name="Search" value="' . _('Search Now') . '" /> - </div><br />'; + <tr> + <td></td> + <td><font size="3"> <b>' . _('OR') . ' </b></font><font size="2">' . _('Enter extract of the Stock Code') . ':</font></td> + <td><input type="text" name="StockCode" size="15" maxlength="18" value="' . $_POST['StockCode'] . '" /></td> + </tr> + <tr> + <td></td> + <td><font size="3"><b>' . _('OR') . ' </b></font><font size="2"><a target="_blank" href="'.$rootpath.'/Stocks.php">' . _('Create a New Stock Item') . '</a></font></td> + </tr> + </table> + <br /> + <div class="centre"> + <input type="submit" name="Search" value="' . _('Search Now') . '" /> + </div> + <br />'; - - $PartsDisplayed =0; } if (isset($SearchResult)) { @@ -338,17 +342,16 @@ echo '<table cellpadding="1" colspan="7">'; $TableHeader = '<tr> - <th>' . _('Code') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Units') . '</th> - <th>' . _('Image') . '</th> - <th>' . _('Quantity') . '</th> + <th>' . _('Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Units') . '</th> + <th>' . _('Image') . '</th> + <th>' . _('Quantity') . '</th> </tr>'; echo $TableHeader; - $j = 1; $k=0; //row colour counter - + $i=0; while ($myrow=DB_fetch_array($SearchResult)) { if ($k==1){ @@ -366,31 +369,34 @@ } echo '<td>'.$myrow['stockid'].'</td> - <td>'.$myrow['description'].'</td> - <td>'.$myrow['units'] . '</td> - <td>'.$ImageSource.'</td> - <td><input class="number" type="text" size="6" value="0" name="Qty'.$myrow['stockid'].'" /></td> + <td>'.$myrow['description'].'</td> + <td>'.$myrow['units'] . '</td> + <td>'.$ImageSource.'</td> + <td><input class="number" type="text" size="6" value="0" name="Qty'.$i.'" /> + <input type="hidden" name="StockID'.$i.'" value="' . $myrow['stockid'] . '" /> + </td> </tr>'; - - $PartsDisplayed++; - if ($PartsDisplayed == $_SESSION['DisplayRecordsMax']){ + $i++; + if ($i == $_SESSION['DisplayRecordsMax']){ break; } #end of page full new headings if } + #end of while loop - echo '</table>'; - if ($PartsDisplayed == $_SESSION['DisplayRecordsMax']){ + echo '</table> + <input type="hidden" name="CountOfItems" value="'. $i . '" />'; + if ($i == $_SESSION['DisplayRecordsMax']){ - - prnMsg( _('Only the first') . ' ' . $_SESSION['DisplayRecordsMax'] . ' ' . _('can be displayed') . '. ' . - _('Please restrict your search to only the parts required'),'info'); + prnMsg( _('Only the first') . ' ' . $_SESSION['DisplayRecordsMax'] . ' ' . _('can be displayed') . '. ' . _('Please restrict your search to only the parts required'),'info'); } - echo '<br /><div class="centre"><input type="submit" name="NewItem" value="' . _('Add to Contract Bill Of Material') .'" /></div>'; + echo '<br /> + <div class="centre"> + <input type="submit" name="NewItem" value="' . _('Add to Contract Bill Of Material') .'" /> + </div>'; }#end if SearchResults to show -echo '<hr />'; - -echo '</form>'; +echo '<hr /> + </form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/ContractOtherReqts.php =================================================================== --- trunk/ContractOtherReqts.php 2011-10-29 09:51:53 UTC (rev 4736) +++ trunk/ContractOtherReqts.php 2011-10-30 05:50:51 UTC (rev 4737) @@ -24,7 +24,7 @@ if($_SESSION['Contract'.$identifier]->Status!=2){ //dont do anything if the customer has committed to the contract foreach ($_SESSION['Contract'.$identifier]->ContractReqts as $ContractComponentID => $ContractRequirementItem) { - if ($_POST['Qty'.$ContractComponentID]==0){ + if (filter_number_format($_POST['Qty'.$ContractComponentID])==0){ //this is the same as deleting the line - so delete it $_SESSION['Contract'.$identifier]->Remove_ContractRequirement($ContractComponentID); } else { @@ -81,10 +81,12 @@ if (count($_SESSION['Contract'.$identifier]->ContractReqts)>0){ - echo '<table cellpadding="2" colspan="7" class="selection">'; + echo '<table class="selection">'; if (isset($_SESSION['Contract'.$identifier]->ContractRef)) { - echo '<tr><th colspan="5">' . _('Contract Reference:') .' '. $_SESSION['Contract'.$identifier]->ContractRef.'</th></tr>'; + echo '<tr> + <th colspan="5">' . _('Contract Reference:') .' '. $_SESSION['Contract'.$identifier]->ContractRef.'</th> + </tr>'; } echo '<tr> Modified: trunk/Contracts.php =================================================================== --- trunk/Contracts.php 2011-10-29 09:51:53 UTC (rev 4736) +++ trunk/Contracts.php 2011-10-30 05:50:51 UTC (rev 4737) @@ -276,7 +276,6 @@ $WorkCentre = $_SESSION['Contract'.$identifier]->LocCode; } /*The above is a bit of a hack to get a default workcentre for a location based on the users default location*/ - } $sql = "SELECT contractref, @@ -542,22 +541,22 @@ quotation) VALUES ( '". $OrderNo . "', - '" . DB_escape_string($_SESSION['Contract'.$identifier]->DebtorNo) . "', - '" . DB_escape_string($_SESSION['Contract'.$identifier]->BranchCode) . "', - '". DB_escape_string($_SESSION['Contract'.$identifier]->CustomerRef) ."', - '" . DB_escape_string(Date('Y-m-d H:i')) . "', - '" . DB_escape_string($CustomerDetailsRow['salestype']) . "', - '" . DB_escape_string($CustomerDetailsRow['defaultshipvia']) ."', - '". DB_escape_string($CustomerDetailsRow['brname']) . "', - '" . DB_escape_string($CustomerDetailsRow['braddress1']) . "', - '" . DB_escape_string($CustomerDetailsRow['braddress2']) . "', - '" . DB_escape_string($CustomerDetailsRow['braddress3']) . "', - '" . DB_escape_string($CustomerDetailsRow['braddress4']) . "', - '" . DB_escape_string($CustomerDetailsRow['braddress5']) . "', - '" . DB_escape_string($CustomerDetailsRow['braddress6']) . "', - '" . DB_escape_string($CustomerDetailsRow['phoneno']) . "', - '" . DB_escape_string($CustomerDetailsRow['email']) . "', - '" . DB_escape_string($_SESSION['Contract'.$identifier]->LocCode) ."', + '" . $_SESSION['Contract'.$identifier]->DebtorNo . "', + '" . $_SESSION['Contract'.$identifier]->BranchCode . "', + '". $_SESSION['Contract'.$identifier]->CustomerRef ."', + '" . Date('Y-m-d H:i') . "', + '" . $CustomerDetailsRow['salestype'] . "', + '" . $CustomerDetailsRow['defaultshipvia'] ."', + '". $CustomerDetailsRow['brname'] . "', + '" . $CustomerDetailsRow['braddress1'] . "', + '" . $CustomerDetailsRow['braddress2'] . "', + '" . $CustomerDetailsRow['braddress3'] . "', + '" . $CustomerDetailsRow['braddress4'] . "', + '" . $CustomerDetailsRow['braddress5'] . "', + '" . $CustomerDetailsRow['braddress6'] . "', + '" . $CustomerDetailsRow['phoneno'] . "', + '" . $CustomerDetailsRow['email'] . "', + '" . $_SESSION['Contract'.$identifier]->LocCode ."', '" . FormatDateForSQL($_SESSION['Contract'.$identifier]->RequiredDate) . "', '" . Date('Y-m-d') . "', '1' )"; @@ -573,10 +572,10 @@ itemdue) VALUES ('0', '" . $OrderNo . "', - '" . DB_escape_string($_SESSION['Contract'.$identifier]->ContractRef) . "', + '" . $_SESSION['Contract'.$identifier]->ContractRef . "', '" . ($ContractPrice * $_SESSION['Contract'.$identifier]->ExRate) . "', '1', - '" . DB_escape_string($_SESSION['Contract'.$identifier]->CustomerRef) . "', + '" . $_SESSION['Contract'.$identifier]->CustomerRef . "', '" . FormatDateForSQL($_SESSION['Contract'.$identifier]->RequiredDate) . "')"; $DbgMsg = _('The SQL that failed was'); $ErrMsg = _('Unable to add the quotation line'); @@ -586,7 +585,7 @@ //make the status of the contract 1 - to indicate that it is now quoted $sql = "UPDATE contracts SET orderno='" . $OrderNo . "', status='" . 1 . "' - WHERE contractref='" . DB_escape_string($_SESSION['Contract'.$identifier]->ContractRef) . "'"; + WHERE contractref='" . $_SESSION['Contract'.$identifier]->ContractRef . "'"; $ErrMsg = _('Unable to update the contract status and order number because'); $UpdContractResult = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); $Result = DB_Txn_Commit($db); @@ -597,7 +596,6 @@ } //end of if making a quotation - if (isset($_POST['SearchCustomers'])){ if (($_POST['CustKeywords']!='') AND (($_POST['CustCode']!='') OR ($_POST['CustPhone']!=''))) { @@ -624,7 +622,7 @@ FROM custbranch LEFT JOIN debtorsmaster ON custbranch.debtorno=debtorsmaster.debtorno - WHERE custbranch.brname " . LIKE . " '$SearchString' + WHERE custbranch.brname " . LIKE . " '" . $SearchString . "' AND custbranch.disabletrans=0 ORDER BY custbranch.debtorno, custbranch.branchcode"; @@ -832,8 +830,10 @@ /*Set up form for entry of contract header stuff */ - echo '<table class="selection">'; - echo '<tr><td>' . _('Contract Reference') . ':</td><td>'; + echo '<table class="selection"> + <tr> + <td>' . _('Contract Reference') . ':</td> + <td>'; if ($_SESSION['Contract'.$identifier]->Status==0) { /*Then the contract has not become an order yet and we can allow changes to the ContractRef */ echo '<input type="text" name="ContractRef" size="21" maxlength="20" value="' . $_SESSION['Contract'.$identifier]->ContractRef . '" />'; @@ -875,27 +875,36 @@ } } - echo '</select></td></tr>'; + echo '</select></td> + </tr> + <tr> + <td>' . _('Contract Description') . ':</td> + <td><textarea name="ContractDescription" style="width:100%" rows="5">' . $_SESSION['Contract'.$identifier]->ContractDescription . '</textarea></td> + </tr><tr> + <td>'. _('Drawing File') . ' .jpg' . ' ' . _('format only') .':</td> + <td><input type="file" id="Drawing" name="Drawing" /></td> + </tr>'; - echo '<tr><td>' . _('Contract Description'); - echo ':</td><td><textarea name="ContractDescription" style="width:100%" rows="5">' . $_SESSION['Contract'.$identifier]->ContractDescription . '</textarea></td></tr>'; - - echo '<tr><td>'. _('Drawing File') . ' .jpg' . ' ' . _('format only') .':</td><td><input type="file" id="Drawing" name="Drawing" /></td></tr>'; - if (!isset($_SESSION['Contract'.$identifier]->RequiredDate)) { $_SESSION['Contract'.$identifier]->RequiredDate = DateAdd(date($_SESSION['DefaultDateFormat']),'m',1); } - echo '<tr><td>' . _('Required Date') . ':</td> - <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'] . '" name="RequiredDate" size="11" value="' . $_SESSION['Contract'.$identifier]->RequiredDate . '" /></td></tr>'; + echo '<tr> + <td>' . _('Required Date') . ':</td> + <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'] . '" name="RequiredDate" size="11" value="' . $_SESSION['Contract'.$identifier]->RequiredDate . '" /></td> + </tr>'; - echo '<tr><td>' . _('Customer Reference') . ':</td> - <td><input type="text" name="CustomerRef" size="21" maxlength="20" value="' . $_SESSION['Contract'.$identifier]->CustomerRef . '" /></td></tr>'; + echo '<tr> + <td>' . _('Customer Reference') . ':</td> + <td><input type="text" name="CustomerRef" size="21" maxlength="20" value="' . $_SESSION['Contract'.$identifier]->CustomerRef . '" /></td> + </tr>'; if (!isset($_SESSION['Contract'.$identifier]->Margin)){ $_SESSION['Contract'.$identifier]->Margin =50; } - echo '<tr><td>' . _('Gross Profit') . ' %:</td> - <td><input type="text" name="Margin" size="4" maxlength="4" value="' . locale_number_format($_SESSION['Contract'.$identifier]->Margin,2) . '" /></td></tr>'; + echo '<tr> + <td>' . _('Gross Profit') . ' %:</td> + <td><input type="text" name="Margin" size="4" maxlength="4" value="' . locale_number_format($_SESSION['Contract'.$identifier]->Margin,2) . '" /></td> + </tr>'; if ($_SESSION['CompanyRecord']['currencydefault'] != $_SESSION['Contract'.$identifier]->CurrCode){ echo '<tr> @@ -906,7 +915,9 @@ echo '<input type="hidden" name="ExRate" value="' . locale_number_format($_SESSION['Contract'.$identifier]->ExRate,'Variable') . '" />'; } - echo '<tr><td>' . _('Contract Status') . ':</td><td>'; + echo '<tr> + <td>' . _('Contract Status') . ':</td> + <td>'; $StatusText = array(); $StatusText[0] = _('Setup'); @@ -920,19 +931,29 @@ echo _('Order Placed'); } echo '<input type="hidden" name="Status" value="'.$_SESSION['Contract'.$identifier]->Status.'" />'; - echo '</td></tr>'; + echo '</td> + </tr>'; if ($_SESSION['Contract'.$identifier]->Status >=1) { - echo '<tr><td>' . _('Quotation Reference/Sales Order No') . ':</td> - <td><a href="' . $rootpath . '/SelectSalesOrder.php?OrderNumber=' . $_SESSION['Contract'.$identifier]->OrderNo . '&Quotations=Quotes_Only">' . $_SESSION['Contract'.$identifier]->OrderNo . '</a></td></tr>'; + echo '<tr> + <td>' . _('Quotation Reference/Sales Order No') . ':</td> + <td><a href="' . $rootpath . '/SelectSalesOrder.php?OrderNumber=' . $_SESSION['Contract'.$identifier]->OrderNo . '&Quotations=Quotes_Only">' . $_SESSION['Contract'.$identifier]->OrderNo . '</a></td> + </tr>'; } if ($_SESSION['Contract'.$identifier]->Status!=2 and isset($_SESSION['Contract'.$identifier]->WO)) { - echo '<tr><td>' . _('Contract Work Order Ref') . ':</td> - <td>' . $_SESSION['Contract'.$identifier]->WO . '</td></tr>'; + echo '<tr> + <td>' . _('Contract Work Order Ref') . ':</td> + <td>' . $_SESSION['Contract'.$identifier]->WO . '</td> + </tr>'; } echo '</table><br />'; - echo '<table><tr><td> - <table class="selection"><tr><th colspan="6">' . _('Stock Items Required') . '</th></tr>'; + echo '<table> + <tr> + <td> + <table class="selection"> + <tr> + <th colspan="6">' . _('Stock Items Required') . '</th> + </tr>'; $ContractBOMCost = 0; if (count($_SESSION['Contract'.$identifier]->ContractBOM)!=0){ echo '<tr><th>' . _('Item Code') . '</th> @@ -944,29 +965,30 @@ </tr>'; foreach ($_SESSION['Contract'.$identifier]->ContractBOM as $Component) { - echo '<tr><td>' . $Component->StockID . '</td> + echo '<tr> + <td>' . $Component->StockID . '</td> <td>' . $Component->ItemDescription . '</td> - <td class="number">' . $Component->Quantity . '</td> + <td class="number">' . locale_number_format($Component->Quantity,$Component->DecimalPlaces) . '</td> <td>' . $Component->UOM . '</td> - <td class="number">' . locale_number_format($Component->ItemCost,2) . '</td> - <td class="number">' . locale_number_format(($Component->ItemCost * $Component->Quantity),2) . '</td> + <td class="number">' . locale_number_format($Component->ItemCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_number_format(($Component->ItemCost * $Component->Quantity),$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr>'; $ContractBOMCost += ($Component->ItemCost * $Component->Quantity); } echo '<tr> <th colspan="5"><b>' . _('Total stock cost') . '</b></th> - <th class="number"><b>' . locale_number_format($ContractBOMCost,2) . '</b></th> + <th class="number"><b>' . locale_number_format($ContractBOMCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></th> </tr>'; } else { //there are no items set up against this contract echo '<tr> <td colspan="6"><i>' . _('None Entered') . '</i></td> - </tr>'; + </tr>'; } echo '</table></td>'; //end of contract BOM table echo '<td valign="top"> <table class="selection"> <tr> - <th colspan="4">' . _('Other Requirements') . '</th> + <th colspan="4">' . _('Other Requirements') . '</th> </tr>'; $ContractReqtsCost = 0; if (count($_SESSION['Contract'.$identifier]->ContractReqts)!=0){ @@ -979,28 +1001,35 @@ foreach ($_SESSION['Contract'.$identifier]->ContractReqts as $Requirement) { echo '<tr> <td>' . $Requirement->Requirement . '</td> - <td class="number">' . $Requirement->Quantity . '</td> - <td class="number">' . $Requirement->CostPerUnit . '</td> - <td class="number">' . locale_number_format(($Requirement->CostPerUnit * $Requirement->Quantity),2) . '</td> + <td class="number">' . locale_number_format($Requirement->Quantity,'Variable') . '</td> + <td class="number">' . locale_number_format($Requirement->CostPerUnit,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_number_format(($Requirement->CostPerUnit * $Requirement->Quantity),$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr>'; $ContractReqtsCost += ($Requirement->CostPerUnit * $Requirement->Quantity); } - echo '<tr><th colspan="3"><b>' . _('Total other costs') . '</b></th><th class="number"><b>' . locale_number_format($ContractReqtsCost,2) . '</b></th></tr>'; + echo '<tr> + <th colspan="3"><b>' . _('Total other costs') . '</b></th> + <th class="number"><b>' . locale_number_format($ContractReqtsCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></th> + </tr>'; } else { //there are no items set up against this contract - echo '<tr><td colspan="4"><i>' . _('None Entered') . '</i></td></tr>'; + echo '<tr> + <td colspan="4"><i>' . _('None Entered') . '</i></td> + </tr>'; } echo '</table></td></tr></table>'; echo '<br />'; echo'<table class="selection"> - <tr><th>' . _('Total Contract Cost') . '</th> - <th class="number">' . locale_number_format(($ContractBOMCost+$ContractReqtsCost),$_SESSION['CompanyRecord']['decimalplaces']) . '</th> - <th>' . _('Contract Price') . '</th> - <th class="number">' . locale_number_format(($ContractBOMCost+$ContractReqtsCost)/((100-$_SESSION['Contract'.$identifier]->Margin)/100),$_SESSION['CompanyRecord']['decimalplaces']) . '</th> + <tr> + <th>' . _('Total Contract Cost') . '</th> + <th class="number">' . locale_number_format(($ContractBOMCost+$ContractReqtsCost),$_SESSION['CompanyRecord']['decimalplaces']) . '</th> + <th>' . _('Contract Price') . '</th> + <th class="number">' . locale_number_format(($ContractBOMCost+$ContractReqtsCost)/((100-$_SESSION['Contract'.$identifier]->Margin)/100),$_SESSION['CompanyRecord']['decimalplaces']) . '</th> </tr> - </table>'; + </table>'; echo'<p></p>'; - echo '<div class="centre"><input type="submit" name="EnterContractBOM" value="' . _('Enter Items Required') . '" /> + echo '<div class="centre"> + <input type="submit" name="EnterContractBOM" value="' . _('Enter Items Required') . '" /> <input type="submit" name="EnterContractRequirements" value="' . _('Enter Other Requirements') .'" />'; if($_SESSION['Contract'.$identifier]->Status==0){ // not yet quoted echo '<input type="submit" name="CommitContract" value="' . _('Commit Changes') .'" />'; @@ -1008,12 +1037,17 @@ echo '<input type="submit" name="CommitContract" value="' . _('Update Quotation') .'" />'; } if($_SESSION['Contract'.$identifier]->Status==0){ //not yet quoted - echo ' <input type="submit" name="CreateQuotation" value="' . _('Create Quotation') .'" /></div>'; + echo ' <input type="submit" name="CreateQuotation" value="' . _('Create Quotation') .'" /> + </div>'; } else { echo '</div>'; } if ($_SESSION['Contract'.$identifier]->Status!=2) { - echo '<p><div class="centre"><input type="submit" name="CancelContract" value="' . _('Cancel and Delete Contract') . '" /></div></p>'; + echo '<p> + <div class="centre"> + <input type="submit" name="CancelContract" value="' . _('Cancel and Delete Contract') . '" /> + </div> + </p>'; } echo '</form>'; } /*end of if customer selected and entering contract header*/ Modified: trunk/CreditStatus.php =================================================================== --- trunk/CreditStatus.php 2011-10-29 09:51:53 UTC (rev 4736) +++ trunk/CreditStatus.php 2011-10-30 05:50:51 UTC (rev 4737) @@ -17,7 +17,9 @@ } $Errors = array(); $InputError = 0; -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p> +echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.' + </p> <br />'; if (isset($_POST['submit'])) { @@ -141,14 +143,14 @@ links to delete or edit each. These will call the same page again and allow update/input or deletion of the records*/ - $sql = 'SELECT reasoncode, reasondescription, dissallowinvoices FROM holdreasons'; + $sql = "SELECT reasoncode, reasondescription, dissallowinvoices FROM holdreasons"; $result = DB_query($sql, $db); - echo '<table class=selection>'; - echo '<tr> - <th>'. _('Status Code') .'</th> - <th>'. _('Description') .'</th> - <th>'. _('Disallow Invoices') .'</th>'; + echo '<table class="selection"> + <tr> + <th>'. _('Status Code') .'</th> + <th>'. _('Description') .'</th> + <th>'. _('Disallow Invoices') .'</th>'; $k=0; //row colour counter while ($myrow=DB_fetch_array($result)) { @@ -186,7 +188,9 @@ } //end of ifs and buts! if (isset($SelectedReason)) { - echo '<div class="centre"><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">' . _('Show Defined Credit Status Codes') . '</a></div>'; + echo '<div class="centre"> + <a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">' . _('Show Defined Credit Status Codes') . '</a> + </div>'; } if (!isset($_GET['delete'])) { @@ -210,8 +214,8 @@ $_POST['ReasonDescription'] = $myrow['reasondescription']; $_POST['DisallowInvoices'] = $myrow['dissallowinvoices']; - echo '<input type="hidden" name="SelectedReason" value="' . $SelectedReason . '">'; - echo '<input type="hidden" name="ReasonCode" value="' . $_POST['ReasonCode'] . '">'; + echo '<input type="hidden" name="SelectedReason" value="' . $SelectedReason . '" />'; + echo '<input type="hidden" name="ReasonCode" value="' . $_POST['ReasonCode'] . '" />'; echo '<table class="selection"> <tr> <td>'. _('Status Code') .':</td> @@ -226,7 +230,7 @@ <table class="selection"> <tr> <td>'. _('Status Code') .':</td> - <td><input ' . (in_array('ReasonCode',$Errors) ? 'class="inputerror"' : '' ) . ' tabindex=1 type="text" name="ReasonCode" value="'. $_POST['ReasonCode'] .'" size=3 maxlength=2></td> + <td><input ' . (in_array('ReasonCode',$Errors) ? 'class="inputerror"' : '' ) . ' tabindex="1" type="text" name="ReasonCode" value="'. $_POST['ReasonCode'] .'" size="3" maxlength="2" /></td> </tr>'; } @@ -241,13 +245,17 @@ <tr> <td>'. _('Disallow Invoices') . '</td>'; if (isset($_POST['DisallowInvoices']) and $_POST['DisallowInvoices']==1) { - echo '<td><input tabindex=3 type="checkbox" checked name="DisallowInvoices"></td></tr>'; + echo '<td><input tabindex="3" type="checkbox" checked name="DisallowInvoices" /></td> + </tr>'; } else { - echo '<td><input tabindex=3 type="checkbox" name="DisallowInvoices"></td></tr>'; + echo '<td><input tabindex=3 type="checkbox" name="DisallowInvoices" /></td> + </tr>'; } echo '</table> <br /> - <div class="centre"><input tabindex=4 type="submit" name="submit" value="' . _('Enter Information') . '"></div> + <div class="centre"> + <input tabindex="4" type="submit" name="submit" value="' . _('Enter Information') . '" /> + </div> </form>'; } //end if record deleted no point displaying form to add record include('includes/footer.inc'); Modified: trunk/Currencies.php =================================================================== --- trunk/Currencies.php 2011-10-29 09:51:53 UTC (rev 4736) +++ trunk/Currencies.php 2011-10-30 05:50:51 UTC (rev 4737) @@ -40,7 +40,9 @@ $i=1; $sql="SELECT count(currabrev) - FROM currencies WHERE currabrev='".$_POST['Abbreviation']."'"; + FROM currencies + WHERE currabrev='".$_POST['Abbreviation']."'"; + $result=DB_query($sql, $db); $myrow=DB_fetch_row($result); @@ -56,23 +58,23 @@ $Errors[$i] = 'Abbreviation'; $i++; } - if (!is_numeric($_POST['ExchangeRate'])){ + if (!is_numeric(filter_number_format($_POST['ExchangeRate']))){ $InputError = 1; prnMsg(_('The exchange rate must be numeric'),'error'); $Errors[$i] = 'ExchangeRate'; $i++; } - if (!is_numeric($_POST['DecimalPlaces'])){ + if (!is_numeric(filter_number_format($_POST['DecimalPlaces']))){ $InputError = 1; prnMsg(_('The number of decimal places to display for amounts in this currency must be numeric'),'error'); $Errors[$i] = 'DecimalPlaces'; $i++; - }elseif ($_POST['DecimalPlaces']<=0){ + }elseif (filter_number_format($_POST['DecimalPlaces'])<=0){ $InputError = 1; prnMsg(_('The number of decimal places to display for amounts in this currency must be positive or zero'),'error'); $Errors[$i] = 'DecimalPlaces'; $i++; - } elseif ($_POST['DecimalPlaces']>2){ + } elseif (filter_number_format($_POST['DecimalPlaces'])>2){ $InputError = 1; prnMsg(_('The number of decimal places to display for amounts in this currency is expected to be 2 or less'),'error'); $Errors[$i] = 'DecimalPlaces'; @@ -113,8 +115,8 @@ $sql = "UPDATE currencies SET currency='" . $_POST['CurrencyName'] . "', country='". $_POST['Country']. "', hundredsname='" . $_POST['HundredsName'] . "', - decimalplaces='" . $_POST['DecimalPlaces'] . "', - rate='" .$_POST['ExchangeRate'] . "' + decimalplaces='" . filter_number_format($_POST['DecimalPlaces']) . "', + rate='" .filter_number_format($_POST['ExchangeRate']) . "' WHERE currabrev = '" . $SelectedCurrency . "'"; $msg = _('The currency definition record has been updated'); @@ -131,8 +133,8 @@ '" . $_POST['Abbreviation'] . "', '" . $_POST['Country'] . "', '" . $_POST['HundredsName'] . "', - '" . $_POST['DecimalPlaces'] . "', - '" . $_POST['ExchangeRate'] . "')"; + '" . filter_number_format($_POST['DecimalPlaces']) . "', + '" . filter_number_format($_POST['ExchangeRate']) . "')"; $msg = _('The currency definition record has been added'); } @@ -208,7 +210,8 @@ $result = DB_query($sql, $db); echo '<table class="selection">'; - echo '<tr><td></td> + echo '<tr> + <td></td> <th>' . _('ISO4217 Code') . '</th> <th>' . _('Currency Name') . '</th> <th>' . _('Country') . '</th> @@ -216,7 +219,7 @@ <th>' . _('Decimal Places') . '</th> <th>' . _('Exchange Rate') . '</th> <th>' . _('Ex Rate - ECB') .'</th> - </tr>'; + </tr>'; $k=0; //row colour counter /*Get published currency rates from Eurpoean Central Bank */ @@ -249,9 +252,9 @@ <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 class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> <td><a href="%s&SelectedCurrency=%s">%s</a></td> <td><a href="%s&SelectedCurrency=%s&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this currency?') . '\');">%s</a></td> <td><a href="%s/ExchangeRateTrend.php?%s">' . _('Graph') . '</a></td> @@ -261,9 +264,9 @@ $myrow['currency'], $myrow['country'], $myrow['hundredsname'], - $myrow['decimalplaces'], - locale_number_format($myrow['rate'],5), - locale_number_format(GetCurrencyRate($myrow['currabrev'],$CurrencyRatesArray),5), + locale_number_format($myrow['decimalplaces'],0), + locale_number_format($myrow['rate'],6), + locale_number_format(GetCurrencyRate($myrow['currabrev'],$CurrencyRatesArray),6), htmlspecialchars($_SERVER['PHP_SELF']) . '?', $myrow['currabrev'], _('Edit'), @@ -280,14 +283,14 @@ <td>%s</td> <td class="number">%s</td> <td class="number">%s</td> - <td colspan=4>%s</td> + <td colspan="4">%s</td> </tr>', $ImageFile, $myrow['currabrev'], $myrow['currency'], $myrow['country'], $myrow['hundredsname'], - $myrow['decimalplaces'], + locale_number_format($myrow['decimalplaces'],0), 1, _('Functional Currency')); } @@ -312,11 +315,11 @@ //editing an existing payment terms $sql = "SELECT currency, - currabrev, - country, - hundredsname, - decimalplaces, - rate + currabrev, + country, + hundredsname, + decimalplaces, + rate FROM currencies WHERE currabrev='" . $SelectedCurrency . "'"; @@ -329,71 +332,76 @@ $_POST['CurrencyName'] = $myrow['currency']; $_POST['Country'] = $myrow['country']; $_POST['HundredsName'] = $myrow['hundredsname']; - $_POST['ExchangeRate'] = $myrow['rate']; - $_POST['DecimalPlaces'] = $myrow['decimalplaces']; + $_POST['ExchangeRate'] = locale_number_format($myrow['rate'],6); + $_POST['DecimalPlaces'] = locale_number_format($myrow['decimalplaces'],0); - echo '<input type="hidden" name="SelectedCurrency" value="' . $SelectedCurrency . '">'; - echo '<input type="hidden" name="Abbreviation" value="' . $_POST['Abbreviation'] . '">'; + echo '<input type="hidden" name="SelectedCurrency" value="' . $SelectedCurrency . '" />'; + echo '<input type="hidden" name="Abbreviation" value="' . $_POST['Abbreviation'] . '" />'; echo '<table class="selection"> <tr> - <td>' . _('ISO 4217 Currency Code').':</td> - <td>' . $_POST['Abbreviation'] . '</td> + <td>' . _('ISO 4217 Currency Code').':</td> + <td>' . $_POST['Abbreviation'] . '</td> </tr>'; } else { //end of if $SelectedCurrency only do the else when a new record is being entered if (!isset($_POST['Abbreviation'])) {$_POST['Abbreviation']='';} echo '<table class="selection"> <tr> - <td>' ._('Currency Abbreviation') . ':</td> - <td><input ' . (in_array('Abbreviation',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="Abbreviation" value="' . $_POST['Abbreviation'] . '" size=4 maxlength=3></td></tr>'; + <td>' ._('Currency Abbreviation') . ':</td> + <td><input ' . (in_array('Abbreviation',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="Abbreviation" value="' . $_POST['Abbreviation'] . '" size="4" maxlength="3" /></td> + </tr>'; } - echo '<tr><td>'._('Currency Name').':</td>'; - echo '<td>'; + echo '<tr> + <td>'._('Currency Name').':</td> + <td>'; if (!isset($_POST['CurrencyName'])) { $_POST['CurrencyName']=''; } - echo '<input ' . (in_array('CurrencyName',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="CurrencyName" size=20 maxlength=20 value="' . $_POST['CurrencyName'] . '">'; - echo '</td></tr>'; - echo '<tr><td>'._('Country').':</td>'; - echo '<td>'; + echo '<input ' . (in_array('CurrencyName',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="CurrencyName" size="20" maxlength="20" value="' . $_POST['CurrencyName'] . '" /></td> + </tr> + <tr> + <td>'._('Country').':</td> + <td>'; if (!isset($_POST['Country'])) { $_POST['Country']=''; } - echo '<input ' . (in_array('Country',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="Country" size=30 maxlength=50 value="' . $_POST['Country'] . '">'; - echo '</td></tr>'; - - echo '<tr><td>'._('Hundredths Name').':</td>'; - echo '<td>'; + echo '<input ' . (in_array('Country',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="Country" size="30" maxlength="50" value="' . $_POST['Country'] . '" /></td> + </tr> + <tr> + <td>'._('Hundredths Name').':</td> + <td>'; if (!isset($_POST['HundredsName'])) { $_POST['HundredsName']=''; } - echo '<input ' . (in_array('HundredsName',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="HundredsName" size=10 maxlength=15 value="'. $_POST['HundredsName'].'">'; - echo '</td></tr>'; - - echo '<tr><td>'._('Decimal Places to Display').':</td>'; - echo '<td>'; + echo '<input ' . (in_array('HundredsName',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="HundredsName" size="10" maxlength="15" value="'. $_POST['HundredsName'].'" /></td> + </tr> + <tr> + <td>'._('Decimal Places to Display').':</td> + <td>'; if (!isset($_POST['DecimalPlaces'])) { $_POST['DecimalPlaces']=''; } - echo '<input ' . (in_array('DecimalPlaces',$Errors) ? 'class="inputerror"' : 'class="number"' ) .' type="text" name="DecimalPlaces" size="2" maxlength="2" value="'. $_POST['DecimalPlaces'].'">'; - echo '</td></tr>'; - - echo '<tr><td>'._('Exchange Rate').':</td>'; - echo '<td>'; + echo '<input ' . (in_array('DecimalPlaces',$Errors) ? 'class="inputerror"' : 'class="number"' ) .' type="text" name="DecimalPlaces" size="2" maxlength="2" value="'. $_POST['DecimalPlaces'].'" /></td> + </tr> + <tr> + <td>'._('Exchange Rate').':</td> + <td>'; if (!isset($_POST['ExchangeRate'])) { $_POST['ExchangeRate']=''; } - echo '<input ' . (in_array('ExchangeRate',$Errors) ? 'class="inputerror"' : '' ) .' type="text" class=number name="ExchangeRate" size=10 maxlength=9 value='. $_POST['ExchangeRate'].'>'; - echo '</td></tr>'; - echo '</table>'; + echo '<input ' . (in_array('ExchangeRate',$Errors) ? 'class="inputerror"' : '' ) .' type="text" class="number" name="ExchangeRate" size="10" maxlength="9" value="'. $_POST['ExchangeRate'].'"></td> + </tr> + </table>'; - echo '<br /><div class="centre"><input type="Submit" name="submit" value='._('Enter Information').'></div>'; + echo '<br /> + <div class="centre"> + <input type="submit" name="submit" value="'._('Enter Information').'" /> + </div> + </form>'; - echo '</form>'; - } //end if record deleted no point displaying form to add record include('includes/footer.inc'); Modified: trunk/CustLoginSetup.php =================================================================== --- trunk/CustLoginSetup.php 2011-10-29 09:51:53 UTC (rev 4736) +++ trunk/CustLoginSetup.php 2011-10-30 05:50:51 UTC (rev 4737) @@ -134,22 +134,27 @@ $_POST['Email']=''; } -echo '<tr><td>' . _('Password') . ':</td> - <td><input type="password" name="Password" size=22 maxlength=20 value="' . $_POST['Password'] . '"></tr>'; -echo '<tr><td>' . _('Full Name') . ':</td> - <td><input type="text" name="RealName" value="' . $_POST['RealName'] . '" size=36 maxlength=35></td></tr>'; -echo '<tr><td>' . _('Telephone No') . ':</td> - <td><input type="text" name="Phone" value="' . $_POST['Phone'] . '" size=32 maxlength=30></td></tr>'; -echo '<tr><td>' . _('Email Address') .':</td> - <td><input type="text" name="Email" value="' . $_POST['Email'] .'" size=32 maxlength=55></td></tr>'; -echo '<input type="hidden" name="Access" value="1">'; +echo '<tr> + <td>' . _('Password') . ':</td> + <td><input type="password" name="Password" size="22" maxlength="20" value="' . $_POST['Password'] . '" /> + </tr> + <tr> + <td>' . _('Full Name') . ':</td> + <td><input type="text" name="RealName" value="' . $_POST['RealName'] . '" size="36" maxlength="35" /></td> + </tr> + <tr> + <td>' . _('Telephone No') . ':</td> + <td><input type="text" name="Phone" value="' . $_POST['Phone'] . '" size="32" maxlength="30" /></td> + </tr> + <tr> + <td>' . _('Email Address') .':</td> + <td><input type="text" name="Email" value="' . $_POST['Email'] .'" size="32" maxlength="55" /></td> + </tr> + <input type="hidden" name="Access" value="1" /> + <tr> + <td>' . _('Branch Code') . ':</td> + <td><select name="BranchCode">'; - -//Customer is fixed by selection of customer - -echo '<tr><td>' . _('Branch Code') . ':</td> - <td><select name="BranchCode">'; - $sql = "SELECT branchcode FROM custbranch WHERE debtorno = '" . $_SESSION['CustomerID'] . "'"; $result = DB_query($sql,$db); @@ -163,7 +168,7 @@ if (isset($_POST['BranchCode']) and $myrow['branchcode'] == $_POST['BranchCode']){ echo '<option selected value="' . $myrow['branchcode'] . '">' . $myrow['branchcode'] . '</option>'; } else { - echo '<option Value="' . $myrow['branchcode'] . '">' . $myrow['branchcode'] . '</option>'; + echo '<option value="' . $myrow['branchcode'] . '">' . $myrow['branchcode'] . '</option>'; } } @@ -211,15 +216,14 @@ echo '<option value="legal_landscape">' . _('Legal') . ' ' . _('landscape') .'</option>'; } -echo '</select></td></tr>'; +echo '</select></td> + </tr> + <tr> + <td>' . _('Theme') . ':</td> + <td><select name="Theme">'; -echo '<tr> - <td>' . _('Theme') . ':</td> - <td><select name="Theme">'; - $ThemeDirectory = dir('css/'); - while (false != ($ThemeName = $ThemeDirectory->read())){ if (is_dir('css/' . $ThemeName) AND $ThemeName != '.' AND $ThemeName != '..' AND $ThemeName != '.svn'){ @@ -234,13 +238,12 @@ } } -echo '</select></td></tr>'; +echo '</select></td> + </tr> + <tr> + <td>' . _('Language') . ':</td> + <td><select name="UserLanguage">'; - -echo '<tr> - <td>' . _('Language') . ':</td> - <td><select name="UserLanguage">'; - foreach ($LanguagesArray as $LanguageEntry => $LanguageName){ if (isset($_POST['UserLanguage']) and $_POST['UserLanguage'] == $LanguageEntry){ echo '<option selected value="' . $LanguageEntry . '">' . $LanguageName .'</option>'; @@ -250,11 +253,13 @@ echo '<option value="' . $LanguageEntry . '">' . $LanguageName .'</option>'; } } -echo '</select></td></tr>'; - - -echo '</table><br /> - <div class="centre"><input type="submit" name="submit" value="' . _('Enter Information') . '"></div> +echo '</select></t... [truncated message content] |