   
    <link rel="stylesheet" href="css/new_mxerp.css">
    <div class="body_contain">
    <div class="tab_div">
    <h1>Purchase Approval</h1>
    <div class="new_tab">
    	<!--Inside tab-->
    	<div class="inside_tab">
    	<ul>
          <?php  //echo "SELECT M.id AS mainID,M.no_of_assignee,C.approval_name,C.id AS childID,C.approval_by FROM conf_purch_approval AS M INNER JOIN conf_purch_app_details AS C ON M.id=C.parent_id WHERE M.company_id='".$_SESSION['ACGCompanyId']."' ORDER BY C.sr_no";


          $purchase_approval=DB_query("SELECT M.id AS mainID,M.no_of_assignee,C.approval_name,C.id AS childID,C.approval_by FROM conf_purch_approval AS M INNER JOIN conf_purch_app_details AS C ON M.id=C.purch_approval_id WHERE M.company_id='".$_SESSION['ACGCompanyId']."' AND M.doc_type='PR' ORDER BY C.seq_no",$db);
          
          $i=0;
          if(DB_num_rows($purchase_approval)>0){
          while($purchase_result=DB_fetch_array($purchase_approval)){
            $Headlist=explode(",",$purchase_result['approval_by']);
            
            if($_SESSION['UserType']=='SuperAdmin')
             {
             $flag=0;   
            }
            else
            {
             $flag=1;
            }
            if(in_array($_SESSION['UserID'],$Headlist) || $flag==0 )
            {
            //print_r($Headlist);
            ?>
    	<li><a href="index.php?route=POModule/pr_approval&modid=<?php echo $_REQUEST['modid'];?>&frmid=<?php echo $_REQUEST['frmid'];?>&tab=<?php echo $i;?>&type=POModule/pr_head_approval&id=<?php echo $purchase_result['childID'];?>"><?php echo $purchase_result['approval_name']?></a></li>
            <?php $i++;}
          }
         }?>
    	</ul>
    	</div>
    	<!--End of Inside tab-->
    </div>
    <!--<div style="height:3px;"></div>-->
    <div style="width:100%;">    			

    	<?php  
            if($_REQUEST['tab']!='')
    	   {
    	       include("pr_head_approval.php");
    	   }
    //        
    //	if($_REQUEST['tab']=='')
    //	{
    //	include("pend_issued_index.php");
    //	}
    	?>
    </div>
    <?php if(isset($_SESSION['success_msg']))
    { ?>
    	<script> alert("<?php echo ($_SESSION['success_msg']);?>");</script>
    <?php 
    }	unset($_SESSION['success_msg']);
    ?>
    </div>
    </div>