<?php
class Report extends AppModel {
	var $name = 'Report';
	var $displayField = 'id';
	
	
	//The Associations below have been created with all possible keys, those that are not needed can be removed		
	public $belongsTo = array();
	
	public $hasMany = array();	
	

	################################################# Statuses 14 (cancelled tests) ######################################################
	// For status = 14, it returns the list of evaluations that have been cancelled. To be used by the cancelled tests report shell.
	function listTestsStatus14($today, $previous_week)
	{
		return $this->find('all', array(
				'link' => array(
					'Order' => array(
						'Employee'
						),

					'Requester' => array(
										'Team'  => array('conditions' => 'Requester.team_id  = Team.id'),
										'conditions' => 'Evaluation.requester_id  = Requester.id'
										),
					'Status' => array(),
				),
				'fields' => array('Status.name_eng','Requester.first_name', 'Requester.last_name','Order.order_code','Evaluation.createdby','Evaluation.test_serie','Evaluation.status_date', 'Employee.id', 'Employee.first_name','Employee.last_name'),
				'conditions' =>  array('Evaluation.status_id' => 14, 'Evaluation.status_date BETWEEN ? AND ?' => array($previous_week,$today))
				));			
	}	

	function beforeSave($opt=[]) {

	}
	
	function afterSave($created) {	

	}	
		
}
?>