Guest User

Untitled

a guest
Jan 22nd, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. $data = CustomerPrepaid
  2. ::join('pos_sales', 'customer_prepaid.customer_id', '=', 'pos_sales.customer_id')
  3. ->join('pos_sales_product', 'pos_sales.pos_sales_code', '=', 'pos_sales_product.pos_sales_code')
  4. ->where('pos_sales_product.product_id', 'customer_prepaid.product_id')
  5. ->select('customer_prepaid.customer_id', 'customer_prepaid.created_at',
  6. 'pos_sales_product.pos_sales_product_code as reference_no',
  7.  
  8. 'customer_prepaid.product_id', 'customer_prepaid.balance',
  9. 'last_used', 'expiry_date', 'customer_prepaid.amount as price')
  10. ->offset(($page-1)*$limit)->limit($limit);
  11.  
  12. SELECT customer_prepaid.customer_id, customer_prepaid.created_at as purchase_date,
  13. pos_sales_product.pos_sales_product_code as reference_no, customer_prepaid.product_id,
  14. customer_prepaid.balance, customer_prepaid.amount*customer_prepaid.balance as value,
  15. last_used, expiry_date, customer_prepaid.amount as price,
  16. customer_prepaid.amount*customer_prepaid.balance as total
  17. FROM customer_prepaid
  18. JOIN pos_sales ON customer_prepaid.customer_id = pos_sales.customer_id
  19. JOIN pos_sales_product ON pos_sales.pos_sales_code = pos_sales_product.pos_sales_code
  20. WHERE pos_sales_product.product_id = customer_prepaid.product_id
Add Comment
Please, Sign In to add comment