Example #1
0
     $tool->setTypeID($_GET['ttyid']);
     $tool->createToolList();
     $sel = new selectlist($id, $tool->getToolList(), $label, 'Tool_ID', 'td', '', '');
     break;
 case 'holder':
     $holder = new Holder();
     $holder->createHolderList();
     $sel = new selectlist('Holder_ID', $holder->getHolderList(), 'Select Holder', 'Holder_ID', 'Holder_Description', '', '');
     break;
 case 'tmisc':
     $tmisc = new Tmisc();
     $tmisc->createTmiscList();
     $sel = new selectlist('ToolMisc_ID', $tmisc->getTmiscList(), 'Select Accessory', 'ToolMisc_ID', 'Misc_Desc', '', '');
     break;
 case 'toolbody':
     $toolbody = new Toolbody();
     if (isset($_GET['tdia'])) {
         $toolbody->setCdiameter($_GET['tdia']);
     }
     if (isset($_GET['ttyid'])) {
         $toolbody->setTypeID($_GET['ttyid']);
     }
     if (isset($_GET['tid'])) {
         $toolbody->setToolID($_GET['tid']);
     }
     if (isset($_GET['id'])) {
         $id = $_GET['id'];
     } else {
         $id = 'ToolBody_ID';
     }
     if (isset($_GET['filterinsert'])) {
Example #2
0
<?php

require_once 'autoload.php';
$_SESSION['LAST_ACTIVITY'] = time();
$toolbody = new Toolbody();
if (isset($_POST['tooldesc'])) {
    print_r($_POST);
    //print_r($_FILES);
    if (isset($_POST['ToolBody_ID'])) {
        $toolbody->setToolBodyID($_POST['ToolBody_ID']);
        $toolbodyid = $_POST['ToolBody_ID'];
    } else {
        $toolbodyid = '';
    }
    ///get tool_id if we are editing an existing tool.
    $toolbody->setToolDesc($_POST['tooldesc']);
    $toolbody->setMfgPartNO($_POST['mfgpartno']);
    $toolbody->setTypeID($_POST['ToolBody_Type_ID']);
    if (isset($_POST['cdiameter'])) {
        $toolbody->setCdiameter($_POST['cdiameter']);
    }
    if (isset($_POST['ndiameter'])) {
        $toolbody->setNdiameter($_POST['ndiameter']);
    }
    if (isset($_POST['sdiameter'])) {
        $toolbody->setSdiameter($_POST['sdiameter']);
    }
    if (isset($_POST['flutelength'])) {
        $toolbody->setFluteLength($_POST['flutelength']);
    }
    if (isset($_POST['reach'])) {
    {
        $insbody = array(2, 3, 4);
        $db = Database::getInstance();
        $cxn = $db->getConnection();
        if ($this->toolid != '') {
            $query = "SELECT tb.ToolBody_ID,CONCAT(Brand_Description,' Make ',Tool_Desc) as td FROM ToolBody_Insert as tbi\n\t\t\t\tINNER JOIN ToolBody as tb ON tb.ToolBody_ID=tbi.ToolBody_ID\n\t\t\t\tINNER JOIN Tool AS t ON t.Tool_ID=tbi.Tool_ID\n\t\t\t\tINNER JOIN Tool_Brand as tbr on tbr.Brand_ID=t.Brand_ID WHERE tbi.Tool_ID={$this->toolid}";
            //			print("$query<br>");
            if (!($res = $cxn->query($query))) {
                echo "error :", $cxn->error;
            } else {
                $rows = array();
                while ($r = mysqli_fetch_assoc($res)) {
                    $rows[] = $r;
                }
                $this->toolbodyinsertlist = json_encode($rows);
            }
        }
    }
    //end creatOperatorList function
    function getToolBodyInsertList()
    {
        return $this->toolbodyinsertlist;
    }
}
//end of class Tool
if (isset($_GET['bid']) && $_GET['bid'] != '') {
    $toolbody = new Toolbody();
    $toolbody->setBrandID($_GET['bid']);
    $toolbody->createToolBodyList();
    $sel = new selectlist('ToolBody_ID', $toolbody->getToolBodyList(), 'Select Tool Body', 'ToolBody_ID', 'td', '', '');
}
Example #4
0
    function showOpeToolUI()
    {
        $ttype = new TType();
        $ttype->createTypeList();
        $toolbody = new Toolbody();
        $toolbody->createToolBodyList();
        $holder = new Holder();
        $holder->createHolderList();
        if ($this->opedrawingid == '') {
            echo <<<_END
\t\t\t<fieldset>
\t\t\t\t<legend>Tool Details</legend>
\t\t\t\t<fieldset><legend>Preferred Tool </legend>
   \t\t\t\t<p>
     \t\t\t\t<label>Select Tool Type</label>
_END;
            $sel = new selectlist('Tool_Type_ID_1', $ttype->getTypeList(), 'Select Tool Type', 'Tool_Type_ID', 'Tool_Type', '', '', '');
            echo <<<_END
   \t\t\t\t</p>
   \t\t\t\t<p>
     \t\t\t\t<label>Tool Diameter</label>
     \t\t\t\t<input id="dia1" name="dia1" size="25" required/>
   \t\t\t\t</p>
   \t\t\t\t<p>
   \t\t\t\t<div id="tdia1"> </div>
   \t\t\t\t</p>
   \t\t\t\t<p>
     \t\t\t\t<div id="tbody1"> </div>
\t\t\t\t\t   <p>
\t\t   \t\t\t     <label>Tool Holder</label>
_END;
            $sel = new selectlist('Holder_ID_1', $holder->getHolderList(), 'Select Holder', 'Holder_ID', 'Holder_Description', '', '', '');
            echo <<<_END
\t
\t\t\t\t\t   </p>
\t\t\t\t\t   </fieldset>
\t\t\t\t<fieldset><legend>Alternate Tool </legend>
   \t\t\t\t<p>
     \t\t\t\t<label>Select Tool Type</label>
_END;
            $sel = new selectlist('Tool_Type_ID_2', $ttype->getTypeList(), 'Select Tool Type', 'Tool_Type_ID', 'Tool_Type', '', '', '');
            echo <<<_END
   \t\t\t\t</p>
   \t\t\t\t<p>
     \t\t\t\t<label>Tool Diameter</label>
     \t\t\t\t<input id="dia2" name="dia2" size="25"/>
   \t\t\t\t</p>
   \t\t\t\t<div id="tdia2"> </div>
   \t\t\t\t</p>

   \t\t\t\t<p>
     \t\t\t\t<div id="tbody2"> </div>
\t\t\t\t\t   <p>
\t\t   \t\t\t     <label>Tool Holder</label>
_END;
            $sel = new selectlist('Holder_ID_2', $holder->getHolderList(), 'Select Holder', 'Holder_ID', 'Holder_Description', '', '', '');
            echo <<<_END
\t
\t\t\t\t\t   </p>
\t\t\t\t\t   </fieldset>
\t\t\t\t\t   <fieldset><legend>Tool Working Details</legend>
\t\t\t\t\t   <p>
\t\t\t\t\t     <label>Tool Projection from Holder</label>
\t\t\t\t\t     <input id="tooloh" name="tooloh" size="25" class="required number"/>
\t\t\t\t\t   </p>
\t\t\t\t\t   <p>
\t\t\t\t\t     <label>Work Description</label>
\t\t\t\t\t     <input id="desc" name="desc" size="25" class="required"/>
\t\t\t\t\t   </p>
\t\t\t\t\t   <p>
\t\t\t\t\t     <label>Tool Cutting Time in mins</label>
\t\t\t\t\t     <input id="cuttingmins" name="cuttingmins" size="25" class="number"/>
\t\t\t\t\t   </p>
\t\t\t\t\t   <p>
\t\t\t\t\t     <label>Tool Life</label>
\t\t\t\t\t     <input id="toollife" name="toollife" size="25" />
\t\t\t\t\t   </p>
\t\t\t\t\t</fieldset>
\t\t\t\t</fieldset>
\t\t\t   <p>
\t\t\t     <input class="submit" type="submit" value="Save"/>
\t\t\t   </p>

_END;
        } else {
            $db = Database::getInstance();
            $cxn = $db->getConnection();
            $q = "SELECT * FROM Ope_Tool WHERE Ope_Drawing_ID={$this->opedrawingid} AND Deleted=0";
            //				print($q);
            if (!($res = $cxn->query($q))) {
                exit("error : {$cxn->error}");
            }
            $i = 0;
            if ($res->num_rows > 0) {
                print "<p>Tools Aded To this Operation</p>";
                print "<table border=\"1\" cellspacing=\"1\" bgcolor=\"#7FFFD4\">";
                print "<tr><th>Delete</th><th>Preferred Tool</th><th>Preferred Holder</th><th>Alternate Tool</th><th>Alternate Holder</th>\n\t\t\t\t\t\t\t<th>Description</th><th>Tool OH</th><th>Cutting Time</th><th>Tool Life</th></tr>";
                while ($row = mysqli_fetch_assoc($res)) {
                    print "<tr><td>";
                    print "<input type=\"checkbox\" name=\"tdel[{$i}]\" value=\"{$row['Ope_Tool_ID']}\" >\n\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"otid[{$i}]\" value=\"{$row['Ope_Tool_ID']}\"></td><td>";
                    //preferred tool
                    $q1 = "SELECT * FROM Tool WHERE Tool_ID={$row['Tool_ID_1']}";
                    $res1 = $cxn->query($q1);
                    $row1 = mysqli_fetch_assoc($res1);
                    $tool = new Tool();
                    $tool->setCdiameter($row1['Cutting_Dia']);
                    $tool->setTypeID($row1['Tool_Type_ID']);
                    $tool->createToolList();
                    print "<table><tr><td>";
                    $sel = new selectlist('tid1[' . $i . ']', $tool->getToolList(), 'Select Tool', 'Tool_ID', 'td', '', $row['Tool_ID_1']);
                    print "</td></tr>";
                    $toolbody = new Toolbody();
                    $toolbody->setToolID($row['Tool_ID_1']);
                    $toolbody->createToolBodyList();
                    print "<tr><td><div id=\"bd1{$i}\">";
                    $sel = new selectlist('tbid1[' . $i . ']', $toolbody->getToolBodyList(), 'Select Tool Body', 'ToolBody_ID', 'td', '', $row['ToolBody_ID_1']);
                    print "</div></td></tr>";
                    print "</table></td><td>";
                    //preferred holder
                    $holder = new Holder();
                    $holder->createHolderList();
                    $sel = new selectlist('hid1[' . $i . ']', $holder->getHolderList(), 'Select Holder', 'Holder_ID', 'Holder_Description', '', $row['Holder_ID_1']);
                    print "</td><td>";
                    //alternate tool
                    if ($row['Tool_ID_2'] != 0) {
                        $q2 = "SELECT * FROM Tool WHERE Tool_ID={$row['Tool_ID_2']}";
                    } else {
                        $q2 = "SELECT * FROM Tool WHERE Tool_ID={$row['Tool_ID_1']}";
                    }
                    $res2 = $cxn->query($q2);
                    $row2 = mysqli_fetch_assoc($res2);
                    $tool->setCdiameter($row2['Cutting_Dia']);
                    $tool->setTypeID($row2['Tool_Type_ID']);
                    $tool->createToolList();
                    print "<table><tr><td>";
                    $sel = new selectlist('tid2[' . $i . ']', $tool->getToolList(), 'Select Tool', 'Tool_ID', 'td', '', $row['Tool_ID_2']);
                    print "</td></tr>";
                    $toolbody2 = new Toolbody();
                    $toolbody2->setToolID($row['Tool_ID_2']);
                    $toolbody2->createToolBodyList();
                    print "<tr><td><div id=\"bd2{$i}\">";
                    $sel = new selectlist('tbid2[' . $i . ']', $toolbody2->getToolBodyList(), 'Select Tool Body', 'ToolBody_ID', 'td', '', $row['ToolBody_ID_2']);
                    print "</div></td></tr>";
                    print "</table></td><td>";
                    //alternate holder
                    $sel = new selectlist('hid2[' . $i . ']', $holder->getHolderList(), 'Select Holder', 'Holder_ID', 'Holder_Description', '', $row['Holder_ID_2']);
                    print "</td><td>";
                    print "<input type=\"text\" name=\"desc[{$i}]\" value=\"{$row['Ope_Tool_Desc']}\"></td>";
                    print "<td><input type=\"text\" name=\"toh[{$i}]\" size=\"5\" value=\"{$row['Ope_Tool_OH']}\"></td>";
                    print "<td><input type=\"text\" name=\"ct[{$i}]\" size=\"5\" value=\"{$row['Cutting_MIns']}\"></td>";
                    print "<td><input type=\"text\" name=\"tl[{$i}]\" size=\"5\" value=\"{$row['Ope_Tool_Life']}\"></td>";
                    $i++;
                }
                print "</table>\n\t\t\t\t\t   <p>\n\t\t\t\t\t     <input class=\"submit\" type=\"submit\" value=\"Save\"/><input type=\"button\" Value=\"Approve\" id=\"abutton\"><input name=\"appremarks\" size=\"50\" id=\"appremarks\">\n\t\t\t\t\t   </p>";
            } else {
                print "<p>No Tools Added for This Operation!!</p>";
            }
        }
    }
Example #5
0
    function showToolUI()
    {
        if ($this->toolid == '') {
            echo <<<_END
\t\t\t<fieldset>
\t\t\t\t<legend>Tool Details</legend>

   \t\t\t\t<p>
     \t\t\t\t<label>Tool Description</label>
     \t\t\t\t<input id="tooldesc" name="tooldesc" size="25" required/>
     \t\t\t\t<input id="tbodyinsert" name="tbodyinsert" type="hidden">
   \t\t\t\t</p>

   \t\t\t\t<p>
     \t\t\t\t<label>Manufacturres's Part NO</label>
     \t\t\t\t<input id="mfgpartno" name="mfgpartno" size="25" required/>
   \t\t\t\t</p>
_END;
            if ($this->typeid != 18) {
                echo <<<_END
   \t\t\t\t<p>
\t\t\t     <label>Cutting Dia (Dc)</label>
\t\t\t     <input id="cdiameter" name="cdiameter" size="25" class="number"/>
\t\t\t   </p>
\t\t\t   <p>
\t\t\t     <label>Shank Diameter (Ds)</label>
\t\t\t     <input id="sdiameter" name="sdiameter" size="25" class="number"/>
\t\t\t   </p>
_END;
                if ($this->typeid != 3) {
                    echo <<<_END
\t\t   \t\t\t\t<p>
\t\t\t\t\t     <label>Neck Diameter (Dn)</label>
\t\t\t\t\t     <input id="ndiameter" name="ndiameter" size="25" class="number"/>
\t\t\t\t\t   </p>
_END;
                }
                echo <<<_END
\t\t  \t\t\t   <p>
\t\t\t\t\t     <label>Neck Length/Reach (NL)</label>
\t\t\t\t\t     <input id="reach" name="reach" size="25" class="number greaterThan" data-min="flutelength"/>
\t\t\t\t\t   </p>



\t\t\t   <p>
\t\t\t     <label>Flute Length (FL)</label>
\t\t\t     <input id="flutelength" name="flutelength" size="25"  class="required number"/>
\t\t\t   </p>
\t\t\t   <p>
\t\t\t     <label>Overall Length (OAL)</label>
\t\t\t     <input id="tooloal" name="tooloal" size="25" class="number greaterThan" data-min="flutelength" data-min="reach"/>
\t\t\t   </p>

_END;
                if ($this->typeid == 9) {
                    echo <<<_END
\t\t\t   <p>
\t\t\t     <label>Max Radial Depth (Tmax)</label>
\t\t\t     <input id="tmax" name="tmax" size="25" class="number" class="required"/>
\t\t\t   </p>
_END;
                }
                echo <<<_END


\t\t\t   <p>
\t\t\t     <label>Tool Material</label>
\t\t\t     <input type="text" id="toolmaterial" name="toolmaterial" size="25"/>
\t\t\t   </p>

_END;
            }
            if ($this->typeid != 3) {
                echo <<<_END

\t\t\t\t\t   <p>
\t\t   \t\t\t     <label>Corner Radius (CRR)</label>
\t\t\t\t\t     <input id="cornerradius" name="cornerradius" size="25" class="number"/>
\t\t\t\t\t   </p>
\t\t\t\t\t   <p>
\t\t\t\t\t     <label>Corner Chamfer (CHL)</label>
\t\t\t\t\t     <input id="cornerchamfer" name="cornerchamfer" size="25" class="number"/>
\t\t\t\t\t   </p>
\t\t\t\t\t   <p>
\t\t\t\t\t     <label>Chamfer Angle (CHA)</label>
\t\t\t\t\t     <input id="chamferangle" name="chamferangle" size="25" class="number"/>
\t\t\t\t\t   </p>
_END;
            }
            echo <<<_END
\t\t\t   <p>
\t\t\t     <label>No Of Cutting Edges</label>
\t\t\t     <input id="noofflutes" name="noofflutes" size="25" class="required number"/>
\t\t\t   </p>

\t\t\t   <p>
\t\t\t     <label>Coating</label>
\t\t\t     <input type="text" id="coating" name="coating" size="25"/>
\t\t\t   </p>
\t\t\t   <p>
\t\t\t     <label>Tool Remarks</label>
\t\t\t     <input id="toolremarks" name="toolremarks" size="25"/>
\t\t\t   </p>
\t\t\t   <p>
\t\t\t     <label>Min Stock Qty</label>
\t\t\t     <input id="minimumstock" name="minimumstock" size="25" class="number"/>
\t\t\t   </p>
\t\t      <p>
\t\t\t    <label>Select Tool Preview Image/File</label>
\t\t\t\t<input name="preview[]" type="file" multiple="true"/>
   \t\t\t\t</p>

\t\t\t\t</fieldset>
\t\t\t   <p>
\t\t\t     <input class="submit" type="submit" value="Save"/>
\t\t\t   </p>
_END;
        } else {
            $db = Database::getInstance();
            $cxn = $db->getConnection();
            $q = "SELECT * FROM Tool WHERE Tool_ID={$this->toolid}";
            if (!($res = $cxn->query($q))) {
                echo "error :", $cxn->error;
            } else {
                $row = mysqli_fetch_assoc($res);
                $ttype = new TType();
                $ttype->createTypeList();
                $toolbody = new Toolbody();
                $toolbody->setBrandID($row['Brand_ID']);
                $toolbody->createToolBodyList();
                echo <<<_END
\t\t\t<fieldset>
\t\t\t\t<legend>Tool Details</legend>
   \t\t\t\t<p>
     \t\t\t\t<label>Tool Type</label>
_END;
                $sel = new selectlist('Tool_Type_ID_E', $ttype->getTypeList(), 'Select Tool Type', 'Tool_Type_ID', 'Tool_Type', '', $row['Tool_Type_ID']);
                if ($row['Tool_Type_ID'] == 18) {
                    print '<input id="tbodyinsert" name="tbodyinsert" type="hidden">';
                    print "<p><label>Tool Type</label>";
                    print "<table><tr><td>";
                    $sel = new selectlist('ToolBody_ID', $toolbody->getToolBodyList(), 'Select Tool Body', 'ToolBody_ID', 'td', '', '');
                    print "</td><td><input type=\"button\" id=\"tbadd\" value=\"Add\"></td></tr></table>";
                    self::listToolBodyforInsert();
                }
                echo <<<_END
   \t\t\t\t</p>
   \t\t\t\t<p>
   \t\t\t\t<label>Tool ID</label>{$this->toolid}
   \t\t\t\t</p>
   \t\t\t\t<p>
     \t\t\t\t<label>Tool Description</label>
     \t\t\t\t<input id="tooldesc" name="tooldesc" size="25" required value="{$row['Tool_Desc']}"/>
   \t\t\t\t</p>

   \t\t\t\t<p>
     \t\t\t\t<label>Manufacturres's Part NO</label>
     \t\t\t\t<input id="mfgpartno" name="mfgpartno" size="25" required value="{$row['Mfg_Part_NO']}"/>
   \t\t\t\t</p>
_END;
                if ($this->typeid != 18) {
                    echo <<<_END
   \t\t\t\t<p>
\t\t\t     <label>Cutting Dia (Dc)</label>
\t\t\t     <input id="cdiameter" name="cdiameter" size="25" class="number" value="{$row['Cutting_Dia']}"/>
\t\t\t   </p>
\t\t\t   <p>
\t\t\t     <label>Shank Diameter (Ds)</label>
\t\t\t     <input id="sdiameter" name="sdiameter" size="25" class="number" value="{$row['Shank_Dia']}"/>
\t\t\t   </p>
_END;
                    if ($this->typeid != 3) {
                        echo <<<_END

   \t\t\t\t<p>
\t\t\t     <label>Neck Diameter (Dn)</label>
\t\t\t     <input id="ndiameter" name="ndiameter" size="25" class="number" value="{$row['Neck_Dia']}"/>
\t\t\t   </p>
_END;
                    }
                    echo <<<_END
\t\t\t   <p>
\t\t\t     <label>Flute Length (FL)</label>
\t\t\t     <input id="flutelength" name="flutelength" size="25"  class="required number" value="{$row['Tool_FL']}"/>
\t\t\t   </p>
\t\t\t   <p>
\t\t\t     <label>Neck Length/Reach (NL)</label>
\t\t\t     <input id="reach" name="reach" size="25" class="number greaterThan" data-min="flutelength" value="{$row['Neck_Length']}"/>
\t\t\t   </p>
\t\t\t   <p>
\t\t\t     <label>Overall Length (OAL)</label>
\t\t\t     <input id="tooloal" name="tooloal" size="25" class="number greaterThan" data-min="flutelength" data-min="reach" value="{$row['Tool_OAL']}"/>
\t\t\t   </p>
_END;
                    if ($this->typeid == 9) {
                        echo <<<_END
\t\t\t   <p>
\t\t\t     <label>Max Radial Depth (Tmax)</label>
\t\t\t     <input id="tmax" name="tmax" size="25" class="number" class="required" value="{$row['T_Max']}"/>
\t\t\t   </p>
_END;
                    }
                    echo <<<_END

\t\t\t   <p>
\t\t\t     <label>Tool Material</label>
\t\t\t     <input type="text" id="toolmaterial" name="toolmaterial" size="25" value="{$row['Material']}"/>
\t\t\t   </p>
_END;
                }
                if ($this->typeid != 3) {
                    echo <<<_END
\t\t\t   <p>
\t\t\t     <label>Corner Radius (CRR)</label>
\t\t\t     <input id="cornerradius" name="cornerradius" size="25" class="number" value="{$row['Corner_Rad']}"/>
\t\t\t   </p>
\t\t\t   <p>
\t\t\t     <label>Corner Chamfer (CHL)</label>
\t\t\t     <input id="cornerchamfer" name="cornerchamfer" size="25" class="number" value="{$row['Corner_Chamfer']}"/>
\t\t\t   </p>
\t\t\t   <p>
\t\t\t     <label>Chamfer Angle (CHA)</label>
\t\t\t     <input id="chamferangle" name="chamferangle" size="25" class="number" value="{$row['Chamfer_Angle']}"/>
\t\t\t   </p>
_END;
                }
                echo <<<_END
\t\t\t   <p>
\t\t\t     <label>No Of Cutting Edges</label>
\t\t\t     <input id="noofflutes" name="noofflutes" size="25" class="required number" value="{$row['No_Of_Edges']}"/>
\t\t\t   </p>
\t\t\t   <p>
\t\t\t     <label>Coating</label>
\t\t\t     <input type="text" id="coating" name="coating" size="25" value="{$row['Tool_Coating']}"/>
\t\t\t   </p>

\t\t\t   <p>
\t\t\t     <label>Tool Remarks</label>
\t\t\t     <input id="toolremarks" name="toolremarks" size="25" value="{$row['Tool_Remarks']}"/>
\t\t\t   </p>
\t\t\t   <p>
\t\t\t     <label>Min Stock Qty</label>
\t\t\t     <input id="minimumstock" name="minimumstock" size="25" class="number" value="{$row['Min_Stock_Qty']}"/>
\t\t\t   </p>
\t\t      <p>
\t\t\t    <label>Select Tool Preview Image/File</label>
\t\t\t\t<input name="preview[]" type="file" multiple="true"/>
   \t\t\t\t</p>

\t\t\t\t</fieldset>
\t\t\t   <p>
\t\t\t     <input class="submit" type="submit" value="Save"/>
\t\t\t   </p>


_END;
                self::listPreviewImage();
            }
        }
    }
Example #6
0
    function showTmiscUI()
    {
        if ($this->tmiscid == '') {
            echo <<<_END
\t\t\t<fieldset>
\t\t\t\t<legend>Tool Accessory Details</legend>
   \t\t\t\t<p>
     \t\t\t\t<label>Accessory Type</label>
\t\t\t     <select id="type" name="type" class="required">
\t\t\t     \t<option value="">Select Accessory Type</option>
\t\t\t     \t<option value="Screw">Screw</option>
\t\t\t     \t<option value="Wrench">Wrench</option>
\t\t\t     </select>

   \t\t\t\t</p>
   \t\t\t\t<p>
     \t\t\t\t<label>Description</label>
     \t\t\t\t<input id="desc" name="desc" size="25" required/>
   \t\t\t\t</p>

   \t\t\t\t<p>
     \t\t\t\t<label>Manufacturres's Part NO</label>
     \t\t\t\t<input id="mfgpartno" name="mfgpartno" size="25" required/>
   \t\t\t\t</p>
\t\t\t     <label>Remarks</label>
\t\t\t     <input id="remarks" name="remarks" size="25"/>
\t\t\t   </p>
\t\t\t   <p>
\t\t\t     <label>Price</label>
\t\t\t     <input id="price" name="price" size="25" class="number"/>
\t\t\t   </p>
\t\t\t   <p>
\t\t\t     <label>Min Stock Qty</label>
\t\t\t     <input id="minimumstock" name="minimumstock" size="25" class="number"/>
\t\t\t   </p>

\t\t\t\t</fieldset>
\t\t\t   <p>
\t\t\t     <input class="submit" type="submit" value="Save"/>
\t\t\t   </p>
_END;
        } else {
            $db = Database::getInstance();
            $cxn = $db->getConnection();
            $q = "SELECT * FROM ToolMisc WHERE ToolMisc_ID={$this->tmiscid}";
            $tbody = new Toolbody();
            $tbody->createToolBodyList();
            if (!($res = $cxn->query($q))) {
                echo "error :", $cxn->error;
            } else {
                $row = mysqli_fetch_assoc($res);
                switch ($row['Type']) {
                    case 'Screw':
                        $opt = '<option value="">Select Accessory</option>
			     					<option value="Screw" selected="selected">Screw</option>
			     					<option value="Wrench">Wrench</option>';
                        break;
                    case 'Wrench':
                        $opt = '<option value="">Select Accessory</option>
			     					<option value="Screw" >Screw</option>
			     					<option value="Wrench" selected="selected">Wrench</option>';
                        break;
                    default:
                        $opt = '<option value=""  selected="selected">Select Accessory</option>
			     					<option value="Screw">Screw</option>
			     					<option value="Wrench">Wrench</option>';
                        break;
                }
                echo <<<_END
\t\t\t<fieldset>
\t\t\t\t<legend>Tool Accessory Details</legend>
\t\t\t\t<p>
\t\t\t\t<label>Select Tool Body</label>
_END;
                $sel = new selectlist('ToolBody_ID_E', $tbody->getToolBodyList(), 'Select Tool Body', 'ToolBody_ID', 'td', '', $row['ToolBody_ID']);
                echo <<<_END
\t\t\t\t</p>
\t\t\t\t<p>
     \t\t\t\t<label>Accessory Type</label>
\t\t\t     <select id="type" name="type" class="required">
\t\t\t\t\t{$opt};
\t\t\t     </select>

   \t\t\t\t</p>
   \t\t\t\t<p>
     \t\t\t\t<label>Description</label>
     \t\t\t\t<input id="desc" name="desc" size="25" required value="{$row['Misc_Desc']}"/>
   \t\t\t\t</p>

   \t\t\t\t<p>
     \t\t\t\t<label>Manufacturres's Part NO</label>
     \t\t\t\t<input id="mfgpartno" name="mfgpartno" size="25" required value="{$row['Mfg_Part_NO']}"/>
   \t\t\t\t</p>
\t\t\t     <label>Remarks</label>
\t\t\t     <input id="remarks" name="remarks" size="25" value="{$row['Remarks']}"/>
\t\t\t   </p>
\t\t\t   <p>
\t\t\t     <label>Price</label>
\t\t\t     <input id="price" name="price" size="25" class="number" value="{$row['Price']}"/>
\t\t\t   </p>
\t\t\t   <p>
\t\t\t     <label>Min Stock Qty</label>
\t\t\t     <input id="minimumstock" name="minimumstock" size="25" class="number" value="{$row['Min_Stock_Qty']}"/>
\t\t\t   </p>

\t\t\t\t</fieldset>
\t\t\t   <p>
\t\t\t     <input class="submit" type="submit" value="Save"/>
\t\t\t   </p>


_END;
            }
        }
    }