- $sql = "select l.date as date, 1 as type, u.name as user_name, p.name as project_name,
- t.name as task_name, l.comment as note,
- time_format(l.duration, '%k:%i') as duration,
- cast(l.billable * coalesce(upb.rate, 0) * time_to_sec(l.duration)/3600 as decimal(10, 2)) as cost,
- l.paid as paid from tt_log l
- inner join tt_users u on (l.user_id = u.id)
- left join tt_projects p on (p.id = l.project_id)
- left join tt_tasks t on (t.id = l.task_id)
- left join tt_user_project_binds upb on (upb.user_id = l.user_id and upb.project_id = l.project_id)
- where l.status = 1 and l.billable = 1 and l.invoice_id = $invoice_id order by l.date, u.name";
+ $sql = "select l.date as date, 1 as type, u.name as user_name, p.name as project_name,".
+ " t.name as task_name, l.comment as note, time_format(l.duration, '%k:%i') as duration,".
+ " cast(l.billable * coalesce(upb.rate, 0) * time_to_sec(l.duration)/3600 as decimal(10, 2)) as cost,".
+ " l.paid as paid from tt_log l".
+ " inner join tt_users u on (l.user_id = u.id)".
+ " left join tt_projects p on (p.id = l.project_id)".
+ " left join tt_tasks t on (t.id = l.task_id)".
+ " left join tt_user_project_binds upb on (upb.user_id = l.user_id and upb.project_id = l.project_id)".
+ " where l.status = 1 and l.billable = 1 and l.invoice_id = $invoice_id".
+ " and l.group_id = $group_id and l.org_id = $org_id order by l.date, u.name";