<?php

require_once(dirname(dirname(__FILE__)) . '/app.php');
need_manager();




$condition = array();
$condition1 = '';
if($_GET){
    if(isset($_GET['username'])){
        $user_id = OUser::GetUserId($_GET['username']);
        $condition['user_id'] = $user_id;
        $condition1 .= "and user.username='".$_GET['username']."' ";
    }
}

$count = Table::Count('flow',$condition);
list($pagesize, $offset, $pagestring) = pagestring($count, 20);
$sql = "SELECT user.username as username,admin.username adminname,flow.*
        FROM user as user,user as admin,flow
        WHERE user.id=flow.user_id and admin.id=flow.admin_id ".$condition1."
        ORDER BY flow.create_time DESC
        LIMIT ".$offset.",".$pagesize;

$flow = DB::GetQueryResult($sql,false);

if($count==0){
    Session::Set('error','没有任何账务信息！');
}

include template('manage_flow');
?>
