<?php

$addon_path="../../";
include $addon_path."includes/config.php";
include $addon_path."includes/database.php";
include $addon_path."includes/keyword.php";
include $addon_path."includes/function.php";
include $addon_path."includes/session.php";

?>



<meta http-equiv=content-type content="text/html; charset=GB2312">

<LINK href="<?php print $addon_path."theme/desktop/".$cssPath1; ?>" rel=stylesheet media="(min-width: 641px)">
<LINK href="<?php print $addon_path."theme/desktop/".$cssPath2; ?>" rel=stylesheet media="(min-width: 641px)">
<LINK href="<?php print $addon_path."theme/desktop/".$cssPath3; ?>" rel=stylesheet media="(min-width: 641px)">
<LINK href="<?php print $addon_path."theme/desktop/".$cssPath4; ?>" rel=stylesheet media="(min-width: 641px)">
<LINK href="<?php print $addon_path."theme/desktop/".$cssPath5; ?>" rel=stylesheet media="(min-width: 641px)">

<LINK href="<?php print $addon_path."theme/mobile/".$cssPath1; ?>" rel=stylesheet media="(max-width: 640px)">
<LINK href="<?php print $addon_path."theme/mobile/".$cssPath2; ?>" rel=stylesheet media="(max-width: 640px)">
<LINK href="<?php print $addon_path."theme/mobile/".$cssPath3; ?>" rel=stylesheet media="(max-width: 640px)">
<LINK href="<?php print $addon_path."theme/mobile/".$cssPath4; ?>" rel=stylesheet media="(max-width: 640px)">
<LINK href="<?php print $addon_path."theme/mobile/".$cssPath5; ?>" rel=stylesheet media="(max-width: 640px)">




<?php

echo '<style>';
  echo ' *{font-family:arial;font-size:12px;} ';
  echo ' TD{background:#ffffff;}';
echo '</style>';





    echo '<table >';
      echo '<tr>';
        echo '<td>';

            echo 'Search: <input type="text" class="textbox textbox-l" name="search" id="search" value="'.$_REQUEST["search"].'">';
            echo ' <input type="button" class="button button-blue" value="Search" onclick="window.location=\'search.php?row='.$_REQUEST["row"].'&search=\'+document.getElementById(\'search\').value">';
        echo '</td>';
      echo '</tr>';
    echo '</table>';



      echo '<table style="width:100%;" bgcolor=#c8c8c8 cellspacing=1 cellpadding=8 >';

            echo '<tr>';

                echo '<td>';
                  echo '<b>Barcode</b>';
                echo '</td>';

                echo '<td>';
                  echo '<b>Product Code</b>';
                echo '</td>';


                echo '<td>';
                  echo '<b>Product Name</b>';
                echo '</td>';


                echo '<td>';
                  echo '<b>Unit Cost</b>';
                echo '</td>';

                echo '<td>';

                  echo '<b>Selection</b>';

                echo '</td>';


            echo '</tr>';


      $query_product = " select *
                        from t_".$key_table_prefix."_product
                        where pdt_status = 'ACTIVE'
                        and pdt_barcode like '%".$_REQUEST["search"]."%'
                        order by pdt_id desc ; ";
      $result_product = mysqli_query($dbconn, $query_product);
      while($line_product = mysqli_fetch_array($result_product,MYSQLI_ASSOC))
      {



              echo '<tr>';

                  echo '<td>';
                    echo $line_product["pdt_barcode"];
                  echo '</td>';



                  echo '<td>';
                    echo $line_product["pdt_code"];
                  echo '</td>';


                  echo '<td>';
                    echo $line_product["pdt_name"];
                  echo '</td>';

                  echo '<td>';
                    echo $line_product["pdt_cost"];
                  echo '</td>';


                  echo '<td>';



                      echo "<input type=button class='button button-blue' name='choose'  value='Choose'
                                onclick=\"
                                        window.opener.document.form_stock_in_multi.cd_".$_REQUEST["row"].".value='".$line_product["pdt_barcode"]."';
                                        window.opener.document.form_stock_in_multi.nm_".$_REQUEST["row"].".value='".$line_product["pdt_name"]."';
                                        window.opener.document.form_stock_in_multi.cs_".$_REQUEST["row"].".value='".(0+$line_product["pdt_cost"])."';
                                        window.close();

                                      \"
                                  >";




                  echo '</td>';


              echo '</tr>';

      }


      echo '</table>';




?>
