} if ( $res1 ) { ksort($res1); foreach ( $res1 as $d ) { array_push($res, $d); } } }*/ if ($i == 43) { $res = pf::getOp($date_from, $date_to, $bYear, $bYearAll); foreach ($res as $kRes => $iRes) { $res[$kRes]['sum'] = round($iRes['sum'] / EXCH_TR, 2); } } if ($i != 43 && !in_array($i, $is_number_project)) { $res = getOP($graphStyle[$i]['op_codes'], $date_from, $date_to, $bYear, $graphStyle[$i]['addit'], $ignored_uids, $bYearAll); } if (in_array($i, $is_number_project)) { $res = getOPProject($date_from, $date_to, $bYear, $bYearAll, $ignored_uids, $graphStyle[$i]['addit']); } $aTemp = $res; if ($bYearAll) { for ($ii = 0; $ii < count($aTemp); $ii++) { $aTemp[$ii]['_day'] = array_search($aTemp[$ii]['_day'], $graphLabels) + 1; } } if (isset($aTemp[0]['_day'])) { for ($j = 0; $j < count($aTemp); $j++) { $iAmount = abs($aTemp[$j]['sum'] / $iFMperPX); $graphValues[$i][$aTemp[$j]['_day'] - 1] = $iAmount; $graphValues2[$i][$aTemp[$j]['_day'] - 1] = $aTemp[$j]['ammount'];
for ($j = 0; $j <= 23; ++$j) { $graphValues[$i][$j] = 0; $graphValues2[$i][$j] = 0; } } $graphStyle[1]['type'] = '1'; $graphStyle[2]['type'] = '2'; $graphStyle[3]['type'] = '3'; $graphStyle[4]['type'] = '4'; $graphStyle[1]['addit'] = ''; $graphStyle[2]['addit'] = ''; $graphStyle[3]['addit'] = ''; $graphStyle[4]['addit'] = ''; $imgHeight = 0; for ($i = 1; $i <= 4; ++$i) { $res = getOP($graphStyle[$i]['type'], $date_from, $date_to, $bYear, $graphStyle[$i]['addit']); $aTemp = $res; if (isset($aTemp[0]['_day'])) { $graphStyle[$i]['max'] = abs($aTemp[0]['cnt'] / $iFMperPX); for ($j = 0; $j < count($aTemp); ++$j) { $iAmount = abs($aTemp[$j]['cnt'] / $iFMperPX); $ii = $aTemp[$j]['cnt']; if ($iAmount > $graphStyle[$i]['max']) { $graphStyle[$i]['max'] = $iAmount; //Вычисляем максимальную высоту всего графика } $graphValues[$i][$aTemp[$j]['_day'] - 1] = $iAmount; $graphValuesV[$i][$aTemp[$j]['_day'] - 1] = $ii; $graphValues2[$i][$aTemp[$j]['_day'] - 1] = $aTemp[$j]['cnt']; } $imgHeight += $graphStyle[$i]['max'];
$graphValues[$i][$j] = 0; $graphCountOperations[$i][$j] = 0; $graphPercentOperations[$i][$j] = 0; } } } //// для теста //foreach ($graphValues as $j => $row) { // foreach ($row as $i => $row1) { // $rr = 5350/ (count($row)-(count($row)-$i-1)); // $graphValues[$j][$i] = rand($rr, 150)/$iFMperPX; // } //} $imgHeight = 0; for ($i = 1; $i <= OP_SIZE + 1; $i++) { $res = getOP(array($i), $date_from, $date_to, $bYear, $bYearAll); $aTemp = $res; if ($i == 4) { $temp = $aTemp; // Сохраняем безнал для безнала Док } if (isset($aTemp[0]['payment_sys'])) { switch ($aTemp[0]['payment_sys']) { case 1: $l = 6; //WMZ $rate = EXCH_WMZ; break; case 2: $l = 4; //WMR - Ч
$iFMperPX = !$bYear ? 30 : 30 * 10; //масштаб $graphStyle[3]['text'] = 'Работодатели'; $graphStyle[2]['text'] = 'Фрилансеры'; $graphStyle[1]['text'] = 'Всего'; $graphStyle[3]['val'] = 'cnt_emp'; $graphStyle[2]['val'] = 'cnt_frl'; $graphStyle[1]['val'] = 'cnt'; for ($i = 1; $i <= 3; ++$i) { for ($j = 0; $j <= $iMaxDays; ++$j) { $graphValues[$i][$j] = 0; } } $imgHeight = 0; for ($i = 1; $i <= count($graphStyle); ++$i) { $res = getOP($date_from, $date_to, $bYear); $aTemp = $res; $value = $graphStyle[$i]['val']; if (isset($aTemp[0]['_day'])) { $graphStyle[$i]['max'] = $aTemp[0][$graphStyle[$i]['val']] / $iFMperPX; // $graphStyle[$i]['max'] = $aTemp[0]['cnt']; for ($j = 0; $j < count($aTemp); ++$j) { $iAmount = $aTemp[$j][$value] / $iFMperPX; $ii = $aTemp[$j][$value]; // $iAmount = $aTemp[$j]['cnt']; if ($iAmount > $graphStyle[$i]['max']) { $graphStyle[$i]['max'] = $iAmount; //Вычисляем максимальную высоту всего графика } $graphValues[$i][$aTemp[$j]['_day'] - 1] = $iAmount; $graphValuesV[$i][$aTemp[$j]['_day'] - 1] = $ii;
$countr[0]['country_name'] = ''; $countr[0]['cnt'] = ''; $countr[0]['country_id'] = '-1'; } $iMaxDays = $iMax = $bYear ? 12 : date('t', mktime(0, 0, 0, $iMonth, 1, $iYear)); //Вычисление максимального количества дней\месяцев в текущем месяце\годе $iFMperPX = !$bYear ? 30 : 30 * 10; //масштаб for ($i = 1; $i <= count($countr); ++$i) { for ($j = 0; $j <= $iMaxDays; ++$j) { $graphValues[$i][$j] = 0; } } $imgHeight = 0; for ($i = 1; $i <= count($countr); ++$i) { $res = getOP($countr[$i - 1]['country_id'], $date_from, $date_to, $bYear); $aTemp = $res; if (isset($aTemp[0]['_day'])) { $graphStyle[$i]['max'] = $aTemp[0]['cnt'] / $iFMperPX; for ($j = 0; $j < count($aTemp); ++$j) { $iAmount = $aTemp[$j]['cnt'] / $iFMperPX; $ii = $aTemp[$j]['cnt']; if ($iAmount > $graphStyle[$i]['max']) { $graphStyle[$i]['max'] = $iAmount; //Вычисляем максимальную высоту всего графика } $graphValues[$i][$aTemp[$j]['_day'] - 1] = $iAmount; $graphValuesV[$i][$aTemp[$j]['_day'] - 1] = $ii; } $imgHeight += $graphStyle[$i]['max']; }
$graphStyle[7]['addit'] = ''; $graphStyle[8]['addit'] = ''; $graphStyle[9]['addit'] = ''; $graphStyle[10]['addit'] = ''; $graphStyle[11]['addit'] = ''; $graphStyle[12]['addit'] = ''; $graphStyle[13]['addit'] = ''; $graphStyle[14]['addit'] = "role&'" . $empmask . "' = '" . $empmask . "'"; $graphStyle[15]['addit'] = "role&'" . $empmask . "' = '" . $frlmask . "'"; $graphStyle[16]['addit'] = ''; $graphStyle[17]['addit'] = ''; $graphStyle[18]['addit'] = ''; $graphStyle[19]['addit'] = ''; $imgHeight = 0; for ($i = 1; $i <= count($graphStyle); ++$i) { $res = getOP($graphStyle[$i]['op_codes'], $date_from, $date_to, $bYear, $graphStyle[$i]['addit']); $aTemp = $res; if (isset($aTemp[0]['_day'])) { $graphStyle[$i]['max'] = abs($aTemp[0]['sum'] / $iFMperPX); for ($j = 0; $j < count($aTemp); ++$j) { $iAmount = abs($aTemp[$j]['sum'] / $iFMperPX); if ($iAmount > $graphStyle[$i]['max']) { $graphStyle[$i]['max'] = $iAmount; //Вычисляем максимальную высоту всего графика } $graphValues[$i][$aTemp[$j]['_day'] - 1] = $iAmount; $graphValues2[$i][$aTemp[$j]['_day'] - 1] = $aTemp[$j]['ammount']; if ($aTemp[$j]['sum'] < 0) { $graphValues3[$i][$aTemp[$j]['_day'] - 1] += -1 * $aTemp[$j]['sum']; } else { $graphValues3[$i][$aTemp[$j]['_day'] - 1] += $aTemp[$j]['sum'];