<table width="100%" border="1" cellspacing="0" cellpadding="0">
   <tr class="row1">
   <td class="tabledata">PO  </td>
   <td class="tabledata">PickList  </td>
   <td class="tabledata" >SOI Date</td> 
   <td class="tabledata" >SOI No</td>
   <td class="tabledata"> Customer</td> 
    <td class="tabledata">Enquiry Type</td>
   <td class="tabledata" >PO No.</td>
   <td class="tabledata" >PO Date.</td>
   <td class="tabledata"> Enquiry No</td>
   <td class="tabledata">Type</td>
   <td colspan="2" class="tabledata"><center>Action Taken</center></td>
    <td class="tabledata">Po  Status</td>
   </tr>
   <?php 
      // LIMIT $startpoint,$perpage
   if(isset($_SESSION['dealerid']))
	{
   $GetRecord = "Select * from dbl_process_sale_order where dealer='".$_SESSION['dealerid']."' order by id DESC";
   }
   else
   {
    $GetRecord = "Select * from dbl_process_sale_order  where company='".$_SESSION['ACGCompanyId']."' order by id DESC";
   }
   $ResultData = DB_query($GetRecord,$db);
   $i=1;
   if(DB_num_rows($ResultData)==0)
   echo "<td colspan='9'>--No Record--</td>";   
   while($RowData = DB_fetch_array($ResultData))
   {
   if($RowData['type']=='Enquiry')
   $order="Through Enquiry";
   else 
   $order="Direct Order";
   
     if($RowData['PoStatus']==0) {
     $postatus="Pending"; }
	 else{$postatus= "PO Generated"; }
	 if($postatus=='PO Generated')
	 $disable='disabled';
	 else
	 $disable='';
	 if($RowData['status']==1)
	 $disable1='disabled';
	 else 
	 $disable1='';
$EditDeleteAction=$s->GetFieldValue('dbl_dealer_dispatch',"SOI_no='".$RowData['id']."'",'id');
if($EditDeleteAction=='')	
{
$editdeletestatus='';
}
else
{
$editdeletestatus='Partial Invoice Generated';
} 
?>
 <tr class="row1"> <td ><div align="center"><input type="checkbox"    name="enquiry_id[]" <?php echo $disable; ?> id="enquiry_id_<?php echo $i; ?>" value="<?php echo $RowData['id'];?>" />
 <input type="hidden" name="type[]" id="type1_<?php echo $i; ?>" value="<?php echo $RowData['order_type']; ?>" />
 </div>
 </td>
 <td><div align="center"><input type="checkbox"    name="enquiry_id1[]" <?php echo $disable1; ?> id="enquiry_id1_<?php echo $i; ?>" value="<?php echo $RowData['id'];?>" onclick="return checkenqueryno();" />
 <input type="hidden" name="cust_type[]" id="cust_type_<?php echo $i; ?>" value="<?php echo $RowData['customer']; ?>" />
 <input type="hidden" name="ordertype[]" id="ordertype_<?php echo $i; ?>" value="<?php echo $RowData['order_type']; ?>" />
 </div></td>
 <td><?php echo ConvertSQLDate($RowData['SOI_date']);  ?></td>
 <td><?php echo $RowData['SOI_no']; ?> </td>
 <td><?php echo $Companyname= $s->getField('clientmaster','id',$RowData['customer'],'c_name');  ?></td>
  <td><?php echo ucwords($RowData['order_type']);  ?></td>
 <td><?php echo $RowData['po_no'];  ?></td>
<td><?php echo ConvertSQLDate($RowData['po_date']);?></td>

<td><?php echo $Companyname= $s->getField('dbl_enquiry_form','id',$RowData['enquiry_no'],'form_no'); ?></td>
<td><?php echo $order; ?>
<td width="19%"><?php if($RowData['status']==0) { ?>
<a href="index.php?route=DealerDistrbutions/Transaction/process_order_creations&modid=<?php echo $_REQUEST['modid']; ?>&frmid=<?php echo $_REQUEST['frmid']; ?>&action=Add&id=<?php echo $RowData['id']; ?>&excise=With Invoice">
<input type="button" value="With INV"  class="search"/></a>&nbsp;&nbsp;<a href="index.php?route=DealerDistrbutions/Transaction/process_order_creations&modid=<?php echo $_REQUEST['modid']; ?>&frmid=<?php echo $_REQUEST['frmid']; ?>&action=Add&id=<?php echo $RowData['id']; ?>&excise=Without Invoice"><input type="button" value="Without INV"  class="search"/></a><?php } else { echo "No Permission"; } ?></td>
<td width="5%"><?php if($RowData['status']==0 && $editdeletestatus=='' ) { ?>
<a href="<?php echo $targetpage?>&amp;action=Edit&amp;id=<?php echo $RowData['id']; ?>"><img src="images/icon-edit.png"  width="10" height="10"/></a>&nbsp;&nbsp;<a href="<?php echo $targetpage1?>&amp;action=Delete&amp;id=<?php echo $RowData['id']; ?>"><img src="images/delete1.gif"  width="10" height="10"/></a>
<?php } else { echo "No Permisssion"; } ?></td>
 <td><?php if($RowData['PoStatus']==0) { echo "Pending"; } else { echo "PO Generated"; } ?></td>
</tr>
 
	<?php $i++;}   
   ?> 
	
   </table>
<script language="javascript" >
function checkenqueryno()
{	
	var chk = document.getElementsByName('enquiry_id1[]');
	var len = chk.length;
	var cout=0;
	var arr1=new Array();
	var arr4=new Array();
	var arr2;
	var arr5;
	for(var i=0;i<=len;i++)
	{
		if(chk[i].checked==true)
		{
			var n=chk[i].id;
			var t1=n.split("_");
			k=t1[2];
			var s=document.getElementById("cust_type_"+k).value;
			var s1=document.getElementById("ordertype_"+k).value;
			arr2=arr1.push(s);
			arr5=arr4.push(s1);
			var arr3=arr1.length;
			for(var z=0;z<arr3;z++)
			{
				if(s!=arr1[z])
				{
					alert("Please Check Same Type Of Customer At a Time");
					document.getElementById("enquiry_id1_"+k).checked=false;
				}
				if(s1!=arr4[z])
				{
					alert("Please Select Same Type Of Enquiry Type At a Time");
					document.getElementById("enquiry_id1_"+k).checked=false;
				}
			
				
			}
		}
	
	}
}





</script>
  