<?
header('Access-Control-Allow-Origin:*'); 
if (empty($dduser)){
    exit();	
}
dd_session_start();
 

$page = !($_POST['page'])?'1':intval($_POST['page']);
$pagesize=$_REQUEST['limit']?$_REQUEST['limit']:20;  
$frmnum=($page-1)*$pagesize;
$date=$_POST['title1'];
$sdate=date("Y-m-01",strtotime($date));
$edate=date("Y-m-t",strtotime($date));
$hhrs=app("user")->partner(0);
$count=count($hhrs);
if ($_POST['hhr'] or $dduser['role']==HHR){
    $hhr=$_POST['hhr']?$_POST['hhr']:$dduser['id'];
    $hhrs=[];
    $hhrs[$hhr]=app("user")->get_name($hhr);
}
foreach ($hhrs as $key => $value) {

 
    $data['commission']=app("order")->hhrCommission($key,$date);
    $data['yicost']=app("income")->totalYicost($sdate,$edate,$key);
    $data['salary']=round($data['commission']-$data['yicost'],2);
    $data['username']=$value;
    $data['title']=$date;
    $list[]=$data;
}

json(0,"",$list,$count,$other);

?>