xaionaro

Updated

... ... @@ -133,6 +133,10 @@ switch ($_GET['action']) {
$project_id = redmine_proj_identifier2id(strtolower(explode('@', $recipient['mail'])[0]));
if (empty($project_id)) {
mail('admin@ut.mephi.ru', 'Got error on decide-note.php', 'empty $project_id, issue '.$issue['id']);
}
addUserToProject($redmine_admin, $assignedTo['id'], $project_id, ROLE_CUSTOMER);
addUserToProject($redmine_admin, $assignedTo['id'], 15971, ROLE_MOVER);
addUserToProject($redmine_admin, $assignedTo['id'], $project_id, ROLE_MOVER);
... ...
... ... @@ -1218,7 +1218,7 @@ foreach ($files as $file) {
case 'request/nix-hosting':
$issue_props =
array(
'assigned_to_id' => USERID_AMGLADTSIN,
'assigned_to_id' => USERID_DYOKUNEV,
'project_id' => $project_id,
'subject' => $memo_subject,
'description' => $text,
... ...
... ... @@ -197,6 +197,8 @@ switch ($file) {
function newFormularData($stfCardId) {
global $themes, $inflect;
/*
// 2017
$salaries = array(
'1-1' => 7800,
'1-2' => 7810,
... ... @@ -219,15 +221,58 @@ switch ($file) {
'4-4' => 8240,
'4-5' => 8585,
'4-6' => 8925,
);*/
// 2018
$salaries = array(
'1-1' => 11200,
'1-2' => 11210,
'2-1' => 11220,
'2-2' => 11230,
'2-3' => 11240,
'2-4' => 11250,
'2-5' => 11260,
'3-1' => 11270,
'3-2' => 11280,
'3-3' => 11290,
'3-4' => 11300,
'3-5' => 11310,
'4-1' => 11320,
'4-2' => 11330,
'4-3' => 12420,
'4-4' => 12430,
'4-5' => 12500,
'4-6' => 12760,
);
$a = json_decode(file_get_contents('https://sd.mephi.ru/api/1/formulars.json?from_local_db=true&active_only=true&api_key='.SDAPI_KEY.'&filter_StfCardId='.preg_replace('/[^0-9]+/', '', $stfCardId)), 1)[0];
$stfCardId = preg_replace('/[^0-9]+/', '', $stfCardId);
$a = json_decode(file_get_contents('https://sd.mephi.ru/api/1/formulars.json?from_local_db=true&active_only=true&api_key='.SDAPI_KEY.'&filter_StfCardId='.$stfCardId), 1)[0];
if (empty($a)) {
$voipAppointment = json_decode(file_get_contents('https://voip.mephi.ru/appointments/'.$stfCardId.'.json'), 1)['appointment_selected'];
if ($voipAppointment['Id'] != $voipAppointment['StfCardId']) {
$a = json_decode(file_get_contents('https://sd.mephi.ru/api/1/formulars.json?from_local_db=true&active_only=true&api_key='.SDAPI_KEY.'&filter_StfCardId='.$voipAppointment['Id']), 1)[0];
}
if (!empty($a)) {
mail('dyokunev@mephi.ru', 'Wrong StfCardId '.$stfCardId, 'Wrong StfCardId '.$stfCardId.' (sent by /var/www/ut.mephi.ru/root/genpdf2.php)');
}
}
if ((int)$a['Cod_Tip_formular'] == 8) {
$a_prev = json_decode(file_get_contents('https://sd.mephi.ru/api/1/formulars.json?from_local_db=true&last_only=true&api_key='.SDAPI_KEY.'&filter_EmpGUID='.$a['EmpGUID'].'&filter_Cod_Tip_formular=!8'), 1)[0];
error_log('https://sd.mephi.ru/api/1/formulars.json?from_local_db=true&last_only=true&api_key='.SDAPI_KEY.'&filter_EmpGUID='.$a['EmpGUID'].'&filter_Cod_Tip_formular=!8');
if (!empty($a_prev)) {
$a['RateAmount'] = $a_prev['RateAmount'];
}
}
$profKvalLevel = preg_replace('/[.].*+/', '', @$a['ProfKvalLevel']);
$salary = $a['RateAmount']*$salaries[(@$a['ProfKvalGroup']).'-'.$profKvalLevel];
$employeePrefix = '';
if ($a['Cod_Tip_formular']==3 || $a['Cod_Tip_formular']==5) { // Совместитель
/*if ($a['Cod_Tip_formular']==3 || $a['Cod_Tip_formular']==5) { // Совместитель
$as = json_decode(file_get_contents('https://sd.mephi.ru/api/1/formulars.json?from_local_db=true&active_only=true&api_key='.SDAPI_KEY.'&filter_EmpGUID='.preg_replace('/[^0-9]+/', '', $a['EmpGUID'])), 1);
//die('https://sd.mephi.ru/api/1/formulars.json?from_local_db=true&active_only=true&api_key='.SDAPI_KEY.'&filter_EmpGUID'.preg_replace('/[^0-9]+/', '', $a['EmpGUID']));
$employeePrefix = '________________________________';
... ... @@ -242,6 +287,19 @@ switch ($file) {
break;
}
}
}*/
$employeeAppointmentPart0 = $a['Name'];
$employeeAppointmentPart1 = $inflect->getInflectNoun($a['Name_podr'], 0);
$employeeAppointmentPart0Words = split(' ', $employeeAppointmentPart0);
$employeeAppointmentPart1Words = split(' ', $employeeAppointmentPart1);
if (mb_strtolower($employeeAppointmentPart0Words[count($employeeAppointmentPart0Words)-1]) === mb_strtolower($employeeAppointmentPart1Words[0])) {
unset($employeeAppointmentPart0Words[count($employeeAppointmentPart0Words)-1]);
}
$employeeAppointment = join(' ', $employeeAppointmentPart0Words).' '.join(' ', $employeeAppointmentPart1Words);
if ($a['Cod_Tip_formular']==3 || $a['Cod_Tip_formular']==5) { // Совместитель
$employeeAppointment .= ' (совместитель)';
}
$curUnit = json_decode(file_get_contents('https://sd.mephi.ru/api/1/units.json?from_local_db=true&active_only=true&api_key='.SDAPI_KEY.'&filter_id='.preg_replace('/[^0-9]+/', '', $a['OrgDiv'])), 1)[0];
... ... @@ -285,6 +343,16 @@ switch ($file) {
$unitHead = $unitHeadNameWords[0].' '.mb_substr($unitHeadNameWords[1], 0, 1).'.'.mb_substr($unitHeadNameWords[2], 0, 1).'.';
}
if ($unitHead === 'Стриханов М.Н.') {
$unitHead = '_____________';
$unitName = '_____________';
}
if (empty($_REQUEST['auto-director'])) {
$unitHead = '_____________';
$unitName = '_____________';
}
$numberToWords = new NumberToWords();
$numberTransformer = $numberToWords->getNumberTransformer('ru');
... ... @@ -310,22 +378,38 @@ switch ($file) {
$attorney_date = '«___» __________ 20___г';
$attorney_code = '_____________';
switch ((int)$prorector_appointment_id) {
case 155472: // Нагорнов
$attorney_code = '329-17-001/17';
$attorney_date = '«30» декабря 2016г';
case 161842: // Нагорнов
// 2017
//$attorney_code = '329-17-001/17';
//$attorney_date = '«30» декабря 2016г';
// 2018
$attorney_code = '329-017-001/18';
$attorney_date = '«29» декабря 2017г';
break;
case 155480: // Ужва
$attorney_code = '329-17-009/17';
$attorney_date = '«30» декабря 2016г';
case 163540: // Ужва
// 2017
//$attorney_code = '329-17-009/17';
//$attorney_date = '«30» декабря 2016г';
// 2018
$attorney_code = '329-017-003/18';
$attorney_date = '«29» декабря 2017г';
break;
case 155706: // Весна
$attorney_code = '329-17-008/17';
$attorney_date = '«30» декабря 2016г';
case 162863: // Весна
// 2017
//$attorney_code = '329-17-008/17';
//$attorney_date = '«30» декабря 2016г';
// 2018
$attorney_code = '329-017-008/18';
$attorney_date = '«29» декабря 2017г';
break;
case 158626: // Каргин
case -27400500:
$attorney_code = '329-17-002/17';
$attorney_date = '«30» декабря 2016г';
// 2017
//$attorney_code = '329-17-002/17';
//$attorney_date = '«30» декабря 2016г';
// 2018
$attorney_code = '329-017-005/18';
$attorney_date = '«29» декабря 2017г';
break;
}
... ... @@ -343,6 +427,7 @@ switch ($file) {
'unit-head' => $unitHead,
'employee' => $a['SurName'].' '.mb_substr($a['FirstName'], 0, 1).'.'.mb_substr($a['MiddleName'], 0, 1).'.',
'employee-full' => $employeePrefix.$a['SurName'].' '.$a['FirstName'].' '.$a['MiddleName'],
'employee-appointment' => $employeeAppointment,
//'employee-full' => /*$employeePrefix.' '.*/$a['SurName'].' '.$a['FirstName'].' '.$a['MiddleName'],
//'appointment-full' => $employeePrefix,
'employment-contract-date' => formatDate($a['ContDate']),
... ... @@ -350,14 +435,14 @@ switch ($file) {
'ProfKvalGroup' => @$a['ProfKvalGroup'],
'ProfKvalLevel' => $profKvalLevel,
'Salary' => $salary.' руб.',
'SalaryText' => $numberTransformer->toWords($salary).' рублей ноль копеек',
'SalaryText' => $numberTransformer->toWords($salary).' рублей '.($numberTransformer->toWords((int)(($salary - floor($salary))*100))).' копеек',
'MultiplyingFactor' => '______',
'MultiplyingFactorReason' => '_________________________________',
'endDateWas' => @formatDate(@$a['EndDate']),
'endDateBecame' => @$_GET['newEndDate'],
'account' => $account,
'account-manager' => $account_manager,
'change-date' => '«___» __________ 20___г',
'change-date' => $_REQUEST['change-date'],
);
}
switch ($_GET['object-type']) {
... ... @@ -368,8 +453,15 @@ switch ($file) {
$employee = json_decode(file_get_contents("https://cps.mephi.ru/?cmd=getemployeeinfo&e_id=".urlencode($employee_id) ), 1)[$employee_id];
$mySids = array();
foreach ($user->employee->WORKPOSITIONS as $idx => $workposition) {
$mySids[$workposition->s_id] = true;
}
//print_r($user);
//die();
foreach ($employee['WORKPOSITIONS'] as $idx => $workposition) {
if (empty($subordinate_units[$workposition['s_id']])) {
if (empty($subordinate_units[$workposition['s_id']]) && ($mySids[$workposition['s_id']] !== true)) {
unset($employee['WORKPOSITIONS'][$idx]);
}
}
... ... @@ -378,11 +470,18 @@ switch ($file) {
die("Нет должностей данного сотрудника в вашем подчинении");
}
foreach ($employee['WORKPOSITIONS'] as $workposition) {
$newData = newFormularData($workposition['w_id']);
if ($employee_id == $user->employee->e_id) {
$newData = newFormularData((int)$_REQUEST['signer-appointment-id']);
if (!empty($newData)) {
$datas[] = $newData;
}
} else {
foreach ($employee['WORKPOSITIONS'] as $workposition) {
$newData = newFormularData($workposition['w_id']);
if (!empty($newData)) {
$datas[] = $newData;
}
}
}
// $unit;
... ... @@ -401,6 +500,7 @@ switch ($file) {
$check_unit_ids = array($unit_id_asu);
while ($id = array_shift($check_unit_ids)) {
$units = json_decode(file_get_contents('https://sd.mephi.ru/api/1/units.json?from_local_db=true&active_only=true&api_key='.SDAPI_KEY.'&filter_ParentId='.$id), 1);
//error_log('https://sd.mephi.ru/api/1/units.json?from_local_db=true&active_only=true&api_key='.SDAPI_KEY.'&filter_ParentId='.$id);
foreach ($units as &$unit) {
array_push($unit_ids, $unit['id']);
array_push($check_unit_ids, $unit['id']);
... ... @@ -444,6 +544,21 @@ if (empty($datas)) {
die("Нет данных для обработки");
}
$monthName = array(
1 => 'январь',
2 => 'февраль',
3 => 'март',
4 => 'апрель',
5 => 'май',
6 => 'июнь',
7 => 'июль',
8 => 'август',
9 => 'сентябрь',
10 => 'октябрь',
11 => 'ноябрь',
12 => 'декабрь',
);
foreach ($datas as $data) {
$tempdir = tempdir();
... ... @@ -460,10 +575,26 @@ foreach ($datas as $data) {
file_put_contents("request.data.fixed", print_r($data, true));
foreach (array('change') as $key) {
$key .= '-date';
if (empty($data[$key])) {
$data[$key] = '«\_\_\_» \_\_\_\_\_\_\_\_\_\_ 20\_\_\_г';
continue;
}
$date = split('\.', $data[$key]);
if (empty(date[2])) {
$data[$key] = '«\_\_\_» \_\_\_\_\_\_\_\_\_\_ 20\_\_\_г';
continue;
}
$data[$key] = '«'.$date[0].'» '.$inflect->getInflectNoun($monthName[$date[1]+0], 0).' '.$date[2].'г';
}
switch ($file) {
case 'form/updatesalary':
case 'form/updateenddate':
$header = '\mmsagreementheader{'.$data['of-prorector'].'}{'.$data['attorney-date'].'}{'.$data['attorney-code'].'}{'.$data['employee-full'].'}{'.$data['employment-contract-date'].'}{'.$data['employment-contract-code'].'}{'.$data['change-date'].'}';
$header = '\mmsagreementheader{'.$data['of-prorector'].'}{'.$data['attorney-date'].'}{'.$data['attorney-code'].'}{'.$data['employee-full'].'}{'.$data['employee-appointment'].'}{'.$data['employment-contract-date'].'}{'.$data['employment-contract-code'].'}{'.$data['change-date'].'}';
$footer = '\mmsagreementfooter{'.$data['prorector'].'}{'.$data['of-unit'].'}{'.$data['unit-head'].'}{'.$data['account'].'}{'.$data['account-manager'].'}{}{}{'.$data['employee'].'}';
break;
}
... ...
Inflect @ f32761cb
Subproject commit a60c8e42622081bce1e8a04c0d18eef53791418b
Subproject commit f32761cbf38413801210935e70bee9c077d0f335
... ...
... ... @@ -8,7 +8,7 @@
\LoadClass[14pt,a4paper]{extarticle}
% formal requirements
\usepackage[a4paper,hmargin=2.0cm,vmargin=1.1cm]{geometry}
\usepackage[a4paper,hmargin=2.0cm,vmargin=1.1cm,bmargin=0.4cm]{geometry}
\linespread{1.3}
% xetex stuff
... ... @@ -121,10 +121,10 @@
% #5 - employment contract date
% #6 - employment contract code (num)
% #7 - change date
\newcommand{\mmsagreementheader}[7] {
\newcommand{\mmsagreementheader}[8] {
\begin{minipage}[c][\dimexpr2.4cm]{\textwidth}
\begin{spacing}{0.8}
\centering{\MakeUppercase{\fontsize{7pt}{9pt}\selectfont{Федеральное государственное автономное образовательное учреждение высшего профессионального образования}}} \\
\centering{\MakeUppercase{\fontsize{7pt}{9pt}\selectfont{Федеральное государственное автономное образовательное учреждение высшего образования}}} \\
\vspace{0.15cm}
\centering\textbf{\fontsize{12pt}{14pt}{\selectfont{НАЦИОНАЛЬНЫЙ ИССЛЕДОВАТЕЛЬСКИЙ ЯДЕРНЫЙ УНИВЕРСИТЕТ \\ «МИФИ» }}} \\
\raggedleft{\MakeUppercase{\fontsize{10pt}{12pt}\selectfont{ИНН 7724068140}}} \\
... ... @@ -143,7 +143,11 @@
\vspace{-.5cm}
\par \fontsize{13pt}{13pt}\selectfont{НИЯУ МИФИ в лице #1, действующего на основании доверенности от #2, № #3, именуемый в дальнейшем «Работодатель», с одной стороны и #4, именуемый в дальнейшем «Работник», с другой стороны, пришли к соглашению о внесении в трудовой договор от #5 № #6 следующих дополнений и изменений с #7:}
\par \fontsize{13pt}{13pt}\selectfont{НИЯУ МИФИ в лице #1, действующего
на основании доверенности от #2, № #3, именуемый в дальнейшем
«Работодатель», с одной стороны и #4, #5, именуемый в дальнейшем
«Работник», с другой стороны, пришли к соглашению о внесении в трудовой
договор от #6 № #7 с #8 следующих дополнений:}
}
% memorandum footer (signatures)
... ... @@ -177,7 +181,7 @@
\blanksignature{ДУП}
\vfill\null
\columnbreak
\textbf{Работник:}
\noindent\textbf{Работник:}
\newline
\newline
\signature{#8}
... ...
\begin{enumerate}
\item {
Абзацы 1, 2, 3, 4, 5 пункта 3.4 трудового договора изложить в следующей редакции:
Абзацы 1, 2, 3, 4, 5 пункта 3.4 трудового договора от [{employment-contract-date}]
№[{employment-contract-code}] изложить в следующей редакции:
\begin{description}[leftmargin=!]
\item «п.3.4. Заработная плата по настоящему трудовому договору выплачивается два раза в месяц
\item Профессиональная квалификационная группа [{ProfKvalGroup}]
... ...