Ejemplo n.º 1
0
         $query = "SELECT kltt_rt_kod,kltt_rt_desc,kltt_spec_desc,\n                      kltt_result_desc1,kltt_result_desc2,kltt_result_desc3,kltt_result_desc4\n                      FROM k_lab_task_test\n                      WHERE kltt_kp_id='" . $row['kp_id'] . "'";
         $result = selQuery($query);
         while ($rows = mysqli_fetch_assoc($result)) {
             $str = $rows['kltt_result_desc1'];
             if ($rows['kltt_result_desc2'] != NULL) {
                 $str .= "<br />" . $rows['kltt_result_desc2'];
             }
             if ($rows['kltt_result_desc3'] != NULL) {
                 $str .= "<br />" . $rows['kltt_result_desc3'];
             }
             if ($rows['kltt_result_desc4'] != NULL) {
                 $str .= "<br />" . $rows['kltt_result_desc4'];
             }
             $html .= '<tr align="center">
               <td width="5%">' . $count++ . '</td>
               <td width="10%">' . getTestCode($rows['kltt_rt_kod']) . getAccreditation($rows['kltt_rt_kod']) . '</td>
               <td width="30%" align="left">' . $rows['kltt_rt_desc'] . '</td>
               <td width="30%" align="left">' . $rows['kltt_spec_desc'] . '</td>
               <td width="25%" align="left">' . $str . '</td>
             </tr>';
         }
         $html .= '</tbody></table></div>
 <div class="col-md-12" style="border-bottom: 1px solid #000;"></div>
 <div class="col-md-12"><i> <font color="red">*</font> Accredited Test</i></div>
 <div class="col-md-12">&nbsp;</div>
 <div class="col-md-12">&nbsp;</div>
 <div class="col-md-12">&nbsp;</div>
 <div class="col-md-12">
   <table width="100%" cellspacing="0">
     <tr align="center">
       <td align="left">Tarikh Dicetak : <b>' . displayDate("now") . '</b></td>
Ejemplo n.º 2
0
function sampleDetail($id, $code, $sampleID)
{
    ?>
  <div class="row">
    <input type="hidden" id="tab" value="<?php 
    echo $code;
    ?>
">
    <div class="col-md-12">
      <div class="panel panel-alert" data-panel-color="panel-alert" data-panel-fullscreen="false" data-panel-title="false" data-panel-remove="false" data-panel-collapse="false">
        <div class="panel-heading ui-sortable-handle">
          <i class="fa fa-eyedropper"></i><span class="panel-title">Sample Information</span>
        </div>
        <div class="panel-body">
          <?php 
    if ($id == 16) {
        if ($code == 1) {
            $sql = "SELECT pp_kod AS kod,pp_nama AS product,pp_osa_kod_owner,pp_osa_kod_holder,rkatp_desc,rkatp_class,pp_rd_kod FROM p_product\n                      LEFT JOIN ref_kat_produk ON rkatp_kod=pp_rkatp_kod\n                      WHERE pp_kod='{$sampleID}'";
        } elseif ($code == 2) {
            $sql = "SELECT adrFormID AS kod,product_name AS product,remarks AS remark,quantity,batchno FROM adr_sample WHERE adrSampleID='{$sampleID}'";
        } elseif ($code == 3 || $code == 4) {
            $sql = "SELECT csps_cs_ruj AS kod,product_name AS product,remarks_to_lab AS remark,quantity,batchno FROM c_surv_sample WHERE pSampleID='{$sampleID}'";
        } elseif ($code == 5 || $code == 6) {
            $sql = "SELECT kp_id AS kod,kp_product_name AS product,kp_manufacturer,kp_holder,rkatp_desc,rkatp_class FROM k_produk\n                      LEFT JOIN ref_kat_produk ON rkatp_kod=kp_rkatp_kod\n                      WHERE kp_id='{$sampleID}'";
        }
        $result = selQuery($sql);
        $row = mysqli_fetch_assoc($result);
        $product = str_replace("'", "\\'", $row['product']);
        if ($code == 6) {
            $check = "SELECT kp_id FROM k_produk\n                        WHERE kp_id='{$sampleID}' AND kp_rsc_kod IN(1,4)";
        } else {
            if ($code == 1) {
                $group = 5;
            } elseif ($code == 2) {
                $group = 11;
            } elseif ($code == 3) {
                $group = 2;
            } elseif ($code == 4) {
                $group = 3;
            } elseif ($code == 5) {
                $group = 12;
            }
            $check = "SELECT kp_id,kp_batch_no,kp_kuantiti_htr,kp_tkh_terima,\n                        kp_tkh_luput,kp_complete_day,kp_sender,kp_rskt_kod,kp_rd_kod FROM k_produk\n                        WHERE kp_sampleID='{$sampleID}' AND kp_rsc_kod='{$group}'";
        }
        if (countRow($check) == 0) {
            if ($code == 1) {
                $group = 5;
            } elseif ($code == 2) {
                $group = 11;
            } elseif ($code == 3) {
                $group = 2;
            } elseif ($code == 4) {
                $group = 3;
            } elseif ($code == 5) {
                $group = 12;
            }
            $kp_id = kpID();
            $query = "INSERT INTO k_produk(kp_id,kp_sampleID,kp_rsc_kod,kp_product_name,kp_requestSpl)\n                        VALUE('{$kp_id}','{$sampleID}','{$group}','{$product}',0)";
            executeQuery($query);
        } else {
            $res = selQuery($check);
            $ro = mysqli_fetch_assoc($res);
            $kp_id = $ro['kp_id'];
        }
        $sampleID = $kp_id;
        ?>
          <input type="hidden" id="sampleID" value="<?php 
        echo $sampleID;
        ?>
">
          <div class="admin-form">
            <table class="table table-stripe table-hover" cellspacing="0" width="100%">
              <tbody>
                <?php 
        if ($code != 6) {
            ?>
                <tr>
                  <td>
                    <?php 
            if ($code == 2) {
                echo "ADR No";
            } else {
                if ($code == 3) {
                    echo "Complaint No";
                } else {
                    if ($code == 4) {
                        echo "Surveilance No";
                    } else {
                        echo "Call No";
                    }
                }
            }
            ?>
                  </td>
                  <td>:</td>
                  <td><b><?php 
            echo $row['kod'];
            ?>
</b></td>
                </tr>
                <?php 
        }
        ?>
                <tr>
                  <td width="24%">Product Name</td>
                  <td width="1%">:</td>
                  <td width="75%"><b><?php 
        echo $product;
        ?>
</b></td>
                </tr>
                <?php 
        if ($code == 1 || $code == 5 || $code == 6) {
            ?>
                <tr>
                  <td>Product Category</td>
                  <td>:</td>
                  <td><b><?php 
            echo $row['rkatp_desc'] . " - " . $row['rkatp_class'];
            ?>
</b></td>
                </tr>
                <tr>
                  <td>Manufacturer</td>
                  <td>:</td>
                  <td>
                    <b><?php 
            if ($code == 1) {
                echo getUser($row['pp_osa_kod_owner'], "os_sykt");
            } else {
                echo $row['kp_manufacturer'];
            }
            ?>
</b>
                  </td>
                </tr>
                <tr>
                  <td>Holder</td>
                  <td>:</td>
                  <td>
                    <b><?php 
            if ($code == 1) {
                echo getUser($row['pp_osa_kod_holder'], "os_sykt");
            } else {
                echo $row['kp_holder'];
            }
            ?>
</b>
                </td>
                </tr>
                <?php 
        } else {
            ?>
                <tr>
                  <td>Pasca Comment</td>
                  <td>:</td>
                  <td>
                    <div class="col-md-9">
                      <label class="field prepend-icon">
                        <textarea class="gui-textarea" id="comment" readonly><?php 
            echo $row['remark'];
            ?>
</textarea>
                        <label for="comment" class="field-icon">
                          <i class="fa fa-comments"></i>
                        </label>
                        <span class="input-footer">Pasca Comment</span>
                      </label>
                    </div>
                  </td>
                </tr>
                <?php 
        }
        ?>
              </tbody>
            </table>
          </div>
          <?php 
    } else {
        $query = "SELECT * FROM k_produk";
        if ($code == 1) {
            $query .= " LEFT JOIN p_product ON pp_kod=kp_sampleID\n                          LEFT JOIN ref_kat_produk ON rkatp_kod=pp_rkatp_kod";
        }
        $query .= " WHERE kp_id='{$sampleID}'";
        //echo $query;
        $result = selQuery($query);
        $row = mysqli_fetch_assoc($result);
        ?>
          <input type="hidden" id="sampleID" value="<?php 
        echo $sampleID;
        ?>
">
          <table class="table table-stripe table-hover" cellspacing="0" width="100%">
            <tbody>
              <tr>
                <td colspan="3" align="right">
                  <?php 
        getBarcode($row['kp_sampel_no']);
        ?>
                </td>
              </tr>
              <tr>
                <td>Sample Status</div>
                <td>:</td>
                <td>
                  <?php 
        if ($row['kp_requestSpl'] == 0) {
            echo "<b>In Store</b>";
        } elseif ($row['kp_requestSpl'] == 1) {
            echo "<b>Ready to Collect</b>";
        } else {
            echo "<b>Sample Collected</b>";
        }
        ?>
                </td>
              </tr>
              <tr>
                <td width="24%">Sample Number</td>
                <td width="1%">:</td>
                <td width="75%"><b><?php 
        echo $row['kp_sampel_no'];
        ?>
</b></td>
              </tr>
              <tr>
                <td>Product Name</td>
                <td>:</td>
                <td><b><?php 
        echo $row['kp_product_name'];
        ?>
</b></td>
              </tr>
              <?php 
        if ($row['kp_rsc_kod'] == 5) {
            ?>
              <tr>
                <td>Product Category</td>
                <td>:</td>
                <td><b><?php 
            echo $row['rkatp_desc'] . " - " . $row['rkatp_class'];
            ?>
</b></td>
              </tr>
              <tr>
                <td>Manufacturer</td>
                <td>:</td>
                <td><b><?php 
            echo $row['kp_manufacturer'];
            ?>
</b></td>
              </tr>
              <tr>
                <td>Holder</td>
                <td>:</td>
                <td><b><?php 
            echo $row['kp_holder'];
            ?>
</b></td>
              </tr>
              <?php 
        }
        ?>
              <tr>
                <td>Batch Number</td>
                <td>:</td>
                <td><b><?php 
        echo $row['kp_batch_no'];
        ?>
</b></td>
              </tr>
              <tr>
                <td>Quantity Received</td>
                <td>:</td>
                <td><b><?php 
        echo $row['kp_kuantiti_htr'];
        ?>
</b></td>
              </tr>
              <tr>
                <td>Dosage</td>
                <td>:</td>
                <td><b><?php 
        echo getDosage($row['kp_rd_kod'], 1);
        ?>
</b></td>
              </tr>
              <tr>
                <td>Unit</td>
                <td>:</td>
                <td><b><?php 
        getSukatan($row['kp_rskt_kod'], 1);
        ?>
</b></td>
              </tr>
              <tr>
                <td>Expiry Date</td>
                <td>:</td>
                <td><b><?php 
        echo displayDate($row['kp_tkh_luput']);
        ?>
</b></td>
              </tr>
              <tr>
                <td>Received Date</td>
                <td>:</td>
                <td><b><?php 
        echo displayDate($row['kp_tkh_terima']);
        ?>
</b></td>
              </tr>
              <tr>
                <td>Expected Complete Day(s)</td>
                <td>:</td>
                <td><b><?php 
        echo $row['kp_complete_day'];
        ?>
</b></td>
              </tr>
              <tr>
                <td>Sender</td>
                <td>:</td>
                <td><b><?php 
        echo $row['kp_sender'];
        ?>
</b></td>
              </tr>
            </tbody>
          </table>
          <?php 
    }
    ?>
        </div>
      </div>
    </div>
  </div>
  <?php 
    if ($id == 16) {
        ?>
  <div class="row">
    <div class="col-md-12">
      <div class="panel panel-alert" data-panel-color="panel-alert" data-panel-fullscreen="false" data-panel-title="false" data-panel-remove="false" data-panel-collapse="false">
        <div class="panel-heading ui-sortable-handle">
          <i class="fa fa-edit"></i><span class="panel-title">To be filled by QCC Officer</span>
        </div>
        <div class="panel-body">
          <div class="admin-form">
            <table class="table table-stripe table-hover" cellspacing="0" width="100%">
              <tbody>
                <tr>
                  <td width="24%">Batch Number <font color="red">*</font></td>
                  <td width="1%">:</td>
                  <td width="75%">
                    <div class="col-md-4">
                      <label class="field prepend-icon">
                        <input type="text" id="txt_batch" class="gui-input" value="<?php 
        if (!$row['batchno']) {
            echo $ro['kp_batch_no'];
        } else {
            echo $row['batchno'];
        }
        ?>
" onchange="savedSample('txt_batch')">
                        <label for="txt_batch" class="field-icon">
                          <i class="fa fa-calculator"></i>
                        </label>
                      </label>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td>Quantity Received <font color="red">*</font></td>
                  <td>:</td>
                  <td>
                    <div class="col-md-4">
                      <label class="field prepend-icon">
                        <input type="text" id="txt_quantity" class="gui-input" value="<?php 
        if (!$row['quantity']) {
            echo $ro['kp_kuantiti_htr'];
        } else {
            echo $row['quantity'];
        }
        ?>
" onchange="savedSample('txt_quantity')">
                        <label for="txt_quantity" class="field-icon">
                          <i class="fa fa-calculator"></i>
                        </label>
                      </label>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td>Dosage</td>
                  <td>:</td>
                  <td>
                    <div class="col-md-4">
                      <label class="field select">
                        <select id="txt_dosage" onchange="savedSample('txt_dosage')">
                          <?php 
        if (!$row['pp_rd_kod']) {
            echo getDosage($ro['kp_rd_kod']);
        } else {
            echo getDosage($row['pp_rd_kod']);
        }
        ?>
                        </select>
                        <i class="arrow"></i>
                      </label>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td>Unit</td>
                  <td>:</td>
                  <td>
                    <div class="col-md-4">
                      <label class="field select" onchange="savedSample('txt_unit')">
                        <select id="txt_unit">
                          <?php 
        getSukatan($ro['kp_rskt_kod']);
        ?>
                        </select>
                        <i class="arrow"></i>
                      </label>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td>Expiry Date</td>
                  <td>:</td>
                  <td>
                    <div class="col-md-4">
                      <label class="field prepend-icon">
                        <input type="text" name="txt_expiry" id="txt_expiry" class="gui-input" readonly value="<?php 
        echo displayDate($ro['kp_tkh_luput']);
        ?>
" onchange="savedSample('txt_expiry')">
                        <label for="txt_expiry" class="field-icon">
                          <i class="fa fa-calendar"></i>
                        </label>
                      </label>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td>Received Date <font color="red">*</font></td>
                  <td>:</td>
                  <td>
                    <div class="col-md-4">
                      <label class="field prepend-icon">
                        <input type="text" name="txt_received" id="txt_received" class="gui-input" readonly value="<?php 
        echo displayDate($ro['kp_tkh_terima']);
        ?>
" onchange="savedSample('txt_received')">
                        <label for="txt_received" class="field-icon">
                          <i class="fa fa-calendar"></i>
                        </label>
                      </label>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td>Expected Complete Day(s) <font color="red">*</font></td>
                  <td>:</td>
                  <td>
                    <div class="col-md-4">
                      <label class="field prepend-icon">
                        <input type="number" name="txt_complete" id="txt_complete" class="gui-input" value="<?php 
        echo $ro['kp_complete_day'];
        ?>
" onchange="savedSample('txt_complete')">
                        <label for="txt_complete" class="field-icon">
                          <i class="fa fa-calculator"></i>
                        </label>
                      </label>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td>Sender <font color="red">*</font></td>
                  <td>:</td>
                  <td>
                    <div class="col-md-7">
                      <label class="field prepend-icon">
                        <input type="text" name="txt_sender" id="txt_sender" class="gui-input" value="<?php 
        echo $ro['kp_sender'];
        ?>
" onchange="savedSample('txt_sender')">
                        <label for="txt_sender" class="field-icon">
                          <i class="fa fa-user"></i>
                        </label>
                      </label>
                    </div>
                  </td>
                </tr>
              </tbody>
            </table>
          </div>
        </div>
      </div>
    </div>
  </div>
  <?php 
    }
    if ($id == 19 || $id == 20) {
        ?>
  <div class="row">
    <div class="col-md-12">
      <div class="panel panel-alert" data-panel-color="panel-alert" data-panel-fullscreen="false" data-panel-title="false" data-panel-remove="false" data-panel-collapse="false">
        <div class="panel-heading ui-sortable-handle">
          <i class="fa fa-random"></i><span class="panel-title">Distribute Sample</span>
        </div>
        <div class="panel-body">
          <div class="admin-form">
            <table class="table table-stripe table-hover" cellspacing="0" width="100%">
              <tbody>
                <tr>
                  <td width="24%">Unit <font class="text-danger">*</font></td>
                  <td width="1%">:</td>
                  <td width="75%">
                    <div class="col-md-10">
                      <select id="txt_lab" class="form-control">
                          <option value='0'>-- Please Select --</option>
                          <?php 
        getLab();
        ?>
                      </select>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td>Quantity <font class="text-danger">*</font></td>
                  <td>:</td>
                  <td>
                    <div class="col-md-4">
                      <label class="field prepend-icon">
                        <input type="text" name="txt_assign" id="txt_assign" class="gui-input">
                        <label for="txt_assign" class="field-icon">
                          <i class="fa fa-calculator"></i>
                        </label>
                      </label>
                    </div>
                    <div class="col-md-8">
                      <button class="btn btn-alert" onclick="balance('<?php 
        echo $sampleID;
        ?>
')"><i class="fa fa-plus"></i> Balance</button>
                      <button class="btn btn-alert" onclick="assignSample('<?php 
        echo $sampleID;
        ?>
')"><i class="fa fa-pencil"></i> Assign Sample</button>
                    </div>
                  </td>
                </tr>
              </tbody>
            </table>
          </div>
        </div>
      </div>
    </div>
  </div>
  <?php 
        $sql = "SELECT klb_kod,klb_ru_kod,klb_kuantiti_agih,klb_rskt_kod FROM k_lab\n          WHERE klb_kp_id='{$sampleID}'";
        if (countRow($sql) > 0) {
            ?>
  <div class="row">
    <div class="col-md-12">
      <div class="panel panel-alert" data-panel-color="panel-alert" data-panel-fullscreen="false" data-panel-title="false" data-panel-remove="false" data-panel-collapse="false">
        <div class="panel-heading ui-sortable-handle">
          <i class="fa fa-list"></i><span class="panel-title">Quantity Distribute to Each Lab</span>
        </div>
        <div class="panel-body">
          <table class="table table-striped table-hover" id="primary" cellspacing="0" width="100%">
            <thead>
              <tr class="alert" align="center">
                <td width="5%">No</td>
                <td width="30%">Lab Name</td>
                <td width="20%">Quantity</td>
                <td width="20%">Units</td>
                <td width="25%">Action</td>
              </tr>
            </thead>
            <tbody>
              <?php 
            $count = 1;
            $result = selQuery($sql);
            while ($row = mysqli_fetch_assoc($result)) {
                ?>
              <tr align="center">
                <td><?php 
                echo $count++;
                ?>
</td>
                <td align="left"><?php 
                echo retriveLab($row['klb_ru_kod']);
                ?>
</td>
                <td><?php 
                echo $row['klb_kuantiti_agih'];
                ?>
</td>
                <td><?php 
                echo $row['klb_rskt_kod'];
                ?>
</td>
                <td>
                  <button class="btn btn-alert btn-sm" onclick="sampleTest('<?php 
                echo $row['klb_kod'];
                ?>
')"><i class="fa fa-plus"></i> Add Test</button>
                  <button class="btn btn-danger btn-sm" onclick="removeAssign('<?php 
                echo $row['klb_kod'];
                ?>
','<?php 
                echo $sampleID;
                ?>
')"><i class="fa fa-trash-o"></i> Remove</button>
                </td>
              </tr>
              <?php 
            }
            ?>
            </tbody>
          </table>
          <div>&nbsp;</div>
          <div align="right">
            <button class="btn btn-danger btn-sm" onclick="removeAllAssign('<?php 
            echo $sampleID;
            ?>
')"><i class="fa fa-trash-o"></i> Remove All</button>
          </div>
        </div>
      </div>
    </div>
  </div>
  <?php 
        }
        $query = "SELECT kltt_kod,kltt_ru_kod,kltt_rt_kod,kltt_rt_desc FROM k_lab_task_test\n            WHERE kltt_kp_id='{$sampleID}' ORDER BY kltt_ru_kod";
        if (countRow($query) > 0) {
            ?>
  <div class="row">
    <div class="col-md-12">
      <div class="panel panel-alert" data-panel-color="panel-alert" data-panel-fullscreen="false" data-panel-title="false" data-panel-remove="false" data-panel-collapse="false">
        <div class="panel-heading ui-sortable-handle">
          <i class="fa fa-list"></i><span class="panel-title">Test(s) Assigned</span>
        </div>
        <div class="panel-body">
          <table class="table table-striped table-hover" id="second" cellspacing="0" width="100%">
            <thead>
              <tr class="alert" align="center">
                <td width="5%">No</td>
                <td width="30%">Lab Name</td>
                <td width="10%">Test Code</td>
                <td width="45%">Description</td>
                <td width="10%">Action</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 align="left"><?php 
                echo retriveLab($row['kltt_ru_kod']);
                ?>
</td>
                <td><?php 
                echo getTestCode($row['kltt_rt_kod']);
                ?>
</td>
                <td align="left"><a style="cursor:pointer;" id="<?php 
                echo $row['kltt_kod'];
                ?>
" onclick="changeDesc('<?php 
                echo $row['kltt_kod'];
                ?>
')"><?php 
                echo $row['kltt_rt_desc'];
                ?>
</a></td>
                <td><button class="btn btn-danger btn-sm" onclick="deleteTest('<?php 
                echo $row['kltt_kod'];
                ?>
','<?php 
                echo $kp_id;
                ?>
',1)"><i class="fa fa-trash-o"></i> Remove</button></td>
              </tr>
              <?php 
            }
            ?>
            </tbody>
          </table>
          <div>&nbsp;</div>
          <div align="right">
            <button class="btn btn-danger btn-sm" onclick="deleteAllTest('<?php 
            echo $sampleID;
            ?>
')"><i class="fa fa-trash-o"></i> Remove All</button>
          </div>
        </div>
      </div>
    </div>
  </div>
  <?php 
        }
    } elseif ($id == 21 || $id == 23 || $id == 25) {
        $query = "SELECT kltt_kod,kltt_ru_kod,kltt_rt_kod,kltt_rt_desc FROM k_lab_task_test\n              WHERE kltt_kp_id='{$sampleID}' AND kltt_ru_kod='" . $_SESSION['ru_kod'] . "'";
        $sql = "SELECT klb_kuantiti_agih,klb_kod FROM k_lab\n            WHERE klb_kp_id='{$sampleID}' AND klb_ru_kod='" . $_SESSION['ru_kod'] . "'";
        $res = selQuery($sql);
        $ro = mysqli_fetch_assoc($res);
        ?>
    <div class="row">
      <div class="col-md-12">
        <div class="panel panel-alert" data-panel-color="panel-alert" data-panel-fullscreen="false" data-panel-title="false" data-panel-remove="false" data-panel-collapse="false">
          <div class="panel-heading ui-sortable-handle">
            <i class="fa fa-list"></i><span class="panel-title">Test(s) Assigned</span>
          </div>
          <div class="panel-body">
            <div class="admin-form">
              <table class="table" cellspacing="0" width="100%">
                <tbody>
                  <tr>
                    <td width="24%">Quantity Assigned</td>
                    <td width="1%">:</td>
                    <td width="75%"><b><?php 
        echo $ro['klb_kuantiti_agih'];
        ?>
</b></td>
                  </tr>
                  <tr>
                    <td colspan="3">
                      <?php 
        if (getSampleResult($sampleID, $_SESSION['ru_kod']) == true) {
            ?>
                      <table class="table table-striped table-bordered table-hover" cellspacing="0" width="100%">
                        <thead>
                          <tr class="alert" align="center">
                            <td width="5%">No</td>
                            <td width="10%">Code</td>
                            <td width="25%">Test</td>
                            <td width="25%">Specification</td>
                            <td width="15%">Result</td>
                            <td width="20%">Action</td>
                          </tr>
                        </thead>
                        <tbody>
                          <?php 
            $count = 1;
            $query = "SELECT kltt_kod,kltt_rt_kod,kltt_rt_desc,kltt_spec_desc,\n                                      kltt_result_desc1,kltt_result_desc2,kltt_result_desc3,kltt_result_desc4\n                                      FROM k_lab_task_test\n                                      WHERE kltt_kp_id='{$sampleID}' AND kltt_ru_kod='" . $_SESSION['ru_kod'] . "'";
            $result = selQuery($query);
            while ($rows = mysqli_fetch_assoc($result)) {
                ?>
                          <tr align="center">
                            <td><?php 
                echo $count++;
                ?>
</td>
                            <td>
                              <?php 
                echo getTestCode($rows['kltt_rt_kod']);
                echo getAccreditation($rows['kltt_rt_kod']);
                ?>
                            </td>
                            <td align="left"><?php 
                echo $rows['kltt_rt_desc'];
                ?>
</td>
                            <td align="left"><?php 
                echo $rows['kltt_spec_desc'];
                ?>
</td>
                            <td align="left">
                              <?php 
                $str = $rows['kltt_result_desc1'];
                if ($rows['kltt_result_desc2'] != NULL) {
                    $str .= "<br />" . $rows['kltt_result_desc2'];
                }
                if ($rows['kltt_result_desc3'] != NULL) {
                    $str .= "<br />" . $rows['kltt_result_desc3'];
                }
                if ($rows['kltt_result_desc4'] != NULL) {
                    $str .= "<br />" . $rows['kltt_result_desc4'];
                }
                echo $str;
                ?>
                            </td>
                            <td>
                              <button class="btn btn-alert btn-sm" onclick="evaluateSample('<?php 
                echo $rows['kltt_kod'];
                ?>
')"><i class="fa fa-edit"></i> Edit</button>
                              <button class="btn btn-danger btn-sm"><i class="fa fa-trash-o"></i> Remove</button>
                            </td>
                          </tr>
                          <?php 
            }
            ?>
                        </tbody>
                      </table>
                      <?php 
        } else {
            ?>
                      <table class="table table-striped table-hover" id="second" cellspacing="0" width="100%">
                        <thead>
                          <tr class="alert" align="center">
                            <td width="5%">No</td>
                            <td width="10%">Test Code</td>
                            <td width="75%">Description</td>
                            <td width="10%">Action</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 getTestCode($row['kltt_rt_kod']);
                ?>
</td>
                            <td align="left"><a style="cursor:pointer;" id="<?php 
                echo $row['kltt_kod'];
                ?>
" onclick="changeDesc('<?php 
                echo $row['kltt_kod'];
                ?>
')"><?php 
                echo $row['kltt_rt_desc'];
                ?>
</a></td>
                            <td><button class="btn btn-danger btn-sm" onclick="deleteTest('<?php 
                echo $row['kltt_kod'];
                ?>
','<?php 
                echo $kp_id;
                ?>
',1)"><i class="fa fa-trash-o"></i> Remove</button></td>
                          </tr>
                          <?php 
            }
            ?>
                        </tbody>
                      </table>
                      <?php 
        }
        ?>
                    </td>
                  </tr>
                  <?php 
        if ($id == 23 || $id == 25) {
            ?>
                  <tr>
                    <td colspan="3" align="right">
                      <button class="btn btn-alert btn-sm" onclick="sampleTest('<?php 
            echo $ro['klb_kod'];
            ?>
')"><i class="fa fa-plus"></i> Add Test</button>
                    </td>
                  </tr>
                  <tr>
                    <td>Pharmacist</td>
                    <td>:</td>
                    <td>
                      <?php 
            if (getSampleResult($sampleID, $_SESSION['ru_kod']) == true) {
                if ($id == 23) {
                    $query = "SELECT klb_tp_kod FROM k_lab\n                                      WHERE klb_kp_id='{$sampleID}' AND klb_ru_kod='" . $_SESSION['ru_kod'] . "'";
                    $result = selQuery($query);
                    $row = mysqli_fetch_assoc($result);
                    $us_id = $row['klb_tp_kod'];
                    $name = getUsername($row['klb_tp_kod']);
                } elseif ($id == 25) {
                    $query = "SELECT kltt_tp_kod FROM k_lab_task_test\n                                      WHERE kltt_kp_id='{$sampleID}' AND kltt_ru_kod='" . $_SESSION['ru_kod'] . "'";
                    $result = selQuery($query);
                    $row = mysqli_fetch_assoc($result);
                    $us_id = $row['kltt_tp_kod'];
                    $name = getUsername($row['kltt_tp_kod']);
                }
                ?>
                        <div class="col-md-5">
                          <label class="field prepend-icon">
                            <input type="hidden" id="pharmacist_id" value="<?php 
                echo $us_id;
                ?>
"/>
                            <input type="text" id="txt_pharmacist" class="gui-input" value="<?php 
                echo $name;
                ?>
" readonly>
                            <label for="txt_pharmacist" class="field-icon">
                              <i class="fa fa-user-md"></i>
                            </label>
                          </label>
                        </div>
                        <?php 
            } else {
                ?>
                      <div class="col-md-5">
                        <label class="field prepend-icon">
                          <input type="hidden" id="pharmacist_id"/>
                          <input type="text" id="txt_pharmacist" class="gui-input" readonly>
                          <label for="txt_pharmacist" class="field-icon">
                            <i class="fa fa-user-md"></i>
                          </label>
                        </label>
                      </div>
                      <?php 
            }
            ?>
                      <div class="col-md-2">
                        <?php 
            if ($id == 23) {
                ?>
                        <button class="btn btn-alert" onclick="viewPharma('sample')"><i class="fa fa-plus"></i> Assign Pharmacist</button>
                        <?php 
            } elseif ($id == 25) {
                ?>
                        <button class="btn btn-alert" onclick="viewPharma('assist')"><i class="fa fa-plus"></i> Assign Assistant Pharmacist</button>
                        <?php 
            }
            ?>
                      </div>
                    </td>
                  </tr>
                  <?php 
        }
        ?>
                </tbody>
              </table>
            </div>
          </div>
        </div>
      </div>
    </div>
  <?php 
    } elseif ($id == 27) {
        $sql = "SELECT klb_kuantiti_agih,klb_kod FROM k_lab\n            WHERE klb_kp_id='{$sampleID}' AND klb_ru_kod='" . $_SESSION['ru_kod'] . "'";
        $res = selQuery($sql);
        $ro = mysqli_fetch_assoc($res);
        ?>
  <div class="row">
    <div class="col-md-12">
      <div class="panel panel-alert" data-panel-color="panel-alert" data-panel-fullscreen="false" data-panel-title="false" data-panel-remove="false" data-panel-collapse="false">
        <div class="panel-heading ui-sortable-handle">
          <span class="panel-title">Enter Result</span>
        </div>
        <div class="panel-body">
          <table class="table" cellspacing="0" width="100%">
            <tbody>
              <tr>
                <td width="24%">Quantity Assigned</td>
                <td width="1%">:</td>
                <td width="75%"><b><?php 
        echo $ro['klb_kuantiti_agih'];
        ?>
</b></td>
              </tr>
              <tr>
                <td colspan="3">
                  <table class="table table-striped table-hover" id="second" cellspacing="0" width="100%">
                    <thead>
                      <tr class="alert" align="center">
                        <td width="5%">No</td>
                        <td width="15%">Test Code</td>
                        <td width="65%">Description</td>
                        <td width="10%">Action</td>
                        <td width="5%">&nbsp;</td>
                      </tr>
                    </thead>
                    <tbody>
                      <?php 
        $count = 1;
        $query = "SELECT * FROM k_lab_task_test\n                                WHERE kltt_kp_id='{$sampleID}' AND kltt_ru_kod='" . $_SESSION['ru_kod'] . "'";
        $result = selQuery($query);
        while ($row = mysqli_fetch_assoc($result)) {
            ?>
                      <tr align="center">
                        <td><?php 
            echo $count++;
            ?>
</td>
                        <td><?php 
            echo getTestCode($row['kltt_rt_kod']);
            ?>
</td>
                        <td align="left"><?php 
            echo $row['kltt_rt_desc'];
            ?>
</td>
                        <td><button class="btn btn-alert btn-sm" onclick="evaluateSample('<?php 
            echo $row['kltt_kod'];
            ?>
')"><i class="fa fa-plus"></i> Add Result</button></td>
                        <td>
                          <?php 
            if ($row['kltt_result'] == NULL) {
                echo "<input type='hidden' id='testCount' value='1' />";
                echo "<i class='fa fa-close text-danger'></i>";
            } else {
                echo "<i class='fa fa-check text-success'></i>";
            }
            ?>
                        </td>
                      </tr>
                      <?php 
        }
        ?>
                    </tbody>
                  </table>
                </td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
    </div>
  </div>
  <?php 
    }
    ?>
  <div class="row">
    <div class="col-md-12">
      <div class="admin-form">
        <label class="field prepend-icon">
          <textarea class="gui-textarea" id="txt_comment" placeholder="Enter Comment..." <?php 
    echo "onchange=\"saveComment('" . $sampleID . "',0)\"";
    ?>
><?php 
    echo getComments($id, $sampleID, $_SESSION['us_id']);
    ?>
</textarea>
          <label for="comment" class="field-icon">
            <i class="fa fa-comments"></i>
          </label>
          <span class="input-footer">
            <?php 
    if ($id == 16) {
        echo "Lab Admin comment";
    } elseif ($id == 19) {
        echo "Coordinating Unit comment";
    } elseif ($id == 20) {
        echo "Redistribute comment from Coordinating Unit";
    } elseif ($id == 21) {
        echo "Section Head comment";
    } elseif ($id == 23) {
        echo "Unit Head comment";
    } elseif ($id == 25) {
        echo "Pharmacist comment";
    } elseif ($id == 27) {
        echo "Analyst overall comment";
    }
    ?>
          </span>
        </label>
      </div>
    </div>
  </div>
  <div class="row">
    <div class="col-md-12">&nbsp;</div>
    <div class="col-md-11">
      <button class="btn btn-alert" onclick="content(<?php 
    echo $code;
    ?>
)"><i class="fa fa-arrow-left"></i> Back</button>
      <button class="btn btn-alert" onclick="showProduct(<?php 
    echo $sampleID;
    //$row['kod'];
    ?>
)"><i class="fa fa-info"></i> Product Details</button>
      <?php 
    if ($id == 16) {
        ?>
      <button class="btn btn-alert" onclick="receiveSample()"><i class="fa fa-check"></i> Receive Sample</button>
      <?php 
        if ($code == 1) {
            ?>
      <button class="btn btn-alert" onclick="rejectSample()"><i class="fa fa-close"></i> Reject Sample</button>
      <?php 
        }
    } else {
        ?>
      <button class="btn btn-alert" onclick="chronology(1,'<?php 
        echo $sampleID;
        ?>
')"><i class="fa fa-sort-alpha-asc"></i> Chronology</button>
      <?php 
        if ($id == 19) {
            ?>
      <button class="btn btn-alert" onclick="printBarcode('<?php 
            echo $sampleID;
            ?>
')"><i class="fa fa-print"></i> Print Barcode</button>
      <?php 
        }
        if ($id == 23 || $id == 25 || $id == 27) {
            ?>
        <div class="btn-group">
      <button stype="button" class="btn btn-alert dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
        <i class="fa fa-print"></i> Print
        <span class="caret ml5"></span>
      </button>
      <ul class="dropdown-menu" role="menu">
        <li><a style="cursor:pointer;" onclick="printBarcode('<?php 
            echo $sampleID;
            ?>
')">Barcode</a></li>
        <li><a style="cursor:pointer;" onclick="printDistribute('<?php 
            echo $sampleID;
            ?>
')">Distribution Detail</a></li>
      </ul>
    </div>
      <?php 
        }
        ?>
      <button class="btn btn-alert" onclick="submitSample('<?php 
        echo $sampleID;
        ?>
')"><i class="fa fa-send"></i> Submit</button>
      <?php 
        if (getSampleResult($sampleID, $_SESSION['ru_kod']) == true) {
            ?>
      <button class="btn btn-alert" onclick="approveResult()"><i class="fa fa-check"></i> Approve</button>
      <?php 
        }
        ?>
      <?php 
    }
    ?>
    </div>
  </div>
  <?php 
}
Ejemplo n.º 3
0
function sampleResult($kp_id)
{
    $query = "SELECT * FROM k_produk\n            WHERE kp_id='{$kp_id}'";
    $result = selQuery($query);
    $row = mysqli_fetch_assoc($result);
    ?>
<div class="row" id="preview">
  <div class="tab-content pn br-n admin-form">
    <div class="col-md-12" align="center">
      <b>BIRO PENGAWALAN FARMASEUTIKAL KEBANGSAAN<br />
      KEMENTERIAN KESIHATAN<br />
      JALAN UNIVERSITI<br />
      46730 PETALING JAYA SELANGOR MALAYSIA</b>
    </div>
    <div class="col-md-12">&nbsp;</div>
    <div class="col-md-12" align="center"><b>SIJIL ANALISIS</b></div>
    <div class="col-md-12">&nbsp;</div>
    <div class="col-md-12" style="border-bottom: 1px solid #000;"></div>
    <div class="col-md-12">
      <table cellspacing="0" width="100%">
        <tr align="left">
          <td><b>NO SAMPEL</b></td>
          <td><?php 
    echo $row['kp_sampel_no'];
    ?>
</td>
          <td><b>TUJUAN</b></td>
          <td><?php 
    echo sampleCategory($row['kp_rsc_kod']);
    ?>
</td>
        </tr>
        <tr align="left">
          <td><b>NAMA KELUARAN</b></td>
          <td><?php 
    echo $row['kp_product_name'];
    ?>
</td>
          <td><b>PEMEGANG</b></td>
          <td>&nbsp;</td>
        </tr>
        <tr align="left">
          <td><b>NO KUMPULAN</b></td>
          <td><?php 
    echo $row['kp_batch_no'];
    ?>
</td>
          <td><b>TARIKH DITERIMA</b></td>
          <td><?php 
    echo displayDate($row['kp_tkh_terima']);
    ?>
</td>
        </tr>
        <tr align="left">
          <td><b>TARIKH DIBUAT/LUPUT</b></td>
          <td><?php 
    echo displayDate($row['kp_tkh_luput']);
    ?>
</td>
          <td><b>NO PEMONITORAN / ADUAN</b></td>
          <td>&nbsp;</td>
        </tr>
        <tr align="left">
          <td><b>NO PENDAFTARAN</b></td>
          <td>&nbsp;</td>
          <td><b>NO RUJUKAN</b></td>
          <td>&nbsp;</td>
        </tr>
        <tr align="left">
          <td><b>PENGHANTAR</b></td>
          <td></td>
          <td><b>RUJUKAN TUAN</b></td>
          <td></td>
        </tr>
        <tr align="left">
          <td><b>PENGILANG</b></td>
          <td colspan="3"></td>
        </tr>
      </table>
    </div>
    <div class="col-md-12">&nbsp;</div>
    <div class="col-md-12">
      <table width="100%" cellspacing="0" class="table table-striped">
        <thead style="border-bottom: 1px solid #000;border-top: 1px solid #000;">
          <tr align="center">
            <td width="5%">BIL</td>
            <td width="10%">KOD</td>
            <td width="30%">UJIAN</td>
            <td width="30%">SPESIFIKASI</td>
            <td width="25%">KEPUTUSAN</td>
          </tr>
        </thead>
        <tbody>
          <?php 
    $count = 1;
    $query = "SELECT kltt_rt_kod,kltt_rt_desc,kltt_spec_desc,\n                      kltt_result_desc1,kltt_result_desc2,kltt_result_desc3,kltt_result_desc4\n                      FROM k_lab_task_test\n                      WHERE kltt_kp_id='{$kp_id}'";
    $result = selQuery($query);
    while ($rows = mysqli_fetch_assoc($result)) {
        ?>
          <tr align="center">
            <td><?php 
        echo $count++;
        ?>
</td>
            <td>
              <?php 
        echo getTestCode($rows['kltt_rt_kod']);
        echo getAccreditation($rows['kltt_rt_kod']);
        ?>
            </td>
            <td align="left"><?php 
        echo $rows['kltt_rt_desc'];
        ?>
</td>
            <td align="left"><?php 
        echo $rows['kltt_spec_desc'];
        ?>
</td>
            <td align="left">
              <?php 
        $str = $rows['kltt_result_desc1'];
        if ($rows['kltt_result_desc2'] != NULL) {
            $str .= "<br />" . $rows['kltt_result_desc2'];
        }
        if ($rows['kltt_result_desc3'] != NULL) {
            $str .= "<br />" . $rows['kltt_result_desc3'];
        }
        if ($rows['kltt_result_desc4'] != NULL) {
            $str .= "<br />" . $rows['kltt_result_desc4'];
        }
        echo $str;
        ?>
            </td>
          </tr>
          <?php 
    }
    ?>
        </tbody>
      </table>
    </div>
    <div class="col-md-12" style="border-bottom: 1px solid #000;"></div>
    <div class="col-md-12"><i> <font color="red">*</font> Accredited Test</i></div>
    <!-- <div class="col-md-12">&nbsp;</div>
    <div class="col-md-12"><i> Note : This certificate is computer generated and does not require any Seal/Signature.</i></div> -->
    <div class="col-md-12">&nbsp;</div>
    <div class="col-md-12">&nbsp;</div>
    <div class="col-md-12">&nbsp;</div>
    <div class="col-md-12">
      <table width="100%" cellspacing="0">
        <tr align="center">
          <td align="left">Tarikh Dicetak : <b><?php 
    echo displayDate("now");
    ?>
</b></td>
          <td>.....................................................................</td>
          <?php 
    if ($row['kp_rs_level'] == '411') {
        ?>
          <td>.....................................................................</td>
          <?php 
    }
    ?>
        </tr>
        <tr align="center">
          <td align="left">&nbsp;</td>
          <td><b>T.T. KETUA MAKMAL</b></td>
          <?php 
    if ($row['kp_rs_level'] == '411') {
        ?>
          <td><b>T.T. TIM. PENGARAH<br />BIRO PENGAWALAN FARMASEUTIKAL KEBANGSAAN</b></td>
          <?php 
    }
    ?>
        </tr>
      </table>
    </div>
  </div>
</div>
<?php 
}