_table . " where staff= '".$sid."' and Year(date) =".$year." group by Year(date)" ; //echo '
'.$sql.'
'; $query = Doo::db ()->query ( $sql ); $result = $query->fetch (); return $result; } function statisticsByComPanyYear($year,$sid,$cidString=''){ //staff= '".$sid."' and $cidSql=''; if(!empty($cidString)) $cidSql=' and cid in ('.$cidString.')'; $sql = "select sum(rePrice) as rePrice,sum(agPrice) as agPrice from " . $this->_table . " where Year(date) =".$year.$cidSql." group by Year(date)" ; $query = Doo::db ()->query ( $sql ); $result = $query->fetch (); return $result; } function statisticsByCid($year,$cid){ // $sql = "select sum(rePrice) as rePrice,sum(agPrice) as agPrice from " . $this->_table . " where cid= '".$cid."' and Year(date) =".$year." group by Year(date)" ; $query = Doo::db ()->query ( $sql ); $result = $query->fetch (); return $result; } /** * 按员工年月获得报销单汇总信息 * @param string $sid * @param string $year * @param string $month */ function getStatisticsBySid($sid='',$year='',$month=''){ if(empty($sid)) return array(); $stList = $this->getOne ( array ( 'select' => 'sum(rePrice) as rePrice,sum(agPrice) as agPrice', 'where' => 'staff='.$sid.' and Month(date)=' . $month . " and Year(date)=" . $year, 'groupby' => 'Month(date)', 'asArray' => true ) ); return $stList; } } ?>