示例#1
0
    function showActivityUI()
    {
        $db = Database::getInstance();
        $cxn = $db->getConnection();
        if ($this->activitylogid == '') {
            $qm = "SELECT DATE_FORMAT(End_Date_Time,'%d-%m-%Y %h:%i%p') as edtt,End_Date_Time FROM ActivityLog WHERE Machine_ID={$this->machineid} AND Activity_ID NOT IN(10,15) ORDER By End_Date_Time DESC LIMIT 1";
            if (!($resm = $cxn->query($qm))) {
                exit("error (showActivityUI) {$qm} : {$cxn->error}");
            }
            $rowm = mysqli_fetch_assoc($resm);
            if ($this->activityid == 8) {
                echo <<<_END
\t   \t\t\t\t<p>
\t     \t\t\t\t<label>Start Date and Time</label>
\t     \t\t\t\t<input id="sdt" name="sdt" class="required" value="{$rowm['edtt']}"/>
\t     \t\t\t\t<input id="sdtdb" name="sdtdb" type="hidden" value="{$rowm['End_Date_Time']}">
\t   \t\t\t\t</p>
\t   \t\t\t\t<p>
\t     \t\t\t\t<label>End Date and Time</label>
\t     \t\t\t\t<input id="edt" name="edt" class="required"/>
\t     \t\t\t\t<input id="edtdb" name="edtdb" type="hidden">
\t   \t\t\t\t</p>
\t   \t\t\t\t<p>
\t     \t\t\t\t<label>Remarks</label>
\t     \t\t\t\t<textarea id="remarks" name="remarks" rows="5" cols="40"  maxlength="300"> </textarea>
\t   \t\t\t\t</p>
\t   \t\t\t\t</fieldset>
\t\t\t\t           <input class="submit" type="submit" value="Save"/>
_END;
                exit;
            }
            $q = "SELECT Batch_Remarks FROM Batch_NO as bn \n\t\t\t\tINNER JOIN BNo_MI_Challans as bmc ON bmc.Batch_ID=bn.Batch_ID\n\t\t\t\tINNER JOIN MI_Drg_Qty as midq ON midq.Mi_Drg_Qty_ID=bmc.Mi_Drg_Qty_ID\n\t\t\t\tWHERE bn.Batch_ID={$this->batchid}";
            if (!($res = $cxn->query($q))) {
                echo "error (showActivityUI2) {$q} :", $cxn->error;
                exit;
            }
            $row = mysqli_fetch_assoc($res);
            if (in_array($this->activityid, $this->production)) {
                echo <<<_END
\t\t\t\t\t<p>Batch Remarks {$row['Batch_Remarks']}</p>
\t\t\t\t\t<fieldset>
\t\t\t\t\t\t<legend>Activity Details</legend>
\t   \t\t\t\t<p>
\t     \t\t\t\t<label>Start Date and Time</label>
\t     \t\t\t\t<input id="sdt" name="sdt" class="required" value="{$rowm['edtt']}"/>
\t     \t\t\t\t<input id="sdtdb" name="sdtdb" type="hidden" value="{$rowm['End_Date_Time']}">
\t   \t\t\t\t</p>
\t   \t\t\t\t<p>
\t     \t\t\t\t<label>End Date and Time</label>
\t     \t\t\t\t<input id="edt" name="edt" class="required"/>
\t     \t\t\t\t<input id="edtdb" name="edtdb" type="hidden">
\t   \t\t\t\t</p>
_END;
                if ($this->operationid != '') {
                    $qo = "SELECT Program_NO FROM Operation WHERE Operation_ID={$this->operationid}";
                    if (!($reso = $cxn->query($qo))) {
                        echo "error (showActivityUI3) {$qo} :", $cxn->error;
                        exit;
                    }
                    $rowo = mysqli_fetch_assoc($reso);
                    $this->programno = $rowo['Program_NO'];
                }
                echo <<<_END
\t   \t\t\t\t<p>
\t     \t\t\t\t<label>Program No</label>
\t     \t\t\t\t<input id="programno" name="programno" class="required" value="{$this->programno}"/>
\t   \t\t\t\t</p>
\t   \t\t\t\t<p>
\t     \t\t\t\t<label>Quantity</label>
\t     \t\t\t\t<input id="quantity" name="quantity" class="required number"/>
\t   \t\t\t\t</p>
\t   \t\t\t\t<p>
\t     \t\t\t\t<label>Remarks</label>
\t     \t\t\t\t<textarea id="remarks" name="remarks" rows="5" cols="40"  maxlength="300"> </textarea>
\t   \t\t\t\t</p>
\t   \t\t\t\t</fieldset>
_END;
            }
            if (in_array($this->activityid, $this->nonproduction)) {
                echo <<<_END
\t\t\t\t\t<p>Batch Remarks {$row['Batch_Remarks']}</p>
\t\t\t\t\t<fieldset>
\t\t\t\t\t<legend>Activity Details</legend>
\t   \t\t\t\t<p>
\t     \t\t\t\t<label>Operation Details</label>
\t     \t\t\t\t<input id="operationdesc" name="operationdesc" class="required"/>
\t   \t\t\t\t</p>
\t   \t\t\t\t<p>
\t     \t\t\t\t<label>Start Date and Time</label>
\t     \t\t\t\t<input id="sdt" name="sdt" class="required" value="{$rowm['edtt']}"/>
\t     \t\t\t\t<input id="sdtdb" name="sdtdb" type="hidden" value="{$rowm['End_Date_Time']}">
\t   \t\t\t\t</p>
\t   \t\t\t\t<p>
\t     \t\t\t\t<label>End Date and Time</label>
\t     \t\t\t\t<input id="edt" name="edt" class="required"/>
\t     \t\t\t\t<input id="edtdb" name="edtdb" type="hidden">
\t   \t\t\t\t</p>
\t   \t\t\t\t<p>
\t     \t\t\t\t<label>Program No</label>
\t     \t\t\t\t<input id="programno" name="programno" class="required"/>
\t   \t\t\t\t</p>
\t   \t\t\t\t<p>
\t     \t\t\t\t<label>Quantity</label>
\t     \t\t\t\t<input id="quantity" name="quantity" class="required number"/>
\t   \t\t\t\t</p>
\t   \t\t\t\t<p>
\t     \t\t\t\t<label>Remarks</label>
\t     \t\t\t\t<textarea id="remarks" name="remarks" rows="5" cols="40"  maxlength="300"> </textarea>
\t   \t\t\t\t</p>
\t   \t\t\t\t</fieldset>
_END;
            }
        } else {
            $q = "SELECT Activity_ID,Operator_ID FROM ActivityLog WHERE Activity_Log_ID={$this->activitylogid}";
            if (!($res = $cxn->query($q))) {
                echo "error :", $cxn->error;
                exit;
            }
            $row = mysqli_fetch_assoc($res);
            $this->activityid = $row['Activity_ID'];
            if ($_SESSION['operatorid'] != $row['Operator_ID'] && !in_array($_SESSION['operatorid'], $this->editauth)) {
                print "Error You Can Edit only Your Log!!";
                exit;
            }
            if (in_array($this->activityid, $this->production)) {
                $qe = "SELECT cust.Customer_ID,Machine_ID,comp.Drawing_ID,ope.Operation_ID,Batch_ID,Operator_ID,prod.Program_NO,Quantity,Remarks,actl.Activity_ID,\n\t\t\t\t\t\tDATE_FORMAT(Start_Date_Time,'%d-%m-%Y %h:%i%p') as sdte,Start_Date_Time,DATE_FORMAT(End_Date_Time,'%d-%m-%Y %h:%i%p') as edte,End_Date_Time FROM ActivityLog as actl \n\t\t\t\t\t\tINNER JOIN Production AS prod ON prod.Activity_Log_ID=actl.Activity_Log_ID\n\t\t\t\t\t\tINNER JOIN Operation as ope ON ope.Operation_ID=prod.Operation_ID\n\t\t\t\t\t\tINNER JOIN Component as comp ON comp.Drawing_ID=ope.Drawing_ID\n\t\t\t\t\t\tINNER JOIN Customer as cust ON cust.Customer_ID=comp.Customer_ID WHERE actl.Activity_Log_ID={$this->activitylogid}";
                //print("<br>$qe");
                if (!($rese = $cxn->query($qe))) {
                    echo "error :", $cxn->error;
                    exit;
                }
                $rowe = mysqli_fetch_assoc($rese);
                $ac = new Activity();
                $ac->setActivityID($rowe['Activity_ID']);
                $ac->createActivityList();
                $sel = new selectlist('Activity_ID', $ac->getActivityList(), 'Select Activity', 'Activity_ID', 'Activity_Name', 'class="required"', $rowe['Activity_ID'], '1');
                $mc = new Machine();
                $mc->createMachineList();
                $sel = new selectlist('Machine_ID', $mc->getMachineList(), 'Select Machine', 'Machine_ID', 'mnslno', 'class="required"', $rowe['Machine_ID'], '1');
                $cust = new Customer();
                $cust->createCustomerList();
                $sel = new selectlist('Customer_ID', $cust->getCustomerList(), 'Select Customer', 'Customer_ID', 'Customer_Name_Short', 'class="required"', $rowe['Customer_ID'], '1');
                $part = new Part();
                $part->createPartList($rowe['Customer_ID']);
                $req = 'class=required';
                echo '<div id="drawe">';
                $selc = new selectlist('Drawing_ID', $part->getPartList(), 'Select Drawing', 'Drawing_ID', 'name', 'class="required"', $rowe['Drawing_ID'], '1');
                echo '</div>';
                $ope = new Operation();
                $ope->createOperationList($rowe['Drawing_ID']);
                echo '<div id="operatione">';
                $sel = new selectlist('Operation_ID', $ope->getOperationList(), 'Select Operation', 'Operation_ID', 'Operation_Desc', 'class="required"', $rowe['Operation_ID'], '1');
                echo '</div>';
                $operator = new Operator();
                $operator->createOperatorList();
                $sel = new selectlist("Operator_ID", $operator->getOperatorList(), 'Select Name', 'Operator_ID', 'Operator_Name', 'class="required"', $rowe['Operator_ID'], '1');
                $bn = new Batch();
                $bn->setPartID($rowe['Drawing_ID']);
                $bn->createBatchList();
                echo '<div id="batche">';
                $sel = new selectlist('Batch_ID', $bn->getBatchList(), 'Select Batch', 'Batch_ID', 'Mfg_Batch_NO', 'class="required"', $rowe['Batch_ID'], '1');
                echo '</div>';
                echo <<<_END
\t\t\t\t\t\t<fieldset>
\t\t\t\t\t\t<legend>Activity Details</legend>

\t\t   \t\t\t\t<p>
\t\t     \t\t\t\t<label>Start Date and Time</label>
\t\t     \t\t\t\t<input id="sdt" name="sdt" rclass="equired" value="{$rowe['sdte']}"/>
\t\t     \t\t\t\t<input id="sdtdb" name="sdtdb" type="hidden" value="{$rowe['Start_Date_Time']}">
\t\t   \t\t\t\t</p>
\t\t   \t\t\t\t<p>
\t\t     \t\t\t\t<label>End Date and Time</label>
\t\t     \t\t\t\t<input id="edt" name="edt" class="required" value="{$rowe['edte']}"/>
\t\t     \t\t\t\t<input id="edtdb" name="edtdb" type="hidden" value="{$rowe['End_Date_Time']}">
\t\t   \t\t\t\t</p>
\t\t   \t\t\t\t<p>
\t\t     \t\t\t\t<label>Program No</label>
\t\t     \t\t\t\t<input id="programno" name="programno" class="required" value="{$rowe['Program_NO']}"/>
\t\t   \t\t\t\t</p>
\t\t   \t\t\t\t<p>
\t\t     \t\t\t\t<label>Quantity</label>
\t\t     \t\t\t\t<input id="quantity" name="quantity" class="required number" value="{$rowe['Quantity']}"/>
\t\t   \t\t\t\t</p>
\t\t   \t\t\t\t<p>
\t\t     \t\t\t\t<label>Remarks</label>
\t\t     \t\t\t\t<textarea id="remarks" name="remarks" rows="5" cols="40"  maxlength="300">{$rowe['Remarks']}</textarea>
\t\t   \t\t\t\t</p>
\t\t   \t\t\t\t</fieldset>
_END;
            }
            if (in_array($this->activityid, $this->nonproduction)) {
                $qe = "SELECT cust.Customer_ID,Machine_ID,comp.Drawing_ID,Operation_Description,Batch_ID,Operator_ID,prod.Program_NO,Quantity,Remarks,actl.Activity_ID,\n\t\t\t\t\t\tDATE_FORMAT(Start_Date_Time,'%d-%m-%Y %h:%i%p') as sdte,Start_Date_Time,DATE_FORMAT(End_Date_Time,'%d-%m-%Y %h:%i%p') as edte,End_Date_Time FROM ActivityLog as actl \n\t\t\t\t\t\tINNER JOIN NonProduction AS prod ON prod.Activity_Log_ID=actl.Activity_Log_ID\n\t\t\t\t\t\tINNER JOIN Component as comp ON comp.Drawing_ID=prod.Drawing_ID\n\t\t\t\t\t\tINNER JOIN Customer as cust ON cust.Customer_ID=comp.Customer_ID WHERE actl.Activity_Log_ID={$this->activitylogid}";
                //print("<br>$qe");
                if (!($rese = $cxn->query($qe))) {
                    echo "error :", $cxn->error;
                    exit;
                }
                $rowe = mysqli_fetch_assoc($rese);
                $ac = new Activity();
                $ac->setActivityID($rowe['Activity_ID']);
                $ac->createActivityList();
                $sel = new selectlist('Activity_ID', $ac->getActivityList(), 'Select Activity', 'Activity_ID', 'Activity_Name', 'class="required"', $rowe['Activity_ID']);
                $mc = new Machine();
                $mc->createMachineList();
                $sel = new selectlist('Machine_ID', $mc->getMachineList(), 'Select Machine', 'Machine_ID', 'mnslno', 'class="required"', $rowe['Machine_ID']);
                $cust = new Customer();
                $cust->createCustomerList();
                $sel = new selectlist('Customer_ID', $cust->getCustomerList(), 'Select Customer', 'Customer_ID', 'Customer_Name_Short', 'class="required"', $rowe['Customer_ID']);
                $part = new Part();
                $part->createPartList($rowe['Customer_ID']);
                $req = 'class=required';
                echo '<div id="drawe">';
                $selc = new selectlist('Drawing_ID', $part->getPartList(), 'Select Drawing', 'Drawing_ID', 'name', 'class="required"', $rowe['Drawing_ID']);
                echo '</div>';
                $operator = new Operator();
                $operator->createOperatorList();
                $sel = new selectlist("Operator_ID", $operator->getOperatorList(), 'Select Name', 'Operator_ID', 'Operator_Name', 'class="required"', $rowe['Operator_ID']);
                $bn = new Batch();
                $bn->setPartID($rowe['Drawing_ID']);
                $bn->createBatchList();
                echo '<div id="batche">';
                $sel = new selectlist('Batch_ID', $bn->getBatchList(), 'Select Batch', 'Batch_ID', 'Mfg_Batch_NO', 'class="required"', $rowe['Batch_ID']);
                echo '</div>';
                echo <<<_END
\t\t\t\t\t\t<fieldset>
\t\t\t\t\t\t<legend>Activity Details</legend>
\t\t   \t\t\t\t<p>
\t\t     \t\t\t\t<label>Operation Details</label>
\t\t     \t\t\t\t<input id="operationdesc" name="operationdesc" class="required" value="{$rowe['Operation_Description']}"/>
\t\t   \t\t\t\t</p>
\t\t   \t\t\t\t<p>
\t\t     \t\t\t\t<label>Start Date and Time</label>
\t\t     \t\t\t\t<input id="sdt" name="sdt" rclass="equired" value="{$rowe['sdte']}"/>
\t\t     \t\t\t\t<input id="sdtdb" name="sdtdb" type="hidden" value="{$rowe['Start_Date_Time']}">
\t\t   \t\t\t\t</p>
\t\t   \t\t\t\t<p>
\t\t     \t\t\t\t<label>End Date and Time</label>
\t\t     \t\t\t\t<input id="edt" name="edt" class="required" value="{$rowe['edte']}"/>
\t\t     \t\t\t\t<input id="edtdb" name="edtdb" type="hidden" value="{$rowe['End_Date_Time']}">
\t\t   \t\t\t\t</p>
\t\t   \t\t\t\t<p>
\t\t     \t\t\t\t<label>Program No</label>
\t\t     \t\t\t\t<input id="programno" name="programno" class="required" value="{$rowe['Program_NO']}"/>
\t\t   \t\t\t\t</p>
\t\t   \t\t\t\t<p>
\t\t     \t\t\t\t<label>Quantity</label>
\t\t     \t\t\t\t<input id="quantity" name="quantity" class="required number" value="{$rowe['Quantity']}"/>
\t\t   \t\t\t\t</p>
\t\t   \t\t\t\t<p>
\t\t     \t\t\t\t<label>Remarks</label>
\t\t     \t\t\t\t<textarea id="remarks" name="remarks" rows="5" cols="40"  maxlength="300">{$rowe['Remarks']}</textarea>
\t\t   \t\t\t\t</p>

\t\t   \t\t\t\t</fieldset>
_END;
            }
            if ($this->activityid == 8) {
                $qe = "SELECT Remarks,actl.Activity_ID,Machine_ID,Operator_ID,Idle_ID,\n\t\t\t\t\t\tDATE_FORMAT(Start_Date_Time,'%d-%m-%Y %h:%i%p') as sdte,Start_Date_Time,DATE_FORMAT(End_Date_Time,'%d-%m-%Y %h:%i%p') as edte,End_Date_Time FROM ActivityLog as actl \n\t\t\t\t\t\tINNER JOIN NonProduction AS prod ON prod.Activity_Log_ID=actl.Activity_Log_ID\n\t\t\t\t\t\tWHERE actl.Activity_Log_ID={$this->activitylogid}";
                //print("<br>$qe");
                if (!($rese = $cxn->query($qe))) {
                    echo "error :", $cxn->error;
                    exit;
                }
                $rowe = mysqli_fetch_assoc($rese);
                $ac = new Activity();
                $ac->setActivityID($rowe['Activity_ID']);
                $ac->createActivityList();
                $sel = new selectlist('Activity_ID', $ac->getActivityList(), 'Select Activity', 'Activity_ID', 'Activity_Name', 'class="required"', $rowe['Activity_ID']);
                $mc = new Machine();
                $mc->createMachineList();
                $sel = new selectlist('Machine_ID', $mc->getMachineList(), 'Select Machine', 'Machine_ID', 'mnslno', 'class="required"', $rowe['Machine_ID']);
                self::createReasonList();
                $sel = new selectlist('Idle_ID', self::getReasonList(), 'Select Idle Reason', 'Idle_ID', 'Idle_Reason', 'class="required"', $rowe['Idle_ID'], '1');
                $operator = new Operator();
                $operator->createOperatorList();
                $sel = new selectlist("Operator_ID", $operator->getOperatorList(), 'Select Name', 'Operator_ID', 'Operator_Name', 'class="required"', $rowe['Operator_ID']);
                echo <<<_END
\t\t\t\t\t\t<fieldset>
\t\t\t\t\t\t<legend>Activity Details</legend>
\t\t   \t\t\t\t<p>
\t\t     \t\t\t\t<label>Start Date and Time</label>
\t\t     \t\t\t\t<input id="sdt" name="sdt" rclass="equired" value="{$rowe['sdte']}"/>
\t\t     \t\t\t\t<input id="sdtdb" name="sdtdb" type="hidden" value="{$rowe['Start_Date_Time']}">
\t\t   \t\t\t\t</p>
\t\t   \t\t\t\t<p>
\t\t     \t\t\t\t<label>End Date and Time</label>
\t\t     \t\t\t\t<input id="edt" name="edt" class="required" value="{$rowe['edte']}"/>
\t\t     \t\t\t\t<input id="edtdb" name="edtdb" type="hidden" value="{$rowe['End_Date_Time']}">
\t\t   \t\t\t\t</p>
\t\t   \t\t\t\t<p>
\t\t     \t\t\t\t<label>Remarks</label>
\t\t     \t\t\t\t<textarea id="remarks" name="remarks" rows="5" cols="40"  maxlength="300">{$rowe['Remarks']}</textarea>
\t\t   \t\t\t\t</p>

\t\t   \t\t\t\t</fieldset>
_END;
            }
            self::showLogimages();
        }
        echo <<<_END

\t\t\t\t           <input class="submit" type="submit" value="Save"/>
_END;
    }
示例#2
0
 case 'machine':
     //machine list
     $mc = new Machine();
     if (isset($_GET['mid'])) {
         $mc->setMachineID($_GET['mid']);
     }
     if (isset($_GET['class'])) {
         $class = 'class="required"';
     } else {
         $class = '';
     }
     if (isset($_GET['showcnc'])) {
         $mc->setValue('showcnc', '1');
     }
     $mc->createMachineList();
     $sel = new selectlist('Machine_ID', $mc->getMachineList(), 'Select Machine', 'Machine_ID', 'mnslno', $class, '', '1');
     break;
 case 'instrument':
     //machine list
     $ins = new Instrument();
     if (isset($_GET['typeid'])) {
         $ins->setValue('typeid', $_GET['typeid']);
     }
     $ins->createInstrumentList();
     $sel = new selectlist('Instrument_ID', $ins->getInstrumentList(), 'Select Instrument', 'Instrument_ID', 'inst', '', '');
     break;
 case 'instype':
     //machine list
     $inst = new InstrumentType();
     $inst->createInstrumentTypeList();
     $sel = new selectlist('Instrument_Type_ID', $inst->getInstrumentTypeList(), 'Select Instrument Type', 'Instrument_Type_ID', 'Instrument', 'class="required"', '', '');
 function showSPMUI()
 {
     $db = Database::getInstance();
     $cxn = $db->getConnection();
     if ($this->spmid != '') {
         $q = "SELECT * FROM Scheduled_PM WHERE SPM_ID={$this->spmid}";
         if (!($res = $cxn->query($q))) {
             exit("error (showSPMUI) : {$cxn->error}");
         }
         $r = mysqli_fetch_assoc($res);
         $this->machineid = $r['Machine_ID'];
         $this->spmtitle = $r['SPM_Title'];
         $this->spmtol = $r['SPM_Tol'];
         $this->spminterval = $r['SPM_Interval'];
     }
     echo '<fieldset><legend>Scheduled Preventive Maintenance Details</legend>';
     if ($this->spmid != '') {
         $mc = new Machine();
         $mc->createMachineList();
         $sel = new selectlist('EMachine_ID', $mc->getMachineList(), 'Select Machine', 'Machine_ID', 'mnslno', 'class="required"', $this->machineid, '1');
     }
     echo '<p><label>Maintenance Title</label><input id="spmtitle" name="spmtitle" class="required" value="' . $this->spmtitle . '"/></p>';
     echo '<p><label>Maintenance Interval in Days</label><input id="spminterval" name="spminterval" class="required" value="' . $this->spminterval . '"/></p>';
     echo '<p><label>Tolerance in Days</label><input id="spmtol" name="spmtol" class="required" value="' . $this->spmtol . '"/></p>';
     echo '<fieldset><legend>Maintanance activites for this Schedule</legend>';
     echo '<input type="button" id="addrow" value="Add New Activity"><p/>';
     if ($this->spmid != '') {
         self::listSPMDesc();
     } else {
         echo '<table class="pcd" id="spmt">';
         echo '<tr><th>Description</th></tr>';
         $this->showSPMrow(0);
         echo '</table>';
     }
     echo '</fieldset>';
     echo '<fieldset><legend>Geometric Parameters to be Checked</legend>';
     echo '<input type="button" id="addgprow" value="Add Selected Parameter to List"><p/>';
     $any = new Anylist();
     $any->createList('Geometric_Parameter');
     $sel = new selectlist('GP_ID', $any->anylist, 'Select Geometric Properties to Check', 'GP_ID', 'Parameter', '', '', '');
     echo '<input id="gpidlist" name="gpidlist" type="hidden">';
     if ($this->spmid != '') {
         $this->listGPIDs();
     }
     echo '<div id="gplist"></div>';
     echo '</fieldset>';
     echo '</fieldset>';
     echo '<input class="submit" type="submit" value="Save Sechduled Maintenance"/>';
 }