Use SQL to create query to duplicate the export sales details

I would like to use SQL to link a query that duplicates the export of sales data in .csv format or SQL data on a scheduled basis. Is it possible to acquire the logic for this report to duplicate in an AQL query?

In version 4 it was hard coded. Version 5 you can do this already with a new CSV export option for custom reports.

Thank you for your reply. However I am not sure I worded my question properly. We would like to use the .csv equivalent to schedule an extract on a routine basis to be able to merge the sales information with the expense information (which comes from a variety of other sources). The code for the export is what I am interested in and I will be able to duplicate the code in the SQL. My most pressing issue is how to detect a discount or a reversal of an erroneous entry in the POS. The export does this but I am not able to find the correct tables/columns that indicate this. We are evaluating Version 5, but if we are limited to a manual export I am not sure this would serve our ultimate purpose and if I am not able to find the tables/columns that are needed for calculation I would probably be at a loss to build the custom report.

When you indicate “hard coded” do you mean in SQL (or other language) vs. coding on the machine or within Windows? If so, and if you could point me to the location of the coding I would be happy to review this as far as I can.

Any help would be appreciated.

Thank you,

Version 5 does not require manual export. You can setup a Custom Export report and you can automate the export with rules and actions to export on WP close. You can even have it email the csv to you.

Hard coded means it is not SQL. He coded it directly into the software. With version 5 all reports are now custom reports and are not hard coded so you can edit and change any report you want.

Here is a great start for learning how to use custom reports.