<?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 if($jenis=='Solar Keekonomian')
	$kodest=$solek;

$sql 	= mysql_query("SELECT * FROM stock WHERE kode_st= '$kodest'");
$row	= mysql_num_rows($sql);
$r      = mysql_fetch_assoc($sql);
$data['hbeli']	= $r[hg_beli];
$data['hjual']	= $r[hg_jual];
$data['jstok']	= $r[jml_gd1]+$r[jml_gd2]+$r[jml_gd3];
echo json_encode($data);
?>