 
<?

$id = $inUser->id;										
$usr['id']	 = $inUser->id;						
	$sql = "SELECT A.*, B.* FROM cms_users as A, cms_user_profiles as B WHERE A.id = $id AND B.user_id = $id";
	$result = $inDB->query($sql);
	
	if ($inDB->num_rows($result)>0){
		$usr = $inDB->fetch_assoc($result);
		$inPage->addPathway($usr['nickname'], cmsUser::getProfileURL($usr['login']));
		$inPage->addPathway($_LANG['zakazi']);
        $inPage->setTitle($_LANG['zakazi'].' - '.$usr['nickname']);

		
$usr['avatar'] = usrLink(usrImageNOdb($usr['id'], 'small', $usr['imageurl'], $usr['is_deleted']), $usr['login'], $menuid);
$usr['nickname'] = cmsUser::getProfileLink($usr['login'], $usr['nickname']);

$usr['zakazi_count'] = $inDB->rows_count('cms_user_zakazi', "to_id={$usr['id']} AND provesti=0");

$usr['karma'] = strip_tags( cmsUser::getKarmaFormat($usr['id'], false), '<table><tr><td><img><a>' );

							  
echo '<div  style="margin-bottom:15px;background:#e3ecf6;padding:5px 10px">';
echo '<table width="100%" height="" cellspacing="" cellpadding="0"><tr>';

echo '<div class="con_heading" style="margin-bottom:7px;font-size:18px"><a href="'.cmsUser::getProfileURL($usr['login']).'">'.$usr['nickname'].'</a> &rarr; Мои сделки <sup style="font-size:13px;color:#5485b7">'.$usr['zakazi_count'].'</sup></div>';
echo '<div  style="background:#fff;padding:5px 10px;font-size:14px">';

echo '<b>'.$_LANG['neprovedennie'].'</b>&nbsp;&nbsp;&nbsp;<a href="/torg/u'.$id.'/zakazi-ok">'.$_LANG['provedennie'].'</a>';
echo '</div></td>';
echo '</tr></table></div>';


echo '<div  style="border:1px solid #eee;padding:8px;">';



		$sql = "SELECT *, message as title, senddate as pubdate
				FROM cms_user_zakazi
				WHERE to_id = $id AND provesti=0
				ORDER BY senddate DESC
				"; 
		

	
		$result = $inDB->query($sql);

		if ($inDB->num_rows($result)){		



echo '<form method="post" action="/torg/u'.$id.'/zakazi-provesti">';
echo '<table width="100%" cellpadding="5" cellspacing="0" border="0">';
echo '<tr>';
echo '<td valign="middle" width=150px>'.$_LANG['zakazan'].'</td>';
echo '<td width="30px"><input type="checkbox" onclick="checkall(this)" /></td>';
echo '<td valign="middle"  width=240px>'.$_LANG['zakaz4ik'].'</td>';
echo '<td>'.$_LANG['tovar'].'</td>';
echo '<td valign="middle" width="100px">'.$_LANG['PRICE'].'</td>';
echo '<td valign="middle" width="10px" align=center></td>';
echo '<td valign="middle" width="220px">'.$_LANG['summa'].'</td>';
echo '</tr>';
echo "<tr>";
while($item = $inDB->fetch_assoc($result)){	
$item['pubdate']  = cmsCore::dateformat($item['pubdate']);
echo '<td valign="middle" width=150px>';	
echo '<span class="bd_item_date" style="padding-left:22px;font-size:12px">'.$item['pubdate'].'</span>';
echo '</td>';
echo '<td width="30px"><input type="checkbox" value="'.$item['item_id'].'" name="board_check[]" /></td>';
echo '<td valign="middle"  width=240px>';									
echo '<a style="margin-right:5px" href="/torg/u'.$item['from_id'].'/sendmessage.html" title="'.$_LANG['WRITE_MESS_TO_AVTOR'].'"><img src="/templates/_default_/images/torg/icons/email_go.png" align="absmiddle"></a>
<a href="/users/'.$item['from_login'].'">'.$item['from_nickname'].'</a><br/>'.$item['email'].'';
echo '<div style="font-size:12px;color:#666"><img src="/templates/_default_/images/torg/icons/contacts/phone.png" align=bottom> '.$item['contacts'].'</div>';
echo '<div style="font-size:12px;color:#666"><img src="/templates/_default_/images/torg/icons/address.gif" align=bottom> '.$item['adress'].'</div>';
echo '<div style="font-size:11px;color:#888">'.$item['short'].'</div>';
echo '</td>';
echo '<td valign="middle" width="400px">';										
echo ''.$item['title'].'';
echo '</td>';
echo '<td valign="middle" width="100px">';
echo ''.$item['price'].' x '.$item['itemscount'].'<input type="input" style="display:none" value="'.$item['itemscount'].'" name="count" />';
echo '</td>';
echo '<td valign="middle" width="10px" align=center>=</td>';
echo '<td valign="middle" width="220px">';
$totalprice=$item['price'] *  $item['itemscount'];
echo '<b style="color:#666"><b>'.$totalprice.'</b> '.$_LANG['rub'].'';
echo '</td>';

echo '</tr>';
				}
			
echo '</table>';
echo '<div style="padding:10px 0 0 135px"><input type="submit" value='.$_LANG['provesti'].' /></div>';
echo '</form>';
	echo '</div>';
	

	
		
		} else { 
				 echo '<div  style="border:1px solid #eaf1f6;padding:20px">'.$_LANG['notovars'].'</div>';
				}
				
				
				
				
				
			
				
				
				
				
	}//END - zakazi
	?>