<?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">Menu Control</li>

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

					</div>



					<div class="page-content">

			



						<div class="page-header">

							<h1>

								Menu Control

							</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['submit']))



{



$check=$_POST['check'];



$type=$_POST['type'];



$user=$_POST['user'];







$kk=mysql_query("delete from menu where username='$user'");





foreach($check as $chk)

{



$in=mysql_query("insert into menu(menu,username) values('$chk','$user')");



}



if($kk || $in)

{



header("location:menu_control.php?s=1&user=".$user."");



}



else

{



header("location:menu_control.php?s=2&user=".$user."");



}





}	



elseif($_GET['user'])

{





$user=$_GET['user'];







if (isset($_GET['s']))



	{



	



	 $status=$_GET['s'];



	 



		 if($status=='1')



		 {



           echo'<div class="alert alert-success alert-dismissable">



                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>



                <span style="text-align:left;">Values Insreted Successfully.</span>



                </div>';



		 }



		 



		 elseif($status=='2')



		 {



           echo'<div class="alert alert-error alert-dismissable">



                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>



                <span style="text-align:left;">Values Not Insreted. Please try again.</span>



                </div>';



		 }



		



	}





$sela=mysql_query("select * from employee where ID='$user'");

$sela1=mysql_fetch_array($sela);





echo"<center>





<table style='line-height:23px; font-weight:bold;'>





<tr><td>User</td><td style='padding:0 5px 0 5px;'>:</td><td>".$sela1['username']."</td></tr>





</table>





</center><br />";





$c1=mysql_query("select COUNT(ID) from menu where menu='customer' and username='$user'");

$d1=mysql_result($c1,0);





$c2=mysql_query("select COUNT(ID) from menu where menu='supplier' and username='$user'");

$d2=mysql_result($c2,0);





$c3=mysql_query("select COUNT(ID) from menu where menu='productcategory' and username='$user'");

$d3=mysql_result($c3,0);





$c4=mysql_query("select COUNT(ID) from menu where menu='product' and username='$user'");

$d4=mysql_result($c4,0);





$c5=mysql_query("select COUNT(ID) from menu where menu='factory' and username='$user'");

$d5=mysql_result($c5,0);





$c6=mysql_query("select COUNT(ID) from menu where menu='bank' and username='$user'");

$d6=mysql_result($c6,0);





$c7=mysql_query("select COUNT(ID) from menu where menu='department' and username='$user'");

$d7=mysql_result($c7,0);





$c8=mysql_query("select COUNT(ID) from menu where menu='designation' and username='$user'");

$d8=mysql_result($c8,0);





$c9=mysql_query("select COUNT(ID) from menu where menu='settings' and username='$user'");

$d9=mysql_result($c9,0);





$c10=mysql_query("select COUNT(ID) from menu where menu='purchaseorder' and username='$user'");

$d10=mysql_result($c10,0);





$c11=mysql_query("select COUNT(ID) from menu where menu='purchase' and username='$user'");

$d11=mysql_result($c11,0);





$c12=mysql_query("select COUNT(ID) from menu where menu='production' and username='$user'");

$d12=mysql_result($c12,0);





$c13=mysql_query("select COUNT(ID) from menu where menu='salesorder' and username='$user'");

$d13=mysql_result($c13,0);





$c14=mysql_query("select COUNT(ID) from menu where menu='sales' and username='$user'");

$d14=mysql_result($c14,0);





$c15=mysql_query("select COUNT(ID) from menu where menu='stock' and username='$user'");

$d15=mysql_result($c15,0);





$c16=mysql_query("select COUNT(ID) from menu where menu='payment' and username='$user'");

$d16=mysql_result($c16,0);





$c17=mysql_query("select COUNT(ID) from menu where menu='receipt' and username='$user'");

$d17=mysql_result($c17,0);





$c18=mysql_query("select COUNT(ID) from menu where menu='daybook' and username='$user'");

$d18=mysql_result($c18,0);





$c19=mysql_query("select COUNT(ID) from menu where menu='customerledger' and username='$user'");

$d19=mysql_result($c19,0);





$c20=mysql_query("select COUNT(ID) from menu where menu='supplierledger' and username='$user'");

$d20=mysql_result($c20,0);





$c21=mysql_query("select COUNT(ID) from menu where menu='cashledger' and username='$user'");

$d21=mysql_result($c21,0);





$c22=mysql_query("select COUNT(ID) from menu where menu='bankledger' and username='$user'");

$d22=mysql_result($c22,0);





$c23=mysql_query("select COUNT(ID) from menu where menu='outstandings' and username='$user'");

$d23=mysql_result($c23,0);





$c24=mysql_query("select COUNT(ID) from menu where menu='expensecategory' and username='$user'");

$d24=mysql_result($c24,0);





$c25=mysql_query("select COUNT(ID) from menu where menu='expense' and username='$user'");

$d25=mysql_result($c25,0);





$c26=mysql_query("select COUNT(ID) from menu where menu='imprest' and username='$user'");

$d26=mysql_result($c26,0);





$c27=mysql_query("select COUNT(ID) from menu where menu='employees' and username='$user'");

$d27=mysql_result($c27,0);





$c28=mysql_query("select COUNT(ID) from menu where menu='attendance' and username='$user'");

$d28=mysql_result($c28,0);





$c29=mysql_query("select COUNT(ID) from menu where menu='advance' and username='$user'");

$d29=mysql_result($c29,0);





$c30=mysql_query("select COUNT(ID) from menu where menu='generatepayslip' and username='$user'");

$d30=mysql_result($c30,0);





$c31=mysql_query("select COUNT(ID) from menu where menu='kpi' and username='$user'");

$d31=mysql_result($c31,0);





$c32=mysql_query("select COUNT(ID) from menu where menu='kpireport' and username='$user'");

$d32=mysql_result($c32,0);





$c33=mysql_query("select COUNT(ID) from menu where menu='salarysheet' and username='$user'");

$d33=mysql_result($c33,0);





$c34=mysql_query("select COUNT(ID) from menu where menu='transport' and username='$user'");

$d34=mysql_result($c34,0);





$c35=mysql_query("select COUNT(ID) from menu where menu='delivery' and username='$user'");

$d35=mysql_result($c35,0);





$c36=mysql_query("select COUNT(ID) from menu where menu='fuel' and username='$user'");

$d36=mysql_result($c36,0);





$c37=mysql_query("select COUNT(ID) from menu where menu='fuelreport' and username='$user'");

$d37=mysql_result($c37,0);





$c38=mysql_query("select COUNT(ID) from menu where menu='crmcustomer' and username='$user'");

$d38=mysql_result($c38,0);





$c39=mysql_query("select COUNT(ID) from menu where menu='crmteamallocate' and username='$user'");

$d39=mysql_result($c39,0);





$c40=mysql_query("select COUNT(ID) from menu where menu='followup' and username='$user'");

$d40=mysql_result($c40,0);





$c41=mysql_query("select COUNT(ID) from menu where menu='followupreport' and username='$user'");

$d41=mysql_result($c41,0);





$c42=mysql_query("select COUNT(ID) from menu where menu='executivesreport' and username='$user'");

$d42=mysql_result($c42,0);





$c43=mysql_query("select COUNT(ID) from menu where menu='otattendance' and username='$user'");

$d43=mysql_result($c43,0);





$c44=mysql_query("select COUNT(ID) from menu where menu='todaysfollowup' and username='$user'");

$d44=mysql_result($c44,0);





$c45=mysql_query("select COUNT(ID) from menu where menu='teamwisereport' and username='$user'");

$d45=mysql_result($c45,0);





$c46=mysql_query("select COUNT(ID) from menu where menu='newproject' and username='$user'");

$d46=mysql_result($c46,0);



$c47=mysql_query("select COUNT(ID) from menu where menu='coconutproject' and username='$user'");

$d47=mysql_result($c47,0);


$c48=mysql_query("select COUNT(ID) from menu where menu='premiumcustomers' and username='$user'");

$d48=mysql_result($c48,0);





?>





<form action="menu_control.php" method="post">





<input type="hidden" name="user" value="<?php echo $user; ?>" />





<table style="width:95%; margin:auto;">



<tr>



<td style="width:20%; padding-top:35px;" valign="top">



<b>Masters</b>



<table style="margin-top:7px; line-height:23px;">



<tr><td><input type="checkbox" value="customer" name="check[1]" style="margin-top:-3px;" <?php if($d1>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Customer</td></tr>



<tr><td><input type="checkbox" value="supplier" name="check[2]" style="margin-top:-3px;" <?php if($d2>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Supplier</td></tr>



<tr><td><input type="checkbox" value="productcategory" name="check[3]" style="margin-top:-3px;" <?php if($d3>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Product Category</td></tr>



<tr><td><input type="checkbox" value="product" name="check[4]" style="margin-top:-3px;" <?php if($d4>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Product</td></tr>



<tr><td><input type="checkbox" value="factory" name="check[5]" style="margin-top:-3px;" <?php if($d5>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Factory</td></tr>



<tr><td><input type="checkbox" value="bank" name="check[6]" style="margin-top:-3px;" <?php if($d6>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Bank</td></tr>



<tr><td><input type="checkbox" value="department" name="check[7]" style="margin-top:-3px;" <?php if($d7>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Department</td></tr>



<tr><td><input type="checkbox" value="designation" name="check[8]" style="margin-top:-3px;" <?php if($d8>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Designation</td></tr>



<tr><td><input type="checkbox" value="settings" name="check[9]" style="margin-top:-3px;" <?php if($d9>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Settings</td></tr>



</table>



</td>



<td style="width:20%; padding-top:35px;" valign="top">



<b>Purchase</b>



<table style="margin-top:7px; line-height:23px;">



<tr><td><input type="checkbox" value="purchaseorder" name="check[10]" style="margin-top:-3px;" <?php if($d10>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Purchase Order</td></tr>



<tr><td><input type="checkbox" value="purchase" name="check[11]" style="margin-top:-3px;" <?php if($d11>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Purchase</td></tr>



</table>



</td>





<td style="width:20%; padding-top:35px;" valign="top">



<b>Production</b>



<table style="margin-top:7px; line-height:23px;">



<tr><td><input type="checkbox" value="production" name="check[12]" style="margin-top:-3px;" <?php if($d12>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Production</td></tr>



</table>



</td>





<td style="width:20%; padding-top:35px;" valign="top">



<b>Sales</b>



<table style="margin-top:7px; line-height:23px;">



<tr><td><input type="checkbox" value="salesorder" name="check[13]" style="margin-top:-3px;" <?php if($d13>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Sales Order</td></tr>



<tr><td><input type="checkbox" value="sales" name="check[14]" style="margin-top:-3px;" <?php if($d14>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Sales</td></tr>



</table>



</td>



</tr>





<tr>



<td style="width:20%; padding-top:35px;" valign="top">



<b>Vouchers</b>



<table style="margin-top:7px; line-height:23px;">



<tr><td><input type="checkbox" value="payment" name="check[16]" style="margin-top:-3px;" <?php if($d16>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Payment</td></tr>



<tr><td><input type="checkbox" value="Receipt" name="check[17]" style="margin-top:-3px;" <?php if($d17>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Receipt</td></tr>



</table>



</td>





<td style="width:20%; padding-top:35px;" valign="top">



<b>Accounts</b>



<table style="margin-top:7px; line-height:23px;">





<tr><td><input type="checkbox" value="daybook" name="check[18]" style="margin-top:-3px;" <?php if($d18>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Daybook</td></tr>



<tr><td><input type="checkbox" value="customerledger" name="check[19]" style="margin-top:-3px;" <?php if($d19>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Customer Ledger</td></tr>



<tr><td><input type="checkbox" value="supplierledger" name="check[20]" style="margin-top:-3px;" <?php if($d20>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Supplier Ledger</td></tr>



<tr><td><input type="checkbox" value="cashledger" name="check[21]" style="margin-top:-3px;" <?php if($d21>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Cash Ledger</td></tr>



<tr><td><input type="checkbox" value="bankledger" name="check[22]" style="margin-top:-3px;" <?php if($d22>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Bank Ledger</td></tr>



<tr><td><input type="checkbox" value="outstandings" name="check[23]" style="margin-top:-3px;" <?php if($d23>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Outstandings</td></tr>



</table>



</td>





<td style="width:20%; padding-top:35px;" valign="top">



<b>Expense</b>



<table style="margin-top:7px; line-height:23px;">



<tr><td><input type="checkbox" value="expensecategory" name="check[24]" style="margin-top:-3px;" <?php if($d24>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Expense Category</td></tr>



<tr><td><input type="checkbox" value="expense" name="check[25]" style="margin-top:-3px;" <?php if($d25>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Expense</td></tr>



</table>



</td>





<td style="width:20%; padding-top:35px;" valign="top">



<b>Imprest</b>



<table style="margin-top:7px; line-height:23px;">



<tr><td><input type="checkbox" value="imprest" name="check[26]" style="margin-top:-3px;" <?php if($d26>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Imprest</td></tr>



</table>



</td>



</tr>





<tr>



<td style="width:20%; padding-top:35px;" valign="top">



<b>Employee</b>



<table style="margin-top:7px; line-height:23px;">



<tr><td><input type="checkbox" value="employees" name="check[27]" style="margin-top:-3px;" <?php if($d27>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Employees</td></tr>



<tr><td><input type="checkbox" value="attendance" name="check[28]" style="margin-top:-3px;" <?php if($d28>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Attendance</td></tr>



<tr><td><input type="checkbox" value="otattendance" name="check[43]" style="margin-top:-3px;" <?php if($d43>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">OT Attendance</td></tr>



<tr><td><input type="checkbox" value="advance" name="check[29]" style="margin-top:-3px;" <?php if($d29>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Advance</td></tr>



<tr><td><input type="checkbox" value="generatepayslip" name="check[30]" style="margin-top:-3px;" <?php if($d30>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Generate Payslip</td></tr>



</table>



</td>





<td style="width:20%; padding-top:35px;" valign="top">



<b>KPI</b>



<table style="margin-top:7px; line-height:23px;">



<tr><td><input type="checkbox" value="kpi" name="check[31]" style="margin-top:-3px;" <?php if($d31>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">KPI</td></tr>



<tr><td><input type="checkbox" value="kpireport" name="check[32]" style="margin-top:-3px;" <?php if($d32>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">KPI Report</td></tr>



<tr><td><input type="checkbox" value="salarysheet" name="check[33]" style="margin-top:-3px;" <?php if($d33>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Salary Sheet</td></tr>



</table>



</td>





<td style="width:20%; padding-top:35px;" valign="top">



<b>Transport</b>



<table style="margin-top:7px; line-height:23px;">



<tr><td><input type="checkbox" value="transport" name="check[34]" style="margin-top:-3px;" <?php if($d34>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Transport</td></tr>



<tr><td><input type="checkbox" value="delivery" name="check[35]" style="margin-top:-3px;" <?php if($d35>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Delivery</td></tr>



<tr><td><input type="checkbox" value="fuel" name="check[36]" style="margin-top:-3px;" <?php if($d36>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Fuel</td></tr>



<tr><td><input type="checkbox" value="fuelreport" name="check[37]" style="margin-top:-3px;" <?php if($d37>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Fuel Report</td></tr>



</table>



</td>



<td style="width:20%; padding-top:35px;" valign="top">



<b>CRM</b>



<table style="margin-top:7px; line-height:23px;">



<tr><td><input type="checkbox" value="crmcustomer" name="check[38]" style="margin-top:-3px;" <?php if($d38>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Farmer Data</td></tr>



<tr><td><input type="checkbox" value="crmteamallocate" name="check[39]" style="margin-top:-3px;" <?php if($d39>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">CRM Team Allocate</td></tr>


<tr><td><input type="checkbox" value="premiumcustomers" name="check[48]" style="margin-top:-3px;" <?php if($d48>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Premium Customers</td></tr>



<tr><td><input type="checkbox" value="followup" name="check[40]" style="margin-top:-3px;" <?php if($d40>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Follow Up</td></tr>



<tr><td><input type="checkbox" value="todaysfollowup" name="check[44]" style="margin-top:-3px;" <?php if($d44>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Today's Follow Up</td></tr>



<tr><td><input type="checkbox" value="followupreport" name="check[41]" style="margin-top:-3px;" <?php if($d41>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Follow Up Report</td></tr>



<tr><td><input type="checkbox" value="executivesreport" name="check[42]" style="margin-top:-3px;" <?php if($d42>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Executives Report</td></tr>



<tr><td><input type="checkbox" value="teamwisereport" name="check[45]" style="margin-top:-3px;" <?php if($d45>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Teamwise Report</td></tr>



</table>



</td>



</tr>





<tr>



<td style="width:20%; padding-top:35px;" valign="top">



<b>Stock</b>



<table style="margin-top:7px; line-height:23px;">



<tr><td><input type="checkbox" value="stock" name="check[15]" style="margin-top:-3px;" <?php if($d15>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Stock</td></tr>



</table>



</td>





<td style="width:20%; padding-top:35px;" valign="top">



<b>New Project</b>



<table style="margin-top:7px; line-height:23px;">



<tr><td><input type="checkbox" value="newproject" name="check[46]" style="margin-top:-3px;" <?php if($d46>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">New Project</td></tr>



</table>



</td>





<td style="width:20%; padding-top:35px;" valign="top">


<b>Coconut Project</b>



<table style="margin-top:7px; line-height:23px;">



<tr><td><input type="checkbox" value="coconutproject" name="check[47]" style="margin-top:-3px;" <?php if($d47>0){ echo'checked="checked"'; } ?> /> </td><td style="padding-left:5px;">Coconut Project</td></tr>



</table>


</td>



<td style="width:20%; padding-top:35px;" valign="top">



</td>



</tr>



</table><br /><br />







<center><button type="submit" name="submit" value="submit" class="btn btn-sm btn-primary">Submit</button></center>







</form>







<br />







<center><a href="viewemployee.php">Back</a></center>







<?php







}







?>



                               

							<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();

?>