<?php

Doo::loadCore('db/DooModel');

class receiptLog extends DooModel {

    public $rlid;
    public $username;
    public $uid;
    
    public $date;
    public $opinion;
    
    public $rolename;
    public $img;
    public $rid;
    public $status;
    
    public $_table = 'CLD_receiptLog';
    public $_primarykey = 'rlid';
    
    public $_fields = array('rlid', 'username', 'uid', 'date', 'opinion','rolename','rid' ,'img', 'status');

 	function getReceiptLogByUid($uid){
    	$sql = "select a.receiptOrder,a.sum,a.status,a.Rtype,a.rid from CLD_receipt  as a left join " . $this->_table . " as b on (a.rid=b.rid)  where a.staff= '".$uid."' group by a.rid ORDER BY a.rid DESC" ;
    	$query = Doo::db ()->query ( $sql );
		$result = $query->fetchAll ();
		Doo::loadClass ( 'XDeode' );
		$XDeode = new XDeode ( 7 );
		foreach ($result as $key=>$value){
			$result [$key] ['ridKey'] = $XDeode->encode ( $value ['rid'] );
		}
		
		return $result;
    }
}

?>