<?php
$obj_tab_area=new cls_tab_sys_area();
$obj_tab_company=new cls_tab_hr_company();


if(isset($get_act)&&$get_act=="save"){
	$arr_fields=array();
	if(isset($get_company_name)) $arr_fields["company_name"]=$get_company_name;
	if(isset($get_company_idnum)) $arr_fields["company_idnum"]=$get_company_idnum;
	if(isset($get_company_industry)) $arr_fields["company_industry"]=$get_company_industry;
	if(isset($get_company_nature)) $arr_fields["company_nature"]=$get_company_nature;
	if(isset($get_company_builddate)) $arr_fields["company_builddate"]=$get_company_builddate;
	if(isset($get_company_regcapital)) $arr_fields["company_regcapital"]=$get_company_regcapital;
	if(isset($get_company_currency)) $arr_fields["company_currency"]=$get_company_currency;
	if(isset($get_company_scale)) $arr_fields["company_scale"]=$get_company_scale;
	if(isset($get_company_area)) $arr_fields["company_area"]=$get_company_area;
	if(isset($get_company_intro)) $arr_fields["company_intro"]=$get_company_intro;
	if(isset($get_company_linkname)) $arr_fields["company_linkname"]=$get_company_linkname;
	if(isset($get_company_tel)) $arr_fields["company_tel"]=$get_company_tel;
	if(isset($get_company_fax)) $arr_fields["company_fax"]=$get_company_fax;
	if(isset($get_company_email)) $arr_fields["company_email"]=$get_company_email;
	if(isset($get_company_website)) $arr_fields["company_website"]=$get_company_website;
	if(isset($get_company_zip)) $arr_fields["company_zip"]=$get_company_zip;
	if(isset($get_company_address)) $arr_fields["company_address"]=$get_company_address;
	if(count($arr_fields)>0){
		$obj_result = $obj_db->query("SELECT * FROM ".DB_PRE."hr_company where company_user_id='".$obj_ctl_user->id."'");
		if($obj_rs = $obj_db->fetch_array($obj_result))
		{
			$arr_fields["company_id"]=$obj_rs["company_id"];
		}else{
			$arr_fields["company_user_id"]=$obj_ctl_user->id;
		}
		$arr_msg=$obj_tab_company->on_save($arr_fields);
		if($arr_msg["err"]!="")
		{
			$obj_msg->alert($arr_msg["err"]);
		}
	}
}
$obj_result = $obj_db->query("SELECT * FROM ".DB_PRE."hr_company where company_user_id='".$obj_ctl_user->id."'");
if($obj_rs = $obj_db->fetch_array($obj_result))
{
	$obj_rs["company_area"]=$obj_tab_area->get_select_area("company_area",$obj_rs["company_area"]);
	$obj_rs["company_industry"]=get_select_html($obj_tab_company->industry,$obj_rs["company_industry"]);
	$obj_rs["company_nature"]=get_select_html($obj_tab_company->nature,$obj_rs["company_nature"]);
	$obj_rs["company_currency"]=get_select_html($obj_tab_company->currency,$obj_rs["company_currency"]);
	$obj_rs["company_scale"]=get_select_html($obj_tab_company->scale,$obj_rs["company_scale"]);
	$arr_company = $obj_rs;
}else{
	//没有简介时，初始数据
	$arr_x=$obj_db->get_fields(DB_PRE."hr_company");
	foreach($arr_x as $item){
		$arr_company[$item]="";
	}
	$arr_company["company_area"]=$obj_tab_area->get_select_area("company_area");
	$arr_company["company_industry"]=get_select_html($obj_tab_company->industry);
	$arr_company["company_nature"]=get_select_html($obj_tab_company->nature);
	$arr_company["company_currency"]=get_select_html($obj_tab_company->currency);
	$arr_company["company_scale"]=get_select_html($obj_tab_company->scale);
}

$this_company_id=$arr_company["company_id"];
//是否生成html文件
$this_html=$obj_tab_company->get_htmlinfo($arr_company["company_id"]);

?>