<?php 
if($_REQUEST['action']=='del')
{
	$condition1="parant_id='".$_REQUEST['id']."'";
	$s->DeleteRecord('dbl_sale_return_details',  $condition1);
	$condition2="id='".$_REQUEST['id']."'";
	$s->DeleteRecord('dbl_sale_return',  $condition2);
	$s->pageLocation('index.php?route=DealerDistrbutions/Transaction/sales_return_index&modid='.$_REQUEST['modid'].'&frmid='.$_REQUEST['frmid'].'');
}
?>

<link rel="stylesheet" href="css/new_mxerp.css">
<div class="body_contain">
<div class="tab_div">
<h1>Sale Return</h1>
<p align="left">
<a href="index.php?route=DealerDistrbutions/Transaction/Sales_return_form&frmid=<?php echo $_REQUEST['frmid']; ?>&modid=<?php echo $_REQUEST['modid']; ?>"><input type="button" value="Sale Return Form Add" class="search"></a>
</p>
<table width="100%" border="1" cellpadding="3" cellspacing="0">
<tr class="row1">
    <td class="tabledata">Sr No.</td>
	<td class="tabledata">Form No.</td>
	<td class="tabledata">Form date</td>
	<td class="tabledata">Customer Name</td>
	<td class="tabledata">Against Pick List</td>
	<td class="tabledata">Pick List date</td>
	<td class="tabledata">Mistake Type</td>
	<td class="tabledata">Responsible.</td>
	<td class="tabledata">Action</td>
</tr>
<?php
$i=0;
$sqlGet=DB_query("SELECT * FROM dbl_sale_return where company_id='".$_SESSION['ACGCompanyId']."'",$db);
if(DB_num_rows($sqlGet)>0){
while($GetRec=DB_fetch_array($sqlGet)){ extract($GetRec);
$SO_VIEW="index.php?route=DealerDistrbutions/Transaction/sale_return_view&action=View&SID=".$GetRec['id'].$rurl;


?>
<tr class="row1">
    <td><?php echo $i+1; ?></td>
	<td><?php echo $form_no; ?></td>
	<td><?php echo ConvertSQLDate($form_date); ?></td>
	<td><?php echo $s->GetFieldValue('clientmaster',"id='".$customer."'",'c_name'); ?></td>
	<td><?php echo $s->GetFieldValue('dbl_dealer_dispatch',"id='".$pln."'",'pick_list_no'); ?></td>
	<td><?php echo ConvertSQLDate($pln_date); ?></td>
	<td><?php echo $mistake_type; ?></td>
	<td><?php echo $responsible; ?></td>
	<td> <a href="<?php echo $SO_VIEW?>"><img src="images/search.gif" width="10px"  height="10" /></a>&nbsp;	
	<a href="index.php?route=DealerDistrbutions/Transaction/sales_return_index&action=del&id=<?php echo $id; ?>&frmid=<?php echo $_REQUEST['frmid']; ?>&modid=<?php echo $_REQUEST['modid']; ?>"><img src="images/Icon_Delete3.gif" width="10" height="10" /></a></td>
</tr>
<?php $i++;}}else{ ?>
<tr class="row1">
	<td colspan="8" class="tabledata1" style="color:#FF0000;">No Record Found</td>
</tr>
<?php } ?>
</table>
</div>
</div>
