<?php

$k=0;
$viewQry="SELECT * FROM indentpr_mapping where  CompanyId='".$_SESSION['ACGCompanyId']."' and id='".$_REQUEST['mapid']."'";
$PendingIndent=DB_query($viewQry,$db);
?>
<link rel="stylesheet" href="css/new_mxerp.css">
<div class="body_contain">
<div class="tab_div">
<h1><?php  echo  $page_title;?></h1>
<table width="100%" border="1" cellpadding="3" cellspacing="0" style="border:1px solid #808080; border-collapse:collapse;">
<tr>
	<th width="4%">S.No.</th>
	<th width="10%">Mapping No.</th>
	<th width="7%">Mapping Date</th>
	<th>Vendor</th>
	<th width="10%">Against Requisitions</th>
  <th width="7%">Requisitions Date</th>
  <th width="12%">Items</th>
  <th width="8%">Qty.</th>
  <th width="14%">Type</th>
	</tr>
<?php  
if(DB_num_rows($PendingIndent)>0){
while($GetPendIndent=DB_fetch_array($PendingIndent)){    
    ?>
<tr bgcolor="#fff">
	<td><?php echo ($k+1).'.'; ?></td>
	<td><?php echo $GetPendIndent['mapNo']; ?></td>
	<td><?php echo ConvertSQLDate($GetPendIndent['createdDate']); ?></td>
	<td style="padding:0;" valign="top">
  <div id="amc-tab">
  <table width="100%" border="0" cellspacing="0" cellpadding="3">
  <?php 
        if($_SESSION['vendorid']=='0' || $_SESSION['vendorid']==''){
        $vendorArray=explode(',', $GetPendIndent['mapped_vendor']);
       foreach($vendorArray as $vendorID)
       { ?>
<tr>
        <td><?php echo $s->GetFieldValue('suppliers',"id='".$vendorID."'",'vendor_name'); ?></td>
      </tr>
        <?php } } else { ?>
        <tr>
        <td><?php echo $s->GetFieldValue('suppliers',"id='".$_SESSION['vendorid']."'",'vendor_name'); ?></td>
        </tr>
        <?php } ?>
       </table>
       </div></td>
	<td style="padding:0;" valign="top">
  <div id="amc-tab">
  <table width="100%" border="0" cellspacing="0" cellpadding="3"><?php 
        $ReqArray=explode(',', $GetPendIndent['indentPrno']);
       foreach($ReqArray as $reqID)
       {?>
<tr>
        <td><?php echo $s->GetFieldValue('materialrequisitions',"requisitionno='".$reqID."'",'Reqno'); ?></td>
      </tr>
        <?php }
       ?></table>
       </div></td>
  <td style="padding:0;" valign="top">
  <div id="amc-tab">
  <table width="100%" border="0" cellspacing="0" cellpadding="3"><?php 
        $ReqArray=explode(',', $GetPendIndent['indentPrno']);
       foreach($ReqArray as $reqID)
       {?>
<tr>
        <td><?php
          $reqDate=$s->GetFieldValue('materialrequisitions',"requisitionno='".$reqID."'",'prdate');
           echo ConvertSQLDate($reqDate);?></td>
      </tr>
        <?php }
       ?></table>
       </div></td>
    <td style="padding:0;" valign="top">
  <div id="amc-tab">
  <table width="100%" border="0" cellspacing="0" cellpadding="3"><?php 
        $itemArray=explode(',', $GetPendIndent['ItemID']);
       foreach($itemArray as $itemids)
       {?>
<tr>
        <td><?php echo $s->GetFieldValue('item_master',"id='".$itemids."'",'item_name'); ?></td>
      </tr>
        <?php }
       ?></table>
       </div></td>
    <td style="padding:0;" valign="top">
  <div id="amc-tab">
  <table width="100%" border="0" cellspacing="0" cellpadding="3"><?php 
        $qtyArray=explode(',', $GetPendIndent['mappedQty']);
        foreach($qtyArray as $quantity)
            {?>
<tr>
        <td><?php echo $quantity; ?></td>
      </tr>
        <?php }
       ?></table>
       </div></td>
        <td><?php         
        if($GetPendIndent['flag']=='true'){
            echo 'Consolidated';
        }
 else {
     echo 'Individual';
 }
         ?></td>	
</tr>
<?php $k++;}?>
<input type="hidden" id="count" value="<?php echo $k; ?>" />
<?php } else { ?>
<tr bgcolor="#fff">
    <td colspan="9" style="color:red;">No Record Found !!</td>
</tr>
<?php } ?>
</table>

</div>
</div>