<?php session_start();  //Developed by ITechScripts
?>
<style type="text/css">
<!--
.style1 {
	color: #666666;
	font-weight: bold;
}
.style3 {color: #666666; font-size: 11px; font-family:Arial, Helvetica, sans-serif}
-->
</style>
>
<?php
require 'include/configurations.php'; // ITECHBIDS Configuration File
require 'include/header.php';
?>
<?
require 'wsearch.php';
?>
<?
$mode=$_GET['mode'];
$type=$_GET['type'];
$wtype=$_GET['wtype'];
$wid=$_GET['wid'];
if($mode=="change"){
if($type==1){
$sql="update withdraw_requests set status='$wtype' where auto=$wid";
$res=mysql_query($sql);
}
if($type==2){
$sql="update withdraw_requests set suspend='$wtype' where auto=$wid";
$res=mysql_query($sql);
}
}

$cboType=$_POST['cboType'];
$makesearch=$_POST['makesearch'];
$array1=array($_POST['cboAyear'],$_POST['cboAmonth'],$_POST['cboAday']);
$array2=array($_POST['cboByear'],$_POST['cboBmonth'],$_POST['cboBday']);
$adate=implode('-',$array1);
$bdate=implode('-',$array2);

if($makesearch != "yes"){
 $pay_sql="select * from withdraw_requests order by auto desc limit 10";
 $pay_res=mysql_query($pay_sql);
 $pay_total_records=mysql_num_rows($pay_res);
}
if($makesearch == "yes"){
 $pay_sql="select * from withdraw_requests where r_date >=$adate and r_date <= $bdate and status=$cboType order by auto desc";
 $pay_res=mysql_query($pay_sql);
 $pay_total_records=mysql_num_rows($pay_res);
}
?>
<br />

<table cellpadding="0" cellspacing="0" width=100%>
<tr class="ct">
<td align="left" height="30">

<?
if($makesearch == "yes"){
?>
<b>&nbsp;&nbsp;Viewing Withdraw Search Result(s) : &nbsp;&nbsp;</b>(<?= $pay_total_records; ?>&nbsp; Records)</b>
<?
}
?>
<?
if($makesearch != "yes"){
?>
<b>&nbsp;&nbsp;Viewing Last 10 Withdraw Request</b>
<?
}
?>
</td>
</tr></table>
<BR>
<table cellspacing="0" cellpadding="0" class="ft" width=100%>
<tr>
<td class="ct"> &nbsp;
</td>
<td class="ct"><b>No.</b> </td>
<td class="ct"><b>Withdraw Ammount</b> </td>
<td class="ct" >Method</td>
<td  class="ct"><b>Date</b> </td>
<td  class="ct" colspan="2"><b>Change Status</b>  </td>
</tr>
<?
$coun = 1;
$pay_res=mysql_query($pay_sql);
while($pay_row=mysql_fetch_array($pay_res))
{
$wauto=$pay_row['auto'];
$wamount=$pay_row['amount'];
$wmethod=$pay_row[method];
$r_date=$pay_row['r_date'];
$status=$pay_row['status'];
$suspend=$pay_row['suspend'];
$gate_select_query="select * from withdraw_gateway where gateway_id='$wmethod'";
$gate_select_result=mysql_query($gate_select_query);
$gate_select_row=mysql_fetch_array($gate_select_result);
$wwmethod=$gate_select_row['payment_gateway'];


if($suspend=="yes")
{
$s_status = "Activate";
$sustatus="yes";
}
if($suspend=="no")
{
$s_status = "Suspend";
$sustatus="no";
}

if($status=="pending")
{
$wstatus = "Complete";
$ustatus="completed";
}
if($status=="completed")
{
$wstatus = "Pending";
$ustatus="pending";
}


?>
<tr>
<td > &nbsp;
</td>
<td ><? echo "$coun" ?></td>
<td><?  echo $wamount ?> </td>
<td><?  echo $wwmethod ?> </td>
<td><?  echo $r_date ?> </td>
<td> <?  echo $status ?> <a href=withdrawls.php?mode=change&type=1&wtype=<? echo "$ustatus" ?>&wid=<? echo "$wauto" ?>>(Change)</a></td>
<td> <?  echo $s_status ?> <a href=withdrawls.php?mode=change&type=2&wtype=<? echo "$sustatus" ?>&wid=<? echo "$wauto" ?>>(Change)</a></td>

</tr>
<?
$coun++;
} // while
?>

</table>
<br /><br />
<?
	require 'include/footer.php';
?>