예제 #1
1
/**
 * Start an eTapestry API session by instantiating a
 * nusoap_client instance and calling the login method.
 */
function startEtapestrySession($api_version, $debugging)
{
    // Set login details and initial endpoint
    require 'authentication-eTap.php';
    if ($api_version == 2) {
        $endpoint = "https://sna.etapestry.com/v2messaging/service?WSDL";
    } else {
        $endpoint = "https://sna.etapestry.com/v3messaging/service?WSDL";
    }
    // Instantiate nusoap_client
    if ($debugging) {
        echo "Establishing NuSoap Client...";
    }
    $nsc = new nusoap_client($endpoint, true);
    if ($debugging) {
        echo "Done\n\n";
    }
    // Did an error occur?
    checkStatus($nsc, $ajax);
    // Invoke login method
    if ($debugging) {
        echo "Calling login method...";
    }
    $newEndpoint = $nsc->call("login", array($loginId, $password));
    if ($debugging) {
        echo "Done\n\n";
    }
    // Did a soap fault occur?
    checkStatus($nsc, $ajax);
    // Determine if the login method returned a value...this will occur
    // when the database you are trying to access is located at a different
    // environment that can only be accessed using the provided endpoint
    if ($newEndpoint != "") {
        echo "New Endpoint: {$newEndpoint}\n\n";
        // Instantiate nusoap_client with different endpoint
        echo "Establishing NuSoap Client with new endpoint...";
        $nsc = new nusoap_client($newEndpoint, true);
        echo "Done\n\n";
        // Did an error occur?
        checkStatus($nsc, $ajax);
        // Invoke login method
        echo "Calling login method...";
        $nsc->call("login", array($loginId, $password));
        echo "Done\n\n";
        // Did a soap fault occur?
        checkStatus($nsc, $ajax);
    }
    // Output results
    if ($debugging) {
        echo "Login Successful\n\n";
    }
    return $nsc;
}
예제 #2
0
/**
 * Start an eTapestry API session by instantiating a
 * nusoap_client instance and calling the login method.
 */
function startEtapestrySession()
{
    // Set login details and initial endpoint
    $loginId = "syaoAPIuser";
    $password = "******";
    $endpoint = "https://sna.etapestry.com/v3messaging/service?WSDL";
    // Instantiate nusoap_client
    echo "Establishing NuSoap Client...";
    $nsc = new nusoap_client($endpoint, true);
    echo "Done<br><br>";
    // Did an error occur?
    checkStatus($nsc);
    // Invoke login method
    echo "Calling login method...";
    $newEndpoint = $nsc->call("login", array($loginId, $password));
    echo "Done<br><br>";
    // Did a soap fault occur?
    checkStatus($nsc);
    // Determine if the login method returned a value...this will occur
    // when the database you are trying to access is located at a different
    // environment that can only be accessed using the provided endpoint
    if ($newEndpoint != "") {
        echo "New Endpoint: {$newEndpoint}<br><br>";
        // Instantiate nusoap_client with different endpoint
        echo "Establishing NuSoap Client with new endpoint...";
        $nsc = new nusoap_client($newEndpoint, true);
        echo "Done<br><br>";
        // Did an error occur?
        checkStatus($nsc);
        // Invoke login method
        echo "Calling login method...";
        $nsc->call("login", array($loginId, $password));
        echo "Done<br><br>";
        // Did a soap fault occur?
        checkStatus($nsc);
    }
    // Output results
    echo "Login Successful<br><br>";
    return $nsc;
}
예제 #3
0
function actionAndCheck($mac, $action, $s20Table)
{
    /*
      This function implements a switch and check satus.
      The check is in fact a double check and should not 
      be required, since the sendAction function checks the 
      power status itself in the reply command and only gives up
      when the correct reply is received. 
      Nevertheless, we have seen the S20 fail report the 
      wrong status sometimes on power on/power off actions 
      Checking the status through a separate subscribe command
      seems ro be able to always get the right status.
    */
    $stay = 1;
    $loop_count = 0;
    while ($stay) {
        if (++$loop_count > MAX_RETRIES) {
            echo "<h1> Error: too many retries without successfull action in actionAndCheck ()</h1>\n";
            exit(0);
        }
        sendAction($mac, $action, $s20Table);
        $st = checkStatus($mac, $s20Table);
        if ($st == $action) {
            $stay = 0;
        } else {
            $logmsg = "switch action FAILED, repeating:\n" . " (ordered=" . $action . " checked=" . $st . ")\n";
            error_log($logmsg);
        }
    }
    if (DEBUG) {
        error_log("Number of retries actionAndCheck() = " . $loop_count . "\n");
    }
    return $st;
}
예제 #4
0
파일: cron.php 프로젝트: emp3d/Swiftproject
 if ($hostIp == "www.3d-sof2.com" || $hostIp == "185.34.216.28") {
     $hostIp = "127.0.0.1";
 }
 $server = $row['srvname'];
 echo "\n\nChecking server {$server}, ip {$hostIp}...";
 $sshport = intval(trim($row['sshport']));
 $startcmd = str_replace("{port}", $gameport, $startcmd);
 $date = date("H:i, F j Y ", time());
 $startcmd = str_replace("{date}", $date, $startcmd);
 $query2 = "";
 $localIp = gethostbyname(gethostname());
 if ($localIp != gethostbyname($hostIp) && $hostIp != "127.0.0.1") {
     continue;
 }
 echo "\nServer {$server} is installed locally, continuing...";
 if (!checkStatus($hostIp, $sshport, $account, $accpass)) {
     $checkUser = "******";
     $data = mysqli_fetch_array(mysqli_query($mysql, $checkUser));
     $lastStart = intval(trim($data['time']));
     $checkReboots = "SELECT time FROM swift_logs WHERE username='******' AND action LIKE '%{$server}' AND time>{$lastStart} ORDER BY id DESC LIMIT 5";
     $getTimes = mysqli_query($mysql, $checkReboots);
     $i = 1;
     $lastTime = time();
     while ($times = mysqli_fetch_array($getTimes)) {
         $time = intval(trim($times['time']));
         if ($lastTime - $time <= 75) {
             $i++;
             $lastTime = $time;
         }
     }
     if ($i == 5) {
예제 #5
0
echo "Done<br><br>";
// Did an error occur?
checkStatus($nsc);
// Invoke login method
echo "Calling login method...";
$newEndpoint = $nsc->call("login", array($loginId, $password));
echo "Done<br><br>";
// Did a soap fault occur?
checkStatus($nsc);
// Determine if the login method returned a value...this will occur
// when the database you are trying to access is located at a different
// environment that can only be accessed using the provided endpoint
if ($newEndpoint != "") {
    echo "New Endpoint: {$newEndpoint}<br><br>";
    // Instantiate nusoap_client with different endpoint
    echo "Establishing NuSoap Client with new endpoint...";
    $nsc = new nusoap_client($newEndpoint, true);
    echo "Done<br><br>";
    // Did an error occur?
    checkStatus($nsc);
    // Invoke login method
    echo "Calling login method...";
    $nsc->call("login", array($loginId, $password));
    echo "Done<br><br>";
    // Did a soap fault occur?
    checkStatus($nsc);
}
// Output results
echo "Login Successful<br><br>";
// Call logout method
stopEtapestrySession($nsc);
예제 #6
0
?>
"><button type="button" class="btn btn-success">Add New Task</button></a>
					<?php 
function checkStatus($task)
{
    if ($task->status == 0) {
        return "<span class='red_text'>In Progress</span>";
    } else {
        return "<span class='green_text'>Completed</span>";
    }
}
if (!empty($task)) {
    foreach ($task as $task) {
        echo '
								<div class="task_wrap">
									' . $task->title . " " . checkStatus($task) . '
									<a href="complete_task?id=' . $task->id . '"> <button type="button" class="btn btn-info">Mark As Complete</button> </a>
									<a href="edit_task?id=' . $task->id . '&current_client_id=' . $_GET['current_client_id'] . ' "> <button type="button" class="btn btn-danger">Edit Task</button> </a>
								</div>
							
							';
    }
}
?>
					
					</div>
				</div>
			</div>
		
			<div class="col-sm-6">
			</div>
예제 #7
0
}
if ($debugging == 'heavy') {
    echo '<pre>';
    print_r($request);
    echo '</pre>';
}
//if ( $_POST['paymentSchedule'] == 'recurring' ) {
//    $processTransactionResponse = $nsc->call( "addRecurringGift", array( $trans, false ) );
//} else {
$processTransactionResponse = $nsc->call("processTransaction", array($request));
//}
if ($debugging) {
    echo "Done" . "\n\n";
}
// did a soap fault occur?
checkStatus($nsc, $_POST['ajax']);
// output result
if ($debugging) {
    echo "addAndProcessPayment Response: <pre>";
    print_r($processTransactionResponse);
    echo "</pre>";
}
// Call logout method
stopEtapestrySession($nsc, $debugging);
if ($debugging) {
    echo 'Sending email...';
}
send_email_summary(array_merge($account, $request), $notification_address, $checkDuplicatesResponse, $addAccountResponse, $processTransactionResponse);
if ($debugging) {
    echo 'Done' . "\n\n";
}
예제 #8
0
파일: ideone.php 프로젝트: mehulsbhatt/code
function check($link)
{
    $status = checkStatus($link);
    if ($status['error'] == 'OK') {
        $stat_code = $status['status'];
        if ($stat_code < 0) {
            $stat = "Pending";
            $details = null;
        } else {
            if ($stat_code == 1) {
                $stat = "Compiling";
                $details = null;
            } else {
                if ($stat_code == 3) {
                    $stat = "Running";
                    $details = null;
                } else {
                    if ($stat_code == 0) {
                        $stat = "Done";
                        $details = checkDetails($link);
                        if ($details['error'] == 'OK') {
                            // Translate 'result' code
                            $result_string = '';
                            switch ($details['result']) {
                                case 0:
                                    $result_string = "Not running";
                                    break;
                                case 11:
                                    $result_string = "Compilation error";
                                    break;
                                case 12:
                                    $result_string = "Runtime error";
                                    break;
                                case 13:
                                    $result_string = "Time limit exceeded";
                                    break;
                                case 15:
                                    $result_string = "Success";
                                    break;
                                case 17:
                                    $result_string = "Memory limit exceeded";
                                    break;
                                case 19:
                                    $result_string = "Illegal system call";
                                    break;
                                case 20:
                                    $result_string = "Internal error";
                                    break;
                            }
                            $details['result_string'] = $result_string;
                        } else {
                            throw new Exception("checkDetails: " . $details['error']);
                        }
                    }
                }
            }
        }
    } else {
        throw new Exception("checkStatus: " . $status['error']);
    }
    return array('status' => $stat, 'details' => $details);
}
예제 #9
0
파일: main_page.php 프로젝트: intfrr/orvfms
function displayMainPage(&$s20Table, $myUrl)
{
    global $daysOfWeek;
    $ndevs = count($s20Table);
    ?>
<center>
<form action="<?php 
    echo $myUrl;
    ?>
" method="post">
<?php 
    //
    // Sort array (in this case, by mac address), such that data is displayed in
    // a deterministic sequence
    //
    $macs = array_keys($s20Table);
    sort($macs);
    //
    // Dynamic location style details;
    //
    // Compute big button height (90 percent of viewport height)
    $bigButHeight = 90 / $ndevs;
    // Countdown & next action time font size
    $fsize = 3;
    $posBigButton = 0;
    $clockTopMargin = 2;
    $timerLabelTopMargin = $bigButHeight * 0.85;
    $timerLabelvSpace = $bigButHeight * 0.1;
    //
    // Loop on all devices and display each button, coloured according to
    // current S20 state.
    //
    foreach ($macs as $mac) {
        $devData = $s20Table[$mac];
        $st = $devData['st'];
        $name = $devData['name'];
        $type = $st == 0 ? "redbutton" : "greenbutton";
        $style = 'style="height:' . $bigButHeight . 'vh;top:' . $posBigButton . 'vh;"';
        $bname = $name;
        if (array_key_exists('off', $devData)) {
            if (!array_key_exists('lastOffCheck', $s20Table[$mac])) {
                $s20Table[$mac]['lastOffCheck'] = $s20Table[$mac]['off'];
                $_SESSION['s20Table'] = $s20Table;
                $devData = $s20Table[$mac];
            }
            if (time() - $devData['lastOffCheck'] > 24 * 3600) {
                // Check once per day
                $s20Table[$mac]['lastOffCheck'] = time();
                $_SESSION['s20Table'] = $s20Table;
                $ip = getIpFromMac($mac, $s20Table);
                if ($ip != 0) {
                    $s20Table[$mac]['ip'] = $ip;
                    $st = checkStatus($mac, $s20Table);
                    $_SESSION["s20Table"] = $s20Table;
                    if ($st >= 0) {
                        unset($s20Table[$mac]['off']);
                        $s20Table[$mac]['st'] = $st;
                        $_SESSION['s20Table'] = $s20Table;
                        $devData = $s20Table[$mac];
                    }
                }
            }
        }
        if (array_key_exists('off', $devData)) {
            $type = "graybutton";
            $bname = $name . " (?)";
            $val = "check";
        } else {
            $val = "switch";
        }
        // display big button
        $bigButton = '<button type="submit" name="toMainPage" 
              value="' . $val . $mac . '" id="' . $type . '" ' . $style . '>' . $bname . '</button><br>' . "\n";
        echo $bigButton;
        if (!array_key_exists('off', $devData)) {
            // overlay timer button for each field (countdown timers);
            $posTimerButton = $posBigButton + $clockTopMargin;
            $timerButtonName = 'clock' . $mac;
            $styleTimer = 'style="top:' . $posTimerButton . 'vh"';
            $timerButton = '<input type="submit" name="toCountDownPage" id="countDownButton" 
                value="timer' . $mac . '" ' . $styleTimer . '/>' . "\n";
            echo $timerButton;
            // overlay clock button for each field
            $clockButton = '<input type="submit" name="toDetailsPage" id="clockButton" 
                value="clock' . $mac . '" ' . $styleTimer . '/>' . "\n";
            echo $clockButton;
            // Include field for timer information
            if ($devData['timerVal'] != 0) {
                if ($devData['timerAction']) {
                    $color = "#00BB00";
                } else {
                    $color = "#EE0000";
                }
            } else {
                if ($devData['switchOffTimer'] > 0) {
                    $color = "white";
                } else {
                    $color = "black";
                }
            }
            $timerLabelTop = $posBigButton + $timerLabelTopMargin;
            ?>
        <div class="counter" id="<?php 
            echo $mac;
            ?>
" style="top:<?php 
            echo $timerLabelTop;
            ?>
vh;
                         color:<?php 
            echo $color;
            ?>
;
                         font-size:<?php 
            echo $fsize;
            ?>
vh;"></div>
<?php 
            $next = getAllActions($mac, $s20Table);
            $nd = count($next);
            $maxd = $s20Table[$mac]['next'];
            if ($nd > $maxd) {
                $nd = $maxd;
            }
            if ($nd > 0) {
                $top = $posBigButton + $timerLabelTopMargin - $nd * $timerLabelvSpace;
                $actString = '<div class="next" style="top:' . $top . 'vh; color:#4C4C4C;"><span>Next:</span>   </div>';
                echo $actString . '\\n';
                for ($j = 0; $j < $nd; $j++) {
                    $nextAct = $next[$j][0];
                    $nextTimeStamp = $next[$j][1];
                    $top = $posBigButton + $timerLabelTopMargin - ($nd - $j - 1) * $timerLabelvSpace;
                    $nextActS = mkNextActString($nextTimeStamp, $nextAct, $top);
                    echo $nextActS . "\n";
                }
            }
        }
        $posBigButton += $bigButHeight;
    }
    /* Overlay find button */
    ?>

<input type="submit" name="toMainPage" id="findButton" 
                value="find000000000000">
</form>
</center>
<?php 
}
예제 #10
0
    $owner = $row['user'];
    $hostname = $row['hostname'];
    $port = $row['port'];
    $hostip = $row['ip'];
    $srvId = $row['srvId'];
    $sshport = $row['sshport'];
    $players = $row['players'];
    $startcmd = trim($row['startcmd']);
    $startcmd = str_replace("{port}", $port, $startcmd);
    $date = date("H:i, F j Y ", time());
    $startcmd = str_replace("{date}", $date, $startcmd);
    $data = true;
    $task = "";
    if ($active) {
        //Before showing everything to the user, parse ALL servers which are active (not stopped) and check that are they running.
        if (!checkStatus($hostip, $sshport, $acc, $pwd)) {
            restartServer($hostip, $sshport, $acc, $pwd, $startcmd);
        }
        $active = "Running";
        $task = "<center><i class=\"stop icon\" title=\"Stop the server\" onclick=\"serverAction(true, {$srvId});\" style=\"cursor:pointer;color:blue;\"></i> <i class=\"refresh icon\" title=\"Restart the server\" style=\"cursor:pointer;color:green;\" onclick=\"serverAction(false, {$srvId});\"></i> <i class=\"remove icon\" title=\"Delete this server\" style=\"cursor:pointer;color:red;\" onclick=\"srvdel('{$srvId}', '{$name}');\"></i> <i class=\"settings icon\" style=\"cursor:pointer;\" title=\"Check & modify the parameters of this server\" onclick=\"location.href='edit/?id={$srvId}'\"></i><i class=\"cloud upload icon\" style=\"cursor:pointer;\" title=\"Update the 1fx. Mod on this server\" onclick=\"location.href='update/?id={$srvId}'\"></i><i class=\"ban icon\" title=\"Check the banlist of this server\" style=\"cursor:pointer;\" onclick=\"location.href='bl/?srvid={$srvId}'\"></i></center>";
    } else {
        $active = "Stopped";
        $task = "<center><i class=\"play icon\" title=\"Start the server\" onclick=\"location.href='?start={$srvId}'\" style=\"cursor:pointer;color:blue;\"></i> <i class=\"remove icon\" title=\"Delete this server\" style=\"cursor:pointer;color:red\" onclick=\"srvdel('{$srvId}', '{$name}');\"></i> <i class=\"settings icon\" style=\"cursor:pointer;\" title=\"Check & modify the parameters of this server\" onclick=\"location.href='edit/?id={$srvId}'\"></i><i class=\"cloud upload icon\" style=\"cursor:pointer;\" title=\"Update the 1fx. Mod on this server\" onclick=\"location.href='update/?id={$srvId}'\"></i></center>";
    }
    echo "<tr><td>{$active}</td><td>{$name}</td><td>{$players}</td><td>{$hostip}</td><td>{$port}</td><td>{$hostname}</td><td>{$owner}</td><td>{$acc}</td><td>{$pwd}</td><td>{$task}</td></tr>";
}
if (!$data) {
    echo "<tr class=\"no-records-found\"><td colspan=\"9\">No records found. You can add a new host machine by clicking the Add new host button.</td></tr>";
}
?>
</tbody>
예제 #11
0
<?php

/**
	Servei que checkeja els ordinadors de la xarxa i introdueïx si els PC's estàn online o no a la BD.
*/
#region HEADERS
header('Content-Type: text/html; charset=utf-8');
#endregion HEADERS
#region INCLUDES
include_once '/var/www/system_audit/php/utils/magic_constants.php';
include_once '/var/www/system_audit/php/models/db.php';
#endregion INCLUDES
#region MAIN
//Instanciem el model(connectem a la BD).
$db = new DB();
checkStatus($db);
$db->close();
#endregion FUNCTIONS
#region FUNCTIONS
//S'encarrega de chekejar i updatar tots els sistemes de la xarxa.
function checkStatus($db)
{
    $result = $db->returnAllIps();
    while ($row = mysqli_fetch_assoc($result)) {
        $ip = $row["ip"];
        $mac = $row["mac_address"];
        $status = shell_exec("ping -W 1 -c 1 -q {$ip} >/dev/null 2>&1 && echo ONLINE || echo OFFLINE");
        $status = trim($status, "\n");
        $status = trim($status, "\t");
        $status = str_replace(' ', '', $status);
        echo $status . "\n";
예제 #12
0
<?php 
include_once 'public.php';
echo '系统首页', "<hr>";
$id = isset($_GET['id']) ? $_GET['id'] : '';
if (empty($id)) {
    redirect('login.html', 3, 'kong请先登录!');
}
connect();
if ($user = checkStatus($id)) {
    $page = isset($_GET['page']) ? $_GET['page'] : 1;
    //设置每页显示的数量
    $length = 5;
    //获取当前满足条件的记录数有多少
    $counts = getCounts();
    //计算前一页和后一页
    $prev = $page <= 1 ? 1 : $page - 1;
    //前一页
    //求出总页数
    $pages = ceil($counts / $length);
    //下一页
    $next = $page >= $pages ? $pages : $page + 1;
    $students = getStudents($page, $length);
} else {
    redirect('login.html', 3, '您还没有登录或者登录已经失效,请重新登录!');
}
?>
	<div id ="all" style="width:100%;height:100%;float:left">
		<div id="header" style="width:100%;height:20px;float:left">
			<div id="userinfo" style="width:50%;float:left;text-align:right">
				欢迎<?php 
echo $user['u_username'];
function checkStatus($file)
{
    global $urlPath;
    $xml = simplexml_load_file($file);
    $lastupdate = explode(" / ", $xml->lastUpdate);
    $lastDate = explode(".", $lastupdate[1]);
    $lastTime = explode(":", $lastupdate[0]);
    $lastDateTime = mktime($lastTime[0], $lastTime[1], $lastTime[2], $lastDate[1], $lastDate[0], $lastDate[2]);
    $currentDateTime = mktime();
    // if we more thant 30 minutes, we guess that the system si down
    if ($currentDateTime - $lastDateTime > 600) {
        // Send a alarms
        $soapClient = new SoapClient("http://{$_SERVER['SERVER_NAME']}/{$urlPath}index.php?soap=notification.wsdl&password={$soapPassword}&username={$soapUsername}");
        $error = 0;
        try {
            $param = array('param' => array(array('key' => 'type', 'value' => 'ALARM'), array('key' => 'code', 'value' => '900'), array('key' => 'object', 'value' => '0')));
            $info = $soapClient->__call("sendMail", $param);
        } catch (SoapFault $fault) {
            $error = 1;
            print "\n            alert('Sorry, blah returned the following ERROR: " . $fault->faultcode . "-" . $fault->faultstring . ". We will now take you back to our home page.');\n            window.location = 'main.php';\n            ";
        }
    }
}
$path = "../tmp";
$dir_handle = @opendir($path) or die("Unable to open {$path}");
while ($file = readdir($dir_handle)) {
    if (substr($file, 0, strlen("system_status_")) == "system_status_") {
        checkStatus($path . "/" . $file);
    }
}
closedir($dir_handle);
예제 #14
0
    }
    $h = 0;
    $m = 0;
    $s = 10;
    echo "setting timer: " . $name . ' -> ' . actionToTxt($action) . " Time=" . sprintf("%02d:%02d:%02d\n", $h, $m, $s);
    if (!setTimer($mac, $h, $m, $s, $action, $s20Table)) {
        echo "Set timer succeed\n";
    } else {
        echo "Some problem on set timer\n";
    }
    //
    //Let us check
    //
    while (1) {
        $timer = checkTimer($mac, $s20Table, $h, $m, $s, $action);
        $st = checkStatus($mac, $s20Table);
        if (!$timer) {
            echo "Timer is off, status = " . actionToTxt($st) . "\n";
            break;
        } else {
            echo sprintf("%02d:%02d:%02d to => %s, current is %s\n", $h, $m, $s, actionToTxt($action), actionToTxt($st));
        }
        ob_flush();
        sleep(2);
    }
}
//
// Test automatic switch off after on first device.
//
echo "\n\n\nTesting automatic switch off after on using switch " . $name . "\n";
$initValue = getSwitchOffTimer($mac, $s20Table);
예제 #15
0
function content($id, $code, $unit)
{
    if (access($id, $_SESSION['us_id']) == true) {
        if ($id == 1 or $id == 4 or $id == 7 or $id == 10 or $id == 13) {
            if ($id == 1) {
                $query = "SELECT pp_kod,pp_nama,pp_tkh_submit,pp_rs_kod_lab,pp_rs_kod_api,pp_rs_kod_product,rkatp_desc,rkatp_class FROM p_product,ref_kat_produk\n                  WHERE pp_rkatp_kod=rkatp_kod AND pp_rs_kod=1105 AND pp_rkatp_kod IN(3,23,24,1,25,26,27,7,8,29,30,33)";
            } else {
                $query = "SELECT pp_kod,pp_nama,pp_tkh_submit,pp_rs_kod_lab,pp_rs_kod_api,pp_rs_kod_product,rkatp_desc,rkatp_class FROM p_product,ref_kat_produk\n                  WHERE pp_rkatp_kod=rkatp_kod AND pp_rs_kod IN(1107,1110,1111,1112) AND pp_rkatp_kod IN(3,23,24,1,25,26,27,7,8,29,30,33)";
            }
            ?>
  <div class="tab-content pn br-n admin-form">
    <div class="row">
      <table class="table table-striped table-bordered table-hover" id="primary" cellspacing="0" width="100%">
        <thead>
          <tr class="primary" align="center">
            <td width="5%">No</td>
            <td width="10%">Call No</td>
            <td width="25%">Product Name</td>
            <td width="15%">Received  Date</td>
            <td width="15%">Lab Status</td>
            <td width="15%">API Status</td>
            <td width="15%">Product Status</td>
          </tr>
        </thead>
        <tbody>
          <?php 
            $count = 1;
            $result = selQuery($query);
            while ($row = mysqli_fetch_assoc($result)) {
                ?>
            <tr align="center">
              <td><?php 
                echo $count++;
                ?>
</td>
              <td><?php 
                echo $row['pp_kod'];
                ?>
</td>
              <td align="left">
                <div class="text-primary">
                  <b><?php 
                echo $row['pp_nama'];
                ?>
</b>
                </div>
                <div class="text-muted">
                  <?php 
                echo $row['rkatp_desc'] . " - " . $row['rkatp_class'];
                ?>
                </div>
              </td>
              <td><?php 
                echo displayDate($row['pp_tkh_submit']);
                ?>
</td>
              <td align="left"><?php 
                echo protocolStatus($row['pp_rs_kod_lab'], $id);
                ?>
</td>
              <td align="left"><?php 
                echo protocolStatus($row['pp_rs_kod_api'], $id);
                ?>
</td>
              <td align="left"><?php 
                echo protocolStatus($row['pp_rs_kod_product'], $id);
                ?>
</td>
            </tr>
          <?php 
            }
            ?>
        </tbody>
      </table>
    </div>
  </div>
<?php 
        } elseif ($id == 2) {
            ?>
  <div class="tab-content pn br-n admin-form">
    <div class="row">
      <input type="hidden" id="mainTitle" value="<?php 
            echo protocolTitle($code);
            ?>
">
      <table class="table table-striped table-bordered table-hover" id="primary" cellspacing="0" width="100%">
        <thead>
          <tr class="primary" align="center">
            <td width="5%">No</td>
            <td width="10%">Call No</td>
            <td width="45%">Product Name</td>
            <td width="15%">Submission Date</td>
            <td width="10%">Aging</td>
            <td width="25%">Status</td>
          </tr>
        </thead>
        <tbody>
          <?php 
            $count = 1;
            //echo getProtocol($code,$id,"A");
            $result = selQuery(getProtocol($code, $id, "A"));
            while ($row = mysqli_fetch_assoc($result)) {
                ?>
          <tr align="center">
            <td><?php 
                echo $count++;
                ?>
</td>
            <td><?php 
                echo $row['pp_kod'];
                ?>
</td>
            <td align="left"><div><b><a style="cursor:pointer;" onclick="detail('<?php 
                echo $code;
                ?>
','<?php 
                echo $row['pp_kod'];
                ?>
')"><?php 
                echo $row['pp_nama'];
                ?>
</a></b></div><div class="text-muted"><?php 
                echo $row['rkatp_desc'] . " - " . $row['rkatp_class'];
                ?>
</div></td>
            <td><?php 
                echo displayDate($row['pp_tkh_submit']);
                ?>
</td>
            <td><?php 
                echo aging($row['pp_tkh_submit']);
                ?>
</td>
            <td align="left"><?php 
                echo getStatus($row['pp_rs_kod_lab']);
                ?>
</td>
          </tr>
          <?php 
            }
            ?>
        </tbody>
      </table>
    </div>
  </div>
  <?php 
        } elseif ($id == 5 or $id == 8 or $id == 11 or $id == 14) {
            ?>
<div class="tab-content pn br-n admin-form">
  <input type="hidden" id="mainTitle" value="<?php 
            echo protocolTitle($code);
            ?>
">
  <div class="row">
    <div class="alert alert-sm alert-border-left alert-danger"><b>Priority List</b></div>
    <table class="table table-striped table-bordered table-hover" id="primary" cellspacing="0" width="100%">
        <thead>
          <tr class="primary" align="center">
            <?php 
            if ($id == 5) {
                ?>
              <td width="2%">&nbsp;</td>
              <td width="2%">No</td>
              <td width="16%">Reference No</td>
              <td width="50%">Product Name</td>
              <td width="10%">Approve Date</td>
              <td width="5%">Aging</td>
              <td width="15%">Status</td>
            <?php 
            } else {
                ?>
              <td width="2%">No</td>
              <td width="18%">Reference No</td>
              <td width="50%">Product Name</td>
              <td width="10%">Approve Date</td>
              <td width="5%">Aging</td>
              <td width="15%">Status</td>
            <?php 
            }
            ?>
          </tr>
        </thead>
        <tbody>
          <?php 
            $count = 1;
            //echo getProtocol($id,$code,$_SESSION['ru_kod'],$_SESSION['us_id'],'P');
            $result = selQuery(getProtocol($code, $id, 'P'));
            while ($row = mysqli_fetch_assoc($result)) {
                ?>
          <tr align="center">
            <?php 
                if ($id == 5) {
                    ?>
              <td><input type="checkbox" value="<?php 
                    echo $row["pp_kod"];
                    ?>
"></td>
              <td><?php 
                    echo $count++;
                    ?>
</td>
              <td><?php 
                    echo $row['pp_ref_no'];
                    ?>
</td>
              <td align="left"><div><b><a style="cursor:pointer;" onclick="detail('<?php 
                    echo $code;
                    ?>
','<?php 
                    echo $row['pp_kod'];
                    ?>
')"><?php 
                    echo $row['pp_nama'];
                    ?>
</a></b></div><div class="text-muted"><?php 
                    echo $row['rkatp_desc'] . " - " . $row['rkatp_class'];
                    ?>
</div></td>
              <td><?php 
                    echo displayDate($row['pp_tkh_approve']);
                    ?>
</td>
              <td><?php 
                    echo aging($row['pp_tkh_approve']);
                    ?>
</td>
              <td><?php 
                    echo checkStatus($row['pp_kod']);
                    ?>
</td>
            <?php 
                } else {
                    ?>
              <td><?php 
                    echo $count++;
                    ?>
</td>
              <td align="left"><?php 
                    echo $row['pp_ref_no'];
                    ?>
</td>
              <td align="left"><div><b><a style="cursor:pointer;" onclick="detail('<?php 
                    echo $code;
                    ?>
','<?php 
                    echo $row['pp_kod'];
                    ?>
')"><?php 
                    echo $row['pp_nama'];
                    ?>
</a></b></div><div class="text-muted"><?php 
                    echo $row['rkatp_desc'] . " - " . $row['rkatp_class'];
                    ?>
</div></td>
              <td><?php 
                    echo displayDate($row['pp_tkh_approve']);
                    ?>
</td>
              <td><?php 
                    echo aging($row['pp_tkh_approve']);
                    ?>
</td>
              <td><?php 
                    echo checkStatus($row['pp_kod']);
                    ?>
</td>
            <?php 
                }
                ?>
          </tr>
          <?php 
            }
            ?>
        </tbody>
      </table>
  </div>
  <?php 
            if ($id == 5) {
                ?>
  <div class="row" align="right">
    <div class="btn-group">
      <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
        Move to
        <span class="caret ml5"></span>
      </button>
      <ul class="dropdown-menu" role="menu">
        <li>
          <a onclick="changePriority('primary','protocol','<?php 
                echo $code;
                ?>
')">Normal List</a>
        </li>
      </ul>
    </div>
  </div>
  <?php 
            }
            ?>
  <div class="row">
    <div class="section-divider"></div>
  </div>
  <div class="row">
    <div class="alert alert-sm alert-border-left alert-primary"><b>Normal List</b></div>
    <table class="table table-striped table-bordered table-hover" id="second" cellspacing="0" width="100%">
        <thead>
          <tr class="primary" align="center">
            <?php 
            if ($id == 5) {
                ?>
              <td width="2%">&nbsp;</td>
              <td width="2%">No</td>
              <td width="16%">Reference No</td>
              <td width="50%">Product Name</td>
              <td width="10%">Approve Date</td>
              <td width="5%">Aging</td>
              <td width="15%">Status</td>
            <?php 
            } else {
                ?>
              <td width="2%">No</td>
              <td width="18%">Reference No</td>
              <td width="50%">Product Name</td>
              <td width="10%">Approve Date</td>
              <td width="5%">Aging</td>
              <td width="15%">Status</td>
            <?php 
            }
            ?>
          </tr>
        </thead>
        <tbody>
          <?php 
            $count = 1;
            $result = selQuery(getProtocol($code, $id, 'N'));
            while ($row = mysqli_fetch_assoc($result)) {
                ?>
          <tr align="center">
            <?php 
                if ($id == 5) {
                    ?>
              <td><input type="checkbox" value="<?php 
                    echo $row["pp_kod"];
                    ?>
"></td>
              <td><?php 
                    echo $count++;
                    ?>
</td>
              <td align="left"><?php 
                    echo $row['pp_ref_no'];
                    ?>
</td>
              <td align="left"><div><b><a style="cursor:pointer;" onclick="detail('<?php 
                    echo $code;
                    ?>
','<?php 
                    echo $row['pp_kod'];
                    ?>
')"><?php 
                    echo $row['pp_nama'];
                    ?>
</a></b></div><div class="text-muted"><?php 
                    echo $row['rkatp_desc'] . " - " . $row['rkatp_class'];
                    ?>
</div></td>
              <td><?php 
                    echo displayDate($row['pp_tkh_approve']);
                    ?>
</td>
              <td><?php 
                    echo aging($row['pp_tkh_approve']);
                    ?>
</td>
              <td><?php 
                    echo checkStatus($row['pp_kod']);
                    ?>
</td>
            <?php 
                } else {
                    if ($row['la_rs_kod'] == 443 and $row['la_us_id'] == $_SESSION['ru_kod']) {
                        echo $row['la_rs_kod'] . $row['la_us_id'];
                    } else {
                        ?>
              <td><?php 
                        echo $count++;
                        ?>
</td>
              <td align="left"><?php 
                        echo $row['pp_ref_no'];
                        ?>
</td>
              <td align="left"><div><b><a style="cursor:pointer;" onclick="detail('<?php 
                        echo $code;
                        ?>
','<?php 
                        echo $row['pp_kod'];
                        ?>
')"><?php 
                        echo $row['pp_nama'];
                        ?>
</a></b></div><div class="text-muted"><?php 
                        echo $row['rkatp_desc'] . " - " . $row['rkatp_class'];
                        ?>
</div></td>
              <td><?php 
                        echo displayDate($row['pp_tkh_approve']);
                        ?>
</td>
              <td><?php 
                        echo aging($row['pp_tkh_approve']);
                        ?>
</td>
              <td><?php 
                        echo checkStatus($row['pp_kod']);
                        ?>
</td>
            <?php 
                    }
                    ?>
          </tr>
          <?php 
                }
            }
            ?>
        </tbody>
      </table>
  </div>
  <?php 
            if ($id == 5) {
                ?>
  <div class="row" align="right">
    <div class="btn-group">
      <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
        Move to
        <span class="caret ml5"></span>
      </button>
      <ul class="dropdown-menu" role="menu">
        <li>
          <a onclick="changePriority('second','protocol','<?php 
                echo $code;
                ?>
')">Priority List</a>
        </li>
      </ul>
    </div>
  </div>
  <?php 
            }
            ?>
</div>
<?php 
        } elseif ($id == 3 or $id == 6 or $id == 9 or $id == 12 or $id == 15) {
            ?>
  <div class="tab-content pn br-n admin-form">
    <div class="row">
      <table class="table table-striped table-bordered table-hover" id="primary" cellspacing="0" width="100%">
        <thead>
          <tr class="primary" align="center">
            <td width="5%">No</td>
            <td width='15%'>
            <?php 
            if ($id == 3) {
                echo "Call No";
            } else {
                echo "Reference No";
            }
            ?>
            </td>
            <td width="35%">Product Name</td>
            <td width="15%">
              <?php 
            if ($id == 3) {
                echo "Screening Date";
            } else {
                echo "Approve Date";
            }
            ?>
            </td>
            <td width="15%">Status</td>
            <td width="20%">Action</td>
          </tr>
        </thead>
        <tbody>
          <?php 
            $count = 1;
            $query = "SELECT pp_kod,pp_ref_no,pp_nama,pp_pkk_screen_tkh,rkatp_desc,rkatp_class FROM p_product\n                      LEFT JOIN ref_kat_produk ON pp_rkatp_kod = rkatp_kod";
            if ($id == 12 || $id == 15) {
                $query .= " LEFT JOIN lab_assign ON la_pp_kod=pp_kod";
            }
            if ($id == 3) {
                $query .= " WHERE pp_rs_kod_lab in(9002,9003) AND pp_status_nopayment='1' AND pp_rs_kod in(1103,1105)";
            } elseif ($id == 6) {
                $query .= " WHERE pp_rs_kod_lab=402 AND pp_status_nopayment='2' AND pp_rs_kod=1103";
            } elseif ($id == 12) {
                $query .= " WHERE pp_rs_kod_lab=402 AND pp_status_nopayment='2' AND pp_rs_kod IN(1103,1110) AND la_ru_kod='" . $_SESSION['ru_kod'] . "' AND la_rs_kod IN (403,443) GROUP BY pp_kod";
            } elseif ($id == 15) {
                $query .= " WHERE pp_rs_kod_lab IN('1111','1112') AND pp_status_nopayment='2' AND pp_rs_kod IN (1112,1111,1110,1103) AND la_ru_kod='" . $_SESSION['ru_kod'] . "' AND la_rs_kod IN(408,1110) GROUP BY pp_kod";
            }
            $result = selQuery($query);
            while ($row = mysqli_fetch_assoc($result)) {
                ?>
          <tr align="center">
            <td><?php 
                echo $count++;
                ?>
</td>
            <td>
              <?php 
                if ($id == 3) {
                    echo $row['pp_kod'];
                } else {
                    echo $row['pp_ref_no'];
                }
                ?>
            </td>
            <td align="left"><div><b><a style="cursor:pointer;" onclick="viewDetail('<?php 
                echo $row['pp_kod'];
                ?>
')"><?php 
                echo $row['pp_nama'];
                ?>
</a></b></div><div class="text-muted"><?php 
                echo $row['rkatp_desc'] . " - " . $row['rkatp_class'];
                ?>
</td>
            <td><?php 
                echo displayDate($row['pp_pkk_screen_tkh']);
                ?>
</td>
            <td align="left"><?php 
                echo checkStatus($row['pp_kod']);
                ?>
</td>
            <td>
              <?php 
                if ($id == 6) {
                    ?>
                <a style="cursor:pointer;" title="Reassign Lab" onclick="viewLab('<?php 
                    echo $row['pp_kod'];
                    ?>
')"><i class="fa fa-random fa-lg"></i></a>
              <?php 
                } elseif ($id == 12) {
                    ?>
                <a style="cursor:pointer;" title="Reassign Pharmacist" onclick="viewPharmacist('<?php 
                    echo $row['pp_kod'];
                    ?>
')"><i class="fa fa-random fa-lg"></i></a>
              <?php 
                }
                ?>
              <a style="cursor:pointer;" title="View Checklist" class="ml10" data-toggle="popover" data-content="And here's some amazing content. It's very engaging. Right?" onclick="viewChecklist('<?php 
                echo $row['pp_kod'];
                ?>
')"><i class="fa fa-list fa-lg"></i></a>
			        <a style="cursor:pointer;" title="View Chronology" class="ml10" onclick="chronology(0,'<?php 
                echo $row['pp_kod'];
                ?>
')"><i class="fa fa-sort-alpha-asc fa-lg"></i></a>
            </td>
          </tr>
          <?php 
            }
            ?>
        </tbody>
      </table>
    </div>
  </div>
<?php 
        } elseif ($id == 16) {
            ?>
<div class="tab-content pn br-n admin-form">
  <input type="hidden" id="mainTitle" value="<?php 
            echo sampleTitle($code);
            ?>
">
  <?php 
            if ($code == 3 || $code == 4) {
                ?>
  <div class="row">
    <div class="alert alert-sm alert-border-left alert-alert"><b>Pharma</b></div>
    <table class="table table-striped table-bordered table-hover" id="primary" cellspacing="0" width="100%">
      <thead>
        <tr class="alert" align="center">
          <td width="5%">No</td>
          <td width="15%">
            <?php 
                if ($code == 3) {
                    echo "Complaint No";
                } else {
                    echo "Surveillance No";
                }
                ?>
          </td>
          <td width="15%">Registration No</td>
          <td width="35%">Product Name</td>
          <td width="15%">Send Date</td>
          <td width="15%">Aging</td>
        </tr>
      </thead>
      <tbody>
        <?php 
                $count = 1;
                $result = selQuery(getSample($code, $id, 1));
                while ($row = mysqli_fetch_assoc($result)) {
                    ?>
        <tr align="center">
          <td><?php 
                    echo $count++;
                    ?>
</td>
          <td><?php 
                    echo $row['ref'];
                    ?>
</td>
          <td><?php 
                    echo $row['reg'];
                    ?>
</td>
          <td align="left"><b><a style="cursor:pointer;" onclick="sampleDetail('<?php 
                    echo $code;
                    ?>
','<?php 
                    echo $row['kod'];
                    ?>
')"><?php 
                    echo $row['product'];
                    ?>
</a></b></td>
          <td><?php 
                    echo displayDate($row['lab_sent_date']);
                    ?>
</td>
          <td><?php 
                    echo aging($row['lab_sent_date']);
                    ?>
</td>
        </tr>
        <?php 
                }
                ?>
      </tbody>
    </table>
  </div>
  <div class="row">
    <div class="section-divider"></div>
  </div>
  <div class="row">
    <div class="alert alert-sm alert-border-left alert-alert"><b>Cosmetic</b></div>
    <table class="table table-striped table-bordered table-hover" id="second" cellspacing="0" width="100%">
      <thead>
        <tr class="alert" align="center">
          <td width="5%">No</td>
          <td width="15%">
            <?php 
                if ($code == 3) {
                    echo "Complaint No";
                } else {
                    echo "Surveillance No";
                }
                ?>
          </td>
          <td width="15%">Registration No</td>
          <td width="35%">Product Name</td>
          <td width="15%">Send Date</td>
          <td width="15%">Aging</td>
        </tr>
      </thead>
      <tbody>
        <?php 
                $count = 1;
                $result = selQuery(getSample($code, $id, 2));
                while ($row = mysqli_fetch_assoc($result)) {
                    ?>
        <tr align="center">
          <td><?php 
                    echo $count++;
                    ?>
</td>
          <td><?php 
                    echo $row['ref'];
                    ?>
</td>
          <td><?php 
                    echo $row['reg'];
                    ?>
</td>
          <td align="left"><b><a style="cursor:pointer;" onclick="sampleDetail('<?php 
                    echo $code;
                    ?>
','<?php 
                    echo $row['kod'];
                    ?>
')"><?php 
                    echo $row['product'];
                    ?>
</a></b></td>
          <td><?php 
                    echo displayDate($row['lab_sent_date']);
                    ?>
</td>
          <td><?php 
                    echo aging($row['lab_sent_date']);
                    ?>
</td>
        </tr>
        <?php 
                }
                ?>
      </tbody>
    </table>
  </div>
  <?php 
            } else {
                ?>
  <div class="row">
    <table class="table table-striped table-bordered table-hover" id="primary" cellspacing="0" width="100%">
      <thead>
        <tr class="alert" align="center">
          <?php 
                if ($code == 1) {
                    ?>
            <td width="5%">No</td>
            <td width="10%">Call No</td>
            <td width="15%">Reference No</td>
            <td width="40%">Product Name</td>
            <td width="10%">Send Date</td>
            <td width="5%">Aging</td>
            <td width="15%">Status</td>
          <?php 
                } elseif ($code == 2) {
                    ?>
            <td width="5%">No</td>
            <td width="15%">ADR No</td>
            <td width="15%">Registration No</td>
            <td width="35%">Product Name</td>
            <td width="15%">Send Date</td>
            <td width="15%">Aging</td>
          <?php 
                } else {
                    ?>
            <td width="5%">No</td>
            <td width="65%">Product Name</td>
            <td width="15%">Send Date</td>
            <td width="15%">Aging</td>
          <?php 
                }
                ?>
        </tr>
      </thead>
      <tbody>
        <?php 
                $count = 1;
                //echo getSample($code,$id);
                $result = selQuery(getSample($code, $id, "A"));
                while ($row = mysqli_fetch_assoc($result)) {
                    ?>
        <tr align="center">
          <?php 
                    if ($code == 1) {
                        ?>
            <td><?php 
                        echo $count++;
                        ?>
</td>
            <td><?php 
                        echo $row['pp_kod'];
                        ?>
</td>
            <td><?php 
                        echo $row['pp_ref_no'];
                        ?>
</td>
            <td align="left"><div><b><a style="cursor:pointer;" onclick="sampleDetail('<?php 
                        echo $code;
                        ?>
','<?php 
                        echo $row['pp_kod'];
                        ?>
')"><?php 
                        echo $row['pp_nama'];
                        ?>
</a></b></div><div class="text-muted"><?php 
                        echo $row['rkatp_desc'] . " - " . $row['rkatp_class'];
                        ?>
</div></td>
            <td>-</td>
            <td>-</td>
            <td align="left"><?php 
                        echo screeningStatus($row['pp_kod']);
                        ?>
</td>
          <?php 
                    } elseif ($code == 2) {
                        ?>
            <td><?php 
                        echo $count++;
                        ?>
</td>
            <td>
              <?php 
                        if (!$row['Adrno']) {
                            echo $row['adrFormID'];
                        } else {
                            echo $row['Adrno'];
                        }
                        ?>
            </td>
            <td><?php 
                        echo $row['MALnum'];
                        ?>
</td>
            <td align="left"><b><a style="cursor:pointer;" onclick="sampleDetail('<?php 
                        echo $code;
                        ?>
','<?php 
                        echo $row['adrSampleID'];
                        ?>
')"><?php 
                        echo $row['product_name'];
                        ?>
</a></b></td>
            <td><?php 
                        echo displayDate($row['lab_sent_date']);
                        ?>
</td>
            <td><?php 
                        echo aging($row['lab_sent_date']);
                        ?>
</td>
          <?php 
                    } elseif ($code == 5) {
                        ?>
            <td><?php 
                        echo $count++;
                        ?>
</td>
            <td align="left"><b><a style="cursor:pointer;" onclick="sampleDetail('<?php 
                        echo $code;
                        ?>
','<?php 
                        echo $row['kp_id'];
                        ?>
')"><?php 
                        echo $row['kp_product_name'];
                        ?>
</a></b></td>
            <td>-</td>
            <td>-</td>
          <?php 
                    } elseif ($code == 6) {
                        ?>
            <td><?php 
                        echo $count++;
                        ?>
</td>
            <td align="left"><b><a style="cursor:pointer;" onclick="sampleDetail('<?php 
                        echo $code;
                        ?>
','<?php 
                        echo $row['kp_id'];
                        ?>
')"><?php 
                        echo $row['kp_product_name'];
                        ?>
</a></b></td>
            <td><?php 
                        echo displayDate($row['kp_tkh_terima']);
                        ?>
</td>
            <td><?php 
                        echo aging($row['kp_tkh_terima']);
                        ?>
</td>
          <?php 
                    }
                    ?>
        </tr>
        <?php 
                }
                ?>
      </tbody>
    </table>
  </div>
  <?php 
            }
            ?>
  <?php 
            if ($code == 1) {
                ?>
    <div class="col-md-12">&nbsp;</div>
    <div class="row" align="right">
      <div class="btn-group">
        <button type="button" class="btn btn-alert dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
          Action
          <span class="caret ml5"></span>
        </button>
        <ul class="dropdown-menu" role="menu">
          <li><a style="cursor:pointer" onclick="screenList(1)">In Tray</a></li>
          <li><a style="cursor:pointer" onclick="screenList(2)">Rejected List</a></li>
        </ul>
      </div>
    </div>
  <?php 
            }
            ?>
  <?php 
            if ($code == 6) {
                ?>
  <div class="col-md-12">&nbsp;</div>
  <div class="row" align="right"><button class="btn btn-alert" onclick="newSample()"><i class="fa fa-plus"></i> New</button></div>
  <?php 
            }
            ?>
</div>
<?php 
        } elseif ($id == 19 or $id == 21 or $id == 23 or $id == 25 or $id == 27) {
            ?>
<div class="tab-content pn br-n admin-form">
  <div class="row">
    <input type="hidden" id="mainTitle" value="<?php 
            echo sampleTitle($code);
            ?>
">
    <div class="alert alert-sm alert-border-left alert-danger"><b>Priority List</b></div>
    <table class="table table-striped table-bordered table-hover" id="primary" cellspacing="0" width="100%">
      <thead>
        <tr class="alert" align="center">
          <?php 
            if ($id == 19) {
                ?>
            <td width="5%">&nbsp;</td>
            <td width="5%">No</td>
            <td width="10%">Sample No</td>
            <td width="20%">Product Name</td>
            <td width="10%">Approved Date</td>
            <td width="10%">Expected Date</td>
            <td width="5%">Aging</td>
            <td width="15%">Status</td>
          <?php 
            } else {
                ?>
          <td width="5%">No</td>
          <td width="10%">Sample No</td>
          <td width="25%">Product Name</td>
          <td width="10%">Received Date</td>
          <td width="10%">Expected Date</td>
          <td width="5%">Aging</td>
          <td width="15%">Status</td>
          <?php 
            }
            ?>
        </tr>
      </thead>
      <tbody>
        <?php 
            $count = 1;
            //echo getSample($code,$id,'P');
            $result = selQuery(getSample($code, $id, 'P'));
            while ($row = mysqli_fetch_assoc($result)) {
                ?>
        <tr align="center">
          <?php 
                if ($id == 19) {
                    ?>
            <td>
              <input type="checkbox" value="<?php 
                    echo $row['kp_id'];
                    ?>
">
            </td>
            <td><?php 
                    echo $count++;
                    ?>
</td>
            <td><?php 
                    echo $row['kp_sampel_no'];
                    ?>
</td>
            <td align="left">
              <b><a style="cursor:pointer;" onclick="sampleDetail('<?php 
                    echo $code;
                    ?>
','<?php 
                    echo $row['kp_id'];
                    ?>
')"><?php 
                    echo $row['kp_product_name'];
                    ?>
</a></b>
              <div><?php 
                    echo $row['rkatp_desc'] . " - " . $row['rkatp_class'];
                    ?>
</div>
            </td>
            <td><?php 
                    echo displayDate($row['kp_tkh_approve']);
                    ?>
</td>
            <td><?php 
                    echo addDayswithdate($row['kp_tkh_approve'], $row['kp_complete_day']);
                    ?>
</td>
            <td><?php 
                    echo aging($row['kp_tkh_terima']);
                    ?>
</td>
            <td align="left"><?php 
                    echo getStatus($row['kp_rs_level']);
                    ?>
</td>
          <?php 
                } else {
                    ?>
            <td><?php 
                    echo $count++;
                    ?>
</td>
            <td><?php 
                    echo $row['kp_sampel_no'];
                    ?>
</td>
            <td align="left">
              <b><a style="cursor:pointer;" onclick="sampleDetail('<?php 
                    echo $code;
                    ?>
','<?php 
                    echo $row['kp_id'];
                    ?>
')"><?php 
                    echo $row['kp_product_name'];
                    ?>
</b></a>
            </td>
            <td><?php 
                    echo displayDate($row['kp_tkh_terima']);
                    ?>
</td>
            <td><?php 
                    echo addDayswithdate($row['kp_tkh_terima'], $row['kp_complete_day']);
                    ?>
</td>
            <td><?php 
                    echo aging($row['kp_tkh_terima']);
                    ?>
</td>
            <td align="left"><?php 
                    echo getStatus($row['kp_rs_level']);
                    ?>
</td>
          <?php 
                }
                ?>
        </tr>
        <?php 
            }
            ?>
      </tbody>
    </table>
  </div>
  <?php 
            if ($id == 19) {
                ?>
  <div class="row" align="right">
    <div class="btn-group">
      <button type="button" class="btn btn-alert dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
        Move to
        <span class="caret ml5"></span>
      </button>
      <ul class="dropdown-menu" role="menu">
        <li>
          <a onclick="changePriority('primary','sample','<?php 
                echo $code;
                ?>
')">Normal List</a>
        </li>
      </ul>
    </div>
  </div>
  <?php 
            }
            ?>
  <div class="row">
    <div class="section-divider"></div>
  </div>
  <div class="row">
    <div class="alert alert-sm alert-border-left alert-alert"><b>Normal List</b></div>
    <table class="table table-striped table-bordered table-hover" id="second" cellspacing="0" width="100%">
      <thead>
        <tr class="alert" align="center">
          <?php 
            if ($id == 19) {
                ?>
            <td width="5%">&nbsp;</td>
            <td width="5%">No</td>
            <td width="10%">Sample No</td>
            <td width="20%">Product Name</td>
            <td width="10%">Received Date</td>
            <td width="10%">Expected Date</td>
            <td width="5%">Aging</td>
            <td width="15%">Status</td>
          <?php 
            } else {
                ?>
          <td width="5%">No</td>
          <td width="10%">Sample No</td>
          <td width="25%">Product Name</td>
          <td width="10%">Received Date</td>
          <td width="10%">Expected Date</td>
          <td width="5%">Aging</td>
          <td width="15%">Status</td>
          <?php 
            }
            ?>
        </tr>
      </thead>
      <tbody>
        <?php 
            $count = 1;
            $result = selQuery(getSample($code, $id, 'N'));
            while ($row = mysqli_fetch_assoc($result)) {
                ?>
        <tr align="center">
          <?php 
                if ($id == 19) {
                    ?>
            <td>
              <input type="checkbox" value="<?php 
                    echo $row['kp_id'];
                    ?>
">
            </td>
            <td><?php 
                    echo $count++;
                    ?>
</td>
            <td><?php 
                    echo $row['kp_sampel_no'];
                    ?>
</td>
            <td align="left">
              <b><a style="cursor:pointer;" onclick="sampleDetail('<?php 
                    echo $code;
                    ?>
','<?php 
                    echo $row['kp_id'];
                    ?>
')"><?php 
                    echo $row['kp_product_name'];
                    ?>
</a></b>
              <div><?php 
                    echo $row['rkatp_desc'] . " - " . $row['rkatp_class'];
                    ?>
</div>
            </td>
            <td><?php 
                    echo displayDate($row['kp_tkh_terima']);
                    ?>
</td>
            <td><?php 
                    echo addDayswithdate($row['kp_tkh_terima'], $row['kp_complete_day']);
                    ?>
</td>
            <td><?php 
                    echo aging($row['kp_tkh_terima']);
                    ?>
</td>
            <td><?php 
                    echo getStatus($row['kp_rs_level']);
                    ?>
</td>
          <?php 
                } else {
                    ?>
            <td><?php 
                    echo $count++;
                    ?>
</td>
            <td><?php 
                    echo $row['kp_sampel_no'];
                    ?>
</td>
            <td align="left">
              <b><a style="cursor:pointer;" onclick="sampleDetail('<?php 
                    echo $code;
                    ?>
','<?php 
                    echo $row['kp_id'];
                    ?>
')"><?php 
                    echo $row['kp_product_name'];
                    ?>
</a></b>
            </td>
            <td><?php 
                    echo displayDate($row['kp_tkh_terima']);
                    ?>
</td>
            <td><?php 
                    echo addDayswithdate($row['kp_tkh_terima'], $row['kp_complete_day']);
                    ?>
</td>
            <td><?php 
                    echo aging($row['kp_tkh_terima']);
                    ?>
</td>
            <td><?php 
                    echo getStatus($row['kp_rs_level']);
                    ?>
</td>
          <?php 
                }
                ?>
        </tr>
        <?php 
            }
            ?>
      </tbody>
    </table>
  </div>
  <?php 
            if ($id == 19) {
                ?>
  <div class="row" align="right">
    <div class="btn-group">
      <button type="button" class="btn btn-alert dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
        Move to
        <span class="caret ml5"></span>
      </button>
      <ul class="dropdown-menu" role="menu">
        <li>
          <a onclick="changePriority('second','sample','<?php 
                echo $code;
                ?>
')">Priority List</a>
        </li>
      </ul>
    </div>
  </div>
  <?php 
            }
            ?>
</div>
<?php 
        } elseif ($id == 17 or $id == 20 or $id == 22 or $id == 24 or $id == 26 or $id == 28) {
            ?>
<div class="tab-content pn br-n admin-form">
  <div class="row">
    <table class="table table-striped table-bordered table-hover" id="primary" cellspacing="0" width="100%">
      <thead>
        <tr class="alert" align="center">
          <td width="5%">No</td>
          <td width="10%">Sample No</td>
          <td width="25%">Product Name</td>
          <td width="15%">Received Date</td>
          <td width="15%">Expected Date</td>
          <td width="10%">Aging</td>
          <td width="20%">Status</td>
        </tr>
      </thead>
      <tbody>
        <?php 
            $count = 1;
            $query = "SELECT kp_id,kp_sampel_no,kp_product_name,kp_tkh_terima,kp_complete_day,kp_rs_level FROM k_produk";
            if ($id == 17) {
                $query .= " WHERE kp_rs_level IN (401,402)";
            } elseif ($id == 20) {
                $query .= " WHERE kp_rs_level='402'";
            } elseif ($id == 22) {
                $query .= " WHERE kp_rs_level='411'";
            } elseif ($id == 24) {
                $query .= " JOIN k_lab ON k_lab.klb_kp_id=k_produk.kp_id\n            WHERE kp_rs_level='402' AND klb_ru_kod='" . $_SESSION['ru_kod'] . "'";
            } elseif ($id == 26) {
                $query .= " JOIN k_lab ON k_lab.klb_kp_id=k_produk.kp_id\n            WHERE kp_rs_level='402' AND klb_ru_kod='" . $_SESSION['ru_kod'] . "' AND klb_tp_kod='" . $_SESSION['us_id'] . "' AND klb_rs_level='404'";
            } elseif ($id == 28) {
                $query .= " JOIN k_lab ON k_lab.klb_kp_id=k_produk.kp_id\n            JOIN k_lab_task_test ON k_lab_task_test.kltt_kp_id=k_produk.kp_id\n            WHERE kp_rs_level='402' AND klb_ru_kod='" . $_SESSION['ru_kod'] . "' AND kltt_tp_kod='" . $_SESSION['us_id'] . "' AND klb_rs_level='405'\n            GROUP BY kp_id";
            }
            $result = selQuery($query);
            while ($row = mysqli_fetch_assoc($result)) {
                ?>
        <tr align="center">
          <td><?php 
                echo $count++;
                ?>
</td>
          <td><?php 
                echo $row['kp_sampel_no'];
                ?>
</td>
          <td align="left"><a style="cursor:pointer;" onclick="viewSample('<?php 
                echo $row['kp_id'];
                ?>
')"><?php 
                echo $row['kp_product_name'];
                ?>
</a></td>
          <td><?php 
                echo displayDate($row['kp_tkh_terima']);
                ?>
</td>
          <td><?php 
                echo addDayswithdate($row['kp_tkh_terima'], $row['kp_complete_day']);
                ?>
</td>
          <td><?php 
                echo aging($row['kp_tkh_terima']);
                ?>
</td>
          <td align="left"><?php 
                echo getStatus($row['kp_rs_level']);
                ?>
</td>
        </tr>
        <?php 
            }
            ?>
      </tbody>
    </table>
  </div>
</div>
<?php 
        } elseif ($id == 18 or $id == 34) {
            ?>
<div class="tab-content pn br-n admin-form">
  <input type="hidden" id="mainTitle" value="<?php 
            echo sampleTitle($code);
            ?>
">
  <div class="row">
    <div class="alert alert-sm alert-border-left alert-danger"><b>Priority List</b></div>
    <table class="table table-striped table-bordered table-hover" id="primary" cellspacing="0" width="100%">
      <thead>
        <tr class="alert" align="center">
          <td width="5%">&nbsp;</td>
          <td width="10%">Sample No</td>
          <td width="45%">Product Name</td>
          <td width="15%">Received Date</td>
          <td width="10%">Aging</td>
          <td width="15%">Approve Date</td>
        </tr>
      </thead>
      <tbody>
        <?php 
            $count = 1;
            $result = selQuery(getSample($code, $id, "P"));
            while ($row = mysqli_fetch_assoc($result)) {
                ?>
        <tr align="center">
          <td>
            <input type="checkbox" value="<?php 
                echo $row['kp_sampel_no'];
                ?>
">
          </td>
          <td><?php 
                echo $row['kp_sampel_no'];
                ?>
</td>
          <td align="left">
            <div><b><a style="cursor:pointer;" onclick="sampleResult('<?php 
                echo $row['kp_id'];
                ?>
','<?php 
                echo $row['kp_sampel_no'];
                ?>
')"><?php 
                echo $row['kp_product_name'];
                ?>
</a></b></div><div class="text-muted"><?php 
                echo sampleCategory($row['kp_rsc_kod']);
                ?>
</div>
          </td>
          <td><?php 
                echo $row['kp_tkh_terima'];
                ?>
</td>
          <td><?php 
                echo aging($row['kp_tkh_terima']);
                ?>
</td>
          <td><?php 
                echo $row[''];
                ?>
</td>
        </tr>
        <?php 
            }
            ?>
      </tbody>
    </table>
  </div>
  <div class="row">
    <div class="section-divider"></div>
  </div>
  <div class="row">
    <div class="alert alert-sm alert-border-left alert-alert"><b>Normal List</b></div>
    <table class="table table-striped table-bordered table-hover" id="primary" cellspacing="0" width="100%">
      <thead>
        <tr class="alert" align="center">
          <td width="5%">&nbsp;</td>
          <td width="10%">Sample No</td>
          <td width="45%">Product Name</td>
          <td width="15%">Received Date</td>
          <td width="10%">Aging</td>
          <td width="15%">Approve Date</td>
        </tr>
      </thead>
      <tbody>
        <?php 
            $count = 1;
            $result = selQuery(getSample($code, $id, "N"));
            while ($row = mysqli_fetch_assoc($result)) {
                ?>
        <tr align="center">
          <td>
            <input type="checkbox" value="<?php 
                echo $row['kp_sampel_no'];
                ?>
">
          </td>
          <td><?php 
                echo $row['kp_sampel_no'];
                ?>
</td>
          <td align="left">
            <div><b><a style="cursor:pointer;" onclick="sampleResult('<?php 
                echo $row['kp_id'];
                ?>
','<?php 
                echo $row['kp_sampel_no'];
                ?>
')"><?php 
                echo $row['kp_product_name'];
                ?>
</a></b></div><div class="text-muted"><?php 
                echo sampleCategory($row['kp_rsc_kod']);
                ?>
</div>
          </td>
          <td><?php 
                echo $row['kp_tkh_terima'];
                ?>
</td>
          <td><?php 
                echo aging($row['kp_tkh_terima']);
                ?>
</td>
          <td><?php 
                echo $row[''];
                ?>
</td>
        </tr>
        <?php 
            }
            ?>
      </tbody>
    </table>
  </div>
  <!-- <div class="col-md-12">&nbsp;</div>
  <div class="col-md-12" align="right">
    <div class="btn-group">
      <button type="button" class="btn btn-alert dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
        Action
        <span class="caret ml5"></span>
      </button>
      <ul class="dropdown-menu" role="menu">
        <li><a style="cursor:pointer" onclick="selectPrint()">Print Selected</a></li>
      </ul>
    </div>
  </div> -->
</div>
<?php 
        } elseif ($id == 29) {
            ?>
<div class="tab-content pn br-n admin-form">
<?php 
            if ($code == 1) {
                ?>
<input type="hidden" id="mainTitle" value="General Search" />
<div class="col-md-2">Search By</div>
<div class="col-md-1">:</div>
<div class="col-md-4">
  <select class="form-control" id="searchBy" onchange="changeSearch(1)">
    <option value="0">-- Please Select --</option>
    <option value="1">Product Name</option>
    <option value="11">Protocol Number</option>
    <option value="2">Reference Number</option>
    <option value="3">Registration Number</option>
    <option value="4">Product Category</option>
    <option value="5">Holder</option>
    <option value="6">Manufacturer</option>
    <option value="7">Active Substance</option>
    <option value="8">Received Date</option>
    <option value="9">Approval Date</option>
    <option value="10">Reject Date</option>
  </select>
</div>
<div class="col-md-12">&nbsp;</div>
<div class="col-md-2">Search</div>
<div class="col-md-1">:</div>
<div class="col-md-4" id="changeSearch">
  <label for="searchTxt" class="field prepend-icon">
    <input type="text" id="searchTxt" class="gui-input" placeholder="Search">
      <label class="field-icon">
        <i class="fa fa-search"></i>
      </label>
  </label>
</div>
<div class="col-md-12">&nbsp;</div>
<div class="col-md-12" align="right">
  <button class="btn btn-primary btn-sm" onclick="carian(1)"><i class="fa fa-search"></i> Search</button>
</div>
<?php 
            } else {
                ?>
<input type="hidden" id="mainTitle" value="Status Search" />
<div class="col-md-2">Search By</div>
<div class="col-md-1">:</div>
<div class="col-md-9" id="ProtocolStatus">
  <div class="radio-custom mb5">
    <input type="radio" id="ProtocolStatus_01" name="ProtocolStatus" checked="true" onclick="changeSearching(3)">
    <label for="ProtocolStatus_01">Protocol Under Evaluation</label>
  </div>
  <div class="radio-custom mb5">
    <input type="radio" id="ProtocolStatus_02" name="ProtocolStatus" onclick="changeSearching(3)">
    <label for="ProtocolStatus_02">Waiting for Approval</label>
  </div>
  <div class="radio-custom mb5">
    <input type="radio" id="ProtocolStatus_03" name="ProtocolStatus" onclick="changeSearching(3)">
    <label for="ProtocolStatus_03">Approval Protocol</label>
  </div>
  <div class="radio-custom mb5">
    <input type="radio" id="ProtocolStatus_04" name="ProtocolStatus" onclick="changeSearching(3)">
    <label for="ProtocolStatus_04">Rejected Protocol</label>
  </div>
</div>
<div class="col-md-12">&nbsp;</div>
<div class="col-md-2">
  <label>Lab</label>
</div>
<div class="col-md-1">:</div>
<div class="col-md-7">
  <select id="txt_lab" class="form-control" onchange="changeSearching(3)">
      <option value='0'>-- Please Select --</option>
      <option value='All'>All Unit</option>
      <?php 
                getLab();
                ?>
  </select>
</div>
<div class="col-md-12">&nbsp;</div>
<div class="col-md-2">
  <label>Year</label>
</div>
<div class="col-md-1">:</div>
<div class="col-md-2">
  <select id="txt_year" class="form-control" onchange="changeSearching(3)">
      <option value='0'>-- Please Select --</option>
      <option value='All'>All Years</option>
      <?php 
                $year = "2000";
                $curYear = date("Y");
                while ($curYear >= $year) {
                    echo "<option value='" . $curYear . "'>" . $curYear . "</option>";
                    $curYear--;
                }
                ?>
  </select>
</div>
<div class="col-md-12">&nbsp;</div>
<div class="col-md-12" align="right">
  <button class="btn btn-primary btn-sm" onclick="carian(3)"><i class="fa fa-search"></i> Search</button>
</div>
<?php 
            }
            ?>
  <div class="col-md-12" id="viewSearch"></div>
</div>
<?php 
        } elseif ($id == 30) {
            ?>
<div class="tab-content pn br-n admin-form">
<?php 
            if ($code == 1) {
                ?>
  <input type="hidden" id="mainTitle" value="General Search" />
<div class="col-md-2">Search By</div>
<div class="col-md-1">:</div>
<div class="col-md-4">
  <select class="form-control" id="searchBy" onchange="changeSearch(2)">
    <option value="0">-- Please Select --</option>
    <option value="1">Product Name</option>
    <option value="2">Sample Number</option>
    <option value="3">Batch Number</option>
    <option value="4">Reference Number</option>
    <option value="5">Registration Number</option>
    <option value="6">Product Category</option>
    <option value="7">Holder</option>
    <option value="8">Manufacturer</option>
    <option value="9">Active Substance</option>
    <option value="10">Received Date</option>
    <option value="11">Approval Date</option>
    <option value="12">Reject Date</option>
  </select>
</div>
<div class="col-md-12">&nbsp;</div>
<div class="col-md-2">Search</div>
<div class="col-md-1">:</div>
<div class="col-md-4" id="changeSearch">
  <label for="searchTxt" class="field prepend-icon">
    <input type="text" id="searchTxt" class="gui-input" placeholder="Search">
      <label class="field-icon">
        <i class="fa fa-search"></i>
      </label>
  </label>
</div>
<div class="col-md-12">&nbsp;</div>
<div class="col-md-12" align="right">
  <button class="btn btn-alert btn-sm" onclick="carian(2)"><i class="fa fa-search"></i> Search</button>
</div>
<?php 
            } else {
                ?>
<input type="hidden" id="mainTitle" value="Status Search" />
<div class="col-md-2">Search By</div>
<div class="col-md-1">:</div>
<div class="col-md-9" id="ProtocolStatus">
  <div class="radio-custom mb5">
    <input type="radio" id="ProtocolStatus_01" name="ProtocolStatus" checked="true" onclick="changeSearching(4)">
    <label for="ProtocolStatus_01">Sample Under Testing</label>
  </div>
  <div class="radio-custom mb5">
    <input type="radio" id="ProtocolStatus_02" name="ProtocolStatus" onclick="changeSearching(4)">
    <label for="ProtocolStatus_02">Waiting for Result Approval</label>
  </div>
  <div class="radio-custom mb5">
    <input type="radio" id="ProtocolStatus_03" name="ProtocolStatus" onclick="changeSearching(4)">
    <label for="ProtocolStatus_03">Pass Samples</label>
  </div>
  <div class="radio-custom mb5">
    <input type="radio" id="ProtocolStatus_04" name="ProtocolStatus" onclick="changeSearching(4)">
    <label for="ProtocolStatus_04">Fail Samples</label>
  </div>
</div>
<div class="col-md-12">&nbsp;</div>
<div class="col-md-2">
  <label>Lab</label>
</div>
<div class="col-md-1">:</div>
<div class="col-md-7">
  <select id="txt_lab" class="form-control" onchange="changeSearching(4)">
      <option value='0'>-- Please Select --</option>
      <option value='All'>All Unit</option>
      <?php 
                getLab();
                ?>
  </select>
</div>
<div class="col-md-12">&nbsp;</div>
<div class="col-md-2">
  <label>Year</label>
</div>
<div class="col-md-1">:</div>
<div class="col-md-2">
  <select id="txt_year" class="form-control" onchange="changeSearching(4)">
      <option value='0'>-- Please Select --</option>
      <option value='All'>All Years</option>
      <?php 
                $year = "2000";
                $curYear = date("Y");
                while ($curYear >= $year) {
                    echo "<option value='" . $curYear . "'>" . $curYear . "</option>";
                    $curYear--;
                }
                ?>
  </select>
</div>
<div class="col-md-12">&nbsp;</div>
<div class="col-md-12" align="right">
  <button class="btn btn-alert btn-sm" onclick="carian(4)"><i class="fa fa-search"></i> Search</button>
</div>
<?php 
            }
            ?>
  <div class="col-md-12" id="viewSearch"></div>
</div>
<?php 
        } elseif ($id == 31) {
            $query = "SELECT pp_kod,pp_ref_no,pp_nama,pp_tkh_approve,pp_rs_kod,rkatp_class,rkatp_desc,pp_correspondence_counter,pp_correspondence_counter_max FROM p_product\n              LEFT JOIN ref_kat_produk ON pp_rkatp_kod = rkatp_kod\n              LEFT JOIN p_product_manu ON p_product_manu.ppm_pp_kod = p_product.pp_kod AND ppm_rmr_kod=1\n              LEFT JOIN o_syarikat_add ON o_syarikat_add.osa_kod = p_product_manu.ppm_osa_kod\n              LEFT JOIN o_syarikat ON o_syarikat.os_kod = o_syarikat_add.osa_os_kod\n              LEFT JOIN lab_assign ON la_pp_kod=pp_kod\n              WHERE pp_status_nopayment=2 AND pp_rs_kod IN (1110,1103,1107)\n              AND la_ru_kod='" . $_SESSION['ru_kod'] . "' AND la_rs_kod IN (1110) AND la_us_id='" . $_SESSION['us_id'] . "' GROUP BY pp_kod";
            $result = selQuery($query);
            ?>
<table class="table table-striped table-bordered table-hover" id="primary" cellspacing="0" width="100%">
  <thead>
    <tr class="primary" align="center">
      <td width="15%">Reference No</td>
      <td width="45%">Product Name</td>
      <td width="30%">Status</td>
      <td width="10%">&nbsp;</td>
    </tr>
  </thead>
  <tbody>
    <?php 
            while ($row = mysqli_fetch_assoc($result)) {
                ?>
    <tr align="center">
      <td><?php 
                echo $row['pp_ref_no'];
                ?>
</td>
      <td align="left">
        <div class="text-primary">
          <b><?php 
                if ($row['pp_rs_kod'] == 1110) {
                    echo $row['pp_nama'];
                } else {
                    ?>
              <a style="cursor:pointer;" onclick="corrDetail('<?php 
                    echo $row['pp_kod'];
                    ?>
')"><?php 
                    echo $row['pp_nama'];
                    ?>
</a>
              <?php 
                }
                ?>
          </b>
        </div>
        <div class="text-muted"><?php 
                echo $row['rkatp_desc'] . " - " . $row['rkatp_class'];
                ?>
</div>
      </td>
      <td>
        <?php 
                if ($row['pp_rs_kod'] == 1110) {
                    echo "WAITING FOR USER REPLY";
                } elseif ($row['pp_rs_kod'] == 1107) {
                    echo "USER CORRESPOND";
                } else {
                    echo "WAITING FOR OTHER DEPARTMENT";
                }
                ?>
      </td>
      <td>
        <?php 
                echo $row['pp_correspondence_counter'] . " of " . $row['pp_correspondence_counter_max'];
                ?>
      </td>
    </tr>
    <?php 
            }
            ?>
  </tbody>
</table>
<?php 
        } elseif ($id == 32) {
            // $query = "SELECT kpd_kp_id,kpd_pp_kod,kpd_sender_name FROM k_produk_det limit 15000";
            // $result = selQuery($query);
            // $count = 0;
            // while($row = mysqli_fetch_assoc($result)) {
            //   $upd = "UPDATE k_produk SET kp_sampleID='".$row['kpd_pp_kod']."',kp_sender='".$row['kpd_sender_name']."' WHERE kp_id='".$row['kpd_kp_id']."'";
            //   executeQuery($upd);
            //   $count++;
            // }
            // echo $count;
            if ($code == 1) {
                //       $query = "SELECT kp_id,kp_rpjp_id FROM k_produk WHERE kp_rpjp_id IS NOT NULL order by kp_id asc LIMIT 10000";
                //       $result = selQuery($query);
                //       while($row = mysqli_fetch_assoc($result)) {
                //         $upd = "UPDATE k_produk SET kp_rsc_kod='".$row['kp_rpjp_id']."' WHERE kp_id='".$row['kp_id']."'";
                // //echo $upd;
                //         executeQuery($upd);
                //
                //       }
                //       echo $query;
                // $query = "SELECT kpd_kp_id,kpd_pp_kod,kpd_sender_name FROM k_produk_det order by kpd_id ASC LIMIT 1500";
                // $result = selQuery($query);
                // while($row = mysqli_fetch_assoc($result)) {
                //   $upd = "UPDATE k_produk SET kp_sampleID='".$row['kpd_pp_kod']."',kp_sender='".$row['kpd_sender_name']."'
                //           WHERE kp_id='".$row['kpd_kp_id']."'";
                //   executeQuery($upd);
                //
                // }
                //echo $upd;
                ?>
<div class="tab-content pn br-n admin-form">
  <input type="hidden" id="mainTitle" value="Home" />
  <div class="row">
    <label class="field prepend-icon">
      <input type="text" id="txt_scan" class="gui-input" placeholder="Scan Barcode" onchange="scanItem()">
      <label for="txt_scan" class="field-icon">
        <i class="fa fa-barcode"></i>
      </label>
    </label>
  </div>
  <div class="row" id="storeList">
    <table class="table table-striped table-bordered table-hover" id="primary" cellspacing="0" width="100%">
      <thead>
        <tr class="system" align="center">
          <td width="2%">&nbsp;</td>
          <td width="10%">Sample No</td>
          <td width="45%">Product Name</td>
          <td width="8%">Batch No</td>
          <td width="10%">Quantity</td>
          <td width="10%">Unit</td>
          <td width="15%">Status</td>
        </tr>
      </thead>
      <tbody>
        <?php 
                $query = "SELECT kp_id,kp_sampel_no,kp_batch_no,kp_product_name,kp_kuantiti_htr,\n                    kp_rskt_kod,kp_rkatp_kod,kp_requestSpl FROM k_lab\n                    LEFT JOIN k_produk ON kp_id=klb_kp_id\n                    WHERE klb_rlog_id IS NULL\n                    GROUP BY klb_ru_kod,klb_kp_id";
                $result = selQuery($query);
                while ($row = mysqli_fetch_assoc($result)) {
                    ?>
        <tr align="center">
          <td><input type="checkbox" value="<?php 
                    echo $row["kp_id"];
                    ?>
"></td>
          <td><?php 
                    echo $row['kp_sampel_no'];
                    ?>
</td>
          <td align="left">
            <div class="text-primary">
              <b><a style="cursor:pointer;" onclick="viewSample('<?php 
                    echo $row['kp_id'];
                    ?>
')"><?php 
                    echo $row['kp_product_name'];
                    ?>
</a></b>
            </div>
            <div class="text-muted">
              <?php 
                    echo $row['rkatp_desc'] . " - " . $row['rkatp_class'];
                    ?>
            </div>
          </td>
          <td align="left"><?php 
                    echo $row['kp_batch_no'];
                    ?>
</td>
          <td align="left"><?php 
                    echo $row['kp_kuantiti_htr'];
                    ?>
</td>
          <td align="left"><?php 
                    echo getSukatan($row['kp_rskt_kod'], 1);
                    ?>
</td>
          <td align="left">
            <?php 
                    if ($row['kp_requestSpl'] == 0) {
                        echo "New Sample";
                    } else {
                        echo "Ready to Collect";
                    }
                    ?>
          </td>
        </tr>
        <?php 
                }
                ?>
      </tbody>
    </table>
  </div>
  <div class="row" align="right">
    <div class="btn-group">
      <button type="button" class="btn btn-system dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
        Action<span class="caret ml5"></span>
      </button>
      <ul class="dropdown-menu" role="menu">
        <li><a onclick="readyCollect()">Ready to Collect</a></li>
      </ul>
    </div>
  </div>
  <div class="row" id="scanList"><?php 
                scanList();
                ?>
</div>
</div>
<?php 
            } else {
                ?>
<input type="hidden" id="mainTitle" value="Collection History" />
<div class="row">
  <table class="table table-striped table-bordered table-hover" id="primary" cellspacing="0" width="100%">
    <thead>
      <tr class="system" align="center">
        <td width="10%">Sample No</td>
        <td width="40%">Product Name</td>
        <td width="30%">Lab</td>
        <td width="10%">Date Collect</td>
        <td width="10%">Collect By</td>
      </tr>
    </thead>
    <tbody>
      <?php 
                $query = "SELECT kp_id,kp_sampel_no,kp_product_name,kp_batch_no,kp_kuantiti_htr,\n                  kp_rskt_kod,kst_ru_kod,kst_tkh_ambil,kst_collect_by,rkatp_class,rkatp_desc FROM k_stor\n                  LEFT JOIN k_produk ON k_produk.kp_id=k_stor.kst_kp_id\n                  LEFT JOIN ref_kat_produk ON rkatp_kod=kp_rkatp_kod\n                  ORDER BY kst_tkh_ambil";
                $result = selQuery($query);
                while ($row = mysqli_fetch_assoc($result)) {
                    ?>
      <tr align="center">
        <td><?php 
                    echo $row['kp_sampel_no'];
                    ?>
</td>
        <td align="left">
          <div class="text-primary">
          <b><a style="cursor:pointer;" onclick="viewSample('<?php 
                    echo $row['kp_id'];
                    ?>
')"><?php 
                    echo $row['kp_product_name'];
                    ?>
</a></b>
          </div>
          <div class="text-muted">
            <?php 
                    echo $row['rkatp_desc'] . " - " . $row['rkatp_class'];
                    ?>
          </div>
        </td>
        <td align="left"><?php 
                    echo retriveLab($row['kst_ru_kod']);
                    ?>
</td>
        <td><?php 
                    echo displayDate($row['kst_tkh_ambil']);
                    ?>
</td>
        <td align="left"><?php 
                    echo $row['kst_collect_by'];
                    ?>
</td>
      </tr>
      <?php 
                }
                ?>
    </tbody>
  </table>
</div>
<?php 
            }
        } elseif ($id == 33) {
            ?>
<div class="tab-content pn br-n admin-form">
  <?php 
            if ($code == 1) {
                $title = "Protocol";
            } else {
                $title = "Sample";
            }
            ?>
  <input type="hidden" id="mainTitle" value="<?php 
            echo $title;
            ?>
" />
  <div class="col-md-12">&nbsp;</div>
  <div class="col-md-6">
    <label for="reportName" class="field-label">Report Name</label>
    <select id="reportName" class="form-control" onchange="viewReport()">
        <option value="0" >-- Please Select --</option>
        <?php 
            if ($code == 1) {
                $query = "SELECT report_id,report_name FROM ref_lab_report\n                    WHERE report_type=1 AND report_active=1";
            } else {
                $query = "SELECT report_id,report_name FROM ref_lab_report\n                    WHERE report_type=2 AND report_active=1";
            }
            $result = selQuery($query);
            while ($row = mysqli_fetch_assoc($result)) {
                echo "<option value='" . $row['report_id'] . "'>" . $row['report_id'] . $row['report_name'] . "</option>";
            }
            ?>
    </select>
  </div>
  <div class="col-md-2">
    <label for="reportYear" class="field-label">Year</label>
    <select id="reportYear" class="form-control" onchange="viewReport()">
        <?php 
            $year = "2000";
            $curYear = date("Y");
            while ($curYear >= $year) {
                echo "<option value='" . $curYear . "'>" . $curYear . "</option>";
                $curYear--;
            }
            ?>
    </select>
  </div>
  <div class="col-md-12">&nbsp;</div>
  <div class="col-md-12" id="showReport"></div>
</div>
<?php 
        }
    }
}
							<th class="table-id">ID</th>
							<th class="table-title">显示标题</th>
							<th class="table-type">超链接地址</th>
							<th class="table-author am-hide-sm-only">状态</th>
							<th class="table-set">操作</th>
						</tr>
					</thead>
					<tbody>
						<?php if(is_array($linklist)): $i = 0; $__LIST__ = $linklist;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><tr>
								<td>
									<input type="checkbox" />
								</td>
								<td><?php echo $vo['idd'] ;?></td>
								<td><?php echo $vo['linkname'] ;?></td>
								<td><a href="#"><?php echo $vo['url'] ;?></a></td>
								<td class="am-hide-sm-only"><?php echo checkStatus($vo['status']) ;?></td>
								<td>
									<div class="am-btn-toolbar">
										<div class="am-btn-group am-btn-group-xs">
											<button class="am-btn am-btn-default am-btn-xs am-text-secondary" onclick="location.href='<?php echo U('edit',array('id'=>$vo['id'])) ;?>';return false;">
													<span class="am-icon-pencil-square-o"></span> 编辑
											</button>
											<?php if($vo['status'] == 1): ?><button class="am-btn am-btn-default am-btn-xs am-hide-sm-only" onclick="location.href='<?php echo U('changeStatus',array('id'=>$vo['id']));?>';return false;">
													<span class="am-icon-copy"></span> 禁用
												</button>
											<?php else: ?>
												<button class="am-btn am-btn-default am-btn-xs am-hide-sm-only" onclick="location.href='<?php echo U('changeStatus',array('id'=>$vo['id']));?>';return false;">
													<span class="am-icon-copy"></span> 启用
												</button><?php endif; ?>
											<button class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only"  onclick="location.href='<?php echo U('del',array('id'=>$vo['id']));?>';return false;">
												<span class="am-icon-trash-o"></span> 删除
예제 #17
0
function gamecp_stop($params)
{
    if ($params['configoption3'] == "1000" || $params['configoption3'] == "1001" || $params['configoption3'] == "1002") {
        return false;
    }
    $urlvars = array("action" => "stop", "customerid" => $params['clientsdetails']['userid'], "packageid" => $params['serviceid']);
    $args = array("plugin_gamecp_GameCP_URL" => $params['configoption1'], "plugin_gamecp_Connector_Passphrase" => $params['configoption2'], "debugging" => $params['configoption7']);
    $r_result = curl2gcp($args, $urlvars);
    $result = checkStatus($r_result);
    if ($result == "completed") {
        $result = "success";
    } else {
        logModuleCall("gamecp", "stop", $_REQUEST, $result);
        $result = "There was an error, please check Utilities, Logs,  Module Debug Log for more details.";
    }
    return $result;
}