Hello friends,
I have the following stored procedure:
CREATE FUNCTION get_delivery_payment(parm int)
RETURNS double
BEGIN
DECLARE total_subtotal double;
DECLARE total_shipping double;
DECLARE total_warranty double;
DECLARE total_misc double;
DECLARE total double;
SELECT SUM(invoice_products.sell_price * invoice_products.qty) INTO total_subtotal FROM invoice_products, products, invoices WHERE invoice_products.associated_invoice_id = parm AND invoice_products.associated_invoice_id = invoices.id AND invoice_products.associated_product_id = products.id AND products.is_taxable = 1;
SELECT SUM(invoice_products.sell_price * invoice_products.qty) INTO total_shipping FROM invoice_products, invoices, products WHERE invoice_products.associated_invoice_id = parm AND invoice_products.associated_invoice_id = invoices.id AND invoice_products.associated_product_id = products.
-- This message may have been cut off and the rest will only be shown to members. To become a member, click here --