$dateDataObj = json_decode($_GET['dateDataObj']);
	        $specification_num = 
	*/
			
			$our_firm_acting_manegement_face = our_firm_acting_manegement_face_new($_GET['signator_id']);
			$client_firm_acting_manegement_face = Client::requisites_acting_manegement_face_details($_GET['requisit_id']);
			
		    $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';
				
<?php 
   
    
	include_once(ROOT."/libs/php/classes/agreement_class.php");
    $oferta_data = Agreement::fetch_oferta_common_data($oferta_id);
    /*echo '<pre>'; print_r($oferta_data); echo '</pre>';*/

	$path = $_SERVER['DOCUMENT_ROOT'].'/admin/order_manager/data/agreements/'.$client_id.'/'.substr($oferta_data['date_time'],0,4).'/offerts/'.$oferta_data['our_requisit_id'].'_'.$oferta_data['client_requisit_id'].'/'.$oferta_data['id'].'.tpl';
	 
    if(isset($_POST['submit_ok']))
	{
		put_content($path,$_POST['page_content']);
	}
	
	
  
 
    $page_content = get_content($path); 

?>

<?php include ('./skins/tpl/agreement/tinymse_js_block.html'); ?>
<style> .main_menu_tbl{ display:none; } </style>
<div style="margin:auto;width:1200px;">
    <div style="margin:10px 20px;">
        <button type="button" onclick="location = '?<?php echo htmlspecialchars(addOrReplaceGetOnURL('section=agreement_editor')); ?>';" style="cursor:pointer;">назад</button>
    </div>
    <div style="margin:0px 20px;">
    <form action="" method="post">
    <textarea id='elm1' name='page_content' style="width:1150px; height:600px;"><?php echo $page_content; ?></textarea>
    <input type='reset' value='сброс'>&nbsp;&nbsp;&nbsp;&nbsp;<input type='submit' name='submit_ok' value='изменить'>