123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751 |
- <?
- if (!$logged_me_in_successfully234)
- return;
- require_once( "fpdf/fpdf.php" );
- include "qrcode.php";
-
- $shiftEntity = \app\models\entity\Shift::find()->all();
- if ($new == "1")
- {
-
- echo "<form action='?act=staff' method='post'>
- <b>Введите данные нового сотрудника:</b>
- <br>
- <p>ФИО: <input name='staffName''></p>
- <p>Имя аккаунта: <input name='staffAccount'></p>
- <p>Уровень аккаунта:
- <select name='cmd'>
- <option value='1''>Company Admin#</option>
- <option value='2'>Company Operator#</option>
- </select>
- </p>
- <p>Смена:
- <select name='shift'>";
- foreach( $shiftEntity as $shift) {
- echo "<option value='".$shift->id."'>". $shift->name."</option>";
- }
- echo " </select>
- </p>
- <p>Телефон: <input name='staffPhone'></p>
- <p>Пароль: <input name='pwd'></p>
- <input type='submit' value='Добавить'>
- <input type='hidden' name='new' value='6'>
- </form>";
- echo '<p></p><a href="?act=staff">Вернуться к списку сотрудников</a></p>';
- }
- else if ($new == "2")
- {
-
- echo '<form action="?act=devices" method="post">
- <b>Отсканируйте или распечатайте данный QR-код для идентификации сотрудника '.$staff_name.'!</b>
- <br></form>';
- $buf=pack("vL*",1, $staff_id); //заголовок - номер пакета 1б и длина 2б. v-ushort, c- byte, C- ubyte, s - short, L - int, l - uint
- $hex_string = base64_encode($buf);
- $filename = $PNG_TEMP_DIR.'test'.md5($hex_string.'|'.$errorCorrectionLevel.'|7').'.png';
- QRcode::png($hex_string, $filename, $errorCorrectionLevel, 7, 2);
- echo '<img src="'.$PNG_WEB_DIR.basename($filename).'" />';
- echo '<p>'.$hex_string.'</p>';
- if ($cmdlevel == 10) {
- $acc = Account::Find($staff_id);
- $decr = encrypt_decrypt('decrypt', $acc->hash);
- echo "<b>Account:</b> ".$acc->getLogin();
- echo "<br><b>Password:</b> $decr ";
- }
- $_SESSION['printer'] = $staff_id;
- if (!isset($print)) {
- echo '<br><br><input name="Subm" type="button" id="Subm" onclick="openwin(\'staff\',' . $staff_id . ',\''.$staff_name.'\')" value="Печать">';
- echo '<p></p><a href="?act=staff">Вернуться к списку сотрудников</a></p>';
- }
- }
- else if ($new == "7" && 10 == $cmdlevel )
- {
-
-
- //echo $staff_id;
-
- $query1 = mysqli_query($link, "select `name`,`cmdlevel`,`login`,`shift_id` from accounts where company=$companyID and id=$staff_id");
- //while($res2 = mysqli_fetch_row($query1)){
- //var_dump($res2);
- //}
-
- $res = mysqli_fetch_assoc($query1);
- $checked = ( 0 != $res['cmdlevel'])?
- "<p>Деактивировать пользователя: <input type='checkbox' name='deactivate' value='1' ></p>":
- "<p>Активировать пользователя: <input type='checkbox' name='deactivate' value='2' ></p>";
-
- echo "<form action='?act=staff' method='post'>
- <b>Изменить данные сотрудника:</b>
- <br>
- <p><input type='hidden' name='staff_id' value='".$staff_id."'></p>
- <p>ФИО: <input name='staffName'' value='".$res['name']."'></p>
- <p>Смена:
- <select name='shift'>";
- foreach( $shiftEntity as $item_shift) {
- $selected = '';
- if ( $res['shift_id'] == $item_shift->id) {
- $selected = 'selected';
- }
- echo "<option value='".$item_shift->id."' ".$selected.">". $item_shift->name."</option>";
-
- }
- echo " </select>
- </p>
- <p>Логин: <input name='log' value='".$res['login']."'></p>
- <p>Пароль: <input name='pwd'></p>
- " . $checked."
-
- <input type='submit' value='Отправить'>
- <input type='hidden' name='new' value='8'>
- </form>";
- echo '<p></p><a href="?act=staff">Вернуться к списку сотрудников</a></p>';
- }
- else
- {
- if ($new == "3")
- {
- $account = Account::Find($new_job_accid);
- /**
- * @var $account Account
- */
- if ($account != null)
- {
- $jobsize = sizeof($account->getJobtypes());
- $jobtype = Jobtype::Find($new_jobtype_id);
- if ($jobtype != null && !$account->hasJobtype($jobtype)) {
- $account->addJobtype($jobtype, $jobsize);
- $account->Save();
- AddJob($new_job_accid, $new_jobtype_id, $job_ids);
- }
- }
- }
- if ($new == "4")
- {
- UpdateJob($newjob_accid, $jobvalue, $index, $previous);
- }
- else if ($new == '5')
- {
- Account::ClearTasksFromAccount($del_id);
- }
- else if ($new == '6')
- {
-
- $hash = encrypt_decrypt('encrypt', $pwd);
- $pwd = md5($pwd);
- //echo '<pre>' . $pwd . '<pre>';
- //echo "insert into accounts (name, cmdlevel, phone, password, login, company) values ('$staffName', $cmd, '$staffPhone', '$pwd','$staffAccount', '$companyID')";
- $query1 = mysqli_query($link, "insert into accounts (name, cmdlevel, phone, password, login, company, hash, company_id, shift_id) values ('$staffName', $cmd, '$staffPhone', '$pwd','$staffAccount', '$companyID','$hash', $companyID, '$shift')");
- //echo '<pre>' . $query1 . '<pre>';
- $lastid = mysqli_insert_id($link);
- //echo '<pre>' . $lastid . '<pre>';
- if ($lastid > 0)
- echo "<span style='color:green'><b>Запись добавлена!</b></span>";
- else
- echo "<span style='color:red'><b>Ошибка! Проверьте правильность заполнения полей. Возможно имя или логин уже заняты.</b></span>";
- }
- else if ($new == '8' && 10 == $cmdlevel )
- {
- $deactivateCheckbox = '';
- if ( 1 == $deactivate) {
- $deactivateCheckbox = ',cmdlevel = 0, company = company + 100'; }
- if ( 2 == $deactivate) {
- $deactivateCheckbox = ',cmdlevel = 1' ;
- }
-
- if ( '' != $pwd ) {
- $hash = encrypt_decrypt('encrypt', $pwd);
- $pwd = md5($pwd);
- $lastid = mysqli_query($link, "update accounts set name='$staffName', password='$pwd', hash='$hash' ". $deactivateCheckbox .", login='$log', shift_id='$shift' where id=$staff_id");
- } else {
- $lastid = mysqli_query($link, "update accounts set name='$staffName' ". $deactivateCheckbox .", login='$log', shift_id='$shift' where id=$staff_id");
- }
- if ($lastid > 0)
- echo "<span style='color:green'><b>Запись добавлена!</b></span>";
- else
- echo "<span style='color:red'><b>OOOOОшибка! Проверьте правильность заполнения полей. Возможно имя или логин уже заняты.</b></span>";
- }
-
- echo "<div style='width: 540px;'></div>";
- echo '<h3>Сотрудники компании '.$companyname.'</h3><br>';
- echo "<div id='result' style='border: solid; border-width: 1px'></div>";
- $jobtypes_company = GetJobtypes($companyID);
- $strinOptionJob = '';
- foreach( $jobtypes_company as $job){
- $strinOptionJob .= "<option value='".$job['id']."' >".$job['name']."</option>";
- }
-
- $job_typeArray = ['all'=>'Все должности','main' => 'Основная', 'slave' => 'Замещающая'];
- $stringOption = '';
- foreach( $job_typeArray as $keys => $job_t) {
- $stringOption .= "<option value='" . $keys . "' >" . $job_t ."</option>";
- }
-
- $ascArray = ['ASC'=>'А-Я','DESC' => 'Я-А'];
- $strinOptionShift = '';
- foreach( $shiftEntity as $item_shift) {
- $strinOptionShift .= "<option value='".$item_shift->id."' >". $item_shift->name."</option>";
-
- }
-
- echo "<br>
- <form id='form6' name='form6' method='post' >
- <select name='asc' id='asc_sort'>";
- foreach( $ascArray as $key => $item_asc){
- echo "<option ".$selected." value='".$key."' >".$item_asc."</option>";
- }
- echo "
- </select>
-
- <select name='kind' id='kind_sort' style='width:100px'>
- <option value='allstaff' >Все</option>
- <option value='last_seen_web'>Онлайн Веб</option>
- <option value='last_seen_mobile'>Онлайн Мобил</option>
- <option value='offline'>Оффлайн</option>
- </select>";
-
- echo "<select name='jobs_type' id='jobs_type_sort'>" . $stringOption . "</select>";
-
- echo "<select name='jobs' id='jobs_sort'>
- <option value='0'>Без фильтрации</option>" . $strinOptionJob . "</select>";
-
- echo "<select name='shift' id='shift_sort'>
- <option value='0' selected >Все смены</option>" . $strinOptionShift . "</select>";
-
- echo "
-
- </form>
-
- ";
- if (isset($shift)){
- echo "<script>
- $('select#shift_sort').val('".$shift."');
- </script>";
- }
-
- if (isset($jobs_type)){
- echo "<script>
- $('select#jobs_type_sort').val('".$jobs_type."');
- </script>";
- }
- if (isset($jobs)){
- echo "<script>
- $('select#jobs_sort').val('".$jobs."');
- </script>";
- }
- if (isset($kind)){
- echo "<script>
- $('select#kind_sort').val('".$kind."');
- </script>";
- }
- if (isset($asc)){
- echo "<script>
- $('select#asc_sort').val('".$asc."');
- </script>";
- }
- echo "
- <form id='form2' name='form2' method='post'>
- <input type='submit' value='Добавить нового сотрудника'>
- <input type='hidden' name='new' value='1'>
- </form>
- ";
- echo "
- <input type='submit' value='Скачать список в pdf' onclick='downloadStaff()'>
- <input type='hidden' name='new' value='1'>
- ";
- $find_staff = (isset($find_staff)) ? $find_staff : '';
- echo "
- <form id='form7' name='form7' method='post'>
- <input type='text' name='find_staff' value='". $find_staff ."' placeholder = 'Введите ФИО сотрудника' size='50'>
- <input type='submit' value='Найти сотрудника' >
- </form>
- ";
- echo '<div id="tabs">
- <ul>
- <li><a href="#tabs-1">Список</a></li>
- <li><a href="#tabs-2">Таблица</a></li>
- </ul>';
-
- echo "<div id='tabs-1'>
- <form id='form1' name='form1' method='post'>";
- // GetOnlineAccountList();
- $query1 = mysqli_query($link, "select * from accounts where company=$companyID");
- /**
- * @var $company Company
- */
- $orderName = 'name';//(isset($kind) and null != $kind )? $kind : 'name' ;
- $orderValue = (isset($asc) and null != $asc )? "".$asc : 'ASC' ;
- $sort = $orderName .' '.$orderValue;
- $filter3 = [];
- $filter4 = [];
- $filter2 = [];
- if (isset($find_staff)) {
- $filter2 = ['like', 'name', $find_staff];
- }
- $filter['company'] = $companyID;
- if ( $shift > 0 ) {
- $filter['shift_id'] = $shift;
- }
- if ( 'slave' == $jobs_type ) {
- $filter3 = ['<>','priority',0];// = $shift_filter;
- }
-
- switch ($jobs_type){
- case 'main':
- $filter3 = ['=','priority',0];
- break;
- case 'slave':
- $filter3 = ['<>','priority',0];
- break;
- case 'all':
- $filter3 = ( null != $jobs && '0' != $jobs)? ['=', 'jobtype_id', $jobs] :[];
- break;
- }
- //var_dump($_POST);
- if( 0 != $jobs && null !== $jobs && null != $jobs_type && 'all' != $jobs_type) {
- $filter['jobtype_id'] = $jobs;
- }
-
- //echo '<pre>';
- //var_dump($filter, $filter2,$filter3);
- //echo '</pre>';
- //var_dump($filter4,$jobs);
- //exit;
- //$accountsEntity = \app\models\entity\Accounts::find()->where($filter)->andWhere($filter2)->orderBy($sort)->all();
- $accountsEntity = \app\models\entity\Accounts::find()
- ->joinWith('accountsJobtypes', ['account_id' => 'id'], 'LEFT JOIN')
- ->where($filter)
- ->andWhere($filter2)
- ->andWhere($filter3)
- //->andWhere($filter4)
- ->orderBy($sort)
- ->all();
-
- $company = Company::Find($companyID);
- $accounts = $company->accounts;
- // \Doctrine\Common\Util\Debug::dump($accounts);
- //$tasks = $entityManager->getRepository('Task')->findAll();
-
- //var_dump(count($accountsEntity));
- //var_dump(count());
- // $accs = Account::GetIdle($companyID);
- // \Doctrine\Common\Util\Debug::dump($accs);
- $accountsEntityCount = count($accountsEntity);
- $count = 1;
- echo "<span id='accountsEntityCount' data_pos='$accountsEntityCount' data_pos_num='$count'></span>";
- foreach ($accountsEntity as $account)
- {
- $staff_id = $account->id;
- $staff_name = $account->name;
- $staff_cmdlevel = $account->cmdlevel;
- $overplan_mode = $account->overplan_mode?"Внеплан":"";
- // $active_task_id = $account->getActiveTaskIds();
- $activeTasks = $account->tasks;
- $last_seen_mobile = ( null != $account->last_seen_mobile )? new DateTime($account->last_seen_mobile): $account->last_seen_mobile ;
- $last_seen_web = ( null != $account->last_seen_web ) ? new DateTime($account->last_seen_web) : $account->last_seen_web;
- $online_mobile = OnlineAccountCheck(TimeString($last_seen_mobile));
- $online_web = OnlineAccountCheck(TimeString($last_seen_web));
- if ( !$online_web && 'last_seen_web' == $kind ){
- continue;
- }
- if ( !$online_mobile && 'last_seen_mobile' == $kind ){
- continue;
- }
- if ( ($online_mobile || $online_web) && 'offline' == $kind ){
- continue;
- }
- // echo " <h4 style='font-size: 1.8rem;'>". $staff_name ."<b><span style='color: darkolivegreen'> [".$staff_id."] </b></h4> <div >";
- echo "<div style='border: solid; border-width: 1px; border-color: #9cb2c4; border-radius: 15px; margin:5px; margin-bottom:20px; padding: 5px'>";
- //var_dump(TimeString($last_seen_web));
- //var_dump($online_web);
- // var_dump($last_seen_web);
- if ($online_mobile) {
- echo "<span style='color: green'>Online </span>";
- }
- if ($online_web) {
- echo "<span style='color: darkcyan'>OnlineWeb </span>";
- }
- if (sizeof($activeTasks) > 0) {
- echo "<span style='color: darkred'>Есть незавершённые задачи </span>";
- }
- if ($online_mobile) {
- echo "<span id='quitAccount' title='$staff_id' style='color: darkred; cursor: pointer'>Выход</span>";
- }
- //Quit($accid)
- if ($overplan_mode)
- echo "<span style='color: darkorange'>Внеплан</span>";
- echo "<div id='data_pos_top_$count' class='slider_staff_toggle" . $staff_id . "_top' ></div>";
- $query2 = mysqli_query($link, "select name from accounttypes where type=$staff_cmdlevel");
- if ($res2 = mysqli_fetch_row($query2))
- {
- $type = $res2[0];
- }
- $job_ids_account = $account->accountsJobtypes;//getJobtypesIds();
- $arrIds = [];
- foreach($job_ids_account as $id) {
-
- $arrIds[] = $id->jobtype_id;
- }
-
- $jobstr = implode(',', $arrIds);
- //$jobstr = implode(',', $job_ids_account);
- if ($jobstr=='')
- $jobstr = '""';
- else
- $jobstr = '"'.$jobstr.'"';
- //$jobnames_account = GetJobNames($job_ids_account);
-
- $jobnames_account = GetJobNames($arrIds);
-
- $jobamount = sizeof($jobnames_account);
- $jobnamesstring = implode(',', $jobnames_account);
- $ttshow = '';
- if (sizeof($activeTasks) == 0) {
- $ttshow = 'нет';
- }
- echo "</span><h4 class='button_staff_toggle' data='slider_staff_toggle" . $staff_id . "'>$staff_name <b><span style='color: darkolivegreen'>[$staff_id]</b></h4> ";
- echo "<div class='slider_staff_toggle" . $staff_id . "' style='display: none;'><input type='button' onclick='ChangeStaff($staff_id,\"$staff_name\")' value='QR'> ";
-
- if( 10 == $cmdlevel ) {
- echo "<input type='button' onclick='UpdateStaff($staff_id,\"$staff_name\")' value='Изменить данные пользователя/удалить'> ";
- }
-
- echo "<p><h4 style='margin-bottom: 5px'>Активные задачи:</h4> $ttshow ";
- // $active_tasks = explode(',',$active_task_id);
- // asort($active_tasks);
- if (sizeof($activeTasks) > 0) {
-
- foreach ($activeTasks as $task) {
- //
- // @var $task Task
- //
- // $task = GrabTask($atask);
- $parent = intval($task->parent_id);
- $projid = $task->project->id;
- $tasktype = $task->type;
-
-
- $taskTypeName = GrabTasktype($tasktype)['name'];
- // $status = GetTaskStatus($atask);
- $status = $task->status;
- $color = "blue";
- if ($status == 2)
- {
- $color = "darkorange";
- }
- elseif ($status == 3)
- $color = "darkolivegreen";
- elseif ($status == 5)
- $color = "green";
-
- $sname = getTaskStatusName($status);
- echo "<b>";
- $myid = $task->id;
- if ($parent != 0) {
- $myid = $parent;
- echo 'Команда ';
- }
- else
- {
- echo "(Проект $projid) ";
- }
- $sort = $status;
- echo $task->id . ":</b><a href='?act=tasks&activeid=$myid&sort=$sort'> $taskTypeName </a><b>Статус:</b> <span style='color: $color'>".$sname[0]."</span>";
- echo '<br>';
- }
- echo '</p>';
-
-
- }
- echo "<br><h4>Должности:</h4> ";
- $countbasic = intval($account->basic_jobs_count);
- echo "Количество основных должностей: ";
- echo "<input id='basic_count' type='number' min='1' value='$countbasic' onchange='ChangeBasic(this.value, $staff_id)'>";
- $jobtypes_company = GetJobtypes($companyID);
-
- EchoJobs($staff_id, $jobnames_account, $jobtypes_company, $countbasic,$count);
- echo "<br><input type='button' onclick='ShowJobs($staff_id, $jobstr)' value='Добавить должность'>";
- if (sizeof($activeTasks) > 0)
- echo " <input type='button' onclick='DelTasks($staff_id)' value='Стереть задачи'><br>";
- echo "<p><b>Среднее время выполнения задач за месяц </b>
- <select style='max-width: 100%'>";
-
- $effarr = EfficiencyReport($staff_id);
- echo sizeof($effarr);
- foreach ($effarr as $ttype=>$atime)
- {
-
- $tdesc = GetTaskNameAndDesc($ttype);
- if ($atime > 120)
- $atime = "---";
- echo "<option>".$tdesc[0]." выполняется за ".$atime." минут</option>";
- }
- echo "</select></p>";
- echo "</div>";
- echo "</div>";
- $count++;
- }
- /*
- foreach ($accounts as $account)
- {
-
- // echo " <h4 style='font-size: 1.8rem;'>". $staff_name ."<b><span style='color: darkolivegreen'> [".$staff_id."] </b></h4> <div >";
- echo "<div style='border: solid; border-width: 1px; border-color: #9cb2c4; border-radius: 15px; margin:5px; margin-bottom:20px; padding: 5px'>";
-
- $staff_id = $account->id;
- $staff_name = $account->getName();
- $staff_cmdlevel = $account->getCmdlevel();
- // $active_task_id = $account->getActiveTaskIds();
- $activeTasks = $account->getActiveTasks();
- $last_seen_mobile = $account->getLastSeenMobile();
- $last_seen_web = $account->getLastSeenWeb();
- $online_mobile = OnlineAccountCheck(TimeString($last_seen_mobile));
- $online_web = OnlineAccountCheck(TimeString($last_seen_web));
- var_dump(TimeString($last_seen_web));
- var_dump($online_web);
- if ($online_mobile)
- echo "<span style='color: green'>Online </span>";
- if ($online_web)
- echo "<span style='color: darkcyan'>OnlineWeb </span>";
- $query2 = mysqli_query($link, "select name from accounttypes where type=$staff_cmdlevel");
- if ($res2 = mysqli_fetch_row($query2))
- {
- $type = $res2[0];
- }
- $job_ids_account = $account->getJobtypesIds();
- $jobstr = implode(',', $job_ids_account);
- if ($jobstr=='')
- $jobstr = '""';
- else
- $jobstr = '"'.$jobstr.'"';
- $jobnames_account = GetJobNames($job_ids_account);
- $jobamount = sizeof($jobnames_account);
- $jobnamesstring = implode(',', $jobnames_account);
- $ttshow = '';
- if (sizeof($activeTasks) == 0) {
- $ttshow = 'нет';
- }
- echo "</span><h4 class='button_staff_toggle' data='slider_staff_toggle" . $staff_id . "'>$staff_name <b><span style='color: darkolivegreen'>[$staff_id] </b></h4> ";
- echo "<div class='slider_staff_toggle" . $staff_id . "' style='display: none;'><input type='button' onclick='ChangeStaff($staff_id,\"$staff_name\")' value='QR'> ";
-
- if( 10 == $cmdlevel ) {
- echo "<input type='button' onclick='UpdateStaff($staff_id,\"$staff_name\")' value='Изменить данные пользователя/удалить'> ";
- }
-
- echo "<p><h4 style='margin-bottom: 5px'>Активные задачи:</h4> $ttshow ";
- $active_tasks = explode(',',$active_task_id);
- // asort($active_tasks);
- if (sizeof($activeTasks) > 0) {
-
- foreach ($activeTasks as $task) {
- //
- // @var $task Task
- //
- // $task = GrabTask($atask);
- $parent = intval($task->parent_id);
- $projid = $task->project->id;
- $tasktype = $task->type;
-
-
- $taskTypeName = GrabTasktype($tasktype)['name'];
- // $status = GetTaskStatus($atask);
- $status = $task->status;
- $color = "blue";
- if ($status == 2)
- {
- $color = "darkorange";
- }
- elseif ($status == 3)
- $color = "darkolivegreen";
- elseif ($status == 5)
- $color = "green";
-
- $sname = getTaskStatusName($status);
- echo "<b>";
- $myid = $task->id;
- if ($parent != 0) {
- $myid = $parent;
- echo 'Команда ';
- }
- else
- {
- echo "(Проект $projid) ";
- }
- $sort = $status;
- echo $task->id . ":</b><a href='?act=tasks&activeid=$myid&sort=$sort'> $taskTypeName </a><b>Статус:</b> <span style='color: $color'>".$sname[0]."</span>";
- echo '<br>';
- }
- echo '</p>';
-
-
- }
- echo "<br><h4>Должности:</h4> ";
- $countbasic = intval($account->basic_jobs_count);
- echo "Количество основных должностей: ";
- echo "<div id='result'></div>";
- echo "<input id='basic_count' type='number' min='1' value='$countbasic' onchange='ChangeBasic(this.value, $staff_id)'>";
- $jobtypes_company = GetJobtypes($companyID);
- EchoJobs($staff_id, $jobnames_account, $jobtypes_company, $countbasic);
- echo "<br><input type='button' onclick='ShowJobs($staff_id, $jobstr)' value='Добавить должность'>";
- if ($active_task_id != 'нет')
- echo " <input type='button' onclick='DelTasks($staff_id)' value='Стереть задачи'><br>";
- echo "<p><b>Среднее время выполнения задач за месяц </b>
- <select>";
-
- $effarr = EfficiencyReport($staff_id);
- echo sizeof($effarr);
- foreach ($effarr as $ttype=>$atime)
- {
-
- $tdesc = GetTaskNameAndDesc($ttype);
- if ($atime > 120)
- $atime = "---";
- echo "<option>".$tdesc[0]." выполняется за ".$atime." минут</option>";
- }
- echo "</select></p>";
- echo "</div>";
- echo "</div>";
-
- }
-
- */
-
- $arrayForPdf = [];
- echo "</form></div>
- <div id='tabs-2'>
- <table style='width:100%'>
- <tr>
- <th>Имя</th>
- <th>Логин</th>
- <th>Пароль</th>
- <th>QR код</th>
- </tr>";
-
- foreach ($accountsEntity as $account) {
-
- $buf = pack("vL*",1, $account->id); //заголовок - номер пакета 1б и длина 2б. v-ushort, c- byte, C- ubyte, s - short, L - int, l - uint
- $hex_string = base64_encode($buf);
- $filename = $PNG_TEMP_DIR.'test'.md5($hex_string.'|'.$errorCorrectionLevel.'|7').'.png';
- QRcode::png($hex_string, $filename, $errorCorrectionLevel, 7, 2);
- $decr = encrypt_decrypt('decrypt', $account->hash);
- echo "<tr>
- <td>". $account->name ."</td>
- <td>". $account->login ."</td>
- <td>". $decr ."</td>
- <td><img src='".$PNG_WEB_DIR.basename($filename)."' /></td>
- </tr>";
- $arrayForPdf[] = ['name' => $account->name,
- 'login' => $account->login,
- 'password' => $decr,
- 'qr' => $PNG_WEB_DIR.basename($filename)
- ];
- }
-
- echo "</table>
- </div>
- </div>";
- EchoEdit($jobtypes_company);
- }
- $_SESSION['staffQRList'] = $arrayForPdf;
- function EchoJobs($staff_id, $jobnames, $jobtypes, $countbasic,$count)
- {
- $account_jobindex = 0; //
- $basic = 0;
- $secondary = false;
- $countSubJob = count($jobnames)-1;
- $dataCount = '';
- foreach ($jobnames as $jobname)
- {
- foreach ($jobtypes as $jobtype) {
- if ($jobname == $jobtype['name']) {
- $previous = $jobtype['id']; break;
- }
- }
- //ChangeJob acc_id, new job id, index from company jobtypes list
- if ($basic == 0)
- {
- echo "<h5>Основные:</h5>";
- $dataCount = "data='" . $countSubJob ."'";
- }
- else if (!$secondary && $countbasic == $basic){
- $secondary = true;
- echo "<h5>Замещение:</h5>";
- $dataCount = '';
- }
- $data_pos_class = 'data_pos_'.$count.'_'.$account_jobindex;
- echo " <select id='jobselect$account_jobindex' name='jobs' $dataCount class='$data_pos_class' onchange='if (!ChangeJob(".$staff_id.", this.value, $account_jobindex, $previous)) this.form.reset();'>";
- foreach ($jobtypes as $jobtype) {
- $sel = "";
- if ($jobname == $jobtype['name'])
- $sel = "selected";
- echo "<option ".$sel." value='" . $jobtype['id'] . "'>" . $jobtype['name'] . "</option>";
- }
- echo "<option value='deletejob'>Очистить должность</option>";
- echo "</select>";
- if ($countbasic > $basic)
- {
- $basic++;
- }
- else
- echo "<br>";
- $account_jobindex++;
- }
- }
- function EchoEdit($jobtypes)//, $job_ids_account)
- {
- echo "<div id='jobs_block' style=\"display: none; margin-left: 0px; padding: 10px; background-color: white; border-color: #E1E1E1; border: solid; border-width: 1px; position: fixed; top: 100px;left: 300px \">";
- echo "<span style='color: green'><b>Выберите добавляемую должность:</b></span>";
- echo "<form id='form3' name='form3' method='post'>";
- echo " <select name='new_jobtype_id'>";
- foreach ($jobtypes as $jobtype)
- {
- echo "<option value='" . $jobtype['id'] . "'>" . $jobtype['name'] . "</option>";
- }
- echo "</select>";
- echo "<input type='submit' value='Добавить'>
- <input type='hidden' name='new' value='3'>
- <input type='hidden' name='new_job_accid' value=''>
- <input type='hidden' name='job_ids' value=''>";
- echo "</form></div><br>";
- }
- ?>
|