function evaluation($pp_kod) { $sql = "SELECT la_protocol_id FROM lab_assign\n WHERE la_pp_kod='{$pp_kod}' AND la_ru_kod='" . $_SESSION['ru_kod'] . "'\n AND la_us_id='" . $_SESSION['us_id'] . "'"; $result = selQuery($sql); $string = array(); $lbl = "<i class='fa fa-close text-danger'></i>"; while ($row = mysqli_fetch_assoc($result)) { if ($row['la_protocol_id'] == "analystProtocol") { $sql = "SELECT ppc_admin_yes,ppc_allow_edit FROM p_product_correspondence\n WHERE ppc_pp_kod='{$pp_kod}' AND ppc_div_id='DIV_E12' AND ppc_admin_dept=3"; $result = selQuery($sql); $row = mysqli_fetch_assoc($result); if ($row['ppc_admin_yes'] == 2) { $display = false; } else { $display = true; } } elseif ($row['la_protocol_id'] == "docList") { $query = "SELECT protocol_id FROM p_protocol\n WHERE pp_kod='{$pp_kod}' AND (protocol_category IN('sumofMethod','otherDoc'))\n AND (evaluate_y IS NOT NULL OR evaluate_n IS NOT NULL OR evaluate_e IS NOT NULL)"; if ($countRow($query) == 2) { $display = true; } else { $display = false; } } else { array_push($string, checkEvaluate($row['la_protocol_id'])); } } if (in_array($lbl, $string) == false) { $display = true; } else { $display = false; } }
function distributedList($id, $pp_kod) { if (checkListAssign($pp_kod) > 0) { ?> <div class="row"> <div class="alert alert-sm alert-border-left alert-primary"> <b> <?php if ($id == 5 || $id == 6) { echo "Assigned List"; } else { echo "Supporting Documents"; } ?> </b> </div> <table class="table table-striped table-bordered table-hover" cellspacing="0" width="100%" id="assignList"> <thead> <tr class="primary" align="center"> <?php if ($id == 5 || $id == 6) { ?> <td width="20%">Category</td> <td width="20%">Description</td> <td width="30%">Lab</td> <td width="30%">Action</td> <?php } elseif (evaluate($pp_kod) == 0) { ?> <td width="20%">Category</td> <td width="30%">Description</td> <td width="30%">Action</td> <td width="5%"><i class="fa fa-check" title="Comply"></i></td> <td width="5%"><i class="fa fa-close" title="Not Comply"></i></td> <td width="5%"><i class="fa fa-share" title="Escalate"></i></td> <td width="5%"> </td> <?php } else { ?> <td width="20%">Category</td> <td width="50%">Description</td> <td width="30%">Action</td> <?php } ?> </tr> </thead> <tbody> <?php $query = "SELECT evaluate_y,evaluate_n,evaluate_e,la_protocol_id,la_kod,la_ru_kod FROM lab_assign\n LEFT JOIN p_protocol ON p_protocol.protocol_id=lab_assign.la_protocol_id\n WHERE la_pp_kod='{$pp_kod}'"; if ($id == 11) { $query .= " AND la_ru_kod='" . $_SESSION['ru_kod'] . "'"; } if ($id != 5 || $id != 6) { $query .= " AND la_protocol_id!='0'"; } $result = selQuery($query); while ($row = mysqli_fetch_assoc($result)) { ?> <tr align="center"> <?php if ($id == 5 || $id == 6) { ?> <td align="left"><?php echo retriveDetail("cat", $row['la_protocol_id']); ?> </td> <td align="left"><?php echo isEmpty(retriveDetail("desc", $row['la_protocol_id'])); ?> </td> <td align="left"><?php echo retriveLab($row['la_ru_kod']); ?> </td> <td align="right"> <?php if ($row['la_protocol_id'] != 0) { ?> <button class="btn btn-system btn-sm" onclick="helpTest('<?php echo $row['la_protocol_id']; ?> ')"><i class="fa fa-question"></i> Guide</button> <button class="btn btn-primary btn-sm" onclick="viewList('<?php echo $row['la_protocol_id']; ?> ')"><i class="fa fa-paperclip"></i> Attachment</button> <?php } ?> <buton class="btn btn-danger btn-sm" onclick="deleteAssign('<?php echo $row['la_kod']; ?> ')"><i class="fa fa-trash-o"></i> Delete</buton> </td> <?php } elseif (evaluate($pp_kod, $_SESSION['ru_kod']) == 0) { ?> <td align="left"><?php echo retriveDetail("cat", $row['la_protocol_id']); ?> </td> <td align="left"><?php echo isEmpty(retriveDetail("desc", $row['la_protocol_id'])); ?> </td> <td> <button class="btn btn-system btn-sm" onclick="helpTest('<?php echo $row['la_protocol_id']; ?> ')"><i class="fa fa-question"></i> Guide</button> <button class="btn btn-primary btn-sm" onclick="viewList('<?php echo $row['la_protocol_id']; ?> ')"><i class="fa fa-paperclip"></i> Attachment</button> <td><?php echo countArray("evaluate", $row['evaluate_y']); ?> </td> <td><?php echo countArray("evaluate", $row['evaluate_n']); ?> </td> <td><?php echo countArray("evaluate", $row['evaluate_e']); ?> </td> <td><?php echo checkEvaluate($row['la_protocol_id']); ?> </td> <?php } else { ?> <td align="left"><?php echo retriveDetail("cat", $row['la_protocol_id']); ?> </td> <td align="left"><?php echo retriveDetail("desc", $row['la_protocol_id']); ?> </td> <td> <button class="btn btn-system btn-sm" onclick="helpTest('<?php echo $row['la_protocol_id']; ?> ')"><i class="fa fa-question"></i> Guide</button> <button class="btn btn-primary btn-sm" onclick="viewList('<?php echo $row['la_protocol_id']; ?> ')"><i class="fa fa-paperclip"></i> Attachment</button> </td> <?php } ?> </tr> <?php } ?> </tbody> </table> <?php if ($id == 5 || $id == 6) { ?> <div class="col-md-12" align="right"><buton class="btn btn-danger btn-sm" onclick="deleteAllAssign('<?php echo $pp_kod; ?> ')"><i class="fa fa-trash-o"></i> Delete All</buton></div> <?php } ?> </div> <div class="row"> <div class="section-divider"></div> </div> <?php } }