<?php
include "../core.php";
saxue_checklogin();
saxue_getconfigs( "configs", "member" );
if ( empty( $_REQUEST['page'] ) || !is_numeric( $_REQUEST['page'] ) ) {
		$GLOBALS['_REQUEST']['page'] = 1;
} 
include SAXUE_ROOT_PATH . "/model/member_bill.php";
$bill_handler = &saxuememberbillhandler :: getinstance( "saxuememberbillhandler" );
$criteria = new criteriacompo( new criteria( "uid", $_SESSION['saxueUserId'] ) );
$criteria -> setsort( "id" );
$criteria -> setorder( "DESC" );
$criteria -> setlimit( $saxueConfigs['member']['logpnum'] );
$criteria -> setstart( ( $_REQUEST['page'] - 1 ) * $saxueConfigs['member']['logpnum'] );
$bill_handler -> queryobjects( $criteria );
$rows = array();
$k = $income = 0;
while ( $v = $bill_handler -> getobject() ) {
		$rows[$k] = $v -> getvars( "n" );
		$income += $rows[$k]['amount'];
		++$k;
} 
include SAXUE_WEB_PATH . "/member/header.php";
$saxueTpl -> assign_by_ref( "rows", $rows );
$saxueTpl -> assign( "income", $income );
include SAXUE_ROOT_PATH . "/lib/util/page.php";
$jumppage = new saxuepage( $bill_handler -> getcount( $criteria ), $saxueConfigs['member']['logpnum'], $_REQUEST['page'] );
$jumppage -> setlink( "", true, true );
$saxueTpl -> assign( "url_jumppage", $jumppage -> whole_bar() );
$saxueTpl -> assign( "totalpage", $jumppage -> total_page );
$saxueTpl -> setcaching( 0 );
$saxueTset['saxue_contents_template'] = SAXUE_THEME_PATH . "/member/bill.html";
include SAXUE_WEB_PATH . "/member/footer.php";
