Hi guys, stuck with this one...
I have a simple stock list with 3 elements 'part_number' (eval populated field) 'maximum_stock' (field) and 'units_in stock' (calc)
The units_in_stock calc is calculated on the fly based on values in another table.
Here is my working calc code...
I want to pre-filter the list based on the calc element but the data is not saved to the database because the list is read only and the data in the field is dynamic as the list the data is taken from constantly changes.
Is there any way to pre-filter and order and css style the list without the database entries?
If not is there another way I can do this to achieve the results I'm after?
I can't think of any way to do it.
I have a simple stock list with 3 elements 'part_number' (eval populated field) 'maximum_stock' (field) and 'units_in stock' (calc)
The units_in_stock calc is calculated on the fly based on values in another table.
Here is my working calc code...
PHP:
$db = FabrikWorker::getDbo();
$query = $db->getQuery(true);
$partnum ='{stock_levels___part_number}';
$pwa = "pwa";
$nyent = "Not Tested";
$query->clear()
->select("COUNT(id)")
->from('automatic_transmission_jobs')
->where($db->quote($partnum) . ' = ' . $db->quoteName('automatic_transmission_jobs.part_number') . ' AND ' . $db->quoteName('automatic_transmission_jobs.test_result') . ' != ' . $db->quote($nyent) . ' AND ' . 'status !=' . $db->quote($pwa));
$db->setQuery($query);
$thepart = $db->loadResult();
//var_dump((string)$query);
if('{stock_levels___maximum_stock}' > $thepart AND $thepart > 0) {
return($thepart . " Replace Stock");
}
else if('{stock_levels___maximum_stock}' <= $thepart){
return($thepart . " OK");
}
else if($thepart == 0){
return($thepart . " No stock left");
}
I want to pre-filter the list based on the calc element but the data is not saved to the database because the list is read only and the data in the field is dynamic as the list the data is taken from constantly changes.
Is there any way to pre-filter and order and css style the list without the database entries?
If not is there another way I can do this to achieve the results I'm after?
I can't think of any way to do it.