Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. DB::table('supply as s')
  2. ->select(
  3. DB::raw('WEEKOFYEAR(zeit_von) as week'), DB::raw('round(count(s.id)/8,2) as slots_count'),
  4. 's.projekt', 'pas.skillset'
  5. )
  6. ->leftJoin('p_projects as p', 'p.id', '=', 's.projekt')
  7. ->leftJoin('accounts_skillset as pas', 'pas.account_id', '=', 's.employee')
  8. ->where('s.deleted', 0)
  9. ->whereIn('s.supply_status', [1, 2])
  10. ->whereRaw(
  11. DB::raw("(select count(cal_id) from w_cal as c
  12. where c.owner=s.employee
  13. and deleted=0
  14. and date_format(s.zeit_von, '%d.%m.%y')=date_format(from_unixtime(c.mdatetime), '%d.%m.%y')
  15. and c.category='Kr')<1")
  16. )
  17. ->whereRaw(DB::raw('year(zeit_von)='.$year))
  18. ->groupBy('pas.skillset', 'p.id', DB::raw('WEEKOFYEAR(s.time_from)'))
  19. ->get();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement