This topic is locked
[SOLVED]

 compare sales with previous year sales

12/26/2018 6:14:02 PM
PHPRunner General questions
F
fpilot author

Hello all,
I am old on this forum but my experience is still very less and every year I renew thinking that I will devote time to learn it but every year i cannot find enough time. By saying that I need assistance here.
I am trying to compare my sales data from DailyReport table with previous year same date. I created a custom button but dont know how should i construct the sql statement. also after doing that this report has to be emailed with cc option, all in HTML format.
pls help.

Sergey Kornilov admin 12/27/2018

This sounds both vague and complicated. It is not clear if you only need to retrieve one number (sales for the same day last year) or something more complicated. If this is a single number only it not clear what you call a "report" then.
Anyway, assuming that you use MySQL, here is a SQL Query that will retrieve data from one year ago:

select * from <TableName> where <DateField> = DATE_SUB(curdate(), INTERVAL 1 YEAR)
M
Mark Kramer 12/30/2018

For your email section, look here For inspiration : https://xlinesoft.com/phprunner/docs/email_to_selected_users.htm

F
fpilot author 12/30/2018

awesome. thanks. is curdate() in yyyy-mm-dd format?



This sounds both vague and complicated. It is not clear if you only need to retrieve one number (sales for the same day last year) or something more complicated. If this is a single number only it not clear what you call a "report" then.
Anyway, assuming that you use MySQL, here is a SQL Query that will retrieve data from one year ago:

select * from <TableName> where <DateField> = DATE_SUB(curdate(), INTERVAL 1 YEAR)


F
fpilot author 12/30/2018

It says "Use custom mailer server settings" under "Email settings". but i dont see this option here, am i at the wrong place? Screen Shot, 2ndly will this change any other emails? 3rdly will it work with html emails.?



For your email section, look here For inspiration : https://xlinesoft.com/phprunner/docs/email_to_selected_users.htm