Jump to content

chaicka

Members
  • Content count

    55
  • Joined

  • Last visited

  1. chaicka

    Margin Report v2.10

    This was built to calculate gross profit...not net. Obviously I don't know what everyone is paying in credit card fees, etc....but I can look into integrating some additional variables that you can define during installation that may take care of these issues. Great work pal on this contribution. I juz help out to keep things intact and organised... No offense but I feel that we do not need new features right now. What we need is to improve on the existing codes, and bugfixing. For genuine full accounting aspects, owners of online stores should either get a proper accountant and accounting practises that is approved by auditors, not contributions of osC, which is just to aid in the work automation and reduction, not as a replacement. There are still some functionality in margin_report2.php that ain't working well. So let's focus on this first. Eg. if there are orders that were cancelled, it still shows in the margin report right? We need to exclude cancelled orders, without having to delete the order itself cause in real world practises, all orders should be retain and auditable.
  2. chaicka

    Margin Report v2.10

    Guys, I have compiled the bugfixes contributed by vaughnn, fixed the duplicated installation instructions, reconsolidate and uploaded as v2.56. http://www.oscommerce.com/community/contributions,1594 I hope this cleans up some of the issues reported so far. Do let us noe if there is anymore bugs found. Thank You.
  3. chaicka

    Margin Report v2.10

    FIND // products price $product_query = tep_db_query("select products_id, products_price, products_tax_class_id, products_weight from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'"); if ($product = tep_db_fetch_array($product_query)) { $prid = $product['products_id']; $products_tax = tep_get_tax_rate($product['products_tax_class_id']); $products_price = $product['products_price']; $products_weight = $product['products_weight']; REPLACE WITH // products price $product_query = tep_db_query("select products_id, products_price, products_tax_class_id, products_weight from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'"); if ($product = tep_db_fetch_array($product_query)) { $prid = $product['products_id']; $products_tax = tep_get_tax_rate($product['products_tax_class_id']); $products_price = $product['products_price']; $products_cost = $product['products_cost']; $products_weight = $product['products_weight']; I am unable to locate this in /includes/classes/order.php
  4. Damn.....I found a mistake I made. Look for this line in account_edit.php: if ($is_read_only == false || (strstr($PHP_SELF,'create_account')) ) { It should be if ($is_read_only == false || (strstr($PHP_SELF,'account_edit')) ) { Hope this close up any minor typo bugs.....anyone wanna re-release it as v2.1b? If not, I will leave it open as it is, and to be updated by the next release or the next person who comes up with new features to add on to it.
  5. Pardon me. If u use web editor to edit your .php files, most likely you will get problem. I think it got something to do with web editing adding something to the end of the file. Use tools like dreamweaver or others to edit remotely, else, edit it locally and upload to your hosting.
  6. Fixes in v2.1a (based on v2.0 and v2.1): 1. Original install.txt from v2.0 is incomplete, whereby the final portion of the code for account_edit.php is missing, thus will not display the validation portion when user edit account. 2. Reduce redundant codes for both create_account.php and account_edit.php changes which starts with the following line: <!-- BOF ANTI ROBOT REG--> ___________________________________________________________________ Original v2.0/2.1 Code for create_account.php <!-- BOF ANTI ROBOT REG--> <?php if ( (ACCOUNT_VALIDATION == 'true' && strstr($PHP_SELF,'create_account') && ACCOUNT_CREATE_VALIDATION == 'true' ) || (ACCOUNT_VALIDATION == 'true' && strstr($PHP_SELF,'account_edit') && ACCOUNT_EDIT_VALIDATION == 'true' )) { ?> <tr> <td class="main"><b><?php echo CATEGORY_ANTIROBOTREG; ?></b></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> <tr class="infoBoxContents"> <td><table align="center" border="0" cellspacing="2" cellpadding="2"> <tr> <?php if ( (ACCOUNT_VALIDATION == 'true' && strstr($PHP_SELF,'create_account') && ACCOUNT_CREATE_VALIDATION == 'true' ) || (ACCOUNT_VALIDATION == 'true' && strstr($PHP_SELF,'account_edit') && ACCOUNT_EDIT_VALIDATION == 'true' )) { if ($is_read_only == false || (strstr($PHP_SELF,'create_account')) || (strstr($PHP_SELF,'account_edit')) ) { $sql = "DELETE FROM " . TABLE_ANTI_ROBOT_REGISTRATION . " WHERE timestamp < '" . (time() - 3600) . "' OR session_id = '" . tep_session_id() . "'"; if( !$result = tep_db_query($sql) ) { die('Could not delete validation key'); } $reg_key = gen_reg_key(); $sql = "INSERT INTO ". TABLE_ANTI_ROBOT_REGISTRATION . " VALUES ('" . tep_session_id() . "', '" . $reg_key . "', '" . time() . "')"; if( !$result = tep_db_query($sql) ) { die('Could not check registration information'); } ?> <tr> <td class="main"><table align="center" border="0" width="100%" cellspacing="0" cellpadding="2" class="formArea"> <tr> <td class="main"><table border="0" cellspacing="0" cellpadding="2"> <tr> <td class="main" width="50%" NOWRAP><span class="main"> <?php echo ENTRY_ANTIROBOTREG; ?></span></td> <td class="main" width="50%" align="left"> <?php if ($entry_antirobotreg_error == true) { ?> <span> <?php $validation_images = ''; for($i = 0; $i < ENTRY_VALIDATION_LENGTH; $i++) { $validation_images .= tep_image(DIR_WS_IMAGES . 'validation/validation_' . $reg_key{$i} . '.gif') . ''; } echo $validation_images . ' <br> '; echo tep_draw_input_field('antirobotreg') . ' <br><b><font color="red">' . ERROR_VALIDATION . '<br>' . $text_antirobotreg_error . '</b></font>'; } else { ?> <span> <?php $validation_images = ''; for($i = 0; $i < ENTRY_VALIDATION_LENGTH; $i++) { $validation_images .= tep_image(DIR_WS_IMAGES . 'validation/validation_' . $reg_key{$i} . '.gif') . ''; } echo $validation_images . ' <br> '; ?> <?php echo tep_draw_input_field('antirobotreg', $account['entry_antirobotreg']) . ' ' . ENTRY_ANTIROBOTREG_TEXT; ?> </span> <?php } ?> </td> </tr> </table></td> </tr> </table></td> </tr> <?php } ?> <?php } ?> </tr> </table></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php } ?> <!-- EOF ANTI ROBOT REG--> New v2.1a Code for create_account.php <!-- BOF ANTI ROBOT REG--> <?php if (ACCOUNT_VALIDATION == 'true' && strstr($PHP_SELF,'create_account') && ACCOUNT_CREATE_VALIDATION == 'true') { ?> <tr> <td class="main"><b><?php echo CATEGORY_ANTIROBOTREG; ?></b></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> <tr class="infoBoxContents"> <td><table align="center" border="0" cellspacing="2" cellpadding="2"> <tr> <?php if (ACCOUNT_VALIDATION == 'true' && strstr($PHP_SELF,'create_account') && ACCOUNT_CREATE_VALIDATION == 'true') { if ($is_read_only == false || (strstr($PHP_SELF,'create_account')) ) { $sql = "DELETE FROM " . TABLE_ANTI_ROBOT_REGISTRATION . " WHERE timestamp < '" . (time() - 3600) . "' OR session_id = '" . tep_session_id() . "'"; if( !$result = tep_db_query($sql) ) { die('Could not delete validation key'); } $reg_key = gen_reg_key(); $sql = "INSERT INTO ". TABLE_ANTI_ROBOT_REGISTRATION . " VALUES ('" . tep_session_id() . "', '" . $reg_key . "', '" . time() . "')"; if( !$result = tep_db_query($sql) ) { die('Could not check registration information'); } ?> <tr> <td class="main"><table align="center" border="0" width="100%" cellspacing="0" cellpadding="2" class="formArea"> <tr> <td class="main"><table border="0" cellspacing="0" cellpadding="2"> <tr> <td class="main" width="50%" NOWRAP><span class="main"> <?php echo ENTRY_ANTIROBOTREG; ?></span></td> <td class="main" width="50%" align="left"> <?php if ($entry_antirobotreg_error == true) { ?> <span> <?php $validation_images = ''; for($i = 0; $i < ENTRY_VALIDATION_LENGTH; $i++) { $validation_images .= tep_image(DIR_WS_IMAGES . 'validation/validation_' . $reg_key{$i} . '.gif') . ''; } echo $validation_images . ' <br> '; echo tep_draw_input_field('antirobotreg') . ' <br><b><font color="red">' . ERROR_VALIDATION . '<br>' . $text_antirobotreg_error . '</b></font>'; } else { ?> <span> <?php $validation_images = ''; for($i = 0; $i < ENTRY_VALIDATION_LENGTH; $i++) { $validation_images .= tep_image(DIR_WS_IMAGES . 'validation/validation_' . $reg_key{$i} . '.gif') . ''; } echo $validation_images . ' <br> '; ?> <?php echo tep_draw_input_field('antirobotreg', $account['entry_antirobotreg']) . ' ' . ENTRY_ANTIROBOTREG_TEXT; ?> </span> <?php } ?> </td> </tr> </table></td> </tr> </table></td> </tr> <?php } ?> <?php } ?> </tr> </table></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php } ?> <!-- EOF ANTI ROBOT REG--> Original v2.0/2.1 Code for account_edit.php is wrong /======== FIND ==========/ $fax = tep_db_prepare_input($HTTP_POST_VARS['fax']); /======== ADD AFTER ==========/ if (ACCOUNT_VALIDATION == 'true' && ACCOUNT_EDIT_VALIDATION == 'true') { $antirobotreg = tep_db_prepare_input($HTTP_POST_VARS['antirobotreg']); } /======== END ==========/ New v2.1a Code for account_edit.php <!-- anti_robot_registration_bof--> <?php if (ACCOUNT_VALIDATION == 'true' && strstr($PHP_SELF,'account_edit') && ACCOUNT_EDIT_VALIDATION == 'true') { ?> <tr> <td class="main"><b><?php echo CATEGORY_ANTIROBOTREG; ?></b></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> <tr class="infoBoxContents"> <td><table align="center" border="0" cellspacing="2" cellpadding="2"> <tr> <?php if (ACCOUNT_VALIDATION == 'true' && strstr($PHP_SELF,'account_edit') && ACCOUNT_EDIT_VALIDATION == 'true') { if ($is_read_only == false || (strstr($PHP_SELF,'create_account')) ) { $sql = "DELETE FROM " . TABLE_ANTI_ROBOT_REGISTRATION . " WHERE timestamp < '" . (time() - 3600) . "' OR session_id = '" . tep_session_id() . "'"; if( !$result = tep_db_query($sql) ) { die('Could not delete validation key'); } $reg_key = gen_reg_key(); $sql = "INSERT INTO ". TABLE_ANTI_ROBOT_REGISTRATION . " VALUES ('" . tep_session_id() . "', '" . $reg_key . "', '" . time() . "')"; if( !$result = tep_db_query($sql) ) { die('Could not check registration information'); } ?> <tr> <td class="main"><table align="center" border="0" width="100%" cellspacing="0" cellpadding="2" class="formArea"> <tr> <td class="main"><table border="0" cellspacing="0" cellpadding="2"> <tr> <td class="main" width="50%" NOWRAP><span class="main"> <?php echo ENTRY_ANTIROBOTREG; ?></span></td> <td class="main" width="50%" align="left"> <?php if ($entry_antirobotreg_error == true) { ?> <span> <?php $validation_images = ''; for($i = 0; $i < ENTRY_VALIDATION_LENGTH; $i++) { $validation_images .= tep_image(DIR_WS_IMAGES . 'validation/validation_' . $reg_key{$i} . '.gif') . ''; } echo $validation_images . ' <br> '; echo tep_draw_input_field('antirobotreg') . ' <br><b><font color="red">' . ERROR_VALIDATION . '<br>' . $text_antirobotreg_error . '</b></font>'; } else { ?> <span> <?php $validation_images = ''; for($i = 0; $i < ENTRY_VALIDATION_LENGTH; $i++) { $validation_images .= tep_image(DIR_WS_IMAGES . 'validation/validation_' . $reg_key{$i} . '.gif') . ''; } echo $validation_images . ' <br> '; ?> <?php echo tep_draw_input_field('antirobotreg', $account['entry_antirobotreg']) . ' ' . ENTRY_ANTIROBOTREG_TEXT; ?> </span> <?php } ?> </td> </tr> </table></td> </tr> </table></td> </tr> <?php } ?> <?php } ?> </tr> </table></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php } ?> <!-- anti_robot_registration_eof--> Just my little contribution to the community. All credits go to the original creator of v2.0 who help converted the old v1.x code to be compatible with osC 2.2 MS2.
  7. chaicka

    Margin Report v2.10

    Anyone interested to team up and work on resolving existing issues with this contribution? I am not very good with programming, thus I need help. Can someone help me with the following questions? Based on v2.55a: 1. Is it looking up the table 'products'? If so, what are the values that is looking up for, products_price, products_cost, etc? 2. Majority of the problem is with margin_report2.php right? 3. Command used in margin_report2.php is not osC MS2-2.2 standard commands. Is there anyway to convert to using osC standard commands, so as to make it more compatible with the osC itself as well as easier to comprehend? Eg. mysql_query can be replaced with tep_db_query? Let's identify all existing problem first, then we sort out solutions for it.
  8. chaicka

    Margin Report v2.10

    v2.55a is great....but like vaughnn has mentioned, it has some bugs in it on how it lookup the product price. Furthermore, I have just discovered that my latest recent order is not being reported correctly too. Example: Order #1002 Item A has order quantity of 90, but the margin report is only reporting order quantity of 1 which gave the wrong report on sales total and gross profit as a result. Any guru to help fix this and release a new version?
  9. Guys, I have enhanced the cosmetic look of the WebSearch for osC. Check out the new revision in the contribution library/database.
  10. chaicka

    Margin Report v2.10

    Error in Margin_Report2.php whereby the export button after the date selection is not showing up in browser. Removed the DIR_FS_Admin statement to make it the same as the <Back><Export> statement and it works fine now.
  11. chaicka

    Margin Report v2.10

    blueline, No offense, great contribution but your installation instructions are having a few errors which I have fixed in a previous upload. Here are the errors based on the new v2.51 file: Page 2 of 7 - Wrongly inputting the products_cost value to the wrong value in mySQL table as the statement is wrong. Error Is <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_price', $pInfo->products_cost, ''); ?></td> Should Be <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_cost', $pInfo->products_cost, ''); ?></td> Page 6 of 7 - In your files, there is reference to TEXT_PRODUCTS_COST_INFO but your installation instructions never add that in. Furthermore, the definition of TEXT_PRODUCTS_PRICE_COST should be in line with the rest of osC 2.2 MS2 definitions. Error Is /includes/languages/english/categories.php Add: define('TEXT_PRODUCTS_PRICE_COST', 'Cost: '); define('TEXT_PRODUCTS_PROFIT_INFO', 'Profit:'); Should Be Add: define('TEXT_PRODUCTS_COST_INFO', 'Cost: '); define('TEXT_PRODUCTS_PROFIT_INFO', 'Profit:'); define('TEXT_PRODUCTS_PRICE_COST', 'Products Price (Cost):');
  12. chaicka

    Margin Report v2.10

    I used this fix but it breaks the background color of the header bar where Product, Cost, Price, Special Price, Margin ($), Margin (%) is shown.
  13. chaicka

    Margin Report v2.10

    Yup, got the same problem. You have any idea how to fix the font and font size of the prices, costs (numbers) in the margin_report.php? Mine is all bigger in size and thus makes printing it appears weird and not that presentable.
  14. chaicka

    [contribution] CGDiscountSpecials

    Must likely you mis-placed some codes in that .php.....go thru the codes again.
  15. chaicka

    [contribution] CGDiscountSpecials

    Bugs/To-Fix in v1.4b 1. When a customer is in a group discount, and a particular item is on special offer, CGDiscount will not take the lower price. Eg. Item A is $12 at normal price, but with group discount of 10% is $10.80, but because it's on special offer at $11 for the month, the CGDiscountSpecial mod will take the price to be $11, instead of taking the lower price of the two prices.
×