Question: Unable to submit sale

Unable to submit sale

when we try to create sale, and add certain items, we are getting a message like this Stock not available, but stock available. Another symptom is that when the submit button is clicked to c

MC

Miguel Carrillo

Asked
when we try to create sale, and add certain items, we are getting a message like this Stock not available, but stock available. Another symptom is that when the submit button is clicked to complete the sale, the page just flashes but remains on same Sale screen. I have enabled development mode and I get the error message below. I have also enabled logging=1 but not errors are shown in the error log.

A PHP Error was encountered Severity: Warning Message: Division by zero Filename: models/Site.php Line Number: 72 Backtrace: File: /home/deltexart/Inventory/app/models/Site.php Line: 72 Function: _error_handler File: /home/deltexart/Inventory/app/models/Site.php Line: 923 Function: calculateCost File: /home/deltexart/Inventory/app/models/Site.php Line: 262 Function: item_costing File: /home/deltexart/Inventory/app/models/admin/Sales_model.php Line: 71 Function: costing File: /home/deltexart/Inventory/app/controllers/admin/Sales.php Line: 265 Function: addSale File: /home/deltexart/Inventory/index.php Line: 273 Function: require_once A PHP Error was encountered Severity: Warning Message: Division by zero Filename: models/Site.php Line Number: 72 Backtrace: File: /home/deltexart/Inventory/app/models/Site.php Line: 72 Function: _error_handler File: /home/deltexart/Inventory/app/models/Site.php Line: 923 Function: calculateCost File: /home/deltexart/Inventory/app/models/admin/Sales_model.php Line: 86 Function: item_costing File: /home/deltexart/Inventory/app/controllers/admin/Sales.php Line: 265 Function: addSale File: /home/deltexart/Inventory/index.php Line: 273 Function: require_once
  • MS

    Mian Saleem

    Answered
    Is it new install or update? I have checked the list try to calculate the cost and the only division in line is quantity.

    Can you let me know the step to replicate it on demo?
  • MC

    Miguel Carrillo

    Answered
    I can provide you with login details where you can replicate the issue on my test site.
  • MS

    Mian Saleem

    Answered
    No. It won't help to find the issue. I need to know the steps on demo to replicate/reproduce it.

    You haven't answer the question about install, please be descriptive so that we can understand the issue.

    Lastly, please check the server requirements in the documentation.pdf and make sure your server meets them specially MySQL only_full_group_by mode.

    Thank you
  • MC

    Miguel Carrillo

    Answered
    The site has about 3000 products and has been in use for the last 3 years and has over 30,000 sales. I have been updating it when new versions are released so it is currently on the latest version (v3.4.26). The issue started happening a couple months ago in August when it was on version (v3.4.17).
    During troubleshooting, I performed an sqldump and exported all data from the live site. I installed a fresh copy of the software (v3.4.26) that was downloaded from codecanyon. I then imported the sqldump data into this new database and this is what I am using for testing.
    The same issue is happening on this test site as well. When I enter certain products on the bill and click submit, the page just flashes and remains on the Sale screen. If I enter one product only, the sale will submit successfully. Then I would need to edit that sale and enter the other items and it will allow me to submit and complete the sale.
  • MC

    Miguel Carrillo

    Answered
    I have ran the query on the database to ensure that the MySQL is only_full_group_by, but the issue still happens:
    ```
    # Get modes
    SELECT @@sql_mode;

    # Disable ONLY_FULL_GROUP_BY
    SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));

    # Disable NO_ZERO_DATE & NO_ZERO_IN_DATE
    SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'NO_ZERO_DATE',''));
    SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'NO_ZERO_IN_DATE',''));
    ```
  • MS

    Mian Saleem

    Answered
    Hello, I am not sure what is causing the issue. Please check server error logs for error details. You can enable application logs bu setting the 'log_threashold' to 1 in `app/config/config.php` file and then try to add sale again. Lastly check the latest log file in `app/logs/`
  • Login to Reply