From: <dai...@us...> - 2011-10-22 05:19:54
|
Revision: 4729 http://web-erp.svn.sourceforge.net/web-erp/?rev=4729&view=rev Author: daintree Date: 2011-10-22 05:19:43 +0000 (Sat, 22 Oct 2011) Log Message: ----------- number formats Modified Paths: -------------- trunk/GLJournal.php trunk/WOSerialNos.php trunk/WWW_Access.php trunk/WWW_Users.php trunk/WhereUsedInquiry.php trunk/WorkCentres.php trunk/WorkOrderCosting.php trunk/WorkOrderEntry.php trunk/WorkOrderIssue.php trunk/WorkOrderReceive.php trunk/WorkOrderStatus.php Modified: trunk/GLJournal.php =================================================================== --- trunk/GLJournal.php 2011-10-19 09:40:44 UTC (rev 4728) +++ trunk/GLJournal.php 2011-10-22 05:19:43 UTC (rev 4729) @@ -10,9 +10,13 @@ include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); -if (isset($_GET['NewJournal']) and $_GET['NewJournal'] == 'Yes' AND isset($_SESSION['JournalDetail'])){ +if (isset($_GET['NewJournal']) + AND $_GET['NewJournal'] == 'Yes' + AND isset($_SESSION['JournalDetail'])){ + unset($_SESSION['JournalDetail']->GLEntries); unset($_SESSION['JournalDetail']); + } if (!isset($_SESSION['JournalDetail'])){ @@ -44,7 +48,7 @@ $_SESSION['JournalDetail']->JournalType = $_POST['JournalType']; } -if (isset($_POST['CommitBatch']) and $_POST['CommitBatch']==_('Accept and Process Journal')){ +if (isset($_POST['CommitBatch']) AND $_POST['CommitBatch']==_('Accept and Process Journal')){ /* once the GL analysis of the journal is entered process all the data in the session cookie into the DB @@ -60,19 +64,19 @@ foreach ($_SESSION['JournalDetail']->GLEntries as $JournalItem) { $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount, - tag) + typeno, + trandate, + periodno, + account, + narrative, + amount, + tag) VALUES ('0', '" . $TransNo . "', '" . FormatDateForSQL($_SESSION['JournalDetail']->JnlDate) . "', '" . $PeriodNo . "', '" . $JournalItem->GLCode . "', - '" . $JournalItem->Narrative . "', + '" . DB_escape_string($JournalItem->Narrative) . "', '" . $JournalItem->Amount . "', '" . $JournalItem->tag."' )"; @@ -82,19 +86,19 @@ if ($_POST['JournalType']=='Reversing'){ $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount, - tag) + typeno, + trandate, + periodno, + account, + narrative, + amount, + tag) VALUES ('0', '" . $TransNo . "', '" . FormatDateForSQL($_SESSION['JournalDetail']->JnlDate) . "', '" . ($PeriodNo + 1) . "', '" . $JournalItem->GLCode . "', - 'Reversal - " . $JournalItem->Narrative . "', + '" . _('Reversal') . " - " . DB_escape_string($JournalItem->Narrative) . "', '" . -($JournalItem->Amount) ."', '".$JournalItem->tag."' )"; @@ -117,7 +121,8 @@ unset($_SESSION['JournalDetail']); /*Set up a newy in case user wishes to enter another */ - echo '<br /><a href="' . $_SERVER['PHP_SELF'] . '?NewJournal=Yes">'._('Enter Another General Ledger Journal').'</a>'; + echo '<br /> + <a href="' . $_SERVER['PHP_SELF'] . '?NewJournal=Yes">'._('Enter Another General Ledger Journal').'</a>'; /*And post the journal too */ include ('includes/GLPostings.inc'); include ('includes/footer.inc'); @@ -128,17 +133,17 @@ /* User hit delete the line from the journal */ $_SESSION['JournalDetail']->Remove_GLEntry($_GET['Delete']); -} elseif (isset($_POST['Process']) and $_POST['Process']==_('Accept')){ //user hit submit a new GL Analysis line into the journal +} elseif (isset($_POST['Process']) AND $_POST['Process']==_('Accept')){ //user hit submit a new GL Analysis line into the journal if ($_POST['GLCode']!='') { $extract = explode(' - ',$_POST['GLCode']); $_POST['GLCode'] = $extract[0]; } if ($_POST['Debit']>0) { - $_POST['GLAmount'] = $_POST['Debit']; + $_POST['GLAmount'] = filter_number_format($_POST['Debit']); } elseif ($_POST['Credit']>0) { - $_POST['GLAmount'] = '-' . $_POST['Credit']; + $_POST['GLAmount'] = -filter_number_format($_POST['Credit']); } - if ($_POST['GLManualCode'] != '' AND is_numeric($_POST['GLManualCode'])){ + if ($_POST['GLManualCode'] != ''){ // If a manual code was entered need to check it exists and isnt a bank account $AllowThisPosting = true; //by default if ($_SESSION['ProhibitJournalsToControlAccounts'] == 1){ @@ -167,17 +172,25 @@ unset($_POST['GLManualCode']); } else { $myrow = DB_fetch_array($Result); - $_SESSION['JournalDetail']->add_to_glanalysis($_POST['GLAmount'], $_POST['GLNarrative'], $_POST['GLManualCode'], $myrow['accountname'], $_POST['tag']); + $_SESSION['JournalDetail']->add_to_glanalysis(filter_number_format($_POST['GLAmount']), + $_POST['GLNarrative'], + $_POST['GLManualCode'], + $myrow['accountname'], + $_POST['tag']); } } } else { $AllowThisPosting =true; //by default if ($_SESSION['ProhibitJournalsToControlAccounts'] == 1){ - if ($_SESSION['CompanyRecord']['gllink_debtors'] == '1' AND $_POST['GLCode'] == $_SESSION['CompanyRecord']['debtorsact']){ + if ($_SESSION['CompanyRecord']['gllink_debtors'] == '1' + AND $_POST['GLCode'] == $_SESSION['CompanyRecord']['debtorsact']){ + prnMsg(_('GL Journals involving the debtors control account cannot be entered. The general ledger debtors ledger (AR) integration is enabled so control accounts are automatically maintained by webERP. This setting can be disabled in System Configuration'),'warn'); $AllowThisPosting = false; } - if ($_SESSION['CompanyRecord']['gllink_creditors'] == '1' AND $_POST['GLCode'] == $_SESSION['CompanyRecord']['creditorsact']){ + if ($_SESSION['CompanyRecord']['gllink_creditors'] == '1' + AND $_POST['GLCode'] == $_SESSION['CompanyRecord']['creditorsact']){ + prnMsg(_('GL Journals involving the creditors control account cannot be entered. The general ledger creditors ledger (AP) integration is enabled so control accounts are automatically maintained by webERP. This setting can be disabled in System Configuration'),'warn'); $AllowThisPosting = false; } @@ -199,7 +212,11 @@ $SQL = "SELECT accountname FROM chartmaster WHERE accountcode='" . $_POST['GLCode'] . "'"; $Result=DB_query($SQL,$db); $myrow=DB_fetch_array($Result); - $_SESSION['JournalDetail']->add_to_glanalysis($_POST['GLAmount'], $_POST['GLNarrative'], $_POST['GLCode'], $myrow['accountname'], $_POST['tag']); + $_SESSION['JournalDetail']->add_to_glanalysis(filter_number_format($_POST['GLAmount']), + $_POST['GLNarrative'], + $_POST['GLCode'], + $myrow['accountname'], + $_POST['tag']); } } @@ -225,7 +242,9 @@ echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post" name="form">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -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>'; // A new table in the first column of the main table @@ -234,18 +253,21 @@ $_SESSION['JournalDetail']->JnlDate = Date($_SESSION['DefaultDateFormat'],mktime(0,0,0,date('m'),0,date('Y'))); } -echo '<table><tr> - <td colspan="5"><table class="selection"><tr><td>'._('Date to Process Journal') . ':</td> - <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="JournalProcessDate" maxlength="10" size="11" value="' . $_SESSION['JournalDetail']->JnlDate . '" /></td>'; -echo '<td>' . _('Type') . ':</td> - <td><select name="JournalType">'; +echo '<table> + <tr> + <td colspan="5"><table class="selection"> + <tr> + <td>'._('Date to Process Journal') . ':</td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="JournalProcessDate" maxlength="10" size="11" value="' . $_SESSION['JournalDetail']->JnlDate . '" /></td> + <td>' . _('Type') . ':</td> + <td><select name="JournalType">'; if ($_POST['JournalType'] == 'Reversing'){ - echo '<option selected="True" value = "Reversing">' . _('Reversing').'</option>'; + echo '<option selected value = "Reversing">' . _('Reversing').'</option>'; echo '<option value = "Normal">' . _('Normal').'</option>'; } else { echo '<option value = "Reversing">' . _('Reversing').'</option>'; - echo '<option selected="True" value = "Normal">' . _('Normal') . '</option>'; + echo '<option selected value = "Normal">' . _('Normal') . '</option>'; } echo '</select></td> @@ -257,20 +279,27 @@ echo '<table class="selection" width="70%">'; /* Set upthe form for the transaction entry for a GL Payment Analysis item */ -echo '<tr><th colspan="3"><div class="centre"><font size="3" color="blue"><b>' . _('Journal Line Entry') . '</b></font></div></th></tr>'; +echo '<tr> + <th colspan="3"> + <div class="centre"><font size="3" color="blue"><b>' . _('Journal Line Entry') . '</b></font></div> + </th> + </tr>'; /*now set up a GLCode field to select from avaialble GL accounts */ -echo '<tr><th>' . _('GL Tag') . '</th> +echo '<tr> + <th>' . _('GL Tag') . '</th> <th>' . _('GL Account Code') . '</th> - <th>' . _('Select GL Account') . '</th></tr>'; + <th>' . _('Select GL Account') . '</th> + </tr>'; /* Set upthe form for the transaction entry for a GL Payment Analysis item */ //Select the tag -echo '<tr><td><select name="tag">'; +echo '<tr> + <td><select name="tag">'; $SQL = "SELECT tagref, - tagdescription + tagdescription FROM tags ORDER BY tagref"; @@ -294,9 +323,9 @@ ' value="'. $_POST['GLManualCode'] .'" /></td>'; $sql="SELECT accountcode, - accountname - FROM chartmaster - ORDER BY accountcode"; + accountname + FROM chartmaster + ORDER BY accountcode"; $result=DB_query($sql, $db); echo '<td><select name="GLCode" onChange="return assignComboToInput(this,'.'GLManualCode'.')">'; @@ -314,36 +343,51 @@ $_POST['GLNarrative'] = ''; } if (!isset($_POST['Credit'])) { - $_POST['Credit'] = ''; + $_POST['Credit'] = 0; } if (!isset($_POST['Debit'])) { - $_POST['Debit'] = ''; + $_POST['Debit'] = 0; } -echo '</tr><tr><th>' . _('Debit') . '</th> - <td><input type="text" class="number" name = "Debit" onChange="eitherOr(this, '.'Credit'.')" maxlength="12" size="10" value="' . $_POST['Debit'] . '" /></td>'; -echo '</tr><tr><th>' . _('Credit') . '</th> - <td><input type="text" class="number" Name = "Credit" onChange="eitherOr(this, '.'Debit'.')" maxlength="12" size="10" value="' . $_POST['Credit'] . '" /></td>'; -echo '</tr><tr><td></td><td></td><th>'. _('Narrative'). '</th>'; -echo '</tr><tr><th></th><th>' . _('GL Narrative') . '</th>'; +echo '</tr> + <tr> + <th>' . _('Debit') . '</th> + <td><input type="text" class="number" name = "Debit" onChange="eitherOr(this, '.'Credit'.')" maxlength="12" size="10" value="' . locale_number_format($_POST['Debit'],$_SESSION['CompanyRecord']['decimalplaces']) . '" /></td> + </tr> + <tr> + <th>' . _('Credit') . '</th> + <td><input type="text" class="number" Name = "Credit" onChange="eitherOr(this, '.'Debit'.')" maxlength="12" size="10" value="' . locale_number_format($_POST['Credit'],$_SESSION['CompanyRecord']['decimalplaces']) . '" /></td> + </tr> + <tr> + <td></td> + <td></td> + <th>'. _('Narrative'). '</th> + </tr> + <tr> + <th></th> + <th>' . _('GL Narrative') . '</th> + <td><input type="text" name="GLNarrative" maxlength="100" size="100" value="' . $_POST['GLNarrative'] . '" /></td> + </tr> + </table> + <br />'; /*Close the main table */ +echo '<div class="centre"> + <input type="submit" name="Process" value="' . _('Accept') . '" /> + </div> + <br /> + <br />'; -echo '<td><input type="text" name="GLNarrative" maxlength="100" size="100" value="' . $_POST['GLNarrative'] . '" /></td>'; +echo '<table class="selection" width="85%"> + <tr> + <th colspan="6"><div class="centre"><font size="3" color="blue"><b>' . _('Journal Summary') . '</b></font></div></th> + </tr> + <tr> + <th>'._('GL Tag').'</th> + <th>'._('GL Account').'</th> + <th>'._('Debit').'</th> + <th>'._('Credit').'</th> + <th>'._('Narrative').'</th> + </tr>'; -echo '</tr></table><br />'; /*Close the main table */ -echo '<div class="centre"><input type="submit" name="Process" value="' . _('Accept') . '" /></div><br /><br />'; - - -echo '<table class="selection" width="85%">'; - -echo '<tr><th colspan="6"><div class="centre"><font size="3" color="blue"><b>' . _('Journal Summary') . '</b></font></div></th></tr>'; -echo '<tr> - <th>'._('GL Tag').'</th> - <th>'._('GL Account').'</th> - <th>'._('Debit').'</th> - <th>'._('Credit').'</th> - <th>'._('Narrative').'</th> - </tr>'; - $DebitTotal=0; $CreditTotal=0; $j=0; @@ -369,8 +413,9 @@ echo '<td>' . $JournalItem->tag . ' - ' . $TagDescription . '</td> <td>' . $JournalItem->GLCode . ' - ' . $JournalItem->GLActName . '</td>'; if ($JournalItem->Amount>0) { - echo '<td class="number">' . locale_number_format($JournalItem->Amount,$_SESSION['CompanyRecord']['decimalplaces']) . '</td><td></td>'; - $DebitTotal=$DebitTotal+$JournalItem->Amount; + echo '<td class="number">' . locale_number_format($JournalItem->Amount,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td></td>'; + $DebitTotal += $JournalItem->Amount; } elseif($JournalItem->Amount<0) { $Credit=(-1 * $JournalItem->Amount); echo '<td></td> @@ -384,9 +429,10 @@ } echo '<tr class="EvenTableRows"><td></td> - <td class="number"><b>' . _('Total') . '</b></td> - <td class="number"><b>' . locale_number_format($DebitTotal,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td> - <td class="number"><b>' . locale_number_format($CreditTotal,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td></tr>'; + <td class="number"><b>' . _('Total') . '</b></td> + <td class="number"><b>' . locale_number_format($DebitTotal,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td> + <td class="number"><b>' . locale_number_format($CreditTotal,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td> + </tr>'; if ($DebitTotal!=$CreditTotal) { echo '<td align="center" style="background-color: #fddbdb"><b>' . _('Required to balance') .' - </b>' . locale_number_format(abs($DebitTotal-$CreditTotal),$_SESSION['CompanyRecord']['decimalplaces']); @@ -398,10 +444,15 @@ } echo '</table>'; -if (ABS($_SESSION['JournalDetail']->JournalTotal)<0.001 AND $_SESSION['JournalDetail']->GLItemCounter > 0){ - echo '<br /><br /><div class="centre"><input type="submit" name="CommitBatch" value="' ._('Accept and Process Journal').'" /></div>'; +if (abs($_SESSION['JournalDetail']->JournalTotal)<0.001 AND $_SESSION['JournalDetail']->GLItemCounter > 0){ + echo '<br /> + <br /> + <div class="centre"> + <input type="submit" name="CommitBatch" value="' ._('Accept and Process Journal').'" /> + </div>'; } elseif(count($_SESSION['JournalDetail']->GLEntries)>0) { - echo '<br /><br />'; + echo '<br /> + <br />'; prnMsg(_('The journal must balance ie debits equal to credits before it can be processed'),'warn'); } Modified: trunk/WOSerialNos.php =================================================================== --- trunk/WOSerialNos.php 2011-10-19 09:40:44 UTC (rev 4728) +++ trunk/WOSerialNos.php 2011-10-22 05:19:43 UTC (rev 4729) @@ -40,13 +40,15 @@ $NextSerialNo = $_POST['NextSerialNo']; } -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="" alt="" />' . ' ' . _('For Work Order Number') . ' ' . $WO . ' ' . _('and output item') . ' ' . $StockID . ' - ' . $Description . '</p>'; +echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="" alt="" />' . ' ' . _('For Work Order Number') . ' ' . $WO . ' ' . _('and output item') . ' ' . $StockID . ' - ' . $Description . ' + </p>'; $DbgMsg = _('The SQL that failed was'); if (isset($_POST['AddControlledItems'])){ if (isset($_POST['NumberToAdd'])){ // Must be adding serial numbers automatically - if (!is_numeric($_POST['NumberToAdd'])){ + if (!is_numeric(filter_number_format($_POST['NumberToAdd']))){ prnMsg(_('The quantity of controlled items to add was not numeric - a number is expected'),'error'); } else { DB_Txn_Begin($db); @@ -62,7 +64,7 @@ '" . $WO . "', '', '' "; - for ($i=0;$i<$_POST['NumberToAdd'];$i++){ + for ($i=0;$i< filter_number_format($_POST['NumberToAdd']);$i++){ $NextItemNumber = $NextSerialNo + $i; $result = DB_query("SELECT serialno FROM woserialnos WHERE wo='" . $WO . "' @@ -93,7 +95,7 @@ $result = DB_query("UPDATE stockmaster SET nextserialno='" . $NextSerialNo . "' WHERE stockid='" . $StockID . "'",$db); - $result = DB_query("UPDATE woitems SET qtyreqd=qtyreqd+" . $_POST['NumberToAdd'] . " + $result = DB_query("UPDATE woitems SET qtyreqd=qtyreqd+" . filter_number_format($_POST['NumberToAdd']) . " WHERE stockid='" . $StockID . "' AND wo='" . $WO . "'",$db,$ErrMsg,$DbgMsg,true); DB_Txn_Commit($db); @@ -105,20 +107,20 @@ prnMsg(_('The batch or serial number reference has not been entered - a reference is required'),'error'); $InputError=true; } - if (!is_numeric($_POST['Quantity'])){ + if (!is_numeric(filter_number_format($_POST['Quantity']))){ prnMsg(_('The quantity for the batch must be numeric'),'error'); $InputError=true; } $result = DB_query("SELECT serialno FROM woserialnos WHERE wo='" . $WO . "' AND stockid='" . $StockID ."' - AND serialno='" . $_POST['Reference'] . "'",$db); + AND serialno='" . DB_escape_string($_POST['Reference']) . "'",$db); if (DB_num_rows($result)!=0){ $InputError=true; prnMsg(_('The serial number or batch reference must be unique to the item - the reference entered is already entered on this work order'),'error'); } $result = DB_query("SELECT serialno FROM stockserialitems - WHERE serialno='" . $_POST['Reference'] . "' + WHERE serialno='" . DB_escape_string($_POST['Reference']) . "' AND stockid='" . $StockID ."'",$db); if (DB_num_rows($result)!=0){ $InputError=true; @@ -128,7 +130,7 @@ DB_Txn_Begin($db); $ErrMsg = _('Could not add a new serial number/batch'); $result = DB_query("UPDATE woitems - SET qtyreqd=qtyreqd+" . $_POST['Quantity'] . " + SET qtyreqd=qtyreqd+" . filter_number_format($_POST['Quantity']) . " WHERE stockid='" . $StockID . "' AND wo='" . $WO . "'",$db,$ErrMsg,$DbgMsg,true); $sql = "INSERT INTO woserialnos (stockid, @@ -139,8 +141,8 @@ VALUES ('" . $StockID . "', '" . $WO . "', '', - '" . $_POST['Quantity'] . "', - '" . $_POST['Reference'] . "')"; + '" . filter_number_format($_POST['Quantity']) . "', + '" . DB_escape_string($_POST['Reference']) . "')"; $ErrMsg = _('Unable to add the batch or serial number requested'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); @@ -156,10 +158,10 @@ $result = DB_query("DELETE FROM woserialnos WHERE wo='" . $WO . "' AND stockid='" . $StockID . "' - AND serialno='" . $_GET['Reference'] ."'", + AND serialno='" . DB_escape_string($_GET['Reference']) ."'", $db); - $result = DB_query("UPDATE woitems SET qtyreqd=qtyreqd-" . $_GET['Quantity'] . " + $result = DB_query("UPDATE woitems SET qtyreqd=qtyreqd-" . filter_number_format($_GET['Quantity']) . " WHERE wo='" . $WO . "' AND stockid = '" . $StockID . "'",$db); @@ -183,13 +185,13 @@ $result = DB_query("SELECT serialno FROM woserialnos WHERE wo='" . $WO . "' AND stockid='" . $StockID ."' - AND serialno='" . $_POST['Reference' . $i] . "'",$db); + AND serialno='" . DB_escape_string($_POST['Reference' . $i]) . "'",$db); if (DB_num_rows($result)!=0){ $InputError=true; prnMsg($_POST['Reference' .$i] . ': ' . _('The reference entered is already entered on this work order'),'error'); } $result = DB_query("SELECT serialno FROM stockserialitems - WHERE serialno='" . $_POST['Reference' .$i] . "' + WHERE serialno='" . DB_escape_string($_POST['Reference' .$i]) . "' AND stockid='" . $StockID ."'",$db); if (DB_num_rows($result)!=0){ $InputError=true; @@ -197,13 +199,13 @@ } } if (!$InputError){ - $sql[] = "UPDATE woserialnos SET serialno='" . $_POST['Reference'.$i] . "', - quantity='" . $_POST['Quantity'.$i] ."', - qualitytext='" . $_POST['Notes'.$i] . "' + $sql[] = "UPDATE woserialnos SET serialno='" . DB_escape_string($_POST['Reference'.$i]) . "', + quantity='" . filter_number_format($_POST['Quantity'.$i]) ."', + qualitytext='" . DB_escape_string($_POST['Notes'.$i]) . "' WHERE wo='" . $WO . "' AND stockid='" . $StockID . "' - AND serialno='" . $_POST['OldReference'.$i] . "'"; - $WOQuantityTotal += $_POST['Quantity'.$i]; + AND serialno='" . DB_escape_string($_POST['OldReference'.$i]) . "'"; + $WOQuantityTotal += filter_number_format($_POST['Quantity'.$i]); } else { $WOQuantityTotal += $_POST['OldQuantity'.$i]; } @@ -226,39 +228,44 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" name="form">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<input type="hidden" name="StockID" value="' . $StockID . '">'; -echo '<input type="hidden" name="Description" value="' . $Description . '">'; -echo '<input type="hidden" name="WO" value="' . $WO . '">'; -echo '<input type="hidden" name="Serialised" value="' . $Serialised . '">'; -echo '<input type="hidden" name="NextSerialNo" value="' . $NextSerialNo . '">'; +echo '<input type="hidden" name="StockID" value="' . $StockID . '" />'; +echo '<input type="hidden" name="Description" value="' . $Description . '" />'; +echo '<input type="hidden" name="WO" value="' . $WO . '" />'; +echo '<input type="hidden" name="Serialised" value="' . $Serialised . '" />'; +echo '<input type="hidden" name="NextSerialNo" value="' . $NextSerialNo . '" />'; echo '<table class="selection">'; if ($Serialised==1 AND $NextSerialNo>0){ echo '<tr><td>' . _('Add A Number of New Serial Numbers'); echo ':</td> - <td><input type="text" name="NumberToAdd" size=10 class=number maxlength=10 value="1"></td> + <td><input type="text" name="NumberToAdd" size="10" class="number" maxlength="10" value="1" /></td> <td>' . _('Starting at') . ':</td><td align="right">' . $NextSerialNo . '</td>'; } else { //Need to allow entry of batch or serial number and its a batch a quantity too for individual entry if ($Serialised==1){ - echo '<tr><th></th><th>' . _('Serial No') . '</th></tr> + echo '<tr> + <th></th> + <th>' . _('Serial No') . '</th></tr> <tr><td>'; echo _('Add a single serial number'); } else { - echo '<tr><th></th><th>' . _('Batch/Lot Ref') . '</th><th>' . _('Quantity') . '</th></tr> + echo '<tr> + <th></th> + <th>' . _('Batch/Lot Ref') . '</th><th>' . _('Quantity') . '</th></tr> <tr><td>'; echo _('Add a single batch/lot number'); } - echo '<td><input type="text" name="Reference" maxlength="30" size="30"></td>'; + echo '<td><input type="text" name="Reference" maxlength="30" size="30" /></td>'; if ($Serialised==0){ //also need to add the quantity - echo '<td><input type="text" name="Quantity" size=10 class=number maxlength=10 value="1"></td>'; + echo '<td><input type="text" name="Quantity" size="10" class="number" maxlength="10" value="1" /></td>'; } else { //it will be 1 for a serial item - echo '<input type="hidden" name="Quantity" value=1>'; + echo '<input type="hidden" name="Quantity" value="1" />'; } } -echo '<td><input type="submit" name="AddControlledItems" value="' . _('Add') . '"></td></tr> +echo '<td><input type="submit" name="AddControlledItems" value="' . _('Add') . '" /></td> + </tr> </table> <br />'; @@ -275,11 +282,19 @@ if (DB_num_rows($WOSerialNoResult)==0){ prnMsg(_('There are no serial items or batches yet defined for this work order item. Create new items first'),'info'); } else { - echo '<br /><table class="selection">'; + echo '<br /> + <table class="selection">'; if ($Serialised==1){ - $Header = '<tr><th>' . _('Serial No') . '</th><th>' . _('Notes') . '</th></tr>'; + $Header = '<tr> + <th>' . _('Serial No') . '</th> + <th>' . _('Notes') . '</th> + </tr>'; } else { - $Header = '<tr><th>' . _('Batch Ref') . '</th><th>' . _('Quantity') . '</th><th>' . _('Notes') . '</th></tr>'; + $Header = '<tr> + <th>' . _('Batch Ref') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Notes') . '</th> + </tr>'; } echo $Header; $i = 0; @@ -291,28 +306,29 @@ $j=0; } - echo '<tr><td><input type="text" name="Reference' . $i .'" value="' . $WOSNRow['serialno'] . '"/></td>'; + echo '<tr> + <td><input type="text" name="Reference' . $i .'" value="' . $WOSNRow['serialno'] . '"/></td>'; echo '<input type="hidden" name="OldReference' . $i . '" value="' . $WOSNRow['serialno'] . '"/>'; if ($Serialised==0){ - echo '<td><input type="text" name="Quantity' . $i .'" value="' . $WOSNRow['quantity'] . '" /></td>'; - echo '<input type="hidden" name="OldQuantity' . $i . '" value="' . $WOSNRow['quantity'] . '" />'; + echo '<td><input type="text" name="Quantity' . $i .'" value="' . locale_number_format($WOSNRow['quantity'],'Variable') . '" /></td>'; + echo '<input type="hidden" name="OldQuantity' . $i . '" value="' . locale_number_format($WOSNRow['quantity'],'Variable') . '" />'; } else { - echo '<input type="hidden" name="Quantity' . $i . '" value="1">'; + echo '<input type="hidden" name="Quantity' . $i . '" value="1" />'; } - echo '<td><textarea name="Notes' . $i .'" cols=60 rows=3>' . $WOSNRow['qualitytext'] .'</textarea></td>'; - echo '<td><a href="' . $_SESSION['PHP_SELF'] . '?Delete=1&Reference=' . $WOSNRow['serialno'] . '&Quantity=' . $WOSNRow['quantity'] . '&WO=' . $WO . '&StockID=' . $StockID . '&Description=' . $Description . '&Serialised=' . $Serialised . '&NextSerialNo=' . $NextSerialNo . '">' . _('Delete') . '</td></tr>'; + echo '<td><textarea name="Notes' . $i .'" cols="60" rows="3">' . $WOSNRow['qualitytext'] .'</textarea></td>'; + echo '<td><a href="' . $_SESSION['PHP_SELF'] . '?Delete=1&Reference=' . $WOSNRow['serialno'] . '&Quantity=' . locale_number_format($WOSNRow['quantity'],'Variable') . '&WO=' . $WO . '&StockID=' . $StockID . '&Description=' . $Description . '&Serialised=' . $Serialised . '&NextSerialNo=' . $NextSerialNo . '">' . _('Delete') . '</a></td></tr>'; $i++; $j++; } - echo '<input type="hidden" name="CountOfItems" value=' . $i . '>'; + echo '<input type="hidden" name="CountOfItems" value="' . $i . '" />'; if ($Serialised==0){ echo '<tr><td style="text-align: center" colspan="3">'; } else { echo '<tr><td style="text-align: center" colspan="2">'; } - echo '<input type="submit" name="UpdateItems" value="' . _('Update') . '"></td></tr>'; + echo '<input type="submit" name="UpdateItems" value="' . _('Update') . '" /></td></tr>'; echo '</table>'; } //end of if there are woserialno items defined Modified: trunk/WWW_Access.php =================================================================== --- trunk/WWW_Access.php 2011-10-19 09:40:44 UTC (rev 4728) +++ trunk/WWW_Access.php 2011-10-22 05:19:43 UTC (rev 4729) @@ -24,7 +24,7 @@ /* actions to take once the user has clicked the submit button ie the page has called itself with some user input */ //first off validate inputs sensible - if (isset($_POST['SecRoleName']) && mb_strlen($_POST['SecRoleName'])<4){ + if (isset($_POST['SecRoleName']) AND mb_strlen($_POST['SecRoleName'])<4){ $InputError = 1; prnMsg(_('The role description entered must be at least 4 characters long'),'error'); } @@ -34,12 +34,12 @@ unset($sql); if (isset($_POST['SecRoleName']) ){ // Update or Add Security Headings if(isset($SelectedRole)) { // Update Security Heading - $sql = "UPDATE securityroles SET secrolename = '".$_POST['SecRoleName']."' + $sql = "UPDATE securityroles SET secrolename = '" . DB_escape_string($_POST['SecRoleName']) . "' WHERE secroleid = '".$SelectedRole . "'"; $ErrMsg = _('The update of the security role description failed because'); $ResMsg = _('The Security role description was updated.'); } else { // Add Security Heading - $sql = "INSERT INTO securityroles (secrolename) VALUES ('".$_POST['SecRoleName']."')"; + $sql = "INSERT INTO securityroles (secrolename) VALUES ('" . DB_escape_string($_POST['SecRoleName']) ."')"; $ErrMsg = _('The update of the security role failed because'); $ResMsg = _('The Security role was created.'); } @@ -165,10 +165,16 @@ if (!isset($_POST['SecRoleName'])) { $_POST['SecRoleName']=''; } -echo '<tr><td>' . _('Role') . ':</td> - <td><input type="text" name="SecRoleName" size=40 maxlength=40 value="' . $_POST['SecRoleName'] . '"></tr>'; -echo '</table><br /> - <div class="centre"><input type="submit" name="submit" value="' . _('Enter Role') . '"></div></form>'; +echo '<tr> + <td>' . _('Role') . ':</td> + <td><input type="text" name="SecRoleName" size=40 maxlength=40 value="' . $_POST['SecRoleName'] . '" /> + </tr>'; +echo '</table> + <br /> + <div class="centre"> + <input type="submit" name="submit" value="' . _('Enter Role') . '" /> + </div> + </form>'; if (isset($SelectedRole)) { $sql = "SELECT tokenid, tokenname Modified: trunk/WWW_Users.php =================================================================== --- trunk/WWW_Users.php 2011-10-19 09:40:44 UTC (rev 4728) +++ trunk/WWW_Users.php 2011-10-22 05:19:43 UTC (rev 4729) @@ -388,9 +388,9 @@ $_POST['Blocked'] = $myrow['blocked']; $_POST['PDFLanguage'] = $myrow['pdflanguage']; - echo '<input type="hidden" name="SelectedUser" value="' . $SelectedUser . '">'; - echo '<input type="hidden" name="UserID" value="' . $_POST['UserID'] . '">'; - echo '<input type="hidden" name="ModulesAllowed" value="' . $_POST['ModulesAllowed'] . '">'; + echo '<input type="hidden" name="SelectedUser" value="' . $SelectedUser . '" /'; + echo '<input type="hidden" name="UserID" value="' . $_POST['UserID'] . '" />'; + echo '<input type="hidden" name="ModulesAllowed" value="' . $_POST['ModulesAllowed'] . '" />'; echo '<table class=selection> <tr><td>' . _('User code') . ':</td><td>'; echo $_POST['UserID'] . '</td></tr>'; @@ -400,7 +400,7 @@ echo '<table class="selection"> <tr> <td>' . _('User Login') . ':</td> - <td><input type="text" name="UserID" size="22" maxlength="20"></td></tr>'; + <td><input type="text" name="UserID" size="22" maxlength="20" /></td></tr>'; /*set the default modules to show to all this had trapped a few people previously*/ @@ -668,7 +668,7 @@ echo '</table> <br /> <div class="centre"> - <input type="submit" name="submit" value="' . _('Enter Information') . '"> + <input type="submit" name="submit" value="' . _('Enter Information') . '" /> </div> </form>'; Modified: trunk/WhereUsedInquiry.php =================================================================== --- trunk/WhereUsedInquiry.php 2011-10-19 09:40:44 UTC (rev 4728) +++ trunk/WhereUsedInquiry.php 2011-10-22 05:19:43 UTC (rev 4729) @@ -2,8 +2,6 @@ /* $Id$*/ -//$PageSecurity = 2; - include('includes/session.inc'); $title = _('Where Used Inquiry'); include('includes/header.inc'); @@ -14,25 +12,30 @@ $StockID = trim(mb_strtoupper($_POST['StockID'])); } -echo "<a href='" . $rootpath . '/SelectProduct.php?' . SID . "'>" . _('Back to Items') . '</a><br />'; - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Search') . '" alt="" />' . ' ' . $title . '</p>'; +echo '<a href="' . $rootpath . '/SelectProduct.php">' . _('Back to Items') . '</a> + <br /> + <p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Search') . '" alt="" />' . ' ' . $title . ' + </p>'; if (isset($StockID)){ $result = DB_query("SELECT description, - units, - mbflag - FROM stockmaster - WHERE stockid='".$StockID."'",$db); + units, + mbflag + FROM stockmaster + WHERE stockid='".$StockID."'",$db); $myrow = DB_fetch_row($result); if (DB_num_rows($result)==0){ prnMsg(_('The item code entered') . ' - ' . $StockID . ' ' . _('is not set up as an item in the system') . '. ' . _('Re-enter a valid item code or select from the Select Item link above'),'error'); include('includes/footer.inc'); exit; } - echo "<br /><font color=navy size=3><b>$StockID - $myrow[0] </b> (" . _('in units of') . ' ' . $myrow[1] . ')</font>'; + echo '<br /> + <font color="navy" size="3"><b>' . $StockID . ' - ' . $myrow[0] . '</b> (' . _('in units of') . ' ' . $myrow[1] . ')</font>'; } -echo "<form action='" . $_SERVER['PHP_SELF'] . '?'. SID ."' method=post><div class='centre'>"; -echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; +echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post"> + <div class="centre"> + <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($StockID)) { echo _('Enter an Item Code') . ': <input type="text" name="StockID" size="21" maxlength="20" value="' . $StockID . '" />'; @@ -40,19 +43,20 @@ echo _('Enter an Item Code') . ': <input type="text" name="StockID" size="21" maxlength="20" />'; } -echo "<input type=submit name='ShowWhereUsed' value='" . _('Show Where Used') . "'>"; +echo '<input type="submit" name="ShowWhereUsed" value="' . _('Show Where Used') . '" />'; -echo '</div><br />'; +echo '</div> + <br />'; if (isset($StockID)) { $SQL = "SELECT bom.*, - stockmaster.description - FROM bom INNER JOIN stockmaster + stockmaster.description + FROM bom INNER JOIN stockmaster ON bom.parent = stockmaster.stockid - WHERE component='" . $StockID . "' - AND bom.effectiveafter<='" . Date('Y-m-d') . "' - AND bom.effectiveto >='" . Date('Y-m-d') . "'"; + WHERE component='" . $StockID . "' + AND bom.effectiveafter<='" . Date('Y-m-d') . "' + AND bom.effectiveto >='" . Date('Y-m-d') . "'"; $ErrMsg = _('The parents for the selected part could not be retrieved because');; $result = DB_query($SQL,$db,$ErrMsg); @@ -60,45 +64,44 @@ prnMsg(_('The selected item') . ' ' . $StockID . ' ' . _('is not used as a component of any other parts'),'error'); } else { - echo '<table width=97% class=selection>'; + echo '<table width=97% class=selection>'; - $tableheader = '<tr><th>' . _('Used By') . '</th> - <th>' . _('Work Centre') . '</th> - <th>' . _('Location') . '</th> - <th>' . _('Quantity Required') . '</th> - <th>' . _('Effective After') . '</th> - <th>' . _('Effective To') . '</th></tr>'; - echo $tableheader; - $k=0; - while ($myrow=DB_fetch_array($result)) { + $TableHeader = '<tr> + <th>' . _('Used By') . '</th> + <th>' . _('Work Centre') . '</th> + <th>' . _('Location') . '</th> + <th>' . _('Quantity Required') . '</th> + <th>' . _('Effective After') . '</th> + <th>' . _('Effective To') . '</th> + </tr>'; + echo $TableHeader; + $k=0; + while ($myrow=DB_fetch_array($result)) { - if ($k==1){ - echo '<tr class="EvenTableRows">'; - $k=0; - } else { - echo '<tr class="OddTableRows">';; - $k=1; - } + if ($k==1){ + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + echo '<tr class="OddTableRows">';; + $k=1; + } - echo '<td><a target="_blank" href="' . $rootpath . '/BOMInquiry.php?StockID=' . $myrow['parent'] . '" alt="' . _('Show Bill Of Material') . '">' . $myrow['parent']. ' - ' . $myrow['description']. '</a></td>'; - echo '<td>' . $myrow['workcentreadded']. '</td>'; - echo '<td>' . $myrow['loccode']. '</td>'; - echo '<td>' . $myrow['quantity']. '</td>'; - echo '<td>' . ConvertSQLDate($myrow['effectiveafter']) . '</td>'; - echo '<td>' . ConvertSQLDate($myrow['effectiveto']) . '</td>'; + echo '<td><a target="_blank" href="' . $rootpath . '/BOMInquiry.php?StockID=' . $myrow['parent'] . '" alt="' . _('Show Bill Of Material') . '">' . $myrow['parent']. ' - ' . $myrow['description']. '</a></td> + <td>' . $myrow['workcentreadded']. '</td> + <td>' . $myrow['loccode']. '</td> + <td class="number">' . locale_number_format($myrow['quantity'],'Variable') . '</td> + <td>' . ConvertSQLDate($myrow['effectiveafter']) . '</td> + <td>' . ConvertSQLDate($myrow['effectiveto']) . '</td>'; - //end of page full new headings if - } + //end of page full new headings if + } - echo '</table>'; + echo '</table>'; } } // StockID is set -echo "<script>defaultControl(document.forms[0].StockID);</script>"; +echo '<script>defaultControl(document.forms[0].StockID);</script>'; - echo '</form>'; - include('includes/footer.inc'); - ?> \ No newline at end of file Modified: trunk/WorkCentres.php =================================================================== --- trunk/WorkCentres.php 2011-10-19 09:40:44 UTC (rev 4728) +++ trunk/WorkCentres.php 2011-10-22 05:19:43 UTC (rev 4729) @@ -42,7 +42,7 @@ delete code below*/ $sql = "UPDATE workcentres SET location = '" . $_POST['Location'] . "', - description = '" . $_POST['Description'] . "', + description = '" . DB_escape_string($_POST['Description']) . "', overheadrecoveryact ='" . $_POST['OverheadRecoveryAct'] . "', overheadperhour = '" . $_POST['OverheadPerHour'] . "' WHERE code = '" . $SelectedWC . "'"; @@ -52,13 +52,13 @@ /*Selected work centre is null cos no item selected on first time round so must be adding a record must be submitting new entries in the new work centre form */ $sql = "INSERT INTO workcentres (code, - location, - description, - overheadrecoveryact, - overheadperhour) + location, + description, + overheadrecoveryact, + overheadperhour) VALUES ('" . $_POST['Code'] . "', '" . $_POST['Location'] . "', - '" . $_POST['Description'] . "', + '" . DB_escape_string($_POST['Description']) . "', '" . $_POST['OverheadRecoveryAct'] . "', '" . $_POST['OverheadPerHour'] . "' )"; @@ -107,7 +107,9 @@ then none of the above are true and the list of work centres will be displayed with links to delete or edit each. These will call the same page again and allow update/input or deletion of the records*/ - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/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>'; $sql = "SELECT workcentres.code, workcentres.description, @@ -120,31 +122,34 @@ $result = DB_query($sql,$db); echo '<table class="selection"> - <tr bgcolor ="#800000"><th>' . _('WC Code') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Location') . '</th> - <th>' . _('Overhead GL Account') . '</th> - <th>' . _('Overhead Per Hour') . '</th> + <tr bgcolor ="#800000"> + <th>' . _('WC Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Location') . '</th> + <th>' . _('Overhead GL Account') . '</th> + <th>' . _('Overhead Per Hour') . '</th> </tr>'; - while ($myrow = DB_fetch_row($result)) { + while ($myrow = DB_fetch_array($result)) { - printf("<tr><td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td class=number>%s</td> - <td><a href=\"%s&SelectedWC=%s\">" . _('Edit') . "</td> - <td><a href=\"%s&SelectedWC=%s&delete=yes\">" . _('Delete') ."</td> - </tr>", - $myrow[0], - $myrow[1], - $myrow[2], - $myrow[3], - $myrow[4], + printf('<tr> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td class="number">%s</td> + <td><a href="%s&SelectedWC=%s">' . _('Edit') . '</td> + <td><a href="%s&SelectedWC=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this work centre?') . '\');">' . _('Delete') .'</td> + </tr>', + $myrow['code'], + $myrow['description'], + $myrow['locationname'], + $myrow['overheadrecoveryact'], + $myrow['overheadperhour'], $_SERVER['PHP_SELF'] . '?', - $myrow[0], $_SERVER['PHP_SELF'] . '?', - $myrow[0]); + $myrow['code'], + $_SERVER['PHP_SELF'] . '?', + $myrow['code']); } //END WHILE LIST LOOP @@ -158,20 +163,21 @@ echo '<div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Show all Work Centres') . '</a></div>'; } -echo '<p><form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; +echo '<br /> + <form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($SelectedWC)) { //editing an existing work centre $sql = "SELECT code, - location, - description, - overheadrecoveryact, - overheadperhour - FROM workcentres - WHERE code='" . $SelectedWC . "'"; - + location, + description, + overheadrecoveryact, + overheadperhour + FROM workcentres + WHERE code='" . $SelectedWC . "'"; + $result = DB_query($sql, $db); $myrow = DB_fetch_array($result); @@ -181,31 +187,36 @@ $_POST['OverheadRecoveryAct'] = $myrow['overheadrecoveryact']; $_POST['OverheadPerHour'] = $myrow['overheadperhour']; - echo '<input type="hidden" name="SelectedWC" value=' . $SelectedWC . '>'; - echo '<input type="hidden" name="Code" value="' . $_POST['Code'] . '">'; - echo '<table class="selection"><tr><td>' ._('Work Centre Code') . ':</td> - <td>' . $_POST['Code'] . '</td></tr>'; + echo '<input type="hidden" name="SelectedWC" value="' . $SelectedWC . '" /> + <input type="hidden" name="Code" value="' . $_POST['Code'] . '" /> + <table class="selection"> + <tr> + <td>' ._('Work Centre Code') . ':</td> + <td>' . $_POST['Code'] . '</td> + </tr>'; } else { //end of if $SelectedWC only do the else when a new record is being entered if (!isset($_POST['Code'])) { $_POST['Code'] = ''; } - echo '<table class="selection"><tr> - <td>' . _('Work Centre Code') . ':</td> - <td><input type="Text" name="Code" size="6" maxlength="5" value="' . $_POST['Code'] . '"></td> + echo '<table class="selection"> + <tr> + <td>' . _('Work Centre Code') . ':</td> + <td><input type="text" name="Code" size="6" maxlength="5" value="' . $_POST['Code'] . '" /></td> </tr>'; } $SQL = "SELECT locationname, - loccode + loccode FROM locations"; $result = DB_query($SQL,$db); if (!isset($_POST['Description'])) { $_POST['Description'] = ''; } -echo '<tr><td>' . _('Work Centre Description') . ':</td> - <td><input type="Text" name="Description" size="21" maxlength="20" value="' . $_POST['Description'] . '"></td> +echo '<tr> + <td>' . _('Work Centre Description') . ':</td> + <td><input type="Text" name="Description" size="21" maxlength="20" value="' . $_POST['Description'] . '" /></td> </tr> <tr><td>' . _('Location') . ':</td> <td><select name="Location">'; @@ -214,7 +225,7 @@ if (isset($_POST['Location']) and $myrow['loccode']==$_POST['Location']) { echo '<option selected value="'; } else { - echo '<option VALUE="'; + echo '<option value="'; } echo $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; @@ -223,13 +234,15 @@ DB_free_result($result); -echo '</select></td></tr> - <tr><td>' . _('Overhead Recovery GL Account') . ':</td> +echo '</select></td> + </tr> + <tr> + <td>' . _('Overhead Recovery GL Account') . ':</td> <td><select name="OverheadRecoveryAct">'; //SQL to poulate account selection boxes $SQL = "SELECT accountcode, - accountname + accountname FROM chartmaster INNER JOIN accountgroups ON chartmaster.group_=accountgroups.groupname WHERE accountgroups.pandl!=0 @@ -253,17 +266,23 @@ } echo '</td></tr>'; -echo '<tr><td>' . _('Overhead Per Hour') . ':</td> - <td><input type="Text" class="number" name="OverheadPerHour" size=6 maxlength=6 value='.$_POST['OverheadPerHour'].'>'; +echo '<tr> + <td>' . _('Overhead Per Hour') . ':</td> + <td><input type="text" class="number" name="OverheadPerHour" size="6" maxlength="6" value="'.$_POST['OverheadPerHour'].'" />'; -echo '</td></tr></table>'; +echo '</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>'; if (!isset($_GET['SelectedWC']) or $_GET['SelectedWC']=='') { - echo "<script>defaultControl(document.forms[0].Code);</script>"; + echo '<script>defaultControl(document.forms[0].Code);</script>'; } else { - echo "<script>defaultControl(document.forms[0].Description);</script>"; + echo '<script>defaultControl(document.forms[0].Description);</script>'; } echo '</form>'; Modified: trunk/WorkOrderCosting.php =================================================================== --- trunk/WorkOrderCosting.php 2011-10-19 09:40:44 UTC (rev 4728) +++ trunk/WorkOrderCosting.php 2011-10-22 05:19:43 UTC (rev 4729) @@ -6,11 +6,13 @@ include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); -echo '<a href="'. $rootpath . '/SelectWorkOrder.php">' . _('Back to Work Orders'). '</a><br />'; +echo '<a href="'. $rootpath . '/SelectWorkOrder.php">' . _('Back to Work Orders'). '</a> + <br /> + <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>'; - echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; @@ -47,14 +49,17 @@ $WorkOrderRow = DB_fetch_array($WOResult); -echo '<table cellpadding=2 class=selection> - <tr><td class="label">' . _('Work order') . ':</td> +echo '<table class="selection"> + <tr> + <td class="label">' . _('Work order') . ':</td> <td>' . $_POST['WO'] .'</td> <td class="label">' . _('Manufactured at') . ':</td> <td>' . $WorkOrderRow['locationname'] . '</td> <td class="label">' . _('Required By') . ':</td> - <td>' . ConvertSQLDate($WorkOrderRow['requiredby']) . '</td></tr> - </table><br />'; + <td>' . ConvertSQLDate($WorkOrderRow['requiredby']) . '</td> + </tr> + </table> + <br />'; $WOItemsResult = DB_query("SELECT woitems.stockid, @@ -77,19 +82,23 @@ $db, $ErrMsg); -echo '<table class="selection"><tr><th>' . _('Item') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Quantity Required') . '</th> - <th>' . _('Units') . '</th> - <th>' . _('Quantity Received') . '</th> - <th>' . _('Status') . '</th> - <th>' . _('Receive') . '</th> - <th>' . _('Issue') . '</th></tr>'; +echo '<table class="selection"> + <tr> + <th>' . _('Item') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Quantity Required') . '</th> + <th>' . _('Units') . '</th> + <th>' . _('Quantity Received') . '</th> + <th>' . _('Status') . '</th> + <th>' . _('Receive') . '</th> + <th>' . _('Issue') . '</th> + </tr>'; $TotalStdValueRecd =0; while ($WORow = DB_fetch_array($WOItemsResult)){ - echo '<tr><td>' . $WORow['stockid'] . '</td> + echo '<tr> + <td>' . $WORow['stockid'] . '</td> <td>' . $WORow['description'] . '</td> <td class="number">' . locale_number_format($WORow['qtyreqd'],$WORow['decimalplaces']) . '</td> <td>' . $WORow['units'] . '</td> @@ -106,18 +115,18 @@ <br /> <table class="selection">'; +echo '<tr> + <th>' . _('Item') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Qty Reqd') . '</th> + <th>' . _('Cost Reqd') . '</th> + <th>' . _('Date Issued') . '</th> + <th>' . _('Issued Qty') . '</th> + <th>' . _('Issued Cost') . '</th> + <th>' . _('Usage Variance') . '</th> + <th>' . _('Cost Variance') . '</th> + </tr>'; -echo '<tr><th>' . _('Item') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Qty Reqd') . '</th> - <th>' . _('Cost Reqd') . '</th> - <th>' . _('Date Issued') . '</th> - <th>' . _('Issued Qty') . '</th> - <th>' . _('Issued Cost') . '</th> - <th>' . _('Usage Variance') . '</th> - <th>' . _('Cost Variance') . '</th> - </tr>'; - $RequirementsResult = DB_query("SELECT worequirements.stockid, stockmaster.description, stockmaster.decimalplaces, @@ -185,7 +194,8 @@ } else { echo '<tr class="OddTableRows">'; } - echo '<td colspan="9"><hr></td></tr>'; + echo '<td colspan="9"><hr></td> + </tr>'; } if ($k==1){ echo '<tr class="EvenTableRows">'; @@ -201,13 +211,15 @@ /*Required quantity is the quantity required of the component based on the quantity of the finished item received */ $UsageVar =($RequirementsRow['requiredqty']-$IssueQty)*($RequirementsRow['stdcost']); - echo '<td colspan="2"></td><td class="number">' . locale_number_format($RequirementsRow['requiredqty'],$RequirementsRow['decimalplaces']) . '</td> - <td class="number">' . locale_number_format($RequirementsRow['expectedcost'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td></td> - <td class="number">' . locale_number_format($IssueQty,$RequirementsRow['decimalplaces']) . '</td> - <td class="number">' . locale_number_format($IssueCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td class="number">' . locale_number_format($UsageVar,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td class="number">' . locale_number_format($CostVar,$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>'; + echo '<td colspan="2"></td> + <td class="number">' . locale_number_format($RequirementsRow['requiredqty'],$RequirementsRow['decimalplaces']) . '</td> + <td class="number">' . locale_number_format($RequirementsRow['expectedcost'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td></td> + <td class="number">' . locale_number_format($IssueQty,$RequirementsRow['decimalplaces']) . '</td> + <td class="number">' . locale_number_format($IssueCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_number_format($UsageVar,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_number_format($CostVar,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + </tr>'; $TotalReqdCost += $RequirementsRow['expectedcost']; $TotalIssuedCost += $IssueCost; $TotalCostVar += $CostVar; @@ -217,26 +229,28 @@ } else { $k++; } - echo '<tr><td colspan="9"><hr></td></tr>'; + echo '<tr> + <td colspan="9"><hr></td> + </tr>'; } //Now need to run through the issues to the work order that weren't in the requirements $sql = "SELECT stockmoves.stockid, - stockmaster.description, - stockmaster.decimalplaces, - trandate, - qty, - stockmoves.standardcost - FROM stockmoves INNER JOIN stockmaster - ON stockmoves.stockid=stockmaster.stockid - WHERE stockmoves.type=28 - AND reference = '" . $_POST['WO'] . "' - AND stockmoves.stockid NOT IN - (SELECT worequirements.stockid - FROM worequirements - WHERE worequirements.wo='" . $_POST['WO'] . "')"; + stockmaster.description, + stockmaster.decimalplaces, + trandate, + qty, + stockmoves.standardcost + FROM stockmoves INNER JOIN stockmaster + ON stockmoves.stockid=stockmaster.stockid + WHERE stockmoves.type=28 + AND reference = '" . $_POST['WO'] . "' + AND stockmoves.stockid NOT IN + (SELECT worequirements.stockid + FROM worequirements + WHERE worequirements.wo='" . $_POST['WO'] . "')"; $WOIssuesResult = DB_query($sql,$db,_('Could not get issues that were not required by the BOM because')); @@ -251,33 +265,38 @@ } echo '<td>' . $WOIssuesRow['stockid'] . '</td> - <td>' . $WOIssuesRow['description'] . '</td> - <td class="number">0</td> - <td class="number">0</td> - <td>' . ConvertSQLDate($WOIssuesRow['trandate']) . '</td> - <td class="number">' . locale_number_format(-$WOIssuesRow['qty'],$WOIssuesRow['decimalplaces']) .'</td> - <td class="number">' . locale_number_format(-$WOIssuesRow['qty']*$WOIssuesRow['standardcost'],$_SESSION['CompanyRecord']['decimalplaces']) .'</td> - <td class="number">' . locale_number_format($WOIssuesRow['qty']*$WOIssuesRow['standardcost'],$_SESSION['CompanyRecord']['decimalplaces']) .'</td> - <td class="number">0</td></tr>'; + <td>' . $WOIssuesRow['description'] . '</td> + <td class="number">0</td> + <td class="number">0</td> + <td>' . ConvertSQLDate($WOIssuesRow['trandate']) . '</td> + <td class="number">' . locale_number_format(-$WOIssuesRow['qty'],$WOIssuesRow['decimalplaces']) .'</td> + <td class="number">' . locale_number_format(-$WOIssuesRow['qty']*$WOIssuesRow['standardcost'],$_SESSION['CompanyRecord']['decimalplaces']) .'</td> + <td class="number">' . locale_number_format($WOIssuesRow['qty']*$WOIssuesRow['standardcost'],$_SESSION['CompanyRecord']['decimalplaces']) .'</td> + <td class="number">0</td> + </tr>'; $TotalUsageVar += ($WOIssuesRow['qty']*$WOIssuesRow['standardcost']); } } # <!-- <td colspan="5"></td> --> -echo '<tr><td colspan="3"></td> +echo '<tr> + <td colspan="3"></td> <td><hr/></td> <td colspan="2"></td> <td colspan="3"><hr></td> </tr>'; -echo '<tr><td colspan="2" class="number">' . _('Totals') . '</td> - <td></td> - <td class="number">' . locale_number_format($TotalReqdCost,$_SESSION['CompanyRecord']['decimalplaces']) .'</td> - <td></td><td></td> - <td class="number">' . locale_number_format($TotalIssuedCost,$_SESSION['CompanyRecord']['decimalplaces']) .'</td> - <td class="number">' . locale_number_format($TotalUsageVar,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td class="number">' . locale_number_format($TotalCostVar,$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>'; - -echo '<tr><td colspan="3"></td> +echo '<tr> + <td colspan="2" class="number">' . _('Totals') . '</td> + <td></td> + <td class="number">' . locale_number_format($TotalReqdCost,$_SESSION['CompanyRecord']['decimalplaces']) .'</td> + <td></td><td></td> + <td class="number">' . locale_number_format($TotalIssuedCost,$_SESSION['CompanyRecord']['decimalplaces']) .'</td> + <td class="number">' . locale_number_format($TotalUsageVar,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_number_format($TotalCostVar,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + </tr>'; + +echo '<tr> + <td colspan="3"></td> <td><hr/></td> <td colspan="2"></td> <td colspan="3"><hr></td> @@ -403,12 +422,12 @@ if ($_SESSION['CompanyRecord']['gllink_stock']==1 AND $TotalUsageVar!=0){ $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount) + typeno, + trandate, + periodno, + account, + narrative, + amount) VALUES (29, '" . $WOCloseNo . "', '" . Date('Y-m-d') . "', @@ -422,12 +441,12 @@ $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount) + typeno, + trandate, + periodno, + account, + narrative, + amount) VALUES (29, '" . $WOCloseNo . "', '" . Date('Y-m-d') . "', @@ -445,11 +464,11 @@ if ($_SESSION['CompanyRecord']['gllink_stock']==1 AND $TotalCostVar!=0){ $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, + typeno, + trandate, + periodno, + account, + narrative, amount) VALUES (29, '" . $WOCloseNo . "', @@ -464,12 +483,12 @@ $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount) + typeno, + trandate, + periodno, + account, + narrative, + amount) VALUES (29, '" . $WOCloseNo . "', '" . Date('Y-m-d') . "', @@ -515,12 +534,21 @@ if ($WorkOrderRow['closed']==0){ - echo '<tr><td colspan="9"><div class="centre"><input type=submit name="Close" value="' . _('Close This Work Order') . '" onclick="return confirm(\'' . _('Closing the work order takes the variances to the general ledger (if integrated). The work order will no longer be able to have manufactured goods received entered against it or materials issued to it.') . ' ' . _('Are You Sure?') . '\');"></div></td></tr>'; + echo '<tr> + <td colspan="9"> + <div class="centre"> + <input type=submit name="Close" value="' . _('Close This Work Order') . '" onclick="return confirm(\'' . _('Closing the work order takes the variances to the general ledger (if integrated). The work order will no longer be able to have manufactured goods received entered against it or materials issued to it.') . ' ' . _('Are You Sure?') . '\');"> + </div> + </td> + </tr>'; } else { - echo '<tr><td colspan="9">' . _('This work order is closed and cannot accept additional issues of materials or receipts of manufactured items') . '</td></tr>'; + echo '<tr> + <td colspan="9">' . _('This work order is closed and cannot accept additional issues of materials or receipts of manufactured items') . '</td> + </tr>'; } -echo '</table>'; -echo '</form>'; +echo '</table> + + </form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/WorkOrderEntry.php =================================================================== --- trunk/WorkOrderEntry.php 2011-10-19 09:40:44 UTC (rev 4728) +++ trunk/WorkOrderEntry.php 2011-10-22 05:19:43 UTC (rev 4729) @@ -7,8 +7,10 @@ include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . _('Search') . - '" alt="" />' . ' ' . $title.'</p>'; +echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . _('Search') . + '" alt="" />' . ' ' . $title.' + </p>'; if (isset($_GET['ReqDate'])){ $ReqDate = $_GET['ReqDate']; @@ -68,23 +70,22 @@ if ($_POST['StockCat']=='All'){ $SQL = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster, - stockcategory - WHERE stockmaster.categoryid=stockcategory.categoryid - AND (stockcategory.stocktype='F' OR stockcategory.stocktype='D') + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE (stockcategory.stocktype='F' OR stockcategory.stocktype='D') AND stockmaster.description " . LIKE . " '$SearchString' AND stockmaster.discontinued=0 AND mbflag='M' ORDER BY stockmaster.stockid"; } else { $SQL = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster, stockcategory - WHERE stockmaster.categoryid=stockcategory.categoryid... [truncated message content] |