<?
ob_start();session_start();

		if($_SESSION['lang']=='')
		{
			$_SESSION['lang'] = "en";
		}
		include 'languages/lang_common_'.$_SESSION['lang'].'.php';
		include 'languages/lang_won_auctions_'.$_SESSION['lang'].'.php';

		include("include/db.inc.php");
		include("include/bit_functions.inc.php");
	    include("include/pager.php");
		include("include/banner_inc.php");
 		$db1=new db;
  		$db1->open();
		mysql_query("SET NAMES 'utf8'");
		 $currency_symbol_new=symbol_currency();
		check_login();
 		if($_GET[uid]){
		$uid=$_GET[uid];
		}
		else{
    	$uid=$_SESSION['uid'];
		}


		if(isset($_POST['delete']) && is_array($_POST['chkbx']))
		{
		foreach($_POST['chkbx'] as $delid)
			{
			$upd="update t123go_product_sold set del_by_winer='1' where pid='$delid' and uid='$uid'";
			$sql=mysql_query($upd);

			}

		}


?>
 <!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>
<base href="<?=_BASEURL_?>/" />
<meta content="<?=_TITLE1_?> offers bargain auctions of new brand products. Save up to 70% for every product almost. Bid and Win high quality products.<?=_TITLE1_?> offers amazing bargains." />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<meta name="author" content="Info-Tech Ltd. | We simplify web 2.0"/>
<title><?=_PAGE_TITLE_;?></title>
<link href="<?=_BASEURLCSSNEW_?>/index.css" rel="stylesheet" type="text/css" />
<link href="<?=_BASEURLCSSNEW_?>/index_sec.css" rel="stylesheet" type="text/css" />
<link href="<?=_BASEURLCSSNEW_?>/personal_acc.css" rel="stylesheet" type="text/css" />
<link href="<?=_BASEURLCSSNEW_?>/won.css" rel="stylesheet" type="text/css" />
<!--[if lte IE 6]><style type="text/css" media="screen">/* <![CDATA[ */ @import url(<?=_BASEURLCSSNEW_?>/ie6.css?0:102290); /* ]]> */</style><![endif]-->
<!--[if gte IE 7]><style type="text/css" media="screen">/* <![CDATA[ */ @import url(<?=_BASEURLCSSNEW_?>/ie7.css?0:99961); /* ]]> */</style><![endif]-->
<script type="text/javascript">
function show_total_saving(total_saving)
{
document.getElementById('total_saving_payment').innerHTML=total_saving;
}
</script>
</head>
<body >

<div id="container">
  <? include("header.php");?>

  <div id="accountleft_bar">
    <? include("view.php");?>
  </div>
 	
  <?
		        $sql="select id,pid,sold_price,date_format(sold_date,'%b , %e %Y')as sold_date from t123go_product_sold where uid='".$uid."' and del_by_winer='0' group by pid ORDER BY pid";
				$rwd=mysql_query(dopaging($sql,4));
				if(mysql_num_rows($rwd)){
		   ?>
     <div id="accountright_bar">
   <div id="won_auc">
      <div class="buygreen1" >
        <div class="buygreen2"><div><?=_YOUR_WON_AUCTIONS_?>&nbsp;&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;&nbsp;  
        Total Savings Year:&nbsp;<?=$currency_symbol_new?>&nbsp;<span id="total_saving_payment"></span></div></div>
        <div class="buygreen3"></div>
      </div>
      <div class="allm100px">
    

				   

     
     <div class="allp5px">
       


  
     <form action="" method="post" name="won_auction">
        <table border="0" cellspacing="0" cellpadding="0" width="100%" align="center">
          <tr>
           <?  	   $i=0;
		  $show_total=0;								
	while($myuser=mysql_fetch_array($rwd)){
	$myprod=mysql_fetch_array(mysql_query("SELECT * FROM t123go_product where pid='".$myuser['pid']."' "));
	
	if($i%4==0 && $i!=0)
	echo"</tr><tr>";
		  ?>
            <td valign="top" align="left">
			<div id="top_n_auction">
			 <div class="normaltextorangebold19ca tm10px"><a href="<?=get_cat_name($myprod['cid']);?>/<?=str_replace(" ","-",$myprod['pname']);?>/auction/<?=$myprod['pid']?>/" class="product_title" title="<?=$myprod['pname'];?>">
                  <?=substr($myprod['pname'],0,20);?>
                  </a></div>
<div class="imagex"><div class="won"><? if($myprod['type1']=='1'){?>
                 
               <div class="fixed_price1"></div>
			  <? }else if($myprod['type1']=='2'){?>
			 <div class="penny_prd1"></div>
			  <? }else if($myprod['type1']=='3'){?>
			  <div class="s100_off1"></div>
             
			  <? }?> </div><a href="<?=get_cat_name($myprod['cid']);?>/<?=str_replace(" ","-",$myprod['pname']);?>/auction/<?=$myprod['pid']?>/"  target="_parent">
                  <?=image_130($myprod['pid']); ?>
                  </a></div>
				  <div class="normaltextorangebold13 tac" id="winner_index_page_<?=$myprod['pid']?>">
                  <?=get_fieldval(id,uname,user,$myprod['bider_id'])?>
                </div>
<div class="pricex" >
 <div><div class="sfl normaltextnotbold133">Actual Price:</div><div class="sfr normaltextgreenbold13 tar"><?=$currency_symbol_new?>&nbsp;<?=$myprod['price']?></div></div>
                <? if($myprod['type1']=='1'){?>
				<div><div class="sfl normaltextnotbold133">Fixed Price:</div><div class="sfr normaltextblackbold13 tar"><?=$currency_symbol_new?>&nbsp;<?=$myprod['fixed_price']?></div></div>
				<? }?>
                
	
                <div class="clb"><div class="sfl normaltextnotbold133">Your Won Price:</div><div class="sfr normaltextblackbold13 tar" style="color:#F6851F"><?=$currency_symbol_new?>&nbsp;<?=$myprod['bid_price']?></div></div>
				<?
				 $mybid=mysql_num_rows(mysql_query("select id from t123go_bid where uid='".$uid."' and pid=".$myprod['pid']));
				  $package_query=mysql_query("select * from t123go_bidpackage b inner join t123go_memberpack m 
			     where b.pkgid=m.package_id and m.payment='c' and uid='".$uid."'");
				 if(mysql_num_rows($package_query) > 0){
				 $my_total=mysql_fetch_array(mysql_query("select count(id),sum(total_price/total_bid) from t123go_bidpackage b inner join t123go_memberpack m 
			     where b.pkgid=m.package_id and m.payment='c' and uid='".$uid."'"));
		         $total_price = $my_total['sum(total_price/total_bid)']/$my_total['count(id)'];
				 }else{
				 $total_price = '0';
				 }
				 $total_bid_price=round($mybid *  $total_price,2);
				
				?>
                <div class="clb"><div class="sfl normaltextnotbold133">Cost of Bids Placed:</div><div class="sfr normaltextblackbold13 tar" >
				<?=$currency_symbol_new?>&nbsp;<?=$total_bid_price?>
				</div></div>
                <div class="clb"><div class="sfl normaltextnotbold133">Total Spent:</div><div class="sfr normaltextblackbold13 tar">
				
				<? if($myprod['type1']=='1'){
				$total_spent = $myprod['fixed_price'] + $total_bid_price;
				 $total_spent;
				 }else if($myprod['type1']=='2'){
				 $total_spent = $myprod['bid_price'] + $total_bid_price;
				 $total_spent; 
				 }else if($myprod['type1']=='3'){
				 $total_spent = $total_bid_price;
				  $total_spent;
				 }
				 echo $currency_symbol_new."&nbsp;".$total_spent;
				 
				 ?></div>
                </div></div>
                <div class="noting">
				  <div class=" allp5px">
				  <div class="clb"><div class="sfl normaltextsmallblack" style="color:#F6851F">Savings Made:</div><div class="sfr normaltextgreenbold13 tar" >
				
				<? 
				
				$saving_made=$myprod['price'] - $total_spent;
				
				echo $currency_symbol_new."&nbsp;".round($saving_made,2);
				?>
				
				</div></div>
				<div class="clb"><div class="sfl normaltextsmallblack" style="color:#F6851F">Saving %:</div><div class="sfr normaltextgreenbold13 tar" style="color:#F6851F">
				<?
				
				$saving= ($saving_made / $myprod['price']) * 100;
				echo floor($saving);
				?>
				%</div></div>
				  </div>
                  </div>
				  <div class="clb allp5px"><div class="sfl normaltextsmallblack">Price to be Paid:</div><div class="sfr normaltextredbold13_profile tar">
				
				<? if($myprod['type1']=='1'){
				  echo $currency_symbol_new."&nbsp;".$myprod['fixed_price'];
				 }else if($myprod['type1']=='2'){
				echo $currency_symbol_new."&nbsp;".$myprod['bid_price'];
			  }else if($myprod['type1']=='3'){
			 	echo $currency_symbol_new."&nbsp;"."0.00";
             
			  }?> </div></div>
				  
				<div class="clb normaltextsmall tal lm5px"><input type="checkbox" name="chkbx[]" value="<?=$myprod[pid]?>"/> Check this to remove.</div>

</div>
			</td>
            <?
			$show_total=$show_total + $saving_made;
				$i++;
			}	// end of while loop
		

				?>
                 </tr>
          <tr>
            <td colspan="4"><div id="if_s"><div class="tac sfl lm40px">
				<? if(rightpaging()){

 echo rightpaging(); 
			}
			?></div></div>
			<div  class="normaltextblackbold11 sfr"><?=_DELETE_SELECTED_AUCTION_;?> &raquo;
	   <input type="submit" name="delete" value=" " class="inputsubmit_delete" onClick="return confirm('<?=_SURE_TO_DELETE_PRODUCT_;?>');"/></div>
			</td>
          </tr>
          
         
          
        </table>

  <script language="javascript">
	 
	 setTimeout("show_total_saving('<?=$show_total?>');",1000);
	 </script>


	   
      </form>
	           
 </div>

    <?	} else{
		echo "<div class='no_message_show'><h3>"._SORRY_NOT_WON_."</h3></div>";

			}
			 ?></div>
              <div class="tft1">
              <div class="tft2"></div>
              <div class="tft3"></div>
            </div> </div> 
            
          <div  class="w99">
          <h3 class="tac tm40px"><div class="tm40px tac"><br /><br /><br /><br /><br />Advertisment Sponsors</div></h3>

  <? 
  $page='innerpage';
  $query_num=mysql_query("select bid from zb_banners where `status`='1' and pagename='$page' order by rand() limit 0,4");
 while($brow=mysql_fetch_array($query_num))
  {
  ?>
<?=banner_home("innerpage","bottom",158,103,$brow['bid']);?>
<? }?>
</div>


     
            
            </div>
  <div style="clear:both">
    <? include("footer.php");?>

