<?php
include($_SERVER['DOCUMENT_ROOT'] .'/script/HeaderInc.php');
//SiteLibs::GetVarDump($_SESSION);

if ((true === isset($_SESSION['SessionAuth']['SvtAdmin']['reg']) && 1 == $_SESSION['SessionAuth']['SvtAdmin']['reg']) ||
    (true === isset($_SESSION['SessionAuth']['SvtOperatorAdv']['reg']) && 1 == $_SESSION['SessionAuth']['SvtOperatorAdv']['reg']) ||
    (true === isset($_SESSION['SessionAuth']['SvtOperator']['reg']) && 1 == $_SESSION['SessionAuth']['SvtOperator']['reg'])
   ){
  $smarty->assign('VarMenuMain', $VarMenu);
  
  $ObjSvtTypeMod = new SvtTypeMod($MS_SP);
//  $ArrSvtType = $ObjSvtTypeMod->GetFromDb('SqlSvtTypeAll', 'GetAssoc', 'YEAR(b.svt_date) < YEAR(NOW())-a.svttype_writeoff+1');
  $ArrSvtType = $ObjSvtTypeMod->GetFromDb('SqlSvtTypeAll', 'GetAssoc', 'YEAR(b.svt_date) < YEAR(NOW())-a.svttype_writeoff');
  $ArrSvtTypeAll = $ObjSvtTypeMod->GetFromDb('SqlSvtTypeAll', 'GetAssoc');
//  SiteLibs::GetVarDump($ArrSvtTypeAll);
  $smarty->assign('ArrSvtType', $ArrSvtType);
  $smarty->assign('ArrSvtTypeAll', $ArrSvtTypeAll);
  $VarPagesTxt .= $smarty->fetch('Svt/ReportSvtForWritteoffCharts.tpl');

  if(true === is_file($MS_SP->SP_CurrFileNameText)){
    $VarPagesTxt .= $smarty->fetch($MS_SP->SP_CurrFileNameText);
  }
}
else{
  $smarty->assign('VarError', $MS_SP->Sp_LangMessage['error']['ErrAuthAccessDenied']);
  $VarPagesTxt .= $smarty->fetch('AccessDenied.tpl');
}

$smarty->assign('VarPagesTxt', @$VarPagesTxt);
if (true === isset($MS_SP->SP_CurrPage['template_file']) && '' != $MS_SP->SP_CurrPage['template_file']){
	$smarty->display($MS_SP->SP_CurrPage['template_file']);
}
else {
	$smarty->display('Page.tpl');
}
include($_SERVER['DOCUMENT_ROOT'] .'/script/FooterInc.php');
?>