<?php
include "../../inc/inc.koneksi.php";

$jenis  = $_POST[jenis];
$prem	= $_POST[prem];
$solar	= $_POST[solar];
$ptmx	= $_POST[ptmx];
$ptmp	= $_POST[ptmp];
$ptlt		= $_POST[ptlt];
$dex	= $_POST[dex];
$dexlite	= $_POST[dexlite];
$solek= $_POST[solek];

if($jenis=='Premium')
	$kodest=$prem;
else if($jenis=='Bio Solar')
	$kodest=$solar;
else if($jenis=='Pertamax')
	$kodest=$ptmx;
else if($jenis=='Pertamax Turbo')
	$kodest=$ptmp;
else if($jenis=='Pertalite')
	$kodest=$ptlt;
else if($jenis=='Pertamina Dex')
	$kodest=$dex;
else if($jenis=='Dexlite')
	$kodest=$dexlite;
else
	$kodest=$solek;
	
$text	= "SELECT * FROM stock WHERE kode_st= '$kodest' ORDER BY kode_st";
$sql 	= mysql_query($text);
$row	= mysql_num_rows($sql);
if ($row>0){
while ($r=mysql_fetch_array($sql)){
	$data['hbeli']	= $r[hg_beli];
	$data['hjual']	= $r[hg_jual];
	echo json_encode($data);
}
}else{
	$data['hbeli']	= '';
	$data['hjual']	= '';
	echo json_encode($data);
}
?>