Custom Report by Flex module

keianrad

Member
I need some reports that I made by flexi customcode module, I need to return values based on log in user and related office id like prefilter in list.
Can I use fabrikar placeholder like '{$my->id}' in SQL query?

I used the code listed below but it doesn't work:

Code:
<?php
$db =& JFactory::getDBO();
$query = "SELECT COUNT(*) FROM `app_contracts` WHERE `contract_status` != '0' AND `adviser_id` = '{$my->id}' and office_id = '''{$q->office_id}'" ;

$db->setQuery($query);
$Result = $db->loadResult();
echo' <div class="uk-text-primary uk-text-center uk-text-bold">'.$Result.'</div>';
?>
 
No, those placeholders are a Fabrik thing, they don't work outside of Fabrik.

But you can get the logged on user id with ...

Code:
$userId = JFactory::getUser()->get('id');
$query = "blah blah blah ... WHERE whatever = $userId ... blah blah";

You don't need to quote it, as it's always going to be an integer.

You'll also have to figure out the pre-query that gives you $q->office_id in the Fabrik pre-filter, and run that at well, either as a separate query, or a sub-query.

-- hugh
 
Thanks, Actually I need to return statistics based on the office id for managers and the login user for advisers. Your code work for the advisers but I still need to find a solution for managers. Is there any way or other module to do that for managers?
 
You posted at 10:40 pm on Friday night (ie. at the weekend). It's about 11pm Sunday night now. So it's not really "bumpable" for another 24 hours.

To answer your question ... I don't know. How are "managers" defined?

-- hugh
 
Hi Hugh, don't be mad at me please :( . I forgot that I posted that on Friday. I thought you are still on the trip. because I left several messages on Skype but you didn't answer me.
 
I'm not mad, I promise! I just remind anyone who posts and bumps over the weekend that ... well, it's the weekend. :)

My Skype has been very flaky about notifications since the last update (to the "new look" Skype) on both desktop and mobile. I'm getting almost no notifications. So I'll only see messages if I actually open my "recent contacts" page and look. Which I don't tend to do very often.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top