Hi,
I am trying to sort by and group after.
I added to my query the ORDER BY and then a pipe to sort (neither worked).
from tours as T
left join tour_costing AS TC on TC.tour_id = T.id
left join staff as S on S.id = T.Planner
left join staff as S2 on S2.id = T.manager_id
left join statuses as ST on ST.id = T.status_id
WHERE T.tour_status !=\"0\" AND T.Planner=$staff_id
ORDER BY ST.row_number ASC
")
->pipe(new Sort(array(
"ST.row_number"=>"asc"
)))
->pipe($this->dataStore("toursGroupedByPlanner"));
As part of the display/report:
Table::create(array(
"dataStore" => $this->dataStore('toursGroupedByPlanner'),
"grouping" => array(
"status" => array(
"calculate" => array(
"{sumComm}" => array("sum", "comm"),
"{sumEst}" => array("sum", "estimated_sale"),
"{sumAgent}" => array("sum", "agent")
),
"top" => "<b>{status}</b>",
"bottom" => "<td><b>Total {status}</b></td><td></td><td></td><td>{sumEst}</td><td>{sumAgent}</td><td><b>{sumComm}</b></td><td></td><td></td>"
),
),
What am I doing wrong? Thank you