<?php
include("include/config.inc.php");
include("include/conn.php");
if(!isset($_SESSION['s_activId']))
{
  $_SESSION['s_urlRedirectDir'] = $_SERVER['REQUEST_URI'];
  header("Location:checkLogin.php");
}
else
{
	$partyId       = isset($_REQUEST['partyId']) && $_REQUEST['partyId'] != '' ? $_REQUEST['partyId'] : "";
	
    if($partyId > 0)
	{
		$deletevepari = "DELETE FROM client	
						WHERE partyId = ".$partyId;
	    $deletevepariRes = mysql_query($deletevepari);
	    if(!$deletevepariRes)
		{
			echo "Client Delete Fail";
		}
		else
		{
			header("Location:clientList.php");
		}	
		
		// $deleteSauda = "DELETE FROM sauda	
						// WHERE partyId = ".$partyId;
	    // $deleteSaudaRes = mysql_query($deleteSauda);
	    // if(!$deleteSaudaRes)
		// {
			// echo "sauda Delete Fail";
		// }
		// else
		// {
			// header("Location:clientList.php");
		// }

		// $deleteRojmel = "DELETE FROM rojmel	
						// WHERE partyId = ".$partyId;
	    // $deleteRojmelRes = mysql_query($deleteRojmel);
	    // if(!$deleteRojmelRes)
		// {
			// echo "sauda Delete Fail";
		// }
		// else
		// {
			// header("Location:clientList.php");
		// }	
	}
		 
	include("./bottom.php");
	$smarty->assign("partyId",$partyId);
	$smarty->assign("finalAmount",$finalAmount);
	$smarty->assign("finalKg",$finalKg);
	$smarty->assign("clientArray",$clientArray);
	$smarty->display("clientList.tpl");
}
?>