Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[CONTRIBUTION] Sales Report v1.0


gdfwilliams

Recommended Posts

~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~

SALES REPORT v1.0

http://www.oscommerce.com/downloads.php/co...ions,800/type,3

12/13/2002

~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~

 

~-~-~-~-~-~-~-~-~-~-~-~-~-~-~

Summary:

~-~-~-~-~-~-~-~-~-~-~-~-~-~-~

A sales report utility that includes Daily, Weekly, Monthly and Yearly sales reports,

including Total # of Orders, Avg. Order Amount, Total Sales, % Variance from previous

hours/days/weeks/months.

 

Daily/Weekly/Hourly reports also include graphs that track total sales. Daily report

uses a stacked bar graph to include average order amount.

 

~-~-~-~-~-~-~-~-~-~-~-~-~-~-~

Recent Improvements:

~-~-~-~-~-~-~-~-~-~-~-~-~-~-~

 

v1.0 - Hourly reports, dynamic graphs, improved navigation, minor tweaks

v.8 - Minor fix in Install file

v.7 - Additions made to language files

v.6 - Moved all the logic into class file sales_report.php in admin/includes/classes/

 

~-~-~-~-~-~-~-~-~-~-~-~-~-~-~

Installation:

~-~-~-~-~-~-~-~-~-~-~-~-~-~-~

 

NEW FILES:

>> copy stats_sales_report.php to admin/

>> copy sales_report.php to admin/includes/classes/

>> copy contents of /jsgraph to NEW folder admin/jsgraph

>> copy stats_sales_report.php to admin/includes/languages/english/

>> copy contents of /images to admin/images

 

MODIFICATIONS TO EXISTING FILES:

 

1) CHANGE the following in admin/includes/boxes/reports.php

 

$contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_STATS_PRODUCTS_VIEWED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_PRODUCTS_VIEWED . '</a><br>' .

'<a href="' . tep_href_link(FILENAME_STATS_PRODUCTS_PURCHASED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_PRODUCTS_PURCHASED . '</a><br>' .

'<a href="' . tep_href_link(FILENAME_STATS_CUSTOMERS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_ORDERS_TOTAL . '</a><br>');

to

$contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_STATS_PRODUCTS_VIEWED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_PRODUCTS_VIEWED . '</a><br>' .

'<a href="' . tep_href_link(FILENAME_STATS_PRODUCTS_PURCHASED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_PRODUCTS_PURCHASED . '</a><br>' .

'<a href="' . tep_href_link(FILENAME_STATS_CUSTOMERS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_ORDERS_TOTAL . '</a><br>' .

'<a href="' . tep_href_link(FILENAME_STATS_SALES_REPORT, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_SALES_REPORT . '</a>');

 

2) ADD the following line in admin/includes/application_top.php

 

define('FILENAME_SALES_REPORT', 'stats_sales_report.php');

 

3) ADD the following line in admin/includes/languages/english.php

 

define('BOX_REPORTS_SALES_REPORT', 'Sales Report');

 

VIEW YOUR REPORTS:

 

Access reports through Admin Control Panel>Reports>Sales Report.

 

~-~-~-~-~-~-~-~-~-~-~-~-~-~-~

Known Bugs:

~-~-~-~-~-~-~-~-~-~-~-~-~-~-~

 

Some minor layout issues with the graphs:

 

> data ranges

> spacing across the X-axis

 

~-~-~-~-~-~-~-~-~-~-~-~-~-~-~

Recent Improvements:

~-~-~-~-~-~-~-~-~-~-~-~-~-~-~

 

v1.0 - Hourly reports, dynamic graphs, improved navigation, minor tweaks

v.8 - Minor fix in Install file

v.7 - Additions made to language files

v.6 - Moved all the logic into class file sales_report.php in admin/includes/classes/

 

~-~-~-~-~-~-~-~-~-~-~-~-~-~-~

To Do:

~-~-~-~-~-~-~-~-~-~-~-~-~-~-~

 

-> Improve graphing function (PHP, perhaps?)

-> Improved export options (CSV and Print)

-> User input for date range of reports

-> Additional sales data to include categories/subcategories, specials

 

~-~-~-~-~-~-~-~-~-~-~-~-~-~-~

Other Info:

~-~-~-~-~-~-~-~-~-~-~-~-~-~-~

 

Screenshot of Daily report:

 

sales_report.gif

 

~-~-~-~-~-~-~-~-~-~-~-~-~-~-~

Development Team:

~-~-~-~-~-~-~-~-~-~-~-~-~-~-~

 

* Charly Wilhelm

* Greg Williams

Link to comment
Share on other sites

This is a fantastic submission. We used to call this the "pulse" report back at another e-commerce company.

 

Anyway, from the installation instructions:

 

2) ADD the following line in admin/includes/application_top.php



define('FILENAME_SALES_REPORT', 'stats_sales_report.php');

 

..needs to be changed to:

 

2) ADD the following line in admin/includes/application_top.php



define('FILENAME_STATS_SALES_REPORT', 'stats_sales_report.php');

 

Then it works just fiiiiiiiiiine.

 

Also, I might add a "bi-weekly" report, to coincide with some of the third-party payment system schedules.

 

Thanks!

Link to comment
Share on other sites

Thanks for pointing out the Install gaffe. I've resubmitted with correct instructions. (That's the second time I've posted that same error :? )

 

I really wish the Contribution section allowed for edits...

 

Thanks, too, for the feedback. We're already looking into bi-weekly reporting... sort of. Specifically, Charly is planning to work in a user-defined date range for reports in addition to daily/weekly/monthly. That should allow maximum flexibility for all.

 

More to follow...

 

- Greg

Link to comment
Share on other sites

For those who don't want to wait until the next version:

 

To fix 2 minor graphing glitches:

 

In admin/stat_sales_report.php:

 

Change:

<?php

echo 'g.setXScaleValues("';

 for ($i = 0; $i < $report->size; $i++) {

 if ($sales_report_view == 4){

echo substr($report->info[$i]['text'] . $date_text[$i], 0,3);

 }else{

echo substr($report->info[$i]['text'] . $date_text[$i], 0,5);

 }

  if (($i+1) < $report->size) {

 echo '","';

  }

}

echo '");';

?>

to:

<?php

echo 'g.setXScaleValues("';

 for ($i = 0; $i < $report->size; $i++) {

 if ($sales_report_view == 4){

echo substr($report->info[$i]['text'] . $date_text[$i], 0,3);

 }else{

  if ($report->size > 5) {

echo substr($report->info[$i]['text'] . $date_text[$i], 3,2);

} else {

echo substr($report->info[$i]['text'] . $date_text[$i], 0,5);

}

 }

  if (($i+1) < $report->size) {

 echo '","';

  }

}

echo '");';

?>

 

Change:

$scale_x = ($sum / $report->size) / ($report->size);

to:

$scale_x = ($sum / $report->size) / 4;

 

Enjoy,

 

GDW

Link to comment
Share on other sites

Some other stats that might be nice.

 

Number of new customers per day/week/month/year.

 

Number of customer logins per day/week/month/year.

 

Number of orders per customer. (there is a report similar to this with the order totals, but I'm curious to know about my return customers and how many times they have come back.)

 

Thanks for this great contribution!!!

Link to comment
Share on other sites

I had version 0.7 working beautifully and thought it would be nice to upgrade to v1. I also made the additional mods (for those who couldn't wait for next version!) However, I now get a parse error:

 

Parse error: parse error in /home/virtual/site135/fst/var/www/html/catalog/admin/stats_sales_report.php on line 198

 

 

Have I screwed up somewhere or has anybody else had this error mesage?

Link to comment
Share on other sites

It means that you have made an error in your code structure. e.g. too many or not enough } " or ' or missing ; or wrong structure of an expression etc.

 

You could try posting the code around line 198 for more help.

Ian-san

Flawlessnet

Link to comment
Share on other sites

Version 1 now works fine, however I think it's the additional code that seems to be the problem. Everything works OK until I make the amendments to admin/stats_sales_report.php

 

line 196 is where the new code has been added:

 

<?php

echo 'g.setXScaleValues("';

? for ($i = 0; $i < $report->size; $i++) {

? if ($sales_report_view == 4){

echo substr($report->info[$i]['text'] . $date_text[$i], 0,3);

? }else{

? ?if ($report->size > 5) {

echo substr($report->info[$i]['text'] . $date_text[$i], 3,2);

} else {

echo substr($report->info[$i]['text'] . $date_text[$i], 0,5);

}

? }

? ?if (($i+1) < $report->size) {

? echo '","';

? ?}

}

echo '");';

?>

 

 

Any ideas?

Link to comment
Share on other sites

  • 6 months later...

Where or what is the /jsgraph?

 

NEW FILES: 

>> copy stats_sales_report.php to admin/ 

>> copy sales_report.php to admin/includes/classes/ 

>> copy contents of /jsgraph to NEW folder admin/jsgraph 

>> copy stats_sales_report.php to admin/includes/languages/english/ 

>> copy contents of /images to admin/images

 

I have searched the OSCommerce forum, inside the Sales Report contribution folder and my entire store but I found nothing.

 

Can anyone please help?

cheers,

 

Crimsontree

Link to comment
Share on other sites

  • 9 months later...
  • 1 year later...

i ve installed the last version availaible the Sales Report v1.2 + the patch , but i dont have any errors , and can't see any graph we can se included taht point at tibet collection screenshot ... is this the offcial thread ?

MS2

Link to comment
Share on other sites

  • 1 month later...
i ve installed the last version availaible the Sales Report v1.2 + the patch , but i dont have any errors , and can't see any graph we can se included taht point at tibet collection screenshot ... is this the offcial thread ?

 

 

Have we learned why the graph doesn't show up yet?

 

I have the link in the report section but when I click it I am taken to a blank page.

 

I'm puzzled.

Link to comment
Share on other sites

  • 3 weeks later...
i ve installed the last version availaible the Sales Report v1.2 + the patch , but i dont have any errors , and can't see any graph we can se included taht point at tibet collection screenshot ... is this the offcial thread ?

 

I'll try it once more...

I click on link in admin/reports but I do not see the graph. I get a blank page. What did I miss?

 

Kym

Link to comment
Share on other sites

  • 1 month later...

HI,

I installed the last sales report v1.3 and all went well.

 

I have a problem with the previous/next links on the weekly reports (and a few others).

Current weekly reports for this year show no previous link although they start at 29/1/2006 - so how do i see weekly reports for the previous weeks ?

 

I can actually go to the data by first showing monthly reports, then clicking through to January - then i see the weekly report for January - so the data is there. Just something to do with the way the 'previous' link is created. Not sure how to fix this yet.

Ive tried removing all checks for prev/next links so the links are always there - except now the missing prev link will go daily stats instead of january weekly stats so that hasnt helped much!

 

I have added some extra colums for shipping and tax - but these only work properly when i dont filter based on pending/processing/dispatched - when filtered the shipping and tax show as negative amounts due to the way i am calculating them from the sum. I will work some more on this and hopefully upload a new version of this great contrib.

 

Any help on the previous/next and filtering would be appreciated.

thanks

Regards

Mark Brindle

Link to comment
Share on other sites

  • 2 weeks later...

Hi, does anybody manage to get the labels/measure on the X axis to display?

 

I've just installed this contribution with the latest file v.1.3 from http://www.oscommerce.com/community/contributions,524

 

But I'm having problem here, the labels on the X axis doesn't show up. The labels on Y axis does show up though.

 

According to http://www.tibetcollection.com/images/sales_report.gif, the labels/measure on the X axis should show up (i.e. 0, 200, 400, 600).

 

Could anybody know what's wrong with that or maybe you don't have any problem with it at all?

Please please pleaseee help...

Link to comment
Share on other sites

  • 4 months later...
Great contribution.

Only bug I could find is the month of January missing from monthly analysis since v.08

 

It's still missing. Is there anyone to help with this contribution? Such a nice one, it deserved a little more attention.

 

I'm also having a problem with a client who has 10 orders status. I really don't know if that has anything to do with that, but since July 12 his report is showing only 0 for the daily sales, when he makes sales every single day.

 

Can somebody help with this nice contribution? :)

Patty

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...