<?
ob_start();
session_start();
if($_SESSION['uname']=='' || $_SESSION['pwd']=='')
		{
			header("location:login.php");
		}
 include("../include/db.inc.php");
 include("../include/pager.php"); 
 include("../include/bit_functions.inc.php");
   $db1=new db;
   $db1->open();
    mysql_query("SET NAMES 'utf8'");
   if($_GET['soldid'])
   	{
		mysql_query("update t123go_product_sold set delivered='1' where id=".$_GET['soldid']);
	 header("location:order_auction.php");
		}
  
   if(isset($_GET['payclear']))
{
$payclear=$_GET['payclear'];

if($payclear==1)
$payclear=0;
else
$payclear=1;
$id=$_GET['id'];
$sql="update t123go_product_sold set payclear='$payclear' where id='$id'";
mysql_query($sql);
header("location:order_auction.php");
exit();
}
  
   if(isset($_GET['preorder']))
{
$preorder=$_GET['preorder'];

if($preorder==1)
$preorder=0;
else
$preorder=1;
$id=$_GET['id'];
$sql="update t123go_product_sold set preorder='$preorder' where id='$id'";
mysql_query($sql);
header("location:order_auction.php");
exit();
}
 if(isset($_GET['processing']))
{
$processing=$_GET['processing'];

if($processing==1)
$processing=0;
else
$processing=1;
$id=$_GET['id'];
$sql="update t123go_product_sold set processing='$processing' where id='$id'";
mysql_query($sql);

}if(isset($_GET['shipped']))
{
$shipped=$_GET['shipped'];

if($shipped==1)
$shipped=0;
else
$shipped=1;
$id=$_GET['id'];
$sql="update t123go_product_sold set shipped='$shipped' where id='$id'";
mysql_query($sql);

}if(isset($_GET['problem']))
{
$problem=$_GET['problem'];

if($problem==1)
$problem=0;
else
$problem=1;
$id=$_GET['id'];
$sql="update t123go_product_sold set problem='$problem' where id='$id'";
mysql_query($sql);

}if(isset($_GET['cancelled']))
{
$cancelled=$_GET['cancelled'];

if($cancelled==1)
$cancelled=0;
else
$cancelled=1;
$id=$_GET['id'];
$sql="update t123go_product_sold set cancelled='$cancelled' where id='$id'";
mysql_query($sql);
}  
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>NEWADMIN</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="../css/stylesheet.css" rel="stylesheet" type="text/css">
<script language="JavaScript" src="../js/common.js"></script>
<script language="JavaScript">
function views(pid){
			window.open('thumbnail.php?id='+pid,'','width=800,height=600,top=50,left=180');		
	}	
function veiwmem(id){
			window.open('view_user.php?id='+id,'','width=800,height=800,top=5,left=180');		
	}	
	
	function viewproduct(id){
		window.open('view_product.php?id='+id,'','scrollbars,width=920,height=700,top=5,left=180');		
	}
	function sendmail(id){
		window.open('invoice.php?id='+id,'','scrollbars,width=700,height=500,top=50,left=180');		
	}
	</script>
<style type="text/css">
<!--
.style1 {color: #093A9C}
.style2 {color: #FE6905}
-->
</style>
</head>
<body bgcolor="#ffffff">
<div class="admin_wrapper">
<div class="logo_show"><? include("minorlogout.php");?></div>
<div style="float:left; width:200px">
<div class="topg_links_show"><? include("left.php");?></div>
<div class="top_links_show"><? include("belowleft1.php");?></div></div>
<div style="float:left; width:800px"> 
<div class="maximum"> 
<!--::::::::::::::::::::::::::::::::::::::::::::::::::::::::::header starts:::::::::::::::::::::::::::::::::::::::::::::::::::::-->
<table  width="100%" border="0" cellpadding="0" cellspacing="0" class="bodytxt">
  <tr> 
    <td width="15" valign="top">&nbsp;</td>
          <td valign="top"><br> <table width="100%" border="0" cellpadding="0" cellspacing="0" class="bodytxt">
        <tr> 
          <td width="33" valign="top"><img src="img/03.gif" width="33" height="23"></td>
                <td background="img/bg01.gif"><strong>AUCTION ORDER LIST </strong></td>
          <td width="35"><img src="img/04.gif" width="35" height="23"></td>
        </tr>
      </table>
      <table width="100%" border="0" cellpadding="0" cellspacing="0" class="bodytxt">
        <tr>  
          <td width="22" height="185" valign="top" background="img/tbl-left04.gif">
          <img border='0' src="img/tbl-left04.gif" width="22" height="13"></td>  
          <td valign="top" align="center"> <br>		  		  		             
                   <form action="" method="post" enctype="multipart/form-data" name="form1"> 
                    <table width="100%" border="1" cellspacing="1" cellpadding="1" style="border-collapse:collapse;border-color:#FED267" >
                      <tr bgcolor="#FED267"> 
					   <td width="3%"  align="center"><strong><font color="#FFFFFF">S. No.</font></strong></td>
					   <td width="10%" ><strong><font color="#FFFFFF">Product Image</font></strong></td>
                        <td width="15%" ><strong><font color="#FFFFFF">Product Name</font></strong></td>
                       
                        <td width="15%" >&nbsp;&nbsp;<strong><font color="#FFFFFF">Username/Winner</font></strong></td>
                        <td width="8%" ><strong><font color="#FFFFFF">Sold Price</font></strong></td>
                        <td width="28%" ><strong><font color="#FFFFFF">Order details</font></strong></td>
		                <td width="18%" height="21" align="center"><font color="#FFFFFF"><strong>Delivered Status</strong></font></td>
                       <td width="18%" height="21" align="center"><font color="#FFFFFF"><strong>Send Invoice</strong></font></td>          
                      </tr>
					  <?
					  $i=1;
					  $sel_query=mysql_query(dopaging("select * from t123go_product_sold",10)) or die(mysql_error());
                      while($myrow=mysql_fetch_array($sel_query)){  ?>
                      <tr onMouseOver="this.style.backgroundColor='#FFECBF'" onMouseOut="this.style.backgroundColor='#ffffff'"> 
					  <td  align="center"><?= $i;?></td>
					   <td style="padding-left:5px;" ><a href="javascript:views('<?=$myrow['pid']?>')"<?=image_90($myrow['pid'])?></td>
                        <td style="padding-left:5px;"><a href="javascript:viewproduct('<?=$myrow['pid']?>')" class="link11">
						<?=get_fieldval(pid,pname,t123go_product,$myrow['pid']);?></td>
                      
                        <td >&nbsp;&nbsp;
						<a class="link5" style="font-size:12px;"   href="javascript:veiwmem(<?=$myrow['uid']?>)" title="Click To View User Information" >
						<?=get_fieldval(id,uname,user,$myrow['uid'])?></a></td>
                       <td style="padding-left:5px;"><?=$myrow['sold_price'];?></td>
                        <td   align="left">
						<?
						if($myrow['payclear']=='1')
						{
						?>
		<a href="order_auction.php?payclear=<?=$myrow['payclear'];?>&id=<?=$myrow['id']?>">
		<input  name="pay_clear[]" type="checkbox" style="margin-left:35px;" checked 
        onClick="window.location='order_auction.php?payclear=<?=$myrow['payclear'];?>&id=<?=$myrow['id']?>'" > </a>
		<span style="font-size:11px;">Payment Cleared</span><br/>
       					 <?
                            }
						else
						
						   {
						   ?>
					<a href="order_auction.php?payclear=<?=$myrow['payclear'];?>&id=<?=$myrow['id']?>">
        <input name="payclear[]" type="checkbox" style="margin-left:35px;"  
        onClick="window.location='order_auction.php?payclear=<?=$myrow['payclear'];?>&id=<?=$myrow['id']?>'" ></a>
		<span style="font-size:11px; ">Payment Cleared</span> <br/>
		                             <?
						   }
		
						if($myrow['preorder']=='1')
						{
						?>
		<a href="order_auction.php?preorder=<?=$myrow['preorder'];?>&id=<?=$myrow['id']?>">
		<input  name="preorder[]" type="checkbox" checked 
        onClick="window.location='order_auction.php?preorder=<?=$myrow['preorder'];?>&id=<?=$myrow['id']?>'" > </a>
		<span style="font-size:11px;">Preorder</span>
       		                 <?
                            }
						else
								   {
						   ?>
						   
		<a href="order_auction.php?preorder=<?=$myrow['preorder'];?>&id=<?=$myrow['id']?>">
        <input  name="preorder[]" type="checkbox" 
        onClick="window.location='order_auction.php?preorder=<?=$myrow['preorder'];?>&id=<?=$myrow['id']?>'" ></a>
		<span style="font-size:11px;margin-left:10px;">Preorder</span>
		                     <?
						   }	
					echo "<br />";
						if($myrow['processing']=='1')
						{
						?>
		<a href="order_auction.php?processing=<?=$myrow['processing'];?>&id=<?=$myrow['id']?>">
		<input  name="processing[]" type="checkbox" checked 
        onClick="window.location='order_auction.php?processing=<?=$myrow['processing'];?>&id=<?=$myrow['id']?>'" style="padding-left:20px;" > </a>
		<span style="font-size:11px;">Processing</span> 
                        <?
                            }
						else
						   {
						   ?>
		<a href="order_auction.php?processing=<?=$myrow['processing'];?>&id=<?=$myrow['id']?>">
        <input  name="processing[]" type="checkbox" 
        onClick="window.location='order_auction.php?processing=<?=$myrow['processing'];?>&id=<?=$myrow['id']?>'" ></a>
		<span style="font-size:11px;">Processing</span> <br/>
		                     <?
						   }	
						if($myrow['shipped']=='1')
						{
						?>
		<a href="order_auction.php?shipped=<?=$myrow['shipped'];?>&id=<?=$myrow['id']?>">
		<input  name="shipped[]" type="checkbox" checked 
        onClick="window.location='order_auction.php?shipped=<?=$myrow['shipped'];?>&id=<?=$myrow['id']?>'" ></a>
		<span style="font-size:11px;">Shipped </span>
                         <?
                            }
						else
						   {
						   ?>
		<a href="order_auction.php?shipped=<?=$myrow['shipped'];?>&id=<?=$myrow['id']?>">
        <input  name="shipped[]" type="checkbox" 
        onClick="window.location='order_auction.php?shipped=<?=$myrow['shipped'];?>&id=<?=$myrow['id']?>'" ></a>
		<span style="font-size:11px;margin-left:10px;">Shipped </span>
		                     <?
						   }	
					echo "<br />";
						if($myrow['problem']=='1')
						{
						?>
		<a href="order_auction.php?problem=<?=$myrow['problem'];?>&id=<?=$myrow['id']?>">
		<input  name="problem[]" type="checkbox" checked 
        onClick="window.location='order_auction.php?problem=<?=$myrow['problem'];?>&id=<?=$myrow['id']?>'" ></a>
		<span style="font-size:11px;">Problem</span> 
                         <?
                            }
						else
						   {
						   ?>
		<a href="order_auction.php?problem=<?=$myrow['problem'];?>&id=<?=$myrow['id']?>">
        <input  name="problem[]" type="checkbox" 
        onClick="window.location='order_auction.php?problem=<?=$myrow['problem'];?>&id=<?=$myrow['id']?>'" ></a>
		<span style="font-size:11px;margin-left:10px;">Problem</span> <br/>
		                     <?
						   }	
						if($myrow['cancelled']=='1')
						{
						?>
		<a href="order_auction.php?cancelled=<?=$myrow['cancelled'];?>&id=<?=$myrow['id']?>">
		<input  name="cancelled[]" type="checkbox" checked 
        onClick="window.location='order_auction.php?cancelled=<?=$myrow['cancelled'];?>&id=<?=$myrow['id']?>'" > </a>
		<span style="font-size:11px;">Cancelled </span>
                        <?
                            }
						else
						   {
						   ?>
		<a href="order_auction.php?cancelled=<?=$myrow['cancelled'];?>&id=<?=$myrow['id']?>">
        <input  name="cancelled[]" type="checkbox" 
        onClick="window.location='order_auction.php?cancelled=<?=$myrow['cancelled'];?>&id=<?=$myrow['id']?>'" ></a>
		<span style="font-size:11px;">Cancelled </span>
		                     <?
						   }	
						?>
						<? /*if($myrow['payment']=='1')
							echo "Confirm";
							else
							echo "Not Confirm";	*/	
						?></td>
                        <td >&nbsp;&nbsp;&nbsp;&nbsp;
						<?
						if($myrow['delivered']=='0' && $myrow['payment']=='0')
						echo "<a href='order_auction.php?soldid=".$myrow['id']."' onClick=\"return confirm('You want to delivered, even payment not confirm ? ')\">Not Delivered</a>";
						else if($myrow['delivered']=='0')
						echo "<a href='order_auction.php?soldid=".$myrow['id']."' onClick=\"return confirm('Payment have done. You want to delivered ? ')\">Not Delivered</a>";
						else
						echo "Delivered";
						?>
						</td>
                      <td><? echo '<a href="javascript:sendmail('.$myrow['pid'].')" class="link11">Send Invoice</a>'?></td>
                      </tr>
                      <? $i++;
									} if(rightpaging())?>
				<tr><td colspan=8 align=center><br><?=rightpaging()?></td></tr>
                    </table>
               </form>  
      </td>  
          <td width="19" valign="top" background="img/tbl-right04.gif"><img src="img/tbl-right04.gif" width="19" height="9"></td>
        </tr> 
      </table>
      <table width="100%" border="0" cellpadding="0" cellspacing="0" class="bodytxt">
              <tr> 
                <td width="33"><img src="img/tbl-bot01.gif" width="33" height="12"></td>
                <td  width="709" align="right" background="img/tbl-bg.gif"></td>
                <td width="33"><img src="img/tbl-right05.gif" width="35" height="12"></td>
              </tr>
            </table>
      </td>
  </tr>
  </table>
<!--::::::::::::::::::::::::::::::::::::::::::::::::::::::::::center ends:::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::footer starts:::::::::::::::::::::::::::::::::::::::::::::::::::::-->
</div></div>
  <div class="bottom_links_show"><? include("footer.php");	?></div>
<!--::::::::::::::::::::::::::::::::::::::::::::::::::::::::::footer ends:::::::::::::::::::::::::::::::::::::::::::::::::::::-->
</body>
</html>