You are here

function _commerce_reports_stock_calculate_lifetime in Commerce Reporting 7.3

Same name and namespace in other branches
  1. 7.4 modules/stock/commerce_reports_stock.module \_commerce_reports_stock_calculate_lifetime()

Calculate the stock lifetime.

1 call to _commerce_reports_stock_calculate_lifetime()
_commerce_reports_stock_calculate_dataset in modules/stock/commerce_reports_stock.module
Calculate all the stock reports data (weekly sales, monthly sales, lifetime)

File

modules/stock/commerce_reports_stock.module, line 72
This module provides advanced stock reporting for Drupal Commerce.

Code

function _commerce_reports_stock_calculate_lifetime($stock, $weekly_burn) {
  if ($weekly_burn === 0) {
    return 1000;
  }
  return (int) ($stock / ($weekly_burn / 7));
}