Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $data = CustomerPrepaid
- ::join('pos_sales', 'customer_prepaid.customer_id', '=', 'pos_sales.customer_id')
- ->join('pos_sales_product', 'pos_sales.pos_sales_code', '=', 'pos_sales_product.pos_sales_code')
- ->where('pos_sales_product.product_id', 'customer_prepaid.product_id')
- ->select('customer_prepaid.customer_id', 'customer_prepaid.created_at',
- 'pos_sales_product.pos_sales_product_code as reference_no',
- 'customer_prepaid.product_id', 'customer_prepaid.balance',
- 'last_used', 'expiry_date', 'customer_prepaid.amount as price')
- ->offset(($page-1)*$limit)->limit($limit);
- SELECT customer_prepaid.customer_id, customer_prepaid.created_at as purchase_date,
- pos_sales_product.pos_sales_product_code as reference_no, customer_prepaid.product_id,
- customer_prepaid.balance, customer_prepaid.amount*customer_prepaid.balance as value,
- last_used, expiry_date, customer_prepaid.amount as price,
- customer_prepaid.amount*customer_prepaid.balance as total
- FROM customer_prepaid
- JOIN pos_sales ON customer_prepaid.customer_id = pos_sales.customer_id
- JOIN pos_sales_product ON pos_sales.pos_sales_code = pos_sales_product.pos_sales_code
- WHERE pos_sales_product.product_id = customer_prepaid.product_id
Add Comment
Please, Sign In to add comment