zzfritz Posted December 8, 2002 Share Posted December 8, 2002 I just posted an extended version of the income summary report: http://www.oscommerce.com/downloads.php/co...ions,776/type,3 New features in this version: open report in printer-friendly window; download file of report data in CVS (comma separated values) for import to spreadsheet tools; help screen; optional columns for loworder fee and gift vouchers only if features enabled. Quote Link to comment Share on other sites More sharing options...
zzfritz Posted December 8, 2002 Author Share Posted December 8, 2002 Thanks to some testers a couple bugs have been discovered in this release. First, you need to create this stylesheet for the printer friendly page, at admin/includes/printer.css: body { background-color: #ffffff; color: #000000; margin: 0px; } .pageHeading { font-family: Verdana, Arial, sans-serif; font-size: 18px; color: #000000; font-weight: bold; } .dataTableHeadingRow { background-color: #ffffff; } .dataTableHeadingContent { font-family: Verdana, Arial, sans-serif; font-size: 11px; color: #000000; font-weight: bold; } .dataTableRow { background-color: #ffffff; } .dataTableContent { font-family: Verdana, Arial, sans-serif; font-size: 11px; color: #000000; } .smallText { font-family: Verdana, Arial, sans-serif; font-size: 11px; } .main { font-family: Verdana, Arial, sans-serif; font-size: 11px; } Also, a dummy file needs to be created at admin/temp.csv which gets deleted as a housekeeping matter; the revision will check for it before trying to delete it. Finally, non-IE browsers are finding a javascript error. This will have to be fixed in a revision, which should be ready within the next day. Quote Link to comment Share on other sites More sharing options...
zzfritz Posted December 8, 2002 Author Share Posted December 8, 2002 Okay, the corrections are made and the printer.css included in the package: http://www.oscommerce.com/downloads.php/co...ions,777/type,3 If your admin directory has file restrictions, be aware that this script creates a temporary file and may need to be given permissions dependent on the nature of your configuration and security protocol. Quote Link to comment Share on other sites More sharing options...
Tato Posted December 8, 2002 Share Posted December 8, 2002 I have installed the last 1.4 but I get allways this error message: Warning: Unlink failed (Permission denied) in /home/........../www/html/admin/stats_monthly_sales.php on line 414 the attribute for file "temp.csv" are 777 , where can be the problem ? Thanks Tato Quote Link to comment Share on other sites More sharing options...
ozstar Posted December 8, 2002 Share Posted December 8, 2002 Hi there, Yes I get the same result. I also checked the temp.csv file is 777. Prints out fine except with that 'Perm denied' error message on it Thanks Fritz this is a great addition and I'm sure this is just a little flea bug! best, ozstar Quote Link to comment Share on other sites More sharing options...
Guest Posted December 8, 2002 Share Posted December 8, 2002 depending on your OS , some will not accept to write in the a directory like admin where there is an htaccess file which could restrict permissions (even if you add a dummy file and try to put 777 permissions on it) a fast workaraound is the following create in catalog/configure.php a line like define('DIR_FS_TMP', DIR_FS_DOCUMENT_ROOT . 'tmp/'); // where a tmp writable directory is located on the server. if $DOCUMENT_ROOT doesnt suit you, replace with your local path. (eg, /usr/local/apache/htdocs) you normally have PUB or TMP defined as a writable directory In the report , add the DIR_FS_TMP before the name of the file this way you will not write anything in the admin directory and it should work it works for me. just make sure the writable directory you choose is Really a writable directory. Quote Link to comment Share on other sites More sharing options...
asim0s Posted December 9, 2002 Share Posted December 9, 2002 well i get the same error also but i just commented the line out and it still works Quote Link to comment Share on other sites More sharing options...
asim0s Posted December 9, 2002 Share Posted December 9, 2002 this addition simply rules makes my life alot easier Quote Link to comment Share on other sites More sharing options...
ozstar Posted December 9, 2002 Share Posted December 9, 2002 What was the actual line you deleted and in exactly what dir/file. Thank you both I'll give both a whirl.. Have a good day Quote Link to comment Share on other sites More sharing options...
asim0s Posted December 9, 2002 Share Posted December 9, 2002 // done with report body // save CSV as file if ($num_rows>0) { if (file_exists('temp.csv')) //unlink('temp.csv'); here is the commented line $f=fopen('temp.csv','w'); fwrite($f,$csv_accum); fclose($f); } ?> and it works guys Quote Link to comment Share on other sites More sharing options...
asim0s Posted December 9, 2002 Share Posted December 9, 2002 /httpdocs/catalog/admin/stats_monthly_sales.php Quote Link to comment Share on other sites More sharing options...
dreamscape Posted December 9, 2002 Share Posted December 9, 2002 great contribution! much thanks. Quote The only thing necessary for evil to flourish is for good men to do nothing - Edmund Burke Link to comment Share on other sites More sharing options...
ozstar Posted December 9, 2002 Share Posted December 9, 2002 Yes thank you all. Commenting out that line, did the job. Regards from a very smokey Sydney!! ozstar Quote Link to comment Share on other sites More sharing options...
zzfritz Posted December 9, 2002 Author Share Posted December 9, 2002 Okay, folks, the unlink call was unnecessary anyway and is removed in the latest post which should be more host-friendly: http://www.oscommerce.com/downloads.php/co...ions,779/type,3 (I sure wish we could axe the deadwood contributions that litter the list in situtations like this ... ) Quote Link to comment Share on other sites More sharing options...
Frying Posted December 9, 2002 Share Posted December 9, 2002 I still get this error on top when I hit "Monthly Sales & Tax". For the rest it looks to be working fine! 0.00 Warning: fopen("temp.csv", "w") - Permission denied in /home/frying/html/catalog/admin/stats_monthly_sales.php on line 416 Warning: fwrite(): supplied argument is not a valid File-Handle resource in /home/frying/html/catalog/admin/stats_monthly_sales.php on line 417 Warning: fclose(): supplied argument is not a valid File-Handle resource in /home/frying/html/catalog/admin/stats_monthly_sales.php on line 418 Anyone got an idea? Fry. Quote Link to comment Share on other sites More sharing options...
ozstar Posted December 9, 2002 Share Posted December 9, 2002 There is a post on the 1st page of this thread with the answer. I had the same problem and just // commented out 1 line and it works beautifully. If you have the new version he posted in the pots bfeore yours, I believe you do not need to do anything as he kindly fixed it all. Good luck. Ozstar Quote Link to comment Share on other sites More sharing options...
Tato Posted December 9, 2002 Share Posted December 9, 2002 i have installed tha last contrib (with patch) and it works !! but i see in the top of header, over the months, this: 0.00 what is it ? is it possible to remove it ? all the best Tato Quote Link to comment Share on other sites More sharing options...
zzfritz Posted December 9, 2002 Author Share Posted December 9, 2002 Tato, I just reviewed the code and you encountered an error that only affects sites that have disabled the low order fee. In admin/stats_monthly_sales.php v.1.4a, change lines 395-399 from <?php if ($loworder) { ?> <td class="dataTableHeadingContent" width='70' align="right"> <?php }; ?> <?php mirror_out(number_format($ytd_loworder,2)); ?> </td> to <?php if ($loworder) { ?> <td class="dataTableHeadingContent" width='70' align="right"> <?php mirror_out(number_format($ytd_loworder,2)); ?> </td> <?php }; ?> Quote Link to comment Share on other sites More sharing options...
Tato Posted December 9, 2002 Share Posted December 9, 2002 Great !!! thank you, now works very well !!! Bye Tato Quote Link to comment Share on other sites More sharing options...
dilirum Posted December 9, 2002 Share Posted December 9, 2002 First of all this is a great contribution. Nice work on it. I have installed 1.4a which prints out my monthly totals fine - but I still get the errors on line 416,417 & 418. I have checked my file to ensure that it does not have the above mentioned "not needed" code that was causing problems. It seems fine there. If I delete out lines 416-18 no errors. Of course I can't download my csv file though... which would be VERY useful to me. When I try I simply get "file not found". Any suggestions? Quote Link to comment Share on other sites More sharing options...
zzfritz Posted December 9, 2002 Author Share Posted December 9, 2002 The pesky bit of code that is causing delirium :wink: and other bad reactions just saves the CSV data to a temporary file for download. I was unaware how much variation there is among servers in the behavior of the "unlink()" function that deletes files, and since it did not cause a fatal error on my Unix/Linux server, the original code deleted the file on every execution. That caused an error on some servers if the file did not exist, so I revised the code to check for the existence of the file before deleting it: if ($num_rows>0) { if (file_exists('temp.csv')) unlink('temp.csv'); $f=fopen('temp.csv','w'); fwrite($f,$csv_accum); fclose($f); } On some servers this will work okay if you remove the second line altogether, and the code just overwrites the file if it is there. Some other servers give an error if you try to overwrite the file, and still others require tweaking to get write permission at all. This is my first experience with the oddities of server file system treatment of PHP file functions. If anyone has a suggestion for universal bullet proof code, I'd love to see it. Quote Link to comment Share on other sites More sharing options...
Adam Posted December 10, 2002 Share Posted December 10, 2002 Does this mod only work on the new checkout csv? I have installed it on a sept 02 release and while I get the table set up correctly on stats_monthly_sales.php there are no entries I just geta message : No income found for this date/status selection Help? If it is just for new checkout csv can the sql be rejigged for old style or am I wasting my time? Quote /* Intellectual property: are you for or against the human race? */ if ( you want exclusive ownership of an idea ) { keep your idea to yourself; // you greedy bastard } Link to comment Share on other sites More sharing options...
dilirum Posted December 10, 2002 Share Posted December 10, 2002 Thanks a lot Fritz. I'll give this one a shot. And again - thanks for a very useful and needed contribution. Quote Link to comment Share on other sites More sharing options...
Adam Posted December 10, 2002 Share Posted December 10, 2002 Fritz, you might want to revisit some bugs on this cont. I have replaced both code snippets and can't get rid of the 0.00 at the top of the page, nor get csv working. The original problem that I had is down to having ot_subtotal disabled in admin, I don't need it and it confuses customers in the UK where we have enought vat/tax issues and clarity of pricing wins. The sql query to get the orders uses a conditional where ot.class = ot_subtotal, essentially. If its disabled you get blanks. Much needed cont needs some tlc. Quote /* Intellectual property: are you for or against the human race? */ if ( you want exclusive ownership of an idea ) { keep your idea to yourself; // you greedy bastard } Link to comment Share on other sites More sharing options...
zzfritz Posted December 10, 2002 Author Share Posted December 10, 2002 This contribution does indeed assume that the subtotal is used, and furthermore, that the subtotal has been set up as the sum of product sales and does not include the additional elements of tax, shipping, loworder and voucher. Given the many possible alternatives for the composition of order total, it may not be feasible to anticipate them all and implement the report to be universally adaptable. Although it might have been apparent from calling the contribution a "Sales & Tax" report, and emphasizing in the description that it distinguishes taxable from exempt sales on the basis of the store zone, perhaps I should announce more explicitly that it is only useful for those of us in the provinces. Sorry, mate. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.