$datetime1 = new DateTime($date1); $datetime2 = new DateTime($date2); $difference = $datetime1->diff($datetime2); //echo $difference->days; /*$sel = abs(strtotime($date2)-strtotime($date1)); $selisih= $sel /(60*60*24);*/ $jumlah_hari = $difference->days + 1; $jumlah_truk = get_jumlah_truk($date1, $date2, $i_owner_id); $jumlah_pengiriman = get_jumlah_pengiriman($date1, $date2, $i_owner_id); $jumlah_volume = get_jumlah_volume($date1, $date2, $i_owner_id) ? get_jumlah_volume($date1, $date2, $i_owner_id) : 0; $jumlah_volume = str_replace(".", ",", $jumlah_volume); $total_jasa_angkut = get_total_jasa_angkut($date1, $date2, $i_owner_id); $total_jasa_angkut = str_replace(".", ",", $total_jasa_angkut); $total_subsidi_tol = get_total_subsidi_tol($date1, $date2, $i_owner_id); $total_transport = $total_jasa_angkut + $total_subsidi_tol; $total_harga_urukan = get_total_harga_urukan($date1, $date2, $i_owner_id); $total_hpp = get_total_hpp($date1, $date2, $i_owner_id); $title = 'report_kepuasan_customer_tagihan'; $supplier_title = str_replace(" ", "_", $supplier); $format = create_report($title . "_" . $supplier_title . "_" . $i_date); include '../views/report/report_kepuasan_customer_tagihan.php'; break; case 'delete_transaction': $id = isset($_GET['id']) ? $_GET['id'] : null; extract($_POST); $i_date = get_isset($_GET['date']); $date_default = $i_date; delete_transaction($id); header("Location: report_kepuasan_customer.php?page=list&preview=1&date={$date_default}"); break; }
<?php // session_start(); /* Print a report * repgen_print.php for PHP Report Generator Bauer, 5.2.2002 Version 0.2 */ // this has to be an own page, because otherwise we could not get Content-type application/pdf $path_to_root = "../.."; $page_security = 'SA_REPORT_GENERATOR'; include_once $path_to_root . "/includes/session.inc"; add_access_extensions(); include_once $path_to_root . "/includes/date_functions.inc"; include_once $path_to_root . "/admin/db/company_db.inc"; include_once $path_to_root . "/includes/ui.inc"; require_once "includes/repgen.inc"; $id = $_GET['id']; $file = $comp_path . '/' . user_company() . '/pdf_files/' . $id . '.pdf'; create_report($id, $file); ?>
function show_timetable() { //Получаем глобальные переменные global $Month; global $Year; global $Redactor; global $user; global $MonthsFull; //Передаем флаг шефа инженеров в cookie setcookie("engineer_chief", $user->data['engineer_chief']); /*Получаем данные от пользователя*/ if (isset($_GET['month'])) { if (!preg_match("/^[0-9]{1,2}\$/", $_GET['month'])) { return "Ошибка в формате входных данных (1)."; } else { $Month = (int) $_GET['month']; } } else { $Month = (int) date("m"); } /*Получаем данные от пользователя*/ if (isset($_GET['year'])) { if (!preg_match("/^[0-9]{4}\$/", $_GET['year'])) { return "Ошибка в формате входных данных (2)."; } else { $Year = (int) $_GET['year']; } } else { $Year = (int) date("Y"); } /*Получаем данные от пользователя*/ if (isset($_GET['redactor'])) { $Redactor = (int) $_GET['redactor']; } else { if ($user->data['timetable_editor'] == 1) { if (check_rights('timetable_show_all_first')) { $Redactor = -1; } else { $Redactor = $user->data['user_id']; } } else { $Redactor = -1; } } /*Формируем таблицу*/ if (@$_GET['regime'] == 'report') { $timetable_html = create_report(); } else { $timetable_html = create_timetable(); } /*Проверяем чьими графиками работы мы можем управлять и можем ли вообще*/ if (!$timetable_html) { return "Вам не доступен ни один график работы для просмотра/редактирования"; } else { //Определяем переменные $html = ""; /*Формируем список годов*/ $years_html = ""; $selectedFOR = ""; $year_start = date("Y"); $year_end = date("Y") - 5; for ($yearFOR = $year_start; $yearFOR >= $year_end; $yearFOR--) { $yearFOR == $Year ? $selectedFOR = 'selected' : ($selectedFOR = ''); $years_html .= "<option value='{$yearFOR}' {$selectedFOR}>{$yearFOR}</option>"; } /*Формируем список месяцев*/ $months_html = ""; $selectedFOR = ""; foreach ($MonthsFull as $keyFOR => $monthFOR) { $keyFOR == $Month ? $selectedFOR = "selected" : ($selectedFOR = ""); $months_html .= "<option value='{$keyFOR}' {$selectedFOR}>{$monthFOR}</option>"; } /*Формируем список редакторов*/ //IF if (check_rights('timetable_show_all')) { //Определяем переменные $redactors_html = "Подразделение (ответственный): "; //Запрос к базе $redactorsRES = db_query("SELECT * FROM `phpbb_users` WHERE `timetable_editor`=1 ORDER BY `hrmanager_alias` ASC"); if (db_count($redactorsRES) == 0) { $redactors_html .= "не заданы"; } else { //Определяем переменную $redactors_html .= "<select name='redactor'>"; /*Не важно*/ $Redactor === -1 ? $redactors_html .= "<option value='-1' selected>--не важно--</option>" : ($redactors_html .= "<option value='-1'>--не важно--</option>"); if (check_rights('timetable_bez_redactora')) { /*Без редактора*/ $Redactor === 0 ? $redactors_html .= "<option value='0' selected>--ответственный не указан--</option>" : ($redactors_html .= "<option value='0'>--ответственный не указан--</option>"); } //WHILE while ($redactorWHILE = db_fetch($redactorsRES)) { //IF $redactorWHILE['hrmanager_alias'] != "" ? $nameWHILE = $redactorWHILE['hrmanager_alias'] . " (" . $redactorWHILE['username'] . ")" : ($nameWHILE = $redactorWHILE['username']); $redactorWHILE['user_id'] == $Redactor ? $selected = 'selected' : ($selected = ''); $redactors_html .= "<option value='{$redactorWHILE['user_id']}' {$selected}>{$nameWHILE}</option>"; } //Определяем переменную $redactors_html .= "</select>"; } //ELSE } else { //Определяем переменную $redactors_html = ""; } /*НАЧАЛО: Определяем вид ссылок subgroup*/ //Определяем переменную $temp_style = "font-weight:bold;text-decoration:none;"; //IF if (@$_GET['regime'] == 'report') { $subgroup_link_2 = $temp_style; $subgroup_link_1 = ''; } else { $subgroup_link_1 = $temp_style; $subgroup_link_2 = ''; } /*КОНЕЦ: Определяем вид ссылок subgroup*/ /*НАЧАЛО: Определяем вид ссылок subgroup2*/ //Определяем переменную $temp_style = "font-weight:bold;text-decoration:none;"; //IF if (@$_GET['report'] == 'year') { $subgroup2_link_2 = $temp_style; $subgroup2_link_1 = ''; } else { $subgroup2_link_1 = $temp_style; $subgroup2_link_2 = ''; } /*КОНЕЦ: Определяем вид ссылок subgroup2*/ /*НАЧАЛО: Отображение subgroup2*/ if (@$_GET['regime'] == 'report') { $subgroup2 = template_get("timetable/subgroup2", array('year' => $Year, 'month' => $Month, 'redactor' => $Redactor, 'subgroup2_link_1' => $subgroup2_link_1, 'subgroup2_link_2' => $subgroup2_link_2)); } else { $subgroup2 = ''; } /*КОНЕЦ: Отображение subgroup2*/ //Проверка, даны ли вошедшему пользователю права на управления графиками кого-либо из редакторов{ //Случай 1. Пользователь перечислен в таблице БД `phpbb_timetable_editors_rights`{ $same_rightsSQL = "SELECT `editor_id` FROM `phpbb_timetable_editors_rights` WHERE `user_id`={$user->data['user_id']}"; if (db_easy_count($same_rightsSQL) > 0) { $editor_id = db_short_easy($same_rightsSQL); if (db_short_easy("SELECT `timetable_editor` FROM `phpbb_users` WHERE `user_id`={$editor_id}") == 1) { $timetable_editor_same_rights = 1; } else { $timetable_editor_same_rights = 0; } } else { $timetable_editor_same_rights = 0; } //} //Случай 2. Пользователь является подчиненным шефа инженеров{ if (is_engineer_chief_employee()) { $timetable_editor_same_rights = 1; } //} //} /*НАЧАЛО: Отображение ссылки на раздел "Таблица"*/ if (check_rights('timetable_menu_tablica') || db_short_easy("SELECT `timetable_editor` FROM `phpbb_users` WHERE `user_id`={$user->data['user_id']}") == 1 || $timetable_editor_same_rights) { $tablica = template_get("timetable/tablica", array('year' => $Year, 'month' => $Month, 'redactor' => $Redactor, 'subgroup_link_1' => $subgroup_link_1)); } else { $tablica = ''; } /*КОНЕЦ: Отображение ссылки на раздел "Таблица"*/ /*НАЧАЛО: Формируем additional_hiddens для <SELECT>*/ //Определяем переменные $temp_array = array(); $additional_hiddens = ""; //IF if (@$_GET['regime'] == 'report') { $temp_array['regime'] = 'report'; } if (@$_GET['report'] == 'year') { $temp_array['report'] = 'year'; } //FOREACH foreach ($temp_array as $nameFOR => $valueFOR) { $additional_hiddens .= "<input type='hidden' name='{$nameFOR}' value='{$valueFOR}' />"; } /*КОНЕЦ: Формируем additional_hiddens для <SELECT>*/ /*Неактивный <SELECT name='month'...*/ @$_GET['report'] == 'year' ? $select_disabled = 'disabled' : ($select_disabled = ''); /*Подключаем файл шаблона*/ $html .= template_get("timetable/show_timetable", array('year' => $Year, 'month' => $Month, 'redactor' => $Redactor, 'years' => $years_html, 'months' => $months_html, 'redactors' => $redactors_html, 'table' => $timetable_html, 'subgroup_link_2' => $subgroup_link_2, 'subgroup2' => $subgroup2, 'additional_hiddens' => $additional_hiddens, 'select_disabled' => $select_disabled, 'tablica' => $tablica)); //Возвращаем значение функции return $html; } }
} $sql .= "AND ({$gsql}) "; } $sql .= "GROUP BY h.userid, h.type"; $result = mysql_query($sql); if (mysql_error()) { trigger_error(mysql_error(), E_USER_WARNING); } if (mysql_num_rows($result) > 0) { while ($obj = mysql_fetch_object($result)) { $holidays[$obj->realname]['name'] = $obj->realname; $holidays[$obj->realname]['entitlement'] = $obj->holiday_entitlement; $holidays[$obj->realname][$obj->type] = $obj->count; } $array = "{$strName},{$strHolidayEntitlement},{$strHoliday},{$strCompassionateLeave},{$strAbsentSick},{$strWorkingAway},{$strTraining}\n"; foreach ($holidays as $h) { $array .= "{$h['name']},{$h['entitlement']},{$h[HOL_HOLIDAY]},{$h[HOL_FREE]},{$h[HOL_SICKNESS]},{$h[HOL_WORKING_AWAY]},{$h[HOL_TRAINING]}\n"; } if ($output == "screen") { include APPLICATION_INCPATH . 'htmlheader.inc.php'; echo "<h2>{$strHolidayUsage}</h2>"; echo create_report($array, 'table'); include APPLICATION_INCPATH . 'htmlfooter.inc.php'; } elseif ($output == "csv") { echo create_report($array, 'csv'); } } else { echo "<h2>{$strHolidayUsage}<h2>"; echo "<p class='warning'>{$strNoRecords}</p>"; } }
} $row .= $stats[0] . ","; $row .= format_seconds($stats[1] * 60) . ","; $row .= round($stats[2] / 60) . " {$strHours},"; $row .= $stats[3] . ","; $row .= $stats[4] . ","; $row .= $stats[5]; $data = $data . "\n" . $row; $current_time = $next_time; } if ($_REQUEST['output'] == 'csv') { echo create_report($data, 'csv', 'average_incident_duration.csv'); } else { include APPLICATION_INCPATH . 'htmlheader.inc.php'; echo "<h2>{$title}</h2>"; echo "<p align='center'>{$strOnlyShowsClosedCalls}</p>"; echo "<p align='center'>"; echo "<a href='{$_SERVER['PHP_SELF']}?mode=all&increment={$increment}"; echo "&states=2,3,4,6,7,9'>{$strActive}</a> | "; echo "<a href='{$_SERVER['PHP_SELF']}?mode=all&increment={$increment}"; echo "&states=0,1,2,3,4,5,9,10'>{$strWaiting}</a> | "; echo "<a href='{$_SERVER['PHP_SELF']}?mode=all&increment={$increment}"; echo "&states=0,1,2,3,5,6,9,10'>{$strWaitingForCustomer}</a> | "; echo "<a href='{$_SERVER['PHP_SELF']}?mode=all&increment={$increment}"; echo "&states=0,1,2,3,4,5,7,8,9,10'>{$strWaitingForSupport}</a>"; echo "</p>"; echo create_report($data); echo "<p align='center'><a href='{$_SERVER['PHP_SELF']}?mode={$mode}&"; echo "output=csv'>{$strSaveAsCSV}</a></p>"; include APPLICATION_INCPATH . 'htmlfooter.inc.php'; }
$col_header = array('Day of Week', 'Hour', 'Average Visitors', 'Average Visits', 'Average Time'); $col_format = array('int', 'int', 'int1000', 'int1000', 'time'); $col_total_visitor = 0; create_report($year, $month, $what, $col_header, $col_format, $arr['result_report_query'], $arr['total_visitor'], $col_total_visitor); break; case 'countries': $arr = query_countries($year, $month); $what = 'country'; $col_header = array('Country', 'Visitors', '%'); $col_format = array('text', 'int1000', 'float'); $col_total_visitor = 2; create_report($year, $month, $what, $col_header, $col_format, $arr['result_report_query'], $arr['total_visitor'], $col_total_visitor); break; case 'help_page': $arr = query_help_page($year, $month); $what = 'help page'; $col_header = array('Page', 'Visitors', 'Page Views', 'Average Time On Page'); $col_format = array('text', 'int1000', 'int1000', 'time'); $col_total_visitor = 2; create_report($year, $month, $what, $col_header, $col_format, $arr['result_report_query'], $arr['total_visitor'], $col_total_visitor); break; case 'screen_res': $arr = query_screen_res($year, $month); $what = 'screen res'; $col_header = array('Width', 'Height', 'Visitors', '%'); $col_format = array('int', 'int', 'int1000', 'float'); $col_total_visitor = 3; create_report($year, $month, $what, $col_header, $col_format, $arr['result_report_query'], $arr['total_visitor'], $col_total_visitor); break; } }