Return to Snippet

Revision: 27021
at May 20, 2010 07:04 by gcman105


Updated Code
SELECT DISTINCT
	invoice.invoice_id,
	invoice.invoice_total,
	invoice.invoice_paid,
	invoice.invoice_tax,
	invoice.ts_printed,
	invoice.ts_add,
	ROUND(invoice.invoice_total-invoice.invoice_paid, 2) AS to_pay,
	orders.customer_ref,
	delivery_note.delivery_note_id
	FROM
	invoice
	Inner Join order_items ON order_items.invoice_ref = invoice.invoice_id
	Inner Join orders ON order_items.order_ref = orders.order_id
	Inner Join delivery_note ON order_items.delivery_note_ref = delivery_note.delivery_note_id
	WHERE
	orders.customer_ref = '$cid'
	AND
	invoice.invoice_paid < invoice.invoice_total
	ORDER BY
	invoice.invoice_id DESC

Revision: 27020
at May 20, 2010 05:37 by gcman105


Initial Code
SELECT DISTINCT
	invoice.invoice_id,
	invoice.invoice_total,
	invoice.invoice_paid,
	invoice.invoice_tax,
	invoice.ts_printed,
	invoice.ts_add,
	ROUND(invoice.invoice_total-invoice.invoice_paid, 2) AS to_pay,
	orders.customer_ref,
	delivery_note.delivery_note_id
	FROM
	invoice
	Inner Join order_items ON order_items.invoice_ref = invoice.invoice_id
	Inner Join orders ON order_items.order_ref = orders.order_id
	Inner Join delivery_note ON order_items.delivery_note_ref = delivery_note.delivery_note_id
	WHERE
	orders.customer_ref = '$cid'
	AND
	invoice.invoice_paid < invoice.invoice_total
	ORDER BY
	invoice.invoice_id DESC

Initial URL

                                

Initial Description

                                

Initial Title
MySQL customers invoices

Initial Tags
mysql, textmate

Initial Language
MySQL