Community Add-Ons
Margin Report v1.00
for osCommerce Online Merchant v2.2
This is a module that will allow you to see a full report on the margin of all of your products. You now enter the cost of the good (in the admin) when you are entering or editing products.
From there this report allows you to sort out your products, in the report, by Product name, cost, price, specials price, margin dollars, and margin percentage.
Hope you like it.
-Chris
Legend:
Download
Report
FULL PACKAGE with Discount coupon addons
________________________________________
Marge net et brute définie pour les utilisateurs de discount coupon (si vous utilisez un autre module il suffit de remplacer la class "ot_discount_coupon" dans le fichier margin_report2 et de le remplacer par votre class
date ok
Pack complet
DON'T USE PREVIOUS VERSION FROM ME PREFER THIS ONE
FORGOT MY PREVIOUS UPLOAD
Same package as previous with all corrections for french translation and format date
FULL PACKAGE FRENCH ONLY
-------------------------
MON PREMIER UPLOAD A UNE ERREUR SUR LES DATES
Même pack que le précédent avec corrections de traduction et traduction manquante.
Correction du format date
Package complet Langues Français uniquement
DATE CORRIGEES
Same package as previous with all corrections for french translation and format date
FULL PACKAGE FRENCH ONLY
-------------------------
Même pack que le précédent avec corrections de traduction et traduction manquante.
Correction du format date
Package complet Langues Français uniquement
I have found an error in the file that calculates sale statistics. In some SELECT they have been used in way not corrected the table names. This rar contains only the correct file.
Updated version:
I made the order number clickable to link to the order details directly.
If you're upgrading, you should be OK with replacing files, but as always backup and compare.
Full package.
This is a new, updated version that now allows:
- per order percentage margin
- filtering based on order status
I think that it is real important to see margin per order as there might be a combination of products or conditions (vouchers, delivery charges) that can cause you loss. Also, the product status filter - if we run reports, we are not interested in canceled or test orders are we? Thus the filter.
This full package contains all updates and fixes below such as:
Gross Profit Calculation
MySQL5
Error in order.php
If you decide to improve or amend anything, please use this latest version to make sure that you work with the latest, fixed report files. I hope that I've not missed anything, if I did, I'm sorry but I have very limited time to do any coding or contribution improvements.
If you're upgrading, you should be OK with replacing files, but as always backup and compare.
Support: http://forums.oscommerce.com/index.php?showtopic=99144&st=40
Thanks Chris! This Contrib is great!
Change for MarginReport2.php to make the cost portion work so that it actually calculated Gross Profit
Enjoy!
Find:
$prods_query = mysql_query("select products_id, products_price, products_cost, products_quantity from orders_products where orders_id = '" . $o[$i] . "'");
Replace With:
$prods_query = mysql_query("select op.products_id, op.products_price, op.products_quantity, p.products_cost from orders_products op, products p where op.orders_id = '" . $o[$i] . "' and op.products_id = p.products_id");
This update is for 2.56b
The /admin/margin_report.php file had some SQL queries which were incompatible with PHP 5 and caused the infamous 1054 - Unknown column 'p.products_id' in 'on clause' error
Attached is the PHP5 compatible file.
After installing 2.56a, I came across an error in Order.php when a customer viewed their order information from the My Account page. As this contribution was the only one I had installed that editted /catalog/includes/classes/order.php I had a close look at the intall instructions and found the problem.
/catalog/includes/classes/order.php
Find:
$orders_products_query = tep_db_query("select orders_products_id, products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'");
while ($orders_products = tep_db_fetch_array($orders_products_query)) {
$this->products[$index] = array('qty' => $orders_products['products_quantity'],
'id' => $orders_products['products_id'],
'name' => $orders_products['products_name'],
'model' => $orders_products['products_model'],
'tax' => $orders_products['products_tax'],
'price' => $orders_products['products_price'],
'final_price' => $orders_products['final_price']);
Replace With:
$orders_products_query = tep_db_query("select orders_products_id, products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'");
while ($orders_products = tep_db_fetch_array($orders_products_query)) {
$this->products[$index] = array('qty' => $orders_products['products_quantity'],
'id' => $orders_products['products_id'],
'name' => $orders_products['products_name'],
'model' => $orders_products['products_model'],
'tax' => $orders_products['products_tax'],
'price' => $orders_products['products_price'],
'cost' => $orders_products['products_cost'],
'final_price' => $orders_products['final_price'],
The last line of the replacement:
'final_price' => $orders_products['final_price'],
Should actually be:
'final_price' => $orders_products['final_price']);
The attached file is the install instructions with this change.
Thanks for the extra updates everyone. In this file there was no code for the extra report popups in 2.56b. The code:
$options = array();
$options[] = array('id' => 'all', 'text' => TEXT_SELECT_REPORT);
$options[] = array('id' => 'daily', 'text' => TEXT_SELECT_REPORT_DAILY);
$options[] = array('id' => 'weekly', 'text' => TEXT_SELECT_REPORT_WEEKLY);
$options[] = array('id' => 'monthly', 'text' => TEXT_SELECT_REPORT_MONTHLY);
$options[] = array('id' => 'quarterly', 'text' =>
TEXT_SELECT_REPORT_QUARTERLY);
$options[] = array('id' => 'semiannually', 'text' => TEXT_SELECT_REPORT_SEMIANNUALLY);
$options[] = array('id' => 'annually', 'text' => TEXT_SELECT_REPORT_ANNUALLY);
echo tep_draw_pull_down_menu('report_id', $options, (isset($_GET['report_id']) ? $_GET['report_id'] : '1'), 'onchange="this.form.submit()"');
echo '</form></td>' . "n";
}
Should look like this:
$options = array();
$options[] = array('id' => 'all', 'text' => TEXT_SELECT_REPORT);
$options[] = array('id' => 'daily', 'text' => TEXT_SELECT_REPORT_DAILY);
$options[] = array('id' => 'yesterday', 'text' => TEXT_SELECT_REPORT_YESTERDAY);
$options[] = array('id' => 'weekly', 'text' => TEXT_SELECT_REPORT_WEEKLY);
$options[] = array('id' => 'lastweek', 'text' => TEXT_SELECT_REPORT_LASTWEEK);
$options[] = array('id' => 'monthly', 'text' => TEXT_SELECT_REPORT_MONTHLY);
$options[] = array('id' => 'lastmonth', 'text' => TEXT_SELECT_REPORT_LASTMONTH);
$options[] = array('id' => 'quarterly', 'text' =>
TEXT_SELECT_REPORT_QUARTERLY);
$options[] = array('id' => 'semiannually', 'text' => TEXT_SELECT_REPORT_SEMIANNUALLY);
$options[] = array('id' => 'annually', 'text' => TEXT_SELECT_REPORT_ANNUALLY);
echo tep_draw_pull_down_menu('report_id', $options, (isset($_GET['report_id']) ? $_GET['report_id'] : '1'), 'onchange="this.form.submit()"');
echo '</form></td>' . "n";
}
Hope this helps some one :) Enjoy!
The last post has the right file attatched same as this one but i forgot to include the correct path to the file:
it is: admin/includes/languages/english/margin_report.php
Sorry only my second contribution submittal, hope this helps :)
Just thought this would help, i found some undefined text in the drop down box of the Margin Report Screen.
Compare to your if you have this problem:
define('TEXT_SELECT_REPORT', 'Please select a report');
define('TEXT_SELECT_REPORT_DAILY', 'Daily');
define('TEXT_SELECT_REPORT_YESTERDAY', 'Yesterday');
define('TEXT_SELECT_REPORT_WEEKLY', 'Weekly');
define('TEXT_SELECT_REPORT_LASTWEEK', 'Last Week');
define('TEXT_SELECT_REPORT_MONTHLY', 'Monthly');
define('TEXT_SELECT_REPORT_LASTMONTH', 'Last Month');
define('TEXT_SELECT_REPORT_QUARTERLY', 'Quarterly');
define('TEXT_SELECT_REPORT_SEMIANNUALLY', 'Semi-annually');
define('TEXT_SELECT_REPORT_ANNUALLY', 'Annually');
define('TEXT_REPORT_HEADER', 'This report is for all orders. ');
define('TEXT_REPORT_HEADER_FROM_DAY', 'This report is for the day beginning: ');
define('TEXT_REPORT_HEADER_FROM_YESTERDAY', 'This report is for yesterday. ');
define('TEXT_REPORT_HEADER_FROM_WEEK', 'This report is for the week beginning: ');
define('TEXT_REPORT_HEADER_FROM_LASTWEEK', 'This report is for last week. ');
define('TEXT_REPORT_HEADER_FROM_MONTH', 'This report is for the month beginning. ');
define('TEXT_REPORT_HEADER_FROM_LASTMONTH', 'This report is for last month. ');
define('TEXT_REPORT_HEADER_FROM_QUARTER', 'This report is for the quarter beginning: ');
define('TEXT_REPORT_HEADER_FROM_SEMIYEAR', 'This report is for the semi-year beginning: ');
define('TEXT_REPORT_HEADER_FROM_YEAR', 'This report is for the year beginning: ');
define('TEXT_REPORT_BETWEEN_DAYS', 'This report is for the dates between ');
New margin_report.php to comply with latest mysql version
solves [1064] error when opening page in admin.
This only contains the updated margin_report.php file, simple replace in your admin folder
please visit the forum discussion at:
http://forums.oscommerce.com/index.php?showtopic=99144&st=40
text file installation instruction here. Hope this will ease those who wanna install this great contribution and continue the support for it.
Complete Files.
Update of the documentation of the version2.56.
Multi language.
French Addition
-----------------
Mise a jour de la documentation de la version2.56.
Multi langue.
Ajout Français
This is a patch to add several reports to the on screen popup. Reports for "Yesterday", "Last Week" and "Last Month" are added. Everything else is the same. This patch requires that v2.56 already be installed and running
Bugfix (based on contributions by vaughnn) & re-consolidate and fixes installation instructions.
No functionality has been changed
* Removed all static English texts in margin_report2.php to language file to make easier to translate to other languages.
* Turkish translation is included with this package.
All Credits go to original creator - Chris.
- Changed to fix some bugs that was fixed in v2.10b but not reflected in v2.51.
- Removed donation buttons for those who find it redundant
- Fixed 2nd export button not showing up in margin_report2.php.
Fixed 2 small errors in installation instructions.
Fixed the export image problem.
I think you all will really like this...as it's got a lot more to it than the past releases.
Now reports can be made for various periods based on preset values (daily, weekly, monthly, quarterly, semi-annually, annually) as well as any dates you would like (you can select a start date and an end date).
These reports can now be automatically downloaded to your local machine (instead of the server) as excel files. Hope everyone likes it...I have also added a donations button. If you find this contribution useful and would like to make a donation...the means are now there.
Fixes semi-annual issues and all font issues.
The install file had several problems with it (at least from my version). This is ONLY THE INSTALL TEXT FILE.
This fixes the weekly bug as well as the semi-annual timeframe.
Fixed serveral bugs in admincatagories.php and adminincludeslanguagesenglishcatagories.php as well as some cleanup on the installation instructions and rename the file to installation v2.10d.txt
Fixes History v2.10b
- added TEXT_PRODUCTS_PRICE_COST variable which is missing
- added TEXT_PRODUCTS_COST_INFO variable which was wrongly defined
- changed the "tep_draw_input_field('products_price', $pInfo->products_cost," to "tep_draw_input_field('products_cost', $pInfo->products_cost," which is wrongly written and resulted in wrong field being updated.
-etc....
Error in Installation Instructions.txt file, on the admincategories.php find and replace, whereby the 2nd find and replace has a wrong find statements that do not exists at all (the statement is exactly the same as the statement to replace with).
Corrected the Installation Instructions.txt and uploaded it.
Creator or someone, please consolidate all those errors in v2.10x and recompile and package into a new version.
First , I would like to say Chris did an alswome job with this contribution. Thanks Chris! This Contrib is great!
Changes from v2.10 to v2.10b
The packaging of v2.10 was really confusing it had duplicate files and a weird folder that had updated files in it, instead of them being in the right place. It also had two installation files and in the installation file it had repeated instructions in 2-3 places. Also there was a bad command in the /admin/margin_report.php file causing the image of the export button not show up.
I have fixed these problems. I repacked the contrib, removed all repeated files and instructions, and fixed the image not showing up problem.
Fixed currency issue. Now will work with default currency type.
Also fixed location of export button
This now includes reports based on daily, weekly, monthly, quarterly, semi-annually, and annually cumulated orders.
This also now saves all exported files on the remote server, which can then be downloaded locally.
Support Thread:
http://forums.oscommerce.com/index.php?showtopic=98823
Hope you like it.
Nothing huge here at all - in fact quite simple. I have only made a slight change from Chris and Patricks most recent version. In the file 'margin_report.php' which goes into the admin dir - I have simply added a 'class="smallText"' into the appropriate place on a <td> so that the report matches the rest of the admin panel. Took me awhile to figure out where it belonged to get it to look right - so I figured I'd save the next person some trouble.
Thanks Chris, for an outstanding contribution.
some bugs in 1.10, pulldown for manufacturers didn't work and I had the gros price in product entry didn't work anymore.
Also there were some doubles in the changefile.
Now the module works like I think it should.
Added export to csv functionality.
Also added the ability to sort by manufacturer.
This is a module that will allow you to see a full report on the margin of all of your products. You now enter the cost of the good (in the admin) when you are entering or editing products.
From there this report allows you to sort out your products, in the report, by Product name, cost, price, specials price, margin dollars, and margin percentage.
Hope you like it.
-Chris
