<?php session_start();
include "sambung.php";
?>
<script type="text/javascript">
function sendValue(s,a,b,e,f){
var selvalue = s;
var selvalue2 = a;
var selvalue3 = b;
/*var selvalue4 = c;*/
/*var selvalue5 = d;*/
var selvalue6 = e;
var selvalue7 = f;
window.opener.document.form1.supp.value = selvalue;
window.opener.document.form1.nama_supp.value = selvalue2;
window.opener.document.form1.harga_sup.value = selvalue3;
/*window.opener.document.form1.ppn.value = selvalue4;*/
/*window.opener.document.form1.total.value = selvalue5;*/
window.opener.document.form1.trans_sup.value = selvalue6;
window.opener.document.form1.id_vendor.value = selvalue7;
window.opener.document.form1.nama_vendor.value = selvalue2;
window.close();
}
</script>
<style type="text/css">
body,td,th {
	font-family: Verdana, Geneva, sans-serif;
	font-size: 12px;
}
</style>
<form id="form1" name="form1" method="get" action="">
  <label for="cab"></label>
  <table width="640" border="0">
    <tr>
      <td width="108"><strong>Pilih Cabang :</strong></td>
      <td width="48"><select name="cabang" id="cabang">
        <?php                      	
 $tampil = mysql_query("SELECT * FROM kntr_cab order by nama_cab desc");
 while( $r    = mysql_fetch_array($tampil))
  {
	  ?>
        <option value="<?php echo $r['id_cab'];?>" <?php if($r['id_cab']==$_GET['cabang']){ echo "selected=selected";}?>><?php echo $r['nama_cab']; ?></option>
        <?
  }
?>
      </select></td>
      <td width="470"><input type="submit" name="button" id="button" value="Tampilkan" /></td>
    </tr>
  </table>
</form>
<table width="1067" border="0" cellpadding="1" cellspacing="1">
  <tr>
    <th width="234" bgcolor="#CCCCCC">NAMA SUPPLIER</th>
    <th width="161" bgcolor="#CCCCCC">ALAMAT</th>
    <th width="110" bgcolor="#CCCCCC">KOTA</th>
    <th width="97" bgcolor="#CCCCCC">PROVINSI</th>
    <th width="93" bgcolor="#CCCCCC">TELEPON</th>
    <th width="96" bgcolor="#CCCCCC">HARGA</th>
    <th width="90" bgcolor="#CCCCCC">PPN</th>
    <th width="70" bgcolor="#CCCCCC">TOTAL</th>
    <th width="88" bgcolor="#CCCCCC">TRANSPORT</th>
  </tr>
  <?php 
 if($_GET['button']=='Tampilkan')
{

//include "library.php";
$sql="SELECT * FROM supp where id_cab='".$_GET['cabang']."' order by nama_supp asc" ;
$execute = mysql_query($sql);
while($row= mysql_fetch_array($execute))
{
$no = $no +1;
if($bg==0)
{
echo"<tr style=background-color:#eeeeee;>";
$bg++;
}
else
{
echo"<tr style=background-color:#;>";
$bg--;
}
?>
        <td align="center"><a href="#" onClick="sendValue('<?=$row['id_sup'];?>','<?php echo $row['nama_supp']; ?>','<?php echo $row['harga_sup']; ?>','<?php echo $row['trans_sup']; ?>','<?php echo $row['id_sap']; ?>');"><?php echo $row['nama_supp']; ?></a></td>
        
      <td><a href="#" onClick="sendValue('<?=$row['id_sup'];?>','<?php echo $row['nama_supp']; ?>','<?php echo $row['harga_sup']; ?>','<?php echo $row['trans_sup']; ?>','<?php echo $row['id_sap']; ?>');"><?php echo $row['alamat']; ?></a></td>
      
    <td><a href="#" onClick="sendValue('<?=$row['id_sup'];?>','<?php echo $row['nama_supp']; ?>','<?php echo $row['harga_sup']; ?>','<?php echo $row['trans_sup']; ?>','<?php echo $row['id_sap']; ?>');"><?php echo $row['kota']; ?></a></td>
    
    <td><a href="#" onClick="sendValue('<?=$row['id_sup'];?>','<?php echo $row['nama_supp']; ?>','<?php echo $row['harga_sup']; ?>','<?php echo $row['trans_sup']; ?>','<?php echo $row['id_sap']; ?>');"><?php echo $row['provinsi']; ?></a></td>
    
    <td><a href="#" onClick="sendValue('<?=$row['id_sup'];?>','<?php echo $row['nama_supp']; ?>','<?php echo $row['harga_sup']; ?>','<?php echo $row['trans_sup']; ?>','<?php echo $row['id_sap']; ?>');"><?php echo $row['telp']; ?></a></td>
    
    <td><a href="#" onClick="sendValue('<?=$row['id_sup'];?>','<?php echo $row['nama_supp']; ?>','<?php echo $row['harga_sup']; ?>','<?php echo $row['trans_sup']; ?>','<?php echo $row['id_sap']; ?>');"><?php echo $row['harga_sup']; ?></a></td>
    
     <td><a href="#" onClick="sendValue('<?=$row['id_sup'];?>','<?php echo $row['nama_supp']; ?>','<?php echo $row['harga_sup']; ?>','<?php echo $row['trans_sup']; ?>','<?php echo $row['id_sap']; ?>');"><?php echo $row['ppn']; ?></a></td>
     
      <td><a href="#" onClick="sendValue('<?=$row['id_sup'];?>','<?php echo $row['nama_supp']; ?>','<?php echo $row['harga_sup']; ?>','<?php echo $row['trans_sup']; ?>','<?php echo $row['id_sap']; ?>');"><?php echo $row['total']; ?></a></td>
      
    <td><a href="#" onClick="sendValue('<?=$row['id_sup'];?>','<?php echo $row['nama_supp']; ?>','<?php echo $row['harga_sup']; ?>','<?php echo $row['trans_sup']; ?>','<?php echo $row['id_sap']; ?>');"><?php echo $row['trans_sup']; ?></a></td>
    
  </tr>
  <? }?>
  </table>
<? } ?>