<?php
include "../../inc/inc.koneksi.php";
$kode	= $_POST['kode'];

$sql	= mysql_query("SELECT * FROM interface");
$r = mysql_fetch_assoc($sql);
$utdg= $r['hutang_dg'];
$utbg= $r['hutang_bg'];
$noutdg 	= $utdg.$kode;
$noutbg 	= $utbg.$kode;

$sql = mysql_query("SELECT * FROM supplier WHERE kode_sp= '$kode'");
$row	= mysql_num_rows($sql);
if ($row>0){
	$input = "DELETE FROM supplier WHERE kode_sp= '$kode'";
	mysql_query($input);
	
	$input = "DELETE FROM akun_bp WHERE noakun= '$noutdg'";
	mysql_query($input);
	$input = "DELETE FROM akun_bp WHERE noakun= '$noutbg'";
	mysql_query($input);
	echo "Data Kode supplier : $kode sukses dihapus";
}else{
	echo "Maaf, tidak ada";
}
?>