Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php /* * Copyright (c) 2022, Documentolog LLP * This program is commercial software..

Decoded Output download

<?php 
/* 
 * Copyright (c) 2022, Documentolog LLP 
 * This program is commercial software: 
 * you can not redistribute it and/or modify it. 
 */ 
namespace app\workflow; 
 
defined('KNQv_B_KBg') or die('No direct access allowed.'); 
class WFW 
{ 
    public static function familytreevar($a, $sDoctypeId, $sDocumentId, $iDepth = 0, $sNamespace = '') 
    { 
        ob_start(); 
        ?> 
        <?php  
        if (!(isset($a[0]['childs']) && count($a[0]['childs']) || $iDepth != 0)) { 
            goto Label_36668; 
        } 
        ?> 
        <?php  
        $sFamilyTreeId = sprintf('%08x%x%08x', mt_rand(), time(), mt_rand()) . '_' . $iDepth; 
        ?> 
 
        <ul id='field_family_tree_<?php  
        echo $sFamilyTreeId; 
        ?> 
' class='family_tree field_family_tree <?php  
        echo $sNamespace; 
        ?> 
 <?php  
        echo !$iDepth ? 'root' : ''; 
        ?> 
'> 
            <?php  
        foreach ($a as $aV) { 
            ?> 
                <li> 
                    <?php  
            if ($aV['doctype_id'] == $sDoctypeId && $aV['id'] == $sDocumentId) { 
                goto Label_36665; 
            } 
            ?> 
                        <span class='title'><?php  
             
            ?> 
								<span class='btn_fastopen' data-href='/workflow/document/fast-view/<?php  
            echo $aV['doctype_id']; 
            ?> 
/<?php  
            echo $aV['id']; 
            ?> 
'>&nbsp;</span><span class='arrow'>&nbsp;</span> 
								<a class='caption' href='/workflow/document/view/<?php  
            echo $aV['doctype_id']; 
            ?> 
/<?php  
            echo $aV['id']; 
            ?> 
'><?php  
            echo $aV['title']; 
            ?> 
</a> 
							</span> 
                    <?php  
            goto Label_36666; 
            Label_36665: 
            ?> 
                        <span class='title current' title='<?php  
            echo \app\system\Registry::get('locale')->get('\xd0\242\320\xb5\xd0\xba\321\x83\xd1\211\320\xb8\xd0\xb9 \xd0\xb4\320\xbe\xd0\xba\321\203\320\xbc\320\xb5\xd0\xbd\321\x82'); 
            ?> 
'> 
								<span class='arrow'>&nbsp;</span><span class='caption'><?php  
            echo $aV['title']; 
            ?> 
</span> 
							</span> 
                    <?php  
            Label_36666: 
            ?> 
                    <?php  
            if (!count($aV['childs'])) { 
                goto Label_36667; 
            } 
            ?> 
                        <?php  
            echo \app\workflow\WFW::familytreevar($aV['childs'], $sDoctypeId, $sDocumentId, $iDepth + 1); 
            ?> 
                    <?php  
            Label_36667: 
            ?> 
                </li> 
            <?php  
        } 
        ?> 
        </ul> 
    <?php  
        Label_36668: 
        ?> 
 
        <?php  
        if (!(strlen($sNamespace) && isset($sFamilyTreeId))) { 
            goto Label_36669; 
        } 
        ?> 
        <script type='text/javascript'> 
            if (!window.FIELDS_BANK[ 'field_family_tree_<?php  
        echo $sFamilyTreeId; 
        ?> 
' ]) 
            { 
                window.FIELDS_BANK['field_family_tree_<?php  
        echo $sFamilyTreeId; 
        ?> 
'] = new MSF_DocumentFamilyTree( '#field_family_tree_<?php  
        echo $sFamilyTreeId; 
        ?> 
' ); 
            } 
        </script> 
    <?php  
        Label_36669: 
        ?> 
 
        <?php  
        $s = ob_get_clean(); 
        return $s; 
    } 
    public static function reportvarview($sFilePath, $sSale, $sType, $oDoctype, $oDocument) 
    { 
        $Registry = get_class(new \app\system\Registry()); 
        $Json = get_class(new \app\system\Json()); 
        $ArrayMapperUtil = get_class(new \app\reference\engine\ArrayMapperUtil()); 
        $sid = \app\user\Account::getaccount()->getsid(); 
        $ListModel = get_class(\app\system\model\ListModel::getlist()); 
        ob_start(); 
        if (!(!empty($sFilePath) && file_exists($sFilePath))) { 
            goto Label_36670; 
        } 
        include $sFilePath; 
        Label_36670: 
        $s = ob_get_clean(); 
        return $s; 
    } 
    public static function roadmapvar($sDoctypeId, $a) 
    { 
        $aLcl = array(); 
        $sLocale = \app\user\Account::getaccount()->getlocale(); 
        if (!($sLocale !== 'ru' && array_key_exists($sLocale, \app\system\Registry::get('config')->get('app_locales')))) { 
            goto Label_36671; 
        } 
        $aL = \app\system\Registry::get('locale_info'); 
        $aLcl = array_merge($aL['pst'], $aL['sdv'], $aL['grp']); 
        Label_36671: 
        ob_start(); 
        $ID = \app\system\Util::randomstring(3); 
        ?> 
        <div class='control_timeline clearfix' id='control_timeline_<?php  
        echo $ID; 
        ?> 
' style='display: inline-block;'> 
            <?php  
        if (!(array_key_exists('points', $a) && array_key_exists('current', $a))) { 
            goto Label_36680; 
        } 
        $iNum = 1; 
        $sPointType = 'complete'; 
        $iCompletedPointsCount = 0; 
        $aPoints = array(); 
        $aPointsPrintable = array(); 
        foreach ($a['points'] as $sPoint => $aData) { 
            if (!count($aData['respondent'])) { 
                goto Label_36672; 
            } 
            foreach ($aData['respondent'] as $sKey => &$sVal) { 
                $sVal = strtr($sVal, a($aLcl, $sKey, array())); 
            } 
            Label_36672: 
            if (!mb_strstr($aData['title'], '$')) { 
                goto Label_36673; 
            } 
            $aData['title'] = mb_substr($aData['title'], mb_strpos($aData['title'], '$') + 1); 
            Label_36673: 
            $aData['title'] = \app\system\Registry::get('locale')->get($aData['title'], '\320\x94\320\xbe\320\xba\321\x83\xd0\xbc\xd0\265\xd0\275\321\202\321\x8b', '\320\x9c\xd0\xb0\xd1\x80\321\210\xd1\x80\321\203\321\202', vsprintf('%s-%s-title', array($sDoctypeId, $sPoint))); 
            if (!mb_strstr($aData['title'], '$')) { 
                goto Label_36674; 
            } 
            $aData['title'] = mb_substr($aData['title'], mb_strpos($aData['title'], '$') + 1); 
            Label_36674: 
            $show_in_progress_if_current = $aData['show_in_progress_if_current'] && $sPoint === $a['current']; 
            if (!($aData['show_in_progress'] || $show_in_progress_if_current)) { 
                goto Label_36678; 
            } 
            if (!($sPointType === 'current')) { 
                goto Label_36675; 
            } 
            $sPointType = ''; 
            Label_36675: 
            if (!($sPoint === $a['current'])) { 
                goto Label_36676; 
            } 
            $sPointType = 'current'; 
            Label_36676: 
            if (!($sPointType === 'complete')) { 
                goto Label_36677; 
            } 
            $iCompletedPointsCount++; 
            Label_36677: 
            $aPoints[] = '<li class="point' . ($sPointType ? ' ' : '') . $sPointType . '">' . $iNum++ . '<span class="point_hint" style="display: none;">' . '<span class="title">' . $aData['title'] . '</span>' . (count($aData['respondent']) ? '<br /><span class="respondents_list"><strong>' . \app\system\Registry::get('locale')->get('\xd0\236\xd1\202\320\262\xd0\265\321\202\321\x81\xd1\202\xd0\xb2\xd0\265\320\xbd\xd0\xbd\xd1\213\xd0\xb5') . '</strong><br />' . join('<br />', $aData['respondent']) . '</span>' : '') . '</span>' . '</li>'; 
            $aPointsPrintable[] = '<span class="point' . ($sPointType ? ' ' : '') . $sPointType . '">' . ($sPointType === 'complete' ? ' \xe2\x9c\224 ' : '') . $aData['title'] . '</span>'; 
            Label_36678: 
        } 
        $iPointWidth = 28; 
        $iPointsSpace = 25; 
        $iPointsCount = sizeof($aPoints); 
        $iLineWidth = $iPointsCount * $iPointWidth + ($iPointsCount - 1) * $iPointsSpace - 1; 
        $iProgressWidth = $iCompletedPointsCount * $iPointWidth + $iCompletedPointsCount * $iPointsSpace - ($iCompletedPointsCount == $iPointsCount ? $iPointsSpace + 2 : 0); 
        if (!($iPointsCount < 7)) { 
            goto Label_36679; 
        } 
        echo '<style>.control_timeline .line_points .point { min-width: 110px;}</style>'; 
        Label_36679: 
         
        ?> 
 
                <div class='control_timeline_inner clearfix noprint'> 
                    <ul class='line_points clearfix'><?php  
        echo join('', $aPoints); 
        ?> 
</ul> 
                    <p class='line'>&nbsp;</p> 
                    <p class='line_progress' style='width:<?php  
        echo $iProgressWidth; 
        ?> 
px;'>&nbsp;</p> 
                </div> 
 
                <div class='control_timeline_inner print'> 
                    <?php  
        echo join(' &rarr; ', $aPointsPrintable); 
        ?> 
                </div> 
            <?php  
        Label_36680: 
        ?> 
        </div> 
        <script type='text/javascript'> 
            ControlTimeline.start('#control_timeline_<?php  
        echo $ID; 
        ?> 
'); 
        </script> 
        <?php  
        $s = ob_get_clean(); 
        return $s; 
    } 
    public static function progressvar($a, $sUri) 
    { 
        ob_start(); 
        ?> 
        <style> 
            .search_input { 
                float: right; 
            } 
            #search_buttom { 
                border: none; 
                background: transparent; 
            } 
            .search_input #search_loading { 
                margin-right: 37px; 
                margin-top: 4px; 
            } 
 
        </style> 
        <div id='document_log' class='field_big_wrap document_log collapsed' data-uri='<?php  
        echo $sUri; 
        ?> 
'> 
            <input type='hidden' value='notloadedyet' id='hasProgress' /> 
            <h3> 
                <?php  
        echo \app\system\Registry::get('locale')->get('\320\245\320\276\xd0\264 \xd1\200\xd0\xb0\xd0\xb1\320\xbe\xd1\202\xd1\x8b'); 
        ?> 
                <span class='control_micro_tabs view_mode' style='display:none'> 
					<a href='#' class='tab short current btn btn-xs'><?php  
        echo \app\system\Registry::get('locale')->get('\320\x9a\320\xbe\321\200\xd0\276\321\x82\xd0\272\320\276'); 
        ?> 
</a><a href='#' class='tab full  btn btn-xs'><?php  
        echo \app\system\Registry::get('locale')->get('\xd0\x9f\320\xbe\xd0\xb4\xd1\x80\xd0\276\320\xb1\320\xbd\xd0\276'); 
        ?> 
</a> 
				</span> 
                <span class='search_input form-group form-group-sm' id='search_bar' style='display:none' ><button id='search_buttom' class='iconBtnForSearching field_keyword' title='<?php  
        echo \app\system\Registry::get('locale')->get('\320\235\320\260\xd0\xb9\321\x82\xd0\270'); 
        ?> 
' value='<?php  
        echo \app\system\Registry::get('locale')->get('\xd0\x9d\xd0\xb0\xd0\xb9\xd1\x82\320\270'); 
        ?> 
'></button> 
                    <input id='search_username' class='field_keyword form-control input-sm' title='<?php  
        echo \app\system\Registry::get('locale')->get('\xd0\x9d\320\xb0\320\271\xd1\x82\320\270 \xd0\277\320\276 \320\244\320\x98\xd0\236'); 
        ?> 
' type='text' placeholder='<?php  
        echo \app\system\Registry::get('locale')->get('\320\x9d\xd0\xb0\320\271\321\202\xd0\270'); 
        ?> 
'> 
                    <select id='search_title' class='form-control input-inline input-sm'> 
                        <option value=''><?php  
        echo \app\system\Registry::get('locale')->get('\xd0\x9d\320\xb5 \320\xb2\xd1\213\320\261\xd1\200\xd0\xb0\xd0\xbd\xd0\276'); 
        ?> 
</option> 
                        <?php  
        foreach (\app\workflow\util\Util::getactiontypes() as $Key => $sV) { 
            ?> 
                            <option value='<?php  
            echo $sV; 
            ?> 
'><?php  
            echo $sV; 
            ?> 
</option> 
                        <?php  
        } 
        ?> 
                    </select> 
                    <img id='search_loading' style='display: none;' src='/tpl/web/img/loading.gif' /> 
                </span> 
            </h3> 
            <div class='inner_wrap wrap' style='display:none'></div> 
            <div class='inner_wrap searchwrap' style='display:none'></div> 
        </div> 
 
 
        <script type='text/javascript'> 
            MSF_App.bind_starter(function() 
            { 
                window.DOCUMENT_LOG = new MSF_DocumentLog( '#document_log' ); 
            }, 'document_log'); 
        </script> 
 
        <?php  
        $s = ob_get_clean(); 
        return $s; 
    } 
    public static function employeeratingvar($a, $sPointName, $sDocumentId, $sDoctypeId, $hasAccess) 
    { 
        ob_start(); 
        $oL = \app\system\Registry::get('locale'); 
        if ($hasAccess && $sDoctypeId === '61957637-5a52-49d7-9900-574e6c8003c8' && $sPointName === 'p_e1302a6') { 
            goto Label_36720; 
        } 
        if ($sDoctypeId === '61957637-5a52-49d7-9900-574e6c8003c8' && $sPointName === 'p_e1302a6') { 
            goto Label_36721; 
        } 
        if ($sDoctypeId === '408acd1a-4e1a-4256-978c-574d77fd00fb' && $sPointName === 'p_813e80a') { 
            goto Label_36722; 
        } 
        goto Label_36719; 
        Label_36720: 
        ?> 
 
            <style type='text/css'> 
                /* <![CDATA[ */ 
 
                .bold { 
                    font-weight: bold; 
                } 
 
                .center { 
                    text-align: center; 
                } 
 
                #rating_table { 
                    border: 1px solid #dddddd; 
                    border-collapse: collapse; 
                    table-layout: fixed; 
                } 
 
                #rating_table .field_title { 
                    background-color: #003b6a; 
                    color: #ffffff; 
                } 
 
                #rating_table .field_title_description { 
                    vertical-align: top; 
                } 
 
                #rating_table .field_title_description, 
                #rating_table .employee { 
                    background-color: #edf3ff; 
                } 
 
                #rating_table .separator_container { 
                    background-color: #ffffff; 
                    border: 1px solid white; 
                } 
 
                #rating_buttons li { 
                    display: inline-block; 
                    list-style: none; 
                    margin: 0; 
                } 
 
                #rating_buttons li:not(:first-child) { 
                    margin: 0 0 0 22px; 
                } 
 
                /* ]]> */ 
            </style> 
 
            <form action='/workflow/rate-employee' method='POST' id='rating_form'> 
                <input type='hidden' name='token' value='<?php  
        echo v(a($_GET, 'token', '----')); 
        ?> 
'> 
                <table class='field_table_view table_key_value' id='rating_table'> 
                    <tbody> 
                    <tr class='trow'> 
                        <td class='field_title center'><span class='bold'><?php  
        echo $oL->get('\xd0\x9e\321\x86\xd0\xb5\xd0\xbd\xd0\xb8\320\xb2\320\260\320\xb5\320\274\321\x8b\320\271'); 
        ?> 
</span></td> 
                        <td class='field_title center'><span class='bold'><?php  
        echo $oL->get('\xd0\237\321\x80\320\xbe\xd1\x84\320\265\xd1\201\321\x81\xd0\xb8\xd0\xbe\xd0\275\xd0\xb0\xd0\273\320\270\320\267\320\274'); 
        ?> 
</span></td> 
                        <td class='field_title center'><span class='bold'><?php  
        echo $oL->get('\xd0\x9e\320\xbf\320\xb5\xd1\x80\320\xb0\321\202\320\xb8\xd0\xb2\320\275\320\xbe\xd1\201\321\x82\xd1\214'); 
        ?> 
</span></td> 
                        <td class='field_title center'><span class='bold'><?php  
        echo $oL->get('\320\x9a\xd0\276\xd0\274\xd0\xbc\321\203\320\275\xd0\xb8\xd0\xba\xd0\260\xd0\xb1\320\xb5\xd0\273\xd1\x8c\320\275\xd0\276\321\201\321\202\xd1\214'); 
        ?> 
</span></td> 
                        <td class='field_title center'><span class='bold'><?php  
        echo $oL->get('\xd0\236\xd1\x82\320\262\xd0\265\xd1\202\321\x81\321\x82\320\262\320\265\xd0\xbd\xd0\xbd\320\276\xd1\201\321\202\321\214'); 
        ?> 
</span></td> 
                        <td class='field_title center'><span class='bold'><?php  
        echo $oL->get('\xd0\230\xd0\275\xd0\xb8\xd1\x86\xd0\xb8\320\260\321\202\320\xb8\xd0\xb2\xd0\xbd\320\276\321\201\321\202\xd1\214'); 
        ?> 
</span></td> 
                    </tr> 
                    <tr class='trow'> 
                        <td class='field_title_description'></td> 
                        <td class='field_title_description'><p><?php  
        echo $oL->get('\320\235\xd0\260 \xd1\201\xd0\xba\xd0\276\xd0\xbb\321\x8c\320\272\320\276 \xd0\xba\xd0\xb0\321\207\xd0\xb5\xd1\x81\321\202\xd0\xb2\xd0\265\320\xbd\320\xbd\320\xbe \xd0\270\xd1\201\320\xbf\320\276\xd0\273\320\275\xd1\x8f\xd0\xb5\321\202 \321\x81\320\262\xd0\276\320\xb8 \320\267\320\260\xd0\264\320\xb0\xd1\207\xd0\xb8?'); 
        ?> 
</p></td> 
                        <td class='field_title_description'><p><?php  
        echo $oL->get('\320\235\320\xb0 \321\201\xd0\xba\320\276\320\273\321\214\320\xba\xd0\xbe \320\261\321\x8b\xd1\201\xd1\202\xd1\x80\xd0\276 \320\270\321\201\320\277\xd0\276\320\xbb\320\xbd\321\217\320\265\321\202 \321\201\xd0\xb2\320\276\320\xb8 \320\267\xd0\260\320\264\xd0\xb0\xd1\x87\xd0\xb8?'); 
        ?> 
</p></td> 
                        <td class='field_title_description'><p><?php  
        echo $oL->get('\320\x9d\320\260 \xd1\x81\xd0\272\xd0\xbe\320\xbb\321\214\xd0\272\320\xbe \xd1\x8d\321\x84\xd1\x84\xd0\265\xd0\xba\xd1\x82\xd0\270\320\262\xd0\275\xd0\276 \xd0\xb2\320\267\320\260\320\xb8\320\xbc\xd0\276\320\xb4\xd0\xb5\xd0\xb9\321\201\321\202\320\262\xd1\203\320\xb5\321\202 \321\201 \320\xba\320\xbe\320\xbb\320\273\xd0\265\xd0\xb3\xd0\xb0\xd0\274\320\270 \xd0\264\320\273\xd1\x8f \xd0\270\xd1\201\xd0\277\xd0\276\xd0\xbb\xd0\xbd\320\xb5\xd0\275\xd0\270\xd1\x8f \321\x81\320\xb2\320\xbe\320\xb8\321\205 \xd0\267\320\260\320\264\320\260\321\207'); 
        ?> 
</p></td> 
                        <td class='field_title_description'><p><?php  
        echo $oL->get('\320\x9d\xd0\260 \xd1\x81\xd0\xba\xd0\276\320\xbb\xd1\x8c\320\xba\xd0\276 \xd1\205\xd0\xbe\321\200\xd0\xbe\xd1\210\320\xbe \320\xbe\xd1\202\320\xb2\320\265\321\207\320\xb0\320\265\321\202 \320\267\320\xb0 \321\201\320\xb2\320\xbe\320\270 \320\267\xd0\xb0\320\xb4\xd0\xb0\xd1\207\xd0\xb8'); 
        ?> 
</p></td> 
                        <td class='field_title_description'><p><?php  
        echo $oL->get('\xd0\x9d\320\260 \xd1\x81\320\272\xd0\276\xd0\273\xd1\x8c\320\xba\320\276 \xd1\201\xd0\260\320\274\xd0\xbe\xd1\201\xd1\202\xd0\276\321\x8f\321\x82\xd0\xb5\xd0\xbb\321\214\320\xbd\xd0\xbe \320\270\321\x81\320\xbf\xd0\xbe\320\xbb\xd0\xbd\xd1\217\320\xb5\321\x82 \xd0\267\xd0\260\320\264\320\260\321\207\xd0\xb8 \320\xb8 \320\277\xd1\x80\320\265\xd0\264\xd0\xbb\320\xb0\xd0\xb3\320\xb0\xd0\xb5\321\202 \320\xb2\xd0\xb0\321\x80\xd0\xb8\xd0\260\xd0\xbd\321\x82\xd1\213 \321\x80\xd0\xb5\xd1\x88\xd0\xb5\320\xbd\xd0\270\xd0\xb9'); 
        ?> 
</p></td> 
                    </tr> 
                    <?php  
        foreach ($a['employees'] as $sK => $sV) { 
            ?> 
                        <tr class='trow'> 
                            <td class='employee'> 
                                <span><?php  
            echo $sV; 
            ?> 
</span> 
                                <input type='hidden' name='employees[<?php  
            echo $sK; 
            ?> 
][employee][<?php  
            echo $sK; 
            ?> 
]' value='<?php  
            echo $sV; 
            ?> 
' id='<?php  
            echo $sK; 
            ?> 
_employee'> 
                            </td> 
                            <td class='center'> 
                                <input type='hidden' name='employees[<?php  
            echo $sK; 
            ?> 
][professionalism][employee]' value='<?php  
            echo $sV; 
            ?> 
'> 
                                <select name='employees[<?php  
            echo $sK; 
            ?> 
][professionalism][value]' value='' id='<?php  
            echo $sK; 
            ?> 
_professionalism_rating'> 
                                    <option value=''></option> 
                                    <?php  
            foreach ($a['ratings'] as $iK2 => $sV2) { 
                ?> 
                                        <option value='<?php  
                echo $iK2; 
                ?> 
'><?php  
                echo $sV2; 
                ?> 
</option> 
                                    <?php  
            } 
            ?> 
                                </select> 
                            </td> 
                            <td class='center'> 
                                <input type='hidden' name='employees[<?php  
            echo $sK; 
            ?> 
][operativeness][employee]' value='<?php  
            echo $sV; 
            ?> 
'> 
                                <select name='employees[<?php  
            echo $sK; 
            ?> 
][operativeness][value]' value='' id='<?php  
            echo $sK; 
            ?> 
_operativeness_rating'> 
                                    <option value=''></option> 
                                    <?php  
            foreach ($a['ratings'] as $iK2 => $sV2) { 
                ?> 
                                        <option value='<?php  
                echo $iK2; 
                ?> 
'><?php  
                echo $sV2; 
                ?> 
</option> 
                                    <?php  
            } 
            ?> 
                                </select> 
                            </td> 
                            <td class='center'> 
                                <input type='hidden' name='employees[<?php  
            echo $sK; 
            ?> 
][communicability][employee]' value='<?php  
            echo $sV; 
            ?> 
'> 
                                <select name='employees[<?php  
            echo $sK; 
            ?> 
][communicability][value]' value='' id='<?php  
            echo $sK; 
            ?> 
_communicability_rating'> 
                                    <option value=''></option> 
                                    <?php  
            foreach ($a['ratings'] as $iK2 => $sV2) { 
                ?> 
                                        <option value='<?php  
                echo $iK2; 
                ?> 
'><?php  
                echo $sV2; 
                ?> 
</option> 
                                    <?php  
            } 
            ?> 
                                </select> 
                            </td> 
                            <td class='center'> 
                                <input type='hidden' name='employees[<?php  
            echo $sK; 
            ?> 
][responsibility][employee]' value='<?php  
            echo $sV; 
            ?> 
'> 
                                <select name='employees[<?php  
            echo $sK; 
            ?> 
][responsibility][value]' value='' id='<?php  
            echo $sK; 
            ?> 
_responsibility_rating'> 
                                    <option value=''></option> 
                                    <?php  
            foreach ($a['ratings'] as $iK2 => $sV2) { 
                ?> 
                                        <option value='<?php  
                echo $iK2; 
                ?> 
'><?php  
                echo $sV2; 
                ?> 
</option> 
                                    <?php  
            } 
            ?> 
                                </select> 
                            </td> 
                            <td class='center'> 
                                <input type='hidden' name='employees[<?php  
            echo $sK; 
            ?> 
][initiative][employee]' value='<?php  
            echo $sV; 
            ?> 
'> 
                                <select name='employees[<?php  
            echo $sK; 
            ?> 
][initiative][value]' value='' id='<?php  
            echo $sK; 
            ?> 
_initiative_rating'> 
                                    <option value=''></option> 
                                    <?php  
            foreach ($a['ratings'] as $iK2 => $sV2) { 
                ?> 
                                        <option value='<?php  
                echo $iK2; 
                ?> 
'><?php  
                echo $sV2; 
                ?> 
</option> 
                                    <?php  
            } 
            ?> 
                                </select> 
                            </td> 
                        </tr> 
                    <?php  
        } 
        ?> 
                    <?php  
         
        ?> 
                    </tbody> 
                </table> 
 
                <ul class='content_bottom_toolbar_inner clearfix btn_clickmenu clickMenu' id='rating_buttons'> 
                    <li class='btn btn_submit cmMain'> 
                        <input type='button' value='<?php  
        echo $oL->get('\xd0\241\320\xbe\xd1\205\321\200\xd0\260\xd0\xbd\xd0\xb8\xd1\202\xd1\x8c'); 
        ?> 
' class='msf_form_submit'> 
                    </li> 
                </ul> 
            </form> 
 
            <script type='text/javascript'> 
                /* <![CDATA[ */ 
 
                $(document).ready(function () { 
                    $('#rating_buttons').delegate('.msf_form_submit', 'click', function () { 
                        if (confirm('  ?')) { 
                            var $oForm = $('#rating_form'); 
                            var sFormUrl = $oForm.attr('action'); 
                            var aFormData = $oForm.serializeArray(); 
 
                            var oExtraData = { name: 'msf_id', value: $('input[name='msf_id']').val() }; 
                            var sExtraData = $.param(oExtraData); 
 
                            var aPostData = aFormData; 
                            aPostData.push(oExtraData); 
                            var sPostData = $.param(aPostData); 
 
                            $.post(sFormUrl, sPostData, function (data) { 
                                MSF_StatusBar.showStatus(data); 
                            }, 'json'); 
                        } 
                    }); 
                }); 
 
                /* ]]> */ 
            </script> 
 
            <?php  
         
        goto Label_36719; 
        Label_36721: 
         
        goto Label_36719; 
        Label_36722: 
        ?> 
 
            <style type='text/css'> 
                /* <![CDATA[ */ 
 
                .bold { 
                    font-weight: bold; 
                } 
 
                .center { 
                    text-align: center; 
                } 
 
                .font-red { 
                    color: red; 
                } 
 
                #rating_table { 
                    border: 1px solid #dddddd; 
                    border-collapse: collapse; 
                    table-layout: fixed; 
                } 
 
                #rating_table .field_title { 
                    background-color: #003b6a; 
                    color: #ffffff; 
                } 
 
                #rating_table .field_title_description { 
                    vertical-align: top; 
                } 
 
                #rating_table .field_title_description, 
                #rating_table .employee { 
                    background-color: #edf3ff; 
                } 
 
                #rating_table .separator_container { 
                    background-color: #ffffff; 
                    border: 1px solid white; 
                } 
 
                /* ]]> */ 
            </style> 
 
            <table class='field_table_view table_key_value' id='rating_table'> 
                <tbody> 
                <tr class='trow'> 
                    <td class='field_title center'><span class='bold'><?php  
        echo $oL->get('\320\x9e\321\206\320\xb5\320\xbd\xd0\xb8\320\262\xd0\xb0\xd0\xb5\320\274\321\213\xd0\271'); 
        ?> 
</span></td> 
                    <td class='field_title center'><span class='bold'><?php  
        echo $oL->get('\xd0\237\321\200\xd0\276\xd1\204\xd0\xb5\xd1\201\xd1\201\xd0\270\xd0\276\320\xbd\xd0\xb0\320\xbb\320\270\320\xb7\320\274'); 
        ?> 
</span></td> 
                    <td class='field_title center'><span class='bold'><?php  
        echo $oL->get('\320\x9e\320\xbf\320\xb5\321\x80\320\260\xd1\202\xd0\270\320\xb2\xd0\xbd\320\276\321\x81\xd1\202\321\x8c'); 
        ?> 
</span></td> 
                    <td class='field_title center'><span class='bold'><?php  
        echo $oL->get('\320\x9a\320\276\xd0\274\320\xbc\321\x83\320\xbd\320\xb8\320\xba\xd0\260\xd0\261\320\xb5\320\273\321\214\xd0\275\320\xbe\321\x81\xd1\x82\xd1\x8c'); 
        ?> 
</span></td> 
                    <td class='field_title center'><span class='bold'><?php  
        echo $oL->get('\320\x9e\xd1\x82\320\262\xd0\265\xd1\202\321\x81\xd1\202\xd0\262\320\265\320\xbd\320\275\xd0\xbe\xd1\x81\xd1\202\321\x8c'); 
        ?> 
</span></td> 
                    <td class='field_title center'><span class='bold'><?php  
        echo $oL->get('\320\x98\320\xbd\xd0\xb8\321\206\xd0\270\320\260\xd1\x82\320\xb8\320\xb2\xd0\xbd\xd0\xbe\321\201\321\x82\321\214'); 
        ?> 
</span></td> 
                    <td class='field_title center'><span class='bold'></span></td> 
                </tr> 
                <tr class='trow'> 
                    <td class='field_title_description'></td> 
                    <td class='field_title_description'><p><?php  
        echo $oL->get('\xd0\x9d\xd0\260 \xd1\x81\320\xba\320\xbe\xd0\273\xd1\214\320\272\320\xbe \xd0\xba\320\260\321\207\320\265\321\201\321\x82\320\xb2\320\xb5\320\xbd\xd0\275\320\276 \xd0\270\321\201\xd0\277\xd0\276\xd0\273\320\xbd\xd1\217\xd0\265\321\x82 \321\201\xd0\262\xd0\276\320\270 \xd0\xb7\xd0\260\xd0\xb4\320\260\xd1\x87\xd0\xb8?'); 
        ?> 
</p></td> 
                    <td class='field_title_description'><p><?php  
        echo $oL->get('\xd0\x9d\xd0\260 \xd1\201\xd0\272\320\xbe\xd0\xbb\321\214\xd0\xba\320\276 \320\xb1\xd1\213\xd1\x81\xd1\x82\xd1\x80\320\xbe \xd0\270\xd1\201\xd0\xbf\320\xbe\320\273\320\275\xd1\x8f\320\xb5\xd1\202 \xd1\x81\xd0\xb2\320\276\xd0\270 \xd0\xb7\xd0\260\320\264\320\xb0\xd1\x87\xd0\270?'); 
        ?> 
</p></td> 
                    <td class='field_title_description'><p><?php  
        echo $oL->get('\320\x9d\xd0\xb0 \321\201\320\272\xd0\xbe\320\xbb\xd1\214\320\xba\xd0\xbe \321\x8d\xd1\x84\321\204\xd0\265\xd0\272\xd1\202\xd0\xb8\xd0\xb2\320\xbd\xd0\276 \xd0\262\xd0\xb7\xd0\260\320\270\320\xbc\xd0\276\320\xb4\xd0\xb5\320\271\321\x81\xd1\202\xd0\xb2\xd1\x83\320\265\xd1\202 \321\201 \xd0\xba\320\276\xd0\xbb\xd0\273\320\265\320\xb3\xd0\260\xd0\xbc\xd0\270 \xd0\xb4\xd0\273\xd1\x8f \xd0\xb8\xd1\201\xd0\277\320\xbe\xd0\273\320\xbd\320\265\320\xbd\xd0\xb8\321\217 \xd1\x81\xd0\262\xd0\276\xd0\270\321\205 \xd0\xb7\xd0\260\320\xb4\320\260\321\207'); 
        ?> 
</p></td> 
                    <td class='field_title_description'><p><?php  
        echo $oL->get('\320\235\320\xb0 \321\201\320\xba\320\xbe\xd0\273\xd1\x8c\xd0\272\320\xbe \321\205\xd0\276\321\x80\320\276\xd1\210\xd0\276 \320\276\xd1\202\xd0\262\xd0\265\321\207\320\260\xd0\265\321\x82 \xd0\xb7\320\xb0 \xd1\x81\320\262\320\xbe\320\xb8 \320\xb7\xd0\xb0\xd0\xb4\xd0\xb0\xd1\207\xd0\270'); 
        ?> 
</p></td> 
                    <td class='field_title_description'><p><?php  
        echo $oL->get('\320\235\320\xb0 \321\201\xd0\xba\320\xbe\320\273\321\x8c\xd0\272\xd0\276 \xd1\201\xd0\xb0\xd0\274\320\276\xd1\x81\321\202\320\276\xd1\x8f\xd1\202\320\265\320\273\xd1\214\xd0\xbd\320\xbe \xd0\xb8\321\x81\xd0\277\xd0\276\320\273\320\xbd\xd1\x8f\xd0\xb5\xd1\x82 \xd0\267\320\260\xd0\264\320\xb0\xd1\207\xd0\270 \320\270 \320\xbf\xd1\200\320\xb5\xd0\264\xd0\xbb\320\xb0\320\263\320\260\xd0\xb5\xd1\202 \xd0\xb2\320\xb0\xd1\200\320\270\xd0\260\xd0\xbd\xd1\202\xd1\213 \xd1\200\xd0\xb5\321\x88\320\xb5\320\xbd\320\xb8\320\xb9'); 
        ?> 
</p></td> 
                    <td class='field_title_description'></td> 
                </tr> 
                <?php  
        foreach ($a['employees'] as $sK => $aV) { 
            ?> 
                    <tr class='trow'> 
                        <td class='employee'> 
                            <span><?php  
            echo $aV['name']; 
            ?> 
</span> 
                        </td> 
                        <?php  
            if ($aV['status'] === 'unmodified') { 
                goto Label_36717; 
            } 
            ?> 
                            <td colspan='6'> 
                                <p><?php  
            vprintf('<span class="font-red">\xd0\x91\xd1\x8b\xd0\273\xd0\270 \xd0\270\xd0\xb7\320\xbc\320\xb5\320\275\320\xb5\320\275\320\270\xd1\217 \xd0\262 \xd1\x81\320\273\320\xb5\320\xb4\xd1\203\xd1\x8e\321\211\xd0\xb8\xd1\x85 \xd1\201\xd1\202\321\x80\xd0\xbe\xd0\272\xd0\260\xd1\205:</span> %s', array(implode(', ', $aV['ids']))); 
            ?> 
</p> 
                            </td> 
                        <?php  
            goto Label_36718; 
            Label_36717: 
            ?> 
                            <td class='center'> 
							<span><!-- 
							<?php  
            if ($aV['ratings']['professionalism'] >= 1.0 && $aV['ratings']['professionalism'] <= 1.3) { 
                goto Label_36682; 
            } 
            if ($aV['ratings']['professionalism'] > 1.3 && $aV['ratings']['professionalism'] <= 2.7) { 
                goto Label_36683; 
            } 
            if ($aV['ratings']['professionalism'] > 2.7 && $aV['ratings']['professionalism'] <= 3.3) { 
                goto Label_36684; 
            } 
            if ($aV['ratings']['professionalism'] > 3.3 && $aV['ratings']['professionalism'] <= 4.0) { 
                goto Label_36685; 
            } 
            if ($aV['ratings']['professionalism'] > 4.0 && $aV['ratings']['professionalism'] <= 6.0) { 
                goto Label_36686; 
            } 
            goto Label_36681; 
            Label_36682: 
            ?> 
								--><?php  
            echo $oL->get('\xd0\276\321\202\xd0\xbb.'); 
            ?> 
<!-- 
							<?php  
            goto Label_36681; 
            Label_36683: 
            ?> 
								--><?php  
            echo $oL->get('\321\205\xd0\xbe\xd1\x80.'); 
            ?> 
<!-- 
							<?php  
            goto Label_36681; 
            Label_36684: 
            ?> 
								--><?php  
            echo $oL->get('\xd0\264\320\276\321\201\xd1\x82.'); 
            ?> 
<!-- 
							<?php  
            goto Label_36681; 
            Label_36685: 
            ?> 
								--><?php  
            echo $oL->get('\321\x83\xd0\xb4\320\xbe\320\262\320\xbb.'); 
            ?> 
<!-- 
							<?php  
            goto Label_36681; 
            Label_36686: 
            ?> 
								--><?php  
            echo $oL->get('\320\275\xd0\265\xd1\203\xd0\xb4.'); 
            ?> 
<!-- 
							<?php  
            Label_36681: 
            ?> 
							--> (<?php  
            echo $aV['ratings']['professionalism']; 
            ?> 
)</span> 
                            </td> 
                            <td class='center'> 
							<span><!-- 
							<?php  
            if ($aV['ratings']['operativeness'] >= 1.0 && $aV['ratings']['operativeness'] <= 1.3) { 
                goto Label_36688; 
            } 
            if ($aV['ratings']['operativeness'] > 1.3 && $aV['ratings']['operativeness'] <= 2.7) { 
                goto Label_36689; 
            } 
            if ($aV['ratings']['operativeness'] > 2.7 && $aV['ratings']['operativeness'] <= 3.3) { 
                goto Label_36690; 
            } 
            if ($aV['ratings']['operativeness'] > 3.3 && $aV['ratings']['operativeness'] <= 4.0) { 
                goto Label_36691; 
            } 
            if ($aV['ratings']['operativeness'] > 4.0 && $aV['ratings']['operativeness'] <= 6.0) { 
                goto Label_36692; 
            } 
            goto Label_36687; 
            Label_36688: 
            ?> 
								--><?php  
            echo $oL->get('\320\xbe\xd1\x82\xd0\xbb.'); 
            ?> 
<!-- 
							<?php  
            goto Label_36687; 
            Label_36689: 
            ?> 
								--><?php  
            echo $oL->get('\xd1\x85\xd0\xbe\xd1\200.'); 
            ?> 
<!-- 
							<?php  
            goto Label_36687; 
            Label_36690: 
            ?> 
								--><?php  
            echo $oL->get('\320\264\xd0\276\321\x81\xd1\202.'); 
            ?> 
<!-- 
							<?php  
            goto Label_36687; 
            Label_36691: 
            ?> 
								--><?php  
            echo $oL->get('\xd1\x83\320\264\320\xbe\xd0\262\xd0\273.'); 
            ?> 
<!-- 
							<?php  
            goto Label_36687; 
            Label_36692: 
            ?> 
								--><?php  
            echo $oL->get('\320\275\xd0\xb5\321\x83\320\264.'); 
            ?> 
<!-- 
							<?php  
            Label_36687: 
            ?> 
							--> (<?php  
            echo $aV['ratings']['operativeness']; 
            ?> 
)</span> 
                            </td> 
                            <td class='center'> 
							<span><!-- 
							<?php  
            if ($aV['ratings']['communicability'] >= 1.0 && $aV['ratings']['communicability'] <= 1.3) { 
                goto Label_36694; 
            } 
            if ($aV['ratings']['communicability'] > 1.3 && $aV['ratings']['communicability'] <= 2.7) { 
                goto Label_36695; 
            } 
            if ($aV['ratings']['communicability'] > 2.7 && $aV['ratings']['communicability'] <= 3.3) { 
                goto Label_36696; 
            } 
            if ($aV['ratings']['communicability'] > 3.3 && $aV['ratings']['communicability'] <= 4.0) { 
                goto Label_36697; 
            } 
            if ($aV['ratings']['communicability'] > 4.0 && $aV['ratings']['communicability'] <= 6.0) { 
                goto Label_36698; 
            } 
            goto Label_36693; 
            Label_36694: 
            ?> 
								--><?php  
            echo $oL->get('\xd0\xbe\321\202\xd0\xbb.'); 
            ?> 
<!-- 
							<?php  
            goto Label_36693; 
            Label_36695: 
            ?> 
								--><?php  
            echo $oL->get('\321\x85\320\xbe\321\x80.'); 
            ?> 
<!-- 
							<?php  
            goto Label_36693; 
            Label_36696: 
            ?> 
								--><?php  
            echo $oL->get('\xd0\xb4\xd0\xbe\321\201\321\202.'); 
            ?> 
<!-- 
							<?php  
            goto Label_36693; 
            Label_36697: 
            ?> 
								--><?php  
            echo $oL->get('\xd1\203\xd0\264\xd0\276\320\262\320\xbb.'); 
            ?> 
<!-- 
							<?php  
            goto Label_36693; 
            Label_36698: 
            ?> 
								--><?php  
            echo $oL->get('\xd0\xbd\320\265\321\203\320\xb4.'); 
            ?> 
<!-- 
							<?php  
            Label_36693: 
            ?> 
							--> (<?php  
            echo $aV['ratings']['communicability']; 
            ?> 
)</span> 
                            </td> 
                            <td class='center'> 
							<span><!-- 
							<?php  
            if ($aV['ratings']['responsibility'] >= 1.0 && $aV['ratings']['responsibility'] <= 1.3) { 
                goto Label_36700; 
            } 
            if ($aV['ratings']['responsibility'] > 1.3 && $aV['ratings']['responsibility'] <= 2.7) { 
                goto Label_36701; 
            } 
            if ($aV['ratings']['responsibility'] > 2.7 && $aV['ratings']['responsibility'] <= 3.3) { 
                goto Label_36702; 
            } 
            if ($aV['ratings']['responsibility'] > 3.3 && $aV['ratings']['responsibility'] <= 4.0) { 
                goto Label_36703; 
            } 
            if ($aV['ratings']['responsibility'] > 4.0 && $aV['ratings']['responsibility'] <= 6.0) { 
                goto Label_36704; 
            } 
            goto Label_36699; 
            Label_36700: 
            ?> 
								--><?php  
            echo $oL->get('\xd0\276\321\202\320\xbb.'); 
            ?> 
<!-- 
							<?php  
            goto Label_36699; 
            Label_36701: 
            ?> 
								--><?php  
            echo $oL->get('\xd1\205\320\xbe\321\200.'); 
            ?> 
<!-- 
							<?php  
            goto Label_36699; 
            Label_36702: 
            ?> 
								--><?php  
            echo $oL->get('\xd0\xb4\xd0\xbe\321\201\xd1\x82.'); 
            ?> 
<!-- 
							<?php  
            goto Label_36699; 
            Label_36703: 
            ?> 
								--><?php  
            echo $oL->get('\xd1\203\xd0\xb4\320\xbe\xd0\xb2\320\273.'); 
            ?> 
<!-- 
							<?php  
            goto Label_36699; 
            Label_36704: 
            ?> 
								--><?php  
            echo $oL->get('\xd0\xbd\xd0\265\xd1\203\xd0\xb4.'); 
            ?> 
<!-- 
							<?php  
            Label_36699: 
            ?> 
							--> (<?php  
            echo $aV['ratings']['responsibility']; 
            ?> 
)</span> 
                            </td> 
                            <td class='center'> 
							<span><!-- 
							<?php  
            if ($aV['ratings']['initiative'] >= 1.0 && $aV['ratings']['initiative'] <= 1.3) { 
                goto Label_36706; 
            } 
            if ($aV['ratings']['initiative'] > 1.3 && $aV['ratings']['initiative'] <= 2.7) { 
                goto Label_36707; 
            } 
            if ($aV['ratings']['initiative'] > 2.7 && $aV['ratings']['initiative'] <= 3.3) { 
                goto Label_36708; 
            } 
            if ($aV['ratings']['initiative'] > 3.3 && $aV['ratings']['initiative'] <= 4.0) { 
                goto Label_36709; 
            } 
            if ($aV['ratings']['initiative'] > 4.0 && $aV['ratings']['initiative'] <= 6.0) { 
                goto Label_36710; 
            } 
            goto Label_36705; 
            Label_36706: 
            ?> 
								--><?php  
            echo $oL->get('\320\xbe\xd1\x82\320\273.'); 
            ?> 
<!-- 
							<?php  
            goto Label_36705; 
            Label_36707: 
            ?> 
								--><?php  
            echo $oL->get('\xd1\205\xd0\276\xd1\200.'); 
            ?> 
<!-- 
							<?php  
            goto Label_36705; 
            Label_36708: 
            ?> 
								--><?php  
            echo $oL->get('\xd0\264\xd0\276\321\201\xd1\202.'); 
            ?> 
<!-- 
							<?php  
            goto Label_36705; 
            Label_36709: 
            ?> 
								--><?php  
            echo $oL->get('\xd1\x83\xd0\264\320\276\320\262\320\xbb.'); 
            ?> 
<!-- 
							<?php  
            goto Label_36705; 
            Label_36710: 
            ?> 
								--><?php  
            echo $oL->get('\xd0\275\320\xb5\xd1\x83\320\xb4.'); 
            ?> 
<!-- 
							<?php  
            Label_36705: 
            ?> 
							--> (<?php  
            echo $aV['ratings']['initiative']; 
            ?> 
)</span> 
                            </td> 
                            <td class='center'> 
							<span><!-- 
							<?php  
            if ($aV['ratings']['total'] >= 1.0 && $aV['ratings']['total'] <= 1.3) { 
                goto Label_36712; 
            } 
            if ($aV['ratings']['total'] > 1.3 && $aV['ratings']['total'] <= 2.7) { 
                goto Label_36713; 
            } 
            if ($aV['ratings']['total'] > 2.7 && $aV['ratings']['total'] <= 3.3) { 
                goto Label_36714; 
            } 
            if ($aV['ratings']['total'] > 3.3 && $aV['ratings']['total'] <= 4.0) { 
                goto Label_36715; 
            } 
            if ($aV['ratings']['total'] > 4.0 && $aV['ratings']['total'] <= 6.0) { 
                goto Label_36716; 
            } 
            goto Label_36711; 
            Label_36712: 
            ?> 
								--><?php  
            echo $oL->get('\320\276\321\202\xd0\273.'); 
            ?> 
<!-- 
							<?php  
            goto Label_36711; 
            Label_36713: 
            ?> 
								--><?php  
            echo $oL->get('\321\205\320\276\xd1\x80.'); 
            ?> 
<!-- 
							<?php  
            goto Label_36711; 
            Label_36714: 
            ?> 
								--><?php  
            echo $oL->get('\320\264\320\276\321\201\xd1\x82.'); 
            ?> 
<!-- 
							<?php  
            goto Label_36711; 
            Label_36715: 
            ?> 
								--><?php  
            echo $oL->get('\xd1\203\320\264\xd0\276\xd0\xb2\xd0\xbb.'); 
            ?> 
<!-- 
							<?php  
            goto Label_36711; 
            Label_36716: 
            ?> 
								--><?php  
            echo $oL->get('\320\275\320\265\xd1\x83\xd0\264.'); 
            ?> 
<!-- 
							<?php  
            Label_36711: 
            ?> 
							--> (<?php  
            echo $aV['ratings']['total']; 
            ?> 
)</span> 
                            </td> 
                            <?php  
             
            ?> 
                        <?php  
            Label_36718: 
            ?> 
                    </tr> 
                <?php  
        } 
        ?> 
                <?php  
         
        ?> 
                </tbody> 
            </table> 
 
            <?php  
         
        ?> 
 
            <?php  
        Label_36719: 
        $s = ob_get_clean(); 
        return $s; 
    } 
    public static function aktenplanvar($a) 
    { 
        ob_start(); 
        ?> 
        <?php  
        $oL = \app\system\Registry::get('locale'); 
        $aAktenplans = a($a, 'aktenplans', array()); 
        if (!count($aAktenplans)) { 
            goto Label_36723; 
        } 
        ?> 
            <div class='aktenplanBox'> 
                <table class='aktenplanTable' width='100%' cellpadding='0' cellspacing='0'> 
                    <tr class='first'> 
                        <td></td> 
                        <td><?php  
        echo $oL->get('\320\x97\xd0\xb0\xd0\263\xd0\276\xd0\273\320\xbe\320\262\320\276\xd0\272'); 
        ?> 
</td> 
                        <td></td> 
                    </tr> 
                    <?php  
        foreach ($aAktenplans as $sK => $aV) { 
            ?> 
                        <tr class='list' onclick='window.location='/reference/document/view/<?php  
            echo $aV['doctype_id']; 
            ?> 
/<?php  
            echo $aV['document_id']; 
            ?> 
''> 
                            <td><?php  
            echo $aV['index']; 
            ?> 
</td> 
                            <td><?php  
            echo $aV['title']; 
            ?> 
</td> 
                            <td><?php  
            echo $aV['subdivision']; 
            ?> 
</td> 
                        </tr> 
                    <?php  
        } 
        ?> 
                    <tr> 
                        <td colspan='3'><?php  
        echo nl2br(v($a['text'])); 
        ?> 
</td> 
                    </tr> 
                </table> 
            </div> 
            <style type='text/css'> 
                .aktenplanTable { 
                    border-top: 1px solid #d3d3d3; 
                    border-left: 1px solid #d3d3d3; 
                } 
                .aktenplanTable td{ 
                    border-bottom: 1px solid #d3d3d3; 
                    border-right: 1px solid #d3d3d3; 
                    padding: 3px; 
                } 
                .aktenplanTable tr.list{ 
                    cursor: pointer; 
                } 
                .aktenplanTable tr.first{ 
                    background-color: #eeeeee; 
                    font-weight: bold; 
                } 
 
            </style> 
        <?php  
        Label_36723: 
        ?> 
        <?php  
        $s = ob_get_clean(); 
        return $s; 
    } 
    public static function decisionvar($a, $sDoctypeId, $sDocumentId) 
    { 
        ob_start(); 
        ?> 
 
        <?php  
        $sTasks = ''; 
        $oL = \app\system\Registry::get('locale'); 
        $sL = \app\user\Account::getaccount()->getlocale(); 
        $aLcl = array(); 
        if (!($sL !== 'ru' && array_key_exists($sL, \app\system\Registry::get('config')->get('app_locales')))) { 
            goto Label_36724; 
        } 
        $aL = \app\system\Registry::get('locale_info'); 
        $aLcl = $aL['pst']; 
        Label_36724: 
        foreach ($a as $sK => $aV) { 
            $sFieldId = sprintf('%08x%x%08x', mt_rand(), time(), mt_rand()); 
            $sLastAction = ''; 
            $sLastDT = ''; 
            $sLastAuthor = ''; 
            ?> 
            <div id='field_decision_<?php  
            echo $sFieldId; 
            ?> 
' class='field_big_wrap blue field_decision_wrap expanded'> 
                <h3 class='clearfix'><?php  
            echo $oL->get($aV['title']); 
            ?> 
</h3> 
                <div class='inner_wrap'> 
                    <ul class='field_decision' id='decisionContent_<?php  
            echo $sK; 
            ?> 
'> 
                        <?php  
            foreach ($aV['decisions'] as $sK2 => $aV2) { 
                ?> 
                            <li class='item'> 
                                <p class='meta'> 
                                    <strong class='author'><?php  
                echo !empty($aLcl) && !empty(a($aLcl, $aV2['author_id'], array())) ? strtr($aV2['author'], a($aLcl, $aV2['author_id'], array())) : $aV2['author']; 
                ?> 
</strong> <span class='dt'><?php  
                echo \app\system\Util::unserializetimestamp($aV2['tstamp']); 
                ?> 
</span> 
                                </p> 
                                <?php  
                if (!isset($aV2['sign_status'])) { 
                    goto Label_36727; 
                } 
                ?> 
                                    <p id='sign_status_<?php  
                echo $aV2['task_name']; 
                ?> 
_<?php  
                echo $aV2['task_pos']; 
                ?> 
' class='sign_status_label'> 
                                        <?php  
                if (isset($aV2['sign_status_eds'])) { 
                    goto Label_36725; 
                } 
                ?> 
                                            <?php  
                echo $aV2['sign_status']; 
                ?> 
                                        <?php  
                goto Label_36726; 
                Label_36725: 
                $sTasks .= $sTasks == '' ? $aV2['task_name'] : ',' . $aV2['task_name']; 
                ?> 
                                            <img style='margin-bottom:-4px;' src='/tpl/web/img/loading.gif' /> <span><?php  
                echo $oL->get('\320\237\321\200\320\276\xd0\xb2\320\265\xd1\200\xd0\272\xd0\260 \xd0\xad\320\246\xd0\x9f'); 
                ?> 
</span> 
                                        <?php  
                Label_36726: 
                ?> 
                                    </p> 
                                <?php  
                Label_36727: 
                ?> 
 
                                <p class='abstract_content clearfix<?php  
                echo strlen($aV2['text']) ? ' with_action' : ''; 
                ?> 
'> 
                                    <?php  
                if (!strlen($aV2['text'])) { 
                    goto Label_36728; 
                } 
                ?> 
                                        <span class='action'><?php  
                echo v($aV2['text']); 
                ?> 
</span> 
                                        <?php  
                $sLastAction = v($aV2['text']); 
                ?> 
                                    <?php  
                Label_36728: 
                ?> 
                                    <span class='comment'> 
										<?php  
                echo \app\system\Util::replaceurls(nl2br(v($aV2['comment']))); 
                ?> 
                                        <?php  
                if (!mb_strlen($aV2['comment'])) { 
                    goto Label_36729; 
                } 
                ?> 
                                            <br /> 
                                        <?php  
                Label_36729: 
                ?> 
                                        <?php  
                $needComma = false; 
                foreach ($aV2['custom_fields'] as $aCf) { 
                    if (!(is_array($aCf['value']) && count($aCf['value']) || !is_array($aCf['value']) && strlen($aCf['value']))) { 
                        goto Label_36732; 
                    } 
                    if (!$needComma) { 
                        goto Label_36730; 
                    } 
                    echo ', '; 
                    goto Label_36731; 
                    Label_36730: 
                    $needComma = true; 
                    Label_36731: 
                    ?> 
                                                <span class='custom_field'> 
                                                    <?php  
                    echo v($oL->get($aCf['title'])); 
                    ?> 
: <?php  
                    echo \app\reference\REF::viewfactory('', $aCf['value'], array_merge(array('document_id' => $sDocumentId), $aCf)); 
                    ?> 
                                                </span> 
                                            <?php  
                    Label_36732: 
                    ?> 
                                        <?php  
                } 
                ?> 
                                        <?php  
                if (!count($aV2['files'])) { 
                    goto Label_36733; 
                } 
                ?> 
                                            <span class='attached_files'> 
											<?php  
                echo \app\reference\REF::fileview('', $aV2['files'], array('row_separator' => ' ')); 
                ?> 
										</span> 
                                        <?php  
                Label_36733: 
                ?> 
									</span> 
                                </p> 
                            </li> 
                            <?php  
                $sLastDT = \app\system\Util::unserializetimestamp($aV2['tstamp']); 
                $sLastAuthor = $aV2['author']; 
                ?> 
                        <?php  
            } 
            ?> 
                    </ul> 
 
                </div> 
            </div> 
            <script type='text/javascript'> 
                MSF_App.bind_starter(function(oParams) 
                { 
                    if (!window.FIELDS_BANK['field_decision_<?php  
            echo $sFieldId; 
            ?> 
']) 
                    { 
                        window.FIELDS_BANK['field_decision_<?php  
            echo $sFieldId; 
            ?> 
'] = new MSF_Decision('<?php  
            echo $sFieldId; 
            ?> 
', { 
                            last_action:'', 
                            last_dt:'' 
                        }); 
                    } 
                }, 'field_decision_<?php  
            echo $sFieldId; 
            ?> 
', true, 'field_decision'); 
            </script> 
        <?php  
        } 
        ?> 
 
        <script type='text/javascript'> 
 
            <?php  
        if ($sTasks != '') { 
            goto Label_36734; 
        } 
        ?> 
            setTimeout(function() { 
                ButtonChecker.setStatus(true); 
            },500); 
            <?php  
        goto Label_36735; 
        Label_36734: 
        ?> 
            $.get('/workflow/document/verify-eds', { 
                isSession: false, 
                doctype: '<?php  
        echo $sDoctypeId; 
        ?> 
', 
                document: '<?php  
        echo $sDocumentId; 
        ?> 
', 
                tasks: '<?php  
        echo $sTasks; 
        ?> 
', 
                sL: '<?php  
        echo $sL; 
        ?> 
', 
                app_company: '<?php  
        echo \app\system\Registry::get('config')->get('app_company'); 
        ?> 
' 
            }, function (data) { 
                if (data.status == 1) { 
                    var isValid = true; 
                    for(var task in data.verify) 
                    { 
                        $('#sign_status_' + task).html(data.verify[task].html); 
                        if(!data.verify[task].status){ 
                            isValid = false; 
                        } 
 
                    } 
                    ButtonChecker.setStatus(isValid); 
                }else 
                { 
 
                } 
            }, 'json'); 
            <?php  
        Label_36735: 
        ?> 
        </script> 
        <?php  
        $s = ob_get_clean(); 
        return $s; 
    } 
    public static function decisionvarmediumhtml($a, $sDoctypeId, $sDocumentId) 
    { 
        ob_start(); 
        ?> 
 
        <?php  
        $sTasks = ''; 
        $oL = \app\system\Registry::get('locale'); 
        $sL = \app\user\Account::getaccount()->getlocale(); 
        $aLcl = array(); 
        if (!($sL !== 'ru' && array_key_exists($sL, \app\system\Registry::get('config')->get('app_locales')))) { 
            goto Label_36736; 
        } 
        $aL = \app\system\Registry::get('locale_info'); 
        $aLcl = $aL['pst']; 
        Label_36736: 
        foreach ($a as $sK => $aV) { 
            ?> 
            <ul class='field_decision' id='decisionContent_<?php  
            echo $sK; 
            ?> 
' style='margin-bottom: 0px; float: right;'> 
                <?php  
            foreach ($aV['decisions'] as $sK2 => $aV2) { 
                ?> 
                    <li class='item'> 
                        <?php  
                if (!isset($aV2['sign_status'])) { 
                    goto Label_36741; 
                } 
                ?> 
                            <div id='sign_status_<?php  
                echo $aV2['task_name']; 
                ?> 
_<?php  
                echo $aV2['task_pos']; 
                ?> 
' class='sign_status_label' style='display:flex; background: #e8e8e8; padding: 8px 20px; width: max-content; border-radius: 13px'> 
                                <?php  
                if (isset($aV2['sign_status_eds'])) { 
                    goto Label_36739; 
                } 
                ?> 
                                    <?php  
                echo $aV2['sign_status']; 
                ?> 
                                <?php  
                goto Label_36740; 
                Label_36739: 
                $sTasks .= $sTasks == '' ? $aV2['task_name'] : ',' . $aV2['task_name']; 
                ?> 
                                    <?php  
                if ($aV2['sign_status_eds']) { 
                    goto Label_36737; 
                } 
                ?> 
                                        <span class='negative icon_key'></span> 
                                    <?php  
                goto Label_36738; 
                Label_36737: 
                ?> 
                                        <span class='positive icon_key'></span> 
                                    <?php  
                Label_36738: 
                ?> 
                                <?php  
                Label_36740: 
                ?> 
                                <span class='meta'><strong class='author' style='font-size: 14px; color: #333;'><?php  
                echo !empty($aLcl) && !empty(a($aLcl, $aV2['author_id'], array())) ? strtr($aV2['author'], a($aLcl, $aV2['author_id'], array())) : $aV2['author']; 
                ?> 
</strong></span> 
                            </div> 
                        <?php  
                Label_36741: 
                ?> 
                    </li> 
                <?php  
            } 
            ?> 
            </ul> 
        <?php  
        } 
        ?> 
        <?php  
        $s = ob_get_clean(); 
        return $s; 
    } 
    public static function decisionvarhtml($a, $sDoctypeId, $sDocumentId) 
    { 
        ob_start(); 
        ?> 
        <?php  
        $sTasks = ''; 
        $oL = \app\system\Registry::get('locale'); 
        foreach ($a as $sK => $aV) { 
            $sFieldId = sprintf('%08x%x%08x', mt_rand(), time(), mt_rand()); 
            $sLastAction = ''; 
            $sLastDT = ''; 
            $sLastAuthor = ''; 
            ?> 
            <table> 
                <tr> 
                    <td><b><?php  
            echo $aV['title']; 
            ?> 
</b></td> 
                </tr> 
                <?php  
            foreach ($aV['decisions'] as $sK2 => $aV2) { 
                ?> 
                    <tr> 
                        <td><?php  
                echo $aV2['author']; 
                ?> 
&nbsp;<?php  
                echo \app\system\Util::unserializetimestamp($aV2['tstamp']); 
                ?> 
</td> 
                    </tr> 
                    <?php  
                if (!isset($aV2['sign_status'])) { 
                    goto Label_36742; 
                } 
                ?> 
                        <tr> 
                            <td style='font-size: 8pt;'><i><?php  
                echo $aV2['sign_status']; 
                ?> 
</i></td> 
                        </tr> 
                    <?php  
                Label_36742: 
                ?> 
                    <?php  
                if (!strlen($aV2['text'])) { 
                    goto Label_36743; 
                } 
                ?> 
                        <tr> 
                            <td style='font-size: 8pt;'><i><?php  
                echo v($aV2['text']); 
                ?> 
</i></td> 
                        </tr> 
                        <?php  
                $sLastAction = v($aV2['text']); 
                Label_36743: 
                ?> 
                    <tr> 
                        <td style='font-size: 8pt;'><i> 
                                <?php  
                echo \app\system\Util::replaceurls(nl2br(v($aV2['comment']))); 
                ?> 
                                <?php  
                if (!mb_strlen($aV2['comment'])) { 
                    goto Label_36744; 
                } 
                ?> 
                                    <br /> 
                                <?php  
                Label_36744: 
                ?> 
 
                                <?php  
                $needComma = false; 
                foreach ($aV2['custom_fields'] as $aCf) { 
                    if (!(is_array($aCf['value']) && count($aCf['value']) || !is_array($aCf['value']) && strlen($aCf['value']))) { 
                        goto Label_36747; 
                    } 
                    if (!$needComma) { 
                        goto Label_36745; 
                    } 
                    echo ', '; 
                    goto Label_36746; 
                    Label_36745: 
                    $needComma = true; 
                    Label_36746: 
                    $oCField = \app\reference\field\FieldFactory::create('', $aCf); 
                    $oCField->set($aCf['value']); 
                    ?> 
                                        <?php  
                    echo v($aCf['title']); 
                    ?> 
: <?php  
                    echo $oCField->getgridvalue(); 
                    ?> 
                                    <?php  
                    Label_36747: 
                    ?> 
                                <?php  
                } 
                ?> 
                            </i> 
                        </td> 
                    </tr> 
                    <?php  
                if (!count($aV2['files'])) { 
                    goto Label_36748; 
                } 
                ?> 
                        <tr> 
                            <td style='font-size: 8pt;'> 
                                <?php  
                foreach ($aV2['files'] as $sId => $sValue) { 
                    ?> 
                                    <a id='filepreview_btn_<?php  
                    echo $sId; 
                    ?> 
' class='textview_attached_file' href='/media/download/<?php  
                    echo $sId; 
                    ?> 
'><?php  
                    echo $sValue; 
                    ?> 
</a> 
                                <?php  
                } 
                ?> 
                            </td> 
                        </tr> 
                    <?php  
                Label_36748: 
                ?> 
                    <?php  
                $sLastDT = \app\system\Util::unserializetimestamp($aV2['tstamp']); 
                $sLastAuthor = $aV2['author']; 
                ?> 
                <?php  
            } 
            ?> 
            </table> 
            <br> 
        <?php  
        } 
        $s = ob_get_clean(); 
        return $s; 
    } 
    public static function controlvar($a) 
    { 
        $oL = \app\system\Registry::get('locale'); 
        ob_start(); 
        $sFieldId = sprintf('%08x%x%08x', mt_rand(), time(), mt_rand()); 
        ?> 
        <?php  
        foreach ($a as $sK => $aV) { 
            ?> 
        <div id='field_control_<?php  
            echo $sFieldId; 
            ?> 
' class='field_big_wrap field_control_wrap collapsed'> 
            <h3><?php  
            echo $oL->get('\320\x92\xd0\267\xd1\x8f\xd1\202\xd0\276 \xd0\275\xd0\260 \320\xba\320\xbe\320\xbd\321\x82\321\200\xd0\276\xd0\273\xd1\x8c'); 
            ?> 
</h3> 
            <div class='inner_wrap' style='display:none'> 
                <ul class='field_control'> 
                    <li class='item'> 
                        <p> 
                            <strong class='label'><?php  
            echo $oL->get('\320\x98\xd1\201\xd0\277\xd0\276\320\xbb\320\275\xd0\xb8\321\x82\320\265\xd0\273\321\214'); 
            ?> 
:</strong> <?php  
            echo implode(', ', $aV['executor']); 
            ?> 
<br /> 
                            <strong class='label'><?php  
            echo $oL->get('\xd0\232\xd0\xbe\xd0\275\xd1\x82\xd1\x80\320\276\320\273\xd1\214\320\275\321\213\320\xb9 \xd1\201\321\x80\320\276\320\xba'); 
            ?> 
:</strong> <?php  
            echo $aV['finish_at']; 
            ?> 
                        </p> 
                    </li> 
                </ul> 
            </div> 
        </div> 
    <?php  
        } 
        ?> 
        <script type='text/javascript'> 
            MSF_App.bind_starter(function(oParams) 
            { 
                if (!window.FIELDS_BANK['field_control_<?php  
        echo $sFieldId; 
        ?> 
']) 
                { 
                    window.FIELDS_BANK['field_control_<?php  
        echo $sFieldId; 
        ?> 
'] = new MSF_FieldControl('<?php  
        echo $sFieldId; 
        ?> 
', oParams); 
                } 
            }, 'field_control_<?php  
        echo $sFieldId; 
        ?> 
', true, 'field_control'); 
        </script> 
 
        <?php  
        $s = ob_get_clean(); 
        return $s; 
    } 
    public static function editadminservice($aT, $aD, $aPoints, $aPointNames, $sDocumentMovePointTitle = '') 
    { 
        $oL = \app\system\Registry::get('locale'); 
        $oC = \app\system\Registry::get('config'); 
        $iIN = $aT['index_number']; 
        $iCN = 'undefined'; 
        $iSN = 'undefined'; 
        $sFN = 'point[execute][' . $iIN . ']'; 
        $sCN = 'point_execute_' . $iIN; 
        $sSuffix = '_' . $iIN; 
        $sViewPath = 'app/workflow/view/themev1/admin' . strtoupper(substr($aT['type'], 0, 1)) . substr($aT['type'], 1) . 'Service.php'; 
        ob_start(); 
        include $sViewPath; 
        $s = ob_get_clean(); 
        return $s; 
    } 
    public static function editadminconditionservice($aT, $aD, $aPoints, $aPointNames, $sDocumentMovePointTitle = '') 
    { 
        $oL = \app\system\Registry::get('locale'); 
        $oC = \app\system\Registry::get('config'); 
        $iIN = $aT['index_number']; 
        $iCN = $aT['container_number']; 
        $iSN = $aT['service_number']; 
        $sFN = 'point[execute][' . $iIN . '][containers][' . $iCN . '][services][' . $iSN . ']'; 
        $sCN = 'point_execute_' . $iIN . '_containers_' . $iCN . '_services_' . $iSN; 
        $sSuffix = '_' . $iIN . '_' . $iCN . '_' . $iSN; 
        $sViewPath = 'app/workflow/view/themev1/admin' . strtoupper(substr($aT['type'], 0, 1)) . substr($aT['type'], 1) . 'Service.php'; 
        ob_start(); 
        include $sViewPath; 
        $s = ob_get_clean(); 
        return $s; 
    } 
    public static function commentvar($a, $sDoctypeId, $sDocumentId, $iDepth = 0, $sTreeId = '', $aParentData = array()) 
    { 
        $oL = \app\system\Registry::get('locale'); 
        ob_start(); 
        end($a); 
        $sEnd = key($a); 
        ?> 
        <?php  
        if (!(0 == $iDepth)) { 
            goto Label_36749; 
        } 
        $sTreeId = sprintf('%08x%x%08x', mt_rand(), time(), mt_rand()); 
        $oDt = \app\workflow\EntityManager::getdoctype($sDoctypeId); 
        ?> 
        <script type='text/javascript'> 
            MSF_App.bind_starter(function(oParams) 
            { 
                oParams.doctype_id = '<?php  
        echo $sDoctypeId; 
        ?> 
'; 
                oParams.document_id = '<?php  
        echo $sDocumentId; 
        ?> 
'; 
                oParams.msf_id = 'workflow'; 
                oParams.process_type = '<?php  
        echo $oDt['process_type']; 
        ?> 
'; 
                if (!window.FIELDS_BANK['field_comments_tree_<?php  
        echo $sTreeId; 
        ?> 
']) 
                { 
                    window.FIELDS_BANK['field_comments_tree_<?php  
        echo $sTreeId; 
        ?> 
'] = new MSF_DocumentCommentsTree('<?php  
        echo $sTreeId; 
        ?> 
', oParams); 
                } 
            }, 'field_comments_tree_<?php  
        echo $sTreeId; 
        ?> 
', true, 'field_comments_tree'); 
        </script> 
    <?php  
        Label_36749: 
        ?> 
 
        <?php  
        if (count($a)) { 
            goto Label_36760; 
        } 
        ?> 
        <ul class='field_comments_tree root empty' id='field_comments_tree_<?php  
        echo $sTreeId; 
        ?> 
'> 
            <li> 
                <ul class='comment_wrap'> 
                    <li class='meta'><?php  
        echo $oL->get('\320\x9d\320\265\321\202 \320\xba\320\276\xd0\xbc\320\xbc\xd0\265\xd0\xbd\321\202\320\xb0\321\200\xd0\xb8\xd0\xb5\xd0\xb2'); 
        ?> 
</li> 
                </ul> 
                <ul class='field_comments_tree'></ul> 
            </li> 
        </ul> 
    <?php  
        goto Label_36761; 
        Label_36760: 
        ?> 
        <ul class='field_comments_tree<?php  
        echo $iDepth == 0 ? ' root' : ''; 
        ?> 
' <?php  
        echo $iDepth == 0 ? 'id="field_comments_tree_' . $sTreeId . '"' : ''; 
        ?> 
> 
            <?php  
        $sLastId = ''; 
        if (!(count($a) > 0)) { 
            goto Label_36750; 
        } 
        end($a); 
        $sLastId = key($a); 
        Label_36750: 
        foreach ($a as $sKKK => $aV) { 
            $bHaveChilds = count($aV['childs']); 
            $sCommentId = sprintf('%08x%x%08x', mt_rand(), time(), mt_rand()) . '_' . $iDepth; 
            $aV['comment_id'] = $sCommentId; 
            $aV['row_seperator'] = ' '; 
            $aV['module'] = 'comment'; 
            $aV['parent_name'] = $aV['id']; 
            ?> 
                <li id='field_comments_tree_comment_<?php  
            echo $sCommentId; 
            ?> 
' data-id='<?php  
            echo $aV['id']; 
            ?> 
' class='<?php  
            echo $aV['id'] != $sEnd ? 'have_next_sibling ' : ''; 
            echo !$bHaveChilds ? 'no_childs' : ''; 
            ?> 
'  > 
                    <ul class='comment_wrap'> 
                        <li class='meta'> 
                            <strong class='author'><?php  
            echo $aV['employee']; 
            ?> 
 (<?php  
            echo current($aV['post']); 
            ?> 
)</strong> 
                            <?php  
            if (!count($aParentData)) { 
                goto Label_36751; 
            } 
            ?> 
                                <span href='#' class='reply_to_btn'> 
									<?php  
            echo $oL->get('\xd0\236\xd1\202\xd0\xb2\320\265\xd1\202 \320\xbd\320\xb0 \320\272\xd0\276\xd0\xbc\320\274\xd0\265\xd0\xbd\xd1\202\xd0\260\xd1\x80\xd0\270\320\xb9'); 
            ?> 
									<span class='comment_snapshot' style='display:none'> 
										<strong><?php  
            echo $aParentData['employee']; 
            ?> 
 (<?php  
            echo current($aParentData['post']); 
            ?> 
)</strong> 
										<span class='dt'><?php  
            echo \app\system\Util::unserializetimestamp($aParentData['created_at']); 
            ?> 
</span> 
										<a href='#<?php  
            echo $aParentData['comment_id']; 
            ?> 
' class='cbtn goto_btn'><?php  
            echo $oL->get('\320\x9f\xd0\xb5\321\x80\320\xb5\320\271\xd1\202\320\270'); 
            ?> 
</a> 
										<a href='#' class='cbtn reply_again_btn'><?php  
            echo $oL->get('\320\x9e\xd1\x82\xd0\262\xd0\265\xd1\202\320\xb8\xd1\202\321\214'); 
            ?> 
</a> 
										<span class='abstract_content'><?php  
            echo v(mb_substr($aParentData['comment'], 0, 100)) . (mb_strlen($aParentData['comment']) > 100 ? '\342\200\xa6' : ''); 
            ?> 
</span> 
									</span> 
								</span> 
                            <?php  
            Label_36751: 
            ?> 
                            <span class='dt'><?php  
            echo \app\system\Util::unserializetimestamp($aV['created_at']); 
            ?> 
</span> 
                            <?php  
            $sId = \app\user\Account::getaccount()->getsid(); 
            $aLikedList = \app\reference\engine\ArrayMapperUtil::unserialize($aV['liked']); 
            $aDisLikedList = \app\reference\engine\ArrayMapperUtil::unserialize($aV['disliked']); 
            ?> 
                            <style>.rating_btn {cursor: pointer; margin-right: 5px;} .rating_btn.active {color: blue;} .rating_btn:hover {text-decoration:  none;}</style> 
                            <a class='rating_btn like_btn <?php  
            echo isset($aLikedList[$sId]) ? 'active' : ''; 
            ?> 
'> 
                                <i class='fa fa-lg fa-thumbs-o-up' aria-hidden='true'></i> 
                                <span class='counter'><?php  
            echo count($aLikedList); 
            ?> 
</span> 
                            </a> 
                            <a class='rating_btn dislike_btn <?php  
            echo isset($aDisLikedList[$sId]) ? 'active' : ''; 
            ?> 
'> 
                                <i class='fa fa-lg fa-thumbs-o-down' aria-hidden='true'></i> 
                                <span class='counter'><?php  
            echo count($aDisLikedList); 
            ?> 
</span> 
                            </a> 
                        </li> 
                        <li class='abstract_content'> 
                            <span><?php  
            echo \app\system\Util::replaceurls(nl2br(v($aV['comment']))); 
            ?> 
</span> 
                            <?php  
            if (count($aV['files'])) { 
                goto Label_36752; 
            } 
            ?> 
                                <div class='attached_files'></div> 
                            <?php  
            goto Label_36753; 
            Label_36752: 
            ?> 
 
                                <?php  
            echo \app\reference\REF::fileview('', $aV['files'], $aV); 
            ?> 
                                </p> 
                            <?php  
            Label_36753: 
            ?> 
                        </li> 
                        <li> 
                            <a href='#' class='btn btn-xs reply_btn' style='display:none'  <?php  
             
            ?> 
><?php  
            echo $oL->get('\320\x9e\321\202\320\xb2\xd0\265\xd1\x82\320\270\321\x82\321\x8c'); 
            ?> 
</a> 
                            <?php  
            if (!(key($aV['post']) == \app\user\Account::getaccount()->getsid() && time() - strtotime($aV['created_at']) < 5 * 60)) { 
                goto Label_36754; 
            } 
            ?> 
                                <a href='#' class='btn btn-xs edit_btn'><?php  
            echo $oL->get('\xd0\xa0\xd0\265\xd0\xb4\xd0\xb0\320\272\xd1\202\xd0\xb8\321\200\xd0\xbe\320\xb2\320\xb0\xd1\202\xd1\214'); 
            ?> 
</a> 
                            <?php  
            Label_36754: 
            ?> 
                            <?php  
            if (!(key($aV['post']) == \app\user\Account::getaccount()->getsid() && time() - strtotime($aV['created_at']) < 5 * 60)) { 
                goto Label_36755; 
            } 
            ?> 
                                <a href='#' class='btn btn-xs delete_btn'><?php  
            echo $oL->get('\xd0\243\320\264\xd0\260\320\xbb\320\270\321\x82\xd1\x8c'); 
            ?> 
</a> 
                            <?php  
            Label_36755: 
            ?> 
                            <?php  
            if (!(strlen($aV['edited_at']) > 0)) { 
                goto Label_36756; 
            } 
            ?> 
                                <span class='edit_dt' ><?php  
            echo $oL->get('\320\x98\320\xb7\xd0\xbc\320\xb5\xd0\xbd\320\xb5\xd0\xbd\320\xbe'); 
            ?> 
 <?php  
            echo \app\system\Util::unserializetimestamp($aV['edited_at']); 
            ?> 
</span> 
                            <?php  
            Label_36756: 
            ?> 
                        </li> 
                    </ul> 
                    <script type='text/javascript'> 
                        MSF_App.bind_starter(function( oParams ) 
                        { 
                            oParams.id = '<?php  
            echo $aV['id']; 
            ?> 
'; 
                            <?php  
            if (!count($aParentData)) { 
                goto Label_36757; 
            } 
            ?> 
                            oParams.parent_id = '<?php  
            echo $aParentData['id']; 
            ?> 
'; 
                            oParams.parent_dom_id = '<?php  
            echo $aParentData['comment_id']; 
            ?> 
'; 
                            <?php  
            Label_36757: 
            ?> 
                            window.FIELDS_BANK['field_comments_tree_<?php  
            echo $sTreeId; 
            ?> 
'].prepare_comment('#field_comments_tree_comment_<?php  
            echo $sCommentId; 
            ?> 
', oParams); 
                        }, 'field_comments_tree_comment_<?php  
            echo $sCommentId; 
            ?> 
', true, 'field_comments_tree_comments'); 
                    </script> 
                    <?php  
            if ($bHaveChilds) { 
                goto Label_36758; 
            } 
            ?> 
                        <ul class='field_comments_tree'></ul> 
                    <?php  
            goto Label_36759; 
            Label_36758: 
            ?> 
                        <?php  
            echo \app\workflow\WFW::commentvar($aV['childs'], $sDoctypeId, $sDocumentId, $iDepth + 1, $sTreeId, $aV); 
            ?> 
                    <?php  
            Label_36759: 
            ?> 
                </li> 
            <?php  
        } 
        ?> 
        </ul> 
    <?php  
        Label_36761: 
        ?> 
 
        <script type='text/javascript'> 
            $(function () { 
                $('#field_comments_tree_uploader_<?php  
        echo $sTreeId; 
        ?> 
_ul').sortable({ 
                    axis: 'y', 
                    items: '> li', 
                    containment: 'parent', 
                    tolerance: 'pointer', 
                }); 
            }); 
        </script> 
 
        <?php  
        $s = ob_get_clean(); 
        return $s; 
    } 
    private static function variablevartabletr($a, $aDataList, $sDocumentId, $iOffset = 0, $iLimit, $iCount = 0, $sParentId = null, $iDepth = 0, $aTreeDraw = array(), $sParentIdOnly = null) 
    { 
        $oL = \app\system\Registry::get('locale'); 
        $bFastEdit = \app\system\Registry::get('config')->get('rel_doc_fast_edit_and_view'); 
        $sHiddenDescription = key(a($a['var'], 'hidden_description', array())); 
        $sHiddenDescriptionVal = current(a($a['var'], 'hidden_description', array())); 
        switch ($a['var']['grid_view_type']) { 
            case 1: 
                $sGridClass = 'grid_single_line'; 
                break; 
            case 2: 
                $sGridClass = 'grid_two_line'; 
                break; 
            case 3: 
                $sGridClass = 'grid_three_line'; 
                break; 
            default: 
                $sGridClass = ''; 
                break; 
        } 
        $i = 1; 
        $isTreeLast = false; 
        foreach ($aDataList as $sKeyData => $aData) { 
            $isTreeLast = $i == count($aDataList); 
            $aTreeDraw[$iDepth] = !$isTreeLast; 
            if (!$isTreeLast) { 
                goto Label_36762; 
            } 
            $aTreeDraw[$iDepth] = false; 
            Label_36762: 
            if (!($iCount < $iOffset)) { 
                goto Label_36764; 
            } 
            $iCount++; 
            if (empty($aData['childs'])) { 
                goto Label_36763; 
            } 
            $iD = $iDepth + 1; 
            $sP = $sParentId . ' ' . $aData['id'] . $a['var']['name']; 
            self::variablevartabletr($a, $aData['childs'], $sDocumentId, $iOffset, $iLimit, $iCount, $sP, $iD, $aTreeDraw, $aData['id'] . $a['var']['name']); 
            Label_36763: 
            continue; 
            Label_36764: 
            $hideTr = $iCount >= $iLimit; 
            $sHideTr = ''; 
            if (!(strlen($sParentIdOnly) > 0 && $sParentIdOnly != $sDocumentId . $a['var']['name'] && $sDocumentId != $aData['id'] && $sParentIdOnly != $aData['tree_id'] . $a['var']['name'] && !\app\system\Registry::get('config')->get('show_all_related_docs'))) { 
                goto Label_36765; 
            } 
            $sHideTr = 'style="display: none;"'; 
            Label_36765: 
            ?> 
            <tr class='trow <?php  
            echo $hideTr ? 'off-limit' : ''; 
            ?> 
' data-parent='<?php  
            echo $sParentId != null ? $sParentId : ''; 
            ?> 
' id='<?php  
            echo $aData['id']; 
            ?> 
' <?php  
            if (!($aData['id'] == $sDocumentId)) { 
                goto Label_36766; 
            } 
            ?> 
  <?php  
            Label_36766: 
            ?> 
 data-only-parent='<?php  
            echo $sParentIdOnly; 
            ?> 
' <?php  
            echo $sHideTr; 
            ?> 
> 
                <?php  
            $j = 0; 
            ?> 
                <?php  
            $iIter = 1; 
            $iMargin = 0; 
            foreach ($a['var']['fields'] as $sK3 => $aV3) { 
                if (!($sHiddenDescriptionVal == $sK3)) { 
                    goto Label_36767; 
                } 
                continue; 
                Label_36767: 
                ?> 
 
                    <td id='variable_table_<?php  
                echo $a['var']['name']; 
                ?> 
_cell_<?php  
                echo $i; 
                ?> 
_<?php  
                echo $j + 1; 
                ?> 
' class='<?php  
                echo $iIter == 1 ? 'content' : ''; 
                ?> 
 cell_with_canvas' <?php  
                echo $aV3['type'] != 'structure' ? 'style="overflow: hidden; text-overflow: ellipsis;"' : ''; 
                ?> 
> 
                        <?php  
                if (!$aV3['hierarchical']) { 
                    goto Label_36768; 
                } 
                for ($i1 = 0; $i1 < $iDepth; $i1++) { 
                    ?> 
                                <div class='tree_grid <?php  
                    echo $aTreeDraw[$i1 + 1] ? 'tree_grid_v_line' : ''; 
                    ?> 
 <?php  
                    echo $i1 + 1 == $iDepth ? 'tree_grid_last' : ''; 
                    ?> 
 <?php  
                    echo $aTreeDraw[$iDepth] ? 'tree_grid_has_siblings' : ''; 
                    ?> 
'> </div> 
                            <?php  
                } 
                ?> 
 
                        <?php  
                Label_36768: 
                ?> 
 
                        <div class='tree_grid has_content'> 
                            <?php  
                if (!empty($aData['childs']) && $aV3['hierarchical']) { 
                    goto Label_36771; 
                } 
                if (!($iIter == 1)) { 
                    goto Label_36770; 
                } 
                ?> 
                                <span class='tree <?php  
                if (!$iDepth) { 
                    goto Label_36769; 
                } 
                ?> 
gline<?php  
                Label_36769: 
                ?> 
'></span> 
                            <?php  
                Label_36770: 
                goto Label_36772; 
                Label_36771: 
                ?> 
                                <?php  
                $sOpened = $sParentIdOnly == null || $sDocumentId == $aData['id'] || \app\system\Registry::get('config')->get('show_all_related_docs') ? 'minus' : 'plus'; 
                ?> 
 
                                <span class='tree <?php  
                echo $sOpened; 
                ?> 
' data-toggle='<?php  
                echo $aData['id'] . $a['var']['name']; 
                ?> 
' style='margin-left:<?php  
                echo $iMargin++ * 16; 
                ?> 
px' id='toggle_<?php  
                echo $a['var']['name']; 
                ?> 
_<?php  
                echo $aData['id']; 
                ?> 
' ></span> 
 
                                <script> 
                                    $('#toggle_<?php  
                echo $a['var']['name']; 
                ?> 
_<?php  
                echo $aData['id']; 
                ?> 
').click(function(oE){ 
                                        var sId = $(this).data('toggle'); 
                                        if($(this).hasClass('minus')) 
                                        { 
                                            $('#variable_table_<?php  
                echo $a['var']['name']; 
                ?> 
 tr[data-parent~='' + sId + '']:not(.off-limit)').hide(); 
                                            $(this).removeClass('minus').addClass('plus'); 
                                            $('#loadRelatedDocuments<?php  
                echo $a['var']['name']; 
                ?> 
').hide(); 
 
                                            $('.load-next_<?php  
                echo $a['var']['name']; 
                ?> 
').hide(); 
                                        }else{ 
                                            //$('#variable_table_<?php  
                 
                ?> 
// tr[data-parent~='' + sId + '']:not(.off-limit)').show(); 
                                            //$('#variable_table_<?php  
                 
                ?> 
// tr[data-parent~='' + sId + ''] span.plus' ).removeClass('plus').addClass('minus'); 
                                            $('#variable_table_<?php  
                echo $a['var']['name']; 
                ?> 
 tr[data-only-parent~='' + sId + '']:not(.off-limit)').show(); 
                                            $('#variable_table_<?php  
                echo $a['var']['name']; 
                ?> 
 tr[data-only-parent~='' + sId + ''] span.minus' ).removeClass('minus').addClass('plus'); 
                                            $(this).removeClass('plus').addClass('minus'); 
                                            $('#loadRelatedDocuments<?php  
                echo $a['var']['name']; 
                ?> 
:not(.loaded)').show(); 
                                            if($('#variable_table_<?php  
                echo $a['var']['name']; 
                ?> 
 tr.off-limit').length) { 
                                                $('.load-next_<?php  
                echo $a['var']['name']; 
                ?> 
').show(); 
                                            } 
                                        } 
 
                                        oE.preventDefault(); 
                                    }) 
                                </script> 
                            <?php  
                Label_36772: 
                ?> 
                        </div> 
                        <div class='cell_canvas  <?php  
                echo $iDepth; 
                ?> 
 <?php  
                echo $sGridClass; 
                ?> 
 <?php  
                echo $aV3['hierarchical'] ? 'hasHierarchial' : ''; 
                ?> 
' <?php  
                if (!$aV3['hierarchical']) { 
                    goto Label_36773; 
                } 
                ?> 
style='padding-left:5px; width: calc(100% - <?php  
                echo $i1 + 2; 
                ?> 
 * 17px);'<?php  
                Label_36773: 
                ?> 
> 
 
						<span class='content'> 
 
						<?php  
                if (!isset($aData[$sK3])) { 
                    goto Label_36787; 
                } 
                ?> 
                            <?php  
                $mValue = $aData[$sK3]; 
                $aFields = $a['var']['fields']; 
                $sTitle = ''; 
                $sTitlePosts = ''; 
                $aV3['options']['type'] = $aV3['type']; 
                switch ($aV3['type']) { 
                    case 'reference': 
                        $aV3['options']['disable_link'] = '1'; 
                    case 'image': 
                    case 'file': 
                    case 'document': 
                    case 'boolean': 
                    case 'enumeration': 
                        $mValue = \app\system\CacheSerializer::fromdb($mValue); 
                        break; 
                    case 'structure': 
                        $mValue = \app\system\CacheSerializer::fromdb($mValue); 
                        if (!(\app\user\Account::getaccount()->getlocale() !== 'ru' && array_key_exists(\app\user\Account::getaccount()->getlocale(), \app\system\Registry::get('config')->get('app_locales')))) { 
                            goto Label_36778; 
                        } 
                        $aRefLcl = array(); 
                        if (!(isset($a['var']['doctypes'][$aData['doctype_id']]['document_fields']) && isset($a['var']['doctypes'][$aData['doctype_id']]['document_fields'][$a['var']['doctypes'][$aData['doctype_id']]['compared_fields'][$sK3]]))) { 
                            goto Label_36775; 
                        } 
                        $aDocField = $a['var']['doctypes'][$aData['doctype_id']]['document_fields'][$a['var']['doctypes'][$aData['doctype_id']]['compared_fields'][$sK3]]; 
                        if (!($aDocField['type'] == 'reference')) { 
                            goto Label_36774; 
                        } 
                        $aRefLcl = \app\locale\Util::getreflcl($aDocField['reference_id']); 
                        Label_36774: 
                        Label_36775: 
                        $oF = \app\reference\field\FieldFactory::create($sK3, $aV3['options']); 
                        $oF->unserialize($aData[$sK3]); 
                        $oF->get(); 
                        if (!count($oF->get())) { 
                            goto Label_36777; 
                        } 
                        $aLocale = \app\system\Registry::get('locale_info'); 
                        $aLcl = count($aRefLcl) ? $aRefLcl : array_merge($aLocale['pst'], $aLocale['sdv'], $aLocale['grp']); 
                        foreach ($mValue as $sId => &$sValue) { 
                            if (!($sId == key($oF->get()))) { 
                                goto Label_36776; 
                            } 
                            $sTitlePosts = v(strtr($sValue, a($aLcl, $sId, array()))); 
                            $sValue = v(strtr($sValue, a($aLcl, $sId, array()))); 
                            Label_36776: 
                        } 
                        Label_36777: 
                        Label_36778: 
                        break; 
                } 
                $oF = \app\reference\field\FieldFactory::create($sK3, $aV3['options']); 
                $oF->unserialize($aData[$sK3]); 
                $sTitle = $sHiddenDescription == $sK3 && $aData[$sHiddenDescriptionVal] != '' ? $aData[$sHiddenDescriptionVal] : $oF->getgridvalue(); 
                $sTitle = html_entity_decode(strip_tags($sTitle), ENT_QUOTES, 'UTF-8'); 
                ?> 
 
                            <?php  
                if (isset($aV3['use_link']) && $aV3['use_link'] && $aData['id'] != $sDocumentId) { 
                    goto Label_36785; 
                } 
                ?> 
                                <?php  
                if ($a['var']['doctypes'][$aData['doctype_id']]['compared_fields'][$sK3] == 'point_title') { 
                    goto Label_36783; 
                } 
                ?> 
                                    <span title='<?php  
                echo $sTitlePosts ? $sTitlePosts : v($sTitle); 
                ?> 
'> 
                                                <?php  
                echo \app\reference\REF::viewfactory($sK3, $mValue, $aV3['options']); 
                ?> 
                                            </span> 
                                <?php  
                goto Label_36784; 
                Label_36783: 
                ?> 
                                    <span title='<?php  
                echo $oL->get(v($sTitle)); 
                ?> 
'> 
                                                <?php  
                echo \app\reference\REF::viewfactory($sK3, $mValue, $aV3['options'], true, false, true); 
                ?> 
                                            </span> 
                                <?php  
                Label_36784: 
                ?> 
                            <?php  
                goto Label_36786; 
                Label_36785: 
                ?> 
                                <?php  
                if (in_array($aV3['type'], array('document'))) { 
                    goto Label_36781; 
                } 
                if ($a['var']['doctypes'][$aData['doctype_id']]['compared_fields'][$sK3] == 'point_title') { 
                    goto Label_36779; 
                } 
                $sText = \app\reference\REF::viewfactory($sK3, $mValue, $aV3['options']); 
                goto Label_36780; 
                Label_36779: 
                $sText = \app\reference\REF::viewfactory($sK3, $mValue, $aV3['options'], true, false, true); 
                $sTitle = trim(html_entity_decode(strip_tags($sText), ENT_QUOTES, 'UTF-8')); 
                Label_36780: 
                goto Label_36782; 
                Label_36781: 
                $sText = implode(a($aV3, 'row_separator', ', '), $mValue); 
                Label_36782: 
                ?> 
                                <a title='<?php  
                echo v($sTitle); 
                ?> 
' href='/workflow/document/view/<?php  
                echo $aData['doctype_id']; 
                ?> 
/<?php  
                echo $aData['id']; 
                echo isset($_GET['mydocuments']) ? '?mydocuments' : ''; 
                ?> 
'><?php  
                echo $sText; 
                ?> 
</a> 
                            <?php  
                Label_36786: 
                ?> 
 
 
                        <?php  
                Label_36787: 
                ?> 
						</span> 
                        </div> 
                    </td> 
 
                    <?php  
                $j++; 
                $iIter++; 
            } 
            ?> 
 
                <td style='width: 24px !important; text-align: center; vertical-align: top;' <?php  
            if (!($aData['id'] != $sDocumentId)) { 
                goto Label_36788; 
            } 
            ?> 
 class='td_fastopen' <?php  
            Label_36788: 
            ?> 
> 
                    <?php  
            if (!($aData['id'] != $sDocumentId)) { 
                goto Label_36791; 
            } 
            ?> 
                        <?php  
            if ($bFastEdit && $a['var']['fast_edit']) { 
                goto Label_36789; 
            } 
            ?> 
                            <span class='btn_fastopen' data-href='/workflow/document/fast-view/<?php  
            echo $aData['doctype_id']; 
            ?> 
/<?php  
            echo $aData['id']; 
            ?> 
' onclick='openModalWindow($(this).attr('data-href'))'> </span> 
                        <?php  
            Label_36789: 
            ?> 
 
                        <?php  
            if (!($bFastEdit && $a['var']['fast_edit'])) { 
                goto Label_36790; 
            } 
            ?> 
                            <span class='btn_fast_edit' data-href='/workflow/document/fast-edit/<?php  
            echo $aData['doctype_id']; 
            ?> 
/<?php  
            echo $aData['id']; 
            ?> 
/<?php  
            echo $a['doctype_id']; 
            ?> 
/<?php  
            echo $a['var']['name']; 
            ?> 
' onclick='msf.actionWindow.view($(this).attr('data-href'), {}, this);'> </span> 
                        <?php  
            Label_36790: 
            ?> 
 
                    <?php  
            Label_36791: 
            ?> 
 
                    <?php  
            if (!($bFastEdit && $a['var']['fast_edit'])) { 
                goto Label_36792; 
            } 
            ?> 
                        <!--<span class='btn_fast_create' onclick='createRelatedDocument<?php  
            echo $a['var']['name']; 
            ?> 
(this, '<?php  
            echo $aData['id']; 
            ?> 
', '<?php  
            echo $aData['doctype_id']; 
            ?> 
')'> </span>--> 
                    <?php  
            Label_36792: 
            ?> 
 
                </td> 
            </tr> 
            <?php  
            $iCount++; 
            if (empty($aData['childs'])) { 
                goto Label_36793; 
            } 
            $iD = $iDepth + 1; 
            $sP = $sParentId . ' ' . $aData['id'] . $a['var']['name']; 
            self::variablevartabletr($a, $aData['childs'], $sDocumentId, $iOffset, $iLimit, $iCount, $sP, $iD, $aTreeDraw, $aData['id'] . $a['var']['name']); 
            Label_36793: 
            $i++; 
         
        } 
    } 
    public static function linkedvarview($a) 
    { 
        $oL = \app\system\Registry::get('locale'); 
        ob_start(); 
        ?> 
        <style> 
            #linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
 span.tree { padding:0 8px 8px 8px; position: relative; height: 100%;  } 
            #linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
 span.tree.line { background: url('/tpl/web/img/themev1/tree_line.gif') repeat-y center center; padding-bottom: 130px; } 
            #linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
 span.tree.gline { background: url('/tpl/web/img/themev1/tree_g_line.gif') no-repeat center top;} 
            #linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
 span.tree.cross { background: url('/tpl/web/img/themev1/tree_cross.gif') no-repeat center top; padding-bottom: 130px;} 
            #linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
 span.tree.cross.last { background: url('/tpl/web/img/themev1/tree_cross_last.gif') no-repeat center top;  } 
            #linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
 td.content { padding-left: 0 !important; overflow: hidden; } 
            #linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
 td.content a.content, #linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
 td.content span.content { display: block; } 
            #linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
 td.tree_grid { padding: 0 !important; border-right: medium none; overflow: hidden; vertical-align: top; } 
            #linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
 tr.title td.header { border-right: none;} 
            #linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
 tr.title td.header span{ position: absolute; margin-top: -9px; } 
            <![if !IE]> 
              #linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
 span.tree.line, 
              #linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
 span.tree.gline, 
              #linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
 span.tree.cross, 
              #linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
 span.tree.cross.last, 
              #linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
 span.tree.minus, 
              #linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
 span.tree.plus { background-position: center center; } 
            <![endif]> 
        </style> 
        <?php  
        if (!\app\system\Util::isie()) { 
            goto Label_36794; 
        } 
        ?> 
        <style> 
            #linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
 span.tree { padding:8px; position: relative; height: 100%;} 
            #linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
 td.tree_grid{ padding: 0 !important; border-right: medium none; overflow: hidden; vertical-align: middle;} 
        </style> 
    <?php  
        Label_36794: 
        ?> 
 
        <div id='linked_documents_<?php  
        echo $a['var']['name']; 
        ?> 
' class='field_big_wrap collapsed'> 
            <h3 data-loaded='0' > 
                <?php  
        echo $oL->get($a['var']['title'], '\xd0\224\320\xbe\xd0\xba\xd1\x83\320\xbc\320\xb5\xd0\275\xd1\202\321\213', '\320\237\xd0\xb5\xd1\x80\320\xb5\xd0\xbc\320\xb5\320\xbd\xd0\275\xd1\213\320\265', sprintf('%s-%s-title', $a['doctype_id'], $a['var']['name'])); 
        ?> 
                <span id='search_bar' class='form-group form-group-sm'> 
                    <input class='field_keyword form-control input-sm' type='text' placeholder='<?php  
        echo $oL->get('\320\x9d\xd0\260\320\271\xd1\202\xd0\270'); 
        ?> 
' style=''> 
                    <span class='iconBtnForSearching' id='iconBtnIdForSearchAndDelete<?php  
        echo $a['var']['name']; 
        ?> 
'></span> 
                </span> 
            </h3> 
            <div class='inner_wrap' style='display:none;'> 
                <table id='linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
' border='0' cellpadding='0' cellspacing='0' class='field_table_view' style='width:100%; '> 
                    <col style='width: 10px !important;' /> 
                    <?php  
        for ($i = 0; $i < $a['var']['lvl_count'] + 1; $i++) { 
            ?> 
                        <col style='width: 16px !important;' /> 
                    <?php  
        } 
        ?> 
                    <tr class='title'> 
                        <td>&nbsp;</td> 
                        <td class='header' colspan='<?php  
        echo $a['var']['lvl_count'] + 1; 
        ?> 
' ><span><?php  
        echo $oL->get('\320\x97\320\xb0\xd0\xb3\320\276\320\273\320\xbe\320\xb2\320\xbe\320\xba'); 
        ?> 
</span></td> 
                        <td>&nbsp;</td> 
                    </tr> 
                </table> 
 
 
                <div style='background-color: #fff;' id='documents_count_info_<?php  
        echo $a['var']['name']; 
        ?> 
'> 
                    <p style='line-height: 23px;text-shadow: 0 1px 0 #FFFFFF;color:#696969'> 
                        <?php  
        echo $oL->get('\xd0\222\xd1\201\xd0\265\xd0\263\xd0\xbe:'); 
        ?> 
                        <span id='total_count_<?php  
        echo $a['var']['name']; 
        ?> 
'><?php  
        echo $a['total_count']; 
        ?> 
</span> 
                    </p> 
                </div> 
 
            </div> 
        </div> 
 
 
        <script> 
            $(document).ready(function() { 
                var oWrap = $('#linked_documents_<?php  
        echo $a['var']['name']; 
        ?> 
'); 
                oWrap.children('h3').unbind('click').bind('click', function() 
                { 
                    if($(this).data('loaded') == 0) 
                    { 
                        getContent<?php  
        echo $a['var']['name']; 
        ?> 
(); 
                        $(this).data('loaded', 1); 
                    } 
                }); 
 
                <?php  
        echo $a['var']['is_expanded'] ? 'oWrap.children('h3').click();' : ''; 
        ?> 
            }); 
 
            function getContent<?php  
        echo $a['var']['name']; 
        ?> 
() 
            { 
                var oThinking = $('#thinking'); 
                oThinking.show(); 
                $.get('/workflow/document/linked-document/<?php  
        echo $a['doctype_id']; 
        ?> 
/<?php  
        echo $a['document_id']; 
        ?> 
/<?php  
        echo $a['var']['name']; 
        echo isset($_GET['mydocuments']) ? '?mydocuments' : ''; 
        ?> 
', function(sHtml) 
                { 
                    var oWrap = $('#linked_documents_<?php  
        echo $a['var']['name']; 
        ?> 
'); 
                    var oInnerWrap = oWrap.children('.inner_wrap'); 
                    oInnerWrap.find('#linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
').append(sHtml); 
                    oWrap.removeClass('collapsed').addClass('expanded'); 
                    oInnerWrap.slideDown(200); 
                    $('#total_count_<?php  
        echo $a['var']['name']; 
        ?> 
').show(); 
                    oThinking.hide(); 
                }); 
            } 
 
 
        </script> 
        <?php  
        $s = ob_get_clean(); 
        return $s; 
    } 
    public static function linked2varview($a) 
    { 
        $oL = \app\system\Registry::get('locale'); 
        ob_start(); 
        ?> 
        <style> 
            #linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
 span.tree { padding:0 8px 8px 8px; position: relative; height: 100%;  } 
            #linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
 span.tree.line { background: url('/tpl/web/img/themev1/tree_line.gif') repeat-y center center; padding-bottom: 130px; } 
            #linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
 span.tree.gline { background: url('/tpl/web/img/themev1/tree_g_line.gif') no-repeat center top;} 
            #linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
 span.tree.cross { background: url('/tpl/web/img/themev1/tree_cross.gif') no-repeat center top; padding-bottom: 130px;} 
            #linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
 span.tree.cross.last { background: url('/tpl/web/img/themev1/tree_cross_last.gif') no-repeat center top;  } 
            #linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
 td.content { padding-left: 0 !important; overflow: hidden; } 
            #linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
 td.content a.content, #linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
 td.content span.content { display: block; } 
            #linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
 td.tree_grid { padding: 0 !important; border-right: medium none; overflow: hidden; vertical-align: top; } 
            #linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
 tr.title td.header { border-right: none;} 
            #linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
 tr.title td.header span{ position: absolute; margin-top: -9px; } 
            <![if !IE]> 
              #linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
 span.tree.line, 
              #linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
 span.tree.gline, 
              #linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
 span.tree.cross, 
              #linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
 span.tree.cross.last, 
              #linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
 span.tree.minus, 
              #linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
 span.tree.plus { background-position: center center; } 
            <![endif]> 
        </style> 
        <?php  
        if (!\app\system\Util::isie()) { 
            goto Label_36795; 
        } 
        ?> 
        <style> 
            #linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
 span.tree { padding:8px; position: relative; height: 100%;} 
            #linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
 td.tree_grid{ padding: 0 !important; border-right: medium none; overflow: hidden; vertical-align: middle;} 
        </style> 
    <?php  
        Label_36795: 
        ?> 
 
        <div id='linked_documents_<?php  
        echo $a['var']['name']; 
        ?> 
' class='field_big_wrap collapsed'> 
            <h3 data-loaded='0' > 
                <?php  
        echo $oL->get($a['var']['title'], '\320\x94\320\xbe\xd0\272\321\203\xd0\xbc\xd0\xb5\xd0\275\321\x82\321\213', '\320\x9f\320\265\xd1\x80\320\xb5\320\xbc\xd0\265\xd0\275\xd0\275\321\213\xd0\xb5', sprintf('%s-%s-title', $a['doctype_id'], $a['var']['name'])); 
        ?> 
                <span id='search_bar' class='form-group form-group-sm'> 
                    <input class='field_keyword form-control input-sm' type='text' placeholder='<?php  
        echo $oL->get('\320\235\xd0\xb0\xd0\xb9\321\202\320\xb8'); 
        ?> 
' style=''> 
                    <span class='iconBtnForSearching' id='iconBtnIdForSearchAndDelete<?php  
        echo $a['var']['name']; 
        ?> 
'></span> 
                </span> 
            </h3> 
            <div class='inner_wrap' style='display:none;'> 
                <table id='linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
' border='0' cellpadding='0' cellspacing='0' class='field_table_view' style='width:100%; '> 
                    <col style='width: 10px !important;' /> 
                    <?php  
        for ($i = 0; $i < $a['var']['lvl_count'] + 1; $i++) { 
            ?> 
                        <col style='width: 16px !important;' /> 
                    <?php  
        } 
        ?> 
                    <tr class='title'> 
                        <td>&nbsp;</td> 
                        <td class='header' colspan='<?php  
        echo $a['var']['lvl_count'] + 1; 
        ?> 
' ><span><?php  
        echo $oL->get('\320\x97\320\xb0\xd0\263\xd0\276\xd0\273\xd0\xbe\320\262\xd0\xbe\320\xba'); 
        ?> 
</span></td> 
                        <td>&nbsp;</td> 
                    </tr> 
                </table> 
 
                <?php  
        if (!(count(json_decode($a['next'], true)) > 0)) { 
            goto Label_36796; 
        } 
        ?> 
                    <button id='getContentNext' class='btn btn-sm' onclick='getContentNext()'> </button> 
                <?php  
        Label_36796: 
        ?> 
 
 
                <div style='background-color: #fff;' id='documents_count_info_<?php  
        echo $a['var']['name']; 
        ?> 
'> 
                    <p style='line-height: 23px;text-shadow: 0 1px 0 #FFFFFF;color:#696969'> 
                        <?php  
        echo $oL->get('\xd0\222\321\x81\320\265\320\263\xd0\xbe:'); 
        ?> 
                        <span id='total_count_<?php  
        echo $a['var']['name']; 
        ?> 
'><?php  
        echo $a['total_count']; 
        ?> 
</span> 
                    </p> 
                </div> 
 
 
                <div id='aNext' style='display: none'><?php  
        echo $a['next']; 
        ?> 
</div> 
                <div id='aDocuments' style='display: none'><?php  
        echo $a['aDocuments']; 
        ?> 
</div> 
            </div> 
        </div> 
 
 
        <script> 
            $(document).ready(function() { 
                var oWrap = $('#linked_documents_<?php  
        echo $a['var']['name']; 
        ?> 
'); 
                oWrap.children('h3').unbind('click').bind('click', function() 
                { 
                    if($(this).data('loaded') == 0) 
                    { 
                        getContent<?php  
        echo $a['var']['name']; 
        ?> 
(); 
                        $(this).data('loaded', 1); 
                    } 
                }); 
 
                <?php  
        echo $a['var']['is_expanded'] ? 'oWrap.children('h3').click();' : ''; 
        ?> 
            }); 
 
            function getContent<?php  
        echo $a['var']['name']; 
        ?> 
() 
            { 
                var oThinking = $('#thinking'); 
                oThinking.show(); 
                $.get('/workflow/document/linked-document/<?php  
        echo $a['doctype_id']; 
        ?> 
/<?php  
        echo $a['document_id']; 
        ?> 
/<?php  
        echo $a['var']['name']; 
        echo isset($_GET['mydocuments']) ? '?mydocuments' : ''; 
        ?> 
', function(sHtml) 
                { 
                    var oWrap = $('#linked_documents_<?php  
        echo $a['var']['name']; 
        ?> 
'); 
                    var oInnerWrap = oWrap.children('.inner_wrap'); 
                    oInnerWrap.find('#linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
').append(sHtml); 
                    oWrap.removeClass('collapsed').addClass('expanded'); 
                    oInnerWrap.slideDown(200); 
                    $('#total_count_<?php  
        echo $a['var']['name']; 
        ?> 
').show(); 
                    oThinking.hide(); 
                }); 
            } 
 
 
            function getContentNext(){ 
                var aDocuments = $('#aDocuments').text(); 
                var aNext = $('#aNext').text(); 
 
                if(aNext.length > 4) { 
                    $.ajax({ 
                        type: 'POST', 
                        dataType: 'json', 
                        url: '/workflow/document/linked-document/<?php  
        echo $a['doctype_id']; 
        ?> 
/<?php  
        echo $a['document_id']; 
        ?> 
/<?php  
        echo $a['var']['name']; 
        ?> 
', 
                        data: {aNext: aNext, aDocuments: aDocuments, sType: 'next'}, 
                        success: function (data) { 
                            if(data['aNext'].length < 4){ 
                                $('#getContentNext').addClass('disabled'); 
                            } 
 
                            $('#aDocuments').text(data['aDocuments']); 
                            $('#aNext').text(data['aNext']); 
                            $('#total_count_<?php  
        echo $a['var']['name']; 
        ?> 
').text(data['iTotalCount']); 
 
                            data['sParentId'].forEach(function(element) { 
                                var sTdHtml = '<td class='tree_grid'><span href='#' data-source=''+element+'' class='tree minus'></span></td>'; 
                                $('#tr_'+element+' .tree_grid').last().replaceWith(sTdHtml); 
                            }); 
 
                            var oWrap = $('#linked_documents_<?php  
        echo $a['var']['name']; 
        ?> 
'); 
                            var oInnerWrap = oWrap.children('.inner_wrap'); 
                            oInnerWrap.find('#linked_table_<?php  
        echo $a['var']['name']; 
        ?> 
 tr').last().after(data['html']); 
 
                            oInnerWrap.find('span.tree.minus, span.tree.plus').unbind('click').bind('click', function(){ 
                                contentToggle<?php  
        echo $a['var']['name']; 
        ?> 
($(this)); 
                                return false; 
                            }); 
                        } 
                    }) 
                } else { 
                    $('#getContentNext').addClass('disabled'); 
                } 
            } 
        </script> 
        <?php  
        $s = ob_get_clean(); 
        return $s; 
    } 
    public static function linkedvarviewtablecontent($a, $aConfig, $currentDoc, $sParent, $iLevel) 
    { 
        self::linkedvartabletree($a, $currentDoc, $sParent, $aConfig['lvl_count'], $iLevel); 
        ?> 
        <script> 
            $(document).ready(function() { 
                var oWrap = $('#linked_documents_<?php  
        echo $aConfig['name']; 
        ?> 
'); 
 
                oWrap.children('h3').unbind('click').bind('click', function() 
                { 
                    headerToggle<?php  
        echo $aConfig['name']; 
        ?> 
($(this)); 
                }); 
                $('#iconBtnIdForSearchAndDelete<?php  
        echo $aConfig['name']; 
        ?> 
').click(function(){ 
                    if(!isLogged()) return; 
                    var e = $(this); 
                    e.addClass('iconBtnForSearching').removeClass('iconBtnForDelete'); 
                    oWrap.find('#search_bar').find('.field_keyword').val(''); 
                    oWrap.find('#search_bar').find('.field_keyword').keyup(); 
                    //oWrap.find('#search_bar').find('.field_keyword').parent().parent().show(); 
                    return false; 
                }); 
                var oInnerWrap = oWrap.children('.inner_wrap'); 
 
                var delay = (function() 
                { 
                    var timer = 0; 
                    return function(callback, ms) { 
                        clearTimeout(timer); 
                        timer = setTimeout(callback, ms); 
                    }; 
                })(); 
                oInnerWrap.find('#linked_table_<?php  
        echo $aConfig['name']; 
        ?> 
') 
                    .clone() 
                    .attr('id', 'linked_table_<?php  
        echo $aConfig['name']; 
        ?> 
_for_search') 
                    .prependTo(oInnerWrap) 
                    .hide(); 
                $('#linked_table_<?php  
        echo $aConfig['name']; 
        ?> 
_for_search').find('span.tree minus, span.tree plus').each(function() 
                { 
                    $(this).parent().prepend('<span class='tree' ></span>'); 
                    $(this).remove() 
                }); 
                oWrap.find('#search_bar').find('.field_keyword') 
                    .focus(function() 
                    { 
                        oWrap.children('h3').unbind('click'); 
                    }) 
                    .blur(function() 
                    { 
                        oWrap.children('h3').click(function() 
                        { 
                            headerToggle<?php  
        echo $aConfig['name']; 
        ?> 
($(this)); 
                        }) 
                    }).keyup(function() 
                { 
                    //canceling previous ajax request 
                    if (typeof ajaxQSRequest == 'object') { 
                        ajaxQSRequest.abort(); 
                    } 
 
                    var sQs = $(this).val(); 
                    delay(function() { 
                        if(sQs.length == 0) 
                        { 
                            $('#linked_table_<?php  
        echo $aConfig['name']; 
        ?> 
_for_search').hide(); 
                            $('#linked_table_<?php  
        echo $aConfig['name']; 
        ?> 
').show(); 
                            $('#iconBtnIdForSearchAndDelete<?php  
        echo $aConfig['name']; 
        ?> 
').addClass('iconBtnForSearching').removeClass('iconBtnForDelete'); 
                            return; 
                        }else if (sQs.length < 3 && sQs.length > 0) 
                        { 
                            return; 
                        } 
 
                        var oThinking = $('#thinking'); 
                        oThinking.show(); 
                        var oTable = $('#linked_table_<?php  
        echo $aConfig['name']; 
        ?> 
_for_search'); 
                        $('#linked_table_<?php  
        echo $aConfig['name']; 
        ?> 
').hide(); 
                        oTable.show(); 
                        oTable.find('.content').each(function() 
                        { 
                            if($(this).text().indexOf(sQs) == -1) 
                            { 
                                $(this).parent().parent().hide(); 
                            }else 
                            { 
                                $(this).parent().parent().show(); 
                            } 
                            if (sQs.length >= 3) { 
                                $('#iconBtnIdForSearchAndDelete<?php  
        echo $aConfig['name']; 
        ?> 
').addClass('iconBtnForDelete').removeClass('iconBtnForSearching'); 
                            } 
                        }); 
                        oThinking.hide(); 
                    }, 500); //<-keyUp TimeOut 
                }); 
 
                oInnerWrap.find('span.tree.minus, span.tree.plus').unbind('click').bind('click', function() 
                { 
                    contentToggle<?php  
        echo $aConfig['name']; 
        ?> 
($(this)); 
                    return false; 
                }); 
            }); 
 
            var ajaxQSRequest; 
 
            function headerToggle<?php  
        echo $aConfig['name']; 
        ?> 
(oHeader) 
            { 
                var oDocCountInfo = oHeader.siblings('#documents_count_info_<?php  
        echo $aConfig['name']; 
        ?> 
'); 
                var oWrap = oHeader.parent(); 
                var oInnerWrap = oWrap.children('.inner_wrap'); 
                if (oWrap.hasClass('collapsed')) 
                { 
                    oWrap.removeClass('collapsed').addClass('expanded'); 
                    oInnerWrap.slideDown(200); 
                    oDocCountInfo.show(); 
                } 
                else 
                { 
                    oWrap.removeClass('expanded').addClass('collapsed'); 
                    oInnerWrap.slideUp(200); 
                    oDocCountInfo.hide(); 
                } 
            } 
 
            function contentToggle<?php  
        echo $aConfig['name']; 
        ?> 
(oHeader) 
            { 
                var oWrap = oHeader.parent().parent(); 
                if (oHeader.hasClass('minus')) 
                { 
                    oHeader.removeClass('minus').addClass('plus'); 
                    oWrap.siblings('.' + oHeader.data('source')).slideUp(200); 
                } 
                else 
                { 
                    oHeader.removeClass('plus').addClass('minus'); 
                    oWrap.parent().find('.' + oHeader.data('source') + ' span.plus').removeClass('plus').addClass('minus'); 
                    oWrap.siblings('.' + oHeader.data('source')).slideDown(200); 
                } 
            } 
        </script> 
        <?php  
    } 
    public static function linkedvartabletree($a, $currentDoc, $sParent, $iLevelCount, $iLevel, $aTreeDraw = array()) 
    { 
        $iChildLevel = $iLevel; 
        $isTreeLast = false; 
        foreach ($a as $sK => $aV) { 
            $isTreeLast = $sK == count($a) - 1 ? '1' : '0'; 
            $aTreeDraw[$iLevel] = $isTreeLast ? '0' : '1'; 
            ?> 
            <tr class='trow <?php  
            echo $sParent; 
            ?> 
' id='tr_<?php  
            echo $aV['data']['id']; 
            ?> 
'> 
                <td <?php  
            echo $currentDoc != $aV['data']['id'] ? 'style="width:10px !important" class="td_fastopen" onclick="openModalWindow('/workflow/document/fast-view/' . $aV['data']['doctype_id'] . '/' . $aV['data']['id'] . '')"' : 'style="width:20px !important"'; 
            ?> 
 > 
                    <?php  
            if (!($currentDoc != $aV['data']['id'])) { 
                goto Label_36797; 
            } 
            ?> 
                        <span data-href='/workflow/document/fast-view/<?php  
            echo $aV['data']['doctype_id']; 
            ?> 
/<?php  
            echo $aV['data']['id']; 
            ?> 
' class='btn_fastopen'>&nbsp;</span> 
                    <?php  
            Label_36797: 
            ?> 
                </td> 
                <?php  
            for ($i = 1; $i < $iLevel; $i++) { 
                ?> 
                    <td class='tree_grid' > 
                        <span class='tree <?php  
                echo $i == $iLevel - 1 ? 'cross' : ($aTreeDraw[$i + 1] ? 'line' : ''); 
                ?> 
 <?php  
                echo $isTreeLast ? 'last' : ''; 
                ?> 
' ></span> 
                    </td> 
                <?php  
            } 
            ?> 
                <td class='tree_grid' > 
                    <?php  
            if (count($aV['childs'])) { 
                goto Label_36799; 
            } 
            ?> 
                        <span class='tree <?php  
            if (!($iLevel != 1)) { 
                goto Label_36798; 
            } 
            ?> 
gline<?php  
            Label_36798: 
            ?> 
' ></span> 
                    <?php  
            goto Label_36800; 
            Label_36799: 
            ?> 
                        <span href='#' data-source='<?php  
            echo $aV['data']['id']; 
            ?> 
' class='tree minus' ></span> 
                    <?php  
            Label_36800: 
            ?> 
                </td> 
                <td class='content' colspan='<?php  
            echo $iLevelCount + 2 - $iChildLevel; 
            ?> 
' > 
                    <?php  
            if ($currentDoc != $aV['data']['id']) { 
                goto Label_36801; 
            } 
            ?> 
                        <span class='content' > 
                    <?php  
            goto Label_36802; 
            Label_36801: 
            ?> 
                    <a href='/workflow/document/view/<?php  
            echo $aV['data']['doctype_id']; 
            ?> 
/<?php  
            echo $aV['data']['id']; 
            echo isset($_GET['mydocuments']) ? '?mydocuments' : ''; 
            ?> 
' class='content' > 
                        <?php  
            Label_36802: 
            $isFirst = true; 
            foreach ($aV['fields'] as $sKey => $sValue) { 
                ?> 
                        <?php  
                echo !$isFirst ? ',&nbsp' : ''; 
                echo $sKey; 
                ?> 
 <?php  
                echo $sValue; 
                ?> 
                        <?php  
                $isFirst = false; 
            } 
            if ($currentDoc != $aV['data']['id']) { 
                goto Label_36803; 
            } 
            ?> 
                    </span> 
                <?php  
            goto Label_36804; 
            Label_36803: 
            ?> 
                    </a> 
                <?php  
            Label_36804: 
            ?> 
                </td> 
            </tr> 
            <?php  
            self::linkedvartabletree($aV['childs'], $currentDoc, $sParent . ' ' . $aV['data']['id'], $iLevelCount, $iChildLevel + 1, $aTreeDraw); 
            ?> 
        <?php  
        } 
    } 
    public static function associatedvarview($a) 
    { 
        if (count($a['data']['fields'])) { 
            goto Label_36805; 
        } 
        return ''; 
        Label_36805: 
        $oL = \app\system\Registry::get('locale'); 
        ob_start(); 
        ?> 
        <style> 
            #associated_documents_<?php  
        echo $a['var']['name']; 
        ?> 
 #bottom_pagination a {float: left;} 
        </style> 
 
        <div id='associated_documents_<?php  
        echo $a['var']['name']; 
        ?> 
' class='field_big_wrap collapsed'> 
            <h3 data-loaded='0' > 
                <?php  
        echo $oL->get($a['var']['title'], '\320\x94\xd0\xbe\xd0\xba\xd1\x83\320\274\320\xb5\320\275\xd1\202\321\213', '\320\x9f\320\265\321\200\xd0\xb5\xd0\274\320\xb5\320\xbd\xd0\275\xd1\x8b\320\265', sprintf('%s-%s-title', $a['doctype_id'], $a['var']['name'])); 
        ?> 
            </h3> 
            <div class='inner_wrap' style='display:none;'> 
                <div style='overflow: auto;'> 
                    <table id='associated_table_<?php  
        echo $a['var']['name']; 
        ?> 
' border='0' cellpadding='0' cellspacing='0' class='field_table_view' style='max-width:100%; '> 
                        <tr class='title'> 
                            <td>&nbsp;</td> 
                            <td><span><?php  
        echo $oL->get('\xd0\222\xd0\xb8\320\xb4 \xd1\201\xd0\xb2\321\217\xd0\267\xd0\270'); 
        ?> 
</td> 
                            <?php  
        foreach ($a['var']['fields'] as $aV) { 
            ?> 
                                <td><span><?php  
            echo $oL->get($aV['title']); 
            ?> 
</span></td> 
                            <?php  
        } 
        ?> 
                            <td><span><?php  
        echo $oL->get('\xd0\x9f\xd0\xbe\xd0\273\321\214\xd0\267\320\276\320\xb2\xd0\260\xd1\x82\320\xb5\320\xbb\xd1\x8c, \321\201\320\xbe\xd0\267\320\264\xd0\xb0\320\xb2\321\210\320\xb8\xd0\xb9 \xd1\x81\xd0\xb2\321\x8f\xd0\267\321\x8c'); 
        ?> 
</td> 
                        </tr> 
                    </table> 
                </div> 
                <div style='background-color: #fff;' id='documents_count_info_<?php  
        echo $a['var']['name']; 
        ?> 
'> 
                    <p id='bottom_pagination' class='clearfix content_bottom_toolbar_inner' style='line-height: 23px;text-shadow: 0 1px 0 #FFFFFF;color:#696969' > 
                        <span class='meta_info'><?php  
        echo $oL->get('\320\222\321\x81\320\xb5\xd0\xb3\xd0\xbe:'); 
        ?> 
 <span><?php  
        echo count($a['var']['extra_fields']); 
        ?> 
</span></span> 
                        <?php  
        $iTotPages = $a['var']['page_count'] > 0 ? $a['var']['page_count'] : 1; 
        $iCurrPage = $a['var']['page_number']; 
        ?> 
                        <span class='btns'> 
                            <?php  
        if (!(4 < $iCurrPage)) { 
            goto Label_36806; 
        } 
        ?> 
                                <a href='#' class='btn first'  href='#' onclick='getContent<?php  
        echo $a['var']['name']; 
        ?> 
(0); return false;'></a> 
                            <?php  
        Label_36806: 
        ?> 
                            <?php  
        for ($i = max(0, $iCurrPage - 4); $i < min($iTotPages, $iCurrPage + 5); $i++) { 
            ?> 
                                <a href='#' class='btn <?php  
            echo $i == $iCurrPage ? 'current' : ''; 
            ?> 
' onclick='getContent<?php  
            echo $a['var']['name']; 
            ?> 
('<?php  
            echo $i; 
            ?> 
'); return false;'><?php  
            echo $i + 1; 
            ?> 
</a> 
                            <?php  
        } 
        ?> 
                            <?php  
        if (!($iCurrPage + 5 < $iTotPages)) { 
            goto Label_36807; 
        } 
        ?> 
                                <a href='#' class='btn last' onclick='getContent<?php  
        echo $a['var']['name']; 
        ?> 
('<?php  
        echo $iTotPages - 1; 
        ?> 
'); return false;'></a> 
                            <?php  
        Label_36807: 
        ?> 
                        </span> 
                        <span class='pages_info'> 
                            <?php  
        if (\app\user\Account::getaccount()->getlocale() == 'kz') { 
            goto Label_36808; 
        } 
        ?> 
                                <?php  
        echo $iCurrPage + 1; 
        ?> 
 <?php  
        echo $oL->get('\320\270\320\xb7'); 
        ?> 
 <?php  
        echo $iTotPages; 
        ?> 
                            <?php  
        goto Label_36809; 
        Label_36808: 
        ?> 
                                <?php  
        echo $iTotPages; 
        ?> 
  <?php  
        echo $iCurrPage + 1; 
        ?> 
                            <?php  
        Label_36809: 
        ?> 
                        </span> 
                    </p> 
                </div> 
            </div> 
        </div> 
        <script> 
            $(document).ready(function() { 
                var oWrap = $('#associated_documents_<?php  
        echo $a['var']['name']; 
        ?> 
'); 
                oWrap.children('h3').unbind('click').bind('click', function() 
                { 
                    if($(this).data('loaded') == 0) 
                    { 
                        getContent<?php  
        echo $a['var']['name']; 
        ?> 
(); 
                        $(this).data('loaded', 1); 
                    } 
                }); 
 
                <?php  
        echo $a['var']['is_expanded'] ? 'oWrap.children('h3').click();' : ''; 
        ?> 
            }); 
 
            function getContent<?php  
        echo $a['var']['name']; 
        ?> 
(iPage) 
            { 
                var oThinking = $('#thinking'); 
                oThinking.show(); 
                iPage = iPage||0; 
                $.get('/workflow/document/associated-document/<?php  
        echo $a['doctype_id']; 
        ?> 
/<?php  
        echo $a['document_id']; 
        ?> 
/<?php  
        echo $a['var']['name']; 
        ?> 
?p=' + iPage, function(sHtml) 
                { 
                    iPage++; 
                    $('#bottom_pagination a').each(function() 
                    { 
                        $(this).removeClass('current'); 
                        if($(this).text() == iPage) 
                        { 
                            $(this).addClass('current'); 
                        } 
                    }); 
                    var oWrap = $('#associated_documents_<?php  
        echo $a['var']['name']; 
        ?> 
'); 
                    var oInnerWrap = oWrap.children('.inner_wrap'); 
                    oInnerWrap.find('#associated_table_<?php  
        echo $a['var']['name']; 
        ?> 
 tr:not(.title)').empty(); 
                    oInnerWrap.find('#associated_table_<?php  
        echo $a['var']['name']; 
        ?> 
').append(sHtml); 
                    oWrap.removeClass('collapsed').addClass('expanded'); 
                    oInnerWrap.slideDown(200); 
                    $('#total_count_<?php  
        echo $a['var']['name']; 
        ?> 
').show(); 
                    oThinking.hide(); 
 
                }); 
            } 
        </script> 
        <?php  
        $s = ob_get_clean(); 
        return $s; 
    } 
    public static function associatedvaredit($a) 
    { 
        $oL = \app\system\Registry::get('locale'); 
        $oC = \app\system\Registry::get('config'); 
        ob_start(); 
        ?> 
        <style> 
            #associated_table_<?php  
        echo $a['var']['name']; 
        ?> 
 {  } 
        </style> 
        <p> 
            <input id='associated_documents_<?php  
        echo $a['var']['name']; 
        ?> 
_button_add' type='button' class='btn btn-sm btn-raised btn-default open_window_btn' value='<?php  
        echo $oL->get('\320\x94\xd0\276\xd0\xb1\xd0\xb0\320\xb2\320\270\xd1\202\321\x8c'); 
        ?> 
'> 
        </p> 
        <div id='associated_documents_<?php  
        echo $a['var']['name']; 
        ?> 
' class='field_big_wrap expanded'> 
            <h3 data-loaded='0' > 
                <?php  
        echo $oL->get($a['var']['title'], '\xd0\x94\320\xbe\320\272\321\203\320\xbc\320\265\xd0\275\321\202\xd1\213', '\320\237\320\xb5\321\200\320\xb5\xd0\xbc\xd0\xb5\xd0\xbd\320\275\xd1\213\xd0\xb5', sprintf('%s-%s-title', $a['doctype_id'], $a['var']['name'])); 
        ?> 
            </h3> 
            <div class='inner_wrap'> 
                <table id='associated_table_<?php  
        echo $a['var']['name']; 
        ?> 
' border='0' cellpadding='0' cellspacing='0' class='field_table_view' style='max-width:100%; '> 
                    <tr class='title'> 
                        <td>&nbsp;</td> 
                        <td style='min-width:230px;' > 
                            <span><?php  
        echo $oL->get('\320\x92\320\270\xd0\xb4 \321\201\xd0\262\xd1\217\320\xb7\320\xb8'); 
        ?> 
                            <input type='hidden' value='' name='<?php  
        echo $a['var']['name']; 
        ?> 
[0][type]'> 
                        </td> 
                        <td> 
                            <span><?php  
        echo $oL->get('\320\224\xd0\xbe\xd0\272\xd1\203\320\274\320\xb5\xd0\275\xd1\x82'); 
        ?> 
                            <input type='hidden' value='' name='<?php  
        echo $a['var']['name']; 
        ?> 
[0][document]'> 
                        </td> 
                        <?php  
        foreach ($a['var']['fields'] as $aV) { 
            ?> 
                            <td><span><?php  
            echo $oL->get($aV['title']); 
            ?> 
</span></td> 
                        <?php  
        } 
        ?> 
                        <td> 
                            <span><?php  
        echo $oL->get('\xd0\237\xd0\xbe\320\xbb\321\x8c\320\267\320\xbe\320\xb2\320\260\321\x82\320\xb5\xd0\273\321\x8c, \xd1\201\320\276\320\267\320\264\320\260\xd0\262\xd1\x88\320\xb8\xd0\271 \xd1\201\320\262\xd1\217\xd0\267\xd1\x8c'); 
        ?> 
                        </td> 
                    </tr> 
 
                    <?php  
        foreach ($a['data']['fields'] as $sK => $aV) { 
            $iIter = $sK; 
            ?> 
                        <tr class='trow' > 
                            <td class=' cell_with_canvas' > 
                                <span class='btn_remove' >&nbsp;</span> 
                            </td> 
                            <td class=' cell_with_canvas'> 
                                <?php  
            echo \app\reference\REF::referenceedit($a['var']['name'] . '[' . $iIter . '][type]', $a['var']['extra_fields'][$sK]['type'], array('reference_id' => $oC->get('ref_type_link'), 'fields' => array('type'), 'ref_default_group' => array(), 'ref_default_filter' => array(), 'is_single' => 1, 'pure_template' => 'type', 'container' => $a['var']['name'] . '_' . $iIter . '_type')); 
            ?> 
                            </td> 
                            <td class=' cell_with_canvas' > 
                                <?php  
            $aFieldDocumentConfig = $a['var']['document_field_config'] ? $a['var']['document_field_config'] : array('doctypes' => array_keys($a['var']['doctypes']), 'is_single' => 1, 'container' => $a['var']['name'] . '_' . $iIter . '_document'); 
            $aFieldDocumentConfig['container'] = $a['var']['name'] . '_' . $iIter . '_document'; 
            ?> 
                                <?php  
            echo \app\reference\REF::documentedit($a['var']['name'] . '[' . $iIter . '][document]', $a['var']['extra_fields'][$sK]['document'], $aFieldDocumentConfig); 
            ?> 
                            </td> 
                            <?php  
            foreach ($aV as $sKey => $oVal) { 
                if (!($sKey === 0 || $sKey === 1)) { 
                    goto Label_36810; 
                } 
                continue; 
                Label_36810: 
                ?> 
                                <td class=' cell_with_canvas' > 
                                    <span><?php  
                echo $oVal['isValue'] ? $oVal['value']->getgridvalue() : ''; 
                ?> 
</span> 
                                </td> 
                            <?php  
            } 
            ?> 
                        </tr> 
                    <?php  
        } 
        ?> 
                </table> 
                <div style='background-color: #fff;' id='documents_count_info_<?php  
        echo $a['var']['name']; 
        ?> 
'> 
                    <p style='line-height: 23px;text-shadow: 0 1px 0 #FFFFFF;color:#696969'> 
                        <?php  
        echo $oL->get('\320\x92\xd1\201\320\xb5\320\263\xd0\276:'); 
        ?> 
                        <span id='total_count_<?php  
        echo $a['var']['name']; 
        ?> 
'><?php  
        echo count($a['var']['extra_fields']); 
        ?> 
</span> 
                    </p> 
                </div> 
            </div> 
        </div> 
        <script> 
            $(document).ready(function() { 
                var oButtonAdd = $('#associated_documents_<?php  
        echo $a['var']['name']; 
        ?> 
_button_add'); 
                oButtonAdd.unbind('click').bind('click', function() 
                { 
                    var iNumber = $('#associated_table_<?php  
        echo $a['var']['name']; 
        ?> 
 tr').size() - 1; 
 
                    $.get('/workflow/document/associated-document-modify/add/<?php  
        echo $a['doctype_id']; 
        ?> 
/<?php  
        echo $a['var']['name']; 
        ?> 
/' + iNumber, function(sHtml) 
                    { 
                        $('#associated_table_<?php  
        echo $a['var']['name']; 
        ?> 
').append(sHtml); 
                        associated_table_<?php  
        echo $a['var']['name']; 
        ?> 
_bind(); 
                    }); 
                }); 
 
                associated_table_<?php  
        echo $a['var']['name']; 
        ?> 
_bind(); 
            }); 
 
            function associated_table_<?php  
        echo $a['var']['name']; 
        ?> 
_bind() 
            { 
                $('#associated_table_<?php  
        echo $a['var']['name']; 
        ?> 
 .btn_remove').unbind('click').bind('click', function() 
                { 
                    $(this).parent().parent().remove(); 
                }); 
            } 
 
        </script> 
        <?php  
        $s = ob_get_clean(); 
        return $s; 
    } 
    public static function associatedvareditadd($sVarName, $iNumber, $iCount, $aDoctypes, $aDConfig) 
    { 
        $aDConfig = array(); 
        $iIter = $iNumber + 1; 
        $oL = \app\system\Registry::get('locale'); 
        $oC = \app\system\Registry::get('config'); 
        ob_start(); 
        ?> 
        <tr class='trow' > 
            <td class=' cell_with_canvas' > 
                <span class='btn_remove'><i class='fa fa-times' aria-hidden='true'></i></span> 
            </td> 
            <td class=' cell_with_canvas' > 
                <?php  
        echo \app\reference\REF::referenceedit($sVarName . '[' . $iIter . '][type]', array(), array('reference_id' => $oC->get('ref_type_link'), 'fields' => array('type'), 'ref_default_group' => array(), 'ref_default_filter' => array(), 'is_single' => 0, 'pure_template' => 'type', 'container' => $sVarName . '_' . $iIter . '_type')); 
        ?> 
            </td> 
            <td class=' cell_with_canvas' > 
                <?php  
        $aFieldDocumentConfig = $aDConfig ? $aDConfig : array('doctypes' => $aDoctypes, 'is_single' => 1, 'container' => $sVarName . '_' . $iIter . '_document'); 
        $aFieldDocumentConfig['container'] = $sVarName . '_' . $iIter . '_document'; 
        ?> 
                <?php  
        echo \app\reference\REF::documentedit($sVarName . '[' . $iIter . '][document]', array(), $aFieldDocumentConfig); 
        ?> 
            </td> 
            <?php  
        for ($i = 0; $i < $iCount + 1; $i++) { 
            ?> 
                <td class=' cell_with_canvas' > 
                    <span></span> 
                </td> 
            <?php  
        } 
        ?> 
        </tr> 
        <?php  
        $s = ob_get_clean(); 
        return $s; 
    } 
    public static function associatedvarviewtablecontent($a, $aConfig) 
    { 
        $iN = 0; 
        foreach ($a['fields'] as $aV) { 
            $iN++; 
            $aDocument = explode(':', key($aV[1]['value']->get())); 
            ?> 
            <tr class='trow' > 
                <td class=' cell_with_canvas td_fastopen' onclick='openModalWindow('/workflow/document/fast-view/<?php  
            echo $aDocument[0]; 
            ?> 
/<?php  
            echo $aDocument[1]; 
            ?> 
')' > 
                    <span class='btn_fastopen'></span> 
                </td> 
                <?php  
            foreach ($aV as $sKey => $oVal) { 
                if ($oVal['isVisible']) { 
                    goto Label_36811; 
                } 
                continue; 
                Label_36811: 
                ?> 
                    <td class=' cell_with_canvas' > 
                        <span><?php  
                echo $oVal['isValue'] ? $oVal['value']->getgridvalue() : ''; 
                ?> 
</span> 
                    </td> 
                <?php  
            } 
            ?> 
            </tr> 
            <?php  
            if (!($iN == $aConfig['row_on_page'])) { 
                goto Label_36812; 
            } 
            break; 
            Label_36812: 
        } 
        ?> 
        <script> 
            $(document).ready(function() { 
                var oWrap = $('#associated_documents_<?php  
        echo $aConfig['name']; 
        ?> 
'); 
 
                oWrap.children('h3').unbind('click').bind('click', function() 
                { 
                    headerToggle<?php  
        echo $aConfig['name']; 
        ?> 
($(this)); 
                }); 
 
                var oInnerWrap = oWrap.children('.inner_wrap'); 
 
                var delay = (function() 
                { 
                    var timer = 0; 
                    return function(callback, ms) { 
                        clearTimeout(timer); 
                        timer = setTimeout(callback, ms); 
                    }; 
                })(); 
 
                oWrap.find('#search_bar').find('.field_keyword') 
                    .focus(function() 
                    { 
                        oWrap.children('h3').unbind('click'); 
                    }) 
                    .blur(function() 
                    { 
                        oWrap.children('h3').click(function() 
                        { 
                            headerToggle<?php  
        echo $aConfig['name']; 
        ?> 
($(this)); 
                        }) 
                    }).keyup(function() 
                { 
                    //canceling previous ajax request 
                    if (typeof ajaxQSRequest == 'object') { 
                        ajaxQSRequest.abort(); 
                    } 
 
                    var sQs = $(this).val(); 
                    delay(function() { 
                        if(sQs.length == 0) 
                        { 
                            $('#associated_table_<?php  
        echo $aConfig['name']; 
        ?> 
').show(); 
                            return; 
                        }else if (sQs.length < 3 && sQs.length > 0) 
                        { 
                            return; 
                        } 
 
                        var oThinking = $('#thinking'); 
                    }, 500); //<-keyUp TimeOut 
                }); 
            }); 
 
            var ajaxQSRequest; 
 
            function headerToggle<?php  
        echo $aConfig['name']; 
        ?> 
(oHeader) 
            { 
                var oDocCountInfo = oHeader.siblings('#documents_count_info_<?php  
        echo $aConfig['name']; 
        ?> 
'); 
                var oWrap = oHeader.parent(); 
                var oInnerWrap = oWrap.children('.inner_wrap'); 
                if (oWrap.hasClass('collapsed')) 
                { 
                    oWrap.removeClass('collapsed').addClass('expanded'); 
                    oInnerWrap.slideDown(200); 
                    oDocCountInfo.show(); 
                } 
                else 
                { 
                    oWrap.removeClass('expanded').addClass('collapsed'); 
                    oInnerWrap.slideUp(200); 
                    oDocCountInfo.hide(); 
                } 
            } 
        </script> 
        <?php  
    } 
    public static function variablevar($a, $sDoctypeId, $sDocumentId, $isAjaxRequest = false) 
    { 
        $oL = \app\system\Registry::get('locale'); 
        $bFastEdit = \app\system\Registry::get('config')->get('rel_doc_fast_edit_and_view'); 
        ob_start(); 
        $sHiddenDescription = current(a($a['var'], 'hidden_description', array())); 
        $isHierarchical = false; 
        foreach ($a['var']['fields'] as $aV) { 
            if (!$aV['hierarchical']) { 
                goto Label_36813; 
            } 
            $isHierarchical = true; 
            Label_36813: 
        } 
        $a['var']['hierarchical'] = $isHierarchical; 
        ?> 
 
        <?php  
        if ($isAjaxRequest) { 
            goto Label_36816; 
        } 
        ?> 
 
 
        <div id='variable_doctypes_list_<?php  
        echo $a['var']['name']; 
        ?> 
' class='drop-down-list-v2' style='display: none;'> 
            <!--<input class='drop-down-list-search' type='text' style='width: 100%; box-sizing: border-box;' placeholder='...'>--> 
            <div class='drop-down-list-body'> 
                <?php  
        foreach ($a['var']['doctypes'] as $sKey => $aDoctype) { 
            ?> 
                    <div class='drop-down-list-item' data-value='<?php  
            echo $sKey; 
            ?> 
'><?php  
            echo $aDoctype['title']; 
            ?> 
</div> 
                <?php  
        } 
        ?> 
            </div> 
        </div> 
 
    <input type='hidden' id='page_count_<?php  
        echo $a['var']['name']; 
        ?> 
' value='1' /> 
        <style> 
            table.field_table_view.execution_table tr { 
                border: none; 
            } 
            table.field_table_view.execution_table span.tree { 
                font-size: 16px; 
            } 
            table.field_table_view.execution_table span.tree.plus:before { 
                content: '\f0da'; 
            } 
            table.field_table_view.execution_table span.tree.minus:before { 
                content: '\f0d7'; 
            } 
            table.field_table_view.execution_table tr:not(.title) td { 
                overflow: initial; 
                position: relative; 
            } 
            table.field_table_view.execution_table tr:not(.title):hover { 
                background-color: #f5f5f5; 
            } 
            table.field_table_view.execution_table span.tree.minus { 
                color: #0d47a1; 
            } 
            table.field_table_view.execution_table span.tree.minus:after { 
                content: ''; 
                position: absolute; 
                width: 1px; 
                height: 100%; 
                border-left: 2px solid; 
                top: 22px; 
                margin-left: 3px; 
            } 
            table.field_table_view.execution_table span.tree.gline { 
                width: 6px; 
                height: 6px; 
                background-color: #0d47a1; 
                display: inline-block; 
                border-radius: 50%; 
                margin-top: 7px; 
            } 
            table.field_table_view.execution_table tr td .tree_grid.tree_grid_last { 
 
            } 
            table.field_table_view.execution_table tr td .tree_grid.tree_grid_v_line:before { 
                content: ''; 
                position: absolute; 
                top: 0; 
                bottom: 0; 
                width: 2px; 
                background-color: #0d47a1; 
                margin-left: 3px; 
            } 
            table.field_table_view.execution_table tr td .tree_grid.tree_grid_last:before { 
                content: ''; 
                width: 12px; 
                height: 1px; 
                border-top: 2px solid #0d47a1; 
                display: inline-block; 
                top: 14px; 
                position: absolute; 
                margin-left: 3px; 
            } 
            table.field_table_view.execution_table tr td .tree_grid.tree_grid_last:after { 
                content: ''; 
                width: 1px; 
                height: 15px; 
                border-left: 2px solid #0d47a1; 
                display: inline-block; 
                top: 1px; 
                position: absolute; 
                margin-left: 3px; 
            } 
            table.field_table_view.execution_table tr td .tree_grid.tree_grid_last.tree_grid_has_siblings:after { 
                height: 100%; 
            } 
        </style> 
        <table id='variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
' border='0' cellpadding='0' cellspacing='0' class='field_table_view execution_table plain CRZ' style='width:100%;'> 
            <tr class='title'> 
                <?php  
        $iIter = 1; 
        foreach ($a['var']['fields'] as $sK1 => $aV1) { 
            if (!($sHiddenDescription == $sK1)) { 
                goto Label_36814; 
            } 
            continue; 
            Label_36814: 
            ?> 
                    <td  style='width:<?php  
            echo $aV1['width']; 
            ?> 
%;' title='<?php  
            echo v($oL->get($aV1['title'], '\xd0\x94\320\276\320\xba\xd1\x83\320\xbc\xd0\xb5\320\275\321\202\321\213', '\320\x9f\xd0\265\321\x80\320\265\xd0\xbc\320\265\320\275\320\xbd\xd1\x8b\320\265 - \xd0\277\xd0\276\320\273\xd1\217', sprintf('%s-%s-%s-title', $a['doctype_id'], $a['var']['name'], $sK1))); 
            ?> 
'><?php  
            echo v($oL->get($aV1['title'], '\320\x94\xd0\xbe\xd0\xba\xd1\x83\320\274\320\265\xd0\275\xd1\x82\321\x8b', '\320\x9f\320\265\xd1\200\xd0\265\320\xbc\320\xb5\320\275\xd0\xbd\321\213\320\xb5 - \xd0\xbf\320\xbe\320\xbb\xd1\217', sprintf('%s-%s-%s-title', $a['doctype_id'], $a['var']['name'], $sK1))); 
            ?> 
</td> 
                    <?php  
            $iIter++; 
        } 
        ?> 
 
                <?php  
        $sStyle = 'width: 24px !important;'; 
         
        ?> 
                <td style='<?php  
        echo $sStyle; 
        ?> 
'><?php  
        if (!($bFastEdit && $a['var']['fast_edit'])) { 
            goto Label_36815; 
        } 
        ?> 
                        <span style='margin: 0px 1px;' class='btn_fast_create' onclick='createRelatedDocument<?php  
        echo $a['var']['name']; 
        ?> 
(this, '<?php  
        echo $sDocumentId; 
        ?> 
', '<?php  
        echo $a['doctype_id']; 
        ?> 
')'> </span> 
                    <?php  
        Label_36815: 
        ?> 
</td> 
            </tr> 
            <?php  
        Label_36816: 
        ?> 
            <?php  
        $sEnum = 'f_f1066f'; 
        $sGoupingLvl2 = 'f_c1c64c'; 
        $mTmp = current($a['data']); 
        if ($bFastEdit && $a['var']['fast_edit'] && isset($mTmp[$sEnum])) { 
            goto Label_36836; 
        } 
        self::variablevartabletr($a, $a['data'], $sDocumentId, $a['offset'], $a['limit'], 0); 
        goto Label_36837; 
        Label_36836: 
        $a['limit'] = array(); 
        $aRef = array(); 
        foreach (\app\system\model\ListModel::getlist('ref_doc_b1a3192')->bind(array('fields' => 'id, f_81aafea[2][1] as status'))->find()->getdata() as $aRow) { 
            $aRef[$aRow['id']] = $aRow['status']; 
        } 
        $aGroupData = array('Newinttech' => array(), 'KazDoc Technology' => array()); 
        $iCounts = array(); 
        foreach ($a['data'] as $sID => $aRow) { 
            $mGV = implode(',', \app\reference\engine\ArrayMapperUtil::unserialize($aRow[$sEnum])); 
            $mGV2 = key(\app\reference\engine\ArrayMapperUtil::unserialize($aRow[$sGoupingLvl2])); 
            $mGV2 = a($aRef, $mGV2, ''); 
            $aGroupData[$mGV][$mGV2][$sID] = $aRow; 
            foreach ($a['var']['fields'] as $sName => $aField) { 
                if (!($aField['type'] == 'integer' || $aField['type'] == 'float')) { 
                    goto Label_36818; 
                } 
                if (isset($iCounts[$mGV][$mGV2][$sName])) { 
                    goto Label_36817; 
                } 
                $iCounts[$mGV][$mGV2][$sName] = 0; 
                Label_36817: 
                $iCounts[$mGV][$mGV2][$sName] += $aRow[$sName]; 
                Label_36818: 
            } 
        } 
        foreach ($aGroupData as $sGroupL1 => $aGroupL1) { 
            ksort($aGroupL1); 
            $aGroupData[$sGroupL1] = $aGroupL1; 
        } 
        $aTotal = array(); 
        foreach ($aGroupData as $sGroupL1 => $aGroupL1) { 
            if (!empty($aGroupL1)) { 
                goto Label_36819; 
            } 
            continue; 
            Label_36819: 
            echo '<tr class="trow company"><td></td>'; 
            $iIter = 1; 
            foreach ($a['var']['fields'] as $sK1 => $aV1) { 
                if (!($sHiddenDescription == $sK1)) { 
                    goto Label_36820; 
                } 
                continue; 
                Label_36820: 
                $sValue = ''; 
                if (!($iIter++ == 1)) { 
                    goto Label_36821; 
                } 
                $sValue = $sGroupL1; 
                Label_36821: 
                if (!isset($iCounts[$sGroupL1])) { 
                    goto Label_36826; 
                } 
                $sTotal = 0; 
                foreach ($iCounts[$sGroupL1] as $aV2) { 
                    if (!isset($aV2[$sK1])) { 
                        goto Label_36822; 
                    } 
                    $sTotal += $aV2[$sK1]; 
                    Label_36822: 
                } 
                $sTotal = number_format($sTotal, 0, ',', ' '); 
                $sTotal = $sTotal == 0 ? '' : $sTotal; 
                if (empty($sTotal)) { 
                    goto Label_36825; 
                } 
                if ($sValue == $sGroupL1) { 
                    goto Label_36823; 
                } 
                $sValue = $sTotal; 
                goto Label_36824; 
                Label_36823: 
                $sValue .= ' (' . $sTotal . ')'; 
                Label_36824: 
                Label_36825: 
                Label_36826: 
                echo '<td>' . $sValue . '</td>'; 
            } 
            echo '</tr>'; 
            foreach ($aGroupL1 as $sGroupL2 => $aGroupL2) { 
                if (!empty($aGroupL2)) { 
                    goto Label_36827; 
                } 
                continue; 
                Label_36827: 
                echo '<tr class="trow catalog"><td></td>'; 
                $iIter = 1; 
                foreach ($a['var']['fields'] as $sK1 => $aV1) { 
                    if (!($sHiddenDescription == $sK1)) { 
                        goto Label_36828; 
                    } 
                    continue; 
                    Label_36828: 
                    $sValue = ''; 
                    if (!isset($iCounts[$sGroupL1][$sGroupL2][$sK1])) { 
                        goto Label_36830; 
                    } 
                    if (isset($aTotal[$sK1])) { 
                        goto Label_36829; 
                    } 
                    $aTotal[$sK1] = 0; 
                    Label_36829: 
                    $aTotal[$sK1] += $iCounts[$sGroupL1][$sGroupL2][$sK1]; 
                    $sValue = number_format($iCounts[$sGroupL1][$sGroupL2][$sK1], 0, ',', ' '); 
                    $sValue = $sValue == 0 ? '' : $sValue; 
                    Label_36830: 
                    if (!($iIter++ == 1)) { 
                        goto Label_36831; 
                    } 
                    $sValue = empty($sValue) ? $sGroupL2 : $sGroupL2 . ' (' . $sValue . ')'; 
                    Label_36831: 
                    echo '<td>' . $sValue . '</td>'; 
                } 
                echo '</tr>'; 
                self::variablevartabletr($a, $aGroupL2, $sDocumentId, $a['offset'], $a['limit'], 0); 
            } 
        } 
        $iIter = 1; 
        echo '<tr class="trow total"><td></td>'; 
        foreach ($a['var']['fields'] as $sK1 => $aV1) { 
            if (!($sHiddenDescription == $sK1)) { 
                goto Label_36832; 
            } 
            continue; 
            Label_36832: 
            $sValue = ''; 
            if (!($iIter++ == 1)) { 
                goto Label_36833; 
            } 
            $sValue = '\xd0\222\xd1\x81\320\265\xd0\263\xd0\276:'; 
            Label_36833: 
            $sTotal = ''; 
            foreach ($aTotal as $sK2 => $iV) { 
                if (!($sK2 == $sK1)) { 
                    goto Label_36834; 
                } 
                $sTotal = number_format($iV, 0, ',', ' '); 
                Label_36834: 
                if (empty($sTotal)) { 
                    goto Label_36835; 
                } 
                $sValue = $sValue == '\320\x92\xd1\201\xd0\265\xd0\263\xd0\xbe:' ? $sValue . ' ' . $sTotal : $sTotal; 
                Label_36835: 
            } 
            echo '<td>' . $sValue . '</td>'; 
        } 
        echo '</tr>'; 
        Label_36837: 
        ?> 
            <!-- dasd --> 
            <?php  
        if ($isAjaxRequest) { 
            goto Label_36843; 
        } 
        ?> 
        </table> 
        <?php  
        if (!($a['data_count'] > $a['limit'])) { 
            goto Label_36838; 
        } 
        ?> 
        <div class='load-next_<?php  
        echo $a['var']['name']; 
        ?> 
' onclick='loadNext_<?php  
        echo $a['var']['name']; 
        ?> 
(this, <?php  
        echo $a['limit']; 
        ?> 
);'><?php  
        echo $oL->get('\xd0\227\320\xb0\xd0\263\321\x80\321\203\320\267\xd0\xb8\xd1\x82\321\x8c \xd0\xb5\321\x89\320\265...'); 
        ?> 
</div> 
    <?php  
        Label_36838: 
        ?> 
        <div style='background-color: #fff;' id='documents_count_info_<?php  
        echo $a['var']['name']; 
        ?> 
'> 
            <p style='line-height: 23px;text-shadow: 0 1px 0 #FFFFFF;color:#696969'> 
                <?php  
        echo $oL->get('\320\x92\321\x81\xd0\xb5\xd0\xb3\320\276:'); 
        ?> 
                <span id='total_count_<?php  
        echo $a['var']['name']; 
        ?> 
'><?php  
        echo $a['total_count']; 
        ?> 
,</span> 
                </span> 
                <span id='on_page_count_<?php  
        echo $a['var']['name']; 
        ?> 
'> 
								<?php  
        echo $oL->get('\320\xbd\xd0\260 \321\201\321\x82\321\200\xd0\260\320\xbd\320\xb8\xd1\206\xd0\265'); 
        ?> 
								<span id='display_count_<?php  
        echo $a['var']['name']; 
        ?> 
'><?php  
        echo $a['display_count']; 
        ?> 
</span> 
						</span> 
            </p> 
        </div> 
 
        <script type='text/javascript'> 
            /* <![CDATA[ */ 
            function loadNext_<?php  
        echo $a['var']['name']; 
        ?> 
(el, limit) { 
                var offLimitEls = $('#variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
 tr.off-limit').slice(0, limit); 
                if(offLimitEls.length) { 
                    offLimitEls.removeClass('off-limit').show(); 
                    $('#display_count_<?php  
        echo $a['var']['name']; 
        ?> 
').text(+$('#display_count_<?php  
        echo $a['var']['name']; 
        ?> 
').text() + offLimitEls.length); 
                    if(!$('#variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
 tr.off-limit').length) { 
                        $(el).hide(); 
                    } 
                } 
            } 
 
            function createRelatedDocument<?php  
        echo $a['var']['name']; 
        ?> 
(element, sDocID, sParentDoctypeId) { 
                var sDoctypeId = '<?php  
        echo $a['doctype_id']; 
        ?> 
'; 
 
                $('#variable_doctypes_list_<?php  
        echo $a['var']['name']; 
        ?> 
 .drop-down-list-item').unbind('click').click(function(){ 
                    var sUrl = '/workflow/document/fast-create/<?php  
        echo $a['doctype_id']; 
        ?> 
/<?php  
        echo $a['var']['name']; 
        ?> 
/' + sParentDoctypeId + '/' + sDocID + '/' + $(this).attr('data-value'); 
 
                    var oChildWin = msf.actionWindow.view(sUrl, {}, element); 
 
                }); 
 
                iCount = $('#variable_doctypes_list_<?php  
        echo $a['var']['name']; 
        ?> 
 .drop-down-list-item').length; 
                if (iCount == 1) { 
                    $('#variable_doctypes_list_<?php  
        echo $a['var']['name']; 
        ?> 
 .drop-down-list-item').click(); 
                } else { 
                    $('#variable_doctypes_list_<?php  
        echo $a['var']['name']; 
        ?> 
').popup($(element)); 
                } 
            } 
 
            function deleteTree<?php  
        echo $a['var']['name']; 
        ?> 
(sDoctypeId, sDocumentId) { 
                var sParentSelector = '#variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
'; 
 
                iResult = confirm('        ?'); 
 
                if (!iResult) { 
                    return false; 
                } 
 
                $.ajax({ 
                    url: '/workflow/delete-from-rel-tree/'+ sDoctypeId +'/'+ sDocumentId, 
                    type: 'get', 
                    dataType: 'json', 
                    success: function(aData){ 
                        if (aData['status'] == 1){ 
                            MSF_StatusBar.showSuccess(aData['message']); 
                            updateRelDocsTable<?php  
        echo $a['var']['name']; 
        ?> 
(); 
                        } else { 
                            MSF_StatusBar.showError(''); 
                        } 
                    } 
                }); 
            } 
 
            function loadRelatedDocuments<?php  
        echo $a['var']['name']; 
        ?> 
(sDoctypeId,sDocumentId,sVariableName){ 
                var oSpinner = $('#loadRelatedDocuments<?php  
        echo $a['var']['name']; 
        ?> 
').find('img'); 
                oSpinner.show(); 
                var iP = $('#page_count_<?php  
        echo $a['var']['name']; 
        ?> 
').val(); 
                var sQs = $('#related_documents_<?php  
        echo $a['var']['name']; 
        ?> 
').find('.field_keyword').val(); 
                $.get('/workflow/document/related-document/' + sDoctypeId + '/' + sDocumentId + '/' + sVariableName + '?is_ajax=1&qs='+sQs+'&p='+ iP + '<?php  
        echo isset($_GET['mydocuments']) ? '&mydocuments' : ''; 
        ?> 
',function(sHtml){ 
                    $('#variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
') 
                        .find('tbody') 
                        // .find('#loadDocuments<?php  
        echo $a['var']['name']; 
        ?> 
') 
                        // .remove() 
                        // .end() 
                        .append(sHtml); 
                    $('#loadRelatedDocuments<?php  
        echo $a['var']['name']; 
        ?> 
').addClass('loaded'); 
                    window.<?php  
        echo $a['var']['name']; 
        ?> 
Hook(); 
                    oSpinner.hide(); 
                    $('#page_count_<?php  
        echo $a['var']['name']; 
        ?> 
').val(parseInt(iP)+1); 
                }); 
            } 
 
            function headerToggle<?php  
        echo $a['var']['name']; 
        ?> 
(oHeader) 
            { 
                var oDocCountInfo = oHeader.siblings('#documents_count_info_<?php  
        echo $a['var']['name']; 
        ?> 
'); 
                var oWrap = $('#related_documents_<?php  
        echo $a['var']['name']; 
        ?> 
'); 
                var oInnerWrap = oWrap.children('.inner_wrap'); 
                if (oWrap.hasClass('collapsed')) 
                { 
                    oWrap.removeClass('collapsed').addClass('expanded'); 
                    oInnerWrap.slideDown(200); 
                    oDocCountInfo.show(); 
                } 
                else 
                { 
                    oWrap.removeClass('expanded').addClass('collapsed'); 
                    oInnerWrap.slideUp(200); 
                    oDocCountInfo.hide(); 
                } 
            } 
            var delay = (function() { 
                var timer = 0; 
                return function(callback, ms) { 
                    clearTimeout(timer); 
                    timer = setTimeout(callback, ms); 
                }; 
            })(); 
            var ajaxQSRequest; 
            $(document).ready(function() { 
                setTimeout(function(){ 
                    $('#variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
 .execution_table .structureView_view_user_info').each(function(){ 
                        $(this).parents('td').eq(0).width() < $(this).width() ? $(this).width($(this).parents('td').eq(0).width()).children('.sV_user_info__inner').css('max-width', '100%') : ''; 
                    }); 
                },500); 
                //var oFT = new MSF_FieldTable('#variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
',null); 
                var oWrap = $('#related_documents_<?php  
        echo $a['var']['name']; 
        ?> 
'); 
                oWrap.children('h3').unbind('click').bind('click',function() 
                { 
                    headerToggle<?php  
        echo $a['var']['name']; 
        ?> 
($(this)); 
                }); 
                $('#iconBtnIdForSearchAndDelete<?php  
        echo $a['var']['name']; 
        ?> 
').click(function(){ 
                    var e = $(this); 
                    e.addClass('iconBtnForSearching').removeClass('iconBtnForDelete'); 
                    oWrap.find('#search_bar').find('.field_keyword').val(''); 
                    oWrap.find('#search_bar').find('.field_keyword').keyup(); 
                    return false; 
                }); 
                var oInnerWrap = oWrap.children('.inner_wrap'); 
                oWrap.find('#search_bar').find('.export_button').click(function() 
                { 
                    oWrap.children('h3').unbind('click'); 
                }).mouseout(function(){ 
                    oWrap.children('h3').unbind('click').bind('click',function(){ 
                        headerToggle<?php  
        echo $a['var']['name']; 
        ?> 
($(this)); 
                    }); 
                }); 
 
                oWrap.find('#search_bar').find('.field_keyword').focus(function() 
                { 
                    oWrap.children('h3').unbind('click'); 
                }) 
                    .blur(function() 
                    { 
                        oWrap.children('h3').unbind('click').bind('click',function() 
                        { 
                            headerToggle<?php  
        echo $a['var']['name']; 
        ?> 
($(this)); 
                        }); 
                    }).keyup(function () { 
                    // canceling previous ajax request 
                    if (typeof ajaxQSRequest === 'object') { 
                        ajaxQSRequest.abort(); 
                    } 
 
                    var sQs = $(this).val(); 
 
                    delay(function () { 
                        if (sQs.length < 3 && sQs.length > 0) { return; } 
 
                        var oThinking = $('#thinking'); 
                        oThinking.show(); 
 
                        var oTable<?php  
        echo $a['var']['name']; 
        ?> 
 = $('#variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
'); 
 
                        $('#page_count_<?php  
        echo $a['var']['name']; 
        ?> 
').val('1'); 
 
                        ajaxQSRequest = $.get( 
                            '/workflow/document/related-document/<?php  
        echo $sDoctypeId; 
        ?> 
/<?php  
        echo $sDocumentId; 
        ?> 
/<?php  
        echo $a['var']['name']; 
        ?> 
?qs=' + sQs + '&p=0<?php  
        echo isset($_GET['mydocuments']) ? '&mydocuments' : ''; 
        ?> 
', 
                            function (sHtml) { 
                                var oParent = oTable<?php  
        echo $a['var']['name']; 
        ?> 
.parent(); 
                                oParent.empty().append(sHtml); 
                                window.<?php  
        echo $a['var']['name']; 
        ?> 
Hook(); 
                                oThinking.hide(); 
                                if (sQs.length >= 3) { 
                                    $('#iconBtnIdForSearchAndDelete<?php  
        echo $a['var']['name']; 
        ?> 
').addClass('iconBtnForDelete').removeClass('iconBtnForSearching'); 
                                } 
                            } 
                        ); 
                    }, 500); // <-keyUp TimeOut 
                }); 
                <?php  
        $sGridClass = '.grid_three_line'; 
        if (!($a['var']['grid_view_type'] == 2)) { 
            goto Label_36839; 
        } 
        $sGridClass = '.grid_two_line'; 
        Label_36839: 
        ?> 
                <?php  
        if (!($a['var']['grid_view_type'] == 2 || $a['var']['grid_view_type'] == 3)) { 
            goto Label_36840; 
        } 
        ?> 
                //$('#related_documents_<?php  
        echo $a['var']['name']; 
        ?> 
').children('.inner_wrap').show(); 
                $('#variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
').find('tr').each(function(){ 
                    var oCurrentTr = $(this); 
                    var hasSingleLine = true; 
                    var oCurrentTd; 
                    oCurrentTr.find('td').each(function(){ 
                        oCurrentTd = $(this); 
 
                        oCurrentTd.find('.content').each(function(){ 
                            //console.log($(this).width()); 
                            if($(this).height() > 20) 
                            { 
                                hasSingleLine = false; 
                            } 
                        }); 
                    }); 
 
                    if(hasSingleLine) 
                    { 
                        // oCurrentTr.find('td').find('.content').addClass('normalize_single_line'); 
                    } 
                }); 
                //$('#related_documents_<?php  
        echo $a['var']['name']; 
        ?> 
').children('.inner_wrap').hide(); 
                <?php  
        Label_36840: 
        ?> 
                $('td.cell_with_canvas').children('div').not('.hasHierarchial').children('.content').each(function(){ 
                    //$(this).css('width','110%'); 
                }); 
                <?php  
        if (!($a['var']['grid_view_type'] == 2)) { 
            goto Label_36841; 
        } 
        ?> 
 
                <?php  
        Label_36841: 
        ?> 
 
                <?php  
        if ($a['var']['show_neighborhood_docs']) { 
            goto Label_36842; 
        } 
        ?> 
                var parent = $('#variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
 tr[id='<?php  
        echo $sDocumentId; 
        ?> 
']').data('parent')||''; 
 
                if(parent == '') 
                { 
                    var aParents = ['']; 
                    //var aParents = ['','<?php  
        echo $sDocumentId; 
        ?> 
']; 
                }else 
                { 
                    var aParents = parent.split(' '); 
                } 
 
                /*for(i=1;i<aParents.length;i++) 
                            { 
                                $('#variable_table_ tr[data-parent*='' + aParents[i] + '']').hide(); 
                            }*/ 
                $('#variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
 tr:not(.title)').hide(); 
 
                $('#variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
 tr[data-parent=' ' + aParents[1] + '']').show().find('span.minus').removeClass('minus').addClass('plus'); 
 
                for(i=1;i<aParents.length;i++) 
                { 
                    sId = aParents[i].replace('<?php  
        echo $a['var']['name']; 
        ?> 
',''); 
                    $('#variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
 tr:not(.title)').each(function() 
                    { 
                        sLast = $(this).data('parent').split(' ').pop(); 
                        sLast = sLast.replace('<?php  
        echo $a['var']['name']; 
        ?> 
',''); 
                        if(sId == sLast && $(this).css('display') === 'none') 
                        { 
                            $(this).show().find('span.minus').removeClass('minus').addClass('plus'); 
                        } 
                    }); 
                    $('#variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
 tr[id='' + sId + '']').show().find('span.plus').removeClass('plus').addClass('minus'); 
 
                } 
 
                $('#variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
 tr[data-parent='' + parent + ''],#<?php  
        echo $sDocumentId; 
        ?> 
').show().find('span.minus').removeClass('minus').addClass('plus'); 
 
                $('#loadRelatedDocuments<?php  
        echo $a['var']['name']; 
        ?> 
').hide(); 
                $('.load-next_<?php  
        echo $a['var']['name']; 
        ?> 
').hide(); 
                <?php  
        Label_36842: 
        ?> 
            }); 
 
            $(function () { 
                $('#variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
 tr.off-limit').hide(); 
            }); 
 
            /* ]]> */ 
        </script> 
        <style> 
            .load-next_<?php  
        echo $a['var']['name']; 
        ?> 
 { 
                text-align: center; 
                padding: 3px; 
                border: 1px solid #eee; 
                margin-top: 5px; 
                cursor: pointer; 
            } 
            .load-next_<?php  
        echo $a['var']['name']; 
        ?> 
:hover { 
                background-color: #eee; 
            } 
        </style> 
    <?php  
        Label_36843: 
        ?> 
 
        <script> 
 
            var oTable<?php  
        echo $a['var']['name']; 
        ?> 
 = $('#variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
'); 
            <?php  
        if ($a['data_count'] <= $a['limit']) { 
            goto Label_36844; 
        } 
        ?> 
            <?php  
         
        ?> 
            $('#loadRelatedDocuments<?php  
        echo $a['var']['name']; 
        ?> 
').show(); 
            <?php  
         
        ?> 
            $('#total_count_<?php  
        echo $a['var']['name']; 
        ?> 
').html('<?php  
        echo $a['total_count']; 
        ?> 
,'); 
            $('#display_count_<?php  
        echo $a['var']['name']; 
        ?> 
').html('<?php  
        echo $a['display_count']; 
        ?> 
'); 
            $('#on_page_count_<?php  
        echo $a['var']['name']; 
        ?> 
').show(); 
            <?php  
        goto Label_36845; 
        Label_36844: 
        ?> 
            $('#loadRelatedDocuments<?php  
        echo $a['var']['name']; 
        ?> 
').hide(); 
            $('#total_count_<?php  
        echo $a['var']['name']; 
        ?> 
').html('<?php  
        echo $a['total_count']; 
        ?> 
'); 
            $('#display_count_<?php  
        echo $a['var']['name']; 
        ?> 
').html('<?php  
        echo $a['display_count']; 
        ?> 
'); 
            $('#on_page_count_<?php  
        echo $a['var']['name']; 
        ?> 
').hide(); 
            <?php  
        Label_36845: 
        ?> 
 
        </script> 
 
        <?php  
        $s = ob_get_clean(); 
        return $s; 
    } 
    public static function variablecombinedvar($a, $sDoctypeId, $sDocumentId, $isAjaxRequest = false) 
    { 
        $oL = \app\system\Registry::get('locale'); 
        ob_start(); 
        $sHiddenDescription = current(a($a['var'], 'hidden_description', array())); 
        $isHierarchical = false; 
        foreach ($a['var']['fields'] as $aV) { 
            if (!$aV['hierarchical']) { 
                goto Label_36846; 
            } 
            $isHierarchical = true; 
            Label_36846: 
        } 
        $a['var']['hierarchical'] = $isHierarchical; 
        ?> 
 
        <?php  
        if ($isAjaxRequest) { 
            goto Label_36851; 
        } 
        ?> 
        <?php  
        if (!$isHierarchical) { 
            goto Label_36848; 
        } 
        ?> 
        <style type='text/css'>/*     css  */ 
 
            #variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
 span.tree { padding:0 8px 8px 8px; height: 100%;} 
            #variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
 span.tree.line { background: url('/tpl/web/img/themev1/tree_line.gif') repeat-y center center; padding-bottom: 130px; } 
            #variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
 span.tree.gline { background: url('/tpl/web/img/themev1/tree_g_line.gif') no-repeat center top; } 
            #variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
 span.tree.cross { background: url('/tpl/web/img/themev1/tree_cross.gif') no-repeat center top; padding-bottom: 130px; top:6px; } 
            #variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
 span.tree.cross.last { background: url('/tpl/web/img/themev1/tree_cross_last.gif') no-repeat center top;  } 
            #variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
 span.tree.minus { background: url('/tpl/web/img/themev1/tree_minus.gif') no-repeat center top; padding-bottom: 130px; } 
            #variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
 span.tree.plus { background: url('/tpl/web/img/themev1/tree_plus.gif') no-repeat center top; } 
            #variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
 td.content { padding-left: 0 !important; } 
            #variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
 td.content>div { padding-left: 1px !important; overflow: visible; } 
            #variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
 td.tree_grid { padding: 0 !important; border-right: medium none; } 
 
        </style> 
 
        <?php  
        if (!\app\system\Util::isie()) { 
            goto Label_36847; 
        } 
        ?> 
            <style type='text/css'> 
 
                #variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
 span.tree { padding:8px; height: 100%;} 
                #variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
 td.tree_grid{ vertical-align: middle;} 
 
            </style> 
        <?php  
        Label_36847: 
        ?> 
    <?php  
        Label_36848: 
        ?> 
 
    <input type='hidden' id='page_count_<?php  
        echo $a['var']['name']; 
        ?> 
' value='1' /> 
        <table id='variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
' border='0' cellpadding='0' cellspacing='0' class='field_table_view plain CRZ' style='width:100%;'> 
            <?php  
        if (!$isHierarchical) { 
            goto Label_36849; 
        } 
        ?> 
                <col style='width:32px !important;' /> 
                <?php  
        for ($i = 0; $i < $a['var']['lvl_count'] + 1; $i++) { 
            ?> 
                    <col style='width: 16px !important;'/> 
                <?php  
        } 
        foreach ($a['var']['fields'] as $sK1 => $aV1) { 
            ?> 
                    <col style='width:<?php  
            echo $aV1['width']; 
            ?> 
%;'/> 
                    <?php  
            break; 
        } 
        Label_36849: 
        ?> 
            <tr class='title'> 
                <td style='width:10px !important'></td> 
                <?php  
        $iIter = 1; 
        foreach ($a['var']['fields'] as $sK1 => $aV1) { 
            if (!($sHiddenDescription == $sK1)) { 
                goto Label_36850; 
            } 
            continue; 
            Label_36850: 
            ?> 
                    <td <?php  
            echo $isHierarchical && $iIter == 1 ? 'colspan="' . ($a['var']['lvl_count'] + 2) . '"' : ''; 
            ?> 
 style='width:<?php  
            echo $aV1['width']; 
            ?> 
%;'><?php  
            echo v($oL->get($aV1['title'], '\xd0\x94\320\xbe\xd0\xba\321\203\320\xbc\xd0\265\xd0\xbd\321\x82\321\x8b', '\xd0\x9f\xd0\265\321\x80\xd0\xb5\xd0\xbc\xd0\xb5\xd0\275\xd0\xbd\xd1\x8b\320\265 - \320\xbf\320\xbe\xd0\xbb\xd1\217', sprintf('%s-%s-%s-title', $a['doctype_id'], $a['var']['name'], $sK1))); 
            ?> 
</td> 
                    <?php  
            $iIter++; 
        } 
        ?> 
            </tr> 
            <?php  
        Label_36851: 
        ?> 
            <?php  
        self::variablevartabletr($a, $a['data'], $sDocumentId, $a['offset'], $a['limit'], 0); 
        ?> 
            <?php  
        if ($isAjaxRequest) { 
            goto Label_36857; 
        } 
        ?> 
        </table> 
        <?php  
        if (!($a['data_count'] > $a['limit'])) { 
            goto Label_36852; 
        } 
        ?> 
        <div id='loadCombinedDocuments<?php  
        echo $a['var']['name']; 
        ?> 
' class='loadDocuments' onclick='loadCombinedDocuments<?php  
        echo $a['var']['name']; 
        ?> 
('<?php  
        echo $sDoctypeId; 
        ?> 
','<?php  
        echo $sDocumentId; 
        ?> 
','<?php  
        echo $a['var']['name']; 
        ?> 
');return;'><img style='display:none;' src='/tpl/web/img/loading.gif' /><span><?php  
        echo $oL->get('\320\227\xd0\xb0\320\xb3\321\200\xd1\x83\xd0\267\320\270\xd1\202\xd1\214 \320\xb5\xd1\x89\xd0\xb5...'); 
        ?> 
</span></div> 
    <?php  
        Label_36852: 
        ?> 
        <div style='background-color: #fff;' id='documents_count_info_<?php  
        echo $a['var']['name']; 
        ?> 
'> 
            <p style='line-height: 23px;text-shadow: 0 1px 0 #FFFFFF;color:#696969'> 
                <?php  
        echo $oL->get('\320\x92\321\201\xd0\265\320\xb3\320\xbe:'); 
        ?> 
                <span id='total_count_<?php  
        echo $a['var']['name']; 
        ?> 
'><?php  
        echo $a['total_count']; 
        ?> 
,</span> 
                </span> 
                <span id='on_page_count_<?php  
        echo $a['var']['name']; 
        ?> 
'> 
								<?php  
        echo $oL->get('\320\275\320\xb0 \xd1\x81\321\x82\321\200\320\260\xd0\275\xd0\270\xd1\206\320\265'); 
        ?> 
								<span id='display_count_<?php  
        echo $a['var']['name']; 
        ?> 
'><?php  
        echo $a['display_count']; 
        ?> 
</span> 
						</span> 
            </p> 
        </div> 
 
        <script type='text/javascript'> 
            /* <![CDATA[ */ 
 
            function loadCombinedDocuments<?php  
        echo $a['var']['name']; 
        ?> 
(sDoctypeId,sDocumentId,sVariableName){ 
                var oSpinner = $('#loadCombinedDocuments<?php  
        echo $a['var']['name']; 
        ?> 
').find('img'); 
                oSpinner.show(); 
                var iP = $('#page_count_<?php  
        echo $a['var']['name']; 
        ?> 
').val(); 
                var sQs = $('#combined_documents_<?php  
        echo $a['var']['name']; 
        ?> 
').find('.field_keyword').val(); 
                $.get('/workflow/document/combined-document/' + sDoctypeId + '/' + sDocumentId + '/' + sVariableName + '?is_ajax=1&qs='+sQs+'&p='+ iP + '<?php  
        echo isset($_GET['mydocuments']) ? '&mydocuments' : ''; 
        ?> 
',function(sHtml){ 
                    $('#variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
') 
                        .find('tbody') 
                        // .find('#loadDocuments<?php  
        echo $a['var']['name']; 
        ?> 
') 
                        // .remove() 
                        // .end() 
                        .append(sHtml); 
                    $('#loadCombinedDocuments<?php  
        echo $a['var']['name']; 
        ?> 
').addClass('loaded'); 
                    window.<?php  
        echo $a['var']['name']; 
        ?> 
Hook(); 
                    oSpinner.hide(); 
                    $('#page_count_<?php  
        echo $a['var']['name']; 
        ?> 
').val(parseInt(iP)+1); 
                }); 
            } 
 
            function headerToggle<?php  
        echo $a['var']['name']; 
        ?> 
(oHeader) 
            { 
                var oDocCountInfo = oHeader.siblings('#documents_count_info_<?php  
        echo $a['var']['name']; 
        ?> 
'); 
                var oWrap = $('#combined_documents_<?php  
        echo $a['var']['name']; 
        ?> 
'); 
                var oInnerWrap = oWrap.children('.inner_wrap'); 
                if (oWrap.hasClass('collapsed')) 
                { 
                    oWrap.removeClass('collapsed').addClass('expanded'); 
                    oInnerWrap.slideDown(200); 
                    oDocCountInfo.show(); 
                } 
                else 
                { 
                    oWrap.removeClass('expanded').addClass('collapsed'); 
                    oInnerWrap.slideUp(200); 
                    oDocCountInfo.hide(); 
                } 
            } 
            var delay = (function() { 
                var timer = 0; 
                return function(callback, ms) { 
                    clearTimeout(timer); 
                    timer = setTimeout(callback, ms); 
                }; 
            })(); 
            var ajaxQSRequest; 
            $(document).ready(function() { 
                //var oFT = new MSF_FieldTable('#variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
',null); 
                var oWrap = $('#combined_documents_<?php  
        echo $a['var']['name']; 
        ?> 
'); 
                oWrap.children('h3').unbind('click').bind('click',function() 
                { 
                    headerToggle<?php  
        echo $a['var']['name']; 
        ?> 
($(this)); 
                }); 
                var oInnerWrap = oWrap.children('.inner_wrap'); 
                oWrap.find('#search_bar').find('.export_button').click(function() 
                { 
                    oWrap.children('h3').unbind('click'); 
                }).mouseout(function(){ 
                    oWrap.children('h3').unbind('click').bind('click',function(){ 
                        headerToggle<?php  
        echo $a['var']['name']; 
        ?> 
($(this)); 
                    }); 
                }); 
 
                oWrap.find('#search_bar').find('.field_keyword').focus(function() 
                { 
                    oWrap.children('h3').unbind('click'); 
                }) 
                    .blur(function() 
                    { 
                        oWrap.children('h3').unbind('click').bind('click',function() 
                        { 
                            headerToggle<?php  
        echo $a['var']['name']; 
        ?> 
($(this)); 
                        }); 
                    }).keyup(function () { 
                    // canceling previous ajax request 
                    if (typeof ajaxQSRequest === 'object') { 
                        ajaxQSRequest.abort(); 
                    } 
 
                    var sQs = $(this).val(); 
 
                    delay(function () { 
                        if (sQs.length < 3 && sQs.length > 0) { return; } 
 
                        var oThinking = $('#thinking'); 
                        oThinking.show(); 
 
                        var oTable<?php  
        echo $a['var']['name']; 
        ?> 
 = $('#variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
'); 
 
                        $('#page_count_<?php  
        echo $a['var']['name']; 
        ?> 
').val('1'); 
 
                        ajaxQSRequest = $.get( 
                            '/workflow/document/combined-document/<?php  
        echo $sDoctypeId; 
        ?> 
/<?php  
        echo $sDocumentId; 
        ?> 
/<?php  
        echo $a['var']['name']; 
        ?> 
?qs=' + sQs + '&p=0<?php  
        echo isset($_GET['mydocuments']) ? '&mydocuments' : ''; 
        ?> 
', 
                            function (sHtml) { 
                                var oParent = oTable<?php  
        echo $a['var']['name']; 
        ?> 
.parent(); 
                                oParent.empty().append(sHtml); 
                                window.<?php  
        echo $a['var']['name']; 
        ?> 
Hook(); 
                                oThinking.hide(); 
                            } 
                        ); 
                    }, 500); // <-keyUp TimeOut 
                }); 
                <?php  
        $sGridClass = '.grid_three_line'; 
        if (!($a['var']['grid_view_type'] == 2)) { 
            goto Label_36853; 
        } 
        $sGridClass = '.grid_two_line'; 
        Label_36853: 
        ?> 
                <?php  
        if (!($a['var']['grid_view_type'] == 2 || $a['var']['grid_view_type'] == 3)) { 
            goto Label_36854; 
        } 
        ?> 
                //$('#related_documents_<?php  
        echo $a['var']['name']; 
        ?> 
').children('.inner_wrap').show(); 
                $('#variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
').find('tr').each(function(){ 
                    var oCurrentTr = $(this); 
                    var hasSingleLine = true; 
                    var oCurrentTd; 
                    oCurrentTr.find('td').each(function(){ 
                        oCurrentTd = $(this); 
 
                        oCurrentTd.find('.content').each(function(){ 
                            //console.log($(this).width()); 
                            if($(this).height() > 20) 
                            { 
                                hasSingleLine = false; 
                            } 
                        }); 
                    }); 
 
                    if(hasSingleLine) 
                    { 
                        // oCurrentTr.find('td').find('.content').addClass('normalize_single_line'); 
                    } 
                }); 
                //$('#related_documents_<?php  
        echo $a['var']['name']; 
        ?> 
').children('.inner_wrap').hide(); 
                <?php  
        Label_36854: 
        ?> 
                $('td.cell_with_canvas').children('div').not('.hasHierarchial').children('.content').each(function(){ 
                    //$(this).css('width','110%'); 
                }); 
                <?php  
        if (!($a['var']['grid_view_type'] == 2)) { 
            goto Label_36855; 
        } 
        ?> 
 
                <?php  
        Label_36855: 
        ?> 
 
                <?php  
        if ($a['var']['show_neighborhood_docs']) { 
            goto Label_36856; 
        } 
        ?> 
                var parent = $('#variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
 tr[id='<?php  
        echo $sDocumentId; 
        ?> 
']').data('parent')||''; 
 
                if(parent == '') 
                { 
                    var aParents = ['']; 
                    //var aParents = ['','<?php  
        echo $sDocumentId; 
        ?> 
']; 
                }else 
                { 
                    var aParents = parent.split(' '); 
                } 
 
                /*for(i=1;i<aParents.length;i++) 
                            { 
                                $('#variable_table_ tr[data-parent*='' + aParents[i] + '']').hide(); 
                            }*/ 
                $('#variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
 tr:not(.title)').hide(); 
 
                $('#variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
 tr[data-parent=' ' + aParents[1] + '']').show().find('span.minus').removeClass('minus').addClass('plus'); 
 
                for(i=1;i<aParents.length;i++) 
                { 
                    sId = aParents[i].replace('<?php  
        echo $a['var']['name']; 
        ?> 
',''); 
                    $('#variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
 tr:not(.title)').each(function() 
                    { 
                        sLast = $(this).data('parent').split(' ').pop(); 
                        sLast = sLast.replace('<?php  
        echo $a['var']['name']; 
        ?> 
',''); 
                        if(sId == sLast && $(this).css('display') === 'none') 
                        { 
                            $(this).show().find('span.minus').removeClass('minus').addClass('plus'); 
                        } 
                    }); 
                    $('#variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
 tr[id='' + sId + '']').show().find('span.plus').removeClass('plus').addClass('minus'); 
 
                } 
 
                $('#variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
 tr[data-parent='' + parent + ''],#<?php  
        echo $sDocumentId; 
        ?> 
').show().find('span.minus').removeClass('minus').addClass('plus'); 
 
                $('#loadCombinedDocuments<?php  
        echo $a['var']['name']; 
        ?> 
').hide(); 
                <?php  
        Label_36856: 
        ?> 
            }); 
 
            /* ]]> */ 
        </script> 
    <?php  
        Label_36857: 
        ?> 
 
        <script> 
 
            var oTable<?php  
        echo $a['var']['name']; 
        ?> 
 = $('#variable_table_<?php  
        echo $a['var']['name']; 
        ?> 
'); 
            <?php  
        if ($a['data_count'] <= $a['limit']) { 
            goto Label_36859; 
        } 
        ?> 
            <?php  
        if (!$a['var']['show_neighborhood_docs']) { 
            goto Label_36858; 
        } 
        ?> 
            $('#loadCombinedDocuments<?php  
        echo $a['var']['name']; 
        ?> 
').show(); 
            <?php  
        Label_36858: 
        ?> 
            $('#total_count_<?php  
        echo $a['var']['name']; 
        ?> 
').html('<?php  
        echo $a['total_count']; 
        ?> 
,'); 
            $('#display_count_<?php  
        echo $a['var']['name']; 
        ?> 
').html('<?php  
        echo $a['display_count']; 
        ?> 
'); 
            $('#on_page_count_<?php  
        echo $a['var']['name']; 
        ?> 
').show(); 
            <?php  
        goto Label_36860; 
        Label_36859: 
        ?> 
            $('#loadCombinedDocuments<?php  
        echo $a['var']['name']; 
        ?> 
').hide(); 
            $('#total_count_<?php  
        echo $a['var']['name']; 
        ?> 
').html('<?php  
        echo $a['total_count']; 
        ?> 
'); 
            $('#display_count_<?php  
        echo $a['var']['name']; 
        ?> 
').html('<?php  
        echo $a['display_count']; 
        ?> 
'); 
            $('#on_page_count_<?php  
        echo $a['var']['name']; 
        ?> 
').hide(); 
            <?php  
        Label_36860: 
        ?> 
 
        </script> 
 
        <?php  
        $s = ob_get_clean(); 
        return $s; 
    } 
    public static function timesheetvaredit($aData, $sDoctypeId, $sDocumentId, $mode = 'create') 
    { 
        $oL = \app\system\Registry::get('locale'); 
        ob_start(); 
        ?> 
        <script type='text/javascript'> 
 
            function isValid(obj) 
            { 
                for (var prop in obj) 
                { 
                    if(!$('[name*=''+obj[prop]+'']').length) 
                    { 
                        ShowErrorMessage('<?php  
        echo $oL->get('\320\x9f\xd1\x80\320\276\xd0\xb2\320\265\321\200\321\x8c\xd1\202\320\265 \xd0\275\320\260\xd0\xbb\320\270\321\207\320\270\320\265 \320\xb2\321\x81\320\265\xd1\x85 \xd0\xbf\xd0\276\320\273\xd0\xb5\320\271 \321\x88\320\xb0\xd0\261\xd0\273\xd0\276\xd0\xbd\320\xb5 \xd0\264\320\xbe\xd0\xba\321\x83\xd0\xbc\xd0\xb5\xd0\xbd\xd1\x82\xd0\xb0'); 
        ?> 
'); 
                        return  false; 
                    } 
                } 
 
                return true; 
            } 
 
            function ShowErrorMessage(t) 
            { 
                MSF_StatusBar.hideWait(); 
                $('#results').show().children('#error').append('<div class='status_error' id='statusErrorItem_0'>'+t+'<br /></div>').show(); 
                setTimeout(function() { 
                    $('#statusErrorItem_0').hide(); 
                    $('#statusErrorItem_0').remove(); 
                    if($('#error').html().trim() == '') { 
                        $('#error').hide(); 
                    } 
                }, 5000); 
            }; 
 
            $(document).ready(function(){ 
 
                var oConfig =  { //  
                    'subdivision': '<?php  
        echo $aData['var']['subdivision']; 
        ?> 
', 
                    'year': '<?php  
        echo $aData['var']['year']; 
        ?> 
', 
                    'month': '<?php  
        echo $aData['var']['month']; 
        ?> 
' 
                }; 
                var summaryConfig = {'8':'actual_work', 
                    '8':'off_travel', 
                    'A':'permision_fail', 
                    '':'disability', 
                    '':'truancy', 
                    '/':'holiday_without_wages', 
                    '':'next_holiday', 
                    '':'temporary_stay', 
                    '8':'wokr_in_holydays', 
                    '':'study_holiday', 
                    '':'weekends'}; 
                var tableExists = false; 
                /* */ 
                $('#bGenerate<?php  
        echo $aData['varType']; 
        ?> 
').click(function() 
                { 
                    if(!isValid(oConfig)) 
                        return; 
 
                    if(tableExists) 
                    { 
                        if (!confirm('<?php  
        echo $oL->get('\xd0\222\xd1\213 \321\x83\xd0\xb2\xd0\265\321\200\xd0\xb5\320\xbd\321\x8b, \xd1\207\321\202\320\xbe \321\x85\320\276\321\x82\320\270\321\x82\320\265 \xd1\x81\320\276\320\267\xd0\xb4\320\xb0\321\202\xd1\214 \xd0\xbd\320\276\320\xb2\xd1\203\xd1\216 \321\x82\xd0\xb0\320\261\320\273\xd0\xb8\321\x86\xd1\203, \xd1\203\xd0\xb4\320\260\xd0\xbb\320\270\320\262 \xd1\201\xd1\202\320\260\xd1\200\xd1\203\xd1\x8e?'); 
        ?> 
')) 
                        { 
                            return; 
                        } 
                    } 
 
                    request = $.ajax( 
                        { 
                            type:		'POST', 
                            url:		'/workflow/document/<?php  
        echo str_replace('_', '-', $aData['varType']); 
        ?> 
/<?php  
        echo $sDoctypeId; 
        ?> 
/<?php  
        echo $sDocumentId; 
        ?> 
/<?php  
        echo $aData['var']['name']; 
        ?> 
', 
                            data:		$('#createRowForm').serialize(), 
                            dataType: 'json', 
                            success: function(oData) 
                            { 
                                if(array_key_exists('error', oData)) 
                                { 
                                    ShowErrorMessage(oData.error); 
                                } 
                                else 
                                { 
                                    $('#timesheet-table<?php  
        echo $aData['varType']; 
        ?> 
').html(oData.html); 
                                    calcAllSummary(); 
 
                                } 
                            }, 
                            error:function(data) 
                            { 
                                ShowErrorMessage('<?php  
        echo $oL->get('\xd0\237\xd1\x80\xd0\276\320\270\320\267\xd0\xbe\321\x88\320\xbb\320\xb0 \xd0\276\321\210\xd0\270\320\xb1\xd0\xba\320\260 \320\262\320\xbe \xd0\262\xd1\200\xd0\265\xd0\274\321\217 \320\xb7\xd0\xb0\320\277\xd1\x80\xd0\xbe\321\x81\xd0\xb0.'); 
        ?> 
'); 
                            } 
                        }); 
 
                }); 
 
                //         
                $('.variable_timesheet select[name*='[posts]']').live('change', function() 
                { 
                    var currentPostId = $(this).parent().parent().parent().attr('id'); 
                    calcSummary(currentPostId); 
                    if($(this).val().length > 1){ 
                        $(this).siblings('.timesheet_day_value').css('padding-left', '-5px'); 
                        $(this).siblings('.timesheet_day_value').css('font-size', '8px'); 
                    } else { 
                        $(this).siblings('.timesheet_day_value').css('padding-left', '0'); 
                        $(this).siblings('.timesheet_day_value').css('font-size', '9pt'); 
                    } 
                    $(this).siblings('.timesheet_day_value').text($(this).val()); 
                }); 
 
                /** 
                 *         
                 * 
                 * @param {type} sName 
                 * @returns {undefined} 
                 */ 
                function calcSummary(sName) 
                { 
                    var qtyBuffer = []; 
                    var qty = 0; 
                    var currentVal; 
 
                    //       
                    $.each(summaryConfig, function(dayType, dayDesc) 
                    { 
                        qtyBuffer[dayType] = 0; 
                    }); 
 
                    //      
                    $('.variable_timesheet [name*='[posts]['+sName+'']').each(function(i, select) 
                    { 
                        currentVal = $(select).children('option:selected').val(); 
                        qtyBuffer[currentVal] = qtyBuffer[currentVal] + 1; 
                    }); 
 
 
                    //    
                    for(var dayType in qtyBuffer) 
                    { 
                        qty = qtyBuffer[dayType]; 
 
                        $('.variable_timesheet [input[name*='[posts]['+sName+']['+summaryConfig[dayType]+'']').val(qty); 
                        $('.variable_timesheet [name*='[posts]['+sName+']['+summaryConfig[dayType]+'']').parent().children('span').text(qty); 
 
                    }; 
                } 
 
                /* 
                     *       () 
                     * @param {type} obj 
                     * @returns 
                     */ 
                function calcAllSummary() 
                { 
 
                    $('#timesheet-table<?php  
        echo $aData['varType']; 
        ?> 
').children('table').children('tbody').children('tr').each(function(i, tr) 
                    { 
                        var trName = $(tr).attr('id'); 
                        if(trName!=''&&trName!=undefined) 
                            calcSummary(trName); 
                    }); 
                } 
                //    ,   . 
                if($('input[name*='actual_work']').length>0) 
                { 
                    tableExists = true; 
                } 
 
                if(tableExists) 
                { 
                    calcAllSummary(); 
                } 
            }); 
        </script> 
        <div class='variable variable_timesheet'> 
            <input id='bGenerate<?php  
        echo $aData['varType']; 
        ?> 
' type='button' value='<?php  
        echo $oL->get('\320\241\xd0\xb3\xd0\265\320\xbd\xd0\265\321\x80\xd0\270\321\200\xd0\xbe\320\xb2\xd0\xb0\321\x82\xd1\214'); 
        ?> 
' class='btn btn-sm btn-raised btn-default' /> 
            <div id='timesheet-table<?php  
        echo $aData['varType']; 
        ?> 
' style='padding-top: 5px;'> 
                <?php  
        if (!($mode == 'edit')) { 
            goto Label_36861; 
        } 
        ?> 
                    <?php  
        echo \app\workflow\WFW::timesheetvartable($aData); 
        ?> 
                <?php  
        Label_36861: 
        ?> 
            </div> 
            <!--[if IE]> 
            <style type='text/css'> 
                .rotated_cell 
                { 
                    text-align: left; 
                    padding-bottom: 10px; 
                } 
 
                .rotate_text 
                { 
                    -ms-writing-mode: bt-rl; 
                    filter: flipH() flipV(); 
                    top: 0px; 
                } 
            </style> 
            <![endif]--> 
        </div> 
        <?php  
        $s = ob_get_clean(); 
        return $s; 
    } 
    public static function timesheetvartable($aData) 
    { 
        $oL = \app\system\Registry::get('locale'); 
        $npp = 1; 
        $isWholeTimesheet = false; 
        $disabled = ''; 
        if (!$isWholeTimesheet) { 
            goto Label_36862; 
        } 
        $disabled = 'disabled = "disabled"'; 
        Label_36862: 
        $html = '<input type="hidden" name="' . $aData['varName'] . '[daysInMonth]" value="' . $aData['daysInMonth'] . '"/>' . '<input type="hidden" name="' . $aData['varName'] . '[month]" value="' . $aData['month'] . '"/>' . '<input type="hidden" name="' . $aData['varName'] . '[year]" value="' . $aData['year'] . '"/>' . '
            <table border="1" cellpadding="0" cellspacing="0" class="variable_table" >\xa            <tbody>\xa            <tr class="title">\xa            <td rowspan="2" style="text-align: center; width: 20px;">' . $oL->get('\342\204\x96 \xd0\277/\320\277') . '</td>\xa            <td rowspan="2" style="text-align: center; width: 150px;">' . $oL->get('\xd0\244\320\x98\xd0\x9e') . '</td>
            <td rowspan="2" style="text-align: center; width: 150px;">' . $oL->get('\320\224\320\276\320\xbb\320\266\320\275\320\xbe\321\201\321\x82\xd1\214') . '</td>
            <td colspan="' . $aData['daysInMonth'] . '">' . $oL->get('\xd0\247\320\xb8\321\x81\320\xbb\xd0\260 \xd0\274\xd0\265\xd1\x81\xd1\217\xd1\206\xd0\xb0') . '</td>
            <td>' . $oL->get('8') . '</td>\xa            <td width="20">' . $oL->get('8\320\x9a') . '</td>\xa            <td>' . $oL->get('A') . '</td>\xa            <td>' . $oL->get('\xd0\221') . '</td>\xa            <td>' . $oL->get('\xd0\235') . '</td>
            <td width="20">' . $oL->get('\xd0\221/\xd0\xa1') . '</td>
            <td>' . $oL->get('\xd0\236') . '</td>
            <td width="20">' . $oL->get('\xd0\x92\320\237') . '</td>
            <td width="20">' . $oL->get('8\320\x92') . '</td>\xa            <td width="20">' . $oL->get('\320\236\320\x9e') . '</td>\xa            <td>' . $oL->get('\320\222') . '</td>\xa            </tr>
            <tr class="title">'; 
        for ($day = 1; $day <= $aData['daysInMonth']; $day++) { 
            $className = \app\workflow\util\Util::isweekenddate($day, $aData['month'], $aData['year']) ? 'weekend' : 'ordinary'; 
            $html .= '<td class="' . $className . '">' . $day . '</td>'; 
        } 
        $html .= '<td class="rotated_cell" ><div class="rotate_text">' . $oL->get('\320\224\xd0\275\320\270 \xd1\x8f\xd0\xb2\320\276\xd0\xba') . '</td>
            <td class="rotated_cell" ><div class="rotate_text">' . $oL->get('\320\232\320\xbe\320\274\320\xb0\320\275\xd0\264\320\xb8\xd1\x80\320\276\xd0\xb2\xd0\xba\xd0\260') . '</td>
            <td class="rotated_cell" ><div class="rotate_text">' . $oL->get('\320\235\320\265\xd1\x8f\xd0\262\320\xba\320\260 \321\x81 \xd1\x80\320\260\xd0\xb7\xd1\x80\320\xb5\xd1\210\xd0\265\xd0\275\320\xb8\321\217 \xd0\x90\xd0\264\320\xbc\320\270\xd0\275\xd0\xb8\321\x81\321\x82\321\200\xd0\260\321\x86\xd0\270\xd0\270') . '</td>
            <td class="rotated_cell" ><div class="rotate_text">' . $oL->get('\320\235\xd0\xb5\321\x82\321\200\xd1\x83\320\xb4\xd0\276\321\x81\320\277\xd0\276\xd1\x81\320\276\320\261\320\275\xd0\xbe\xd1\201\xd1\x82\321\x8c') . '</td>\xa            <td class="rotated_cell" ><div class="rotate_text">' . $oL->get('\xd0\237\xd0\240\xd0\236\xd0\223\xd0\xa3\xd0\233') . '</td>
            <td class="rotated_cell" ><div class="rotate_text">' . $oL->get('\xd0\x9e\321\x82\320\xbf\321\x83\321\201\320\272 \xd0\261\xd0\265\xd0\xb7 \321\x81\xd0\276\xd1\x85\321\200\320\xb0\xd0\xbd\320\xb5\320\xbd\320\270\321\x8f \xd0\267/\320\xbf\xd0\xbb\320\xb0\xd1\202\xd1\213') . '</td>
            <td class="rotated_cell" ><div class="rotate_text">' . $oL->get('\320\236\xd1\x87\xd0\265\xd1\200\xd0\265\320\xb4\xd0\275\320\276\xd0\xb9 \xd1\202\321\200\321\x83\xd0\xb4\320\276\xd0\262\xd0\276\xd0\271 \xd0\276\321\202\320\277\321\203\321\x81\xd0\272') . '</td>
            <td class="rotated_cell" ><div class="rotate_text">' . $oL->get('\xd0\x92\321\x80\320\265\320\274\320\265\320\xbd\xd0\275\321\x8b\xd0\271 \xd0\xbf\321\200\xd0\xbe\xd1\201\xd1\x82\xd0\276\xd0\xb9') . '</td>
            <td class="rotated_cell" ><div class="rotate_text">' . $oL->get('\320\xa0\320\260\xd0\261\xd0\xbe\xd1\202\xd0\xb0 \320\xb2 \xd0\262\xd1\x8b\321\205\xd0\xbe\xd0\xb4\320\xbd\321\x8b\320\xb5 \320\xb4\xd0\275\xd0\xb8') . '</td>\xa            <td class="rotated_cell" ><div class="rotate_text">' . $oL->get('\320\x9e\xd1\x82\320\277\xd1\x83\321\201\xd0\272 \320\277\320\xbe \xd0\xbe\320\xb1\321\x83\321\207\xd0\265\xd0\275\320\xb8\xd1\216') . '</td>\xa            <td class="rotated_cell" ><div class="rotate_text">' . $oL->get('\xd0\x92\xd1\x8b\321\205\320\xbe\320\xb4\320\xbd\xd1\213\xd0\265 \xd0\270 \320\xbf\xd1\x80\xd0\xb0\xd0\267\320\264\320\xbd\320\270\321\207\xd0\xbd\xd1\213\xd0\xb5 \xd0\xb4\320\275\xd0\270') . '</td>
            </tr>'; 
        $selected = 'selected="selected"'; 
        foreach ($aData['structure'] as $sdvId => $sdv) { 
            $sdvTemp = $aData['varName'] . '[structure][' . $sdvId . ']'; 
            $html .= '<tr class="subtitle"><td colspan="' . ($aData['daysInMonth'] + 14) . '">&nbsp; ' . $sdv['name'] . '<input type="hidden" name="' . $sdvTemp . '[name]" value="' . $sdv['name'] . '"></td></tr>'; 
            foreach ($sdv['posts'] as $postId => $post) { 
                $html .= '<tr id="' . $postId . '">'; 
                $html .= '<td>' . '<input type="hidden" name="' . $sdvTemp . '[posts][' . $postId . '][employee]" value="' . $post['employee'] . '"/>' . '<input type="hidden" name="' . $sdvTemp . '[posts][' . $postId . '][post]" value="' . $post['post'] . '"/>' . $npp . '</td><td class="align_left">' . $post['employee'] . '</td>' . '<td class="align_left">' . $post['post'] . '</td>'; 
                for ($day = 1; $day <= $aData['daysInMonth']; $day++) { 
                    $isWeekend = \app\workflow\util\Util::isweekenddate($day, $aData['month'], $aData['year']); 
                    $className = $isWeekend ? 'weekend' : 'ordinary'; 
                    $sName = $sdvTemp . '[posts][' . $postId . '][' . $day . ']'; 
                    $sSelectedValue = a($post, $day, $isWeekend ? '\xd0\222' : '8'); 
                    if (mb_strlen($sSelectedValue) > 1) { 
                        goto Label_36863; 
                    } 
                    $html .= '<td class="' . $className . '"><div class="timesheet_day"><span class="timesheet_day_value">' . $sSelectedValue . '</span><select name="' . $sName . '" ' . $disabled . 'class="abbr" >'; 
                    goto Label_36864; 
                    Label_36863: 
                    $html .= '<td class="' . $className . '"><div class="timesheet_day"><span style="padding-left: -5px; font-size:8px;" class="timesheet_day_value">' . $sSelectedValue . '</span><select name="' . $sName . '" ' . $disabled . 'class="abbr" >'; 
                    Label_36864: 
                    foreach ($aData['dayTypesOptions'] as $key => $value) { 
                        $html .= '<option  value="' . $key . '" ' . ($key == $sSelectedValue ? 'selected="selected"' : '') . '>' . $value . '</option>'; 
                    } 
                    $html .= '</select>'; 
                    if (!$isWholeTimesheet) { 
                        goto Label_36865; 
                    } 
                    $html .= '<input type="hidden" name="' . $sName . '" value="' . $post[$day] . '"/>'; 
                    Label_36865: 
                    $html .= '</div></td>'; 
                } 
                $npp++; 
                $SummaryName = $sdvTemp . '[posts][' . $postId . ']'; 
                $html .= '<td><div id="actual_work"><span></span><input name="' . $SummaryName . '[actual_work]" type="hidden" value=""/></div></td>
                            <td><div id="off_travel"><span></span><input name="' . $SummaryName . '[off_travel]" type="hidden" value=""/></div></td>
                            <td><div id="permision_fail"><span></span><input name="' . $SummaryName . '[permision_fail]" type="hidden" value=""/></div></td>
                            <td><div id="disability"><span></span><input name="' . $SummaryName . '[disability]" type="hidden" value=""/></div></td>
                            <td><div id="truancy"><span></span><input name="' . $SummaryName . '[truancy]" type="hidden" value=""/></div></td>\xa                            <td><div id="holiday_without_wages"><span></span><input name="' . $SummaryName . '[holiday_without_wages]" type="hidden" value=""/></div></td>\xa                            <td><div id="next_holiday"><span></span><input name="' . $SummaryName . '[next_holiday]" type="hidden" value=""/></div></td>\xa                            <td><div id="temporary_stay"><span></span><input name="' . $SummaryName . '[temporary_stay]" type="hidden" value=""/></div></td>\xa                            <td><div id="wokr_in_holydays"><span></span><input name="' . $SummaryName . '[wokr_in_holydays]" type="hidden" value=""/></div></td>
                            <td><div id="study_holiday"><span></span><input name="' . $SummaryName . '[study_holiday]" type="hidden" value=""/></div></td>
                            <td><div id="weekends"><span></span><input name="' . $SummaryName . '[weekends]" type="hidden" value=""/></div></td>
                            </tr>'; 
             
            } 
        } 
        $html .= '</tbody>
                 </table>'; 
        return $html; 
    } 
    public static function timesheetvarview($aData, $sDoctypeId, $sDocumentId) 
    { 
        $oL = \app\system\Registry::get('locale'); 
        ob_start(); 
        ?> 
        <?php  
        if (!isset($aData['structure'])) { 
            goto Label_36866; 
        } 
        ?> 
        <div class='variable variable_timesheet'> 
            <input type='button' value='<?php  
        echo $oL->get('\320\xad\xd0\272\xd1\x81\320\277\xd0\276\321\x80\321\x82 \xd0\xb2 Excel'); 
        ?> 
' onclick='msf.page.go('/workflow/document/export-variable/<?php  
        echo $sDoctypeId; 
        ?> 
/<?php  
        echo $sDocumentId; 
        ?> 
/<?php  
        echo $aData['varName']; 
        ?> 
');' /> 
            <div id='timesheet-table<?php  
        echo $aData['varType']; 
        ?> 
' style='padding-top: 5px;'> 
                <?php  
        echo \app\workflow\WFW::timesheetvartableview($aData); 
        ?> 
            </div> 
            <!--[if IE]> 
            <style type='text/css'> 
                .rotated_cell 
                { 
                    text-align: left; 
                    padding-bottom: 10px; 
                } 
 
                .rotate_text 
                { 
                    -ms-writing-mode: bt-rl; 
                    filter: flipH() flipV(); 
                    top: 0px; 
                } 
            </style> 
            <![endif]--> 
        </div> 
    <?php  
        Label_36866: 
        ?> 
        <?php  
        $s = ob_get_clean(); 
        return $s; 
    } 
    public static function timesheetvar2edit($aData, $sDoctypeId, $sDocumentId, $mode = 'create') 
    { 
        $oL = \app\system\Registry::get('locale'); 
        ob_start(); 
        ?> 
        <script type='text/javascript'> 
 
            function isValid(obj) 
            { 
                for (var prop in obj) 
                { 
                    if(!$('[name*=''+obj[prop]+'']').length) 
                    { 
                        ShowErrorMessage('<?php  
        echo $oL->get('\320\x9f\xd1\200\320\276\320\262\320\xb5\xd1\200\xd1\x8c\321\x82\xd0\265 \xd0\275\320\260\xd0\273\320\270\321\x87\xd0\xb8\xd0\xb5 \320\262\321\x81\320\265\321\205 \320\xbf\320\276\320\273\320\xb5\320\xb9 \321\210\xd0\xb0\320\xb1\320\273\320\xbe\xd0\xbd\320\xb5 \320\264\320\276\xd0\xba\321\x83\320\274\xd0\265\320\xbd\xd1\202\xd0\260'); 
        ?> 
'); 
                        return  false; 
                    } 
                } 
 
                return true; 
            } 
 
            function ShowErrorMessage(t) 
            { 
                MSF_StatusBar.hideWait(); 
                $('#results').show().children('#error').append('<div class='status_error' id='statusErrorItem_0'>'+t+'<br /></div>').show(); 
                setTimeout(function() { 
                    $('#statusErrorItem_0').hide(); 
                    $('#statusErrorItem_0').remove(); 
                    if($('#error').html().trim() == '') { 
                        $('#error').hide(); 
                    } 
                }, 5000); 
            }; 
 
            $(document).ready(function(){ 
                var varType = '<?php  
        echo $aData['varType']; 
        ?> 
'; 
                if(varType == 'whole_timesheet2'){ 
                    var oConfig =  { //  
                        'year': '<?php  
        echo $aData['var']['year']; 
        ?> 
', 
                        'month': '<?php  
        echo $aData['var']['month']; 
        ?> 
', 
                    }; 
                } else { 
                    var oConfig =  { //  
                        'subdivision': '<?php  
        echo $aData['var']['subdivision']; 
        ?> 
', 
                        'year': '<?php  
        echo $aData['var']['year']; 
        ?> 
', 
                        'month': '<?php  
        echo $aData['var']['month']; 
        ?> 
', 
                    }; 
                } 
                var oDates =  { //  
                    'year': '<?php  
        echo isset($aData['year']) ? $aData['year'] : ''; 
        ?> 
', 
                    'month': '<?php  
        echo isset($aData['month']) ? $aData['month'] : ''; 
        ?> 
', 
                    'monthEnd': '<?php  
        echo isset($aData['daysInMonth']) ? $aData['daysInMonth'] : ''; 
        ?> 
', 
                }; 
 
                var summaryConfig = $.parseJSON('<?php  
        echo addslashes(\app\system\Json::encode($aData['var']['doctypeByTag'])); 
        ?> 
'); 
                var colorByTag = $.parseJSON('<?php  
        echo addslashes(\app\system\Json::encode($aData['colorByTag'])); 
        ?> 
'); 
                var tableExists = false; 
                /* */ 
                $('#bGenerate<?php  
        echo $aData['varType']; 
        ?> 
').click(function() 
                { 
                    if(!isValid(oConfig)) 
                        return; 
 
                    if(tableExists) 
                    { 
                        if (!confirm('<?php  
        echo $oL->get('\xd0\222\xd1\x8b \xd1\x83\xd0\262\xd0\265\xd1\x80\320\265\xd0\275\321\x8b, \321\207\xd1\202\320\276 \xd1\x85\320\xbe\321\x82\xd0\xb8\xd1\202\xd0\265 \xd1\201\320\xbe\320\xb7\320\264\320\260\321\202\321\214 \320\275\xd0\xbe\320\xb2\321\203\321\216 \321\x82\xd0\260\320\261\320\xbb\xd0\270\xd1\206\xd1\203, \321\203\xd0\xb4\320\xb0\320\273\xd0\xb8\xd0\xb2 \321\x81\xd1\202\xd0\xb0\321\x80\xd1\203\xd1\x8e?'); 
        ?> 
')) 
                        { 
                            return; 
                        } 
                    } 
 
                    request = $.ajax( 
                        { 
                            type:		'POST', 
                            url:		'/workflow/document/<?php  
        echo str_replace('_', '-', $aData['varType']); 
        ?> 
/<?php  
        echo $sDoctypeId; 
        ?> 
/<?php  
        echo $sDocumentId; 
        ?> 
/<?php  
        echo $aData['var']['name']; 
        ?> 
', 
                            data:		$('#createRowForm').serialize(), 
                            dataType: 'json', 
                            success: function(oData) 
                            { 
                                if(array_key_exists('error', oData)) 
                                { 
                                    ShowErrorMessage(oData.error); 
                                } 
                                else 
                                { 
                                    $('#timesheet-table<?php  
        echo $aData['varType']; 
        ?> 
').html(oData.html); 
                                    calcAllSummary(); 
                                    mergeTd(); 
                                } 
                            }, 
                            error:function(data) 
                            { 
                                ShowErrorMessage('<?php  
        echo $oL->get('\320\237\321\200\xd0\xbe\320\270\320\267\xd0\276\xd1\210\xd0\xbb\320\xb0 \xd0\276\xd1\210\320\xb8\xd0\xb1\xd0\xba\xd0\260 \xd0\xb2\320\276 \xd0\xb2\xd1\200\xd0\xb5\xd0\274\321\x8f \320\267\320\260\320\277\321\x80\xd0\276\xd1\x81\320\xb0.'); 
        ?> 
'); 
                            } 
                        }); 
 
                }); 
 
                //         
                $('.variable_timesheet select[name*='[posts]']').live('change', function() 
                { 
 
                    var currentPostId = $(this).parent().parent().parent().attr('id'); 
                    var currentSdvId = $(this).parent().parent().parent().attr('sdvid'); 
                    var td = $(this).parent().parent(); 
                    var div = $(this).parent(); 
                    $('[name=''+$(this).attr('name')+'[edited]']').remove(); 
                    calcSummary(currentPostId, currentSdvId); 
                    div.append('<input type='hidden' name=''+$(this).attr('name')+'[edited]' value=''+$(this).val()+''/>'); 
                    if($(this).val().length > 1){ 
                        $(this).siblings('.timesheet_day_value').css('padding-left', '-5px'); 
                        $(this).siblings('.timesheet_day_value').css('font-size', '8px'); 
                    } else { 
                        $(this).siblings('.timesheet_day_value').css('padding-left', '0'); 
                        $(this).siblings('.timesheet_day_value').css('font-size', '9pt'); 
                    } 
                    td.removeClass(); 
                    td.addClass(colorByTag[$(this).val()]); 
                    $(this).siblings('.timesheet_day_value').text($(this).val()); 
                }); 
 
                /** 
                 *         
                 * 
                 * @param {type} sName 
                 * @returns {undefined} 
                 */ 
                function calcSummary(sName, sSdvId) 
                { 
                    var qtyBuffer = []; 
                    var qty = 0; 
                    var currentVal; 
 
                    //       
                    $.each(summaryConfig, function(dayType, dayDesc) 
                    { 
                        qtyBuffer[dayType] = 0; 
                    }); 
 
                    //      
                    $('.variable_timesheet [name*='['+sSdvId+'][posts]['+sName+'']').each(function(i, select) 
                    { 
                        currentVal = $(select).children('option:selected').val(); 
                        if(currentVal == ''){ 
                            var regexp = /[\[]([^\[]+)\]$/g; 
                            var match = regexp.exec($(select).attr('name')); 
                            var flag = true; 
                            //console.log(match[1]); 
                            $('#days').children('td.weekend').each(function(){ 
                                if($(this).text() == match[1]){ 
                                    flag = false; 
                                } 
                            }); 
                            if(flag){ 
                                qtyBuffer['8'] = qtyBuffer['8'] + 1; 
                            } 
                        } 
                        qtyBuffer[currentVal] = qtyBuffer[currentVal] + 1; 
                    }); 
 
 
                    //    
                    for(var dayType in qtyBuffer) 
                    { 
                        qty = qtyBuffer[dayType]; 
 
                        $('.variable_timesheet [input[name*='['+sSdvId+'][posts]['+sName+']['+summaryConfig[dayType]+'']').val(qty); 
                        $('.variable_timesheet [name*='['+sSdvId+'][posts]['+sName+']['+summaryConfig[dayType]+'']').parent().children('span').text(qty); 
 
                    }; 
                    var iHours = qtyBuffer['8']*8 + qtyBuffer['4']*4; 
                    $('.variable_timesheet [input[name*='['+sSdvId+'][posts]['+sName+'][hours']').val(iHours); 
                    $('.variable_timesheet [name*='['+sSdvId+'][posts]['+sName+'][hours']').parent().children('span').text(iHours); 
                } 
 
                function mergeTd(){ 
                    var mergingData = []; 
                    var mergingShift = []; 
                    var diff = 0; 
                    var prevDay = 0; 
                    var attr = undefined; 
                    $('.merge').each(function(){ 
                        if(($(this).attr('day') != prevDay + 1) || (typeof $(this).attr('sdvId') !== typeof undefined && typeof attr !== typeof undefined && attr !== false && attr != $(this).attr('sdvId'))){ 
                            diff++; 
                        } 
                        if(typeof  mergingData[$(this).attr('postid')+diff] == 'undefined'){ 
                            mergingData[$(this).attr('postid')+diff] = []; 
                        } 
                        mergingData[$(this).attr('postid')+diff][$(this).attr('day')] = $(this); 
 
                        attr = $(this).attr('sdvId'); 
                        if (typeof attr !== typeof undefined && attr !== false) { 
                            if(typeof  mergingShift[$(this).attr('postid')+diff] == 'undefined'){ 
                                mergingShift[$(this).attr('postid')+diff] = []; 
                            } 
                            mergingShift[$(this).attr('postid')+diff][$(this).attr('day')] = true; 
                        } 
                        prevDay = parseInt($(this).attr('day')); 
                    }); 
 
                    var regexp = /[\[](.+)\]$/g; 
                    var match = regexp.exec($('#'+oConfig.month).attr('name')); 
                    oDates.year = $('#'+oConfig.year).val(); 
                    oDates.month = match[1]; 
                    oDates.monthEnd = 32 - new Date(oDates.year, oDates.month - 1, 32).getDate(); 
                    for(var postID in mergingData){ 
                        var colspan = count(mergingData[postID]); 
                        var isFirst = true; 
                        for(var day in mergingData[postID]){ 
                            if(isFirst){ 
                                mergingData[postID][day].attr('colspan', colspan); 
                                if(colspan != oDates.monthEnd){ 
                                    if(typeof mergingShift[postID] !== typeof undefined && mergingShift[postID][day] && day == 1){ 
                                        mergingData[postID][day].html('<div title='  '+mergingData[postID].length+'.'+oDates.month+'.'+oDates.year+'.' style='overflow-x:hidden; white-space: nowrap;'>  '+mergingData[postID].length+'.'+oDates.month+'.'+oDates.year+'.</div>'); 
                                    } else if(typeof mergingShift[postID] !== typeof undefined && mergingShift[postID][day] && day != 1){ 
                                        mergingData[postID][day].html('<div title='   '+mergingData[postID][day].attr('postName')+'   '+mergingData[postID][day].attr('sdvName')+'' style='overflow-x:hidden; white-space: nowrap;'>: '+mergingData[postID][day].attr('postName')+', '+mergingData[postID][day].attr('sdvName')+'</div>'); 
                                    } else if(day == '1'){ 
                                        mergingData[postID][day].html('<div title=' '+mergingData[postID].length+'.'+oDates.month+'.'+oDates.year+'.' style='overflow-x:hidden; white-space: nowrap;'> '+mergingData[postID].length+'.'+oDates.month+'.'+oDates.year+'.</div>'); 
                                    } else { 
                                        mergingData[postID][day].html('<div title=' '+day+'.'+oDates.month+'.'+oDates.year+'.' style='overflow-x:hidden; white-space: nowrap;'> '+day+'.'+oDates.month+'.'+oDates.year+'.</div>'); 
                                    } 
                                } 
                                isFirst = false; 
                            } else { 
                                mergingData[postID][day].remove(); 
                            } 
                        } 
                    } 
                } 
                /* 
                             *       () 
                             * @param {type} obj 
                             * @returns 
                             */ 
                function calcAllSummary() 
                { 
 
                    $('#timesheet-table<?php  
        echo $aData['varType']; 
        ?> 
').children('table').children('tbody').children('tr').each(function(i, tr) 
                    { 
                        var trName = $(tr).attr('id'); 
                        var sdvId = $(tr).attr('sdvId'); 
                        if(trName!=''&&trName!=undefined) 
                            calcSummary(trName, sdvId); 
                    }); 
                } 
 
                //    ,   . 
                if($('input[name*='weekend']').length>0) 
                { 
                    tableExists = true; 
                } 
 
                if(tableExists) 
                { 
                    mergeTd(); 
                    calcAllSummary(); 
                } 
            }); 
        </script> 
        <div class='variable variable_timesheet'> 
            <input id='bGenerate<?php  
        echo $aData['varType']; 
        ?> 
' type='button' value='<?php  
        echo $oL->get('\xd0\xa1\xd0\263\320\265\xd0\275\xd0\265\xd1\x80\320\270\321\x80\320\xbe\320\262\320\xb0\xd1\202\321\x8c'); 
        ?> 
' class='btn btn-sm btn-raised btn-default' /> 
            <div id='timesheet-table<?php  
        echo $aData['varType']; 
        ?> 
' style='padding-top: 5px;'> 
                <?php  
        if (!($mode == 'edit')) { 
            goto Label_36867; 
        } 
        ?> 
                    <?php  
        echo \app\workflow\WFW::timesheetvar2table($aData); 
        ?> 
                <?php  
        Label_36867: 
        ?> 
            </div> 
            <!--[if IE]> 
            <style type='text/css'> 
                .rotated_cell 
                { 
                    text-align: left; 
                    padding-bottom: 10px; 
                } 
 
                .rotate_text 
                { 
                    -ms-writing-mode: bt-rl; 
                    filter: flipH() flipV(); 
                    top: 0px; 
                } 
            </style> 
            <![endif]--> 
        </div> 
        <?php  
        $s = ob_get_clean(); 
        return $s; 
    } 
    public static function timesheetvar2table($aData) 
    { 
        $oL = \app\system\Registry::get('locale'); 
        $npp = 1; 
        $displayed = 0; 
        $isWholeTimesheet = $aData['varType'] == 'whole_timesheet2' ? true : false; 
        $disabled = ''; 
        $html = '<input type="hidden" name="' . $aData['varName'] . '[daysInMonth]" value="' . $aData['daysInMonth'] . '"/>' . '<input type="hidden" name="' . $aData['varName'] . '[month]" value="' . $aData['month'] . '"/>' . '<input type="hidden" name="' . $aData['varName'] . '[year]" value="' . $aData['year'] . '"/>' . '\xa            <table border="1" cellpadding="0" cellspacing="0" class="variable_table" >\xa            <tbody>
            <tr class="title">\xa            <td rowspan="2" style="text-align: center; width: 20px;">' . $oL->get('\342\204\x96 \320\xbf/\xd0\xbf') . '</td>\xa            <td rowspan="2" style="text-align: center; width: 150px;">' . $oL->get('\320\xa4\xd0\230\320\236') . '</td>
            <td rowspan="2" style="text-align: center; width: 150px;">' . $oL->get('\320\x94\320\xbe\320\xbb\xd0\xb6\xd0\275\320\276\321\x81\321\x82\xd1\214') . '</td>\xa            <td colspan="' . $aData['daysInMonth'] . '">' . $oL->get('\320\xa7\320\xb8\xd1\x81\320\xbb\320\260 \320\274\320\xb5\xd1\x81\321\217\xd1\x86\320\xb0') . '</td>'; 
        $html .= '<td>' . $oL->get('8') . '</td>'; 
        foreach ($aData['integratedDoctypes'] as $aOne) { 
            if (!(substr($aOne['tag'], 0, 1) == '-' || $aOne['tag'] == '8')) { 
                goto Label_36868; 
            } 
            continue; 
            Label_36868: 
            $displayed++; 
            $html .= '<td class="' . $aOne['color'] . '">' . $oL->get($aOne['tag']) . '</td>'; 
        } 
        $html .= '<td class="weekend">' . $oL->get('\xd0\x92') . '</td>'; 
        $html .= '<td style="width:21px;" class="color_hours"></td>'; 
        $html .= '</tr>
            <tr id="days"  class="title">'; 
        for ($day = 1; $day <= $aData['daysInMonth']; $day++) { 
            $className = \app\workflow\util\Util::isweekenddate($day, $aData['month'], $aData['year']) ? 'weekend' : 'ordinary'; 
            $html .= '<td class="' . $className . '">' . $day . '</td>'; 
        } 
        $html .= '<td class="rotated_cell" ><div class="rotate_text">' . $oL->get('\xd0\224\320\xbd\320\270 \xd1\204\xd0\xb0\xd0\xba\xd1\x82\xd0\xb8\xd1\x87\xd0\xb5\xd1\x81\xd0\272\xd0\xbe\320\xb9 \321\x80\xd0\260\320\xb1\320\276\321\x82\321\213') . '</td>'; 
        foreach ($aData['integratedDoctypes'] as $aOne) { 
            if (!(substr($aOne['tag'], 0, 1) == '-' || $aOne['tag'] == '8')) { 
                goto Label_36869; 
            } 
            continue; 
            Label_36869: 
            $html .= '<td class="rotated_cell ' . $aOne['color'] . '" ><div class="rotate_text">' . $oL->get($aOne['full_name']) . '</td>'; 
        } 
        $html .= '<td class="rotated_cell weekend" ><div class="rotate_text">' . $oL->get('\xd0\x92\xd1\x8b\321\x85\320\xbe\320\xb4\320\xbd\xd1\x8b\320\265') . '</td>'; 
        $html .= '<td class="rotated_cell color_hours" ><div class="rotate_text">' . $oL->get('\xd0\232\320\xbe\320\273-\xd0\xb2\320\xbe \xd0\xbe\321\x82\xd1\x80\xd0\xb0\320\xb1\320\xbe\321\202 \xd1\x87\320\xb0\321\201\xd0\276\xd0\xb2') . '</td>'; 
        $html .= '</tr>'; 
        $selected = 'selected="selected"'; 
        foreach ($aData['structure'] as $sdvId => $sdv) { 
            $sdvTemp = $aData['varName'] . '[structure][' . $sdvId . ']'; 
            if ($isWholeTimesheet) { 
                goto Label_36870; 
            } 
            $html .= '<tr class="subtitle"><td colspan="' . ($aData['daysInMonth'] + 6 + $displayed) . '">&nbsp; ' . $sdv['name'] . '<input type="hidden" name="' . $sdvTemp . '[name]" value="' . $sdv['name'] . '"></td></tr>'; 
            Label_36870: 
            if (empty($sdv['posts'])) { 
                goto Label_36893; 
            } 
            foreach ($sdv['posts'] as $postId => $post) { 
                $html .= '<tr id="' . $postId . '" sdvId="' . $sdvId . '">'; 
                if (strlen($post['employee'])) { 
                    goto Label_36871; 
                } 
                $sWithoutLast = $sLastChar = $post['employee']; 
                goto Label_36872; 
                Label_36871: 
                $sLastChar = substr($post['employee'], -1); 
                $sWithoutLast = substr($post['employee'], 0, -1); 
                Label_36872: 
                if ($sLastChar == '0') { 
                    goto Label_36874; 
                } 
                if ($sLastChar == '1') { 
                    goto Label_36875; 
                } 
                $html .= '<td>' . '<input type="hidden" name="' . $sdvTemp . '[posts][' . $postId . '][employee]" value="' . $post['employee'] . '"/>' . '<input type="hidden" name="' . $sdvTemp . '[posts][' . $postId . '][post]" value="' . $post['post'] . '"/>' . $npp . '</td><td class="align_left">' . $post['employee'] . '</td>' . '<td class="align_left">' . $post['post'] . '</td>'; 
                goto Label_36873; 
                Label_36874: 
                $html .= '<td rowspan="2">' . '<input type="hidden" name="' . $sdvTemp . '[posts][' . $postId . '][employee]" value="' . $post['employee'] . '"/>' . '<input type="hidden" name="' . $sdvTemp . '[posts][' . $postId . '][post]" value="' . $post['post'] . '"/>' . $npp . '</td><td rowspan="2" class="align_left">' . $sWithoutLast . '</td>' . '<td class="align_left">' . $post['post'] . '</td>'; 
                goto Label_36873; 
                Label_36875: 
                $html .= '<input type="hidden" name="' . $sdvTemp . '[posts][' . $postId . '][employee]" value="' . $post['employee'] . '"/>' . '<input type="hidden" name="' . $sdvTemp . '[posts][' . $postId . '][post]" value="' . $post['post'] . '"/>'; 
                $html .= '<td class="align_left">' . $post['post'] . '</td>'; 
                $npp--; 
                Label_36873: 
                for ($day = 1; $day <= $aData['daysInMonth']; $day++) { 
                    $isWeekend = \app\workflow\util\Util::isweekenddate($day, $aData['month'], $aData['year']); 
                    $className = $isWeekend ? 'weekend' : 'ordinary'; 
                    $sName = $sdvTemp . '[posts][' . $postId . '][' . $day . ']'; 
                    $shifted = ''; 
                    if (isset($aData['shiftValues'][$sdvId][$postId]['to']) && $day < $aData['shiftValues'][$sdvId][$postId]['to']) { 
                        goto Label_36879; 
                    } 
                    if (isset($aData['shiftValues'][$sdvId][$postId]['from']) && $day >= $aData['shiftValues'][$sdvId][$postId]['from']) { 
                        goto Label_36880; 
                    } 
                    if (isset($post['shift']['to']) && $day < $post['shift']['to']) { 
                        goto Label_36881; 
                    } 
                    if (isset($post['shift']['from']) && $day >= $post['shift']['from']) { 
                        goto Label_36882; 
                    } 
                    if (isset($aData['editedValues'][$postId][$day])) { 
                        goto Label_36883; 
                    } 
                    if (isset($post[$day]) && is_array($post[$day]) && isset($post[$day]['edited'])) { 
                        goto Label_36884; 
                    } 
                    if (isset($aData['aDValues'][substr($postId, 0, 36)][$day])) { 
                        goto Label_36885; 
                    } 
                    if (isset($aData['aDTags'][$postId]['8']) || !isset($aData['isNew']) && !isset($post[$day])) { 
                        goto Label_36886; 
                    } 
                    $sSelectedValue = a($post, $day, $isWeekend ? '\320\x92' : '8'); 
                    goto Label_36878; 
                    Label_36879: 
                    $sSelectedValue = ''; 
                    $className = 'merge" sdvId="' . $sdvId . '" postId="' . $postId . '" day="' . $day; 
                    $shifted = '<input type="hidden" name="' . $sdvTemp . '[posts][' . $postId . '][shift][to]" value="' . $aData['shiftValues'][$sdvId][$postId]['to'] . '"/>'; 
                    goto Label_36878; 
                    Label_36880: 
                    $sSelectedValue = ''; 
                    $className = 'merge" sdvName="' . $aData['shiftedTo'][$postId]['subdiv_to'] . '" postName="' . $aData['shiftedTo'][$postId]['post_to'] . '" sdvId="' . $sdvId . '" postId="' . $postId . '" day="' . $day; 
                    $shifted = '<input type="hidden" name="' . $sdvTemp . '[posts][' . $postId . '][shift][from]" value="' . $aData['shiftValues'][$sdvId][$postId]['from'] . '"/>'; 
                    $shifted .= '<input type="hidden" name="' . $sdvTemp . '[posts][' . $postId . '][shift][post_to]" value="' . $aData['shiftedTo'][$postId]['post_to'] . '"/>'; 
                    $shifted .= '<input type="hidden" name="' . $sdvTemp . '[posts][' . $postId . '][shift][sdv_to]" value="' . $aData['shiftedTo'][$postId]['subdiv_to'] . '"/>'; 
                    goto Label_36878; 
                    Label_36881: 
                    $sSelectedValue = ''; 
                    $className = 'merge" sdvId="' . $sdvId . '" postId="' . $postId . '" day="' . $day; 
                    $shifted = '<input type="hidden" name="' . $sdvTemp . '[posts][' . $postId . '][shift][to]" value="' . $post['shift']['to'] . '"/>'; 
                    goto Label_36878; 
                    Label_36882: 
                    $sSelectedValue = ''; 
                    $className = 'merge" sdvName="' . $post['shift']['sdv_to'] . '" postName="' . $post['shift']['post_to'] . '" sdvId="' . $sdvId . '" postId="' . $postId . '" day="' . $day; 
                    $shifted = '<input type="hidden" name="' . $sdvTemp . '[posts][' . $postId . '][shift][from]" value="' . $post['shift']['from'] . '"/>'; 
                    $shifted .= '<input type="hidden" name="' . $sdvTemp . '[posts][' . $postId . '][shift][post_to]" value="' . $post['shift']['post_to'] . '"/>'; 
                    $shifted .= '<input type="hidden" name="' . $sdvTemp . '[posts][' . $postId . '][shift][sdv_to]" value="' . $post['shift']['sdv_to'] . '"/>'; 
                    goto Label_36878; 
                    Label_36883: 
                    $sSelectedValue = $aData['editedValues'][$postId][$day]['edited']; 
                    goto Label_36878; 
                    Label_36884: 
                    $sSelectedValue = $post[$day]['edited']; 
                    goto Label_36878; 
                    Label_36885: 
                    $sSelectedValue = $aData['aDValues'][substr($postId, 0, 36)][$day]; 
                    if (!($sSelectedValue == '8' && $isWeekend)) { 
                        goto Label_36876; 
                    } 
                    $sSelectedValue = '\xd0\x92'; 
                    Label_36876: 
                    if (!($sSelectedValue == '-8')) { 
                        goto Label_36877; 
                    } 
                    $sSelectedValue = ''; 
                    $className = 'merge" postId="' . $postId . '" day="' . $day; 
                    Label_36877: 
                    goto Label_36878; 
                    Label_36886: 
                    $sSelectedValue = a($post, $day, ''); 
                    $className = 'merge" postId="' . $postId . '" day="' . $day; 
                    Label_36878: 
                    if (!isset($aData['colorByTag'][$sSelectedValue])) { 
                        goto Label_36887; 
                    } 
                    $className = $aData['colorByTag'][$sSelectedValue]; 
                    Label_36887: 
                    if (mb_strlen($sSelectedValue) > 1) { 
                        goto Label_36888; 
                    } 
                    $html .= '<td class="' . $className . '"><div class="timesheet_day"><span class="timesheet_day_value">' . $sSelectedValue . '</span>'; 
                    goto Label_36889; 
                    Label_36888: 
                    $html .= '<td class="' . $className . '"><div class="timesheet_day"><span style="padding-left: -5px; font-size:8px;" class="timesheet_day_value">' . $sSelectedValue . '</span>'; 
                    Label_36889: 
                    if (!($sSelectedValue !== '')) { 
                        goto Label_36890; 
                    } 
                    $html .= '<select name="' . $sName . '" ' . $disabled . 'class="abbr" >'; 
                    foreach ($aData['dayTypesOptions'] as $key => $value) { 
                        $html .= '<option  value="' . $key . '" ' . ($key == $sSelectedValue ? 'selected="selected"' : '') . '>' . $value . '</option>'; 
                    } 
                    $html .= '</select>'; 
                    Label_36890: 
                    if (!(isset($post[$day]) && is_array($post[$day]) && isset($post[$day]['edited']) || isset($aData['editedValues'][$postId][$day]))) { 
                        goto Label_36891; 
                    } 
                    $html .= '<input type="hidden" name="' . $sName . '[edited]" value="' . $sSelectedValue . '"/>'; 
                    Label_36891: 
                    $html .= '</div></td>'; 
                    $html .= $shifted; 
                } 
                $npp++; 
                $SummaryName = $sdvTemp . '[posts][' . $postId . ']'; 
                $html .= '<td><div><span></span><input name="' . $SummaryName . '[actual_work]" type="hidden" value=""/></div></td>'; 
                foreach ($aData['integratedDoctypes'] as $aOne) { 
                    if (!(substr($aOne['tag'], 0, 1) == '-' || $aOne['tag'] == '8')) { 
                        goto Label_36892; 
                    } 
                    continue; 
                    Label_36892: 
                    $html .= '<td class="' . $aOne['color'] . '"><div id="dt_' . $aOne['doctype'] . '"><span></span><input name="' . $SummaryName . '[dt_' . $aOne['doctype'] . ']" type="hidden" value=""/></div></td>'; 
                } 
                $html .= '<td class="weekend"><div id="weekend"><span></span><input name="' . $SummaryName . '[weekend]" type="hidden" value=""/></div></td>'; 
                $html .= '<td class="color_hours"><div id="hours"><span></span><input name="' . $SummaryName . '[hours]" type="hidden" value=""/></div></td>'; 
                $html .= '</tr>'; 
            } 
            Label_36893: 
        } 
        $html .= '</tbody>\xa                 </table>'; 
        return $html; 
    } 
    public static function timesheetvar2view($aData, $sDoctypeId, $sDocumentId) 
    { 
        $oL = \app\system\Registry::get('locale'); 
        ob_start(); 
        ?> 
        <?php  
        if (!isset($aData['structure'])) { 
            goto Label_36894; 
        } 
        ?> 
            <script> 
                var oDates =  { //  
                    'year': '<?php  
        echo $aData['year']; 
        ?> 
', 
                    'month': '<?php  
        echo $aData['month']; 
        ?> 
', 
                    'monthEnd': '<?php  
        echo $aData['daysInMonth']; 
        ?> 
', 
                }; 
                $(document).ready(function(){ 
                    mergeTd(); 
                }); 
                function mergeTd(){ 
                    var mergingData = []; 
                    var mergingShift = []; 
                    var diff = 0; 
                    var prevDay = 0; 
                    var attr = undefined; 
                    $('.merge').each(function(){ 
                        if(($(this).attr('day') != prevDay + 1) || (typeof $(this).attr('sdvId') !== typeof undefined && typeof attr !== typeof undefined && attr !== false && attr != $(this).attr('sdvId'))){ 
                            console.log('yes'); 
                            diff++; 
                        } 
                        if(typeof  mergingData[$(this).attr('postid')+diff] == 'undefined'){ 
                            console.log('yeah'); 
                            mergingData[$(this).attr('postid')+diff] = []; 
                        } 
                        mergingData[$(this).attr('postid')+diff][$(this).attr('day')] = $(this); 
 
                        attr = $(this).attr('sdvId'); 
                        if (typeof attr !== typeof undefined && attr !== false) { 
                            if(typeof  mergingShift[$(this).attr('postid')+diff] == 'undefined'){ 
                                mergingShift[$(this).attr('postid')+diff] = []; 
                            } 
                            mergingShift[$(this).attr('postid')+diff][$(this).attr('day')] = true; 
                        } 
                        prevDay = parseInt($(this).attr('day')); 
                    }); 
 
                    for(var postID in mergingData){ 
                        //console.log(postID+' '+ count(mergingData[postID])); 
                        var colspan = count(mergingData[postID]); 
                        var isFirst = true; 
                        for(var day in mergingData[postID]){ 
                            if(isFirst){ 
                                mergingData[postID][day].attr('colspan', colspan); 
                                if(colspan != oDates.monthEnd){ 
                                    if(typeof mergingShift[postID] !== typeof undefined && mergingShift[postID][day] && day == 1){ 
                                        mergingData[postID][day].html('<div title='  '+mergingData[postID].length+'.'+oDates.month+'.'+oDates.year+'.' style='overflow-x:hidden; white-space: nowrap;'>  '+mergingData[postID].length+'.'+oDates.month+'.'+oDates.year+'.</div>'); 
                                    } else if(typeof mergingShift[postID] !== typeof undefined && mergingShift[postID][day] && day != 1){ 
                                        mergingData[postID][day].html('<div title='   '+mergingData[postID][day].attr('postName')+'   '+mergingData[postID][day].attr('sdvName')+'' style='overflow-x:hidden; white-space: nowrap;'>: '+mergingData[postID][day].attr('postName')+', '+mergingData[postID][day].attr('sdvName')+'</div>'); 
                                    } else if(day == '1'){ 
                                        mergingData[postID][day].html('<div title=' '+mergingData[postID].length+'.'+oDates.month+'.'+oDates.year+'.' style='overflow-x:hidden; white-space: nowrap;'> '+mergingData[postID].length+'.'+oDates.month+'.'+oDates.year+'.</div>'); 
                                    } else { 
                                        mergingData[postID][day].html('<div title=' '+day+'.'+oDates.month+'.'+oDates.year+'.' style='overflow-x:hidden; white-space: nowrap;'> '+day+'.'+oDates.month+'.'+oDates.year+'.</div>'); 
                                    } 
                                } 
                                isFirst = false; 
                            } else { 
                                mergingData[postID][day].remove(); 
                            } 
                        } 
                    } 
                } 
            </script> 
            <div class='variable variable_timesheet'> 
                <input type='button' value='<?php  
        echo $oL->get('\320\255\xd0\xba\xd1\201\xd0\xbf\xd0\xbe\321\200\xd1\202 \xd0\262 Excel'); 
        ?> 
' onclick='msf.page.go('/workflow/document/export-variable/<?php  
        echo $sDoctypeId; 
        ?> 
/<?php  
        echo $sDocumentId; 
        ?> 
/<?php  
        echo $aData['varName']; 
        ?> 
');' /> 
                <div id='timesheet-table<?php  
        echo $aData['varType']; 
        ?> 
' style='padding-top: 5px;'> 
                    <?php  
        echo \app\workflow\WFW::timesheetvar2tableview($aData); 
        ?> 
                </div> 
                <!--[if IE]> 
                <style type='text/css'> 
                    .rotated_cell 
                    { 
                        text-align: left; 
                        padding-bottom: 10px; 
                    } 
 
                    .rotate_text 
                    { 
                        -ms-writing-mode: bt-rl; 
                        filter: flipH() flipV(); 
                        top: 0px; 
                    } 
                </style> 
                <![endif]--> 
            </div> 
        <?php  
        Label_36894: 
        ?> 
        <?php  
        $s = ob_get_clean(); 
        return $s; 
    } 
    public static function timesheetvar2tableview($aData) 
    { 
        $displayed = 0; 
        $isWholeTimesheet = $aData['varType'] == 'whole_timesheet2' ? true : false; 
        if (isset($aData['structure'])) { 
            goto Label_36915; 
        } 
        return ''; 
        goto Label_36916; 
        Label_36915: 
        $oL = \app\system\Registry::get('locale'); 
        $npp = 1; 
        $html = '\xa                <table border="1" cellspacing="0" cellpadding="0" class="variable_table" >\xa                <tbody>\xa                <tr class="title">
                <td rowspan="2" style="text-align: center; width: 20px;">' . $oL->get('\xe2\x84\226 \xd0\xbf/\xd0\277') . '</td>
                <td rowspan="2" style="text-align: center; width: 150px;">' . $oL->get('\xd0\244\320\230\xd0\236') . '</td>
                <td rowspan="2" style="text-align: center; width: 150px;">' . $oL->get('\xd0\x94\xd0\xbe\320\xbb\xd0\xb6\xd0\275\xd0\xbe\xd1\x81\321\x82\xd1\x8c') . '</td>
                <td colspan="' . $aData['daysInMonth'] . '">' . $oL->get('\320\247\xd0\270\321\x81\320\xbb\xd0\xb0 \320\274\xd0\xb5\xd1\x81\321\217\321\206\320\260') . '</td>'; 
        $html .= '<td>' . $oL->get('8') . '</td>'; 
        foreach ($aData['integratedDoctypes'] as $aOne) { 
            if (!(substr($aOne['tag'], 0, 1) == '-' || $aOne['tag'] == '8')) { 
                goto Label_36895; 
            } 
            continue; 
            Label_36895: 
            $displayed++; 
            $html .= '<td class="' . $aOne['color'] . '">' . $oL->get($aOne['tag']) . '</td>'; 
        } 
        $html .= '<td class="weekend">' . $oL->get('\xd0\222') . '</td>'; 
        $html .= '<td style="width:21px" class="color_hours"></td>'; 
        $html .= '</tr>\xa                <tr class="title">'; 
        for ($day = 1; $day <= $aData['daysInMonth']; $day++) { 
            $className = \app\workflow\util\Util::isweekenddate($day, $aData['month'], $aData['year']) ? 'weekend' : 'ordinary'; 
            $html .= '<td class="' . $className . '">' . $day . '</td>'; 
        } 
        $html .= '<td class="rotated_cell" ><div class="rotate_text">' . $oL->get('\xd0\x94\320\275\320\270 \xd1\x84\320\260\xd0\xba\321\202\320\xb8\321\x87\xd0\265\xd1\x81\320\272\320\276\xd0\xb9 \xd1\x80\320\260\320\xb1\xd0\xbe\321\202\xd1\213') . '</td>'; 
        foreach ($aData['integratedDoctypes'] as $aOne) { 
            if (!(substr($aOne['tag'], 0, 1) == '-' || $aOne['tag'] == '8')) { 
                goto Label_36896; 
            } 
            continue; 
            Label_36896: 
            $html .= '<td class="rotated_cell ' . $aOne['color'] . '" ><div class="rotate_text">' . $oL->get($aOne['full_name']) . '</td>'; 
        } 
        $html .= '<td class="rotated_cell weekend" ><div class="rotate_text">' . $oL->get('\320\222\xd1\213\xd1\x85\320\276\xd0\264\xd0\275\321\x8b\320\xb5') . '</td>'; 
        $html .= '<td class="rotated_cell color_hours" ><div class="rotate_text">' . $oL->get('\320\232\320\276\xd0\xbb-\320\xb2\xd0\xbe \320\276\321\x82\321\x80\320\xb0\320\xb1\320\276\321\x82 \321\207\xd0\260\xd1\x81\xd0\276\320\262') . '</td>'; 
        $html .= '</tr>'; 
        $selected = 'selected="selected"'; 
        foreach ($aData['structure'] as $sdvId => $sdv) { 
            $sdvTemp = $aData['varName'] . '[structure][' . $sdvId . ']'; 
            if ($isWholeTimesheet) { 
                goto Label_36897; 
            } 
            $html .= '<tr><td colspan="' . ($aData['daysInMonth'] + 6 + $displayed) . '">&nbsp; ' . v($sdv['name']) . '</td></tr>'; 
            Label_36897: 
            if (empty($sdv['posts'])) { 
                goto Label_36914; 
            } 
            foreach ($sdv['posts'] as $postId => $post) { 
                $html .= '<tr id="' . $postId . '">'; 
                if (strlen($post['employee'])) { 
                    goto Label_36898; 
                } 
                $sWithoutLast = $sLastChar = $post['employee']; 
                goto Label_36899; 
                Label_36898: 
                $sLastChar = substr($post['employee'], -1); 
                $sWithoutLast = substr($post['employee'], 0, -1); 
                Label_36899: 
                if ($sLastChar == '0') { 
                    goto Label_36901; 
                } 
                if ($sLastChar == '1') { 
                    goto Label_36902; 
                } 
                $html .= '<td>' . $npp . '</td><td class="align_left">' . v($post['employee']) . '</td>' . '<td class="align_left">' . v($post['post']) . '</td>'; 
                goto Label_36900; 
                Label_36901: 
                $html .= '<td rowspan="2">' . $npp . '</td><td rowspan="2" class="align_left">' . v($sWithoutLast) . '</td>' . '<td class="align_left">' . v($post['post']) . '</td>'; 
                goto Label_36900; 
                Label_36902: 
                $html .= '<td class="align_left">' . v($post['post']) . '</td>'; 
                $npp--; 
                Label_36900: 
                for ($day = 1; $day <= $aData['daysInMonth']; $day++) { 
                    $isWeekend = \app\workflow\util\Util::isweekenddate($day, $aData['month'], $aData['year']); 
                    $flag = false; 
                    if (isset($post[$day])) { 
                        goto Label_36903; 
                    } 
                    $post[$day] = ''; 
                    $flag = true; 
                    Label_36903: 
                    if (!(is_array($post[$day]) && isset($post[$day]['edited']))) { 
                        goto Label_36904; 
                    } 
                    $post[$day] = $post[$day]['edited']; 
                    Label_36904: 
                    if (isset($post['shift']['to']) && $day < $post['shift']['to']) { 
                        goto Label_36906; 
                    } 
                    if (isset($post['shift']['from']) && $day >= $post['shift']['from']) { 
                        goto Label_36907; 
                    } 
                    if (isset($aData['colorByTag'][$post[$day]])) { 
                        goto Label_36908; 
                    } 
                    if ($flag) { 
                        goto Label_36909; 
                    } 
                    $className = $isWeekend ? 'weekend' : 'ordinary'; 
                    goto Label_36905; 
                    Label_36906: 
                    $className = 'merge" sdvId="' . $sdvId . '" postId="' . $postId . '" day="' . $day; 
                    goto Label_36905; 
                    Label_36907: 
                    $className = 'merge" sdvName="' . $post['shift']['sdv_to'] . '" postName="' . $post['shift']['post_to'] . '" sdvId="' . $sdvId . '" postId="' . $postId . '" day="' . $day; 
                    goto Label_36905; 
                    Label_36908: 
                    $className = $aData['colorByTag'][$post[$day]]; 
                    goto Label_36905; 
                    Label_36909: 
                    $className = 'merge" postid="' . $postId . '" day="' . $day; 
                    Label_36905: 
                    if (mb_strlen($post[$day]) > 1) { 
                        goto Label_36910; 
                    } 
                    $html .= '<td class="' . $className . '">'; 
                    $html .= $post[$day]; 
                    goto Label_36911; 
                    Label_36910: 
                    $html .= '<td style="padding-left: -5px; font-size:8px;" class="' . $className . '">'; 
                    $html .= $post[$day]; 
                    Label_36911: 
                    $html .= '</td>'; 
                } 
                $npp++; 
                $html .= '<td>' . $post['actual_work'] . '</td>'; 
                foreach ($aData['integratedDoctypes'] as $aOne) { 
                    if (!(substr($aOne['tag'], 0, 1) == '-' || $aOne['tag'] == '8')) { 
                        goto Label_36912; 
                    } 
                    continue; 
                    Label_36912: 
                    if (!isset($post['dt_' . $aOne['doctype']])) { 
                        goto Label_36913; 
                    } 
                    $html .= '<td class="' . $aOne['color'] . '">' . $post['dt_' . $aOne['doctype']] . '</td>'; 
                    Label_36913: 
                } 
                $html .= '<td class="weekend">' . $post['weekend'] . '</td>'; 
                $html .= '<td class="color_hours">' . $post['hours'] . '</td>'; 
                $html .= '</tr>'; 
            } 
            Label_36914: 
        } 
        $html .= '</tbody>\xa                     </table>'; 
        return $html; 
        Label_36916: 
    } 
    public static function timesheetvar3edit($aData, $sDoctypeId, $sDocumentId, $mode = 'create') 
    { 
        $oL = \app\system\Registry::get('locale'); 
        ob_start(); 
        ?> 
        <script type='text/javascript'> 
 
            function isValid(obj) 
            { 
                for (var prop in obj) 
                { 
                    if(!$('[name*=''+obj[prop]+'']').length) 
                    { 
                        ShowErrorMessage('<?php  
        echo $oL->get('\320\237\321\x80\xd0\xbe\320\xb2\xd0\xb5\321\200\321\214\321\202\320\xb5 \xd0\275\320\xb0\xd0\273\320\xb8\xd1\207\320\xb8\320\265 \320\262\321\x81\320\xb5\321\205 \320\277\320\276\320\273\xd0\xb5\320\xb9 \xd1\x88\320\xb0\xd0\xb1\xd0\273\xd0\276\xd0\275\xd0\265 \xd0\264\320\xbe\xd0\xba\xd1\203\xd0\xbc\320\xb5\xd0\275\xd1\x82\xd0\260'); 
        ?> 
'); 
                        return  false; 
                    } 
                } 
 
                return true; 
            } 
 
            function ShowErrorMessage(t) 
            { 
                MSF_StatusBar.hideWait(); 
                $('#results').show().children('#error').append('<div class='status_error' id='statusErrorItem_0'>'+t+'<br /></div>').show(); 
                setTimeout(function() { 
                    $('#statusErrorItem_0').hide(); 
                    $('#statusErrorItem_0').remove(); 
                    if($('#error').html().trim() == '') { 
                        $('#error').hide(); 
                    } 
                }, 5000); 
            }; 
 
            $(document).ready(function(){ 
                var varType = '<?php  
        echo $aData['varType']; 
        ?> 
'; 
                if(varType == 'whole_timesheet3'){ 
                    var oConfig =  { //  
                        'year': '<?php  
        echo $aData['var']['year']; 
        ?> 
', 
                        'month': '<?php  
        echo $aData['var']['month']; 
        ?> 
', 
                    }; 
                } else { 
                    var oConfig =  { //  
                        'subdivision': '<?php  
        echo $aData['var']['subdivision']; 
        ?> 
', 
                        'year': '<?php  
        echo $aData['var']['year']; 
        ?> 
', 
                        'month': '<?php  
        echo $aData['var']['month']; 
        ?> 
', 
                    }; 
                } 
                var oDates =  { //  
                    'year': '<?php  
        echo isset($aData['year']) ? $aData['year'] : ''; 
        ?> 
', 
                    'month': '<?php  
        echo isset($aData['month']) ? $aData['month'] : ''; 
        ?> 
', 
                    'monthEnd': '<?php  
        echo isset($aData['daysInMonth']) ? $aData['daysInMonth'] : ''; 
        ?> 
', 
                }; 
 
                var summaryConfig = $.parseJSON('<?php  
        echo addslashes(\app\system\Json::encode($aData['var']['doctypeByTag'])); 
        ?> 
'); 
                var colorByTag = $.parseJSON('<?php  
        echo addslashes(\app\system\Json::encode($aData['colorByTag'])); 
        ?> 
'); 
                var tableExists = false; 
                /* */ 
                $('#bGenerate<?php  
        echo $aData['varType']; 
        ?> 
').click(function() 
                { 
                    if(!isValid(oConfig)) 
                        return; 
 
                    if(tableExists) 
                    { 
                        if (!confirm('<?php  
        echo $oL->get('\xd0\x92\321\x8b \321\x83\320\262\xd0\xb5\321\200\xd0\xb5\320\275\xd1\x8b, \321\x87\321\202\xd0\xbe \xd1\x85\320\xbe\xd1\x82\xd0\270\xd1\x82\xd0\265 \xd1\x81\320\xbe\320\267\xd0\264\xd0\260\321\x82\321\x8c \320\275\xd0\276\320\xb2\xd1\x83\321\x8e \xd1\x82\xd0\xb0\320\xb1\320\273\xd0\270\321\206\321\x83, \xd1\203\xd0\xb4\320\xb0\320\xbb\xd0\xb8\320\262 \321\201\321\x82\xd0\260\321\200\321\203\xd1\x8e?'); 
        ?> 
')) 
                        { 
                            return; 
                        } 
                    } 
 
                    request = $.ajax( 
                        { 
                            type:		'POST', 
                            url:		'/workflow/document/<?php  
        echo str_replace('_', '-', $aData['varType']); 
        ?> 
/<?php  
        echo $sDoctypeId; 
        ?> 
/<?php  
        echo $sDocumentId; 
        ?> 
/<?php  
        echo $aData['var']['name']; 
        ?> 
', 
                            data:		$('#createRowForm').serialize(), 
                            dataType: 'json', 
                            success: function(oData) 
                            { 
                                if(array_key_exists('error', oData)) 
                                { 
                                    ShowErrorMessage(oData.error); 
                                } 
                                else 
                                { 
                                    $('#timesheet-table<?php  
        echo $aData['varType']; 
        ?> 
').html(oData.html); 
                                    calcAllSummary(); 
                                    mergeTd(); 
                                } 
                            }, 
                            error:function(data) 
                            { 
                                ShowErrorMessage('<?php  
        echo $oL->get('\xd0\x9f\xd1\x80\xd0\276\xd0\270\xd0\267\xd0\276\xd1\210\xd0\273\xd0\xb0 \320\xbe\321\x88\xd0\270\320\xb1\320\272\xd0\xb0 \320\xb2\xd0\xbe \xd0\262\xd1\x80\320\xb5\xd0\274\321\217 \xd0\267\xd0\xb0\320\xbf\321\x80\xd0\xbe\321\x81\xd0\xb0.'); 
        ?> 
'); 
                            } 
                        }); 
 
                }); 
 
                //         
                $('.variable_timesheet select[name*='[posts]']').live('change', function() 
                { 
 
                    var currentPostId = $(this).parent().parent().parent().attr('id'); 
                    var currentSdvId = $(this).parent().parent().parent().attr('sdvid'); 
                    var td = $(this).parent().parent(); 
                    var div = $(this).parent(); 
                    $('[name=''+$(this).attr('name')+'[edited]']').remove(); 
                    calcSummary(currentPostId, currentSdvId); 
                    div.append('<input type='hidden' name=''+$(this).attr('name')+'[edited]' value=''+$(this).val()+''/>'); 
                    if($(this).val().length > 1){ 
                        $(this).siblings('.timesheet_day_value').css('padding-left', '-5px'); 
                        $(this).siblings('.timesheet_day_value').css('font-size', '8px'); 
                    } else { 
                        $(this).siblings('.timesheet_day_value').css('padding-left', '0'); 
                        $(this).siblings('.timesheet_day_value').css('font-size', '9pt'); 
                    } 
                    td.removeClass(); 
                    td.addClass(colorByTag[$(this).val()]); 
                    $(this).siblings('.timesheet_day_value').text($(this).val()); 
                }); 
 
                /** 
                 *         
                 * 
                 * @param {type} sName 
                 * @returns {undefined} 
                 */ 
                function calcSummary(sName, sSdvId) 
                { 
                    var qtyBuffer = []; 
                    var qty = 0; 
                    var currentVal; 
 
                    //       
                    $.each(summaryConfig, function(dayType, dayDesc) 
                    { 
                        qtyBuffer[dayType] = 0; 
                    }); 
 
                    //      
                    $('.variable_timesheet [name*='['+sSdvId+'][posts]['+sName+'']').each(function(i, select) 
                    { 
                        currentVal = $(select).children('option:selected').val(); 
                        if(currentVal == ''){ 
                            var regexp = /[\[]([^\[]+)\]$/g; 
                            var match = regexp.exec($(select).attr('name')); 
                            var flag = true; 
                            //console.log(match[1]); 
                            $('#days').children('td.weekend').each(function(){ 
                                if($(this).text() == match[1]){ 
                                    flag = false; 
                                } 
                            }); 
                            if(flag){ 
                                qtyBuffer['8'] = qtyBuffer['8'] + 1; 
                            } 
                        } 
                        if (currentVal == '') { 
                            qtyBuffer[''] = qtyBuffer[''] + 1; 
                        } else { 
                            qtyBuffer[currentVal] = qtyBuffer[currentVal] + 1; 
                        } 
                    }); 
 
                    //    
                    for(var dayType in qtyBuffer) 
                    { 
                        qty = qtyBuffer[dayType]; 
                        $('.variable_timesheet [input[name*='['+sSdvId+'][posts]['+sName+']['+summaryConfig[dayType]+'']').val(qty); 
                        $('.variable_timesheet [name*='['+sSdvId+'][posts]['+sName+']['+summaryConfig[dayType]+'']').parent().children('span').text(qty); 
 
                    }; 
 
                    $('.variable_timesheet [input[name*='['+sSdvId+'][posts]['+sName+'][hours']').val(qtyBuffer['8']*8); 
                    $('.variable_timesheet [name*='['+sSdvId+'][posts]['+sName+'][hours']').parent().children('span').text(qtyBuffer['8']*8); 
                    var daysInMonth = $('.variable_timesheet [input[name*='daysInMonth']').val(); 
                    $('.variable_timesheet [input[name*='['+sSdvId+'][posts]['+sName+'][days_in_month']').val(daysInMonth); 
                    $('.variable_timesheet [name*='['+sSdvId+'][posts]['+sName+'][days_in_month']').parent().children('span').text(daysInMonth); 
                } 
 
                function mergeTd(){ 
                    var mergingData = []; 
                    var mergingShift = []; 
                    var diff = 0; 
                    var prevDay = 0; 
                    var attr = undefined; 
                    $('.merge').each(function(){ 
                        if(($(this).attr('day') != prevDay + 1) || (typeof $(this).attr('sdvId') !== typeof undefined && typeof attr !== typeof undefined && attr !== false && attr != $(this).attr('sdvId'))){ 
                            diff++; 
                        } 
                        if(typeof  mergingData[$(this).attr('postid')+diff] == 'undefined'){ 
                            mergingData[$(this).attr('postid')+diff] = []; 
                        } 
                        mergingData[$(this).attr('postid')+diff][$(this).attr('day')] = $(this); 
 
                        attr = $(this).attr('sdvId'); 
                        if (typeof attr !== typeof undefined && attr !== false) { 
                            if(typeof  mergingShift[$(this).attr('postid')+diff] == 'undefined'){ 
                                mergingShift[$(this).attr('postid')+diff] = []; 
                            } 
                            mergingShift[$(this).attr('postid')+diff][$(this).attr('day')] = true; 
                        } 
                        prevDay = parseInt($(this).attr('day')); 
                    }); 
 
                    var regexp = /[\[](.+)\]$/g; 
                    var match = regexp.exec($('#'+oConfig.month).attr('name')); 
                    oDates.year = $('#'+oConfig.year).val(); 
                    oDates.month = match[1]; 
                    oDates.monthEnd = 32 - new Date(oDates.year, oDates.month - 1, 32).getDate(); 
                    for(var postID in mergingData){ 
                        var colspan = count(mergingData[postID]); 
                        var isFirst = true; 
                        for(var day in mergingData[postID]){ 
                            if(isFirst){ 
                                //if ($( 'input[name*='msf_form_type']' ).val() == 'create') { 
                                mergingData[postID][day].attr('colspan', colspan); 
                                //} 
                                if(colspan != oDates.monthEnd){ 
                                    if(typeof mergingShift[postID] !== typeof undefined && mergingShift[postID][day] && day == 1){ 
                                        mergingData[postID][day].html('<div title='  '+mergingData[postID].length+'.'+oDates.month+'.'+oDates.year+'.' style='overflow-x:hidden; white-space: nowrap;'>  '+mergingData[postID].length+'.'+oDates.month+'.'+oDates.year+'.</div>'); 
                                    } else if(typeof mergingShift[postID] !== typeof undefined && mergingShift[postID][day] && day != 1){ 
                                        mergingData[postID][day].html('<div title='   '+mergingData[postID][day].attr('postName')+'   '+mergingData[postID][day].attr('sdvName')+'' style='overflow-x:hidden; white-space: nowrap;'>: '+mergingData[postID][day].attr('postName')+', '+mergingData[postID][day].attr('sdvName')+'</div>'); 
                                    } else if(day == '1'){ 
                                        mergingData[postID][day].html('<div title=' '+mergingData[postID].length+'.'+oDates.month+'.'+oDates.year+'.' style='overflow-x:hidden; white-space: nowrap;'> '+mergingData[postID].length+'.'+oDates.month+'.'+oDates.year+'.</div>'); 
                                    } else { 
                                        //    -2195/19  20.02.2019 15:01 
                                        //mergingData[postID][day].html('<div title=' '+day+'.'+oDates.month+'.'+oDates.year+'.' style='overflow-x:hidden; white-space: nowrap;'> '+day+'.'+oDates.month+'.'+oDates.year+'.</div>'); 
                                        var oD = new Date(oDates.year,oDates.month,day); 
                                        oD.setDate(oD.getDate() - 1); 
                                        var sD = oD.getDate()+'.'+oD.getMonth()+'.'+oD.getFullYear(); 
                                        mergingData[postID][day].html('<div title=' '+sD+'.' style='overflow-x:hidden; white-space: nowrap;'> '+sD+'.</div>'); 
                                    } 
                                } 
                                isFirst = false; 
                            } else { 
                                mergingData[postID][day].remove(); 
                            } 
                        } 
                    } 
                } 
                /* 
                             *       () 
                             * @param {type} obj 
                             * @returns 
                             */ 
                function calcAllSummary() 
                { 
 
                    $('#timesheet-table<?php  
        echo $aData['varType']; 
        ?> 
').children('table').children('tbody').children('tr').each(function(i, tr) 
                    { 
                        var trName = $(tr).attr('id'); 
                        var sdvId = $(tr).attr('sdvId'); 
                        if(trName!=''&&trName!=undefined) 
                            calcSummary(trName, sdvId); 
                    }); 
                } 
 
                //    ,   . 
                if($('input[name*='weekend']').length>0) 
                { 
                    tableExists = true; 
                } 
 
                if(tableExists) 
                { 
                    mergeTd(); 
                    calcAllSummary(); 
                } 
            }); 
        </script> 
        <div class='variable variable_timesheet'> 
            <input id='bGenerate<?php  
        echo $aData['varType']; 
        ?> 
' type='button' value='<?php  
        echo $oL->get('\320\241\xd0\263\xd0\265\320\xbd\320\xb5\321\200\320\xb8\xd1\200\320\xbe\xd0\xb2\xd0\260\xd1\x82\321\x8c'); 
        ?> 
' /> 
            <div id='timesheet-table<?php  
        echo $aData['varType']; 
        ?> 
' style='padding-top: 5px;'> 
                <?php  
        if (!($mode == 'edit')) { 
            goto Label_36917; 
        } 
        ?> 
                    <?php  
        echo \app\workflow\WFW::timesheetvar3table($aData); 
        ?> 
                <?php  
        Label_36917: 
        ?> 
            </div> 
            <!--[if IE]> 
            <style type='text/css'> 
                .rotated_cell 
                { 
                    text-align: left; 
                    padding-bottom: 10px; 
                } 
 
                .rotate_text 
                { 
                    -ms-writing-mode: bt-rl; 
                    filter: flipH() flipV(); 
                    top: 0px; 
                } 
            </style> 
            <![endif]--> 
        </div> 
        <?php  
        $s = ob_get_clean(); 
        return $s; 
    } 
    public static function timesheetvar3table($aData) 
    { 
        $oL = \app\system\Registry::get('locale'); 
        $npp = 1; 
        $displayed = 0; 
        $isWholeTimesheet = $aData['varType'] == 'whole_timesheet3' ? true : false; 
        $disabled = ''; 
        $iWeekDaysShow = a($aData, 'weekDaysShow', 0); 
        $html = '<input type="hidden" name="' . $aData['varName'] . '[daysInMonth]" value="' . $aData['daysInMonth'] . '"/>' . '<input type="hidden" name="' . $aData['varName'] . '[month]" value="' . $aData['month'] . '"/>' . '<input type="hidden" name="' . $aData['varName'] . '[year]" value="' . $aData['year'] . '"/>' . '\xa            <table border="1" cellpadding="0" cellspacing="0" class="variable_table" >
            <tbody>\xa            <tr class="title">
            <td rowspan="' . (2 + $iWeekDaysShow) . '" style="text-align: center; width: 20px;">' . $oL->get('\xe2\204\x96 \320\xbf/\xd0\277') . '</td>
            <td rowspan="' . (2 + $iWeekDaysShow) . '" style="text-align: center; width: 150px;">' . $oL->get('\xd0\xa4\320\x98\xd0\236') . '</td>
            <td rowspan="' . (2 + $iWeekDaysShow) . '" style="text-align: center; width: 150px;">' . $oL->get('\xd0\224\320\276\320\xbb\320\266\xd0\xbd\320\276\321\201\321\x82\xd1\214') . '</td>\xa            <td colspan="' . $aData['daysInMonth'] . '">' . $oL->get('\320\247\xd0\270\321\x81\320\xbb\320\260 \xd0\274\xd0\265\xd1\x81\321\x8f\321\206\xd0\260') . '</td>'; 
        $html .= '<td>' . $oL->get('8') . '</td>'; 
        foreach ($aData['integratedDoctypes'] as $aOne) { 
            if (!(substr($aOne['tag'], 0, 1) == '-' || $aOne['tag'] == '8' || substr($aOne['tag'], 0, 1) == '+')) { 
                goto Label_36918; 
            } 
            continue; 
            Label_36918: 
            $displayed++; 
            $html .= '<td class="' . $aOne['color'] . '">' . $oL->get($aOne['tag']) . '</td>'; 
        } 
        $html .= '<td class="weekend">' . $oL->get('\320\x92') . '</td>'; 
        $html .= '<td style="width:21px;" class="color_hours"></td>'; 
        $html .= '<td style="width:21px;" class="color_days"></td>'; 
        $html .= '</tr>\xa            <tr id="days"  class="title">'; 
        for ($day = 1; $day <= $aData['daysInMonth']; $day++) { 
            $oDate = new \DateTime(sprintf('%s-%s-%s', $aData['year'], $aData['month'], $day)); 
            $aWeekDays = array($oL->get('\xd0\x92\321\201'), $oL->get('\320\237\xd0\xbd'), $oL->get('\320\x92\xd1\202'), $oL->get('\xd0\xa1\321\x80'), $oL->get('\320\xa7\321\202'), $oL->get('\320\x9f\xd1\x82'), $oL->get('\320\xa1\320\xb1')); 
            $className = \app\workflow\util\Util::isweekenddate($day, $aData['month'], $aData['year']) ? 'weekend' : 'ordinary'; 
            if ($iWeekDaysShow) { 
                goto Label_36919; 
            } 
            $html .= '<td class="' . $className . '">' . $day . '</td>'; 
            goto Label_36920; 
            Label_36919: 
            $html .= '<td style="height: 21px" class="' . $className . '">' . $aWeekDays[$oDate->format('w')] . '</td>'; 
            Label_36920: 
        } 
        $html .= '<td rowspan="' . (1 + $iWeekDaysShow) . '" class="rotated_cell" ><div class="rotate_text">' . $oL->get('\xd0\x94\xd0\xbd\xd0\xb8 \xd1\204\320\xb0\xd0\272\xd1\x82\320\270\xd1\207\xd0\xb5\321\x81\xd0\272\xd0\xbe\320\xb9 \321\x80\xd0\260\320\261\320\xbe\321\202\xd1\x8b') . '</td>'; 
        foreach ($aData['integratedDoctypes'] as $aOne) { 
            if (!(substr($aOne['tag'], 0, 1) == '-' || $aOne['tag'] == '8' || substr($aOne['tag'], 0, 1) == '+')) { 
                goto Label_36921; 
            } 
            continue; 
            Label_36921: 
            $html .= '<td rowspan="' . (1 + $iWeekDaysShow) . '" class="rotated_cell ' . $aOne['color'] . '" ><div class="rotate_text">' . $oL->get($aOne['full_name']) . '</td>'; 
        } 
        $html .= '<td rowspan="' . (1 + $iWeekDaysShow) . '" class="rotated_cell weekend" ><div class="rotate_text">' . $oL->get('\xd0\222\xd1\x8b\321\205\320\276\xd0\xb4\320\xbd\xd1\x8b\xd0\xb5') . '</td>'; 
        $html .= '<td rowspan="' . (1 + $iWeekDaysShow) . '" class="rotated_cell color_hours" ><div class="rotate_text">' . $oL->get('\320\232\xd0\xbe\320\xbb-\xd0\262\xd0\276 \xd0\276\321\202\321\200\320\xb0\xd0\261\320\xbe\xd1\202 \321\207\xd0\260\xd1\x81\320\xbe\320\262') . '</td>'; 
        $html .= '<td rowspan="' . (1 + $iWeekDaysShow) . '" class="rotated_cell color_days" ><div class="rotate_text">' . $oL->get('\xd0\x98\321\x82\xd0\276\xd0\263\320\276 \xd0\272\320\xb0\xd0\xbb\xd0\265\xd0\xbd\320\xb4. \xd0\xb4\320\275\xd0\xb5\xd0\xb9') . '</td>'; 
        $html .= '</tr>'; 
        if (!$iWeekDaysShow) { 
            goto Label_36922; 
        } 
        $html .= '</tr>
                <tr id="week_days"  class="title">'; 
        for ($day = 1; $day <= $aData['daysInMonth']; $day++) { 
            $className = \app\workflow\util\Util::isweekenddate($day, $aData['month'], $aData['year']) ? 'weekend' : 'ordinary'; 
            $html .= '<td class="' . $className . '">' . $day . '</td>'; 
        } 
        $html .= '</tr>'; 
        Label_36922: 
        $selected = 'selected="selected"'; 
        foreach ($aData['structure'] as $sdvId => $sdv) { 
            $sdvTemp = $aData['varName'] . '[structure][' . $sdvId . ']'; 
            if ($isWholeTimesheet) { 
                goto Label_36923; 
            } 
            $html .= '<tr class="subtitle"><td colspan="' . ($aData['daysInMonth'] + 7 + $displayed) . '">&nbsp; ' . $sdv['name'] . '<input type="hidden" name="' . $sdvTemp . '[name]" value="' . $sdv['name'] . '"></td></tr>'; 
            Label_36923: 
            if (empty($sdv['posts'])) { 
                goto Label_36950; 
            } 
            foreach ($sdv['posts'] as $postId => $post) { 
                $html .= '<tr id="' . $postId . '" sdvId="' . $sdvId . '">'; 
                if (strlen($post['employee'])) { 
                    goto Label_36924; 
                } 
                $sWithoutLast = $sLastChar = $post['employee']; 
                goto Label_36925; 
                Label_36924: 
                $sLastChar = substr($post['employee'], -1); 
                $sWithoutLast = substr($post['employee'], 0, -1); 
                Label_36925: 
                if ($sLastChar == '0') { 
                    goto Label_36927; 
                } 
                if ($sLastChar == '1') { 
                    goto Label_36928; 
                } 
                $html .= '<td>' . '<input type="hidden" name="' . $sdvTemp . '[posts][' . $postId . '][employee]" value="' . $post['employee'] . '"/>' . '<input type="hidden" name="' . $sdvTemp . '[posts][' . $postId . '][post]" value="' . $post['post'] . '"/>' . $npp . '</td><td class="align_left">' . $post['employee'] . '</td>' . '<td class="align_left">' . $post['post'] . '</td>'; 
                goto Label_36926; 
                Label_36927: 
                $html .= '<td rowspan="2">' . '<input type="hidden" name="' . $sdvTemp . '[posts][' . $postId . '][employee]" value="' . $post['employee'] . '"/>' . '<input type="hidden" name="' . $sdvTemp . '[posts][' . $postId . '][post]" value="' . $post['post'] . '"/>' . $npp . '</td><td rowspan="2" class="align_left">' . $sWithoutLast . '</td>' . '<td class="align_left">' . $post['post'] . '</td>'; 
                goto Label_36926; 
                Label_36928: 
                $html .= '<input type="hidden" name="' . $sdvTemp . '[posts][' . $postId . '][employee]" value="' . $post['employee'] . '"/>' . '<input type="hidden" name="' . $sdvTemp . '[posts][' . $postId . '][post]" value="' . $post['post'] . '"/>'; 
                $html .= '<td class="align_left">' . $post['post'] . '</td>'; 
                $npp--; 
                Label_36926: 
                for ($day = 1; $day <= $aData['daysInMonth']; $day++) { 
                    $isWeekend = \app\workflow\util\Util::isweekenddate($day, $aData['month'], $aData['year']); 
                    $className = $isWeekend ? 'weekend' : 'ordinary'; 
                    $sName = $sdvTemp . '[posts][' . $postId . '][' . $day . ']'; 
                    $shifted = ''; 
                    if (isset($aData['shiftValues'][$sdvId][$postId]['to']) && $day < $aData['shiftValues'][$sdvId][$postId]['to']) { 
                        goto Label_36933; 
                    } 
                    if (isset($aData['shiftValues'][$sdvId][$postId]['from']) && $day >= $aData['shiftValues'][$sdvId][$postId]['from']) { 
                        goto Label_36934; 
                    } 
                    if (isset($post['shift']['to']) && $day < $post['shift']['to']) { 
                        goto Label_36935; 
                    } 
                    if (isset($post['shift']['from']) && $day >= $post['shift']['from']) { 
                        goto Label_36936; 
                    } 
                    if (isset($aData['editedValues'][$postId][$day])) { 
                        goto Label_36937; 
                    } 
                    if (isset($post[$day]) && is_array($post[$day]) && isset($post[$day]['edited'])) { 
                        goto Label_36938; 
                    } 
                    if (isset($aData['aDValues'][substr($postId, 0, 36)][$day])) { 
                        goto Label_36939; 
                    } 
                    if (isset($aData['aDTags'][mb_substr($postId, 0, 36)]['8']) || !isset($aData['isNew']) && !isset($post[$day])) { 
                        goto Label_36940; 
                    } 
                    $sSelectedValue = a($post, $day, $isWeekend ? '\320\222' : '8'); 
                    goto Label_36932; 
                    Label_36933: 
                    $sSelectedValue = ''; 
                    $className = 'merge" sdvId="' . $sdvId . '" postId="' . $postId . '" day="' . $day; 
                    $shifted = '<input type="hidden" name="' . $sdvTemp . '[posts][' . $postId . '][shift][to]" value="' . $aData['shiftValues'][$sdvId][$postId]['to'] . '"/>'; 
                    goto Label_36932; 
                    Label_36934: 
                    $sSelectedValue = ''; 
                    $className = 'merge" sdvName="' . $aData['shiftedTo'][$postId]['subdiv_to'] . '" postName="' . $aData['shiftedTo'][$postId]['post_to'] . '" sdvId="' . $sdvId . '" postId="' . $postId . '" day="' . $day; 
                    $shifted = '<input type="hidden" name="' . $sdvTemp . '[posts][' . $postId . '][shift][from]" value="' . $aData['shiftValues'][$sdvId][$postId]['from'] . '"/>'; 
                    $shifted .= '<input type="hidden" name="' . $sdvTemp . '[posts][' . $postId . '][shift][post_to]" value="' . $aData['shiftedTo'][$postId]['post_to'] . '"/>'; 
                    $shifted .= '<input type="hidden" name="' . $sdvTemp . '[posts][' . $postId . '][shift][sdv_to]" value="' . $aData['shiftedTo'][$postId]['subdiv_to'] . '"/>'; 
                    goto Label_36932; 
                    Label_36935: 
                    $sSelectedValue = ''; 
                    $className = 'merge" sdvId="' . $sdvId . '" postId="' . $postId . '" day="' . $day; 
                    $shifted = '<input type="hidden" name="' . $sdvTemp . '[posts][' . $postId . '][shift][to]" value="' . $post['shift']['to'] . '"/>'; 
                    goto Label_36932; 
                    Label_36936: 
                    $sSelectedValue = ''; 
                    $className = 'merge" sdvName="' . $post['shift']['sdv_to'] . '" postName="' . $post['shift']['post_to'] . '" sdvId="' . $sdvId . '" postId="' . $postId . '" day="' . $day; 
                    $shifted = '<input type="hidden" name="' . $sdvTemp . '[posts][' . $postId . '][shift][from]" value="' . $post['shift']['from'] . '"/>'; 
                    $shifted .= '<input type="hidden" name="' . $sdvTemp . '[posts][' . $postId . '][shift][post_to]" value="' . $post['shift']['post_to'] . '"/>'; 
                    $shifted .= '<input type="hidden" name="' . $sdvTemp . '[posts][' . $postId . '][shift][sdv_to]" value="' . $post['shift']['sdv_to'] . '"/>'; 
                    goto Label_36932; 
                    Label_36937: 
                    $sSelectedValue = $aData['editedValues'][$postId][$day]['edited']; 
                    goto Label_36932; 
                    Label_36938: 
                    $sSelectedValue = $post[$day]['edited']; 
                    goto Label_36932; 
                    Label_36939: 
                    $sSelectedValue = $aData['aDValues'][substr($postId, 0, 36)][$day]; 
                    if (!($sSelectedValue == '8' && $isWeekend)) { 
                        goto Label_36929; 
                    } 
                    $sSelectedValue = '\xd0\222'; 
                    Label_36929: 
                    if (!($sSelectedValue == '8\320\x92' && $isWeekend)) { 
                        goto Label_36930; 
                    } 
                    $sSelectedValue = '8'; 
                    $className = ''; 
                    Label_36930: 
                    if (!($sSelectedValue == '-8')) { 
                        goto Label_36931; 
                    } 
                    $sSelectedValue = ''; 
                    $className = 'merge" postId="' . $postId . '" day="' . $day; 
                    Label_36931: 
                    goto Label_36932; 
                    Label_36940: 
                    $sSelectedValue = a($post, $day, ''); 
                    $className = 'merge" postId="' . $postId . '" day="' . $day; 
                    Label_36932: 
                    if (isset($aData['colorByTag'][$sSelectedValue])) { 
                        goto Label_36942; 
                    } 
                    if ($sSelectedValue == '\xd0\232\xd0\x92' && isset($aData['colorByTag']['\xd0\x9a'])) { 
                        goto Label_36943; 
                    } 
                    goto Label_36941; 
                    Label_36942: 
                    $className = $aData['colorByTag'][$sSelectedValue]; 
                    goto Label_36941; 
                    Label_36943: 
                    $className = $aData['colorByTag']['\320\x9a']; 
                    Label_36941: 
                    if (mb_strlen($sSelectedValue) > 1) { 
                        goto Label_36945; 
                    } 
                    if (!($sSelectedValue == '\xd0\232' && $isWeekend)) { 
                        goto Label_36944; 
                    } 
                    $sSelectedValue = '\320\232\xd0\222'; 
                    Label_36944: 
                    $html .= '<td class="' . $className . '"><div class="timesheet_day"><span class="timesheet_day_value">' . $sSelectedValue . '</span>'; 
                    goto Label_36946; 
                    Label_36945: 
                    $html .= '<td class="' . $className . '"><div class="timesheet_day"><span style="padding-left: -5px; font-size:8px;" class="timesheet_day_value">' . $sSelectedValue . '</span>'; 
                    Label_36946: 
                    if (!($sSelectedValue !== '')) { 
                        goto Label_36947; 
                    } 
                    $html .= '<select name="' . $sName . '" ' . $disabled . 'class="abbr" >'; 
                    foreach ($aData['dayTypesOptions'] as $key => $value) { 
                        $html .= '<option  value="' . $key . '" ' . ($key == $sSelectedValue ? 'selected="selected"' : '') . '>' . $value . '</option>'; 
                    } 
                    $html .= '</select>'; 
                    Label_36947: 
                    if (!(isset($post[$day]) && is_array($post[$day]) && isset($post[$day]['edited']) || isset($aData['editedValues'][$postId][$day]))) { 
                        goto Label_36948; 
                    } 
                    $html .= '<input type="hidden" name="' . $sName . '[edited]" value="' . $sSelectedValue . '"/>'; 
                    Label_36948: 
                    $html .= '</div></td>'; 
                    $html .= $shifted; 
                } 
                $npp++; 
                $SummaryName = $sdvTemp . '[posts][' . $postId . ']'; 
                $html .= '<td><div><span></span><input name="' . $SummaryName . '[actual_work]" type="hidden" value=""/></div></td>'; 
                foreach ($aData['integratedDoctypes'] as $aOne) { 
                    if (!(substr($aOne['tag'], 0, 1) == '-' || $aOne['tag'] == '8' || substr($aOne['tag'], 0, 1) == '+')) { 
                        goto Label_36949; 
                    } 
                    continue; 
                    Label_36949: 
                    $sDtId = 'dt_' . $aOne['doctype'] . '_' . implode('_', array_flip(array_merge(a($aOne, 'order_type', array()), a($aOne, 'vacation_type', array()), a($aOne, 'business_trip_type', array())))); 
                    $html .= '<td class="' . $aOne['color'] . '"><div id="' . $sDtId . '"><span></span><input name="' . $SummaryName . '[' . $sDtId . ']" type="hidden" value=""/></div></td>'; 
                } 
                $html .= '<td class="weekend"><div id="weekend"><span></span><input name="' . $SummaryName . '[weekend]" type="hidden" value=""/></div></td>'; 
                $html .= '<td class="color_hours"><div id="hours"><span></span><input name="' . $SummaryName . '[hours]" type="hidden" value=""/></div></td>'; 
                $html .= '<td class="color_days"><div id="days_in_month"><span></span><input name="' . $SummaryName . '[days_in_month]" type="hidden" value=""/></div></td>'; 
                $html .= '</tr>'; 
            } 
            Label_36950: 
        } 
        $html .= '</tbody>
                 </table>'; 
        return $html; 
    } 
    public static function timesheetvar3view($aData, $sDoctypeId, $sDocumentId) 
    { 
        $oL = \app\system\Registry::get('locale'); 
        ob_start(); 
        ?> 
        <?php  
        if (!isset($aData['structure'])) { 
            goto Label_36951; 
        } 
        ?> 
            <script> 
                var oDates =  { //  
                    'year': '<?php  
        echo $aData['year']; 
        ?> 
', 
                    'month': '<?php  
        echo $aData['month']; 
        ?> 
', 
                    'monthEnd': '<?php  
        echo $aData['daysInMonth']; 
        ?> 
', 
                }; 
                $(document).ready(function(){ 
                    mergeTd(); 
                }); 
                function mergeTd(){ 
                    var mergingData = []; 
                    var mergingShift = []; 
                    var diff = 0; 
                    var prevDay = 0; 
                    var attr = undefined; 
                    $('.merge').each(function(){ 
                        if(($(this).attr('day') != prevDay + 1) || (typeof $(this).attr('sdvId') !== typeof undefined && typeof attr !== typeof undefined && attr !== false && attr != $(this).attr('sdvId'))){ 
                            console.log('yes'); 
                            diff++; 
                        } 
                        if(typeof  mergingData[$(this).attr('postid')+diff] == 'undefined'){ 
                            console.log('yeah'); 
                            mergingData[$(this).attr('postid')+diff] = []; 
                        } 
                        mergingData[$(this).attr('postid')+diff][$(this).attr('day')] = $(this); 
 
                        attr = $(this).attr('sdvId'); 
                        if (typeof attr !== typeof undefined && attr !== false) { 
                            if(typeof  mergingShift[$(this).attr('postid')+diff] == 'undefined'){ 
                                mergingShift[$(this).attr('postid')+diff] = []; 
                            } 
                            mergingShift[$(this).attr('postid')+diff][$(this).attr('day')] = true; 
                        } 
                        prevDay = parseInt($(this).attr('day')); 
                    }); 
 
                    for(var postID in mergingData){ 
                        //console.log(postID+' '+ count(mergingData[postID])); 
                        var colspan = count(mergingData[postID]); 
                        var isFirst = true; 
                        for(var day in mergingData[postID]){ 
                            if(isFirst){ 
                                mergingData[postID][day].attr('colspan', colspan); 
                                if(colspan != oDates.monthEnd){ 
                                    if(typeof mergingShift[postID] !== typeof undefined && mergingShift[postID][day] && day == 1){ 
                                        mergingData[postID][day].html('<div title='  '+mergingData[postID].length+'.'+oDates.month+'.'+oDates.year+'.' style='overflow-x:hidden; white-space: nowrap;'>  '+mergingData[postID].length+'.'+oDates.month+'.'+oDates.year+'.</div>'); 
                                    } else if(typeof mergingShift[postID] !== typeof undefined && mergingShift[postID][day] && day != 1){ 
                                        mergingData[postID][day].html('<div title='   '+mergingData[postID][day].attr('postName')+'   '+mergingData[postID][day].attr('sdvName')+'' style='overflow-x:hidden; white-space: nowrap;'>: '+mergingData[postID][day].attr('postName')+', '+mergingData[postID][day].attr('sdvName')+'</div>'); 
                                    } else if(day == '1'){ 
                                        mergingData[postID][day].html('<div title=' '+mergingData[postID].length+'.'+oDates.month+'.'+oDates.year+'.' style='overflow-x:hidden; white-space: nowrap;'> '+mergingData[postID].length+'.'+oDates.month+'.'+oDates.year+'.</div>'); 
                                    } else { 
                                        //    -2195/19  20.02.2019 15:01 
                                        //mergingData[postID][day].html('<div title=' '+day+'.'+oDates.month+'.'+oDates.year+'.' style='overflow-x:hidden; white-space: nowrap;'> '+day+'.'+oDates.month+'.'+oDates.year+'.</div>'); 
                                        var oD = new Date(oDates.year,oDates.month,day); 
                                        oD.setDate(oD.getDate() - 1); 
                                        var sD = oD.getDate()+'.'+oD.getMonth()+'.'+oD.getFullYear(); 
                                        mergingData[postID][day].html('<div title=' '+sD+'.' style='overflow-x:hidden; white-space: nowrap;'> '+sD+'.</div>'); 
                                    } 
                                } 
                                isFirst = false; 
                            } else { 
                                mergingData[postID][day].remove(); 
                            } 
                        } 
                    } 
                } 
            </script> 
            <div class='variable variable_timesheet'> 
                <input type='button' value='<?php  
        echo $oL->get('\xd0\255\320\xba\321\x81\320\xbf\xd0\xbe\321\x80\321\x82 \xd0\xb2 Excel'); 
        ?> 
' onclick='msf.page.go('/workflow/document/export-variable/<?php  
        echo $sDoctypeId; 
        ?> 
/<?php  
        echo $sDocumentId; 
        ?> 
/<?php  
        echo $aData['varName']; 
        ?> 
');' /> 
                <div id='timesheet-table<?php  
        echo $aData['varType']; 
        ?> 
' style='padding-top: 5px;'> 
                    <?php  
        echo \app\workflow\WFW::timesheetvar3tableview($aData); 
        ?> 
                </div> 
                <!--[if IE]> 
                <style type='text/css'> 
                    .rotated_cell 
                    { 
                        text-align: left; 
                        padding-bottom: 10px; 
                    } 
 
                    .rotate_text 
                    { 
                        -ms-writing-mode: bt-rl; 
                        filter: flipH() flipV(); 
                        top: 0px; 
                    } 
                </style> 
                <![endif]--> 
            </div> 
        <?php  
        Label_36951: 
        ?> 
        <?php  
        $s = ob_get_clean(); 
        return $s; 
    } 
    public static function timesheetvar3tableview($aData) 
    { 
        $displayed = 0; 
        $isWholeTimesheet = $aData['varType'] == 'whole_timesheet3' ? true : false; 
        if (isset($aData['structure'])) { 
            goto Label_36976; 
        } 
        return ''; 
        goto Label_36977; 
        Label_36976: 
        $oL = \app\system\Registry::get('locale'); 
        $npp = 1; 
        $iWeekDaysShow = a($aData, 'weekDaysShow', 0); 
        $html = '\xa                <table border="1" cellspacing="0" cellpadding="0" class="variable_table" >
                <tbody>
                <tr class="title">\xa                <td rowspan="' . (2 + $iWeekDaysShow) . '" style="text-align: center; width: 20px;">' . $oL->get('\342\x84\226 \xd0\277/\320\277') . '</td>
                <td rowspan="' . (2 + $iWeekDaysShow) . '" style="text-align: center; width: 150px;">' . $oL->get('\xd0\xa4\320\x98\320\236') . '</td>
                <td rowspan="' . (2 + $iWeekDaysShow) . '" style="text-align: center; width: 150px;">' . $oL->get('\xd0\224\xd0\276\320\xbb\xd0\xb6\xd0\275\xd0\xbe\321\x81\xd1\x82\321\x8c') . '</td>\xa                <td colspan="' . $aData['daysInMonth'] . '">' . $oL->get('\xd0\247\xd0\270\321\x81\xd0\xbb\xd0\xb0 \xd0\274\xd0\xb5\xd1\201\xd1\x8f\321\206\320\xb0') . '</td>'; 
        $html .= '<td>' . $oL->get('8') . '</td>'; 
        foreach ($aData['integratedDoctypes'] as $aOne) { 
            if (!(substr($aOne['tag'], 0, 1) == '-' || $aOne['tag'] == '8' || substr($aOne['tag'], 0, 1) == '+')) { 
                goto Label_36952; 
            } 
            continue; 
            Label_36952: 
            $displayed++; 
            $html .= '<td class="' . $aOne['color'] . '">' . $oL->get($aOne['tag']) . '</td>'; 
        } 
        $html .= '<td class="weekend">' . $oL->get('\xd0\x92') . '</td>'; 
        $html .= '<td style="width:21px" class="color_hours"></td>'; 
        $html .= '<td style="width:21px;" class="color_days"></td>'; 
        $html .= '</tr>
                <tr class="title">'; 
        for ($day = 1; $day <= $aData['daysInMonth']; $day++) { 
            $oDate = new \DateTime(sprintf('%s-%s-%s', $aData['year'], $aData['month'], $day)); 
            $aWeekDays = array($oL->get('\320\x92\321\x81'), $oL->get('\320\237\320\275'), $oL->get('\xd0\222\xd1\202'), $oL->get('\xd0\xa1\xd1\x80'), $oL->get('\xd0\xa7\xd1\x82'), $oL->get('\xd0\237\xd1\202'), $oL->get('\xd0\241\320\261')); 
            $className = \app\workflow\util\Util::isweekenddate($day, $aData['month'], $aData['year']) ? 'weekend' : 'ordinary'; 
            if ($iWeekDaysShow) { 
                goto Label_36953; 
            } 
            $html .= '<td class="' . $className . '">' . $day . '</td>'; 
            goto Label_36954; 
            Label_36953: 
            $html .= '<td style="height: 21px" class="' . $className . '">' . $aWeekDays[$oDate->format('w')] . '</td>'; 
            Label_36954: 
        } 
        $html .= '<td rowspan="' . (1 + $iWeekDaysShow) . '" class="rotated_cell" ><div class="rotate_text">' . $oL->get('\xd0\x94\320\xbd\320\270 \xd1\204\320\xb0\xd0\xba\321\x82\xd0\270\321\207\xd0\xb5\xd1\201\320\272\xd0\xbe\320\271 \xd1\200\320\260\xd0\xb1\320\276\xd1\x82\xd1\x8b') . '</td>'; 
        foreach ($aData['integratedDoctypes'] as $aOne) { 
            if (!(substr($aOne['tag'], 0, 1) == '-' || $aOne['tag'] == '8' || substr($aOne['tag'], 0, 1) == '+')) { 
                goto Label_36955; 
            } 
            continue; 
            Label_36955: 
            $html .= '<td rowspan="' . (1 + $iWeekDaysShow) . '" class="rotated_cell ' . $aOne['color'] . '" ><div class="rotate_text">' . $oL->get($aOne['full_name']) . '</td>'; 
        } 
        $html .= '<td rowspan="' . (1 + $iWeekDaysShow) . '" class="rotated_cell weekend" ><div class="rotate_text">' . $oL->get('\320\x92\xd1\213\xd1\205\320\276\xd0\xb4\xd0\275\321\213\xd0\xb5') . '</td>'; 
        $html .= '<td rowspan="' . (1 + $iWeekDaysShow) . '" class="rotated_cell color_hours" ><div class="rotate_text">' . $oL->get('\320\232\xd0\xbe\xd0\273-\xd0\xb2\xd0\xbe \320\276\xd1\x82\321\200\xd0\260\320\261\xd0\276\321\x82 \321\207\xd0\xb0\xd1\201\320\xbe\xd0\xb2') . '</td>'; 
        $html .= '<td rowspan="' . (1 + $iWeekDaysShow) . '" class="rotated_cell color_days" ><div class="rotate_text">' . $oL->get('\xd0\230\321\x82\xd0\276\xd0\xb3\320\276 \xd0\xba\320\260\xd0\xbb\320\265\xd0\275\320\264. \xd0\xb4\xd0\xbd\320\xb5\xd0\271') . '</td>'; 
        $html .= '</tr>'; 
        if (!$iWeekDaysShow) { 
            goto Label_36956; 
        } 
        $html .= '</tr>\xa                    <tr id="week_days"  class="title">'; 
        for ($day = 1; $day <= $aData['daysInMonth']; $day++) { 
            $className = \app\workflow\util\Util::isweekenddate($day, $aData['month'], $aData['year']) ? 'weekend' : 'ordinary'; 
            $html .= '<td class="' . $className . '">' . $day . '</td>'; 
        } 
        $html .= '</tr>'; 
        Label_36956: 
        $selected = 'selected="selected"'; 
        foreach ($aData['structure'] as $sdvId => $sdv) { 
            $sdvTemp = $aData['varName'] . '[structure][' . $sdvId . ']'; 
            if ($isWholeTimesheet) { 
                goto Label_36957; 
            } 
            $html .= '<tr><td colspan="' . ($aData['daysInMonth'] + 7 + $displayed) . '">&nbsp; ' . v($sdv['name']) . '</td></tr>'; 
            Label_36957: 
            if (empty($sdv['posts'])) { 
                goto Label_36975; 
            } 
            foreach ($sdv['posts'] as $postId => $post) { 
                $html .= '<tr id="' . $postId . '">'; 
                if (strlen($post['employee'])) { 
                    goto Label_36958; 
                } 
                $sWithoutLast = $sLastChar = $post['employee']; 
                goto Label_36959; 
                Label_36958: 
                $sLastChar = substr($post['employee'], -1); 
                $sWithoutLast = substr($post['employee'], 0, -1); 
                Label_36959: 
                if ($sLastChar == '0') { 
                    goto Label_36961; 
                } 
                if ($sLastChar == '1') { 
                    goto Label_36962; 
                } 
                $html .= '<td>' . $npp . '</td><td class="align_left">' . v($post['employee']) . '</td>' . '<td class="align_left">' . v($post['post']) . '</td>'; 
                goto Label_36960; 
                Label_36961: 
                $html .= '<td rowspan="2">' . $npp . '</td><td rowspan="2" class="align_left">' . v($sWithoutLast) . '</td>' . '<td class="align_left">' . v($post['post']) . '</td>'; 
                goto Label_36960; 
                Label_36962: 
                $html .= '<td class="align_left">' . v($post['post']) . '</td>'; 
                $npp--; 
                Label_36960: 
                for ($day = 1; $day <= $aData['daysInMonth']; $day++) { 
                    $isWeekend = \app\workflow\util\Util::isweekenddate($day, $aData['month'], $aData['year']); 
                    $flag = false; 
                    if (isset($post[$day])) { 
                        goto Label_36963; 
                    } 
                    $post[$day] = ''; 
                    $flag = true; 
                    Label_36963: 
                    if (!(is_array($post[$day]) && isset($post[$day]['edited']))) { 
                        goto Label_36964; 
                    } 
                    $post[$day] = $post[$day]['edited']; 
                    Label_36964: 
                    if (isset($post['shift']['to']) && $day < $post['shift']['to']) { 
                        goto Label_36966; 
                    } 
                    if (isset($post['shift']['from']) && $day >= $post['shift']['from']) { 
                        goto Label_36967; 
                    } 
                    if (isset($aData['colorByTag'][$post[$day]])) { 
                        goto Label_36968; 
                    } 
                    if ($post[$day] == '\320\x9a\320\222' && isset($aData['colorByTag']['\xd0\x9a'])) { 
                        goto Label_36969; 
                    } 
                    if ($flag) { 
                        goto Label_36970; 
                    } 
                    $className = $isWeekend ? 'weekend' : 'ordinary'; 
                    goto Label_36965; 
                    Label_36966: 
                    $className = 'merge" sdvId="' . $sdvId . '" postId="' . $postId . '" day="' . $day; 
                    goto Label_36965; 
                    Label_36967: 
                    $className = 'merge" sdvName="' . $post['shift']['sdv_to'] . '" postName="' . $post['shift']['post_to'] . '" sdvId="' . $sdvId . '" postId="' . $postId . '" day="' . $day; 
                    goto Label_36965; 
                    Label_36968: 
                    $className = $aData['colorByTag'][$post[$day]]; 
                    goto Label_36965; 
                    Label_36969: 
                    $className = $aData['colorByTag']['\xd0\232']; 
                    goto Label_36965; 
                    Label_36970: 
                    $className = 'merge" postid="' . $postId . '" day="' . $day; 
                    Label_36965: 
                    if (mb_strlen($post[$day]) > 1) { 
                        goto Label_36971; 
                    } 
                    $html .= '<td class="' . $className . '">'; 
                    $html .= $post[$day]; 
                    goto Label_36972; 
                    Label_36971: 
                    $html .= '<td style="padding-left: -5px; font-size:8px;" class="' . $className . '">'; 
                    $html .= $post[$day]; 
                    Label_36972: 
                    $html .= '</td>'; 
                } 
                $npp++; 
                $html .= '<td>' . $post['actual_work'] . '</td>'; 
                foreach ($aData['integratedDoctypes'] as $aOne) { 
                    if (!(substr($aOne['tag'], 0, 1) == '-' || $aOne['tag'] == '8' || substr($aOne['tag'], 0, 1) == '+')) { 
                        goto Label_36973; 
                    } 
                    continue; 
                    Label_36973: 
                    $sDtId = 'dt_' . $aOne['doctype'] . '_' . implode('_', array_flip(array_merge(a($aOne, 'order_type', array()), a($aOne, 'vacation_type', array()), a($aOne, 'business_trip_type', array())))); 
                    if (!isset($post[$sDtId])) { 
                        goto Label_36974; 
                    } 
                    $html .= '<td class="' . $aOne['color'] . '">' . $post[$sDtId] . '</td>'; 
                    Label_36974: 
                } 
                $html .= '<td class="weekend">' . $post['weekend'] . '</td>'; 
                $html .= '<td class="color_hours">' . $post['hours'] . '</td>'; 
                $html .= '<td class="color_days">' . $post['days_in_month'] . '</td>'; 
                $html .= '</tr>'; 
            } 
            Label_36975: 
        } 
        $html .= '</tbody>
                     </table>'; 
        return $html; 
        Label_36977: 
    } 
    public static function holidaysvaredit($aData, $sDoctypeId, $sDocumentId, $mode = 'create') 
    { 
        $oL = \app\system\Registry::get('locale'); 
        ob_start(); 
        ?> 
        <script type='text/javascript'> 
 
            function isValid(obj) 
            { 
                for (var prop in obj) 
                { 
                    if(!$('[name*=''+obj[prop]+'']').length) 
                    { 
                        ShowErrorMessage('<?php  
        echo $oL->get('\320\237\321\200\xd0\xbe\xd0\262\320\265\321\x80\321\x8c\xd1\202\xd0\265 \320\275\320\260\xd0\273\xd0\xb8\xd1\207\xd0\xb8\xd0\xb5 \320\xb2\xd1\201\320\265\321\205 \320\xbf\xd0\xbe\320\273\320\xb5\xd0\xb9 \321\x88\320\260\xd0\261\xd0\xbb\xd0\xbe\xd0\275\xd0\265 \320\264\xd0\xbe\xd0\xba\xd1\203\xd0\xbc\320\265\xd0\xbd\xd1\202\320\xb0'); 
        ?> 
'); 
                        return  false; 
                    } 
                } 
 
                return true; 
            } 
 
            function ShowErrorMessage(t) 
            { 
                MSF_StatusBar.hideWait(); 
                $('#results').show().children('#error').append('<div class='status_error' id='statusErrorItem_0'>'+t+'<br /></div>').show(); 
                setTimeout(function() { 
                    $('#statusErrorItem_0').hide(); 
                    $('#statusErrorItem_0').remove(); 
                    if($('#error').html().trim() == '') { 
                        $('#error').hide(); 
                    } 
                }, 5000); 
            }; 
 
            $(document).ready(function(){ 
 
                var oConfig =  { //  
                    'subdivision': '<?php  
        echo $aData['var']['subdivision']; 
        ?> 
', 
                    'year': '<?php  
        echo $aData['var']['year']; 
        ?> 
' 
                }; 
 
                var tableExists = false; 
                /* */ 
                $('#bGenerate<?php  
        echo $aData['varType']; 
        ?> 
').click(function() 
                { 
                    if(!isValid(oConfig)) 
                        return; 
 
                    if(tableExists) 
                    { 
                        if (!confirm('<?php  
        echo $oL->get('\320\222\321\213 \xd1\203\320\262\320\265\xd1\200\xd0\xb5\xd0\275\xd1\x8b, \xd1\207\321\202\320\xbe \xd1\x85\320\276\321\202\320\xb8\xd1\202\xd0\xb5 \321\201\xd0\276\320\xb7\320\264\320\260\xd1\x82\321\x8c \xd0\275\xd0\276\xd0\262\xd1\x83\xd1\x8e \321\202\320\xb0\320\xb1\xd0\xbb\320\270\321\x86\321\203, \321\x83\320\264\320\260\xd0\xbb\xd0\xb8\xd0\xb2 \321\201\321\202\320\260\xd1\x80\321\203\321\x8e?'); 
        ?> 
')) 
                        { 
                            return; 
                        } 
                    } 
 
                    request = $.ajax( 
                        { 
                            type:		'POST', 
                            url:		'/workflow/document/<?php  
        echo str_replace('_', '-', $aData['varType']); 
        ?> 
/<?php  
        echo $sDoctypeId; 
        ?> 
/<?php  
        echo $sDocumentId; 
        ?> 
/<?php  
        echo $aData['var']['name']; 
        ?> 
', 
                            data:		$('#createRowForm').serialize(), 
                            dataType: 'json', 
                            success: function(oData) 
                            { 
                                if(array_key_exists('error', oData)) 
                                { 
                                    ShowErrorMessage(oData.error); 
                                } 
                                else 
                                { 
                                    $('#timesheet-table<?php  
        echo $aData['varType']; 
        ?> 
').html(oData.html); 
 
                                } 
                            }, 
                            error:function(data) 
                            { 
                                ShowErrorMessage('<?php  
        echo $oL->get('\xd0\237\xd1\200\xd0\276\xd0\270\xd0\267\320\xbe\xd1\x88\xd0\xbb\xd0\xb0 \320\xbe\321\210\xd0\270\320\261\320\xba\xd0\xb0 \320\xb2\xd0\276 \320\xb2\321\200\xd0\xb5\320\xbc\xd1\217 \320\267\xd0\260\xd0\xbf\321\x80\320\xbe\321\201\xd0\xb0.'); 
        ?> 
'); 
                            } 
                        }); 
 
                }); 
 
 
            }); 
        </script> 
        <div class='variable variable_holidays'> 
            <input id='bGenerate<?php  
        echo $aData['varType']; 
        ?> 
' type='button' value='<?php  
        echo $oL->get('\xd0\xa1\320\xb3\320\265\xd0\xbd\xd0\xb5\321\200\xd0\xb8\xd1\x80\320\276\xd0\262\320\260\321\202\xd1\x8c'); 
        ?> 
' class='btn btn-sm btn-raised btn-default' /> 
            <div id='timesheet-table<?php  
        echo $aData['varType']; 
        ?> 
' style='padding-top: 5px;'> 
                <?php  
        if (!($mode == 'edit')) { 
            goto Label_36978; 
        } 
        ?> 
                    <?php  
        echo \app\workflow\WFW::holidaysvartable($aData); 
        ?> 
                <?php  
        Label_36978: 
        ?> 
            </div> 
            <!--[if IE]> 
            <style type='text/css'> 
                .rotated_cell 
                { 
                    text-align: left; 
                    padding-bottom: 10px; 
                } 
 
                .rotate_text 
                { 
                    -ms-writing-mode: bt-rl; 
                    filter: flipH() flipV(); 
                    top: 0px; 
                } 
            </style> 
            <![endif]--> 
        </div> 
        <?php  
        $s = ob_get_clean(); 
        return $s; 
    } 
    public static function holidaysvartable($aData) 
    { 
        $oL = \app\system\Registry::get('locale'); 
        $npp = 1; 
        $html = '<input type="hidden" name="' . $aData['varName'] . '[year]" value="' . $aData['year'] . '"/>' . '\xa            <table border="1" cellspacing="0" cellpadding="0" class="variable_table" >
            <tbody>\xa            <tr class="title">\xa            <td rowspan="2" style="text-align: center; width: 20px;">' . $oL->get('\342\x84\226 \xd0\xbf/\xd0\277') . '</td>\xa            <td rowspan="2" style="text-align: center; width: 150px;">' . $oL->get('\320\244\320\230\320\236') . '</td>
            <td rowspan="2" style="text-align: center; width: 150px;">' . $oL->get('\320\x94\xd0\276\xd0\273\xd0\xb6\320\xbd\320\276\321\x81\xd1\202\321\214') . '</td>
            <td colspan="12">' . $oL->get('\xd0\x9c\xd0\265\xd1\201\xd1\x8f\xd1\x86\321\213') . '</td>\xa            </tr>\xa            <tr class="title">'; 
        foreach ($aData['monthOptions'] as $monthId => $monthName) { 
            $html .= '<td class="rotated_cell"><div class="rotate_text">' . $monthName . '</div></td>'; 
        } 
        foreach ($aData['structure'] as $sdvId => $sdv) { 
            $sdvTemp = $aData['varName'] . '[structure][' . $sdvId . ']'; 
            $html .= '<tr><td colspan="' . 15 . '">' . v($sdv['name']) . '<input type="hidden" name="' . $sdvTemp . '[name]" value="' . v($sdv['name']) . '"></td></tr>'; 
            foreach ($sdv['posts'] as $postId => $post) { 
                $html .= '<tr id="' . $postId . '">'; 
                $html .= '<td>' . '<input type="hidden" name="' . $sdvTemp . '[posts][' . $postId . '][employee]" value="' . $post['employee'] . '"/>' . '<input type="hidden" name="' . $sdvTemp . '[posts][' . $postId . '][post]" value="' . $post['post'] . '"/>' . $npp . '</td><td class="align_left">' . $post['employee'] . '</td>' . '<td class="align_left">' . $post['post'] . '</td>'; 
                foreach ($aData['monthOptions'] as $monthId => $monthName) { 
                    $oDt = new \DateTime(sprintf('%04d-%02d-%02d', $aData['year'], $monthId, 1)); 
                    $sName = $sdvTemp . '[posts][' . $postId . '][' . $monthId . ']'; 
                    $html .= '<td>'; 
                    if (!empty($post[$monthId])) { 
                        goto Label_36979; 
                    } 
                    $html .= \app\reference\REF::dateedit($sName . '[from]', '', array('min_date' => $oDt->format('Y-m-d'), 'max_date' => $oDt->format('Y-m-t'), 'container' => 'from_' . $monthId . substr($postId, 0, 8))) . '<br />' . \app\reference\REF::dateedit($sName . '[to]', '', array('min_date' => $oDt->format('Y-m-d'), 'max_date' => $oDt->format('Y-m-t'), 'container' => 'to_' . $monthId . substr($postId, 0, 8))); 
                    goto Label_36980; 
                    Label_36979: 
                    $html .= \app\reference\REF::dateedit($sName . '[from]', $post[$monthId]['from'], array('min_date' => $oDt->format('Y-m-d'), 'max_date' => $oDt->format('Y-m-t'), 'container' => 'from_' . $monthId . substr($postId, 0, 8))) . '<br />' . \app\reference\REF::dateedit($sName . '[to]', $post[$monthId]['to'], array('min_date' => $oDt->format('Y-m-d'), 'max_date' => $oDt->format('Y-m-t'), 'container' => 'to_' . $monthId . substr($postId, 0, 8))); 
                     
                    Label_36980: 
                    $html .= '</td>'; 
                } 
                $npp++; 
            } 
        } 
        $html .= '</tbody>\xa                 </table>'; 
        return $html; 
    } 
    public static function holidaysvarview($aData, $sDoctypeId, $sDocumentId, $isAjaxRequest = false) 
    { 
        $oL = \app\system\Registry::get('locale'); 
        ob_start(); 
        ?> 
        <?php  
        if (!isset($aData['structure'])) { 
            goto Label_36981; 
        } 
        ?> 
        <div class='variable variable_holidays'> 
            <input type='button' value='<?php  
        echo $oL->get('\xd0\xad\320\272\321\201\xd0\277\xd0\276\xd1\x80\xd1\x82 \xd0\262 Excel'); 
        ?> 
' onclick='msf.page.go('/workflow/document/export-variable/<?php  
        echo $sDoctypeId; 
        ?> 
/<?php  
        echo $sDocumentId; 
        ?> 
/<?php  
        echo $aData['varName']; 
        ?> 
');' /> 
            <div style='padding-top: 5px;'> 
                <?php  
        echo \app\workflow\WFW::holidaysvartableview($aData); 
        ?> 
            </div> 
            <!--[if IE]> 
            <style type='text/css'> 
                .rotated_cell 
                { 
                    text-align: left; 
                    padding-bottom: 10px; 
                } 
 
                .rotate_text 
                { 
                    -ms-writing-mode: bt-rl; 
                    filter: flipH() flipV(); 
                    top: 0px; 
                } 
            </style> 
            <![endif]--> 
        </div> 
    <?php  
        Label_36981: 
        ?> 
        <?php  
        $s = ob_get_clean(); 
        return $s; 
    } 
    public static function timesheetvartableview($aData) 
    { 
        if (isset($aData['structure'])) { 
            goto Label_36984; 
        } 
        return ''; 
        goto Label_36985; 
        Label_36984: 
        $oL = \app\system\Registry::get('locale'); 
        $npp = 1; 
        $html = '\xa                <table border="1" cellspacing="0" cellpadding="0" class="variable_table" >\xa                <tbody>\xa                <tr class="title">\xa                <td rowspan="2" style="text-align: center; width: 20px;">' . $oL->get('\xe2\204\x96 \xd0\xbf/\320\277') . '</td>\xa                <td rowspan="2" style="text-align: center; width: 150px;">' . $oL->get('\xd0\xa4\xd0\x98\xd0\236') . '</td>
                <td rowspan="2" style="text-align: center; width: 150px;">' . $oL->get('\xd0\x94\320\xbe\320\273\xd0\266\320\275\xd0\276\321\201\xd1\x82\xd1\214') . '</td>\xa                <td colspan="' . $aData['daysInMonth'] . '">' . $oL->get('\xd0\247\320\xb8\xd1\201\xd0\xbb\xd0\260 \320\xbc\xd0\265\321\x81\xd1\x8f\321\x86\xd0\xb0') . '</td>\xa                <td>' . $oL->get('8') . '</td>
                <td width="20">' . $oL->get('8\320\x9a') . '</td>\xa                <td>' . $oL->get('A') . '</td>\xa                <td>' . $oL->get('\320\x91') . '</td>
                <td>' . $oL->get('\320\235') . '</td>\xa                <td width="20">' . $oL->get('\xd0\221/\xd0\241') . '</td>\xa                <td>' . $oL->get('\320\x9e') . '</td>
                <td width="20">' . $oL->get('\xd0\222\xd0\237') . '</td>
                <td width="20">' . $oL->get('8\320\222') . '</td>\xa                <td width="20">' . $oL->get('\320\236\320\x9e') . '</td>
                <td>' . $oL->get('\320\x92') . '</td>\xa                </tr>
                <tr class="title">'; 
        for ($day = 1; $day <= $aData['daysInMonth']; $day++) { 
            $className = \app\workflow\util\Util::isweekenddate($day, $aData['month'], $aData['year']) ? 'weekend' : 'ordinary'; 
            $html .= '<td class="' . $className . '">' . $day . '</td>'; 
        } 
        $html .= '<td class="rotated_cell" ><div class="rotate_text">' . $oL->get('\320\224\320\xbd\320\270 \321\x8f\xd0\xb2\320\xbe\320\xba') . '</td>\xa                <td class="rotated_cell" ><div class="rotate_text">' . $oL->get('\xd0\232\xd0\xbe\320\xbc\320\xb0\320\275\xd0\xb4\320\xb8\321\x80\320\276\320\xb2\xd0\272\xd0\260') . '</td>
                <td class="rotated_cell" ><div class="rotate_text">' . $oL->get('\xd0\x9d\xd0\xb5\321\x8f\xd0\262\320\272\xd0\260 \xd1\x81 \xd1\200\320\xb0\xd0\267\xd1\x80\320\265\xd1\210\xd0\265\320\275\320\xb8\321\217 \xd0\x90\xd0\264\xd0\274\320\270\xd0\xbd\xd0\270\xd1\201\321\202\xd1\200\320\xb0\321\x86\320\xb8\xd0\270') . '</td>
                <td class="rotated_cell" ><div class="rotate_text">' . $oL->get('\xd0\235\320\265\xd1\202\xd1\x80\321\203\xd0\xb4\xd0\xbe\321\x81\320\xbf\xd0\276\xd1\x81\xd0\xbe\320\xb1\320\xbd\xd0\xbe\xd1\x81\xd1\x82\xd1\x8c') . '</td>
                <td class="rotated_cell" ><div class="rotate_text">' . $oL->get('\320\237\xd0\240\320\x9e\xd0\223\320\xa3\320\233') . '</td>\xa                <td class="rotated_cell" ><div class="rotate_text">' . $oL->get('\xd0\x9e\xd1\x82\xd0\xbf\xd1\x83\321\201\320\272 \320\xb1\xd0\xb5\xd0\xb7 \321\201\320\276\xd1\x85\xd1\200\320\260\xd0\xbd\xd0\xb5\320\275\320\xb8\321\x8f \320\267/\320\xbf\320\273\320\260\xd1\x82\321\213') . '</td>
                <td class="rotated_cell" ><div class="rotate_text">' . $oL->get('\xd0\236\xd1\207\320\xb5\321\200\320\265\xd0\xb4\xd0\275\xd0\276\320\xb9 \xd1\202\xd1\x80\xd1\x83\xd0\264\xd0\xbe\320\xb2\320\276\320\271 \320\276\xd1\202\xd0\277\321\x83\xd1\201\320\xba') . '</td>\xa                <td class="rotated_cell" ><div class="rotate_text">' . $oL->get('\xd0\x92\321\200\320\265\320\xbc\320\xb5\xd0\275\320\xbd\xd1\213\xd0\271 \320\277\321\200\320\xbe\xd1\x81\321\x82\xd0\276\320\271') . '</td>\xa                <td class="rotated_cell" ><div class="rotate_text">' . $oL->get('\320\xa0\320\260\xd0\261\320\xbe\xd1\202\xd0\xb0 \320\xb2 \320\262\xd1\213\xd1\x85\xd0\276\320\264\320\275\xd1\213\xd0\265 \xd0\264\320\275\xd0\270') . '</td>
                <td class="rotated_cell" ><div class="rotate_text">' . $oL->get('\xd0\236\xd1\202\320\277\321\203\xd1\201\320\272 \xd0\277\xd0\276 \xd0\xbe\xd0\xb1\321\x83\xd1\207\xd0\265\320\275\320\xb8\xd1\x8e') . '</td>
                <td class="rotated_cell" ><div class="rotate_text">' . $oL->get('\xd0\x92\321\213\321\205\320\xbe\320\xb4\xd0\xbd\321\x8b\xd0\xb5 \xd0\xb8 \320\277\321\200\xd0\xb0\xd0\267\320\xb4\xd0\xbd\xd0\xb8\321\x87\320\275\xd1\x8b\320\265 \320\264\320\275\320\270') . '</td>\xa                </tr>'; 
        $selected = 'selected="selected"'; 
        foreach ($aData['structure'] as $sdvId => $sdv) { 
            $sdvTemp = $aData['varName'] . '[structure][' . $sdvId . ']'; 
            $html .= '<tr><td colspan="' . ($aData['daysInMonth'] + 14) . '">&nbsp; ' . v($sdv['name']) . '</td></tr>'; 
            foreach ($sdv['posts'] as $postId => $post) { 
                $html .= '<tr id="' . $postId . '">'; 
                $html .= '<td>' . $npp . '</td><td class="align_left">' . v($post['employee']) . '</td>' . '<td class="align_left">' . v($post['post']) . '</td>'; 
                for ($day = 1; $day <= $aData['daysInMonth']; $day++) { 
                    $isWeekend = \app\workflow\util\Util::isweekenddate($day, $aData['month'], $aData['year']); 
                    $className = $isWeekend ? 'weekend' : 'ordinary'; 
                    if (mb_strlen($post[$day]) > 1) { 
                        goto Label_36982; 
                    } 
                    $html .= '<td class="' . $className . '">'; 
                    $html .= $post[$day]; 
                    goto Label_36983; 
                    Label_36982: 
                    $html .= '<td style="padding-left: -5px; font-size:8px;" class="' . $className . '">'; 
                    $html .= $post[$day]; 
                    Label_36983: 
                    $html .= '</td>'; 
                } 
                $npp++; 
                $html .= '<td>' . $post['actual_work'] . '</td>\xa                                <td>' . $post['off_travel'] . '</td>\xa                                <td>' . $post['permision_fail'] . '</td>
                                <td>' . (!empty($post['disability']) ? $post['disability'] : '') . '</td>
                                <td>' . (!empty($post['truancy']) ? $post['truancy'] : '') . '</td>\xa                                <td>' . (!empty($post['holiday_without_wages']) ? $post['holiday_without_wages'] : '') . '</td>\xa                                <td>' . (!empty($post['next_holiday']) ? $post['next_holiday'] : '') . '</td>\xa                                <td>' . (!empty($post['temporary_stay']) ? $post['temporary_stay'] : '') . '</td>\xa                                <td>' . (!empty($post['wokr_in_holydays']) ? $post['wokr_in_holydays'] : '') . '</td>\xa                                <td>' . (!empty($post['study_holiday']) ? $post['study_holiday'] : '') . '</td>
                                <td>' . (!empty($post['weekends']) ? $post['weekends'] : '') . '</td>\xa                               </tr>'; 
            } 
        } 
        $html .= '</tbody>\xa                     </table>'; 
        return $html; 
        Label_36985: 
    } 
    public static function holidaysvartableview($aData) 
    { 
        if (isset($aData['structure'])) { 
            goto Label_36990; 
        } 
        return ''; 
        goto Label_36991; 
        Label_36990: 
        $oL = \app\system\Registry::get('locale'); 
        $npp = 1; 
        $html = '<input type="hidden" name="' . $aData['varName'] . '[year]" value="' . $aData['year'] . '"/>' . '
                <table border="1" cellspacing="0" cellpadding="0" class="variable_table" >
                <tbody>\xa                <tr class="title">
                <td rowspan="2" style="text-align: center; width: 20px;">' . $oL->get('\xe2\204\x96 \xd0\xbf/\320\xbf') . '</td>\xa                <td rowspan="2" style="text-align: center; width: 150px;">' . $oL->get('\xd0\xa4\320\x98\320\x9e') . '</td>\xa                <td rowspan="2" style="text-align: center; width: 150px;">' . $oL->get('\320\224\xd0\276\320\273\xd0\266\xd0\xbd\xd0\xbe\xd1\201\xd1\x82\321\x8c') . '</td>\xa                <td colspan="24">' . $oL->get('\320\234\xd0\xb5\xd1\201\321\x8f\321\x86\321\x8b') . '</td>
                </tr>
                <tr class="title">'; 
        foreach ($aData['monthOptions'] as $monthId => $monthName) { 
            $html .= '<td class="rotated_cell" colspan="2"><div class="rotate_text">' . $monthName . '</div></td>'; 
        } 
        foreach ($aData['structure'] as $sdvId => $sdv) { 
            $sdvTemp = $aData['varName'] . '[structure][' . $sdvId . ']'; 
            $html .= '<tr><td colspan="' . 27 . '">' . $sdv['name'] . '</td></tr>'; 
            foreach ($sdv['posts'] as $postId => $post) { 
                $html .= '<tr id="' . $postId . '">'; 
                $html .= '<td>' . $npp . '</td><td class="align_left">' . $post['employee'] . '</td>' . '<td class="align_left">' . $post['post'] . '</td>'; 
                foreach ($aData['monthOptions'] as $monthId => $monthName) { 
                    $sName = $sdvTemp . '[posts][' . $postId . '][' . $monthId . ']'; 
                    if (!empty($post[$monthId]['from']) && !empty($post[$monthId]['to'])) { 
                        goto Label_36988; 
                    } 
                    $html .= '<td></td><td></td>'; 
                    goto Label_36989; 
                    Label_36988: 
                    $dateFrom = new \DateTime($post[$monthId]['from']); 
                    $dateTo = new \DateTime($post[$monthId]['to']); 
                    $iStart = $dateFrom->format('d'); 
                    $iEnd = $dateTo->format('d'); 
                    $iFirstDays = min($iEnd, intval($dateFrom->format('t') / 2)) - max($iStart, 1); 
                    $iSecondDays = min($iEnd, $dateFrom->format('t')) - max($iStart, intval($dateFrom->format('t') / 2)); 
                    if ($iFirstDays > $iSecondDays) { 
                        goto Label_36986; 
                    } 
                    $html .= '<td></td>'; 
                    $html .= '<td class="rotated_cell"><div class="rotate_text">' . $dateFrom->format('d.m') . '-' . $dateTo->format('d.m') . '</div></td>'; 
                    goto Label_36987; 
                    Label_36986: 
                    $html .= '<td class="rotated_cell"><div class="rotate_text">' . $dateFrom->format('d.m') . '-' . $dateTo->format('d.m') . '</div></td>'; 
                    $html .= '<td></td>'; 
                    Label_36987: 
                    Label_36989: 
                } 
                $npp++; 
            } 
        } 
        $html .= '</tbody>
                     </table>'; 
        return $html; 
        Label_36991: 
    } 
    public static function previewvarview($aConfig) 
    { 
        ob_start(); 
        $aIcons = array('pdf' => 'pdf_small_icon', 'docx' => 'docx_small_icon', 'doc' => 'doc_small_icon', 'rtf' => 'rtf_small_icon', 'xlsx' => 'xlsx_small_icon', 'xls' => 'xls_small_icon', 'jpeg' => 'jpeg_small_icon', 'zip' => 'zip_small_icon', 'rar' => 'rar_small_icon'); 
        $sFirstPreviewId = null; 
        $sUSid = \app\user\Account::getaccount()->getsid(); 
        $aHashes = array(); 
        $aFileNames = array(); 
        $bWithTranslate = false; 
        $aBottomColontitulValues = array(); 
        foreach ($aConfig['decision_files'] as $sFileKey => $aValue) { 
            $aBottomColontitulValues[$sFileKey] = $aValue['bottom_colontitul_values']; 
        } 
        $sListPosition = $aConfig['var']['list_position']; 
        ?> 
        <div id='var_<?php  
        echo $aConfig['var']['name']; 
        ?> 
' class='preview_var paper'> 
            <?php  
        if ($sListPosition == 'left') { 
            goto Label_37011; 
        } 
        ?> 
                <div class='preview_top'> 
                <?php  
        if (!(count($aConfig['files']) > 1 && $aConfig['var']['download_attachments'] && $aConfig['download_acces'])) { 
            goto Label_37010; 
        } 
        ?> 
                        <span class='attached_file'> 
                            <a class='filename' href='/media/download-multiple/workflow/<?php  
        echo $aConfig['doctype_id']; 
        ?> 
/<?php  
        echo $aConfig['document_id']; 
        ?> 
/<?php  
        echo $aConfig['var']['name']; 
        ?> 
' download='' onclick='MSF_PreviewVar<?php  
        echo $aConfig['var']['name']; 
        ?> 
.checkHtmlTemplate();'> 
                                <img src='/img/themev1/download_tiny.png' style='height: 12px;margin-bottom: 2px;margin-right: 2px;'> <?php  
        echo \app\system\Registry::get('locale')->get('\xd0\xa1\320\xba\320\260\321\x87\xd0\260\xd1\x82\xd1\x8c \320\xb2\321\201\321\x91'); 
        ?> 
                            </a> 
                        </span> 
                    <?php  
        Label_37010: 
        ?> 
                    <?php  
        foreach ($aConfig['files'] as $sFileKey => $sFileVal) { 
            ?> 
                        <?php  
            $aHashes[$sFileKey] = md5($sUSid . $sFileKey); 
            $hasChangedFile = false; 
            if (!(isset($aConfig['changed_files'][$sFileKey]['changed_id']) && strlen($aConfig['changed_files'][$sFileKey]['changed_id']))) { 
                goto Label_37000; 
            } 
            $hasChangedFile = true; 
            $aHashes[$aConfig['changed_files'][$sFileKey]['changed_id']] = md5($sUSid . $aConfig['changed_files'][$sFileKey]['changed_id']); 
            $aFileNames[$aConfig['changed_files'][$sFileKey]['changed_id']] = \app\media\Util::getpurefilename($sFileVal); 
            Label_37000: 
            $aFileNames[$sFileKey] = \app\media\Util::getpurefilename($sFileVal); 
            ?> 
                        <span class='attached_file'> 
                                <a href='/media/download/<?php  
            echo $sFileKey; 
            ?> 
?' class='filename' title='<?php  
            echo \app\system\Registry::get('locale')->get('\xd0\x9a\xd0\273\xd0\270\320\xba\xd0\275\xd0\270\321\202\320\265, \xd1\207\xd1\x82\320\xbe\xd0\xb1\xd1\213 \xd0\xbf\xd0\276\321\201\xd0\274\320\xbe\xd1\202\321\x80\320\265\xd1\x82\321\x8c \321\x84\xd0\xb0\xd0\271\320\273'); 
            ?> 
' 
                                    <?php  
            if (\app\media\Util::haspreview($sFileVal)) { 
                goto Label_37004; 
            } 
            if (in_array(\app\media\Util::getExtension($sFileVal), \app\media\Util::getarchiveformats())) { 
                goto Label_37002; 
            } 
            ?> 
                                        onclick='window.location.href = '/media/download/<?php  
            echo $sFileKey; 
            ?> 
'; return false;' 
                                    <?php  
            goto Label_37003; 
            Label_37002: 
            ?> 
                                        onclick='MSF_PreviewVar<?php  
            echo $aConfig['var']['name']; 
            ?> 
.loadArchiveTop('<?php  
            echo $sFileKey; 
            ?> 
', event); return false;' 
                                        onblur='MSF_PreviewVar<?php  
            echo $aConfig['var']['name']; 
            ?> 
.archiveTopContentOnBlur(event)' 
                                    <?php  
            Label_37003: 
            goto Label_37005; 
            Label_37004: 
            ?> 
                                        <?php  
            if (!($sFirstPreviewId == null)) { 
                goto Label_37001; 
            } 
            $sFirstPreviewId = isset($aConfig['changed_files'][$sFileKey]['changed_id']) && strlen($aConfig['changed_files'][$sFileKey]['changed_id']) ? $aConfig['changed_files'][$sFileKey]['changed_id'] : $sFileKey; 
            Label_37001: 
            ?> 
                                        onclick='MSF_PreviewVar<?php  
            echo $aConfig['var']['name']; 
            ?> 
.loadFile('<?php  
            echo $hasChangedFile ? $aConfig['changed_files'][$sFileKey]['changed_id'] : $sFileKey; 
            ?> 
'); return false;' 
                                    <?php  
            Label_37005: 
            ?> 
                                > 
                                    <img src='/tpl/web/img/preview_icons/<?php  
            echo array_key_exists(\app\media\Util::getExtension($sFileVal), $aIcons) ? $aIcons[\app\media\Util::getExtension($sFileVal)] : 'default_small_icon'; 
            ?> 
.png' style='height: 16px;margin-right: 5px;float: left;' /> 
                                    <?php  
            echo v($sFileVal); 
            ?> 
</a> 
                                <?php  
            if (!$aConfig['var']['download_attachments']) { 
                goto Label_37009; 
            } 
            ?> 
                                    <?php  
            if (isset($aConfig['template_files'][$sFileKey])) { 
                goto Label_37007; 
            } 
            if (!$aConfig['download_acces']) { 
                goto Label_37006; 
            } 
            ?> 
                                        <a href='/media/download/<?php  
            echo $sFileKey; 
            ?> 
' download class='attached_file_download' title='<?php  
            echo \app\system\Registry::get('locale')->get('\xd0\xa1\320\xba\xd0\xb0\xd1\207\320\xb0\321\202\321\214 \xd1\204\320\xb0\xd0\xb9\xd0\xbb'); 
            ?> 
'><i class='fa fa-download' aria-hidden='true'></i></a> 
                                    <?php  
            Label_37006: 
            goto Label_37008; 
            Label_37007: 
            ?> 
                                        <a href='/workflow/document/export-as-word/<?php  
            echo $aConfig['template_files'][$sFileKey]['doctype_id']; 
            ?> 
/<?php  
            echo $aConfig['template_files'][$sFileKey]['document_id']; 
            ?> 
' download class='attached_file_download' title='<?php  
            echo \app\system\Registry::get('locale')->get('\320\xa1\320\xba\320\260\321\207\320\xb0\321\x82\xd1\x8c \xd1\204\xd0\260\xd0\271\xd0\273'); 
            ?> 
'><i class='fa fa-download' aria-hidden='true'></i></a> 
                                    <?php  
            Label_37008: 
            ?> 
                                <?php  
            Label_37009: 
            ?> 
                            </span> 
                    <?php  
        } 
        ?> 
                </div> 
            <?php  
        goto Label_37012; 
        Label_37011: 
        ?> 
                <div class='preview_left' style='float: left; width: 120px; overflow-x: hidden;'> 
                    <ul style='list-style: none;'> 
                        <?php  
        foreach ($aConfig['files'] as $sFileKey => $sFileVal) { 
            ?> 
                            <?php  
            $aHashes[$sFileKey] = md5($sUSid . $sFileKey); 
            $hasChangedFile = false; 
            if (!(isset($aConfig['changed_files'][$sFileKey]['changed_id']) && strlen($aConfig['changed_files'][$sFileKey]['changed_id']))) { 
                goto Label_36992; 
            } 
            $hasChangedFile = true; 
            $aHashes[$aConfig['changed_files'][$sFileKey]['changed_id']] = md5($sUSid . $aConfig['changed_files'][$sFileKey]['changed_id']); 
            $aFileNames[$aConfig['changed_files'][$sFileKey]['changed_id']] = \app\media\Util::getpurefilename($sFileVal); 
            Label_36992: 
            $aFileNames[$sFileKey] = \app\media\Util::getpurefilename($sFileVal); 
            ?> 
                            <li style='position: relative;'> 
                                <a id='preview_item_<?php  
            echo $sFileKey; 
            ?> 
' class='preview_item' title='<?php  
            echo v($sFileVal); 
            ?> 
' style='cursor: pointer;' 
                                    <?php  
            if (\app\media\Util::haspreview($sFileVal)) { 
                goto Label_36995; 
            } 
            if (extension_loaded('rar') && in_array(\app\media\Util::getExtension($sFileVal), \app\media\Util::getarchiveformats())) { 
                goto Label_36996; 
            } 
            ?> 
                                        onclick='window.location.href = '/media/download/<?php  
            echo $sFileKey; 
            ?> 
'; return false;' 
                                    <?php  
            goto Label_36994; 
            Label_36995: 
            ?> 
                                        <?php  
            if (!($sFirstPreviewId == null)) { 
                goto Label_36993; 
            } 
            $sFirstPreviewId = isset($aConfig['changed_files'][$sFileKey]['changed_id']) && strlen($aConfig['changed_files'][$sFileKey]['changed_id']) ? $aConfig['changed_files'][$sFileKey]['changed_id'] : $sFileKey; 
            Label_36993: 
            ?> 
                                        onclick='MSF_PreviewVar<?php  
            echo $aConfig['var']['name']; 
            ?> 
.loadFile('<?php  
            echo $hasChangedFile ? $aConfig['changed_files'][$sFileKey]['changed_id'] : $sFileKey; 
            ?> 
'); return false;' 
                                    <?php  
            goto Label_36994; 
            Label_36996: 
            ?> 
                                        onclick='MSF_PreviewVar<?php  
            echo $aConfig['var']['name']; 
            ?> 
.loadArchive('<?php  
            echo $sFileKey; 
            ?> 
', this); return false;' 
                                        data-archive-open='false' 
                                    <?php  
            Label_36994: 
            ?> 
                                > 
                                    <div class='doc_icon <?php  
            echo array_key_exists(\app\media\Util::getExtension($sFileVal), $aIcons) ? $aIcons[\app\media\Util::getExtension($sFileVal)] : 'default_small_icon'; 
            ?> 
'></div> 
                                    <?php  
            if (!in_array($sFileKey, $aConfig['added_files'])) { 
                goto Label_36997; 
            } 
            ?> 
                                        <img src='/tpl/web/img/preview_icons/red_pencil_small_icon.png' style='position: absolute; top: -2px; left: 53px;' /> 
                                    <?php  
            Label_36997: 
            ?> 
                                    <br /> 
                                    <?php  
            if (!(mb_strlen($sFileVal) > 30)) { 
                goto Label_36998; 
            } 
            $sFileVal = mb_substr($sFileVal, 0, 27) . '...'; 
            Label_36998: 
            ?> 
                                    <span class='icon-open'></span> 
                                    <?php  
            echo v($sFileVal); 
            ?> 
                                </a> 
                            </li> 
                        <?php  
        } 
        ?> 
 
                    </ul> 
                    <?php  
        if (!(count($aConfig['files']) > 1 && $aConfig['var']['download_attachments'] && $aConfig['download_acces'])) { 
            goto Label_36999; 
        } 
        ?> 
                        <div class='download_all_control' style='text-align: center;'> 
                            <a href='/media/download-multiple/workflow/<?php  
        echo $aConfig['doctype_id']; 
        ?> 
/<?php  
        echo $aConfig['document_id']; 
        ?> 
/<?php  
        echo $aConfig['var']['name']; 
        ?> 
' download='' onclick='MSF_PreviewVar<?php  
        echo $aConfig['var']['name']; 
        ?> 
.checkHtmlTemplate();'> 
                                <?php  
        echo \app\system\Registry::get('locale')->get('\xd0\xa1\xd0\xba\320\xb0\xd1\x87\xd0\xb0\xd1\x82\321\x8c \320\xb2\321\x81\xd1\221'); 
        ?> 
                            </a> 
                        </div> 
                    <?php  
        Label_36999: 
        ?> 
                </div> 
            <?php  
        Label_37012: 
        ?> 
<style> 
                .preview_right { 
                    background-color: #f5f5f5; 
                    margin-top: 10px; 
                    padding: 0; 
                } 
                .preview_right_header { 
                    border-bottom: 2px solid; 
                    height: 50px; 
                    position: relative; 
                    color: #0d48a1; 
                    font-size: 15px; 
                    padding: 0 15px; 
                } 
                .preview_right_header .control { 
                    padding: 19px 9px; 
                    cursor: pointer; 
                } 
                .content_inner_3c .preview_right_header .control { 
                    padding: 19px 5px; 
                } 
                .preview_var .pagination_bar_control { 
                    position: absolute; 
                    top: 15px; 
                    left: 45%; 
                } 
                .preview_var .pagination_bar_control .center_input  { 
                    border: none; 
                    background: none; 
                    width: 1.5em; 
                    text-align: right; 
                } 
                .preview_var .pagination_bar_control .right_btn { 
                    margin-left: 5px; 
                } 
                .preview_var .pagination_bar_control .nav_btn { 
                    cursor: pointer; 
                } 
                .preview_right_content { 
                    padding-top: 0; 
                } 
                .preview_right_header .anyviewer_document_view_file_name { 
                    padding: 15px 0; 
                    display: inline-block; 
                    width: calc(50% - 50px); 
                    white-space: nowrap; 
                    overflow: hidden !important; 
                    text-overflow: ellipsis; 
                } 
                .preview_left-active { 
                    font-weight: 900; 
 
                } 
                .preview_left-link { 
                    color: #000 !important; 
                } 
            </style> 
            <div class='preview_right row' style='<?php  
        echo $sListPosition == 'left' ? 'margin-left: 120px; padding-top: 0;' : 'padding-top: 0;'; 
        ?> 
'> 
                <div class='preview_right_header'> 
                    <div> 
                        <?php  
         
        ?> 
                        <div class='anyviewer_document_view_file_name left'></div> 
                        <span class='fullscreen_control control right anyviewer_document_view_fullscreen_control'> 
                                <i class='fa fa-expand' aria-hidden='true'></i> 
                            </span> 
                        <?php  
        if (!$aConfig['var']['pagination']) { 
            goto Label_37013; 
        } 
        ?> 
                            <p class='anyviewer_document_view_pagination_bar_control pagination_bar_control'> 
                                    <span class='left_btn nav_btn'> 
                                    	<i class='fa fa-chevron-left' aria-hidden='true'></i> 
                                    </span> 
                                <input type='text' class='center_input value' value='1' onblur='this.value=parseInt(this.value) || 1'> 
                                <span class='center_input_total'></span> 
                                <span class='right_btn nav_btn'> 
										<i class='fa fa-chevron-right' aria-hidden='true'></i> 
                                    </span> 
                            </p> 
                        <?php  
        Label_37013: 
        ?> 
                        <?php  
        if (!$aConfig['var']['download_attachments']) { 
            goto Label_37014; 
        } 
        ?> 
                            <span class='download_control right control anyviewer_document_view_download_control' title=''> 
                                <i class='fa fa-download' aria-hidden='true'></i> 
                            </span> 
                            <span class='download_decision_control right control anyviewer_document_view_download_decision_control' title='   '> 
                                <i class='fa fa-cloud-download' aria-hidden='true'></i> 
                            </span> 
                            <span class='download_decision_more_control right control anyviewer_document_view_download_decision_more_control' title=',      (   )'> 
                                <i class='fa fa-cloud-download' aria-hidden='true'></i> 
                            </span> 
                        <?php  
        Label_37014: 
        ?> 
                        <?php  
        if (\app\system\Util::ismobile()) { 
            goto Label_37017; 
        } 
        ?> 
                            <?php  
        if (!$aConfig['var']['print_attachments']) { 
            goto Label_37015; 
        } 
        ?> 
                                <span class='print_control control right anyviewer_document_view_print_control' title=''> 
                                        <i class='fa fa-print' aria-hidden='true'></i> 
                                    </span> 
                            <?php  
        Label_37015: 
        ?> 
                            <?php  
        if (!(in_array($aConfig['doctype_id'], \app\workflow\util\Util::getdoctypeidsforreviewing()) && in_array($aConfig['doc_point_name'], \app\workflow\util\Util::getpointsforreviewing()) || $aConfig['reviewing_simple'])) { 
            goto Label_37016; 
        } 
        ?> 
                                <span class='edit_control control right anyviewer_document_view_edit_control' title=''> 
                                        <i class='fa fa-pencil' aria-hidden='true'></i> 
                                    </span> 
                            <?php  
        Label_37016: 
        ?> 
                        <?php  
        Label_37017: 
        ?> 
                        <span class='rotate_right_control right control anyviewer_document_view_rotate_right_control' title='    '> 
                                <i class='fa fa-repeat' aria-hidden='true'></i> 
                            </span> 
                        <span class='rotate_left_control right control anyviewer_document_view_rotate_left_control' title='    '> 
                                <i class='fa fa-undo' aria-hidden='true'></i> 
                            </span> 
                        <div style='clear: both;'></div> 
                    </div> 
                </div> 
                <div class='preview_right_content' style='clear: both; padding-bottom: 20px; min-height: 400px; <?php  
        if ($aConfig['var']['pagination']) { 
            goto Label_37018; 
        } 
        ?> 
 overflow: auto;<?php  
        Label_37018: 
        ?> 
'> 
 
                </div> 
                <!-- <div class='preview_right_header' style='padding-top: 3px; height: 25px; display: none;'> 
                        <div style='margin: 0 10px;'> 
                            <?php  
         
        ?> 
                            <span class='fullscreen_control btn control right anyviewer_document_view_fullscreen_control'><input type='button' value='' title=''></span> 
                            <?php  
        if (!$aConfig['var']['pagination']) { 
            goto Label_37019; 
        } 
        ?> 
                                <p class='anyviewer_document_view_pagination_bar_control pagination_bar_control control left'> 
                                    <span class='left_btn nav_btn'><span class='icon'>&nbsp;</span></span> 
                                    <input type='text' class='center_input value' value='1' onblur='this.value=parseInt(this.value) || 1'> 
                                    <span class='center_input_total'></span> 
                                    <span class='right_btn nav_btn'><span class='icon'>&nbsp;</span></span> 
                                </p> 
                            <?php  
        Label_37019: 
        ?> 
                            <span class='rotate_left_control btn control left anyviewer_document_view_rotate_left_control'><input type='button' value='' title='    ' /></span> 
                            <span class='rotate_right_control btn control left anyviewer_document_view_rotate_right_control'><input type='button' value='' title='    ' /></span> 
                            <span class='download_control btn control left anyviewer_document_view_download_control'><input type='button' value='' title='' /></span> 
                            <span class='download_decision_control btn control left anyviewer_document_view_download_decision_control'><input type='button' value='' title='   ' /></span> 
                            <?php  
        if (\app\system\Util::ismobile()) { 
            goto Label_37021; 
        } 
        ?> 
                                <span class='print_control btn control left anyviewer_document_view_print_control'><input type='button' value='' title='' /></span> 
                                <?php  
        if (!(in_array($aConfig['doctype_id'], \app\workflow\util\Util::getdoctypeidsforreviewing()) && in_array($aConfig['doc_point_name'], \app\workflow\util\Util::getpointsforreviewing()))) { 
            goto Label_37020; 
        } 
        ?> 
                                    <span class='edit_control btn control left anyviewer_document_view_edit_control'><input type='button' value='' title='' /></span> 
                                <?php  
        Label_37020: 
        ?> 
                            <?php  
        Label_37021: 
        ?> 
                            <div style='clear: both;'></div> 
                        </div> 
                    </div> --> 
            </div> 
        </div> 
 
        <script type='text/javascript' src='/js/pdfjs/build/pdf.js'></script> 
 
        <script type='text/javascript'> 
            /* <![CDATA[ */ 
            var preview_item = $('.preview_left ul li') 
            var preview_item_link = $('.preview_left ul li a') 
            $(preview_item_link).toggleClass('preview_left-link') 
            $(preview_item[0]).toggleClass('preview_left-active') 
            $(preview_item).click(function() { 
                if($(this).hasClass('preview_left-active')) { 
                    $(this).removeClass('preview_left-active') 
                } else { 
                    $('.preview_left ul li').removeClass('preview_left-active') 
                    $(this).addClass('preview_left-active') 
                } 
            }) 
            $('#var_<?php  
        echo $aConfig['var']['name']; 
        ?> 
 .preview_left').mCustomScrollbar(); 
 
            var MSF_PreviewVar<?php  
        echo $aConfig['var']['name']; 
        ?> 
 = { 
                oContext: null, 
                oRightContext: null, 
                sFirstPreviewId: null, 
                aTemplateFiles: null, 
                aDecisionFiles: null, 
                aLoadedFiles: {}, 
                sCurrentFile: null, 
                iImageWidth: null, 
                aFileNames : {}, 
                aHashes: {}, 
                aChangedFiles: {}, 
                iFileMTime:parseInt('<?php  
        echo time(); 
        ?> 
',10), 
                oChecker:null, 
                sMsfId:null, 
                aFilesTimes: {}, 
                sCurrentId:null, 
                sListPosition: null, 
                aGeneratedFiles: {}, 
                init: function() 
                { 
                    this.sMsfId = $('#msf_id').size() ? $('#msf_id').val() : null; 
                    this.aFileNames = $.parseJSON('<?php  
        echo addslashes(\app\system\Json::encode($aFileNames)); 
        ?> 
'); 
                    this.aHashes = $.parseJSON('<?php  
        echo addslashes(\app\system\Json::encode($aHashes)); 
        ?> 
'); 
                    this.aChangedFiles = $.parseJSON('<?php  
        echo addslashes(\app\system\Json::encode($aConfig['changed_files'])); 
        ?> 
'); 
                    this.oContext = $('#var_<?php  
        echo $aConfig['var']['name']; 
        ?> 
'); 
                    this.oRightContext = this.oContext.find('.preview_right_content'); 
                    <?php  
        if (!($sFirstPreviewId != null)) { 
            goto Label_37022; 
        } 
        ?> 
                    this.sFirstPreviewId = '<?php  
        echo $sFirstPreviewId; 
        ?> 
'; 
                    <?php  
        Label_37022: 
        ?> 
                    this.aTemplateFiles = $.parseJSON('<?php  
        echo addslashes(\app\system\Json::encode($aConfig['template_files'])); 
        ?> 
'); 
                    this.aDecisionFiles = $.parseJSON('<?php  
        echo addslashes(\app\system\Json::encode($aConfig['decision_files'])); 
        ?> 
'); 
                    this.aColontitulValues = $.parseJSON('<?php  
        echo addslashes(\app\system\Json::encode($aBottomColontitulValues)); 
        ?> 
'); 
                    this.sListPosition = '<?php  
        echo $sListPosition; 
        ?> 
'; 
                    this.load(); 
                }, 
 
                load: function() 
                { 
                    if(this.sFirstPreviewId != null) 
                    { 
                        this.showLoading(); 
                        this.loadFile(this.sFirstPreviewId); 
                    } 
                    else 
                    { 
                        this.showError('<?php  
        echo \app\system\Registry::get('locale')->get('\320\x9d\xd0\265\321\202 \xd1\x84\320\260\xd0\xb9\320\xbb\320\276\320\xb2'); 
        ?> 
'); 
                    } 
 
                }, 
                checkPreview: function(sId, bDisableHtml) { 
                    var oThis = this; 
                    if (oThis.checkPreviewQueueTimeout) { 
                        clearTimeout(oThis.checkPreviewQueueTimeout) 
                    } 
                    oThis.checkPreviewQueueTimeout = setTimeout(function() { 
                        $.get('/media/check-preview/' + sId, function(status) { 
                            if (status === '2') { 
                                oThis.checkPreview(sId, bDisableHtml); 
                            } 
                            else { 
                                oThis.loadFile(sId, bDisableHtml); 
                            } 
                        }); 
                    }, 5000); 
                }, 
                loadFile: function(sId, bDisableHtml) { 
                    $('#var_<?php  
        echo $aConfig['var']['name']; 
        ?> 
 .preview_item').css('color', '#666666'); 
                    $('#var_<?php  
        echo $aConfig['var']['name']; 
        ?> 
 #preview_item_' + sId).css('color', '#660033'); 
                    var oThis = this; 
                    if (oThis.checkPreviewQueueTimeout) { 
                        clearTimeout(oThis.checkPreviewQueueTimeout) 
                    } 
                    if(bDisableHtml) { 
                        var sPreviewType = oThis.aLoadedFiles[sId]['type']; 
                        if(sPreviewType == 'template') { 
                            oThis.aTemplateFiles[sId]['disable_html'] = 1; 
                            oThis.aLoadedFiles[sId] = undefined; 
                        } 
                    } 
 
                    if (array_key_exists(sId, oThis.aGeneratedFiles)) { 
                        sId = oThis.aGeneratedFiles[sId]; 
                    } 
 
                    if(oThis.aLoadedFiles[sId] != undefined) 
                    { 
                        oThis.render(sId); 
                        if(oThis.aLoadedFiles[sId]['type'] == 'document' && '<?php  
        echo !$aConfig['var']['pagination']; 
        ?> 
' && oThis.aLoadedFiles[sId]['number_of_pages'] <= 3) { 
                            oThis.oContext.find('.preview_right_header').hide(); 
                        } 
                        else { 
                            oThis.oContext.find('.preview_right_header').show(); 
                        } 
                    } 
                    else 
                    { 
                        oThis.showLoading(); 
                        $.ajax({ 
                            url: '/media/preview/' + sId + '?_hash=' + oThis.iFileMTime, 
                            data: array_key_exists(sId, oThis.aTemplateFiles) ? oThis.aTemplateFiles[sId] : {}, 
                            async: bDisableHtml && sPreviewType == 'template' ? false : true, 
                            success: function(oData) 
                            { 
                                if(oData.result.code) 
                                { 
                                    if($('#preview_item_' + sId).size() && $('#preview_item_' + sId).attr('onclick').indexOf('MSF_PreviewVar<?php  
        echo $aConfig['var']['name']; 
        ?> 
.loadFile') > -1) 
                                    { 
                                        $('#preview_item_' + sId).attr('onclick','MSF_PreviewVar<?php  
        echo $aConfig['var']['name']; 
        ?> 
.loadFile(\'' + oData.file_id + '\'); return false;'); 
                                    } 
 
                                    if (array_key_exists(sId, oThis.aTemplateFiles)) { 
                                        oThis.aGeneratedFiles[sId] = oData.file_id; 
                                    } 
 
                                    sId = oData.file_id; 
                                    if(!array_key_exists(sId,oThis.aFileNames)) 
                                    { 
                                        oThis.aFileNames[sId] = oData.title; 
                                    } 
                                    oThis.aLoadedFiles[sId] = oData; 
                                    oThis.render(sId); 
                                    if(oThis.aLoadedFiles[sId]['type'] == 'document' && '<?php  
        echo !$aConfig['var']['pagination']; 
        ?> 
' && oThis.aLoadedFiles[sId]['number_of_pages'] <= 3) { 
                                        oThis.oContext.find('.preview_right_header').hide(); 
                                    } 
                                    else { 
                                        oThis.oContext.find('.preview_right_header').show(); 
                                    } 
                                } 
                                else if(oData.result.text) 
                                { 
                                    if (oData.file_id && array_key_exists(sId, oThis.aTemplateFiles)) { 
                                        oThis.aGeneratedFiles[sId] = oData.file_id; 
                                        sId = oData.file_id; 
                                    } 
                                    if (oData.result.text === '      ' || oData.result.text === '    ') { 
                                        oThis.checkPreview(sId, bDisableHtml); 
                                        return; 
                                    } 
                                    if (oData.result.text !== '   !') { 
                                        oThis.showError(oData.result.text + '<p><a href='/media/download/' + sId + ''> </a></p>'); 
                                    } else { 
                                        oThis.showError(oData.result.text); 
                                    } 
                                    oThis.oContext.find('.preview_right_header').hide(); 
                                } 
                                else 
                                { 
                                    oThis.showError(oData.result.error); 
                                    oThis.oContext.find('.preview_right_header').hide(); 
                                } 
 
                            }, 
                            dataType: 'json' 
                        }); 
                    } 
 
                }, 
 
                loadArchive: function(sId, element){ 
                    $.ajax({ 
                        url: '/media/get-list-from-archive/' + sId, 
                        type: 'GET', 
                        dataType: 'json', 
                        success: function (oData) { 
 
                            if (oData.result.code == 0) { 
                                MSF_StatusBar.showError(oData.result.text); 
                                return false; 
                            } 
 
                            var s = '<div class='hr-top' parent-id=''+ sId +''></div>'; 
 
                            var oList = oData.result.data; 
                            for (sIdFile in oList) { 
                                var sOnClick = ''; 
                                if (oList[sIdFile]['can_preview']){ 
                                    sOnClick = 'MSF_PreviewVar<?php  
        echo $aConfig['var']['name']; 
        ?> 
.loadFile(\''+ sIdFile +'\'); return false;'; 
                                } else { 
                                    sOnClick = 'window.location.href = \'/media/download/'+ sIdFile +'\'; return false;'; 
                                } 
 
                                var sName = oList[sIdFile]['name']; 
                                if (sName.length > 30) { 
                                    sName = sName.substr(0, 27) + '...'; 
                                } 
 
                                s += '<li style='position: relative;' parent-id=''+ sId +''>' 
                                    + '<a' 
                                    + ' id='preview_item_'+ sIdFile +''' 
                                    + ' class='preview_item'' 
                                    + ' title=''+ oList[sIdFile]['name'] +''' 
                                    + ' style='cursor: pointer;'' 
                                    + ' onclick=''+ sOnClick +''' 
                                    + '>' 
                                    + '<div class='doc_icon '+ oList[sIdFile]['icon'] +''></div>' 
                                    + '<br>' 
                                    + sName 
                                    + '</a>' 
                                    + '</li>'; 
                            } 
 
                            s += '<div class='hr-bottom' parent-id=''+ sId +''></div>'; 
 
                            $(element).parent().after(s); 
                            $(element).attr('onclick', 'MSF_PreviewVar<?php  
        echo $aConfig['var']['name']; 
        ?> 
.archiveOpenClose(\''+ sId +'\', this)'); 
                            $(element).attr('data-archive-open', 'true'); 
                        }, 
                        error: function () { 
                            MSF_StatusBar.showError(''); 
                        } 
                    }); 
                }, 
 
                loadArchiveTop: function(sId, event){ 
                    event.preventDefault(); 
                    $('#var_<?php  
        echo $aConfig['var']['name']; 
        ?> 
 .attached_file .archive_content').hide(); 
                    if($(event.target).next('.archive_content').size()) { 
                        $(event.target).next('.archive_content').show(); 
                    } 
                    else { 
                        $.ajax({ 
                            url: '/media/get-list-from-archive/' + sId, 
                            type: 'GET', 
                            dataType: 'json', 
                            success: function (oData) { 
                                if (oData.result.code == 0) { 
                                    MSF_StatusBar.showError(oData.result.text); 
                                    return false; 
                                } 
 
                                var s = '<div class='archive_content' style='display:none;'>'; 
                                var aList = oData.result.data; 
                                for (var sFileId in aList) { 
                                    if (aList[sFileId]['can_preview']) { 
                                        var sOnClick = 'MSF_PreviewVar<?php  
        echo $aConfig['var']['name']; 
        ?> 
.loadFile(\'' + sFileId + '\'); archiveTopContentOnBlur(); return false;'; 
                                    } else { 
                                        var sOnClick = 'window.location.href = \'/media/download/' + sFileId + '\'; archiveTopContentOnBlur(); return false;'; 
                                    } 
                                    s += '<div class='archive_content_item' onmousedown='' + sOnClick + ''><img src='/tpl/web/img/preview_icons/' + aList[sFileId]['icon'] + '.png' style='height: 16px; margin-bottom: -2px; margin-right: 5px;'>' + aList[sFileId]['name'] + '</div>'; 
                                } 
                                s += '</div>'; 
                                $(s).insertAfter(event.target).show(); 
                            }, 
                            error: function () { 
                                MSF_StatusBar.showError(''); 
                            } 
                        }); 
                    } 
                }, 
 
                archiveTopContentOnBlur: function() { 
                    $('#var_<?php  
        echo $aConfig['var']['name']; 
        ?> 
 .attached_file .archive_content').hide(); 
                }, 
 
                archiveOpenClose: function(sId, element){ 
                    aItems = this.oContext.find('.preview_left [parent-id=''+ sId +'']'); 
                    if (aItems.eq(0).is(':visible')) { 
                        aItems.css('display', 'none'); 
                        $(element).attr('data-archive-open', 'false'); 
                    } else { 
                        aItems.css('display', 'block'); 
                        $(element).attr('data-archive-open', 'true'); 
                    } 
                }, 
 
                render: function(sId) 
                { 
                    var oThis = this; 
                    $('.anyviewer_document_view_file_name').text(oThis.aFileNames[sId]).attr('title', oThis.aFileNames[sId]); 
                    $('.anyviewer_document_view_pagination_bar_control').find('.center_input_total').html('/ ' + oThis.aLoadedFiles[sId].pages.length); 
                    $('.anyviewer_document_view_pagination_bar_control').find('.center_input').val(oThis.aLoadedFiles[sId]['current_page'] + 1 || 1); 
                    $('.anyviewer_document_view_pagination_bar_control').find('.nav_btn').unbind('click').click(function(oEv) 
                    { 
                        var oPage = $('.anyviewer_document_view_pagination_bar_control').find('.center_input'); 
                        var iPage = oPage.val(); 
 
                        if($(this).hasClass('left_btn')) 
                        { 
                            iPage = iPage == 1 ? iPage : --iPage; 
                        }else 
                        { 
                            iPage = iPage == oThis.aLoadedFiles[sId].pages.length ? iPage : ++iPage; 
                        } 
 
                        if(oPage.val() != iPage) 
                        { 
                            oPage.val(iPage) 
                            oThis.renderPage(oThis.aLoadedFiles[sId], iPage - 1); 
                            oThis.aLoadedFiles[sId]['current_page'] = iPage - 1; 
                        } 
                    }); 
                    $('.anyviewer_document_view_rotate_left_control').unbind('click').click(function() 
                    { 
                        var iRotate = oThis.aLoadedFiles[sId].rotate || 0; 
                        if(iRotate == 0) 
                        { 
                            iRotate = 270; 
                        } 
                        else 
                        { 
                            iRotate -= 90; 
                        } 
 
                        oThis.aLoadedFiles[sId].rotate = iRotate; 
                        oThis.renderPage(oThis.aLoadedFiles[sId], oThis.aLoadedFiles[sId]['current_page'] || 0); 
                        return false; 
                    }); 
                    $('.anyviewer_document_view_rotate_right_control').unbind('click').click(function() 
                    { 
                        var iRotate = oThis.aLoadedFiles[sId].rotate || 0; 
                        if(iRotate == 270) 
                        { 
                            iRotate = 0; 
                        } 
                        else 
                        { 
                            iRotate += 90; 
                        } 
 
                        oThis.aLoadedFiles[sId].rotate = iRotate; 
                        oThis.renderPage(oThis.aLoadedFiles[sId], oThis.aLoadedFiles[sId]['current_page'] || 0); 
                        return false; 
                    }); 
                    $('.anyviewer_document_view_download_control').unbind('click').click(function() 
                    { 
                        window.location.href = oThis.aLoadedFiles[sId].download_url; 
                        return false; 
                    }); 
                    if(array_key_exists(sId, oThis.aDecisionFiles)) 
                    { 
                        var aTemp = oThis.aDecisionFiles[sId]; 
                        var sUrl = sId + 
                            '?rf=' + aTemp['rf'] + 
                            '&rfn=' + aTemp['rfn'] + 
                            '&d=' + aTemp['d'] + 
                            '&f=' + aTemp['f'] + 
                            '&b=' + aTemp['b'] + 
                            '&btt=' + aTemp['btt'] + 
                            '&ep=' + aTemp['ep'] + 
                            '&field=' + aTemp['field'] + 
                            '&wmk_tpl=' + aTemp['wmk_tpl']; 
 
                        $('.anyviewer_document_view_download_decision_control').unbind('click').click(function() 
                        { 
                            window.location.href = '/media/download-decision/' +sUrl; 
                            return false; 
                        }); 
 
                        $('.anyviewer_document_view_download_decision_more_control').unbind('click').click(function() 
                        { 
                            window.location.href = '/media/download-decision/' + sUrl + '&eds_more=1'; 
                            return false; 
                        }); 
 
                        $('.anyviewer_document_view_download_decision_control').show(); 
                        $('.anyviewer_document_view_download_decision_more_control').show(); 
                    } 
                    else 
                    { 
                        $('.anyviewer_document_view_download_decision_control').hide(); 
                        $('.anyviewer_document_view_download_decision_more_control').hide(); 
                    } 
 
                    $('.anyviewer_document_view_fullscreen_control').unbind('click').click(function() 
                    { 
 
                        if($('#fullscreen_control_block').hasClass('expanded') || $('#page_wrapper').hasClass('expanded')) { 
                            $('.expanded .preview_right_content').attr('style', 'clear: both; min-heght: 400px;'); 
                            $('#page_columns').removeAttr('style'); 
 
                            $('#page_wrapper').removeClass('expanded'); 
                            $('#page_wrapper').removeAttr('style'); 
                            $('#fullscreen_control_block').removeClass('expanded'); 
                            $('#fullscreen_control_block').removeAttr('style'); 
                            <?php  
        if (!(\app\system\Registry::get('config')->get('app_editor_type') === 'onlyoffice')) { 
            goto Label_37023; 
        } 
        ?> 
                                $('.preview_right_content').attr('style', 'clear: both; min-height: 930px; height: 930px; overflow: hidden; display: grid;'); 
                            <?php  
        Label_37023: 
        ?> 
                        } else { 
                            $('#page_wrapper').addClass('expanded'); 
                            $('#page_wrapper').attr('style', 'width: 100%'); 
                            $('#fullscreen_control_block').addClass('expanded'); 
                            $('#fullscreen_control_block').attr('style', 'width: 100%'); 
 
                            $('#page_columns').attr('style', 'overflow: hidden;'); 
                            $('.expanded .preview_right_content').attr('style', 'top: 50px !important; overflow-y: scroll; background: #f5f5f5'); 
                        } 
                        if(oThis.aLoadedFiles[sId]['type'] == 'template' || oThis.aLoadedFiles[sId]['type'] == 'text') { 
                            scaleWordPage(); 
                        } 
                        return false; 
                    }); 
 
                    $('.anyviewer_document_view_print_control').unbind('click').click(function() 
                    { 
                        oThis.print(sId); 
                        return false; 
                    }); 
 
                    //if(this.aChangedFiles.hasOwnProperty(sId)) 
                    //{ 
                    $('.anyviewer_document_view_edit_control').unbind('click').click(function() 
                    { 
                        oThis.editDocument(sId); 
                        return false; 
                    }); 
                    <?php  
        if (!(\app\system\Registry::get('config')->get('app_editor_url') && \app\system\License::hasdocumentologoffice())) { 
            goto Label_37024; 
        } 
        ?> 
                    if (in_array(oThis.aLoadedFiles[sId]['ext'], ['doc', 'docx'])) { 
                        $('.anyviewer_document_view_edit_control').show(); 
                    } else { 
                        $('.anyviewer_document_view_edit_control').hide(); 
                    } 
                    <?php  
        Label_37024: 
        ?> 
                    //} 
                    //else 
                    //{ 
                    //  $('.anyviewer_document_view_edit_control').hide(); 
                    //} 
                    oThis.sCurrentId = sId; 
                    oThis.renderPage(oThis.aLoadedFiles[sId], oThis.aLoadedFiles[sId]['current_page'] || 0); 
                }, 
 
                renderPage: function(aData, iPage) 
                { 
                    var oThis = this; 
                    oThis.oRightContext.css({'min-height' : '400px'}); 
                    if(aData.type == 'excel') { 
                        <?php  
        if (!$aConfig['var']['pagination']) { 
            goto Label_37025; 
        } 
        ?> 
                        oThis.oRightContext.html('<div style='position: relative;'><div class='page_wrap page_loading' style='min-width: 300px; min-height: 400px;'><iframe width='100%' style='min-height: 500px; border: none; background-color: #fff;' src='' + aData.pages[iPage].preview_url + ''/>' + (typeof oThis.aColontitulValues[oThis.sCurrentId] != 'undefined' && iPage == 0 ? '<div style='position:relative; margin-top: -13px; text-align: right; padding-right: 25px; color: #F18080; font-weight: bold;'>'+ oThis.aColontitulValues[oThis.sCurrentId] +'</div>' : '') +'</div></div>') 
                            .find('iframe').load(function() { 
                            $(this).show(); 
                            $(this).width('100%'); 
                            $(this).parent().removeClass('page_loading').end().fadeIn(200); 
                            $(this).parent().siblings().show(); 
                        }); 
                        <?php  
        goto Label_37026; 
        Label_37025: 
        ?> 
                        oThis.oRightContext.html(''); 
                        oThis.oRightContext.css({'min-height' : '', 'height' : aData.pages[0].height + 'px'}); 
                        for(var iPageNow in aData.pages){ 
                            oThis.oRightContext.html('<div style='position: relative;'>' + '<div class='page_wrap page_loading' style='min-width: 300px; min-height: 400px;'><iframe width='100%' style='min-height: 500px; border: none; background-color: #fff;' src='' + aData.pages[iPageNow].preview_url + ''/>' + (typeof oThis.aColontitulValues[oThis.sCurrentId] != 'undefined' && iPageNow == 0 ? '<div style='position:relative; margin-top: -13px; text-align: right; padding-right: 25px; color: #F18080; font-weight: bold;'>'+ oThis.aColontitulValues[oThis.sCurrentId] +'</div>' : '') +'</div></div>') 
                                .find('iframe').load(function() { 
                                $(this).show(); 
                                $(this).width('100%'); 
                                $(this).parent().removeClass('page_loading').end().fadeIn(200); 
                                $(this).parent().siblings().show(); 
                            }); 
                        } 
                        <?php  
        Label_37026: 
        ?> 
                    } 
                    else if(aData.type == 'text') { 
                        <?php  
        if (!$aConfig['var']['pagination']) { 
            goto Label_37027; 
        } 
        ?> 
                        oThis.oRightContext.html('<div style='position: relative;'><div class='page_wrap page_loading' style='min-width: 300px; min-height: 400px;'><div class='page_content'/>' + (typeof oThis.aColontitulValues[oThis.sCurrentId] != 'undefined' && iPage == 0 ? '<div style='position:relative; margin-top: -13px; text-align: right; padding-right: 25px; color: #F18080; font-weight: bold;'>'+ oThis.aColontitulValues[oThis.sCurrentId] +'</div>' : '') +'</div></div>'); 
                        $.get(aData.pages[iPage].preview_url, function(data){ 
                            var oPageContent  = oThis.oRightContext.find('div.page_content'); 
                            oPageContent.html(data) 
                            oPageContent.show(); 
                            oPageContent.width('100%'); 
                            oPageContent.parent().removeClass('page_loading').end().fadeIn(200); 
                            oPageContent.parent().siblings().show(); 
                        }); 
                        <?php  
        goto Label_37028; 
        Label_37027: 
        ?> 
                        oThis.oRightContext.html(''); 
                        oThis.oRightContext.css({'min-height' : '', 'height' : aData.pages[0].height + 'px'}); 
                        for(var iPageNow in aData.pages){ 
                            var iPageNowPage = iPageNow; 
                            oThis.oRightContext.html('<div style='position: relative;'>' + 
                                '<div class='page_wrap page_loading' style='min-width: 300px; min-height: 400px;'><div class='page_content_' + iPageNowPage + ''/>' + (typeof oThis.aColontitulValues[oThis.sCurrentId] != 'undefined' && iPageNowPage == 0 ? '<div style='position:relative; margin-top: -13px; text-align: right; padding-right: 25px; color: #F18080; font-weight: bold;'>'+ oThis.aColontitulValues[oThis.sCurrentId] +'</div>' : '') +'</div></div>'); 
                            $.get(aData.pages[iPageNowPage].preview_url, function(data){ 
                                var oPageContent  = oThis.oRightContext.find('div.page_content_' + iPageNowPage); 
                                oPageContent.html(data) 
                                oPageContent.show(); 
                                oPageContent.width('100%'); 
                                oPageContent.parent().removeClass('page_loading').end().fadeIn(200); 
                                oPageContent.parent().siblings().show(); 
                            }); 
                        } 
                        <?php  
        Label_37028: 
        ?> 
                    } 
                    else if(aData.type == 'tiff') { 
                        <?php  
        if (!$aConfig['var']['pagination']) { 
            goto Label_37029; 
        } 
        ?> 
                        oThis.oRightContext.html('<div style='position: relative;'><div class='page_wrap page_loading' style='min-width: 300px; min-height: 400px;'><img style='display: none;' src='' />'+ (typeof oThis.aColontitulValues[oThis.sCurrentId] != 'undefined' && oThis.aColontitulValues[oThis.sCurrentId].length && iPage == 0 ? '<div style='position:relative; margin-top: -13px; text-align: right; padding-right: 25px; color: #F18080; font-weight: bold;'>'+ oThis.aColontitulValues[oThis.sCurrentId] +'</div>' : '') +'</div></div>') 
                            .find('img').attr('src', aData.pages[iPage].preview_url + '?rotate=' + (aData.rotate || 0) + '&_hash=' + oThis.iFileMTime).one('load', function() 
                        { 
                            $(this).show(); 
                            $(this).width('100%'); 
                            $(this).parent().removeClass('page_loading').end().fadeIn(200); 
                            $(this).parent().siblings().show(); 
                        }).each(function() { 
                            if(this.complete) 
                            { 
                                $(this).load(); 
                            } 
 
                        }); 
                        <?php  
        goto Label_37030; 
        Label_37029: 
        ?> 
                        oThis.oRightContext.html(''); 
                        for(var iPageNow in aData.pages){ 
                            oThis.oRightContext.append('<div style='position: relative;'>' + 
                                (iPageNow == 0 ? '<span class='page_label debug_class' style='display: none;'>' + 
                                    aData['title'] + '</span>' : '') + '<div class='page_wrap page_loading' style='min-width: 300px; min-height: 400px;'>' + 
                                '<img style='display: none;' src='' + aData.pages[iPageNow].preview_url + '?rotate=' + (aData.rotate || 0) + '&_hash=' + 
                                oThis.iFileMTime + '' />'+ (typeof oThis.aColontitulValues[oThis.sCurrentId] != 'undefined' && 
                                oThis.aColontitulValues[oThis.sCurrentId].length && iPageNow == 0 ? '<div style='position:relative; margin-top: -13px;' + 
                                    'text-align: right; padding-right: 25px; color: #F18080; font-weight: bold;'>'+ oThis.aColontitulValues[oThis.sCurrentId] + 
                                    '</div>' : '') +'</div></div>') 
                                .find('img').one('load', function() 
                            { 
                                $(this).show(); 
                                $(this).width('100%'); 
                                $(this).parent().removeClass('page_loading').end().fadeIn(200); 
                                $(this).parent().siblings().show(); 
                            }).each(function() { 
                                if(this.complete) 
                                { 
                                    $(this).load(); 
                                } 
                            }); 
                        } 
                        <?php  
        Label_37030: 
        ?> 
                    } 
                    else if(aData.type == 'template') { 
                        oThis.oRightContext.html('<div style='margin: 0 10px; position: relative;overflow-y: auto;'><div class='page_wrap page_loading' style='min-width: 300px; min-height: 400px;'><div class='page_content'/>' + (typeof oThis.aColontitulValues[oThis.sCurrentId] != 'undefined' && iPage == 0 ? '<div style='position:relative; margin-top: -13px; text-align: right; padding-right: 25px; color: #F18080; font-weight: bold;'>'+ oThis.aColontitulValues[oThis.sCurrentId] +'</div>' : '') +'</div></div>'); 
                        $.get(aData.pages[iPage].preview_url, {sPagination: <?php  
        echo $aConfig['var']['pagination']; 
        ?> 
}, function(data){ 
                            var oPageContent  = oThis.oRightContext.find('div.page_content'); 
                            oPageContent.html('<div id='preview-word'>' + data + '</div>'); 
                            oPageContent.show(); 
                            oPageContent.width('100%'); 
                            oPageContent.parent().removeClass('page_loading').end().fadeIn(200); 
                            oPageContent.parent().siblings().show(); 
//                                scaleWordPage(); 
//                                window.onresize = scaleWordPage; 
                        }); 
                    } 
                    else if(aData.type == 'image') { 
                        oThis.oRightContext.html('<div style='margin: 0 10px; position: relative;'><div class='page_wrap page_loading' style='min-width: 300px; min-height: 400px;'><img style='display: none;' src='' />'+ (typeof oThis.aColontitulValues[oThis.sCurrentId] != 'undefined' && oThis.aColontitulValues[oThis.sCurrentId].length && iPage == 0 ? '<div style='position:relative; margin-top: -13px; text-align: right; padding-right: 25px; color: #F18080; font-weight: bold;'>'+ oThis.aColontitulValues[oThis.sCurrentId] +'</div>' : '') +'</div></div>') 
                            .find('img').attr('src', aData.pages[iPage].preview_url + '?rotate=' + (aData.rotate || 0) + '&_hash=' + oThis.iFileMTime).one('load', function() 
                        { 
                            $(this).show(); 
                            $(this).width('100%'); 
                            $(this).parent().removeClass('page_loading').end().fadeIn(200); 
                            $(this).parent().siblings().show(); 
                        }).each(function() { 
                            if(this.complete) 
                            { 
                                $(this).load(); 
                            } 
 
                        }); 
                    } 
                    else { 
                        <?php  
        if (!$aConfig['var']['pagination']) { 
            goto Label_37033; 
        } 
        ?> 
                        oThis.oRightContext.html('<div style='position: relative;'><div class='page_wrap page_loading' style='min-width: 300px; min-height: 400px;'><img style='display: none;' src='' />'+ (typeof oThis.aColontitulValues[oThis.sCurrentId] != 'undefined' && oThis.aColontitulValues[oThis.sCurrentId].length && iPage == 0 ? '<div style='position:relative; margin-top: -13px; text-align: right; padding-right: 25px; color: #F18080; font-weight: bold;'>'+ oThis.aColontitulValues[oThis.sCurrentId] +'</div>' : '') +'</div></div>') 
                            .find('img').attr('src', aData.pages[iPage].preview_url + '?rotate=' + (aData.rotate || 0) + '&_hash=' + oThis.iFileMTime).one('load', function() 
                        { 
                            $(this).show(); 
                            $(this).width('100%'); 
                            $(this).parent().removeClass('page_loading').end().fadeIn(200); 
                            $(this).parent().siblings().show(); 
                        }).each(function() { 
                            if(this.complete) 
                            { 
                                $(this).load(); 
                            } 
 
                        }); 
                        <?php  
        goto Label_37034; 
        Label_37033: 
        ?> 
                        <?php  
        if (\app\system\Registry::get('config')->get('app_editor_type') === 'onlyoffice') { 
            goto Label_37031; 
        } 
        ?> 
                        if(aData.number_of_pages > 3) { 
                            $('.fullscreen_control').hide(); 
                            oThis.oRightContext.html('\ 
                                <div style='margin: 0 10px; position: relative;'>\ 
                                    <div class='page_wrap' style='min-width: 300px; min-height: 400px;position:relative;'>\ 
                                        <img style='width: 100%;' src='' + aData.pages[0].preview_url + '?rotate=' + (aData.rotate || 0) + '&_hash=' + oThis.iFileMTime + '' />\ 
                                        <div style='padding-top: 40px;' class='load_pdfjs' onclick='MSF_PreviewVar<?php  
        echo $aConfig['var']['name']; 
        ?> 
.loadPdfjs(\''+aData.preview_url+'\')'>\ 
                                             <div>\ 
                                                <span style='font-size: 16px; background-color: #fff;' class='btn btn-raised btn-sm'><?php  
        echo \app\system\Registry::get('locale')->get('\xd0\x9f\xd0\276\321\201\320\274\320\276\xd1\x82\321\x80\xd0\xb5\321\202\xd1\214 \xd0\264\xd0\276\xd0\272\321\x83\320\274\320\265\320\xbd\xd1\202 \xd0\277\320\xbe\320\273\320\xbd\xd0\276\321\201\xd1\202\321\x8c\321\216'); 
        ?> 
</span>\ 
                                             </div>\ 
                                        </div>\ 
                                    </div>\ 
                                </div>'); 
                        } else { 
                            MSF_PreviewVar<?php  
        echo $aConfig['var']['name']; 
        ?> 
.loadPdfjs(aData.preview_url); 
                        } 
                        <?php  
        goto Label_37032; 
        Label_37031: 
        ?> 
                        MSF_PreviewVar<?php  
        echo $aConfig['var']['name']; 
        ?> 
.loadOnlyoffice(aData); 
                        <?php  
        Label_37032: 
        ?> 
 
                        <?php  
        Label_37034: 
        ?> 
                    } 
 
                }, 
 
                showLoading: function() 
                { 
                    this.oRightContext.html('<p class='page_wrap' style='min-width: 400px; min-height: 500px;'>&nbsp;</p>').find('.page_wrap').addClass('page_loading'); 
                    //this.oRightContext.html('<div style='padding: 10px; padding-top: 50px; text-align: center;'><p class='state_loading'>'+MSF_Locale.get(' ')+'...</p></div>'); 
                }, 
 
                loadPdfjs: function(sUrl) 
                { 
                    var iframeElement = $('<iframe src='/js/pdfjs/web/viewer_mini.php?file=' + window.location.origin + sUrl + 
                        '&lang=<?php  
        echo $_SESSION['account']['locale']; 
        ?> 
&skin=<?php  
        echo $_SESSION['account']['skin']; 
        ?> 
&wt=<?php  
        echo $bWithTranslate; 
        ?> 
' width='100%' height='100%' style='border: none;' />'); 
                    this.oContext.find('.preview_right_header').hide(); 
                    this.oRightContext.html(iframeElement); 
                    this.oRightContext.css({'min-height' : '930px', 'height' : '930px', 'overflow': 'hidden', 'display' : 'grid'}); 
                }, 
 
                loadOnlyoffice: function(aData) { 
                    $('.anyviewer_document_view_rotate_left_control').hide(); 
                    $('.anyviewer_document_view_rotate_right_control').hide(); 
                    this.oRightContext.html('<div id='preview_right_content_div'></div>'); 
                    new DocsAPI.DocEditor('preview_right_content_div', { 
                        'documentType': aData['document_type'], 
                        'document': { 
                            'fileType': aData['ext'], 
                            'key': aData['key'], 
                            'title': aData['title'], 
                            'url': aData['preview_url'], 
                            'permissions': { 
                                'comment': false, 
                                'copy': false, 
                                'deleteCommentAuthorOnly': true, 
                                'download': false, 
                                'edit': false, 
                                'editCommentAuthorOnly': true, 
                                'fillForms': false, 
                                'modifyContentControl': false, 
                                'modifyFilter': false, 
                                'print': false, 
                                'review': false 
                            } 
                        }, 
                        'editorConfig': { 
                            'callbackUrl': aData['preview_url'], 
                            'lang': '<?php  
        echo $_SESSION['account']['locale']; 
        ?> 
', 
                            'mode': 'view', 
                            'region': 'ru-RU', 
                            'user': { 
                                'id': '<?php  
        echo \app\user\Account::getaccount()->getsid(); 
        ?> 
', 
                                'name': <?php  
        echo json_encode(\app\user\Account::getaccount()->getemployee()); 
        ?> 
                            }, 
                            'customization' : { 
                                'chat': false, 
                                'comments': false, 
                                'compactHeader': true, 
                                'compactToolbar': false, 
                                'compatibleFeatures': false, 
                                'customer': { 
                                    'address': ', . -, .  5', 
                                    'info': '', 
                                    'logo': '<?php  
        echo getSiteUrl(); 
        ?> 
/css/common/login_page/new_logo_1.png', 
                                    'mail': '[email protected]', 
                                    'name': 'TOO Documentolog', 
                                    'www': 'www.documentolog.kz' 
                                }, 
                                'forcesave' : true, 
                                'help': true, 
                                'hideNotes': true, 
                                'hideRightMenu': true, 
                                'hideRulers': false, 
                                //'loaderName': 'Documentolog', 
                                //'loaderLogo': '<?php  
         
        ?> 
/css/common/login_page/new_logo_1.png', 
                                'logo': { 
                                    'image': '<?php  
        echo getSiteUrl(); 
        ?> 
/css/common/login_page/new_logo_1.png', 
                                    'imageEmbedded': '<?php  
        echo getSiteUrl(); 
        ?> 
/css/common/login_page/new_logo_1.png', 
                                    'url': '<?php  
        echo getSiteUrl(); 
        ?> 
' 
                                }, 
                                'macros': false, 
                                'macrosMode': 'disable', 
                                'mentionShare': false, 
                                'plugins': false, 
                                'review': { 
                                    'hideReviewDisplay': true, 
                                    'trackChanges': false 
                                }, 
                                'spellcheck': true, 
                                'toolbarHideFileName': true, 
                                'toolbarNoTabs': true, 
                                'uiTheme': 'theme-light', 
                                'unit': 'cm', 
                                'zoom': 90 
                            } 
                        }, 
                        'type': 'desktop' 
                    }); 
                    this.oRightContext.css({'min-height' : '930px', 'height' : '930px', 'overflow': 'hidden', 'display' : 'grid'}); 
                }, 
 
                showError: function(sMessage) 
                { 
                    this.oRightContext.html('<div style='padding: 10px; padding-top: 50px; text-align: center;'>' + sMessage + '</div>'); 
                }, 
 
                print: function(sId) 
                { 
                    var oThis = this; 
                    if(oThis.aLoadedFiles[sId]['type'] == 'template') { 
                        oThis.loadFile(sId, true); 
                        $('.anyviewer_document_view_print_control').click(); 
                    } 
                    else { 
                        window.open('/media/print/' + oThis.aLoadedFiles[sId].file_id); 
                    } 
                }, 
                checkHtmlTemplate: function() { 
                    var oThis = this; 
                    for(var key in oThis.aLoadedFiles) { 
                        if(oThis.aLoadedFiles[key]['type'] == 'template') { 
                            oThis.loadFile(key, true); 
                        } 
                    } 
                }, 
                getFileMTime: function(sId) 
                { 
                    var iFileMTime = 0; 
                    $.get('/media/get-filemtime/' + sId,function(oResponse){ 
                        iFileMTime = oResponse['time']; 
                    }); 
                    return iFileMTime; 
                }, 
                duplicatedFiles: { }, 
                editDocument: function (sId) 
                { 
                    var oThis = this; 
                    if(oThis.aLoadedFiles[sId]['type'] == 'template') { 
                        oThis.loadFile(sId, true); 
                        $('.anyviewer_document_view_edit_control').click(); 
                        return; 
                    } 
 
                    <?php  
        if (!$aConfig['reviewing_simple']) { 
            goto Label_37037; 
        } 
        ?> 
                    <?php  
        if (\app\system\Registry::get('config')->get('app_editor_url') && \app\system\License::hasdocumentologoffice()) { 
            goto Label_37035; 
        } 
        ?> 
                    var sUrl = '<?php  
        echo getSiteUrl(); 
        ?> 
/dav/file/' + sId + '/<?php  
        echo hash('sha256', \app\user\Account::getaccount()->getsid()); 
        ?> 
-<?php  
        echo \app\system\Registry::get('config')->get('app_company'); 
        ?> 
/' + oThis.aFileNames[sId]; 
                    var oNsaApplet = null; 
                    var sFileExt = ['doc', 'DOC', 'docx', 'DOCX'].includes(oThis.aFileNames[sId].split('.').pop()); 
 
 
                    if(sFileExt && <?php  
        echo \app\system\Registry::get('config')->get('word_desktop_for_reviewing'); 
        ?> 
) { 
                        location.href='ms-word:ofe|u|' + sUrl; 
                    } else { 
                        DWSS.check({ 
                            error: function () { 
                                return false; 
                            }, 
                            success: function () { 
                                if (oNsaApplet == null) { 
                                    oNsaApplet = DWSS.init(); 
                                } else if (!oNsaApplet.WsIsOpen) { 
                                    oNsaApplet.create(); 
                                } else if (oNsaApplet.WsIsOpen) { 
                                    oNsaApplet.close(); 
                                    oNsaApplet.create(); 
                                } 
 
                                var applet = oNsaApplet; 
                                applet.defualtError = function () { 
                                    throw '  '; 
                                } 
 
                                oNsaApplet.processWs = function () { 
                                    applet.send('dav', 'run', 'new', [sUrl], { 
                                        success: function () { 
                                            console.log('dav run ' + sUrl); 
                                        } 
                                    }); 
                                } 
                            } 
                        }); 
                    } 
                    <?php  
        goto Label_37036; 
        Label_37035: 
        ?> 
                    window.open('/media/edit/' + sId + '?doctype_id=<?php  
        echo a($aConfig, 'doctype_id') . '&document_id=' . a($aConfig, 'document_id'); 
        ?> 
', '_self'); 
                    <?php  
        Label_37036: 
        ?> 
                    return; 
                    <?php  
        Label_37037: 
        ?> 
 
                    var oDef = $.Deferred(); 
                    var sChangedId = ''; 
                    isForDuplicate = true; 
                    for (var s in this.aChangedFiles) { 
                        if (this.aChangedFiles.hasOwnProperty(s)) { 
                            if (this.aChangedFiles[s]['changed_id'] == sId) { 
                                isForDuplicate = false; 
                                sId = s; 
                                break; 
                            } 
                        } 
                    } 
 
                    for (var s in this.duplicatedFiles) { 
                        if (this.duplicatedFiles.hasOwnProperty(s) && this.duplicatedFiles[s] == sId) { 
                            isForDuplicate = false; 
                            sChangedId = sId; 
                            break; 
                        } 
                    } 
 
                    if ( 
                        isForDuplicate && ( 
                            this.aChangedFiles[sId] == undefined 
                            || !this.aChangedFiles[sId]['changed_id'] 
                            || this.aChangedFiles[sId]['changed_id'].length == 0 
                        ) 
                    ) { 
                        if (oThis.duplicatedFiles.hasOwnProperty(sId)) { 
                            sChangedId = oThis.duplicatedFiles[sId]; 
                            oDef.resolve(); 
                        } else { 
                            $.post('/media/duplicate-file', { id: sId, msf_id: $('#msf_id').val() }, function (oResponse) 
                            { 
                                if (oResponse['status']) { 
                                    oThis.duplicatedFiles[sId] = oResponse['changed_id']; 
                                    sChangedId = oResponse['changed_id']; 
                                    if (!array_key_exists(sChangedId, this.aChangedFiles)) { 
                                        oThis.aChangedFiles[sChangedId] = { 'changed_id': sChangedId }; 
                                    } 
 
                                    oDef.resolve(); 
                                } else { 
                                    alert(oResponse['msg']); 
                                } 
                            }, 'json'); 
                        } 
                    } else { 
                        sChangedId = this.aChangedFiles[sId]['changed_id']; 
                        oDef.resolve(); 
                    } 
 
                    oDef.done(function () 
                    { 
                        if ( 
                            $('#preview_item_' + sId).length 
                            && $('#preview_item_' + sId).attr('onclick').indexOf('MSF_PreviewVar<?php  
        echo $aConfig['var']['name']; 
        ?> 
.loadFile') > -1 
                        ) { 
                            $('#preview_item_' + sId).attr('onclick', 'event.preventDefault(); MSF_PreviewVar<?php  
        echo $aConfig['var']['name']; 
        ?> 
.loadFile('' + sChangedId + '');'); 
                        } 
 
                        var id = 'DAVLauncher_' + sChangedId; 
                        oThis.sCurrentId = sChangedId; 
 
                        if (!array_key_exists(sChangedId, oThis.aFilesTimes)) { 
                            oThis.aFilesTimes[sChangedId] = 0; 
                        } 
 
                        <?php  
        if (\app\system\Registry::get('config')->get('app_editor_url') && \app\system\License::hasdocumentologoffice()) { 
            goto Label_37038; 
        } 
        ?> 
                        var sUrl = '<?php  
        echo getSiteUrl(); 
        ?> 
/dav/file/' + sChangedId + '/' + forge.md.sha256.create().update('<?php  
        echo \app\user\Account::getaccount()->getsid(); 
        ?> 
' + sChangedId).digest().toHex() + '-<?php  
        echo \app\system\Registry::get('config')->get('app_company'); 
        ?> 
/' + oThis.aFileNames[sId]; 
 
                        var oApplet = $('#' + id)[0]; 
 
                        var oNsaApplet = null; 
                        var sFileExt = ['doc', 'DOC', 'docx', 'DOCX'].includes(oThis.aFileNames[sId].split('.').pop()); 
 
                        if(sFileExt && <?php  
        echo \app\system\Registry::get('config')->get('word_desktop_for_reviewing'); 
        ?> 
) { 
                            location.href='ms-word:ofe|u|' + sUrl; 
                        } else { 
                            DWSS.check({ 
                                error: function () { 
                                    return false; 
                                }, 
                                success: function () { 
                                    if (oNsaApplet == null) { 
                                        oNsaApplet = DWSS.init(); 
                                    } else if (!oNsaApplet.WsIsOpen) { 
                                        oNsaApplet.create(); 
                                    } else if (oNsaApplet.WsIsOpen) { 
                                        oNsaApplet.close(); 
                                        oNsaApplet.create(); 
                                    } 
 
                                    var applet = oNsaApplet; 
                                    applet.defualtError = function () { 
                                        throw '  '; 
                                    } 
 
                                    oNsaApplet.processWs = function () { 
                                        applet.send('dav', 'run', 'new', [sUrl], { 
                                            success: function () { 
                                                console.log('dav run ' + sUrl); 
                                            } 
                                        }); 
                                    } 
                                } 
                            }); 
                        } 
                        <?php  
        goto Label_37039; 
        Label_37038: 
        ?> 
                        window.open('/media/edit/' + sChangedId + '?doctype_id=<?php  
        echo a($aConfig, 'doctype_id') . '&document_id=' . a($aConfig, 'document_id'); 
        ?> 
', '_self'); 
                        <?php  
        Label_37039: 
        ?> 
 
                    }); 
                } 
            }; 
            var attached_file_active = $('.preview_top .attached_file')[0] 
            $(attached_file_active).toggleClass('attached_file-active') 
            $('.attached_file').click(function() { 
                if($(this).hasClass('attached_file-active')) { 
                    $(this).removeClass('attached_file-active') 
                } else { 
                    $('.attached_file').removeClass('attached_file-active') 
                    $(this).addClass('attached_file-active') 
                } 
            }) 
            MSF_PreviewVar<?php  
        echo $aConfig['var']['name']; 
        ?> 
.init(); 
            /* ]]> */ 
        </script> 
 
        <style> 
            .preview_var .preview_left .download_all_control>a { color: #086680; cursor: pointer; text-decoration: underline; } 
            .preview_var .preview_left .download_all_control>a:hover { text-decoration: none; } 
            .preview_var .preview_left { padding-top: 20px; } 
            .preview_var .preview_left ul li { margin: 0; text-align: center; margin-bottom: 10px; } 
            .preview_var .preview_left ul li a { color: #666666; font-size: 12px; line-height: 14px; } 
            .preview_var .preview_left ul li a .doc_icon { width: 35px; height: 45px; margin: 0 auto; margin-bottom:5px; } 
            .preview_var .preview_left ul li a .default_small_icon { background:url('/tpl/web/img/preview_icons/default_small_icon.png'); } 
            .preview_var .preview_left ul li a .pdf_small_icon { background:url('/tpl/web/img/preview_icons/pdf_small_icon.png'); } 
            .preview_var .preview_left ul li a .docx_small_icon { background:url('/tpl/web/img/preview_icons/docx_small_icon.png'); } 
            .preview_var .preview_left ul li a .doc_small_icon { background:url('/tpl/web/img/preview_icons/doc_small_icon.png'); } 
            .preview_var .preview_left ul li a .rtf_small_icon { background:url('/tpl/web/img/preview_icons/rtf_small_icon.png'); } 
            .preview_var .preview_left ul li a .xlsx_small_icon { background:url('/tpl/web/img/preview_icons/xlsx_small_icon.png'); } 
            .preview_var .preview_left ul li a .xls_small_icon { background:url('/tpl/web/img/preview_icons/xls_small_icon.png'); } 
            .preview_var .preview_left ul li a .jpeg_small_icon { background:url('/tpl/web/img/preview_icons/jpeg_small_icon.png'); } 
            .preview_var .preview_left ul li a .zip_small_icon { background:url('/tpl/web/img/preview_icons/zip_small_icon.png'); } 
            .preview_var .preview_left ul li a .rar_small_icon { background:url('/tpl/web/img/preview_icons/rar_small_icon.png'); } 
            .preview_var .preview_right { padding-top: 20px; } 
 
            .preview_var .state_loading{ 
                display:inline-block; margin:0 auto; vertical-align:middle; width:150px; padding:0 0 0 28px; text-align:left; 
                background:#f6f6f6 url('/css/themev1/skins/skin1/controls/any_viewer/loading.gif') no-repeat 4px center; color:#222; txt-shadow:0 1px 0 #fff; 
                user-select: none; -moz-user-select: none; -khtml-user-select: none; -webkit-user-select: none; 
            } 
 
            .preview_var .page_wrap { background-color: #f5f5f5;} 
            .preview_var .page_wrap.page_loading{ background:url('/css/themev1/skins/skin1/controls/any_viewer/page_loading.gif') no-repeat center center; } 
 
            .preview_var .page_label { 
                height:14px; padding-top:2px; width: 100%; color:#555; display: inline-block; background:#e0e0e0; 
                font-size:8pt; font-weight:bold; line-height:14px; text-align:center; text-shadow:0 1px 0 #fff; 
                -webkit-border-top-left-radius:6px; -webkit-border-top-right-radius:6px; 
                -moz-border-radius-topleft:6px; -moz-border-radius-topright:6px; 
                border-top-left-radius:6px; border-top-right-radius:6px; 
                margin-top: -8px; 
            } 
            .load_pdfjs { 
                position:absolute; 
                left: 0; 
                top: 0; 
                bottom: 0; 
                right: 0; 
                background-color: rgba(0, 0, 0, 0.07); 
                text-align: center;padding-top: 30%; 
                cursor: pointer; 
            } 
            .preview_var .page_label_bottom { 
                height:14px; padding-top:2px; width: 100%; color:#555; display:block; background:#e0e0e0; 
                font-size:8pt; font-weight:bold; line-height:14px; text-align:center; text-shadow:0 1px 0 #fff; 
                -webkit-border-bottom-left-radius:6px; -webkit-border-bottom-right-radius:6px; 
                -moz-border-radius-bottomleft:6px; -moz-border-radius-bottomright:6px; 
                border-bottom-left-radius:6px; border-bottom-right-radius:6px; 
            } 
 
            /* Download btn */ 
            .preview_var .download_control input{ background:url('/css/themev1/skins/skin2/controls/icons/download_small_gray.png') no-repeat center center !important; width: 22px; } 
 
            /* Download decision btn */ 
            .preview_var .download_decision_control input{ background:url('/css/themev1/skins/skin2/controls/icons/decisions_small_gray.png') no-repeat center center !important; width: 22px; } 
 
            /* Print btn */ 
            .preview_var .print_control input{ background:url('/css/themev1/skins/skin1/controls/icons/print_small.png') no-repeat center center !important; width: 22px;} 
 
            /* Print btn */ 
            .preview_var .edit_control input{ background:url('/css/themev1/skins/skin2/controls/icons/edit_micro_gray.png') no-repeat center center !important; width: 22px;} 
 
            /* Rotate btn */ 
            .preview_var .rotate_left_control input{ background:url('/tpl/web/img/preview_icons/rotate_left.png') no-repeat center center !important; width: 22px; } 
 
            .preview_var .rotate_right_control input{ background:url('/tpl/web/img/preview_icons/rotate_right.png') no-repeat center center !important; width: 22px; } 
 
            /* Fullscreen btn */ 
            .preview_var .fullscreen_control{ margin: 0 !important; border: 0;  } 
            .preview_var .fullscreen_control input{ background:url('/tpl/web/img/preview_icons/enable_fullscreen.png') no-repeat 4px 4px !important; width: 22px; } 
            .preview_var .fullscreen_control input.expanded{ background:url('/tpl/web/img/preview_icons/disable_fullscreen.png') no-repeat 4px 4px !important; } 
 
            /* Navigator control */ 
            .preview_var .navigator_control{ 
                position:relative; overflow:hidden; color:#fff; display:inline-block; border:1px solid #ccc; font-weight:bold; margin-left:4px; padding:0 14px; text-shadow:0 1px 0 #111; 
                -webkit-border-radius: 12px; -moz-border-radius: 12px; border-radius: 12px; 
                user-select: none; -moz-user-select: none; -khtml-user-select: none; -webkit-user-select: none; 
            } 
            .preview_var .navigator_control .nav_btn{ cursor:pointer; position:absolute; top:-1px; display:block; width:22px; height:24px; background:#fff url('/css/themev1/skins/skin2/controls/content_buttons/btn_bg.gif') repeat-x bottom; } 
            .preview_var .navigator_control .nav_btn .icon{ display:block; width:22px; height:24px; } 
 
            .preview_var .navigator_control .left_btn{ left:0; border-right:1px solid #444; } 
            .preview_var .navigator_control .left_btn .icon{ background:url('/css/themev1/skins/skin2/controls/icons/zoom_in_small_gray.png') no-repeat 8px 8px; } 
            .preview_var .navigator_control .left_btn:active .icon{ background-position:8px 9px; } 
            .preview_var .navigator_control .right_btn{ right:0; border-left:1px solid #444; } 
            .preview_var .navigator_control .right_btn .icon{ background:url('/css/themev1/skins/skin2/controls/icons/zoom_out_small_gray.png') no-repeat 6px 9px; } 
            .preview_var .navigator_control .right_btn:active .icon{ background-position:6px 10px; } 
 
            .preview_var .navigator_control .value{ display:block; background:#555; width:60px; height:19px; padding-top:3px; text-align:center; } 
            .preview_var .navigator_control .nav_btn:hover{ background-image:url('/css/themev1/skins/skin2/controls/content_buttons/btn_bg.gif'); } 
 
 
            /* pagination bar control */ 
 
 
            .hr-top { border-top: 2px solid #ccc; margin-bottom: 10px;} 
            .hr-bottom { border-bottom: 2px solid #ccc; margin-bottom: 10px;} 
            .preview_var .preview_left ul li a[data-archive-open='false'] .icon-open::after {content: '\25bc';} 
            .preview_var .preview_left ul li a[data-archive-open='true'] .icon-open::after {content: '\25b2';} 
            .preview_var {position: relative; text-align: center;} 
            .preview_var .preview_left {position: absolute;top: 0;bottom: 0; width: 120px;padding-left: 10px;} 
            .preview_var .mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar {background-color: #000;} 
            .preview_top .attached_file{ margin-right:8px; margin-bottom: 12px; display:inline-block; float: left; 
                position: relative; } 
            .attached_file-active > a.filename{background-color: #d2d2d2 !important; color:#fff !important;} 
            .preview_top .attached_file .filename{ 
                display: inline-block; 
                overflow: hidden; 
                margin: 0 0 -5px; 
                background: #f7f7f7; 
                color: #5d5d5d; 
                text-decoration: none; 
                -webkit-border-radius: 3px; 
                -moz-border-radius: 3px; 
                border-radius: 3px; 
                text-overflow: ellipsis; 
                white-space: nowrap; 
                max-width: 180px; 
                padding: 4px 7px 3px 7px; 
            } 
            .preview_top .attached_file_download { 
                display: inline-block; 
                width: 20px; 
                height: 25px; 
                text-align: center; 
                margin-left: -10px; 
                padding-top: 9px; 
                color: #32558c; 
                font-size: 0.9em; 
                cursor: pointer; 
                top: -2px; 
                position: relative; 
                background-color: #f7f7f7; 
                border-top-right-radius: 3px; 
                border-bottom-right-radius: 3px; 
            } 
            .preview_top .attached_file .filename:hover, .preview_top .attached_file_download:hover { background:#ddd; text-shadow: initial; } 
            .preview_top .attached_file .archive_content { 
                position: absolute; 
                background-color: #fff; 
                top: 27px; 
                width: 190px; 
                box-shadow: 0 2px 3px rgba(0, 0, 0, 0.3); 
                max-height: 300px; 
                overflow-y: auto; 
                z-index: 2; 
            } 
            .preview_top .attached_file .archive_content_item { 
                padding: 5px 7px; 
                border-bottom: 1px solid #eee; 
                cursor: pointer; 
                white-space: nowrap; 
                overflow:hidden !important; 
                text-overflow: ellipsis; 
            } 
            .preview_top .attached_file .archive_content_item:hover { 
                background-color: #eee; 
            } 
            .preview_top { 
                overflow: hidden; 
                position: relative; 
                height: 30px; 
            } 
            .preview_top_left, .preview_top_right { 
                position: absolute; 
                top: -6px; 
                font-size: 24px; 
                line-height: 34px; 
                background-color: #fff; 
                padding: 0 5px; 
                cursor: pointer; 
                -webkit-user-select: none; 
                -moz-user-select: none; 
                -ms-user-select: none; 
                user-select: none; 
                z-index: 1; 
                margin-bottom: 10px; 
            } 
            .preview_top_left { left: -15px; display: none; } 
            .preview_top_right { right: -15px; } 
            @media all and (-ms-high-contrast: none), (-ms-high-contrast: active) { /* if IE10/11 */ 
                .preview_top_left { left: -5px;} 
                .preview_top_right { right: -5px; } 
            } 
            .preview_top_left:hover, .preview_top_right:hover { 
                color: #2196F3; 
            } 
            .preview_var { 
                overflow:hidden; 
            } 
        </style> 
        <script> 
            $(function() { 
                var preview_top = $('#var_<?php  
        echo $aConfig['var']['name']; 
        ?> 
 .preview_top'); 
                function previewTopScroll(callback) { 
                    setTimeout(function(){ 
                        if(preview_top.is(':visible') && !+preview_top.data('scroll')) { 
                            var inner_wrap_width = 0; 
                            var step = 300; 
                            var animSpeed = 200; 
                            preview_top.find('.attached_file').each(function () { 
                                inner_wrap_width += +$(this).outerWidth(true); 
                            }); 
                            inner_wrap_width +=55; 
                            var inner_wrap_width_1 = inner_wrap_width; 
                            if (preview_top.width() < inner_wrap_width) { 
                                preview_top.wrapInner('<div class='preview_top_inner_wrap'></div>'); 
                                preview_top.prepend('<span class='preview_top_left'></span>'); 
                                preview_top.append('<span class='preview_top_right'></span>'); 
                                var preview_top_inner_wrap = $('.preview_top_inner_wrap'); 
                                preview_top_inner_wrap.css('width', inner_wrap_width); 
 
 
                                var preview_top_right = $('.preview_top_right'); 
                                var preview_top_left = $('.preview_top_left'); 
 
 
                                preview_top_right.live('click', function () { 
                                    inner_wrap_width = inner_wrap_width - step; 
                                    if (preview_top.width() < inner_wrap_width) { 
                                        preview_top_inner_wrap.animate({ 
                                            marginLeft: parseInt(preview_top_inner_wrap.css('margin-left')) - step + 'px' 
                                        }, animSpeed, 'linear', function () { 
                                            preview_top_left.show(); 
                                        }); 
                                    } else { 
                                        preview_top_inner_wrap.animate({ 
                                            marginLeft: preview_top.width() - inner_wrap_width_1 + 'px' 
                                        }, animSpeed, 'linear', function () { 
                                            preview_top_left.show(); 
                                            preview_top_right.hide(); 
                                            inner_wrap_width = preview_top.width(); 
                                        }); 
                                    } 
 
                                }); 
 
                                preview_top_left.live('click', function () { 
                                    inner_wrap_width = inner_wrap_width + step; 
                                    if (parseInt(preview_top_inner_wrap.css('margin-left')) + step < 0) { 
                                        preview_top_inner_wrap.animate({ 
                                            marginLeft: parseInt(preview_top_inner_wrap.css('margin-left')) + step + 'px' 
                                        }, animSpeed, 'linear', function () { 
                                            preview_top_right.show(); 
                                        }); 
                                    } else { 
                                        preview_top_inner_wrap.animate({ 
                                            marginLeft: '0px' 
                                        }, animSpeed, 'linear', function () { 
                                            preview_top_right.show(); 
                                            preview_top_left.hide(); 
                                        }); 
                                    } 
                                }); 
                            } 
                            preview_top.data('scroll', 1); 
                        } 
                        typeof callback === 'function' ? callback() : ''; 
                    }, 150); 
                } 
 
                if(preview_top.is(':visible')) { 
                    previewTopScroll(function(){ 
                        $('.preview_top').css('overflow', 'initial'); 
                    }); 
                } else { 
                    var targetNode = findHiddenParent(preview_top); 
                    if(targetNode != false) { 
                        var callback = function(mutationsList, observer) { 
                            mutationsList.forEach(function(key) { 
                                if(key.type == 'attributes') { 
                                    if(preview_top.is(':visible')) { 
                                        previewTopScroll(function(){ 
                                            $('.preview_top').css('overflow', 'initial'); 
                                        }); 
                                        observer.disconnect(); 
                                    } 
                                } 
                            }); 
                        }; 
                        var config = { attributes: true }; 
                        var observer = new MutationObserver(callback); 
                        observer.observe(targetNode, config); 
                    } 
                } 
 
                function findHiddenParent(el) { 
                    var hiddenParent = false; 
                    el.parents().each(function(){ 
                        if($(this).is(':visible')) { 
                            return false; 
                        } 
                        hiddenParent = $(this); 
                    }); 
                    return hiddenParent != false ? hiddenParent[0] : hiddenParent; 
                } 
            }) 
        </script> 
        <style> 
            #preview-word * { 
                box-sizing: border-box; 
                word-break: break-word; 
            } 
            #preview-word { 
                max-height: 600px; 
            } 
            #preview-word .word-page { 
                width: 210mm; 
                min-height: 297mm; 
                box-shadow: 0 0 5px rgba(0,0,0,0.6); 
                padding: 20mm 15mm 20mm 30mm; 
                position: relative; 
                background-color: #ffffff; 
                font-size: 12pt; 
                transform-origin: 0 0; 
                font-family: 'Times New Roman', Times, serif; 
                overflow-y: auto; 
                margin: 0 auto; 
                text-align: left; 
            } 
            #preview-word hr { 
                border: none; 
                border-bottom: 2px solid #000; 
            } 
            @-moz-document url-prefix() { 
                #preview-word .word-page .word-content { 
                    margin-bottom: 20mm; 
                } 
            } 
        </style> 
        <script> 
            function scaleWordPage() { 
                var previewWordWrap = document.getElementById('preview-word'); 
                if(previewWordWrap) { 
                    var wordPage = document.querySelector('#preview-word .word-page'); 
                    previewWordWrap.style.height = wordPage.offsetHeight*previewWordWrap.offsetWidth/wordPage.offsetWidth+'px'; 
                    wordPage.style.transform = 'scale('+previewWordWrap.offsetWidth/wordPage.offsetWidth+')'; 
                } 
            } 
        </script> 
        <?php  
        $s = ob_get_clean(); 
        return $s; 
    } 
    public static function decisiontasksvarloader($aVariable) 
    { 
        ob_start(); 
        ?> 
        <div id='decision_task_var_<?php  
        echo $aVariable['config']['name']; 
        ?> 
' class='decision_task_var_cnt'> 
            <img src='/tpl/web/img/themev1/login_load.gif' /> 
        </div> 
        <script> 
            jQuery(document).ready(function(){ 
                jQuery.get('/workflow/document/decision-tasks/<?php  
        echo $aVariable['doctype_id']; 
        ?> 
/<?php  
        echo $aVariable['document_id']; 
        ?> 
/<?php  
        echo $aVariable['config']['name']; 
        ?> 
', {}, function(sHtml){ 
                    $('#decision_task_var_<?php  
        echo $aVariable['config']['name']; 
        ?> 
').html(sHtml); 
                }); 
            }); 
        </script> 
        <style> 
        </style> 
        <?php  
        return ob_get_clean(); 
    } 
    public static function decisiontasksvarview($aConfig) 
    { 
        $oL = \app\system\Registry::get('locale'); 
        $sDoctypeId = null; 
        $sDocumentId = null; 
        $aTasks = array(); 
        $aFields = array(); 
        $sOt = \app\user\Account::getaccount()->getlocale() == 'en' ? ' from ' : (\app\user\Account::getaccount()->getlocale() == 'kz' ? ' ' : ' \320\276\xd1\202 '); 
        ob_start(); 
        ?> 
        <?php  
        if (count($aConfig['data']) == 1 && $aConfig['data'][0]['version'] == 1 && a($aConfig['var'], 'hide_if_alone', 0)) { 
            goto Label_37061; 
        } 
        ?> 
        <div class='decision_task_var'> 
            <?php  
        foreach ($aConfig['data'] as $iRow => $aRow) { 
            ?> 
                <?php  
            if (!($aRow['id'] == $aRow['redaction_id'])) { 
                goto Label_37040; 
            } 
            $sDoctypeId = $aRow['doctype_id']; 
            $sDocumentId = $aRow['id']; 
            Label_37040: 
            $oDoctype = new \app\workflow\doctype\Doctype($aRow['doctype_id']); 
            $oDoctype->load(); 
            $aFields = $oDoctype->getfields(); 
            ?> 
                <div> 
                    <?php  
            if (!(count($aConfig['data']) > 1)) { 
                goto Label_37041; 
            } 
            ?> 
                        <span class='decision_task_var_toggle <?php  
            echo $aConfig['document_id'] != $aRow['id'] ? 'plus' : 'minus'; 
            ?> 
'> 
                            &nbsp; 
                        </span> 
                    <?php  
            Label_37041: 
            ?> 
                    <?php  
            if (!($aConfig['document_id'] != $aRow['id'])) { 
                goto Label_37042; 
            } 
            ?> 
                    <a href='/workflow/document/view/<?php  
            echo $aRow['doctype_id']; 
            ?> 
/<?php  
            echo $aRow['id']; 
            ?> 
?mydocuments'> 
                        <?php  
            Label_37042: 
            ?> 
                        <?php  
            echo $oL->get('\xd0\x92\xd0\xb5\xd1\200\xd1\201\xd0\270\321\x8f'); 
            ?> 
 <?php  
            echo $aRow['version']; 
            ?> 
                        <?php  
            echo empty($aRow['created_at_date']) ? '' : $sOt . ' '; 
            echo \app\system\Util::unserializedate($aRow['created_at_date']); 
            ?> 
                        <?php  
            echo empty($aRow['reg_number']) && empty($aRow['reg_tstamp']) ? '' : ': '; 
            ?> 
                        <?php  
            echo empty($aRow['reg_number']) ? '' : '\342\x84\x96 '; 
            echo $aRow['reg_number']; 
            ?> 
                        <?php  
            echo empty($aRow['reg_tstamp']) ? '' : $sOt . ' '; 
            echo \app\system\Util::unserializedate($aRow['reg_tstamp']); 
            ?> 
                        <?php  
            echo empty($aRow['version_comment']) ? '' : ' (' . $aRow['version_comment'] . ')'; 
            ?> 
                        <?php  
            if (!($aConfig['document_id'] != $aRow['id'])) { 
                goto Label_37043; 
            } 
            ?> 
                    </a> 
                <?php  
            Label_37043: 
            ?> 
                    <div class='decision_task_var_toggle_content' style='<?php  
            echo $aConfig['document_id'] != $aRow['id'] ? 'display:none;' : 'display:block;'; 
            ?> 
'> 
                        <?php  
            foreach ($aConfig['blocks'] as $sBlockName => $aBlockConfig) { 
                ?> 
                            <?php  
                if (!(isset($aRow[$sBlockName . '_field']) && count($aRow[$sBlockName . '_field']))) { 
                    goto Label_37044; 
                } 
                $aRow[$sBlockName . '_field'] = is_string($aRow[$sBlockName . '_field']) ? \app\reference\engine\ArrayMapperUtil::unserialize($aRow[$sBlockName . '_field']) : $aRow[$sBlockName . '_field']; 
                ?> 
                                <p> 
                                <div style='display:none'><?php  
                echo implode(',', $aRow[$sBlockName . '_field']); 
                ?> 
</div> 
                                <?php  
                foreach ($aRow[$sBlockName . '_field'] as $sPostKey => $sPostVal) { 
                    $aRow[$sBlockName . '_field'][$sPostKey] = sprintf('<span class="structureView_view_user_info" onmouseover="MSF_ViewUserInfo.view('%s', this)" onmouseleave="MSF_ViewUserInfo.blure(this)" title="%s"><span class="sV_user_info__inner">%s</span></span>', v($sPostKey), v(\app\reference\Util::getsidinfo($sPostKey, $aConfig)), v($sPostVal)); 
                } 
                ?> 
                                <?php  
                echo $oL->get($aBlockConfig['structure_title']); 
                ?> 
: <?php  
                echo implode(', ', $aRow[$sBlockName . '_field']); 
                ?> 
                                </p> 
 
                            <?php  
                Label_37044: 
                ?> 
                            <?php  
                if (!(isset($aRow[$sBlockName]) && count($aRow[$sBlockName]))) { 
                    goto Label_37056; 
                } 
                ?> 
                                <?php  
                foreach ($aRow[$sBlockName] as $iDec => $aDec) { 
                    ?> 
                                    <p> 
                                    <?php  
                    echo \app\system\Util::unserializetimestamp($aDec['tstamp']); 
                    ?> 
 <?php  
                    echo v($oL->get($aDec['text'] != '' ? $aDec['text'] : $aDec['title'])); 
                    ?> 
: 
 
                                    <span class='structureView_view_user_info' onmouseover='MSF_ViewUserInfo.view('<?php  
                    echo v($aDec['author_id']); 
                    ?> 
', this)' onmouseleave='MSF_ViewUserInfo.blure(this)' title='<?php  
                    echo v(\app\reference\Util::getsidinfo($aDec['author_id'], $aConfig)); 
                    ?> 
'> 
                                            <?php  
                    if (!($aRow['id'] == $aRow['redaction_id'] && $aDec['e_sign'] != '' && count($aDec['e_sign']) && count($aDec['sign_fields']))) { 
                        goto Label_37045; 
                    } 
                    $aTasks[] = $aDec['name']; 
                    ?> 
                                                <span id='decision_task_status_<?php  
                    echo $aConfig['var']['name']; 
                    ?> 
_<?php  
                    echo $aDec['task_name']; 
                    ?> 
_<?php  
                    echo $aDec['task_pos']; 
                    ?> 
' class='decision_task_var_eds loading verify_<?php  
                    echo $aDec['name']; 
                    ?> 
_<?php  
                    echo count($aTasks) - 1; 
                    ?> 
' >&nbsp;</span> 
                                            <?php  
                    Label_37045: 
                    ?> 
                                            <span class='sV_user_info__inner'><?php  
                    echo v($aDec['author']); 
                    ?> 
</span> 
                                        </span> <?php  
                    if (!strlen($aDec['comment'])) { 
                        goto Label_37046; 
                    } 
                    ?> 
, <?php  
                    echo v($aDec['comment']); 
                    Label_37046: 
                    ?> 
                                    <?php  
                    if (!count($aDec['custom_fields'])) { 
                        goto Label_37054; 
                    } 
                    ?> 
                                        <i class='fa fa-chevron-down' aria-hidden='true'></i> 
                                        <div id='custom_fields' style='display:none'> 
                                            <?php  
                    foreach ($aDec['custom_fields'] as $sK => $sV) { 
                        ?> 
                                                <?php  
                        if (in_array($aFields[$sK]['type'], array('structure', 'reference', 'enumeration'))) { 
                            goto Label_37052; 
                        } 
                        if (in_array($aFields[$sK]['type'], array('file', 'image'))) { 
                            goto Label_37050; 
                        } 
                        if ($aFields[$sK]['type'] == 'table') { 
                            goto Label_37048; 
                        } 
                        if (is_array($sV)) { 
                            goto Label_37047; 
                        } 
                        ?> 
                                                    <span><?php  
                        echo $aFields[$sK]['title'] . ' : ' . $sV; 
                        ?> 
</span><br> 
                                                <?php  
                        Label_37047: 
                        goto Label_37049; 
                        Label_37048: 
                        ?> 
                                                    <?php  
                        echo \app\reference\REF::viewfactory($sK, $sV, $aFields[$sK], true, false, true); 
                        ?> 
                                                <?php  
                        Label_37049: 
                        goto Label_37051; 
                        Label_37050: 
                        ?> 
                                                    <span><?php  
                        echo $aFields[$sK]['title'] . ' : '; 
                        ?> 
</span> 
                                                    <?php  
                        foreach ($sV as $sKey => $sValue) { 
                            ?> 
                                                        <span class='attached_file'> 
                                                            <a class='filename' href='/media/download/<?php  
                            echo $sKey; 
                            ?> 
' title='<?php  
                            echo v($sValue); 
                            ?> 
'><?php  
                            echo v($sValue); 
                            ?> 
</a> 
                                                            </span>, 
                                                    <?php  
                        } 
                        ?> 
                                                    <br> 
                                                <?php  
                        Label_37051: 
                        goto Label_37053; 
                        Label_37052: 
                        ?> 
                                                    <span><?php  
                        echo $aFields[$sK]['title'] . ' : ' . implode(', ', $sV); 
                        ?> 
</span><br> 
                                                <?php  
                        Label_37053: 
                        ?> 
                                            <?php  
                    } 
                    ?> 
                                        </div> 
                                    <?php  
                    Label_37054: 
                    ?> 
                                    <?php  
                    echo self::decisiontasksvarviewfile($aDec['files']); 
                    ?> 
                                    <?php  
                    $aChilds = array(); 
                    foreach ($aRow['childs'] as $iChild => $aChild) { 
                        if (!(\app\reference\Util::getsubspostid(key($aChild['creator'])) == \app\reference\Util::getsubspostid($aDec['author_id']))) { 
                            goto Label_37055; 
                        } 
                        $aChilds[] = $aChild; 
                        unset($aRow['childs'][$iChild]); 
                        Label_37055: 
                    } 
                    ?> 
                                    <?php  
                    echo self::decisiontasksvarviewpart($aChilds, $aConfig, 1); 
                    ?> 
                                    </p> 
                                <?php  
                } 
                ?> 
                            <?php  
                Label_37056: 
                ?> 
                        <?php  
            } 
            ?> 
                        <!--                            <a href='javascript:void(0)' class='showAll'> </a>--> 
                        <?php  
            foreach ($aRow['childs'] as $iChild => $aChild) { 
                ?> 
                            <?php  
                echo self::decisiontasksvarviewpart(array($aChild), $aConfig); 
                ?> 
                        <?php  
            } 
            ?> 
                        <?php  
            foreach ($aRow['reg'] as $iDec => $aDec) { 
                ?> 
                            <p> 
                                <?php  
                echo \app\system\Util::unserializetimestamp($aDec['tstamp']); 
                ?> 
 <?php  
                echo v($oL->get($aDec['title'])); 
                ?> 
: 
 
                                <span class='structureView_view_user_info' onmouseover='MSF_ViewUserInfo.view('<?php  
                echo v($aDec['author_id']); 
                ?> 
', this)' onmouseleave='MSF_ViewUserInfo.blure(this)' title='<?php  
                echo v(\app\reference\Util::getsidinfo($aDec['author_id'], $aConfig)); 
                ?> 
'> 
                                        <?php  
                if (!($aRow['id'] == $aRow['redaction_id'] && count($aDec['e_sign']))) { 
                    goto Label_37057; 
                } 
                $aTasks[] = $aDec['name']; 
                ?> 
                                            <span id='decision_task_status_<?php  
                echo $aConfig['var']['name']; 
                ?> 
_<?php  
                echo $aDec['task_name']; 
                ?> 
_<?php  
                echo $aDec['task_pos']; 
                ?> 
' class='decision_task_var_eds loading verify_<?php  
                echo $aDec['name']; 
                ?> 
_<?php  
                echo count($aTasks) - 1; 
                ?> 
' >&nbsp;</span> 
                                        <?php  
                Label_37057: 
                ?> 
                                        <span class='sV_user_info__inner'><?php  
                echo v($aDec['author']); 
                ?> 
</span> 
                                    </span>, <?php  
                echo v($aDec['text']); 
                if (!strlen($aDec['comment'])) { 
                    goto Label_37058; 
                } 
                ?> 
, <?php  
                echo v($aDec['comment']); 
                Label_37058: 
                ?> 
                                <?php  
                echo self::decisiontasksvarviewfile($aDec['files']); 
                ?> 
                            </p> 
                        <?php  
            } 
            ?> 
                    </div> 
                </div> 
            <?php  
        } 
        ?> 
        </div> 
        <script> 
            $('.fa-chevron-down').toggle(function(){ 
                $(this).parent().next().slideDown(); 
            }, function(){ 
                $(this).parent().next().slideUp(); 
            }); 
            $(function () { 
                $('#decision_task_var_<?php  
        echo $aConfig['var']['name']; 
        ?> 
 .decision_task_var .decision_task_var_toggle').click(function(){ 
                    var oThis = $(this); 
                    if(oThis.hasClass('minus')) 
                    { 
                        oThis.removeClass('minus').addClass('plus'); 
                    } 
                    else 
                    { 
                        oThis.removeClass('plus').addClass('minus'); 
                    } 
 
                    $(this).siblings('.decision_task_var_toggle_content').toggle(); 
                }); 
 
                <?php  
        if (count($aTasks)) { 
            goto Label_37059; 
        } 
        ?> 
                setTimeout(function() { 
                    ButtonChecker.setStatus(true); 
                },500); 
                <?php  
        goto Label_37060; 
        Label_37059: 
        ?> 
                $.get('/workflow/document/verify-eds', { 
                    isSession: false, 
                    doctype: '<?php  
        echo $sDoctypeId; 
        ?> 
', 
                    document: '<?php  
        echo $sDocumentId; 
        ?> 
', 
                    tasks: '<?php  
        echo implode(',', array_unique($aTasks)); 
        ?> 
', 
                    app_company: '<?php  
        echo \app\system\Registry::get('config')->get('app_company'); 
        ?> 
' 
                }, function (data) { 
                    if (data.status == 1) { 
                        var isValid = true; 
 
                        for(var task in data.verify){ 
                            if(data.verify[task].status){ 
                                $('#decision_task_status_<?php  
        echo $aConfig['var']['name']; 
        ?> 
_' + task).removeClass('loading').addClass('positive'); 
                            } else { 
                                $('#decision_task_status_<?php  
        echo $aConfig['var']['name']; 
        ?> 
_' + task).removeClass('loading').addClass('negative').attr('data-error', data.verify[task].html); 
                                isValid = false; 
                            } 
 
                        } 
 
                        ButtonChecker.setStatus(isValid); 
                    } 
                }, 'json'); 
                <?php  
        Label_37060: 
        ?> 
            }); 
        </script> 
    <?php  
        Label_37061: 
        ?> 
        <?php  
        $s = ob_get_clean(); 
        return $s; 
    } 
    public static function decisiontasksvarviewpart($aOrders, $aConfig, $iDepth = 0) 
    { 
        $oL = \app\system\Registry::get('locale'); 
        ob_start(); 
        ?> 
        <?php  
        foreach ($aOrders as $iRow => $aRow) { 
            ?> 
        <div <?php  
            echo $iDepth ? 'style="position: relative;"' : ''; 
            ?> 
> 
            <?php  
            if (!(count($aRow['childs']) || count($aRow['isp']))) { 
                goto Label_37062; 
            } 
            ?> 
                <span class='decision_task_var_toggle minus'> 
                            &nbsp; 
                        </span> 
            <?php  
            Label_37062: 
            ?> 
            <?php  
            echo \app\system\Util::unserializetimestamp($aRow['created_at']); 
            ?> 
            <a href='/workflow/document/view/<?php  
            echo $aRow['doctype_id']; 
            ?> 
/<?php  
            echo $aRow['id']; 
            ?> 
?mydocuments'><?php  
            echo \app\system\Registry::get('locale')->get($aRow['doctype_title']); 
            ?> 
:</a> 
            <?php  
            $i = 0; 
            foreach ($aRow['executor'] as $sExKey => $sExVal) { 
                $aRow['executor'][$sExKey] = sprintf('<span title="%s" style="%s">%s</span>', v(\app\reference\Util::getsidinfo($sExKey, $aConfig)), $i == 0 && count($aRow['executor']) > 1 ? 'color: #C2174B;' : '', v($sExVal)); 
                $i++; 
            } 
            ?> 
            <span title='<?php  
            echo v(\app\reference\Util::getsidinfo(key($aRow['creator']), $aConfig)); 
            ?> 
'><?php  
            echo v(current($aRow['creator'])); 
            ?> 
</span> - <?php  
            echo implode(', ', $aRow['executor']); 
            ?> 
, <?php  
            echo v(implode(', ', $aRow['ref_text'])); 
            ?> 
            <div class='decision_task_var_toggle_content'> 
                <?php  
            echo self::decisiontasksvarviewpart($aRow['childs'], $aConfig, $iDepth + 1); 
            ?> 
 
                <?php  
            foreach ($aRow['isp'] as $aDec) { 
                ?> 
                    <p style='padding-left: 20px;'> 
                        <?php  
                echo \app\system\Util::unserializetimestamp($aDec['tstamp']); 
                ?> 
 <?php  
                echo v($oL->get($aDec['title'])); 
                ?> 
: <span title='<?php  
                echo v(\app\reference\Util::getsidinfo($aDec['author_id'], $aConfig)); 
                ?> 
'><?php  
                echo v($aDec['author']); 
                ?> 
</span><?php  
                if (!strlen($aDec['comment'])) { 
                    goto Label_37063; 
                } 
                ?> 
, <?php  
                echo v($aDec['comment']); 
                Label_37063: 
                ?> 
                        <?php  
                echo self::decisiontasksvarviewfile($aDec['files']); 
                ?> 
                    </p> 
                <?php  
            } 
            ?> 
            </div> 
        </div> 
 
    <?php  
        } 
        ?> 
        <?php  
        $s = ob_get_clean(); 
        return $s; 
    } 
    private static function decisiontasksvarviewfile($aFiles) 
    { 
        $oL = \app\system\Registry::get('locale'); 
        ob_start(); 
        ?> 
        <?php  
        foreach ($aFiles as $sFileKey => $sFileVal) { 
            if (mb_strlen($sFileVal) > 40) { 
                goto Label_37064; 
            } 
            $sShortFileVal = $sFileVal; 
            goto Label_37065; 
            Label_37064: 
            $sShortFileVal = mb_substr($sFileVal, 0, 37) . '...'; 
            Label_37065: 
            ?> 
        <span class='attached_file'> 
                    <a class='filename' href='/media/download/<?php  
            echo $sFileKey; 
            ?> 
' title='<?php  
            echo v($sFileVal); 
            ?> 
'><?php  
            echo v($sShortFileVal); 
            ?> 
</a> 
                    <a class='af_btn_view' target='_blank' href='/media/preview/<?php  
            echo $sFileKey; 
            ?> 
' id='filepreview_btn_<?php  
            echo $sFileKey; 
            ?> 
' title='<?php  
            echo $oL->get('\320\x9f\xd1\x80\320\276\xd1\x81\320\274\320\276\xd1\x82\xd1\x80 \321\x84\xd0\xb0\xd0\xb9\xd0\273\320\xb0'); 
            ?> 
'> 
                        <span class='icon'>&nbsp;</span> 
                    </a> 
                </span> 
    <?php  
        } 
        ?> 
        <script type='text/javascript'> 
            <?php  
        if (!count($aFiles)) { 
            goto Label_37066; 
        } 
        ?> 
            MSF_AnyViewer.bind([ '<?php  
        echo join('","', array_keys($aFiles)); 
        ?> 
']); 
            <?php  
        Label_37066: 
        ?> 
        </script> 
        <?php  
        $s = ob_get_clean(); 
        return $s; 
    } 
    public static function timesheetsamrukvaredit($aData, $sDoctypeId, $sDocumentId, $mode = 'create') 
    { 
        $oL = \app\system\Registry::get('locale'); 
        ob_start(); 
        ?> 
        <script type='text/javascript'> 
 
            function isValid(obj) 
            { 
                for (var prop in obj) 
                { 
                    if(!$('[name*=''+obj[prop]+'']').length) 
                    { 
                        ShowErrorMessage('<?php  
        echo $oL->get('\xd0\x9f\321\200\xd0\276\xd0\262\xd0\xb5\xd1\200\321\x8c\321\x82\xd0\xb5 \320\xbd\320\xb0\xd0\273\320\270\xd1\207\xd0\270\320\xb5 \xd0\xb2\xd1\201\320\xb5\321\205 \xd0\xbf\xd0\276\xd0\xbb\320\xb5\xd0\271 \321\x88\320\260\xd0\xb1\xd0\xbb\xd0\276\320\275\xd0\xb5 \320\xb4\xd0\276\xd0\xba\321\x83\xd0\xbc\xd0\xb5\320\275\xd1\202\xd0\260'); 
        ?> 
'); 
                        return  false; 
                    } 
                } 
 
                return true; 
            } 
 
            function ShowErrorMessage(t) 
            { 
                MSF_StatusBar.hideWait(); 
                $('#results').show().children('#error').append('<div class='status_error' id='statusErrorItem_0'>'+t+'<br /></div>').show(); 
                setTimeout(function() { 
                    $('#statusErrorItem_0').hide(); 
                    $('#statusErrorItem_0').remove(); 
                    if($('#error').html().trim() == '') { 
                        $('#error').hide(); 
                    } 
                }, 5000); 
            }; 
 
            $(document).ready(function(){ 
 
                var oConfig =  { //  
                    'subdivision': '<?php  
        echo $aData['var']['subdivision']; 
        ?> 
', 
                    'year': '<?php  
        echo $aData['var']['year']; 
        ?> 
', 
                    'month': '<?php  
        echo $aData['var']['month']; 
        ?> 
' 
                }; 
                <?php  
        $aSummaryConfig = array(); 
        foreach (\app\workflow\util\VarUtil::gettimesheetdaytypes() as $sK => $sV) { 
            $aSummaryConfig[] = ''' . $sV . '':'' . $sK . '''; 
        } 
        ?> 
 
                var summaryConfig = {<?php  
        echo implode(',', $aSummaryConfig); 
        ?> 
}; 
 
                var tableExists = false; 
                /* */ 
                $('#bGenerate<?php  
        echo $aData['varType']; 
        ?> 
').click(function() 
                { 
                    if(!isValid(oConfig)) 
                        return; 
 
                    if(tableExists) 
                    { 
                        if (!confirm('<?php  
        echo $oL->get('\xd0\x92\xd1\213 \321\203\320\xb2\320\xb5\xd1\200\xd0\xb5\xd0\275\xd1\213, \321\x87\321\202\320\276 \xd1\x85\xd0\xbe\321\202\320\270\xd1\x82\xd0\xb5 \xd1\x81\xd0\xbe\xd0\xb7\xd0\xb4\320\xb0\xd1\202\xd1\x8c \320\xbd\xd0\276\320\xb2\321\x83\xd1\x8e \xd1\x82\320\xb0\320\xb1\320\xbb\xd0\xb8\321\206\xd1\203, \321\203\xd0\264\320\xb0\320\273\xd0\270\320\262 \xd1\201\xd1\x82\320\260\321\200\xd1\x83\321\x8e?'); 
        ?> 
')) 
                        { 
                            return; 
                        } 
                    } 
 
                    request = $.ajax({ 
                        type: 'POST', 
                        url: '/workflow/document/<?php  
        echo str_replace('_', '-', $aData['varType']); 
        ?> 
/<?php  
        echo $sDoctypeId; 
        ?> 
/<?php  
        echo $sDocumentId; 
        ?> 
/<?php  
        echo $aData['var']['name']; 
        ?> 
', 
                        data: $('#createRowForm').serialize(), 
                        dataType: 'json', 
                        success: function (oData) { 
                            if (array_key_exists('error', oData)) { 
                                ShowErrorMessage(oData.error); 
                            } else { 
                                $('#timesheet-table<?php  
        echo $aData['varType']; 
        ?> 
').html(oData.html); 
                                calcAllSummary(); 
                            } 
                        }, 
                        error: function (data) { 
                            ShowErrorMessage('<?php  
        echo $oL->get('\320\x9f\321\x80\320\xbe\xd0\xb8\320\267\xd0\xbe\321\x88\xd0\xbb\320\xb0 \xd0\xbe\xd1\210\320\270\xd0\261\320\xba\xd0\260 \320\262\320\xbe \320\262\321\x80\xd0\xb5\xd0\xbc\321\217 \xd0\xb7\xd0\260\xd0\277\321\200\320\276\321\x81\xd0\xb0.'); 
        ?> 
'); 
                        } 
                    }); 
                }); 
 
                //         
                $('.variable_timesheet select[name*='[posts]']').live('change', function() 
                { 
                    var currentPostId = $(this).parent().parent().parent().attr('id'); 
                    calcSummary(currentPostId); 
                    $(this).siblings('.timesheet_day_value').text($(this).val()); 
                }); 
 
                $('.variable_timesheet select.month_day_select').die('change').live('change', function() 
                { 
                    var sTdNum = $(this).data('td_num'); 
                    var sVal = $(this).val(); 
                    if($.trim(sVal).length == 0) 
                    { 
                        return; 
                    } 
                    var oTable = $(this).parent().parent().parent().parent(); 
                    oTable.children('tr:not(.title .subtitle)').children('td').each(function(){ 
                        //console.log($(this).data('td_num')); 
                        if($(this).data('td_num') == sTdNum) 
                        { 
                            $(this).find('.timesheet_day_value').text(sVal); 
                            $(this).find('select.abbr').val(sVal); 
                            var currentPostId = $(this).parent().attr('id'); 
                            //console.log(currentPostId); 
                            calcSummary(currentPostId); 
                        } 
                    }) 
                    //calcAllSummary(); 
                }); 
 
                /** 
                 *         
                 * 
                 * @param {type} sName 
                 * @returns {undefined} 
                 */ 
                function calcSummary(sName) 
                { 
                    var qtyBuffer = []; 
                    var qty = 0; 
                    var currentVal; 
 
                    //       
                    $.each(summaryConfig, function(dayType, dayDesc) 
                    { 
                        qtyBuffer[dayType] = 0; 
                    }); 
 
                    //      
                    $('.variable_timesheet [name*='[posts]['+sName+'']').each(function(i, select) 
                    { 
                        currentVal = $(select).children('option:selected').val(); 
                        qtyBuffer[currentVal] = qtyBuffer[currentVal] + 1; 
                    }); 
 
 
                    //    
                    for(var dayType in qtyBuffer) 
                    { 
                        qty = parseInt(qtyBuffer[dayType],10); 
                        if(dayType == '8') 
                        { 
                            qty = parseInt(qty,10)+parseInt(qtyBuffer[''],10); 
                        } 
                        $('.variable_timesheet [input[name*='[posts]['+sName+']['+summaryConfig[dayType]+'']').val(qty); 
                        $('.variable_timesheet [name*='[posts]['+sName+']['+summaryConfig[dayType]+'']').parent().children('span').text(qty); 
 
                    }; 
                } 
 
                /* 
                             *       () 
                             * @param {type} obj 
                             * @returns 
                             */ 
                function calcAllSummary() 
                { 
 
                    $('#timesheet-table<?php  
        echo $aData['varType']; 
        ?> 
').children('table').children('tbody').children('tr').each(function(i, tr) 
                    { 
                        var trName = $(tr).attr('id'); 
                        if(trName!=''&&trName!=undefined) 
                            calcSummary(trName); 
                    }); 
                } 
 
                //    ,   . 
                if($('input[name*='actual_work']').length>0) 
                { 
                    tableExists = true; 
                } 
 
                if(tableExists) 
                { 
                    calcAllSummary(); 
                } 
 
                $('span.variable_timesheet_remove_btn').die('click').live('click',function(oE){ 
                    if(confirm('    ?')) 
                    { 
                        var oParent = $(this).parent().parent(); 
                        var oSiblings = oParent.nextAll(); 
                        var iCounter = oParent.children('td').first().text(); 
                        if(oParent.prev('tr').hasClass('subtitle') && (!oParent.next('tr').size() || oParent.next('tr').hasClass('subtitle'))) 
                        { 
                            oParent.prev('tr').remove(); 
                        } 
                        oParent.remove(); 
                        oSiblings.each(function(index) { 
                            if ($(this).is('tr')) 
                                $(this).children('td').first().children('span').text(iCounter++); 
                        }); 
                    } 
 
                    oE.preventDefault(); 
                }) 
            }); 
        </script> 
        <div class='variable variable_timesheet'> 
            <input id='bGenerate<?php  
        echo $aData['varType']; 
        ?> 
' type='button' value='<?php  
        echo $oL->get('\xd0\xa1\xd0\xb3\xd0\xb5\320\275\320\265\xd1\200\320\xb8\xd1\200\xd0\xbe\xd0\262\320\260\321\x82\xd1\214'); 
        ?> 
' class='btn btn-sm btn-raised btn-default' /> 
            <div id='timesheet-table<?php  
        echo $aData['varType']; 
        ?> 
' style='padding-top: 5px;'> 
                <?php  
        if (!($mode == 'edit')) { 
            goto Label_37067; 
        } 
        ?> 
                    <?php  
        echo \app\workflow\WFW::timesheetsamrukvartable($aData); 
        ?> 
                <?php  
        Label_37067: 
        ?> 
            </div> 
            <!--[if IE]> 
            <style type='text/css'> 
                .rotated_cell 
                { 
                    text-align: left; 
                    padding-bottom: 10px; 
                } 
 
                .rotate_text 
                { 
                    -ms-writing-mode: bt-rl; 
                    filter: flipH() flipV(); 
                    top: 0px; 
                } 
            </style> 
            <![endif]--> 
        </div> 
        <?php  
        $s = ob_get_clean(); 
        return $s; 
    } 
    public static function timesheetsamrukvartable($aData) 
    { 
        $oL = \app\system\Registry::get('locale'); 
        $npp = 1; 
        $isWholeTimesheet = $aData['varType'] == 'whole_timesheet' ? true : false; 
        $disabled = ''; 
        $aDayTypesOptions = \app\workflow\util\VarUtil::gettimesheetdaytypes(); 
        $aDayTypeValues = \app\workflow\util\VarUtil::gettimesheetdaytypevalues(); 
        if (!$isWholeTimesheet) { 
            goto Label_37068; 
        } 
        $disabled = 'disabled = "disabled"'; 
        Label_37068: 
        $html = '<input type="hidden" name="' . $aData['varName'] . '[daysInMonth]" value="' . $aData['daysInMonth'] . '"/>' . '<input type="hidden" name="' . $aData['varName'] . '[month]" value="' . $aData['month'] . '"/>' . '<input type="hidden" name="' . $aData['varName'] . '[year]" value="' . $aData['year'] . '"/>' . '
            <table border="1" cellpadding="0" cellspacing="0" class="variable_table" >
            <tbody>\xa            <tr class="title">\xa            <td rowspan="2" style="text-align: center; width: 20px;">' . $oL->get('\xe2\x84\x96 \xd0\xbf/\xd0\xbf') . '</td>
            <td rowspan="2" style="text-align: center; width: 150px;">' . $oL->get('\xd0\xa4\320\230\320\236') . '</td>
            <td rowspan="2" style="text-align: center; width: 150px;">' . $oL->get('\320\x94\xd0\276\xd0\273\xd0\266\320\275\xd0\276\321\x81\321\202\321\x8c') . '</td>
            <td colspan="' . $aData['daysInMonth'] . '">' . $oL->get('\320\xa7\xd0\xb8\321\201\320\273\xd0\xb0 \xd0\xbc\xd0\265\321\201\321\217\xd1\x86\320\xb0') . '</td>
            <td colspan="' . count($aDayTypeValues) . '">' . $oL->get('\xd0\224\xd0\275\320\xb8 \xd1\x8f\320\xb2\xd0\xbe\xd0\272') . '</td>\xa            </tr>\xa            <tr class="title">'; 
        for ($day = 1; $day <= $aData['daysInMonth']; $day++) { 
            $className = \app\workflow\util\Util::isweekenddate($day, $aData['month'], $aData['year']) ? 'weekend' : 'ordinary'; 
            $html .= '<td style="width:15px;" class="' . $className . '"><div class="timesheet_day"><span class="timesheet_day_value">' . $day . ' </span><select class="abbr month_day_select" data-td_num="' . $day . '" ><option selected="selected"></option><option value="\xd0\x9e">\xd0\x9e</option><option value="\xd0\222">\xd0\x92</option></select><div></td>'; 
        } 
        foreach ($aDayTypeValues as $sK => $sV) { 
            $html .= '<td class="rotated_cell" ><div class="rotate_text">' . $oL->get($sV) . '</td>'; 
        } 
        $html .= '</tr>'; 
        $selected = 'selected="selected"'; 
        foreach ($aData['structure'] as $sdvId => $sdv) { 
            $sdvTemp = $aData['varName'] . '[structure][' . $sdvId . ']'; 
            $html .= '<tr class="subtitle"><td colspan="' . ($aData['daysInMonth'] + count($aDayTypeValues) + 3) . '">&nbsp; ' . $sdv['name'] . '<input type="hidden" name="' . $sdvTemp . '[name]" value="' . $sdv['name'] . '"></td></tr>'; 
            if (empty($sdv['posts'])) { 
                goto Label_37070; 
            } 
            foreach ($sdv['posts'] as $postId => $post) { 
                $html .= '<tr id="' . $postId . '">'; 
                $html .= '<td>' . '<input type="hidden" name="' . $sdvTemp . '[posts][' . $postId . '][employee]" value="' . $post['employee'] . '"/>' . '<input type="hidden" name="' . $sdvTemp . '[posts][' . $postId . '][post]" value="' . $post['post'] . '"/>' . '<span>' . $npp . '</span>' . '</td><td class="align_left">' . $post['employee'] . '<span class="variable_timesheet_remove_btn"></span></td>' . '<td class="align_left">' . $post['post'] . '</td>'; 
                for ($day = 1; $day <= $aData['daysInMonth']; $day++) { 
                    $isWeekend = \app\workflow\util\Util::isweekenddate($day, $aData['month'], $aData['year']); 
                    $className = $isWeekend ? 'weekend' : 'ordinary'; 
                    $sName = $sdvTemp . '[posts][' . $postId . '][' . $day . ']'; 
                    $sSelectedValue = a($post, $day, $isWeekend ? '\320\x92' : '8'); 
                    $html .= '<td data-td_num="' . $day . '" class="' . $className . '"><div class="timesheet_day"><span class="timesheet_day_value">' . $sSelectedValue . '</span><select name="' . $sName . '" ' . $disabled . 'class="abbr" >'; 
                    foreach ($aDayTypesOptions as $key => $value) { 
                        $html .= '<option  value="' . $value . '" ' . ($value == $sSelectedValue ? 'selected="selected"' : '') . '>' . $value . '</option>'; 
                    } 
                    $html .= '</select>'; 
                    if (!$isWholeTimesheet) { 
                        goto Label_37069; 
                    } 
                    $html .= '<input type="hidden" name="' . $sName . '" value="' . $post[$day] . '"/>'; 
                    Label_37069: 
                    $html .= '</div></td>'; 
                } 
                $npp++; 
                $SummaryName = $sdvTemp . '[posts][' . $postId . ']'; 
                foreach ($aDayTypeValues as $sK => $sV) { 
                    $html .= '<td><div id="' . $sK . '"><span></span><input name="' . $SummaryName . '[' . $sK . ']" type="hidden" value=""/></div></td>'; 
                } 
                $html .= '</tr>'; 
            } 
            Label_37070: 
        } 
        $html .= '</tbody>\xa                 </table>'; 
        return $html; 
    } 
    public static function timesheetsamrukvarview($aData, $sDoctypeId, $sDocumentId) 
    { 
        $oL = \app\system\Registry::get('locale'); 
        ob_start(); 
        ?> 
        <?php  
        if (!isset($aData['structure'])) { 
            goto Label_37071; 
        } 
        ?> 
        <div class='variable variable_timesheet'> 
            <input type='button' value='<?php  
        echo $oL->get('\320\xad\320\272\321\201\320\xbf\xd0\xbe\321\x80\xd1\x82 \320\262 Excel'); 
        ?> 
' onclick='msf.page.go('/workflow/document/export-variable/<?php  
        echo $sDoctypeId; 
        ?> 
/<?php  
        echo $sDocumentId; 
        ?> 
/<?php  
        echo $aData['varName']; 
        ?> 
');' /> 
            <div id='timesheet-table<?php  
        echo $aData['varType']; 
        ?> 
' style='padding-top: 5px;'> 
                <?php  
        echo \app\workflow\WFW::timesheetsamrukvartableview($aData); 
        ?> 
            </div> 
            <!--[if IE]> 
            <style type='text/css'> 
                .rotated_cell 
                { 
                    text-align: left; 
                    padding-bottom: 10px; 
                } 
 
                .rotate_text 
                { 
                    -ms-writing-mode: bt-rl; 
                    filter: flipH() flipV(); 
                    top: 0px; 
                } 
            </style> 
            <![endif]--> 
        </div> 
    <?php  
        Label_37071: 
        ?> 
        <?php  
        $s = ob_get_clean(); 
        return $s; 
    } 
    public static function holidayssamrukvaredit($aData, $sDoctypeId, $sDocumentId, $mode = 'create') 
    { 
        $oL = \app\system\Registry::get('locale'); 
        ob_start(); 
        ?> 
        <script type='text/javascript'> 
 
            function isValid(obj) 
            { 
                for (var prop in obj) 
                { 
                    if(!$('[name*=''+obj[prop]+'']').length) 
                    { 
                        ShowErrorMessage('<?php  
        echo $oL->get('\320\x9f\321\200\320\xbe\320\xb2\xd0\xb5\321\x80\xd1\214\xd1\202\320\xb5 \320\275\320\xb0\320\273\320\270\xd1\x87\320\xb8\xd0\265 \xd0\262\xd1\x81\xd0\xb5\321\205 \320\277\320\276\xd0\273\xd0\265\xd0\xb9 \321\x88\320\260\xd0\261\xd0\xbb\320\xbe\xd0\275\320\265 \xd0\xb4\xd0\276\xd0\272\321\x83\xd0\274\320\xb5\320\275\xd1\x82\xd0\260'); 
        ?> 
'); 
                        return  false; 
                    } 
                } 
 
                return true; 
            } 
 
            function ShowErrorMessage(t) 
            { 
                MSF_StatusBar.hideWait(); 
                $('#results').show().children('#error').append('<div class='status_error' id='statusErrorItem_0'>'+t+'<br /></div>').show(); 
                setTimeout(function() { 
                    $('#statusErrorItem_0').hide(); 
                    $('#statusErrorItem_0').remove(); 
                    if($('#error').html().trim() == '') { 
                        $('#error').hide(); 
                    } 
                }, 5000); 
            }; 
 
            $(document).ready(function(){ 
 
                var oConfig =  { //  
                    'subdivision': '<?php  
        echo $aData['var']['subdivision']; 
        ?> 
', 
                    'year': '<?php  
        echo $aData['var']['year']; 
        ?> 
' 
                }; 
 
                var tableExists = false; 
                /* */ 
                $('#bGenerate<?php  
        echo $aData['varType']; 
        ?> 
').click(function() 
                { 
                    if(!isValid(oConfig)) 
                        return; 
 
                    if(tableExists) 
                    { 
                        if (!confirm('<?php  
        echo $oL->get('\320\222\xd1\213 \321\x83\320\xb2\xd0\265\321\200\xd0\xb5\xd0\275\321\213, \321\207\321\x82\xd0\xbe \321\x85\320\xbe\xd1\x82\320\xb8\xd1\x82\320\265 \xd1\x81\320\xbe\xd0\267\320\264\xd0\xb0\321\x82\xd1\214 \320\275\xd0\276\320\xb2\xd1\x83\xd1\216 \xd1\x82\320\260\xd0\xb1\320\273\320\xb8\xd1\x86\xd1\203, \xd1\x83\xd0\264\xd0\260\xd0\xbb\320\270\320\xb2 \321\x81\xd1\202\320\xb0\321\x80\xd1\x83\xd1\x8e?'); 
        ?> 
')) 
                        { 
                            return; 
                        } 
                    } 
 
                    request = $.ajax({ 
                        type: 'POST', 
                        url: '/workflow/document/<?php  
        echo str_replace('_', '-', $aData['varType']); 
        ?> 
/<?php  
        echo $sDoctypeId; 
        ?> 
/<?php  
        echo $sDocumentId; 
        ?> 
/<?php  
        echo $aData['var']['name']; 
        ?> 
', 
                        data: $('#createRowForm').serialize(), 
                        dataType: 'json', 
                        success: function (oData) { 
                            if (array_key_exists('error', oData)) { 
                                ShowErrorMessage(oData.error); 
                            } else { 
                                $('#timesheet-table<?php  
        echo $aData['varType']; 
        ?> 
').html(oData.html); 
                            } 
                        }, 
                        error: function (data) { 
                            ShowErrorMessage('<?php  
        echo $oL->get('\320\237\321\200\320\xbe\xd0\xb8\320\xb7\xd0\276\321\210\xd0\273\320\xb0 \320\xbe\321\x88\xd0\xb8\xd0\xb1\xd0\xba\xd0\260 \320\262\320\xbe \xd0\262\xd1\200\320\265\320\xbc\321\217 \320\xb7\320\xb0\xd0\277\321\x80\xd0\276\xd1\201\xd0\260.'); 
        ?> 
'); 
                        } 
                    }); 
                }); 
            }); 
 
        </script> 
 
        <div class='variable variable_holidays'> 
            <input id='bGenerate<?php  
        echo $aData['varType']; 
        ?> 
' type='button' value='<?php  
        echo $oL->get('\xd0\xa1\xd0\263\xd0\265\320\xbd\xd0\xb5\321\x80\xd0\xb8\321\x80\xd0\276\320\262\xd0\xb0\321\x82\321\x8c'); 
        ?> 
' class='btn btn-sm btn-raised btn-default' /> 
            <div id='timesheet-table<?php  
        echo $aData['varType']; 
        ?> 
' style='padding-top: 5px;'> 
                <?php  
        if (!($mode == 'edit')) { 
            goto Label_37072; 
        } 
        $aData['config'] = []; 
        $aData['config']['strictVacationPeriod'] = $aData['var']['strictVacationPeriod']; 
        ?> 
                    <?php  
        echo \app\workflow\WFW::holidayssamrukvartable($aData); 
        ?> 
                <?php  
        Label_37072: 
        ?> 
            </div> 
            <!--[if IE]> 
            <style type='text/css'> 
                .rotated_cell 
                { 
                    text-align: left; 
                    padding-bottom: 10px; 
                } 
 
                .rotate_text 
                { 
                    -ms-writing-mode: bt-rl; 
                    filter: flipH() flipV(); 
                    top: 0px; 
                } 
            </style> 
            <![endif]--> 
        </div> 
        <?php  
        $s = ob_get_clean(); 
        return $s; 
    } 
    public static function holidayssamrukvartable($aData) 
    { 
        ob_start(); 
        $oL = \app\system\Registry::get('locale'); 
        ?> 
        <input type='hidden' name='<?php  
        echo $aData['varName']; 
        ?> 
[year]' value='<?php  
        echo $aData['year']; 
        ?> 
' /> 
        <table border='1' cellspacing='0' cellpadding='0' class='variable_table' > 
            <tbody> 
            <tr class='title'> 
                <td rowspan='2' style='text-align: center; width: 20px;'><?php  
        echo $oL->get('\xe2\x84\x96 \320\277/\320\xbf'); 
        ?> 
</td> 
                <td rowspan='2' style='text-align: center; width: 150px;'><?php  
        echo $oL->get('\xd0\xa4\xd0\230\xd0\236'); 
        ?> 
</td> 
                <td rowspan='2' style='text-align: center; width: 150px;'><?php  
        echo $oL->get('\320\224\320\276\320\273\xd0\266\xd0\275\xd0\276\xd1\201\xd1\202\xd1\214'); 
        ?> 
</td> 
                <td colspan='3' style='width: 400px;'><?php  
        echo $oL->get('\xd0\x9e\xd0\242\xd0\x9f\320\243\xd0\241\320\x9a'); 
        ?> 
</td> 
                <td rowspan='2'></td> 
                <td rowspan='2' style='width: 21px;'></td> 
                <td rowspan='2' style='width: 21px;'></td> 
            </tr> 
            <tr class='title'> 
                <td>  </td> 
                <td>  </td> 
                <td>  </td> 
            </tr> 
            <?php  
        $iCounter = 1; 
        foreach ($aData['structure'] as $sSubdivisionID => $aSubdivisionInformation) { 
            $sVarNameAndSubdivisionID = $aData['varName'] . '[structure][' . $sSubdivisionID . ']'; 
            ?> 
                <tr> 
                    <td colspan='9'><?php  
            echo v($aSubdivisionInformation['name']); 
            ?> 
                        <input type='hidden' name='<?php  
            echo $sVarNameAndSubdivisionID; 
            ?> 
[name]' value='<?php  
            echo v($aSubdivisionInformation['name']); 
            ?> 
'> 
                    </td> 
                </tr> 
                <?php  
            foreach ($aSubdivisionInformation['posts'] as $sPostID => $aPostInformation) { 
                $sTop50 = 'no'; 
                if (!($aData['config']['strictVacationPeriod'] == 'yes')) { 
                    goto Label_37073; 
                } 
                $sTop50 = isset($aPostInformation['top50']) ? $aPostInformation['top50'] : 'no'; 
                Label_37073: 
                $sVarNameSubdivisionPostID = $sVarNameAndSubdivisionID . '[posts][' . $sPostID . ']'; 
                $sHyphenlessVarSubdivisionPostID = $aData['varName'] . '_structure_' . strtr($sSubdivisionID, array('-' => '')) . '_posts_' . strtr($sPostID, array('-' => '')); 
                $aPostInformation['holidays'] = a($aPostInformation, 'holidays', array(0 => array('days' => 0, 'from' => null, 'to' => null, 'note' => null))); 
                ?> 
                    <?php  
                foreach ($aPostInformation['holidays'] as $iHoliday => $aHolidayInformation) { 
                    $sVarSdvPostHolidayID = $sVarNameSubdivisionPostID . '[holidays][' . $iHoliday . ']'; 
                    $sHyphenlessVarSdvPostHolidayID = $sHyphenlessVarSubdivisionPostID . '_holidays_' . $iHoliday; 
                    ?> 
                        <tr class='<?php  
                    echo $sHyphenlessVarSubdivisionPostID; 
                    ?> 
'> 
                            <?php  
                    if (!($iHoliday == 0)) { 
                        goto Label_37075; 
                    } 
                    ?> 
                                <td rowspan='<?php  
                    echo count($aPostInformation['holidays']); 
                    ?> 
'> 
                                    <input type='hidden' name='<?php  
                    echo $sVarNameSubdivisionPostID; 
                    ?> 
[employee]' value='<?php  
                    echo $aPostInformation['employee']; 
                    ?> 
' /> 
                                    <input type='hidden' name='<?php  
                    echo $sVarNameSubdivisionPostID; 
                    ?> 
[post]' value='<?php  
                    echo $aPostInformation['post']; 
                    ?> 
'/> 
                                    <?php  
                    if (!($aData['config']['strictVacationPeriod'] == 'yes')) { 
                        goto Label_37074; 
                    } 
                    ?> 
                                        <input type='hidden' id='<?php  
                    echo $sPostID; 
                    ?> 
_top50' name='<?php  
                    echo $sVarNameSubdivisionPostID; 
                    ?> 
[top50]' value='<?php  
                    echo $sTop50; 
                    ?> 
'/> 
                                    <?php  
                    Label_37074: 
                    ?> 
                                    <span><?php  
                    echo $iCounter++; 
                    ?> 
</span> 
                                </td> 
                                <td rowspan='<?php  
                    echo count($aPostInformation['holidays']); 
                    ?> 
' class='align_left'><span class='variable_holidays_remove_btn'></span><?php  
                    echo $aPostInformation['employee']; 
                    ?> 
</td> 
                                <td rowspan='<?php  
                    echo count($aPostInformation['holidays']); 
                    ?> 
' class='align_left'><?php  
                    echo $aPostInformation['post']; 
                    ?> 
</td> 
                            <?php  
                    Label_37075: 
                    ?> 
                            <?php  
                    if ($aData['config']['strictVacationPeriod'] == 'yes') { 
                        goto Label_37078; 
                    } 
                    ?> 
                                <td id='<?php  
                    echo $sHyphenlessVarSdvPostHolidayID; 
                    ?> 
_days'> 
                                    <span><?php  
                    echo $aHolidayInformation['days']; 
                    ?> 
</span> 
                                    <input type='hidden' class='form-control' name='<?php  
                    echo $sVarSdvPostHolidayID; 
                    ?> 
[days]' value='<?php  
                    echo $aHolidayInformation['days']; 
                    ?> 
' /> 
                                </td> 
                                <td><?php  
                    echo self::holidayssamrukvardateeditoldversion($aHolidayInformation['from'], $sVarSdvPostHolidayID . '[from]', $sHyphenlessVarSdvPostHolidayID . '_from', $aData); 
                    ?> 
</td> 
                                <td><?php  
                    echo self::holidayssamrukvardateeditoldversion($aHolidayInformation['to'], $sVarSdvPostHolidayID . '[to]', $sHyphenlessVarSdvPostHolidayID . '_to', $aData); 
                    ?> 
</td> 
                            <?php  
                    goto Label_37079; 
                    Label_37078: 
                    if ($sTop50 == 'no' || $sTop50 == '\xd0\xbd\320\xb5\321\202') { 
                        goto Label_37076; 
                    } 
                    ?> 
                                    <td id='<?php  
                    echo $sHyphenlessVarSdvPostHolidayID; 
                    ?> 
_days'> 
                                        <span><?php  
                    echo $aHolidayInformation['days']; 
                    ?> 
</span> 
                                        <input type='hidden' class='form-control' name='<?php  
                    echo $sVarSdvPostHolidayID; 
                    ?> 
[days]' value='<?php  
                    echo $aHolidayInformation['days']; 
                    ?> 
' /> 
                                    </td> 
                                <?php  
                    goto Label_37077; 
                    Label_37076: 
                    ?> 
                                    <td id='<?php  
                    echo $sHyphenlessVarSdvPostHolidayID; 
                    ?> 
_days'> 
                                        <select class='changemonitor form-control input-inline'  name='<?php  
                    echo $sVarSdvPostHolidayID; 
                    ?> 
[days]' value='<?php  
                    echo $aHolidayInformation['days']; 
                    ?> 
'> 
                                            <option value='' <?php  
                    echo $aHolidayInformation['days'] == '' ? 'selected ="selected"' : ''; 
                    ?> 
>   </option> 
                                            <option value='5' <?php  
                    echo $aHolidayInformation['days'] == 5 ? 'selected ="selected"' : ''; 
                    ?> 
> 5 </option> 
                                            <option value='10' <?php  
                    echo $aHolidayInformation['days'] == 10 ? 'selected ="selected"' : ''; 
                    ?> 
> 10 </option> 
                                            <option value='14' <?php  
                    echo $aHolidayInformation['days'] == 14 ? 'selected ="selected"' : ''; 
                    ?> 
> 14 </option> 
                                        </select> 
                                    </td> 
                                <?php  
                    Label_37077: 
                    ?> 
                                <td><?php  
                    echo self::holidayssamrukvardateeditbiversion($aHolidayInformation['from'], $sVarSdvPostHolidayID . '[from]', $sHyphenlessVarSdvPostHolidayID . '_from', $aData, $sTop50); 
                    ?> 
</td> 
                                <td><?php  
                    echo self::holidayssamrukvardateeditbiversion($aHolidayInformation['to'], $sVarSdvPostHolidayID . '[to]', $sHyphenlessVarSdvPostHolidayID . '_to', $aData, $sTop50); 
                    ?> 
</td> 
                            <?php  
                    Label_37079: 
                    ?> 
                            <td><input type='text' style='width: 100%' name='<?php  
                    echo $sVarSdvPostHolidayID; 
                    ?> 
[note]' value='<?php  
                    echo v($aHolidayInformation['note']); 
                    ?> 
' /></td> 
                            <td> 
                                <input type='button' class='btn btn-xs' style='padding: 0px 5px;' value='+' onclick='addHoliday(this, '<?php  
                    echo $sVarNameSubdivisionPostID; 
                    ?> 
', '<?php  
                    echo $sHyphenlessVarSubdivisionPostID; 
                    ?> 
', '<?php  
                    echo $sTop50; 
                    ?> 
');' /> 
                            </td> 
                            <td> 
                                <?php  
                    if (!($iHoliday != 0)) { 
                        goto Label_37080; 
                    } 
                    ?> 
                                    <input type='button' class='btn btn-xs' style='padding: 0px 5px; width: 10px;' value='x' onclick='deleteHoliday(this, '<?php  
                    echo $sVarNameSubdivisionPostID; 
                    ?> 
', '<?php  
                    echo $sHyphenlessVarSubdivisionPostID; 
                    ?> 
');' /> 
                                <?php  
                    Label_37080: 
                    ?> 
                            </td> 
                        </tr> 
                        </tr> 
                        <?php  
                    if ($aData['config']['strictVacationPeriod'] == 'yes') { 
                        goto Label_37083; 
                    } 
                    ?> 
                            <script type='text/javascript'> 
                                $(function(){ 
                                    $('#<?php  
                    echo $sHyphenlessVarSdvPostHolidayID; 
                    ?> 
_from_widget,#<?php  
                    echo $sHyphenlessVarSdvPostHolidayID; 
                    ?> 
_to_widget').change(function() { 
                                        var iDays = 0; 
                                        var holidays = <?php  
                    echo \app\system\Json::encode(explode(',', \app\system\Registry::get('config')->get('wfw_holidays'))); 
                    ?> 
; 
 
                                        if($('#<?php  
                    echo $sHyphenlessVarSdvPostHolidayID; 
                    ?> 
_from_widget').val().length && $('#<?php  
                    echo $sHyphenlessVarSdvPostHolidayID; 
                    ?> 
_to_widget').val().length) 
                                        { 
                                            var dateEnd = new Date($('#<?php  
                    echo $sHyphenlessVarSdvPostHolidayID; 
                    ?> 
_to_widget').datepicker('getDate')); 
                                            var dateStart = new Date($('#<?php  
                    echo $sHyphenlessVarSdvPostHolidayID; 
                    ?> 
_from_widget').datepicker('getDate')); 
                                            holidaysCount = 0; 
                                            holidays.forEach(function(h){ 
                                                var hDate = new Date(h).valueOf(); 
                                                if((hDate >= dateStart) && (hDate <= dateEnd)) { 
                                                    holidaysCount++; 
                                                } 
                                            }); 
                                            iDays = (dateEnd - dateStart)/(1000*60*60*24) - holidaysCount + 1; 
                                        } 
                                        $('#<?php  
                    echo $sHyphenlessVarSdvPostHolidayID; 
                    ?> 
_days>span').html(iDays); 
                                        $('#<?php  
                    echo $sHyphenlessVarSdvPostHolidayID; 
                    ?> 
_days>input').val(iDays); 
                                    }) 
                                }); 
                            </script> 
                        <?php  
                    goto Label_37084; 
                    Label_37083: 
                    ?> 
                            <script type='text/javascript'> 
                                var allHolidays = '<?php  
                    echo \app\system\Registry::get('config')->get('wfw_bi_group_holidays'); 
                    ?> 
'; 
                                var tmpHolidaysValues = Array.from(new Set(allHolidays.split(','))); 
                                var tmpExtraWorkDays = Array.from(new Set(MSF_Config.wfw_extra_work_dates.split(','))); 
                                var aBiGroupExtraHolidays = '<?php  
                    echo \app\system\Registry::get('config')->get('wfw_bi_group_holidays'); 
                    ?> 
'.split(','); 
                                var aBiGroupExtraWorkDays = {}; 
                                var aBiGroupHolidays = {}; 
                            </script> 
                            <?php  
                    if ($sTop50 == 'no' || $sTop50 == '\xd0\xbd\320\265\321\x82') { 
                        goto Label_37081; 
                    } 
                    ?> 
                                <script type='text/javascript'> 
                                    $(function () { 
                                        $('#<?php  
                    echo $sHyphenlessVarSdvPostHolidayID; 
                    ?> 
_from_widget,#<?php  
                    echo $sHyphenlessVarSdvPostHolidayID; 
                    ?> 
_to_widget').change(function () { 
                                            var iDays = 0; 
                                            var aErrors = []; 
                                            var holidays = <?php  
                    echo \app\system\Json::encode(explode(',', \app\system\Registry::get('config')->get('wfw_holidays'))); 
                    ?> 
; 
 
                                            if ($('#<?php  
                    echo $sHyphenlessVarSdvPostHolidayID; 
                    ?> 
_from_widget').val().length && $('#<?php  
                    echo $sHyphenlessVarSdvPostHolidayID; 
                    ?> 
_to_widget').val().length) { 
                                                var dateEnd = new Date($('#<?php  
                    echo $sHyphenlessVarSdvPostHolidayID; 
                    ?> 
_to_widget').datepicker('getDate')); 
                                                var dateStart = new Date($('#<?php  
                    echo $sHyphenlessVarSdvPostHolidayID; 
                    ?> 
_from_widget').datepicker('getDate')); 
                                                holidaysCount = 0; 
                                                holidays.forEach(function (h) { 
                                                    var hDate = new Date(h).valueOf(); 
                                                    if ((hDate >= dateStart) && (hDate <= dateEnd)) { 
                                                        holidaysCount++; 
                                                    } 
                                                }); 
                                                iDays = (dateEnd - dateStart) / (1000 * 60 * 60 * 24) - holidaysCount + 1; 
                                            } 
                                            $('#<?php  
                    echo $sHyphenlessVarSdvPostHolidayID; 
                    ?> 
_days>span').html(iDays); 
                                            $('#<?php  
                    echo $sHyphenlessVarSdvPostHolidayID; 
                    ?> 
_days>input').val(iDays); 
                                            aErrors = dateChangeVersionTop50(this, '<?php  
                    echo $sVarNameSubdivisionPostID; 
                    ?> 
', '<?php  
                    echo $sHyphenlessVarSubdivisionPostID; 
                    ?> 
'); 
                                            if (aErrors.length) { 
                                                cleanFieldsWhenChangeDatesVersionTop50(this, '<?php  
                    echo $sHyphenlessVarSubdivisionPostID; 
                    ?> 
'); 
                                                MSF_StatusBar.showError(aErrors.pop()); 
                                                return 0; 
                                            } 
                                            addAutocompleteListenerVersionTop50('<?php  
                    echo $sVarNameSubdivisionPostID; 
                    ?> 
', '<?php  
                    echo $sHyphenlessVarSubdivisionPostID; 
                    ?> 
'); 
                                        }); 
                                    }); 
                                </script> 
                            <?php  
                    goto Label_37082; 
                    Label_37081: 
                    ?> 
                                <script type='text/javascript'> 
                                    $(function () { 
                                        var holidays = <?php  
                    echo \app\system\Json::encode(explode(',', \app\system\Registry::get('config')->get('wfw_holidays'))); 
                    ?> 
; 
 
                                        $('#<?php  
                    echo $sHyphenlessVarSdvPostHolidayID; 
                    ?> 
_from_widget').change(function () { 
                                            var daysToVacate = $('select[name='<?php  
                    echo $sVarSdvPostHolidayID; 
                    ?> 
[days]']').val(); 
                                            daysToVacate = parseInt(daysToVacate) - 1; 
                                            var sValidDate = $('#<?php  
                    echo $sHyphenlessVarSdvPostHolidayID . '_from'; 
                    ?> 
').val(); 
                                            var oStartDate = new Date(sValidDate); 
                                            var oValidDate = new Date(sValidDate); 
                                            oValidDate.setDate(oValidDate.getDate() + daysToVacate); 
                                            aBiGroupExtraWorkDays = convertArrayToObj(tmpExtraWorkDays, aBiGroupExtraWorkDays); 
                                            aBiGroupHolidays = convertArrayToObj(tmpHolidaysValues, aBiGroupHolidays); 
                                            var iHolidaysNumber = parseInt(calculateHolidaysInRange(oStartDate, new Date(oValidDate.getTime()))); 
                                            oValidDate.setDate(oValidDate.getDate() + iHolidaysNumber); 
                                            $('#<?php  
                    echo $sHyphenlessVarSdvPostHolidayID . '_to'; 
                    ?> 
').val(date('<?php  
                    echo \app\system\Registry::get('config')->get('php_db_date'); 
                    ?> 
', oValidDate)); 
                                            $('#<?php  
                    echo $sHyphenlessVarSdvPostHolidayID . '_to'; 
                    ?> 
_widget').datepicker('setDate', oValidDate); 
                                        }); 
                                    }); 
                                </script> 
                            <?php  
                    Label_37082: 
                    Label_37084: 
                } 
            } 
        } 
        ?> 
            </tbody> 
        </table> 
        <script type='text/javascript'> 
 
 
            function convertArrayToObj(sourceArray, destinationObj) { 
                for (let holidaysIndex in sourceArray) { 
                    destinationObj[holidaysIndex] = sourceArray[holidaysIndex]; 
                } 
                return destinationObj; 
            } 
 
            function addHoliday(eElem, sOldVarNameSubdivisionPostID, sOldHyphenlessVarSubdivisionPostID, sTop50) 
            { 
                var isUserTop50 = sTop50; 
                <?php  
        if ($aData['config']['strictVacationPeriod'] == 'yes') { 
            goto Label_37085; 
        } 
        ?> 
                    addHolidayOldVersion(eElem, sOldVarNameSubdivisionPostID, sOldHyphenlessVarSubdivisionPostID); 
                <?php  
        goto Label_37086; 
        Label_37085: 
        ?> 
                    if (isUserTop50 == 'no' || isUserTop50 == '') { 
                        addHolidayBIVersion(eElem, sOldVarNameSubdivisionPostID, sOldHyphenlessVarSubdivisionPostID, sTop50); 
                    } else { 
                        addHolidayVersionTop50(eElem, sOldVarNameSubdivisionPostID, sOldHyphenlessVarSubdivisionPostID, sTop50); 
                    } 
                <?php  
        Label_37086: 
        ?> 
            } 
 
            function addHolidayVersionTop50(eElem, sOldVarNameSubdivisionPostID, sOldHyphenlessVarSubdivisionPostID, sTop50) { 
                var oElem = $(eElem); 
                var oCurrentTableRow = oElem.parent().parent(); 
                var iTotalRows = oCurrentTableRow.parent().children('tr.' + sOldHyphenlessVarSubdivisionPostID).size(); 
                var sVarNameSubdivisionPostID = sOldVarNameSubdivisionPostID + '[holidays][' + iTotalRows + ']'; 
                var sHyphenlessVarSubdivisionPostID = sOldHyphenlessVarSubdivisionPostID + '_holidays_' + iTotalRows; 
                var aConfigHolidays = <?php  
        echo \app\system\Json::encode(explode(',', \app\system\Registry::get('config')->get('wfw_holidays'))); 
        ?> 
; 
 
                var aErrors = validateVacationFieldsVersionTop50(iTotalRows, sOldVarNameSubdivisionPostID, sOldHyphenlessVarSubdivisionPostID); 
                if (aErrors.length) { 
                    MSF_StatusBar.showError(aErrors.pop()); 
                    return 0; 
                } 
 
                addHtmlRowToTableVersionTop50(oCurrentTableRow, sOldVarNameSubdivisionPostID, sOldHyphenlessVarSubdivisionPostID, sVarNameSubdivisionPostID, sHyphenlessVarSubdivisionPostID, iTotalRows, sTop50); 
 
                attachDatepickerToElementVersionTop50(sHyphenlessVarSubdivisionPostID + '_to'); 
                attachDatepickerToElementVersionTop50(sHyphenlessVarSubdivisionPostID + '_from'); 
                addAutocompleteListenerVersionTop50(sVarNameSubdivisionPostID, sOldHyphenlessVarSubdivisionPostID, sHyphenlessVarSubdivisionPostID); 
            } 
 
            function validateVacationFieldsVersionTop50(iTotalRows, sCurrentRowName, sTableRowClassName) { 
                var aErrors = []; 
                var iTotalVacationDays = 0; 
                iTotalVacationDays = getTotalSelectedValuesVersionTop50(iTotalRows, sTableRowClassName); 
                if (iTotalVacationDays == 24) { 
                    aErrors.push('    !'); 
                } 
                return aErrors; 
            } 
 
            function dateChangeVersionTop50(oElem, sOldVarNameSubdivisionPostID, sOldHyphenlessVarSubdivisionPostID) { 
                var aErrors = []; 
                var oElem = $(oElem); 
                var oCurrentTableRow = oElem.parent().parent(); 
                var iTotalRows = oCurrentTableRow.parents('tbody').children('tr.' + sOldHyphenlessVarSubdivisionPostID).size(); 
                var iTotalVacationDays = 0; 
                var aConfigHolidays = <?php  
        echo \app\system\Json::encode(explode(',', \app\system\Registry::get('config')->get('wfw_holidays'))); 
        ?> 
; 
                iTotalVacationDays = getTotalSelectedValuesVersionTop50(iTotalRows, sOldHyphenlessVarSubdivisionPostID); 
                if (iTotalVacationDays > 24) { 
                    aErrors.push('      24 !'); 
                } 
                return aErrors; 
            } 
 
            function getTotalSelectedValuesVersionTop50(iTotalRows, sTableRowClassName) { 
                var iTotalVacationDays = 0; 
                $('[id^=' + sTableRowClassName + '_holidays][id$=days] input').each(function(i, e) { 
                    iTotalVacationDays += parseInt($(e).val()); 
                }); 
                return iTotalVacationDays; 
            } 
 
            function cleanFieldsWhenChangeDatesVersionTop50(oElem, sOldHyphenlessVarSubdivisionPostID) { 
                var oElem = $(oElem); 
                var oCurrentTableRow = oElem.parent(); 
                var iTotalRows = oCurrentTableRow.parents('tbody').children('tr.' + sOldHyphenlessVarSubdivisionPostID).size(); 
                var sHyphenlessVarSubdivisionPostID = sOldHyphenlessVarSubdivisionPostID + '_holidays_' + (iTotalRows - 1); 
 
                $('#' + sHyphenlessVarSubdivisionPostID + '_days span').html(0); 
                $('#' + sHyphenlessVarSubdivisionPostID + '_days input').val(0); 
 
                $('#' + sHyphenlessVarSubdivisionPostID + '_to_widget').val('').change(); 
                $('#' + sHyphenlessVarSubdivisionPostID + '_from_widget').val('').change(); 
            } 
 
            function cleanFieldsVersionTop50(iTotalRows, sTableRowClassName) { 
                $('#' + sTableRowClassName + '_holidays_' + (iTotalRows - 1) + '_days span').html(0); 
                $('#' + sTableRowClassName + '_holidays_' + (iTotalRows - 1) + '_days input').val(0); 
 
                $('#' + sTableRowClassName + '_holidays_' + (iTotalRows - 1) + '_to_widget').val('').change(); 
                $('#' + sTableRowClassName + '_holidays_' + (iTotalRows - 1) + '_from_widget').val('').change(); 
            } 
 
            function attachDatepickerToElementVersionTop50(sHyphenlessVarSubdivisionPostID) { 
                var oMinimalDate = new Date(); 
                var iBusinessDays = getBusinessDays(4); 
                oMinimalDate.setDate(oMinimalDate.getDate() + iBusinessDays); 
                $('#' + sHyphenlessVarSubdivisionPostID + '_widget').datepicker({ 
                    minDate: oMinimalDate, 
                    dateFormat: '<?php  
        echo \app\system\Registry::get('config')->get('app_js_date'); 
        ?> 
', 
                    showOn: 'button', 
                    onSelect: function(dateText, inst){ 
                        $('#' + sHyphenlessVarSubdivisionPostID).val(date('<?php  
        echo \app\system\Registry::get('config')->get('php_db_date'); 
        ?> 
', $(this).datepicker('getDate'))); 
                        $('#' + sHyphenlessVarSubdivisionPostID + '_widget').change(); 
                    }, 
                    beforeShowDay: function (date) { 
                        if (!enableExtraWorkingDays(date)) { 
                            return true; 
                        } 
                        if (!disableHolidays(date)[0]) { 
                            return false; 
                        } 
 
                        return $.datepicker.noWeekends(date); 
                    } 
                }); 
 
                $('#' + sHyphenlessVarSubdivisionPostID + '_widget_icon').click(function(){ 
                    $('#' + sHyphenlessVarSubdivisionPostID + '_widget').datepicker('show'); 
                }); 
            } 
 
            function addAutocompleteListenerVersionTop50(sVarNameSubdivisionPostID, sOldHyphenlessVarSubdivisionPostID, sHyphenlessVarSubdivisionPostID) { 
 
                $('#' + sHyphenlessVarSubdivisionPostID + '_from_widget,#' + sHyphenlessVarSubdivisionPostID + '_to_widget').change(function() { 
                    var iDays = 0;var aErrors = []; 
                    var holidays = <?php  
        echo \app\system\Json::encode(explode(',', \app\system\Registry::get('config')->get('wfw_holidays'))); 
        ?> 
; 
 
                    if($('#' + sHyphenlessVarSubdivisionPostID + '_from_widget').val().length && $('#' + sHyphenlessVarSubdivisionPostID + '_to_widget').val().length) 
                    { 
                        var dateEnd = new Date($('#' + sHyphenlessVarSubdivisionPostID + '_to_widget').datepicker('getDate')); 
                        var dateStart = new Date($('#' + sHyphenlessVarSubdivisionPostID + '_from_widget').datepicker('getDate')); 
                        holidaysCount = 0; 
                        holidays.forEach(function(h){ 
                            var hDate = new Date(h).valueOf(); 
                            if((hDate >= dateStart) && (hDate <= dateEnd)) { 
                                holidaysCount++; 
                            } 
                        }); 
 
                        iDays = (dateEnd - dateStart)/(1000*60*60*24) - holidaysCount + 1; 
                    } 
 
                    $('#' + sHyphenlessVarSubdivisionPostID + '_days>span').html(iDays); 
                    $('#' + sHyphenlessVarSubdivisionPostID + '_days>input').val(iDays); 
                    aErrors = dateChangeVersionTop50(this, sVarNameSubdivisionPostID, sOldHyphenlessVarSubdivisionPostID); 
                    if (aErrors.length) { 
                        cleanFieldsWhenChangeDatesVersionTop50(this, sOldHyphenlessVarSubdivisionPostID); 
                        MSF_StatusBar.showError(aErrors.pop()); 
                        return 0; 
                    } 
                }); 
            } 
 
            function addHolidayBIVersion(eElem, sOldVarNameSubdivisionPostID, sOldHyphenlessVarSubdivisionPostID, sTop50) { 
                var oElem = $(eElem); 
                var oCurrentTableRow = oElem.parent().parent(); 
                var iTotalRows = oCurrentTableRow.parent().children('tr.' + sOldHyphenlessVarSubdivisionPostID).size(); 
                var sVarNameSubdivisionPostID = sOldVarNameSubdivisionPostID + '[holidays][' + iTotalRows + ']'; 
                var sHyphenlessVarSubdivisionPostID = sOldHyphenlessVarSubdivisionPostID + '_holidays_' + iTotalRows; 
                var aConfigHolidays = <?php  
        echo \app\system\Json::encode(explode(',', \app\system\Registry::get('config')->get('wfw_holidays'))); 
        ?> 
; 
 
                var aErrors = validateVacationFields(iTotalRows, sOldVarNameSubdivisionPostID, sOldHyphenlessVarSubdivisionPostID); 
 
                if (aErrors.length) { 
                    MSF_StatusBar.showError(aErrors.pop()); 
                    return 0; 
                } 
 
                addHtmlRowToTable(oCurrentTableRow, sOldVarNameSubdivisionPostID, sOldHyphenlessVarSubdivisionPostID, sVarNameSubdivisionPostID, sHyphenlessVarSubdivisionPostID, iTotalRows, sTop50); 
                var aSelectOptions = findOptionsToSelect(sOldHyphenlessVarSubdivisionPostID); 
                addOptionsToSelect(sVarNameSubdivisionPostID + '[days]', aSelectOptions); 
 
                attachDatepickerToElement(sHyphenlessVarSubdivisionPostID + '_to'); 
                attachDatepickerToElement(sHyphenlessVarSubdivisionPostID + '_from'); 
                addAutocompleteListener(sVarNameSubdivisionPostID, sHyphenlessVarSubdivisionPostID); 
 
            } 
 
            function validateVacationFields(iTotalRows, sCurrentRowName, sTableRowClassName) { 
                var iMaximumPossibleRows = 3; 
                var iCurrentIndex = iTotalRows - 1; 
                var aErrors = []; 
                var iTotalVacationDays = 0; 
 
                iTotalVacationDays = getTotalSelectedValues (sTableRowClassName); 
 
                var sSelectElemSelector = 'select[name='' + sCurrentRowName + '[holidays][' + iCurrentIndex + '][days]']'; 
                if (iTotalRows == iMaximumPossibleRows) { 
                    aErrors.push('   3 !'); 
                } else if ($(sSelectElemSelector).val() == 'none' || $(sSelectElemSelector).val() == 0) { 
                    aErrors.push(',  -  !'); 
                } else if (iTotalVacationDays >= 20) { 
                    aErrors.push('    !'); 
                } 
                return aErrors; 
            } 
 
            function getTotalSelectedValues (sTableRowClassName) { 
                var iTotalVacationDays = 0; 
                $('.' + sTableRowClassName + ' select').each(function(i, e) { 
                    iTotalVacationDays += parseInt($(e).val()); 
                }); 
                return iTotalVacationDays; 
            } 
 
            function addHtmlRowToTableVersionTop50(oTrElement, sOldName, sOldHyphenlessName, sNewName, sNewHyphenlessName, iIndexOfNewElement, sTop50) { 
                oTrElement.parent().children('tr.' + sOldHyphenlessName + ':eq(0)').children('td:eq(0),td:eq(1),td:eq(2)').attr('rowspan', iIndexOfNewElement + 1); 
                oTrElement.after( 
                    '<tr class='' + sOldHyphenlessName + ''>' + 
                    '<td id='' + sNewHyphenlessName + '_days'>\ 
                                <span>0</span>\ 
                                <input type='hidden' name='' + sNewName + '[days]' value='0' />\ 
                                </td>\ 
                                <td>\ 
                                    <span class='field_date_edit'>\ 
                                        <input type='text' class='form-control' id='' + sNewHyphenlessName + '_from_widget' value='' />\ 
                                        <label id='' + sNewHyphenlessName + '_from_widget_icon' class='icon_btn'>&zwnj;</label>\ 
                                        <input type='hidden' id='' + sNewHyphenlessName + '_from' class='changemonitor' name='' + sNewName + '[from]' value='' />\ 
                                    </span>\ 
                                </td>\ 
                                <td>\ 
                                    <span class='field_date_edit'>\ 
                                        <input type='text' class='form-control' id='' + sNewHyphenlessName + '_to_widget' value='' />\ 
                                        <label id='' + sNewHyphenlessName + '_to_widget_icon' class='icon_btn'>&zwnj;</label>\ 
                                        <input type='hidden' id='' + sNewHyphenlessName + '_to' class='changemonitor' name='' + sNewName + '[to]' value='' />\ 
                                    </span>\ 
                                </td>\ 
                                <td><input type='text' style='width: 100%' name='' + sNewName + '[note]' value='' /></td>\ 
                                <td><input type='button' class='btn btn-xs' style='padding: 0px 5px;' value='+' onclick='addHoliday(this, \'' + sOldName + '\', \'' + sOldHyphenlessName + '\', \'' + sTop50 + '\');' /></td>\ 
                                <td><input type='button' class='btn btn-xs' style='padding: 0px 5px;' value='x' onclick='deleteHoliday(this, \'' + sOldName + '\', \'' + sOldHyphenlessName + '\');' /></td></tr>' 
                ); 
            } 
 
            function addHtmlRowToTable(oTrElement, sOldName, sOldHyphenlessName, sNewName, sNewHyphenlessName, iIndexOfNewElement, sTop50) { 
                oTrElement.parent().children('tr.' + sOldHyphenlessName + ':eq(0)').children('td:eq(0),td:eq(1),td:eq(2)').attr('rowspan', iIndexOfNewElement + 1); 
                oTrElement.after( 
                    '<tr class='' + sOldHyphenlessName + ''>' + 
                    '<td id='' + sNewHyphenlessName + '_days'>\ 
                                <select class='changemonitor form-control input-inline'  name='' + sNewName + '[days]' value=''>\ 
                                \<option value=''> </option>\ 
                                </select>\ 
                                </td>\ 
                                <td>\ 
                                    <span class='field_date_edit'>\ 
                                        <input type='text' class='form-control' id='' + sNewHyphenlessName + '_from_widget' value='' />\ 
                                        <label id='' + sNewHyphenlessName + '_from_widget_icon' class='icon_btn'>&zwnj;</label>\ 
                                        <input type='hidden' id='' + sNewHyphenlessName + '_from' class='changemonitor' name='' + sNewName + '[from]' value='' />\ 
                                    </span>\ 
                                </td>\ 
                                <td>\ 
                                    <span class='field_date_edit'>\ 
                                        <input type='text' disabled class='form-control' id='' + sNewHyphenlessName + '_to_widget' value='' />\ 
                                        <input type='hidden' id='' + sNewHyphenlessName + '_to' class='changemonitor' name='' + sNewName + '[to]' value='' />\ 
                                    </span>\ 
                                </td>\ 
                                <td><input type='text' style='width: 100%' name='' + sNewName + '[note]' value='' /></td>\ 
                                <td><input type='button' class='btn btn-xs' style='padding: 0px 5px;' value='+' onclick='addHoliday(this, \'' + sOldName + '\', \'' + sOldHyphenlessName + '\', \'' + sTop50 +'\');' /></td>\ 
                                <td><input type='button' class='btn btn-xs' style='padding: 0px 5px;' value='x' onclick='deleteHoliday(this, \'' + sOldName + '\', \'' + sOldHyphenlessName + '\');' /></td></tr>' 
                ); 
            } 
 
            function findOptionsToSelect(sTableRowClassName) { 
                var aPreviousSelectedValues = []; 
                var aOptions = []; 
                $('.' + sTableRowClassName + ' select').not(':last').each(function (i, e) { 
                    aPreviousSelectedValues.push(parseInt($(e).val())); 
                }); 
                aPreviousSelectedValues.sort(); 
                if (aPreviousSelectedValues.length == 1) { 
                    switch (aPreviousSelectedValues[0]) { 
                        case 5: 
                            aOptions = [5, 14]; 
                            break; 
                        case 10: 
                            aOptions = [14]; 
                            break; 
                        case 14: 
                            aOptions = [5,10]; 
                            break; 
                    } 
                } else if (aPreviousSelectedValues.length == 2) { 
                    var total = getTotalSelectedValues(sTableRowClassName); 
                    if (total == 10) { 
                        aOptions = [14]; 
                    } else { 
                        aOptions = [5]; 
                    } 
                } 
                return aOptions; 
            } 
 
            function addOptionsToSelect(sSelectName, aSelectOptions) { 
                for (var i = 0; i < aSelectOptions.length; i++) { 
                    $('select[name='' + sSelectName + '']').append( 
                        '<option value='' + aSelectOptions[i] + ''>' + aSelectOptions[i] + '</option>' 
                    ); 
                } 
            } 
 
            function attachDatepickerToElement(sHyphenlessVarSubdivisionPostID) { 
                var oMinimalDate = new Date(); 
                var iBusinessDays = getBusinessDays(4); 
                oMinimalDate.setDate(oMinimalDate.getDate() + iBusinessDays); 
                $('#' + sHyphenlessVarSubdivisionPostID + '_widget').datepicker({ 
                    minDate: oMinimalDate, 
                    dateFormat: '<?php  
        echo \app\system\Registry::get('config')->get('app_js_date'); 
        ?> 
', 
                    showOn: 'button', 
                    onSelect: function(dateText, inst){ 
                        $('#' + sHyphenlessVarSubdivisionPostID).val(date('<?php  
        echo \app\system\Registry::get('config')->get('php_db_date'); 
        ?> 
', $(this).datepicker('getDate'))); 
                        $('#' + sHyphenlessVarSubdivisionPostID + '_widget').change(); 
                    }, 
                    beforeShowDay: function (date) { 
                        if (!enableExtraWorkingDays(date)) { 
                            return true; 
                        } 
                        if (!disableHolidays(date)[0]) { 
                            return false; 
                        } 
 
                        return $.datepicker.noWeekends(date); 
                    } 
                }); 
 
                $('#' + sHyphenlessVarSubdivisionPostID + '_widget_icon').click(function(){ 
                    var sDateRange = $('#' + sHyphenlessVarSubdivisionPostID + '_widget').closest('tr').find('select').val(); 
                    if (!sDateRange) { 
                        MSF_StatusBar.showError(',  -  !'); 
                        return 0; 
                    } 
                    $('#' + sHyphenlessVarSubdivisionPostID + '_widget').datepicker('show'); 
                }); 
            } 
 
            function getBusinessDays(numberOfDays) { 
                var currentDate = new Date(); 
                var daysToAdd = 0; 
                while (numberOfDays >= 0){ 
                    currentDate.setDate(currentDate.getDate()+1); 
                    daysToAdd++; 
                    if (isHoliday(currentDate)) { 
                        numberOfDays--; 
                    } 
                } 
                return daysToAdd; 
            } 
 
            function isHoliday(date) { 
                return $.datepicker.noWeekends(date)[0]; 
            } 
 
            function disableHolidays(date) { 
                var sKey = $.datepicker.formatDate('yy-mm-dd', date); 
                return [tmpHolidaysValues.indexOf(sKey) == -1]; 
            } 
 
            function disableBiExtraHolidays(date) { 
                var sKey = $.datepicker.formatDate('yy-mm-dd', date); 
                return [aBiGroupExtraHolidays.indexOf(sKey) == -1]; 
            } 
 
 
            function addAutocompleteListener(sVarNameSubdivisionPostID, sHyphenlessVarSubdivisionPostID) { 
                $('#' + sHyphenlessVarSubdivisionPostID + '_from_widget').change(function () { 
                    var oStartDate; 
                    var daysToVacate = $('select[name='' + sVarNameSubdivisionPostID + '[days]']').val(); 
                    daysToVacate = parseInt(daysToVacate) - 1; 
                    var sValidDate =  $('#' + sHyphenlessVarSubdivisionPostID + '_from').val(); 
                    oStartDate = new Date(sValidDate); 
                    var oValidDate = new Date(sValidDate); 
                    aBiGroupExtraWorkDays = convertArrayToObj(tmpExtraWorkDays, aBiGroupExtraWorkDays); 
                    aBiGroupHolidays = convertArrayToObj(tmpHolidaysValues, aBiGroupHolidays); 
                    oValidDate.setDate(oValidDate.getDate() + daysToVacate); 
                    var iHolidaysNumber = parseInt(calculateHolidaysInRange(oStartDate, new Date(oValidDate.getTime()))); 
                    oValidDate.setDate(oValidDate.getDate() + iHolidaysNumber); 
                    $('#' + sHyphenlessVarSubdivisionPostID + '_to').val(date('<?php  
        echo \app\system\Registry::get('config')->get('php_db_date'); 
        ?> 
', oValidDate)); 
                    $('#' + sHyphenlessVarSubdivisionPostID + '_to_widget').datepicker('setDate', oValidDate); 
                }); 
            } 
 
            function calculateHolidaysInRange(oStartDate, oEndDate) { 
                var iHolidayCount = numberOfHolidaysInRange(oStartDate, oEndDate); 
                if (!iHolidayCount) { 
                    return iHolidayCount; 
                } 
 
                oStartDate = new Date(oEndDate.getTime()); 
 
                oEndDate.setDate(oEndDate.getDate() + iHolidayCount); 
                iHolidayCount += calculateHolidaysInRange(oStartDate, oEndDate); 
 
                return iHolidayCount; 
            } 
 
            function numberOfHolidaysInRange(oStartDate, oEndDate) { 
                var iHolidays = 0; 
                var temp = {...aBiGroupHolidays}; 
                for (var index in temp) { 
                    var oHolidayDate = new Date(temp[index]); 
                    if ((oStartDate <= oHolidayDate) && (oHolidayDate <= oEndDate)) { 
                        iHolidays += 1; 
                        delete aBiGroupHolidays[index]; 
                    } 
                } 
 
                return iHolidays; 
            } 
 
            function addHolidayOldVersion(eElem, sOldName, sOldCont) { 
                var oElem = $(eElem); 
                var oTr = oElem.parent().parent(); 
                var iCounter = oTr.parent().children('tr.' + sOldCont).size(); 
                var sName = sOldName + '[holidays][' + iCounter + ']'; 
                var sCont = sOldCont + '_holidays_' + iCounter; 
                oTr.parent().children('tr.' + sOldCont + ':eq(0)').children('td:eq(0),td:eq(1),td:eq(2)').attr('rowspan', iCounter + 1); 
                oTr.after( 
                    '<tr class='' + sOldCont + ''><td id='' + sCont + '_days'><span>0</span><input type='hidden' name='' + sName + '[days]' value='0' /></td>\ 
                                <td>\ 
                                    <span class='field_date_edit'>\ 
                                        <input type='text' class='form-control ' id='' + sCont + '_from_widget' value='' />\ 
                                        <label id='' + sCont + '_from_widget_icon' class='icon_btn'>&zwnj;</label>\ 
                                        <input type='hidden' id='' + sCont + '_from' class='changemonitor' name='' + sName + '[from]' value='' />\ 
                                    </span>\ 
                                </td>\ 
                                <td>\ 
                                    <span class='field_date_edit'>\ 
                                        <input type='text' class='form-control ' id='' + sCont + '_to_widget' value='' />\ 
                                        <label id='' + sCont + '_to_widget_icon' class='icon_btn'>&zwnj;</label>\ 
                                        <input type='hidden' id='' + sCont + '_to' class='changemonitor' name='' + sName + '[to]' value='' />\ 
                                    </span>\ 
                                </td>\ 
                                <td><input type='text' class='btn btn-xs' style='width:100%; outline:auto; text-align: left; padding: 1px 2px;' name='' + sName + '[note]' value='' /></td>\ 
                                <td><input type='button' class='btn btn-xs' style='padding: 0px 5px;' value='+' onclick='addHoliday(this, \'' + sOldName + '\', \'' + sOldCont + '\');' /></td>\ 
                                <td><input type='button' class='btn btn-xs' style='padding: 0px 5px;' value='x' onclick='deleteHoliday(this, \'' + sOldName + '\', \'' + sOldCont + '\');' /></td></tr>' 
                ); 
                $('#' + sCont + '_from_widget').datepicker({ 
                    dateFormat: '<?php  
        echo \app\system\Registry::get('config')->get('app_js_date'); 
        ?> 
', 
                    showOn: 'button', 
                    onSelect: function(dateText, inst){ 
                        $('#' + sCont + '_from').val(date('<?php  
        echo \app\system\Registry::get('config')->get('php_db_date'); 
        ?> 
', $(this).datepicker('getDate'))); 
                        $('#' + sCont + '_from_widget').change(); 
                    } 
                }); 
                $('#' + sCont + '_from_widget_icon').click(function(){ 
                    $('#' + sCont + '_from_widget').datepicker('show'); 
                }); 
                $('#' + sCont + '_to_widget').datepicker({ 
                    dateFormat: '<?php  
        echo \app\system\Registry::get('config')->get('app_js_date'); 
        ?> 
', 
                    showOn: 'button', 
                    onSelect: function(dateText, inst){ 
                        $('#' + sCont + '_to').val(date('<?php  
        echo \app\system\Registry::get('config')->get('php_db_date'); 
        ?> 
', $(this).datepicker('getDate'))); 
                        $('#' + sCont + '_to_widget').change(); 
                    } 
                }); 
                $('#' + sCont + '_to_widget_icon').click(function(){ 
                    $('#' + sCont + '_to_widget').datepicker('show'); 
                }); 
                $('#' + sCont + '_from_widget,#' + sCont + '_to_widget').change(function() { 
                    var iDays = 0; 
                    if($('#' + sCont + '_from_widget').val().length && $('#' + sCont + '_to_widget').val().length) 
                    { 
                        iDays = ($('#' + sCont + '_to_widget').datepicker('getDate') - $('#' + sCont + '_from_widget').datepicker('getDate'))/(1000*60*60*24) + 1; 
                    } 
 
                    $('#' + sCont + '_days>span').html(iDays); 
                    $('#' + sCont + '_days>input').val(iDays); 
                }); 
            } 
 
            function deleteHoliday(eElem, sOldName, sOldCont) 
            { 
                var oElem = $(eElem); 
                var oTr = oElem.parent().parent(); 
                var iCounter = oTr.parent().children('tr.' + sOldCont).size(); 
                oTr.parent().children('tr.' + sOldCont + ':eq(0)').children('td:eq(0),td:eq(1),td:eq(2)').attr('rowspan', iCounter - 1); 
                oTr.remove(); 
            } 
            $(function(){ 
                $('span.variable_holidays_remove_btn').die('click').live('click',function(oE){ 
                    if(confirm('    ?')) 
                    { 
                        var oTr = $('.' + $(this).parent().parent().attr('class')); 
                        var oSiblings = oTr.nextAll(); 
                        var iCounter = oTr.children('td').first().text(); 
                        oTr.remove(); 
                        oSiblings.each(function(index) { 
                            if ($(this).is('tr')) 
                                $(this).children('td').first().children('span').text(iCounter++); 
                        }); 
                        // 
                    } 
                    oE.preventDefault(); 
                }) 
            }) 
        </script> 
        <style type='text/css'> 
            .variable_holidays .field_date_edit input[type='text'] { 
                width: 100px; 
            } 
            .variable_holidays_remove_btn { 
                background: rgba(0, 0, 0, 0) url('/tpl/web/skin/dark-blue/img/icons/remove_small.png') no-repeat scroll center center; 
                cursor: pointer; 
                display: inline-block; 
                float: right; 
                height: 16px; 
                margin-left: 2px; 
                position: relative; 
                vertical-align: middle; 
                width: 16px; 
                z-index: 1; 
            } 
            .variable_timesheet_remove_btn { 
                background: rgba(0, 0, 0, 0) url('/tpl/web/skin/dark-blue/img/icons/remove_small.png') no-repeat scroll center center; 
                cursor: pointer; 
                display: inline-block; 
                float: right; 
                height: 16px; 
                margin-left: 2px; 
                position: relative; 
                vertical-align: middle; 
                width: 16px; 
                z-index: 1; 
            } 
        </style> 
        <?php  
        $s = ob_get_clean(); 
        return $s; 
    } 
    private static function holidayssamrukvardateeditbiversion($sHolidayDay, $sName, $sID, $aData, $sTop50) 
    { 
        ob_start(); 
        ?> 
        <script type='text/javascript'> 
            var aBiGroupExtraWorkingDays = MSF_Config.wfw_extra_work_dates.split(','); 
            var aBiGroupHolidays = '<?php  
        echo \app\system\Registry::get('config')->get('wfw_bi_group_holidays'); 
        ?> 
'.split(','); 
 
            function getBusinessDays(numberOfDays) { 
                var currentDate = new Date(); 
                var daysToAdd = 0; 
                while (numberOfDays >= 0){ 
                    currentDate.setDate(currentDate.getDate() + 1); 
                    daysToAdd++; 
                    if (isHoliday(currentDate)) { 
                        numberOfDays--; 
                    } 
                } 
                return daysToAdd; 
            } 
 
            function isHoliday(date) { 
                return $.datepicker.noWeekends(date)[0]; 
            } 
 
            function disableHolidays(date) { 
                var sKey = $.datepicker.formatDate('yy-mm-dd', date); 
                return [aBiGroupHolidays.indexOf(sKey) == -1]; 
            } 
 
            function enableExtraWorkingDays(date) { 
                var sKey = $.datepicker.formatDate('yy-mm-dd', date); 
                return [aBiGroupExtraWorkingDays.indexOf(sKey) == -1]; 
            } 
        </script> 
        <?php  
        if ($sTop50 == 'no' || $sTop50 == '\xd0\xbd\320\xb5\321\202') { 
            goto Label_37089; 
        } 
        ?> 
            <span class='field_date_edit'> 
                <input type='text' class='form-control' id='<?php  
        echo $sID; 
        ?> 
_widget' value='<?php  
        echo \app\system\Util::unserializedate($sHolidayDay); 
        ?> 
' /> 
                <label id='<?php  
        echo $sID; 
        ?> 
_widget_icon' class='icon_btn'>&zwnj;</label> 
                <input type='hidden' id='<?php  
        echo $sID; 
        ?> 
' class='changemonitor' name='<?php  
        echo $sName; 
        ?> 
' value='<?php  
        echo $sHolidayDay; 
        ?> 
' /> 
            </span> 
            <script type='text/javascript'> 
                $(function(){ 
                    $('#<?php  
        echo $sID; 
        ?> 
_widget').datepicker({ 
                        dateFormat: '<?php  
        echo \app\system\Registry::get('config')->get('app_js_date'); 
        ?> 
', 
                        showOn: 'button', 
                        onSelect: function(dateText, inst){ 
                            $('#<?php  
        echo $sID; 
        ?> 
').val(date('<?php  
        echo \app\system\Registry::get('config')->get('php_db_date'); 
        ?> 
', $(this).datepicker('getDate'))); 
                            $('#<?php  
        echo $sID; 
        ?> 
_widget').change(); 
                        }, 
                        beforeShowDay: function (date) { 
                            if (!enableExtraWorkingDays(date)) { 
                                return true; 
                            } 
                            if (!disableHolidays(date)[0]) { 
                                return false; 
                            } 
 
                            return $.datepicker.noWeekends(date); 
                        } 
                    }); 
                    $('#<?php  
        echo $sID; 
        ?> 
_widget_icon').click(function(){ 
                        $('#<?php  
        echo $sID; 
        ?> 
_widget').datepicker('show'); 
                    }); 
                }); 
            </script> 
        <?php  
        goto Label_37090; 
        Label_37089: 
        ?> 
            <span class='field_date_edit'> 
                <?php  
        if (substr($sID, -2) !== 'to') { 
            goto Label_37087; 
        } 
        ?> 
                    <input type='text' disabled class='form-control' id='<?php  
        echo $sID; 
        ?> 
_widget' value='<?php  
        echo \app\system\Util::unserializedate($sHolidayDay); 
        ?> 
' /> 
                <?php  
        goto Label_37088; 
        Label_37087: 
        ?> 
                    <input type='text' class='form-control' id='<?php  
        echo $sID; 
        ?> 
_widget' value='<?php  
        echo \app\system\Util::unserializedate($sHolidayDay); 
        ?> 
' /> 
                    <label id='<?php  
        echo $sID; 
        ?> 
_widget_icon' class='icon_btn'>&zwnj;</label> 
                <?php  
        Label_37088: 
        ?> 
                <input type='hidden' id='<?php  
        echo $sID; 
        ?> 
' class='changemonitor' name='<?php  
        echo $sName; 
        ?> 
' value='<?php  
        echo $sHolidayDay; 
        ?> 
' /> 
            </span> 
            <script type='text/javascript'> 
                $(function(){ 
                    var minDateForDatepicker = new Date(); 
                    var businessDaysToAdd = getBusinessDays(4); 
                    minDateForDatepicker.setDate(minDateForDatepicker.getDate() + businessDaysToAdd); 
 
                    $('#<?php  
        echo $sID; 
        ?> 
_widget').datepicker({ 
                        minDate: minDateForDatepicker, 
                        dateFormat: '<?php  
        echo \app\system\Registry::get('config')->get('app_js_date'); 
        ?> 
', 
                        showOn: 'button', 
                        onSelect: function(dateText, inst){ 
                            $('#<?php  
        echo $sID; 
        ?> 
').val(date('<?php  
        echo \app\system\Registry::get('config')->get('php_db_date'); 
        ?> 
', $(this).datepicker('getDate'))); 
                            $('#<?php  
        echo $sID; 
        ?> 
_widget').change(); 
                        }, 
                        beforeShowDay: function (date) { 
                            if (!enableExtraWorkingDays(date)) { 
                                return true; 
                            } 
                            if (!disableHolidays(date)[0]) { 
                                return false; 
                            } 
 
                            return $.datepicker.noWeekends(date); 
                        } 
                    }); 
 
                    $('#<?php  
        echo $sID; 
        ?> 
_widget_icon').click(function(){ 
                        var sDateRange = $('#<?php  
        echo $sID; 
        ?> 
_widget').closest('tr').find('select').val(); 
                        if (!sDateRange) { 
                            MSF_StatusBar.showError(',  -  !'); 
                            return 0; 
                        } 
                        $('#<?php  
        echo $sID; 
        ?> 
_widget').datepicker('show'); 
                    }); 
                }); 
 
            </script> 
        <?php  
        Label_37090: 
        $s = ob_get_clean(); 
        return $s; 
    } 
    private static function holidayssamrukvardateeditoldversion($sHolidayDay, $sName, $sID, $aData) 
    { 
        ob_start(); 
        ?> 
        <span class='field_date_edit'> 
            <input type='text' class='form-control' id='<?php  
        echo $sID; 
        ?> 
_widget' value='<?php  
        echo \app\system\Util::unserializedate($sHolidayDay); 
        ?> 
' /> 
            <label id='<?php  
        echo $sID; 
        ?> 
_widget_icon' class='icon_btn'>&zwnj;</label> 
            <input type='hidden' id='<?php  
        echo $sID; 
        ?> 
' class='changemonitor' name='<?php  
        echo $sName; 
        ?> 
' value='<?php  
        echo $sHolidayDay; 
        ?> 
' /> 
        </span> 
        <script type='text/javascript'> 
            $(function(){ 
                $('#<?php  
        echo $sID; 
        ?> 
_widget').datepicker({ 
                    dateFormat: '<?php  
        echo \app\system\Registry::get('config')->get('app_js_date'); 
        ?> 
', 
                    showOn: 'button', 
                    onSelect: function(dateText, inst){ 
                        $('#<?php  
        echo $sID; 
        ?> 
').val(date('<?php  
        echo \app\system\Registry::get('config')->get('php_db_date'); 
        ?> 
', $(this).datepicker('getDate'))); 
                        $('#<?php  
        echo $sID; 
        ?> 
_widget').change(); 
                    } 
                }); 
                $('#<?php  
        echo $sID; 
        ?> 
_widget_icon').click(function(){ 
                    $('#<?php  
        echo $sID; 
        ?> 
_widget').datepicker('show'); 
                }); 
            }); 
        </script> 
        <?php  
        $s = ob_get_clean(); 
        return $s; 
    } 
    public static function holidayssamrukvartableold($aData) 
    { 
        $oL = \app\system\Registry::get('locale'); 
        $npp = 1; 
        $html = '<input type="hidden" name="' . $aData['varName'] . '[year]" value="' . $aData['year'] . '"/>' . '\xa            <table border="1" cellspacing="0" cellpadding="0" class="variable_table" >\xa            <tbody>
            <tr class="title">\xa            <td rowspan="2" style="text-align: center; width: 20px;">' . $oL->get('\xe2\x84\226 \xd0\277/\320\277') . '</td>
            <td rowspan="2" style="text-align: center; width: 150px;">' . $oL->get('\xd0\xa4\320\x98\320\x9e') . '</td>
            <td rowspan="2" style="text-align: center; width: 150px;">' . $oL->get('\xd0\224\xd0\xbe\xd0\xbb\xd0\266\xd0\275\xd0\276\xd1\201\xd1\202\321\214') . '</td>
            <td colspan="12">' . $oL->get('\320\x9c\xd0\xb5\321\x81\xd1\x8f\321\206\xd1\x8b') . '</td>
            </tr>\xa            <tr class="title">'; 
        foreach ($aData['monthOptions'] as $monthId => $monthName) { 
            $html .= '<td class="rotated_cell"><div class="rotate_text">' . $monthName . '</div></td>'; 
        } 
        foreach ($aData['structure'] as $sdvId => $sdv) { 
            $sdvTemp = $aData['varName'] . '[structure][' . $sdvId . ']'; 
            $sdv['name'] = a($sdv, 'name', '\xd0\x9f\xd0\276\320\273\321\214\320\xb7\xd0\276\xd0\xb2\320\260\xd1\202\320\xb5\320\273\321\x8c \320\275\xd0\xb5 \320\275\320\260\xd0\271\xd0\xb4\320\xb5\xd0\xbd'); 
            $html .= '<tr><td colspan="' . 15 . '">' . v($sdv['name']) . '<input type="hidden" name="' . $sdvTemp . '[name]" value="' . v($sdv['name']) . '"></td></tr>'; 
            if (empty($sdv['posts'])) { 
                goto Label_37096; 
            } 
            foreach ($sdv['posts'] as $postId => $post) { 
                $html .= '<tr id="' . $postId . '">'; 
                $html .= '<td>' . '<input type="hidden" name="' . $sdvTemp . '[posts][' . $postId . '][employee]" value="' . $post['employee'] . '"/>' . '<input type="hidden" name="' . $sdvTemp . '[posts][' . $postId . '][post]" value="' . $post['post'] . '"/>' . $npp . '</td><td class="align_left">' . $post['employee'] . '</td>' . '<td class="align_left">' . $post['post'] . '</td>'; 
                foreach ($aData['monthOptions'] as $monthId => $monthName) { 
                    $oDt = new \DateTime(sprintf('%04d-%02d-%02d', $aData['year'], $monthId, 1)); 
                    $sName = $sdvTemp . '[posts][' . $postId . '][' . $monthId . ']'; 
                    $html .= '<td>'; 
                    if (!empty($post[$monthId])) { 
                        goto Label_37094; 
                    } 
                    $html .= \app\workflow\REF::dateedit($sName . '[from]', '', array('min_date' => $oDt->format('Y-m-d'), 'max_date' => $oDt->format('Y-m-t'), 'container' => 'from_' . $monthId . substr($postId, 0, 8))) . '<br />' . \app\workflow\REF::dateedit($sName . '[to]', '', array('min_date' => $oDt->format('Y-m-d'), 'max_date' => $oDt->format('Y-m-t'), 'container' => 'to_' . $monthId . substr($postId, 0, 8))); 
                    goto Label_37095; 
                    Label_37094: 
                    if ($aData['varType'] == 'whole_holidays') { 
                        goto Label_37092; 
                    } 
                    $html .= \app\workflow\REF::dateedit($sName . '[from]', $post[$monthId]['from'], array('min_date' => $oDt->format('Y-m-d'), 'max_date' => $oDt->format('Y-m-t'), 'container' => 'from_' . $monthId . substr($postId, 0, 8))) . '<br />' . \app\workflow\REF::dateedit($sName . '[to]', $post[$monthId]['to'], array('min_date' => $oDt->format('Y-m-d'), 'max_date' => $oDt->format('Y-m-t'), 'container' => 'to_' . $monthId . substr($postId, 0, 8))); 
                    goto Label_37093; 
                    Label_37092: 
                    if (empty($post[$monthId]['from'])) { 
                        goto Label_37091; 
                    } 
                    $dateFrom = new \DateTime($post[$monthId]['from']); 
                    $dateTo = new \DateTime($post[$monthId]['to']); 
                    $html .= $dateFrom->format('d.m') . '<br />' . $dateTo->format('d.m'); 
                    Label_37091: 
                    $html .= '<input type="hidden" name="' . $sName . '[from]' . '" value="' . $post[$monthId]['from'] . '">' . '<input type="hidden" name="' . $sName . '[to]' . '" value="' . $post[$monthId]['to'] . '">'; 
                    Label_37093: 
                    Label_37095: 
                    $html .= '</td>'; 
                } 
                $npp++; 
            } 
            Label_37096: 
        } 
        $html .= '</tbody>\xa                 </table>'; 
        return $html; 
    } 
    public static function holidayssamrukvarview($aData, $sDoctypeId, $sDocumentId, $isAjaxRequest = false) 
    { 
        $oL = \app\system\Registry::get('locale'); 
        ob_start(); 
        ?> 
        <?php  
        if (!isset($aData['structure'])) { 
            goto Label_37097; 
        } 
        ?> 
        <div class='variable variable_holidays'> 
            <input type='button' value='<?php  
        echo $oL->get('\320\xad\xd0\272\321\201\xd0\277\xd0\276\xd1\x80\xd1\x82 \320\xb2 Excel'); 
        ?> 
' onclick='msf.page.go('/workflow/document/export-variable/<?php  
        echo $sDoctypeId; 
        ?> 
/<?php  
        echo $sDocumentId; 
        ?> 
/<?php  
        echo $aData['varName']; 
        ?> 
');' /> 
            <div style='padding-top: 5px;'> 
                <?php  
        echo \app\workflow\WFW::holidayssamrukvartableview($aData); 
        ?> 
            </div> 
            <!--[if IE]> 
            <style type='text/css'> 
                .rotated_cell 
                { 
                    text-align: left; 
                    padding-bottom: 10px; 
                } 
 
                .rotate_text 
                { 
                    -ms-writing-mode: bt-rl; 
                    filter: flipH() flipV(); 
                    top: 0px; 
                } 
            </style> 
            <![endif]--> 
        </div> 
    <?php  
        Label_37097: 
        ?> 
        <?php  
        $s = ob_get_clean(); 
        return $s; 
    } 
    public static function timesheetsamrukvartableview($aData) 
    { 
        if (!a($_GET, 'x', 0)) { 
            goto Label_37098; 
        } 
        debug($aData); 
        Label_37098: 
        if (isset($aData['structure'])) { 
            goto Label_37104; 
        } 
        return ''; 
        goto Label_37105; 
        Label_37104: 
        $aDayTypeValues = \app\workflow\util\VarUtil::gettimesheetdaytypevalues(); 
        $oL = \app\system\Registry::get('locale'); 
        $npp = 1; 
        $html = '\xa                <table border="1" cellspacing="0" cellpadding="0" class="variable_table" >\xa                <tbody>
                <tr class="title">\xa                <td rowspan="2" style="text-align: center; width: 20px;">' . $oL->get('\342\x84\226 \320\xbf/\320\277') . '</td>
                <td rowspan="2" style="text-align: center; width: 150px;">' . $oL->get('\320\xa4\320\x98\xd0\236') . '</td>
                <td rowspan="2" style="text-align: center; width: 150px;">' . $oL->get('\xd0\224\320\xbe\320\xbb\320\266\xd0\xbd\xd0\xbe\xd1\x81\xd1\202\xd1\214') . '</td>
                <td colspan="' . $aData['daysInMonth'] . '">' . $oL->get('\xd0\247\xd0\xb8\xd1\x81\xd0\xbb\320\260 \xd0\xbc\320\265\321\201\321\x8f\321\206\320\xb0') . '</td>\xa                <td colspan="' . count($aDayTypeValues) . '">' . $oL->get('\xd0\224\320\275\xd0\xb8 \xd1\x8f\320\xb2\xd0\xbe\320\272') . '</td>\xa                </tr>
                <tr class="title">'; 
        for ($day = 1; $day <= $aData['daysInMonth']; $day++) { 
            $className = \app\workflow\util\Util::isweekenddate($day, $aData['month'], $aData['year']) ? 'weekend' : 'ordinary'; 
            $html .= '<td class="' . $className . '">' . $day . '</td>'; 
        } 
        foreach ($aDayTypeValues as $sK => $sV) { 
            $html .= '<td class="rotated_cell" ><div class="rotate_text">' . $oL->get($sV) . '</td>'; 
        } 
        $html .= '</tr>'; 
        $selected = 'selected="selected"'; 
        foreach ($aData['structure'] as $sdvId => $sdv) { 
            $sdvTemp = $aData['varName'] . '[structure][' . $sdvId . ']'; 
            $html .= '<tr><td colspan="' . ($aData['daysInMonth'] + 11) . '">&nbsp; ' . (isset($sdv['name']) ? v($sdv['name']) : '') . '</td></tr>'; 
            if (empty($sdv['posts'])) { 
                goto Label_37103; 
            } 
            foreach ($sdv['posts'] as $postId => $post) { 
                $html .= '<tr id="' . $postId . '">'; 
                $html .= '<td>' . $npp . '</td><td class="align_left">' . v($post['employee']) . '</td>' . '<td class="align_left">' . v($post['post']) . '</td>'; 
                for ($day = 1; $day <= $aData['daysInMonth']; $day++) { 
                    $isWeekend = \app\workflow\util\Util::isweekenddate($day, $aData['month'], $aData['year']); 
                    $className = $isWeekend ? 'weekend' : 'ordinary'; 
                    $html .= '<td class="' . $className . '">'; 
                    $html .= $post[$day]; 
                    $html .= '</td>'; 
                } 
                $npp++; 
                foreach ($aDayTypeValues as $sK => $sV) { 
                    if (isset($post[$sK])) { 
                        goto Label_37101; 
                    } 
                    if (isset($post[\app\workflow\util\VarUtil::getolddaytypebynewtype($sK)])) { 
                        goto Label_37099; 
                    } 
                    $html .= '<td></td>'; 
                    goto Label_37100; 
                    Label_37099: 
                    $html .= '<td>' . $post[\app\workflow\util\VarUtil::getolddaytypebynewtype($sK)] . '</td>'; 
                    Label_37100: 
                    goto Label_37102; 
                    Label_37101: 
                    $html .= '<td>' . $post[$sK] . '</td>'; 
                    Label_37102: 
                } 
                $html .= '</tr>'; 
            } 
            Label_37103: 
        } 
        $html .= '</tbody>\xa                     </table>'; 
        return $html; 
        Label_37105: 
    } 
    public static function holidayssamrukvartableview($aData) 
    { 
        ob_start(); 
        $oL = \app\system\Registry::get('locale'); 
        ?> 
        <?php  
        if (!isset($aData['structure'])) { 
            goto Label_37107; 
        } 
        ?> 
        <input type='hidden' name='<?php  
        echo $aData['varName']; 
        ?> 
[year]' value='<?php  
        echo $aData['year']; 
        ?> 
' /> 
        <table border='1' cellspacing='0' cellpadding='0' class='variable_table' > 
            <tbody> 
            <tr class='title'> 
                <td rowspan='2' style='text-align: center; width: 20px;'><?php  
        echo $oL->get('\xe2\204\x96 \320\277/\320\277'); 
        ?> 
</td> 
                <td rowspan='2' style='text-align: center; width: 150px;'><?php  
        echo $oL->get('\xd0\xa4\xd0\230\xd0\x9e'); 
        ?> 
</td> 
                <td rowspan='2' style='text-align: center; width: 150px;'><?php  
        echo $oL->get('\320\x94\xd0\276\320\273\320\xb6\xd0\275\320\xbe\321\x81\xd1\202\321\x8c'); 
        ?> 
</td> 
                <td colspan='3'><?php  
        echo $oL->get('\320\x9e\320\242\xd0\x9f\xd0\xa3\xd0\241\320\232'); 
        ?> 
</td> 
                <td rowspan='2'> (  .    .)</td> 
            </tr> 
            <tr class='title'> 
                <td>  </td> 
                <td>  </td> 
                <td>  </td> 
            </tr> 
            <?php  
        $iCounter = 1; 
        foreach ($aData['structure'] as $sSdvId => $aSdv) { 
            $sName1 = $aData['varName'] . '[structure][' . $sSdvId . ']'; 
            ?> 
                <tr> 
                    <td colspan='7'><?php  
            echo v($aSdv['name']); 
            ?> 
                        <input type='hidden' name='<?php  
            echo $sName1; 
            ?> 
[name]' value='<?php  
            echo v($aSdv['name']); 
            ?> 
'> 
                    </td> 
                </tr> 
                <?php  
            foreach ($aSdv['posts'] as $sPostId => $aPost) { 
                $sName2 = $sName1 . '[posts][' . $sPostId . ']'; 
                $sCont2 = $aData['varName'] . '_structure_' . strtr($sSdvId, array('-' => '')) . '_posts_' . strtr($sPostId, array('-' => '')); 
                $aPost['holidays'] = a($aPost, 'holidays', array(0 => array('from' => null, 'to' => null, 'note' => null))); 
                ?> 
                    <?php  
                foreach ($aPost['holidays'] as $iHoliday => $aHoliday) { 
                    $sName3 = $sName2 . '[holidays][' . $iHoliday . ']'; 
                    $sCont3 = $sCont2 . '_holidays_' . $iHoliday; 
                    ?> 
                        <tr class='<?php  
                    echo $sCont2; 
                    ?> 
'> 
                            <?php  
                    if (!($iHoliday == 0)) { 
                        goto Label_37106; 
                    } 
                    ?> 
                                <td rowspan='<?php  
                    echo count($aPost['holidays']); 
                    ?> 
'> 
                                    <?php  
                    echo $iCounter++; 
                    ?> 
                                </td> 
                                <td rowspan='<?php  
                    echo count($aPost['holidays']); 
                    ?> 
' class='align_left'><?php  
                    echo $aPost['employee']; 
                    ?> 
</td> 
                                <td rowspan='<?php  
                    echo count($aPost['holidays']); 
                    ?> 
' class='align_left'><?php  
                    echo $aPost['post']; 
                    ?> 
</td> 
                            <?php  
                    Label_37106: 
                    ?> 
                            <td id='<?php  
                    echo $sCont3; 
                    ?> 
_days'><?php  
                    echo $aHoliday['days']; 
                    ?> 
</td> 
                            <td><?php  
                    echo \app\system\Util::unserializedate($aHoliday['from']); 
                    ?> 
</td> 
                            <td><?php  
                    echo \app\system\Util::unserializedate($aHoliday['to']); 
                    ?> 
</td> 
                            <td><?php  
                    echo v($aHoliday['note']); 
                    ?> 
</td> 
                        </tr> 
                    <?php  
                } 
                ?> 
                <?php  
            } 
            ?> 
            <?php  
        } 
        ?> 
            </tbody> 
        </table> 
    <?php  
        Label_37107: 
        ?> 
        <?php  
        $s = ob_get_clean(); 
        return $s; 
    } 
    public static function holidayssamrukvartableviewold($aData) 
    { 
        if (isset($aData['structure'])) { 
            goto Label_37113; 
        } 
        return ''; 
        goto Label_37114; 
        Label_37113: 
        $oL = \app\system\Registry::get('locale'); 
        $npp = 1; 
        $html = '<input type="hidden" name="' . $aData['varName'] . '[year]" value="' . $aData['year'] . '"/>' . '
                <table border="1" cellspacing="0" cellpadding="0" class="variable_table" >
                <tbody>\xa                <tr class="title">
                <td rowspan="2" style="text-align: center; width: 20px;">' . $oL->get('\xe2\x84\x96 \320\xbf/\xd0\xbf') . '</td>\xa                <td rowspan="2" style="text-align: center; width: 150px;">' . $oL->get('\320\244\xd0\230\320\x9e') . '</td>\xa                <td rowspan="2" style="text-align: center; width: 150px;">' . $oL->get('\320\224\320\xbe\320\273\320\xb6\xd0\275\xd0\xbe\321\201\xd1\202\321\x8c') . '</td>
                <td colspan="24">' . $oL->get('\xd0\234\320\265\321\201\xd1\217\321\x86\xd1\213') . '</td>\xa                </tr>\xa                <tr class="title">'; 
        foreach ($aData['monthOptions'] as $monthId => $monthName) { 
            $html .= '<td class="rotated_cell" colspan="2"><div class="rotate_text">' . $monthName . '</div></td>'; 
        } 
        foreach ($aData['structure'] as $sdvId => $sdv) { 
            $sdvTemp = $aData['varName'] . '[structure][' . $sdvId . ']'; 
            $html .= '<tr><td colspan="' . 27 . '">' . $sdv['name'] . '</td></tr>'; 
            if (empty($sdv['posts'])) { 
                goto Label_37112; 
            } 
            foreach ($sdv['posts'] as $postId => $post) { 
                $html .= '<tr id="' . $postId . '">'; 
                $html .= '<td>' . $npp . '</td><td class="align_left">' . $post['employee'] . '</td>' . '<td class="align_left">' . $post['post'] . '</td>'; 
                foreach ($aData['monthOptions'] as $monthId => $monthName) { 
                    $sName = $sdvTemp . '[posts][' . $postId . '][' . $monthId . ']'; 
                    if (!empty($post[$monthId]['from']) && !empty($post[$monthId]['to'])) { 
                        goto Label_37110; 
                    } 
                    $html .= '<td></td><td></td>'; 
                    goto Label_37111; 
                    Label_37110: 
                    $dateFrom = new \DateTime($post[$monthId]['from']); 
                    $dateTo = new \DateTime($post[$monthId]['to']); 
                    $iStart = $dateFrom->format('d'); 
                    $iEnd = $dateTo->format('d'); 
                    $iFirstDays = min($iEnd, intval($dateFrom->format('t') / 2)) - max($iStart, 1); 
                    $iSecondDays = min($iEnd, $dateFrom->format('t')) - max($iStart, intval($dateFrom->format('t') / 2)); 
                    if ($iFirstDays > $iSecondDays) { 
                        goto Label_37108; 
                    } 
                    $html .= '<td></td>'; 
                    $html .= '<td class="rotated_cell"><div class="rotate_text">' . $dateFrom->format('d.m') . '-' . $dateTo->format('d.m') . '</div></td>'; 
                    goto Label_37109; 
                    Label_37108: 
                    $html .= '<td class="rotated_cell"><div class="rotate_text">' . $dateFrom->format('d.m') . '-' . $dateTo->format('d.m') . '</div></td>'; 
                    $html .= '<td></td>'; 
                    Label_37109: 
                    Label_37111: 
                } 
                $npp++; 
            } 
            Label_37112: 
        } 
        $html .= '</tbody>
                     </table>'; 
        return $html; 
        Label_37114: 
    } 
    public static function statementofassessmentsamrukvaredit($aData, $sDoctypeId, $sDocumentId, $mode = 'create') 
    { 
        $oL = \app\system\Registry::get('locale'); 
        ob_start(); 
        ?> 
        <script type='text/javascript'> 
 
            function isValid(obj) 
            { 
                for (var prop in obj) 
                { 
                    if(!$('[name*=''+obj[prop]+'']').length) 
                    { 
                        ShowErrorMessage('<?php  
        echo $oL->get('\xd0\x9f\321\x80\320\xbe\320\xb2\xd0\265\321\x80\321\214\321\x82\xd0\xb5 \xd0\275\xd0\260\320\273\xd0\xb8\xd1\x87\320\270\xd0\265 \320\262\xd1\201\320\xb5\321\205 \320\xbf\320\276\xd0\273\320\xb5\xd0\271 \321\x88\320\xb0\xd0\xb1\320\xbb\xd0\xbe\320\xbd\xd0\265 \320\264\320\xbe\xd0\xba\321\x83\xd0\274\xd0\265\320\275\321\x82\xd0\xb0'); 
        ?> 
'); 
                        return  false; 
                    } 
                } 
 
                return true; 
            } 
 
            function ShowErrorMessage(t) 
            { 
                MSF_StatusBar.hideWait(); 
                $('#results').show().children('#error').append('<div class='status_error' id='statusErrorItem_0'>'+t+'<br /></div>').show(); 
                setTimeout(function() { 
                    $('#statusErrorItem_0').hide(); 
                    $('#statusErrorItem_0').remove(); 
                    if($('#error').html().trim() == '') { 
                        $('#error').hide(); 
                    } 
                }, 5000); 
            }; 
            function calculateFunction(oThis, name){ 
                var val = $(oThis).val().split(',').join('.'); 
                var result = +val + +$('input[name='' + name + '[coefficient]'').val(); 
                $('input[name='' + name + '[final_coefficient]'').val(result); 
                $(document.getElementById(name + '[final_coefficient]')).html(result); 
            } 
 
            $(document).ready(function(){ 
 
                var oConfig =  { //  
                    'document': '<?php  
        echo $aData['var']['document']; 
        ?> 
', 
                    'subdivision': '<?php  
        echo $aData['var']['subdivision']; 
        ?> 
', 
                    'year': '<?php  
        echo $aData['var']['year']; 
        ?> 
', 
                    'month': '<?php  
        echo $aData['var']['quarter']; 
        ?> 
' 
                }; 
                var bAddField = <?php  
        echo $aData['var']['add_fields']; 
        ?> 
; 
                var tableExists = false; 
 
                if(oConfig.document){ 
                    delete oConfig.subdivision; 
                } else { 
                    delete oConfig.document; 
                } 
                /* */ 
                $('#bGenerate<?php  
        echo $aData['varType']; 
        ?> 
').click(function() 
                { 
                    if(!isValid(oConfig)) 
                        return; 
 
                    if(tableExists) 
                    { 
                        if (!confirm('<?php  
        echo $oL->get('\320\x92\321\x8b \xd1\203\xd0\xb2\320\265\321\x80\320\xb5\xd0\xbd\xd1\213, \xd1\x87\321\x82\xd0\276 \321\x85\320\xbe\321\202\320\270\321\202\320\xb5 \xd1\x81\320\276\xd0\xb7\xd0\xb4\xd0\xb0\321\202\321\214 \320\275\320\xbe\320\262\xd1\x83\xd1\x8e \xd1\x82\320\xb0\320\xb1\320\xbb\320\xb8\321\206\xd1\x83, \321\x83\xd0\xb4\320\xb0\xd0\273\320\270\xd0\xb2 \321\201\xd1\x82\320\xb0\321\200\xd1\x83\321\216?'); 
        ?> 
')) 
                        { 
                            return; 
                        } 
                    } 
 
                    request = $.ajax( 
                        { 
                            type:		'POST', 
                            url:		'/workflow/document/<?php  
        echo str_replace('_', '-', $aData['varType']); 
        ?> 
/<?php  
        echo $sDoctypeId; 
        ?> 
/<?php  
        echo $sDocumentId; 
        ?> 
/<?php  
        echo $aData['var']['name']; 
        ?> 
', 
                            data:		$('#createRowForm').serialize(), 
                            dataType: 'json', 
                            success: function(oData) 
                            { 
                                if(array_key_exists('error', oData)) 
                                { 
                                    ShowErrorMessage(oData.error); 
                                } 
                                else 
                                { 
                                    $('#statement_of_assessment_table<?php  
        echo $aData['varType']; 
        ?> 
').html(oData.html); 
                                    if(bAddField){ 
                                        $('.calculate').trigger('change'); 
                                    } 
                                } 
                            }, 
                            error:function(data) 
                            { 
                                ShowErrorMessage('<?php  
        echo $oL->get('\320\237\321\200\320\xbe\xd0\xb8\xd0\267\xd0\xbe\xd1\210\320\273\xd0\260 \xd0\xbe\xd1\210\320\270\xd0\261\320\xba\320\xb0 \xd0\xb2\320\276 \xd0\xb2\321\200\320\265\320\274\321\217 \xd0\xb7\xd0\260\xd0\277\xd1\200\320\276\xd1\201\320\260.'); 
        ?> 
'); 
                            } 
                        }); 
 
                }); 
 
 
                //    ,   . 
                if($('input[name*='actual_work']').length>0) 
                { 
                    tableExists = true; 
                } 
            }); 
        </script> 
        <div class='variable variable_timesheet'> 
            <input id='bGenerate<?php  
        echo $aData['varType']; 
        ?> 
' type='button' value='<?php  
        echo $oL->get('\xd0\xa1\xd0\263\320\xb5\xd0\xbd\xd0\xb5\xd1\x80\xd0\270\321\x80\320\276\320\262\320\260\321\x82\321\x8c'); 
        ?> 
' class='btn btn-sm btn-raised btn-default' /> 
            <div id='statement_of_assessment_table<?php  
        echo $aData['varType']; 
        ?> 
' style='padding-top: 5px;'> 
                <?php  
        if (!($mode == 'edit')) { 
            goto Label_37115; 
        } 
        ?> 
                    <?php  
        echo \app\workflow\WFW::statementofassessmentsamrukvartable($aData, true); 
        ?> 
                <?php  
        Label_37115: 
        ?> 
            </div> 
        </div> 
        <?php  
        $s = ob_get_clean(); 
        return $s; 
    } 
    public static function statementofassessmentsamrukvartable($aData, $isEdit = false) 
    { 
        $oL = \app\system\Registry::get('locale'); 
        $npp = 1; 
        $sManagerName = a(current($aData['data']), 'manager_name', ''); 
        $sHtml = '\xa            <table border="1" cellpadding="0" cellspacing="0" class="variable_table" >
            <tbody>\xa                <tr class="title">\xa                    <td style="text-align: center; width: 20px;">' . $oL->get('\xe2\204\x96 \xd0\277/\320\xbf') . '</td>\xa                    <td style="text-align: center; width: 300px;">' . $oL->get('\320\xa4\320\x98\xd0\236 \321\200\320\xb0\320\xb1\xd0\xbe\xd1\202\320\275\xd0\xb8\320\xba\xd0\xb0') . '</td>\xa                    <td style="text-align: center; width: 200px;">' . $oL->get('\320\224\xd0\xbe\xd0\xbb\320\xb6\xd0\xbd\xd0\276\321\201\321\x82\xd1\x8c') . '</td>'; 
        if (!($aData['add_fields'] && empty($aData['document']) && \app\system\Registry::get('config')->get('statement_of_assessment_samruk') == 'docnii.kmg.kz')) { 
            goto Label_37116; 
        } 
        $sHtml .= '<td style="text-align: center; width: 80px;">' . $oL->get('\320\236\321\202\321\200\xd0\xb0\xd0\261\xd0\276\xd1\202\320\xb0\xd0\xbd\xd0\275\xd1\x8b\xd0\265 \320\xb4\xd0\xbd\320\270') . '</td>'; 
        Label_37116: 
        if (!(empty($aData['document']) && !$aData['add_fields'])) { 
            goto Label_37117; 
        } 
        $sHtml .= '<td style="text-align: center; width: 200px;">' . $oL->get('\320\x98\xd1\202\320\276\xd0\xb3\xd0\276\xd0\262\320\260\321\x8f \321\x80\320\xb5\320\xb7\xd1\x83\xd0\xbb\321\x8c\xd1\202\xd0\xb0\321\x82\320\xb8\320\xb2\xd0\xbd\xd0\276\321\x81\xd1\202\xd1\214') . '</td>'; 
        Label_37117: 
        if (!($aData['add_fields'] && empty($aData['document']))) { 
            goto Label_37118; 
        } 
        $sHtml .= '<td style="text-align: center; width: 80px;">' . $oL->get('\xd0\x9e\xd1\206\xd0\xb5\xd0\275\xd0\xba\320\260') . '</td>\xa                       <td style="text-align: center; width: 80px;">' . $oL->get('\320\x9e\xd0\232\xd0\x9f') . '</td>\xa                       <td style="text-align: center; width: 80px;">' . $oL->get('\320\232\320\276\321\x80\321\x80\320\xb5\xd0\xba\xd1\x82\xd0\270\xd1\200\xd0\xbe\320\262\xd0\272\xd0\260 \320\x9e\xd0\232\xd0\237') . '</td>
                       <td style="text-align: center; width: 150px;">' . $oL->get('\320\x9a\320\xbe\xd1\x8d\321\204\xd1\204\320\270\xd1\x86\xd0\xb8\xd0\xb5\xd0\xbd\xd1\x82 \320\xbf\xd1\x80\320\265\xd0\xbc\320\270\321\200\xd0\xbe\320\xb2\xd0\260\xd0\xbd\xd0\270\321\217 \xd0\xb1\320\265\320\267 \321\x83\321\x87\xd0\265\321\202\320\260 \320\261\xd1\216\xd0\264\xd0\266\xd0\xb5\xd1\202\xd0\275\320\276\xd0\263\xd0\xbe \xd0\276\xd0\263\xd1\200\320\xb0\xd0\275\xd0\xb8\321\x87\320\265\xd0\xbd\xd0\xb8\xd1\217') . '</td>
                       <td style="text-align: center; width: 200px;">' . $oL->get('\xd0\x9f\xd1\200\320\270\320\274\xd0\265\xd1\207\320\260\320\275\xd0\xb8\320\265 \xd0\277\xd0\xbe \xd0\xba\xd0\xbe\321\200\321\200\320\265\320\272\xd1\x82\320\270\321\200\320\276\xd0\xb2\xd0\xba\xd0\265') . '</td>'; 
        Label_37118: 
        if (!(isset($aData['document']) && !empty($aData['document']))) { 
            goto Label_37119; 
        } 
        $sHtml .= '<td style="text-align: center; width: 80px;">' . $oL->get('\320\236\321\x86\320\265\320\275\320\xba\xd0\xb0') . '</td>
                       <td style="text-align: center; width: 150px;">' . $oL->get('\320\232\320\276\xd1\215\xd1\x84\xd1\x84\320\xb8\321\206\320\270\320\265\xd0\xbd\xd1\202 \320\277\xd1\200\320\xb5\320\xbc\xd0\xb8\321\200\xd0\276\xd0\262\xd0\xb0\320\xbd\xd0\270\321\x8f \xd0\xb1\320\xb5\xd0\xb7 \321\x83\321\x87\320\xb5\321\202\320\260 \xd0\261\321\216\320\xb4\320\266\320\265\321\202\xd0\275\320\xbe\xd0\xb3\320\xbe \xd0\276\320\xb3\321\200\xd0\xb0\320\xbd\xd0\270\321\207\xd0\265\320\275\xd0\270\321\x8f') . '</td>'; 
        Label_37119: 
        if (!$isEdit) { 
            goto Label_37120; 
        } 
        $sHtml .= '<td style="text-align: center; width: 60px;">' . $oL->get('\xd0\xa3\320\264\xd0\260\xd0\xbb\xd0\265\320\xbd\320\270\xd0\265') . '</td>'; 
        Label_37120: 
        $sHtml .= '</tr>\xa                    <tr class="title">'; 
        if (!(empty($aData['document']) && !$aData['add_fields'])) { 
            goto Label_37123; 
        } 
        foreach ($aData['data'] as $sPostId => $aV) { 
            $sTemp = $aData['var_name'] . '[' . $sPostId . ']'; 
            $sHtml .= '<tr id="' . $sPostId . '">'; 
            $sHtml .= '<td>' . '<input type="hidden" name="' . $sTemp . '[name]" value="' . $aV['name'] . '"/>' . '<input type="hidden" name="' . $sTemp . '[post]" value="' . $aV['post'] . '"/>' . $npp . '</td><td class="align_left">' . $aV['name'] . '</td>' . '<td class="align_left">' . $aV['post'] . '</td>'; 
            if ($isEdit) { 
                goto Label_37121; 
            } 
            $sHtml .= '<td>' . $aV['result'] . '</td>'; 
            goto Label_37122; 
            Label_37121: 
            $sHtml .= '<td><input name="' . $sTemp . '[result]" type="text" value="' . $aV['result'] . '" /></td>'; 
            $sHtml .= '<td><span onclick="$(this).parent().parent().remove();" style="float:none;margin:auto;" class="variable_timesheet_remove_btn"></span></td>'; 
            Label_37122: 
            $npp++; 
            $sHtml .= '</tr>'; 
        } 
        Label_37123: 
        if ($aData['add_fields'] && empty($aData['document']) && \app\system\Registry::get('config')->get('statement_of_assessment_samruk') == 'docnii.kmg.kz') { 
            goto Label_37143; 
        } 
        if (!($aData['add_fields'] && empty($aData['document']))) { 
            goto Label_37142; 
        } 
        if ($isEdit) { 
            goto Label_37133; 
        } 
        $sHtml .= '<td colspan="8"">' . '\320\221\xd0\273\320\276\320\272, \320\272\321\x83\xd1\200\320\xb8\xd1\x80\321\x83\xd0\265\320\xbc\xd1\x8b\xd0\271 ' . $sManagerName . '</td>'; 
        goto Label_37134; 
        Label_37133: 
        $sHtml .= '<td colspan="9"">' . '\320\x91\xd0\xbb\xd0\xbe\320\xba, \xd0\xba\321\x83\321\x80\xd0\xb8\xd1\200\321\x83\xd0\265\320\xbc\321\x8b\320\271 ' . $sManagerName . '</td>'; 
        Label_37134: 
        $i = 0; 
        foreach ($aData['data'] as $sPostId => $aV) { 
            $aNewData[$aV['subdivision_id']]['subdivision_name'] = $aV['subdivision_name']; 
            $aNewData[$aV['subdivision_id']]['subdivision_id'] = $aV['subdivision_id']; 
            $aNewData[$aV['subdivision_id']][] = $aV; 
        } 
        $aData['data'] = $aNewData; 
        foreach ($aData['data'] as $sPostId => &$aValue) { 
            foreach ($aValue as $sKey => &$aV) { 
                $sTemp = $aData['var_name'] . '[' . $i . ']'; 
                $sHtml .= '<tr id="' . $sKey . '" >'; 
                if ($sKey !== 'subdivision_name' && $sKey !== 'subdivision_id' && $sKey !== 'manager_name') { 
                    goto Label_37140; 
                } 
                if (!($sKey === 'subdivision_name')) { 
                    goto Label_37139; 
                } 
                if ($isEdit) { 
                    goto Label_37137; 
                } 
                $sHtml .= '<td colspan="8"">' . $aValue['subdivision_name'] . '</td>'; 
                goto Label_37138; 
                Label_37137: 
                $sHtml .= '<td colspan="9"">' . $aValue['subdivision_name'] . '</td>'; 
                Label_37138: 
                Label_37139: 
                goto Label_37141; 
                Label_37140: 
                $sHtml .= '<td>' . '<input type="hidden" name="' . $sTemp . '[name]" value="' . $aV['name'] . '"/>' . '<input type="hidden" name="' . $sTemp . '[post]" value="' . $aV['post'] . '"/>' . '<input type="hidden" name="' . $sTemp . '[evaluation]" value="' . $aV['evaluation'] . '"/>' . '<input type="hidden" name="' . $sTemp . '[coefficient]" value="' . $aV['coefficient'] . '"/>' . '<input type="hidden" name="' . $sTemp . '[final_coefficient]" value="' . $aV['final_coefficient'] . '"/>' . '<input type="hidden" name="' . $sTemp . '[subdivision_name]" value="' . $aV['subdivision_name'] . '"/>' . '<input type="hidden" name="' . $sTemp . '[subdivision_id]" value="' . $aV['subdivision_id'] . '"/>' . '<input type="hidden" name="' . $sTemp . '[manager_name]" value="' . $aV['manager_name'] . '"/>' . $npp . '</td><td class="align_left">' . $aV['name'] . '</td>' . '<td class="align_left">' . $aV['post'] . '</td>' . '<td class="align_center">' . $aV['evaluation'] . '</td>' . '<td class="align_center">' . $aV['coefficient'] . '</td>'; 
                if ($isEdit) { 
                    goto Label_37135; 
                } 
                $sHtml .= '<td>' . $aV['adjustment_coefficient'] . '</td>' . '<td id="' . $sTemp . '[final_coefficient]">' . $aV['final_coefficient'] . '</td>' . '<td >' . $aV['note'] . '</td>'; 
                goto Label_37136; 
                Label_37135: 
                $sHtml .= '<td><input class="calculate" style ="width: 80px;" name="' . $sTemp . '[adjustment_coefficient]" type="text" value="' . $aV['adjustment_coefficient'] . '"  onchange="calculateFunction(this,'' . $sTemp . '')"/></td>' . '<td class="align_center" ><span id="' . $sTemp . '[final_coefficient]">' . $aV['final_coefficient'] . '</span></td>' . '<td><input style="width: 200px" name="' . $sTemp . '[note]" type="text" value="' . $aV['note'] . '" /></td>' . '<td><span onclick="$(this).parent().parent().remove();" style="float:none;margin:auto;" class="variable_timesheet_remove_btn"></span></td>'; 
                Label_37136: 
                $npp++; 
                $sHtml .= '</tr>'; 
                Label_37141: 
                $i++; 
            } 
        } 
        Label_37142: 
        goto Label_37144; 
        Label_37143: 
        $i = 0; 
        foreach ($aData['data'] as $sPostId => $aV) { 
            $aNewData[$aV['subdivision_id']]['subdivision_name'] = $aV['subdivision_name']; 
            $aNewData[$aV['subdivision_id']]['subdivision_id'] = $aV['subdivision_id']; 
            $aNewData[$aV['subdivision_id']][] = $aV; 
        } 
        $aData['data'] = $aNewData; 
        foreach ($aData['data'] as $sPostId => &$aValue) { 
            foreach ($aValue as $sKey => &$aV) { 
                $sTemp = $aData['var_name'] . '[' . $i . ']'; 
                $sHtml .= '<tr id="' . $sKey . '" >'; 
                if ($sKey !== 'subdivision_name' && $sKey !== 'subdivision_id' && $sKey !== 'manager_name') { 
                    goto Label_37131; 
                } 
                if (!($sKey === 'subdivision_name')) { 
                    goto Label_37130; 
                } 
                if ($isEdit) { 
                    goto Label_37128; 
                } 
                $sHtml .= '<td colspan="9"">' . $aValue['subdivision_name'] . '</td>'; 
                goto Label_37129; 
                Label_37128: 
                $sHtml .= '<td colspan="10"">' . $aValue['subdivision_name'] . '</td>'; 
                Label_37129: 
                Label_37130: 
                goto Label_37132; 
                Label_37131: 
                $sHtml .= '<td>' . '<input type="hidden" name="' . $sTemp . '[name]" value="' . $aV['name'] . '"/>' . '<input type="hidden" name="' . $sTemp . '[post]" value="' . $aV['post'] . '"/>' . '<input type="hidden" name="' . $sTemp . '[spent_days]" value="' . $aV['spent_days'] . '"/>' . '<input type="hidden" name="' . $sTemp . '[evaluation]" value="' . $aV['evaluation'] . '"/>' . '<input type="hidden" name="' . $sTemp . '[coefficient]" value="' . $aV['coefficient'] . '"/>' . '<input type="hidden" name="' . $sTemp . '[final_coefficient]" value="' . $aV['final_coefficient'] . '"/>' . '<input type="hidden" name="' . $sTemp . '[subdivision_name]" value="' . $aV['subdivision_name'] . '"/>' . '<input type="hidden" name="' . $sTemp . '[subdivision_id]" value="' . $aV['subdivision_id'] . '"/>' . '<input type="hidden" name="' . $sTemp . '[manager_name]" value="' . $aV['manager_name'] . '"/>' . $npp . '</td><td class="align_left">' . $aV['name'] . '</td>' . '<td class="align_left">' . $aV['post'] . '</td>'; 
                if ($isEdit) { 
                    goto Label_37124; 
                } 
                $sHtml .= '<td>' . $aV['spent_days'] . '</td>'; 
                goto Label_37125; 
                Label_37124: 
                $sHtml .= '<td><input style ="width: 80px;"  type="text" value="' . $aV['spent_days'] . '"/></td>'; 
                Label_37125: 
                $sHtml .= '<td class="align_center">' . $aV['evaluation'] . '</td>' . '<td class="align_center">' . $aV['coefficient'] . '</td>'; 
                if ($isEdit) { 
                    goto Label_37126; 
                } 
                $sHtml .= '<td>' . $aV['adjustment_coefficient'] . '</td>' . '<td id="' . $sTemp . '[final_coefficient]">' . $aV['final_coefficient'] . '</td>' . '<td >' . $aV['note'] . '</td>'; 
                goto Label_37127; 
                Label_37126: 
                $sHtml .= '<td><input class="calculate" style ="width: 80px;" name="' . $sTemp . '[adjustment_coefficient]" type="text" value="' . $aV['adjustment_coefficient'] . '"  onchange="calculateFunction(this,'' . $sTemp . '')"/></td>' . '<td class="align_center" ><span id="' . $sTemp . '[final_coefficient]">' . $aV['final_coefficient'] . '</span></td>' . '<td><input style="width: 200px" name="' . $sTemp . '[note]" type="text" value="' . $aV['note'] . '" /></td>' . '<td><span onclick="$(this).parent().parent().remove();" style="float:none;margin:auto;" class="variable_timesheet_remove_btn"></span></td>'; 
                Label_37127: 
                $npp++; 
                $sHtml .= '</tr>'; 
                Label_37132: 
                $i++; 
            } 
        } 
        Label_37144: 
        if (!(isset($aData['document']) && !empty($aData['document']))) { 
            goto Label_37151; 
        } 
        $i = 0; 
        foreach ($aData['data'] as $sPostId => $aV) { 
            $aNewData[$aV['subdivision_id']]['subdivision_name'] = $aV['subdivision_name']; 
            $aNewData[$aV['subdivision_id']]['subdivision_id'] = $aV['subdivision_id']; 
            $aNewData[$aV['subdivision_id']][] = $aV; 
        } 
        $aData['data'] = $aNewData; 
        foreach ($aData['data'] as $sPostId => &$aValue) { 
            foreach ($aValue as $sKey => &$aV) { 
                $sTemp = $aData['var_name'] . '[' . $i . ']'; 
                $sHtml .= '<tr id="' . $sKey . '">'; 
                if ($sKey !== 'subdivision_name' && $sKey !== 'subdivision_id') { 
                    goto Label_37149; 
                } 
                if (!($sKey === 'subdivision_name')) { 
                    goto Label_37148; 
                } 
                if ($isEdit) { 
                    goto Label_37146; 
                } 
                $sHtml .= '<td colspan="5"">' . $aValue['subdivision_name'] . '</td>'; 
                goto Label_37147; 
                Label_37146: 
                $sHtml .= '<td colspan="6"">' . $aValue['subdivision_name'] . '</td>'; 
                Label_37147: 
                Label_37148: 
                goto Label_37150; 
                Label_37149: 
                $sHtml .= '<td>' . '<input type="hidden" name="' . $sTemp . '[name]" value="' . $aV['name'] . '"/>' . '<input type="hidden" name="' . $sTemp . '[post]" value="' . $aV['post'] . '"/>' . '<input type="hidden" name="' . $sTemp . '[evaluation]" value="' . $aV['evaluation'] . '"/>' . '<input type="hidden" name="' . $sTemp . '[final_coefficient]" value="' . $aV['final_coefficient'] . '"/>' . '<input type="hidden" name="' . $sTemp . '[subdivision_name]" value="' . $aV['subdivision_name'] . '"/>' . '<input type="hidden" name="' . $sTemp . '[subdivision_id]" value="' . $aV['subdivision_id'] . '"/>' . $npp . '</td><td class="align_left">' . $aV['name'] . '</td>' . '<td class="align_left">' . $aV['post'] . '</td>' . '<td class="align_center">' . $aV['evaluation'] . '</td>' . '<td class="align_center">' . $aV['final_coefficient'] . '</td>'; 
                if (!$isEdit) { 
                    goto Label_37145; 
                } 
                $sHtml .= '<td><span onclick="$(this).parent().parent().remove();" style="float:none;margin:auto;" class="variable_timesheet_remove_btn"></span></td>'; 
                Label_37145: 
                $npp++; 
                $sHtml .= '</tr>'; 
                Label_37150: 
                $i++; 
            } 
        } 
        Label_37151: 
        $sHtml .= '</tbody>\xa                 </table>'; 
        return $sHtml; 
    } 
    public static function statementofassessmentsamrukvarview($aData, $sDoctypeId, $sDocumentId) 
    { 
        $oL = \app\system\Registry::get('locale'); 
        ob_start(); 
        ?> 
        <div class='variable variable_timesheet'> 
            <input type='button' value='<?php  
        echo $oL->get('\320\255\320\272\321\x81\xd0\xbf\320\xbe\321\x80\xd1\202 \320\xb2 Excel'); 
        ?> 
' onclick='msf.page.go('/workflow/document/export-variable/<?php  
        echo $sDoctypeId; 
        ?> 
/<?php  
        echo $sDocumentId; 
        ?> 
/<?php  
        echo $aData['var_name']; 
        ?> 
');' /> 
            <div id='timesheet-table<?php  
        echo $aData['var_type']; 
        ?> 
' style='padding-top: 5px;'> 
                <?php  
        echo \app\workflow\WFW::statementofassessmentsamrukvartable($aData); 
        ?> 
            </div> 
            <style type='text/css'> 
                .rotated_cell 
                { 
                    text-align: left; 
                    padding-bottom: 10px; 
                } 
 
                .rotate_text 
                { 
                    -ms-writing-mode: bt-rl; 
                    filter: flipH() flipV(); 
                    top: 0px; 
                } 
            </style> 
        </div> 
        <?php  
        $s = ob_get_clean(); 
        return $s; 
    } 
    public static function viewpagepart2($aPart2) 
    { 
        $oL = \app\system\Registry::get('locale'); 
        ob_start(); 
        $aMeta = a($aPart2, 'meta', array()); 
        ?> 
        <ul class='list' id='mydocs_main_grid'> 
            <?php  
        if (!in_array(TRUE, a($aMeta, 'visibility', array()))) { 
            goto Label_37164; 
        } 
        ?> 
                <?php  
        $iCounter = 1; 
        ?> 
                <?php  
        foreach ($aPart2['data'] as $aRow) { 
            ?> 
                    <?php  
            $aItemClickIds = array(); 
            foreach ($aPart2['event']['onItemClick']['ids'] as $iK2 => $sV2) { 
                if (isset($aRow[$sV2])) { 
                    goto Label_37152; 
                } 
                $aItemClickIds[$iK2] = $sV2; 
                goto Label_37153; 
                Label_37152: 
                $aItemClickIds[$iK2] = $aRow[$sV2]; 
                Label_37153: 
            } 
            ?> 
                    <li class='list__item<?php  
            echo !($iCounter % 2) ? ' list__item--even' : ' list__item--odd'; 
            echo strlen($aRow['highlight']) ? ' ' . $aRow['highlight'] : ''; 
            ?> 
 <?php  
            echo isset($aRow['is_visited']) && !$aRow['is_visited'] ? 'unread' : ''; 
            ?> 
 data_row' 
                        id='list__item-<?php  
            echo $iCounter; 
            ?> 
' data-url='<?php  
            echo vsprintf($aPart2['event']['onItemClick']['uri'], $aItemClickIds); 
            ?> 
'> 
                        <ul> 
                            <li class='list__item__checkbox'> 
                                <?php  
            if ($aPart2['is_folder']) { 
                goto Label_37156; 
            } 
            ?> 
                                    <input type='checkbox' class='gridItemCheckbox' value='<?php  
            echo $aRow['doctype_id']; 
            ?> 
:<?php  
            echo $aRow['id']; 
            ?> 
'/> 
                                <?php  
            goto Label_37157; 
            Label_37156: 
            ?> 
                                    <?php  
            if ($aPart2['show_delete_checkbox'] && count(array_intersect(\app\reference\engine\ArrayMapperUtil::unserialize($aRow['s_acl_delete']), \app\structure\Util::getaccesslist()))) { 
                goto Label_37154; 
            } 
            ?> 
                                        <input type='checkbox' disabled='disabled'/> 
                                    <?php  
            goto Label_37155; 
            Label_37154: 
            ?> 
                                        <input type='checkbox' class='gridItemCheckbox' value='<?php  
            echo $aRow['doctype_id']; 
            ?> 
:<?php  
            echo $aRow['id']; 
            ?> 
'/> 
                                    <?php  
            Label_37155: 
            ?> 
                                <?php  
            Label_37157: 
            ?> 
                            </li> 
                            <li class='list__item__item' onclick='msf.page.viewNode('<?php  
            echo vsprintf($aPart2['event']['onItemClick']['uri'], $aItemClickIds); 
            ?> 
'); if($(this).parent().parent().hasClass('unread')) {msf.page.viewPart(); $(this).parent().parent().removeClass('unread');}'> 
                                <ul> 
                                    <?php  
            $iCounter2 = 1; 
            ?> 
                                    <?php  
            foreach ($aRow as $sK2 => $mV2) { 
                ?> 
                                        <?php  
                if (!$aPart2['meta']['visibility'][$sK2]) { 
                    goto Label_37163; 
                } 
                ?> 
                                            <?php  
                if ($aPart2['meta']['type'][$sK2] === 'image') { 
                    goto Label_37159; 
                } 
                if ($aPart2['meta']['type'][$sK2] === 'text') { 
                    goto Label_37160; 
                } 
                $sNormalText = strtr(v(strtr($mV2, array('<br>' => '[[:br:]]', '<hr>' => '[[:hr:]]'))), array('[[:br:]]' => '<br>', '[[:hr:]]' => '<hr>')); 
                goto Label_37158; 
                Label_37159: 
                $sNormalText = $mV2; 
                goto Label_37158; 
                Label_37160: 
                $sNormalText = strip_tags($mV2); 
                Label_37158: 
                ?> 
                                            <li class='list__item__field<?php  
                echo $iCounter2 === 1 ? ' list__item__field--first' : ''; 
                ?> 
'> 
                                                <p> 
                                                    <?php  
                if (!($iCounter2 > 1)) { 
                    goto Label_37161; 
                } 
                ?> 
                                                        <span class='list__item__field__title'><?php  
                echo $aPart2['meta']['title'][$sK2]; 
                ?> 
:</span> 
                                                        <!-- <span class='list__item__field__divider'>: </span> --> 
                                                    <?php  
                Label_37161: 
                ?> 
                                                    <?php  
                if (!($iCounter2 > 1)) { 
                    goto Label_37162; 
                } 
                ?> 
 
                                                    <?php  
                Label_37162: 
                ?> 
                                                    <span class='list__item__field__value'><?php  
                echo $sNormalText; 
                ?> 
</span> 
                                                </p> 
                                            </li> 
                                            <?php  
                $iCounter2++; 
                ?> 
                                        <?php  
                Label_37163: 
                ?> 
                                    <?php  
            } 
            ?> 
                                </ul> 
                            </li> 
                        </ul> 
                    </li> 
                    <?php  
            $iCounter++; 
            ?> 
                <?php  
        } 
        ?> 
            <?php  
        Label_37164: 
        ?> 
        </ul> 
        <?php  
        return ob_get_clean(); 
    } 
} 
?>

Did this file decode correctly?

Original Code

<?php
/*
 * Copyright (c) 2022, Documentolog LLP
 * This program is commercial software:
 * you can not redistribute it and/or modify it.
 */
namespace app\workflow;

defined('\113\x4e\x51\166\x5f\x42\137\113\x42\x67') or die('\x4e\x6f\40\x64\x69\x72\x65\143\164\x20\x61\143\x63\x65\163\163\40\141\154\x6c\x6f\167\145\144\x2e');
class WFW
{
    public static function familytreevar($a, $sDoctypeId, $sDocumentId, $iDepth = 0, $sNamespace = '')
    {
        ob_start();
        ?>
        <?php 
        if (!(isset($a[0]['\143\x68\x69\154\144\x73']) && count($a[0]['\143\x68\151\154\144\x73']) || $iDepth != 0)) {
            goto Label_36668;
        }
        ?>
        <?php 
        $sFamilyTreeId = sprintf('\45\60\70\170\45\170\x25\60\70\x78', mt_rand(), time(), mt_rand()) . '\137' . $iDepth;
        ?>

        <ul id='field_family_tree_<?php 
        echo $sFamilyTreeId;
        ?>
' class='family_tree field_family_tree <?php 
        echo $sNamespace;
        ?>
 <?php 
        echo !$iDepth ? '\162\x6f\157\164' : '';
        ?>
'>
            <?php 
        foreach ($a as $aV) {
            ?>
                <li>
                    <?php 
            if ($aV['\x64\157\143\164\171\x70\x65\137\x69\144'] == $sDoctypeId && $aV['\x69\x64'] == $sDocumentId) {
                goto Label_36665;
            }
            ?>
                        <span class='title'><?php 
            
            ?>
								<span class='btn_fastopen' data-href='/workflow/document/fast-view/<?php 
            echo $aV['\x64\157\x63\x74\171\160\145\x5f\151\144'];
            ?>
/<?php 
            echo $aV['\151\144'];
            ?>
'>&nbsp;</span><span class='arrow'>&nbsp;</span>
								<a class='caption' href='/workflow/document/view/<?php 
            echo $aV['\x64\x6f\x63\x74\171\x70\145\x5f\151\x64'];
            ?>
/<?php 
            echo $aV['\x69\144'];
            ?>
'><?php 
            echo $aV['\164\x69\164\154\x65'];
            ?>
</a>
							</span>
                    <?php 
            goto Label_36666;
            Label_36665:
            ?>
                        <span class='title current' title='<?php 
            echo \app\system\Registry::get('\x6c\157\x63\x61\x6c\x65')->get('\xd0\242\320\xb5\xd0\xba\321\x83\xd1\211\320\xb8\xd0\xb9\x20\xd0\xb4\320\xbe\xd0\xba\321\203\320\xbc\320\xb5\xd0\xbd\321\x82');
            ?>
'>
								<span class='arrow'>&nbsp;</span><span class='caption'><?php 
            echo $aV['\164\151\x74\x6c\145'];
            ?>
</span>
							</span>
                    <?php 
            Label_36666:
            ?>
                    <?php 
            if (!count($aV['\143\150\151\154\144\x73'])) {
                goto Label_36667;
            }
            ?>
                        <?php 
            echo \app\workflow\WFW::familytreevar($aV['\x63\x68\151\154\x64\x73'], $sDoctypeId, $sDocumentId, $iDepth + 1);
            ?>
                    <?php 
            Label_36667:
            ?>
                </li>
            <?php 
        }
        ?>
        </ul>
    <?php 
        Label_36668:
        ?>

        <?php 
        if (!(strlen($sNamespace) && isset($sFamilyTreeId))) {
            goto Label_36669;
        }
        ?>
        <script type='text/javascript'>
            if (!window.FIELDS_BANK[ 'field_family_tree_<?php 
        echo $sFamilyTreeId;
        ?>
' ])
            {
                window.FIELDS_BANK['field_family_tree_<?php 
        echo $sFamilyTreeId;
        ?>
'] = new MSF_DocumentFamilyTree( '#field_family_tree_<?php 
        echo $sFamilyTreeId;
        ?>
' );
            }
        </script>
    <?php 
        Label_36669:
        ?>

        <?php 
        $s = ob_get_clean();
        return $s;
    }
    public static function reportvarview($sFilePath, $sSale, $sType, $oDoctype, $oDocument)
    {
        $Registry = get_class(new \app\system\Registry());
        $Json = get_class(new \app\system\Json());
        $ArrayMapperUtil = get_class(new \app\reference\engine\ArrayMapperUtil());
        $sid = \app\user\Account::getaccount()->getsid();
        $ListModel = get_class(\app\system\model\ListModel::getlist());
        ob_start();
        if (!(!empty($sFilePath) && file_exists($sFilePath))) {
            goto Label_36670;
        }
        include $sFilePath;
        Label_36670:
        $s = ob_get_clean();
        return $s;
    }
    public static function roadmapvar($sDoctypeId, $a)
    {
        $aLcl = array();
        $sLocale = \app\user\Account::getaccount()->getlocale();
        if (!($sLocale !== '\x72\165' && array_key_exists($sLocale, \app\system\Registry::get('\x63\157\156\146\151\147')->get('\141\x70\160\137\154\x6f\143\141\154\x65\x73')))) {
            goto Label_36671;
        }
        $aL = \app\system\Registry::get('\154\157\x63\x61\x6c\x65\x5f\151\x6e\146\157');
        $aLcl = array_merge($aL['\160\x73\x74'], $aL['\x73\x64\x76'], $aL['\x67\x72\x70']);
        Label_36671:
        ob_start();
        $ID = \app\system\Util::randomstring(3);
        ?>
        <div class='control_timeline clearfix' id='control_timeline_<?php 
        echo $ID;
        ?>
' style='display: inline-block;'>
            <?php 
        if (!(array_key_exists('\x70\x6f\151\x6e\164\x73', $a) && array_key_exists('\x63\165\162\162\145\x6e\x74', $a))) {
            goto Label_36680;
        }
        $iNum = 1;
        $sPointType = '\143\x6f\x6d\160\154\145\x74\x65';
        $iCompletedPointsCount = 0;
        $aPoints = array();
        $aPointsPrintable = array();
        foreach ($a['\x70\x6f\151\x6e\164\x73'] as $sPoint => $aData) {
            if (!count($aData['\x72\x65\x73\x70\157\x6e\x64\x65\156\x74'])) {
                goto Label_36672;
            }
            foreach ($aData['\x72\145\163\x70\x6f\x6e\144\145\x6e\x74'] as $sKey => &$sVal) {
                $sVal = strtr($sVal, a($aLcl, $sKey, array()));
            }
            Label_36672:
            if (!mb_strstr($aData['\164\x69\164\x6c\x65'], '\44')) {
                goto Label_36673;
            }
            $aData['\x74\151\164\154\145'] = mb_substr($aData['\x74\151\x74\154\x65'], mb_strpos($aData['\x74\x69\164\154\x65'], '\44') + 1);
            Label_36673:
            $aData['\x74\151\164\x6c\x65'] = \app\system\Registry::get('\x6c\157\x63\x61\154\145')->get($aData['\164\151\164\x6c\145'], '\320\x94\320\xbe\320\xba\321\x83\xd0\xbc\xd0\265\xd0\275\321\202\321\x8b', '\320\x9c\xd0\xb0\xd1\x80\321\210\xd1\x80\321\203\321\202', vsprintf('\45\163\55\45\x73\55\x74\x69\x74\x6c\x65', array($sDoctypeId, $sPoint)));
            if (!mb_strstr($aData['\x74\151\164\x6c\x65'], '\x24')) {
                goto Label_36674;
            }
            $aData['\x74\151\x74\x6c\x65'] = mb_substr($aData['\x74\x69\164\154\145'], mb_strpos($aData['\164\151\x74\x6c\x65'], '\x24') + 1);
            Label_36674:
            $show_in_progress_if_current = $aData['\163\150\x6f\x77\137\x69\156\x5f\160\x72\157\147\x72\145\163\163\137\x69\x66\137\143\x75\x72\x72\x65\156\x74'] && $sPoint === $a['\x63\x75\x72\x72\x65\156\x74'];
            if (!($aData['\x73\x68\x6f\x77\137\x69\x6e\137\160\x72\157\x67\x72\x65\x73\163'] || $show_in_progress_if_current)) {
                goto Label_36678;
            }
            if (!($sPointType === '\x63\x75\162\x72\x65\x6e\164')) {
                goto Label_36675;
            }
            $sPointType = '';
            Label_36675:
            if (!($sPoint === $a['\x63\x75\x72\x72\x65\x6e\x74'])) {
                goto Label_36676;
            }
            $sPointType = '\x63\165\162\x72\145\x6e\x74';
            Label_36676:
            if (!($sPointType === '\x63\157\155\x70\154\145\164\145')) {
                goto Label_36677;
            }
            $iCompletedPointsCount++;
            Label_36677:
            $aPoints[] = '\74\x6c\151\40\143\154\x61\163\163\75\42\x70\x6f\151\x6e\x74' . ($sPointType ? '\40' : '') . $sPointType . '\42\x3e' . $iNum++ . '\x3c\163\160\141\x6e\40\143\154\141\x73\x73\75\42\x70\x6f\151\156\164\137\x68\x69\156\x74\x22\x20\163\164\x79\x6c\x65\x3d\42\x64\151\x73\x70\154\x61\x79\x3a\x20\156\x6f\x6e\x65\x3b\42\76' . '\x3c\163\x70\x61\156\x20\143\154\x61\163\x73\x3d\x22\x74\151\x74\x6c\x65\42\76' . $aData['\x74\151\x74\154\x65'] . '\x3c\57\x73\160\x61\156\76' . (count($aData['\x72\x65\163\160\157\156\x64\145\x6e\x74']) ? '\74\x62\x72\x20\x2f\x3e\x3c\163\x70\x61\x6e\x20\x63\154\x61\163\x73\75\x22\162\145\163\160\157\156\x64\x65\x6e\x74\x73\x5f\154\x69\163\x74\x22\x3e\74\x73\164\162\157\156\x67\x3e' . \app\system\Registry::get('\154\157\x63\x61\x6c\145')->get('\xd0\236\xd1\202\320\262\xd0\265\321\202\321\x81\xd1\202\xd0\xb2\xd0\265\320\xbd\xd0\xbd\xd1\213\xd0\xb5') . '\x3c\x2f\163\x74\162\x6f\156\147\76\x3c\x62\162\40\x2f\76' . join('\x3c\x62\x72\x20\x2f\76', $aData['\x72\145\163\160\157\156\144\145\x6e\164']) . '\x3c\57\163\x70\x61\156\x3e' : '') . '\74\x2f\163\x70\141\x6e\76' . '\74\x2f\154\151\x3e';
            $aPointsPrintable[] = '\74\163\x70\141\156\x20\x63\154\x61\x73\163\x3d\x22\160\x6f\x69\x6e\x74' . ($sPointType ? '\x20' : '') . $sPointType . '\42\x3e' . ($sPointType === '\x63\157\155\x70\154\145\164\x65' ? '\x20\xe2\x9c\224\x20' : '') . $aData['\x74\151\x74\154\145'] . '\74\57\x73\x70\141\x6e\x3e';
            Label_36678:
        }
        $iPointWidth = 28;
        $iPointsSpace = 25;
        $iPointsCount = sizeof($aPoints);
        $iLineWidth = $iPointsCount * $iPointWidth + ($iPointsCount - 1) * $iPointsSpace - 1;
        $iProgressWidth = $iCompletedPointsCount * $iPointWidth + $iCompletedPointsCount * $iPointsSpace - ($iCompletedPointsCount == $iPointsCount ? $iPointsSpace + 2 : 0);
        if (!($iPointsCount < 7)) {
            goto Label_36679;
        }
        echo '\74\163\164\171\154\x65\x3e\56\x63\x6f\x6e\164\162\157\x6c\137\164\151\155\145\x6c\151\156\x65\x20\x2e\154\151\x6e\x65\137\x70\x6f\x69\156\x74\163\x20\x2e\160\157\x69\x6e\164\x20\x7b\x20\x6d\151\x6e\55\167\x69\144\x74\x68\72\40\x31\61\x30\x70\170\x3b\x7d\x3c\57\x73\x74\x79\x6c\145\x3e';
        Label_36679:
        
        ?>

                <div class='control_timeline_inner clearfix noprint'>
                    <ul class='line_points clearfix'><?php 
        echo join('', $aPoints);
        ?>
</ul>
                    <p class='line'>&nbsp;</p>
                    <p class='line_progress' style='width:<?php 
        echo $iProgressWidth;
        ?>
px;'>&nbsp;</p>
                </div>

                <div class='control_timeline_inner print'>
                    <?php 
        echo join('\x20\46\162\141\162\x72\73\40', $aPointsPrintable);
        ?>
                </div>
            <?php 
        Label_36680:
        ?>
        </div>
        <script type='text/javascript'>
            ControlTimeline.start('#control_timeline_<?php 
        echo $ID;
        ?>
');
        </script>
        <?php 
        $s = ob_get_clean();
        return $s;
    }
    public static function progressvar($a, $sUri)
    {
        ob_start();
        ?>
        <style>
            .search_input {
                float: right;
            }
            #search_buttom {
                border: none;
                background: transparent;
            }
            .search_input #search_loading {
                margin-right: 37px;
                margin-top: 4px;
            }

        </style>
        <div id='document_log' class='field_big_wrap document_log collapsed' data-uri='<?php 
        echo $sUri;
        ?>
'>
            <input type='hidden' value='notloadedyet' id='hasProgress' />
            <h3>
                <?php 
        echo \app\system\Registry::get('\154\x6f\143\x61\154\x65')->get('\320\245\320\276\xd0\264\40\xd1\200\xd0\xb0\xd0\xb1\320\xbe\xd1\202\xd1\x8b');
        ?>
                <span class='control_micro_tabs view_mode' style='display:none'>
					<a href='#' class='tab short current btn btn-xs'><?php 
        echo \app\system\Registry::get('\154\157\x63\x61\x6c\145')->get('\320\x9a\320\xbe\321\200\xd0\276\321\x82\xd0\272\320\276');
        ?>
</a><a href='#' class='tab full  btn btn-xs'><?php 
        echo \app\system\Registry::get('\154\x6f\x63\x61\x6c\x65')->get('\xd0\x9f\320\xbe\xd0\xb4\xd1\x80\xd0\276\320\xb1\320\xbd\xd0\276');
        ?>
</a>
				</span>
                <span class='search_input form-group form-group-sm' id='search_bar' style='display:none' ><button id='search_buttom' class='iconBtnForSearching field_keyword' title='<?php 
        echo \app\system\Registry::get('\154\x6f\x63\141\154\145')->get('\320\235\320\260\xd0\xb9\321\x82\xd0\270');
        ?>
' value='<?php 
        echo \app\system\Registry::get('\154\157\x63\141\x6c\x65')->get('\xd0\x9d\xd0\xb0\xd0\xb9\xd1\x82\320\270');
        ?>
'></button>
                    <input id='search_username' class='field_keyword form-control input-sm' title='<?php 
        echo \app\system\Registry::get('\154\157\x63\141\154\x65')->get('\xd0\x9d\320\xb0\320\271\xd1\x82\320\270\40\xd0\277\320\276\x20\320\244\320\x98\xd0\236');
        ?>
' type='text' placeholder='<?php 
        echo \app\system\Registry::get('\154\157\143\x61\154\145')->get('\320\x9d\xd0\xb0\320\271\321\202\xd0\270');
        ?>
'>
                    <select id='search_title' class='form-control input-inline input-sm'>
                        <option value=''><?php 
        echo \app\system\Registry::get('\154\157\143\x61\x6c\x65')->get('\xd0\x9d\320\xb5\40\320\xb2\xd1\213\320\261\xd1\200\xd0\xb0\xd0\xbd\xd0\276');
        ?>
</option>
                        <?php 
        foreach (\app\workflow\util\Util::getactiontypes() as $Key => $sV) {
            ?>
                            <option value='<?php 
            echo $sV;
            ?>
'><?php 
            echo $sV;
            ?>
</option>
                        <?php 
        }
        ?>
                    </select>
                    <img id='search_loading' style='display: none;' src='/tpl/web/img/loading.gif' />
                </span>
            </h3>
            <div class='inner_wrap wrap' style='display:none'></div>
            <div class='inner_wrap searchwrap' style='display:none'></div>
        </div>


        <script type='text/javascript'>
            MSF_App.bind_starter(function()
            {
                window.DOCUMENT_LOG = new MSF_DocumentLog( '#document_log' );
            }, 'document_log');
        </script>

        <?php 
        $s = ob_get_clean();
        return $s;
    }
    public static function employeeratingvar($a, $sPointName, $sDocumentId, $sDoctypeId, $hasAccess)
    {
        ob_start();
        $oL = \app\system\Registry::get('\x6c\x6f\143\141\154\x65');
        if ($hasAccess && $sDoctypeId === '\66\x31\71\x35\x37\x36\x33\67\55\65\141\x35\62\x2d\x34\x39\x64\x37\x2d\x39\71\x30\x30\55\65\67\64\145\66\143\70\x30\60\x33\143\x38' && $sPointName === '\160\137\145\x31\63\60\x32\141\x36') {
            goto Label_36720;
        }
        if ($sDoctypeId === '\x36\x31\71\65\x37\66\x33\67\x2d\65\141\x35\62\x2d\64\x39\x64\67\x2d\x39\71\x30\x30\55\65\67\x34\145\66\x63\x38\x30\x30\63\x63\70' && $sPointName === '\x70\x5f\145\61\x33\60\x32\x61\66') {
            goto Label_36721;
        }
        if ($sDoctypeId === '\x34\60\x38\141\x63\144\x31\141\x2d\64\x65\61\141\55\x34\62\x35\x36\55\x39\x37\x38\143\55\65\67\x34\144\x37\67\x66\x64\60\x30\x66\x62' && $sPointName === '\x70\137\70\x31\x33\x65\x38\x30\141') {
            goto Label_36722;
        }
        goto Label_36719;
        Label_36720:
        ?>

            <style type='text/css'>
                /* <![CDATA[ */

                .bold {
                    font-weight: bold;
                }

                .center {
                    text-align: center;
                }

                #rating_table {
                    border: 1px solid #dddddd;
                    border-collapse: collapse;
                    table-layout: fixed;
                }

                #rating_table .field_title {
                    background-color: #003b6a;
                    color: #ffffff;
                }

                #rating_table .field_title_description {
                    vertical-align: top;
                }

                #rating_table .field_title_description,
                #rating_table .employee {
                    background-color: #edf3ff;
                }

                #rating_table .separator_container {
                    background-color: #ffffff;
                    border: 1px solid white;
                }

                #rating_buttons li {
                    display: inline-block;
                    list-style: none;
                    margin: 0;
                }

                #rating_buttons li:not(:first-child) {
                    margin: 0 0 0 22px;
                }

                /* ]]> */
            </style>

            <form action='/workflow/rate-employee' method='POST' id='rating_form'>
                <input type='hidden' name='token' value='<?php 
        echo v(a($_GET, '\164\x6f\153\145\156', '\55\55\x2d\x2d'));
        ?>
'>
                <table class='field_table_view table_key_value' id='rating_table'>
                    <tbody>
                    <tr class='trow'>
                        <td class='field_title center'><span class='bold'><?php 
        echo $oL->get('\xd0\x9e\321\x86\xd0\xb5\xd0\xbd\xd0\xb8\320\xb2\320\260\320\xb5\320\274\321\x8b\320\271');
        ?>
</span></td>
                        <td class='field_title center'><span class='bold'><?php 
        echo $oL->get('\xd0\237\321\x80\320\xbe\xd1\x84\320\265\xd1\201\321\x81\xd0\xb8\xd0\xbe\xd0\275\xd0\xb0\xd0\273\320\270\320\267\320\274');
        ?>
</span></td>
                        <td class='field_title center'><span class='bold'><?php 
        echo $oL->get('\xd0\x9e\320\xbf\320\xb5\xd1\x80\320\xb0\321\202\320\xb8\xd0\xb2\320\275\320\xbe\xd1\201\321\x82\xd1\214');
        ?>
</span></td>
                        <td class='field_title center'><span class='bold'><?php 
        echo $oL->get('\320\x9a\xd0\276\xd0\274\xd0\xbc\321\203\320\275\xd0\xb8\xd0\xba\xd0\260\xd0\xb1\320\xb5\xd0\273\xd1\x8c\320\275\xd0\276\321\201\321\202\xd1\214');
        ?>
</span></td>
                        <td class='field_title center'><span class='bold'><?php 
        echo $oL->get('\xd0\236\xd1\x82\320\262\xd0\265\xd1\202\321\x81\321\x82\320\262\320\265\xd0\xbd\xd0\xbd\320\276\xd1\201\321\202\321\214');
        ?>
</span></td>
                        <td class='field_title center'><span class='bold'><?php 
        echo $oL->get('\xd0\230\xd0\275\xd0\xb8\xd1\x86\xd0\xb8\320\260\321\202\320\xb8\xd0\xb2\xd0\xbd\320\276\321\201\321\202\xd1\214');
        ?>
</span></td>
                    </tr>
                    <tr class='trow'>
                        <td class='field_title_description'></td>
                        <td class='field_title_description'><p><?php 
        echo $oL->get('\320\235\xd0\260\x20\xd1\201\xd0\xba\xd0\276\xd0\xbb\321\x8c\320\272\320\276\x20\xd0\xba\xd0\xb0\321\207\xd0\xb5\xd1\x81\321\202\xd0\xb2\xd0\265\320\xbd\320\xbd\320\xbe\x20\xd0\270\xd1\201\320\xbf\320\276\xd0\273\320\275\xd1\x8f\xd0\xb5\321\202\40\321\x81\320\262\xd0\276\320\xb8\40\320\267\320\260\xd0\264\320\xb0\xd1\207\xd0\xb8\x3f');
        ?>
</p></td>
                        <td class='field_title_description'><p><?php 
        echo $oL->get('\320\235\320\xb0\x20\321\201\xd0\xba\320\276\320\273\321\214\320\xba\xd0\xbe\40\320\261\321\x8b\xd1\201\xd1\202\xd1\x80\xd0\276\x20\320\270\321\201\320\277\xd0\276\320\xbb\320\xbd\321\217\320\265\321\202\x20\321\201\xd0\xb2\320\276\320\xb8\x20\320\267\xd0\260\320\264\xd0\xb0\xd1\x87\xd0\xb8\x3f');
        ?>
</p></td>
                        <td class='field_title_description'><p><?php 
        echo $oL->get('\320\x9d\320\260\x20\xd1\x81\xd0\272\xd0\xbe\320\xbb\321\214\xd0\272\320\xbe\40\xd1\x8d\321\x84\xd1\x84\xd0\265\xd0\xba\xd1\x82\xd0\270\320\262\xd0\275\xd0\276\40\xd0\xb2\320\267\320\260\320\xb8\320\xbc\xd0\276\320\xb4\xd0\xb5\xd0\xb9\321\201\321\202\320\262\xd1\203\320\xb5\321\202\x20\321\201\40\320\xba\320\xbe\320\xbb\320\273\xd0\265\xd0\xb3\xd0\xb0\xd0\274\320\270\x20\xd0\264\320\273\xd1\x8f\x20\xd0\270\xd1\201\xd0\277\xd0\276\xd0\xbb\xd0\xbd\320\xb5\xd0\275\xd0\270\xd1\x8f\40\321\x81\320\xb2\320\xbe\320\xb8\321\205\40\xd0\267\320\260\320\264\320\260\321\207');
        ?>
</p></td>
                        <td class='field_title_description'><p><?php 
        echo $oL->get('\320\x9d\xd0\260\40\xd1\x81\xd0\xba\xd0\276\320\xbb\xd1\x8c\320\xba\xd0\276\40\xd1\205\xd0\xbe\321\200\xd0\xbe\xd1\210\320\xbe\40\320\xbe\xd1\202\320\xb2\320\265\321\207\320\xb0\320\265\321\202\x20\320\267\320\xb0\40\321\201\320\xb2\320\xbe\320\270\40\320\267\xd0\xb0\320\xb4\xd0\xb0\xd1\207\xd0\xb8');
        ?>
</p></td>
                        <td class='field_title_description'><p><?php 
        echo $oL->get('\xd0\x9d\320\260\x20\xd1\x81\320\272\xd0\276\xd0\273\xd1\x8c\320\xba\320\276\x20\xd1\201\xd0\260\320\274\xd0\xbe\xd1\201\xd1\202\xd0\276\321\x8f\321\x82\xd0\xb5\xd0\xbb\321\214\320\xbd\xd0\xbe\40\320\270\321\x81\320\xbf\xd0\xbe\320\xbb\xd0\xbd\xd1\217\320\xb5\321\x82\40\xd0\267\xd0\260\320\264\320\260\321\207\xd0\xb8\40\320\xb8\x20\320\277\xd1\x80\320\265\xd0\264\xd0\xbb\320\xb0\xd0\xb3\320\xb0\xd0\xb5\321\202\x20\320\xb2\xd0\xb0\321\x80\xd0\xb8\xd0\260\xd0\xbd\321\x82\xd1\213\40\321\x80\xd0\xb5\xd1\x88\xd0\xb5\320\xbd\xd0\270\xd0\xb9');
        ?>
</p></td>
                    </tr>
                    <?php 
        foreach ($a['\x65\155\160\x6c\x6f\x79\145\145\163'] as $sK => $sV) {
            ?>
                        <tr class='trow'>
                            <td class='employee'>
                                <span><?php 
            echo $sV;
            ?>
</span>
                                <input type='hidden' name='employees[<?php 
            echo $sK;
            ?>
][employee][<?php 
            echo $sK;
            ?>
]' value='<?php 
            echo $sV;
            ?>
' id='<?php 
            echo $sK;
            ?>
_employee'>
                            </td>
                            <td class='center'>
                                <input type='hidden' name='employees[<?php 
            echo $sK;
            ?>
][professionalism][employee]' value='<?php 
            echo $sV;
            ?>
'>
                                <select name='employees[<?php 
            echo $sK;
            ?>
][professionalism][value]' value='' id='<?php 
            echo $sK;
            ?>
_professionalism_rating'>
                                    <option value=''></option>
                                    <?php 
            foreach ($a['\x72\x61\x74\x69\x6e\x67\x73'] as $iK2 => $sV2) {
                ?>
                                        <option value='<?php 
                echo $iK2;
                ?>
'><?php 
                echo $sV2;
                ?>
</option>
                                    <?php 
            }
            ?>
                                </select>
                            </td>
                            <td class='center'>
                                <input type='hidden' name='employees[<?php 
            echo $sK;
            ?>
][operativeness][employee]' value='<?php 
            echo $sV;
            ?>
'>
                                <select name='employees[<?php 
            echo $sK;
            ?>
][operativeness][value]' value='' id='<?php 
            echo $sK;
            ?>
_operativeness_rating'>
                                    <option value=''></option>
                                    <?php 
            foreach ($a['\x72\141\164\x69\x6e\x67\x73'] as $iK2 => $sV2) {
                ?>
                                        <option value='<?php 
                echo $iK2;
                ?>
'><?php 
                echo $sV2;
                ?>
</option>
                                    <?php 
            }
            ?>
                                </select>
                            </td>
                            <td class='center'>
                                <input type='hidden' name='employees[<?php 
            echo $sK;
            ?>
][communicability][employee]' value='<?php 
            echo $sV;
            ?>
'>
                                <select name='employees[<?php 
            echo $sK;
            ?>
][communicability][value]' value='' id='<?php 
            echo $sK;
            ?>
_communicability_rating'>
                                    <option value=''></option>
                                    <?php 
            foreach ($a['\162\141\x74\x69\x6e\147\163'] as $iK2 => $sV2) {
                ?>
                                        <option value='<?php 
                echo $iK2;
                ?>
'><?php 
                echo $sV2;
                ?>
</option>
                                    <?php 
            }
            ?>
                                </select>
                            </td>
                            <td class='center'>
                                <input type='hidden' name='employees[<?php 
            echo $sK;
            ?>
][responsibility][employee]' value='<?php 
            echo $sV;
            ?>
'>
                                <select name='employees[<?php 
            echo $sK;
            ?>
][responsibility][value]' value='' id='<?php 
            echo $sK;
            ?>
_responsibility_rating'>
                                    <option value=''></option>
                                    <?php 
            foreach ($a['\162\x61\x74\151\156\147\163'] as $iK2 => $sV2) {
                ?>
                                        <option value='<?php 
                echo $iK2;
                ?>
'><?php 
                echo $sV2;
                ?>
</option>
                                    <?php 
            }
            ?>
                                </select>
                            </td>
                            <td class='center'>
                                <input type='hidden' name='employees[<?php 
            echo $sK;
            ?>
][initiative][employee]' value='<?php 
            echo $sV;
            ?>
'>
                                <select name='employees[<?php 
            echo $sK;
            ?>
][initiative][value]' value='' id='<?php 
            echo $sK;
            ?>
_initiative_rating'>
                                    <option value=''></option>
                                    <?php 
            foreach ($a['\x72\141\164\151\156\x67\163'] as $iK2 => $sV2) {
                ?>
                                        <option value='<?php 
                echo $iK2;
                ?>
'><?php 
                echo $sV2;
                ?>
</option>
                                    <?php 
            }
            ?>
                                </select>
                            </td>
                        </tr>
                    <?php 
        }
        ?>
                    <?php 
        
        ?>
                    </tbody>
                </table>

                <ul class='content_bottom_toolbar_inner clearfix btn_clickmenu clickMenu' id='rating_buttons'>
                    <li class='btn btn_submit cmMain'>
                        <input type='button' value='<?php 
        echo $oL->get('\xd0\241\320\xbe\xd1\205\321\200\xd0\260\xd0\xbd\xd0\xb8\xd1\202\xd1\x8c');
        ?>
' class='msf_form_submit'>
                    </li>
                </ul>
            </form>

            <script type='text/javascript'>
                /* <![CDATA[ */

                $(document).ready(function () {
                    $('#rating_buttons').delegate('.msf_form_submit', 'click', function () {
                        if (confirm('  ?')) {
                            var $oForm = $('#rating_form');
                            var sFormUrl = $oForm.attr('action');
                            var aFormData = $oForm.serializeArray();

                            var oExtraData = { name: 'msf_id', value: $('input[name='msf_id']').val() };
                            var sExtraData = $.param(oExtraData);

                            var aPostData = aFormData;
                            aPostData.push(oExtraData);
                            var sPostData = $.param(aPostData);

                            $.post(sFormUrl, sPostData, function (data) {
                                MSF_StatusBar.showStatus(data);
                            }, 'json');
                        }
                    });
                });

                /* ]]> */
            </script>

            <?php 
        
        goto Label_36719;
        Label_36721:
        
        goto Label_36719;
        Label_36722:
        ?>

            <style type='text/css'>
                /* <![CDATA[ */

                .bold {
                    font-weight: bold;
                }

                .center {
                    text-align: center;
                }

                .font-red {
                    color: red;
                }

                #rating_table {
                    border: 1px solid #dddddd;
                    border-collapse: collapse;
                    table-layout: fixed;
                }

                #rating_table .field_title {
                    background-color: #003b6a;
                    color: #ffffff;
                }

                #rating_table .field_title_description {
                    vertical-align: top;
                }

                #rating_table .field_title_description,
                #rating_table .employee {
                    background-color: #edf3ff;
                }

                #rating_table .separator_container {
                    background-color: #ffffff;
                    border: 1px solid white;
                }

                /* ]]> */
            </style>

            <table class='field_table_view table_key_value' id='rating_table'>
                <tbody>
                <tr class='trow'>
                    <td class='field_title center'><span class='bold'><?php 
        echo $oL->get('\320\x9e\321\206\320\xb5\320\xbd\xd0\xb8\320\262\xd0\xb0\xd0\xb5\320\274\321\213\xd0\271');
        ?>
</span></td>
                    <td class='field_title center'><span class='bold'><?php 
        echo $oL->get('\xd0\237\321\200\xd0\276\xd1\204\xd0\xb5\xd1\201\xd1\201\xd0\270\xd0\276\320\xbd\xd0\xb0\320\xbb\320\270\320\xb7\320\274');
        ?>
</span></td>
                    <td class='field_title center'><span class='bold'><?php 
        echo $oL->get('\320\x9e\320\xbf\320\xb5\321\x80\320\260\xd1\202\xd0\270\320\xb2\xd0\xbd\320\276\321\x81\xd1\202\321\x8c');
        ?>
</span></td>
                    <td class='field_title center'><span class='bold'><?php 
        echo $oL->get('\320\x9a\320\276\xd0\274\320\xbc\321\x83\320\xbd\320\xb8\320\xba\xd0\260\xd0\261\320\xb5\320\273\321\214\xd0\275\320\xbe\321\x81\xd1\x82\xd1\x8c');
        ?>
</span></td>
                    <td class='field_title center'><span class='bold'><?php 
        echo $oL->get('\320\x9e\xd1\x82\320\262\xd0\265\xd1\202\321\x81\xd1\202\xd0\262\320\265\320\xbd\320\275\xd0\xbe\xd1\x81\xd1\202\321\x8c');
        ?>
</span></td>
                    <td class='field_title center'><span class='bold'><?php 
        echo $oL->get('\320\x98\320\xbd\xd0\xb8\321\206\xd0\270\320\260\xd1\x82\320\xb8\320\xb2\xd0\xbd\xd0\xbe\321\201\321\x82\321\214');
        ?>
</span></td>
                    <td class='field_title center'><span class='bold'></span></td>
                </tr>
                <tr class='trow'>
                    <td class='field_title_description'></td>
                    <td class='field_title_description'><p><?php 
        echo $oL->get('\xd0\x9d\xd0\260\40\xd1\x81\320\xba\320\xbe\xd0\273\xd1\214\320\272\320\xbe\x20\xd0\xba\320\260\321\207\320\265\321\201\321\x82\320\xb2\320\xb5\320\xbd\xd0\275\320\276\x20\xd0\270\321\201\xd0\277\xd0\276\xd0\273\320\xbd\xd1\217\xd0\265\321\x82\40\321\201\xd0\262\xd0\276\320\270\x20\xd0\xb7\xd0\260\xd0\xb4\320\260\xd1\x87\xd0\xb8\77');
        ?>
</p></td>
                    <td class='field_title_description'><p><?php 
        echo $oL->get('\xd0\x9d\xd0\260\x20\xd1\201\xd0\272\320\xbe\xd0\xbb\321\214\xd0\xba\320\276\x20\320\xb1\xd1\213\xd1\x81\xd1\x82\xd1\x80\320\xbe\40\xd0\270\xd1\201\xd0\xbf\320\xbe\320\273\320\275\xd1\x8f\320\xb5\xd1\202\x20\xd1\x81\xd0\xb2\320\276\xd0\270\x20\xd0\xb7\xd0\260\320\264\320\xb0\xd1\x87\xd0\270\77');
        ?>
</p></td>
                    <td class='field_title_description'><p><?php 
        echo $oL->get('\320\x9d\xd0\xb0\x20\321\201\320\272\xd0\xbe\320\xbb\xd1\214\320\xba\xd0\xbe\x20\321\x8d\xd1\x84\321\204\xd0\265\xd0\272\xd1\202\xd0\xb8\xd0\xb2\320\xbd\xd0\276\40\xd0\262\xd0\xb7\xd0\260\320\270\320\xbc\xd0\276\320\xb4\xd0\xb5\320\271\321\x81\xd1\202\xd0\xb2\xd1\x83\320\265\xd1\202\40\321\201\40\xd0\xba\320\276\xd0\xbb\xd0\273\320\265\320\xb3\xd0\260\xd0\xbc\xd0\270\40\xd0\xb4\xd0\273\xd1\x8f\x20\xd0\xb8\xd1\201\xd0\277\320\xbe\xd0\273\320\xbd\320\265\320\xbd\xd0\xb8\321\217\40\xd1\x81\xd0\262\xd0\276\xd0\270\321\205\40\xd0\xb7\xd0\260\320\xb4\320\260\321\207');
        ?>
</p></td>
                    <td class='field_title_description'><p><?php 
        echo $oL->get('\320\235\320\xb0\x20\321\201\320\xba\320\xbe\xd0\273\xd1\x8c\xd0\272\320\xbe\40\321\205\xd0\276\321\x80\320\276\xd1\210\xd0\276\40\320\276\xd1\202\xd0\262\xd0\265\321\207\320\260\xd0\265\321\x82\40\xd0\xb7\320\xb0\40\xd1\x81\320\262\320\xbe\320\xb8\x20\320\xb7\xd0\xb0\xd0\xb4\xd0\xb0\xd1\207\xd0\270');
        ?>
</p></td>
                    <td class='field_title_description'><p><?php 
        echo $oL->get('\320\235\320\xb0\x20\321\201\xd0\xba\320\xbe\320\273\321\x8c\xd0\272\xd0\276\40\xd1\201\xd0\xb0\xd0\274\320\276\xd1\x81\321\202\320\276\xd1\x8f\xd1\202\320\265\320\273\xd1\214\xd0\xbd\320\xbe\x20\xd0\xb8\321\x81\xd0\277\xd0\276\320\273\320\xbd\xd1\x8f\xd0\xb5\xd1\x82\40\xd0\267\320\260\xd0\264\320\xb0\xd1\207\xd0\270\x20\320\270\x20\320\xbf\xd1\200\320\xb5\xd0\264\xd0\xbb\320\xb0\320\263\320\260\xd0\xb5\xd1\202\40\xd0\xb2\320\xb0\xd1\200\320\270\xd0\260\xd0\xbd\xd1\202\xd1\213\x20\xd1\200\xd0\xb5\321\x88\320\xb5\320\xbd\320\xb8\320\xb9');
        ?>
</p></td>
                    <td class='field_title_description'></td>
                </tr>
                <?php 
        foreach ($a['\x65\x6d\x70\x6c\x6f\171\x65\x65\163'] as $sK => $aV) {
            ?>
                    <tr class='trow'>
                        <td class='employee'>
                            <span><?php 
            echo $aV['\x6e\141\x6d\145'];
            ?>
</span>
                        </td>
                        <?php 
            if ($aV['\x73\164\x61\x74\165\163'] === '\165\156\x6d\157\x64\x69\x66\151\x65\144') {
                goto Label_36717;
            }
            ?>
                            <td colspan='6'>
                                <p><?php 
            vprintf('\74\163\160\141\x6e\40\x63\x6c\x61\x73\163\x3d\42\x66\x6f\x6e\x74\55\162\145\x64\x22\76\xd0\x91\xd1\x8b\xd0\273\xd0\270\x20\xd0\270\xd0\xb7\320\xbc\320\xb5\320\275\320\xb5\320\275\320\270\xd1\217\40\xd0\262\40\xd1\x81\320\273\320\xb5\320\xb4\xd1\203\xd1\x8e\321\211\xd0\xb8\xd1\x85\40\xd1\201\xd1\202\321\x80\xd0\xbe\xd0\272\xd0\260\xd1\205\72\x3c\57\x73\x70\x61\156\x3e\40\45\163', array(implode('\54\x20', $aV['\x69\144\x73'])));
            ?>
</p>
                            </td>
                        <?php 
            goto Label_36718;
            Label_36717:
            ?>
                            <td class='center'>
							<span><!--
							<?php 
            if ($aV['\162\x61\x74\151\156\x67\163']['\160\162\157\x66\145\x73\163\151\157\156\141\x6c\151\x73\x6d'] >= 1.0 && $aV['\162\x61\x74\x69\x6e\147\x73']['\160\162\x6f\x66\x65\x73\163\x69\x6f\x6e\141\154\151\163\155'] <= 1.3) {
                goto Label_36682;
            }
            if ($aV['\162\x61\164\x69\x6e\x67\x73']['\160\x72\x6f\146\145\163\163\x69\x6f\156\x61\x6c\151\163\155'] > 1.3 && $aV['\162\x61\x74\151\x6e\x67\x73']['\160\x72\x6f\146\x65\163\x73\151\x6f\x6e\x61\154\151\163\155'] <= 2.7) {
                goto Label_36683;
            }
            if ($aV['\x72\x61\x74\151\156\147\x73']['\160\162\157\x66\145\163\x73\151\157\x6e\141\154\x69\x73\x6d'] > 2.7 && $aV['\162\141\x74\x69\x6e\x67\163']['\160\162\x6f\146\x65\163\163\x69\157\x6e\x61\154\x69\x73\x6d'] <= 3.3) {
                goto Label_36684;
            }
            if ($aV['\x72\141\x74\151\x6e\147\163']['\160\x72\x6f\x66\x65\163\163\x69\x6f\156\141\x6c\x69\x73\155'] > 3.3 && $aV['\x72\141\164\x69\156\147\x73']['\160\x72\157\x66\x65\163\x73\x69\x6f\156\x61\x6c\x69\x73\x6d'] <= 4.0) {
                goto Label_36685;
            }
            if ($aV['\x72\x61\164\151\156\x67\163']['\x70\x72\x6f\146\x65\163\x73\x69\x6f\x6e\x61\154\151\163\155'] > 4.0 && $aV['\x72\141\164\x69\x6e\x67\163']['\160\x72\157\x66\145\x73\x73\151\157\x6e\141\154\151\x73\155'] <= 6.0) {
                goto Label_36686;
            }
            goto Label_36681;
            Label_36682:
            ?>
								--><?php 
            echo $oL->get('\xd0\276\321\202\xd0\xbb\x2e');
            ?>
<!--
							<?php 
            goto Label_36681;
            Label_36683:
            ?>
								--><?php 
            echo $oL->get('\321\205\xd0\xbe\xd1\x80\56');
            ?>
<!--
							<?php 
            goto Label_36681;
            Label_36684:
            ?>
								--><?php 
            echo $oL->get('\xd0\264\320\276\321\201\xd1\x82\x2e');
            ?>
<!--
							<?php 
            goto Label_36681;
            Label_36685:
            ?>
								--><?php 
            echo $oL->get('\321\x83\xd0\xb4\320\xbe\320\262\320\xbb\x2e');
            ?>
<!--
							<?php 
            goto Label_36681;
            Label_36686:
            ?>
								--><?php 
            echo $oL->get('\320\275\xd0\265\xd1\203\xd0\xb4\56');
            ?>
<!--
							<?php 
            Label_36681:
            ?>
							--> (<?php 
            echo $aV['\162\x61\x74\x69\x6e\147\x73']['\160\162\157\146\145\x73\x73\x69\x6f\x6e\141\154\x69\163\155'];
            ?>
)</span>
                            </td>
                            <td class='center'>
							<span><!--
							<?php 
            if ($aV['\162\x61\164\151\x6e\x67\163']['\157\x70\x65\x72\x61\x74\151\x76\x65\156\145\163\x73'] >= 1.0 && $aV['\162\141\164\151\156\147\163']['\x6f\x70\145\x72\141\164\151\166\x65\156\145\163\x73'] <= 1.3) {
                goto Label_36688;
            }
            if ($aV['\162\x61\164\x69\x6e\x67\163']['\157\x70\145\x72\141\164\x69\x76\x65\x6e\x65\x73\x73'] > 1.3 && $aV['\162\x61\x74\x69\x6e\147\163']['\x6f\160\x65\162\141\x74\x69\166\x65\156\x65\163\x73'] <= 2.7) {
                goto Label_36689;
            }
            if ($aV['\x72\x61\164\151\156\147\x73']['\157\160\x65\162\x61\164\x69\166\x65\156\145\163\x73'] > 2.7 && $aV['\162\x61\164\151\156\147\x73']['\157\160\x65\x72\141\x74\151\x76\145\156\145\163\x73'] <= 3.3) {
                goto Label_36690;
            }
            if ($aV['\x72\x61\164\x69\x6e\147\x73']['\157\x70\145\162\141\x74\x69\x76\145\156\145\x73\163'] > 3.3 && $aV['\162\x61\164\x69\x6e\x67\x73']['\157\x70\145\162\141\164\x69\x76\145\156\x65\163\x73'] <= 4.0) {
                goto Label_36691;
            }
            if ($aV['\x72\141\x74\151\156\147\x73']['\x6f\x70\145\x72\x61\x74\151\x76\x65\x6e\145\x73\163'] > 4.0 && $aV['\162\141\x74\151\156\147\x73']['\157\x70\145\x72\141\x74\x69\x76\x65\156\x65\163\x73'] <= 6.0) {
                goto Label_36692;
            }
            goto Label_36687;
            Label_36688:
            ?>
								--><?php 
            echo $oL->get('\320\xbe\xd1\x82\xd0\xbb\x2e');
            ?>
<!--
							<?php 
            goto Label_36687;
            Label_36689:
            ?>
								--><?php 
            echo $oL->get('\xd1\x85\xd0\xbe\xd1\200\56');
            ?>
<!--
							<?php 
            goto Label_36687;
            Label_36690:
            ?>
								--><?php 
            echo $oL->get('\320\264\xd0\276\321\x81\xd1\202\x2e');
            ?>
<!--
							<?php 
            goto Label_36687;
            Label_36691:
            ?>
								--><?php 
            echo $oL->get('\xd1\x83\320\264\320\xbe\xd0\262\xd0\273\x2e');
            ?>
<!--
							<?php 
            goto Label_36687;
            Label_36692:
            ?>
								--><?php 
            echo $oL->get('\320\275\xd0\xb5\321\x83\320\264\x2e');
            ?>
<!--
							<?php 
            Label_36687:
            ?>
							--> (<?php 
            echo $aV['\162\141\x74\151\x6e\147\163']['\x6f\x70\145\162\141\164\x69\x76\145\x6e\145\163\163'];
            ?>
)</span>
                            </td>
                            <td class='center'>
							<span><!--
							<?php 
            if ($aV['\162\141\164\x69\156\147\x73']['\143\x6f\x6d\x6d\165\x6e\151\143\141\142\x69\x6c\x69\x74\171'] >= 1.0 && $aV['\x72\x61\x74\x69\156\x67\163']['\143\157\155\155\165\x6e\151\x63\x61\142\x69\x6c\x69\164\x79'] <= 1.3) {
                goto Label_36694;
            }
            if ($aV['\x72\141\164\x69\x6e\147\163']['\143\157\x6d\x6d\x75\156\x69\x63\x61\x62\x69\x6c\151\164\x79'] > 1.3 && $aV['\x72\x61\x74\x69\x6e\147\163']['\143\x6f\x6d\155\165\156\x69\x63\x61\142\x69\x6c\x69\x74\171'] <= 2.7) {
                goto Label_36695;
            }
            if ($aV['\x72\141\x74\x69\156\x67\163']['\143\157\x6d\155\165\x6e\151\x63\x61\x62\151\x6c\x69\x74\171'] > 2.7 && $aV['\162\x61\x74\151\x6e\x67\x73']['\143\x6f\x6d\155\165\x6e\151\x63\141\x62\151\x6c\151\164\171'] <= 3.3) {
                goto Label_36696;
            }
            if ($aV['\x72\x61\164\151\156\x67\x73']['\x63\157\155\155\x75\x6e\151\143\x61\x62\x69\x6c\151\164\171'] > 3.3 && $aV['\x72\x61\164\151\x6e\147\163']['\143\157\x6d\x6d\165\x6e\151\x63\141\142\151\x6c\151\164\x79'] <= 4.0) {
                goto Label_36697;
            }
            if ($aV['\x72\141\164\151\x6e\x67\x73']['\x63\x6f\x6d\155\x75\x6e\x69\x63\x61\142\x69\x6c\151\164\171'] > 4.0 && $aV['\x72\x61\x74\151\x6e\147\163']['\143\157\x6d\x6d\165\x6e\x69\143\141\x62\151\154\151\164\x79'] <= 6.0) {
                goto Label_36698;
            }
            goto Label_36693;
            Label_36694:
            ?>
								--><?php 
            echo $oL->get('\xd0\xbe\321\202\xd0\xbb\x2e');
            ?>
<!--
							<?php 
            goto Label_36693;
            Label_36695:
            ?>
								--><?php 
            echo $oL->get('\321\x85\320\xbe\321\x80\56');
            ?>
<!--
							<?php 
            goto Label_36693;
            Label_36696:
            ?>
								--><?php 
            echo $oL->get('\xd0\xb4\xd0\xbe\321\201\321\202\56');
            ?>
<!--
							<?php 
            goto Label_36693;
            Label_36697:
            ?>
								--><?php 
            echo $oL->get('\xd1\203\xd0\264\xd0\276\320\262\320\xbb\x2e');
            ?>
<!--
							<?php 
            goto Label_36693;
            Label_36698:
            ?>
								--><?php 
            echo $oL->get('\xd0\xbd\320\265\321\203\320\xb4\x2e');
            ?>
<!--
							<?php 
            Label_36693:
            ?>
							--> (<?php 
            echo $aV['\x72\141\164\151\156\147\163']['\143\x6f\155\155\x75\x6e\151\143\x61\142\151\x6c\x69\x74\x79'];
            ?>
)</span>
                            </td>
                            <td class='center'>
							<span><!--
							<?php 
            if ($aV['\x72\x61\x74\151\x6e\x67\163']['\162\x65\163\x70\157\x6e\163\x69\142\151\x6c\x69\x74\x79'] >= 1.0 && $aV['\162\x61\164\151\156\147\x73']['\x72\x65\163\160\157\156\x73\x69\142\x69\154\151\164\x79'] <= 1.3) {
                goto Label_36700;
            }
            if ($aV['\162\141\164\151\x6e\x67\x73']['\162\x65\163\160\x6f\x6e\163\151\142\x69\154\x69\164\x79'] > 1.3 && $aV['\x72\x61\164\151\x6e\147\x73']['\162\x65\163\160\157\x6e\163\x69\x62\x69\154\151\164\x79'] <= 2.7) {
                goto Label_36701;
            }
            if ($aV['\x72\x61\x74\151\156\147\163']['\162\145\x73\x70\x6f\x6e\163\151\x62\x69\154\x69\x74\171'] > 2.7 && $aV['\x72\x61\164\151\156\147\163']['\162\x65\x73\x70\x6f\156\x73\151\x62\x69\x6c\x69\164\171'] <= 3.3) {
                goto Label_36702;
            }
            if ($aV['\162\141\164\151\156\x67\x73']['\x72\x65\x73\x70\x6f\x6e\163\x69\142\151\x6c\x69\x74\x79'] > 3.3 && $aV['\x72\141\164\x69\156\x67\163']['\x72\145\x73\x70\157\x6e\163\151\142\151\x6c\151\x74\x79'] <= 4.0) {
                goto Label_36703;
            }
            if ($aV['\x72\141\164\151\x6e\147\163']['\162\x65\x73\x70\157\x6e\163\151\142\x69\154\x69\164\x79'] > 4.0 && $aV['\x72\141\x74\x69\x6e\147\x73']['\x72\145\x73\x70\157\156\163\151\x62\151\154\x69\164\171'] <= 6.0) {
                goto Label_36704;
            }
            goto Label_36699;
            Label_36700:
            ?>
								--><?php 
            echo $oL->get('\xd0\276\321\202\320\xbb\56');
            ?>
<!--
							<?php 
            goto Label_36699;
            Label_36701:
            ?>
								--><?php 
            echo $oL->get('\xd1\205\320\xbe\321\200\x2e');
            ?>
<!--
							<?php 
            goto Label_36699;
            Label_36702:
            ?>
								--><?php 
            echo $oL->get('\xd0\xb4\xd0\xbe\321\201\xd1\x82\56');
            ?>
<!--
							<?php 
            goto Label_36699;
            Label_36703:
            ?>
								--><?php 
            echo $oL->get('\xd1\203\xd0\xb4\320\xbe\xd0\xb2\320\273\56');
            ?>
<!--
							<?php 
            goto Label_36699;
            Label_36704:
            ?>
								--><?php 
            echo $oL->get('\xd0\xbd\xd0\265\xd1\203\xd0\xb4\56');
            ?>
<!--
							<?php 
            Label_36699:
            ?>
							--> (<?php 
            echo $aV['\x72\x61\164\x69\156\x67\163']['\x72\145\x73\x70\x6f\x6e\163\151\x62\151\x6c\x69\x74\171'];
            ?>
)</span>
                            </td>
                            <td class='center'>
							<span><!--
							<?php 
            if ($aV['\x72\x61\164\x69\156\147\163']['\x69\x6e\151\164\151\x61\x74\151\166\145'] >= 1.0 && $aV['\162\141\x74\x69\x6e\147\163']['\x69\156\x69\164\x69\141\x74\151\x76\145'] <= 1.3) {
                goto Label_36706;
            }
            if ($aV['\162\141\x74\x69\156\x67\163']['\x69\156\151\x74\x69\141\164\151\166\145'] > 1.3 && $aV['\162\141\164\151\156\147\163']['\x69\156\151\x74\151\x61\164\151\166\145'] <= 2.7) {
                goto Label_36707;
            }
            if ($aV['\x72\141\164\151\156\x67\x73']['\x69\156\151\x74\151\141\x74\151\166\145'] > 2.7 && $aV['\162\x61\x74\151\156\147\163']['\x69\x6e\x69\164\151\141\x74\151\x76\145'] <= 3.3) {
                goto Label_36708;
            }
            if ($aV['\x72\141\x74\x69\x6e\147\163']['\151\156\151\164\x69\141\x74\x69\x76\x65'] > 3.3 && $aV['\162\141\x74\x69\156\147\x73']['\x69\156\x69\x74\151\141\164\x69\x76\x65'] <= 4.0) {
                goto Label_36709;
            }
            if ($aV['\162\141\164\x69\156\147\163']['\151\x6e\x69\164\151\141\x74\x69\x76\x65'] > 4.0 && $aV['\162\141\164\151\156\x67\x73']['\x69\156\x69\x74\151\x61\x74\151\166\145'] <= 6.0) {
                goto Label_36710;
            }
            goto Label_36705;
            Label_36706:
            ?>
								--><?php 
            echo $oL->get('\320\xbe\xd1\x82\320\273\x2e');
            ?>
<!--
							<?php 
            goto Label_36705;
            Label_36707:
            ?>
								--><?php 
            echo $oL->get('\xd1\205\xd0\276\xd1\200\56');
            ?>
<!--
							<?php 
            goto Label_36705;
            Label_36708:
            ?>
								--><?php 
            echo $oL->get('\xd0\264\xd0\276\321\201\xd1\202\x2e');
            ?>
<!--
							<?php 
            goto Label_36705;
            Label_36709:
            ?>
								--><?php 
            echo $oL->get('\xd1\x83\xd0\264\320\276\320\262\320\xbb\56');
            ?>
<!--
							<?php 
            goto Label_36705;
            Label_36710:
            ?>
								--><?php 
            echo $oL->get('\xd0\275\320\xb5\xd1\x83\320\xb4\56');
            ?>
<!--
							<?php 
            Label_36705:
            ?>
							--> (<?php 
            echo $aV['\162\x61\x74\151\x6e\147\163']['\151\156\151\x74\x69\x61\164\151\x76\145'];
            ?>
)</span>
                            </td>
                            <td class='center'>
							<span><!--
							<?php 
            if ($aV['\162\141\164\x69\156\147\163']['\x74\157\x74\141\x6c'] >= 1.0 && $aV['\162\x61\x74\x69\156\x67\x73']['\x74\x6f\x74\x61\154'] <= 1.3) {
                goto Label_36712;
            }
            if ($aV['\162\x61\164\151\x6e\147\163']['\x74\x6f\164\141\154'] > 1.3 && $aV['\x72\141\x74\x69\156\x67\163']['\164\157\x74\141\154'] <= 2.7) {
                goto Label_36713;
            }
            if ($aV['\162\x61\x74\x69\x6e\147\163']['\x74\157\x74\x61\x6c'] > 2.7 && $aV['\162\x61\164\151\x6e\x67\163']['\164\x6f\x74\x61\x6c'] <= 3.3) {
                goto Label_36714;
            }
            if ($aV['\162\141\x74\x69\x6e\x67\163']['\164\x6f\x74\x61\x6c'] > 3.3 && $aV['\162\141\164\151\x6e\147\163']['\164\x6f\164\x61\x6c'] <= 4.0) {
                goto Label_36715;
            }
            if ($aV['\x72\141\x74\151\156\147\x73']['\164\x6f\x74\x61\x6c'] > 4.0 && $aV['\162\x61\164\x69\x6e\x67\x73']['\x74\x6f\x74\x61\154'] <= 6.0) {
                goto Label_36716;
            }
            goto Label_36711;
            Label_36712:
            ?>
								--><?php 
            echo $oL->get('\320\276\321\202\xd0\273\56');
            ?>
<!--
							<?php 
            goto Label_36711;
            Label_36713:
            ?>
								--><?php 
            echo $oL->get('\321\205\320\276\xd1\x80\56');
            ?>
<!--
							<?php 
            goto Label_36711;
            Label_36714:
            ?>
								--><?php 
            echo $oL->get('\320\264\320\276\321\201\xd1\x82\x2e');
            ?>
<!--
							<?php 
            goto Label_36711;
            Label_36715:
            ?>
								--><?php 
            echo $oL->get('\xd1\203\320\264\xd0\276\xd0\xb2\xd0\xbb\x2e');
            ?>
<!--
							<?php 
            goto Label_36711;
            Label_36716:
            ?>
								--><?php 
            echo $oL->get('\320\275\320\265\xd1\x83\xd0\264\x2e');
            ?>
<!--
							<?php 
            Label_36711:
            ?>
							--> (<?php 
            echo $aV['\162\141\x74\151\156\147\x73']['\x74\157\x74\x61\x6c'];
            ?>
)</span>
                            </td>
                            <?php 
            
            ?>
                        <?php 
            Label_36718:
            ?>
                    </tr>
                <?php 
        }
        ?>
                <?php 
        
        ?>
                </tbody>
            </table>

            <?php 
        
        ?>

            <?php 
        Label_36719:
        $s = ob_get_clean();
        return $s;
    }
    public static function aktenplanvar($a)
    {
        ob_start();
        ?>
        <?php 
        $oL = \app\system\Registry::get('\154\x6f\x63\x61\x6c\x65');
        $aAktenplans = a($a, '\141\153\x74\145\156\160\x6c\x61\156\163', array());
        if (!count($aAktenplans)) {
            goto Label_36723;
        }
        ?>
            <div class='aktenplanBox'>
                <table class='aktenplanTable' width='100%' cellpadding='0' cellspacing='0'>
                    <tr class='first'>
                        <td></td>
                        <td><?php 
        echo $oL->get('\320\x97\xd0\xb0\xd0\263\xd0\276\xd0\273\320\xbe\320\262\320\276\xd0\272');
        ?>
</td>
                        <td></td>
                    </tr>
                    <?php 
        foreach ($aAktenplans as $sK => $aV) {
            ?>
                        <tr class='list' onclick='window.location='/reference/document/view/<?php 
            echo $aV['\144\x6f\x63\164\x79\160\x65\137\151\144'];
            ?>
/<?php 
            echo $aV['\x64\x6f\x63\x75\155\145\156\x74\x5f\151\x64'];
            ?>
''>
                            <td><?php 
            echo $aV['\x69\156\x64\145\x78'];
            ?>
</td>
                            <td><?php 
            echo $aV['\x74\151\164\154\145'];
            ?>
</td>
                            <td><?php 
            echo $aV['\163\x75\x62\x64\151\166\x69\163\x69\157\156'];
            ?>
</td>
                        </tr>
                    <?php 
        }
        ?>
                    <tr>
                        <td colspan='3'><?php 
        echo nl2br(v($a['\x74\x65\x78\x74']));
        ?>
</td>
                    </tr>
                </table>
            </div>
            <style type='text/css'>
                .aktenplanTable {
                    border-top: 1px solid #d3d3d3;
                    border-left: 1px solid #d3d3d3;
                }
                .aktenplanTable td{
                    border-bottom: 1px solid #d3d3d3;
                    border-right: 1px solid #d3d3d3;
                    padding: 3px;
                }
                .aktenplanTable tr.list{
                    cursor: pointer;
                }
                .aktenplanTable tr.first{
                    background-color: #eeeeee;
                    font-weight: bold;
                }

            </style>
        <?php 
        Label_36723:
        ?>
        <?php 
        $s = ob_get_clean();
        return $s;
    }
    public static function decisionvar($a, $sDoctypeId, $sDocumentId)
    {
        ob_start();
        ?>

        <?php 
        $sTasks = '';
        $oL = \app\system\Registry::get('\154\157\x63\141\x6c\x65');
        $sL = \app\user\Account::getaccount()->getlocale();
        $aLcl = array();
        if (!($sL !== '\x72\x75' && array_key_exists($sL, \app\system\Registry::get('\x63\157\x6e\x66\x69\147')->get('\x61\x70\x70\137\x6c\x6f\143\141\154\145\163')))) {
            goto Label_36724;
        }
        $aL = \app\system\Registry::get('\154\157\143\x61\154\x65\137\x69\x6e\x66\x6f');
        $aLcl = $aL['\x70\x73\x74'];
        Label_36724:
        foreach ($a as $sK => $aV) {
            $sFieldId = sprintf('\45\x30\70\170\x25\x78\45\x30\70\170', mt_rand(), time(), mt_rand());
            $sLastAction = '';
            $sLastDT = '';
            $sLastAuthor = '';
            ?>
            <div id='field_decision_<?php 
            echo $sFieldId;
            ?>
' class='field_big_wrap blue field_decision_wrap expanded'>
                <h3 class='clearfix'><?php 
            echo $oL->get($aV['\x74\151\x74\154\145']);
            ?>
</h3>
                <div class='inner_wrap'>
                    <ul class='field_decision' id='decisionContent_<?php 
            echo $sK;
            ?>
'>
                        <?php 
            foreach ($aV['\x64\145\143\151\x73\151\157\156\163'] as $sK2 => $aV2) {
                ?>
                            <li class='item'>
                                <p class='meta'>
                                    <strong class='author'><?php 
                echo !empty($aLcl) && !empty(a($aLcl, $aV2['\141\x75\164\150\157\162\137\151\x64'], array())) ? strtr($aV2['\141\165\x74\150\157\162'], a($aLcl, $aV2['\x61\x75\164\x68\x6f\x72\137\x69\x64'], array())) : $aV2['\141\x75\164\x68\x6f\x72'];
                ?>
</strong> <span class='dt'><?php 
                echo \app\system\Util::unserializetimestamp($aV2['\x74\x73\164\x61\155\160']);
                ?>
</span>
                                </p>
                                <?php 
                if (!isset($aV2['\x73\151\147\156\137\x73\164\141\x74\x75\163'])) {
                    goto Label_36727;
                }
                ?>
                                    <p id='sign_status_<?php 
                echo $aV2['\x74\x61\163\153\137\x6e\141\x6d\145'];
                ?>
_<?php 
                echo $aV2['\x74\x61\163\x6b\x5f\160\x6f\163'];
                ?>
' class='sign_status_label'>
                                        <?php 
                if (isset($aV2['\163\151\x67\x6e\x5f\163\x74\x61\x74\x75\163\137\x65\144\163'])) {
                    goto Label_36725;
                }
                ?>
                                            <?php 
                echo $aV2['\x73\x69\x67\x6e\137\163\x74\x61\x74\x75\x73'];
                ?>
                                        <?php 
                goto Label_36726;
                Label_36725:
                $sTasks .= $sTasks == '' ? $aV2['\x74\141\163\153\137\156\x61\x6d\x65'] : '\54' . $aV2['\x74\141\163\x6b\137\156\x61\155\145'];
                ?>
                                            <img style='margin-bottom:-4px;' src='/tpl/web/img/loading.gif' /> <span><?php 
                echo $oL->get('\320\237\321\200\320\276\xd0\xb2\320\265\xd1\200\xd0\272\xd0\260\x20\xd0\xad\320\246\xd0\x9f');
                ?>
</span>
                                        <?php 
                Label_36726:
                ?>
                                    </p>
                                <?php 
                Label_36727:
                ?>

                                <p class='abstract_content clearfix<?php 
                echo strlen($aV2['\164\145\170\x74']) ? '\40\167\151\164\x68\x5f\x61\143\x74\x69\x6f\x6e' : '';
                ?>
'>
                                    <?php 
                if (!strlen($aV2['\164\x65\x78\x74'])) {
                    goto Label_36728;
                }
                ?>
                                        <span class='action'><?php 
                echo v($aV2['\x74\x65\x78\164']);
                ?>
</span>
                                        <?php 
                $sLastAction = v($aV2['\x74\x65\x78\164']);
                ?>
                                    <?php 
                Label_36728:
                ?>
                                    <span class='comment'>
										<?php 
                echo \app\system\Util::replaceurls(nl2br(v($aV2['\143\x6f\155\x6d\145\156\164'])));
                ?>
                                        <?php 
                if (!mb_strlen($aV2['\143\157\155\x6d\x65\x6e\x74'])) {
                    goto Label_36729;
                }
                ?>
                                            <br />
                                        <?php 
                Label_36729:
                ?>
                                        <?php 
                $needComma = false;
                foreach ($aV2['\x63\x75\163\164\x6f\155\137\146\x69\x65\154\x64\163'] as $aCf) {
                    if (!(is_array($aCf['\x76\141\x6c\165\145']) && count($aCf['\x76\141\x6c\165\145']) || !is_array($aCf['\166\141\154\165\x65']) && strlen($aCf['\x76\x61\154\165\x65']))) {
                        goto Label_36732;
                    }
                    if (!$needComma) {
                        goto Label_36730;
                    }
                    echo '\x2c\40';
                    goto Label_36731;
                    Label_36730:
                    $needComma = true;
                    Label_36731:
                    ?>
                                                <span class='custom_field'>
                                                    <?php 
                    echo v($oL->get($aCf['\x74\x69\164\154\x65']));
                    ?>
: <?php 
                    echo \app\reference\REF::viewfactory('', $aCf['\166\141\x6c\x75\145'], array_merge(array('\x64\x6f\143\x75\x6d\x65\x6e\x74\137\x69\x64' => $sDocumentId), $aCf));
                    ?>
                                                </span>
                                            <?php 
                    Label_36732:
                    ?>
                                        <?php 
                }
                ?>
                                        <?php 
                if (!count($aV2['\146\151\154\145\x73'])) {
                    goto Label_36733;
                }
                ?>
                                            <span class='attached_files'>
											<?php 
                echo \app\reference\REF::fileview('', $aV2['\x66\151\154\x65\163'], array('\162\157\167\137\x73\x65\160\141\x72\x61\x74\157\x72' => '\x20'));
                ?>
										</span>
                                        <?php 
                Label_36733:
                ?>
									</span>
                                </p>
                            </li>
                            <?php 
                $sLastDT = \app\system\Util::unserializetimestamp($aV2['\164\x73\164\141\x6d\160']);
                $sLastAuthor = $aV2['\x61\165\x74\150\x6f\x72'];
                ?>
                        <?php 
            }
            ?>
                    </ul>

                </div>
            </div>
            <script type='text/javascript'>
                MSF_App.bind_starter(function(oParams)
                {
                    if (!window.FIELDS_BANK['field_decision_<?php 
            echo $sFieldId;
            ?>
'])
                    {
                        window.FIELDS_BANK['field_decision_<?php 
            echo $sFieldId;
            ?>
'] = new MSF_Decision('<?php 
            echo $sFieldId;
            ?>
', {
                            last_action:'',
                            last_dt:''
                        });
                    }
                }, 'field_decision_<?php 
            echo $sFieldId;
            ?>
', true, 'field_decision');
            </script>
        <?php 
        }
        ?>

        <script type='text/javascript'>

            <?php 
        if ($sTasks != '') {
            goto Label_36734;
        }
        ?>
            setTimeout(function() {
                ButtonChecker.setStatus(true);
            },500);
            <?php 
        goto Label_36735;
        Label_36734:
        ?>
            $.get('/workflow/document/verify-eds', {
                isSession: false,
                doctype: '<?php 
        echo $sDoctypeId;
        ?>
',
                document: '<?php 
        echo $sDocumentId;
        ?>
',
                tasks: '<?php 
        echo $sTasks;
        ?>
',
                sL: '<?php 
        echo $sL;
        ?>
',
                app_company: '<?php 
        echo \app\system\Registry::get('\143\x6f\156\x66\151\x67')->get('\141\160\x70\137\x63\x6f\155\160\141\156\171');
        ?>
'
            }, function (data) {
                if (data.status == 1) {
                    var isValid = true;
                    for(var task in data.verify)
                    {
                        $('#sign_status_' + task).html(data.verify[task].html);
                        if(!data.verify[task].status){
                            isValid = false;
                        }

                    }
                    ButtonChecker.setStatus(isValid);
                }else
                {

                }
            }, 'json');
            <?php 
        Label_36735:
        ?>
        </script>
        <?php 
        $s = ob_get_clean();
        return $s;
    }
    public static function decisionvarmediumhtml($a, $sDoctypeId, $sDocumentId)
    {
        ob_start();
        ?>

        <?php 
        $sTasks = '';
        $oL = \app\system\Registry::get('\x6c\x6f\x63\x61\154\x65');
        $sL = \app\user\Account::getaccount()->getlocale();
        $aLcl = array();
        if (!($sL !== '\x72\165' && array_key_exists($sL, \app\system\Registry::get('\x63\x6f\x6e\x66\151\x67')->get('\141\160\160\x5f\x6c\157\x63\x61\x6c\x65\163')))) {
            goto Label_36736;
        }
        $aL = \app\system\Registry::get('\154\157\143\x61\154\x65\x5f\151\156\x66\x6f');
        $aLcl = $aL['\160\163\x74'];
        Label_36736:
        foreach ($a as $sK => $aV) {
            ?>
            <ul class='field_decision' id='decisionContent_<?php 
            echo $sK;
            ?>
' style='margin-bottom: 0px; float: right;'>
                <?php 
            foreach ($aV['\x64\145\143\151\163\x69\157\156\163'] as $sK2 => $aV2) {
                ?>
                    <li class='item'>
                        <?php 
                if (!isset($aV2['\163\151\147\x6e\x5f\x73\164\141\x74\165\163'])) {
                    goto Label_36741;
                }
                ?>
                            <div id='sign_status_<?php 
                echo $aV2['\x74\x61\163\x6b\x5f\156\141\x6d\145'];
                ?>
_<?php 
                echo $aV2['\x74\x61\x73\153\x5f\x70\x6f\163'];
                ?>
' class='sign_status_label' style='display:flex; background: #e8e8e8; padding: 8px 20px; width: max-content; border-radius: 13px'>
                                <?php 
                if (isset($aV2['\x73\x69\147\x6e\137\163\x74\141\164\165\163\x5f\145\x64\x73'])) {
                    goto Label_36739;
                }
                ?>
                                    <?php 
                echo $aV2['\x73\151\x67\156\137\163\164\141\164\165\x73'];
                ?>
                                <?php 
                goto Label_36740;
                Label_36739:
                $sTasks .= $sTasks == '' ? $aV2['\164\141\x73\153\137\x6e\x61\x6d\x65'] : '\x2c' . $aV2['\x74\141\x73\153\137\156\141\155\x65'];
                ?>
                                    <?php 
                if ($aV2['\x73\x69\147\x6e\x5f\163\164\x61\x74\165\163\x5f\x65\x64\163']) {
                    goto Label_36737;
                }
                ?>
                                        <span class='negative icon_key'></span>
                                    <?php 
                goto Label_36738;
                Label_36737:
                ?>
                                        <span class='positive icon_key'></span>
                                    <?php 
                Label_36738:
                ?>
                                <?php 
                Label_36740:
                ?>
                                <span class='meta'><strong class='author' style='font-size: 14px; color: #333;'><?php 
                echo !empty($aLcl) && !empty(a($aLcl, $aV2['\x61\x75\x74\x68\x6f\162\137\x69\144'], array())) ? strtr($aV2['\141\165\164\150\x6f\x72'], a($aLcl, $aV2['\x61\165\x74\x68\x6f\x72\137\151\x64'], array())) : $aV2['\141\x75\x74\150\157\x72'];
                ?>
</strong></span>
                            </div>
                        <?php 
                Label_36741:
                ?>
                    </li>
                <?php 
            }
            ?>
            </ul>
        <?php 
        }
        ?>
        <?php 
        $s = ob_get_clean();
        return $s;
    }
    public static function decisionvarhtml($a, $sDoctypeId, $sDocumentId)
    {
        ob_start();
        ?>
        <?php 
        $sTasks = '';
        $oL = \app\system\Registry::get('\154\x6f\x63\x61\x6c\145');
        foreach ($a as $sK => $aV) {
            $sFieldId = sprintf('\x25\60\x38\170\x25\170\45\60\x38\170', mt_rand(), time(), mt_rand());
            $sLastAction = '';
            $sLastDT = '';
            $sLastAuthor = '';
            ?>
            <table>
                <tr>
                    <td><b><?php 
            echo $aV['\164\151\x74\154\x65'];
            ?>
</b></td>
                </tr>
                <?php 
            foreach ($aV['\x64\x65\x63\151\x73\x69\x6f\156\163'] as $sK2 => $aV2) {
                ?>
                    <tr>
                        <td><?php 
                echo $aV2['\141\165\x74\x68\157\162'];
                ?>
&nbsp;<?php 
                echo \app\system\Util::unserializetimestamp($aV2['\164\163\164\141\155\x70']);
                ?>
</td>
                    </tr>
                    <?php 
                if (!isset($aV2['\163\151\147\x6e\x5f\163\164\141\x74\165\x73'])) {
                    goto Label_36742;
                }
                ?>
                        <tr>
                            <td style='font-size: 8pt;'><i><?php 
                echo $aV2['\163\151\147\x6e\x5f\163\x74\141\x74\165\x73'];
                ?>
</i></td>
                        </tr>
                    <?php 
                Label_36742:
                ?>
                    <?php 
                if (!strlen($aV2['\164\x65\170\x74'])) {
                    goto Label_36743;
                }
                ?>
                        <tr>
                            <td style='font-size: 8pt;'><i><?php 
                echo v($aV2['\164\145\x78\164']);
                ?>
</i></td>
                        </tr>
                        <?php 
                $sLastAction = v($aV2['\164\145\170\164']);
                Label_36743:
                ?>
                    <tr>
                        <td style='font-size: 8pt;'><i>
                                <?php 
                echo \app\system\Util::replaceurls(nl2br(v($aV2['\143\157\155\155\145\x6e\x74'])));
                ?>
                                <?php 
                if (!mb_strlen($aV2['\143\157\155\x6d\x65\156\x74'])) {
                    goto Label_36744;
                }
                ?>
                                    <br />
                                <?php 
                Label_36744:
                ?>

                                <?php 
                $needComma = false;
                foreach ($aV2['\x63\165\163\164\x6f\x6d\137\146\151\145\154\x64\163'] as $aCf) {
                    if (!(is_array($aCf['\166\141\x6c\165\145']) && count($aCf['\166\141\x6c\165\x65']) || !is_array($aCf['\x76\141\x6c\x75\x65']) && strlen($aCf['\x76\141\x6c\x75\x65']))) {
                        goto Label_36747;
                    }
                    if (!$needComma) {
                        goto Label_36745;
                    }
                    echo '\x2c\40';
                    goto Label_36746;
                    Label_36745:
                    $needComma = true;
                    Label_36746:
                    $oCField = \app\reference\field\FieldFactory::create('', $aCf);
                    $oCField->set($aCf['\166\x61\x6c\x75\x65']);
                    ?>
                                        <?php 
                    echo v($aCf['\164\151\x74\x6c\145']);
                    ?>
: <?php 
                    echo $oCField->getgridvalue();
                    ?>
                                    <?php 
                    Label_36747:
                    ?>
                                <?php 
                }
                ?>
                            </i>
                        </td>
                    </tr>
                    <?php 
                if (!count($aV2['\146\151\154\x65\x73'])) {
                    goto Label_36748;
                }
                ?>
                        <tr>
                            <td style='font-size: 8pt;'>
                                <?php 
                foreach ($aV2['\x66\x69\154\x65\x73'] as $sId => $sValue) {
                    ?>
                                    <a id='filepreview_btn_<?php 
                    echo $sId;
                    ?>
' class='textview_attached_file' href='/media/download/<?php 
                    echo $sId;
                    ?>
'><?php 
                    echo $sValue;
                    ?>
</a>
                                <?php 
                }
                ?>
                            </td>
                        </tr>
                    <?php 
                Label_36748:
                ?>
                    <?php 
                $sLastDT = \app\system\Util::unserializetimestamp($aV2['\x74\163\164\141\155\x70']);
                $sLastAuthor = $aV2['\x61\165\164\150\x6f\x72'];
                ?>
                <?php 
            }
            ?>
            </table>
            <br>
        <?php 
        }
        $s = ob_get_clean();
        return $s;
    }
    public static function controlvar($a)
    {
        $oL = \app\system\Registry::get('\154\x6f\x63\141\x6c\145');
        ob_start();
        $sFieldId = sprintf('\x25\60\x38\170\45\170\x25\60\x38\x78', mt_rand(), time(), mt_rand());
        ?>
        <?php 
        foreach ($a as $sK => $aV) {
            ?>
        <div id='field_control_<?php 
            echo $sFieldId;
            ?>
' class='field_big_wrap field_control_wrap collapsed'>
            <h3><?php 
            echo $oL->get('\320\x92\xd0\267\xd1\x8f\xd1\202\xd0\276\40\xd0\275\xd0\260\x20\320\xba\320\xbe\320\xbd\321\x82\321\200\xd0\276\xd0\273\xd1\x8c');
            ?>
</h3>
            <div class='inner_wrap' style='display:none'>
                <ul class='field_control'>
                    <li class='item'>
                        <p>
                            <strong class='label'><?php 
            echo $oL->get('\320\x98\xd1\201\xd0\277\xd0\276\320\xbb\320\275\xd0\xb8\321\x82\320\265\xd0\273\321\214');
            ?>
:</strong> <?php 
            echo implode('\x2c\40', $aV['\x65\x78\145\x63\165\164\157\x72']);
            ?>
<br />
                            <strong class='label'><?php 
            echo $oL->get('\xd0\232\xd0\xbe\xd0\275\xd1\x82\xd1\x80\320\276\320\273\xd1\214\320\275\321\213\320\xb9\40\xd1\201\321\x80\320\276\320\xba');
            ?>
:</strong> <?php 
            echo $aV['\x66\x69\156\x69\163\150\137\x61\x74'];
            ?>
                        </p>
                    </li>
                </ul>
            </div>
        </div>
    <?php 
        }
        ?>
        <script type='text/javascript'>
            MSF_App.bind_starter(function(oParams)
            {
                if (!window.FIELDS_BANK['field_control_<?php 
        echo $sFieldId;
        ?>
'])
                {
                    window.FIELDS_BANK['field_control_<?php 
        echo $sFieldId;
        ?>
'] = new MSF_FieldControl('<?php 
        echo $sFieldId;
        ?>
', oParams);
                }
            }, 'field_control_<?php 
        echo $sFieldId;
        ?>
', true, 'field_control');
        </script>

        <?php 
        $s = ob_get_clean();
        return $s;
    }
    public static function editadminservice($aT, $aD, $aPoints, $aPointNames, $sDocumentMovePointTitle = '')
    {
        $oL = \app\system\Registry::get('\x6c\157\x63\141\154\x65');
        $oC = \app\system\Registry::get('\143\x6f\156\146\151\147');
        $iIN = $aT['\x69\156\144\145\x78\x5f\156\165\155\142\145\162'];
        $iCN = '\x75\x6e\x64\x65\x66\151\x6e\x65\144';
        $iSN = '\165\156\144\x65\146\151\x6e\x65\x64';
        $sFN = '\160\157\x69\x6e\164\x5b\145\170\x65\143\x75\164\x65\135\x5b' . $iIN . '\x5d';
        $sCN = '\160\157\x69\156\164\137\145\x78\145\143\165\x74\145\137' . $iIN;
        $sSuffix = '\x5f' . $iIN;
        $sViewPath = '\141\x70\x70\x2f\167\157\x72\x6b\146\x6c\x6f\167\57\166\x69\x65\x77\57\x74\x68\x65\x6d\145\166\x31\x2f\141\x64\x6d\x69\x6e' . strtoupper(substr($aT['\164\x79\x70\x65'], 0, 1)) . substr($aT['\x74\x79\x70\145'], 1) . '\x53\145\x72\166\151\x63\145\56\x70\150\160';
        ob_start();
        include $sViewPath;
        $s = ob_get_clean();
        return $s;
    }
    public static function editadminconditionservice($aT, $aD, $aPoints, $aPointNames, $sDocumentMovePointTitle = '')
    {
        $oL = \app\system\Registry::get('\x6c\157\x63\x61\x6c\x65');
        $oC = \app\system\Registry::get('\143\157\x6e\146\151\x67');
        $iIN = $aT['\x69\x6e\x64\x65\170\137\x6e\165\x6d\x62\x65\162'];
        $iCN = $aT['\x63\157\156\x74\x61\x69\x6e\x65\162\x5f\156\x75\155\142\145\x72'];
        $iSN = $aT['\163\x65\x72\166\151\143\x65\x5f\x6e\165\155\x62\x65\162'];
        $sFN = '\160\x6f\151\156\x74\x5b\x65\x78\x65\x63\x75\x74\145\135\x5b' . $iIN . '\135\133\143\x6f\x6e\x74\x61\x69\156\x65\162\x73\135\133' . $iCN . '\x5d\x5b\163\x65\162\166\x69\143\x65\163\135\x5b' . $iSN . '\x5d';
        $sCN = '\x70\157\x69\x6e\164\x5f\145\170\145\x63\165\x74\x65\137' . $iIN . '\x5f\x63\157\156\x74\x61\151\x6e\145\162\163\x5f' . $iCN . '\x5f\163\x65\x72\166\x69\143\x65\163\x5f' . $iSN;
        $sSuffix = '\137' . $iIN . '\x5f' . $iCN . '\x5f' . $iSN;
        $sViewPath = '\141\x70\x70\57\x77\x6f\x72\x6b\146\154\157\x77\x2f\x76\151\x65\167\x2f\x74\x68\x65\155\x65\x76\x31\57\141\x64\155\151\156' . strtoupper(substr($aT['\x74\171\160\145'], 0, 1)) . substr($aT['\x74\x79\160\x65'], 1) . '\x53\145\x72\x76\151\x63\145\x2e\x70\150\x70';
        ob_start();
        include $sViewPath;
        $s = ob_get_clean();
        return $s;
    }
    public static function commentvar($a, $sDoctypeId, $sDocumentId, $iDepth = 0, $sTreeId = '', $aParentData = array())
    {
        $oL = \app\system\Registry::get('\x6c\157\x63\141\154\x65');
        ob_start();
        end($a);
        $sEnd = key($a);
        ?>
        <?php 
        if (!(0 == $iDepth)) {
            goto Label_36749;
        }
        $sTreeId = sprintf('\45\60\x38\170\45\170\45\x30\x38\x78', mt_rand(), time(), mt_rand());
        $oDt = \app\workflow\EntityManager::getdoctype($sDoctypeId);
        ?>
        <script type='text/javascript'>
            MSF_App.bind_starter(function(oParams)
            {
                oParams.doctype_id = '<?php 
        echo $sDoctypeId;
        ?>
';
                oParams.document_id = '<?php 
        echo $sDocumentId;
        ?>
';
                oParams.msf_id = 'workflow';
                oParams.process_type = '<?php 
        echo $oDt['\160\x72\157\143\145\163\x73\137\164\x79\x70\x65'];
        ?>
';
                if (!window.FIELDS_BANK['field_comments_tree_<?php 
        echo $sTreeId;
        ?>
'])
                {
                    window.FIELDS_BANK['field_comments_tree_<?php 
        echo $sTreeId;
        ?>
'] = new MSF_DocumentCommentsTree('<?php 
        echo $sTreeId;
        ?>
', oParams);
                }
            }, 'field_comments_tree_<?php 
        echo $sTreeId;
        ?>
', true, 'field_comments_tree');
        </script>
    <?php 
        Label_36749:
        ?>

        <?php 
        if (count($a)) {
            goto Label_36760;
        }
        ?>
        <ul class='field_comments_tree root empty' id='field_comments_tree_<?php 
        echo $sTreeId;
        ?>
'>
            <li>
                <ul class='comment_wrap'>
                    <li class='meta'><?php 
        echo $oL->get('\320\x9d\320\265\321\202\40\320\xba\320\276\xd0\xbc\320\xbc\xd0\265\xd0\xbd\321\202\320\xb0\321\200\xd0\xb8\xd0\xb5\xd0\xb2');
        ?>
</li>
                </ul>
                <ul class='field_comments_tree'></ul>
            </li>
        </ul>
    <?php 
        goto Label_36761;
        Label_36760:
        ?>
        <ul class='field_comments_tree<?php 
        echo $iDepth == 0 ? '\40\162\x6f\x6f\164' : '';
        ?>
' <?php 
        echo $iDepth == 0 ? '\x69\x64\75\x22\x66\151\145\x6c\x64\137\143\157\x6d\x6d\x65\x6e\x74\163\x5f\x74\162\x65\145\x5f' . $sTreeId . '\42' : '';
        ?>
>
            <?php 
        $sLastId = '';
        if (!(count($a) > 0)) {
            goto Label_36750;
        }
        end($a);
        $sLastId = key($a);
        Label_36750:
        foreach ($a as $sKKK => $aV) {
            $bHaveChilds = count($aV['\143\150\x69\154\x64\x73']);
            $sCommentId = sprintf('\45\60\70\170\45\x78\45\60\x38\x78', mt_rand(), time(), mt_rand()) . '\137' . $iDepth;
            $aV['\x63\x6f\155\x6d\145\156\x74\x5f\151\x64'] = $sCommentId;
            $aV['\162\x6f\167\x5f\x73\x65\x70\x65\x72\x61\164\157\x72'] = '\x20';
            $aV['\155\157\x64\x75\x6c\145'] = '\x63\157\155\x6d\x65\x6e\x74';
            $aV['\160\141\x72\x65\156\164\x5f\x6e\x61\x6d\x65'] = $aV['\151\144'];
            ?>
                <li id='field_comments_tree_comment_<?php 
            echo $sCommentId;
            ?>
' data-id='<?php 
            echo $aV['\x69\x64'];
            ?>
' class='<?php 
            echo $aV['\151\144'] != $sEnd ? '\x68\x61\x76\x65\137\x6e\x65\x78\164\137\163\x69\142\x6c\x69\156\x67\x20' : '';
            echo !$bHaveChilds ? '\x6e\157\x5f\x63\x68\x69\154\144\163' : '';
            ?>
'  >
                    <ul class='comment_wrap'>
                        <li class='meta'>
                            <strong class='author'><?php 
            echo $aV['\x65\x6d\x70\154\157\x79\x65\x65'];
            ?>
 (<?php 
            echo current($aV['\160\157\x73\x74']);
            ?>
)</strong>
                            <?php 
            if (!count($aParentData)) {
                goto Label_36751;
            }
            ?>
                                <span href='#' class='reply_to_btn'>
									<?php 
            echo $oL->get('\xd0\236\xd1\202\xd0\xb2\320\265\xd1\202\x20\320\xbd\320\xb0\x20\320\272\xd0\276\xd0\xbc\320\274\xd0\265\xd0\xbd\xd1\202\xd0\260\xd1\x80\xd0\270\320\xb9');
            ?>
									<span class='comment_snapshot' style='display:none'>
										<strong><?php 
            echo $aParentData['\x65\155\x70\154\x6f\x79\x65\x65'];
            ?>
 (<?php 
            echo current($aParentData['\160\x6f\163\x74']);
            ?>
)</strong>
										<span class='dt'><?php 
            echo \app\system\Util::unserializetimestamp($aParentData['\x63\162\x65\141\164\x65\144\137\x61\164']);
            ?>
</span>
										<a href='#<?php 
            echo $aParentData['\143\157\x6d\155\x65\x6e\x74\x5f\x69\x64'];
            ?>
' class='cbtn goto_btn'><?php 
            echo $oL->get('\320\x9f\xd0\xb5\321\x80\320\xb5\320\271\xd1\202\320\270');
            ?>
</a>
										<a href='#' class='cbtn reply_again_btn'><?php 
            echo $oL->get('\320\x9e\xd1\x82\xd0\262\xd0\265\xd1\202\320\xb8\xd1\202\321\214');
            ?>
</a>
										<span class='abstract_content'><?php 
            echo v(mb_substr($aParentData['\x63\157\x6d\155\145\156\x74'], 0, 100)) . (mb_strlen($aParentData['\143\x6f\155\x6d\145\x6e\164']) > 100 ? '\342\200\xa6' : '');
            ?>
</span>
									</span>
								</span>
                            <?php 
            Label_36751:
            ?>
                            <span class='dt'><?php 
            echo \app\system\Util::unserializetimestamp($aV['\x63\162\x65\x61\x74\145\x64\137\x61\x74']);
            ?>
</span>
                            <?php 
            $sId = \app\user\Account::getaccount()->getsid();
            $aLikedList = \app\reference\engine\ArrayMapperUtil::unserialize($aV['\154\x69\x6b\145\144']);
            $aDisLikedList = \app\reference\engine\ArrayMapperUtil::unserialize($aV['\x64\151\163\154\x69\153\x65\144']);
            ?>
                            <style>.rating_btn {cursor: pointer; margin-right: 5px;} .rating_btn.active {color: blue;} .rating_btn:hover {text-decoration:  none;}</style>
                            <a class='rating_btn like_btn <?php 
            echo isset($aLikedList[$sId]) ? '\x61\x63\164\x69\x76\145' : '';
            ?>
'>
                                <i class='fa fa-lg fa-thumbs-o-up' aria-hidden='true'></i>
                                <span class='counter'><?php 
            echo count($aLikedList);
            ?>
</span>
                            </a>
                            <a class='rating_btn dislike_btn <?php 
            echo isset($aDisLikedList[$sId]) ? '\x61\143\x74\x69\166\x65' : '';
            ?>
'>
                                <i class='fa fa-lg fa-thumbs-o-down' aria-hidden='true'></i>
                                <span class='counter'><?php 
            echo count($aDisLikedList);
            ?>
</span>
                            </a>
                        </li>
                        <li class='abstract_content'>
                            <span><?php 
            echo \app\system\Util::replaceurls(nl2br(v($aV['\143\x6f\x6d\155\x65\156\164'])));
            ?>
</span>
                            <?php 
            if (count($aV['\x66\151\x6c\145\163'])) {
                goto Label_36752;
            }
            ?>
                                <div class='attached_files'></div>
                            <?php 
            goto Label_36753;
            Label_36752:
            ?>

                                <?php 
            echo \app\reference\REF::fileview('', $aV['\146\151\x6c\145\x73'], $aV);
            ?>
                                </p>
                            <?php 
            Label_36753:
            ?>
                        </li>
                        <li>
                            <a href='#' class='btn btn-xs reply_btn' style='display:none'  <?php 
            
            ?>
><?php 
            echo $oL->get('\320\x9e\321\202\320\xb2\xd0\265\xd1\x82\320\270\321\x82\321\x8c');
            ?>
</a>
                            <?php 
            if (!(key($aV['\160\x6f\163\164']) == \app\user\Account::getaccount()->getsid() && time() - strtotime($aV['\x63\x72\145\x61\164\x65\144\x5f\141\164']) < 5 * 60)) {
                goto Label_36754;
            }
            ?>
                                <a href='#' class='btn btn-xs edit_btn'><?php 
            echo $oL->get('\xd0\xa0\xd0\265\xd0\xb4\xd0\xb0\320\272\xd1\202\xd0\xb8\321\200\xd0\xbe\320\xb2\320\xb0\xd1\202\xd1\214');
            ?>
</a>
                            <?php 
            Label_36754:
            ?>
                            <?php 
            if (!(key($aV['\x70\157\x73\x74']) == \app\user\Account::getaccount()->getsid() && time() - strtotime($aV['\x63\x72\x65\141\164\145\x64\x5f\x61\x74']) < 5 * 60)) {
                goto Label_36755;
            }
            ?>
                                <a href='#' class='btn btn-xs delete_btn'><?php 
            echo $oL->get('\xd0\243\320\264\xd0\260\320\xbb\320\270\321\x82\xd1\x8c');
            ?>
</a>
                            <?php 
            Label_36755:
            ?>
                            <?php 
            if (!(strlen($aV['\x65\x64\x69\164\x65\x64\x5f\x61\x74']) > 0)) {
                goto Label_36756;
            }
            ?>
                                <span class='edit_dt' ><?php 
            echo $oL->get('\320\x98\320\xb7\xd0\xbc\320\xb5\xd0\xbd\320\xb5\xd0\xbd\320\xbe');
            ?>
 <?php 
            echo \app\system\Util::unserializetimestamp($aV['\x65\x64\x69\164\x65\x64\x5f\x61\164']);
            ?>
</span>
                            <?php 
            Label_36756:
            ?>
                        </li>
                    </ul>
                    <script type='text/javascript'>
                        MSF_App.bind_starter(function( oParams )
                        {
                            oParams.id = '<?php 
            echo $aV['\151\x64'];
            ?>
';
                            <?php 
            if (!count($aParentData)) {
                goto Label_36757;
            }
            ?>
                            oParams.parent_id = '<?php 
            echo $aParentData['\151\144'];
            ?>
';
                            oParams.parent_dom_id = '<?php 
            echo $aParentData['\x63\x6f\155\155\145\x6e\164\x5f\x69\144'];
            ?>
';
                            <?php 
            Label_36757:
            ?>
                            window.FIELDS_BANK['field_comments_tree_<?php 
            echo $sTreeId;
            ?>
'].prepare_comment('#field_comments_tree_comment_<?php 
            echo $sCommentId;
            ?>
', oParams);
                        }, 'field_comments_tree_comment_<?php 
            echo $sCommentId;
            ?>
', true, 'field_comments_tree_comments');
                    </script>
                    <?php 
            if ($bHaveChilds) {
                goto Label_36758;
            }
            ?>
                        <ul class='field_comments_tree'></ul>
                    <?php 
            goto Label_36759;
            Label_36758:
            ?>
                        <?php 
            echo \app\workflow\WFW::commentvar($aV['\x63\x68\151\x6c\x64\163'], $sDoctypeId, $sDocumentId, $iDepth + 1, $sTreeId, $aV);
            ?>
                    <?php 
            Label_36759:
            ?>
                </li>
            <?php 
        }
        ?>
        </ul>
    <?php 
        Label_36761:
        ?>

        <script type='text/javascript'>
            $(function () {
                $('#field_comments_tree_uploader_<?php 
        echo $sTreeId;
        ?>
_ul').sortable({
                    axis: 'y',
                    items: '> li',
                    containment: 'parent',
                    tolerance: 'pointer',
                });
            });
        </script>

        <?php 
        $s = ob_get_clean();
        return $s;
    }
    private static function variablevartabletr($a, $aDataList, $sDocumentId, $iOffset = 0, $iLimit, $iCount = 0, $sParentId = null, $iDepth = 0, $aTreeDraw = array(), $sParentIdOnly = null)
    {
        $oL = \app\system\Registry::get('\154\x6f\143\x61\x6c\145');
        $bFastEdit = \app\system\Registry::get('\x63\x6f\156\x66\x69\147')->get('\x72\x65\x6c\x5f\x64\x6f\143\x5f\146\x61\x73\x74\137\x65\144\151\164\x5f\141\x6e\144\x5f\166\151\145\167');
        $sHiddenDescription = key(a($a['\x76\x61\162'], '\150\x69\x64\x64\145\156\137\x64\145\x73\143\162\151\x70\x74\151\x6f\x6e', array()));
        $sHiddenDescriptionVal = current(a($a['\x76\x61\x72'], '\x68\151\144\x64\x65\156\137\144\x65\x73\x63\x72\151\160\x74\151\x6f\x6e', array()));
        switch ($a['\166\141\162']['\x67\162\151\x64\x5f\166\151\x65\x77\137\x74\x79\x70\x65']) {
            case 1:
                $sGridClass = '\147\162\x69\x64\137\x73\151\156\147\154\145\x5f\154\x69\x6e\145';
                break;
            case 2:
                $sGridClass = '\x67\162\x69\144\x5f\x74\167\157\137\154\x69\156\145';
                break;
            case 3:
                $sGridClass = '\x67\162\151\144\x5f\x74\x68\162\x65\145\137\x6c\151\156\x65';
                break;
            default:
                $sGridClass = '';
                break;
        }
        $i = 1;
        $isTreeLast = false;
        foreach ($aDataList as $sKeyData => $aData) {
            $isTreeLast = $i == count($aDataList);
            $aTreeDraw[$iDepth] = !$isTreeLast;
            if (!$isTreeLast) {
                goto Label_36762;
            }
            $aTreeDraw[$iDepth] = false;
            Label_36762:
            if (!($iCount < $iOffset)) {
                goto Label_36764;
            }
            $iCount++;
            if (empty($aData['\143\x68\151\x6c\144\x73'])) {
                goto Label_36763;
            }
            $iD = $iDepth + 1;
            $sP = $sParentId . '\40' . $aData['\151\144'] . $a['\166\141\x72']['\x6e\141\x6d\145'];
            self::variablevartabletr($a, $aData['\x63\x68\x69\154\144\x73'], $sDocumentId, $iOffset, $iLimit, $iCount, $sP, $iD, $aTreeDraw, $aData['\x69\x64'] . $a['\166\141\x72']['\x6e\x61\155\145']);
            Label_36763:
            continue;
            Label_36764:
            $hideTr = $iCount >= $iLimit;
            $sHideTr = '';
            if (!(strlen($sParentIdOnly) > 0 && $sParentIdOnly != $sDocumentId . $a['\166\x61\x72']['\156\141\155\x65'] && $sDocumentId != $aData['\x69\144'] && $sParentIdOnly != $aData['\x74\x72\145\x65\137\x69\x64'] . $a['\x76\x61\x72']['\156\141\x6d\145'] && !\app\system\Registry::get('\143\x6f\156\146\x69\x67')->get('\x73\x68\x6f\167\137\x61\154\154\x5f\x72\x65\x6c\141\164\x65\x64\x5f\x64\157\143\163'))) {
                goto Label_36765;
            }
            $sHideTr = '\x73\x74\x79\154\x65\x3d\42\x64\x69\x73\160\154\141\171\72\x20\x6e\157\156\x65\73\42';
            Label_36765:
            ?>
            <tr class='trow <?php 
            echo $hideTr ? '\157\x66\x66\55\x6c\151\155\151\164' : '';
            ?>
' data-parent='<?php 
            echo $sParentId != null ? $sParentId : '';
            ?>
' id='<?php 
            echo $aData['\x69\x64'];
            ?>
' <?php 
            if (!($aData['\151\x64'] == $sDocumentId)) {
                goto Label_36766;
            }
            ?>
  <?php 
            Label_36766:
            ?>
 data-only-parent='<?php 
            echo $sParentIdOnly;
            ?>
' <?php 
            echo $sHideTr;
            ?>
>
                <?php 
            $j = 0;
            ?>
                <?php 
            $iIter = 1;
            $iMargin = 0;
            foreach ($a['\166\141\162']['\146\x69\x65\154\144\x73'] as $sK3 => $aV3) {
                if (!($sHiddenDescriptionVal == $sK3)) {
                    goto Label_36767;
                }
                continue;
                Label_36767:
                ?>

                    <td id='variable_table_<?php 
                echo $a['\x76\x61\162']['\156\x61\155\145'];
                ?>
_cell_<?php 
                echo $i;
                ?>
_<?php 
                echo $j + 1;
                ?>
' class='<?php 
                echo $iIter == 1 ? '\143\157\x6e\164\x65\x6e\x74' : '';
                ?>
 cell_with_canvas' <?php 
                echo $aV3['\164\171\x70\x65'] != '\163\x74\x72\165\143\x74\165\162\145' ? '\x73\x74\171\x6c\x65\x3d\42\x6f\x76\x65\162\x66\154\x6f\167\x3a\40\x68\151\144\144\145\x6e\73\x20\164\x65\170\x74\x2d\157\166\x65\162\146\x6c\157\x77\72\x20\145\x6c\x6c\151\160\x73\151\163\73\42' : '';
                ?>
>
                        <?php 
                if (!$aV3['\150\151\x65\x72\x61\x72\x63\x68\151\143\x61\x6c']) {
                    goto Label_36768;
                }
                for ($i1 = 0; $i1 < $iDepth; $i1++) {
                    ?>
                                <div class='tree_grid <?php 
                    echo $aTreeDraw[$i1 + 1] ? '\164\x72\x65\145\137\147\162\x69\x64\x5f\x76\x5f\154\151\156\x65' : '';
                    ?>
 <?php 
                    echo $i1 + 1 == $iDepth ? '\164\162\145\145\x5f\x67\162\151\144\137\x6c\x61\163\x74' : '';
                    ?>
 <?php 
                    echo $aTreeDraw[$iDepth] ? '\x74\x72\145\145\137\147\162\x69\144\137\150\141\x73\x5f\x73\x69\x62\x6c\151\x6e\x67\163' : '';
                    ?>
'> </div>
                            <?php 
                }
                ?>

                        <?php 
                Label_36768:
                ?>

                        <div class='tree_grid has_content'>
                            <?php 
                if (!empty($aData['\x63\150\151\x6c\x64\x73']) && $aV3['\150\151\x65\x72\141\x72\x63\x68\x69\143\x61\154']) {
                    goto Label_36771;
                }
                if (!($iIter == 1)) {
                    goto Label_36770;
                }
                ?>
                                <span class='tree <?php 
                if (!$iDepth) {
                    goto Label_36769;
                }
                ?>
gline<?php 
                Label_36769:
                ?>
'></span>
                            <?php 
                Label_36770:
                goto Label_36772;
                Label_36771:
                ?>
                                <?php 
                $sOpened = $sParentIdOnly == null || $sDocumentId == $aData['\151\144'] || \app\system\Registry::get('\143\157\x6e\146\x69\147')->get('\x73\150\157\x77\137\141\x6c\154\x5f\162\x65\x6c\141\164\x65\x64\x5f\x64\157\143\x73') ? '\155\x69\x6e\165\163' : '\160\154\165\x73';
                ?>

                                <span class='tree <?php 
                echo $sOpened;
                ?>
' data-toggle='<?php 
                echo $aData['\x69\144'] . $a['\x76\x61\162']['\x6e\x61\x6d\145'];
                ?>
' style='margin-left:<?php 
                echo $iMargin++ * 16;
                ?>
px' id='toggle_<?php 
                echo $a['\166\141\x72']['\156\141\x6d\145'];
                ?>
_<?php 
                echo $aData['\x69\x64'];
                ?>
' ></span>

                                <script>
                                    $('#toggle_<?php 
                echo $a['\x76\141\x72']['\156\141\155\x65'];
                ?>
_<?php 
                echo $aData['\151\x64'];
                ?>
').click(function(oE){
                                        var sId = $(this).data('toggle');
                                        if($(this).hasClass('minus'))
                                        {
                                            $('#variable_table_<?php 
                echo $a['\166\141\162']['\x6e\x61\x6d\x65'];
                ?>
 tr[data-parent~='' + sId + '']:not(.off-limit)').hide();
                                            $(this).removeClass('minus').addClass('plus');
                                            $('#loadRelatedDocuments<?php 
                echo $a['\x76\141\x72']['\x6e\x61\155\145'];
                ?>
').hide();

                                            $('.load-next_<?php 
                echo $a['\x76\141\x72']['\156\141\155\x65'];
                ?>
').hide();
                                        }else{
                                            //$('#variable_table_<?php 
                
                ?>
// tr[data-parent~='' + sId + '']:not(.off-limit)').show();
                                            //$('#variable_table_<?php 
                
                ?>
// tr[data-parent~='' + sId + ''] span.plus' ).removeClass('plus').addClass('minus');
                                            $('#variable_table_<?php 
                echo $a['\x76\x61\x72']['\156\141\x6d\x65'];
                ?>
 tr[data-only-parent~='' + sId + '']:not(.off-limit)').show();
                                            $('#variable_table_<?php 
                echo $a['\x76\141\162']['\156\141\x6d\145'];
                ?>
 tr[data-only-parent~='' + sId + ''] span.minus' ).removeClass('minus').addClass('plus');
                                            $(this).removeClass('plus').addClass('minus');
                                            $('#loadRelatedDocuments<?php 
                echo $a['\x76\x61\162']['\x6e\141\x6d\x65'];
                ?>
:not(.loaded)').show();
                                            if($('#variable_table_<?php 
                echo $a['\166\x61\162']['\156\141\x6d\x65'];
                ?>
 tr.off-limit').length) {
                                                $('.load-next_<?php 
                echo $a['\166\141\162']['\156\x61\x6d\x65'];
                ?>
').show();
                                            }
                                        }

                                        oE.preventDefault();
                                    })
                                </script>
                            <?php 
                Label_36772:
                ?>
                        </div>
                        <div class='cell_canvas  <?php 
                echo $iDepth;
                ?>
 <?php 
                echo $sGridClass;
                ?>
 <?php 
                echo $aV3['\150\x69\x65\x72\141\162\x63\150\x69\143\x61\x6c'] ? '\150\141\x73\x48\x69\x65\x72\141\x72\x63\x68\151\x61\154' : '';
                ?>
' <?php 
                if (!$aV3['\150\x69\x65\162\x61\x72\x63\150\151\x63\x61\154']) {
                    goto Label_36773;
                }
                ?>
style='padding-left:5px; width: calc(100% - <?php 
                echo $i1 + 2;
                ?>
 * 17px);'<?php 
                Label_36773:
                ?>
>

						<span class='content'>

						<?php 
                if (!isset($aData[$sK3])) {
                    goto Label_36787;
                }
                ?>
                            <?php 
                $mValue = $aData[$sK3];
                $aFields = $a['\x76\x61\x72']['\146\151\x65\x6c\x64\163'];
                $sTitle = '';
                $sTitlePosts = '';
                $aV3['\x6f\x70\164\151\157\156\163']['\x74\171\x70\x65'] = $aV3['\164\171\x70\145'];
                switch ($aV3['\x74\171\160\x65']) {
                    case '\x72\145\x66\145\x72\x65\x6e\x63\x65':
                        $aV3['\x6f\160\x74\151\x6f\x6e\163']['\x64\151\x73\141\x62\154\145\137\154\x69\156\x6b'] = '\61';
                    case '\x69\155\141\x67\x65':
                    case '\x66\x69\x6c\x65':
                    case '\144\157\143\x75\x6d\145\x6e\164':
                    case '\x62\157\157\154\145\x61\x6e':
                    case '\x65\x6e\165\x6d\145\162\x61\164\x69\157\156':
                        $mValue = \app\system\CacheSerializer::fromdb($mValue);
                        break;
                    case '\x73\164\162\165\143\x74\x75\x72\145':
                        $mValue = \app\system\CacheSerializer::fromdb($mValue);
                        if (!(\app\user\Account::getaccount()->getlocale() !== '\x72\x75' && array_key_exists(\app\user\Account::getaccount()->getlocale(), \app\system\Registry::get('\x63\157\x6e\146\151\147')->get('\141\160\160\137\154\x6f\143\141\154\145\163')))) {
                            goto Label_36778;
                        }
                        $aRefLcl = array();
                        if (!(isset($a['\x76\141\162']['\x64\157\x63\164\x79\160\x65\163'][$aData['\x64\157\x63\x74\171\x70\x65\137\x69\144']]['\x64\x6f\143\165\155\145\x6e\x74\x5f\146\x69\x65\x6c\x64\x73']) && isset($a['\x76\x61\x72']['\144\x6f\x63\x74\x79\160\x65\x73'][$aData['\144\157\143\164\x79\x70\x65\137\151\x64']]['\144\x6f\x63\165\x6d\145\x6e\164\137\146\x69\145\154\x64\163'][$a['\166\x61\x72']['\x64\x6f\x63\164\x79\x70\145\x73'][$aData['\144\157\x63\164\x79\160\x65\x5f\151\144']]['\143\x6f\x6d\x70\141\162\145\144\137\146\x69\145\154\144\163'][$sK3]]))) {
                            goto Label_36775;
                        }
                        $aDocField = $a['\x76\141\162']['\144\157\x63\164\171\x70\145\163'][$aData['\144\157\143\164\171\x70\145\137\x69\144']]['\x64\157\x63\165\x6d\145\156\x74\x5f\146\x69\x65\x6c\144\163'][$a['\166\x61\162']['\144\157\x63\x74\171\160\x65\163'][$aData['\144\x6f\x63\x74\171\160\145\x5f\151\x64']]['\x63\x6f\155\x70\x61\162\145\x64\x5f\x66\151\x65\154\x64\x73'][$sK3]];
                        if (!($aDocField['\164\171\x70\x65'] == '\162\x65\x66\x65\162\x65\x6e\143\x65')) {
                            goto Label_36774;
                        }
                        $aRefLcl = \app\locale\Util::getreflcl($aDocField['\x72\145\146\145\162\x65\x6e\143\145\137\x69\x64']);
                        Label_36774:
                        Label_36775:
                        $oF = \app\reference\field\FieldFactory::create($sK3, $aV3['\157\x70\x74\x69\x6f\x6e\163']);
                        $oF->unserialize($aData[$sK3]);
                        $oF->get();
                        if (!count($oF->get())) {
                            goto Label_36777;
                        }
                        $aLocale = \app\system\Registry::get('\154\157\x63\x61\x6c\145\x5f\151\156\x66\x6f');
                        $aLcl = count($aRefLcl) ? $aRefLcl : array_merge($aLocale['\x70\163\164'], $aLocale['\x73\144\x76'], $aLocale['\147\162\160']);
                        foreach ($mValue as $sId => &$sValue) {
                            if (!($sId == key($oF->get()))) {
                                goto Label_36776;
                            }
                            $sTitlePosts = v(strtr($sValue, a($aLcl, $sId, array())));
                            $sValue = v(strtr($sValue, a($aLcl, $sId, array())));
                            Label_36776:
                        }
                        Label_36777:
                        Label_36778:
                        break;
                }
                $oF = \app\reference\field\FieldFactory::create($sK3, $aV3['\x6f\160\164\x69\157\x6e\163']);
                $oF->unserialize($aData[$sK3]);
                $sTitle = $sHiddenDescription == $sK3 && $aData[$sHiddenDescriptionVal] != '' ? $aData[$sHiddenDescriptionVal] : $oF->getgridvalue();
                $sTitle = html_entity_decode(strip_tags($sTitle), ENT_QUOTES, '\125\124\106\55\70');
                ?>

                            <?php 
                if (isset($aV3['\x75\x73\145\137\x6c\151\156\153']) && $aV3['\165\163\145\x5f\154\x69\x6e\x6b'] && $aData['\151\x64'] != $sDocumentId) {
                    goto Label_36785;
                }
                ?>
                                <?php 
                if ($a['\x76\141\162']['\x64\157\143\x74\171\x70\145\x73'][$aData['\144\157\143\164\x79\x70\x65\137\151\144']]['\143\157\155\160\141\x72\145\x64\x5f\x66\151\145\x6c\144\163'][$sK3] == '\x70\157\x69\x6e\x74\137\x74\x69\x74\x6c\145') {
                    goto Label_36783;
                }
                ?>
                                    <span title='<?php 
                echo $sTitlePosts ? $sTitlePosts : v($sTitle);
                ?>
'>
                                                <?php 
                echo \app\reference\REF::viewfactory($sK3, $mValue, $aV3['\157\160\164\x69\157\156\x73']);
                ?>
                                            </span>
                                <?php 
                goto Label_36784;
                Label_36783:
                ?>
                                    <span title='<?php 
                echo $oL->get(v($sTitle));
                ?>
'>
                                                <?php 
                echo \app\reference\REF::viewfactory($sK3, $mValue, $aV3['\x6f\x70\164\x69\157\x6e\x73'], true, false, true);
                ?>
                                            </span>
                                <?php 
                Label_36784:
                ?>
                            <?php 
                goto Label_36786;
                Label_36785:
                ?>
                                <?php 
                if (in_array($aV3['\164\x79\160\145'], array('\x64\x6f\143\165\155\145\x6e\164'))) {
                    goto Label_36781;
                }
                if ($a['\x76\x61\x72']['\x64\x6f\143\x74\171\x70\145\163'][$aData['\144\x6f\143\164\171\160\x65\x5f\151\x64']]['\x63\157\x6d\x70\x61\x72\145\x64\137\146\x69\145\x6c\144\x73'][$sK3] == '\160\157\x69\156\164\137\164\151\164\154\145') {
                    goto Label_36779;
                }
                $sText = \app\reference\REF::viewfactory($sK3, $mValue, $aV3['\x6f\160\164\x69\157\x6e\163']);
                goto Label_36780;
                Label_36779:
                $sText = \app\reference\REF::viewfactory($sK3, $mValue, $aV3['\x6f\x70\164\x69\x6f\156\163'], true, false, true);
                $sTitle = trim(html_entity_decode(strip_tags($sText), ENT_QUOTES, '\125\x54\106\x2d\x38'));
                Label_36780:
                goto Label_36782;
                Label_36781:
                $sText = implode(a($aV3, '\162\157\x77\137\x73\145\160\x61\162\141\164\157\x72', '\x2c\40'), $mValue);
                Label_36782:
                ?>
                                <a title='<?php 
                echo v($sTitle);
                ?>
' href='/workflow/document/view/<?php 
                echo $aData['\x64\157\143\x74\x79\x70\145\x5f\x69\x64'];
                ?>
/<?php 
                echo $aData['\151\144'];
                echo isset($_GET['\155\171\144\x6f\143\x75\155\145\x6e\164\x73']) ? '\77\155\171\x64\x6f\143\x75\x6d\x65\156\164\163' : '';
                ?>
'><?php 
                echo $sText;
                ?>
</a>
                            <?php 
                Label_36786:
                ?>


                        <?php 
                Label_36787:
                ?>
						</span>
                        </div>
                    </td>

                    <?php 
                $j++;
                $iIter++;
            }
            ?>

                <td style='width: 24px !important; text-align: center; vertical-align: top;' <?php 
            if (!($aData['\151\144'] != $sDocumentId)) {
                goto Label_36788;
            }
            ?>
 class='td_fastopen' <?php 
            Label_36788:
            ?>
>
                    <?php 
            if (!($aData['\x69\x64'] != $sDocumentId)) {
                goto Label_36791;
            }
            ?>
                        <?php 
            if ($bFastEdit && $a['\x76\141\162']['\146\x61\163\164\x5f\145\144\151\x74']) {
                goto Label_36789;
            }
            ?>
                            <span class='btn_fastopen' data-href='/workflow/document/fast-view/<?php 
            echo $aData['\x64\x6f\143\164\x79\160\145\137\x69\x64'];
            ?>
/<?php 
            echo $aData['\x69\x64'];
            ?>
' onclick='openModalWindow($(this).attr('data-href'))'> </span>
                        <?php 
            Label_36789:
            ?>

                        <?php 
            if (!($bFastEdit && $a['\x76\x61\162']['\146\141\163\x74\x5f\x65\x64\x69\x74'])) {
                goto Label_36790;
            }
            ?>
                            <span class='btn_fast_edit' data-href='/workflow/document/fast-edit/<?php 
            echo $aData['\x64\x6f\143\164\x79\x70\x65\137\151\144'];
            ?>
/<?php 
            echo $aData['\151\x64'];
            ?>
/<?php 
            echo $a['\x64\157\143\164\171\x70\145\x5f\151\144'];
            ?>
/<?php 
            echo $a['\x76\x61\162']['\x6e\141\x6d\x65'];
            ?>
' onclick='msf.actionWindow.view($(this).attr('data-href'), {}, this);'> </span>
                        <?php 
            Label_36790:
            ?>

                    <?php 
            Label_36791:
            ?>

                    <?php 
            if (!($bFastEdit && $a['\x76\141\x72']['\x66\x61\163\x74\x5f\x65\144\151\164'])) {
                goto Label_36792;
            }
            ?>
                        <!--<span class='btn_fast_create' onclick='createRelatedDocument<?php 
            echo $a['\166\x61\x72']['\156\141\155\x65'];
            ?>
(this, '<?php 
            echo $aData['\151\x64'];
            ?>
', '<?php 
            echo $aData['\144\x6f\143\x74\171\160\x65\x5f\x69\144'];
            ?>
')'> </span>-->
                    <?php 
            Label_36792:
            ?>

                </td>
            </tr>
            <?php 
            $iCount++;
            if (empty($aData['\143\150\x69\x6c\x64\x73'])) {
                goto Label_36793;
            }
            $iD = $iDepth + 1;
            $sP = $sParentId . '\x20' . $aData['\151\144'] . $a['\166\141\x72']['\x6e\141\155\145'];
            self::variablevartabletr($a, $aData['\x63\150\x69\154\x64\x73'], $sDocumentId, $iOffset, $iLimit, $iCount, $sP, $iD, $aTreeDraw, $aData['\151\x64'] . $a['\x76\141\162']['\x6e\x61\x6d\x65']);
            Label_36793:
            $i++;
        
        }
    }
    public static function linkedvarview($a)
    {
        $oL = \app\system\Registry::get('\154\157\x63\x61\154\x65');
        ob_start();
        ?>
        <style>
            #linked_table_<?php 
        echo $a['\166\x61\x72']['\156\141\x6d\x65'];
        ?>
 span.tree { padding:0 8px 8px 8px; position: relative; height: 100%;  }
            #linked_table_<?php 
        echo $a['\166\141\x72']['\x6e\x61\x6d\x65'];
        ?>
 span.tree.line { background: url('/tpl/web/img/themev1/tree_line.gif') repeat-y center center; padding-bottom: 130px; }
            #linked_table_<?php 
        echo $a['\x76\x61\x72']['\156\x61\x6d\x65'];
        ?>
 span.tree.gline { background: url('/tpl/web/img/themev1/tree_g_line.gif') no-repeat center top;}
            #linked_table_<?php 
        echo $a['\x76\x61\x72']['\x6e\x61\155\x65'];
        ?>
 span.tree.cross { background: url('/tpl/web/img/themev1/tree_cross.gif') no-repeat center top; padding-bottom: 130px;}
            #linked_table_<?php 
        echo $a['\166\x61\x72']['\x6e\141\155\145'];
        ?>
 span.tree.cross.last { background: url('/tpl/web/img/themev1/tree_cross_last.gif') no-repeat center top;  }
            #linked_table_<?php 
        echo $a['\166\x61\162']['\x6e\x61\x6d\x65'];
        ?>
 td.content { padding-left: 0 !important; overflow: hidden; }
            #linked_table_<?php 
        echo $a['\x76\141\x72']['\x6e\x61\155\145'];
        ?>
 td.content a.content, #linked_table_<?php 
        echo $a['\x76\x61\x72']['\156\x61\x6d\x65'];
        ?>
 td.content span.content { display: block; }
            #linked_table_<?php 
        echo $a['\x76\141\162']['\x6e\141\155\145'];
        ?>
 td.tree_grid { padding: 0 !important; border-right: medium none; overflow: hidden; vertical-align: top; }
            #linked_table_<?php 
        echo $a['\x76\x61\162']['\x6e\141\155\x65'];
        ?>
 tr.title td.header { border-right: none;}
            #linked_table_<?php 
        echo $a['\166\x61\162']['\x6e\x61\155\145'];
        ?>
 tr.title td.header span{ position: absolute; margin-top: -9px; }
            <![if !IE]>
              #linked_table_<?php 
        echo $a['\166\141\162']['\x6e\141\x6d\145'];
        ?>
 span.tree.line,
              #linked_table_<?php 
        echo $a['\166\x61\162']['\x6e\x61\x6d\145'];
        ?>
 span.tree.gline,
              #linked_table_<?php 
        echo $a['\166\x61\162']['\156\141\x6d\145'];
        ?>
 span.tree.cross,
              #linked_table_<?php 
        echo $a['\x76\x61\x72']['\156\141\155\x65'];
        ?>
 span.tree.cross.last,
              #linked_table_<?php 
        echo $a['\166\x61\162']['\156\x61\x6d\x65'];
        ?>
 span.tree.minus,
              #linked_table_<?php 
        echo $a['\166\141\162']['\156\141\x6d\145'];
        ?>
 span.tree.plus { background-position: center center; }
            <![endif]>
        </style>
        <?php 
        if (!\app\system\Util::isie()) {
            goto Label_36794;
        }
        ?>
        <style>
            #linked_table_<?php 
        echo $a['\166\141\x72']['\156\141\155\145'];
        ?>
 span.tree { padding:8px; position: relative; height: 100%;}
            #linked_table_<?php 
        echo $a['\x76\x61\x72']['\x6e\x61\x6d\145'];
        ?>
 td.tree_grid{ padding: 0 !important; border-right: medium none; overflow: hidden; vertical-align: middle;}
        </style>
    <?php 
        Label_36794:
        ?>

        <div id='linked_documents_<?php 
        echo $a['\166\141\162']['\x6e\x61\x6d\145'];
        ?>
' class='field_big_wrap collapsed'>
            <h3 data-loaded='0' >
                <?php 
        echo $oL->get($a['\166\141\x72']['\164\x69\164\154\x65'], '\xd0\224\320\xbe\xd0\xba\xd1\x83\320\xbc\320\xb5\xd0\275\xd1\202\321\213', '\320\237\xd0\xb5\xd1\x80\320\xb5\xd0\xbc\320\xb5\320\xbd\xd0\275\xd1\213\320\265', sprintf('\45\163\55\45\x73\x2d\164\151\x74\x6c\x65', $a['\x64\x6f\x63\164\x79\x70\x65\x5f\x69\x64'], $a['\x76\x61\162']['\x6e\141\x6d\145']));
        ?>
                <span id='search_bar' class='form-group form-group-sm'>
                    <input class='field_keyword form-control input-sm' type='text' placeholder='<?php 
        echo $oL->get('\320\x9d\xd0\260\320\271\xd1\202\xd0\270');
        ?>
' style=''>
                    <span class='iconBtnForSearching' id='iconBtnIdForSearchAndDelete<?php 
        echo $a['\166\141\162']['\156\141\155\145'];
        ?>
'></span>
                </span>
            </h3>
            <div class='inner_wrap' style='display:none;'>
                <table id='linked_table_<?php 
        echo $a['\x76\141\x72']['\x6e\x61\x6d\145'];
        ?>
' border='0' cellpadding='0' cellspacing='0' class='field_table_view' style='width:100%; '>
                    <col style='width: 10px !important;' />
                    <?php 
        for ($i = 0; $i < $a['\x76\x61\162']['\154\166\154\x5f\143\x6f\x75\x6e\x74'] + 1; $i++) {
            ?>
                        <col style='width: 16px !important;' />
                    <?php 
        }
        ?>
                    <tr class='title'>
                        <td>&nbsp;</td>
                        <td class='header' colspan='<?php 
        echo $a['\x76\141\162']['\154\166\154\137\143\157\x75\156\x74'] + 1;
        ?>
' ><span><?php 
        echo $oL->get('\320\x97\320\xb0\xd0\xb3\320\276\320\273\320\xbe\320\xb2\320\xbe\320\xba');
        ?>
</span></td>
                        <td>&nbsp;</td>
                    </tr>
                </table>


                <div style='background-color: #fff;' id='documents_count_info_<?php 
        echo $a['\x76\x61\162']['\x6e\x61\155\x65'];
        ?>
'>
                    <p style='line-height: 23px;text-shadow: 0 1px 0 #FFFFFF;color:#696969'>
                        <?php 
        echo $oL->get('\xd0\222\xd1\201\xd0\265\xd0\263\xd0\xbe\x3a');
        ?>
                        <span id='total_count_<?php 
        echo $a['\166\x61\x72']['\156\x61\x6d\145'];
        ?>
'><?php 
        echo $a['\164\157\164\141\154\137\x63\x6f\165\x6e\164'];
        ?>
</span>
                    </p>
                </div>

            </div>
        </div>


        <script>
            $(document).ready(function() {
                var oWrap = $('#linked_documents_<?php 
        echo $a['\166\141\162']['\156\x61\155\x65'];
        ?>
');
                oWrap.children('h3').unbind('click').bind('click', function()
                {
                    if($(this).data('loaded') == 0)
                    {
                        getContent<?php 
        echo $a['\166\x61\162']['\156\141\155\x65'];
        ?>
();
                        $(this).data('loaded', 1);
                    }
                });

                <?php 
        echo $a['\x76\141\162']['\151\x73\x5f\145\x78\x70\x61\x6e\x64\x65\x64'] ? '\157\127\162\x61\160\56\x63\x68\151\x6c\x64\x72\x65\x6e\50\x27\150\63\47\x29\56\143\154\x69\143\x6b\x28\x29\73' : '';
        ?>
            });

            function getContent<?php 
        echo $a['\166\x61\162']['\156\141\x6d\145'];
        ?>
()
            {
                var oThinking = $('#thinking');
                oThinking.show();
                $.get('/workflow/document/linked-document/<?php 
        echo $a['\144\x6f\143\x74\x79\x70\145\137\x69\144'];
        ?>
/<?php 
        echo $a['\x64\x6f\x63\x75\155\x65\x6e\164\137\151\x64'];
        ?>
/<?php 
        echo $a['\166\x61\x72']['\x6e\141\155\145'];
        echo isset($_GET['\155\x79\144\157\143\x75\x6d\145\156\164\x73']) ? '\77\x6d\171\144\x6f\x63\x75\x6d\x65\x6e\x74\x73' : '';
        ?>
', function(sHtml)
                {
                    var oWrap = $('#linked_documents_<?php 
        echo $a['\166\x61\162']['\x6e\x61\155\145'];
        ?>
');
                    var oInnerWrap = oWrap.children('.inner_wrap');
                    oInnerWrap.find('#linked_table_<?php 
        echo $a['\x76\141\x72']['\156\x61\155\x65'];
        ?>
').append(sHtml);
                    oWrap.removeClass('collapsed').addClass('expanded');
                    oInnerWrap.slideDown(200);
                    $('#total_count_<?php 
        echo $a['\x76\x61\x72']['\x6e\141\155\x65'];
        ?>
').show();
                    oThinking.hide();
                });
            }


        </script>
        <?php 
        $s = ob_get_clean();
        return $s;
    }
    public static function linked2varview($a)
    {
        $oL = \app\system\Registry::get('\x6c\157\x63\x61\154\145');
        ob_start();
        ?>
        <style>
            #linked_table_<?php 
        echo $a['\166\141\162']['\x6e\x61\155\x65'];
        ?>
 span.tree { padding:0 8px 8px 8px; position: relative; height: 100%;  }
            #linked_table_<?php 
        echo $a['\x76\141\x72']['\x6e\141\155\145'];
        ?>
 span.tree.line { background: url('/tpl/web/img/themev1/tree_line.gif') repeat-y center center; padding-bottom: 130px; }
            #linked_table_<?php 
        echo $a['\x76\x61\162']['\x6e\x61\x6d\145'];
        ?>
 span.tree.gline { background: url('/tpl/web/img/themev1/tree_g_line.gif') no-repeat center top;}
            #linked_table_<?php 
        echo $a['\166\x61\162']['\156\141\x6d\145'];
        ?>
 span.tree.cross { background: url('/tpl/web/img/themev1/tree_cross.gif') no-repeat center top; padding-bottom: 130px;}
            #linked_table_<?php 
        echo $a['\166\141\x72']['\x6e\141\155\145'];
        ?>
 span.tree.cross.last { background: url('/tpl/web/img/themev1/tree_cross_last.gif') no-repeat center top;  }
            #linked_table_<?php 
        echo $a['\x76\x61\x72']['\156\x61\155\145'];
        ?>
 td.content { padding-left: 0 !important; overflow: hidden; }
            #linked_table_<?php 
        echo $a['\166\141\162']['\156\x61\155\x65'];
        ?>
 td.content a.content, #linked_table_<?php 
        echo $a['\x76\x61\x72']['\x6e\x61\x6d\145'];
        ?>
 td.content span.content { display: block; }
            #linked_table_<?php 
        echo $a['\166\x61\x72']['\x6e\x61\x6d\145'];
        ?>
 td.tree_grid { padding: 0 !important; border-right: medium none; overflow: hidden; vertical-align: top; }
            #linked_table_<?php 
        echo $a['\166\141\x72']['\x6e\141\155\145'];
        ?>
 tr.title td.header { border-right: none;}
            #linked_table_<?php 
        echo $a['\166\141\x72']['\156\x61\155\145'];
        ?>
 tr.title td.header span{ position: absolute; margin-top: -9px; }
            <![if !IE]>
              #linked_table_<?php 
        echo $a['\x76\x61\x72']['\x6e\141\155\145'];
        ?>
 span.tree.line,
              #linked_table_<?php 
        echo $a['\x76\141\x72']['\x6e\141\x6d\145'];
        ?>
 span.tree.gline,
              #linked_table_<?php 
        echo $a['\166\141\x72']['\x6e\141\155\x65'];
        ?>
 span.tree.cross,
              #linked_table_<?php 
        echo $a['\x76\x61\x72']['\156\141\x6d\x65'];
        ?>
 span.tree.cross.last,
              #linked_table_<?php 
        echo $a['\x76\x61\162']['\x6e\x61\x6d\x65'];
        ?>
 span.tree.minus,
              #linked_table_<?php 
        echo $a['\x76\141\162']['\x6e\141\x6d\145'];
        ?>
 span.tree.plus { background-position: center center; }
            <![endif]>
        </style>
        <?php 
        if (!\app\system\Util::isie()) {
            goto Label_36795;
        }
        ?>
        <style>
            #linked_table_<?php 
        echo $a['\166\x61\x72']['\156\x61\155\x65'];
        ?>
 span.tree { padding:8px; position: relative; height: 100%;}
            #linked_table_<?php 
        echo $a['\x76\141\x72']['\156\x61\x6d\x65'];
        ?>
 td.tree_grid{ padding: 0 !important; border-right: medium none; overflow: hidden; vertical-align: middle;}
        </style>
    <?php 
        Label_36795:
        ?>

        <div id='linked_documents_<?php 
        echo $a['\x76\141\x72']['\x6e\x61\x6d\x65'];
        ?>
' class='field_big_wrap collapsed'>
            <h3 data-loaded='0' >
                <?php 
        echo $oL->get($a['\x76\141\x72']['\164\151\164\154\145'], '\320\x94\320\xbe\xd0\272\321\203\xd0\xbc\xd0\xb5\xd0\275\321\x82\321\213', '\320\x9f\320\265\xd1\x80\320\xb5\320\xbc\xd0\265\xd0\275\xd0\275\321\213\xd0\xb5', sprintf('\45\163\55\x25\163\55\164\x69\x74\x6c\x65', $a['\x64\157\143\164\171\160\145\x5f\x69\x64'], $a['\166\x61\x72']['\156\x61\155\x65']));
        ?>
                <span id='search_bar' class='form-group form-group-sm'>
                    <input class='field_keyword form-control input-sm' type='text' placeholder='<?php 
        echo $oL->get('\320\235\xd0\xb0\xd0\xb9\321\202\320\xb8');
        ?>
' style=''>
                    <span class='iconBtnForSearching' id='iconBtnIdForSearchAndDelete<?php 
        echo $a['\x76\141\x72']['\156\141\155\145'];
        ?>
'></span>
                </span>
            </h3>
            <div class='inner_wrap' style='display:none;'>
                <table id='linked_table_<?php 
        echo $a['\x76\x61\x72']['\156\x61\155\x65'];
        ?>
' border='0' cellpadding='0' cellspacing='0' class='field_table_view' style='width:100%; '>
                    <col style='width: 10px !important;' />
                    <?php 
        for ($i = 0; $i < $a['\x76\141\x72']['\x6c\166\x6c\x5f\x63\157\x75\x6e\x74'] + 1; $i++) {
            ?>
                        <col style='width: 16px !important;' />
                    <?php 
        }
        ?>
                    <tr class='title'>
                        <td>&nbsp;</td>
                        <td class='header' colspan='<?php 
        echo $a['\166\x61\162']['\154\x76\154\x5f\143\157\x75\x6e\x74'] + 1;
        ?>
' ><span><?php 
        echo $oL->get('\320\x97\320\xb0\xd0\263\xd0\276\xd0\273\xd0\xbe\320\262\xd0\xbe\320\xba');
        ?>
</span></td>
                        <td>&nbsp;</td>
                    </tr>
                </table>

                <?php 
        if (!(count(json_decode($a['\156\x65\x78\164'], true)) > 0)) {
            goto Label_36796;
        }
        ?>
                    <button id='getContentNext' class='btn btn-sm' onclick='getContentNext()'> </button>
                <?php 
        Label_36796:
        ?>


                <div style='background-color: #fff;' id='documents_count_info_<?php 
        echo $a['\x76\141\162']['\x6e\x61\x6d\145'];
        ?>
'>
                    <p style='line-height: 23px;text-shadow: 0 1px 0 #FFFFFF;color:#696969'>
                        <?php 
        echo $oL->get('\xd0\222\321\x81\320\265\320\263\xd0\xbe\72');
        ?>
                        <span id='total_count_<?php 
        echo $a['\166\x61\162']['\156\x61\155\x65'];
        ?>
'><?php 
        echo $a['\x74\157\x74\x61\154\137\x63\157\165\156\164'];
        ?>
</span>
                    </p>
                </div>


                <div id='aNext' style='display: none'><?php 
        echo $a['\x6e\145\170\x74'];
        ?>
</div>
                <div id='aDocuments' style='display: none'><?php 
        echo $a['\141\x44\x6f\143\165\x6d\145\x6e\x74\x73'];
        ?>
</div>
            </div>
        </div>


        <script>
            $(document).ready(function() {
                var oWrap = $('#linked_documents_<?php 
        echo $a['\x76\141\162']['\156\x61\155\x65'];
        ?>
');
                oWrap.children('h3').unbind('click').bind('click', function()
                {
                    if($(this).data('loaded') == 0)
                    {
                        getContent<?php 
        echo $a['\166\141\x72']['\x6e\x61\x6d\x65'];
        ?>
();
                        $(this).data('loaded', 1);
                    }
                });

                <?php 
        echo $a['\166\141\x72']['\x69\x73\x5f\x65\170\160\x61\x6e\144\x65\144'] ? '\x6f\x57\162\x61\x70\x2e\x63\x68\x69\x6c\x64\x72\145\x6e\50\x27\150\x33\47\51\56\x63\154\151\x63\153\50\51\73' : '';
        ?>
            });

            function getContent<?php 
        echo $a['\x76\141\x72']['\x6e\x61\155\x65'];
        ?>
()
            {
                var oThinking = $('#thinking');
                oThinking.show();
                $.get('/workflow/document/linked-document/<?php 
        echo $a['\144\x6f\143\x74\171\x70\x65\137\x69\144'];
        ?>
/<?php 
        echo $a['\144\x6f\143\165\x6d\x65\x6e\164\x5f\151\x64'];
        ?>
/<?php 
        echo $a['\166\141\162']['\156\141\155\145'];
        echo isset($_GET['\155\x79\x64\157\x63\165\x6d\145\156\x74\163']) ? '\x3f\x6d\x79\144\x6f\143\x75\x6d\145\156\164\163' : '';
        ?>
', function(sHtml)
                {
                    var oWrap = $('#linked_documents_<?php 
        echo $a['\x76\x61\162']['\x6e\141\155\145'];
        ?>
');
                    var oInnerWrap = oWrap.children('.inner_wrap');
                    oInnerWrap.find('#linked_table_<?php 
        echo $a['\166\x61\162']['\x6e\141\x6d\x65'];
        ?>
').append(sHtml);
                    oWrap.removeClass('collapsed').addClass('expanded');
                    oInnerWrap.slideDown(200);
                    $('#total_count_<?php 
        echo $a['\x76\141\x72']['\x6e\141\155\x65'];
        ?>
').show();
                    oThinking.hide();
                });
            }


            function getContentNext(){
                var aDocuments = $('#aDocuments').text();
                var aNext = $('#aNext').text();

                if(aNext.length > 4) {
                    $.ajax({
                        type: 'POST',
                        dataType: 'json',
                        url: '/workflow/document/linked-document/<?php 
        echo $a['\x64\x6f\143\164\x79\x70\x65\x5f\151\144'];
        ?>
/<?php 
        echo $a['\x64\157\x63\x75\155\145\x6e\x74\137\151\x64'];
        ?>
/<?php 
        echo $a['\166\141\162']['\156\x61\x6d\145'];
        ?>
',
                        data: {aNext: aNext, aDocuments: aDocuments, sType: 'next'},
                        success: function (data) {
                            if(data['aNext'].length < 4){
                                $('#getContentNext').addClass('disabled');
                            }

                            $('#aDocuments').text(data['aDocuments']);
                            $('#aNext').text(data['aNext']);
                            $('#total_count_<?php 
        echo $a['\x76\x61\x72']['\x6e\x61\x6d\145'];
        ?>
').text(data['iTotalCount']);

                            data['sParentId'].forEach(function(element) {
                                var sTdHtml = '<td class='tree_grid'><span href='#' data-source=''+element+'' class='tree minus'></span></td>';
                                $('#tr_'+element+' .tree_grid').last().replaceWith(sTdHtml);
                            });

                            var oWrap = $('#linked_documents_<?php 
        echo $a['\x76\141\x72']['\156\x61\155\x65'];
        ?>
');
                            var oInnerWrap = oWrap.children('.inner_wrap');
                            oInnerWrap.find('#linked_table_<?php 
        echo $a['\x76\x61\162']['\x6e\141\x6d\145'];
        ?>
 tr').last().after(data['html']);

                            oInnerWrap.find('span.tree.minus, span.tree.plus').unbind('click').bind('click', function(){
                                contentToggle<?php 
        echo $a['\166\x61\162']['\156\x61\155\145'];
        ?>
($(this));
                                return false;
                            });
                        }
                    })
                } else {
                    $('#getContentNext').addClass('disabled');
                }
            }
        </script>
        <?php 
        $s = ob_get_clean();
        return $s;
    }
    public static function linkedvarviewtablecontent($a, $aConfig, $currentDoc, $sParent, $iLevel)
    {
        self::linkedvartabletree($a, $currentDoc, $sParent, $aConfig['\154\166\154\x5f\143\157\x75\x6e\x74'], $iLevel);
        ?>
        <script>
            $(document).ready(function() {
                var oWrap = $('#linked_documents_<?php 
        echo $aConfig['\156\141\155\x65'];
        ?>
');

                oWrap.children('h3').unbind('click').bind('click', function()
                {
                    headerToggle<?php 
        echo $aConfig['\x6e\141\x6d\x65'];
        ?>
($(this));
                });
                $('#iconBtnIdForSearchAndDelete<?php 
        echo $aConfig['\156\x61\x6d\x65'];
        ?>
').click(function(){
                    if(!isLogged()) return;
                    var e = $(this);
                    e.addClass('iconBtnForSearching').removeClass('iconBtnForDelete');
                    oWrap.find('#search_bar').find('.field_keyword').val('');
                    oWrap.find('#search_bar').find('.field_keyword').keyup();
                    //oWrap.find('#search_bar').find('.field_keyword').parent().parent().show();
                    return false;
                });
                var oInnerWrap = oWrap.children('.inner_wrap');

                var delay = (function()
                {
                    var timer = 0;
                    return function(callback, ms) {
                        clearTimeout(timer);
                        timer = setTimeout(callback, ms);
                    };
                })();
                oInnerWrap.find('#linked_table_<?php 
        echo $aConfig['\156\x61\x6d\145'];
        ?>
')
                    .clone()
                    .attr('id', 'linked_table_<?php 
        echo $aConfig['\156\141\x6d\145'];
        ?>
_for_search')
                    .prependTo(oInnerWrap)
                    .hide();
                $('#linked_table_<?php 
        echo $aConfig['\156\x61\155\x65'];
        ?>
_for_search').find('span.tree minus, span.tree plus').each(function()
                {
                    $(this).parent().prepend('<span class='tree' ></span>');
                    $(this).remove()
                });
                oWrap.find('#search_bar').find('.field_keyword')
                    .focus(function()
                    {
                        oWrap.children('h3').unbind('click');
                    })
                    .blur(function()
                    {
                        oWrap.children('h3').click(function()
                        {
                            headerToggle<?php 
        echo $aConfig['\156\141\x6d\145'];
        ?>
($(this));
                        })
                    }).keyup(function()
                {
                    //canceling previous ajax request
                    if (typeof ajaxQSRequest == 'object') {
                        ajaxQSRequest.abort();
                    }

                    var sQs = $(this).val();
                    delay(function() {
                        if(sQs.length == 0)
                        {
                            $('#linked_table_<?php 
        echo $aConfig['\156\141\155\x65'];
        ?>
_for_search').hide();
                            $('#linked_table_<?php 
        echo $aConfig['\156\x61\x6d\x65'];
        ?>
').show();
                            $('#iconBtnIdForSearchAndDelete<?php 
        echo $aConfig['\x6e\141\x6d\145'];
        ?>
').addClass('iconBtnForSearching').removeClass('iconBtnForDelete');
                            return;
                        }else if (sQs.length < 3 && sQs.length > 0)
                        {
                            return;
                        }

                        var oThinking = $('#thinking');
                        oThinking.show();
                        var oTable = $('#linked_table_<?php 
        echo $aConfig['\156\141\155\x65'];
        ?>
_for_search');
                        $('#linked_table_<?php 
        echo $aConfig['\156\141\x6d\x65'];
        ?>
').hide();
                        oTable.show();
                        oTable.find('.content').each(function()
                        {
                            if($(this).text().indexOf(sQs) == -1)
                            {
                                $(this).parent().parent().hide();
                            }else
                            {
                                $(this).parent().parent().show();
                            }
                            if (sQs.length >= 3) {
                                $('#iconBtnIdForSearchAndDelete<?php 
        echo $aConfig['\156\141\x6d\145'];
        ?>
').addClass('iconBtnForDelete').removeClass('iconBtnForSearching');
                            }
                        });
                        oThinking.hide();
                    }, 500); //<-keyUp TimeOut
                });

                oInnerWrap.find('span.tree.minus, span.tree.plus').unbind('click').bind('click', function()
                {
                    contentToggle<?php 
        echo $aConfig['\156\141\155\145'];
        ?>
($(this));
                    return false;
                });
            });

            var ajaxQSRequest;

            function headerToggle<?php 
        echo $aConfig['\156\141\x6d\145'];
        ?>
(oHeader)
            {
                var oDocCountInfo = oHeader.siblings('#documents_count_info_<?php 
        echo $aConfig['\156\x61\x6d\x65'];
        ?>
');
                var oWrap = oHeader.parent();
                var oInnerWrap = oWrap.children('.inner_wrap');
                if (oWrap.hasClass('collapsed'))
                {
                    oWrap.removeClass('collapsed').addClass('expanded');
                    oInnerWrap.slideDown(200);
                    oDocCountInfo.show();
                }
                else
                {
                    oWrap.removeClass('expanded').addClass('collapsed');
                    oInnerWrap.slideUp(200);
                    oDocCountInfo.hide();
                }
            }

            function contentToggle<?php 
        echo $aConfig['\156\x61\155\145'];
        ?>
(oHeader)
            {
                var oWrap = oHeader.parent().parent();
                if (oHeader.hasClass('minus'))
                {
                    oHeader.removeClass('minus').addClass('plus');
                    oWrap.siblings('.' + oHeader.data('source')).slideUp(200);
                }
                else
                {
                    oHeader.removeClass('plus').addClass('minus');
                    oWrap.parent().find('.' + oHeader.data('source') + ' span.plus').removeClass('plus').addClass('minus');
                    oWrap.siblings('.' + oHeader.data('source')).slideDown(200);
                }
            }
        </script>
        <?php 
    }
    public static function linkedvartabletree($a, $currentDoc, $sParent, $iLevelCount, $iLevel, $aTreeDraw = array())
    {
        $iChildLevel = $iLevel;
        $isTreeLast = false;
        foreach ($a as $sK => $aV) {
            $isTreeLast = $sK == count($a) - 1 ? '\x31' : '\60';
            $aTreeDraw[$iLevel] = $isTreeLast ? '\x30' : '\x31';
            ?>
            <tr class='trow <?php 
            echo $sParent;
            ?>
' id='tr_<?php 
            echo $aV['\x64\141\164\141']['\x69\x64'];
            ?>
'>
                <td <?php 
            echo $currentDoc != $aV['\144\141\x74\141']['\x69\x64'] ? '\163\x74\171\154\x65\75\42\x77\151\x64\x74\x68\72\61\x30\160\x78\x20\x21\x69\155\x70\157\x72\164\x61\156\164\42\40\143\154\x61\x73\x73\x3d\42\164\144\137\146\141\x73\x74\x6f\160\x65\156\42\40\157\x6e\x63\154\151\143\x6b\x3d\42\157\x70\x65\156\115\x6f\144\x61\154\x57\x69\156\x64\x6f\167\50\x27\x2f\167\x6f\162\x6b\x66\154\157\167\57\144\157\143\x75\155\x65\x6e\x74\57\146\x61\163\x74\x2d\166\x69\x65\167\57' . $aV['\144\x61\x74\x61']['\144\157\143\x74\x79\x70\145\x5f\151\144'] . '\57' . $aV['\144\141\164\x61']['\151\x64'] . '\x27\x29\42' : '\163\x74\171\154\x65\75\x22\x77\x69\x64\164\150\x3a\x32\60\160\170\x20\x21\151\x6d\x70\x6f\x72\x74\x61\156\164\42';
            ?>
 >
                    <?php 
            if (!($currentDoc != $aV['\144\x61\164\x61']['\151\x64'])) {
                goto Label_36797;
            }
            ?>
                        <span data-href='/workflow/document/fast-view/<?php 
            echo $aV['\x64\x61\164\141']['\144\157\x63\x74\171\160\145\x5f\151\144'];
            ?>
/<?php 
            echo $aV['\144\141\164\x61']['\151\144'];
            ?>
' class='btn_fastopen'>&nbsp;</span>
                    <?php 
            Label_36797:
            ?>
                </td>
                <?php 
            for ($i = 1; $i < $iLevel; $i++) {
                ?>
                    <td class='tree_grid' >
                        <span class='tree <?php 
                echo $i == $iLevel - 1 ? '\x63\x72\x6f\x73\163' : ($aTreeDraw[$i + 1] ? '\x6c\151\156\x65' : '');
                ?>
 <?php 
                echo $isTreeLast ? '\x6c\x61\163\164' : '';
                ?>
' ></span>
                    </td>
                <?php 
            }
            ?>
                <td class='tree_grid' >
                    <?php 
            if (count($aV['\143\x68\x69\x6c\144\163'])) {
                goto Label_36799;
            }
            ?>
                        <span class='tree <?php 
            if (!($iLevel != 1)) {
                goto Label_36798;
            }
            ?>
gline<?php 
            Label_36798:
            ?>
' ></span>
                    <?php 
            goto Label_36800;
            Label_36799:
            ?>
                        <span href='#' data-source='<?php 
            echo $aV['\x64\x61\x74\141']['\151\144'];
            ?>
' class='tree minus' ></span>
                    <?php 
            Label_36800:
            ?>
                </td>
                <td class='content' colspan='<?php 
            echo $iLevelCount + 2 - $iChildLevel;
            ?>
' >
                    <?php 
            if ($currentDoc != $aV['\x64\x61\x74\x61']['\151\144']) {
                goto Label_36801;
            }
            ?>
                        <span class='content' >
                    <?php 
            goto Label_36802;
            Label_36801:
            ?>
                    <a href='/workflow/document/view/<?php 
            echo $aV['\x64\x61\x74\x61']['\144\157\143\164\x79\x70\145\x5f\151\x64'];
            ?>
/<?php 
            echo $aV['\x64\x61\x74\x61']['\151\x64'];
            echo isset($_GET['\155\171\144\x6f\x63\x75\x6d\145\156\x74\163']) ? '\x3f\155\171\144\157\143\x75\x6d\x65\x6e\164\163' : '';
            ?>
' class='content' >
                        <?php 
            Label_36802:
            $isFirst = true;
            foreach ($aV['\146\x69\145\x6c\x64\x73'] as $sKey => $sValue) {
                ?>
                        <?php 
                echo !$isFirst ? '\x2c\x26\156\142\163\x70' : '';
                echo $sKey;
                ?>
 <?php 
                echo $sValue;
                ?>
                        <?php 
                $isFirst = false;
            }
            if ($currentDoc != $aV['\x64\x61\164\x61']['\x69\144']) {
                goto Label_36803;
            }
            ?>
                    </span>
                <?php 
            goto Label_36804;
            Label_36803:
            ?>
                    </a>
                <?php 
            Label_36804:
            ?>
                </td>
            </tr>
            <?php 
            self::linkedvartabletree($aV['\143\150\151\154\x64\x73'], $currentDoc, $sParent . '\40' . $aV['\144\141\x74\x61']['\151\x64'], $iLevelCount, $iChildLevel + 1, $aTreeDraw);
            ?>
        <?php 
        }
    }
    public static function associatedvarview($a)
    {
        if (count($a['\144\x61\164\141']['\x66\x69\x65\x6c\144\163'])) {
            goto Label_36805;
        }
        return '';
        Label_36805:
        $oL = \app\system\Registry::get('\x6c\x6f\x63\x61\154\145');
        ob_start();
        ?>
        <style>
            #associated_documents_<?php 
        echo $a['\166\141\x72']['\x6e\x61\x6d\x65'];
        ?>
 #bottom_pagination a {float: left;}
        </style>

        <div id='associated_documents_<?php 
        echo $a['\x76\x61\162']['\x6e\141\x6d\145'];
        ?>
' class='field_big_wrap collapsed'>
            <h3 data-loaded='0' >
                <?php 
        echo $oL->get($a['\x76\x61\162']['\x74\151\164\x6c\145'], '\320\x94\xd0\xbe\xd0\xba\xd1\x83\320\274\320\xb5\320\275\xd1\202\321\213', '\320\x9f\320\265\321\200\xd0\xb5\xd0\274\320\xb5\320\xbd\xd0\275\xd1\x8b\320\265', sprintf('\x25\x73\x2d\x25\163\55\164\151\164\x6c\145', $a['\144\157\x63\164\x79\x70\x65\x5f\x69\144'], $a['\x76\x61\162']['\156\x61\x6d\145']));
        ?>
            </h3>
            <div class='inner_wrap' style='display:none;'>
                <div style='overflow: auto;'>
                    <table id='associated_table_<?php 
        echo $a['\166\x61\162']['\156\x61\155\x65'];
        ?>
' border='0' cellpadding='0' cellspacing='0' class='field_table_view' style='max-width:100%; '>
                        <tr class='title'>
                            <td>&nbsp;</td>
                            <td><span><?php 
        echo $oL->get('\xd0\222\xd0\xb8\320\xb4\40\xd1\201\xd0\xb2\321\217\xd0\267\xd0\270');
        ?>
</td>
                            <?php 
        foreach ($a['\x76\x61\162']['\x66\151\x65\x6c\x64\x73'] as $aV) {
            ?>
                                <td><span><?php 
            echo $oL->get($aV['\164\151\164\x6c\x65']);
            ?>
</span></td>
                            <?php 
        }
        ?>
                            <td><span><?php 
        echo $oL->get('\xd0\x9f\xd0\xbe\xd0\273\321\214\xd0\267\320\276\320\xb2\xd0\260\xd1\x82\320\xb5\320\xbb\xd1\x8c\x2c\x20\321\201\320\xbe\xd0\267\320\264\xd0\xb0\320\xb2\321\210\320\xb8\xd0\xb9\40\xd1\x81\xd0\xb2\321\x8f\xd0\267\321\x8c');
        ?>
</td>
                        </tr>
                    </table>
                </div>
                <div style='background-color: #fff;' id='documents_count_info_<?php 
        echo $a['\x76\141\x72']['\156\141\x6d\145'];
        ?>
'>
                    <p id='bottom_pagination' class='clearfix content_bottom_toolbar_inner' style='line-height: 23px;text-shadow: 0 1px 0 #FFFFFF;color:#696969' >
                        <span class='meta_info'><?php 
        echo $oL->get('\320\222\321\x81\320\xb5\xd0\xb3\xd0\xbe\72');
        ?>
 <span><?php 
        echo count($a['\166\x61\162']['\x65\170\164\162\x61\x5f\x66\x69\x65\154\x64\163']);
        ?>
</span></span>
                        <?php 
        $iTotPages = $a['\x76\x61\x72']['\x70\x61\147\145\137\143\x6f\x75\156\164'] > 0 ? $a['\x76\x61\x72']['\x70\141\147\x65\137\143\x6f\x75\156\x74'] : 1;
        $iCurrPage = $a['\166\x61\x72']['\160\x61\147\x65\x5f\156\165\155\142\145\162'];
        ?>
                        <span class='btns'>
                            <?php 
        if (!(4 < $iCurrPage)) {
            goto Label_36806;
        }
        ?>
                                <a href='#' class='btn first'  href='#' onclick='getContent<?php 
        echo $a['\x76\141\162']['\x6e\141\x6d\145'];
        ?>
(0); return false;'></a>
                            <?php 
        Label_36806:
        ?>
                            <?php 
        for ($i = max(0, $iCurrPage - 4); $i < min($iTotPages, $iCurrPage + 5); $i++) {
            ?>
                                <a href='#' class='btn <?php 
            echo $i == $iCurrPage ? '\143\x75\162\x72\145\156\164' : '';
            ?>
' onclick='getContent<?php 
            echo $a['\x76\x61\x72']['\x6e\141\x6d\145'];
            ?>
('<?php 
            echo $i;
            ?>
'); return false;'><?php 
            echo $i + 1;
            ?>
</a>
                            <?php 
        }
        ?>
                            <?php 
        if (!($iCurrPage + 5 < $iTotPages)) {
            goto Label_36807;
        }
        ?>
                                <a href='#' class='btn last' onclick='getContent<?php 
        echo $a['\x76\141\x72']['\x6e\141\x6d\145'];
        ?>
('<?php 
        echo $iTotPages - 1;
        ?>
'); return false;'></a>
                            <?php 
        Label_36807:
        ?>
                        </span>
                        <span class='pages_info'>
                            <?php 
        if (\app\user\Account::getaccount()->getlocale() == '\153\x7a') {
            goto Label_36808;
        }
        ?>
                                <?php 
        echo $iCurrPage + 1;
        ?>
 <?php 
        echo $oL->get('\320\270\320\xb7');
        ?>
 <?php 
        echo $iTotPages;
        ?>
                            <?php 
        goto Label_36809;
        Label_36808:
        ?>
                                <?php 
        echo $iTotPages;
        ?>
  <?php 
        echo $iCurrPage + 1;
        ?>
                            <?php 
        Label_36809:
        ?>
                        </span>
                    </p>
                </div>
            </div>
        </div>
        <script>
            $(document).ready(function() {
                var oWrap = $('#associated_documents_<?php 
        echo $a['\166\x61\x72']['\156\141\155\145'];
        ?>
');
                oWrap.children('h3').unbind('click').bind('click', function()
                {
                    if($(this).data('loaded') == 0)
                    {
                        getContent<?php 
        echo $a['\166\141\162']['\156\x61\x6d\145'];
        ?>
();
                        $(this).data('loaded', 1);
                    }
                });

                <?php 
        echo $a['\x76\141\162']['\151\x73\137\x65\x78\160\x61\x6e\144\x65\144'] ? '\x6f\127\x72\141\x70\x2e\143\x68\151\154\144\162\145\x6e\50\47\150\63\x27\x29\x2e\143\154\151\x63\153\50\51\73' : '';
        ?>
            });

            function getContent<?php 
        echo $a['\166\141\162']['\x6e\141\x6d\145'];
        ?>
(iPage)
            {
                var oThinking = $('#thinking');
                oThinking.show();
                iPage = iPage||0;
                $.get('/workflow/document/associated-document/<?php 
        echo $a['\x64\157\x63\x74\171\x70\145\x5f\x69\144'];
        ?>
/<?php 
        echo $a['\144\157\x63\165\155\x65\x6e\164\137\x69\144'];
        ?>
/<?php 
        echo $a['\166\141\x72']['\156\x61\155\x65'];
        ?>
?p=' + iPage, function(sHtml)
                {
                    iPage++;
                    $('#bottom_pagination a').each(function()
                    {
                        $(this).removeClass('current');
                        if($(this).text() == iPage)
                        {
                            $(this).addClass('current');
                        }
                    });
                    var oWrap = $('#associated_documents_<?php 
        echo $a['\x76\141\162']['\x6e\x61\x6d\145'];
        ?>
');
                    var oInnerWrap = oWrap.children('.inner_wrap');
                    oInnerWrap.find('#associated_table_<?php 
        echo $a['\166\141\162']['\x6e\141\155\x65'];
        ?>
 tr:not(.title)').empty();
                    oInnerWrap.find('#associated_table_<?php 
        echo $a['\x76\141\x72']['\x6e\141\155\145'];
        ?>
').append(sHtml);
                    oWrap.removeClass('collapsed').addClass('expanded');
                    oInnerWrap.slideDown(200);
                    $('#total_count_<?php 
        echo $a['\x76\141\162']['\x6e\141\x6d\145'];
        ?>
').show();
                    oThinking.hide();

                });
            }
        </script>
        <?php 
        $s = ob_get_clean();
        return $s;
    }
    public static function associatedvaredit($a)
    {
        $oL = \app\system\Registry::get('\154\x6f\143\141\x6c\x65');
        $oC = \app\system\Registry::get('\x63\x6f\156\146\x69\x67');
        ob_start();
        ?>
        <style>
            #associated_table_<?php 
        echo $a['\x76\141\162']['\156\141\x6d\145'];
        ?>
 {  }
        </style>
        <p>
            <input id='associated_documents_<?php 
        echo $a['\166\141\162']['\156\x61\155\145'];
        ?>
_button_add' type='button' class='btn btn-sm btn-raised btn-default open_window_btn' value='<?php 
        echo $oL->get('\320\x94\xd0\276\xd0\xb1\xd0\xb0\320\xb2\320\270\xd1\202\321\x8c');
        ?>
'>
        </p>
        <div id='associated_documents_<?php 
        echo $a['\166\x61\162']['\x6e\x61\155\x65'];
        ?>
' class='field_big_wrap expanded'>
            <h3 data-loaded='0' >
                <?php 
        echo $oL->get($a['\x76\141\162']['\164\x69\x74\154\145'], '\xd0\x94\320\xbe\320\272\321\203\320\xbc\320\265\xd0\275\321\202\xd1\213', '\320\237\320\xb5\321\200\320\xb5\xd0\xbc\xd0\xb5\xd0\xbd\320\275\xd1\213\xd0\xb5', sprintf('\x25\x73\x2d\45\x73\x2d\164\151\x74\x6c\x65', $a['\144\157\x63\164\171\x70\145\x5f\x69\144'], $a['\166\x61\x72']['\x6e\141\x6d\x65']));
        ?>
            </h3>
            <div class='inner_wrap'>
                <table id='associated_table_<?php 
        echo $a['\x76\141\x72']['\x6e\141\155\x65'];
        ?>
' border='0' cellpadding='0' cellspacing='0' class='field_table_view' style='max-width:100%; '>
                    <tr class='title'>
                        <td>&nbsp;</td>
                        <td style='min-width:230px;' >
                            <span><?php 
        echo $oL->get('\320\x92\320\270\xd0\xb4\40\321\201\xd0\262\xd1\217\320\xb7\320\xb8');
        ?>
                            <input type='hidden' value='' name='<?php 
        echo $a['\x76\141\x72']['\156\x61\x6d\145'];
        ?>
[0][type]'>
                        </td>
                        <td>
                            <span><?php 
        echo $oL->get('\320\224\xd0\xbe\xd0\272\xd1\203\320\274\320\xb5\xd0\275\xd1\x82');
        ?>
                            <input type='hidden' value='' name='<?php 
        echo $a['\166\x61\162']['\x6e\x61\x6d\145'];
        ?>
[0][document]'>
                        </td>
                        <?php 
        foreach ($a['\x76\x61\x72']['\x66\151\145\x6c\x64\x73'] as $aV) {
            ?>
                            <td><span><?php 
            echo $oL->get($aV['\x74\151\x74\154\x65']);
            ?>
</span></td>
                        <?php 
        }
        ?>
                        <td>
                            <span><?php 
        echo $oL->get('\xd0\237\xd0\xbe\320\xbb\321\x8c\320\267\320\xbe\320\xb2\320\260\321\x82\320\xb5\xd0\273\321\x8c\x2c\40\xd1\201\320\276\320\267\320\264\320\260\xd0\262\xd1\x88\320\xb8\xd0\271\x20\xd1\201\320\262\xd1\217\xd0\267\xd1\x8c');
        ?>
                        </td>
                    </tr>

                    <?php 
        foreach ($a['\x64\141\164\x61']['\146\x69\x65\x6c\x64\163'] as $sK => $aV) {
            $iIter = $sK;
            ?>
                        <tr class='trow' >
                            <td class=' cell_with_canvas' >
                                <span class='btn_remove' >&nbsp;</span>
                            </td>
                            <td class=' cell_with_canvas'>
                                <?php 
            echo \app\reference\REF::referenceedit($a['\x76\141\x72']['\x6e\x61\x6d\x65'] . '\133' . $iIter . '\x5d\x5b\x74\x79\160\x65\135', $a['\166\x61\x72']['\x65\170\x74\162\141\137\146\151\x65\154\144\163'][$sK]['\x74\x79\x70\x65'], array('\162\x65\146\x65\x72\145\x6e\143\x65\137\151\144' => $oC->get('\x72\145\146\x5f\164\x79\160\145\137\154\151\x6e\153'), '\x66\x69\145\x6c\144\x73' => array('\164\x79\x70\x65'), '\x72\x65\x66\x5f\144\x65\146\x61\165\154\x74\x5f\147\162\157\165\x70' => array(), '\x72\145\x66\x5f\144\x65\x66\141\x75\x6c\164\137\146\151\154\x74\145\162' => array(), '\x69\x73\137\163\x69\x6e\147\154\x65' => 1, '\x70\x75\x72\145\x5f\164\145\155\x70\154\x61\x74\x65' => '\164\x79\160\x65', '\x63\157\156\x74\141\151\x6e\145\162' => $a['\x76\x61\162']['\x6e\141\x6d\145'] . '\x5f' . $iIter . '\x5f\164\171\x70\x65'));
            ?>
                            </td>
                            <td class=' cell_with_canvas' >
                                <?php 
            $aFieldDocumentConfig = $a['\166\141\162']['\x64\x6f\x63\165\x6d\145\x6e\164\137\x66\151\x65\x6c\x64\137\143\x6f\x6e\x66\x69\147'] ? $a['\x76\141\x72']['\144\157\143\165\155\145\156\164\x5f\x66\151\145\154\144\x5f\143\157\156\146\x69\x67'] : array('\x64\x6f\143\x74\171\x70\145\x73' => array_keys($a['\166\x61\162']['\x64\x6f\x63\164\171\x70\x65\x73']), '\x69\x73\x5f\163\151\156\x67\154\145' => 1, '\x63\x6f\156\164\x61\x69\x6e\x65\x72' => $a['\166\x61\162']['\156\141\155\x65'] . '\x5f' . $iIter . '\x5f\x64\157\143\165\x6d\x65\156\x74');
            $aFieldDocumentConfig['\x63\x6f\x6e\164\141\x69\156\x65\162'] = $a['\x76\141\162']['\x6e\x61\x6d\x65'] . '\137' . $iIter . '\x5f\x64\x6f\x63\x75\155\x65\x6e\x74';
            ?>
                                <?php 
            echo \app\reference\REF::documentedit($a['\x76\141\162']['\156\141\x6d\x65'] . '\x5b' . $iIter . '\135\x5b\x64\x6f\143\x75\x6d\x65\x6e\164\x5d', $a['\166\x61\x72']['\145\170\x74\162\141\x5f\146\151\145\x6c\x64\x73'][$sK]['\x64\x6f\x63\165\x6d\145\156\164'], $aFieldDocumentConfig);
            ?>
                            </td>
                            <?php 
            foreach ($aV as $sKey => $oVal) {
                if (!($sKey === 0 || $sKey === 1)) {
                    goto Label_36810;
                }
                continue;
                Label_36810:
                ?>
                                <td class=' cell_with_canvas' >
                                    <span><?php 
                echo $oVal['\151\x73\x56\x61\x6c\x75\x65'] ? $oVal['\x76\141\154\165\x65']->getgridvalue() : '';
                ?>
</span>
                                </td>
                            <?php 
            }
            ?>
                        </tr>
                    <?php 
        }
        ?>
                </table>
                <div style='background-color: #fff;' id='documents_count_info_<?php 
        echo $a['\166\x61\x72']['\x6e\x61\x6d\145'];
        ?>
'>
                    <p style='line-height: 23px;text-shadow: 0 1px 0 #FFFFFF;color:#696969'>
                        <?php 
        echo $oL->get('\320\x92\xd1\201\320\xb5\320\263\xd0\276\x3a');
        ?>
                        <span id='total_count_<?php 
        echo $a['\x76\141\x72']['\x6e\141\155\x65'];
        ?>
'><?php 
        echo count($a['\x76\141\162']['\x65\170\164\162\141\x5f\x66\x69\x65\154\x64\163']);
        ?>
</span>
                    </p>
                </div>
            </div>
        </div>
        <script>
            $(document).ready(function() {
                var oButtonAdd = $('#associated_documents_<?php 
        echo $a['\166\141\162']['\156\141\155\145'];
        ?>
_button_add');
                oButtonAdd.unbind('click').bind('click', function()
                {
                    var iNumber = $('#associated_table_<?php 
        echo $a['\166\141\x72']['\156\x61\x6d\x65'];
        ?>
 tr').size() - 1;

                    $.get('/workflow/document/associated-document-modify/add/<?php 
        echo $a['\144\157\143\x74\171\x70\x65\137\151\144'];
        ?>
/<?php 
        echo $a['\x76\x61\162']['\156\141\155\x65'];
        ?>
/' + iNumber, function(sHtml)
                    {
                        $('#associated_table_<?php 
        echo $a['\x76\141\162']['\156\141\x6d\x65'];
        ?>
').append(sHtml);
                        associated_table_<?php 
        echo $a['\x76\141\162']['\156\141\x6d\x65'];
        ?>
_bind();
                    });
                });

                associated_table_<?php 
        echo $a['\x76\x61\162']['\156\141\155\x65'];
        ?>
_bind();
            });

            function associated_table_<?php 
        echo $a['\166\141\x72']['\156\141\x6d\145'];
        ?>
_bind()
            {
                $('#associated_table_<?php 
        echo $a['\x76\141\162']['\156\141\x6d\x65'];
        ?>
 .btn_remove').unbind('click').bind('click', function()
                {
                    $(this).parent().parent().remove();
                });
            }

        </script>
        <?php 
        $s = ob_get_clean();
        return $s;
    }
    public static function associatedvareditadd($sVarName, $iNumber, $iCount, $aDoctypes, $aDConfig)
    {
        $aDConfig = array();
        $iIter = $iNumber + 1;
        $oL = \app\system\Registry::get('\154\x6f\x63\x61\154\x65');
        $oC = \app\system\Registry::get('\143\157\156\x66\151\x67');
        ob_start();
        ?>
        <tr class='trow' >
            <td class=' cell_with_canvas' >
                <span class='btn_remove'><i class='fa fa-times' aria-hidden='true'></i></span>
            </td>
            <td class=' cell_with_canvas' >
                <?php 
        echo \app\reference\REF::referenceedit($sVarName . '\133' . $iIter . '\x5d\133\x74\x79\x70\x65\x5d', array(), array('\x72\145\146\145\162\x65\x6e\x63\145\137\151\144' => $oC->get('\162\145\x66\137\x74\x79\x70\145\137\154\x69\x6e\153'), '\146\151\x65\x6c\x64\163' => array('\164\171\160\145'), '\x72\x65\146\137\144\145\x66\141\165\x6c\164\137\x67\x72\x6f\165\x70' => array(), '\x72\x65\x66\137\x64\x65\x66\x61\x75\154\x74\137\146\x69\x6c\164\145\x72' => array(), '\x69\x73\137\163\151\156\147\x6c\145' => 0, '\x70\165\x72\145\137\164\145\155\160\154\141\164\145' => '\164\171\160\x65', '\x63\x6f\156\164\x61\151\156\x65\162' => $sVarName . '\x5f' . $iIter . '\137\x74\x79\x70\145'));
        ?>
            </td>
            <td class=' cell_with_canvas' >
                <?php 
        $aFieldDocumentConfig = $aDConfig ? $aDConfig : array('\x64\x6f\143\x74\171\x70\x65\x73' => $aDoctypes, '\151\x73\137\163\x69\156\x67\154\145' => 1, '\143\x6f\156\x74\x61\x69\x6e\x65\x72' => $sVarName . '\137' . $iIter . '\137\144\157\x63\x75\x6d\145\x6e\164');
        $aFieldDocumentConfig['\143\x6f\156\x74\141\151\156\x65\162'] = $sVarName . '\x5f' . $iIter . '\x5f\144\157\x63\165\155\x65\156\x74';
        ?>
                <?php 
        echo \app\reference\REF::documentedit($sVarName . '\x5b' . $iIter . '\135\133\144\x6f\x63\165\155\145\156\164\135', array(), $aFieldDocumentConfig);
        ?>
            </td>
            <?php 
        for ($i = 0; $i < $iCount + 1; $i++) {
            ?>
                <td class=' cell_with_canvas' >
                    <span></span>
                </td>
            <?php 
        }
        ?>
        </tr>
        <?php 
        $s = ob_get_clean();
        return $s;
    }
    public static function associatedvarviewtablecontent($a, $aConfig)
    {
        $iN = 0;
        foreach ($a['\x66\x69\145\154\144\x73'] as $aV) {
            $iN++;
            $aDocument = explode('\72', key($aV[1]['\166\x61\154\165\145']->get()));
            ?>
            <tr class='trow' >
                <td class=' cell_with_canvas td_fastopen' onclick='openModalWindow('/workflow/document/fast-view/<?php 
            echo $aDocument[0];
            ?>
/<?php 
            echo $aDocument[1];
            ?>
')' >
                    <span class='btn_fastopen'></span>
                </td>
                <?php 
            foreach ($aV as $sKey => $oVal) {
                if ($oVal['\151\163\126\x69\163\x69\142\154\145']) {
                    goto Label_36811;
                }
                continue;
                Label_36811:
                ?>
                    <td class=' cell_with_canvas' >
                        <span><?php 
                echo $oVal['\x69\163\x56\141\x6c\x75\x65'] ? $oVal['\166\141\154\165\x65']->getgridvalue() : '';
                ?>
</span>
                    </td>
                <?php 
            }
            ?>
            </tr>
            <?php 
            if (!($iN == $aConfig['\x72\x6f\167\137\157\x6e\137\x70\x61\147\145'])) {
                goto Label_36812;
            }
            break;
            Label_36812:
        }
        ?>
        <script>
            $(document).ready(function() {
                var oWrap = $('#associated_documents_<?php 
        echo $aConfig['\156\141\x6d\145'];
        ?>
');

                oWrap.children('h3').unbind('click').bind('click', function()
                {
                    headerToggle<?php 
        echo $aConfig['\156\141\x6d\145'];
        ?>
($(this));
                });

                var oInnerWrap = oWrap.children('.inner_wrap');

                var delay = (function()
                {
                    var timer = 0;
                    return function(callback, ms) {
                        clearTimeout(timer);
                        timer = setTimeout(callback, ms);
                    };
                })();

                oWrap.find('#search_bar').find('.field_keyword')
                    .focus(function()
                    {
                        oWrap.children('h3').unbind('click');
                    })
                    .blur(function()
                    {
                        oWrap.children('h3').click(function()
                        {
                            headerToggle<?php 
        echo $aConfig['\x6e\141\155\145'];
        ?>
($(this));
                        })
                    }).keyup(function()
                {
                    //canceling previous ajax request
                    if (typeof ajaxQSRequest == 'object') {
                        ajaxQSRequest.abort();
                    }

                    var sQs = $(this).val();
                    delay(function() {
                        if(sQs.length == 0)
                        {
                            $('#associated_table_<?php 
        echo $aConfig['\x6e\141\x6d\x65'];
        ?>
').show();
                            return;
                        }else if (sQs.length < 3 && sQs.length > 0)
                        {
                            return;
                        }

                        var oThinking = $('#thinking');
                    }, 500); //<-keyUp TimeOut
                });
            });

            var ajaxQSRequest;

            function headerToggle<?php 
        echo $aConfig['\156\141\155\x65'];
        ?>
(oHeader)
            {
                var oDocCountInfo = oHeader.siblings('#documents_count_info_<?php 
        echo $aConfig['\156\x61\155\x65'];
        ?>
');
                var oWrap = oHeader.parent();
                var oInnerWrap = oWrap.children('.inner_wrap');
                if (oWrap.hasClass('collapsed'))
                {
                    oWrap.removeClass('collapsed').addClass('expanded');
                    oInnerWrap.slideDown(200);
                    oDocCountInfo.show();
                }
                else
                {
                    oWrap.removeClass('expanded').addClass('collapsed');
                    oInnerWrap.slideUp(200);
                    oDocCountInfo.hide();
                }
            }
        </script>
        <?php 
    }
    public static function variablevar($a, $sDoctypeId, $sDocumentId, $isAjaxRequest = false)
    {
        $oL = \app\system\Registry::get('\x6c\157\x63\141\154\x65');
        $bFastEdit = \app\system\Registry::get('\x63\157\x6e\146\x69\x67')->get('\162\145\x6c\x5f\144\157\x63\137\146\x61\x73\x74\137\145\144\x69\x74\x5f\141\156\x64\137\x76\151\x65\x77');
        ob_start();
        $sHiddenDescription = current(a($a['\166\141\162'], '\150\151\x64\144\x65\x6e\x5f\144\x65\163\x63\162\x69\x70\164\151\157\x6e', array()));
        $isHierarchical = false;
        foreach ($a['\166\x61\162']['\x66\151\x65\154\144\163'] as $aV) {
            if (!$aV['\x68\151\x65\162\141\x72\x63\x68\151\143\x61\x6c']) {
                goto Label_36813;
            }
            $isHierarchical = true;
            Label_36813:
        }
        $a['\x76\141\x72']['\150\151\145\x72\x61\162\143\x68\x69\x63\141\x6c'] = $isHierarchical;
        ?>

        <?php 
        if ($isAjaxRequest) {
            goto Label_36816;
        }
        ?>


        <div id='variable_doctypes_list_<?php 
        echo $a['\x76\141\x72']['\x6e\x61\x6d\x65'];
        ?>
' class='drop-down-list-v2' style='display: none;'>
            <!--<input class='drop-down-list-search' type='text' style='width: 100%; box-sizing: border-box;' placeholder='...'>-->
            <div class='drop-down-list-body'>
                <?php 
        foreach ($a['\166\x61\162']['\144\157\x63\x74\171\x70\x65\x73'] as $sKey => $aDoctype) {
            ?>
                    <div class='drop-down-list-item' data-value='<?php 
            echo $sKey;
            ?>
'><?php 
            echo $aDoctype['\164\151\164\x6c\x65'];
            ?>
</div>
                <?php 
        }
        ?>
            </div>
        </div>

    <input type='hidden' id='page_count_<?php 
        echo $a['\x76\141\162']['\x6e\141\155\145'];
        ?>
' value='1' />
        <style>
            table.field_table_view.execution_table tr {
                border: none;
            }
            table.field_table_view.execution_table span.tree {
                font-size: 16px;
            }
            table.field_table_view.execution_table span.tree.plus:before {
                content: '\f0da';
            }
            table.field_table_view.execution_table span.tree.minus:before {
                content: '\f0d7';
            }
            table.field_table_view.execution_table tr:not(.title) td {
                overflow: initial;
                position: relative;
            }
            table.field_table_view.execution_table tr:not(.title):hover {
                background-color: #f5f5f5;
            }
            table.field_table_view.execution_table span.tree.minus {
                color: #0d47a1;
            }
            table.field_table_view.execution_table span.tree.minus:after {
                content: '';
                position: absolute;
                width: 1px;
                height: 100%;
                border-left: 2px solid;
                top: 22px;
                margin-left: 3px;
            }
            table.field_table_view.execution_table span.tree.gline {
                width: 6px;
                height: 6px;
                background-color: #0d47a1;
                display: inline-block;
                border-radius: 50%;
                margin-top: 7px;
            }
            table.field_table_view.execution_table tr td .tree_grid.tree_grid_last {

            }
            table.field_table_view.execution_table tr td .tree_grid.tree_grid_v_line:before {
                content: '';
                position: absolute;
                top: 0;
                bottom: 0;
                width: 2px;
                background-color: #0d47a1;
                margin-left: 3px;
            }
            table.field_table_view.execution_table tr td .tree_grid.tree_grid_last:before {
                content: '';
                width: 12px;
                height: 1px;
                border-top: 2px solid #0d47a1;
                display: inline-block;
                top: 14px;
                position: absolute;
                margin-left: 3px;
            }
            table.field_table_view.execution_table tr td .tree_grid.tree_grid_last:after {
                content: '';
                width: 1px;
                height: 15px;
                border-left: 2px solid #0d47a1;
                display: inline-block;
                top: 1px;
                position: absolute;
                margin-left: 3px;
            }
            table.field_table_view.execution_table tr td .tree_grid.tree_grid_last.tree_grid_has_siblings:after {
                height: 100%;
            }
        </style>
        <table id='variable_table_<?php 
        echo $a['\x76\141\x72']['\x6e\x61\155\x65'];
        ?>
' border='0' cellpadding='0' cellspacing='0' class='field_table_view execution_table plain CRZ' style='width:100%;'>
            <tr class='title'>
                <?php 
        $iIter = 1;
        foreach ($a['\x76\141\x72']['\x66\x69\145\x6c\144\163'] as $sK1 => $aV1) {
            if (!($sHiddenDescription == $sK1)) {
                goto Label_36814;
            }
            continue;
            Label_36814:
            ?>
                    <td  style='width:<?php 
            echo $aV1['\x77\151\x64\164\150'];
            ?>
%;' title='<?php 
            echo v($oL->get($aV1['\x74\x69\x74\154\x65'], '\xd0\x94\320\276\320\xba\xd1\x83\320\xbc\xd0\xb5\320\275\321\202\321\213', '\320\x9f\xd0\265\321\x80\320\265\xd0\xbc\320\265\320\275\320\xbd\xd1\x8b\320\265\x20\55\x20\xd0\277\xd0\276\320\273\xd1\217', sprintf('\x25\163\x2d\45\x73\55\45\163\x2d\x74\x69\164\154\x65', $a['\x64\157\x63\164\171\160\x65\x5f\151\x64'], $a['\166\141\162']['\156\141\155\x65'], $sK1)));
            ?>
'><?php 
            echo v($oL->get($aV1['\164\151\164\154\145'], '\320\x94\xd0\xbe\xd0\xba\xd1\x83\320\274\320\265\xd0\275\xd1\x82\321\x8b', '\320\x9f\320\265\xd1\200\xd0\265\320\xbc\320\xb5\320\275\xd0\xbd\321\213\320\xb5\40\x2d\40\xd0\xbf\320\xbe\320\xbb\xd1\217', sprintf('\45\163\x2d\45\163\x2d\x25\x73\55\164\151\164\154\x65', $a['\x64\157\x63\x74\171\160\x65\x5f\x69\144'], $a['\x76\x61\x72']['\156\141\155\145'], $sK1)));
            ?>
</td>
                    <?php 
            $iIter++;
        }
        ?>

                <?php 
        $sStyle = '\x77\x69\144\164\150\72\40\62\64\x70\x78\x20\x21\x69\x6d\x70\157\162\x74\141\156\164\73';
        
        ?>
                <td style='<?php 
        echo $sStyle;
        ?>
'><?php 
        if (!($bFastEdit && $a['\x76\141\x72']['\x66\x61\163\x74\x5f\145\144\x69\164'])) {
            goto Label_36815;
        }
        ?>
                        <span style='margin: 0px 1px;' class='btn_fast_create' onclick='createRelatedDocument<?php 
        echo $a['\x76\141\x72']['\156\141\155\x65'];
        ?>
(this, '<?php 
        echo $sDocumentId;
        ?>
', '<?php 
        echo $a['\x64\x6f\x63\x74\x79\x70\145\x5f\151\144'];
        ?>
')'> </span>
                    <?php 
        Label_36815:
        ?>
</td>
            </tr>
            <?php 
        Label_36816:
        ?>
            <?php 
        $sEnum = '\x66\x5f\x66\61\60\x36\66\x66';
        $sGoupingLvl2 = '\146\137\143\61\143\x36\x34\143';
        $mTmp = current($a['\x64\141\164\141']);
        if ($bFastEdit && $a['\x76\x61\162']['\146\x61\163\x74\x5f\x65\144\x69\x74'] && isset($mTmp[$sEnum])) {
            goto Label_36836;
        }
        self::variablevartabletr($a, $a['\144\141\164\141'], $sDocumentId, $a['\x6f\146\x66\163\x65\x74'], $a['\154\x69\155\151\164'], 0);
        goto Label_36837;
        Label_36836:
        $a['\154\x69\x6d\x69\x74'] = array();
        $aRef = array();
        foreach (\app\system\model\ListModel::getlist('\x72\145\x66\x5f\144\157\143\x5f\142\x31\141\x33\61\x39\62')->bind(array('\146\151\x65\154\x64\163' => '\151\x64\54\x20\x66\137\x38\x31\141\141\x66\x65\141\133\x32\x5d\133\x31\135\40\141\x73\40\163\x74\x61\x74\165\163'))->find()->getdata() as $aRow) {
            $aRef[$aRow['\x69\144']] = $aRow['\x73\x74\x61\x74\165\163'];
        }
        $aGroupData = array('\116\x65\167\x69\x6e\x74\164\x65\x63\150' => array(), '\113\x61\172\x44\157\143\x20\x54\x65\x63\x68\x6e\x6f\x6c\157\x67\x79' => array());
        $iCounts = array();
        foreach ($a['\144\141\x74\x61'] as $sID => $aRow) {
            $mGV = implode('\x2c', \app\reference\engine\ArrayMapperUtil::unserialize($aRow[$sEnum]));
            $mGV2 = key(\app\reference\engine\ArrayMapperUtil::unserialize($aRow[$sGoupingLvl2]));
            $mGV2 = a($aRef, $mGV2, '');
            $aGroupData[$mGV][$mGV2][$sID] = $aRow;
            foreach ($a['\166\x61\x72']['\x66\x69\x65\x6c\144\x73'] as $sName => $aField) {
                if (!($aField['\164\171\160\x65'] == '\151\x6e\x74\145\147\145\162' || $aField['\x74\x79\x70\145'] == '\146\154\x6f\141\164')) {
                    goto Label_36818;
                }
                if (isset($iCounts[$mGV][$mGV2][$sName])) {
                    goto Label_36817;
                }
                $iCounts[$mGV][$mGV2][$sName] = 0;
                Label_36817:
                $iCounts[$mGV][$mGV2][$sName] += $aRow[$sName];
                Label_36818:
            }
        }
        foreach ($aGroupData as $sGroupL1 => $aGroupL1) {
            ksort($aGroupL1);
            $aGroupData[$sGroupL1] = $aGroupL1;
        }
        $aTotal = array();
        foreach ($aGroupData as $sGroupL1 => $aGroupL1) {
            if (!empty($aGroupL1)) {
                goto Label_36819;
            }
            continue;
            Label_36819:
            echo '\x3c\164\x72\40\143\154\141\163\163\x3d\x22\x74\162\x6f\x77\40\x63\x6f\155\160\141\156\x79\x22\x3e\74\164\144\x3e\74\x2f\x74\x64\76';
            $iIter = 1;
            foreach ($a['\x76\141\x72']['\146\151\x65\154\144\163'] as $sK1 => $aV1) {
                if (!($sHiddenDescription == $sK1)) {
                    goto Label_36820;
                }
                continue;
                Label_36820:
                $sValue = '';
                if (!($iIter++ == 1)) {
                    goto Label_36821;
                }
                $sValue = $sGroupL1;
                Label_36821:
                if (!isset($iCounts[$sGroupL1])) {
                    goto Label_36826;
                }
                $sTotal = 0;
                foreach ($iCounts[$sGroupL1] as $aV2) {
                    if (!isset($aV2[$sK1])) {
                        goto Label_36822;
                    }
                    $sTotal += $aV2[$sK1];
                    Label_36822:
                }
                $sTotal = number_format($sTotal, 0, '\x2c', '\x20');
                $sTotal = $sTotal == 0 ? '' : $sTotal;
                if (empty($sTotal)) {
                    goto Label_36825;
                }
                if ($sValue == $sGroupL1) {
                    goto Label_36823;
                }
                $sValue = $sTotal;
                goto Label_36824;
                Label_36823:
                $sValue .= '\x20\50' . $sTotal . '\51';
                Label_36824:
                Label_36825:
                Label_36826:
                echo '\74\164\144\76' . $sValue . '\x3c\57\164\144\x3e';
            }
            echo '\74\57\164\x72\76';
            foreach ($aGroupL1 as $sGroupL2 => $aGroupL2) {
                if (!empty($aGroupL2)) {
                    goto Label_36827;
                }
                continue;
                Label_36827:
                echo '\74\x74\x72\40\143\154\x61\163\x73\75\42\x74\x72\x6f\x77\x20\x63\141\164\141\x6c\x6f\x67\42\x3e\74\x74\144\76\x3c\x2f\164\144\76';
                $iIter = 1;
                foreach ($a['\166\x61\x72']['\146\151\x65\154\144\163'] as $sK1 => $aV1) {
                    if (!($sHiddenDescription == $sK1)) {
                        goto Label_36828;
                    }
                    continue;
                    Label_36828:
                    $sValue = '';
                    if (!isset($iCounts[$sGroupL1][$sGroupL2][$sK1])) {
                        goto Label_36830;
                    }
                    if (isset($aTotal[$sK1])) {
                        goto Label_36829;
                    }
                    $aTotal[$sK1] = 0;
                    Label_36829:
                    $aTotal[$sK1] += $iCounts[$sGroupL1][$sGroupL2][$sK1];
                    $sValue = number_format($iCounts[$sGroupL1][$sGroupL2][$sK1], 0, '\x2c', '\40');
                    $sValue = $sValue == 0 ? '' : $sValue;
                    Label_36830:
                    if (!($iIter++ == 1)) {
                        goto Label_36831;
                    }
                    $sValue = empty($sValue) ? $sGroupL2 : $sGroupL2 . '\40\x28' . $sValue . '\51';
                    Label_36831:
                    echo '\x3c\x74\x64\76' . $sValue . '\x3c\x2f\x74\x64\x3e';
                }
                echo '\74\x2f\x74\x72\76';
                self::variablevartabletr($a, $aGroupL2, $sDocumentId, $a['\157\x66\x66\x73\x65\164'], $a['\x6c\x69\x6d\x69\x74'], 0);
            }
        }
        $iIter = 1;
        echo '\74\164\x72\40\143\154\x61\x73\163\75\x22\164\x72\x6f\x77\40\164\x6f\164\x61\154\42\x3e\74\164\x64\76\74\57\164\144\x3e';
        foreach ($a['\166\141\162']['\146\151\145\x6c\144\163'] as $sK1 => $aV1) {
            if (!($sHiddenDescription == $sK1)) {
                goto Label_36832;
            }
            continue;
            Label_36832:
            $sValue = '';
            if (!($iIter++ == 1)) {
                goto Label_36833;
            }
            $sValue = '\xd0\222\xd1\x81\320\265\xd0\263\xd0\276\x3a';
            Label_36833:
            $sTotal = '';
            foreach ($aTotal as $sK2 => $iV) {
                if (!($sK2 == $sK1)) {
                    goto Label_36834;
                }
                $sTotal = number_format($iV, 0, '\x2c', '\40');
                Label_36834:
                if (empty($sTotal)) {
                    goto Label_36835;
                }
                $sValue = $sValue == '\320\x92\xd1\201\xd0\265\xd0\263\xd0\xbe\72' ? $sValue . '\x20' . $sTotal : $sTotal;
                Label_36835:
            }
            echo '\x3c\x74\x64\x3e' . $sValue . '\x3c\x2f\164\144\76';
        }
        echo '\74\x2f\x74\x72\76';
        Label_36837:
        ?>
            <!-- dasd -->
            <?php 
        if ($isAjaxRequest) {
            goto Label_36843;
        }
        ?>
        </table>
        <?php 
        if (!($a['\x64\141\x74\x61\137\143\157\165\156\164'] > $a['\154\x69\155\151\164'])) {
            goto Label_36838;
        }
        ?>
        <div class='load-next_<?php 
        echo $a['\166\141\162']['\x6e\x61\155\145'];
        ?>
' onclick='loadNext_<?php 
        echo $a['\x76\141\x72']['\156\141\155\145'];
        ?>
(this, <?php 
        echo $a['\x6c\151\155\151\x74'];
        ?>
);'><?php 
        echo $oL->get('\xd0\227\320\xb0\xd0\263\321\x80\321\203\320\267\xd0\xb8\xd1\x82\321\x8c\x20\xd0\xb5\321\x89\320\265\56\56\x2e');
        ?>
</div>
    <?php 
        Label_36838:
        ?>
        <div style='background-color: #fff;' id='documents_count_info_<?php 
        echo $a['\166\141\162']['\156\x61\155\x65'];
        ?>
'>
            <p style='line-height: 23px;text-shadow: 0 1px 0 #FFFFFF;color:#696969'>
                <?php 
        echo $oL->get('\320\x92\321\x81\xd0\xb5\xd0\xb3\320\276\72');
        ?>
                <span id='total_count_<?php 
        echo $a['\x76\141\162']['\156\x61\155\x65'];
        ?>
'><?php 
        echo $a['\164\x6f\164\141\x6c\137\143\x6f\165\x6e\164'];
        ?>
,</span>
                </span>
                <span id='on_page_count_<?php 
        echo $a['\166\141\162']['\x6e\x61\155\x65'];
        ?>
'>
								<?php 
        echo $oL->get('\320\xbd\xd0\260\40\321\201\321\x82\321\200\xd0\260\320\xbd\320\xb8\xd1\206\xd0\265');
        ?>
								<span id='display_count_<?php 
        echo $a['\166\141\162']['\156\x61\155\145'];
        ?>
'><?php 
        echo $a['\x64\151\163\160\154\141\x79\137\143\157\x75\156\x74'];
        ?>
</span>
						</span>
            </p>
        </div>

        <script type='text/javascript'>
            /* <![CDATA[ */
            function loadNext_<?php 
        echo $a['\166\x61\x72']['\156\x61\x6d\145'];
        ?>
(el, limit) {
                var offLimitEls = $('#variable_table_<?php 
        echo $a['\166\141\162']['\156\141\155\145'];
        ?>
 tr.off-limit').slice(0, limit);
                if(offLimitEls.length) {
                    offLimitEls.removeClass('off-limit').show();
                    $('#display_count_<?php 
        echo $a['\166\141\162']['\156\141\x6d\x65'];
        ?>
').text(+$('#display_count_<?php 
        echo $a['\166\141\x72']['\156\x61\155\145'];
        ?>
').text() + offLimitEls.length);
                    if(!$('#variable_table_<?php 
        echo $a['\166\x61\x72']['\x6e\x61\x6d\145'];
        ?>
 tr.off-limit').length) {
                        $(el).hide();
                    }
                }
            }

            function createRelatedDocument<?php 
        echo $a['\166\x61\x72']['\x6e\x61\x6d\145'];
        ?>
(element, sDocID, sParentDoctypeId) {
                var sDoctypeId = '<?php 
        echo $a['\x64\x6f\x63\x74\171\160\145\137\x69\144'];
        ?>
';

                $('#variable_doctypes_list_<?php 
        echo $a['\166\141\162']['\x6e\141\x6d\x65'];
        ?>
 .drop-down-list-item').unbind('click').click(function(){
                    var sUrl = '/workflow/document/fast-create/<?php 
        echo $a['\x64\157\143\x74\171\x70\145\x5f\151\144'];
        ?>
/<?php 
        echo $a['\x76\x61\162']['\156\141\x6d\x65'];
        ?>
/' + sParentDoctypeId + '/' + sDocID + '/' + $(this).attr('data-value');

                    var oChildWin = msf.actionWindow.view(sUrl, {}, element);

                });

                iCount = $('#variable_doctypes_list_<?php 
        echo $a['\166\x61\x72']['\156\141\155\145'];
        ?>
 .drop-down-list-item').length;
                if (iCount == 1) {
                    $('#variable_doctypes_list_<?php 
        echo $a['\166\141\162']['\156\141\x6d\145'];
        ?>
 .drop-down-list-item').click();
                } else {
                    $('#variable_doctypes_list_<?php 
        echo $a['\166\x61\x72']['\156\141\x6d\x65'];
        ?>
').popup($(element));
                }
            }

            function deleteTree<?php 
        echo $a['\x76\x61\162']['\156\141\155\145'];
        ?>
(sDoctypeId, sDocumentId) {
                var sParentSelector = '#variable_table_<?php 
        echo $a['\x76\x61\x72']['\x6e\141\x6d\145'];
        ?>
';

                iResult = confirm('        ?');

                if (!iResult) {
                    return false;
                }

                $.ajax({
                    url: '/workflow/delete-from-rel-tree/'+ sDoctypeId +'/'+ sDocumentId,
                    type: 'get',
                    dataType: 'json',
                    success: function(aData){
                        if (aData['status'] == 1){
                            MSF_StatusBar.showSuccess(aData['message']);
                            updateRelDocsTable<?php 
        echo $a['\166\141\162']['\x6e\x61\x6d\145'];
        ?>
();
                        } else {
                            MSF_StatusBar.showError('');
                        }
                    }
                });
            }

            function loadRelatedDocuments<?php 
        echo $a['\x76\141\x72']['\x6e\x61\x6d\145'];
        ?>
(sDoctypeId,sDocumentId,sVariableName){
                var oSpinner = $('#loadRelatedDocuments<?php 
        echo $a['\166\141\x72']['\156\141\x6d\x65'];
        ?>
').find('img');
                oSpinner.show();
                var iP = $('#page_count_<?php 
        echo $a['\x76\141\x72']['\156\141\x6d\x65'];
        ?>
').val();
                var sQs = $('#related_documents_<?php 
        echo $a['\x76\x61\162']['\156\141\155\145'];
        ?>
').find('.field_keyword').val();
                $.get('/workflow/document/related-document/' + sDoctypeId + '/' + sDocumentId + '/' + sVariableName + '?is_ajax=1&qs='+sQs+'&p='+ iP + '<?php 
        echo isset($_GET['\155\x79\x64\x6f\x63\x75\155\x65\156\164\x73']) ? '\x26\155\171\144\x6f\x63\165\x6d\x65\x6e\164\x73' : '';
        ?>
',function(sHtml){
                    $('#variable_table_<?php 
        echo $a['\x76\x61\162']['\x6e\141\155\x65'];
        ?>
')
                        .find('tbody')
                        // .find('#loadDocuments<?php 
        echo $a['\x76\x61\x72']['\x6e\x61\x6d\x65'];
        ?>
')
                        // .remove()
                        // .end()
                        .append(sHtml);
                    $('#loadRelatedDocuments<?php 
        echo $a['\166\x61\x72']['\x6e\141\x6d\145'];
        ?>
').addClass('loaded');
                    window.<?php 
        echo $a['\166\x61\162']['\156\141\x6d\145'];
        ?>
Hook();
                    oSpinner.hide();
                    $('#page_count_<?php 
        echo $a['\166\x61\x72']['\x6e\141\x6d\145'];
        ?>
').val(parseInt(iP)+1);
                });
            }

            function headerToggle<?php 
        echo $a['\166\141\162']['\156\x61\x6d\145'];
        ?>
(oHeader)
            {
                var oDocCountInfo = oHeader.siblings('#documents_count_info_<?php 
        echo $a['\166\x61\x72']['\x6e\141\155\145'];
        ?>
');
                var oWrap = $('#related_documents_<?php 
        echo $a['\x76\x61\162']['\x6e\141\x6d\x65'];
        ?>
');
                var oInnerWrap = oWrap.children('.inner_wrap');
                if (oWrap.hasClass('collapsed'))
                {
                    oWrap.removeClass('collapsed').addClass('expanded');
                    oInnerWrap.slideDown(200);
                    oDocCountInfo.show();
                }
                else
                {
                    oWrap.removeClass('expanded').addClass('collapsed');
                    oInnerWrap.slideUp(200);
                    oDocCountInfo.hide();
                }
            }
            var delay = (function() {
                var timer = 0;
                return function(callback, ms) {
                    clearTimeout(timer);
                    timer = setTimeout(callback, ms);
                };
            })();
            var ajaxQSRequest;
            $(document).ready(function() {
                setTimeout(function(){
                    $('#variable_table_<?php 
        echo $a['\166\x61\162']['\x6e\x61\x6d\x65'];
        ?>
 .execution_table .structureView_view_user_info').each(function(){
                        $(this).parents('td').eq(0).width() < $(this).width() ? $(this).width($(this).parents('td').eq(0).width()).children('.sV_user_info__inner').css('max-width', '100%') : '';
                    });
                },500);
                //var oFT = new MSF_FieldTable('#variable_table_<?php 
        echo $a['\166\x61\x72']['\156\x61\155\x65'];
        ?>
',null);
                var oWrap = $('#related_documents_<?php 
        echo $a['\x76\x61\x72']['\x6e\141\155\145'];
        ?>
');
                oWrap.children('h3').unbind('click').bind('click',function()
                {
                    headerToggle<?php 
        echo $a['\x76\141\162']['\x6e\x61\x6d\x65'];
        ?>
($(this));
                });
                $('#iconBtnIdForSearchAndDelete<?php 
        echo $a['\x76\x61\x72']['\x6e\141\x6d\x65'];
        ?>
').click(function(){
                    var e = $(this);
                    e.addClass('iconBtnForSearching').removeClass('iconBtnForDelete');
                    oWrap.find('#search_bar').find('.field_keyword').val('');
                    oWrap.find('#search_bar').find('.field_keyword').keyup();
                    return false;
                });
                var oInnerWrap = oWrap.children('.inner_wrap');
                oWrap.find('#search_bar').find('.export_button').click(function()
                {
                    oWrap.children('h3').unbind('click');
                }).mouseout(function(){
                    oWrap.children('h3').unbind('click').bind('click',function(){
                        headerToggle<?php 
        echo $a['\x76\141\x72']['\x6e\x61\155\x65'];
        ?>
($(this));
                    });
                });

                oWrap.find('#search_bar').find('.field_keyword').focus(function()
                {
                    oWrap.children('h3').unbind('click');
                })
                    .blur(function()
                    {
                        oWrap.children('h3').unbind('click').bind('click',function()
                        {
                            headerToggle<?php 
        echo $a['\x76\141\162']['\x6e\x61\x6d\145'];
        ?>
($(this));
                        });
                    }).keyup(function () {
                    // canceling previous ajax request
                    if (typeof ajaxQSRequest === 'object') {
                        ajaxQSRequest.abort();
                    }

                    var sQs = $(this).val();

                    delay(function () {
                        if (sQs.length < 3 && sQs.length > 0) { return; }

                        var oThinking = $('#thinking');
                        oThinking.show();

                        var oTable<?php 
        echo $a['\x76\141\162']['\x6e\141\155\145'];
        ?>
 = $('#variable_table_<?php 
        echo $a['\x76\x61\162']['\156\x61\x6d\145'];
        ?>
');

                        $('#page_count_<?php 
        echo $a['\x76\x61\162']['\156\141\155\145'];
        ?>
').val('1');

                        ajaxQSRequest = $.get(
                            '/workflow/document/related-document/<?php 
        echo $sDoctypeId;
        ?>
/<?php 
        echo $sDocumentId;
        ?>
/<?php 
        echo $a['\x76\141\162']['\156\x61\155\145'];
        ?>
?qs=' + sQs + '&p=0<?php 
        echo isset($_GET['\x6d\171\144\x6f\143\165\155\x65\156\164\163']) ? '\x26\x6d\171\x64\157\x63\x75\x6d\145\x6e\164\x73' : '';
        ?>
',
                            function (sHtml) {
                                var oParent = oTable<?php 
        echo $a['\x76\x61\162']['\x6e\141\x6d\145'];
        ?>
.parent();
                                oParent.empty().append(sHtml);
                                window.<?php 
        echo $a['\166\141\162']['\x6e\141\x6d\145'];
        ?>
Hook();
                                oThinking.hide();
                                if (sQs.length >= 3) {
                                    $('#iconBtnIdForSearchAndDelete<?php 
        echo $a['\166\x61\x72']['\x6e\x61\155\x65'];
        ?>
').addClass('iconBtnForDelete').removeClass('iconBtnForSearching');
                                }
                            }
                        );
                    }, 500); // <-keyUp TimeOut
                });
                <?php 
        $sGridClass = '\56\147\162\x69\x64\x5f\164\x68\x72\145\x65\137\x6c\x69\156\x65';
        if (!($a['\x76\x61\162']['\x67\x72\x69\x64\137\x76\151\145\x77\137\164\x79\x70\x65'] == 2)) {
            goto Label_36839;
        }
        $sGridClass = '\56\147\162\151\144\137\164\x77\x6f\137\x6c\151\x6e\145';
        Label_36839:
        ?>
                <?php 
        if (!($a['\x76\141\x72']['\x67\x72\x69\144\x5f\166\x69\x65\167\x5f\x74\171\x70\145'] == 2 || $a['\166\141\162']['\147\x72\x69\x64\x5f\x76\151\x65\x77\137\164\171\160\145'] == 3)) {
            goto Label_36840;
        }
        ?>
                //$('#related_documents_<?php 
        echo $a['\166\141\x72']['\x6e\x61\x6d\145'];
        ?>
').children('.inner_wrap').show();
                $('#variable_table_<?php 
        echo $a['\x76\x61\162']['\x6e\x61\x6d\145'];
        ?>
').find('tr').each(function(){
                    var oCurrentTr = $(this);
                    var hasSingleLine = true;
                    var oCurrentTd;
                    oCurrentTr.find('td').each(function(){
                        oCurrentTd = $(this);

                        oCurrentTd.find('.content').each(function(){
                            //console.log($(this).width());
                            if($(this).height() > 20)
                            {
                                hasSingleLine = false;
                            }
                        });
                    });

                    if(hasSingleLine)
                    {
                        // oCurrentTr.find('td').find('.content').addClass('normalize_single_line');
                    }
                });
                //$('#related_documents_<?php 
        echo $a['\x76\141\x72']['\x6e\x61\x6d\145'];
        ?>
').children('.inner_wrap').hide();
                <?php 
        Label_36840:
        ?>
                $('td.cell_with_canvas').children('div').not('.hasHierarchial').children('.content').each(function(){
                    //$(this).css('width','110%');
                });
                <?php 
        if (!($a['\166\x61\162']['\x67\162\x69\x64\137\x76\x69\x65\167\137\x74\171\160\x65'] == 2)) {
            goto Label_36841;
        }
        ?>

                <?php 
        Label_36841:
        ?>

                <?php 
        if ($a['\166\141\162']['\163\x68\157\x77\137\156\145\151\147\x68\142\157\162\150\157\157\x64\137\144\157\143\x73']) {
            goto Label_36842;
        }
        ?>
                var parent = $('#variable_table_<?php 
        echo $a['\166\141\162']['\x6e\x61\x6d\145'];
        ?>
 tr[id='<?php 
        echo $sDocumentId;
        ?>
']').data('parent')||'';

                if(parent == '')
                {
                    var aParents = [''];
                    //var aParents = ['','<?php 
        echo $sDocumentId;
        ?>
'];
                }else
                {
                    var aParents = parent.split(' ');
                }

                /*for(i=1;i<aParents.length;i++)
                            {
                                $('#variable_table_ tr[data-parent*='' + aParents[i] + '']').hide();
                            }*/
                $('#variable_table_<?php 
        echo $a['\166\141\162']['\x6e\141\155\145'];
        ?>
 tr:not(.title)').hide();

                $('#variable_table_<?php 
        echo $a['\x76\x61\x72']['\x6e\141\x6d\145'];
        ?>
 tr[data-parent=' ' + aParents[1] + '']').show().find('span.minus').removeClass('minus').addClass('plus');

                for(i=1;i<aParents.length;i++)
                {
                    sId = aParents[i].replace('<?php 
        echo $a['\x76\141\162']['\156\x61\155\145'];
        ?>
','');
                    $('#variable_table_<?php 
        echo $a['\x76\141\162']['\156\141\x6d\145'];
        ?>
 tr:not(.title)').each(function()
                    {
                        sLast = $(this).data('parent').split(' ').pop();
                        sLast = sLast.replace('<?php 
        echo $a['\x76\141\x72']['\x6e\141\155\145'];
        ?>
','');
                        if(sId == sLast && $(this).css('display') === 'none')
                        {
                            $(this).show().find('span.minus').removeClass('minus').addClass('plus');
                        }
                    });
                    $('#variable_table_<?php 
        echo $a['\x76\x61\162']['\156\141\155\x65'];
        ?>
 tr[id='' + sId + '']').show().find('span.plus').removeClass('plus').addClass('minus');

                }

                $('#variable_table_<?php 
        echo $a['\166\141\162']['\156\141\155\x65'];
        ?>
 tr[data-parent='' + parent + ''],#<?php 
        echo $sDocumentId;
        ?>
').show().find('span.minus').removeClass('minus').addClass('plus');

                $('#loadRelatedDocuments<?php 
        echo $a['\x76\x61\162']['\x6e\141\155\145'];
        ?>
').hide();
                $('.load-next_<?php 
        echo $a['\166\141\x72']['\x6e\x61\x6d\145'];
        ?>
').hide();
                <?php 
        Label_36842:
        ?>
            });

            $(function () {
                $('#variable_table_<?php 
        echo $a['\x76\141\162']['\x6e\x61\x6d\x65'];
        ?>
 tr.off-limit').hide();
            });

            /* ]]> */
        </script>
        <style>
            .load-next_<?php 
        echo $a['\x76\x61\x72']['\x6e\141\155\145'];
        ?>
 {
                text-align: center;
                padding: 3px;
                border: 1px solid #eee;
                margin-top: 5px;
                cursor: pointer;
            }
            .load-next_<?php 
        echo $a['\166\x61\x72']['\156\x61\x6d\x65'];
        ?>
:hover {
                background-color: #eee;
            }
        </style>
    <?php 
        Label_36843:
        ?>

        <script>

            var oTable<?php 
        echo $a['\166\141\x72']['\x6e\141\155\x65'];
        ?>
 = $('#variable_table_<?php 
        echo $a['\166\141\162']['\156\x61\155\x65'];
        ?>
');
            <?php 
        if ($a['\x64\141\164\141\x5f\x63\x6f\x75\x6e\x74'] <= $a['\x6c\x69\x6d\151\x74']) {
            goto Label_36844;
        }
        ?>
            <?php 
        
        ?>
            $('#loadRelatedDocuments<?php 
        echo $a['\x76\141\162']['\156\x61\155\x65'];
        ?>
').show();
            <?php 
        
        ?>
            $('#total_count_<?php 
        echo $a['\x76\141\162']['\156\141\155\145'];
        ?>
').html('<?php 
        echo $a['\164\x6f\x74\x61\154\137\x63\157\x75\156\x74'];
        ?>
,');
            $('#display_count_<?php 
        echo $a['\x76\x61\x72']['\x6e\141\155\145'];
        ?>
').html('<?php 
        echo $a['\144\151\x73\160\x6c\x61\171\x5f\x63\157\165\156\164'];
        ?>
');
            $('#on_page_count_<?php 
        echo $a['\166\141\x72']['\156\141\155\145'];
        ?>
').show();
            <?php 
        goto Label_36845;
        Label_36844:
        ?>
            $('#loadRelatedDocuments<?php 
        echo $a['\x76\x61\x72']['\x6e\141\x6d\x65'];
        ?>
').hide();
            $('#total_count_<?php 
        echo $a['\166\141\x72']['\156\141\155\145'];
        ?>
').html('<?php 
        echo $a['\164\157\164\x61\x6c\137\x63\x6f\165\x6e\164'];
        ?>
');
            $('#display_count_<?php 
        echo $a['\166\141\162']['\x6e\141\x6d\145'];
        ?>
').html('<?php 
        echo $a['\144\151\163\x70\154\141\171\x5f\x63\157\165\156\164'];
        ?>
');
            $('#on_page_count_<?php 
        echo $a['\166\x61\x72']['\x6e\141\155\x65'];
        ?>
').hide();
            <?php 
        Label_36845:
        ?>

        </script>

        <?php 
        $s = ob_get_clean();
        return $s;
    }
    public static function variablecombinedvar($a, $sDoctypeId, $sDocumentId, $isAjaxRequest = false)
    {
        $oL = \app\system\Registry::get('\x6c\157\x63\x61\154\x65');
        ob_start();
        $sHiddenDescription = current(a($a['\166\141\x72'], '\150\x69\x64\x64\x65\x6e\137\144\145\x73\143\x72\x69\160\x74\x69\157\156', array()));
        $isHierarchical = false;
        foreach ($a['\166\x61\162']['\x66\151\145\154\x64\163'] as $aV) {
            if (!$aV['\x68\x69\x65\x72\141\x72\x63\x68\x69\143\x61\154']) {
                goto Label_36846;
            }
            $isHierarchical = true;
            Label_36846:
        }
        $a['\166\x61\x72']['\150\x69\x65\x72\141\162\x63\150\x69\143\141\154'] = $isHierarchical;
        ?>

        <?php 
        if ($isAjaxRequest) {
            goto Label_36851;
        }
        ?>
        <?php 
        if (!$isHierarchical) {
            goto Label_36848;
        }
        ?>
        <style type='text/css'>/*     css  */

            #variable_table_<?php 
        echo $a['\x76\x61\162']['\156\x61\155\x65'];
        ?>
 span.tree { padding:0 8px 8px 8px; height: 100%;}
            #variable_table_<?php 
        echo $a['\x76\x61\162']['\156\141\155\145'];
        ?>
 span.tree.line { background: url('/tpl/web/img/themev1/tree_line.gif') repeat-y center center; padding-bottom: 130px; }
            #variable_table_<?php 
        echo $a['\166\x61\162']['\x6e\x61\x6d\x65'];
        ?>
 span.tree.gline { background: url('/tpl/web/img/themev1/tree_g_line.gif') no-repeat center top; }
            #variable_table_<?php 
        echo $a['\x76\x61\x72']['\x6e\x61\x6d\x65'];
        ?>
 span.tree.cross { background: url('/tpl/web/img/themev1/tree_cross.gif') no-repeat center top; padding-bottom: 130px; top:6px; }
            #variable_table_<?php 
        echo $a['\166\x61\x72']['\x6e\x61\155\x65'];
        ?>
 span.tree.cross.last { background: url('/tpl/web/img/themev1/tree_cross_last.gif') no-repeat center top;  }
            #variable_table_<?php 
        echo $a['\166\141\x72']['\x6e\x61\x6d\x65'];
        ?>
 span.tree.minus { background: url('/tpl/web/img/themev1/tree_minus.gif') no-repeat center top; padding-bottom: 130px; }
            #variable_table_<?php 
        echo $a['\166\141\x72']['\x6e\141\x6d\145'];
        ?>
 span.tree.plus { background: url('/tpl/web/img/themev1/tree_plus.gif') no-repeat center top; }
            #variable_table_<?php 
        echo $a['\x76\141\x72']['\156\x61\155\145'];
        ?>
 td.content { padding-left: 0 !important; }
            #variable_table_<?php 
        echo $a['\x76\x61\x72']['\x6e\x61\x6d\x65'];
        ?>
 td.content>div { padding-left: 1px !important; overflow: visible; }
            #variable_table_<?php 
        echo $a['\x76\141\x72']['\156\141\x6d\x65'];
        ?>
 td.tree_grid { padding: 0 !important; border-right: medium none; }

        </style>

        <?php 
        if (!\app\system\Util::isie()) {
            goto Label_36847;
        }
        ?>
            <style type='text/css'>

                #variable_table_<?php 
        echo $a['\166\x61\x72']['\156\141\155\x65'];
        ?>
 span.tree { padding:8px; height: 100%;}
                #variable_table_<?php 
        echo $a['\166\x61\x72']['\156\141\x6d\x65'];
        ?>
 td.tree_grid{ vertical-align: middle;}

            </style>
        <?php 
        Label_36847:
        ?>
    <?php 
        Label_36848:
        ?>

    <input type='hidden' id='page_count_<?php 
        echo $a['\x76\x61\162']['\156\x61\155\x65'];
        ?>
' value='1' />
        <table id='variable_table_<?php 
        echo $a['\166\141\162']['\x6e\x61\155\145'];
        ?>
' border='0' cellpadding='0' cellspacing='0' class='field_table_view plain CRZ' style='width:100%;'>
            <?php 
        if (!$isHierarchical) {
            goto Label_36849;
        }
        ?>
                <col style='width:32px !important;' />
                <?php 
        for ($i = 0; $i < $a['\x76\x61\x72']['\154\x76\x6c\137\x63\x6f\165\156\164'] + 1; $i++) {
            ?>
                    <col style='width: 16px !important;'/>
                <?php 
        }
        foreach ($a['\x76\x61\162']['\x66\x69\x65\154\144\163'] as $sK1 => $aV1) {
            ?>
                    <col style='width:<?php 
            echo $aV1['\167\151\x64\x74\x68'];
            ?>
%;'/>
                    <?php 
            break;
        }
        Label_36849:
        ?>
            <tr class='title'>
                <td style='width:10px !important'></td>
                <?php 
        $iIter = 1;
        foreach ($a['\x76\x61\162']['\x66\151\145\x6c\x64\x73'] as $sK1 => $aV1) {
            if (!($sHiddenDescription == $sK1)) {
                goto Label_36850;
            }
            continue;
            Label_36850:
            ?>
                    <td <?php 
            echo $isHierarchical && $iIter == 1 ? '\x63\157\x6c\x73\160\x61\x6e\75\x22' . ($a['\x76\x61\162']['\x6c\166\154\137\x63\x6f\165\x6e\x74'] + 2) . '\x22' : '';
            ?>
 style='width:<?php 
            echo $aV1['\x77\151\x64\164\150'];
            ?>
%;'><?php 
            echo v($oL->get($aV1['\x74\151\x74\x6c\x65'], '\xd0\x94\320\xbe\xd0\xba\321\203\320\xbc\xd0\265\xd0\xbd\321\x82\321\x8b', '\xd0\x9f\xd0\265\321\x80\xd0\xb5\xd0\xbc\xd0\xb5\xd0\275\xd0\xbd\xd1\x8b\320\265\x20\55\x20\320\xbf\320\xbe\xd0\xbb\xd1\217', sprintf('\45\x73\55\45\163\55\45\x73\55\x74\151\x74\154\145', $a['\x64\157\143\x74\x79\x70\145\x5f\x69\144'], $a['\x76\x61\x72']['\x6e\141\x6d\x65'], $sK1)));
            ?>
</td>
                    <?php 
            $iIter++;
        }
        ?>
            </tr>
            <?php 
        Label_36851:
        ?>
            <?php 
        self::variablevartabletr($a, $a['\x64\141\164\141'], $sDocumentId, $a['\x6f\146\146\x73\x65\164'], $a['\x6c\151\x6d\151\164'], 0);
        ?>
            <?php 
        if ($isAjaxRequest) {
            goto Label_36857;
        }
        ?>
        </table>
        <?php 
        if (!($a['\x64\x61\x74\141\x5f\x63\x6f\165\156\164'] > $a['\154\151\155\151\x74'])) {
            goto Label_36852;
        }
        ?>
        <div id='loadCombinedDocuments<?php 
        echo $a['\x76\141\x72']['\156\141\x6d\x65'];
        ?>
' class='loadDocuments' onclick='loadCombinedDocuments<?php 
        echo $a['\166\x61\x72']['\x6e\x61\x6d\x65'];
        ?>
('<?php 
        echo $sDoctypeId;
        ?>
','<?php 
        echo $sDocumentId;
        ?>
','<?php 
        echo $a['\x76\141\x72']['\x6e\141\x6d\145'];
        ?>
');return;'><img style='display:none;' src='/tpl/web/img/loading.gif' /><span><?php 
        echo $oL->get('\320\227\xd0\xb0\320\xb3\321\200\xd1\x83\xd0\267\320\270\xd1\202\xd1\214\40\320\xb5\xd1\x89\xd0\xb5\x2e\x2e\56');
        ?>
</span></div>
    <?php 
        Label_36852:
        ?>
        <div style='background-color: #fff;' id='documents_count_info_<?php 
        echo $a['\x76\x61\162']['\x6e\141\155\145'];
        ?>
'>
            <p style='line-height: 23px;text-shadow: 0 1px 0 #FFFFFF;color:#696969'>
                <?php 
        echo $oL->get('\320\x92\321\201\xd0\265\320\xb3\320\xbe\72');
        ?>
                <span id='total_count_<?php 
        echo $a['\x76\x61\162']['\156\x61\x6d\145'];
        ?>
'><?php 
        echo $a['\x74\x6f\x74\141\154\x5f\x63\157\x75\156\164'];
        ?>
,</span>
                </span>
                <span id='on_page_count_<?php 
        echo $a['\x76\x61\162']['\156\x61\x6d\x65'];
        ?>
'>
								<?php 
        echo $oL->get('\320\275\320\xb0\40\xd1\x81\321\x82\321\200\320\260\xd0\275\xd0\270\xd1\206\320\265');
        ?>
								<span id='display_count_<?php 
        echo $a['\x76\141\162']['\x6e\141\155\x65'];
        ?>
'><?php 
        echo $a['\144\151\163\160\x6c\141\x79\x5f\x63\157\165\156\x74'];
        ?>
</span>
						</span>
            </p>
        </div>

        <script type='text/javascript'>
            /* <![CDATA[ */

            function loadCombinedDocuments<?php 
        echo $a['\166\141\162']['\156\141\x6d\145'];
        ?>
(sDoctypeId,sDocumentId,sVariableName){
                var oSpinner = $('#loadCombinedDocuments<?php 
        echo $a['\x76\x61\x72']['\x6e\x61\155\x65'];
        ?>
').find('img');
                oSpinner.show();
                var iP = $('#page_count_<?php 
        echo $a['\166\x61\x72']['\x6e\141\x6d\x65'];
        ?>
').val();
                var sQs = $('#combined_documents_<?php 
        echo $a['\x76\x61\x72']['\156\141\155\x65'];
        ?>
').find('.field_keyword').val();
                $.get('/workflow/document/combined-document/' + sDoctypeId + '/' + sDocumentId + '/' + sVariableName + '?is_ajax=1&qs='+sQs+'&p='+ iP + '<?php 
        echo isset($_GET['\155\x79\x64\157\x63\165\x6d\x65\156\x74\x73']) ? '\46\x6d\171\144\x6f\143\x75\155\x65\x6e\164\163' : '';
        ?>
',function(sHtml){
                    $('#variable_table_<?php 
        echo $a['\166\141\162']['\x6e\141\155\145'];
        ?>
')
                        .find('tbody')
                        // .find('#loadDocuments<?php 
        echo $a['\x76\141\x72']['\x6e\141\155\x65'];
        ?>
')
                        // .remove()
                        // .end()
                        .append(sHtml);
                    $('#loadCombinedDocuments<?php 
        echo $a['\x76\141\x72']['\x6e\141\x6d\x65'];
        ?>
').addClass('loaded');
                    window.<?php 
        echo $a['\166\141\x72']['\x6e\141\155\x65'];
        ?>
Hook();
                    oSpinner.hide();
                    $('#page_count_<?php 
        echo $a['\x76\141\x72']['\156\x61\x6d\x65'];
        ?>
').val(parseInt(iP)+1);
                });
            }

            function headerToggle<?php 
        echo $a['\166\x61\162']['\156\x61\x6d\x65'];
        ?>
(oHeader)
            {
                var oDocCountInfo = oHeader.siblings('#documents_count_info_<?php 
        echo $a['\166\141\x72']['\x6e\x61\155\x65'];
        ?>
');
                var oWrap = $('#combined_documents_<?php 
        echo $a['\166\x61\x72']['\156\141\x6d\x65'];
        ?>
');
                var oInnerWrap = oWrap.children('.inner_wrap');
                if (oWrap.hasClass('collapsed'))
                {
                    oWrap.removeClass('collapsed').addClass('expanded');
                    oInnerWrap.slideDown(200);
                    oDocCountInfo.show();
                }
                else
                {
                    oWrap.removeClass('expanded').addClass('collapsed');
                    oInnerWrap.slideUp(200);
                    oDocCountInfo.hide();
                }
            }
            var delay = (function() {
                var timer = 0;
                return function(callback, ms) {
                    clearTimeout(timer);
                    timer = setTimeout(callback, ms);
                };
            })();
            var ajaxQSRequest;
            $(document).ready(function() {
                //var oFT = new MSF_FieldTable('#variable_table_<?php 
        echo $a['\166\x61\x72']['\156\141\155\145'];
        ?>
',null);
                var oWrap = $('#combined_documents_<?php 
        echo $a['\166\x61\x72']['\x6e\141\155\145'];
        ?>
');
                oWrap.children('h3').unbind('click').bind('click',function()
                {
                    headerToggle<?php 
        echo $a['\x76\x61\162']['\x6e\141\x6d\x65'];
        ?>
($(this));
                });
                var oInnerWrap = oWrap.children('.inner_wrap');
                oWrap.find('#search_bar').find('.export_button').click(function()
                {
                    oWrap.children('h3').unbind('click');
                }).mouseout(function(){
                    oWrap.children('h3').unbind('click').bind('click',function(){
                        headerToggle<?php 
        echo $a['\166\x61\x72']['\156\x61\155\x65'];
        ?>
($(this));
                    });
                });

                oWrap.find('#search_bar').find('.field_keyword').focus(function()
                {
                    oWrap.children('h3').unbind('click');
                })
                    .blur(function()
                    {
                        oWrap.children('h3').unbind('click').bind('click',function()
                        {
                            headerToggle<?php 
        echo $a['\166\141\x72']['\x6e\141\x6d\145'];
        ?>
($(this));
                        });
                    }).keyup(function () {
                    // canceling previous ajax request
                    if (typeof ajaxQSRequest === 'object') {
                        ajaxQSRequest.abort();
                    }

                    var sQs = $(this).val();

                    delay(function () {
                        if (sQs.length < 3 && sQs.length > 0) { return; }

                        var oThinking = $('#thinking');
                        oThinking.show();

                        var oTable<?php 
        echo $a['\166\x61\162']['\x6e\x61\x6d\x65'];
        ?>
 = $('#variable_table_<?php 
        echo $a['\166\x61\x72']['\156\x61\x6d\145'];
        ?>
');

                        $('#page_count_<?php 
        echo $a['\x76\141\x72']['\156\141\155\145'];
        ?>
').val('1');

                        ajaxQSRequest = $.get(
                            '/workflow/document/combined-document/<?php 
        echo $sDoctypeId;
        ?>
/<?php 
        echo $sDocumentId;
        ?>
/<?php 
        echo $a['\x76\141\162']['\156\x61\155\145'];
        ?>
?qs=' + sQs + '&p=0<?php 
        echo isset($_GET['\155\171\x64\157\143\x75\x6d\145\x6e\164\x73']) ? '\46\155\x79\144\157\x63\165\155\x65\156\x74\163' : '';
        ?>
',
                            function (sHtml) {
                                var oParent = oTable<?php 
        echo $a['\166\x61\x72']['\156\x61\x6d\145'];
        ?>
.parent();
                                oParent.empty().append(sHtml);
                                window.<?php 
        echo $a['\166\141\162']['\x6e\x61\x6d\145'];
        ?>
Hook();
                                oThinking.hide();
                            }
                        );
                    }, 500); // <-keyUp TimeOut
                });
                <?php 
        $sGridClass = '\56\147\162\x69\x64\x5f\164\x68\x72\x65\x65\x5f\x6c\151\x6e\145';
        if (!($a['\x76\x61\x72']['\x67\162\x69\x64\x5f\166\x69\145\x77\137\x74\x79\160\145'] == 2)) {
            goto Label_36853;
        }
        $sGridClass = '\x2e\x67\x72\151\x64\137\x74\x77\x6f\137\x6c\x69\x6e\145';
        Label_36853:
        ?>
                <?php 
        if (!($a['\x76\x61\162']['\x67\x72\151\x64\137\x76\x69\145\167\137\x74\x79\160\x65'] == 2 || $a['\x76\x61\162']['\147\162\151\144\137\166\151\145\167\x5f\x74\171\160\145'] == 3)) {
            goto Label_36854;
        }
        ?>
                //$('#related_documents_<?php 
        echo $a['\x76\x61\x72']['\156\x61\155\145'];
        ?>
').children('.inner_wrap').show();
                $('#variable_table_<?php 
        echo $a['\x76\141\162']['\x6e\141\155\x65'];
        ?>
').find('tr').each(function(){
                    var oCurrentTr = $(this);
                    var hasSingleLine = true;
                    var oCurrentTd;
                    oCurrentTr.find('td').each(function(){
                        oCurrentTd = $(this);

                        oCurrentTd.find('.content').each(function(){
                            //console.log($(this).width());
                            if($(this).height() > 20)
                            {
                                hasSingleLine = false;
                            }
                        });
                    });

                    if(hasSingleLine)
                    {
                        // oCurrentTr.find('td').find('.content').addClass('normalize_single_line');
                    }
                });
                //$('#related_documents_<?php 
        echo $a['\166\x61\162']['\156\x61\x6d\145'];
        ?>
').children('.inner_wrap').hide();
                <?php 
        Label_36854:
        ?>
                $('td.cell_with_canvas').children('div').not('.hasHierarchial').children('.content').each(function(){
                    //$(this).css('width','110%');
                });
                <?php 
        if (!($a['\166\x61\162']['\x67\162\151\144\137\x76\151\145\x77\x5f\x74\171\x70\145'] == 2)) {
            goto Label_36855;
        }
        ?>

                <?php 
        Label_36855:
        ?>

                <?php 
        if ($a['\166\x61\162']['\x73\x68\157\x77\137\156\145\x69\147\150\142\x6f\x72\150\157\x6f\x64\x5f\144\x6f\x63\163']) {
            goto Label_36856;
        }
        ?>
                var parent = $('#variable_table_<?php 
        echo $a['\166\141\x72']['\156\x61\x6d\x65'];
        ?>
 tr[id='<?php 
        echo $sDocumentId;
        ?>
']').data('parent')||'';

                if(parent == '')
                {
                    var aParents = [''];
                    //var aParents = ['','<?php 
        echo $sDocumentId;
        ?>
'];
                }else
                {
                    var aParents = parent.split(' ');
                }

                /*for(i=1;i<aParents.length;i++)
                            {
                                $('#variable_table_ tr[data-parent*='' + aParents[i] + '']').hide();
                            }*/
                $('#variable_table_<?php 
        echo $a['\166\141\162']['\x6e\141\155\145'];
        ?>
 tr:not(.title)').hide();

                $('#variable_table_<?php 
        echo $a['\x76\141\x72']['\156\x61\155\x65'];
        ?>
 tr[data-parent=' ' + aParents[1] + '']').show().find('span.minus').removeClass('minus').addClass('plus');

                for(i=1;i<aParents.length;i++)
                {
                    sId = aParents[i].replace('<?php 
        echo $a['\x76\x61\x72']['\156\141\x6d\145'];
        ?>
','');
                    $('#variable_table_<?php 
        echo $a['\x76\141\x72']['\x6e\141\155\x65'];
        ?>
 tr:not(.title)').each(function()
                    {
                        sLast = $(this).data('parent').split(' ').pop();
                        sLast = sLast.replace('<?php 
        echo $a['\166\x61\x72']['\x6e\x61\155\145'];
        ?>
','');
                        if(sId == sLast && $(this).css('display') === 'none')
                        {
                            $(this).show().find('span.minus').removeClass('minus').addClass('plus');
                        }
                    });
                    $('#variable_table_<?php 
        echo $a['\x76\141\x72']['\156\141\x6d\x65'];
        ?>
 tr[id='' + sId + '']').show().find('span.plus').removeClass('plus').addClass('minus');

                }

                $('#variable_table_<?php 
        echo $a['\166\x61\x72']['\x6e\x61\x6d\145'];
        ?>
 tr[data-parent='' + parent + ''],#<?php 
        echo $sDocumentId;
        ?>
').show().find('span.minus').removeClass('minus').addClass('plus');

                $('#loadCombinedDocuments<?php 
        echo $a['\166\141\x72']['\156\141\x6d\145'];
        ?>
').hide();
                <?php 
        Label_36856:
        ?>
            });

            /* ]]> */
        </script>
    <?php 
        Label_36857:
        ?>

        <script>

            var oTable<?php 
        echo $a['\x76\x61\162']['\x6e\141\155\145'];
        ?>
 = $('#variable_table_<?php 
        echo $a['\166\x61\162']['\x6e\x61\x6d\145'];
        ?>
');
            <?php 
        if ($a['\144\x61\164\x61\x5f\x63\157\x75\156\164'] <= $a['\x6c\x69\155\151\x74']) {
            goto Label_36859;
        }
        ?>
            <?php 
        if (!$a['\x76\x61\x72']['\x73\150\x6f\x77\x5f\156\x65\151\x67\150\x62\x6f\x72\150\x6f\157\144\137\144\x6f\143\x73']) {
            goto Label_36858;
        }
        ?>
            $('#loadCombinedDocuments<?php 
        echo $a['\166\141\x72']['\x6e\x61\155\x65'];
        ?>
').show();
            <?php 
        Label_36858:
        ?>
            $('#total_count_<?php 
        echo $a['\166\x61\162']['\156\x61\155\145'];
        ?>
').html('<?php 
        echo $a['\x74\157\164\x61\154\137\x63\157\165\x6e\164'];
        ?>
,');
            $('#display_count_<?php 
        echo $a['\166\x61\x72']['\x6e\x61\x6d\145'];
        ?>
').html('<?php 
        echo $a['\x64\151\x73\x70\154\141\171\137\143\157\x75\x6e\x74'];
        ?>
');
            $('#on_page_count_<?php 
        echo $a['\166\141\162']['\x6e\x61\x6d\x65'];
        ?>
').show();
            <?php 
        goto Label_36860;
        Label_36859:
        ?>
            $('#loadCombinedDocuments<?php 
        echo $a['\166\x61\x72']['\156\x61\155\145'];
        ?>
').hide();
            $('#total_count_<?php 
        echo $a['\166\141\162']['\156\x61\x6d\145'];
        ?>
').html('<?php 
        echo $a['\x74\x6f\x74\x61\154\x5f\x63\x6f\x75\156\164'];
        ?>
');
            $('#display_count_<?php 
        echo $a['\x76\x61\162']['\x6e\x61\x6d\x65'];
        ?>
').html('<?php 
        echo $a['\x64\x69\163\x70\x6c\x61\171\137\x63\x6f\165\x6e\164'];
        ?>
');
            $('#on_page_count_<?php 
        echo $a['\x76\x61\162']['\156\x61\x6d\x65'];
        ?>
').hide();
            <?php 
        Label_36860:
        ?>

        </script>

        <?php 
        $s = ob_get_clean();
        return $s;
    }
    public static function timesheetvaredit($aData, $sDoctypeId, $sDocumentId, $mode = '\x63\x72\145\141\164\145')
    {
        $oL = \app\system\Registry::get('\x6c\157\143\x61\x6c\145');
        ob_start();
        ?>
        <script type='text/javascript'>

            function isValid(obj)
            {
                for (var prop in obj)
                {
                    if(!$('[name*=''+obj[prop]+'']').length)
                    {
                        ShowErrorMessage('<?php 
        echo $oL->get('\320\x9f\xd1\x80\320\276\xd0\xb2\320\265\321\200\321\x8c\xd1\202\320\265\40\xd0\275\320\260\xd0\xbb\320\270\321\207\320\270\320\265\40\320\xb2\321\x81\320\265\xd1\x85\40\xd0\xbf\xd0\276\320\273\xd0\xb5\320\271\x20\321\x88\320\xb0\xd0\261\xd0\273\xd0\276\xd0\xbd\320\xb5\x20\xd0\264\320\xbe\xd0\xba\321\x83\xd0\xbc\xd0\xb5\xd0\xbd\xd1\x82\xd0\xb0');
        ?>
');
                        return  false;
                    }
                }

                return true;
            }

            function ShowErrorMessage(t)
            {
                MSF_StatusBar.hideWait();
                $('#results').show().children('#error').append('<div class='status_error' id='statusErrorItem_0'>'+t+'<br /></div>').show();
                setTimeout(function() {
                    $('#statusErrorItem_0').hide();
                    $('#statusErrorItem_0').remove();
                    if($('#error').html().trim() == '') {
                        $('#error').hide();
                    }
                }, 5000);
            };

            $(document).ready(function(){

                var oConfig =  { // 
                    'subdivision': '<?php 
        echo $aData['\166\141\162']['\163\165\x62\144\151\x76\x69\x73\151\157\x6e'];
        ?>
',
                    'year': '<?php 
        echo $aData['\166\x61\162']['\171\x65\x61\162'];
        ?>
',
                    'month': '<?php 
        echo $aData['\x76\x61\x72']['\155\157\156\164\x68'];
        ?>
'
                };
                var summaryConfig = {'8':'actual_work',
                    '8':'off_travel',
                    'A':'permision_fail',
                    '':'disability',
                    '':'truancy',
                    '/':'holiday_without_wages',
                    '':'next_holiday',
                    '':'temporary_stay',
                    '8':'wokr_in_holydays',
                    '':'study_holiday',
                    '':'weekends'};
                var tableExists = false;
                /* */
                $('#bGenerate<?php 
        echo $aData['\x76\x61\x72\124\171\160\x65'];
        ?>
').click(function()
                {
                    if(!isValid(oConfig))
                        return;

                    if(tableExists)
                    {
                        if (!confirm('<?php 
        echo $oL->get('\xd0\222\xd1\213\40\321\x83\xd0\xb2\xd0\265\321\200\xd0\xb5\320\xbd\321\x8b\x2c\40\xd1\207\321\202\320\xbe\40\321\x85\320\276\321\x82\320\270\321\x82\320\265\40\xd1\x81\320\276\320\267\xd0\xb4\320\xb0\321\202\xd1\214\40\xd0\xbd\320\276\320\xb2\xd1\203\xd1\216\40\321\x82\xd0\xb0\320\261\320\273\xd0\xb8\321\x86\xd1\203\x2c\40\xd1\203\xd0\xb4\320\260\xd0\xbb\320\270\320\262\x20\xd1\201\xd1\202\320\260\xd1\200\xd1\203\xd1\x8e\x3f');
        ?>
'))
                        {
                            return;
                        }
                    }

                    request = $.ajax(
                        {
                            type:		'POST',
                            url:		'/workflow/document/<?php 
        echo str_replace('\x5f', '\x2d', $aData['\166\x61\162\x54\x79\x70\145']);
        ?>
/<?php 
        echo $sDoctypeId;
        ?>
/<?php 
        echo $sDocumentId;
        ?>
/<?php 
        echo $aData['\x76\141\162']['\156\141\x6d\x65'];
        ?>
',
                            data:		$('#createRowForm').serialize(),
                            dataType: 'json',
                            success: function(oData)
                            {
                                if(array_key_exists('error', oData))
                                {
                                    ShowErrorMessage(oData.error);
                                }
                                else
                                {
                                    $('#timesheet-table<?php 
        echo $aData['\166\x61\162\x54\x79\160\145'];
        ?>
').html(oData.html);
                                    calcAllSummary();

                                }
                            },
                            error:function(data)
                            {
                                ShowErrorMessage('<?php 
        echo $oL->get('\xd0\237\xd1\x80\xd0\276\320\270\320\267\xd0\xbe\321\x88\320\xbb\320\xb0\40\xd0\276\321\210\xd0\270\320\xb1\xd0\xba\320\260\40\320\262\320\xbe\40\xd0\262\xd1\200\xd0\265\xd0\274\321\217\x20\320\xb7\xd0\xb0\320\277\xd1\x80\xd0\xbe\321\x81\xd0\xb0\x2e');
        ?>
');
                            }
                        });

                });

                //        
                $('.variable_timesheet select[name*='[posts]']').live('change', function()
                {
                    var currentPostId = $(this).parent().parent().parent().attr('id');
                    calcSummary(currentPostId);
                    if($(this).val().length > 1){
                        $(this).siblings('.timesheet_day_value').css('padding-left', '-5px');
                        $(this).siblings('.timesheet_day_value').css('font-size', '8px');
                    } else {
                        $(this).siblings('.timesheet_day_value').css('padding-left', '0');
                        $(this).siblings('.timesheet_day_value').css('font-size', '9pt');
                    }
                    $(this).siblings('.timesheet_day_value').text($(this).val());
                });

                /**
                 *        
                 *
                 * @param {type} sName
                 * @returns {undefined}
                 */
                function calcSummary(sName)
                {
                    var qtyBuffer = [];
                    var qty = 0;
                    var currentVal;

                    //      
                    $.each(summaryConfig, function(dayType, dayDesc)
                    {
                        qtyBuffer[dayType] = 0;
                    });

                    //     
                    $('.variable_timesheet [name*='[posts]['+sName+'']').each(function(i, select)
                    {
                        currentVal = $(select).children('option:selected').val();
                        qtyBuffer[currentVal] = qtyBuffer[currentVal] + 1;
                    });


                    //   
                    for(var dayType in qtyBuffer)
                    {
                        qty = qtyBuffer[dayType];

                        $('.variable_timesheet [input[name*='[posts]['+sName+']['+summaryConfig[dayType]+'']').val(qty);
                        $('.variable_timesheet [name*='[posts]['+sName+']['+summaryConfig[dayType]+'']').parent().children('span').text(qty);

                    };
                }

                /*
                     *       ()
                     * @param {type} obj
                     * @returns
                     */
                function calcAllSummary()
                {

                    $('#timesheet-table<?php 
        echo $aData['\166\141\162\x54\x79\x70\x65'];
        ?>
').children('table').children('tbody').children('tr').each(function(i, tr)
                    {
                        var trName = $(tr).attr('id');
                        if(trName!=''&&trName!=undefined)
                            calcSummary(trName);
                    });
                }
                //    ,   .
                if($('input[name*='actual_work']').length>0)
                {
                    tableExists = true;
                }

                if(tableExists)
                {
                    calcAllSummary();
                }
            });
        </script>
        <div class='variable variable_timesheet'>
            <input id='bGenerate<?php 
        echo $aData['\x76\141\x72\124\x79\x70\145'];
        ?>
' type='button' value='<?php 
        echo $oL->get('\320\241\xd0\xb3\xd0\265\320\xbd\xd0\265\321\x80\xd0\270\321\200\xd0\xbe\320\xb2\xd0\xb0\321\x82\xd1\214');
        ?>
' class='btn btn-sm btn-raised btn-default' />
            <div id='timesheet-table<?php 
        echo $aData['\166\141\x72\124\171\160\x65'];
        ?>
' style='padding-top: 5px;'>
                <?php 
        if (!($mode == '\x65\x64\151\164')) {
            goto Label_36861;
        }
        ?>
                    <?php 
        echo \app\workflow\WFW::timesheetvartable($aData);
        ?>
                <?php 
        Label_36861:
        ?>
            </div>
            <!--[if IE]>
            <style type='text/css'>
                .rotated_cell
                {
                    text-align: left;
                    padding-bottom: 10px;
                }

                .rotate_text
                {
                    -ms-writing-mode: bt-rl;
                    filter: flipH() flipV();
                    top: 0px;
                }
            </style>
            <![endif]-->
        </div>
        <?php 
        $s = ob_get_clean();
        return $s;
    }
    public static function timesheetvartable($aData)
    {
        $oL = \app\system\Registry::get('\x6c\x6f\143\141\154\145');
        $npp = 1;
        $isWholeTimesheet = false;
        $disabled = '';
        if (!$isWholeTimesheet) {
            goto Label_36862;
        }
        $disabled = '\x64\151\x73\x61\142\x6c\145\x64\40\x3d\40\x22\x64\x69\163\x61\x62\x6c\x65\144\42';
        Label_36862:
        $html = '\x3c\151\x6e\x70\165\164\40\164\x79\x70\145\x3d\42\x68\151\x64\144\x65\156\x22\x20\156\141\155\145\x3d\x22' . $aData['\x76\x61\162\116\x61\155\145'] . '\x5b\x64\x61\171\163\111\x6e\115\x6f\x6e\x74\150\x5d\x22\40\166\141\x6c\165\x65\x3d\42' . $aData['\x64\141\171\163\111\156\115\x6f\156\164\150'] . '\x22\x2f\76' . '\x3c\151\156\x70\x75\x74\40\164\171\x70\145\75\42\x68\x69\144\144\x65\x6e\42\x20\156\x61\155\x65\x3d\x22' . $aData['\166\x61\x72\x4e\x61\155\x65'] . '\x5b\x6d\x6f\x6e\164\150\135\42\40\x76\x61\x6c\165\x65\x3d\42' . $aData['\155\x6f\156\164\x68'] . '\42\57\76' . '\x3c\151\156\160\165\x74\x20\164\x79\160\x65\x3d\x22\x68\151\x64\144\145\156\x22\40\156\x61\155\x65\75\x22' . $aData['\166\x61\x72\x4e\x61\x6d\x65'] . '\x5b\x79\145\x61\162\x5d\x22\40\166\x61\x6c\165\x65\75\42' . $aData['\171\145\x61\162'] . '\42\x2f\76' . '\12\40\40\x20\40\40\x20\x20\40\40\40\x20\x20\x3c\164\x61\x62\x6c\x65\40\x62\157\x72\x64\145\x72\75\x22\x31\x22\x20\x63\x65\x6c\154\160\141\144\x64\151\156\147\75\x22\60\42\40\x63\145\x6c\154\163\x70\141\x63\x69\x6e\x67\x3d\42\60\x22\40\x63\x6c\x61\x73\x73\x3d\x22\x76\x61\162\151\x61\x62\x6c\x65\137\x74\141\142\x6c\x65\x22\x20\x3e\xa\40\x20\x20\40\40\40\x20\40\x20\x20\x20\x20\x3c\164\x62\x6f\x64\x79\76\xa\40\x20\x20\x20\40\40\x20\x20\40\40\40\x20\74\164\x72\40\143\x6c\141\163\163\75\42\x74\151\x74\154\145\x22\x3e\xa\x20\x20\40\40\40\x20\x20\x20\x20\40\40\40\74\164\x64\40\162\157\x77\163\160\x61\x6e\75\x22\x32\x22\40\163\x74\171\x6c\x65\x3d\x22\164\x65\170\x74\55\141\x6c\x69\147\156\72\x20\143\x65\x6e\x74\x65\162\73\x20\167\151\x64\164\150\72\x20\x32\x30\x70\170\x3b\x22\76' . $oL->get('\342\204\x96\40\xd0\277\57\320\277') . '\x3c\57\x74\144\76\xa\40\40\40\40\x20\x20\x20\x20\x20\x20\x20\x20\x3c\164\x64\40\x72\157\167\x73\160\141\156\x3d\x22\x32\x22\x20\x73\164\x79\154\145\x3d\x22\164\x65\x78\164\55\141\154\151\x67\156\72\40\143\x65\156\x74\145\x72\73\x20\x77\x69\x64\x74\150\72\x20\x31\65\60\x70\170\x3b\x22\x3e' . $oL->get('\xd0\244\320\x98\xd0\x9e') . '\74\57\x74\144\76\12\x20\40\x20\40\x20\40\x20\x20\40\40\x20\x20\74\164\x64\40\x72\157\x77\x73\x70\x61\156\75\42\x32\x22\x20\163\x74\x79\154\145\x3d\42\x74\x65\170\164\55\141\x6c\151\147\156\x3a\40\x63\145\156\164\145\162\73\40\x77\151\144\164\x68\72\x20\61\65\60\x70\170\73\42\x3e' . $oL->get('\320\224\320\276\320\xbb\320\266\320\275\320\xbe\321\201\321\x82\xd1\214') . '\74\57\x74\144\76\12\x20\40\x20\40\x20\x20\40\40\x20\40\40\x20\x3c\x74\144\40\x63\157\154\163\x70\x61\156\75\42' . $aData['\144\141\171\x73\x49\x6e\x4d\x6f\x6e\x74\150'] . '\x22\x3e' . $oL->get('\xd0\247\320\xb8\321\x81\320\xbb\xd0\260\x20\xd0\274\xd0\265\xd1\x81\xd1\217\xd1\206\xd0\xb0') . '\x3c\57\x74\144\x3e\12\x20\x20\40\40\x20\40\x20\40\x20\40\x20\x20\74\x74\x64\x3e' . $oL->get('\x38') . '\x3c\x2f\x74\x64\76\xa\x20\x20\40\40\x20\x20\40\40\40\40\40\x20\x3c\x74\144\40\167\151\144\x74\x68\x3d\x22\62\x30\42\76' . $oL->get('\70\320\x9a') . '\74\x2f\164\x64\x3e\xa\40\40\40\x20\40\40\40\x20\x20\40\x20\40\x3c\x74\144\x3e' . $oL->get('\101') . '\74\x2f\x74\144\x3e\xa\40\x20\x20\x20\40\40\40\x20\x20\x20\x20\40\x3c\x74\x64\x3e' . $oL->get('\xd0\221') . '\74\x2f\x74\x64\76\xa\40\40\40\40\40\x20\40\40\40\40\40\x20\74\x74\144\x3e' . $oL->get('\xd0\235') . '\x3c\57\x74\144\x3e\12\x20\x20\40\40\x20\40\x20\x20\40\40\40\40\74\164\144\40\x77\151\144\164\x68\75\x22\x32\60\x22\76' . $oL->get('\xd0\221\x2f\xd0\xa1') . '\x3c\x2f\164\x64\x3e\12\x20\40\40\40\40\40\x20\40\x20\x20\40\40\x3c\164\144\x3e' . $oL->get('\xd0\236') . '\74\57\x74\x64\x3e\12\x20\x20\x20\40\x20\40\40\40\40\x20\x20\40\x3c\x74\144\x20\x77\151\144\164\x68\x3d\42\62\60\x22\76' . $oL->get('\xd0\x92\320\237') . '\74\x2f\x74\x64\x3e\12\40\x20\x20\x20\x20\40\40\40\40\x20\x20\x20\x3c\164\x64\x20\167\151\144\164\x68\x3d\x22\62\x30\42\x3e' . $oL->get('\70\320\x92') . '\74\x2f\164\144\76\xa\40\40\x20\40\40\x20\x20\x20\40\x20\40\x20\x3c\x74\144\x20\x77\x69\144\164\150\75\42\x32\60\x22\76' . $oL->get('\320\236\320\x9e') . '\74\57\x74\144\x3e\xa\40\x20\x20\40\40\40\40\40\40\x20\x20\x20\74\x74\x64\x3e' . $oL->get('\320\222') . '\74\x2f\x74\x64\x3e\xa\x20\x20\40\40\x20\40\40\x20\40\40\40\40\74\x2f\x74\162\76\12\x20\x20\40\x20\40\40\40\x20\x20\x20\x20\40\x3c\164\x72\40\143\154\x61\x73\163\x3d\42\164\x69\x74\x6c\x65\x22\x3e';
        for ($day = 1; $day <= $aData['\x64\141\171\x73\x49\x6e\115\x6f\156\x74\150']; $day++) {
            $className = \app\workflow\util\Util::isweekenddate($day, $aData['\x6d\157\156\164\150'], $aData['\x79\x65\141\x72']) ? '\167\x65\145\153\145\x6e\x64' : '\x6f\162\144\151\156\141\162\x79';
            $html .= '\74\164\144\40\x63\x6c\x61\163\163\x3d\42' . $className . '\x22\76' . $day . '\74\x2f\x74\x64\x3e';
        }
        $html .= '\74\164\144\x20\143\154\141\x73\163\x3d\42\162\x6f\164\141\x74\x65\x64\137\143\145\154\x6c\42\40\x3e\x3c\x64\151\166\40\x63\154\141\x73\x73\75\x22\162\x6f\x74\141\164\x65\137\x74\x65\x78\164\x22\x3e' . $oL->get('\320\224\xd0\275\320\270\x20\xd1\x8f\xd0\xb2\320\276\xd0\xba') . '\74\x2f\164\x64\x3e\12\x20\x20\x20\40\40\x20\x20\x20\40\40\40\40\74\x74\144\x20\143\154\x61\163\x73\x3d\x22\162\x6f\x74\141\x74\145\x64\137\x63\x65\x6c\x6c\42\40\x3e\x3c\x64\151\166\x20\x63\x6c\x61\x73\163\x3d\42\x72\x6f\x74\141\164\145\x5f\164\x65\x78\x74\x22\76' . $oL->get('\320\232\320\xbe\320\274\320\xb0\320\275\xd0\264\320\xb8\xd1\x80\320\276\xd0\xb2\xd0\xba\xd0\260') . '\x3c\x2f\164\144\x3e\12\40\40\40\x20\x20\40\40\40\x20\x20\x20\x20\x3c\x74\x64\x20\x63\154\141\x73\x73\x3d\x22\x72\x6f\x74\141\x74\x65\144\137\143\145\154\154\42\x20\x3e\x3c\144\151\166\40\143\x6c\141\163\x73\75\x22\162\157\164\x61\164\x65\137\164\145\170\164\x22\76' . $oL->get('\320\235\320\265\xd1\x8f\xd0\262\320\xba\320\260\40\321\x81\40\xd1\x80\320\260\xd0\xb7\xd1\x80\320\xb5\xd1\210\xd0\265\xd0\275\320\xb8\321\217\40\xd0\x90\xd0\264\320\xbc\320\270\xd0\275\xd0\xb8\321\x81\321\x82\321\200\xd0\260\321\x86\xd0\270\xd0\270') . '\x3c\x2f\x74\x64\76\12\40\40\40\40\x20\40\40\x20\x20\x20\40\x20\x3c\x74\x64\x20\143\154\141\163\163\75\x22\162\157\x74\141\164\x65\x64\137\143\x65\154\154\42\40\76\x3c\144\x69\166\x20\143\154\x61\x73\x73\x3d\42\x72\x6f\x74\141\x74\x65\x5f\x74\x65\x78\164\x22\x3e' . $oL->get('\320\235\xd0\xb5\321\x82\321\200\xd1\x83\320\xb4\xd0\276\321\x81\320\277\xd0\276\xd1\x81\320\276\320\261\320\275\xd0\xbe\xd1\201\xd1\x82\321\x8c') . '\74\57\164\144\76\xa\40\x20\40\40\40\40\40\x20\x20\40\40\40\74\x74\144\x20\143\154\x61\x73\x73\75\x22\162\x6f\x74\141\164\145\144\x5f\143\x65\154\154\x22\x20\76\x3c\144\x69\x76\40\143\154\x61\x73\x73\75\x22\162\157\164\141\164\145\137\x74\145\170\164\x22\76' . $oL->get('\xd0\237\xd0\240\xd0\236\xd0\223\xd0\xa3\xd0\233') . '\x3c\57\164\x64\x3e\12\x20\x20\x20\x20\x20\40\40\x20\x20\x20\x20\x20\x3c\164\x64\40\143\154\141\x73\163\x3d\x22\162\157\x74\x61\164\x65\144\x5f\143\145\154\x6c\x22\40\x3e\x3c\x64\x69\166\x20\x63\x6c\141\x73\163\x3d\x22\162\x6f\x74\x61\x74\x65\137\x74\145\x78\x74\42\x3e' . $oL->get('\xd0\x9e\321\x82\320\xbf\321\x83\321\201\320\272\40\xd0\261\xd0\265\xd0\xb7\x20\321\x81\xd0\276\xd1\x85\321\200\320\xb0\xd0\xbd\320\xb5\320\xbd\320\270\321\x8f\x20\xd0\267\57\320\xbf\xd0\xbb\320\xb0\xd1\202\xd1\213') . '\74\x2f\164\144\x3e\12\40\40\x20\40\x20\40\40\x20\40\x20\x20\x20\x3c\x74\144\x20\143\x6c\141\x73\163\75\x22\162\157\164\141\x74\x65\144\x5f\143\x65\154\154\x22\40\76\74\x64\151\166\x20\x63\x6c\141\x73\x73\x3d\42\x72\157\x74\141\164\x65\x5f\164\x65\170\164\x22\76' . $oL->get('\320\236\xd1\x87\xd0\265\xd1\200\xd0\265\320\xb4\xd0\275\320\276\xd0\xb9\x20\xd1\202\321\200\321\x83\xd0\xb4\320\276\xd0\262\xd0\276\xd0\271\x20\xd0\276\321\202\320\277\321\203\321\x81\xd0\272') . '\x3c\57\164\x64\x3e\12\40\x20\40\40\x20\40\40\x20\x20\x20\x20\40\74\164\144\x20\143\154\141\163\163\x3d\x22\162\x6f\164\141\x74\145\144\x5f\x63\145\154\154\x22\x20\x3e\x3c\144\x69\166\x20\x63\154\141\x73\x73\x3d\x22\x72\157\x74\141\x74\x65\x5f\x74\145\x78\x74\x22\x3e' . $oL->get('\xd0\x92\321\x80\320\265\320\274\320\265\320\xbd\xd0\275\321\x8b\xd0\271\40\xd0\xbf\321\200\xd0\xbe\xd1\201\xd1\x82\xd0\276\xd0\xb9') . '\74\57\x74\x64\x3e\12\40\40\x20\40\40\x20\x20\40\x20\x20\x20\40\x3c\x74\x64\40\x63\x6c\141\x73\x73\x3d\42\162\157\164\x61\164\x65\x64\x5f\x63\145\x6c\154\x22\x20\x3e\x3c\x64\151\x76\x20\143\x6c\141\x73\x73\75\x22\x72\157\x74\141\x74\x65\x5f\x74\x65\x78\164\x22\x3e' . $oL->get('\320\xa0\320\260\xd0\261\xd0\xbe\xd1\202\xd0\xb0\40\320\xb2\x20\xd0\262\xd1\x8b\321\205\xd0\xbe\xd0\xb4\320\xbd\321\x8b\320\xb5\40\320\xb4\xd0\275\xd0\xb8') . '\74\57\164\144\76\xa\40\x20\40\x20\40\x20\40\40\x20\x20\40\x20\74\164\x64\x20\x63\x6c\x61\x73\x73\75\42\x72\157\164\x61\x74\145\x64\x5f\143\145\x6c\x6c\42\x20\x3e\x3c\144\x69\166\40\x63\x6c\x61\x73\163\x3d\42\x72\x6f\x74\141\x74\x65\x5f\164\x65\170\x74\x22\76' . $oL->get('\320\x9e\xd1\x82\320\277\xd1\x83\321\201\xd0\272\40\320\277\320\xbe\40\xd0\xbe\320\xb1\321\x83\321\207\xd0\265\xd0\275\320\xb8\xd1\216') . '\74\x2f\x74\144\76\xa\40\x20\x20\x20\x20\x20\40\x20\x20\40\x20\40\x3c\164\144\40\143\x6c\141\163\x73\75\x22\x72\x6f\x74\x61\164\x65\144\x5f\143\145\154\x6c\x22\x20\x3e\74\x64\x69\x76\40\143\x6c\141\x73\163\x3d\x22\162\x6f\164\141\164\x65\137\x74\x65\170\164\42\76' . $oL->get('\xd0\x92\xd1\x8b\321\205\320\xbe\320\xb4\320\xbd\xd1\213\xd0\265\40\xd0\270\x20\320\xbf\xd1\x80\xd0\xb0\xd0\267\320\264\320\xbd\320\270\321\207\xd0\xbd\xd1\213\xd0\xb5\x20\xd0\xb4\320\275\xd0\270') . '\74\x2f\x74\144\x3e\12\40\40\40\x20\40\40\x20\40\40\x20\40\40\x3c\57\x74\162\76';
        $selected = '\163\145\154\145\x63\x74\x65\x64\x3d\x22\x73\x65\154\145\143\164\145\x64\x22';
        foreach ($aData['\163\x74\x72\x75\143\x74\165\162\x65'] as $sdvId => $sdv) {
            $sdvTemp = $aData['\166\x61\x72\x4e\x61\x6d\x65'] . '\133\x73\164\x72\x75\x63\164\165\x72\x65\135\x5b' . $sdvId . '\x5d';
            $html .= '\74\x74\162\x20\143\x6c\141\x73\x73\x3d\42\163\x75\x62\x74\151\x74\154\x65\42\76\x3c\164\144\x20\143\157\154\x73\x70\141\156\75\42' . ($aData['\x64\141\171\163\111\x6e\x4d\157\x6e\164\x68'] + 14) . '\42\x3e\x26\x6e\142\163\160\x3b\x20' . $sdv['\x6e\141\x6d\x65'] . '\74\x69\156\160\x75\x74\x20\164\x79\x70\145\x3d\42\x68\x69\144\x64\x65\156\42\40\156\141\x6d\x65\75\x22' . $sdvTemp . '\x5b\x6e\141\x6d\145\x5d\42\x20\x76\x61\x6c\x75\145\75\42' . $sdv['\x6e\x61\155\x65'] . '\x22\x3e\74\x2f\x74\144\76\74\x2f\164\162\x3e';
            foreach ($sdv['\160\x6f\163\164\163'] as $postId => $post) {
                $html .= '\x3c\x74\x72\40\x69\144\x3d\42' . $postId . '\42\76';
                $html .= '\74\x74\x64\x3e' . '\x3c\151\156\160\165\x74\x20\164\171\160\145\75\42\x68\x69\144\x64\145\156\42\40\x6e\141\x6d\x65\x3d\42' . $sdvTemp . '\x5b\160\157\x73\164\163\x5d\133' . $postId . '\x5d\x5b\145\x6d\x70\x6c\x6f\x79\x65\x65\x5d\42\x20\166\141\x6c\165\145\75\x22' . $post['\x65\155\160\x6c\x6f\x79\145\x65'] . '\x22\57\76' . '\x3c\x69\156\x70\x75\164\x20\164\171\x70\x65\x3d\42\150\151\x64\x64\145\156\x22\x20\156\x61\x6d\x65\x3d\42' . $sdvTemp . '\133\x70\x6f\x73\x74\x73\x5d\133' . $postId . '\x5d\133\x70\157\x73\x74\x5d\42\40\166\x61\x6c\x75\145\x3d\42' . $post['\160\157\163\x74'] . '\42\57\x3e' . $npp . '\x3c\57\x74\x64\x3e\74\164\x64\x20\x63\154\141\x73\x73\x3d\42\141\154\x69\147\156\x5f\x6c\145\146\x74\42\x3e' . $post['\x65\x6d\160\x6c\x6f\x79\x65\x65'] . '\74\57\164\x64\x3e' . '\x3c\x74\x64\x20\143\x6c\x61\163\x73\75\42\141\x6c\151\x67\x6e\137\154\x65\x66\x74\42\76' . $post['\x70\x6f\x73\164'] . '\x3c\57\164\144\76';
                for ($day = 1; $day <= $aData['\x64\x61\x79\x73\x49\x6e\115\x6f\156\164\150']; $day++) {
                    $isWeekend = \app\workflow\util\Util::isweekenddate($day, $aData['\155\157\156\164\x68'], $aData['\171\145\141\162']);
                    $className = $isWeekend ? '\167\145\145\153\x65\156\x64' : '\157\162\x64\151\x6e\x61\162\171';
                    $sName = $sdvTemp . '\133\x70\x6f\163\x74\163\x5d\x5b' . $postId . '\135\133' . $day . '\135';
                    $sSelectedValue = a($post, $day, $isWeekend ? '\xd0\222' : '\70');
                    if (mb_strlen($sSelectedValue) > 1) {
                        goto Label_36863;
                    }
                    $html .= '\x3c\164\144\40\x63\154\141\x73\x73\75\x22' . $className . '\x22\76\x3c\144\151\166\x20\x63\154\141\x73\163\x3d\42\x74\x69\x6d\145\163\x68\x65\145\x74\137\x64\141\171\42\x3e\x3c\163\160\x61\156\x20\x63\154\x61\x73\163\75\42\164\151\155\x65\x73\x68\x65\x65\164\137\x64\141\171\137\166\141\x6c\x75\145\42\x3e' . $sSelectedValue . '\74\57\163\x70\x61\156\x3e\x3c\x73\145\154\x65\x63\164\40\156\141\155\x65\75\42' . $sName . '\x22\x20' . $disabled . '\x63\x6c\141\x73\x73\x3d\x22\141\x62\142\162\x22\x20\x3e';
                    goto Label_36864;
                    Label_36863:
                    $html .= '\74\164\144\x20\143\x6c\141\163\163\75\42' . $className . '\42\76\x3c\144\x69\x76\40\x63\154\x61\163\163\x3d\x22\x74\151\x6d\145\x73\x68\x65\145\164\x5f\x64\x61\x79\x22\x3e\x3c\163\160\141\156\x20\163\x74\x79\x6c\145\x3d\42\160\141\144\144\151\156\x67\55\x6c\145\x66\x74\x3a\40\x2d\x35\160\170\73\40\x66\x6f\x6e\x74\55\163\151\x7a\x65\x3a\x38\160\170\x3b\42\x20\143\154\x61\x73\x73\75\42\164\x69\x6d\145\163\150\x65\145\x74\x5f\144\x61\171\x5f\x76\x61\154\165\x65\42\76' . $sSelectedValue . '\74\57\x73\160\141\156\x3e\74\163\x65\x6c\x65\x63\164\x20\156\x61\155\x65\x3d\42' . $sName . '\42\40' . $disabled . '\143\x6c\x61\x73\163\x3d\42\x61\142\x62\162\42\x20\76';
                    Label_36864:
                    foreach ($aData['\144\x61\171\124\171\160\145\163\117\x70\x74\x69\x6f\156\x73'] as $key => $value) {
                        $html .= '\x3c\157\160\164\151\x6f\x6e\40\x20\x76\x61\x6c\x75\145\75\42' . $key . '\42\x20' . ($key == $sSelectedValue ? '\163\145\154\145\x63\x74\145\x64\x3d\x22\x73\x65\x6c\145\143\164\x65\x64\42' : '') . '\76' . $value . '\74\x2f\x6f\x70\164\x69\x6f\x6e\76';
                    }
                    $html .= '\x3c\x2f\x73\145\154\x65\x63\164\x3e';
                    if (!$isWholeTimesheet) {
                        goto Label_36865;
                    }
                    $html .= '\x3c\151\x6e\x70\165\x74\x20\164\171\160\145\75\x22\x68\151\x64\x64\x65\x6e\42\x20\x6e\x61\x6d\145\x3d\42' . $sName . '\x22\x20\166\x61\154\x75\145\75\42' . $post[$day] . '\42\57\x3e';
                    Label_36865:
                    $html .= '\x3c\57\x64\151\166\76\x3c\57\164\144\76';
                }
                $npp++;
                $SummaryName = $sdvTemp . '\x5b\160\x6f\163\x74\163\x5d\133' . $postId . '\135';
                $html .= '\x3c\x74\144\76\x3c\144\x69\x76\40\151\x64\75\42\141\143\x74\x75\141\154\x5f\x77\x6f\x72\x6b\42\x3e\74\163\160\141\x6e\x3e\74\57\163\160\x61\156\76\x3c\x69\x6e\160\165\x74\x20\156\x61\155\x65\x3d\x22' . $SummaryName . '\x5b\141\x63\x74\x75\x61\x6c\x5f\x77\157\x72\153\135\42\x20\x74\171\x70\x65\x3d\x22\x68\151\144\x64\x65\x6e\x22\40\166\141\154\x75\145\x3d\42\42\57\x3e\74\x2f\x64\x69\166\76\x3c\57\164\144\x3e\12\40\40\40\40\40\40\x20\x20\40\40\40\x20\x20\40\x20\x20\x20\x20\x20\40\40\40\x20\x20\40\x20\40\x20\x3c\164\x64\76\x3c\144\x69\166\x20\x69\x64\75\42\157\x66\x66\x5f\x74\162\x61\166\x65\x6c\42\x3e\74\x73\160\141\x6e\x3e\74\x2f\x73\x70\141\x6e\x3e\74\151\156\x70\165\164\x20\156\141\x6d\145\x3d\42' . $SummaryName . '\133\157\146\146\x5f\164\x72\x61\166\x65\154\135\x22\x20\x74\171\160\x65\x3d\x22\150\151\144\144\x65\x6e\42\x20\x76\x61\154\165\145\75\x22\42\57\x3e\74\57\x64\151\166\76\x3c\57\x74\x64\76\12\x20\x20\x20\40\x20\40\40\x20\x20\40\x20\x20\x20\40\40\40\x20\40\x20\x20\40\40\x20\40\40\40\x20\40\x3c\x74\x64\x3e\74\x64\151\166\x20\151\x64\x3d\x22\160\145\162\x6d\151\x73\x69\x6f\x6e\x5f\146\141\151\x6c\42\76\x3c\x73\160\141\x6e\76\x3c\x2f\x73\x70\141\156\76\74\x69\x6e\160\165\x74\40\x6e\x61\155\x65\x3d\42' . $SummaryName . '\x5b\x70\145\x72\155\x69\163\x69\x6f\x6e\x5f\146\141\151\154\135\42\40\x74\171\x70\x65\x3d\x22\x68\x69\x64\x64\145\x6e\x22\x20\x76\x61\x6c\165\145\x3d\42\42\57\x3e\74\57\x64\151\x76\76\74\57\x74\x64\76\12\x20\x20\x20\40\x20\x20\x20\x20\x20\x20\40\x20\40\x20\x20\x20\40\x20\40\40\40\x20\40\x20\x20\x20\40\x20\x3c\164\144\x3e\x3c\x64\x69\x76\40\151\x64\75\x22\x64\x69\x73\x61\x62\x69\x6c\151\164\171\x22\76\x3c\163\160\x61\x6e\x3e\74\x2f\163\x70\141\x6e\76\74\x69\156\x70\x75\x74\x20\156\x61\155\145\x3d\x22' . $SummaryName . '\x5b\144\151\163\141\x62\x69\154\x69\x74\171\x5d\42\x20\164\171\x70\145\75\x22\150\x69\x64\144\x65\156\x22\x20\166\141\x6c\x75\x65\75\42\42\57\76\74\57\144\151\166\x3e\74\x2f\164\x64\x3e\12\40\x20\40\40\40\40\x20\40\x20\x20\40\40\x20\x20\40\40\40\x20\40\40\40\40\x20\x20\x20\40\x20\40\x3c\164\x64\76\x3c\144\x69\166\x20\151\144\75\x22\x74\162\x75\141\x6e\143\x79\42\76\74\163\160\141\x6e\76\74\x2f\x73\x70\141\x6e\76\x3c\151\156\160\x75\x74\40\x6e\141\155\x65\75\x22' . $SummaryName . '\133\164\162\165\141\x6e\x63\x79\135\x22\x20\164\171\160\x65\x3d\x22\x68\151\144\144\x65\156\42\x20\166\141\x6c\x75\145\x3d\42\x22\57\76\74\57\x64\x69\x76\x3e\x3c\x2f\x74\x64\76\xa\x20\x20\40\x20\40\40\40\x20\40\40\x20\40\40\x20\40\40\x20\x20\40\x20\40\40\40\40\x20\40\x20\40\x3c\x74\x64\76\x3c\144\151\166\x20\x69\144\75\42\150\x6f\x6c\x69\x64\141\171\137\167\151\x74\150\x6f\x75\x74\x5f\167\x61\x67\x65\x73\x22\76\x3c\x73\x70\141\156\76\74\x2f\x73\x70\x61\x6e\76\x3c\151\x6e\160\x75\164\40\x6e\x61\155\145\75\42' . $SummaryName . '\x5b\150\157\154\x69\144\x61\x79\x5f\167\x69\x74\150\x6f\165\164\137\x77\141\x67\145\163\x5d\x22\40\x74\171\x70\x65\x3d\42\x68\x69\144\x64\x65\156\42\x20\166\141\x6c\x75\145\75\x22\42\57\x3e\74\57\144\x69\x76\76\74\57\164\144\76\xa\x20\x20\x20\40\40\x20\40\40\x20\x20\40\40\40\40\x20\40\x20\x20\40\40\x20\40\40\x20\x20\x20\x20\40\x3c\164\x64\x3e\74\144\x69\166\x20\151\144\x3d\42\x6e\x65\x78\x74\137\150\x6f\x6c\x69\x64\x61\x79\42\76\x3c\x73\x70\141\x6e\76\x3c\57\163\160\141\x6e\x3e\74\x69\156\x70\x75\x74\40\x6e\x61\x6d\145\x3d\x22' . $SummaryName . '\133\156\x65\x78\164\137\150\x6f\154\x69\x64\141\171\135\x22\x20\x74\171\160\145\x3d\42\150\151\x64\144\x65\156\42\40\x76\141\154\165\145\x3d\x22\42\x2f\x3e\74\x2f\x64\x69\x76\x3e\74\x2f\164\144\76\xa\40\x20\x20\40\x20\x20\x20\40\x20\x20\40\40\x20\x20\x20\40\x20\x20\40\40\x20\40\40\40\x20\x20\40\40\x3c\x74\x64\x3e\74\144\151\x76\40\151\x64\75\x22\164\145\155\x70\x6f\162\x61\162\171\137\x73\x74\x61\x79\42\x3e\74\163\x70\141\x6e\x3e\74\x2f\163\x70\x61\156\x3e\x3c\x69\156\x70\165\x74\x20\x6e\141\x6d\145\75\x22' . $SummaryName . '\x5b\x74\145\155\160\x6f\x72\141\x72\171\x5f\163\164\141\171\x5d\42\40\x74\x79\160\145\x3d\x22\x68\151\x64\x64\145\156\42\40\166\141\154\x75\x65\75\x22\42\57\76\x3c\x2f\144\151\x76\76\x3c\57\164\x64\76\xa\40\x20\40\x20\40\40\x20\x20\x20\40\x20\x20\x20\40\40\x20\40\40\x20\40\40\40\x20\x20\x20\x20\x20\x20\74\x74\x64\76\x3c\x64\151\x76\x20\151\x64\x3d\x22\167\x6f\x6b\x72\x5f\151\x6e\137\150\157\x6c\171\144\141\x79\x73\x22\x3e\74\x73\x70\141\156\x3e\74\57\x73\x70\x61\x6e\x3e\x3c\x69\156\x70\165\x74\x20\x6e\141\x6d\145\75\x22' . $SummaryName . '\133\x77\x6f\x6b\x72\x5f\151\x6e\x5f\x68\x6f\154\x79\x64\141\x79\163\135\x22\40\164\x79\160\x65\75\x22\x68\151\144\144\x65\x6e\x22\40\166\x61\154\x75\145\75\42\42\57\76\x3c\57\144\x69\x76\x3e\x3c\57\164\144\x3e\12\x20\x20\x20\40\x20\x20\x20\40\40\x20\40\40\x20\x20\40\x20\40\x20\x20\x20\x20\40\40\40\40\40\x20\x20\x3c\164\144\x3e\x3c\x64\151\x76\40\x69\144\75\x22\163\x74\x75\x64\171\x5f\150\157\x6c\x69\144\141\x79\42\x3e\x3c\x73\x70\141\156\76\x3c\57\x73\160\141\x6e\76\74\151\156\x70\x75\164\40\x6e\141\x6d\145\75\42' . $SummaryName . '\x5b\163\x74\x75\x64\171\137\150\157\x6c\151\x64\141\171\x5d\x22\40\164\x79\160\x65\x3d\x22\150\x69\x64\144\x65\156\42\40\166\141\x6c\165\x65\x3d\x22\x22\x2f\76\x3c\57\x64\x69\x76\x3e\74\x2f\164\144\x3e\12\x20\x20\40\40\40\40\x20\x20\40\40\40\40\40\x20\40\x20\x20\40\x20\40\x20\40\x20\x20\40\40\x20\x20\x3c\x74\x64\x3e\74\144\x69\166\x20\151\x64\75\x22\167\145\145\153\x65\x6e\144\x73\42\x3e\74\x73\x70\x61\156\x3e\74\x2f\x73\160\141\156\76\x3c\151\x6e\160\165\164\x20\x6e\141\155\x65\x3d\42' . $SummaryName . '\x5b\x77\145\x65\x6b\x65\156\144\x73\x5d\x22\40\x74\x79\x70\145\x3d\42\150\x69\144\x64\145\156\42\x20\166\141\154\x75\x65\x3d\42\x22\57\x3e\74\57\x64\151\x76\x3e\74\x2f\164\x64\76\12\x20\40\x20\x20\x20\40\x20\x20\40\x20\40\x20\40\x20\x20\40\x20\40\x20\40\x20\40\40\40\40\40\40\40\x3c\57\164\x72\x3e';
            
            }
        }
        $html .= '\x3c\x2f\x74\142\x6f\x64\171\x3e\12\x20\x20\40\40\x20\40\40\x20\40\40\40\40\40\x20\40\x20\x20\74\57\x74\x61\x62\154\x65\x3e';
        return $html;
    }
    public static function timesheetvarview($aData, $sDoctypeId, $sDocumentId)
    {
        $oL = \app\system\Registry::get('\x6c\x6f\143\x61\x6c\145');
        ob_start();
        ?>
        <?php 
        if (!isset($aData['\163\164\162\165\143\164\165\162\145'])) {
            goto Label_36866;
        }
        ?>
        <div class='variable variable_timesheet'>
            <input type='button' value='<?php 
        echo $oL->get('\320\xad\xd0\272\xd1\x81\320\277\xd0\276\321\x80\321\x82\40\xd0\xb2\40\105\x78\143\145\x6c');
        ?>
' onclick='msf.page.go('/workflow/document/export-variable/<?php 
        echo $sDoctypeId;
        ?>
/<?php 
        echo $sDocumentId;
        ?>
/<?php 
        echo $aData['\166\x61\162\x4e\x61\x6d\x65'];
        ?>
');' />
            <div id='timesheet-table<?php 
        echo $aData['\166\x61\162\124\x79\x70\x65'];
        ?>
' style='padding-top: 5px;'>
                <?php 
        echo \app\workflow\WFW::timesheetvartableview($aData);
        ?>
            </div>
            <!--[if IE]>
            <style type='text/css'>
                .rotated_cell
                {
                    text-align: left;
                    padding-bottom: 10px;
                }

                .rotate_text
                {
                    -ms-writing-mode: bt-rl;
                    filter: flipH() flipV();
                    top: 0px;
                }
            </style>
            <![endif]-->
        </div>
    <?php 
        Label_36866:
        ?>
        <?php 
        $s = ob_get_clean();
        return $s;
    }
    public static function timesheetvar2edit($aData, $sDoctypeId, $sDocumentId, $mode = '\x63\x72\145\141\x74\x65')
    {
        $oL = \app\system\Registry::get('\154\157\143\x61\x6c\145');
        ob_start();
        ?>
        <script type='text/javascript'>

            function isValid(obj)
            {
                for (var prop in obj)
                {
                    if(!$('[name*=''+obj[prop]+'']').length)
                    {
                        ShowErrorMessage('<?php 
        echo $oL->get('\320\x9f\xd1\200\320\276\320\262\320\xb5\xd1\200\xd1\x8c\321\x82\xd0\265\40\xd0\275\320\260\xd0\273\320\270\321\x87\xd0\xb8\xd0\xb5\40\320\262\321\x81\320\265\321\205\40\320\xbf\320\276\320\273\320\xb5\320\xb9\40\321\210\xd0\xb0\320\xb1\320\273\320\xbe\xd0\xbd\320\xb5\40\320\264\320\276\xd0\xba\321\x83\320\274\xd0\265\320\xbd\xd1\202\xd0\260');
        ?>
');
                        return  false;
                    }
                }

                return true;
            }

            function ShowErrorMessage(t)
            {
                MSF_StatusBar.hideWait();
                $('#results').show().children('#error').append('<div class='status_error' id='statusErrorItem_0'>'+t+'<br /></div>').show();
                setTimeout(function() {
                    $('#statusErrorItem_0').hide();
                    $('#statusErrorItem_0').remove();
                    if($('#error').html().trim() == '') {
                        $('#error').hide();
                    }
                }, 5000);
            };

            $(document).ready(function(){
                var varType = '<?php 
        echo $aData['\166\x61\162\124\171\160\x65'];
        ?>
';
                if(varType == 'whole_timesheet2'){
                    var oConfig =  { // 
                        'year': '<?php 
        echo $aData['\x76\141\x72']['\171\x65\x61\x72'];
        ?>
',
                        'month': '<?php 
        echo $aData['\166\141\162']['\155\x6f\x6e\164\150'];
        ?>
',
                    };
                } else {
                    var oConfig =  { // 
                        'subdivision': '<?php 
        echo $aData['\166\141\162']['\x73\x75\x62\x64\151\166\151\163\x69\157\x6e'];
        ?>
',
                        'year': '<?php 
        echo $aData['\166\141\162']['\171\x65\141\x72'];
        ?>
',
                        'month': '<?php 
        echo $aData['\x76\x61\162']['\x6d\x6f\x6e\164\150'];
        ?>
',
                    };
                }
                var oDates =  { // 
                    'year': '<?php 
        echo isset($aData['\171\145\141\162']) ? $aData['\x79\145\x61\162'] : '';
        ?>
',
                    'month': '<?php 
        echo isset($aData['\155\x6f\x6e\x74\x68']) ? $aData['\155\x6f\x6e\164\150'] : '';
        ?>
',
                    'monthEnd': '<?php 
        echo isset($aData['\144\x61\171\163\111\x6e\x4d\x6f\x6e\164\150']) ? $aData['\144\141\171\x73\x49\156\x4d\157\x6e\164\150'] : '';
        ?>
',
                };

                var summaryConfig = $.parseJSON('<?php 
        echo addslashes(\app\system\Json::encode($aData['\166\141\162']['\x64\157\143\164\x79\160\x65\102\x79\x54\x61\147']));
        ?>
');
                var colorByTag = $.parseJSON('<?php 
        echo addslashes(\app\system\Json::encode($aData['\143\157\154\157\162\x42\171\x54\141\x67']));
        ?>
');
                var tableExists = false;
                /* */
                $('#bGenerate<?php 
        echo $aData['\x76\x61\162\124\x79\x70\x65'];
        ?>
').click(function()
                {
                    if(!isValid(oConfig))
                        return;

                    if(tableExists)
                    {
                        if (!confirm('<?php 
        echo $oL->get('\xd0\222\xd1\x8b\x20\xd1\x83\xd0\262\xd0\265\xd1\x80\320\265\xd0\275\321\x8b\54\40\321\207\xd1\202\320\276\40\xd1\x85\320\xbe\321\x82\xd0\xb8\xd1\202\xd0\265\40\xd1\201\320\xbe\320\xb7\320\264\320\260\321\202\321\214\x20\320\275\xd0\xbe\320\xb2\321\203\321\216\x20\321\x82\xd0\260\320\261\320\xbb\xd0\270\xd1\206\xd1\203\54\40\321\203\xd0\xb4\320\xb0\320\273\xd0\xb8\xd0\xb2\x20\321\x81\xd1\202\xd0\xb0\321\x80\xd1\203\xd1\x8e\77');
        ?>
'))
                        {
                            return;
                        }
                    }

                    request = $.ajax(
                        {
                            type:		'POST',
                            url:		'/workflow/document/<?php 
        echo str_replace('\x5f', '\x2d', $aData['\x76\x61\x72\x54\x79\x70\x65']);
        ?>
/<?php 
        echo $sDoctypeId;
        ?>
/<?php 
        echo $sDocumentId;
        ?>
/<?php 
        echo $aData['\166\x61\x72']['\x6e\141\155\145'];
        ?>
',
                            data:		$('#createRowForm').serialize(),
                            dataType: 'json',
                            success: function(oData)
                            {
                                if(array_key_exists('error', oData))
                                {
                                    ShowErrorMessage(oData.error);
                                }
                                else
                                {
                                    $('#timesheet-table<?php 
        echo $aData['\x76\141\162\124\x79\x70\145'];
        ?>
').html(oData.html);
                                    calcAllSummary();
                                    mergeTd();
                                }
                            },
                            error:function(data)
                            {
                                ShowErrorMessage('<?php 
        echo $oL->get('\320\237\321\200\xd0\xbe\320\270\320\267\xd0\276\xd1\210\xd0\xbb\320\xb0\x20\xd0\276\xd1\210\320\xb8\xd0\xb1\xd0\xba\xd0\260\x20\xd0\xb2\320\276\40\xd0\xb2\xd1\200\xd0\xb5\xd0\274\321\x8f\x20\320\267\320\260\320\277\321\x80\xd0\276\xd1\x81\320\xb0\56');
        ?>
');
                            }
                        });

                });

                //        
                $('.variable_timesheet select[name*='[posts]']').live('change', function()
                {

                    var currentPostId = $(this).parent().parent().parent().attr('id');
                    var currentSdvId = $(this).parent().parent().parent().attr('sdvid');
                    var td = $(this).parent().parent();
                    var div = $(this).parent();
                    $('[name=''+$(this).attr('name')+'[edited]']').remove();
                    calcSummary(currentPostId, currentSdvId);
                    div.append('<input type='hidden' name=''+$(this).attr('name')+'[edited]' value=&#