<?php
session_start();

	if(!isset($_SESSION['linkarisecrm']))
	{
		header('Location: index.php');
		return;
	}

	include("connect.php");
	include("connectp.php");
	
	date_default_timezone_set("Asia/Singapore");
	$mdate= date('Y-m-d H:i:s');
	$mdate1= date('Y-m-d');
	
	

	
	$jobworkmid =(int)mysqli_real_escape_string($conn,$_GET['jobworkmid']);
	$jobworkdid =(int)mysqli_real_escape_string($conn,$_GET['id']);
	
	
	$sql = "DELETE FROM res_jobwork_detail WHERE jobworkdid=?";
	$stmt= $db7->prepare($sql);
	if($stmt->execute([$jobworkdid]))
	{
		$query="delete from res_jobworkitem_detail where jobworkdid=$jobworkdid";
	$result= mysqli_query($conn, $query) or die("Error");
		$_SESSION['msg'] = "Record deleted successfully";
	} 
	else
	{
		$_SESSION['msg1'] = "Error";
	}
	
	if($jobworkmid!=0)
	{
		header("Location: jobworkadd.php?jobworkmid=$jobworkmid");
	}
	else
	{
		header('Location:jobworkadd.php');
	}
?>