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

$module=$_GET[module];
$act=$_GET[act];
 
// Input YM
if ($module=='cust' AND $act=='edit'){
	mysql_query("update produk set produk = '$_POST[nama]', category ='$_POST[cat]' where id = $_GET[id]");
	header('location:data.php');

}
elseif ($module=='cust' AND $act=='unblock'){
	mysql_query("update setup set setup = 'N'  where id = 1");
	header('location:data.php');

}
elseif ($module=='stok' AND $act=='download'){
	$kasir 	= $_SESSION['nama'];
	mysql_query("INSERT INTO cetakstok(kasir) VALUES('$kasir')");
	$aab = mysql_insert_id();
	
	
	$cek = mysql_query("Select * from qqtmpproduk");
	while ($r=mysql_fetch_array($cek)){	

		mysql_query("INSERT INTO cetakstokdetail(idcetak,id2,jenis,billno,billdate,cust,custname,dateadded,produk,qty,harga,status,ucode,tax) VALUES('$aab','$r[id]','$r[jenis]','$r[billno]','$r[billdate]','$r[cust]','$r[custname]','$r[dateadded]','$r[produk]','$r[qty]','$r[harga]','$r[status]','$r[ucode]','$r[tax]')");
	}
	
	header('location:cetak.php?id='.$aab);

}
elseif ($module=='cust' AND $act=='delete'){
	mysql_query("delete from produk  where id = $_GET[id]");
	header('location:data.php');

}elseif ($module=='movement' AND $act=='all'){
	$id = $_GET['id'];
	$awal = $_POST['awal'];
	$akhir = $_POST['akhir'];
	header('location:movement.php?id='.$id.'&tglawal='.$awal.'&tglakhir='.$akhir);

}elseif ($module=='movement' AND $act=='nontax'){
	$id = $_GET['id'];
	$awal = $_POST['awal'];
	$akhir = $_POST['akhir'];
	header('location:movement1.php?id='.$id.'&tglawal='.$awal.'&tglakhir='.$akhir);

}elseif ($module=='movement' AND $act=='tax'){
	$id = $_GET['id'];
	$awal = $_POST['awal'];
	$akhir = $_POST['akhir'];
	header('location:movement2.php?id='.$id.'&tglawal='.$awal.'&tglakhir='.$akhir);

}elseif ($module=='pricelist' AND $act=='add'){
	$id = $_GET['id'];
	mysql_query("INSERT INTO pricelist(id,xfrom,xto,price) VALUES('$id','$_POST[from]','$_POST[to]','$_POST[price]')");
	header('location:pricelist.php?id='.$id);

}

?>
