Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. $query = DB::table('autostk')
  2. ->where('autostk.branchid', $branch_id)
  3. ->where('autostk.itemcode',$request->itemcode)
  4. ->whereDate('autostk.date','<=',$request->tdate)
  5. ->leftjoin('journal AS j', function($join) use ($branch_id) {
  6. $join->on('autostk.refno', '=', 'j.vno')
  7. ->where('j.code', '>=', 100)
  8. ->where('j.branchid', $branch_id)
  9. ->where('j.vtype', '=', 'autostk.vtype')
  10. ->leftjoin('accounts', 'j.code', '=', 'accounts.code')
  11. ->where('accounts.branchid', $branch_id);
  12. })
  13. ->select('j.code','accounts.title','autostk.*')
  14. ->orderBY('date')->get()
  15. ->map(function ($item, $key) {
  16. return (array) $item;
  17. })
  18. ->all();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement