From: <tim...@us...> - 2010-01-20 17:36:27
|
Revision: 3311 http://web-erp.svn.sourceforge.net/web-erp/?rev=3311&view=rev Author: tim_schofield Date: 2010-01-20 17:36:19 +0000 (Wed, 20 Jan 2010) Log Message: ----------- Remove redundant javascript calls Modified Paths: -------------- trunk/AccountGroups.php trunk/AccountSections.php trunk/DiscountMatrix.php trunk/GLBudgets.php trunk/GoodsReceived.php trunk/Payments.php trunk/SelectGLAccount.php trunk/SelectOrderItems.php trunk/StockLocTransfer.php trunk/StockLocTransferReceive.php trunk/TaxGroups.php trunk/WOSerialNos.php trunk/WorkCentres.php trunk/WorkOrderEntry.php trunk/WorkOrderReceive.php trunk/doc/Change.log.html Modified: trunk/AccountGroups.php =================================================================== --- trunk/AccountGroups.php 2010-01-20 06:23:48 UTC (rev 3310) +++ trunk/AccountGroups.php 2010-01-20 17:36:19 UTC (rev 3311) @@ -18,10 +18,10 @@ $ErrMsg = _('An error occurred in retrieving the account groups of the parent account group during the check for recursion'); $DbgMsg = _('The SQL that was used to retrieve the account groups of the parent account group and that failed in the process was'); - + do { $sql = "SELECT parentgroupname FROM accountgroups WHERE groupname='" . $GroupName ."'"; - + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg); $myrow = DB_fetch_row($result); if ($ParentGroupName == $myrow[0]){ @@ -36,9 +36,9 @@ if (isset($Errors)) { unset($Errors); } - -$Errors = array(); +$Errors = array(); + if (isset($_POST['submit'])) { //initialise no input errors assumed initially before we test @@ -50,8 +50,8 @@ //first off validate inputs sensible $i=1; - - $sql="SELECT count(groupname) + + $sql="SELECT count(groupname) FROM accountgroups WHERE groupname='".$_POST['GroupName']."'"; $DbgMsg = _('The SQL that was used to retrieve the information was'); @@ -64,7 +64,7 @@ $InputError = 1; prnMsg( _('The account group name already exists in the database'),'error'); $Errors[$i] = 'GroupName'; - $i++; + $i++; } if (ContainsIllegalCharacters($_POST['GroupName'])) { $InputError = 1; @@ -85,12 +85,12 @@ $Errors[$i] = 'ParentGroupName'; $i++; } else { - $sql = "SELECT pandl, - sequenceintb, - sectioninaccounts - FROM accountgroups + $sql = "SELECT pandl, + sequenceintb, + sectioninaccounts + FROM accountgroups WHERE groupname='" . $_POST['ParentGroupName'] . "'"; - + $DbgMsg = _('The SQL that was used to retrieve the information was'); $ErrMsg = _('Could not check whether the group is recursive because'); @@ -119,7 +119,7 @@ prnMsg( _('The sequence in the TB must be numeric and less than') . ' 10,000','error'); $Errors[$i] = 'SequenceInTB'; $i++; - } + } if ($_POST['SelectedAccountGroup']!='' AND $InputError !=1) { @@ -216,7 +216,7 @@ sequenceintb, pandl, parentgroupname - FROM accountgroups + FROM accountgroups LEFT JOIN accountsection ON sectionid = sectioninaccounts ORDER BY sequenceintb"; @@ -224,7 +224,7 @@ $ErrMsg = _('Could not get account groups because'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="">' . ' ' . $title.'<br>'; - + echo '<table> <tr> <th>' . _('Group Name') . "</th> @@ -369,7 +369,7 @@ } echo '</select>'; echo '</td></tr>'; - + echo '<tr><td>' . _('Profit and Loss') . ':' . '</td> <td><select tabindex="4" name="PandL">'; @@ -388,7 +388,7 @@ echo '<tr><td>' . _('Sequence In TB') . ':' . '</td>'; echo '<td><input tabindex="5" ' . (in_array('SequenceInTB',$Errors) ? 'class="inputerror"' : '' ) . - ' type="text" maxlength="4" name="SequenceInTB" onkeypress="return restrictToNumbers(this, event)" + ' type="text" maxlength="4" name="SequenceInTB" class=number value="' . $_POST['SequenceInTB'] . '" /></td></tr>'; echo '</table>'; @@ -396,9 +396,9 @@ echo '<div class="centre"><input tabindex="6" type="submit" name="submit" value="' . _('Enter Information') . '" /></div>'; echo '<script type="text/javascript">defaultControl(document.forms[0].GroupName);</script>'; - + echo '</form>'; } //end if record deleted no point displaying form to add record include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/AccountSections.php =================================================================== --- trunk/AccountSections.php 2010-01-20 06:23:48 UTC (rev 3310) +++ trunk/AccountSections.php 2010-01-20 17:36:19 UTC (rev 3311) @@ -17,7 +17,7 @@ if( $myrow[0] == 0 ) { $sql = "INSERT INTO accountsection ( sectionid, - sectionname + sectionname ) VALUES ( 1, 'Income' @@ -31,22 +31,22 @@ if( $myrow[0] == 0 ) { $sql = "INSERT INTO accountsection ( sectionid, - sectionname + sectionname ) VALUES ( 2, 'Cost Of Sales' )"; $result = DB_query($sql,$db); } -// DONE WITH MINIMUM TESTS +// DONE WITH MINIMUM TESTS if (isset($Errors)) { unset($Errors); } - -$Errors = array(); +$Errors = array(); + if (isset($_POST['submit'])) { //initialise no input errors assumed initially before we test @@ -59,7 +59,7 @@ //first off validate inputs sensible if (isset($_POST['SectionID'])) { - $sql="SELECT count(sectionid) + $sql="SELECT count(sectionid) FROM accountsection WHERE sectionid='".$_POST['SectionID']."'"; $result=DB_query($sql, $db); $myrow=DB_fetch_row($result); @@ -67,32 +67,32 @@ $InputError = 1; prnMsg( _('The account section already exists in the database'),'error'); $Errors[$i] = 'SectionID'; - $i++; + $i++; } } if (strpos($_POST['SectionName'],'&')>0 OR strpos($_POST['SectionName'],"'")>0) { $InputError = 1; prnMsg( _('The account section name cannot contain the character') . " '&' " . _('or the character') ." '",'error'); $Errors[$i] = 'SectionName'; - $i++; - } + $i++; + } if (strlen($_POST['SectionName'])==0) { $InputError = 1; prnMsg( _('The account section name must contain at least one character') ,'error'); $Errors[$i] = 'SectionName'; - $i++; + $i++; } if (isset($_POST['SectionID']) and (!is_numeric($_POST['SectionID']))) { $InputError = 1; prnMsg( _('The section number must be an integer'),'error'); $Errors[$i] = 'SectionID'; - $i++; + $i++; } if (isset($_POST['SectionID']) and strpos($_POST['SectionID'],".")>0) { $InputError = 1; prnMsg( _('The section number must be an integer'),'error'); $Errors[$i] = 'SectionID'; - $i++; + $i++; } if (isset($_POST['SelectedSectionID']) and $_POST['SelectedSectionID']!='' AND $InputError !=1) { @@ -144,7 +144,7 @@ $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); $SectionName = $myrow[0]; - + $sql="DELETE FROM accountsection WHERE sectionid='" . $_GET['SelectedSectionID'] . "'"; $result = DB_query($sql,$db); prnMsg( $SectionName . ' ' . _('section has been deleted') . '!','success'); @@ -159,7 +159,7 @@ if (!isset($_GET['SelectedSectionID']) OR !isset($_POST['SelectedSectionID'])) { -/* An account section could be posted when one has been edited and is being updated +/* An account section could be posted when one has been edited and is being updated or GOT when selected for modification SelectedSectionID will exist because it was sent with the page in a GET . If its the first time the page has been displayed with no parameters @@ -254,7 +254,7 @@ echo "<table> <tr> <td>" . _('Section Number') . ':' . '</td> - <td><input tabindex="1" ' . (in_array('SectionID',$Errors) ? 'class="inputerror"' : '' ) ." type='text' name='SectionID' onKeyPress='return restrictToNumbers(this, event)' size=4 maxlength=4 value='" . $_POST['SectionID'] . "'></td></tr>"; + <td><input tabindex="1" ' . (in_array('SectionID',$Errors) ? 'class="inputerror"' : '' ) ." type='text' name='SectionID' class=number size=4 maxlength=4 value='" . $_POST['SectionID'] . "'></td></tr>"; } echo "<tr><td>" . _('Section Description') . ':' . '</td> <td><input tabindex="2" ' . (in_array('SectionName',$Errors) ? 'class="inputerror"' : '' ) ." type='text' name='SectionName' size=30 maxlength=30 value='" . $_POST['SectionName'] . "'></td> Modified: trunk/DiscountMatrix.php =================================================================== --- trunk/DiscountMatrix.php 2010-01-20 06:23:48 UTC (rev 3310) +++ trunk/DiscountMatrix.php 2010-01-20 17:36:19 UTC (rev 3311) @@ -11,8 +11,8 @@ if (isset($Errors)) { unset($Errors); } - -$Errors = array(); + +$Errors = array(); $i=1; echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="">' . ' ' . $title.'<br>'; @@ -26,26 +26,26 @@ prnMsg( _('The quantity break must be entered as a positive number'),'error'); $InputError =1; $Errors[$i] = 'QuantityBreak'; - $i++; + $i++; } if ($_POST['QuantityBreak']<=0){ prnMsg( _('The quantity of all items on an order in the discount category') . ' ' . $_POST['DiscountCategory'] . ' ' . _('at which the discount will apply is 0 or less than 0') . '. ' . _('Positive numbers are expected for this entry'),'warn'); $InputError =1; $Errors[$i] = 'QuantityBreak'; - $i++; + $i++; } if (!is_numeric($_POST['DiscountRate'])){ prnMsg( _('The discount rate must be entered as a positive number'),'warn'); $InputError =1; $Errors[$i] = 'DiscountRate'; - $i++; + $i++; } if ($_POST['DiscountRate']<=0 OR $_POST['DiscountRate']>=70){ prnMsg( _('The discount rate applicable for this record is either less than 0% or greater than 70%') . '. ' . _('Numbers between 1 and 69 are expected'),'warn'); $InputError =1; $Errors[$i] = 'DiscountRate'; - $i++; + $i++; } /* actions to take once the user has clicked the submit button @@ -53,13 +53,13 @@ if ($InputError !=1) { - $sql = "INSERT INTO discountmatrix (salestype, - discountcategory, - quantitybreak, - discountrate) - VALUES('" . $_POST['SalesType'] . "', - '" . $_POST['DiscountCategory'] . "', - " . $_POST['QuantityBreak'] . ", + $sql = "INSERT INTO discountmatrix (salestype, + discountcategory, + quantitybreak, + discountrate) + VALUES('" . $_POST['SalesType'] . "', + '" . $_POST['DiscountCategory'] . "', + " . $_POST['QuantityBreak'] . ", " . ($_POST['DiscountRate']/100) . ')'; $result = DB_query($sql,$db); @@ -126,11 +126,11 @@ echo '<tr><td>' . _('Quantity Break') . ":</td><td><input class='number' tabindex=3 " . (in_array('QuantityBreak',$Errors) ? "class='inputerror'" : "") - ." type='text' name='QuantityBreak' size=10 maxlength=10 onKeyPress='return restrictToNumbers(this, event)'></td></tr>"; + ." type='text' name='QuantityBreak' size=10 maxlength=10></td></tr>"; echo '<tr><td>' . _('Discount Rate') . " (%):</td><td><input class='number' tabindex=4 " . (in_array('DiscountRate',$Errors) ? "class='inputerror'" : "") . - "type='text' name='DiscountRate' size=4 maxlength=4 onKeyPress='return restrictToNumbers(this, event)'></td></tr>"; + "type='text' name='DiscountRate' size=4 maxlength=4></td></tr>"; echo '</table><br>'; echo "<div class='centre'><input tabindex=5 type='submit' name='submit' value='" . _('Enter Information') . "'></div><hr>"; Modified: trunk/GLBudgets.php =================================================================== --- trunk/GLBudgets.php 2010-01-20 06:23:48 UTC (rev 3310) +++ trunk/GLBudgets.php 2010-01-20 17:36:19 UTC (rev 3311) @@ -31,7 +31,7 @@ echo '<form action=' . $_SERVER['PHP_SELF'] . '?' . SID . ' method=post name="selectaccount">'; echo '<table>'; -echo '</br><tr><td>'. _('Select GL Account'). ":</td><td><select name='SelectedAccount' +echo '</br><tr><td>'. _('Select GL Account'). ":</td><td><select name='SelectedAccount' onChange='ReloadForm(selectaccount.Select)'>"; $SQL = 'SELECT accountcode, @@ -121,9 +121,9 @@ if (isset($_POST['apportion'])) { for ($i=1; $i<=12; $i++) { - if ($_POST['AnnualAmount'] != '0') + if ($_POST['AnnualAmount'] != '0') $budget[$CurrentYearEndPeriod+($i)] = $_POST['AnnualAmount']/12; - if ($_POST['AnnualAmountTY'] != '0') + if ($_POST['AnnualAmountTY'] != '0') $budget[$CurrentYearEndPeriod+($i)-12] = $_POST['AnnualAmountTY']/12; } } @@ -168,10 +168,10 @@ echo '<td bgcolor="d2e5e8" class="number">'.number_format($budget[$CurrentYearEndPeriod-(24-$i)],2,'.','').'</td>'; echo '<th>'. $PeriodEnd[$CurrentYearEndPeriod-(12-$i)] .'</th>'; echo '<td bgcolor="d2e5e8" class="number">'.number_format($actual[$CurrentYearEndPeriod-(12-$i)],2,'.','').'</td>'; - echo '<td><input type="text" onKeyPress="return restrictToNumbers(this, event)" class="number" size=14 name='.$i.'this'.' value="'.number_format($budget[$CurrentYearEndPeriod-(12-$i)],2,'.','').'"></td>'; + echo '<td><input type="text" class="number" size=14 name='.$i.'this'.' value="'.number_format($budget[$CurrentYearEndPeriod-(12-$i)],2,'.','').'"></td>'; echo '<th>'. $PeriodEnd[$CurrentYearEndPeriod+($i)] .'</th>'; echo '<td bgcolor="d2e5e8" class="number">'.number_format($actual[$CurrentYearEndPeriod+($i)],2,'.','').'</td>'; - echo '<td><input type="text" onKeyPress="return restrictToNumbers(this, event)" class="number" size=14 name='.$i.'next'.' value='.number_format($budget[$CurrentYearEndPeriod+($i)],2,'.','').'></td>'; + echo '<td><input type="text" class="number" size=14 name='.$i.'next'.' value='.number_format($budget[$CurrentYearEndPeriod+($i)],2,'.','').'></td>'; echo '</tr>'; $LastYearActual=$LastYearActual+$actual[$CurrentYearEndPeriod-(24-$i)]; $LastYearBudget=$LastYearBudget+$budget[$CurrentYearEndPeriod-(24-$i)]; @@ -193,9 +193,9 @@ echo '<th align="right">'.number_format($NextYearActual,2,'.',''). '</th>'; echo '<th align="right">'.number_format($NextYearBudget,2,'.',''). '</th></tr>'; echo '<tr><td></td><td></td><td></td><td colspan=2>'._('Annual Budget').'</td>'; - echo '<td><input onKeyPress="return restrictToNumbers(this, event)" type="text" size=14 name="AnnualAmountTY" style="text-align: right" value=0.00></td>'; + echo '<td><input class=number type="text" size=14 name="AnnualAmountTY" value=0.00></td>'; echo '</td><td></td><td>'; - echo '<td><input onChange="numberFormat(this,2)" onKeyPress="return restrictToNumbers(this, event)" type="text" size=14 name="AnnualAmount" style="text-align: right" value=0.00></td>'; + echo '<td><input onChange="numberFormat(this,2)" class=number type="text" size=14 name="AnnualAmount" value=0.00></td>'; echo '<td><input type="submit" name="apportion" value="Apportion budget"></td>'; echo '</tr>'; echo '</table>'; Modified: trunk/GoodsReceived.php =================================================================== --- trunk/GoodsReceived.php 2010-01-20 06:23:48 UTC (rev 3310) +++ trunk/GoodsReceived.php 2010-01-20 17:36:19 UTC (rev 3311) @@ -127,7 +127,7 @@ } else { $uom=$LnItm->Units; } - + //Now Display LineItem echo '<td><font size=2>' . $LnItm->StockID . '</font></td>'; echo '<td><font size=2>' . $LnItm->ItemDescription . '</td>'; @@ -141,7 +141,7 @@ echo '<input type=hidden name="RecvQty_' . $LnItm->LineNo . '" value="' . $LnItm->ReceiveQty . '"><a href="GoodsReceivedControlled.php?' . SID . '&LineNo=' . $LnItm->LineNo . '">' . number_format($LnItm->ReceiveQty,$LnItm->DecimalPlaces) . '</a></td>'; } else { - echo '<input type=text class=number name="RecvQty_' . $LnItm->LineNo . '" maxlength=10 size=10 onKeyPress="return restrictToNumbers(this, event)" onFocus="return setTextAlign(this, '."'".'right'."'".')" value="' . $LnItm->ReceiveQty . '"></td>'; + echo '<input type=text class=number name="RecvQty_' . $LnItm->LineNo . '" maxlength=10 size=10 value="' . $LnItm->ReceiveQty . '"></td>'; } echo '<td class=number><font size=2>' . $DisplayPrice . '</td>'; @@ -378,7 +378,7 @@ completed=0 WHERE podetailitem = " . $OrderLine->PODetailRec; } - + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The purchase order detail record could not be updated with the quantity received because'); $DbgMsg = _('The following SQL to update the purchase order detail record was used'); $Result = DB_query($SQL,$db, $ErrMsg, $DbgMsg, true); @@ -527,16 +527,16 @@ $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock item record could not be inserted because'); $DbgMsg = _('The following SQL to insert the serial stock item records was used'); $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); - + /*Update fixed asset details */ $sql='select stocktype from stockcategory - left join stockmaster on - stockcategory.categoryid=stockmaster.categoryid + left join stockmaster on + stockcategory.categoryid=stockmaster.categoryid where stockmaster.stockid="'.$OrderLine->StockID.'"'; $result=DB_query($sql, $db); $myrow=DB_fetch_array($result); if ($myrow['stocktype']=='A') { - $SQL = "INSERT INTO assetmanager + $SQL = "INSERT INTO assetmanager VALUES (NULL, '" . $OrderLine->StockID . "', '" . $Item->BundleRef . "', @@ -620,12 +620,12 @@ } /*end of OrderLine loop */ $completedsql='SELECT SUM(completed) as completedlines, COUNT(podetailitem) as alllines - FROM purchorderdetails + FROM purchorderdetails WHERE orderno='.$_SESSION['PO']->OrderNo; $completedresult=DB_query($completedsql,$db); $mycompletedrow=DB_fetch_array($completedresult); $status=$mycompletedrow['alllines']-$mycompletedrow['completedlines']; - + if ($status==0) { $sql='SELECT stat_comment FROM purchorders WHERE orderno='.$_SESSION['PO']->OrderNo; $result=DB_query($sql,$db); @@ -633,14 +633,14 @@ $comment=$myrow['stat_comment']; $date = date($_SESSION['DefaultDateFormat']); $StatusComment=$date.' - Order Completed'.'<br>'.$comment; - $sql="UPDATE purchorders + $sql="UPDATE purchorders SET status='" . PurchOrder::STATUS_COMPLITED . "', stat_comment='".$StatusComment."' WHERE orderno=".$_SESSION['PO']->OrderNo; $result=DB_query($sql,$db); } - + $Result = DB_Txn_Commit($db); $PONo = $_SESSION['PO']->OrderNo; unset($_SESSION['PO']->LineItems); Modified: trunk/Payments.php =================================================================== --- trunk/Payments.php 2010-01-20 06:23:48 UTC (rev 3310) +++ trunk/Payments.php 2010-01-20 17:36:19 UTC (rev 3311) @@ -234,8 +234,8 @@ } $PeriodNo = GetPeriod($_SESSION['PaymentDetail']->DatePaid,$db); - - + + // first time through commit if supplier cheque then print it first if ((!isset($_POST['ChequePrinted'])) AND (!isset($_POST['PaymentCancelled'])) @@ -521,7 +521,7 @@ $ErrMsg = _('Cannot insert a bank transaction because'); $DbgMsg = _('Cannot insert a bank transaction using the SQL'); - $result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); + $result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); } else { foreach ($_SESSION['PaymentDetail']->GLItems as $PaymentItem) { $SQL="INSERT INTO banktrans (transno, @@ -891,14 +891,13 @@ /*now set up a GLCode field to select from avaialble GL accounts */ if (isset($_POST['GLManualCode'])) { echo '<tr><td>' . _('Enter GL Account Manually') . ':</td> - <td><input type=Text Name="GLManualCode" Maxlength=12 size=12onChange="return inArray(this, this.value, GLCode.options,'. + <td><input type=Text class="number" Name="GLManualCode" Maxlength=12 size=12 onChange="return inArray(this, this.value, GLCode.options,'. "'".'The account code '."'".'+ this.value+ '."'".' doesnt exist'."'".')"' . - ' onKeyPress="return restrictToNumbers(this, event)" VALUE='. $_POST['GLManualCode'] .' ></td></tr>'; + ' VALUE='. $_POST['GLManualCode'] .' ></td></tr>'; } else { echo '<tr><td>' . _('Enter GL Account Manually') . ':</td> - <td><input type=Text Name="GLManualCode" Maxlength=12 size=12 onChange="return inArray(this, this.value, GLCode.options,'. - "'".'The account code '."'".'+ this.value+ '."'".' doesnt exist'."'".')"' . - ' onKeyPress="return restrictToNumbers(this, event)"></td></tr>'; + <td><input type=Text class="number" Name="GLManualCode" Maxlength=12 size=12 onChange="return inArray(this, this.value, GLCode.options,'. + "'".'The account code '."'".'+ this.value+ '."'".' doesnt exist'."'".')"></td></tr>'; } echo '<tr><td>' . _('Select GL Account') . ':</td> <td><select name="GLCode" onChange="return assignComboToInput(this,'.'GLManualCode'.')">'; @@ -928,14 +927,14 @@ if (isset($_POST['GLNarrative'])) { echo '<tr><td>' . _('GL Narrative') . ':</td><td><input type="text" name="GLNarrative" maxlength=50 size=52 value="' . $_POST['GLNarrative'] . '"></td></tr>'; } else { - echo '<tr><td>' . _('GL Narrative') . ':</td><td><input type="text" name="GLNarrative" maxlength=50 size=52></td></tr>'; + echo '<tr><td>' . _('GL Narrative') . ':</td><td><input type="text" name="GLNarrative" maxlength=50 size=52></td></tr>'; } - + if (isset($_POST['GLAmount'])) { - echo '<tr><td>' . _('Amount') . ' (' . $_SESSION['PaymentDetail']->Currency . '):</td><td><input type=Text Name="GLAmount" Maxlength=12 size=12 onKeyPress="return restrictToNumbers(this, event)" onChange="numberFormat(this,2)" onFocus="return setTextAlign(this, '."'".'right'."'".')" VALUE=' . $_POST['GLAmount'] . '></td></tr>'; + echo '<tr><td>' . _('Amount') . ' (' . $_SESSION['PaymentDetail']->Currency . '):</td><td><input type=Text Name="GLAmount" Maxlength=12 size=12 class=number VALUE=' . $_POST['GLAmount'] . '></td></tr>'; } else { - echo '<tr><td>' . _('Amount') . ' (' . $_SESSION['PaymentDetail']->Currency . '):</td><td><input type=Text Name="GLAmount" Maxlength=12 size=12 onKeyPress="return restrictToNumbers(this, event)" onChange="numberFormat(this,2)" onFocus="return setTextAlign(this, '."'".'right'."'".')"></td></tr>'; - } + echo '<tr><td>' . _('Amount') . ' (' . $_SESSION['PaymentDetail']->Currency . '):</td><td><input type=Text Name="GLAmount" Maxlength=12 size=12 class=number></td></tr>'; + } echo '</table>'; echo '<div class="centre"><input type=submit name="Process" value="' . _('Accept') . '"><input type=submit name="Cancel" value="' . _('Cancel') . '"></div>'; Modified: trunk/SelectGLAccount.php =================================================================== --- trunk/SelectGLAccount.php 2010-01-20 06:23:48 UTC (rev 3310) +++ trunk/SelectGLAccount.php 2010-01-20 17:36:19 UTC (rev 3311) @@ -49,8 +49,8 @@ $SQL = "SELECT chartmaster.accountcode, chartmaster.accountname, chartmaster.group_, - CASE WHEN accountgroups.pandl!=0 - THEN '" . _('Profit and Loss') . "' + CASE WHEN accountgroups.pandl!=0 + THEN '" . _('Profit and Loss') . "' ELSE '" . _('Balance Sheet') . "' END AS pl FROM chartmaster, accountgroups @@ -84,7 +84,7 @@ if (!isset($AccountID)) { -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Search') . '" alt="">' . ' ' . _('Search for General Ledger Accounts'); +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Search') . '" alt="">' . ' ' . _('Search for General Ledger Accounts'); echo "<br><form action='" . $_SERVER['PHP_SELF'] . '?' . SID . "' method=post>"; if(strlen($msg)>1){ @@ -97,7 +97,7 @@ <td><input type='Text' name='Keywords' size=20 maxlength=25></td> <td><font size=3><b>" . _('OR') . "</b></font></td> <td><font size=1>" . _('Enter Account No. to search from') . ":</font></td> - <td><input type='Text' name='GLCode' size=15 maxlength=18 onKeyPress='return restrictToNumbers(this, event)' ></td> + <td><input type='Text' name='GLCode' size=15 maxlength=18 class=number ></td> </tr> </table><br>"; Modified: trunk/SelectOrderItems.php =================================================================== --- trunk/SelectOrderItems.php 2010-01-20 06:23:48 UTC (rev 3310) +++ trunk/SelectOrderItems.php 2010-01-20 17:36:19 UTC (rev 3311) @@ -62,7 +62,7 @@ } -// removed to improve UI layout +// removed to improve UI layout //echo '<a href="'. $rootpath . '/SelectSalesOrder.php?' . SID . '">'. _('Back to Sales Orders'). '</a><br>'; if (isset($_GET['ModifyOrderNumber']) @@ -250,7 +250,7 @@ $myrow['eoq'], $myrow['nextserialno'], $ExRate ); - + /*Just populating with existing order - no DBUpdates */ } $LastLineNo = $myrow['orderlineno']; @@ -324,10 +324,10 @@ custbranch.debtorno FROM custbranch WHERE custbranch.brname " . LIKE . " '$SearchString'"; - + if ($_SESSION['SalesmanLogin']!=''){ $SQL .= " AND custbranch.salesman='" . $_SESSION['SalesmanLogin'] . "'"; - } + } $SQL .= ' AND custbranch.disabletrans=0 ORDER BY custbranch.debtorno, custbranch.branchcode'; @@ -343,7 +343,7 @@ custbranch.debtorno FROM custbranch WHERE custbranch.debtorno " . LIKE . " '%" . $_POST['CustCode'] . "%' OR custbranch.branchcode " . LIKE . " '%" . $_POST['CustCode'] . "%'"; - + if ($_SESSION['SalesmanLogin']!=''){ $SQL .= " AND custbranch.salesman='" . $_SESSION['SalesmanLogin'] . "'"; } @@ -358,11 +358,11 @@ custbranch.debtorno FROM custbranch WHERE custbranch.phoneno " . LIKE . " '%" . $_POST['CustPhone'] . "%'"; - + if ($_SESSION['SalesmanLogin']!=''){ $SQL .= " AND custbranch.salesman='" . $_SESSION['SalesmanLogin'] . "'"; } - + $SQL .= ' AND custbranch.disabletrans=0 ORDER BY custbranch.debtorno'; } @@ -476,7 +476,7 @@ include('includes/footer.inc'); exit; } - + $_SESSION['Items'.$identifier]->DeliverTo = $myrow[0]; $_SESSION['Items'.$identifier]->DelAdd1 = $myrow[1]; $_SESSION['Items'.$identifier]->DelAdd2 = $myrow[2]; @@ -602,8 +602,8 @@ if ($_SESSION['RequireCustomerSelection'] ==1 OR !isset($_SESSION['Items'.$identifier]->DebtorNo) OR $_SESSION['Items'.$identifier]->DebtorNo=='') { - + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Search') . '" alt="">' . ' ' . _('Enter an Order or Quotation') . ' : ' . _('Search for the Customer Branch.') . '</p>'; echo '<div class="page_help_text">' . _('Orders/Quotations are placed against the Customer Branch. A Customer may have several Branches.') . '</div>'; @@ -901,10 +901,10 @@ /*Process Quick Entry */ /* If enter is pressed on the quick entry screen, the default button may be Recalculate */ - if (isset($_POST['order_items']) - OR isset($_POST['QuickEntry']) - OR isset($_POST['Recalculate'])){ - + if (isset($_POST['order_items']) + OR isset($_POST['QuickEntry']) + OR isset($_POST['Recalculate'])){ + /* get the item details from the database and hold them in the cart object */ /*Discount can only be set later on -- after quick entry -- so default discount to 0 in the first place */ @@ -991,7 +991,7 @@ unset($NewItem); } /* end of if quick entry */ - + /*Now do non-quick entry delete/edits/adds */ if ((isset($_SESSION['Items'.$identifier])) OR isset($NewItem)){ @@ -1011,7 +1011,7 @@ if (isset($_POST['Quantity_' . $OrderLine->LineNumber])){ $Quantity = $_POST['Quantity_' . $OrderLine->LineNumber]; - + if (ABS($OrderLine->Price - $_POST['Price_' . $OrderLine->LineNumber])>0.01){ $Price = $_POST['Price_' . $OrderLine->LineNumber]; $_POST['GPPercent_' . $OrderLine->LineNumber] = (($Price*(1-($_POST['Discount_' . $OrderLine->LineNumber]/100))) - $OrderLine->StandardCost*$ExRate)/($Price *(1-$_POST['Discount_' . $OrderLine->LineNumber])/100); @@ -1020,14 +1020,14 @@ $Price = ($OrderLine->StandardCost*$ExRate)/(1 -(($_POST['GPPercent_' . $OrderLine->LineNumber] + $_POST['Discount_' . $OrderLine->LineNumber])/100)); } else { $Price = $_POST['Price_' . $OrderLine->LineNumber]; - } + } $DiscountPercentage = $_POST['Discount_' . $OrderLine->LineNumber]; if ($_SESSION['AllowOrderLineItemNarrative'] == 1) { $Narrative = $_POST['Narrative_' . $OrderLine->LineNumber]; } else { $Narrative = ''; } - + if (!isset($OrderLine->DiscountPercent)) { $OrderLine->DiscountPercent = 0; } @@ -1047,13 +1047,13 @@ } elseif ($_SESSION['Items'.$identifier]->LineItems[$OrderLine->LineNumber]->QtyInv > $Quantity){ prnMsg( _('You are attempting to make the quantity ordered a quantity less than has already been invoiced') . '. ' . _('The quantity delivered and invoiced cannot be modified retrospectively'),'warn'); - } elseif ($OrderLine->Quantity !=$Quantity - OR $OrderLine->Price != $Price - OR ABS($OrderLine->DiscountPercent -$DiscountPercentage/100) >0.001 - OR $OrderLine->Narrative != $Narrative - OR $OrderLine->ItemDue != $_POST['ItemDue_' . $OrderLine->LineNumber] + } elseif ($OrderLine->Quantity !=$Quantity + OR $OrderLine->Price != $Price + OR ABS($OrderLine->DiscountPercent -$DiscountPercentage/100) >0.001 + OR $OrderLine->Narrative != $Narrative + OR $OrderLine->ItemDue != $_POST['ItemDue_' . $OrderLine->LineNumber] OR $OrderLine->POLine != $_POST['POLine_' . $OrderLine->LineNumber]) { - + $_SESSION['Items'.$identifier]->update_cart_item($OrderLine->LineNumber, $Quantity, $Price, @@ -1113,7 +1113,7 @@ } else { /*Its not a kit set item*/ $NewItemDue = date($_SESSION['DefaultDateFormat']); $NewPOLine = 0; - + include('includes/SelectOrderItems_IntoCart.inc'); } @@ -1223,7 +1223,7 @@ <th>' . _('Unit') . '</th> <th>' . _('Price') . '</th>'; - if (in_array(2,$_SESSION['AllowedPageSecurityTokens'])){ + if (in_array(2,$_SESSION['AllowedPageSecurityTokens'])){ echo '<th>' . _('Discount') . '</th> <th>' . _('GP %') . '</th>'; } @@ -1263,7 +1263,7 @@ echo '<td><a target="_blank" href="' . $rootpath . '/StockStatus.php?' . SID .'identifier='.$identifier . '&StockID=' . $OrderLine->StockID . '&DebtorNo=' . $_SESSION['Items'.$identifier]->DebtorNo . '">' . $OrderLine->StockID . '</a></td> <td>' . $OrderLine->ItemDescription . '</td>'; - echo '<td><input class="number" onKeyPress="return restrictToNumbers(this, event)" tabindex=2 type=tect name="Quantity_' . $OrderLine->LineNumber . '" size=6 maxlength=6 value=' . $OrderLine->Quantity . '>'; + echo '<td><input class="number" tabindex=2 type=tect name="Quantity_' . $OrderLine->LineNumber . '" size=6 maxlength=6 value=' . $OrderLine->Quantity . '>'; if ($QtyRemain != $QtyOrdered){ echo '<br>'.$OrderLine->QtyInv.' of '.$OrderLine->Quantity.' invoiced'; } @@ -1273,9 +1273,9 @@ if (in_array(2,$_SESSION['AllowedPageSecurityTokens'])){ /*OK to display with discount if it is an internal user with appropriate permissions */ - echo '<td><input class="number" onKeyPress="return restrictToNumbers(this, event)" type=text name="Price_' . $OrderLine->LineNumber . '" size=16 maxlength=16 value=' . $OrderLine->Price . '></td> - <td><input class="number" onKeyPress="return restrictToNumbers(this, event)" type=text name="Discount_' . $OrderLine->LineNumber . '" size=5 maxlength=4 value=' . ($OrderLine->DiscountPercent * 100) . '></td> - <td><input class="number" onKeyPress="return restrictToNumbers(this, event)" type=text name="GPPercent_' . $OrderLine->LineNumber . '" size=3 maxlength=40 value=' . $OrderLine->GPPercent . '></td>'; + echo '<td><input class="number" type=text name="Price_' . $OrderLine->LineNumber . '" size=16 maxlength=16 value=' . $OrderLine->Price . '></td> + <td><input class="number" type=text name="Discount_' . $OrderLine->LineNumber . '" size=5 maxlength=4 value=' . ($OrderLine->DiscountPercent * 100) . '></td> + <td><input class="number" type=text name="GPPercent_' . $OrderLine->LineNumber . '" size=3 maxlength=40 value=' . $OrderLine->GPPercent . '></td>'; } else { echo '<td class=number>' . $OrderLine->Price . '</td><td></td>'; echo '<input type=hidden name="Price_' . $OrderLine->LineNumber . '" value=' . $OrderLine->Price . '>'; @@ -1338,10 +1338,10 @@ echo '<input type="hidden" name="PartSearch" value="' . _('Yes Please') . '">'; if ($_SESSION['FrequentlyOrderedItems']>0){ //show the Frequently Order Items selection where configured to do so - + // Select the most recently ordered items for quick select $SixMonthsAgo = DateAdd (Date($_SESSION['DefaultDateFormat']),'m',-6); - + $SQL="SELECT stockmaster.units, stockmaster.description, stockmaster.stockid, salesorderdetails.stkcode, SUM(qtyinvoiced) Sales FROM `salesorderdetails`, `stockmaster` WHERE ActualDispatchDate >= '" . FormatDateForSQL($SixMonthsAgo) . "' AND salesorderdetails.stkcode = stockmaster.stockid @@ -1400,7 +1400,7 @@ // Find the quantity on purchase orders $sql = "SELECT SUM(purchorderdetails.quantityord-purchorderdetails.quantityrecd) AS dem FROM purchorderdetails - WHERE purchorderdetails.completed=0 + WHERE purchorderdetails.completed=0 AND purchorderdetails.itemcode='" . $myrow['stockid'] . "'"; $ErrMsg = _('The order details for this product cannot be retrieved because'); @@ -1502,8 +1502,8 @@ <td align="right"><b><?php echo _('OR'); ?> </b><b><?php echo _('Enter extract of the Stock Code'); ?>:</b> <input tabindex=3 type="Text" name="StockCode" size=15 maxlength=18 value="<?php if (isset($_POST['StockCode'])) echo $_POST['StockCode']; ?>"></td> - - </tr><tr> + + </tr><tr> <td style="text-align:center" colspan=1><input tabindex=4 type=submit name="Search" value="<?php echo _('Search Now'); ?>"></td> <td style="text-align:center" colspan=1><input tabindex=5 type=submit name="QuickEntry" value="<?php echo _('Use Quick Entry'); ?>"></td> @@ -1705,10 +1705,10 @@ }#end of else not selecting a customer echo '</form>'; -echo '<script type="text/javascript">defaultControl(document.SelectParts.part_1);</script>'; +echo '<script type="text/javascript">defaultControl(document.SelectParts.part_1);</script>'; if (isset($_GET['NewOrder']) and $_GET['NewOrder']!='') { - echo '<script type="text/javascript">defaultControl(document.SelectCustomer.CustKeywords);</script>'; + echo '<script type="text/javascript">defaultControl(document.SelectCustomer.CustKeywords);</script>'; } include('includes/footer.inc'); ?> Modified: trunk/StockLocTransfer.php =================================================================== --- trunk/StockLocTransfer.php 2010-01-20 06:23:48 UTC (rev 3310) +++ trunk/StockLocTransfer.php 2010-01-20 17:36:19 UTC (rev 3311) @@ -118,7 +118,7 @@ If (isset($InputError) and $InputError==true){ echo '<br>'; - + prnMsg($ErrorMessage, 'error'); echo '<br>'; @@ -180,8 +180,8 @@ $k=0; } echo '<tr> - <td><input type=text name="StockID' . $i .'" size=21 maxlength=20 Value="' . $_POST['StockID' . $i] . '"></td> - <td><input type=text name="StockQTY' . $i .'" size=5 maxlength=4 onkeypress="return restrictToNumbers(this, event)" onFocus="return setTextAlign(this, '."'".'right'."'".')" Value="' . $_POST['StockQTY' . $i] . '"></td> + <td><input type=text name="StockID' . $i .'" size=21 maxlength=20 value="' . $_POST['StockID' . $i] . '"></td> + <td><input type=text name="StockQTY' . $i .'" size=5 maxlength=4 class="number" value="' . $_POST['StockQTY' . $i] . '"></td> </tr>'; } }else { @@ -198,14 +198,14 @@ $_POST['StockQTY' . $i]=0; } echo '<tr> - <td><input type=text name="StockID' . $i .'" size=21 maxlength=20 Value="' . $_POST['StockID' . $i] . '"></td> - <td><input type=text name="StockQTY' . $i .'" size=5 maxlength=4 onkeypress="return restrictToNumbers(this, event)" onFocus="return setTextAlign(this, '."'".'right'."'".')" Value="' . $_POST['StockQTY' . $i] . '"></td> + <td><input type=text name="StockID' . $i .'" size=21 maxlength=20 value="' . $_POST['StockID' . $i] . '"></td> + <td><input type=text name="StockQTY' . $i .'" size=5 maxlength=4 class="number" value="' . $_POST['StockQTY' . $i] . '"></td> </tr>'; $i++; } echo '</table><br><div class="centre"> - <input type=hidden name="LinesCounter" value='. $i .'><input type=submit name="EnterMoreItems" VALUE="'. _('Add More Items'). '"><input type=submit name="Submit" VALUE="'. _('Create Transfer Shipment'). '"><br><hr>'; + <input type=hidden name="LinesCounter" value='. $i .'><input type=submit name="EnterMoreItems" value="'. _('Add More Items'). '"><input type=submit name="Submit" value="'. _('Create Transfer Shipment'). '"><br><hr>'; echo '<script type="text/javascript">defaultControl(document.forms[0].StockID0);</script>'; echo '</form></div>'; include('includes/footer.inc'); Modified: trunk/StockLocTransferReceive.php =================================================================== --- trunk/StockLocTransferReceive.php 2010-01-20 06:23:48 UTC (rev 3310) +++ trunk/StockLocTransferReceive.php 2010-01-20 17:36:19 UTC (rev 3311) @@ -448,14 +448,14 @@ if ($TrfLine->Controlled==1){ echo '<td><input type=hidden name="Qty' . $i . '" VALUE="' . $Qty . '"><a href="' . $rootpath .'/StockTransferControlled.php?' . SID . '&TransferItem=' . $i . '">' . $Qty . '</a></td>'; } else { - echo '<td><input type=TEXT class="number" name="Qty' . $i . '" maxlength=10 onKeyPress="return restrictToNumbers(this, event)" onFocus="return setTextAlign(this, '."'".'right'."'".')" size=10 VALUE="' . $Qty . '"></td>'; + echo '<td><input type=TEXT class="number" name="Qty' . $i . '" maxlength=10 class="number" size=10 VALUE="' . $Qty . '"></td>'; } echo '<td>' . $TrfLine->PartUnit . '</td>'; - + echo '<td><input type="checkbox" name="CancelBalance' . $i . '" value=1></td>'; - + if ($TrfLine->Controlled==1){ if ($TrfLine->Serialised==1){ echo '<td><a href="' . $rootpath .'/StockTransferControlled.php?' . SID . '&TransferItem=' . $i . '">' . _('Enter Serial Numbers') . '</a></td>'; Modified: trunk/TaxGroups.php =================================================================== --- trunk/TaxGroups.php 2010-01-20 06:23:48 UTC (rev 3310) +++ trunk/TaxGroups.php 2010-01-20 17:36:19 UTC (rev 3311) @@ -27,18 +27,18 @@ $InputError = 1; prnMsg(_('The Group description entered must be at least 4 characters long'),'error'); } - + // if $_POST['GroupName'] then it is a modification of a tax group name - // else it is either an add or remove of taxgroup + // else it is either an add or remove of taxgroup unset($sql); if (isset($_POST['GroupName']) ){ // Update or Add a tax group if(isset($SelectedGroup)) { // Update a tax group - $sql = "UPDATE taxgroups SET taxgroupdescription = '". $_POST['GroupName'] ."' + $sql = "UPDATE taxgroups SET taxgroupdescription = '". $_POST['GroupName'] ."' WHERE taxgroupid = ".$SelectedGroup; $ErrMsg = _('The update of the tax group description failed because'); $SuccessMsg = _('The tax group description was updated to') . ' ' . $_POST['GroupName']; } else { // Add new tax group - + $result = DB_query("SELECT taxgroupid FROM taxgroups WHERE taxgroupdescription='" . $_POST['GroupName'] . "'",$db); if (DB_num_rows($result)==1){ prnMsg( _('A new tax group could not be added because a tax group already exists for') . ' ' . $_POST['GroupName'],'warn'); @@ -54,17 +54,17 @@ } elseif (isset($SelectedGroup) ) { $TaxAuthority = $_GET['TaxAuthority']; if( isset($_GET['add']) ) { // adding a tax authority to a tax group - $sql = "INSERT INTO taxgrouptaxes ( taxgroupid, + $sql = "INSERT INTO taxgrouptaxes ( taxgroupid, taxauthid, - calculationorder) - VALUES (" . $SelectedGroup . ", + calculationorder) + VALUES (" . $SelectedGroup . ", " . $TaxAuthority . ", 0)"; - + $ErrMsg = _('The addition of the tax failed because'); $SuccessMsg = _('The tax was added.'); } elseif ( isset($_GET['remove']) ) { // remove a taxauthority from a tax group - $sql = "DELETE FROM taxgrouptaxes + $sql = "DELETE FROM taxgrouptaxes WHERE taxgroupid = ".$SelectedGroup." AND taxauthid = ".$TaxAuthority; $ErrMsg = _('The removal of this tax failed because'); @@ -85,30 +85,30 @@ //A calculation order update $sql = 'SELECT taxauthid FROM taxgrouptaxes WHERE taxgroupid=' . $SelectedGroup; $Result = DB_query($sql,$db,_('Could not get tax authorities in the selected tax group')); - + while ($myrow=DB_fetch_row($Result)){ if (is_numeric($_POST['CalcOrder_' . $myrow[0]]) AND $_POST['CalcOrder_' . $myrow[0]] <5){ - - $sql = 'UPDATE taxgrouptaxes + + $sql = 'UPDATE taxgrouptaxes SET calculationorder=' . $_POST['CalcOrder_' . $myrow[0]] . ', taxontax=' . $_POST['TaxOnTax_' . $myrow[0]] . ' WHERE taxgroupid=' . $SelectedGroup . ' AND taxauthid=' . $myrow[0]; - + $result = DB_query($sql,$db); } } - + //need to do a reality check to ensure that taxontax is relevant only for taxes after the first tax - $sql = 'SELECT taxauthid, - taxontax - FROM taxgrouptaxes + $sql = 'SELECT taxauthid, + taxontax + FROM taxgrouptaxes WHERE taxgroupid=' . $SelectedGroup . ' ORDER BY calculationorder'; - + $Result = DB_query($sql,$db,_('Could not get tax authorities in the selected tax group')); - + if (DB_num_rows($Result)>0){ $myrow=DB_fetch_array($Result); if ($myrow['taxontax']==1){ @@ -116,10 +116,10 @@ $Result = DB_query('UPDATE taxgrouptaxes SET taxontax=0 WHERE taxgroupid=' . $SelectedGroup . ' AND taxauthid=' . $myrow['taxauthid'],$db); } } -} elseif (isset($_GET['Delete'])) { - +} elseif (isset($_GET['Delete'])) { + /* PREVENT DELETES IF DEPENDENT RECORDS IN 'custbranch, suppliers */ - + $sql= "SELECT COUNT(*) FROM custbranch WHERE taxgroupid=" . $_GET['SelectedGroup']; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); @@ -134,7 +134,7 @@ prnMsg( _('Cannot delete this tax group because some suppliers are setup using it'),'warn'); echo '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('suppliers referring to this tax group'); } else { - + $sql="DELETE FROM taxgrouptaxes WHERE taxgroupid=" . $_GET['SelectedGroup']; $result = DB_query($sql,$db); $sql="DELETE FROM taxgroups WHERE taxgroupid=" . $_GET['SelectedGroup']; @@ -163,7 +163,7 @@ echo '<table border=1>'; echo "<tr><th>" . _('Group No') . "</th> <th>" . _('Tax Group') . "</th></tr>"; - + $k=0; //row colour counter while ($myrow = DB_fetch_array($result)) { if ($k==1){ @@ -173,7 +173,7 @@ echo '<tr class="OddTableRows">'; $k=1; } - + printf("<td>%s</td> <td>%s</td> <td><a href=\"%s&SelectedGroup=%s\">" . _('Edit') . "</a></td> @@ -186,7 +186,7 @@ $_SERVER['PHP_SELF'] . "?" . SID, $myrow['taxgroupid'], urlencode($myrow['taxgroupdescription'])); - + } //END WHILE LIST LOOP echo '</table>'; } @@ -230,23 +230,23 @@ if (isset($SelectedGroup)) { echo '</table><br>'; - - $sql = 'SELECT taxid, - description as taxname + + $sql = 'SELECT taxid, + description as taxname FROM taxauthorities ORDER BY taxid'; - + $sqlUsed = "SELECT taxauthid, description AS taxname, - calculationorder, - taxontax + calculationorder, + taxontax FROM taxgrouptaxes INNER JOIN taxauthorities ON taxgrouptaxes.taxauthid=taxauthorities.taxid - WHERE taxgroupid=". $SelectedGroup . ' + WHERE taxgroupid=". $SelectedGroup . ' ORDER BY calculationorder'; - + $Result = DB_query($sql, $db); - + /*Make an array of the used tax authorities in calculation order */ $UsedResult = DB_query($sqlUsed, $db); $TaxAuthsUsed = array(); //this array just holds the taxauthid of all authorities in the group @@ -257,14 +257,14 @@ $TaxAuthRow[$i] = $myrow; $i++; } - + /* the order and tax on tax will only be an issue if more than one tax authority in the group */ - if (count($TaxAuthsUsed)>0) { + if (count($TaxAuthsUsed)>0) { echo '<div class="centre"><font size=3 color=blue>'._('Calculation Order').'</font></div>'; echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?' . SID .'">'; echo '<input type=hidden name="SelectedGroup" value="' . $SelectedGroup .'">'; echo '<table>'; - + echo '<tr><th>'._('Tax Authority').'</th> <th>'._('Order').'</th> <th>'._('Tax on Prior Taxes').'</th></tr>'; @@ -277,15 +277,14 @@ echo '<tr class="EvenTableRows">'; $k=1; } - + if ($TaxAuthRow[$i]['calculationorder']==0){ $TaxAuthRow[$i]['calculationorder'] = $i; } - + echo '<td>' . $TaxAuthRow[$i]['taxname'] . '</td><td>'. - '<input type="text" class="number" name="CalcOrder_' . $TaxAuthRow[$i]['taxauthid'] . '" value="' . - $TaxAuthRow[$i]['calculationorder'] . '" size=2 maxlength=2 onKeyPress="return restrictToNumbers(this, event)" - style="width: 100%"></td>'; + '<input type="text" class="number" name="CalcOrder_' . $TaxAuthRow[$i]['taxauthid'] . '" value="' . + $TaxAuthRow[$i]['calculationorder'] . '" size=2 maxlength=2 style="width: 100%"></td>'; echo '<td><select name="TaxOnTax_' . $TaxAuthRow[$i]['taxauthid'] . '" style="width: 100%">'; if ($TaxAuthRow[$i]['taxontax']==1){ echo '<option selected value=1>' . _('Yes'); @@ -294,15 +293,15 @@ echo '<option value=1>' . _('Yes'); echo '<option selected value=0>' . _('No'); } - echo '</select></td></tr>'; - + echo '</select></td></tr>'; + } echo '</table>'; echo '<br><div class="centre"><input type="submit" name="UpdateOrder" value="' . _('Update Order') . '"></div>'; } - + echo '</form>'; - + if (DB_num_rows($Result)>0 ) { echo '<br>'; echo '<table><tr>'; @@ -311,7 +310,7 @@ echo "<th colspan=2>"._('Available Taxes')."</th>"; echo '</tr>'; - echo '<tr>'; + echo '<tr>'; echo "<th>" . _('Tax Auth ID') . '</th>'; echo "<th>" . _('Tax Authority Name') . '</th>'; echo "<th>" . _('Calculation Order') . '</th>'; @@ -320,14 +319,14 @@ echo "<th>" . _('Tax Auth ID') . '</th>'; echo "<th>" . _('Tax Authority Name') . '</th>'; echo '</tr>'; - + } else { echo '<br><div class="centre">' . _('There are no tax authorities defined to allocate to this tax group').'</div>'; } - + $k=0; //row colour counter while($AvailRow = DB_fetch_array($Result)) { - + if ($k==1){ echo '<tr class="EvenTableRows">'; $k=0; @@ -336,15 +335,15 @@ $k=1; } $TaxAuthUsedPointer = array_search($AvailRow['taxid'],$TaxAuthsUsed); - + if ($TaxAuthUsedPointer){ - + if ($TaxAuthRow[$TaxAuthUsedPointer]['taxontax'] ==1){ $TaxOnTax = _('Yes'); } else { $TaxOnTax = _('No'); } - + printf("<td>%s</td> <td>%s</td> <td>%s</td> @@ -360,7 +359,7 @@ $SelectedGroup, $AvailRow['taxid'] ); - + } else { printf("<td> </td> <td> </td> @@ -376,11 +375,11 @@ $SelectedGroup, $AvailRow['taxid'] ); - } + } echo '</tr>'; } echo '</table>'; - + } include('includes/footer.inc'); Modified: trunk/WOSerialNos.php =================================================================== --- trunk/WOSerialNos.php 2010-01-20 06:23:48 UTC (rev 3310) +++ trunk/WOSerialNos.php 2010-01-20 17:36:19 UTC (rev 3311) @@ -1,12 +1,12 @@ <?php /* $Id$*/ -/*This page shows the serial numbers created for a works order - * - creating automatically from the last serial number counter in the stockmaster or by manual entry - * - If the item is lot controlled then the lot reference and the quantity in the lot can be entered - * - this updates the quantity on the work order. - * The work order quantity can only be modified by creating lots or serial numbers for controlled item work orders - * +/*This page shows the serial numbers created for a works order + * - creating automatically from the last serial number counter in the stockmaster or by manual entry + * - If the item is lot controlled then the lot reference and the quantity in the lot can be entered + * - this updates the quantity on the work order. + * The work order quantity can only be modified by creating lots or serial numbers for controlled item work orders + * * Need to allow adding serial numbers/batches and deleting batches/serial numbers */ @@ -53,7 +53,7 @@ $sql = "INSERT INTO woserialnos (stockid, wo, qualitytext, - serialno) + serialno) VALUES "; $ValueLine = " ('" . $StockID . "', " . $WO . ",'' ,"; for ($i=0;$i<$_POST['NumberToAdd'];$i++){ @@ -82,13 +82,13 @@ } $NextSerialNo = $NextItemNumber + 1; $ErrMsg = _('Unable to add the serial numbers requested'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); // update the nextserialno in the stockmaster for the item - $result = DB_query('UPDATE stockmaster - SET nextserialno=' . $NextSerialNo . " + $result = DB_query('UPDATE stockmaster + SET nextserialno=' . $NextSerialNo . " WHERE stockid='" . $StockID . "'",$db); $result = DB_query('UPDATE woitems SET qtyreqd=qtyreqd+' . $_POST['NumberToAdd'] . " - WHERE stockid='" . $StockID . "' + WHERE stockid='" . $StockID . "' AND wo=" . $WO,$db,$ErrMsg,$DbgMsg,true); DB_Txn_Commit($db); } @@ -121,50 +121,50 @@ if (!$InputError){ DB_Txn_Begin($db); $ErrMsg = _('Could not add a new serial number/batch'); - $result = DB_query('UPDATE woitems + $result = DB_query('UPDATE woitems SET qtyreqd=qtyreqd+' . $_POST['Quantity'] . " - WHERE stockid='" . $StockID . "' + WHERE stockid='" . $StockID . "' AND wo=" . $WO,$db,$ErrMsg,$DbgMsg,true); $sql = "INSERT INTO woserialnos (stockid, wo, qualitytext, quantity, serialno) - VALUES ('" . $StockID . "', + VALUES ('" . $StockID . "', " . $WO . ", '', " . $_POST['Quantity'] . ", '" . $_POST['Reference'] . "')"; - + $ErrMsg = _('Unable to add the batch or serial number requested'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - - DB_Txn_Commit($db); + + DB_Txn_Commit($db); } - } + } } -if (isset($_GET['Delete'])){ //user hit delete link +if (isset($_GET['Delete'])){ //user hit delete link /*when serial numbers /lots received they are removed from the woserialnos table so no need to check if already received - they will only show here if they are in progress */ - $result = DB_query("DELETE FROM woserialnos - WHERE wo=" . $WO . " + $result = DB_query("DELETE FROM woserialnos + WHERE wo=" . $WO . " AND stockid='" . $StockID . "' AND serialno='" . $_GET['Reference'] ."'", $db); - + $result = DB_query("UPDATE woitems SET qtyreqd=qtyreqd-" . $_GET['Quantity'] . " WHERE wo=" . $WO . " - AND stockid = '" . $StockID . "'",$db); - - prnMsg(_('The batch/serial number') . ' ' . $_GET['Reference'] . ' ' . _('has been deleted from this work order'),'info'); + AND stockid = '" . $StockID . "'",$db); + + prnMsg(_('The batch/serial number') . ' ' . $_GET['Reference'] . ' ' . _('has been deleted from this work order'),'info'); } if (isset($_POST['UpdateItems'])){ //update the serial numbers and quantities and notes for each serial number or batch $WOQuantityTotal=0; for ($i=0;$i<$_POST['CountOfItems'];$i++){ - + if (strlen($_POST['Reference' . $i])==0){ prnMsg($_POST['OldReference' .$i] . ': ' , _('The new batch or serial number reference has not been entered - a reference is required'),'error'); $InputError=true; @@ -200,7 +200,7 @@ $WOQuantityTotal += $_POST['Quantity'.$i]; } else { $WOQuantityTotal += $_POST['OldQuantity'.$i]; - } + } }//end loop around all serial numbers/batches $ErrMsg = _('Could not update serial/batches on the work order'); if (sizeof($sql)>0){ @@ -209,7 +209,7 @@ $result = DB_query($SQLStatement,$db,$ErrMsg,$DbgMsg,true); } $result = DB_query("UPDATE woitems SET qtyreqd = " . $WOQuantityTotal . " - WHERE wo = " .$WO . " + WHERE wo = " .$WO . " AND stockid='" . $StockID . "'", $db, $ErrMsg,$DbgMsg,true); $result = DB_Txn_Commit($db); } @@ -226,11 +226,11 @@ echo '<input type="hidden" name="NextSerialNo" value="' . $NextSerialNo . '">'; echo '<table>'; - + 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 onKeyPress="return restrictToNumbers(this, event)" 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 @@ -245,7 +245,7 @@ } 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 onKeyPress="return restrictToNumbers(this, event)" 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>'; } @@ -255,10 +255,10 @@ </table>'; echo '<hr>'; -$sql = "SELECT serialno, - quantity, - qualitytext - FROM woserialnos +$sql = "SELECT serialno, + quantity, + qualitytext + FROM woserialnos WHERE wo=" . $WO . " AND stockid='" . $StockID . "'"; @@ -278,12 +278,12 @@ $i = 0; $j = 0; while ($WOSNRow = DB_fetch_array($WOSerialNoResult)){ - + if ($j==5){ echo $Header; $j=0; } - + 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){ @@ -295,11 +295,11 @@ echo '<td><textarea name="Notes' . $i .'" cols=60 rows=3>' . $WOSNRow['qualitytext'] .'</textarea></td>'; echo '<td><a href="' . $_SESSION['PHP_SELF'] . '?' . SID . '&Delete=1&Reference=' . $WOSNRow['serialno'] . '&Quantity=' . $WOSNRow['quantity'] . '&WO=' . $WO . '&StockID=' . $StockID . '&Description=' . $Description . '&Serialised=' . $Serialised . '&NextSerialNo=' . $NextSerialNo . '">' . _('Delete') . '</td></tr>'; $i++; - $j++; + $j++; } - + echo '<input type="hidden" name="CountOfItems" value=' . $i . '>'; - + if ($Serialised==0){ echo '<tr><td align="center" colspan=3>'; } else { @@ -307,7 +307,7 @@ } echo '<input type="submit" name="UpdateItems" value="' . _('Update') . '"></td></tr>'; echo '</table>'; - + } //end of if there are woserialno items defined echo '<p/><a href="' . $rootpath . '/WorkOrderEntry.php?' . SID . '&WO=' . $WO . '">' . _('Back To Work Order') . ' ' . $WO .'</a>'; Modified: trunk/WorkCentres.php =================================================================== --- trunk/WorkCentres.php 2010-01-20 06:23:48 UTC (rev 3310) +++ trunk/WorkCentres.php 2010-01-20 17:36:19 UTC (rev 3311) @@ -26,7 +26,7 @@ if (strlen($_POST['Code']) < 2) { $InputError = 1; prnMsg(_('The Work Centre code must be at least 2 characters long'),'error'); - } + } if (strlen($_POST['Description'])<3) { $InputError = 1; prnMsg(_('The Work Centre description must be at least 3 characters long'),'error'); @@ -41,7 +41,7 @@ /*SelectedWC could also exist if submit had not been clicked this code would not run in this case cos submit is false of course see the delete code below*/ - + $sql = "UPDATE workcentres SET location = '" . $_POST['Location'] . "', description = '" . $_POST['Description'] . "', overheadrecoveryact =" . $_POST['OverheadRecoveryAct'] . ", @@ -66,7 +66,7 @@ $msg = _('The new work centre has been added to the database'); } //run the SQL from either of the above possibilites - + if ($InputError !=1){ $result = DB_query($sql,$db,_('The update/addition of the work centre failed because')); prnMsg($msg,'success'); @@ -82,7 +82,7 @@ //the link to delete a selected record was clicked instead of the submit button // PREVENT DELETES IF DEPENDENT RECORDS IN 'BOM' - + $sql= "SELECT COUNT(*) FROM bom WHERE bom.workcentreadded='$SelectedWC'"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); @@ -109,7 +109,7 @@ 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; - + $sql = 'SELECT workcentres.code, workcentres.description, locations.locationname, @@ -197,7 +197,7 @@ $SQL = 'SELECT locationname, loccode - FROM locations'; + FROM locations'; $result = DB_query($SQL,$db); if (!isset($_POST['Description'])) { @@ -254,7 +254,7 @@ echo '</td></tr>'; echo '<tr><td>' . _('Overhead Per Hour') . ':</td> - <td><input type="Text" class="number" name="OverheadPerHour" size=6 maxlength=6 onKeyPress="return restrictToNumbers(this, event)" value=' . $_POST['OverheadPerHour'] . '></td></tr> + <td><input type="Text" class="number" name="OverheadPerHour" size=6 maxlength=6></td></tr> </table>'; echo '<br><div class="centre"><input type="Submit" name="submit" value="' . _('Enter Information') . '"></div>'; Modified: trunk/WorkOrderEntry.php =================================================================== --- trunk/WorkOrderEntry.php 2010-01-20 06:23:48 UTC (rev 3310) +++ trunk/WorkOrderEntry.php 2010-01-20 17:36:19 UTC (rev 3311) @@ -205,9 +205,9 @@ if (!isset($EOQ)){ $EOQ=1; } - + $Result = DB_Txn_Begin($db); - + // insert parent item info $sql = "INSERT INTO woitems (wo, stockid, @@ -225,7 +225,7 @@ WoRealRequirements($db, $_POST['WO'], $_POST['StockLocation'], $NewItem); $result = DB_Txn_Commit($db); - + unset($NewItem); } //end if there were no input errors } //adding a new item to the work order @@ -354,7 +354,7 @@ $ErrMsg=_('The work order could not be deleted'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - DB_Txn_Commit($db); + DB_Txn_Commit($db); prnMsg(_('The work order has been deleted'),'success'); @@ -480,8 +480,8 @@ if ($_POST['Controlled'.$i]==1 AND $_SESSION['DefineControlledOnWOEntry']==1){ echo '<td style="text-align: right">' . $_POST['OutputQty' . $i] . '</td>'; echo '<input type="hidden" name="OutputQty' . $i .'" value=' . $_POST['OutputQty' . $i] . '>'; - } else { - echo'<td><input type="text" style="text-align: right" name="OutputQty' . $i . '" value=' . $_POST['OutputQty' . $i] . ' size=10 onKeyPress="return restrictToNumbers(this, event)" maxlength=10></td>'; + } else { + echo'<td><input type="text" class="number" name="OutputQty' . $i . '" value=' . $_POST['OutputQty' . $i] . ' size=10 maxlength=10></td>'; } echo '<td><input type="hidden" name="RecdQty' . $i . '" value=' . $_POST['RecdQty' .$i] . '>' . $_POST['RecdQty' .$i] .'</td> <td align="right">' . ($_POST['OutputQty' . $i] - $_POST['RecdQty' .$i]) . '</td>'; Modified: trunk/WorkOrderReceive.php =================================================================== --- trunk/WorkOrderReceive.php 2010-01-20 06:23:48 UTC (rev 3310) +++ trunk/WorkOrderReceive.php 20... [truncated message content] |