Problem solved
$allleaves = $this->Leavetype->find('all', array(
'joins' => array(
array(
'table' => 'vacations',
'alias' => 'vacationsJoin',
'type' => 'left',
'conditions' => array('vacationsJoin.sub_leave_type = Leavetype.type',
'vacationsJoin.user_id' => $_SESSION['Auth']['User']['id'],
'vacationsJoin.from_date BETWEEN ? and ?' => array(date('Y') . '-01-01',
date('Y') . '-12-31')
)
)
),
'fields' => array('type', 'days', '(SUM(working_days)) as used'),
'group' => 'type'
));
$this->set(compact('allleaves'));
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Monday, March 5, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment