Zen Cart Logo

Sales and Use

Locked

Views: 610

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
30 Sep 2008, 12:36 AM
#1
hermes369 avatar

hermes369

New Zenner

Join Date:
Dec 2006
Location:
Augusta, GA
Posts:
74
Plugin Contributions:
0

Sales and Use

Through much wailing and gnashing of teeth, I'm not a mysql expert as the code below will confirm...
Anyway, I have a client that needs a monthly 'sales and use' report. She created an example excel worksheet with the fields she wanted. Here's what I came up with:

SELECT zen_orders.customers_name, zen_orders.date_purchased, zen_orders_total.text AS subtotal, shipping_source.text AS shipping, shipping_source.title AS shipping_method,zen_orders.order_tax, zen_orders.order_total
FROM zen_orders, zen_orders_total
LEFT JOIN zen_orders_total AS shipping_source ON zen_orders_total.orders_id = shipping_source.orders_id
WHERE zen_orders_total.title LIKE 'Sub%'
AND shipping_source.title LIKE 'Unit%'
AND zen_orders.orders_id = zen_orders_total.orders_id

I am rather convinced there is a more elegant solution. I'm also hoping to put this in a shell script that will put a date range in and have cron run it once a month to produce an .xls. I used phpmyadmin to execute and export the file. It works for me. Let me know what you think!

30 Sep 2008, 1:01 PM
#3
hermes369 avatar

hermes369

New Zenner

Join Date:
Dec 2006
Location:
Augusta, GA
Posts:
74
Plugin Contributions:
0

Re: Sales and Use

Thanks for the kind words. I'm a former ballet dancer, I teach now. Any time I can prove that I can do more than count to eight, I'm happy.
I'll check out the mod.