<html>
<head>
<link href="../../css/pop_up style.css" rel="stylesheet" type="text/css">
<script src="../../js/jquery/jquery.js" type="text/javascript"></script>
<script src="../../js/jquery/jquery-1.8.2.js"></script>
<script src="../../js/jquery/jquery-ui.js"></script>
<script src="../../js/user_permission_ajax.js" type="text/javascript"></script>
<script>

/************************************************************************************************************/
function overall_dashboard_value()
{
    var answers = [];
    jQuery.each(jQuery('.overalldashboard:checked'), function() {
        answers.push(jQuery(this).val()); 
    });
	document.getElementById('user_checks1').value=answers;
	return false;
}

/************************************************************************************************************/
function get_check_jobcard()
{
     var answers = [];
    jQuery.each(jQuery('.jobcards:checked'), function(){
        answers.push(jQuery(this).val()); 
    });
	document.getElementById('jobcards').value=answers;
	return false;
}
function get_check_consumable()
{
     var answers = [];
    jQuery.each(jQuery('.consumable:checked'), function(){
        answers.push(jQuery(this).val()); 
    });
	document.getElementById('consumable').value=answers;
	return false;
}

/************************************************************************************************************/
function get_check_deliverys()
{
     var answers = [];
    jQuery.each(jQuery('.deliverys:checked'), function() {
        answers.push(jQuery(this).val()); 
    });
	document.getElementById('deliverys').value=answers;
	return false;
}


/************************************************************************************************************/
function get_check_printers()
{
     var answers = [];
    jQuery.each(jQuery('.printers:checked'), function() {
        answers.push(jQuery(this).val()); 
    });
	document.getElementById('printers').value=answers;
	return false;
}

/************************************************************************************************************/
function get_check_fusing()
{
     var answers = [];
    jQuery.each(jQuery('.fusing:checked'), function() {
        answers.push(jQuery(this).val()); 
    });
	document.getElementById('fusing').value=answers;
	return false;
}


/************************************************************************************************************/
function get_check_invoice()
{
     var answers = [];
    jQuery.each(jQuery('.invoice:checked'), function() {
        answers.push(jQuery(this).val()); 
    });
	document.getElementById('invoice').value=answers;
	return false;
}
function selectAll(source) {
		checkboxes = document.getElementsByName('user_check');
			for(var j in checkboxes)
			checkboxes[j].checked = source.checked;
	}
function get_check_value()
{
     var answers = [];
    jQuery.each(jQuery('.admin_fields:checked'), function() {
        answers.push(jQuery(this).val()); 
    });
	document.getElementById('user_checks').value=answers;
	return false;
}	


function selectAll1(source) {
		checkboxes = document.getElementsByName('overalldashboard');
			for(var j in checkboxes)
			checkboxes[j].checked = source.checked;
	}
function get_check_value1()
{
     var answers = [];
    jQuery.each(jQuery('.overalldashboard:checked'), function() {
        answers.push(jQuery(this).val()); 
    });
	document.getElementById('user_checks1').value=answers;
	return false;
}	



function selectAll2(source) {
		checkboxes = document.getElementsByName('jobcard');
			for(var j in checkboxes)
			checkboxes[j].checked = source.checked;
	}
function get_check_value2()
{
     var answers = [];
    jQuery.each(jQuery('.jobcards:checked'), function() {
        answers.push(jQuery(this).val()); 
    });
	document.getElementById('jobcards').value=answers;
	return false;
}	


function selectAll3(source) {
		checkboxes = document.getElementsByName('delivery');
			for(var j in checkboxes)
			checkboxes[j].checked = source.checked;
	}
function get_check_value3()
{
     var answers = [];
    jQuery.each(jQuery('.deliverys:checked'), function() {
        answers.push(jQuery(this).val()); 
    });
	document.getElementById('deliverys').value=answers;
	return false;
}	


function selectAll5(source) {
		checkboxes = document.getElementsByName('printer');
			for(var j in checkboxes)
			checkboxes[j].checked = source.checked;
	}
function get_check_value5()
{
     var answers = [];
    jQuery.each(jQuery('.printers:checked'), function() {
        answers.push(jQuery(this).val()); 
    });
	document.getElementById('printers').value=answers;
	return false;
}	


function selectAll6(source) {
		checkboxes = document.getElementsByName('fusing1');
			for(var j in checkboxes)
			checkboxes[j].checked = source.checked;
	}
function get_check_value6()
{
     var answers = [];
    jQuery.each(jQuery('.fusing:checked'), function() {
        answers.push(jQuery(this).val()); 
    });
	document.getElementById('fusing').value=answers;
	return false;
}	


function selectAll7(source) {
		checkboxes = document.getElementsByName('invoices');
			for(var j in checkboxes)
			checkboxes[j].checked = source.checked;
	}
function get_check_value7()
{
    var answers = [];
    jQuery.each(jQuery('.invoice:checked'), function() {
    answers.push(jQuery(this).val()); 
    });
	document.getElementById('invoice').value=answers;
	return false;
}	
function selectAll10(source) {
		checkboxes = document.getElementsByName('consumables');
			for(var j in checkboxes)
			checkboxes[j].checked = source.checked;
	}
function get_check_value10()
{
    var answers = [];
    jQuery.each(jQuery('.consumable:checked'), function() {
    answers.push(jQuery(this).val()); 
    });
	document.getElementById('consumable').value=answers;
	return false;
}	

</script>
</head>
<?php
error_reporting(0);
$edit_id=$_GET['edit_id'];
include("../../include/db.php");
$user_login=$_GET['user_name'];
   $id=$_GET['edit_id'];
   $sql="select * from  user_permissions ";
    $rs=mysql_query($sql);
	$sno=0;
    while($rsdata=mysql_fetch_array($rs))
     {
        $sno=$sno+1;
        $user_type_id11=$rsdata['user_type_id'];
  		$user_name_permission=$rsdata['user_name'];
  		$user_screen=$rsdata['user_screen'];
		$user_form_name=$rsdata['user_form_name'];
	}

	$id=$_GET['edit_id'];
    $sql11="select * from  user_permission_main where main_id='$_GET[edit_id]'  ";
    $rs1=mysql_query($sql11);
    while($rsdatas=mysql_fetch_array($rs1))
     {
  		$user_name_permission=$rsdatas['user_name'];
	 }
	 
	 
function admin_screen_name($user_screen,$user_login)
  {
	$sql_user="select * from user_permissions where box_name='$user_screen' and user_type_id='$_GET[user_name]'";
	$rs_user=mysql_query($sql_user);
	while($rsdata_user=mysql_fetch_object($rs_user))
	{ 
	$permission=$rsdata_user->permission;
	}
	return $permission;
 } 
function master_screen_name($user_screen,$user_login)
  {
	$sql_user="select * from user_permissions where box_name='$user_screen' and user_type_id='$user_login' ";
	$rs_user=mysql_query($sql_user);
	while($rsdata_user=mysql_fetch_object($rs_user))
	{ 
	$permission=$rsdata_user->permission;
	}
	return $permission;
 } 

?>

<style type="text/css">
.txt{ font-family: Verdana, Arial, Helvetica, sans-serif; font-size:13px;}

.style2 {color: #FF0000}
.style7{font-family: Tahoma, Arial, Helvetica, sans-serif;font-size: 13px;}
.headings{ font-family:verdana; font-size:10px;}
</style>
<body style="margin:0px;" bgcolor="#f7f7f7">
    <table width="100%">
  <tr>
    <td colspan="6" class="heading" ><span class="h_title" style="margin-bottom:10px;"><strong>User Permission</strong></span></td>
  </tr>
   
  <tr>

  <td width="18" height="30" align="left" class="txt">&nbsp;</td>
  
  <td width="177" align="left" class="txt">User Type<span class="style2">*</span></td>
  <td width="1120" colspan="3" class="field"><select name="user_name" id="user_name" tabindex="4"   onchange="user_right_clear_validate(this.value)"  style="width:200px; height:30px; border:1px solid #a1a1a1;">
    <?php
			  $sql="select * from user_type where delete_status!='1' ORDER BY user_type_id ASC ";
			  $rs=mysql_query($sql);
			  while($rsdata=mysql_fetch_object($rs))
			  {
				  $usertype_permission=$rsdata->user_type;
				  $user_type_id=$rsdata->user_type_id;
			  ?>
			 
			  
    <option value="<?php echo $usertype_permission;?>"<?php if($user_login==$usertype_permission){ echo "Selected"; } ?>><?php echo $usertype_permission;?>
    </option>
    <?php  } ?>
  </select>
  <div  id="user_name_err_design" style="color:#FF0000;" ></div></td>
  </tr>
    <tr>
    <td colspan="6" align="right" class="txt">&nbsp;</td>
    <?php
	 $sql_subscreen=$sql="select * from user_rights ";
$rs_subscreen=mysql_query($sql_subscreen);
$rscount_subscreen=mysql_num_rows($rs_subscreen);
while($rsdata_subscreen=mysql_fetch_object($rs_subscreen))
{ 
$form_id=$rsdata_subscreen->form_id;

} ?>
    <input type="hidden" name="user_value" id="user_value"/>
  </tr>
   <tr>  
    <td align="left" class="style7">&nbsp;&nbsp;<span class="txt">&nbsp;&nbsp;</span></td>
    <?php 
	 $sql_subscreen=$sql="select * from user_permissions where box_name='1' and user_type_id='$_GET[user_name]' ";
$rs_subscreen=mysql_query($sql_subscreen);
$rscount_subscreen=mysql_num_rows($rs_subscreen);
while($rsdata_subscreen=mysql_fetch_object($rs_subscreen))
{ 
$permission1=$rsdata_subscreen->permission;
}
	
	?>
        <td colspan="2" align="left" class="style7 txt" style="color:#CC3399">DASHBOARD <input type="checkbox" name="user_form1" id="user_form1"  onclick="selectAll(this);get_check_value();" class="admin_fields same_field" value="1" <?php if($permission1=='1'){?> checked <?php }else{?><?php } ?>/></td>
        </tr>
</table>
  <?php
 $sql_subscreen="select * from user_rights where form_id='1' ";
$rs_subscreen=mysql_query($sql_subscreen);
$rscount_subscreen=mysql_num_rows($rs_subscreen);
$columns_counter=0; 
echo "<table width='75%' border='0' cellspacing='0' cellpadding='3'>";
echo '<tr>';
while($rsdata_subscreen=mysql_fetch_object($rs_subscreen))
{ 
$i=$i+1;
$i=$i+1;
$user_name=$rsdata_subscreen->user_name;
$user_screen=$rsdata_subscreen->user_screen;
$user_screen_id=$user_screen.'-'.$i;
$user_screen_file=$rsdata_subscreen->user_screen_file;
$form_id=$rsdata_subscreen->form_id;
$user_id=admin_screen_name($user_screen,$user_login);
 if($user_id=='1') 
 {
echo "<td width='15%' class='small_text' style='padding-left:25px;font-family:verdana; font-size:12px;'>
<input type='checkbox' name='user_check' onClick='get_check_value();'  id='user_check' class='rights admin_fields' value='".$user_screen."'  checked >".$user_screen."</td> ";  
}
else
{ 
echo "<td width='15%' class='small_text' style='padding-left:25px;font-family:verdana; font-size:12px;'>
<input type='checkbox' name='user_check' onClick='get_check_value();'  id='user_check' class='rights admin_fields' value='".$user_screen."'   >".$user_screen."</td> ";
}
	
$columns_counter++; 
	if($columns_counter==4)
	{ 
	   echo '</tr><tr>'; //close and open a row if $columns_counter=4; 
	   $columns_counter=0; 
	} 
	} 
 echo "</tr></table>";  
?>
<?php 
 $sql_subscreen=$sql="select box_name from user_permissions where form_id='1' and permission='1' and user_type_id='$_GET[user_name]' ";
$rs_subscreen=mysql_query($sql_subscreen);
$rscount_subscreen=mysql_num_rows($rs_subscreen);
while($rsdata_subscreen=mysql_fetch_object($rs_subscreen))
{ 
 $box_name11.=$rsdata_subscreen->box_name.',';
}?>
<input type="hidden" name="user_checks" id="user_checks" value="<?php echo $box_name11;?>"/>

<table width="100%" border="0" cellpadding="0" cellspacing="0"> 
         <tr>  
    <td width="2%" height="30" align="left" class="style7">&nbsp;&nbsp;<span class="txt">&nbsp;&nbsp;</span></td>
     <?php 
	 $sql_subscreen=$sql="select * from user_permissions where box_name='2' and user_type_id='$_GET[user_name]'";
$rs_subscreen=mysql_query($sql_subscreen);
$rscount_subscreen=mysql_num_rows($rs_subscreen);
while($rsdata_subscreen=mysql_fetch_object($rs_subscreen))
{ 
$permission2=$rsdata_subscreen->permission;
}
	?>
        <td width="98%" colspan="2" align="left" class="style7 txt" style="color:#CC3399">MASTER CREATION<input type="checkbox" name="user_form2" id="user_form2"  onclick="selectAll1(this);get_check_value1();" class="overalldashboard same_field" value="2" <?php if($permission2=='1'){?> checked <?php }else{?><?php } ?>/></td>
        </tr>
        </table>
         <?php
	 $sql_subscreen=$sql="select * from user_rights where  form_id='2'  ";
$rs_subscreen=mysql_query($sql_subscreen);
$rscount_subscreen=mysql_num_rows($rs_subscreen);
$columns_counter=0; 
echo "<table width='100%' border='0' cellspacing='0' cellpadding='3'>";
echo '<tr>';
while($rsdata_subscreen=mysql_fetch_object($rs_subscreen))
{ 
$user_screen=$rsdata_subscreen->user_screen;
$user_screen=$rsdata_subscreen->user_screen;
$form_id=$rsdata_subscreen->form_id;
$user_id=admin_screen_name($user_screen,$user_login);
 if($user_id=='1') {
echo " <td width='15%' class='small_text' style='padding-left:25px;font-family:verdana; font-size:12px;'><input type='checkbox' name='overalldashboard' onClick='overall_dashboard_value();' id='overalldashboard' class='rights overalldashboard' value='".$user_screen."' checked>".$user_screen."</td> ";  
 }else{
	 
	echo " <td width='15%' class='small_text' style='padding-left:25px;font-family:verdana; font-size:12px;'><input type='checkbox' name='overalldashboard' onClick='overall_dashboard_value();' id='overalldashboard' class='rights overalldashboard' value='".$user_screen."' >".$user_screen."</td> ";   
	 }

$columns_counter++; 
	if($columns_counter==2){ 
	   echo '</tr><tr>'; 
	   $columns_counter=0; 
	} 
	} 

 echo "</tr></table>";  
?>
<?php 
$sql_subscreen=$sql="select box_name from user_permissions where form_id='2' and permission='1' and user_type_id='$_GET[user_name]' ";
$rs_subscreen=mysql_query($sql_subscreen);
$rscount_subscreen=mysql_num_rows($rs_subscreen);
while($rsdata_subscreen=mysql_fetch_object($rs_subscreen))
{ 
$box_name22.=$rsdata_subscreen->box_name.',';
}?>

<input type="hidden" name="user_checks1" id="user_checks1" value="<?php echo $box_name22;?>"/>

<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>  
    <td width="2%" height="30" align="left" class="style7">&nbsp;&nbsp;<span class="txt">&nbsp;&nbsp;</span></td>
    <?php 
	 $sql_subscreen=$sql="select * from user_permissions where box_name='3' and user_type_id='$_GET[user_name]'";
$rs_subscreen=mysql_query($sql_subscreen);
$rscount_subscreen=mysql_num_rows($rs_subscreen);
while($rsdata_subscreen=mysql_fetch_object($rs_subscreen))
{ 
$permission3=$rsdata_subscreen->permission;
}
	
	?>
        <td width="98%" colspan="2" align="left" class="style7 txt" style="color:#CC3399">JOBCARD<input type="checkbox" name="user_form3" id="user_form3"  onclick="selectAll2(this);get_check_value2();" class="jobcards same_field" value="3" <?php if($permission3=='1'){?> checked <?php }else{?><?php } ?>/></td>
  </tr>
</table>
  <?php
$sql_subscreen=$sql="select * from user_rights where  form_id='3'  ";
$rs_subscreen=mysql_query($sql_subscreen);
$rscount_subscreen=mysql_num_rows($rs_subscreen);
$columns_counter=0; 
echo "<table width='100%' border='0' cellspacing='0' cellpadding='3'>";
echo '<tr>';
while($rsdata_subscreen=mysql_fetch_object($rs_subscreen))
{ 
$user_screen=$rsdata_subscreen->user_screen;
$user_screen=$rsdata_subscreen->user_screen;
$form_id=$rsdata_subscreen->form_id;
$user_id=admin_screen_name($user_screen,$user_login);
 if($user_id=='1') 
 {
echo " <td width='15%' class='small_text' style='padding-left:25px;font-family:verdana; font-size:12px;'><input type='checkbox' name='jobcard' onClick='get_check_jobcard();' id='jobcard' class='rights jobcards' value='".$user_screen."' checked>".$user_screen."</td> ";  
 }
 else
 {
echo " <td width='15%' class='small_text' style='padding-left:25px;font-family:verdana; font-size:12px;'><input type='checkbox' name='jobcard' onClick='get_check_jobcard();' id='jobcard' class='rights jobcards' value='".$user_screen."' >".$user_screen."</td> ";   
 }

$columns_counter++; 
	if($columns_counter==2){ 
	   echo '</tr><tr>'; //close and open a row if $columns_counter=4; 
	   $columns_counter=0; 
	} 
	} 

 echo "</tr></table>";  
?>
<?php 
$sql_subscreen=$sql="select box_name from user_permissions where form_id='3' and permission='1' and user_type_id='$_GET[user_name]' ";
$rs_subscreen=mysql_query($sql_subscreen);
$rscount_subscreen=mysql_num_rows($rs_subscreen);
while($rsdata_subscreen=mysql_fetch_object($rs_subscreen))
{ 
$box_name14.=$rsdata_subscreen->box_name.',';
}?>
<input type="hidden" name="jobcards" id="jobcards"  value="<?php echo $box_name14;?>"   />
<table width="100%" border="0" cellpadding="0" cellspacing="0"> 
         <tr>  
    <td width="2%" height="30" align="left" class="style7">&nbsp;&nbsp;<span class="txt">&nbsp;&nbsp;</span></td>
    <?php 
	 $sql_subscreen=$sql="select * from user_permissions where box_name='4' and user_type_id='$_GET[user_name]' ";
$rs_subscreen=mysql_query($sql_subscreen);
$rscount_subscreen=mysql_num_rows($rs_subscreen);
while($rsdata_subscreen=mysql_fetch_object($rs_subscreen))
{ 
$permission4=$rsdata_subscreen->permission;
}
	
	?>
        <td width="98%" colspan="2" align="left" class="style7 txt" style="color:#CC3399">DELIVERY <input type="checkbox" name="user_form4" id="user_form4"  onclick="selectAll3(this);get_check_value3();" class="deliverys same_field" value="4" <?php if($permission4=='1'){?> checked <?php }else{?><?php } ?>/></td>
  </tr>
</table>        
       <?php
	 $sql_subscreen=$sql="select * from user_rights where form_id='4' ";
$rs_subscreen=mysql_query($sql_subscreen);
$rscount_subscreen=mysql_num_rows($rs_subscreen);
$columns_counter=0; 
echo "<table width='100%' border='0' cellspacing='0' cellpadding='3'>";
echo '<tr>';
while($rsdata_subscreen=mysql_fetch_object($rs_subscreen))
{ 
$user_screen=$rsdata_subscreen->user_screen;
$user_screen=$rsdata_subscreen->user_screen;
$form_id=$rsdata_subscreen->form_id;
$user_id=master_screen_name($user_screen,$user_login);
 if($user_id=='1') {


echo " <td width='15%' class='small_text' style='padding-left:25px;font-family:verdana; font-size:12px;'><input type='checkbox' name='delivery' onClick='get_check_deliverys();'  id='delivery' class='rights deliverys' value='".$user_screen."' checked >".$user_screen."</td> ";  
 } else{
	echo " <td width='15%' class='small_text' style='padding-left:25px;font-family:verdana; font-size:12px;'><input type='checkbox' name='delivery' onClick='get_check_deliverys();'  id='delivery' class='rights deliverys' value='".$user_screen."' >".$user_screen."</td> ";  
	 
	 }

$columns_counter++; 
	if($columns_counter==4){ 
	   echo '</tr><tr>'; //close and open a row if $columns_counter=4; 
	   $columns_counter=0; 
	} 
	} 
 echo "</tr></table>";  
?>
<?php 
$sql_subscreen=$sql="select box_name from user_permissions where form_id='4' and permission='1' and user_type_id='$_GET[user_name]' ";
$rs_subscreen=mysql_query($sql_subscreen);
$rscount_subscreen=mysql_num_rows($rs_subscreen);
while($rsdata_subscreen=mysql_fetch_object($rs_subscreen))
{ 
$box_name1022.=$rsdata_subscreen->box_name.',';
}?>
<input type="hidden" name="deliverys" id="deliverys"  value="<?php echo $box_name1022;?>"  />
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<?php 
	 $sql_subscreen=$sql="select * from user_permissions where box_name='5' and user_type_id='$_GET[user_name]' ";
$rs_subscreen=mysql_query($sql_subscreen);
$rscount_subscreen=mysql_num_rows($rs_subscreen);
while($rsdata_subscreen=mysql_fetch_object($rs_subscreen))
{ 
$permission10=$rsdata_subscreen->permission;
}
	
	?>
 <tr>  
    <td width="2%" height="30" align="left" class="style7">&nbsp;&nbsp;<span class="txt">&nbsp;&nbsp;</span></td>
        <td width="98%" colspan="2" align="left" class="style7 txt" style="color:#CC3399">CONSUMABLE<input type="checkbox" name="user_form10" id="user_form10"  onclick="selectAll10(this);get_check_value10();" class="consumable same_field" value="5" <?php if($permission10=='1'){?> checked <?php }else{?><?php } ?>/></td>
  </tr>
</table>
<?php
	 $sql_subscreen=$sql="select * from user_rights where  form_id='5'  ";
$rs_subscreen=mysql_query($sql_subscreen);
$rscount_subscreen=mysql_num_rows($rs_subscreen);
$columns_counter=0; 
echo "<table width='100%' border='0' cellspacing='0' cellpadding='3'>";
echo '<tr>';
while($rsdata_subscreen=mysql_fetch_object($rs_subscreen))
{ 
 $user_screen=$rsdata_subscreen->user_screen;
 $user_screen=$rsdata_subscreen->user_screen;
$form_id=$rsdata_subscreen->form_id;
$user_id=admin_screen_name($user_screen,$user_login);
 if($user_id=='1') {
echo " <td width='15%' class='small_text' style='padding-left:25px;font-family:verdana; font-size:12px;'><input type='checkbox' name='consumables' onClick='get_check_consumable();' id='consumables' class='rights consumable' value='".$user_screen."' checked>".$user_screen."</td> ";  
 }else{
	 
	echo " <td width='15%' class='small_text' style='padding-left:25px;font-family:verdana; font-size:12px;'><input type='checkbox' name='consumables' onClick='get_check_consumable();' id='consumables' class='rights consumable' value='".$user_screen."' >".$user_screen."</td> ";   
	 }

$columns_counter++; 
	if($columns_counter==2){ 
	   echo '</tr><tr>'; //close and open a row if $columns_counter=4; 
	   $columns_counter=0; 
	} 
	} 

 echo "</tr></table>";  
?>
<?php 
$sql_subscreen=$sql="select box_name from user_permissions where form_id='5' and permission='1' and user_type_id='$_GET[user_name]' ";
$rs_subscreen=mysql_query($sql_subscreen);
$rscount_subscreen=mysql_num_rows($rs_subscreen);
while($rsdata_subscreen=mysql_fetch_object($rs_subscreen))
{ 
$box_name14221.=$rsdata_subscreen->box_name.',';
}?>
<input type="hidden" name="consumable" id="consumable"  value="<?php echo $box_name14221;?>"   />
<table width="100%" border="0" cellpadding="0" cellspacing="0">
 <?php 
	 $sql_subscreen=$sql="select * from user_permissions where box_name='6' and user_type_id='$_GET[user_name]' ";
$rs_subscreen=mysql_query($sql_subscreen);
$rscount_subscreen=mysql_num_rows($rs_subscreen);
while($rsdata_subscreen=mysql_fetch_object($rs_subscreen))
{ 
$permission6=$rsdata_subscreen->permission;
}
	
	?>
  <tr>  
    <td width="2%" height="30" align="left" class="style7">&nbsp;&nbsp;<span class="txt">&nbsp;&nbsp;</span></td>
        <td width="98%" colspan="2" align="left" class="style7 txt" style="color:#CC3399">PRINTER PRODUCTION <input type="checkbox" name="user_form6" id="user_form6"  onclick="selectAll5(this);get_check_value5();" class="printers same_field" value="6" <?php if($permission6=='1'){?> checked <?php }else{?><?php } ?>/></td>
  </tr>
</table>
  <?php
	 $sql_subscreen=$sql="select * from user_rights where  form_id='6'  ";
$rs_subscreen=mysql_query($sql_subscreen);
$rscount_subscreen=mysql_num_rows($rs_subscreen);
$columns_counter=0; 
echo "<table width='100%' border='0' cellspacing='0' cellpadding='3'>";
echo '<tr>';
while($rsdata_subscreen=mysql_fetch_object($rs_subscreen))
{ 
$user_screen=$rsdata_subscreen->user_screen;
$user_screen=$rsdata_subscreen->user_screen;
$form_id=$rsdata_subscreen->form_id;
$user_id=admin_screen_name($user_screen,$user_login);
 if($user_id=='1') {
echo " <td width='15%' class='small_text' style='padding-left:25px;font-family:verdana; font-size:12px;'><input type='checkbox' name='printer' onClick='get_check_printers();' id='printer' class='rights printers' value='".$user_screen."' checked>".$user_screen."</td> ";  
 }else{
	 
	echo " <td width='15%' class='small_text' style='padding-left:25px;font-family:verdana; font-size:12px;'><input type='checkbox' name='printer' onClick='get_check_printers();' id='printer' class='rights printers' value='".$user_screen."' >".$user_screen."</td> ";   
	 }

$columns_counter++; 
	if($columns_counter==2){ 
	   echo '</tr><tr>'; //close and open a row if $columns_counter=4; 
	   $columns_counter=0; 
	} 
	} 

 echo "</tr></table>";  
?>
<?php 
$sql_subscreen=$sql="select box_name from user_permissions where form_id='6' and permission='1' and user_type_id='$_GET[user_name]' ";
$rs_subscreen=mysql_query($sql_subscreen);
$rscount_subscreen=mysql_num_rows($rs_subscreen);
while($rsdata_subscreen=mysql_fetch_object($rs_subscreen))
{ 
$box_name1422.=$rsdata_subscreen->box_name.',';
}?>
<input type="hidden" name="printers" id="printers"  value="<?php echo $box_name1422;?>"   />
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>  
    <td width="2%" height="30" align="left" class="style7">&nbsp;&nbsp;<span class="txt">&nbsp;&nbsp;</span></td>
    <?php 
	 $sql_subscreen=$sql="select * from user_permissions where box_name='7' and user_type_id='$_GET[user_name]' ";
$rs_subscreen=mysql_query($sql_subscreen);
$rscount_subscreen=mysql_num_rows($rs_subscreen);
while($rsdata_subscreen=mysql_fetch_object($rs_subscreen))
{ 
$permission7=$rsdata_subscreen->permission;
}
	
	?>
        <td width="98%" colspan="2" align="left" class="style7 txt" style="color:#CC3399">FUISNG PRODUCTION  <input type="checkbox" name="user_form7" id="user_form7"  onclick="selectAll6(this);get_check_value6();" class="fusing same_field" value="7" <?php if($permission7=='1'){?> checked <?php }else{?><?php } ?>/></td>
  </tr>
</table>
  <?php
	 $sql_subscreen=$sql="select * from user_rights where  form_id='7'";
$rs_subscreen=mysql_query($sql_subscreen);
$rscount_subscreen=mysql_num_rows($rs_subscreen);
$columns_counter=0; 
echo "<table width='100%' border='0' cellspacing='0' cellpadding='3'>";
echo '<tr>';
while($rsdata_subscreen=mysql_fetch_object($rs_subscreen))
{ 
$user_screen=$rsdata_subscreen->user_screen;
$user_screen=$rsdata_subscreen->user_screen;
$form_id=$rsdata_subscreen->form_id;
$user_id=admin_screen_name($user_screen,$user_login);
 if($user_id=='1') {
echo " <td width='15%' class='small_text' style='padding-left:25px;font-family:verdana; font-size:12px;'><input type='checkbox' name='fusing1' onClick='get_check_fusing();' id='fusing1' class='rights fusing' value='".$user_screen."' checked>".$user_screen."</td> ";  
 }else{
	 
	echo " <td width='15%' class='small_text' style='padding-left:25px;font-family:verdana; font-size:12px;'><input type='checkbox' name='fusing1' onClick='get_check_fusing();' id='fusing1' class='rights fusing' value='".$user_screen."' >".$user_screen."</td> ";   
	 }

$columns_counter++; 
	if($columns_counter==2){ 
	   echo '</tr><tr>'; //close and open a row if $columns_counter=4; 
	   $columns_counter=0; 
	} 
	} 

 echo "</tr></table>";  
?>
<?php 
$sql_subscreen=$sql="select box_name from user_permissions where form_id='7' and permission='1' and user_type_id='$_GET[user_name]' ";
$rs_subscreen=mysql_query($sql_subscreen);
$rscount_subscreen=mysql_num_rows($rs_subscreen);
while($rsdata_subscreen=mysql_fetch_object($rs_subscreen))
{ 
$box_name1311.=$rsdata_subscreen->box_name.',';
}?>
<input type="hidden" name="fusing" id="fusing"  value="<?php echo $box_name1311;?>"   />
<table width="100%" border="0" cellpadding="0" cellspacing="0">
 <tr>  
    <td width="2%" height="30" align="left" class="style7">&nbsp;&nbsp;<span class="txt">&nbsp;&nbsp;</span></td>
    <?php 
	 $sql_subscreen=$sql="select * from user_permissions where box_name='8' and user_type_id='$_GET[user_name]' ";
$rs_subscreen=mysql_query($sql_subscreen);
$rscount_subscreen=mysql_num_rows($rs_subscreen);
while($rsdata_subscreen=mysql_fetch_object($rs_subscreen))
{ 
$permission8=$rsdata_subscreen->permission;
}
	
	?>
        <td width="98%" colspan="2" align="left" class="style7 txt" style="color:#CC3399">INVOICE <input type="checkbox" name="user_form8" id="user_form8"  onclick="selectAll7(this);get_check_value7();" class="invoice same_field" value="8" <?php if($permission8=='1'){?> checked <?php }else{?><?php } ?>/></td>
  </tr>
</table>
  <?php
	 $sql_subscreen=$sql="select * from user_rights where  form_id='8'  ";
$rs_subscreen=mysql_query($sql_subscreen);
$rscount_subscreen=mysql_num_rows($rs_subscreen);
$columns_counter=0; 
echo "<table width='100%' border='0' cellspacing='0' cellpadding='3'>";
echo '<tr>';
while($rsdata_subscreen=mysql_fetch_object($rs_subscreen))
{ 
$user_screen=$rsdata_subscreen->user_screen;
$user_screen=$rsdata_subscreen->user_screen;
$form_id=$rsdata_subscreen->form_id;
$user_id=admin_screen_name($user_screen,$user_login);
 if($user_id=='1') {
echo " <td width='15%' class='small_text' style='padding-left:25px;font-family:verdana; font-size:12px;'><input type='checkbox' name='invoices' onClick='get_check_invoice();' id='invoices' class='rights invoice' value='".$user_screen."' checked>".$user_screen."</td> ";  
 }else{
	 
	echo " <td width='15%' class='small_text' style='padding-left:25px;font-family:verdana; font-size:12px;'><input type='checkbox' name='invoices' onClick='get_check_invoice();' id='invoices' class='rights invoice' value='".$user_screen."' >".$user_screen."</td> ";   
	 }

$columns_counter++; 
	if($columns_counter==2){ 
	   echo '</tr><tr>'; //close and open a row if $columns_counter=4; 
	   $columns_counter=0; 
	} 
	} 

 echo "</tr></table>";  
?>
<?php 
$sql_subscreen=$sql="select box_name from user_permissions where form_id='8' and permission='1' and user_type_id='$_GET[user_name]' ";
$rs_subscreen=mysql_query($sql_subscreen);
$rscount_subscreen=mysql_num_rows($rs_subscreen);
while($rsdata_subscreen=mysql_fetch_object($rs_subscreen))
{ 
$box_name1444.=$rsdata_subscreen->box_name.',';
}?>
<input type="hidden" name="invoice" id="invoice"  value="<?php echo $box_name1444;?>"   />
     <table width="100%" border="0" cellpadding="0" cellspacing="0">
 <tr>  
    <td width="2%" height="30" align="left" class="style7">&nbsp;&nbsp;<span class="txt">&nbsp;&nbsp;</span></td>
    <td width="98%" colspan="2" align="center" class="style7 txt" style="color:#CC3399"><span class="style7 txt" style="color:#CC3399">
      <input type="button" name="action"  style="height:27px; width:55px" id="action" tabindex="3" value="<?php  echo "ADD";  ?>" class="add_button" onClick="user_permission_add(user_name.value,user_value.value,user_checks.value,user_checks1.value,jobcards.value,deliverys.value,printers.value,fusing.value,invoice.value,consumable.value,this.value)"/>
    </span></td>
  </tr>
</table>
