require '../../init.php'; header('Content-Type: application/json'); $data = ['error' => 1]; $recordId = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : null; $rec = Register::GetRecord($recordId, 1); $data = $rec; if(Service::IsClient()) { ob_start(); include('_photos_client.php'); $photos = ob_get_contents(); ob_end_clean(); $data['photoHTML'] = '
'; $data['billHTML'] = '';//'' . $data['bill_files'] . ''; foreach($data['bill_files'] as $bf) { $arFile = CFile::GetFileArray($bf); // $data['billHTML'] = $arFile; $data['billHTML'] .= ''; } Register::ViewRecord($recordId, 1); $data['counts'] = [ 0 => 0, 1 => Register::GetRecordsTotal(0, 0, 0, $clientId, 0, 0, 1), 2 => Register::GetRecordsTotal(0, 0, 0, $clientId, 0, 0, 2), ]; $data['counts'][0] = $data['counts'][1] + $data['counts'][2] + $data['counts'][3]; } else { $data['photoHTML'] = Register::GetPhotoReport($recordId); } echo \Bitrix\Main\Web\Json::encode($data);