|
From: <aga...@us...> - 2014-12-16 20:55:59
|
Revision: 7026
http://sourceforge.net/p/web-erp/reponame/7026
Author: agaluski
Date: 2014-12-16 20:55:46 +0000 (Tue, 16 Dec 2014)
Log Message:
-----------
Modified Paths:
--------------
trunk/GoodsReceived.php
trunk/SystemParameters.php
trunk/WorkOrderReceive.php
trunk/Z_ChangeStockCode.php
trunk/doc/Change.log
trunk/includes/MainMenuLinksArray.php
trunk/includes/SQL_CommonFunctions.inc
trunk/sql/mysql/upgrade4.11-4.12.sql
Added Paths:
-----------
trunk/HistoricalTestResults.php
trunk/PDFCOA.php
trunk/PDFProdSpec.php
trunk/ProductSpecs.php
trunk/QATests.php
trunk/SelectQASamples.php
trunk/TestPlanResults.php
trunk/includes/PDFCOAHeader.inc
trunk/includes/PDFProdSpecHeader.inc
Modified: trunk/GoodsReceived.php
===================================================================
--- trunk/GoodsReceived.php 2014-12-16 15:01:00 UTC (rev 7025)
+++ trunk/GoodsReceived.php 2014-12-16 20:55:46 UTC (rev 7026)
@@ -605,6 +605,9 @@
$ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock movement record could not be inserted because');
$DbgMsg = _('The following SQL to insert the serial stock movement records was used');
$Result = DB_query($SQL, $ErrMsg, $DbgMsg, true);
+ if ($_SESSION['QualityLogSamples']==1) {
+ CreateQASample($OrderLine->StockID,$Item->BundleRef, '', 'Created from Purchase Order', 0, 0,$db);
+ }
}//non blank BundleRef
} //end foreach
}
Added: trunk/HistoricalTestResults.php
===================================================================
--- trunk/HistoricalTestResults.php (rev 0)
+++ trunk/HistoricalTestResults.php 2014-12-16 20:55:46 UTC (rev 7026)
@@ -0,0 +1,156 @@
+<?php
+/* $Id: HsitoricalTestResults.php 1 2014-09-08 10:42:50Z agaluski $*/
+
+include('includes/session.inc');
+$Title = _('Historical Test Results');
+include('includes/header.inc');
+
+if (isset($_GET['KeyValue'])){
+ $KeyValue =mb_strtoupper($_GET['KeyValue']);
+} elseif(isset($_POST['KeyValue'])){
+ $KeyValue =mb_strtoupper($_POST['KeyValue']);
+}
+
+if (!isset($_POST['FromDate'])){
+ $_POST['FromDate']=Date(($_SESSION['DefaultDateFormat']), strtotime($UpcomingDate . ' - 180 days'));
+}
+if (!isset($_POST['ToDate'])){
+ $_POST['ToDate'] = Date($_SESSION['DefaultDateFormat']);
+}
+if (!Is_Date($_POST['FromDate'])) {
+ $InputError = 1;
+ prnMsg(_('Invalid From Date'),'error');
+ $_POST['FromDate']=Date(($_SESSION['DefaultDateFormat']), strtotime($UpcomingDate . ' - 180 days'));
+}
+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)) {
+ unset($Errors);
+}
+
+$Errors = array();
+
+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">
+ <tr>
+ <td>' . _('Show Test Results For') .':</td>';
+$SQLSpecSelect="SELECT DISTINCT(prodspeckey),
+ description
+ FROM qasamples LEFT OUTER JOIN stockmaster
+ ON stockmaster.stockid=qasamples.prodspeckey";
+
+
+$ResultSelection=DB_query($SQLSpecSelect, $db);
+echo '<td><select name="KeyValue">';
+
+while ($MyRowSelection=DB_fetch_array($ResultSelection)){
+ if ($MyRowSelection['prodspeckey']==$KeyValue) {
+ $Selected=' selected="selected" ';
+ } else {
+ $Selected='';
+ }
+ echo '<option' . $Selected . ' value="' . $MyRowSelection['prodspeckey'] . '">' . $MyRowSelection['prodspeckey'].' - ' .htmlspecialchars($MyRowSelection['description'], ENT_QUOTES,'UTF-8', false) . '</option>';
+}
+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>
+ </tr>
+ </table>
+ </div>
+ <div>
+ <input type="submit" name="pickspec" value="' . _('Submit') . '" />
+ </div>
+ </form>';
+
+
+//show header
+$SQLSpecSelect="SELECT description
+ FROM stockmaster
+ WHERE stockmaster.stockid='" .$KeyValue. "'";
+
+$ResultSelection=DB_query($SQLSpecSelect, $db);
+$MyRowSelection=DB_fetch_array($ResultSelection);
+$SQLTests="SELECT sampleresults.testid,
+ sampledate,
+ sampleresults.sampleid,
+ lotkey,
+ identifier,
+ cert,
+ isinspec,
+ testvalue,
+ name
+ FROM qasamples
+ INNER JOIN sampleresults on sampleresults.sampleid=qasamples.sampleid
+ INNER JOIN qatests
+ ON qatests.testid=sampleresults.testid
+ WHERE qasamples.prodspeckey='".$KeyValue."'
+ AND sampleresults.showontestplan='1'
+ AND sampledate>='".$FromDate."'
+ AND sampledate <='".$ToDate."'";
+
+
+$TestResult=DB_query($SQLTests, $db);
+$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);
+ if ($testkey===false) {
+ $TestsArray[$MyTestRow['name']]=$MyTestRow['name'];
+ }
+
+ $testkey=array_search ($MyTestRow['sampleid'] , $SamplesArray);
+ if ($testkey===false) {
+ $SamplesArray[$FormattedSampleID]=$MyTestRow;
+ $TotResults++;
+ }
+ $AllResultsArray[$MyTestRow['name']][$FormattedSampleID]=$MyTestRow;
+}
+
+if ($TotResults>0) {
+ echo '<br/>' . _('Historical Test Results for') . ' ' . $KeyValue . '-' . $MyRowSelection['description'] . '<br/>';
+ $k = 0; //row colour counter
+ echo '<div><div style="overflow:auto; width:98%; padding:10px; "><table width="90%" style="overflow: scroll;"><tr><th style="white-space:nowrap; text-align:right">' . _('Sample ID:') . '<br>' . _('Lot/Serial:') . '<br>' . _('Identifier:') . '<br>' . _('Sample Date:') .'</th>';
+ foreach ($SamplesArray as $samplekey => $samplevalue) {
+ echo '<th>'. $samplekey . '<br>' . $samplevalue['lotkey'] . '<br>' . $samplevalue['identifier'] . '<br>' . ConvertSQLDate($samplevalue['sampledate']).'</th>';
+ }
+ echo '</tr>';
+ foreach ($TestsArray as $testkey => $testvalue) {
+ if ($k == 1) { /*alternate bgcolour of row for highlighting */
+ echo '<tr class="EvenTableRows">';
+ $k = 0;
+ } else {
+ echo '<tr class="OddTableRows">';
+ $k++;
+ }
+ echo '<td class="select" style="white-space:nowrap;">'.$testvalue.'</th>';
+ foreach ($SamplesArray as $samplekey => $samplevalue) {
+ if ($AllResultsArray[$testkey][$samplekey]['testvalue']=='' OR !isset($AllResultsArray[$testkey][$samplekey]['testvalue'])) {
+ $AllResultsArray[$testkey][$samplekey]['testvalue']=' ';
+ }
+ echo '<td>'.$AllResultsArray[$testkey][$samplekey]['testvalue'].'</td>';
+ }
+ echo '</tr>';
+ }
+ echo '</tr></table></div></div>';
+}
+
+include('includes/footer.inc');
+?>
\ No newline at end of file
Added: trunk/PDFCOA.php
===================================================================
--- trunk/PDFCOA.php (rev 0)
+++ trunk/PDFCOA.php 2014-12-16 20:55:46 UTC (rev 7026)
@@ -0,0 +1,320 @@
+<?php
+
+/* $Id: PDFCOA.php 1 2014-09-15 06:31:08Z agaluski $ */
+
+include('includes/session.inc');
+include('includes/SQL_CommonFunctions.inc');
+
+if (isset($_GET['LotKey'])) {
+ $SelectedCOA=$_GET['LotKey'];
+} elseif (isset($_POST['LotKey'])) {
+ $SelectedCOA=$_POST['LotKey'];
+}
+if (isset($_GET['ProdSpec'])) {
+ $SelectedSpec=$_GET['ProdSpec'];
+} elseif (isset($_POST['ProdSpec'])) {
+ $SelectedSpec=$_POST['ProdSpec'];
+}
+
+if (isset($_GET['QASampleID'])) {
+ $QASampleID=$_GET['QASampleID'];
+} elseif (isset($_POST['QASampleID'])) {
+ $QASampleID=$_POST['QASampleID'];
+}
+
+//Get Out if we have no Certificate of Analysis
+If ((!isset($SelectedCOA) || $SelectedCOA=='') AND (!isset($QASampleID) OR $QASampleID=='')){
+ $Title = _('Select Certificate of Analysis 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>';
+ echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">
+ <div>
+ <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />
+ <table class="selection">
+ <tr>
+ <td>' . _('Enter Item') .':</td>
+ <td><input type="text" name="ProdSpec" size="25" maxlength="25" /></td>
+ <td>' . _('Enter Lot') .':</td>
+ <td><input type="text" name="LotKey" size="25" maxlength="25" /></td>
+ </tr>
+ </table>
+ </div>
+ <div>
+ <input type="submit" name="pickspec" value="' . _('Submit') . '" />
+ </div>
+ </form>
+ <form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">
+ <div>
+ <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />
+ <table class="selection">
+ <tr>
+ <td>' . _('Or Select Existing Lot') .':</td>';
+ $SQLSpecSelect="SELECT sampleid,
+ lotkey,
+ prodspeckey,
+ description
+ FROM qasamples LEFT OUTER JOIN stockmaster
+ ON stockmaster.stockid=qasamples.prodspeckey
+ WHERE cert='1'
+ ORDER BY lotkey";
+
+
+ $ResultSelection=DB_query($SQLSpecSelect, $db);
+ 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 '</tr>
+ </table>
+ </div>
+ <div>
+ <input type="submit" name="pickspec" value="' . _('Submit') . '" />
+ </div>
+ </form>';
+ include('includes/footer.inc');
+ exit();
+}
+
+
+$ErrMsg = _('There was a problem retrieving the Lot Information') . ' ' .$SelectedCOA . ' ' . _('from the database');
+if (isset($SelectedCOA)) {
+ $sql = "SELECT lotkey,
+ description,
+ name,
+ method,
+ qatests.units,
+ type,
+ testvalue,
+ sampledate,
+ groupby
+ FROM qasamples INNER JOIN sampleresults
+ ON sampleresults.sampleid=qasamples.sampleid
+ INNER JOIN qatests
+ ON qatests.testid=sampleresults.testid
+ LEFT OUTER JOIN stockmaster on stockmaster.stockid=qasamples.prodspeckey
+ WHERE qasamples.lotkey='" .$SelectedCOA."'
+ AND qasamples.prodspeckey='" .$SelectedSpec."'
+ AND qasamples.cert='1'
+ AND sampleresults.showoncert='1'
+ ORDER by groupby, sampleresults.testid";
+} else {
+ $sql = "SELECT lotkey,
+ description,
+ name,
+ method,
+ qatests.units,
+ type,
+ testvalue,
+ sampledate,
+ groupby
+ FROM qasamples INNER JOIN sampleresults
+ ON sampleresults.sampleid=qasamples.sampleid
+ INNER JOIN qatests
+ ON qatests.testid=sampleresults.testid
+ LEFT OUTER JOIN stockmaster on stockmaster.stockid=qasamples.prodspeckey
+ WHERE qasamples.sampleid='" .$QASampleID."'
+ AND qasamples.cert='1'
+ AND sampleresults.showoncert='1'
+ ORDER by groupby, sampleresults.testid";
+}
+$result=DB_query($sql,$db, $ErrMsg);
+
+//If there are no rows, there's a problem.
+if (DB_num_rows($result)==0){
+ $Title = _('Print Certificate of Analysis Error');
+ include('includes/header.inc');
+ echo '<div class="centre">
+ <br />
+ <br />
+ <br />';
+ prnMsg( _('Unable to Locate Lot') . ' : ' . $SelectedCOA . ' ', 'error');
+ echo '<br />
+ <br />
+ <br />
+ <table class="table_index">
+ <tr>
+ <td class="menu_group_item">
+ <ul><li><a href="'. $RootPath . '/PDFCOA.php">' . _('Certificate of Analysis') . '</a></li></ul>
+ </td>
+ </tr>
+ </table>
+ </div>
+ <br />
+ <br />
+ <br />';
+ include('includes/footer.inc');
+ exit;
+}
+$PaperSize = 'Letter';
+if ($QASampleID>'') {
+ $myrow=DB_fetch_array($result);
+ $SelectedCOA=$myrow['lotkey'];
+ DB_data_seek($result,0);
+}
+include('includes/PDFStarter.php');
+$pdf->addInfo('Title', _('Certificate of Analysis') );
+$pdf->addInfo('Subject', _('Certificate of Analysis') . ' ' . $SelectedCOA);
+$FontSize=12;
+$PageNumber = 1;
+$HeaderPrinted=0;
+$line_height=$FontSize*1.25;
+$RectHeight=12;
+$SectionHeading=0;
+$CurSection='';
+$SectionTitle='';
+$SectionTrailer='';
+
+$SectionsArray=array(array('PhysicalProperty',3, _('Physical Properties'), '', array(260,110,135),array(_('Physical Property'),_('Value'),_('Test Method')),array('left','center','center')),
+ array('Processing',2, _('Injection Molding Processing Guidelines'), _('* Desicant type dryer required.'), array(240,265),array(_('Setting'),_('Value')),array('left','center')),
+ array('RegulatoryCompliance',2, _('Regulatory Compliance'), '', array(240,265),array(_('Regulatory Compliance'),_('Value')),array('left','center')));
+
+while ($myrow=DB_fetch_array($result)){
+ if ($myrow['description']=='') {
+ $myrow['description']=$myrow['prodspeckey'];
+ }
+ $Spec=$myrow['description'];
+ $SampleDate=ConvertSQLDate($myrow['sampledate']);
+
+ foreach($SectionsArray as $row) {
+ if ($myrow['groupby']==$row[0]) {
+ $SectionColSizes=$row[4];
+ $SectionColLabs=$row[5];
+ $SectionAlign=$row[6];
+ }
+ }
+ $TrailerPrinted=1;
+ if ($HeaderPrinted==0) {
+ include('includes/PDFCOAHeader.inc');
+ $HeaderPrinted=1;
+ }
+
+ if ($CurSection!=$myrow['groupby']) {
+ $SectionHeading=0;
+ if ($CurSection!='' AND $PrintTrailer==1) {
+ $pdf->line($XPos+1, $YPos+$RectHeight,$XPos+506, $YPos+$RectHeight);
+ }
+ $PrevTrailer=$SectionTrailer;
+ $CurSection=$myrow['groupby'];
+ foreach($SectionsArray as $row) {
+ if ($myrow['groupby']==$row[0]) {
+ $SectionTitle=$row[2];
+ $SectionTrailer=$row[3];
+ }
+ }
+ }
+
+ if ($SectionHeading==0) {
+ $XPos=65;
+ if ($PrevTrailer>'' AND $PrintTrailer==1) {
+ $PrevFontSize=$FontSize;
+ $FontSize=8;
+ $line_height=$FontSize*1.25;
+ $LeftOvers = $pdf->addTextWrap($XPos+5,$YPos,500,$FontSize,$PrevTrailer,'left');
+ $FontSize=$PrevFontSize;
+ $line_height=$FontSize*1.25;
+ $YPos -= $line_height;
+ $YPos -= $line_height;
+ }
+ if ($YPos < ($Bottom_Margin + 90)){ // Begins new page
+ $PrintTrailer=0;
+ $PageNumber++;
+ include ('includes/PDFCOAHeader.inc');
+ }
+ $LeftOvers = $pdf->addTextWrap($XPos,$YPos,500,$FontSize,$SectionTitle,'center');
+ $YPos -= $line_height;
+ $pdf->setFont('','B');
+ $pdf->SetFillColor(200,200,200);
+ $x=0;
+ foreach($SectionColLabs as $CurColLab) {
+ $ColLabel=$CurColLab;
+ $ColWidth=$SectionColSizes[$x];
+ $x++;
+ $LeftOvers = $pdf->addTextWrap($XPos+1,$YPos,$ColWidth,$FontSize,$ColLabel,'center',1,'fill');
+ $XPos+=$ColWidth;
+ }
+ $SectionHeading=1;
+ $YPos -= $line_height;
+ $pdf->setFont('','');
+ } //$SectionHeading==0
+ $XPos=65;
+ $Value='';
+ if ($myrow['testvalue'] > '') {
+ $Value=$myrow['testvalue'];
+ } //elseif ($myrow['rangemin'] > '') {
+ // $Value=$myrow['rangemin'] . ' - ' . $myrow['rangemax'];
+ //}
+ if (strtoupper($Value) <> 'NB' AND strtoupper($Value) <> 'NO BREAK') {
+ $Value.= ' ' . $myrow['units'];
+ }
+ $x=0;
+ foreach($SectionColLabs as $CurColLab) {
+ $ColLabel=$CurColLab;
+ $ColWidth=$SectionColSizes[$x];
+ $ColAlign=$SectionAlign[$x];
+ switch ($x) {
+ case 0;
+ $DispValue=$myrow['name'];
+ break;
+ 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++;
+ }
+
+ $YPos -= $line_height;
+ $XPos=65;
+ $PrintTrailer=1;
+ if ($YPos < ($Bottom_Margin + 80)){ // Begins new page
+ $pdf->line($XPos+1, $YPos+$RectHeight,$XPos+506, $YPos+$RectHeight);
+ $PrintTrailer=0;
+ $PageNumber++;
+ include ('includes/PDFCOAHeader.inc');
+ }
+ //echo 'PrintTrailer'.$PrintTrailer.' '.$PrevTrailer.'<br>' ;
+} //while loop
+
+$pdf->line($XPos+1, $YPos+$RectHeight,$XPos+506, $YPos+$RectHeight);
+if ($SectionTrailer>'') {
+ $PrevFontSize=$FontSize;
+ $FontSize=8;
+ $line_height=$FontSize*1.25;
+ $LeftOvers = $pdf->addTextWrap($XPos+5,$YPos,500,$FontSize,$SectionTrailer,'left');
+ $FontSize=$PrevFontSize;
+ $line_height=$FontSize*1.25;
+ $YPos -= $line_height;
+ $YPos -= $line_height;
+}
+if ($YPos < ($Bottom_Margin + 85)){ // Begins new page
+ $PageNumber++;
+ include ('includes/PDFCOAHeader.inc');
+}
+
+$FontSize=8;
+$line_height=$FontSize*1.25;
+$YPos -= $line_height;
+$YPos -= $line_height;
+$sql = "SELECT confvalue
+ FROM config
+ WHERE confname='QualityCOAText'";
+
+$result=DB_query($sql,$db, $ErrMsg);
+$myrow=DB_fetch_array($result);
+$Disclaimer=$myrow[0];
+$LeftOvers = $pdf->addTextWrap($XPos+5,$YPos,500,$FontSize,$Disclaimer);
+while (mb_strlen($LeftOvers) > 1) {
+ $YPos -= $line_height;
+ $LeftOvers = $pdf->addTextWrap($XPos+5,$YPos,445,$FontSize, $LeftOvers, 'left');
+}
+
+$pdf->OutputI($_SESSION['DatabaseName'] . 'COA' . date('Y-m-d') . '.pdf');
+$pdf->__destruct();
+
+?>
\ No newline at end of file
Added: trunk/PDFProdSpec.php
===================================================================
--- trunk/PDFProdSpec.php (rev 0)
+++ trunk/PDFProdSpec.php 2014-12-16 20:55:46 UTC (rev 7026)
@@ -0,0 +1,287 @@
+<?php
+
+/* $Id: PDFProdSpec.php 1 2014-09-15 06:31:08Z agaluski $ */
+
+include('includes/session.inc');
+include('includes/SQL_CommonFunctions.inc');
+
+if (isset($_GET['KeyValue'])) {
+ $SelectedProdSpec=$_GET['KeyValue'];
+} elseif (isset($_POST['KeyValue'])) {
+ $SelectedProdSpec=$_POST['KeyValue'];
+}
+
+//Get Out if we have no product specification
+If (!isset($SelectedProdSpec) || $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>';
+ echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">
+ <div>
+ <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />
+ <table class="selection">
+ <tr>
+ <td>' . _('Enter Specification Name') .':</td>
+ <td><input type="text" name="KeyValue" size="25" maxlength="25" /></td>
+ </tr>
+ </table>
+ </div>
+ <div>
+ <input type="submit" name="pickspec" value="' . _('Submit') . '" />
+ </div>
+ </form>
+ <form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">
+ <div>
+ <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />
+ <table class="selection">
+ <tr>
+ <td>' . _('Or Select Existing Specification') .':</td>';
+ $SQLSpecSelect="SELECT DISTINCT(keyval),
+ description
+ FROM prodspecs LEFT OUTER JOIN stockmaster
+ ON stockmaster.stockid=prodspecs.keyval";
+
+
+ $ResultSelection=DB_query($SQLSpecSelect, $db);
+ 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 '</tr>
+ </table>
+ </div>
+ <div>
+ <input type="submit" name="pickspec" value="' . _('Submit') . '" />
+ </div>
+ </form>';
+ include('includes/footer.inc');
+ exit();
+}
+
+/*retrieve the order details from the database to print */
+$ErrMsg = _('There was a problem retrieving the Product Specification') . ' ' . $SelectedProdSpec . ' ' . _('from the database');
+
+$sql = "SELECT keyval,
+ description,
+ longdescription,
+ prodspecs.testid,
+ name,
+ method,
+ qatests.units,
+ type,
+ numericvalue,
+ prodspecs.targetvalue,
+ prodspecs.rangemin,
+ prodspecs.rangemax,
+ groupby
+ FROM prodspecs INNER JOIN qatests
+ ON qatests.testid=prodspecs.testid
+ LEFT OUTER JOIN stockmaster on stockmaster.stockid=prodspecs.keyval
+ WHERE prodspecs.keyval='" .$SelectedProdSpec."'
+ AND prodspecs.showonspec='1'
+ ORDER by groupby, prodspecs.testid";
+
+$result=DB_query($sql,$db, $ErrMsg);
+
+//If there are no rows, there's a problem.
+if (DB_num_rows($result)==0){
+ $Title = _('Print Product Specification Error');
+ include('includes/header.inc');
+ echo '<div class="centre">
+ <br />
+ <br />
+ <br />';
+ prnMsg( _('Unable to Locate Specification') . ' : ' . $_SelectedProdSpec . ' ', 'error');
+ echo '<br />
+ <br />
+ <br />
+ <table class="table_index">
+ <tr>
+ <td class="menu_group_item">
+ <ul><li><a href="'. $RootPath . '/PDFProdSpec.php">' . _('Product Specifications') . '</a></li></ul>
+ </td>
+ </tr>
+ </table>
+ </div>
+ <br />
+ <br />
+ <br />';
+ include('includes/footer.inc');
+ exit;
+}
+$PaperSize = 'Letter';
+
+include('includes/PDFStarter.php');
+$pdf->addInfo('Title', _('Product Specification') );
+$pdf->addInfo('Subject', _('Product Specification') . ' ' . $SelectedProdSpec);
+$FontSize=12;
+$PageNumber = 1;
+$HeaderPrinted=0;
+$line_height=$FontSize*1.25;
+$RectHeight=12;
+$SectionHeading=0;
+$CurSection='';
+$SectionTitle='';
+$SectionTrailer='';
+
+$SectionsArray=array(array('PhysicalProperty',3, _('Technical Data Sheet Properties'), _('* Data herein is typical and not to be construed as specifications.'), array(260,110,135),array(_('Physical Property'),_('Value'),_('Test Method')),array('left','center','center')),
+ array('Processing',2, _('Injection Molding Processing Guidelines'), _('* Desicant type dryer required.'), array(240,265),array(_('Setting'),_('Value')),array('left','center')),
+ array('RegulatoryCompliance',2, _('Regulatory Compliance'), '', array(240,265),array(_('Regulatory Compliance'),_('Value')),array('left','center')));
+
+while ($myrow=DB_fetch_array($result)){
+ if ($myrow['description']=='') {
+ $myrow['description']=$myrow['keyval'];
+ }
+ $Spec=$myrow['description'];
+ $SpecDesc=$myrow['longdescription'];
+ foreach($SectionsArray as $row) {
+ if ($myrow['groupby']==$row[0]) {
+ $SectionColSizes=$row[4];
+ $SectionColLabs=$row[5];
+ $SectionAlign=$row[6];
+ }
+ }
+ $TrailerPrinted=1;
+ if ($HeaderPrinted==0) {
+ include('includes/PDFProdSpecHeader.inc');
+ $HeaderPrinted=1;
+ }
+
+ if ($CurSection!=$myrow['groupby']) {
+ $SectionHeading=0;
+ if ($CurSection!='' AND $PrintTrailer==1) {
+ $pdf->line($XPos+1, $YPos+$RectHeight,$XPos+506, $YPos+$RectHeight);
+ }
+ $PrevTrailer=$SectionTrailer;
+ $CurSection=$myrow['groupby'];
+ foreach($SectionsArray as $row) {
+ if ($myrow['groupby']==$row[0]) {
+ $SectionTitle=$row[2];
+ $SectionTrailer=$row[3];
+ }
+ }
+ }
+
+ if ($SectionHeading==0) {
+ $XPos=65;
+ if ($PrevTrailer>'' AND $PrintTrailer==1) {
+ $PrevFontSize=$FontSize;
+ $FontSize=8;
+ $line_height=$FontSize*1.25;
+ $LeftOvers = $pdf->addTextWrap($XPos+5,$YPos,500,$FontSize,$PrevTrailer,'left');
+ $FontSize=$PrevFontSize;
+ $line_height=$FontSize*1.25;
+ $YPos -= $line_height;
+ $YPos -= $line_height;
+ }
+ if ($YPos < ($Bottom_Margin + 90)){ // Begins new page
+ $PrintTrailer=0;
+ $PageNumber++;
+ include ('includes/PDFProdSpecHeader.inc');
+ }
+ $LeftOvers = $pdf->addTextWrap($XPos,$YPos,500,$FontSize,$SectionTitle,'center');
+ $YPos -= $line_height;
+ $pdf->setFont('','B');
+ $pdf->SetFillColor(200,200,200);
+ $x=0;
+ foreach($SectionColLabs as $CurColLab) {
+ $ColLabel=$CurColLab;
+ $ColWidth=$SectionColSizes[$x];
+ $x++;
+ $LeftOvers = $pdf->addTextWrap($XPos+1,$YPos,$ColWidth,$FontSize,$ColLabel,'center',1,'fill');
+ $XPos+=$ColWidth;
+ }
+ $SectionHeading=1;
+ $YPos -= $line_height;
+ $pdf->setFont('','');
+ } //$SectionHeading==0
+ $XPos=65;
+ $Value='';
+ if ($myrow['targetvalue'] > '') {
+ $Value=$myrow['targetvalue'];
+ } elseif ($myrow['rangemin'] > '' OR $myrow['rangemax'] > '') {
+ if ($myrow['rangemin'] > '' AND $myrow['rangemax'] == '') {
+ $Value='> ' . $myrow['rangemin'];
+ } elseif ($myrow['rangemin']== '' AND $myrow['rangemax'] > '') {
+ $Value='< ' . $myrow['rangemax'];
+ } else {
+ $Value=$myrow['rangemin'] . ' - ' . $myrow['rangemax'];
+ }
+ }
+ if (strtoupper($Value) <> 'NB' AND strtoupper($Value) <> 'NO BREAK') {
+ $Value.= ' ' . $myrow['units'];
+ }
+ $x=0;
+
+ foreach($SectionColLabs as $CurColLab) {
+ $ColLabel=$CurColLab;
+ $ColWidth=$SectionColSizes[$x];
+ $ColAlign=$SectionAlign[$x];
+ switch ($x) {
+ case 0;
+ $DispValue=$myrow['name'];
+ break;
+ 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++;
+ }
+ $YPos -= $line_height;
+ $XPos=65;
+ $PrintTrailer=1;
+ if ($YPos < ($Bottom_Margin + 80)){ // Begins new page
+ $pdf->line($XPos+1, $YPos+$RectHeight,$XPos+506, $YPos+$RectHeight);
+ $PrintTrailer=0;
+ $PageNumber++;
+ include ('includes/PDFProdSpecHeader.inc');
+ }
+ //echo 'PrintTrailer'.$PrintTrailer.' '.$PrevTrailer.'<br>' ;
+} //while loop
+
+$pdf->line($XPos+1, $YPos+$RectHeight,$XPos+506, $YPos+$RectHeight);
+if ($SectionTrailer>'') {
+ $PrevFontSize=$FontSize;
+ $FontSize=8;
+ $line_height=$FontSize*1.25;
+ $LeftOvers = $pdf->addTextWrap($XPos+5,$YPos,500,$FontSize,$SectionTrailer,'left');
+ $FontSize=$PrevFontSize;
+ $line_height=$FontSize*1.25;
+ $YPos -= $line_height;
+ $YPos -= $line_height;
+}
+if ($YPos < ($Bottom_Margin + 85)){ // Begins new page
+ $PageNumber++;
+ include ('includes/PDFProdSpecHeader.inc');
+}
+$Disclaimer= _('The information provided on this datasheet should only be used as a guideline. Actual lot to lot values will vary.');
+$FontSize=8;
+$line_height=$FontSize*1.25;
+$YPos -= $line_height;
+$LeftOvers = $pdf->addTextWrap($XPos+5,$YPos,500,$FontSize,$Disclaimer);
+$YPos -= $line_height;
+$YPos -= $line_height;
+$sql = "SELECT confvalue
+ FROM config
+ WHERE confname='QualityProdSpecText'";
+
+$result=DB_query($sql,$db, $ErrMsg);
+$myrow=DB_fetch_array($result);
+$Disclaimer=$myrow[0];
+$LeftOvers = $pdf->addTextWrap($XPos+5,$YPos,500,$FontSize,$Disclaimer);
+while (mb_strlen($LeftOvers) > 1) {
+ $YPos -= $line_height;
+ $LeftOvers = $pdf->addTextWrap($XPos+5,$YPos,445,$FontSize, $LeftOvers, 'left');
+}
+
+$pdf->OutputI($_SESSION['DatabaseName'] . 'ProductSpecification' . date('Y-m-d') . '.pdf');
+$pdf->__destruct();
+
+?>
\ No newline at end of file
Added: trunk/ProductSpecs.php
===================================================================
--- trunk/ProductSpecs.php (rev 0)
+++ trunk/ProductSpecs.php 2014-12-16 20:55:46 UTC (rev 7026)
@@ -0,0 +1,671 @@
+<?php
+/* $Id: ProductsSpecs.php 1 2014-09-08 10:42:50Z agaluski $*/
+
+include('includes/session.inc');
+$Title = _('Product Specifications Maintenance');
+include('includes/header.inc');
+
+if (isset($_GET['SelectedQATest'])){
+ $SelectedQATest =mb_strtoupper($_GET['SelectedQATest']);
+} elseif(isset($_POST['SelectedQATest'])){
+ $SelectedQATest =mb_strtoupper($_POST['SelectedQATest']);
+}
+if (isset($_GET['KeyValue'])){
+ $KeyValue =mb_strtoupper($_GET['KeyValue']);
+} elseif(isset($_POST['KeyValue'])){
+ $KeyValue =mb_strtoupper($_POST['KeyValue']);
+}
+
+if ($_POST['RangeMin']=='') {
+ $RangeMin="NULL";
+} else {
+ $RangeMin="'" . $_POST['RangeMin'] . "'";
+}
+if ($_POST['RangeMax']=='') {
+ $RangeMax="NULL";
+} else {
+ $RangeMax="'" . $_POST['RangeMax'] . "'";
+}
+
+if (isset($Errors)) {
+ unset($Errors);
+}
+
+$Errors = array();
+
+echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $Title . '</p>';
+
+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>';
+ include('includes/footer.inc');
+ exit;
+ } else {
+ $sql = "INSERT IGNORE INTO prodspecs
+ (keyval,
+ testid,
+ defaultvalue,
+ targetvalue,
+ rangemin,
+ rangemax,
+ showoncert,
+ showonspec,
+ showontestplan,
+ active)
+ SELECT '" . $_POST['CopyTo'] . "',
+ testid,
+ defaultvalue,
+ targetvalue,
+ rangemin,
+ rangemax,
+ showoncert,
+ showonspec,
+ showontestplan,
+ active
+ FROM prodspecs WHERE keyval='" .$KeyValue. "'";
+ $msg = _('A Product Specification has been copied to') . ' ' . $_POST['CopyTo'] . ' from ' . ' ' . $KeyValue ;
+ $ErrMsg = _('The insert of the Product Specification failed because');
+ $DbgMsg = _('The SQL that was used and failed was');
+ $result = DB_query($sql,$db,$ErrMsg, $DbgMsg);
+ prnMsg($msg , 'success');
+ $KeyValue=$_POST['CopyTo'];
+ unset($_GET['CopySpec']);
+ unset($_POST['CopySpec']);
+ } //else
+} //CopySpec
+
+if (!isset($KeyValue) OR $KeyValue=='') {
+ //prompt user for Key Value
+ echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">
+ <div>
+ <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />
+ <table class="selection">
+ <tr>
+ <td>' . _('Enter Specification Name') .':</td>
+ <td><input type="text" name="KeyValue" size="25" maxlength="25" /></td>
+ </tr>
+ </table>
+ </div>
+ <div>
+ <input type="submit" name="pickspec" value="' . _('Submit') . '" />
+ </div>
+ </form>
+ <form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">
+ <div>
+ <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />
+ <table class="selection">
+ <tr>
+ <td>' . _('Or Select Existing Specification') .':</td>';
+ $SQLSpecSelect="SELECT DISTINCT(keyval),
+ description
+ FROM prodspecs LEFT OUTER JOIN stockmaster
+ ON stockmaster.stockid=prodspecs.keyval";
+
+
+ $ResultSelection=DB_query($SQLSpecSelect, $db);
+ 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 '</tr>
+ </table>
+ </div>
+ <div>
+ <input type="submit" name="pickspec" value="' . _('Submit') . '" />
+ </div>
+ </form>';
+
+
+} else {
+ //show header
+ $SQLSpecSelect="SELECT description
+ FROM stockmaster
+ WHERE stockmaster.stockid='" .$KeyValue. "'";
+
+ $ResultSelection=DB_query($SQLSpecSelect, $db);
+ $MyRowSelection=DB_fetch_array($ResultSelection);
+ echo '<br/>' . _('Product Specification for') . ' ' . $KeyValue . '-' . $MyRowSelection['description'] . '<br/><br/>';
+}
+if (isset($_GET['ListTests'])) {
+ $sql = "SELECT qatests.testid,
+ name,
+ method,
+ units,
+ type,
+ numericvalue,
+ qatests.defaultvalue
+ FROM qatests
+ LEFT JOIN prodspecs
+ ON prodspecs.testid=qatests.testid
+ AND prodspecs.keyval='".$KeyValue."'
+ WHERE qatests.active='1'
+ AND prodspecs.keyval IS NULL
+ ORDER BY name";
+ $result = DB_query($sql,$db);
+ 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 '<table class="selection">';
+ echo '<tr>
+ <th class="ascending">' . _('Add') . '</th>
+ <th class="ascending">' . _('Name') . '</th>
+ <th class="ascending">' . _('Method') . '</th>
+ <th class="ascending">' . _('Units') . '</th>
+ <th>' . _('Possible Values') . '</th>
+ <th>' . _('Target Value') . '</th>
+ <th>' . _('Range Min') . '</th>
+ <th>' . _('Range Max') . '</th>
+ </tr>';
+ $k=0;
+ $x=0;
+ while ($myrow=DB_fetch_array($result)) {
+
+ if ($k==1){
+ echo '<tr class="EvenTableRows">';
+ $k=0;
+ } else {
+ echo '<tr class="OddTableRows">';
+ $k++;
+ }
+ $x++;
+ $Class='';
+ $RangeMin='';
+ $RangeMax='';
+ if ($myrow['numericvalue'] == 1) {
+ $IsNumeric = _('Yes');
+ $Class="number";
+ } else {
+ $IsNumeric = _('No');
+ }
+
+ switch ($myrow['type']) {
+ case 0; //textbox
+ $TypeDisp=_('Text Box');
+ break;
+ case 1; //select box
+ $TypeDisp=_('Select Box');
+ break;
+ case 2; //checkbox
+ $TypeDisp=_('Check Box');
+ break;
+ case 3; //datebox
+ $TypeDisp=_('Date Box');
+ $Class="date";
+ break;
+ case 4; //range
+ $TypeDisp=_('Range');
+ $RangeMin='<input class="' .$Class. '" type="text" name="AddRangeMin' .$x.'" />';
+ $RangeMax='<input class="' .$Class. '" type="text" name="AddRangeMax' .$x.'" />';
+ break;
+ } //end switch
+ printf('<td>%s</td>
+ <td>%s</td>
+ <td>%s</td>
+ <td>%s</td>
+ <td>%s</td>
+ <td>%s</td>
+ <td>%s</td>
+ <td>%s</td>
+ </tr>',
+ '<input type="checkbox" name="AddRow' .$x.'"><input type="hidden" name="AddTestID' .$x.'" value="' .$myrow['testid']. '">',
+ $myrow['name'],
+ $myrow['method'],
+ $myrow['units'],
+ $myrow['defaultvalue'],
+ '<input class="' .$Class. '" type="text" name="AddTargetValue' .$x.'" />',
+ $RangeMin,
+ $RangeMax);
+
+ } //END WHILE LIST LOOP
+
+ echo '</table><br /></div>
+ <div class="centre">
+ <input type="hidden" name="KeyValue" value="' . $KeyValue . '" />
+ <input type="hidden" name="AddTestsCounter" value="' . $x . '" />
+ <input type="submit" name="AddTests" value="' . _('Add') . '" />
+ </div></form>';
+ include('includes/footer.inc');
+ exit;
+} //ListTests
+if (isset($_POST['AddTests'])) {
+ for ($i=0;$i<=$_POST['AddTestsCounter'];$i++){
+ if ($_POST['AddRow' .$i]=='on') {
+ if ($_POST['AddRangeMin' .$i]=='') {
+ $AddRangeMin="NULL";
+ } else {
+ $AddRangeMin="'" . $_POST['AddRangeMin' .$i] . "'";
+ }
+ if ($_POST['AddRangeMax' .$i]=='') {
+ $AddRangeMax="NULL";
+ } else {
+ $AddRangeMax="'" . $_POST['AddRangeMax' .$i] . "'";
+ }
+
+ $sql = "INSERT INTO prodspecs
+ (keyval,
+ testid,
+ defaultvalue,
+ targetvalue,
+ rangemin,
+ rangemax,
+ showoncert,
+ showonspec,
+ showontestplan,
+ active)
+ SELECT '" . $KeyValue . "',
+ testid,
+ defaultvalue,
+ '" . $_POST['AddTargetValue' .$i] . "',
+ " . $AddRangeMin . ",
+ " . $AddRangeMax. ",
+ showoncert,
+ showonspec,
+ showontestplan,
+ active
+ FROM qatests WHERE testid='" .$_POST['AddTestID' .$i]. "'";
+ 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');
+ $result = DB_query($sql,$db,$ErrMsg, $DbgMsg);
+ prnMsg($msg , 'success');
+ } //if on
+ } //for
+} //AddTests
+
+if (isset($_POST['submit'])) {
+
+ //initialise no input errors assumed initially before we test
+ $InputError = 0;
+
+ /* actions to take once the user has clicked the submit button
+ ie the page has called itself with some user input */
+ $i=1;
+
+ //first off validate inputs sensible
+
+ if (isset($SelectedQATest) AND $InputError !=1) {
+
+ /*SelectedQATest 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 prodspecs SET defaultvalue='" . $_POST['DefaultValue'] . "',
+ targetvalue='" . $_POST['TargetValue'] . "',
+ rangemin=" . $RangeMin . ",
+ rangemax=" . $RangeMax . ",
+ showoncert='" . $_POST['ShowOnCert'] . "',
+ showonspec='" . $_POST['ShowOnSpec'] . "',
+ showontestplan='" . $_POST['ShowOnTestPlan'] . "',
+ active='" . $_POST['Active'] . "'
+ WHERE prodspecs.keyval = '".$KeyValue."'
+ AND prodspecs.testid = '".$SelectedQATest."'";
+
+ $msg = _('Product Specification record for') . ' ' . $_POST['QATestName'] . ' for ' . ' ' . $KeyValue . _('has been updated');
+ $ErrMsg = _('The update of the Product Specification failed because');
+ $DbgMsg = _('The SQL that was used and failed was');
+ $result = DB_query($sql,$db,$ErrMsg, $DbgMsg);
+
+ prnMsg($msg , 'success');
+
+ unset($SelectedQATest);
+ unset($_POST['DefaultValue']);
+ unset($_POST['TargetValue']);
+ unset($_POST['RangeMax']);
+ unset($_POST['RangeMin']);
+ unset($_POST['ShowOnCert']);
+ unset($_POST['ShowOnSpec']);
+ unset($_POST['Active']);
+ }
+} 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 qasamples
+ INNER JOIN sampleresults on sampleresults.sampleid=qasamples.sampleid AND sampleresults.testid='". $SelectedQATest."'
+ WHERE qasamples.prodspeckey='".$KeyValue."'";
+ $result = DB_query($sql,$db);
+ $myrow = DB_fetch_row($result);
+ if ($myrow[0]>0) {
+ prnMsg(_('Cannot delete this Product Specification because there are test results tied to it'),'error');
+ } else {
+ $sql="DELETE FROM prodspecs WHERE keyval='". $KeyValue."'
+ AND testid='". $SelectedQATest."'";
+ $ErrMsg = _('The Product Specification could not be deleted because');
+ $result = DB_query($sql,$db,$ErrMsg);
+
+ prnMsg(_('Product Specification') . ' ' . $SelectedQATest . ' for ' . ' ' . $KeyValue . _('has been deleted from the database'),'success');
+ unset ($SelectedQATest);
+ unset($delete);
+ unset ($_GET['delete']);
+ }
+}
+
+if (!isset($SelectedQATest)) {
+
+/* It could still be the second time the page has been run and a record has been selected for modification - SelectedQATest will exist because it was sent with the new call. If its the first time the page has been displayed with no parameters
+then none of the above are true and the list of QA Test 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*/
+
+ $sql = "SELECT prodspecs.testid,
+ name,
+ method,
+ units,
+ type,
+ numericvalue,
+ prodspecs.defaultvalue,
+ prodspecs.targetvalue,
+ prodspecs.rangemin,
+ prodspecs.rangemax,
+ prodspecs.showoncert,
+ prodspecs.showonspec,
+ prodspecs.showontestplan,
+ prodspecs.active
+ FROM prodspecs INNER JOIN qatests
+ ON qatests.testid=prodspecs.testid
+ WHERE prodspecs.keyval='" .$KeyValue."'
+ ORDER BY name";
+ $result = DB_query($sql,$db);
+
+ echo '<table class="selection">';
+ echo '<tr>
+ <th class="ascending">' . _('Name') . '</th>
+ <th class="ascending">' . _('Method') . '</th>
+ <th class="ascending">' . _('Units') . '</th>
+ <th class="ascending">' . _('Type') . '</th>
+ <th>' . _('Possible Values') . '</th>
+ <th>' . _('Target Value') . '</th>
+ <th>' . _('Range Min') . '</th>
+ <th>' . _('Range Max') . '</th>
+ <th class="ascending">' . _('Show on Cert') . '</th>
+ <th class="ascending">' . _('Show on Spec') . '</th>
+ <th class="ascending">' . _('Show on Test Plan') . '</th>
+ <th class="ascending">' . _('Active') . '</th>
+ </tr>';
+ $k=0;
+ while ($myrow=DB_fetch_array($result)) {
+
+ if ($k==1){
+ echo '<tr class="EvenTableRows">';
+ $k=0;
+ } else {
+ echo '<tr class="OddTableRows">';
+ $k++;
+ }
+ if ($myrow['active'] == 1) {
+ $ActiveText = _('Yes');
+ } else {
+ $ActiveText = _('No');
+ }
+ if ($myrow['numericvalue'] == 1) {
+ $IsNumeric = _('Yes');
+ $Class="number";
+ } else {
+ $IsNumeric = _('No');
+ }
+ if ($myrow['showoncert'] == 1) {
+ $ShowOnCertText = _('Yes');
+ } else {
+ $ShowOnCertText = _('No');
+ }
+ if ($myrow['showonspec'] == 1) {
+ $ShowOnSpecText = _('Yes');
+ } else {
+ $ShowOnSpecText = _('No');
+ }
+ if ($myrow['showontestplan'] == 1) {
+ $ShowOnTestPlanText = _('Yes');
+ } else {
+ $ShowOnTestPlanText = _('No');
+ }
+ switch ($myrow['type']) {
+ case 0; //textbox
+ $TypeDisp='Text Box';
+ break;
+ case 1; //select box
+ $TypeDisp='Select Box';
+ break;
+ case 2; //checkbox
+ $TypeDisp='Check Box';
+ break;
+ case 3; //datebox
+ $TypeDisp='Date Box';
+ $Class="date";
+ break;
+ case 4; //range
+ $TypeDisp='Range';
+ break;
+ } //end switch
+
+ printf('<td>%s</td>
+ <td>%s</td>
+ <td>%s</td>
+ <td>%s</td>
+ <td>%s</td>
+ <td>%s</td>
+ <td>%s</td>
+ <td>%s</td>
+ <td>%s</td>
+ <td>%s</td>
+ <td>%s</td>
+ <td>%s</td>
+ <td><a href="%sSelectedQATest=%s&KeyValue=%s">' . _('Edit') . '</a></td>
+ <td><a href="%sSelectedQATest=%s&KeyValue=%s&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this Product Specification ?') . '\');">' . _('Delete') . '</a></td>
+ </tr>',
+ $myrow['name'],
+ $myrow['method'],
+ $myrow['units'],
+ $TypeDisp,
+ $myrow['defaultvalue'],
+ $myrow['targetvalue'],
+ $myrow['rangemin'],
+ $myrow['rangemax'],
+ $ShowOnCertText,
+ $ShowOnSpecText,
+ $ShowOnTestPlanText,
+ $ActiveText,
+ htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?',
+ $myrow['testid'],
+ $KeyValue,
+ htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?',
+ $myrow['testid'],
+ $KeyValue);
+
+ } //END WHILE LIST LOOP
+ echo '</table><br />';
+} //end of ifs and buts!
+
+if (isset($SelectedQATest)) {
+ echo '<div class="centre"><a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?KeyValue=' .$KeyValue .'">' . _('Show All Product Specs') . '</a></div>';
+}
+
+if (! isset($_GET['delete'])) {
+
+ echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">';
+ echo '<div>';
+ echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
+
+ if (isset($SelectedQATest)) {
+ //editing an existing Prod Spec
+
+ $sql = "SELECT prodspecs.testid,
+ name,
+ method,
+ units,
+ type,
+ numericvalue,
+ prodspecs.defaultvalue,
+ prodspecs.targetvalue,
+ prodspecs.rangemin,
+ prodspecs.rangemax,
+ prodspecs.showoncert,
+ prodspecs.showonspec,
+ prodspecs.showontestplan,
+ prodspecs.active
+ FROM prodspecs INNER JOIN qatests
+ ON qatests.testid=prodspecs.testid
+ WHERE prodspecs.keyval='".$KeyValue."'
+ AND prodspecs.testid='".$SelectedQATest."'";
+
+ $result = DB_query($sql, $db);
+ $myrow = DB_fetch_array($result);
+
+ $_POST['SelectedQATest'] = $myrow['testid'];
+ $_POST['QATestName'] = $myrow['name'];
+ $_POST['Method'] = $myrow['method'];
+ $_POST['GroupBy'] = $myrow['groupby'];
+ $_POST['Type'] = $myrow['type'];
+ $_POST['Units'] = $myrow['units'];
+ $_POST['DefaultValue'] = $myrow['defaultvalue'];
+ $_POST['NumericValue'] = $myrow['numericvalue'];
+ $_POST['TargetValue'] = $myrow['targetvalue'];
+ $_POST['RangeMin'] = $myrow['rangemin'];
+ $_POST['RangeMax'] = $myrow['rangemax'];
+ $_POST['ShowOnCert'] = $myrow['showoncert'];
+ $_POST['ShowOnSpec'] = $myrow['showonspec'];
+ $_POST['ShowOnTestPlan'] = $myrow['showontestplan'];
+ $_POST['Active'] = $myrow['active'];
+
+
+ echo '<input type="hidden" name="SelectedQATest" value="' . $SelectedQATest . '" />';
+ echo '<input type="hidden" name="KeyValue" value="' . $KeyValue . '" />';
+ echo '<input type="hidden" name="TestID" value="' . $_POST['SelectedQATest'] . '" />';
+ echo '<table class="selection">
+ <tr>
+ <td>' . _('Test Name') . ':</td>
+ <td>' . $_POST['QATestName'] . '</td>
+ </tr>';
+
+ if (!isset($_POST['Active'])) {
+ $_POST['Active']=1;
+ }
+ if (!isset($_POST['ShowOnCert'])) {
+ $_POST['ShowOnCert']=1;
+ }
+ if (!isset($_POST['ShowOnSpec'])) {
+ $_POST['ShowOnSpec']=1;
+ }
+ if ($myrow['numericvalue'] == 1) {
+ $IsNumeric = _('Yes');
+ $Class="number";
+ }
+ switch ($myrow['type']) {
+ case 0; //textbox
+ $TypeDisp='Text Box';
+ break;
+ case 1; //select box
+ $TypeDisp='Select Box';
+ break;
+ case 2; //checkbox
+ $TypeDisp='Check Box';
+ break;
+ case 3; //datebox
+ $TypeDisp='Date Box';
+ $Class="date";
+ break;
+ case 4; //range
+ $TypeDisp='Range';
+ break;
+ } //end switch
+ if ($TypeDisp=='Select Box') {
+ echo '<tr>
+ <td>' . _('Possible Values') . ':</td>
+ <td><input type="text" name="DefaultValue" size="50" maxlength="150" value="' . $_POST['DefaultValue']. '" /></td>
+ </tr>';
+ }
+ echo '<tr>
+ <td>' . _('Target Value') . ':</td>
+ <td><input type="text" class="' . $Class.'" name="TargetValue" size="15" maxlength="15" value="' . $_POST['TargetValue']. '" /> '.$_POST['Units'].'</td>
+ </tr>';
+
+ if ($TypeDisp=='Range') {
+ echo '<tr>
+ <td>' . _('Range Min') . ':</td>
+ <td><input class="' . $Class.'" type="text" name="RangeMin" size="10" maxlength="10" value="' . $_POST['RangeMin']. '" /></td>
+ </tr>';
+ echo '<tr>
+ <td>' . _('Range Max') . ':</td>
+ <td><input class="' . $Class.'" type="text" name="RangeMax" size="10" maxlength="10" value="' . $_POST['RangeMax']. '" /></td>
+ </tr>';
+ }
+ echo '<tr>
+ <td>' . _('Show On Cert?') . ':</td>
+ <td><select name="ShowOnCert">';
+ if ($_POST['ShowOnCert']==1){
+ echo '<option selected="selected" value="1">' . _('Yes') . '</option>';
+ } else {
+ echo '<option value="1">' . _('Yes') . '</option>';
+ }
+ if ($_POST['ShowOnCert']==0){
+ echo '<option selected="selected" value="0">' . _('No') . '</option>';
+ } else {
+ echo '<option value="0">' . _('No') . '</option>';
+ }
+ echo '</select></td></tr><tr>
+ <td>' . _('Show On Spec?') . ':</td>
+ <td><select name="ShowOnSpec">';
+ if ($_POST['ShowOnSpec']==1){
+ echo '<option selected="selected" value="1">' . _('Yes') . '</option>';
+ } else {
+ echo '<option value="1">' . _('Yes') . '</option>';
+ }
+ if ($_POST['ShowOnSpec']==0){
+ echo '<option selected="selected" value="0">' . _('No') . '</option>';
+ } else {
+ echo '<option value="0">' . _('No') . '</option>';
+ }
+ echo '</select></td></tr><tr>
+ <td>' . _('Show On Test Plan?') . ':</td>
+ <td><select name="ShowOnTestPlan">';
+ if ($_POST['ShowOnTestPlan']==1){
+ echo '<option selected="selected" value="1">' . _('Yes') . '</option>';
+ } else {
+ echo '<option value="1">' . _('Yes') . '</option>';
+ }
+ if ($_POST['ShowOnTestPlan']==0){
+ echo '<option selected="selected" value="0">' . _('No') . '</option>';
+ } else {
+ echo '<option value="0">' . _('No') . '</option>';
+ }
+ echo '</select></td></tr><tr>
+ <td>' . _('Active?') . ':</td>
+ <td><select name="Active">';
+ if ($_POST['Active']==1){
+ echo '<option selected="selected" value="1">' . _('Yes') . '</option>';
+ } else {
+ echo '<option value="1">' . _('Yes') . '</option>';
+ }
+ if ($_POST['Active']==0){
+ echo '<option selected="selected" value="0">' . _('No') . '</option>';
+ } else {
+ echo '<option value="0">' . _('No') . '</option>';
+ }
+ echo '</select></td>
+ </tr>
+ </table>
+ <br />
+ <div class="centre">
+ <input type="submit" name="submit" value="' . _('Enter Information') . '" />
+ </div>
+ </div>
+ </form>';
+ }
+ if (isset($KeyValue)) {
+ echo '<div class="centre"><a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?ListTests=yes&KeyValue=' .$KeyValue .'">' . _('Add More Tests') . '</a></div>';
+ echo '<div class="centre"><a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?CopySpec=yes&KeyValue=' .$KeyValue .'">' . _('Copy This Specification') . '</a></div>';
+ echo '<div class="centre"><a target="_blank" href="'. $RootPath . '/PDFProdSpec.php?KeyValue=' .$KeyValue .'">' . _('Print Product Specification') . '</a></div>';
+ echo '<div class="centre"><a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') .'">' . _('Product Specification Main Page') . '</a></div>';
+ }
+} //end if record deleted no point displaying form to add record
+
+include('includes/footer.inc');
+?>
\ No newline at end of file
Added: trunk/QATests.php
===================================================================
--- trunk/QATests.php (rev 0)
+++ trunk/QATests.php 2014-12-16 20:55:46 UTC (rev 7026)
@@ -0,0 +1,488 @@
+<?php
+/* $Id: QATests.php 1 2014-09-08 10:42:50Z agaluski $*/
+
+include('includes/session.inc');
+$Title = _('QA Tests Maintenance');
+include('includes/header.inc');
+
+if (isset($_GET['SelectedQATest'])){
+ $SelectedQATest =mb_strtoupper($_GET['SelectedQATest']);
+} elseif(isset($_POST['SelectedQATest'])){
+ $SelectedQATest =mb_strtoupper($_POST['SelectedQATest']);
+}
+
+if (isset($Errors)) {
+ unset($Errors);
+}
+
+$Errors = array();
+
+echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $Title . '</p>';
+
+if (isset($_POST['submit'])) {
+
+ //initialise no input errors assumed initially before we test
+ $InputError = 0;
+
+ /* actions to take once the user has clicked the submit button
+ ie the page has called itself with some user input */
+ $i=1;
+
+ //first off validate inputs sensible
+
+ if (mb_strlen($_POST['QATestName']) > 50) {
+ $InputError = 1;
+ prnMsg(_('The QA Test name must be fifty characters or less long'),'error');
+ $Errors[$i] = 'QATestName';
+ $i++;
+ }
+
+ if (mb_strlen($_POST['Type']) =='') {
+ $InputError = 1;
+ prnMsg(_('The Type must not be blank'),'error');
+ $Errors[$i] = 'Type';
+ $i++;
+ }
+ $sql= "SELECT COUNT(*) FROM qatests WHERE qatests.name='".$_POST['QATestName']."'
+ AND qatests.testid <> '" .$SelectedQATest. "'";
+ $result = DB_query($sql,$db);
+ $myrow = DB_fetch_row($result);
+ if ($myrow[0]>0) {
+ $InputError = 1;
+ prnMsg(_('The QA Test name already exists'),'error');
+ $Errors[$i] = 'QATestName';
+ $i++;
+ }
+
+ if (isset($SelectedQATest) AND $InputError !=1) {
+
+ /*SelectedQATest 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 qatests SET name='" . $_POST['QATestName'] . "',
+ method='" . $_POST['Method'] . "',
+ groupby='" . $_POST['GroupBy'] . "',
+ units='" . $_POST['Units'] . "',
+ type='" . $_POST['Type'] . "',
+ defaultvalue='" . $_POST['DefaultValue'] . "',
+ numericvalue='" . $_POST['NumericValue'] . "',
+ showoncert='" . $_POST['ShowOnCert'] . "',
+ showonspec='" . $_POST['ShowOnSpec'] . "',
+ showontestplan='" . $_POST['ShowOnTestPlan'] . "',
+ active='" . $_POST['Active'] . "'
+ WHERE qatests.testid = '".$SelectedQATest."'";
+
+ $msg = _('QA Test record for') . ' ' . $_POST['QATestName'] . ' ' . _('has been updated');
+ } elseif ($InputError !=1) {
+
+ /*Selected group is null cos no item selected on first time round so must be adding a record must be submitting new entries in the new QA Test form */
+
+ $sql = "INSERT INTO qatests (name,
+ method,
+ groupby,
+ units,
+ type,
+ defaultvalue,
+ numericvalue,
+ showoncert,
+ showonspec,
+ showontestplan,
+ active)
+ VALUES ('" . $_POST['QATestName'] . "',
+ '" . $_POST['Method'] . "',
+ '" . $_POST['GroupBy'] . "',
+ '" . $_POST['Units'] . "',
+ '" .$_POST['Type'] . "',
+ '" . $_POST['DefaultValue'] . "',
+ '" . $_POST['NumericValue'] . "',
+ '" . $_POST['ShowOnCert'] . "',
+ '" . $_POST['ShowOnSpec'] . "',
+ '" . $_POST['ShowOnTestPlan'] . "',
+ '" . $_POST['Active'] . "'
+ )";
+
+ $msg = _('A new QA Test record has been added for') . ' ' . $_POST['QATestName'];
+ }
+ if ($InputError !=1) {
+ //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);
+
+ prnMsg($msg , 'success');
+
+ unset($SelectedQATest);
+ unset($_POST['QATestName']);
+ //unset($_POST['Method']);
+ //unset($_POST['GroupBy']);
+ //unset($_POST['Units']);
+ //unset($_POST['Type']);
+ unset($_POST['DefaultValue']);
+ unset($_POST['NumericValue']);
+ //unset($_POST['ShowOnCert']);
+ //unset($_POST['ShowOnSpec']);
+ //unset($_POST['ShowOnTestPlan']);
+ //unset($_POST['Active']);
+ }
+
+} 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 prodspec WHERE prodspec.testid='".$SelectedQATest."'";
+ //$result = DB_query($sql,$db);
+ //$myrow = DB_fetch_row($result);
+ if ($myrow[0]>0) {
+ prnMsg(_('Cannot delete this QA Test because Product Specs are using it'),'error');
+ } else {
+ $sql="DELETE FROM qatests WHERE testid='". $SelectedQATest."'";
+ $ErrMsg = _('The QA Test could not be deleted because');
+ $result = DB_query($sql,$db,$ErrMsg);
+
+ prnMsg(_('QA Test') . ' ' . $SelectedQATest . ' ' . _('has been deleted from the database'),'success');
+ unset ($SelectedQATest);
+ unset($delete);
+ unset ($_GET['delete']);
+ }
+}
+
+if (isset($SelectedQATest)) {
+ echo '<div class="centre"><a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">' . _('Show All QA Tests') . '</a></div>';
+}
+
+if (! isset($_GET['delete'])) {
+
+ echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">';
+ echo '<div>';
+ echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
+
+ if (isset($SelectedQATest)) {
+ //editing an existing Sales-person
+
+ $sql = "SELECT testid,
+ name,
+ method,
+ groupby,
+ units,
+ type,
+ defaultvalue,
+ numericvalue,
+ showoncert,
+ showonspec,
+ showontestplan,
+ active
+ FROM qatests
+ WHERE testid='".$SelectedQATest."'";
+
+ $result = DB_query($sql, $db);
+ $myrow = DB_fetch_array($result);
+
+ $_POST['SelectedQATest'] = $myrow['testid'];
+ $_POST['QATestName'] = $myrow['name'];
+ $_POST['Method'] = $myrow['method'];
+ $_POST['GroupBy'] = $myrow['groupby'];
+ $_POST['Type'] = $myrow['type'];
+ $_POST['Units'] = $myrow['units'];
+ $_POST['DefaultValue'] = $myrow['defaultvalue'];
+ $_POST['NumericValue'] = $myrow['numericvalue'];
+ $_POST['ShowOnCert'] = $myrow['showoncert'];
+ $_POST['ShowOnSpec'] = $myrow['showonspec'];
+ $_POST['ShowOnTestPlan'] = $myrow['showontestplan'];
+ $_POST['Active'] = $myrow['active'];
+
+
+ echo '<input type="hidden" name="SelectedQATest" value="' . $SelectedQATest . '" />';
+ echo '<input type="hidden" name="TestID" value="' . $_POST['SelectedQATest'] . '" />';
+ echo '<table class="selection">
+ <tr>
+ <td>' . _('QA Test ID') . ':</td>
+ <td>' . $_POST['SelectedQATest'] . '</td>
+ </tr>';
+
+ } else { //end of if $SelectedQATest only do the else when a new record is being entered
+
+ echo '<table class="selection">';
+
+ }
+ if (!isset($_POST['QATestName'])){
+ $_POST['QATestName']='';
+ }
+ if (!isset($_POST['Method'])){
+ $_POST['Method']='';
+ }
+ if (!isset($_POST['GroupBy'])){
+ $_POST['GroupBy']='';
+ }
+ if (!isset($_POST['Units'])){
+ $_POST['Units']='';
+ }
+ if (!isset($_POST['Type'])) {
+ $_POST['Type']=4;
+ }
+ if (!isset($_POST['Active'])) {
+ $_POST['Active']=1;
+ }
+ if (!isset($_POST['NumericValue'])) {
+ $_POST['NumericValue']=1;
+ }
+ if (!isset($_POST['ShowOnCert'])) {
+ $_POST['ShowOnCert']=1;
+ }
+ if (!isset($_POST['ShowOnSpec'])) {
+ $_POST['ShowOnSpec']=1;
+ }
+ if (!isset($_POST['ShowOnTestPlan'])) {
+ $_POST['ShowOnTestPlan']=1;
+ }
+ echo '<tr>
+ <td>' . _('QA Test Name') . ':</td>
+ <td><input type="text" '. (in_array('QATestName',$Errors) ? 'class="inputerror"' : '' ) .' name="QATestName" size="30" maxlength="50" value="' . $_POST['QATestName'] . '" /></td>
+ </tr>';
+ echo '<tr>
+ <td>' . _('Method') . ':</td>
+ <td><input type="text" name="Method" size="20" maxlength="20" value="' . $_POST['Method'] . '" /></td>
+ </tr>';
+ echo '<tr>
+ <td>' . _('Group By') . ':</td>
+ <td><input type="text" name="GroupBy" size="20" maxlength="20" value="' . $_POST['GroupBy'] . '" /></td>
+ </tr>';
+ echo '<tr>
+ <td>' . _('Units') . ':</td>
+ <td><input type="text" name="Units" size="20" maxlength="20" value="' . $_POST['Units'] . '" /></td>
+ </tr>';
+ echo '<tr>
+ <td>' . _('Type') . ':</td>
+ <td><select name="Type">';
+ if ($_POST['Type']==0){
+ echo '<option selected="selected" value="0">' . _('Text Box') . '</option>';
+ } else {
+ echo '<option Type="0">' . _('Text Box') . '</option>';
+ }
+ if ($_POST['Type']==1){
+ echo '<option selected="selected" value="1">' . _('Select Box') . '</option>';
+ } else {
+ echo '<option value="1">' . _('Select Box') . '</option>';
+ }
+ if ($_POST['Type']==2){
+ echo '<option selected="selected" value="2">' . _('Check Box') . '</option>';
+ } else {
+ echo '<option Type="2">' . _('Check Box') . '</option>';
+ }
+ if ($_POST['Type']==3){
+ echo '<option selected="selected" value="3">' . _('Date Box') . '</option>';
+ } else {
+ echo '<option value="3">' . _('Date Box') . '</option>';
+ }
+ if ($_POST['Type']==4){
+ echo '<option selected="selected" value="4">' . _('Range') . '</option>';
+ } else {
+ echo '<option value="4">' . _('Range') . '</option>';
+ }
+ echo '</select></td></tr><tr>
+ <td>' . _('Possible Values') . ':</td>
+ <td><input type="text" name="DefaultValue" size="50" maxlength="150" value="' . $_POST['DefaultValue']. '" /></td>
+ </tr>';
+
+ echo '<tr>
+ <td>' . _('Numeric Value?') . ':</td>
+ <td><select name="NumericValue">';
+ if ($_POST['NumericValue']==1){
+ echo '<option selected="selected" value="1">' . _('Yes') . '</option>';
+ } else {
+ echo '<option value="1">' . _('Yes') . '</option>';
+ }
+ if ($_POST['NumericValue']==0){
+ echo '<option selected="selected" value="0">' . _('No') . '</option>';
+ } else {
+ echo '<option value="0">' . _('No') . '</option>';
+ }
+ echo '</select></td></tr><tr>
+ <td>' . _('Show On Cert?') . ':</td>
+ <td><select name="ShowOnCert">';
+ if ($_POST['ShowOnCert']==1){
+ echo '<option selected="selected" value="1">' . _('Yes') . '</option>';
+ } else {
+ echo '<option value="1">' . _('Yes') . '</option>';
+ }
+ if ($_POST['ShowOnCert']==0){
+ echo '<option selected="selected" value="0">' . _('No') . '</option>';
+ } else {
+ echo '<option value="0">' . _('No') . '</option>';
+ }
+ echo '</select></td></tr><tr>
+ <td>' . _('Show On Spec?') . ':</td>
+ <td><select name="ShowOnSpec">';
+ if ($_POST['ShowOnSpec']==1){
+ echo '<option selected="selected" value="1">' . _('Yes') . '</option>';
+ } else {
+ echo '<option value="1">' . _('Yes') . '</option>';
+ }
+ if ($_POST['ShowOnSpec']==0){
+ echo '<option selected="selected" value="0">' . _('No') . '</option>';
+ } else {
+ echo '<option value="0">' . _('No') . '</option>';
+ }
+ echo '</select></td></tr><tr>
+ <td>' . _('Show On Test Plan?') . ':</td>
+ <td><select name="ShowOnTestPlan">';
+ if ($_POST['ShowOnTestPlan']==1){
+ echo '<option selected="se...
[truncated message content] |