Exemplo n.º 1
0
    function getReportByCompanyIdAndUserIDList($company_id, $user_ids, $order = NULL)
    {
        if ($company_id == '') {
            return FALSE;
        }
        if ($user_ids == '') {
            return FALSE;
        }
        /*
        		if ( $order == NULL ) {
        			$order = array( 'status_id' => 'asc', 'last_name' => 'asc' );
        			$strict = FALSE;
        		} else {
        			$strict = TRUE;
        		}
        */
        //		$utf = new UserTaxFactory();
        //					LEFT JOIN '. $utf->getTable() .' as b ON a.id = b.user_id AND (b.deleted=0 OR b.deleted IS NULL)
        $baf = new BankAccountFactory();
        $ph = array('company_id' => $company_id);
        $query = '
					select 	c.*,a.*
					from 	' . $this->getTable() . ' as a
					LEFT JOIN ' . $baf->getTable() . ' as c ON a.id = c.user_id AND (c.deleted=0 OR c.deleted IS NULL)
					where
						a.company_id = ?
						AND a.id in (' . $this->getListSQL($user_ids, $ph) . ')
						AND ( a.deleted = 0 )
				';
        $query .= $this->getSortSQL($order, FALSE);
        $this->ExecuteSQL($query, $ph);
        return $this;
    }