function viewSample($kp_id, $id) { // echo $id; $query = "SELECT kp_rsc_kod FROM k_produk\n WHERE kp_id='{$kp_id}'"; $result = selQuery($query); $row = mysqli_fetch_assoc($result); if ($row['kp_rsc_kod'] == 5) { $query = "SELECT kp_product_name,kp_rsc_kod,kp_sampel_no,kp_batch_no,kp_manufacturer,kp_holder,\n kp_kuantiti_htr,kp_rd_kod,kp_rskt_kod,kp_tkh_terima,kp_tkh_luput,rkatp_desc,rkatp_class,\n pp_osa_kod_owner,pp_osa_kod_holder FROM k_produk\n LEFT JOIN p_product ON pp_kod=kp_sampleID\n LEFT JOIN ref_kat_produk ON rkatp_kod=pp_rkatp_kod\n WHERE kp_id='{$kp_id}'"; } elseif ($row['kp_rsc_kod'] == 11) { $query = "SELECT kp_product_name,kp_rsc_kod,kp_sampel_no,kp_batch_no,\n kp_kuantiti_htr,kp_rd_kod,kp_rskt_kod,kp_tkh_terima,kp_tkh_luput FROM k_produk\n LEFT JOIN adr_sample ON adrSampleID=kp_sampleID\n WHERE kp_id='{$kp_id}'"; } elseif ($row['kp_rsc_kod'] == 2 || $row['kp_rsc_kod'] == 3) { $query = "SELECT kp_product_name,kp_rsc_kod,kp_sampel_no,kp_batch_no,\n kp_kuantiti_htr,kp_rd_kod,kp_rskt_kod,kp_tkh_terima,kp_tkh_luput FROM k_produk\n LEFT JOIN c_surv_sample ON pSampleID=kp_sampleID\n WHERE kp_id='{$kp_id}'"; } else { $query = "SELECT kp_product_name,kp_rsc_kod,kp_sampel_no,kp_batch_no,\n kp_kuantiti_htr,kp_rd_kod,kp_rskt_kod,kp_tkh_terima,kp_tkh_luput FROM k_produk\n WHERE kp_id='{$kp_id}'"; } $result = selQuery($query); $row = mysqli_fetch_assoc($result); ?> <div class="row" id="preview"> <?php if ($id == 17) { ?> <div class="admin-form"> <style> .ui-datepicker{ z-index:1151 !important; } </style> <table class="table table-stripe table-hover" cellspacing="0" width="100%"> <tr> <td colspan="3" align="right"><?php getBarcode($row['kp_sampel_no']); ?> </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> <tr> <td>Purpose</td> <td>:</td> <td><b><?php echo sampleCategory($row['kp_rsc_kod']); ?> </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 getUser($row['pp_osa_kod_owner'], "os_sykt"); ?> </b></td> </tr> <tr> <td>Holder</td> <td>:</td> <td><b><?php echo getUser($row['pp_osa_kod_holder'], "os_sykt"); ?> </b></td> </tr> <?php } ?> <tr> <td>Batch Number <font color="red">*</font></td> <td>:</td> <td> <div class="col-md-4"> <label class="field prepend-icon"> <input type="text" name="txt_batch" id="txt_batch" class="gui-input" value="<?php echo $row['kp_batch_no']; ?> "> <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" name="txt_batch" id="txt_quantity" class="gui-input" value="<?php echo $row['kp_kuantiti_htr']; ?> "> <label for="txt_batch" 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"> <?php getDosage($row['kp_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"> <select id="txt_unit"> <?php getSukatan($row['kp_rskt_kod']); ?> </select> <i class="arrow"></i> </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" value="<?php echo displayDate($row['kp_tkh_terima']); ?> " readonly> <label for="txt_received" class="field-icon"> <i class="fa fa-calendar"></i> </label> </label> </div> </td> </tr> <tr> <td>Expired Date</td> <td>:</td> <td> <div class="col-md-4"> <label class="field prepend-icon"> <input type="text" name="txt_received" id="txt_expiry" class="gui-input" value="<?php echo displayDate($row['kp_tkh_luput']); ?> " readonly> <label for="txt_received" class="field-icon"> <i class="fa fa-calendar"></i> </label> </label> </div> </td> </tr> </table> </div> <div class="col-md-12"> <font color="red">*</font> required field </div> <?php } elseif ($id == 19 or $id == 20 or $id == "print") { ?> <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"> Sample Information</span> </div> <div class="panel-body"> <table class="table table-stripe table-hover" cellspacing="0" width="100%"> <tr> <td colspan="3" align="right"><?php getBarcode($row['kp_sampel_no']); ?> </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 Reference</td> <td>:</td> <td><b><?php echo $row['kp_product_name']; ?> </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'] == 1) { ?> <tr> <td>Manufacturer</td> <td>:</td> <td><b><?php echo $row['kp_product_name']; ?> </b></td> </tr> <tr> <td>Holder</td> <td>:</td> <td><b><?php echo sampleCategory($row['kp_rsc_kod']); ?> </b></td> </tr> <tr> <td>Batch Number</td> <td>:</td> <td><b><?php echo $row['kp_sampel_no']; ?> </b></td> </tr> <tr> <td>Purpose</td> <td>:</td> <td><b><?php echo sampleCategory($row['kp_rsc_kod']); ?> </b></td> </tr> <?php } ?> </table> </div> </div> <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"> Quantity Distribute to Each Lab</span> </div> <div class="panel-body"> <table class="table table-stripe table-hover" cellspacing="0" width="100%"> <thead> <tr align="center" class="alert"> <td width="70%"><b>Lab Name</b></td> <td width="15%"><b>Quantity</b></td> <td width="15%"><b>Units</b></td> </tr> </thead> <tbody> <?php $query = "SELECT klb_ru_kod,klb_kuantiti_agih,klb_rskt_kod FROM k_lab\n WHERE klb_kp_id='{$kp_id}'"; $result = selQuery($query); while ($row = mysqli_fetch_assoc($result)) { ?> <tr align="center"> <td align="left"><?php echo retriveLab($row['klb_ru_kod']); ?> </td> <td><?php echo $row['klb_kuantiti_agih']; ?> </td> <td><?php echo getSukatan($row['klb_rskt_kod'], 1); ?> </td> </tr> <?php } ?> </tbody> </table> </div> </div> <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"> Test(s) Assigned</span> </div> <div class="panel-body"> <?php $query = "SELECT klb_ru_kod FROM k_lab\n WHERE klb_kp_id='{$kp_id}'"; $result = selQuery($query); while ($row = mysqli_fetch_assoc($result)) { $ru_kod = $row['klb_ru_kod']; ?> <div><b><?php echo retriveLab($ru_kod); ?> </b></div> <table class="table table-stripe table-hover" cellspacing="0" width="100%"> <thead> <tr align="center" class="alert"> <td width="20%"><b>Test Code</b></td> <td width="80%"><b>Description</b></td> </tr> </thead> <tbody> <?php $sql = "SELECT kltt_rt_kod,kltt_rt_desc FROM k_lab_task_test\n WHERE kltt_kp_id='{$kp_id}' AND kltt_ru_kod='{$ru_kod}'"; $sql_result = selQuery($sql); while ($sql_row = mysqli_fetch_assoc($sql_result)) { ?> <tr align="center"> <td><?php echo getTestCode($sql_row['kltt_rt_kod']); ?> </td> <td align="left"><?php echo $sql_row['kltt_rt_desc']; ?> </td> </tr> <?php } ?> </tbody> </table> <div> </div> <?php } ?> </div> </div> <?php } else { ?> <table class="table table-stripe table-hover" cellspacing="0" width="100%"> <tr> <td colspan="3" align="right"><?php getBarcode($row['kp_sampel_no']); ?> </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> <tr> <td>Purpose</td> <td>:</td> <td><b><?php echo getWork($row['kp_rsc_kod']); ?> </b></td> </tr> <?php if ($row['kp_rsc_kod'] == 1) { ?> <tr> <td>Product Category</td> <td>:</td> <td><b><?php echo $row['kp_sampel_no']; ?> </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 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>Received Date</td> <td>:</td> <td><b><?php echo displayDate($row['kp_tkh_terima']); ?> </b></td> </tr> <tr> <td>Expired Date</td> <td>:</td> <td><b><?php echo displayDate($row['kp_tkh_luput']); ?> </b></td> </tr> </table> <?php } ?> </div> <?php }
$resp = json_decode(curl_exec($curl)); curl_close($curl); $modules = $resp->modules->aus; $allMatches = (array) $resp->matches; $matches = array(); foreach ($modules as $module) { if ($module->category == 'intl') { $matches = array_merge($matches, getWork($module->matches, $allMatches, 'init')); } if ($module->category == 'dom') { if ($module->title == 'Domestic') { foreach ($module->submenu as $domestic) { $matches = array_merge($matches, getWork($domestic->matches, $allMatches, 'dom', $domestic->title)); } } elseif ($module->title == 'Others') { $matches = array_merge($matches, getWork($module->matches, $allMatches, 'other')); } } } echo json_encode($matches); }); $app->get('/match_details', function () use($app) { $matchID = $app->request->get('matchID'); $matchType = $app->request->get('matchType'); if ($matchType == 'init') { $url = 'http://www.espncricinfo.com/netstorage/' . $matchID . '.json?xhr=1'; } else { $url = 'http://www.espncricinfo.com/ci/engine/match/' . $matchID . '.json?xhr=1'; } $curl = curl_init(); curl_setopt_array($curl, array(CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => $url, CURLOPT_USERAGENT => 'Codular Sample cURL Request'));