What is the SQL Query for Word Period Report?

I want to know, wjhat is the SQL query to write in SQL Server management to see all details like in word period report

It’s not a simple query. That’s why emre did report code to make it easier to customise.
To get and sales you’ll need to join many tables in ludong orders, tags and taxes, possibly more.
For a item sales type report your likely going to need to to add menuitem table as well to get group info etc.
You’ll want to use SQL 2016 to utilise the Jon helpers as the state info you’ll need to account for is stored in json is you want to make sure you don’t count qoid orders etc.

Perhaps if you explain what your trying to do it would be easier to offer best method .m

i am trying to display a dashboard with basic reporting in php.

Total Sales, Taxes, Discount, VOid , Gift, Cash, Credit Card and other payment methods and few more.

i have tried many ways to design query in SSMS. But it doesnt show the results like it shows in Reports of SambaPOS

You would be better of using the samba api and calling the report itself through that.
Why reinvent the wheel when the complex sql queries can be handled for you by sambas own reporting code.

Could you help me with an example to such API and do you mean using graphql

Ive not done masses of work with it but it would be along these lines;

Thanks. I tried and i can pull reports now.

Guess i will have to crack GraphQL and React

Will i be able to use filters as well ;

You will save yourself hours of headake taking that route over direct SQL.
Ive used direct SQL before we had the api but only for very specific stuff generally from a single table. A broad report would require so many joins and json work it would become very complex very quickly and when you can get straight to the values via the api and existing reports why go to the extra effort.

that is true. it does save the time.

but i dont know where to start with graphql to pull and save info to display on a page.

Do you have any resources to start with ?

Did you not have a plan for this before as that would have been the same if you had used SQL LOL

Maybe you would be better looking at mertik (although in beta is sambas reporting app) or maybe Q’s custom web based extention which can do web based mobile device interface and reporting also.
QMX - QMX for SambaPOS ::: Cross-Platform Mobile Client

i did see Metrik. it is a beautiful app. But its incomplete. :cry:

and QMX looks very dark and complicated . :slight_smile:

And expensive for each system installation

You think??? Your not going to want to report on every device…
You understnad its an adon to samba right.
Plus not wanting to short sell Q but I beleive the reporting part is free with his basic licence.

1 Like

That is true. Wont be reporting from all systems.

You can find information about making graphql calls on this tutorial.