<?php

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

class loanReceipt extends DooModel {

    public $rid;
    public $accountItem;
    
    public $loanItem;
    
    public $staff;
    
    public $sum;
    public $date;
    public $pastDate;
    
    public $cid;
    public $status;
    public $Rtype;
    
    public $reviseDetail;
    public $revisePrice;
    public $receiptOrder;
    public $verify;
   	public $verifyStaff;
   	
   	public $nowStaff;
   	
   	public $verifyBreakup;
   	
    public $explanation;
    public $notice;
    public $amount;
    
    public $_table = 'CLD_loanReceipt';
    public $_primarykey = 'rid';
    
    public $_fields = array('aid', 'accountItem', 'staff', 'sum', 'date','pastDate' ,'cid', 'status', 'reviseDetail', 'revisePrice', 'verify','verifyStaff',
    'nowStaff','receiptOrder','explanation','notice','Rtype','loanItem','verifyBreakup','amount');

	function receiptByYear($year,$sid){
    	//
    	$sql = "select sum(sum) as sum from " . $this->_table . " where staff= '".$sid."' and Year(date) =".$year." and status=3 " ;
    	//echo '<div style="display:none">'.$sql.'</div>';
    	$query = Doo::db ()->query ( $sql );
		$result = $query->fetch ();
		
		return $result;
    }

}

?>