$oferta_id = Agreement::create_oferta($dateDataObj,$_SESSION['data_for_specification'],$client_id,$_GET['our_firm_id'],$_GET['requisit_id'],$our_firm_acting_manegement_face,$client_firm_acting_manegement_face,$_GET['short_description'],urldecode($_GET['address']),$_GET['prepayment']);
		    unset($_SESSION['data_for_specification']);
		    // создали оферту перезагружаем страницу с указанием номера
			header('Location:?'.addOrReplaceGetOnURL('open=oferta&oferta_id='.$oferta_id,'short_description')); 
			exit;  
		}
		
		$general_data =  Agreement::fetch_oferta_common_data($_GET['oferta_id']);
        if(!$general_data){ echo 'не удалось получить данные оферты'; return; }
		
		//!!!!!!!!!!!!!!!  oferta_num  oferta_type date_time
		//
		//  echo '<pre>general_data'; print_r($general_data); echo '</pre>';
		
		$oferta_tbl_data =  Agreement::fetch_oferta_data($_GET['oferta_id']);
		// echo '<pre>oferta_data'; print_r($oferta_tbl_data); echo '</pre>';
		
		$table_data = Agreement::build_specification_tbl($dateDataObj->doc_type,$oferta_tbl_data);
		// echo '<pre>'; print_r($table_data); echo '</pre>';
		
		// считываем файл оферты
		$file_name = $_SERVER['DOCUMENT_ROOT'].'/admin/order_manager/data/agreements/'.$client_id.'/'.substr($general_data['date_time'],0,4).'/offerts/'.$general_data['our_requisit_id'].'_'.$general_data['client_requisit_id'].'/'.$general_data['id'].'.tpl';
				
		$fd = fopen($file_name,"r");
		$doc = fread($fd,filesize($file_name));
		fclose($fd);

      
		// наши реквизиты
		$our_firm = fetch_our_certain_firm_data($general_data['our_requisit_id']);
			{
				eval('?>'.$tpl.'<?php ');  
				$itogo += (float)$row['summ'];		
			}
			
			$rows = ob_get_contents();
			ob_get_clean();
			
			include './skins/tpl/agreement/specification_edit_tbl.tpl';
		}
		else $rows = 'ошибка получения данных specification_editor_controller.php';
    }
    if($dateDataObj->doc_type=='oferta')
	{
	    include_once(ROOT."/libs/php/classes/agreement_class.php");
		$oferta_data_arr =  Agreement::fetch_oferta_data($_GET['oferta_id']);

		if(count($oferta_data_arr)>0)
		{
			
			$tpl = './skins/tpl/agreement/specification_edit_row.tpl';
			$fd = fopen($tpl,'r');
			$tpl = fread($fd,filesize($tpl));
			fclose($fd);
			
			ob_start();
			$row_num = 0;
			$itogo=0;
			foreach($oferta_data_arr as $row)
			{
				eval('?>'.$tpl.'<?php ');