<script>
function add_customer_form(url)
{
new_popup28= window.open(url,'new_popup28','height=350,width=450,scrollbars=yes,resizable=no,left=50,top=50,toolbar=no,location=no,directories=no,status=no,menubar=no');
}

function add_new_customer_form(url)
{
new_popup25= window.open(url,'new_popup23','height=550,width=450,scrollbars=yes,resizable=no,left=50,top=50,toolbar=no,location=no,directories=no,status=no,menubar=no');
}

function add_label_customer_form1(url)
{
new_popup26= window.open(url,'new_popup26','height=320,width=450,scrollbars=yes,resizable=no,left=50,top=50,toolbar=no,location=no,directories=no,status=no,menubar=no');
}

function add_search_form(url)
{
new_popup27= window.open(url,'new_popup27','height=350,width=1000,scrollbars=no,resizable=no,left=50,top=50,toolbar=no,location=no,directories=no,status=no,menubar=no');
}
</script>

<script>
function new_db_backup(url)
{
new_popup28= window.open(url,'new_popup28','height=400,width=600,scrollbars=yes,resizable=no,left=350,top=150,toolbar=no,location=no,directories=no,status=no,menubar=no');

}
</script>
<?php
error_reporting(0);
session_start();
$login=$_SESSION['login_user_name'];
            $login_id = $_SESSION['login_user_id'];
			$login_user_name = $_SESSION['login_user_name'];
			$login_password = $_SESSION['login_pass_word'];
			$branch = $_SESSION['branch'];
			$user_type = $_SESSION['user_type'];
			$acc_year = $_SESSION['acc_year'];
			$current_date = date('Y-m-d');
      //$inactive = 5; 

 //$session_life = time();
//echo  $_SESSION['timeout'];
//if($session_life > $inactive) {
   
  // header("Location: logoutpage.php");
//}


function get_user($usertype_id)
{
	$sql_user="select * from  user_type where user_type_id='$usertype_id'";
	$rs_user=mysql_query($sql_user);
	while($rsdata_user=mysql_fetch_object($rs_user))
	{ 
	$user_type=$rsdata_user->user_type;
	}
	return $user_type;
}
/************************************USER TYPE ID*********************************/
function get_usertype($username)
{
	$sql_user="select * from  user_creation where user_name='$username'";
	$rs_user=mysql_query($sql_user);
	while($rsdata_user=mysql_fetch_object($rs_user))
	{ 
	$user_type=$rsdata_user->user_type;
	}
	return $user_type;
}
  $username=$_SESSION['login_user_name'];
 $usertype_id=get_usertype($username);
 $usertype=get_user($usertype_id);
function get_permission($usertype,$pur_party_name)
{
    $sql_user="select * from  user_permissions where box_name='$pur_party_name' and user_type_id='$usertype'";
	$rs_user=mysql_query($sql_user);
	while($rsdata_user=mysql_fetch_object($rs_user))
	{ 
	$permission=$rsdata_user->permission;
	}
	return $permission;
} 
?>
<?php  $file = $_GET['file'];
if($_SESSION['login_user_id']!='')
{?>
<ul class="menu" >
<!--******************************** Master Entry ***************************************-->

	<li  class="font">SRI AMMAN DIGITAL PRINTS</li>
     <?php $rights=get_permission($usertype,'1'); if($rights=='1'){?><li  class="bg"><img src="img/master.png" /></li>
    <?php $rights=get_permission($usertype,'DashBoard'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file4; ?>" style=" padding-right: 15px;">DashBoard</a></li><?php } ?><?php } ?>


<!--******************************** Master Entry ***************************************-->

     <?php $rights=get_permission($usertype,'2'); if($rights=='1'){?><li  class="bg"><img src="img/master.png" /></li>
    <li><a href="#">Master Creation</a>
    <ul class="submenubg">
             <?php $rights=get_permission($usertype,'User Type Creation'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file2; ?>">User Type Creation </a></li><?php } ?>
<?php $rights=get_permission($usertype,'User Name Creation'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file3; ?>">User Name Creation </a></li><?php } ?>
            <?php $rights=get_permission($usertype,'User Screen'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file49; ?>">User Screen</a></li><?php } ?>
            <?php $rights=get_permission($usertype,'User Rights Creation'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file48; ?>">User Rights Creation </a></li><?php } ?>
           <?php $rights=get_permission($usertype,'Party Creation'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file11; ?>">Party Creation </a></li><?php } ?>
            <?php $rights=get_permission($usertype,'Unit Measurement'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file7; ?>">Unit Measurement</a></li><?php } ?>
            <?php $rights=get_permission($usertype,'Company Creation'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file8; ?>">Company Creation</a></li><?php } ?>
            <?php $rights=get_permission($usertype,'Operator Creation'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file25; ?>">Operator Creation</a></li><?php } ?>
            <?php $rights=get_permission($usertype,'Shift Creation'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file21; ?>">Shift Creation</a></li><?php } ?>
           <?php $rights=get_permission($usertype,'Machine Creation'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file24; ?>">Machine Creation</a></li><?php } ?>
            <?php $rights=get_permission($usertype,'RollSize Creation'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file47; ?>">RollSize Creation</a></li><?php } ?>
             <?php $rights=get_permission($usertype,'Payment Terms'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file55; ?>">Payment Terms</a></li><?php } ?>
            <?php $rights=get_permission($usertype,'Consumable Creation'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file90; ?>">Consumable Creation</a></li><?php } ?>
            <?php $rights=get_permission($usertype,'Fabric Type Creation'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file50; ?>">Fabric Type Creation</a></li><?php } ?>
            <?php $rights=get_permission($usertype,'Fabric Type Creation'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file58; ?>">Gap Interval Creation</a></li><?php } ?>
            <?php $rights=get_permission($usertype,'Job Type Creation'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file59; ?>">Job Type Creation</a></li><?php } ?>

                 <?php $rights=get_permission($usertype,'User Type Creation'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file357; ?>">Designer Creation </a></li><?php } ?>

                  <?php $rights=get_permission($usertype,'User Type Creation'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file358; ?>">Customer Status Creation </a></li><?php } ?>
		</ul>
	</li><?php } ?>
<!--******************************** Booking Entry  ***************************************-->
    <?php $rights=get_permission($usertype,'3'); if($rights=='1'){?><li  class="bg"><img src="img/master.png" /></li>
	<li><a href="#" style=" padding-right: 25px;">Job Card</a>
      <ul class="submenubg">
      <?php $rights=get_permission($usertype,'Jobcard Quotation'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file201; ?>">Jobcard Quotation</a></li><?php } ?>
       <?php $rights=get_permission($usertype,'New Jobcard Creation'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file13; ?>">New Jobcard Creation</a></li><?php } ?>
       
          <?php $rights=get_permission($usertype,'Datewise Jobcard Report'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file161; ?>">DateWise Jobcard Report</a></li><?php } ?>
           <?php $rights=get_permission($usertype,'Customer Wise Report'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file33; ?>">Customer Wise Report</a></li><?php } ?>
        <?php $rights=get_permission($usertype,'Quotation Customer Report'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file203; ?>">Quotation Customer Report</a></li><?php } ?>
             <?php $rights=get_permission($usertype,'Job Process Report'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file36; ?>">Job Process Report</a></li><?php } ?>
             
             
       <!--<?php $rights=get_permission($usertype,'Sample Jobcard Creation'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file152; ?>">Sample Jobcard Creation</a></li><?php } ?>-->
		<!--<?php $rights=get_permission($usertype,'Sample Customer Wise Report'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file158; ?>">Sample Customer Report</a></li><?php } ?>-->
  <!--   <?php $rights=get_permission($usertype,'Date Wise Report'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file159; ?>">Date Wise Report</a></li><?php } ?>-->
     <?php $rights=get_permission($usertype,'Designer Wise Report'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file160; ?>">Designer Wise Report</a></li><?php } ?>

	</ul>
 </li><?php } ?>
 <!--*******************  Consumable  ********************-->
  <?php $rights=get_permission($usertype,'5'); if($rights=='1'){?><li  class="bg"><img src="img/master.png" /></li>
	<li><a href="#" style=" padding-right: 25px;">Consumable</a>
      <ul class="submenubg">
       <?php $rights=get_permission($usertype,'Media Purchase'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file154; ?>">Media Purchase</a></li><?php } ?>
       
       <?php $rights=get_permission($usertype,'Media Entry'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file45; ?>">Media Entry</a></li><?php } ?>
       
          <?php $rights=get_permission($usertype,'Media Report'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file162; ?>">Media Report</a></li><?php } ?>
          
          <?php $rights=get_permission($usertype,'Media Usage Analyze Report'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file353; ?>">Media Usage Analyze Report</a></li><?php } ?>
          
          <?php $rights=get_permission($usertype,'Media Usage Console Report'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file355; ?>">Media Usage Console Report</a></li><?php } ?>
          
		 <?php $rights=get_permission($usertype,'Ink Purchase'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file155; ?>">Ink Purchase</a></li><?php } ?>
		 
		 <?php $rights=get_permission($usertype,'Ink Entry'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file153; ?>">Ink Entry</a></li><?php } ?>
         		
          <?php $rights=get_permission($usertype,'Ink Report'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file156; ?>">Ink Report</a></li><?php } ?>
          
           <?php $rights=get_permission($usertype,'Ink Usage Consolidated Report'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file354; ?>">Ink Usage Consolidated Report</a></li><?php } ?>
           <?php $rights=get_permission($usertype,'Stock Report'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file157; ?>">Stock Report</a></li><?php } ?>
           
              <?php $rights=get_permission($usertype,'Consumable Return Form'); if($rights=='1'){?> <li><a href="main_fram.php?file=<?php  echo $file200; ?>">Consumable Return Form</a></li><?php } ?>
             
              <?php $rights=get_permission($usertype,'Empty can DC Form'); if($rights=='1'){?> <li><a href="main_fram.php?file=<?php  echo $file356; ?>">Empty can DC Form</a></li><?php } ?>
              
	</ul>
 </li><?php } ?>
   <!--******************************** delivery ***************************************-->	
   <?php $rights=get_permission($usertype,'4'); if($rights=='1'){?><li  class="bg"><img src="img/master.png" /></li>
	<li><a href="#" style=" padding-right: 25px;">Delivery</a>
    <ul class="submenubg">
         <?php $rights=get_permission($usertype,'Inward Entry'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file15; ?>">Inward Entry</a></li><?php } ?>
       <?php $rights=get_permission($usertype,'Fabric Delivery Challan'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file16; ?>">Fabric Delivery Challan</a></li><?php } ?>
       
        <?php $rights=get_permission($usertype,'Sticker Delivery Challan'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file56; ?>">Sticker Delivery Challan</a></li><?php } ?>
        
        <?php $rights=get_permission($usertype,'Return Form'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file31; ?>">Return Form</a></li><?php } ?>
       <?php $rights=get_permission($usertype,'Delivery Report'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file38; ?>">Delivery Report</a></li><?php } ?>
	</ul>
 </li><?php } ?>
 <!--******************************** delivery ***************************************-->
  <!--  <li  class="bg"><img src="img/master.png" /></li>
	<li><a href="#" style=" padding-right: 25px;">Consumable</a>
    <ul class="submenubg">
	</ul>
 </li>-->
 <!--******************************** Production ***************************************-->
  <?php $rights=get_permission($usertype,'6'); if($rights=='1'){?><li  class="bg"><img src="img/master.png" /></li>
	<li><a href="#" style=" padding-right: 25px;">Printer</a>
      <ul class="submenubg">
	<?php $rights=get_permission($usertype,'Printer Production Entry'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file18; ?>">Printer Production Entry</a></li><?php } ?>
		<?php $rights=get_permission($usertype,'Job No wise Report'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file39; ?>">Job No wise Report</a></li><?php } ?>
         <?php $rights=get_permission($usertype,'Operator wise Report'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file40; ?>">Operator wise Report</a></li><?php } ?>
        <?php $rights=get_permission($usertype,'Machine wise Report'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file41; ?>">Machine wise Report</a></li><?php } ?>
         <?php $rights=get_permission($usertype,'Customer wise Report'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file145; ?>">Customer wise Report</a></li><?php } ?>
          <?php $rights=get_permission($usertype,'Date wise Report'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file146; ?>">Date wise Report</a></li><?php } ?>
        
	</ul>
 </li><?php } ?>
  <!--******************************** Production ***************************************-->
  <?php $rights=get_permission($usertype,'7'); if($rights=='1'){?><li  class="bg"><img src="img/master.png" /></li>
	<li><a href="#" style=" padding-right: 25px;">Fusing</a>
    <ul class="submenubg">
			<?php $rights=get_permission($usertype,'Fusing Production Entry'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file19; ?>">Fusing Production Entry</a></li><?php } ?>
			<?php $rights=get_permission($usertype,'Job No wise Report'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file42; ?>">Job No wise Report</a></li><?php } ?>
          <?php $rights=get_permission($usertype,'Operator wise Report'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file43; ?>">Operator wise Report</a></li><?php } ?>
           <?php $rights=get_permission($usertype,'Machine wise Report'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file44; ?>">Machine wise Report</a></li><?php } ?>
           <?php $rights=get_permission($usertype,'Customer wise Report'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file147; ?>">Customer wise Report</a></li><?php } ?>
           <?php $rights=get_permission($usertype,'Date wise Report'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file148; ?>">Date wise Report</a></li><?php } ?>
	</ul>
 </li><?php } ?>
 <!--******************************** Production ***************************************-->
   <?php $rights=get_permission($usertype,'8'); if($rights=='1'){?><li  class="bg"><img src="img/master.png" /></li>
	<li><a href="#" style=" padding-right: 25px;">Accounts</a>
      <ul class="submenubg">
      
       <?php $rights=get_permission($usertype,'Deleted Jobcard'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file350; ?>">Deleted Jobcard</a></li><?php } ?>
      
       <?php $rights=get_permission($usertype,'Deleted Billing'); if($rights=='1'){?> <li><a href="main_fram.php?file=<?php  echo $file351; ?>">Deleted Billing</a></li><?php } ?>
       
           <?php $rights=get_permission($usertype,'Pending JobCard'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file163; ?>">Pending JobCard</a></li><?php } ?>
           
		   <?php $rights=get_permission($usertype,'Unbilling List'); if($rights=='1'){?><li><a href="main_fram.php?file=<?php  echo $file30; ?>">Unbilling List</a></li><?php } ?>
          
			<?php $rights=get_permission($usertype,'Billing List'); if($rights=='1'){?> <li><a href="main_fram.php?file=<?php  echo $file29; ?>">Billing List</a></li><?php } ?>
            
            
            <?php $rights=get_permission($usertype,'Porforma Billing List'); if($rights=='1'){?> <li><a href="main_fram.php?file=<?php  echo $file352; ?>">Porforma List</a></li><?php } ?>
            
            
             <?php $rights=get_permission($usertype,'Pay Slip'); if($rights=='1'){?> <li><a href="main_fram.php?file=<?php  echo $file52; ?>">Pay Slip</a></li><?php } ?>
               
            <?php if($username==='accounts'){?> <li><a href="javascript:new_db_backup('backup/backup.php')">DB Backup</a><?php } ?>
	</ul>
 </li><?php } ?>
<!--******************************** Logout ***************************************-->

	<li><a href="main_fram.php?file=<?php  echo $file1;  ?>" style="padding-top:1px;" ><img src="img/logout.png" /></a></li>
    <li><a href="main_fram.php?file=<?php  echo $file1; ?>" style=" padding-right: 10px;">Logout</a></li>
   
<div align="right" style=" color:#FFFFFF; font-size:13px; font-family: 'Open Sans', sans-serif; padding-top: 9px;">Welcome, <?php echo ucfirst($_SESSION['login_user_name']);?></div><?php }
else
{
 // session_destroy();
 // $_SESSION['timeout']=time();
	echo "<script>alert('Session Invalid!!!');</script>";
	echo "<script>window.location.href='index.php'</script>";
}
?>
</ul>
</ul>