public static function find($itStat, $fromDate, $toDate, $periodFrom, $periodTo)
 {
     $itStat->meanWithinSales = $itStat->Stock = $itStat->item->getStock($toDate);
     list($totalRows, $months, $x, $Qtys, $itStat->mean) = ItemStatistics::getDataAndMean($itStat->item['id'], $fromDate, $toDate);
     list($pTotalRows, $pMonths, $pX, $pQtys, $itStat->periodMean) = ItemStatistics::getDataAndMean($itStat->item['id'], $periodFrom, $periodTo);
     $itStat->period = (substr($periodTo, 0, 4) - substr($periodFrom, 0, 4)) * 12;
     $itStat->period += substr($periodTo, 5, 2) - substr($periodFrom, 5, 2) + 1;
     $itStat->totalPeriod = (substr($toDate, 0, 4) - substr($fromDate, 0, 4)) * 12;
     $itStat->totalPeriod += substr($toDate, 5, 2) - substr($fromDate, 5, 2) + 1;
     if ($totalRows > 0) {
         list($itStat->periodStdDev, $itStat->periodMeanDev) = ItemStatistics::getDeviations($itStat->periodMean, $pQtys);
         list($itStat->stdDev, $itStat->meanDev) = ItemStatistics::getDeviations($itStat->mean, $Qtys);
         $itStat->periodMean += $itStat->periodMeanDev;
         $lr = ItemStatistics::linear_regression($x, $Qtys);
         $itStat->trend = $lr['b'] + $lr['m'] * $months;
         $itStat->trend2 = $lr['b'] + $lr['m'] * ($months + 1);
         $itStat->trend3 = $lr['b'] + $lr['m'] * ($months + 2);
         $itStat->trendMean = ($itStat->trend + $itStat->trend2 + $itStat->trend3) / 3;
         $itStat->trendStdDev = ItemStatistics::getLinearDeviation($lr, $Qtys);
         $itStat->trendStdDevX3 = $itStat->trendStdDev * 3;
     }
     return $itStat;
 }