<?
define("PARTNER_AUTHORIZATION",1);
include("../../../includes/common.php");
/*PAGE TITLE*/
$page_title = "История выводов";
$header = "История выводов";
$table = "partner_payouts";
/* pager start */
$params['tables'] = $table;
$params['nocheckfield']=true;
$params['s_prefix'] = $table;
$params['query'] = "select count(*) from $table where partner_id=$PARTNER_ID";
$pager = GetPagerParams($params);
/* pager end */
$table_headers = Array(
"itter"=>Array("№","width=20 align=center"),
"id"=>Array("<a href='".$pager['new_sort']."$table".".id' title='Sort'>ID</a>","width=30 align=center"),
"props"=>Array("<a href='".$pager['new_sort']."$table".".properties' title='Sort'>Детали перевода</a>",""),
"amount"=>Array("<a href='".$pager['new_sort']."$table".".amount' title='Sort'>Количество</a>","align=center"),
"status"=>Array("<a href='".$pager['new_sort']."$table".".status' title='Sort'>Статус</a>","align=center"),
"date"=>Array("<a href='".$pager['new_sort']."$table".".regdate' title='Sort'>Дата</a>","align=center"),
);
$query = "select $table.*, curr.symbol as currency_symbol from $table inner join currencies curr on curr.id = $table.currency_id ORDER BY ".$pager['sort_by']." ".$pager['sort_ord']
." LIMIT ".$SETTINGS['admin_items_per_page']." OFFSET ".($pager['start_item']-1);
$res = mysql_query($query);
$table_items=Array();
$itter =$pager['start_item'];
$i=0;
while ($row = mysql_fetch_object($res)){
switch($row->status){
case 0:
$s= $ADMIN_ICONS[status_off];
break;
case 1:
$s= $ADMIN_ICONS[status_on];
break;
case 2:
$s= $ADMIN_ICONS[status_progress];
break;
}
$amount = MoneyToStr($row->amount);
$amount = ($row->amount>0?"<font color=green>+":"<font color=red>").$amount." ".$row->currency_symbol."</font>";
$rest = ($row->rest_amount>0?"<font color=green>+":"<font color=red>").MoneyToStr(round($row->rest_amount,2))." ".$row->rest_curr_symbol."</font>";
$table_items[$itter] = Array(
"id"=>array($row->id,"align=center"),
"itter"=>array($itter,"align=center"),
"props"=>Array(nl2br(stripslashes($row->properties))),
"order"=>Array($row->order_id>0?$row->order_id:"-","align=center"),
"amount"=>Array($amount,"align=center"),
"status"=>Array($s,"align=center"),
"date"=>Array(strftime("%d %b %Y<br><small>%H:%M:%S</small>",$row->regdate),"align=center"),
);
$itter++;
}
$smarty->assign('page_title',"История выводов");
$smarty->assign('error',$error);
/* table template */
$smarty->assign('pager',$pager);
$smarty->assign('table_headers',$table_headers);
$smarty->assign('table_items',$table_items);
$smarty->assign('table_width',"90%");
$smarty->assign('top_menu_tpl',"partner_payouts_menu.tpl");
$smarty->assign('main_tpl',"admin_list_table.tpl");
$smarty->assign('use_group_funcs',array_key_exists("group_funcs",$table_headers));
/* display content */
$smarty->display('partner_index.tpl');
?>