
<?php

session_start();
@ob_start();
include "../../config/koneksi.php";

$module=$_GET[module];
$act=$_GET[act];
 
if ($module=='sales' AND $act=='add'){
	$dt1 = date("Y-m-d");
	mysql_query("INSERT INTO orders(billdate,Customerid,grandtotal) VALUES('$dt1','$_POST[cust]','0')");
	header('location:data.php');

}
elseif ($module=='sales' AND $act=='ordadd'){
	$dt1 = date("Y-m-d");
	$data = $_POST['choices'];
	mysql_query("INSERT INTO orderdetails(billno,code,qty) VALUES('$_GET[id]','$data[0]','$_POST[qty]')");
	header('location:edit.php?id='.$_GET[id]);

}
elseif ($module=='cust' AND $act=='edit'){
	mysql_query("update customers set customername = '$_POST[nama]', address ='$_POST[alamat]', phone = '$_POST[telp]',wilayah = '$_POST[wilayah]' where customerid = $_GET[id]");
	header('location:data.php');

}
elseif ($module=='sales' AND $act=='delprodadd'){
	$urut = $_GET[urut];
	mysql_query("delete from orderdetails where urut = $urut");
	header('location:edit.php?id='.$_GET[id]);

}

?>
