<?PHP


ob_start();


session_start();


include 'connect.php';


if(isset($_SESSION['adminemail']))


{


$user=$_SESSION['adminemail'];





$gtp=mysql_query("select * from admin where username='$user'");


$gtp1=mysql_fetch_array($gtp);





include 'top.php';


?>











<div class="main-content">


				<div class="main-content-inner">


					<div class="breadcrumbs ace-save-state" id="breadcrumbs">


						<ul class="breadcrumb">


							<li>


								<i class="ace-icon fa fa-home home-icon"></i>


								<a href="#">Home</a>


							</li>


							<li class="active">Delete</li>


						</ul><!-- /.breadcrumb -->


					</div>





					<div class="page-content">


			





						<div class="page-header">


							<h1>


								Delete


							</h1>


						</div><!-- /.page-header -->


<br />





						<div class="row">


							<div class="col-xs-12">


                            


								<!-- PAGE CONTENT BEGINS -->


                                


<script src="assets/js/jquery.js"></script>


<script>


	


jQuery(function($){


		   


	// simple jQuery validation script


	$('#work').submit(function(){


		


		var valid = true;


		var errormsg = 'This field is required!';


		var errorcn = 'error';


		


		$('.' + errorcn, this).remove();			


		


		$('#required', this).each(function(){


			var parent = $(this).parent();


			if( $(this).val() == '' ){


				var msg = $(this).attr('title');


				msg = (msg != '') ? msg : errormsg;


				$('<span style="font-size:13px;color:#FF0000; padding-left:3px;" class="'+ errorcn +'">'+ msg +'</span>')


					.appendTo(parent)


					.fadeIn('fast')


					.click(function(){ $(this).remove(); });


				valid = false;


			};


		});


		


		return valid;


	});


	


});	





</script>





<?php





if(isset($_POST['yes']))


{


$id=$_POST['id'];


$desc=$_POST['desc'];


$ac=$_POST['ac'];





if($desc=='supplier')


{





$del=mysql_query("delete from supplier where ID='$id'");





if($del)


{


header("location:viewsupplier.php?s=7");


}





}


elseif($desc=='productcategory')


{





$del=mysql_query("delete from product_category where ID='$id'");





if($del)


{


header("location:viewproduct_category.php?s=7");


}





}


elseif($desc=='product')


{





$del=mysql_query("delete from product where ID='$id'");





if($del)


{


header("location:viewproduct.php?s=7");


}





}


elseif($desc=='factory')


{





$del=mysql_query("delete from factory where ID='$id'");





if($del)


{


header("location:viewfactory.php?s=7");


}





}


elseif($desc=='purchaseorder')


{





$del=mysql_query("delete from purchase_order where orderno='$id'");





if($del)


{


header("location:viewpurchaseorder.php?s=7");


}





}


elseif($desc=='purchase')


{





$del=mysql_query("delete from purchase where invoiceno='$id'");





if($del)


{


header("location:viewpurchase.php?s=7");


}





}


elseif($desc=='salesorder')


{





$del=mysql_query("delete from sales_order where orderno='$id'");





if($del)


{


header("location:viewsalesorder.php?s=7");


}





}


elseif($desc=='invoice')


{





$del=mysql_query("delete from invoice where invoiceno='$id'");





if($del)


{


header("location:viewinvoice.php?s=7");


}





}


elseif($desc=='receipt')


{





$del=mysql_query("delete from receipt where ID='$id'");





if($del)


{


header("location:viewreceipt.php?s=5");


}





}


elseif($desc=='payment')


{





$del=mysql_query("delete from payment where ID='$id'");





if($del)


{


header("location:viewpayment.php?s=5");


}





}


elseif($desc=='department')


{





$del=mysql_query("delete from department where ID='$id'");





if($del)


{


header("location:viewdepartment.php?s=7");


}





}


elseif($desc=='designation')


{





$del=mysql_query("delete from employee_designation where ID='$id'");





if($del)


{


header("location:viewdesignation.php?s=7");


}





}


elseif($desc=='employee')


{





$del=mysql_query("delete from employee where ID='$id'");





if($del)


{


header("location:viewemployee.php?s=7");


}





}


elseif($desc=='expense')


{





$del=mysql_query("delete from expense where ID='$id'");





if($del)


{


header("location:viewexpense.php?s=7");


}





}


elseif($desc=='journal')


{





$del=mysql_query("delete from journal where ID='$id'");





if($del)


{


header("location:viewjournal.php?s=5");


}





}


elseif($desc=='user')


{





$del=mysql_query("delete from admin where ID='$id'");





if($del)


{


header("location:viewusers.php?s=5");


}





}


elseif($desc=='imprest')


{





$del=mysql_query("delete from imprest where ID='$id'");





if($del)


{


header("location:viewimprest.php?s=5");


}





}


elseif($desc=='salaryadvance')


{





$del=mysql_query("delete from advance where ID='$id'");





if($del)


{


header("location:viewadvance.php?s=3");


}





}


elseif($desc=='attendance')


{





$del=mysql_query("delete from attendance where entryno='$id'");





if($del)


{


header("location:viewattendance.php?s=3");


}





}


elseif($desc=='otattendance')


{





$del=mysql_query("delete from ot_attendance where entryno='$id'");





if($del)


{


header("location:viewotattendance.php?s=3");


}





}


elseif($desc=='production')


{





$del=mysql_query("delete from production where pno='$id'");





if($del)


{


header("location:viewproduction.php?s=7");


}





}


elseif($desc=='kpi')


{





$del=mysql_query("delete from kpi where ID='$id'");





if($del)


{


header("location:viewkpi.php?s=7");


}





}


elseif($desc=='crmcustomer')


{





$del=mysql_query("delete from crm_customer where ID='$id'");





if($del)


{


header("location:viewcrmcustomer.php?s=7");


}





}


elseif($desc=='customer')


{


	$del=mysql_query("delete from customer where ID='$id'");


	


	if($del)


	{


		header("location:viewcustomer.php?s=7");


	}


}


elseif($desc=='newproject')


{


	$del=mysql_query("delete from newproject where ID='$id'");


	


	if($del)


	{


		header("location:viewnewproject.php?s=7");


	}


}

elseif($desc=='coconutproject')

{

	$del=mysql_query("delete from coconutproject where ID='$id'");

	

	if($del)

	{

		header("location:viewcoconutproject.php?s=7");

	}

}








}





elseif(isset($_POST['no']))


{


$id=$_POST['id'];


$desc=$_POST['desc'];


$ac=$_POST['ac'];





if($desc=='supplier')


{


header("location:viewsupplier.php");


}


elseif($desc=='productcategory')


{


header("location:viewproduct_category.php");


}


elseif($desc=='product')


{


header("location:viewproduct.php");


}


elseif($desc=='factory')


{


header("location:viewfactory.php");


}


elseif($desc=='purchaseorder')


{


header("location:viewpurchaseorder.php");


}


elseif($desc=='purchase')


{


header("location:viewpurchase.php");


}


elseif($desc=='salesorder')


{


header("location:viewsalesorder.php");


}


elseif($desc=='invoice')


{


header("location:viewinvoice.php");


}


elseif($desc=='receipt')


{


header("location:viewreceipt.php");


}


elseif($desc=='payment')


{


header("location:viewpayment.php");


}


elseif($desc=='department')


{


header("location:viewdepartment.php");


}


elseif($desc=='designation')


{


header("location:viewdesignation.php");


}


elseif($desc=='employee')


{


header("location:viewemployee.php");


}


elseif($desc=='expense')


{


header("location:viewexpense.php");


}


elseif($desc=='journal')


{


header("location:viewjournal.php");


}


elseif($desc=='user')


{


header("location:viewusers.php");


}


elseif($desc=='imprest')


{


header("location:viewimprest.php");


}


elseif($desc=='salaryadvance')


{


header("location:viewadvance.php");


}


elseif($desc=='attendance')


{


header("location:viewattendance.php");


}


elseif($desc=='otattendance')


{


header("location:viewotattendance.php");


}


elseif($desc=='production')


{


header("location:viewproduction.php");


}


elseif($desc=='kpi')


{


header("location:viewkpi.php");


}


elseif($desc=='crmcustomer')


{


header("location:viewcrmcustomer.php");


}


elseif($desc=='customer')


{


	header("location:viewcustomer.php");


}


elseif($desc=='newproject')


{


	header("location:viewnewproject.php");


}

elseif($desc=='coconutproject')

{

	header("location:viewcoconutproject.php");

}




}





else


{





$id=$_GET['id'];


$desc=$_GET['desc'];


$ac=$_GET['ac'];





echo"<form action='del.php' method='post'>





<input type='hidden' name='id' value='".$id."' />





<input type='hidden' name='desc' value='".$desc."' />





<input type='hidden' name='ac' value='".$ac."' />";





if($desc=='supplier')


{





echo"<center>Are you sure want to delete this supplier# : ".$id."</center>";





}


elseif($desc=='productcategory')


{





echo"<center>Are you sure want to delete this product category# : ".$id."</center>";





}


elseif($desc=='product')


{





echo"<center>Are you sure want to delete this product# : ".$id."</center>";





}


elseif($desc=='factory')


{





echo"<center>Are you sure want to delete this factory# : ".$id."</center>";





}


elseif($desc=='purchaseorder')


{





echo"<center>Are you sure want to delete this purhcase order# : ".$id."</center>";





}


elseif($desc=='purchase')


{





echo"<center>Are you sure want to delete this purhcase entry# : ".$id."</center>";





}


elseif($desc=='salesorder')


{





echo"<center>Are you sure want to delete this sales order# : ".$id."</center>";





}


elseif($desc=='invoice')


{





echo"<center>Are you sure want to delete this invoice entry# : ".$id."</center>";





}


elseif($desc=='receipt')


{





echo"<center>Are you sure want to delete this receipt entry# : ".$id."</center>";





}


elseif($desc=='payment')


{





echo"<center>Are you sure want to delete this payment entry# : ".$id."</center>";





}


elseif($desc=='department')


{





echo"<center>Are you sure want to delete this department# : ".$id."</center>";





}


elseif($desc=='designation')


{





echo"<center>Are you sure want to delete this designation# : ".$id."</center>";





}


elseif($desc=='employee')


{





echo"<center>Are you sure want to delete this employee# : ".$id."</center>";





}


elseif($desc=='expense')


{





echo"<center>Are you sure want to delete this expense# : ".$id."</center>";





}


elseif($desc=='journal')


{





echo"<center>Are you sure want to delete this journal entry# : ".$id."</center>";





}


elseif($desc=='user')


{





echo"<center>Are you sure want to delete this user# : ".$id."</center>";





}


elseif($desc=='imprest')


{





echo"<center>Are you sure want to delete this entry# : ".$id."</center>";





}


elseif($desc=='salaryadvance')


{





echo"<center>Are you sure want to delete this entry# : ".$id."</center>";





}


elseif($desc=='attendance')


{





echo"<center>Are you sure want to delete this entry# : ".$id."</center>";





}


elseif($desc=='otattendance')


{





echo"<center>Are you sure want to delete this entry# : ".$id."</center>";





}


elseif($desc=='production')


{





echo"<center>Are you sure want to delete this entry# : ".$id."</center>";





}


elseif($desc=='kpi')


{





echo"<center>Are you sure want to delete this entry# : ".$id."</center>";





}


elseif($desc=='crmcustomer')


{





echo"<center>Are you sure want to delete this entry# : ".$id."</center>";





}


elseif($desc=='customer')


{


	echo"<center>Are you sure want to delete this entry# : ".$id."</center>";


}


elseif($desc=='newproject')


{


	echo"<center>Are you sure want to delete this entry# : ".$id."</center>";


}

elseif($desc=='coconutproject')

{

	echo"<center>Are you sure want to delete this entry# : ".$id."</center>";

}





echo"<br /><center><button type='submit' class='btn btn-sm btn-primary' name='yes' value='Yes'>Yes</button> &nbsp; <button type='submit' class='btn btn-sm btn-warning' name='no' value='No'>No</button></center><br /><br /></form>";





}





?>





							<br>


<br>


	





								<!-- PAGE CONTENT ENDS -->


							</div><!-- /.col -->


						</div><!-- /.row -->


					





</div><!-- /.page-content -->


				</div>


			</div><!-- /.main-content -->











<?php





include 'bottom.php';





}


else


{





 header("location:login.php");


 


}





ob_flush();





?>