<td class='firstCol'><?if($arElem['SECTION'] == 1369) {?><b><?=$arResult['INDICATOR_NAMES'][$arElem['SECTION']]?></b><?} else {?><?=$arResult['INDICATOR_NAMES'][$arElem['SECTION']]?><?}?></td>
<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true) die();?>
<div class='kpiIndicator'>
<?//pr($arParams);?>
<?if($arParams['MAIN_PAGE']!=='Y' && $arParams['EDIT']!=='Y'):?>
<div class='departmentFilter'>
<form action='<?=$APPLICATION->GetCurPage();?>' method='get' id='departmentFilterForm'>
<label>
Выбор подразделения для вывода отчетности
<?$APPLICATION->IncludeComponent('areal:department.select','links',
array(
'CACHE_TIME'=>'360000',
'EDIT_KPI'=>'Y',
'EDIT_EVENTS'=>'N',
),
false);?>
</label>
</form>
</div>
<?endif;?>
<h2 class='KPIh2'>Основные показатели деятельности компании<?=($arParams['YEAR'] && $arParams['EDIT']==='Y')?' за '.$arParams['YEAR']:'';?></h2>
<?if($arParams['EDIT']!=='Y'):?>
<div class='period'>
<p>Период
с <input type="text" class="datepicker" id='dpDateFrom' value='<?=date('Y')?>-01'/>
по <input type="text" class="datepicker" id='dpDateTo' value='<?=date('Y')?>-<?=date('m')?>'/>
</p>
</div>
<?else:?>
<form action='<?=$APPLICATION->GetCurPage();?>' method='get' id='yearFilterForm'>
<label>
Выберите год, за который выводить отчет
<select name='year' id='yearKpiTable'>
<?for($i=2013;$i<=date('Y');$i++):?>
<option value='<?=$i?>'<?=($i==$arParams['YEAR'])?' selected':'';?>><?=$i?></option>
<?endfor;?>
</select>
</label>
<input type='hidden' value='Y' name='edit'/>
</form>
<?endif;?>
<?if($arParams['EDIT']!=='Y'):?>
<table class='kpiIndicatorsTable'>
<tr>
<th class="first" width='46%'>ПОКАЗАТЕЛЬ</th>
<th class="second" width='18%'>ПЛАН (год)</th>
<th class="third" width='18%'>ФАКТ</th>
<th class="forth" width='18%'>% ВЫПОЛНЕНИЯ</th>
</tr>
<?foreach($arResult['INDICATORS'] as $id=>$arElem):?>
<?if($arResult['LAST'][$id] && $arElem['SECTION']==1368 || $arResult['LAST'][$id] && $arElem['SECTION']==1369 || $arResult['LAST'][$id] && $arElem['SECTION']==1371){
$arResult['FACT'][$id]=$arResult['LAST'][$id];
}?>
<tr>
<td class='firstCol'><?=$arResult['INDICATOR_NAMES'][$arElem['SECTION']]?></td>
<td class='firstCol'><?if($arElem['SECTION'] == 1369) {?><b><?=$arResult['INDICATOR_NAMES'][$arElem['SECTION']]?></b><?} else {?><?=$arResult['INDICATOR_NAMES'][$arElem['SECTION']]?><?}?></td>
<td>
<?$plan=(double)$arElem['PLAN'];?>
<?=number_format(
$plan,
($plan-(int)$plan)?2:0,
'.',
' '
)?>
</td>
<td>
<?$fakt=(double)$arResult['FACT'][$id];?>
<?=number_format(
$fakt,
($fakt-(int)$fakt)?2:0,
'.',
' '
)?>
</td>
<td>
<?$res=((double)$arElem['PLAN'])?(double)($arResult['FACT'][$id]/$arElem['PLAN']*100):0?>
<?=number_format(
$res,
($res-(int)$res)?2:0,
'.',
' '
);?>
</td>
</tr>
<?endforeach;?>
</table>
<?if($arResult['CAN_EDIT']):?>
<input type='hidden' name='year' id='year' value='<?=date('Y')?>' />
<input type='hidden' name='link' id='link' value='<?=$APPLICATION->GetCurPageParam('edit=Y',array('edit','save'));?>' />
<a href='<?=$APPLICATION->GetCurPageParam('edit=Y',array('edit','save'));?>' class='tableEdit'>Редактировать</a>
<?endif;?>
<?else:?>
<?$APPLICATION->SetTitle('');?>
<form action='<?=$APPLICATION->GetCurPage();?>' id='saveKpiInfo' method='post'>
<table class='kpiIndicatorsTable edited'>
<tr>
<th class="first" rowspan='2'>Показатель</th>
<th class="second" rowspan='2'>План на год</th>
<th class="third" colspan='12'>Факт по месяцам</th>
<th class="forth" rowspan='2' >% выполнения</th>
</tr>
<tr>
<?foreach($arResult['MONTHS'] as $m_id=>$month):?>
<th class='small'><?=$month?></th>
<?endforeach;?>
</tr>
<?foreach($arResult['INDICATORS'] as $id=>$arElem):?>
<?if($arResult['LAST'][$id] && $arElem['SECTION']==1368 || $arResult['LAST'][$id] && $arElem['SECTION']==1369 || $arResult['LAST'][$id] && $arElem['SECTION']==1371){
$arResult['FACT'][$id]=$arResult['LAST'][$id];
}?>
<tr<?=($arElem['SECTION']==1368 || $arElem['SECTION']==1369 || $arElem['SECTION']==1371)?' class="takeLastValue"':'';?>>
<td class='firstCol'><?=$arResult['INDICATOR_NAMES'][$arElem['SECTION']]?></td>
<td class='plan'>
<input type='text' value='<?=(double)$arElem['PLAN']?>' name='INDICATOR[<?=$id?>][PLAN]' class='planInput'/>
</td>
<?foreach($arResult['MONTHS'] as $m_id=>$month):?>
<td class='small'>
<input type='text' class='smallInp' value='<?=($arElem['MONTHS'][$m_id+1]['VALUE'])?$arElem['MONTHS'][$m_id+1]['VALUE']:'';?>' name='INDICATOR[<?=$id?>][MONTHS][<?=$m_id+1?>]'/>
<?if($arElem['MONTHS'][$m_id+1]['ID']):?>
<input type='hidden' value='<?=$arElem['MONTHS'][$m_id+1]['ID']?>' name='MONTHS[<?=$id?>][<?=$m_id+1?>]'/>
<?endif;?>
</td>
<?endforeach;?>
<td class='percent'><?=((double)$arElem['PLAN'])?round((double)($arResult['FACT'][$id]/$arElem['PLAN']*100),2):0;?></td>
</tr>
<?endforeach;?>
</table>
<?=bitrix_sessid_post()?>
<div class='tableEdit'>
<input type='submit' name='save' value='Сохранить' />
<a class='cancel' href='<?=$APPLICATION->GetCurPageParam('',array('edit','save','year'));?>'>Отменить</a>
</div>
</form>
<?/* <a href='<?=$APPLICATION->GetCurPageParam('save=Y',array('edit','save'));?>'>Сохранить</a> */?>
<?endif;?>
</div>
<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true) die();?>
<div class='kpiIndicator'>
<?//pr($arParams);?>
<?if($arParams['MAIN_PAGE']!=='Y' && $arParams['EDIT']!=='Y'):?>
<div class='departmentFilter'>
<form action='<?=$APPLICATION->GetCurPage();?>' method='get' id='departmentFilterForm'>
<label>
Выбор подразделения для вывода отчетности
<?$APPLICATION->IncludeComponent('areal:department.select','links',
array(
'CACHE_TIME'=>'360000',
'EDIT_KPI'=>'Y',
'EDIT_EVENTS'=>'N',
),
false);?>
</label>
</form>
</div>
<?endif;?>
<h2 class='KPIh2'>Основные показатели деятельности компании<?=($arParams['YEAR'] && $arParams['EDIT']==='Y')?' за '.$arParams['YEAR']:'';?></h2>
<?if($arParams['EDIT']!=='Y'):?>
<div class='period'>
<p>Период
с <input type="text" class="datepicker" id='dpDateFrom' value='<?=date('Y')?>-01'/>
по <input type="text" class="datepicker" id='dpDateTo' value='<?=date('Y')?>-<?=date('m')?>'/>
</p>
</div>
<?else:?>
<form action='<?=$APPLICATION->GetCurPage();?>' method='get' id='yearFilterForm'>
<label>
Выберите год, за который выводить отчет
<select name='year' id='yearKpiTable'>
<?for($i=2013;$i<=date('Y');$i++):?>
<option value='<?=$i?>'<?=($i==$arParams['YEAR'])?' selected':'';?>><?=$i?></option>
<?endfor;?>
</select>
</label>
<input type='hidden' value='Y' name='edit'/>
</form>
<?endif;?>
<?if($arParams['EDIT']!=='Y'):?>
<table class='kpiIndicatorsTable'>
<tr>
<th class="first" width='46%'>ПОКАЗАТЕЛЬ</th>
<th class="second" width='18%'>ПЛАН (год)</th>
<th class="third" width='18%'>ФАКТ</th>
<th class="forth" width='18%'>% ВЫПОЛНЕНИЯ</th>
</tr>
<?foreach($arResult['INDICATORS'] as $id=>$arElem):?>
<?if($arResult['LAST'][$id] && $arElem['SECTION']==1368 || $arResult['LAST'][$id] && $arElem['SECTION']==2609 || $arResult['LAST'][$id] && $arElem['SECTION']==2610 || $arResult['LAST'][$id] && $arElem['SECTION']==2611){
$arResult['FACT'][$id]=$arResult['LAST'][$id];
}?>
<tr>
<td class='firstCol'><?=$arResult['INDICATOR_NAMES'][$arElem['SECTION']]?></td>
<td>
<?$plan=(double)$arElem['PLAN'];?>
<?=number_format(
$plan,
($plan-(int)$plan)?2:0,
'.',
' '
)?>
</td>
<td>
<?$fakt=(double)$arResult['FACT'][$id];?>
<?=number_format(
$fakt,
($fakt-(int)$fakt)?2:0,
'.',
' '
)?>
</td>
<td>
<?$res=((double)$arElem['PLAN'])?(double)($arResult['FACT'][$id]/$arElem['PLAN']*100):0?>
<?=number_format(
$res,
($res-(int)$res)?2:0,
'.',
' '
);?>
</td>
</tr>
<?endforeach;?>
</table>
<?if($arResult['CAN_EDIT']):?>
<input type='hidden' name='year' id='year' value='<?=date('Y')?>' />
<input type='hidden' name='link' id='link' value='<?=$APPLICATION->GetCurPageParam('edit=Y',array('edit','save'));?>' />
<a href='<?=$APPLICATION->GetCurPageParam('edit=Y',array('edit','save'));?>' class='tableEdit'>Редактировать</a>
<?endif;?>
<?else:?>
<?$APPLICATION->SetTitle('');?>
<form action='<?=$APPLICATION->GetCurPage();?>' id='saveKpiInfo' method='post'>
<table class='kpiIndicatorsTable edited'>
<tr>
<th class="first" rowspan='2'>Показатель</th>
<th class="second" rowspan='2'>План на год</th>
<th class="third" colspan='12'>Факт по месяцам</th>
<th class="forth" rowspan='2' >% выполнения</th>
</tr>
<tr>
<?foreach($arResult['MONTHS'] as $m_id=>$month):?>
<th class='small'><?=$month?></th>
<?endforeach;?>
</tr>
<?foreach($arResult['INDICATORS'] as $id=>$arElem):?>
<?if($arResult['LAST'][$id] && $arElem['SECTION']==1368 || $arResult['LAST'][$id] && $arElem['SECTION']==2609 || $arResult['LAST'][$id] && $arElem['SECTION']==2610 || $arResult['LAST'][$id] && $arElem['SECTION']==2611){
$arResult['FACT'][$id]=$arResult['LAST'][$id];
}?>
<tr<?=($arElem['SECTION']==1368 || $arElem['SECTION']==2609 || $arElem['SECTION']==2610 || $arElem['SECTION']==2611)?' class="takeLastValue"':'';?>>
<td class='firstCol'><?=$arResult['INDICATOR_NAMES'][$arElem['SECTION']]?></td>
<td class='plan'>
<input type='text' value='<?=(double)$arElem['PLAN']?>' name='INDICATOR[<?=$id?>][PLAN]' class='planInput'/>
</td>
<?foreach($arResult['MONTHS'] as $m_id=>$month):?>
<td class='small'>
<input type='text' class='smallInp' value='<?=($arElem['MONTHS'][$m_id+1]['VALUE'])?$arElem['MONTHS'][$m_id+1]['VALUE']:'';?>' name='INDICATOR[<?=$id?>][MONTHS][<?=$m_id+1?>]'/>
<?if($arElem['MONTHS'][$m_id+1]['ID']):?>
<input type='hidden' value='<?=$arElem['MONTHS'][$m_id+1]['ID']?>' name='MONTHS[<?=$id?>][<?=$m_id+1?>]'/>
<?endif;?>
</td>
<?endforeach;?>
<td class='percent'><?=((double)$arElem['PLAN'])?round((double)($arResult['FACT'][$id]/$arElem['PLAN']*100),2):0;?></td>
</tr>
<?endforeach;?>
</table>
<?=bitrix_sessid_post()?>
<div class='tableEdit'>
<input type='submit' name='save' value='Сохранить' />
<a class='cancel' href='<?=$APPLICATION->GetCurPageParam('',array('edit','save','year'));?>'>Отменить</a>
</div>
</form>
<?/* <a href='<?=$APPLICATION->GetCurPageParam('save=Y',array('edit','save'));?>'>Сохранить</a> */?>
<?endif;?>
</div>