<?  require 'include/options.php'; // ITECHBIDS Configuration File
   require 'include/calculate.php';
	$user_id=$_SESSION[userid];
    $reg_sql="select * from member_details where user_id=$_SESSION[userid]";
	$reg_res=mysql_query($reg_sql);
	$reg_row=mysql_fetch_array($reg_res);
	$member_account=$reg_row[member_account];
	
	// ------------------ bidding items  ----------------
$bid_sql="select * from site_bids a,auction_details b where a.user_id=$user_id and user_pos='No' and a.productid=b.productid and b.status='Active'";
$bid_res=mysql_query($bid_sql);
$bid_total_records=mysql_num_rows($bid_res);
// ------------------- Won items -------------------------
$won_sql="select * from site_bids a,auction_details b where a.user_id=$user_id and a.productid=b.productid and a.user_pos='Yes'";
$won_res=mysql_query($won_sql);
$won_total_records=mysql_num_rows($won_res);

$didntwin_sql="select * from site_bids a,auction_details b where a.user_id=$user_id and a.productid=b.productid and a.user_pos='No' and b.Quantity=0";
$didntwin_res=mysql_query($didntwin_sql);
$didntwin_total_records=mysql_num_rows($didntwin_res);


//------------------------ watching -----------------------------
$datecheck=date("Y-m-d H:i:s");
$watch_sql="select * from watch_list a, auction_details b where a.productid=b.productid and a.user_id=$user_id and (expire_date > '$datecheck') group by b.productid";
$watch=mysql_query($watch_sql);
$watch_total_records=mysql_num_rows($watch);

//------------------------ end of watching -----------------------------

// ------------------- Opened  Auction  -----------------------------------------

$postsql="select * from auction_details where user_id=$user_id and status='Active' and selling_method!='want_it_now'";
$sell=mysql_query($postsql);
$postrow=mysql_fetch_array($sell);
$posttotal_records=mysql_num_rows($sell);

// ------------------- end of Opened  Auction   -----------------------------------------


// ------------------- Closed  Auction  -----------------------------------------

$close_sql="select * from auction_details where user_id=$user_id and status='Closed' and selling_method!='want_it_now'";
$close_res=mysql_query($close_sql);
$close_row=mysql_fetch_array($close_res);
$close_total_records=mysql_num_rows($close_res);

// ------------------- end of Closed  Auction -----------------------------------------


// ------------------- Sold  Auction  -----------------------------------------

$sold_sql="select * from site_bids a,auction_details b where b.user_id=$user_id and a.productid=b.productid and quantity_sold > 0 and b.selling_method!='want_it_now' and user_pos='yes'";
$sold_res=mysql_query($sold_sql);
$sold_row=mysql_fetch_array($sold_res);
$sold_total_records=mysql_num_rows($sold_res);

// ------------------- end of Sold  Auction -----------------------------------------

// ------------------- Inbox Calculation  -----------------------------------------

$inbox_mail_sql="select * from askseller where to_id=$user_id and status!='delete' ";
$inbox_mail_res=mysql_query($inbox_mail_sql);
$inbox_mail_total_records=mysql_num_rows($inbox_mail_res);

// ------------------- End Of Inbox Calculation  -----------------------------------------

// ------------------- Inbox Calculation -----------------------------------------

$outbox_mail_sql="select * from askseller where from_id=$user_id and status='reply' ";
$outbox_mail_res=mysql_query($outbox_mail_sql);
$outbox_mail_total_records=mysql_num_rows($outbox_mail_res);

// ------------------- End Of Outbox Calculation -----------------------------------------


//-----------------------Total Due----------------------------------------------------
 $pay_sqlm="select * from auction_details where user_id=$user_id and status='new'";
 $pay_resm=mysql_query($pay_sqlm);
 $pay_total_recordsm=mysql_num_rows($pay_resm);

//-----------------------End of Total Due----------------------------------------------------

//-----------------------UnApproved----------------------------------------------------
 $unp_sqlm="select * from auction_details where user_id=$user_id and status='unapproved'";
 $unp_resm=mysql_query($unp_sqlm);
 $unp_total_recordsm=mysql_num_rows($unp_resm);

//-----------------------End of Total Due----------------------------------------------------


//----------------------------Transactions---------------------------------------------------

$pay_sql1="select * from usertransaction where user_id=$user_id and status='Pending' and type='credit' order by pay_id desc";
$pay_res1=mysql_query($pay_sql1);
$pay_p_c=mysql_num_rows($pay_res1);

$pay_sql2="select * from usertransaction where user_id=$user_id and status='Pending' and type='debit' order by pay_id desc";
$pay_res2=mysql_query($pay_sql2);
$pay_p_d=mysql_num_rows($pay_res2);

$pay_sql3="select * from usertransaction where user_id=$user_id and status='Queued' and type='debit' order by pay_id desc";
$pay_res3=mysql_query($pay_sql3);
$pay_q_d=mysql_num_rows($pay_res3);

$pay_sql4="select * from usertransaction where user_id=$user_id and status='Queued' and type='credit' order by pay_id desc";
$pay_res4=mysql_query($pay_sql4);
$pay_q_c=mysql_num_rows($pay_res4);


$pay_sql5="select * from usertransaction where user_id=$user_id and status='Complete' order by pay_id desc";
$pay_res5=mysql_query($pay_sql5);
$pay_com5=mysql_num_rows($pay_res5);


//--------------------------End of transactions-----------------------------------------------

$mem_plan=member_tp($user_id);
$shprofile=site_plans($mem_plan, aboutme);
if($shprofile!='yes')
{
$sprofile="no";
}
else
{
$sprofile="yes";
}

?>
<style type="text/css">
div#tipDiv {
    color:#000; font-size:11px; line-height:1.2;
    background-color:#E1E5F1; border:1px solid #667295; 
    width:210px; padding:4px;
}</style>
<script src="js/dw_event.js" type="text/javascript"></script>
<script src="js/dw_viewport.js" type="text/javascript"></script>
<script src="js/dw_tooltip.js" type="text/javascript"></script>
<script src="js/dw_tooltip_aux.js" type="text/javascript"></script>
<script type="text/javascript">
dw_Tooltip.content_vars = {
L1: '<?=$ttips_1?>',
L2: '<?=$ttips_2?>',
L3: '<?=$ttips_3?>',
L4: '<?=$ttips_4?>',
L5: '<?=$ttips_5?>',
L6: '<?=$ttips_6?>',
L7: '<?=$ttips_7?>',
L8: '<?=$ttips_8?>',
L9: '<?=$ttips_9?>',
L10: '<?=$ttips_10?>',
L11: '<?=$ttips_11?>',
L12: '<?=$ttips_12?>',
L13: '<?=$ttips_13?>',
L14: '<?=$ttips_14?>',
L15: '<?=$ttips_15?>',
L16: ' <?=$ttips_16?>',
L17: '<?=$ttips_17?>',
L18: '<?=$ttips_18?>',
L19: '<?=$ttips_19?>',
L20: '<?=$ttips_20?>',
L21: '<?=$ttips_21?>',
L22: '<?=$ttips_22?>',
L23: '<?=$ttips_23?>',
L24: '<?=$ttips_24?>',
L25: '<?=$ttips_25?>',
L26: '<?=$ttips_26?>',
L27: '<?=$ttips_27?>',
L28: '<?=$ttips_28?>',
L29: '<?=$ttips_29?>',
L30: '<?=$ttips_30?>',
L31: '<?=$ttips_31?>',
L32: '<?=$ttips_32?>',
L33: '<?=$ttips_33?>',
L34: '<?=$ttips_34?>'
}
</script>
<?
require 'templates/'.$tfold.'/usermenu.php';
?>