<?php

$k=0;
$viewQry="SELECT * FROM indentpr_mapping where  CompanyId='".$_SESSION['ACGCompanyId']."' and id='".$_REQUEST['mapid']."'";
$PendingIndent=DB_query($viewQry,$db);
?>
<br/>
<table width="100%" border="1" cellpadding="3" cellspacing="0" style="border:1px solid #333333;">
<tr bgcolor="#d4d4d4">
	<td class="tabledata">Sr.No.</td>
	<td class="tabledata">Mapping No.</td>
	<td class="tabledata">Mapping Date</td>
	<td class="tabledata">Vendor</td>
	<td class="tabledata">Against Requisitions</td>
        <td class="tabledata">Requisitions Date</td>
        <td class="tabledata">Items</td>
        <td class="tabledata">Qty.</td>
        <td class="tabledata">Type</td>
	</tr>
<?php  
if(DB_num_rows($PendingIndent)>0){
while($GetPendIndent=DB_fetch_array($PendingIndent)){
    
    ?>
<tr>
	<td><?php echo ($k+1).'.'; ?></td>
	<td><?php echo $GetPendIndent['mapNo']; ?></td>
	<td><?php echo ConvertSQLDate($GetPendIndent['createdDate']); ?></td>
	<td><?php 
        if($_SESSION['vendorid']=='0' || $_SESSION['vendorid']==''){
        $vendorArray=explode(',', $GetPendIndent['mapped_vendor']);
       foreach($vendorArray as $vendorID)
       {
          echo $s->GetFieldValue('suppliers',"id='".$vendorID."'",'vendor_name').'<br/>'; 
        } } else {  echo $s->GetFieldValue('suppliers',"id='".$_SESSION['vendorid']."'",'vendor_name');} ?></td>
	<td><?php 
        $ReqArray=explode(',', $GetPendIndent['indentPrno']);
       foreach($ReqArray as $reqID)
       {
          echo $s->GetFieldValue('materialrequisitions',"requisitionno='".$reqID."'",'Reqno').'<br/>'; 
       }
       ?></td>
        <td><?php 
        $ReqArray=explode(',', $GetPendIndent['indentPrno']);
       foreach($ReqArray as $reqID)
       {
          $reqDate=$s->GetFieldValue('materialrequisitions',"requisitionno='".$reqID."'",'prdate');
           echo ConvertSQLDate($reqDate).'<br/>';
       }
       ?></td>
        <td><?php 
        $itemArray=explode(',', $GetPendIndent['ItemID']);
       foreach($itemArray as $itemids)
       {
          echo $s->GetFieldValue('item_master',"id='".$itemids."'",'item_name').'<br/>'; 
       }
       ?></td>
        <td><?php 
        $qtyArray=explode(',', $GetPendIndent['mappedQty']);
        foreach($qtyArray as $quantity)
            {
               echo $quantity.'<br/>'; 
            }
       ?></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>
    <td colspan="9" style="color:red;">No Record Found !!</td>
</tr>
<?php } ?>
</table>