From: <dai...@us...> - 2011-01-04 00:34:35
|
Revision: 4458 http://web-erp.svn.sourceforge.net/web-erp/?rev=4458&view=rev Author: daintree Date: 2011-01-04 00:34:27 +0000 (Tue, 04 Jan 2011) Log Message: ----------- various Modified Paths: -------------- trunk/Areas.php trunk/ContractBOM.php trunk/ContractCosting.php trunk/ContractOtherReqts.php trunk/Contracts.php trunk/EmailConfirmation.php trunk/MailSalesReport_csv.php trunk/PO_Header.php trunk/PO_Items.php trunk/PO_SelectOSPurchOrder.php trunk/PO_SelectPurchOrder.php trunk/RecurringSalesOrdersProcess.php trunk/SelectContract.php trunk/SelectProduct.php trunk/UpgradeDatabase.php trunk/doc/Change.log.html trunk/doc/Manual/ManualContents.php trunk/includes/ConnectDB.inc trunk/includes/DefineContractClass.php trunk/includes/DefinePOClass.php trunk/includes/GetConfig.php trunk/includes/PO_ReadInOrder.inc trunk/includes/UserLogin.php trunk/includes/session.inc trunk/index.php trunk/sql/mysql/upgrade3.09-3.10.sql trunk/sql/mysql/upgrade3.10-3.11.sql trunk/sql/mysql/upgrade3.11.1-4.00.sql Modified: trunk/Areas.php =================================================================== --- trunk/Areas.php 2010-12-30 22:10:43 UTC (rev 4457) +++ trunk/Areas.php 2011-01-04 00:34:27 UTC (rev 4458) @@ -180,7 +180,7 @@ if (!isset($_GET['delete'])) { - echo "<form method='post' action=" . $_SERVER['PHP_SELF'] . '?' . SID . '><br>'; + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?' . SID . '"><br>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($SelectedArea)) { Modified: trunk/ContractBOM.php =================================================================== --- trunk/ContractBOM.php 2010-12-30 22:10:43 UTC (rev 4457) +++ trunk/ContractBOM.php 2011-01-04 00:34:27 UTC (rev 4458) @@ -38,8 +38,8 @@ if (isset($_POST['BackToHeader'])){ - echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/Contracts.php?' . SID . 'identifier='.$identifier. '">'; - echo '<p>'; + echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/Contracts.php?' . SID . 'identifier='.$identifier. '" />'; + echo '<br />'; prnMsg(_('You should automatically be forwarded to the Contract page. If this does not happen perhaps the browser does not support META Refresh') . '<a href="' . $rootpath . '/Contracts.php?' . SID. 'identifier='.$identifier . '">' . _('click here') . '</a> ' . _('to continue'),'info'); include('includes/footer.inc'); exit; @@ -144,7 +144,7 @@ $DbgMsg = _('The SQL statement that failed was'); $SearchResult = DB_query($sql,$db,$ErrMsg,$DbgMsg); - if (DB_num_rows($SearchResult)==0 && $debug==1){ + if (DB_num_rows($SearchResult)==0 AND $debug==1){ prnMsg( _('There are no products to display matching the criteria provided'),'warn'); } if (DB_num_rows($SearchResult)==1){ @@ -212,7 +212,7 @@ } else { prnMsg (_('The item code') . ' ' . $ItemCode . ' ' . _('does not exist in the database and therefore cannot be added to the contract BOM'),'error'); if ($debug==1){ - echo "<br>".$sql; + echo "<br />".$sql; } include('includes/footer.inc'); exit; @@ -231,11 +231,12 @@ 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">'; + if (isset($_SESSION['Contract'.$identifier]->ContractRef)) { - echo ' ' . _('Contract Reference:') .' '. $_SESSION['Contract'.$identifier]->ContractRef; + echo '<tr><th colspan="7"><font color="navy" size="2">' . _('Contract Reference:') .' '. $_SESSION['Contract'.$identifier]->ContractRef.'</font></th></tr>'; } - echo '<table cellpadding=2 colspan=7 border=1>'; echo '<tr> <th>' . _('Item Code') . '</th> <th>' . _('Description') . '</th> @@ -264,18 +265,18 @@ 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="' . $ContractComponent->Quantity . '" /></td> <td>' . $ContractComponent->UOM . '</td> <td class="number">' . $ContractComponent->ItemCost . '</td> <td class="number">' . $DisplayLineTotal . '</td> - <td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . 'identifier='.$identifier. '&Delete=' . $ContractComponent->ComponentID . '">' . _('Delete') . '</a></td></tr>'; + <td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . 'identifier='.$identifier. '&Delete=' . $ContractComponent->ComponentID . '">' . _('Delete') . '</a></td></tr>'; $TotalCost += $LineTotal; } $DisplayTotal = number_format($TotalCost,2); - echo '<tr><td colspan=6 class="number">' . _('Total Cost') . '</td><td class="number"><b>' . $DisplayTotal . '</b></td></tr></table>'; - echo '<br><div class="centre"><input type="submit" name="UpdateLines" value="' . _('Update Order Lines') . '">'; - echo ' <input type="submit" name="BackToHeader" value="' . _('Back To Contract Header') . '">'; + echo '<tr><td colspan="6" class="number">' . _('Total Cost') . '</td><td class="number"><b>' . $DisplayTotal . '</b></td></tr></table>'; + echo '<br /><div class="centre"><input type="submit" name="UpdateLines" value="' . _('Update Lines') . '" />'; + echo '<input type="submit" name="BackToHeader" value="' . _('Back To Contract Header') . '" /></div>'; } /*Only display the contract BOM lines if there are any !! */ @@ -289,18 +290,18 @@ $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); + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . + _('Print') . '" alt="" />' . ' ' . _('Search For Stock Items') . '</p>'; + echo '<table class="selection"><tr>'; - echo '<table class=selection><tr><p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . - _('Print') . '" alt="">' . ' ' . _('Search For Stock Items') . ''; + echo ":</tr><tr><td><select name='StockCat'>"; - echo ":</font></tr><tr><td><select name='StockCat'>"; - - echo "<option selected value='All'>" . _('All'); + echo "<option selected='True' value='All'>" . _('All').'</option>'; while ($myrow1 = DB_fetch_array($result1)) { if (isset($_POST['StockCat']) and $_POST['StockCat']==$myrow1['categoryid']){ - echo "<option selected value=". $myrow1['categoryid'] . '>' . $myrow1['categorydescription']; + echo '<option selected value="'. $myrow1['categoryid'] . '">' . $myrow1['categorydescription'].'</option>'; } else { - echo "<option value=". $myrow1['categoryid'] . '>' . $myrow1['categorydescription']; + echo '<option value="'. $myrow1['categoryid'] . '">' . $myrow1['categorydescription'].'</option>'; } } @@ -316,19 +317,19 @@ } 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> + <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="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?"' . SID . - '">' . _('Create a New Stock Item') . "</a></font></td></tr> - </table><br> - <div class='centre'><input type=submit name='Search' value='" . _('Search Now') . "'> - </div><br>"; + <td><font size="3"><b>' . _('OR') . ' </b></font><font size="2"><a target="_blank" href="'.$rootpath.'/Stocks.php?' . SID . + '">' . _('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; @@ -336,16 +337,16 @@ if (isset($SearchResult)) { - echo '<table cellpadding=1 colspan=7>'; + echo '<table cellpadding="1" colspan="7">'; - $tableheader = '<tr> + $TableHeader = '<tr> <th>' . _('Code') . '</th> <th>' . _('Description') . '</th> <th>' . _('Units') . '</th> <th>' . _('Image') . '</th> - <th>' . _('Quantity') . '</th + <th>' . _('Quantity') . '</th> </tr>'; - echo $tableheader; + echo $TableHeader; $j = 1; $k=0; //row colour counter @@ -362,7 +363,7 @@ $filename = $myrow['stockid'] . '.jpg'; if (file_exists( $_SESSION['part_pics_dir'] . '/' . $filename) ) { - $ImageSource = '<img src="'.$rootpath . '/' . $_SESSION['part_pics_dir'] . '/' . $filename . '" width="50" height="50">'; + $ImageSource = '<img src="'.$rootpath . '/' . $_SESSION['part_pics_dir'] . '/' . $filename . '" width="50" height="50" />'; } else { $ImageSource = '<i>'._('No Image').'</i>'; } @@ -371,7 +372,7 @@ <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><input class="number" type="text" size="6" value="0" name="qty'.$myrow['stockid'].'" /></td> </tr>'; $PartsDisplayed++; @@ -389,10 +390,10 @@ prnMsg( _('Only the first') . ' ' . $Maximum_Number_Of_Parts_To_Show . ' ' . _('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 '<hr />'; echo '</form>'; include('includes/footer.inc'); Modified: trunk/ContractCosting.php =================================================================== --- trunk/ContractCosting.php 2010-12-30 22:10:43 UTC (rev 4457) +++ trunk/ContractCosting.php 2011-01-04 00:34:27 UTC (rev 4458) @@ -16,7 +16,7 @@ } if (!isset($_GET['SelectedContract'])){ - echo '<br>'; + echo '<br />'; prnMsg( _('This page is expected to be called with the contract reference to show the costing for'), 'error'); include ('includes/footer.inc'); exit; @@ -52,7 +52,7 @@ } echo '<p class="page_title_text"> - <img src="'.$rootpath.'/css/'.$theme.'/images/contract.png" title="' . _('Contract') . '" alt="" />'; + <img src="'.$rootpath.'/css/'.$theme.'/images/contract.png" title="' . _('Contract') . '" alt="" />'; if ($_SESSION['Contract'.$identifier]->Status==3){ echo _('Closed') . ' '; } elseif ($_SESSION['Contract'.$identifier]->Status==2){ @@ -62,13 +62,12 @@ } echo _('Contract') . '<br />' . $_SESSION['Contract'.$identifier]->CustomerName . '<br />' . $_SESSION['Contract'.$identifier]->ContractDescription.'</p>'; -echo '<table> +echo '<table class="selection"> <tr> - <th colspan=6>' . _('Original Costing') .'</th> - <th colspan=6>' . _('Actual Costs') .'</th></tr> - <tr>'; + <th colspan="6">' . _('Original Costing') .'</th> + <th colspan="6">' . _('Actual Costs') .'</th></tr>'; -echo '<tr><th colspan=12>' . _('Inventory Required') . '</th></tr>'; +echo '<tr><th colspan="12">' . _('Inventory Required') . '</th></tr>'; echo '<tr><th>' . _('Item Code') . '</th> <th>' . _('Item Description') . '</th> @@ -83,7 +82,7 @@ <th>' . _('Unit Cost') . '</th> <th>' . _('Total Cost') . '</th> </tr>'; -$ContractBOMBudget =0; +$ContractBOMBudget = 0; $ContractBOMActual = 0; foreach ($_SESSION['Contract'.$identifier]->ContractBOM as $Component) { echo '<tr><td>' . $Component->StockID . '</td> @@ -95,7 +94,7 @@ $ContractBOMBudget += ($Component->ItemCost * $Component->Quantity); if (isset($InventoryIssues[$Component->StockID])){ $InventoryIssues[$Component->StockID]->Matched=1; - echo '<td colspan=2 align="centre">' . _('Actual usage') . '</td> + echo '<td colspan="2" align="center">' . _('Actual usage') . '</td> <td class="number">' . -$InventoryIssues[$Component->StockID]->Quantity . '</td> <td>' . $InventoryIssues[$Component->StockID]->Units . '</td> <td class="number">' . number_format($InventoryIssues[$Component->StockID]->TotalCost/$InventoryIssues[$Component->StockID]->Quantity,2) . '</td> @@ -127,7 +126,7 @@ $OtherReqtsBudget = 0; //other requirements budget sub-table -echo '<tr><td colspan=6><table> +echo '<tr><td colspan="6"><table class="selection"> <tr><th>' . _('Requirement') . '</th> <th>' . _('Quantity') . '</th> <th>' . _('Unit Cost') . '</th> @@ -144,7 +143,7 @@ </table></td>'; //Now other requirements actual in a sub table -echo '<td colspan="6"><table> +echo '<td colspan="6"><table class="selection"> <tr><th>' . _('Supplier') . '</th> <th>' . _('Reference') . '</th> <th>' . _('Date') . '</th> @@ -215,17 +214,17 @@ narrative, amount) VALUES ( 32, - " . $ContractCloseNo . ", + '" . $ContractCloseNo . "', '" . Date('Y-m-d') . "', '" . $PeriodNo . "', '" . $GLCodes['wipact'] . "', '" . _('Variance on contract') . ' ' . $_SESSION['Contract'.$identifier]->ContractRef . "', '" . -$Variance . "')"; - $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The gl entry of WIP for the variance on closing the contract could not be inserted because'); - $DbgMsg = _('The following SQL to insert the GLTrans record was used'); - $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); - $SQL = "INSERT INTO gltrans ( type, + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The gl entry of WIP for the variance on closing the contract could not be inserted because'); + $DbgMsg = _('The following SQL to insert the GLTrans record was used'); + $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); + $SQL = "INSERT INTO gltrans ( type, typeno, trandate, periodno, @@ -233,22 +232,24 @@ narrative, amount) VALUES ( 32, - " . $ContractCloseNo . ", + '" . $ContractCloseNo . "', '" . Date('Y-m-d') . "', '" . $PeriodNo . "', '" . $GLCodes['materialuseagevarac'] . "', '" . _('Variance on contract') . ' ' . $_SESSION['Contract'.$identifier]->ContractRef . "', '" . $Variance . "')"; - $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The gl entry of WIP for the variance on closing the contract could not be inserted because'); - $DbgMsg = _('The following SQL to insert the GLTrans record was used'); - $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The gl entry of WIP for the variance on closing the contract could not be inserted because'); + $DbgMsg = _('The following SQL to insert the GLTrans record was used'); + $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); //Now update the status of the contract to closed - $SQL = "UPDATE contracts SET status=3 WHERE contractref='" . $_SESSION['Contract'.$identifier]->ContractRef . "'"; - $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The status of the contract could not be updated to closed because'); - $DbgMsg = _('The following SQL to change the status of the contract was used'); - $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); + $SQL = "UPDATE contracts + SET status=3 + WHERE contractref='" . $_SESSION['Contract'.$identifier]->ContractRef . "'"; + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The status of the contract could not be updated to closed because'); + $DbgMsg = _('The following SQL to change the status of the contract was used'); + $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); /*Check if the contract work order is still open */ $CheckIfWOOpenResult = DB_query("SELECT closed @@ -272,146 +273,145 @@ * If work done on the contract is a write off then the user must also write off the stock of the contract item as a separate job */ - $result =DB_query("SELECT qtyrecd FROM woitems + $result =DB_query("SELECT qtyrecd FROM woitems WHERE stockid='" . $_SESSION['Contract'.$identifier]->ContractRef . "' AND wo='" . $_SESSION['Contract'.$identifier]->WO . "'",$db); - if (DB_num_rows($result)==1) { - $myrow=DB_fetch_row($result); - if ($myrow[0]==0){ //then the contract wo has not been received (it will only ever be for 1 item) + if (DB_num_rows($result)==1) { + $myrow=DB_fetch_row($result); + if ($myrow[0]==0){ //then the contract wo has not been received (it will only ever be for 1 item) - $WOReceiptNo = GetNextTransNo(26, $db); + $WOReceiptNo = GetNextTransNo(26, $db); - /* Need to get the current location quantity will need it later for the stock movement */ - $SQL = "SELECT locstock.quantity + /* Need to get the current location quantity will need it later for the stock movement */ + $SQL = "SELECT locstock.quantity FROM locstock WHERE locstock.stockid='" . $_SESSION['Contract'.$identifier]->ContractRef . "' AND loccode= '" . $_SESSION['Contract'.$identifier]->LocCode . "'"; - $Result = DB_query($SQL, $db); - if (DB_num_rows($Result)==1){ - $LocQtyRow = DB_fetch_row($Result); - $QtyOnHandPrior = $LocQtyRow[0]; - } else { - /*There must actually be some error this should never happen */ - $QtyOnHandPrior = 0; - } + $Result = DB_query($SQL, $db); + if (DB_num_rows($Result)==1){ + $LocQtyRow = DB_fetch_row($Result); + $QtyOnHandPrior = $LocQtyRow[0]; + } else { + /*There must actually be some error this should never happen */ + $QtyOnHandPrior = 0; + } - $SQL = "UPDATE locstock - SET quantity = locstock.quantity + 1 - WHERE locstock.stockid = '" . $_SESSION['Contract'.$identifier]->ContractRef . "' + $SQL = "UPDATE locstock + SET quantity = locstock.quantity + 1 + WHERE locstock.stockid = '" . $_SESSION['Contract'.$identifier]->ContractRef . "' AND loccode= '" . $_SESSION['Contract'.$identifier]->LocCode . "'"; - $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The location stock record could not be updated because'); - $DbgMsg = _('The following SQL to update the location stock record was used'); - $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The location stock record could not be updated because'); + $DbgMsg = _('The following SQL to update the location stock record was used'); + $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); - /*Insert stock movements - with unit cost */ + /*Insert stock movements - with unit cost */ - $SQL = "INSERT INTO stockmoves (stockid, - type, - transno, - loccode, - trandate, - price, - prd, - reference, - qty, - standardcost, - newqoh) - VALUES ('" . $_SESSION['Contract'.$identifier]->ContractRef . "', - 26, - " . $WOReceiptNo . ", - '" . $_SESSION['Contract'.$identifier]->LocCode . "', - '" . Date('Y-m-d') . "', - " . ($OtherReqtsBudget+$ContractBOMBudget) . ", - " . $PeriodNo . ", - '" . $_SESSION['Contract'.$identifier]->WO . "', - 1, - " . ($OtherReqtsBudget+$ContractBOMBudget) . ", - " . ($QtyOnHandPrior + 1) . ")"; + $SQL = "INSERT INTO stockmoves (stockid, + type, + transno, + loccode, + trandate, + price, + prd, + reference, + qty, + standardcost, + newqoh) + VALUES ('" . $_SESSION['Contract'.$identifier]->ContractRef . "', + 26, + '" . $WOReceiptNo . "', + '" . $_SESSION['Contract'.$identifier]->LocCode . "', + '" . Date('Y-m-d') . "', + '" . ($OtherReqtsBudget+$ContractBOMBudget) . "', + '" . $PeriodNo . "', + '" . $_SESSION['Contract'.$identifier]->WO . "', + 1, + '" . ($OtherReqtsBudget+$ContractBOMBudget) . "', + '" . ($QtyOnHandPrior + 1) . "')"; - $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('stock movement records could not be inserted when processing the work order receipt because'); - $DbgMsg = _('The following SQL to insert the stock movement records was used'); - $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('stock movement records could not be inserted when processing the work order receipt because'); + $DbgMsg = _('The following SQL to insert the stock movement records was used'); + $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); - /*Get the ID of the StockMove... */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + /*Get the ID of the StockMove... */ + $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); - /* If GLLink_Stock then insert GLTrans to debit the GL Code and credit GRN Suspense account at standard cost*/ - if ($_SESSION['CompanyRecord']['gllink_stock']==1 AND ($OtherReqtsBudget+$ContractBOMBudget)!=0){ - /*GL integration with stock is activated so need the GL journals to make it so */ + /* If GLLink_Stock then insert GLTrans to debit the GL Code and credit GRN Suspense account at standard cost*/ + if ($_SESSION['CompanyRecord']['gllink_stock']==1 AND ($OtherReqtsBudget+$ContractBOMBudget)!=0){ + /*GL integration with stock is activated so need the GL journals to make it so */ + /*first the debit the finished stock of the item received from the WO + the appropriate account was already retrieved into the $StockGLCode variable as the Processing code is kicked off + it is retrieved from the stock category record of the item by a function in SQL_CommonFunctions.inc*/ - /*first the debit the finished stock of the item received from the WO - the appropriate account was already retrieved into the $StockGLCode variable as the Processing code is kicked off - it is retrieved from the stock category record of the item by a function in SQL_CommonFunctions.inc*/ + $SQL = "INSERT INTO gltrans (type, + typeno, + trandate, + periodno, + account, + narrative, + amount) + VALUES (26, + '" . $WOReceiptNo . "', + '" . Date('Y-m-d') . "', + '" . $PeriodNo . "', + '" . $GLCodes['stockact'] . "', + '" . $_SESSION['Contract'.$identifier]->WO . ' ' . $_SESSION['Contract'.$identifier]->ContractRef . ' - x 1 @ ' . number_format(($OtherReqtsBudget+$ContractBOMBudget),2) . "', + '" . ($OtherReqtsBudget+$ContractBOMBudget) . "')"; - $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount) - VALUES (26, - " . $WOReceiptNo . ", - '" . Date('Y-m-d') . "', - " . $PeriodNo . ", - " . $GLCodes['stockact'] . ", - '" . $_SESSION['Contract'.$identifier]->WO . ' ' . $_SESSION['Contract'.$identifier]->ContractRef . ' - x 1 @ ' . number_format(($OtherReqtsBudget+$ContractBOMBudget),2) . "', - " . ($OtherReqtsBudget+$ContractBOMBudget) . ')'; + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The receipt of contract work order finished stock GL posting could not be inserted because'); + $DbgMsg = _('The following SQL to insert the work order receipt of finished items GLTrans record was used'); + $Result = DB_query($SQL,$db,$ErrMsg, $DbgMsg, true); - $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The receipt of contract work order finished stock GL posting could not be inserted because'); - $DbgMsg = _('The following SQL to insert the work order receipt of finished items GLTrans record was used'); - $Result = DB_query($SQL,$db,$ErrMsg, $DbgMsg, true); + /*now the credit WIP entry*/ + $SQL = "INSERT INTO gltrans (type, + typeno, + trandate, + periodno, + account, + narrative, + amount) + VALUES (26, + '" . $WOReceiptNo . "', + '" . Date('Y-m-d') . "', + '" . $PeriodNo . "', + '" . $GLCodes['wipact'] . "', + '" . $_SESSION['Contract'.$identifier]->WO . ' ' . $_SESSION['Contract'.$identifier]->ContractRef . ' - x 1 @ ' . number_format(($OtherReqtsBudget+$ContractBOMBudget),2) . "', + '" . -($OtherReqtsBudget+$ContractBOMBudget) . "')"; - /*now the credit WIP entry*/ - $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount) - VALUES (26, - " . $WOReceiptNo . ", - '" . Date('Y-m-d') . "', - " . $PeriodNo . ", - " . $GLCodes['wipact'] . ", - '" . $_SESSION['Contract'.$identifier]->WO . ' ' . $_SESSION['Contract'.$identifier]->ContractRef . ' - x 1 @ ' . number_format(($OtherReqtsBudget+$ContractBOMBudget),2) . "', - " . -($OtherReqtsBudget+$ContractBOMBudget) . ")"; + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The WIP credit on receipt of finished items from a work order GL posting could not be inserted because'); + $DbgMsg = _('The following SQL to insert the WIP GLTrans record was used'); + $Result = DB_query($SQL,$db, $ErrMsg, $DbgMsg,true); - $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The WIP credit on receipt of finished items from a work order GL posting could not be inserted because'); - $DbgMsg = _('The following SQL to insert the WIP GLTrans record was used'); - $Result = DB_query($SQL,$db, $ErrMsg, $DbgMsg,true); + } /* end of if GL and stock integrated and standard cost !=0 */ - } /* end of if GL and stock integrated and standard cost !=0 */ - - //update the wo with the new qtyrecd - $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' ._('Could not update the work order item record with the total quantity received because'); - $DbgMsg = _('The following SQL was used to update the work order'); - $UpdateWOResult =DB_query("UPDATE woitems + //update the wo with the new qtyrecd + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' ._('Could not update the work order item record with the total quantity received because'); + $DbgMsg = _('The following SQL was used to update the work order'); + $UpdateWOResult =DB_query("UPDATE woitems SET qtyrecd=qtyrecd+1 - WHERE wo=" . $_SESSION['Contract'.$identifier]->WO . " - AND stockid='" . $_SESSION['Contract'.$identifier]->ContractRef . "'", - $db,$ErrMsg,$DbgMsg,true); - }//end if the contract wo was not received - work order item received/processed above if not - }//end if there was a row returned from the woitems query - } //end if the work order was still open (so end of closing it and processing receipt if necessary) + WHERE wo='" . $_SESSION['Contract'.$identifier]->WO . "' + AND stockid='" . $_SESSION['Contract'.$identifier]->ContractRef . "'", + $db,$ErrMsg,$DbgMsg,true); + }//end if the contract wo was not received - work order item received/processed above if not + }//end if there was a row returned from the woitems query + } //end if the work order was still open (so end of closing it and processing receipt if necessary) - DB_Txn_Commit($db); + DB_Txn_Commit($db); - $_SESSION['Contract'.$identifier]->Status=3; - prnMsg(_('The contract has been closed. No further charges can be posted against this contract.'),'success'); + $_SESSION['Contract'.$identifier]->Status=3; + prnMsg(_('The contract has been closed. No further charges can be posted against this contract.'),'success'); } //end if Closing the contract Close Contract button hit if ($_SESSION['Contract'.$identifier]->Status ==2){//the contract is an order being processed now - echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?' .SID .'&SelectedContract=' . $_SESSION['Contract'.$identifier]->ContractRef . '&identifier=' . $identifier . '">'; + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?' .SID .'&SelectedContract=' . $_SESSION['Contract'.$identifier]->ContractRef . '&identifier=' . $identifier . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<br><div class="centre"><input type="submit" name="CloseContract" Value="' . _('Close Contract') . '" onclick="return confirm(\'' . _('Closing the contract will prevent further stock being issued to it and charges being made against it. Variances will be taken to the profit and loss account. Are You Sure?') . '\');"></div>'; + echo '<br /><div class="centre"><input type="submit" name="CloseContract" value="' . _('Close Contract') . '" onclick="return confirm(\'' . _('Closing the contract will prevent further stock being issued to it and charges being made against it. Variances will be taken to the profit and loss account. Are You Sure?') . '\');" /></div>'; echo '</form>'; } include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/ContractOtherReqts.php =================================================================== --- trunk/ContractOtherReqts.php 2010-12-30 22:10:43 UTC (rev 4457) +++ trunk/ContractOtherReqts.php 2011-01-04 00:34:27 UTC (rev 4458) @@ -40,8 +40,8 @@ if (isset($_POST['BackToHeader'])){ - echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/Contracts.php?' . SID . 'identifier='.$identifier. '">'; - echo '<p>'; + echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/Contracts.php?' . SID . 'identifier='.$identifier. '" />'; + echo '<br />'; prnMsg(_('You should automatically be forwarded to the Contract page. If this does not happen perhaps the browser does not support META Refresh') . '<a href="' . $rootpath . '/Contracts.php?' . SID. 'identifier='.$identifier . '">' . _('click here') . '</a> ' . _('to continue'),'info'); include('includes/footer.inc'); exit; @@ -84,12 +84,12 @@ if (count($_SESSION['Contract'.$identifier]->ContractReqts)>0){ + echo '<table cellpadding="2" colspan="7" class="selection">'; if (isset($_SESSION['Contract'.$identifier]->ContractRef)) { - echo ' ' . _('Contract Reference:') .' '. $_SESSION['Contract'.$identifier]->ContractRef; + echo '<tr><th colspan="5">' . _('Contract Reference:') .' '. $_SESSION['Contract'.$identifier]->ContractRef.'</th></tr>'; } - echo '<table cellpadding=2 colspan=7 border=1>'; echo '<tr> <th>' . _('Description') . '</th> <th>' . _('Quantity') . '</th> @@ -115,31 +115,36 @@ } echo '<td><textarea name="Requirement' . $ContractReqtID . '" cols="30" rows="3">' . $ContractComponent->Requirement . '</textarea></td> - <td><input type=text class="number" name="Qty' . $ContractReqtID . '" size="11" value="' . $ContractComponent->Quantity . '"></td> - <td><input type=text class="number" name="CostPerUnit' . $ContractReqtID . '" size="11" value="' . $ContractComponent->CostPerUnit . '"></td> + <td><input type="text" class="number" name="Qty' . $ContractReqtID . '" size="11" value="' . $ContractComponent->Quantity . '" /></td> + <td><input type="text" class="number" name="CostPerUnit' . $ContractReqtID . '" size="11" value="' . $ContractComponent->CostPerUnit . '" /></td> <td class="number">' . $DisplayLineTotal . '</td> - <td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . 'identifier='.$identifier. '&Delete=' . $ContractReqtID . '">' . _('Delete') . '</a></td></tr>'; + <td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . 'identifier='.$identifier. '&Delete=' . $ContractReqtID . '">' . _('Delete') . '</a></td></tr>'; $TotalCost += $LineTotal; } $DisplayTotal = number_format($TotalCost,2); echo '<tr><td colspan="4" class="number">' . _('Total Other Requirements Cost') . '</td><td class="number"><b>' . $DisplayTotal . '</b></td></tr></table>'; - echo '<br><div class="centre"><input type="submit" name="UpdateLines" value="' . _('Update Other Requirements Lines') . '">'; - echo ' <input type="submit" name="BackToHeader" value="' . _('Back To Contract Header') . '">'; + echo '<br /><div class="centre"><input type="submit" name="UpdateLines" value="' . _('Update Other Requirements Lines') . '" />'; + echo ' <input type="submit" name="BackToHeader" value="' . _('Back To Contract Header') . '" /></div>'; } /*Only display the contract other requirements lines if there are any !! */ -echo '<hr>'; +echo '<br />'; /*Now show form to add new requirements to the contract */ -echo '<table> +if (!isset($_POST['RequirementDescription'])) { + $_POST['RequirementDescription']=''; + $_POST['Quantity']=0; + $_POST['CostPerUnit']=0; +} +echo '<table class="selection"> <tr><th colspan="2">' . _('Enter New Requirements') . '</th></tr> <tr><td>' . _('Requirement Description') . '</td> <td><textarea name="RequirementDescription" cols="30" rows="3">' . $_POST['RequirementDescription'] . '</textarea></td></tr>'; -echo '<tr><td>' . _('Quantity Required') . ':</td><td><input type="text" name="Quantity" size=10 maxlength=10 value="' . $_POST['Quantity'] . '"></td></tr>'; -echo '<tr><td>' . _('Cost Per Unit') . ':</td><td><input type="text" name="CostPerUnit" size=10 maxlength=10 value="' . $_POST['CostPerUnit'] . '"></td></tr>'; +echo '<tr><td>' . _('Quantity Required') . ':</td><td><input type="text" class="number" name="Quantity" size="10" maxlength="10" value="' . $_POST['Quantity'] . '" /></td></tr>'; +echo '<tr><td>' . _('Cost Per Unit') . ':</td><td><input type="text" class="number" name="CostPerUnit" size="10" maxlength="10" value="' . $_POST['CostPerUnit'] . '" /></td></tr>'; echo '</table>'; -echo '<div class="centre"><input type="submit" name="EnterNewRequirement" value="' . _('Enter New Contract Requirement') . '"></div>'; +echo '<br /><div class="centre"><input type="submit" name="EnterNewRequirement" value="' . _('Enter New Contract Requirement') . '" /></div>'; echo '</form>'; include('includes/footer.inc'); Modified: trunk/Contracts.php =================================================================== --- trunk/Contracts.php 2010-12-30 22:10:43 UTC (rev 4457) +++ trunk/Contracts.php 2011-01-04 00:34:27 UTC (rev 4458) @@ -81,8 +81,8 @@ } if (isset($_POST['EnterContractBOM']) AND !$InputError){ - echo "<meta http-equiv='Refresh' content='0; url=" . $rootpath . '/ContractBOM.php?' . SID . 'identifier='.$identifier. "'>"; - echo '<p>'; + echo "<meta http-equiv='Refresh' content='0; url=" . $rootpath . '/ContractBOM.php?' . SID . 'identifier='.$identifier. "' />"; + echo '<br />'; prnMsg(_('You should automatically be forwarded to the entry of the Contract line items page') . '. ' . _('If this does not happen') . ' (' . _('if the browser does not support META Refresh') . ') ' . "<a href='$rootpath/ContractBOM.php?" . SID. 'identifier='.$identifier . "'>" . _('click here') . '</a> ' . _('to continue'),'info'); @@ -90,8 +90,8 @@ exit; } if (isset($_POST['EnterContractRequirements']) AND !$InputError){ - echo "<meta http-equiv='Refresh' content='0; url=" . $rootpath . '/ContractOtherReqts.php?' . SID . 'identifier='.$identifier. "'>"; - echo '<p>'; + echo "<meta http-equiv='Refresh' content='0; url=" . $rootpath . '/ContractOtherReqts.php?' . SID . 'identifier='.$identifier. "' />"; + echo '<br />'; prnMsg(_('You should automatically be forwarded to the entry of the Contract requirements page') . '. ' . _('If this does not happen') . ' (' . _('if the browser does not support META Refresh') . ') ' . "<a href='$rootpath/ContractOtherReqts.php?" . SID. 'identifier='.$identifier . "'>" . _('click here') . '</a> ' . _('to continue'),'info'); @@ -100,7 +100,7 @@ } } /* end of if going to contract BOM or contract requriements */ -echo '<a href="'. $rootpath . '/SelectContract.php?' . SID .'">'. _('Back to Contract Selection'). '</a><br>'; +echo '<a href="'. $rootpath . '/SelectContract.php?' . SID .'">'. _('Back to Contract Selection'). '</a><br />'; //attempting to upload the drawing image file if (isset($_FILES['Drawing']) AND $_FILES['Drawing']['name'] !='' AND $_SESSION['Contract'.$identifier]->ContractRef!='') { @@ -306,9 +306,9 @@ $sql = "UPDATE contracts SET categoryid = '" . $_POST['CategoryID'] ."', requireddate = '" . FormatDateForSQL($_POST['RequiredDate']) . "', loccode='" . $_POST['LocCode'] . "', - margin = " . $_POST['Margin'] . ", + margin = '" . $_POST['Margin'] . "', customerref = '" . $_POST['CustomerRef'] . "', - exrate = " . $_POST['ExRate'] . " + exrate = '" . $_POST['ExRate'] . "' WHERE contractref ='" . $_POST['ContractRef'] . "'"; $ErrMsg = _('Cannot update the contract because'); $result = DB_query($sql,$db,$ErrMsg); @@ -323,7 +323,7 @@ VALUES ( '" . $_POST['ContractRef'] . "', '" . $Component->StockID . "', '" . $WorkCentre . "', - " . $Component->Quantity . ")"; + '" . $Component->Quantity . "')"; $result = DB_query($sql,$db,$ErrMsg); } @@ -338,7 +338,7 @@ VALUES ( '" . $_POST['ContractRef'] . "', '" . $Requirement->Requirement . "', '" . $Requirement->CostPerUnit . "', - " . $Requirement->Quantity . ")"; + '" . $Requirement->Quantity . "')"; $result = DB_query($sql,$db,$ErrMsg); } @@ -375,7 +375,7 @@ $DbgMsg = _('The SQL that failed to update the quotation was'); $UpdQuoteResult = DB_query($sql,$db,$ErrMsg,$DbgMsg); pnMsg(_('The contract quotation has been updated based on the new contract cost and margin'),'success'); - echo '<br><a href="' .$rootpath . '/SelectSalesOrder.php?OrderNumber=' . $_SESSION['Contract'.$identifier]->OrderNo . '&Quotations=Quotes_Only">' . _('Go to Quotation') . ' ' . $_SESSION['Contract'.$identifier]->OrderNo . '</a>'; + echo '<br /><a href="' .$rootpath . '/SelectSalesOrder.php?OrderNumber=' . $_SESSION['Contract'.$identifier]->OrderNo . '&Quotations=Quotes_Only">' . _('Go to Quotation') . ' ' . $_SESSION['Contract'.$identifier]->OrderNo . '</a>'; } if ($ExistingContract['status'] == 0 AND $_POST['Status']==1){ @@ -405,9 +405,9 @@ '" . $_POST['CategoryID'] . "', '" . $_POST['LocCode'] . "', '" . FormatDateForSQL($_POST['RequiredDate']) . "', - " . $_POST['Margin'] . ", + '" . $_POST['Margin'] . "', '" . $_POST['CustomerRef'] . "', - ". $_POST['ExRate'] .")"; + '". $_POST['ExRate'] ."')"; $ErrMsg = _('The new contract could not be added because'); $result = DB_query($sql,$db,$ErrMsg); @@ -422,7 +422,7 @@ VALUES ( '" . $_POST['ContractRef'] . "', '" . $Component->StockID . "', '" . $WorkCentre . "', - " . $Component->Quantity . ")"; + '" . $Component->Quantity . "')"; $result = DB_query($sql,$db,$ErrMsg); } @@ -435,7 +435,7 @@ VALUES ( '" . $_POST['ContractRef'] . "', '" . $Requirement->Requirement . "', '" . $Requirement->CostPerUnit . "', - " . $Requirement->Quantity . ")"; + '" . $Requirement->Quantity . "')"; $result = DB_query($sql,$db,$ErrMsg); } prnMsg(_('The new contract has been added to the database'),'success'); @@ -595,7 +595,7 @@ $_SESSION['Contract'.$identifier]->Status=1; $_SESSION['Contract'.$identifier]->OrderNo=$OrderNo; prnMsg(_('The contract has been made into quotation number') . ' ' . $OrderNo,'info'); - echo '<br><a href="' . $rootpath . '/SelectSalesOrder.php?OrderNumber=' . $OrderNo . '&Quotations=Quotes_Only">' . _('Go to quotation number:') . ' ' . $OrderNo . '</a>'; + echo '<br /><a href="' . $rootpath . '/SelectSalesOrder.php?OrderNumber=' . $OrderNo . '&Quotations=Quotes_Only">' . _('Go to quotation number:') . ' ' . $OrderNo . '</a>'; } //end of if making a quotation @@ -709,7 +709,7 @@ if (DB_num_rows($result)==0){ prnMsg(_('The customer details were unable to be retrieved'),'error'); if ($debug==1){ - prnMsg(_('The SQL used that failed to get the customer details was:') . '<p>' . $sql,'error'); + prnMsg(_('The SQL used that failed to get the customer details was:') . '<br />' . $sql,'error'); } } else { $_SESSION['Contract'.$identifier]->BranchName = $myrow['brname']; @@ -737,29 +737,29 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/contract.png" title="' . _('Contract') . '" alt="" />' . ' ' . _('Contract: Select Customer') . '</p>'; - echo '<form action="' . $_SERVER['PHP_SELF'] . '?' .SID .'&identifier=' . $identifier .'" name="CustomerSelection" method=post>'; + echo '<form action="' . $_SERVER['PHP_SELF'] . '?' .SID .'&identifier=' . $identifier .'" name="CustomerSelection" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<table cellpadding=3 colspan=4 class=selection> + echo '<table cellpadding="3" colspan="4" class="selection"> <tr> <td><h5>' . _('Part of the Customer Branch Name') . ':</h5></td> - <td><input tabindex=1 type="Text" name="CustKeywords" size=20 maxlength=25></td> + <td><input tabindex="1" type="text" name="CustKeywords" size="20" maxlength="25" /></td> <td><h2><b>' . _('OR') . '</b></h2></td> <td><h5>' . _('Part of the Customer Branch Code'). ':</h5></td> - <td><input tabindex=2 type="Text" name="CustCode" size=15 maxlength=18></td> + <td><input tabindex="2" type="text" name="CustCode" size="15" maxlength="18" /></td> <td><h2><b>' . _('OR') . '</b></h2></td> <td><h5>' . _('Part of the Branch Phone Number') . ':</h5></td> - <td><input tabindex=3 type="Text" name="CustPhone" size=15 maxlength=18></td> + <td><input tabindex="3" type="text" name="CustPhone" size="15" maxlength="18" /></td> </tr> </table> - <br><div class="centre"><input tabindex=4 type=submit name="SearchCustomers" value="' . _('Search Now') . '"> - <input tabindex=5 type=submit action=reset value="' . _('Reset') .'"></div>'; + <br /><div class="centre"><input tabindex="4" type="submit" name="SearchCustomers" value="' . _('Search Now') . '" /> + <input tabindex="5" type="submit" action="reset" value="' . _('Reset') .'" /></div>'; if (isset($result_CustSelect)) { - echo '<table cellpadding=2 colspan=7>'; + echo '<table cellpadding="2" class="selection">'; - $TableHeader = '<br><tr> + $TableHeader = '<br /><tr> <th>' . _('Customer') . '</th> <th>' . _('Branch') . '</th> <th>' . _('Contact') . '</th> @@ -781,34 +781,34 @@ $k=1; } if ($LastCustomer != $myrow['name']) { - echo '<td>'.$myrow['name'].'</td>'; + echo '<td>'.htmlentities($myrow['name']).'</td>'; } else { echo '<td></td>'; } - echo '<td><input tabindex='.number_format($j+5).' type=submit name="Submit" value="'.$myrow['brname'].'"</td> - <input type=hidden name="SelectedCustomer" value="'.$myrow['debtorno'].' - '.$myrow['branchcode'].'"> - <td>'.$myrow['contactname'].'</td> + echo '<td><input tabindex="'.number_format($j+5).'" type="submit" name="Submit" value="'.htmlentities($myrow['brname']).'" /></td> + <input type="hidden" name="SelectedCustomer" value="'.$myrow['debtorno'].' - '.$myrow['branchcode'].'" /> + <td>'.htmlentities($myrow['contactname']).'</td> <td>'.$myrow['phoneno'].'</td> <td>'.$myrow['faxno'].'</td> - </tr></form>'; + </tr>'; $LastCustomer=$myrow['name']; $j++; //end of page full new headings if } //end of while loop - echo '</table>'; + echo '</table></form>'; }//end if results to show //end if RequireCustomerSelection } else { /*A customer is already selected so get into the contract setup proper */ - echo '<form name="ContractEntry" enctype="multipart/form-data" action="' . $_SERVER['PHP_SELF'] . '?' . SID . '&identifier=' . $identifier . '" method="post">'; + echo '<form name="ContractEntry" enctype="multipart/form-data" action="' . $_SERVER['PHP_SELF'] . '?' . SID . '&identifier=' . $identifier . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<p class="page_title_text"> - <img src="'.$rootpath.'/css/'.$theme.'/images/contract.png" title="' . _('Contract') . '" alt=""> + <img src="'.$rootpath.'/css/'.$theme.'/images/contract.png" title="' . _('Contract') . '" alt="" /> ' . $_SESSION['Contract'.$identifier]->CustomerName; if ($_SESSION['CompanyRecord']['currencydefault'] != $_SESSION['Contract'.$identifier]->CurrCode){ @@ -821,34 +821,34 @@ /*Set up form for entry of contract header stuff */ - echo '<table>'; + echo '<table class="selection">'; echo '<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 . '">'; + echo '<input type="text" name="ContractRef" size="21" maxlength="20" value="' . $_SESSION['Contract'.$identifier]->ContractRef . '" />'; } else { /*Just show the contract Ref - dont allow modification */ - echo '<input type="hidden" name="ContractRef" value="' . $_SESSION['Contract'.$identifier]->ContractRef . '">' . $_SESSION['Contract'.$identifier]->ContractRef; + echo '<input type="hidden" name="ContractRef" value="' . $_SESSION['Contract'.$identifier]->ContractRef . '" />' . $_SESSION['Contract'.$identifier]->ContractRef; } echo '</td></tr>'; echo '<tr><td>' . _('Category') . ':</td><td><select name="CategoryID" >'; - $sql = 'SELECT categoryid, categorydescription FROM stockcategory WHERE stocktype!="A"'; + $sql = "SELECT categoryid, categorydescription FROM stockcategory"; $ErrMsg = _('The stock categories could not be retrieved because'); $DbgMsg = _('The SQL used to retrieve stock categories and failed was'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg); while ($myrow=DB_fetch_array($result)){ if (!isset($_SESSION['Contract'.$identifier]->CategoryID) or $myrow['categoryid']==$_SESSION['Contract'.$identifier]->CategoryID){ - echo '<option selected VALUE="'. $myrow['categoryid'] . '">' . $myrow['categorydescription']; + echo '<option selected="True" value="'. $myrow['categoryid'] . '">' . $myrow['categorydescription'].'</option>'; } else { - echo '<option VALUE="'. $myrow['categoryid'] . '">' . $myrow['categorydescription']; + echo '<option value="'. $myrow['categoryid'] . '">' . $myrow['categorydescription'].'</option>'; } } echo '</select><a target="_blank" href="'. $rootpath . '/StockCategories.php?' . SID . '">' . _('Add or Modify Contract Categories') . '</a></td></tr>'; - $sql = 'SELECT loccode, locationname FROM locations'; + $sql = "SELECT loccode, locationname FROM locations"; $ErrMsg = _('The stock locations could not be retrieved because'); $DbgMsg = _('The SQL used to retrieve stock locations and failed was'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg); @@ -856,36 +856,36 @@ echo '<tr><td>' . _('Location') . ':</td><td><select name="LocCode" >'; while ($myrow=DB_fetch_array($result)){ if (!isset($_SESSION['Contract'.$identifier]->LocCode) or $myrow['loccode']==$_SESSION['Contract'.$identifier]->LocCode){ - echo '<option selected VALUE="'. $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option selected="True" 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></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 ':</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>'; + 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="' . $_SESSION['Contract'.$identifier]->Margin . '"></td></tr>'; + echo '<tr><td>' . _('Gross Profit') . ' %:</td><td><input type="text" name="Margin" size="4" maxlength="4" value="' . $_SESSION['Contract'.$identifier]->Margin . '" /></td></tr>'; if ($_SESSION['CompanyRecord']['currencydefault'] != $_SESSION['Contract'.$identifier]->CurrCode){ echo '<tr><td>' . $_SESSION['Contract'.$identifier]->CurrCode . ' ' . _('Exchange Rate') . ':</td> - <td><input type="text" name="ExRate" size=10 maxlength=10 value=' . $_SESSION['Contract'.$identifier]->ExRate . '></td></tr>'; + <td><input type="text" name="ExRate" size="10" maxlength="10" value="' . $_SESSION['Contract'.$identifier]->ExRate . '" /></td></tr>'; } else { - echo '<input type="hidden" name="ExRate" value=' . $_SESSION['Contract'.$identifier]->ExRate . '>'; + echo '<input type="hidden" name="ExRate" value="' . $_SESSION['Contract'.$identifier]->ExRate . '" />'; } echo '<tr><td>' . _('Contract Status') . ':</td><td>'; @@ -901,17 +901,18 @@ } elseif ($_SESSION['Contract'.$identifier]->Status == 2){ echo _('Order Placed'); } - echo '</select></td></tr>'; + echo '<input type="hidden" name="Status" value="'.$_SESSION['Contract'.$identifier]->Status.'" />'; + 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) { - echo '<tr><td>' . _('Contract Work Order Ref') . ':</td><td>' . $_SESSION['Contract'.$identifier]->WorkOrder . '</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 '</table><hr>'; + echo '</table><br />'; echo '<table><tr><td> - <table><tr><th colspan=6>' . _('Stock Items Required') . '</th></tr>'; + <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> @@ -936,7 +937,7 @@ } echo '</table></td>'; //end of contract BOM table echo '<td valign="top"> - <table><tr><th colspan=4>' . _('Other Requirements') . '</th></tr>'; + <table class="selection"><tr><th colspan="4">' . _('Other Requirements') . '</th></tr>'; $ContractReqtsCost = 0; if (count($_SESSION['Contract'.$identifier]->ContractReqts)!=0){ echo '<tr><th>' . _('Requirement') . '</th> @@ -956,27 +957,27 @@ echo '<tr><td colspan="4"><i>' . _('None Entered') . '</i></td></tr>'; } echo '</table></td></tr></table>'; - echo '<hr>'; - echo'<table><tr><th>' . _('Total Contract Cost') . '</th><th class="number">' . number_format(($ContractBOMCost+$ContractReqtsCost),2) . '</th><th>' . _('Contract Price') . '</th><th class="number">' . number_format(($ContractBOMCost+$ContractReqtsCost)/((100-$_SESSION['Contract'.$identifier]->Margin)/100),2) . '</th></tr></table>'; + echo '<br />'; + echo'<table class="selection"><tr><th>' . _('Total Contract Cost') . '</th><th class="number">' . number_format(($ContractBOMCost+$ContractReqtsCost),2) . '</th><th>' . _('Contract Price') . '</th><th class="number">' . number_format(($ContractBOMCost+$ContractReqtsCost)/((100-$_SESSION['Contract'.$identifier]->Margin)/100),2) . '</th></tr></table>'; echo'<p></p>'; - echo '<div class="centre"><input type="submit" name="EnterContractBOM" value="' . _('Enter Items Required') . '"> - <input type=submit name="EnterContractRequirements" value="' . _('Enter Other Requirements') .'">'; + 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') .'">'; + echo '<input type="submit" name="CommitContract" value="' . _('Commit Changes') .'" />'; } elseif($_SESSION['Contract'.$identifier]->Status==1){ //quoted but not yet ordered - echo '<input type=submit name="CommitContract" value="' . _('Update Quotation') .'">'; + 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*/ -echo '</form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/EmailConfirmation.php =================================================================== --- trunk/EmailConfirmation.php 2010-12-30 22:10:43 UTC (rev 4457) +++ trunk/EmailConfirmation.php 2011-01-04 00:34:27 UTC (rev 4458) @@ -27,37 +27,37 @@ $ErrMsg = _('There was a problem retrieving the order header details for Order Number') . ' ' . $_GET['TransNo'] . ' ' . _('from the database'); $sql = "SELECT salesorders.debtorno, - salesorders.customerref, - salesorders.comments, - salesorders.orddate, - salesorders.deliverto, - salesorders.deladd1, - salesorders.deladd2, - salesorders.dela... [truncated message content] |