Forums / Addon Admin Tools / Sales report 2.0

Sales report 2.0

Started by blindside on 29 Aug 2006, 2:41 AM · Views: 248,186

Results 661 to 680 of 882
8 Jun 2014, 1:58 AM
#661
southshorepizza avatar

southshorepizza

Zen Follower

Join Date:
Sep 2012
Posts:
253
Plugin Contributions:
0

Sales report 2.0

I'm not following you exactly but I think you are saying that your totals don't match correctly. If so you have the same problem I had. I ended up changing the table orders over to the table orders_total to pul the report. This made everything line up perfectly. The issue I saw was that this report recalculated every order. I have a bunch of attributes on every order and was off several dollars every day. By switching this to pull data from the other table instead of recalculating every order I eliminated this variance. It's been quite a while since I did this with help of others so I'm not 100% certain where we modified the original report. After it was correct I heavily modified it to give me a more detailed report for my specific needs. Orders_total is the table that the customer emailed receipt is saved to. So the data in that table is exactly what the customer pays from.
I think this is what you may need from the admin/includes/classes/sales_report.php

// pull shipping, discounts, tax, and gift certificates used from orders_total table
      $totals = $db->Execute("select * from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . $oID . "'");
      while (!$totals->EOF) {
        $class = $totals->fields['class'];
        $value = $totals->fields['value'];
        if ($class != "ot_total1" && $class != "ot_subtotal1") {
          if($class == "ot_gv") {
            $order_gc_used += $value;
            $this->timeframe[$id]['total']['gc_used'] += $value;
            $this->build_li_orders($oID, 'gc_used', $value);

            $this->timeframe[$id]['total']['gc_used_qty']++;
            $this->build_li_orders($oID, 'gc_used_qty', 1);
          }
          elseif ($class == "ot_coupon" || $class == "ot_group_pricing" || $class == "ot_better_together" || $class == "ot_reward_points" || $class == "ot_quantity_discount" || $class == "ot_gv") {  
            $order_discount += $value;
            $this->timeframe[$id]['total']['discount'] += $value;
            $this->build_li_orders($oID, 'discount', $value);

            $this->timeframe[$id]['total']['discount_qty']++;
            $this->build_li_orders($oID, 'discount_qty', 1);
          }
          elseif ($class == "ot_tip") {
            $order_discount += $value;
            $this->timeframe[$id]['total']['ot_tip'] += $value;
            $this->build_li_orders($oID, 'ot_tip', $value);

            $this->timeframe[$id]['total']['tip_qty']++;
            $this->build_li_orders($oID, 'tip_qty', 1);
          }
          elseif ($class == "ot_cashback") {
            $order_discount += $value;
            $this->timeframe[$id]['total']['discount'] += $value;
            $this->build_li_orders($oID, 'discount', $value);

            $this->timeframe[$id]['total']['discount_qty']++;
            $this->build_li_orders($oID, 'discount_qty', 1);
          }
          elseif ($class == "ot_tax") {
            $order_recorded_tax += $value;
            $this->timeframe[$id]['total']['order_recorded_tax'] += $value;
            $this->build_li_orders($oID, 'order_recorded_tax', $value);
          }
          elseif ($class == "ot_shipping") {
            $order_shipping += $value;
            $this->timeframe[$id]['total']['shipping'] += $value;
            $this->build_li_orders($oID, 'shipping', $value);
          }
          elseif ($class == "ot_subtotal") {
            $order_shipping += $value;
            $this->timeframe[$id]['total']['subtotal'] += $value;
            $this->build_li_orders($oID, 'subtotal', $value);
          }
          elseif ($class == "ot_total") {
            $order_shipping += $value;
            $this->timeframe[$id]['total']['totalsales'] += $value;
            $this->build_li_orders($oID, 'totalsales', $value);
          }
          // this allows for a custom discount, a la Super Orders
          elseif ($value < 0) {
            $order_discount += abs($value);
            $this->timeframe[$id]['total']['discount'] += abs($value);
            $this->build_li_orders($oID, 'discount', abs($value) );

            $this->timeframe[$id]['total']['discount_qty']++;
            $this->build_li_orders($oID, 'discount_qty', 1);
          }
        }

        $totals->MoveNext();
      }
3 Jul 2014, 6:02 PM
#662
wolfderby avatar

wolfderby

Zen Follower

Join Date:
Dec 2008
Location:
Pittsburgh, PA
Posts:
241
Plugin Contributions:
0

Re: Sales report 2.0

Thanks southshorepizza.

3 Jul 2014, 6:16 PM
#663
wolfderby avatar

wolfderby

Zen Follower

Join Date:
Dec 2008
Location:
Pittsburgh, PA
Posts:
241
Plugin Contributions:
0

Re: Sales report 2.0

So I've been trying to teach myself php using this add-on and I'm attempting to add product cost to the report (pulling from the product cost fields created by the profit margin calculator add-on for 1.3.9f) and I was able to integrate the product cost into the report for the product line stats. However, I'm unsure as to how to do the math to add a profit field line by line for each product.

I also don't know how to add the costs together for the timeframe total at the top of the product lines report.

Nor can I seem to figure out how to calculate total profit for each order because there isn't a total cost field in the database for each order, like a total rev and/or total sub-total. Should I attempt to add this database field and have it calculate in check out somehow, or have the script tabulate it?

Does anyone have any suggestions on how I might learn to do this, or the method I should go about trying to do this?

Thanks,
b

9 Sep 2014, 12:32 AM
#664
bbsbcastle avatar

bbsbcastle

New Zenner

Join Date:
Aug 2009
Location:
Greeneville, TN USA
Posts:
55
Plugin Contributions:
0

Re: Sales report 2.0

I know this is a bit old, but I was running into the same problem. The issue is, the report is deducting the sales tax from the product sales, which it should not.

In admin/includes/classes/sales_report.php line 385, I changed it from

$product_price_inc_tax = (zen_add_tax($final_price, $tax) * $quantity) + zen_add_tax($onetime_charges, $tax);

to

$product_price_exc_tax = ($product_price_inc_tax - $product_tax);

Now it calculates correctly. It's a quick hack, but it works. Someone could take the time to make a more elegant solution. I don't understand why it's doing this since Sales Tax is clearly additive to the total.

9 Sep 2014, 7:14 AM
#665
dysfunctional avatar

dysfunctional

Zen Follower

Join Date:
Apr 2008
Posts:
159
Plugin Contributions:
0

Re: Sales report 2.0

Hi wolfderby, I'm curious if you ever got anywhere with this? I've been misssing this feature for years, but I'm not really a programmer. I was thinking of installing the "Product Cost Display" (http://www.zen-cart.com/downloads.php?do=file&id=1444) or something similar to get my product costs into Zen Cart. Did you ever manage to get Sales Report to calculate the product costs correctly?

Best regards

Peter

wolfderby:

So I've been trying to teach myself php using this add-on and I'm attempting to add product cost to the report (pulling from the product cost fields created by the profit margin calculator add-on for 1.3.9f) and I was able to integrate the product cost into the report for the product line stats. However, I'm unsure as to how to do the math to add a profit field line by line for each product.

I also don't know how to add the costs together for the timeframe total at the top of the product lines report.

Nor can I seem to figure out how to calculate total profit for each order because there isn't a total cost field in the database for each order, like a total rev and/or total sub-total. Should I attempt to add this database field and have it calculate in check out somehow, or have the script tabulate it?

Does anyone have any suggestions on how I might learn to do this, or the method I should go about trying to do this?

Thanks,
b

6 Oct 2014, 2:24 PM
#666
popularcrustacean avatar

popularcrustacean

New Zenner

Join Date:
Dec 2013
Posts:
17
Plugin Contributions:
0

Re: Sales report 2.0

Not sure if anyone still checks up on this thread, but

I installed this add-on on my 1.5.1 installation, but when i click the "show me the money" button, nothing happens.
I've made sure i installed each file in its correct location (triple checked!), read through the readme again (i didnt complete any of the optional steps), and checked back about 15 pages in this thread.

Anyone have any idea whats going on?

6 Oct 2014, 8:11 PM
#667
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,139
Plugin Contributions:
56

Re: Sales report 2.0

PopularCrustacean:

Not sure if anyone still checks up on this thread, but

I installed this add-on on my 1.5.1 installation, but when i click the "show me the money" button, nothing happens.
I've made sure i installed each file in its correct location (triple checked!), read through the readme again (i didnt complete any of the optional steps), and checked back about 15 pages in this thread.

Anyone have any idea whats going on?
There's a checkbox just above "Show me the money" that defaults to checked (much to my chagrin) and causes the result of the report to open in a new window.

7 Oct 2014, 3:05 PM
#668
popularcrustacean avatar

popularcrustacean

New Zenner

Join Date:
Dec 2013
Posts:
17
Plugin Contributions:
0

Re: Sales report 2.0

lat9:

There's a checkbox just above "Show me the money" that defaults to checked (much to my chagrin) and causes the result of the report to open in a new window.

Whether the "open in a new window" box is checked or not, nothing happens.
I tried disabling all my add-ons, that didnt work. I also tried it in firefox as well as chrome, neither works.

7 Oct 2014, 3:08 PM
#669
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,139
Plugin Contributions:
56

Re: Sales report 2.0

Any debug-log files in your /logs directory?

8 Oct 2014, 4:25 PM
#670
engkiat avatar

engkiat

New Zenner

Join Date:
Sep 2014
Location:
Singapore, Singapore
Posts:
6
Plugin Contributions:
0

Re: Sales report 2.0

Good day,
This is a great plugin for sales reporting, but can i ask how i can add data from "Product Line Items" (namely Product Name and Model No. ) into the "Order Line Items" for CSV output?

Many thanks!
EngKiat

9 Oct 2014, 11:16 AM
#671
engkiat avatar

engkiat

New Zenner

Join Date:
Sep 2014
Location:
Singapore, Singapore
Posts:
6
Plugin Contributions:
0

Re: Sales report 2.0

Any help please.. Thanks!

9 Oct 2014, 3:07 PM
#672
southshorepizza avatar

southshorepizza

Zen Follower

Join Date:
Sep 2012
Posts:
253
Plugin Contributions:
0

Re: Sales report 2.0

EngKiat:

Any help please.. Thanks!

If you look at the file in the classes folder at line 879 you will see it includes the CSV output. You will need to modify that section to include the exact data you are looking to get.

5 Nov 2014, 7:16 PM
#674
southshorepizza avatar

southshorepizza

Zen Follower

Join Date:
Sep 2012
Posts:
253
Plugin Contributions:
0

Re: Sales report 2.0

d0ugparker:

Can Sales Report be easily modified to
sort based on Country-Shipped-To?

Dr Doug

Please see the three posts prior to yours. Instead of looking for CSV you will do it outside of CSV.

31 Dec 2014, 4:10 PM
#675
joew36 avatar

joew36

New Zenner

Join Date:
Feb 2010
Location:
Vermont, USA
Posts:
21
Plugin Contributions:
0

Re: Sales report 2.0

I've suddenly started getting a blank page when trying to view the sales report by product line items or order line items for a month.

I'm using Zen 1.3.9 (working on the upgrade)
Sales Report 2.3.2

I've tried boosting the execution time up to 2400 from 600 and it still happens.

It works for Today or Yesterday or a range of dates as long as the range is less than a month.

I just downloaded the original mod to compare it to the files on my server and they are the same. No modifications or updates had been done close to the time this started happening.

The site is nearly 5 years old with lots of orders and products. There are over 70,000 entries in the orders table and over 300,000 in the orders_products.

31 Dec 2014, 5:10 PM
#676
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Sales report 2.0

joew36:

I've suddenly started getting a blank page when trying to view the sales report by product line items or order line items for a month.

I'm using Zen 1.3.9 (working on the upgrade)
Sales Report 2.3.2

I've tried boosting the execution time up to 2400 from 600 and it still happens.

It works for Today or Yesterday or a range of dates as long as the range is less than a month.

I just downloaded the original mod to compare it to the files on my server and they are the same. No modifications or updates had been done close to the time this started happening.

The site is nearly 5 years old with lots of orders and products. There are over 70,000 entries in the orders table and over 300,000 in the orders_products.

Blank page = Error log

What does the error log you are getting say????

My Site - Zen Cart & WordPress integration specialist
I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

31 Dec 2014, 5:59 PM
#677
joew36 avatar

joew36

New Zenner

Join Date:
Feb 2010
Location:
Vermont, USA
Posts:
21
Plugin Contributions:
0

Re: Sales report 2.0

That took some looking, 500 server error.

31 Dec 2014, 6:19 PM
#678
darkangel avatar

darkangel

Totally Zenned

Join Date:
Oct 2007
Location:
Emporia, Kansas
Posts:
1,729
Plugin Contributions:
0

Re: Sales report 2.0

joew36:

That took some looking, 500 server error.

Is that what the error files in the cache folder are telling you.

I do know that the Edit mod is misbehaving a bit in our version of store---not in the use but it also coughs up an error and I have to clear the cache folder nearly every day just to get rid of them.

It might just be due to our store version, not sure, but I have no intention of upgrading until all mods we use are going to work properly too, thus far they do not...in our case and a few fresh installs that I have made.

31 Dec 2014, 7:54 PM
#679
joew36 avatar

joew36

New Zenner

Join Date:
Feb 2010
Location:
Vermont, USA
Posts:
21
Plugin Contributions:
0

Re: Sales report 2.0

That's from the top level server log files, in real time. I tried running the report while viewing the error log.

1 Jan 2015, 4:08 AM
#680
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Sales report 2.0

joew36:

That's from the top level server log files, in real time. I tried running the report while viewing the error log.

well it sounds like there is an issue with your server which is preventing the report from completing..

My Site - Zen Cart & WordPress integration specialist
I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.