<?php
Doo::loadCore ( 'db/DooModel' );
class RAssist extends DooModel {
	public $aid;
	public $rid;
	public $sid;
	public $inputer;
	public $date;
	
	public $_table = 'CLD_RAssist';
	public $_primarykey = 'aid';
	public $_fields = array (
			'aid',
			'rid',
			'sid',
			'inputer',
			'date',
			
	);
	
	/**
	 * 更加费用ID获得可操作人员
	 * @param number $rid
	 */
	function getRAssistByRid($rid=0){
		$sql = 'select * from ' . $this->_table . ' a left JOIN CLD_staff as b on (a.sid=b.sid)  where a.rid='.$rid;
		
		$query = Doo::db ()->query ( $sql );
		$list = $query->fetchAll ();
		Doo::loadClass ( 'XDeode' );
		$XDeode = new XDeode ( 5 );
		foreach ($list as $key=>$value){
			$list[$key]['aidKey']=$XDeode->encode ( $value ['aid'] );
		}
		
		return $list;
	}
	
	function getRAssistBySid($sid=0){
		$sql = 'select * from ' . $this->_table . ' a left JOIN CLD_receipt as b on (a.rid=b.rid)  where a.sid='.$sid;
		
		$query = Doo::db ()->query ( $sql );
		$list = $query->fetchAll ();
		Doo::loadClass ( 'XDeode' );
		$XDeode = new XDeode ( 5 );
		$XDeode7 = new XDeode ( 7 );
		
		foreach ($list as $key=>$value){
			$list[$key]['aidKey']=$XDeode->encode ( $value ['aid'] );
			$list[$key]['ridKey7']=$XDeode7->encode ( $value ['rid'] );
			$list[$key]['ridKey']=$XDeode->encode ( $value ['rid'] );
		}
		
		return $list;
	}
	
}

?>