<?php
/***********************************************************************************/
/* MassCRM客户关系管理系统							   */
/* ========================      						   */
/* 欢迎使用 MassCRM ,在您开始使用之前,请务必完整阅读本软件附带的全部说明档	   */
/***********************************************************************************/
/* Welcome to http://www.massboxes.com & http://masscrm.massboxes.com		   */
/***********************************************************************************/
	require_once "../includes/check_login.inc.php";
	require_once "../includes/config.inc.php";
	require_once "../includes/common.inc.php";
	require_once"../includes/BiaoCommon.class.php";
	
	if(file_exists("../account/".$account.".startup.lock")){
		echo"<script>alert(\"帐套已经启用！\");</script>";
		echo"<br><br><h1><center><font color=red>帐套已经启用，不用再启动！</font></center></h1>";
		exit;
	}
	
	if($_POST[startup]){
	
		$file="../account/".$account.".startup.lock";
		$ofile=fopen($file,"w");
		fputs($ofile,date("Y-m-d H:i:s",time()));
		fclose($ofile);
		
		if(!file_exists("../account/".$account.".startup.lock")){
			echo"<script>alert(\"启用帐套失败！\");</script>";		
			exit;
		}
		
		global $boxesDB; 
		$boxesDB=new BiaoCommon($conn); 
		$boxesDB->setTableName("boxes_module");
		$sql="where bm_auto_id=43";	//最后分隔线
		$boxesDB->setCondition($sql);
		$boxes_result=$boxesDB->deleteRow();
		
		$sql="where bm_auto_id=44";	//库存初始化
		$boxesDB->setCondition($sql);
		$boxes_result=$boxesDB->deleteRow();
		
		$sql="where bm_auto_id=45";	//期初应收
		$boxesDB->setCondition($sql);
		$boxes_result=$boxesDB->deleteRow();
		
		$sql="where bm_auto_id=46";	//期初应付
		$boxesDB->setCondition($sql);
		$boxes_result=$boxesDB->deleteRow();
		
		$sql="where bm_auto_id=47";	//启用帐套
		$boxesDB->setCondition($sql);
		$boxes_result=$boxesDB->deleteRow();
	}
	
?>
<html>
<HEAD>
	<TITLE>启用帐套</TITLE>
	<META HTTP-EQUIV=”Pragma” CONTENT=”no-cache”>
	<META HTTP-EQUIV=”Cache-Control” CONTENT=”no-cache”>
	<META HTTP-EQUIV=”Expires” CONTENT=”0”>
	<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
	<script Language=JavaScript src="../includes/js/forbidden.js"></script>
	<link href="../images/default/style.css" rel="stylesheet" type="text/css">

	<style>
		body {
			margin-left: 0px;
			margin-top: 0px;
			margin-right: 0px;
			margin-bottom: 0px;
			background-color: #ECE9D8;
		}
	</style>

</HEAD>
<body>
<table width="100%" height="100%" border=0 cellspacing=0 cellpadding=0>
		<tr>
			<td valign="top">
				<TABLE  width="100%" height="100%" border=0 cellspacing=0 cellpadding=0 onselectstart="return false" style="table-layout: fixed">
					<TR>
						<TD colspan=2>
							<TABLE height="97%" width="101%" border=0 cellspacing=2 cellpadding=0>
								<TR>
									<TD id="mywindows" align="center">
									<br>
									<img src="../images/default/main/B5.gif" width="203" height="203">
									<br>
									<?php
									if(file_exists("../account/".$account.".startup.lock")){
									?>
									<h1><font color=red>帐套启用成功！</font></h1><br>
									<?php
									}
									else{
									?>
									<form name="form1" method="post" action="">
									  <input type="submit" name="startup" style="width:300; height:35; background-color:#CCCCCC " value="启动帐套" onClick="if(confirm('确定要启动帐套吗？启动后将不能再进行期初设置(库存初始化、期初应收和应付)！')) return true; else return false;">
									</form>
									<?php
									}
									?>
									<p style="color:red">&nbsp;</p></TD>
								</TR>
						  </TABLE>
						</TD>
					</TR>
			  </TABLE>
			</td>
		</tr>
	</table>
</body>
</html>