Post by SelfSus » Mon Dec 15, 2014 8:44 pm

Hey guys.

Our tax year run 1 March to end Feb every year.

OC's default runs 1 jan to end Dec.

is there a simple way to change the "Total Sales This Year" Date range?

Selfsustainable farmer living the dream. http://www.livingseeds.co.za


User avatar
Active Member

Posts

Joined
Fri May 27, 2011 8:40 pm
Location - ZA

Post by SelfSus » Mon Jan 05, 2015 3:54 pm

Bump

Selfsustainable farmer living the dream. http://www.livingseeds.co.za


User avatar
Active Member

Posts

Joined
Fri May 27, 2011 8:40 pm
Location - ZA

Post by soundzgood-nz » Mon Jan 05, 2015 6:09 pm

Nope there isn't a simple change - however I'd recommend using the Sales Report under Reports > Sales > Orders where you can set the date range and also importantly the order statuses so you get the range you want and actual valid orders in the total sales (the dashboard total includes ALL order statuses, around 10 of which are invalid eg canceled orders)

Simon

User avatar
Active Member

Posts

Joined
Sat Oct 25, 2014 5:15 pm
Location - New Zealand

Post by SelfSus » Mon Jan 05, 2015 10:11 pm

Hey Simon.

Thanks for the response. Yeah I do have Sales Reporting and it works.

The dash would just be nicer if it is customisable as well.

Saffa regards.

Selfsustainable farmer living the dream. http://www.livingseeds.co.za


User avatar
Active Member

Posts

Joined
Fri May 27, 2011 8:40 pm
Location - ZA

Post by webvet » Wed Jan 07, 2015 12:37 am

SelfSus

Just noticed your thread - I haven't used OC v1.5.5.1 for a while, but you can change the model for the getTotalSalesByYear query that runs in the database.

If you go to admin/model/sale/order.php and look for the line:

Code: Select all

public function getTotalSalesByYear($year)
Change the NEXT line to:

Code: Select all

$query = $this->db->query("SELECT SUM(total) AS total FROM `" . DB_PREFIX . "order` WHERE order_status_id > '0' AND date_added BETWEEN '2014-03-01' AND '2015-02-28'");
I haven't double checked this so PLEASE back up your original admin/model/sale/order.php file (and everything!) or alternatively create a quick vqmod to do this without changing any core files.

This will hard code the dates to your specific tax year - so after the 28th Feb you will need to change the dates for the 2015-16 tax year manually.

Give me a shout if you need the vqmod version - otherwise good luck, hope this helps...

Genuine, Honest Opencart Support @ http://webvetservices.com


User avatar
Active Member

Posts

Joined
Thu May 14, 2009 2:04 am
Location - Shropshire, UK

Post by soundzgood-nz » Wed Jan 07, 2015 7:34 am

I think if you're going to manually keep the date range up to date then you might want to exclude all the 'non-sale' order ids as well because that query at the moment will include canceled, processing, invalid, failed etc orders which would pretty much make the sales total on the dashboard invalid.

Not sure what order statuses you're running of course but you'd change the WHERE order_status_id > 0 bit to
WHERE order_status_id = <whatever status id COMPLETED is>
or
WHERE order_status_id not in (order status ids not wanted)

Simon

User avatar
Active Member

Posts

Joined
Sat Oct 25, 2014 5:15 pm
Location - New Zealand

Post by webvet » Wed Jan 07, 2015 8:05 am

Fair point - but it is difficult to provide code that will work for everyone as order_status_id's might be different for different stores.

For the OP I kept the query the same as the Opencart core, just changed the dates to match his tax year as opposed to a calendar year.

I have changed my Dashboard reports by vqmod to show what I want, but that won't necessarily work exactly the same for everyone.

Genuine, Honest Opencart Support @ http://webvetservices.com


User avatar
Active Member

Posts

Joined
Thu May 14, 2009 2:04 am
Location - Shropshire, UK

Post by SelfSus » Tue Mar 10, 2015 5:55 pm

Hey Guys.

Thank you for the feedback much appreciated, I'll implement.

Selfsustainable farmer living the dream. http://www.livingseeds.co.za


User avatar
Active Member

Posts

Joined
Fri May 27, 2011 8:40 pm
Location - ZA
Who is online

Users browsing this forum: No registered users and 144 guests