Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DB::table('supply as s')
- ->select(
- DB::raw('WEEKOFYEAR(zeit_von) as week'), DB::raw('round(count(s.id)/8,2) as slots_count'),
- 's.projekt', 'pas.skillset'
- )
- ->leftJoin('p_projects as p', 'p.id', '=', 's.projekt')
- ->leftJoin('accounts_skillset as pas', 'pas.account_id', '=', 's.employee')
- ->where('s.deleted', 0)
- ->whereIn('s.supply_status', [1, 2])
- ->whereRaw(
- DB::raw("(select count(cal_id) from w_cal as c
- where c.owner=s.employee
- and deleted=0
- and date_format(s.zeit_von, '%d.%m.%y')=date_format(from_unixtime(c.mdatetime), '%d.%m.%y')
- and c.category='Kr')<1")
- )
- ->whereRaw(DB::raw('year(zeit_von)='.$year))
- ->groupBy('pas.skillset', 'p.id', DB::raw('WEEKOFYEAR(s.time_from)'))
- ->get();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement