<?php
class bizinfo
{
	var $db;
	var $tpl;
	var $page;
	
	function bizinfo()
	{
		global $db;
		global $config;
		global $tpl;		
		$this -> db     = & $db;
		$this -> tpl    = & $tpl;
	}
	
	function get_detail($bcid)
	{
		$sql="select * from ".CERTIFICATION." where company_id='$bcid'";
		$this->db->query($sql);
		$re=$this->db->fetchRow();
		return $re;
	}
	
	function update_business_info()
	{
		global $bcid;

		if(isset($_POST["type"]) && $_POST["type"]='update_protect')
		{
			$sql = "update ".CERTIFICATION." set com_reg_id_protect='$_POST[com_reg_id_protect]',com_reg_add_protect='$_POST[com_reg_add_protect]',com_deputy_protect='$_POST[com_deputy_protect]',com_reg_capital_protect='$_POST[com_reg_capital_protect]' where company_id='$bcid'";
		}
		else
		{
			$uptime=date("Y-m-d H:i:s");
			$sql="select id from ".CERTIFICATION." where company_id='$bcid'";
			$this->db->query($sql);
			$re=$this->db->fetchRow();
			if($re['id'])
			{
				$sql = "update ".CERTIFICATION." set
				person_name='$_POST[person_name]',	job='$_POST[job]',com_reg_name='$_POST[com_reg_name]',com_reg_id='$_POST[com_reg_id]',com_reg_add='$_POST[com_reg_add]',com_deputy='$_POST[com_deputy]',com_reg_capital='$_POST[com_reg_capital]',com_reg_type='$_POST[com_reg_type]',com_reg_time='$_POST[com_reg_time]',com_reg_time_ex='$_POST[com_reg_time_ex]',com_reg_area='$_POST[com_reg_area]',com_reg_unit='$_POST[com_reg_unit]',com_check='$_POST[com_check]',com_reg_id_protect='$_POST[com_reg_id_protect]',com_reg_add_protect='$_POST[com_reg_add_protect]',com_deputy_protect='$_POST[com_deputy_protect]',com_reg_capital_protect='$_POST[com_reg_capital_protect]',uptime='$uptime',statu='0',pic='$_POST[pic]' where company_id='$bcid'";
			}
			else
			{
				$sql="insert into ".CERTIFICATION."(person_name,job,com_reg_name,com_reg_id,com_reg_add,com_deputy,com_reg_capital,com_reg_type,com_reg_time,com_reg_time_ex,com_reg_area,com_reg_unit,com_check,com_reg_id_protect,com_reg_add_protect,com_deputy_protect,com_reg_capital_protect,uptime,company_id,pic) values('$_POST[person_name]','$_POST[job]','$_POST[com_reg_name]','$_POST[com_reg_id]','$_POST[com_reg_add]','$_POST[com_deputy]','$_POST[com_reg_capital]','$_POST[com_reg_type]','$_POST[com_reg_time]','$_POST[com_reg_time_ex]','$_POST[com_reg_area]','$_POST[com_reg_unit]','$_POST[com_check]','$_POST[com_reg_id_protect]','$_POST[com_reg_add_protect]','$_POST[com_deputy_protect]','$_POST[com_reg_capital_protect]','$uptime','$bcid','$_POST[pic]')";
			}
		}
		$this->db->query($sql);
	}
}
?>
