From: <dai...@us...> - 2015-02-04 09:15:52
|
Revision: 7123 http://sourceforge.net/p/web-erp/reponame/7123 Author: daintree Date: 2015-02-04 09:15:50 +0000 (Wed, 04 Feb 2015) Log Message: ----------- fix up DB_query calls in QA stuff Modified Paths: -------------- trunk/HistoricalTestResults.php trunk/PDFCOA.php trunk/PDFProdSpec.php trunk/ProductSpecs.php trunk/QATests.php trunk/SelectQASamples.php trunk/doc/Manual/ManualQualityAssurance.html Modified: trunk/HistoricalTestResults.php =================================================================== --- trunk/HistoricalTestResults.php 2015-02-04 08:22:52 UTC (rev 7122) +++ trunk/HistoricalTestResults.php 2015-02-04 09:15:50 UTC (rev 7123) @@ -3,16 +3,20 @@ include('includes/session.inc'); $Title = _('Historical Test Results'); +$ViewTopic= 'QualityAssurance';// Filename in ManualContents.php's TOC. +$BookMark = 'QA_HistoricalResults';// Anchor's id in the manual's html document. include('includes/header.inc'); if (isset($_GET['KeyValue'])){ $KeyValue =mb_strtoupper($_GET['KeyValue']); -} elseif(isset($_POST['KeyValue'])){ +} elseif (isset($_POST['KeyValue'])){ $KeyValue =mb_strtoupper($_POST['KeyValue']); +} else { + $KeyValue=''; } if (!isset($_POST['FromDate'])){ - $_POST['FromDate']=Date(($_SESSION['DefaultDateFormat']), strtotime($UpcomingDate . ' - 180 days')); + $_POST['FromDate']=Date(($_SESSION['DefaultDateFormat']), Mktime(0, 0, 0, Date('m'), Date('d')-180, Date('Y'))); } if (!isset($_POST['ToDate'])){ $_POST['ToDate'] = Date($_SESSION['DefaultDateFormat']); @@ -20,13 +24,13 @@ if (!Is_Date($_POST['FromDate'])) { $InputError = 1; prnMsg(_('Invalid From Date'),'error'); - $_POST['FromDate']=Date(($_SESSION['DefaultDateFormat']), strtotime($UpcomingDate . ' - 180 days')); -} + $_POST['FromDate']=Date(($_SESSION['DefaultDateFormat']), Mktime(0, 0, 0, Date('m'), Date('d')-180, Date('Y'))); +} if (!Is_Date($_POST['ToDate'])) { $InputError = 1; prnMsg(_('Invalid To Date'),'error'); $_POST['ToDate'] = Date($_SESSION['DefaultDateFormat']); -} +} $FromDate = FormatDateForSQL($_POST['FromDate']); $ToDate = FormatDateForSQL($_POST['ToDate']); if (isset($Errors)) { @@ -35,12 +39,11 @@ $Errors = array(); -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>'; //prompt user for Key Value echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post"> - <form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post"> <div> <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" /> <table class="selection"> @@ -50,30 +53,33 @@ description FROM qasamples LEFT OUTER JOIN stockmaster ON stockmaster.stockid=qasamples.prodspeckey"; - -$ResultSelection=DB_query($SQLSpecSelect, $db); + +$ResultSelection=DB_query($SQLSpecSelect); echo '<td><select name="KeyValue">'; while ($MyRowSelection=DB_fetch_array($ResultSelection)){ if ($MyRowSelection['prodspeckey']==$KeyValue) { - $Selected=' selected="selected" '; + $Selected='selected="selected" '; } else { $Selected=''; } - echo '<option' . $Selected . ' value="' . $MyRowSelection['prodspeckey'] . '">' . $MyRowSelection['prodspeckey'].' - ' .htmlspecialchars($MyRowSelection['description'], ENT_QUOTES,'UTF-8', false) . '</option>'; + echo '<option ' . $Selected . ' value="' . $MyRowSelection['prodspeckey'] . '">' . $MyRowSelection['prodspeckey'].' - ' .htmlspecialchars($MyRowSelection['description'], ENT_QUOTES,'UTF-8', false) . '</option>'; } -echo '</select></td>'; +echo '</select></td>'; echo '</tr> <tr> - <td>'; -echo _('From Sample Date') . ': </td><td><input name="FromDate" size="10" class="date" value="' . $_POST['FromDate'] . '"/></td></tr><tr><td> ' . _('To Sample Date') . ':</td><td> <input name="ToDate" size="10" class="date" value="' . $_POST['ToDate'] . '"/> '; -echo '</td> + <td>' . _('From Sample Date') . ': </td> + <td><input name="FromDate" size="10" class="date" value="' . $_POST['FromDate'] . '"/></td> </tr> + <tr> + <td> ' . _('To Sample Date') . ':</td> + <td> <input name="ToDate" size="10" class="date" value="' . $_POST['ToDate'] . '"/></td> + </tr> </table> </div> <div> - <input type="submit" name="pickspec" value="' . _('Submit') . '" /> + <input type="submit" name="PickSpec" value="' . _('Submit') . '" /> </div> </form>'; @@ -81,9 +87,9 @@ //show header $SQLSpecSelect="SELECT description FROM stockmaster - WHERE stockmaster.stockid='" .$KeyValue. "'"; + WHERE stockmaster.stockid='" . $KeyValue . "'"; -$ResultSelection=DB_query($SQLSpecSelect, $db); +$ResultSelection=DB_query($SQLSpecSelect); $MyRowSelection=DB_fetch_array($ResultSelection); $SQLTests="SELECT sampleresults.testid, sampledate, @@ -92,30 +98,30 @@ identifier, cert, isinspec, - testvalue, + testvalue, name FROM qasamples INNER JOIN sampleresults on sampleresults.sampleid=qasamples.sampleid INNER JOIN qatests ON qatests.testid=sampleresults.testid - WHERE qasamples.prodspeckey='".$KeyValue."' + WHERE qasamples.prodspeckey='" . $KeyValue . "' AND sampleresults.showontestplan='1' - AND sampledate>='".$FromDate."' - AND sampledate <='".$ToDate."'"; - + AND sampledate>='" . $FromDate . "' + AND sampledate <='" . $ToDate . "'"; -$TestResult=DB_query($SQLTests, $db); + +$TestResult=DB_query($SQLTests); $TestsArray=array(); $SamplesArray=array(); $AllResultsArray=array(); $TotResults=0; while ($MyTestRow=DB_fetch_array($TestResult)) { $FormattedSampleID=str_pad($MyTestRow['sampleid'],10,'0',STR_PAD_LEFT); - $testkey=array_search ($MyTestRow['name'] , $TestsArray); + $testkey=array_search ($MyTestRow['name'] , $TestsArray); if ($testkey===false) { $TestsArray[$MyTestRow['name']]=$MyTestRow['name']; } - + $testkey=array_search ($MyTestRow['sampleid'] , $SamplesArray); if ($testkey===false) { $SamplesArray[$FormattedSampleID]=$MyTestRow; Modified: trunk/PDFCOA.php =================================================================== --- trunk/PDFCOA.php 2015-02-04 08:22:52 UTC (rev 7122) +++ trunk/PDFCOA.php 2015-02-04 09:15:50 UTC (rev 7123) @@ -40,7 +40,7 @@ </table> </div> <div> - <input type="submit" name="pickspec" value="' . _('Submit') . '" /> + <input type="submit" name="PickSpec" value="' . _('Submit') . '" /> </div> </form> <form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post"> @@ -57,20 +57,20 @@ ON stockmaster.stockid=qasamples.prodspeckey WHERE cert='1' ORDER BY lotkey"; - - $ResultSelection=DB_query($SQLSpecSelect, $db); + + $ResultSelection=DB_query($SQLSpecSelect); echo '<td><select name="QASampleID" style="font-family: monospace; white-space:pre;">'; echo '<option value="">' . str_pad(_('Lot/Serial'),15,'_'). str_pad(_('Item'),20, '_', STR_PAD_RIGHT). str_pad(_('Description'),20,'_') . '</option>'; while ($MyRowSelection=DB_fetch_array($ResultSelection)){ echo '<option value="' . $MyRowSelection['sampleid'] . '">' . str_pad($MyRowSelection['lotkey'],15, '_', STR_PAD_RIGHT). str_pad($MyRowSelection['prodspeckey'],20,'_') .htmlspecialchars($MyRowSelection['description'], ENT_QUOTES,'UTF-8', false) . '</option>'; } - echo '</select></td>'; + echo '</select></td>'; echo '</tr> </table> </div> <div> - <input type="submit" name="pickspec" value="' . _('Submit') . '" /> + <input type="submit" name="PickSpec" value="' . _('Submit') . '" /> </div> </form>'; include('includes/footer.inc'); @@ -89,7 +89,7 @@ testvalue, sampledate, groupby - FROM qasamples INNER JOIN sampleresults + FROM qasamples INNER JOIN sampleresults ON sampleresults.sampleid=qasamples.sampleid INNER JOIN qatests ON qatests.testid=sampleresults.testid @@ -109,7 +109,7 @@ testvalue, sampledate, groupby - FROM qasamples INNER JOIN sampleresults + FROM qasamples INNER JOIN sampleresults ON sampleresults.sampleid=qasamples.sampleid INNER JOIN qatests ON qatests.testid=sampleresults.testid @@ -119,7 +119,7 @@ AND sampleresults.showoncert='1' ORDER by groupby, sampleresults.testid"; } -$result=DB_query($sql,$db, $ErrMsg); +$result=DB_query($sql,$ErrMsg); //If there are no rows, there's a problem. if (DB_num_rows($result)==0){ @@ -146,7 +146,7 @@ <br />'; include('includes/footer.inc'); exit; -} +} $PaperSize = 'Letter'; if ($QASampleID>'') { $myrow=DB_fetch_array($result); @@ -176,7 +176,7 @@ } $Spec=$myrow['description']; $SampleDate=ConvertSQLDate($myrow['sampledate']); - + foreach($SectionsArray as $row) { if ($myrow['groupby']==$row[0]) { $SectionColSizes=$row[4]; @@ -189,7 +189,7 @@ include('includes/PDFCOAHeader.inc'); $HeaderPrinted=1; } - + if ($CurSection!=$myrow['groupby']) { $SectionHeading=0; if ($CurSection!='' AND $PrintTrailer==1) { @@ -204,7 +204,7 @@ } } } - + if ($SectionHeading==0) { $XPos=65; if ($PrevTrailer>'' AND $PrintTrailer==1) { @@ -254,16 +254,16 @@ $ColWidth=$SectionColSizes[$x]; $ColAlign=$SectionAlign[$x]; switch ($x) { - case 0; + case 0; $DispValue=$myrow['name']; break; - case 1; + case 1; $DispValue=$Value; break; case 2; $DispValue=$myrow['method']; break; - } + } $LeftOvers = $pdf->addTextWrap($XPos+1,$YPos,$ColWidth,$FontSize,$DispValue,$ColAlign,1); $XPos+=$ColWidth; $x++; @@ -305,7 +305,7 @@ FROM config WHERE confname='QualityCOAText'"; -$result=DB_query($sql,$db, $ErrMsg); +$result=DB_query($sql, $ErrMsg); $myrow=DB_fetch_array($result); $Disclaimer=$myrow[0]; $LeftOvers = $pdf->addTextWrap($XPos+5,$YPos,500,$FontSize,$Disclaimer); Modified: trunk/PDFProdSpec.php =================================================================== --- trunk/PDFProdSpec.php 2015-02-04 08:22:52 UTC (rev 7122) +++ trunk/PDFProdSpec.php 2015-02-04 09:15:50 UTC (rev 7123) @@ -9,10 +9,11 @@ $SelectedProdSpec=$_GET['KeyValue']; } elseif (isset($_POST['KeyValue'])) { $SelectedProdSpec=$_POST['KeyValue']; +} else { + $SelectedProdSpec=''; } - //Get Out if we have no product specification -If (!isset($SelectedProdSpec) || $SelectedProdSpec==""){ +If (!isset($SelectedProdSpec) OR $SelectedProdSpec==''){ $Title = _('Select Product Specification To Print'); include('includes/header.inc'); echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/printer.png" title="' . _('Print') . '" alt="" />' . ' ' . $Title . '</p>'; @@ -27,7 +28,7 @@ </table> </div> <div> - <input type="submit" name="pickspec" value="' . _('Submit') . '" /> + <input type="submit" name="PickSpec" value="' . _('Submit') . '" /> </div> </form> <form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post"> @@ -40,20 +41,20 @@ description FROM prodspecs LEFT OUTER JOIN stockmaster ON stockmaster.stockid=prodspecs.keyval"; - - $ResultSelection=DB_query($SQLSpecSelect, $db); + + $ResultSelection=DB_query($SQLSpecSelect); echo '<td><select name="KeyValue">'; while ($MyRowSelection=DB_fetch_array($ResultSelection)){ echo '<option value="' . $MyRowSelection['keyval'] . '">' . $MyRowSelection['keyval'].' - ' .htmlspecialchars($MyRowSelection['description'], ENT_QUOTES,'UTF-8', false) . '</option>'; } - echo '</select></td>'; + echo '</select></td>'; echo '</tr> </table> </div> <div> - <input type="submit" name="pickspec" value="' . _('Submit') . '" /> + <input type="submit" name="PickSpec" value="' . _('Submit') . '" /> </div> </form>'; include('includes/footer.inc'); @@ -83,7 +84,7 @@ AND prodspecs.showonspec='1' ORDER by groupby, prodspecs.testid"; -$result=DB_query($sql,$db, $ErrMsg); +$result=DB_query($sql,$ErrMsg); //If there are no rows, there's a problem. if (DB_num_rows($result)==0){ @@ -110,7 +111,7 @@ <br />'; include('includes/footer.inc'); exit; -} +} $PaperSize = 'Letter'; include('includes/PDFStarter.php'); @@ -148,7 +149,7 @@ include('includes/PDFProdSpecHeader.inc'); $HeaderPrinted=1; } - + if ($CurSection!=$myrow['groupby']) { $SectionHeading=0; if ($CurSection!='' AND $PrintTrailer==1) { @@ -163,7 +164,7 @@ } } } - + if ($SectionHeading==0) { $XPos=65; if ($PrevTrailer>'' AND $PrintTrailer==1) { @@ -220,16 +221,16 @@ $ColWidth=$SectionColSizes[$x]; $ColAlign=$SectionAlign[$x]; switch ($x) { - case 0; + case 0; $DispValue=$myrow['name']; break; - case 1; + case 1; $DispValue=$Value; break; case 2; $DispValue=$myrow['method']; break; - } + } $LeftOvers = $pdf->addTextWrap($XPos+1,$YPos,$ColWidth,$FontSize,$DispValue,$ColAlign,1); $XPos+=$ColWidth; $x++; @@ -272,7 +273,7 @@ FROM config WHERE confname='QualityProdSpecText'"; -$result=DB_query($sql,$db, $ErrMsg); +$result=DB_query($sql,$ErrMsg); $myrow=DB_fetch_array($result); $Disclaimer=$myrow[0]; $LeftOvers = $pdf->addTextWrap($XPos+5,$YPos,500,$FontSize,$Disclaimer); @@ -281,7 +282,7 @@ $LeftOvers = $pdf->addTextWrap($XPos+5,$YPos,445,$FontSize, $LeftOvers, 'left'); } -$pdf->OutputI($_SESSION['DatabaseName'] . 'ProductSpecification' . date('Y-m-d') . '.pdf'); +$pdf->OutputI($_SESSION['DatabaseName'] . '_ProductSpecification_' . date('Y-m-d') . '.pdf'); $pdf->__destruct(); ?> \ No newline at end of file Modified: trunk/ProductSpecs.php =================================================================== --- trunk/ProductSpecs.php 2015-02-04 08:22:52 UTC (rev 7122) +++ trunk/ProductSpecs.php 2015-02-04 09:15:50 UTC (rev 7123) @@ -40,13 +40,14 @@ if (isset($_GET['CopySpec']) OR isset($_POST['CopySpec'])) { if (!isset($_POST['CopyTo']) OR $_POST['CopyTo']=='' ) { echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; - echo '<div>'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo _('Enter The Item, Fixed Asset or Template to Copy this Specification to') . ':<input type="text" name="CopyTo" size="25" maxlength="25" />'; - echo '<div class="centre"> - <input type="hidden" name="KeyValue" value="' . $KeyValue . '" /> - <input type="submit" name="CopySpec" value="' . _('Copy') . '" /> - </div></form>'; + echo '<div> + <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + echo _('Enter The Item, Fixed Asset or Template to Copy this Specification to') . ':<input type="text" name="CopyTo" size="25" maxlength="25" /> + <div class="centre"> + <input type="hidden" name="KeyValue" value="' . $KeyValue . '" /> + <input type="submit" name="CopySpec" value="' . _('Copy') . '" /> + </div> + </form>'; include('includes/footer.inc'); exit; } else { @@ -105,6 +106,7 @@ <table class="selection"> <tr> <td>' . _('Or Select Existing Specification') .':</td>'; + $SQLSpecSelect="SELECT DISTINCT(keyval), description FROM prodspecs LEFT OUTER JOIN stockmaster @@ -274,7 +276,7 @@ showontestplan, active FROM qatests WHERE testid='" .$_POST['AddTestID' .$i]. "'"; - echo $sql; + //echo $sql; $msg = _('A Product Specification record has been added for Test ID') . ' ' . $_POST['AddTestID' .$i] . ' for ' . ' ' . $KeyValue ; $ErrMsg = _('The insert of the Product Specification failed because'); $DbgMsg = _('The SQL that was used and failed was'); Modified: trunk/QATests.php =================================================================== --- trunk/QATests.php 2015-02-04 08:22:52 UTC (rev 7122) +++ trunk/QATests.php 2015-02-04 09:15:50 UTC (rev 7123) @@ -47,7 +47,7 @@ } $sql= "SELECT COUNT(*) FROM qatests WHERE qatests.name='".$_POST['QATestName']."' AND qatests.testid <> '" .$SelectedQATest. "'"; - $result = DB_query($sql,$db); + $result = DB_query($sql); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { $InputError = 1; @@ -108,7 +108,7 @@ //run the SQL from either of the above possibilites $ErrMsg = _('The insert or update of the QA Test failed because'); $DbgMsg = _('The SQL that was used and failed was'); - $result = DB_query($sql,$db,$ErrMsg, $DbgMsg); + $result = DB_query($sql,$ErrMsg, $DbgMsg); prnMsg($msg , 'success'); @@ -139,7 +139,7 @@ } else { $sql="DELETE FROM qatests WHERE testid='". $SelectedQATest."'"; $ErrMsg = _('The QA Test could not be deleted because'); - $result = DB_query($sql,$db,$ErrMsg); + $result = DB_query($sql,$ErrMsg); prnMsg(_('QA Test') . ' ' . $SelectedQATest . ' ' . _('has been deleted from the database'),'success'); unset ($SelectedQATest); @@ -176,7 +176,7 @@ FROM qatests WHERE testid='".$SelectedQATest."'"; - $result = DB_query($sql, $db); + $result = DB_query($sql); $myrow = DB_fetch_array($result); $_POST['SelectedQATest'] = $myrow['testid']; @@ -383,7 +383,7 @@ active FROM qatests ORDER BY name"; - $result = DB_query($sql,$db); + $result = DB_query($sql); echo '<table class="selection">'; echo '<tr> Modified: trunk/SelectQASamples.php =================================================================== --- trunk/SelectQASamples.php 2015-02-04 08:22:52 UTC (rev 7122) +++ trunk/SelectQASamples.php 2015-02-04 09:15:50 UTC (rev 7123) @@ -3,6 +3,8 @@ include('includes/session.inc'); $Title = _('Select QA Samples'); +$ViewTopic= 'QualityAssurance';// Filename in ManualContents.php's TOC. +$BookMark = 'QA_Samples';// Anchor's id in the manual's html document. include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); @@ -28,7 +30,7 @@ $SampleID = $_POST['SampleID']; } if (!isset($_POST['FromDate'])){ - $_POST['FromDate']=Date(($_SESSION['DefaultDateFormat']), strtotime($UpcomingDate . ' - 15 days')); + $_POST['FromDate']=Date(($_SESSION['DefaultDateFormat']), Mktime(0, 0, 0, Date('m'), Date('d')-15, Date('Y'))); } if (!isset($_POST['ToDate'])){ $_POST['ToDate'] = Date($_SESSION['DefaultDateFormat']); @@ -56,9 +58,9 @@ if (isset($SelectedSampleID) AND $InputError !=1) { //check to see all values are in spec or at least entered $result = DB_query("SELECT count(sampleid) FROM sampleresults - WHERE sampleid = '".$SelectedSampleID."' + WHERE sampleid = '" . $SelectedSampleID . "' AND showoncert='1' - AND testvalue=''", $db); + AND testvalue=''"); $myrow = DB_fetch_row($result);; if($myrow[0]>0 AND $_POST['Cert']=='1') { $_POST['Cert']='0'; @@ -68,7 +70,7 @@ $result = DB_query("SELECT count(sampleid) FROM sampleresults WHERE sampleid = '".$SelectedSampleID."' AND showoncert='1' - AND isinspec='0'", $db); + AND isinspec='0'"); $myrow = DB_fetch_row($result);; if($myrow[0]>0 AND $_POST['Cert']=='1') { $msg = _('Some Results are out of Spec'); @@ -78,26 +80,26 @@ comments='" . $_POST['Comments'] . "', sampledate='" . FormatDateForSQL($_POST['SampleDate']) . "', cert='" . $_POST['Cert'] . "' - WHERE sampleid = '".$SelectedSampleID."'"; + WHERE sampleid = '" . $SelectedSampleID . "'"; $msg = _('QA Sample record for') . ' ' . $SelectedSampleID . ' ' . _('has been updated'); $ErrMsg = _('The update of the QA Sample failed because'); $DbgMsg = _('The SQL that was used and failed was'); - $result = DB_query($sql,$db,$ErrMsg, $DbgMsg); + $result = DB_query($sql,$ErrMsg, $DbgMsg); prnMsg($msg , 'success'); if ( $_POST['Cert']==1) { $result = DB_query("SELECT prodspeckey, lotkey FROM qasamples - WHERE sampleid = '".$SelectedSampleID."'", $db); + WHERE sampleid = '".$SelectedSampleID."'"); $myrow = DB_fetch_row($result);; if($myrow[0]>'') { $sql = "UPDATE qasamples SET cert='0' - WHERE sampleid <> '".$SelectedSampleID."' - AND prodspeckey='".$myrow[0]."' - AND lotkey='".$myrow[1]."'"; + WHERE sampleid <> '".$SelectedSampleID . "' + AND prodspeckey='" . $myrow[0] . "' + AND lotkey='" . $myrow[1] . "'"; $msg = _('All other samples for this Specification and Lot was marked as Cert=No'); $ErrMsg = _('The update of the QA Sample failed because'); $DbgMsg = _('The SQL that was used and failed was'); - $result = DB_query($sql,$db,$ErrMsg, $DbgMsg); + $result = DB_query($sql,$ErrMsg, $DbgMsg); prnMsg($msg , 'success'); } } @@ -107,7 +109,7 @@ $SelectedSampleID=DB_Last_Insert_ID($db,'qasamples','sampleid'); if ($SelectedSampleID > '') { $msg = _('Created New Sample'); - prnMsg($msg , 'success'); + prnMsg($msg , 'success'); } } unset($SelectedSampleID); @@ -115,25 +117,25 @@ unset($_POST['LotKey']); unset($_POST['Identifier']); unset($_POST['Comments']); - unset($_POST['Cert']); + unset($_POST['Cert']); } elseif (isset($_GET['delete'])) { //the link to delete a selected record was clicked instead of the submit button // PREVENT DELETES IF DEPENDENT RECORDS $sql= "SELECT COUNT(*) FROM sampleresults WHERE sampleresults.sampleid='".$SelectedSampleID."' - AND sampleresults.testvalue>''"; - $result = DB_query($sql,$db); + AND sampleresults.testvalue > ''"; + $result = DB_query($sql); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { prnMsg(_('Cannot delete this Sample ID because there are test results tied to it'),'error'); } else { - $sql="DELETE FROM sampleresults WHERE sampleid='". $SelectedSampleID."'"; + $sql="DELETE FROM sampleresults WHERE sampleid='" . $SelectedSampleID . "'"; $ErrMsg = _('The sample results could not be deleted because'); - $result = DB_query($sql,$db,$ErrMsg); - $sql="DELETE FROM qasamples WHERE sampleid='". $SelectedSampleID."'"; + $result = DB_query($sql,$ErrMsg); + $sql="DELETE FROM qasamples WHERE sampleid='" . $SelectedSampleID ."'"; $ErrMsg = _('The QA Sample could not be deleted because'); - $result = DB_query($sql,$db,$ErrMsg); + $result = DB_query($sql,$ErrMsg); echo $sql; prnMsg(_('QA Sample') . ' ' . $SelectedSampleID . _('has been deleted from the database'),'success'); unset ($SelectedSampleID); @@ -150,7 +152,7 @@ if (isset($_POST['ResetPart'])) { unset($SelectedStockItem); } - + if (isset($SampleID) AND $SampleID != '') { if (!is_numeric($SampleID)) { prnMsg(_('The Sample ID entered') . ' <U>' . _('MUST') . '</U> ' . _('be numeric'), 'error'); @@ -162,13 +164,13 @@ if (!Is_Date($_POST['FromDate'])) { $InputError = 1; prnMsg(_('Invalid From Date'),'error'); - $_POST['FromDate']=Date(($_SESSION['DefaultDateFormat']), strtotime($UpcomingDate . ' - 15 days')); - } + $_POST['FromDate']=Date(($_SESSION['DefaultDateFormat']), mktime(0, 0, 0, Date('m'), Date('d')-15, Date('Y'))); + } if (!Is_Date($_POST['ToDate'])) { $InputError = 1; prnMsg(_('Invalid To Date'),'error'); $_POST['ToDate'] = Date($_SESSION['DefaultDateFormat']); - } + } if (isset($_POST['SearchParts'])) { if ($_POST['Keywords'] AND $_POST['StockCode']) { prnMsg(_('Stock description keywords have been used in preference to the Stock code extract entered'), 'info'); @@ -182,7 +184,7 @@ SUM(locstock.quantity) as qoh, stockmaster.units, FROM stockmaster INNER JOIN locstock - ON stockmaster.stockid = locstock.stockid + ON stockmaster.stockid = locstock.stockid INNER JOIN locationusers ON locationusers.loccode = locstock.loccode AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canview=1 @@ -228,14 +230,20 @@ stockmaster.units ORDER BY stockmaster.stockid"; } - + $ErrMsg = _('No stock items were returned by the SQL because'); $DbgMsg = _('The SQL used to retrieve the searched parts was'); - $StockItemsResult = DB_query($SQL, $db, $ErrMsg, $DbgMsg); + $StockItemsResult = DB_query($SQL, $ErrMsg, $DbgMsg); } - if (true or !isset($LotNumber) or $LotNumber == "") { //revisit later, right now always show all inputs + if (true or !isset($LotNumber) or $LotNumber == '') { //revisit later, right now always show all inputs echo '<table class="selection"><tr><td>'; + if (!isset($LotNumber)){ + $LotNumber =''; + } + if (!isset($SampleID)){ + $SampleID=''; + } if (isset($SelectedStockItem)) { echo _('For the part') . ':<b>' . $SelectedStockItem . '</b> ' . _('and') . ' <input type="hidden" name="SelectedStockItem" value="' . $SelectedStockItem . '" />'; } @@ -249,14 +257,13 @@ categorydescription FROM stockcategory ORDER BY categorydescription"; - $result1 = DB_query($SQL, $db); - echo ' - <table class="selection"> + $result1 = DB_query($SQL); + echo '<table class="selection"> <tr> - <td>'; - echo _('To search for Pick Lists for a specific part use the part selection facilities below') . '</td></tr>'; - echo '<tr> - <td>' . _('Select a stock category') . ':<select name="StockCat">'; + <td>' . _('To search for Pick Lists for a specific part use the part selection facilities below') . '</td> + </tr> + <tr> + <td>' . _('Select a stock category') . ':<select name="StockCat">'; while ($myrow1 = DB_fetch_array($result1)) { if (isset($_POST['StockCat']) and $myrow1['categoryid'] == $_POST['StockCat']) { echo '<option selected="selected" value="' . $myrow1['categoryid'] . '">' . $myrow1['categorydescription'] . '</option>'; @@ -380,7 +387,7 @@ } //no stock item selected } //end no sample id selected $ErrMsg = _('No QA samples were returned by the SQL because'); - $SampleResult = DB_query($SQL, $db, $ErrMsg); + $SampleResult = DB_query($SQL, $ErrMsg); if (DB_num_rows($SampleResult) > 0) { echo '<table cellpadding="2" width="90%" class="selection">'; @@ -410,7 +417,7 @@ $Edit = '<a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?SelectedSampleID=' . $myrow['sampleid'] .'">' . _('Edit') .'</a>'; $Delete = '<a href="' .htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') .'?delete=yes&SelectedSampleID=' . $myrow['sampleid'].'" onclick="return confirm(\'' . _('Are you sure you wish to delete this Sample ID ?') . '\');">' . _('Delete').'</a>'; $FormatedSampleDate = ConvertSQLDate($myrow['sampledate']); - + //echo '<div class="centre"><a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?CopyTest=yes&SelectedSampleID=' .$SelectedSampleID .'">' . _('Copy These Results') . '</a></div>'; //echo '<div class="centre"><a target="_blank" href="'. $RootPath . '/PDFTestPlan.php?SelectedSampleID=' .$SelectedSampleID .'">' . _('Print Testing Worksheet') . '</a></div>'; if ($myrow['cert']==1) { @@ -418,7 +425,7 @@ } else { $CertAllowed=_('No'); } - + echo '<td><a href="' . $ModifySampleID . '">' . str_pad($myrow['sampleid'],10,'0',STR_PAD_LEFT) . '</a></td> <td>' . $myrow['prodspeckey'] . '</td> <td>' . $myrow['description'] . '</td> @@ -447,7 +454,7 @@ if (isset($SelectedSampleID)) { echo '<div class="centre"><a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">' . _('Show All Samples') . '</a></div>'; - + } if (! isset($_GET['delete'])) { @@ -464,10 +471,10 @@ comments, cert, sampledate - FROM qasamples + FROM qasamples WHERE sampleid='".$SelectedSampleID."'"; - - $result = DB_query($sql, $db); + + $result = DB_query($sql); $myrow = DB_fetch_array($result); $_POST['ProdSpecKey'] = $myrow['prodspeckey']; @@ -476,7 +483,7 @@ $_POST['Comments'] = $myrow['comments']; $_POST['SampleDate'] = ConvertSQLDate($myrow['sampledate']); $_POST['Cert'] = $myrow['cert']; - + echo '<input type="hidden" name="SelectedSampleID" value="' . $SelectedSampleID . '" />'; echo '<table class="selection"> <tr> @@ -487,24 +494,24 @@ echo '<tr> <td>' . _('Specification') . ':</td> <td>' . $_POST['ProdSpecKey']. '</td> - </tr>'; - echo '<tr> + </tr> + <tr> <td>' . _('Lot') . ':</td> <td>' . $_POST['LotKey']. '</td> - </tr>'; - echo '<tr> + </tr> + <tr> <td>' . _('Identifier') . ':</td> <td><input type="text" name="Identifier" size="15" maxlength="15" value="' . $_POST['Identifier']. '" /></td> - </tr>'; - echo '<tr> + </tr> + <tr> <td>' . _('Comments') . ':</td> <td><input type="text" name="Comments" size="30" maxlength="255" value="' . $_POST['Comments']. '" /></td> - </tr>'; - echo '<tr> + </tr> + <tr> <td>' . _('Sample Date') . ':</td> <td><input class="date" type="text" name="SampleDate" size="10" maxlength="10" value="' . $_POST['SampleDate']. '" /></td> - </tr>'; - echo '<tr> + </tr> + <tr> <td>' . _('Use for Cert?') . ':</td> <td><select name="Cert">'; if ($_POST['Cert']==1){ @@ -538,30 +545,29 @@ description FROM prodspecs LEFT OUTER JOIN stockmaster ON stockmaster.stockid=prodspecs.keyval"; - - $ResultSelection=DB_query($SQLSpecSelect, $db); + + $ResultSelection=DB_query($SQLSpecSelect); echo '<tr> <td>' . _('Specification') . ':</td>'; echo '<td><select name="ProdSpecKey">'; while ($MyRowSelection=DB_fetch_array($ResultSelection)){ echo '<option value="' . $MyRowSelection['keyval'] . '">' . $MyRowSelection['keyval'].' - ' .htmlspecialchars($MyRowSelection['description'], ENT_QUOTES,'UTF-8', false) . '</option>'; } - echo '</select></td> - </tr>'; - echo '<tr> + echo '</select></td> + </tr> + <tr> <td>' . _('Lot') . ':</td> - <td><input type="text" required="required" name="LotKey" size="15" maxlength="15" value="' . $_POST['LotKey']. '" /></td> - </tr>'; - echo '<tr> + <td><input type="text" required="required" name="LotKey" size="15" maxlength="15" value="' . (isset($_POST['LotKey'])? $_POST['LotKey']:'') . '" /></td> + </tr> + <tr> <td>' . _('Identifier') . ':</td> - <td><input type="text" name="Identifier" size="15" maxlength="15" value="' . $_POST['Identifier']. '" /></td> - </tr>'; - echo '<tr> + <td><input type="text" name="Identifier" size="15" maxlength="15" value="' . (isset($_POST['Identifier'])? $_POST['Identifier']:'') . '" /></td> + </tr> + <tr> <td>' . _('Comments') . ':</td> - <td><input type="text" name="Comments" size="30" maxlength="255" value="' . $_POST['Comments']. '" /></td> - </tr>'; - - echo '<tr> + <td><input type="text" name="Comments" size="30" maxlength="255" value="' . (isset($_POST['Comments'])? $_POST['Comments']:'') . '" /></td> + </tr> + <tr> <td>' . _('Use for Cert?') . ':</td> <td><select name="Cert">'; if ($_POST['Cert']==1){ Modified: trunk/doc/Manual/ManualQualityAssurance.html =================================================================== --- trunk/doc/Manual/ManualQualityAssurance.html 2015-02-04 08:22:52 UTC (rev 7122) +++ trunk/doc/Manual/ManualQualityAssurance.html 2015-02-04 09:15:50 UTC (rev 7123) @@ -45,7 +45,7 @@ <h2>Print Product Specification</h2> <p>Prints a Customer Facing document that shows all the QA Tests that you have specified to "Show on Product Specification"</p> <img src="images/QA_PrintProductSpecification.png" alt="QA printing a product specification" /> -<h2>Logging Samples</h2> +<h2><a id="QA_Samples">Logging Samples</a></h2> <p>Samples can be logged automatically by the system or manually by a Quality person. If the configuration is set to Yes and the item is lot or serial controlled then at P/O receipt a sample is created in the system for each new Lot or serial received for the item being received. The system will not create duplicate samples if you receive the same lot 3 times against a purchase order or work order.</p> <p>You can view and edit existing samples in the "QA Samples and Test Results" under the Manufacturing module.</p> @@ -68,7 +68,7 @@ <img src="images/QA_PrintCertOfAnalysis2.png" alt="QA print certificate of Analysis 2" /> <p>The certification looks like this:</p> <img src="images/QA_CertOfAnalysisReport.png" alt="QA Certificate of Analysis" /> -<h2>Viewing Historical Results</h2> +<h2><a id="QA_HistoricalResults">Viewing Historical Results</a></h2> <ul> <li>1) Select “Historical QA Test Results” from the Manufacturing Reports menu</li> <li>2) Select your Specification</li> |