Jelajahi Sumber

开票日志相关功能

caipin 8 tahun lalu
induk
melakukan
0d2eca878e

+ 436 - 333
protected/controller/InvoiceController.php

@@ -1,7 +1,11 @@
 <?php
 
 /**
- * @author darkredz
+ * 开票功能控制器
+ * @author CP
+ * @version 1.0
+ * @namespace invoice
+ * @package invoiceController
  */
 class InvoiceController extends DooController {
 	public $staff;
@@ -9,337 +13,437 @@ class InvoiceController extends DooController {
 	public $executeId;
 	public static $NEW = 0;
 	public static $NEW2 = 0;
-	private $INVOICEKEY="APPROVAL";
-
+	private $INVOICEKEY = "APPROVAL";
 	function __construct() {
-		if(isset($_COOKIE["staff"])){
-
-			if(!empty($_COOKIE["staff"])){
-
+		if (isset ( $_COOKIE ["staff"] )) {
+			
+			if (! empty ( $_COOKIE ["staff"] )) {
+				
 				Doo::loadModel ( 'staff' );
-				Doo::loadModel('verify');
-				$verify=new verify();
+				Doo::loadModel ( 'verify' );
+				$verify = new verify ();
 				$staff = new staff ();
-				Doo::loadModel("execute");
-				$execute=new execute();
-
-				$verifyList=$verify->find(array('select'=>'staff','asArray'=>true));
-				$list=array();
-
-				//判断角色的审批权限
-				foreach ($verifyList as $key=>$value){
-					$ver=json_decode($value['staff']);
-
-					foreach ($ver as $k=>$v){
-						if ($v[1]=='ROLE'){
-							$roleList=json_decode($v[3]);
-							foreach ($roleList as $t=>$g){
-								$gList=explode("_", $g);
-								array_push($list, $gList[0]);
-								//print_r($list);
+				Doo::loadModel ( "execute" );
+				$execute = new execute ();
+				
+				$verifyList = $verify->find ( array (
+						'select' => 'staff',
+						'asArray' => true 
+				) );
+				$list = array ();
+				
+				// 判断角色的审批权限
+				foreach ( $verifyList as $key => $value ) {
+					$ver = json_decode ( $value ['staff'] );
+					
+					foreach ( $ver as $k => $v ) {
+						if ($v [1] == 'ROLE') {
+							$roleList = json_decode ( $v [3] );
+							foreach ( $roleList as $t => $g ) {
+								$gList = explode ( "_", $g );
+								array_push ( $list, $gList [0] );
+								// print_r($list);
 							}
-						}else
-							array_push($list, $v[0]);
+						} else
+							array_push ( $list, $v [0] );
 					}
 				}
-
-				//判断执行人的审批权限
-				$executeList=$execute->find(array('select'=>'staff','asArray'=>true));
-				$list2=array();
-				foreach ($executeList as $key=>$value){
-					$ver=json_decode($value['staff']);
-
-					foreach ($ver as $k=>$v){
-						array_push($list2, $v[0]);
+				
+				// 判断执行人的审批权限
+				$executeList = $execute->find ( array (
+						'select' => 'staff',
+						'asArray' => true 
+				) );
+				$list2 = array ();
+				foreach ( $executeList as $key => $value ) {
+					$ver = json_decode ( $value ['staff'] );
+					
+					foreach ( $ver as $k => $v ) {
+						array_push ( $list2, $v [0] );
 					}
 				}
-
-				$eidList=file_get_contents("protected/config/execute/execute.ini");
-				$eidList=array_filter(explode(",", $eidList));
-
-				$this->executeId= array_merge($list2,$eidList);
-
-				$this->verifyId=$list;
-				$this->staff=$staff->getUserByIdList($_COOKIE["staff"]);
-				ReceiptController::$NEW= $this->getReceiptCount();
-				ReceiptController::$NEW2= $this->getExeCount();
+				
+				$eidList = file_get_contents ( "protected/config/execute/execute.ini" );
+				$eidList = array_filter ( explode ( ",", $eidList ) );
+				
+				$this->executeId = array_merge ( $list2, $eidList );
+				
+				$this->verifyId = $list;
+				$this->staff = $staff->getUserByIdList ( $_COOKIE ["staff"] );
+				ReceiptController::$NEW = $this->getReceiptCount ();
+				ReceiptController::$NEW2 = $this->getExeCount ();
 				return "/";
 			}
 		}
-
+		
 		Doo::loadCore ( 'uri/DooUriRouter' );
 		$router = new DooUriRouter ();
 		$routeRs = $router->execute ( Doo::app ()->route, Doo::conf ()->SUBFOLDER );
-
-		if($routeRs['1']!="login"){
+		
+		if ($routeRs ['1'] != "login") {
 			header ( 'Content-Type:text/html;charset=utf-8' );
-			@header ( "Location: /login"  );
+			@header ( "Location: /login" );
 		}
 	}
-
-	function invoice(){
-
-		$data['memu']="invoice";
-		$data['staff']=$this->staff;
-		$data['receiptMemu']='invoice';
-		$data['verifyId']=$this->verifyId;
-		$data['executeId']=$this->executeId;
+	function invoice() {
+		$data ['memu'] = "invoice";
+		$data ['staff'] = $this->staff;
+		$data ['receiptMemu'] = 'invoice';
+		$data ['verifyId'] = $this->verifyId;
+		$data ['executeId'] = $this->executeId;
 		$this->render ( "/admin/invoice", $data );
 	}
-
-	function invoiceAdd(){
-		Doo::loadModel('L_category');
-		$lCategory=new L_category();
-
-		$category=$lCategory->find(array('asArray'=>true));
-
-		$data['category']=$category;
-
-		$data['memu']="invoice";
-		$data['staff']=$this->staff;
-		$data['receiptMemu']='invoice';
-		$data['verifyId']=$this->verifyId;
-		$data['executeId']=$this->executeId;
+	function invoiceAdd() {
+		Doo::loadModel ( 'L_category' );
+		$lCategory = new L_category ();
+		
+		$category = $lCategory->find ( array (
+				'asArray' => true 
+		) );
+		
+		$data ['category'] = $category;
+		
+		$data ['memu'] = "invoice";
+		$data ['staff'] = $this->staff;
+		$data ['receiptMemu'] = 'invoice';
+		$data ['verifyId'] = $this->verifyId;
+		$data ['executeId'] = $this->executeId;
 		$this->render ( "/admin/invoiceAdd", $data );
 	}
-
-	function invoiceAddDo(){
-		$cid=$this->get_args('cid')&&is_numeric($this->get_args('cid'))?$this->get_args('cid'):0;
-		$invoiceType=$this->get_args('invoiceType')&&is_numeric($this->get_args('invoiceType'))?$this->get_args('invoiceType'):0;
-		$doPost=$this->get_args('doPost')&&is_numeric($this->get_args('doPost'))?$this->get_args('doPost'):0;
-		$invoicePrice=$this->get_args('invoicePrice')?$this->get_args('invoicePrice'):"";
-		$invoiceElement=$this->get_args('invoiceElement')?$this->get_args('invoiceElement'):"";
-		$invoiceTitle=$this->get_args('invoiceTitle')?$this->get_args('invoiceTitle'):"";
-		$invoiceCompany=$this->get_args('invoiceCompany')?$this->get_args('invoiceCompany'):"";
-		$TIN=$this->get_args('TIN')?$this->get_args('TIN'):"";
-		$address=$this->get_args('address')?$this->get_args('address'):"";
-		$phone=$this->get_args('phone')?$this->get_args('phone'):"";
-		$bank=$this->get_args('bank')?$this->get_args('bank'):"";
-		$bankAccount=$this->get_args('bankAccount')?$this->get_args('bankAccount'):"";
-		$recipients=$this->get_args('recipients')?$this->get_args('recipients'):"";
-		$recipientsPhone=$this->get_args('recipientsPhone')?$this->get_args('recipientsPhone'):"";
-		$recipientsAddress=$this->get_args('recipientsAddress')?$this->get_args('recipientsAddress'):"";
-
-		$mailItems=$this->get_args('mailItems')?$this->get_args('mailItems'):"";
-		$remark=$this->get_args('remark')?$this->get_args('remark'):"";
-
-		if(!empty($cid)&&!empty($invoicePrice)&&!empty($invoiceElement)){
-			Doo::loadModel('invoice');
-			$invoice=new invoice();
-			Doo::loadModel('L_category');
-			$lCategory=new L_category();
-			Doo::loadModel('invoiceManage');
-			$invoiceManage=new invoiceManage();
-            
+	
+	/**
+	 * 提交一份开票申请,并记录下操作日志
+	 *
+	 * @since 1.0.0
+	 *       
+	 * @var integer cid 办事处ID
+	 * @var integer invoiceType 发票类型
+	 * @var integer doPost 是否邮寄
+	 * @var integer invoicePrice 开票金额
+	 * @var string invoiceElement 开票内容
+	 * @var string invoiceTitle 发票抬头
+	 * @var string invoiceCompany 单位名称
+	 * @var string TIN 纳税人识别码
+	 * @var string address 注册地址
+	 * @var string phone 注册电话
+	 * @var string bank 开户银行
+	 * @var string bankAccount 银行账户
+	 * @var string recipients 收件人
+	 * @var string recipientsPhone 收件人手机/电话
+	 * @var string recipientsAddress 收件地址
+	 * @var string mailItems 邮寄物品
+	 * @var string remark 备注
+	 * @return string 返回跳转开票主页路径
+	 */
+	function invoiceAddDo() {
+		$cid = $this->get_args ( 'cid' ) && is_numeric ( $this->get_args ( 'cid' ) ) ? $this->get_args ( 'cid' ) : 0;
+		$invoiceType = $this->get_args ( 'invoiceType' ) && is_numeric ( $this->get_args ( 'invoiceType' ) ) ? $this->get_args ( 'invoiceType' ) : 0;
+		$doPost = $this->get_args ( 'doPost' ) && is_numeric ( $this->get_args ( 'doPost' ) ) ? $this->get_args ( 'doPost' ) : 0;
+		$invoicePrice = $this->get_args ( 'invoicePrice' ) ? $this->get_args ( 'invoicePrice' ) : "";
+		$invoiceElement = $this->get_args ( 'invoiceElement' ) ? $this->get_args ( 'invoiceElement' ) : "";
+		$invoiceTitle = $this->get_args ( 'invoiceTitle' ) ? $this->get_args ( 'invoiceTitle' ) : "";
+		$invoiceCompany = $this->get_args ( 'invoiceCompany' ) ? $this->get_args ( 'invoiceCompany' ) : "";
+		$TIN = $this->get_args ( 'TIN' ) ? $this->get_args ( 'TIN' ) : "";
+		$address = $this->get_args ( 'address' ) ? $this->get_args ( 'address' ) : "";
+		$phone = $this->get_args ( 'phone' ) ? $this->get_args ( 'phone' ) : "";
+		$bank = $this->get_args ( 'bank' ) ? $this->get_args ( 'bank' ) : "";
+		$bankAccount = $this->get_args ( 'bankAccount' ) ? $this->get_args ( 'bankAccount' ) : "";
+		$recipients = $this->get_args ( 'recipients' ) ? $this->get_args ( 'recipients' ) : "";
+		$recipientsPhone = $this->get_args ( 'recipientsPhone' ) ? $this->get_args ( 'recipientsPhone' ) : "";
+		$recipientsAddress = $this->get_args ( 'recipientsAddress' ) ? $this->get_args ( 'recipientsAddress' ) : "";
+		
+		$mailItems = $this->get_args ( 'mailItems' ) ? $this->get_args ( 'mailItems' ) : "";
+		$remark = $this->get_args ( 'remark' ) ? $this->get_args ( 'remark' ) : "";
+		
+		if (! empty ( $cid ) && ! empty ( $invoicePrice ) && ! empty ( $invoiceElement )) {
+			Doo::loadModel ( 'invoice' );
+			$invoice = new invoice ();
+			Doo::loadModel ( 'L_category' );
+			$lCategory = new L_category ();
+			Doo::loadModel ( 'invoiceManage' );
+			$invoiceManage = new invoiceManage ();
+			Doo::loadModel ( 'invoiceOperationLog' );
+			$invoiceOperationLog = new invoiceOperationLog ();
 			
+			$categoryDetil = $lCategory->getOne ( array (
+					'SELECT' => 'title',
+					'where' => 'cid=' . $cid,
+					'asArray' => true 
+			) );
+			$invoiceManageDetail = $invoiceManage->getOne ( array (
+					'SELECT' => 'title',
+					'where' => 'mold="发票审批"',
+					'asArray' => true 
+			) );
 			
-			$categoryDetil=$lCategory->getOne(array('SELECT'=>'title','where'=>'cid='.$cid,'asArray'=>true));
-			$invoiceManageDetail=$invoiceManage->getOne(array('SELECT'=>'title','where'=>'mold="发票审批"','asArray'=>true));
-
-			$invoice->cid=$cid;
-			$invoice->categoryName=$categoryDetil['title'];
-			$invoice->invoiceElement=$invoiceElement;
-			$invoice->invoicePrice=$invoicePrice;
-
-			$invoice->invoiceType=$invoiceType;
-			if ($invoiceType==0)
-				$invoice->invoiceTitle=$invoiceTitle;
-			elseif ($invoiceType==1){
-				$invoice->invoiceCompany=$invoiceCompany;
-				$invoice->TIN=$TIN;
-				$invoice->address=$address;
-				$invoice->phone=$phone;
-				$invoice->bank=$bank;
-				$invoice->bankAccount=$bankAccount;
+			$invoice->cid = $cid;
+			$invoice->categoryName = $categoryDetil ['title'];
+			$invoice->invoiceElement = $invoiceElement;
+			$invoice->invoicePrice = $invoicePrice;
+			
+			$invoice->invoiceType = $invoiceType;
+			if ($invoiceType == 0)
+				$invoice->invoiceTitle = $invoiceTitle;
+			elseif ($invoiceType == 1) {
+				$invoice->invoiceCompany = $invoiceCompany;
+				$invoice->TIN = $TIN;
+				$invoice->address = $address;
+				$invoice->phone = $phone;
+				$invoice->bank = $bank;
+				$invoice->bankAccount = $bankAccount;
 			}
-
-			$invoice->doPost=$doPost;
-			if ($doPost==1){
-				$invoice->recipients=$recipients;
-				$invoice->recipientsPhone=$recipientsPhone;
-				$invoice->recipientsAddress=$recipientsAddress;
-				$invoice->mailItems=$mailItems;
+			
+			$invoice->doPost = $doPost;
+			if ($doPost == 1) {
+				$invoice->recipients = $recipients;
+				$invoice->recipientsPhone = $recipientsPhone;
+				$invoice->recipientsAddress = $recipientsAddress;
+				$invoice->mailItems = $mailItems;
 			}
-			$invoice->status=1;
-			$invoice->invoiceSerial="#F".date("Ymd").mt_rand(1000,9999);
-			$invoice->date=date("Y-m-d H:i:s");
-			$invoice->updateTime=date("Y-m-d H:i:s");
-			$invoice->sid=$this->staff[0]['sid'];
-			$invoice->userName=$this->staff[0]['username'];
-			$invoice->invoiceManage=$invoiceManageDetail['staff'];
-			$staffId=$a=json_decode($invoiceManageDetail['staff']);
-			$invoice->pendingApprovals=$staffId[0][0];
-			$invoice->remark=$remark;
+			$invoice->status = 1;
+			$invoice->invoiceSerial = "#F" . date ( "Ymd" ) . mt_rand ( 1000, 9999 );
+			$invoice->date = date ( "Y-m-d H:i:s" );
+			$invoice->updateTime = date ( "Y-m-d H:i:s" );
+			$invoice->sid = $this->staff [0] ['sid'];
+			$invoice->userName = $this->staff [0] ['username'];
+			$invoice->invoiceManage = $invoiceManageDetail ['staff'];
+			$staffId = $a = json_decode ( $invoiceManageDetail ['staff'] );
+			$invoice->pendingApprovals = $staffId [0] [0];
+			$invoice->remark = $remark;
+			$iid = $invoice->insert ();
 			
-			$invoice->insert();
+			$item = array (
+					'date' => date ( "Y-m-d H:i:s" ),
+					'operation' => "提交审批",
+					'status' => 1,
+					'img' => $this->staff [0] ['avatar'],
+					'username' => $this->staff [0] ['username'],
+					'uid' => $this->staff [0] ['sid'],
+					'iid' => $iid 
+			);
+			$invoiceOperationLog->setInvoiceOperationLog ( $item );
 		}
-
+		
 		return "/invoice";
 	}
-
-	function invoiceApproval(){
-
-		Doo::loadModel('invoice');
-		$invoice=new invoice();
-		Doo::loadModel('invoiceManage');
-		$invoiceManage=new invoiceManage();
-		Doo::loadClass('XDeode');
-		$XDeode=new XDeode(5);
-		Doo::loadModel('staff');
-		$staff=new staff();
+	function invoiceApproval() {
+		Doo::loadModel ( 'invoice' );
+		$invoice = new invoice ();
+		Doo::loadModel ( 'invoiceManage' );
+		$invoiceManage = new invoiceManage ();
+		Doo::loadClass ( 'XDeode' );
+		$XDeode = new XDeode ( 5 );
+		Doo::loadModel ( 'staff' );
+		$staff = new staff ();
 		
-		$invoiceList=$invoice->find(array('where'=>'status=1 and pendingApprovals='.$this->staff[0]['sid'],'asArray'=>true));
-		foreach ($invoiceList as $key=>$value){
-			$invoiceList[$key]['iidKey']=$XDeode->encode($value['iid']);//base64_encode($value['iid']);
+		$invoiceList = $invoice->find ( array (
+				'where' => 'status=1 and pendingApprovals=' . $this->staff [0] ['sid'],
+				'desc' => 'iid',
+				'asArray' => true 
+		) );
+		foreach ( $invoiceList as $key => $value ) {
+			$invoiceList [$key] ['iidKey'] = $XDeode->encode ( $value ['iid'] );
 			
-			$lastApprover=json_decode($value['processApprovals'],true);
-			if (!empty($lastApprover)){
-				$lastApproverKey=array_keys($lastApprover);
-				$lastApprover=end($lastApprover);
+			$lastApprover = json_decode ( $value ['processApprovals'], true );
+			if (! empty ( $lastApprover )) {
+				$lastApproverKey = array_keys ( $lastApprover );
+				$lastApprover = end ( $lastApprover );
 				
-				$staffDetail=$staff->getOne(array('where'=>'sid='.end($lastApproverKey),'asArray'=>true));
-				$lastApprover['username']=$staffDetail['username'];
+				$staffDetail = $staff->getOne ( array (
+						'where' => 'sid=' . end ( $lastApproverKey ),
+						'asArray' => true 
+				) );
+				$lastApprover ['username'] = $staffDetail ['username'];
 			}
-			$invoiceList[$key]['lastApprover']=$lastApprover;	
+			$invoiceList [$key] ['lastApprover'] = $lastApprover;
 		}
-
-		$data['invoiceList']=$invoiceList;
-
-		$data['memu']="invoice";
-		$data['staff']=$this->staff;
-		$data['receiptMemu']='invoiceApproval';
-		$data['verifyId']=$this->verifyId;
-		$data['executeId']=$this->executeId;
+		
+		$data ['invoiceList'] = $invoiceList;
+		
+		$data ['memu'] = "invoice";
+		$data ['staff'] = $this->staff;
+		$data ['receiptMemu'] = 'invoiceApproval';
+		$data ['verifyId'] = $this->verifyId;
+		$data ['executeId'] = $this->executeId;
 		$this->render ( "/admin/invoiceApproval", $data );
 	}
-
-	function invoiceDetail(){
-		Doo::loadClass('XDeode');
-		$XDeode=new XDeode(5);
-
-		$iid=isset($this->params['iid'])?$this->params['iid']:"";
-		$iid=$XDeode->decode($iid);//base64_decode($iid);
-		if (!is_numeric($iid))
-			die('illegal request');
+	function invoiceDetail() {
+		Doo::loadClass ( 'XDeode' );
+		$XDeode = new XDeode ( 5 );
 		
-		Doo::loadModel('invoice');
-		$invoice=new invoice();
-		//Doo::loadModel('invoiceManage');
-		//$invoiceManage=new invoiceManage();
-
-
-		$invoiceDetail=$invoice->getOne(array('where'=>'status=1 and pendingApprovals='.$this->staff[0]['sid'].' and iid='.$iid,'asArray'=>true));
-
-		//$invoiceManageDetail=$invoiceManage->getOne(array('SELECT'=>'title','where'=>'mold="发票审批"','asArray'=>true));
-
-		//$a=json_decode($invoiceManageDetail['staff']);
-
-
-		$data['invoiceDetail']=$invoiceDetail;
-
-		$data['INVOICEKEY']=$this->authcode($invoiceDetail['iid'],'');
-		$data['memu']="invoice";
-		$data['staff']=$this->staff;
-		$data['receiptMemu']='invoiceApproval';
-		$data['verifyId']=$this->verifyId;
-		$data['executeId']=$this->executeId;
+		$iid = isset ( $this->params ['iid'] ) ? $this->params ['iid'] : "";
+		$iid = $XDeode->decode ( $iid );
+		if (! is_numeric ( $iid ))
+			die ( 'illegal request' );
+		
+		Doo::loadModel ( 'invoice' );
+		$invoice = new invoice ();
+		// Doo::loadModel('invoiceManage');
+		// $invoiceManage=new invoiceManage();
+		
+		$invoiceDetail = $invoice->getOne ( array (
+				'where' => 'status=1 and pendingApprovals=' . $this->staff [0] ['sid'] . ' and iid=' . $iid,
+				'asArray' => true 
+		) );
+		
+		$data ['invoiceDetail'] = $invoiceDetail;
+		
+		$data ['INVOICEKEY'] = $this->authcode ( $invoiceDetail ['iid'], '' );
+		$data ['memu'] = "invoice";
+		$data ['staff'] = $this->staff;
+		$data ['receiptMemu'] = 'invoiceApproval';
+		$data ['verifyId'] = $this->verifyId;
+		$data ['executeId'] = $this->executeId;
 		$this->render ( "/admin/invoiceApprovalDetail", $data );
 	}
-
-	function invoiceApprovalDo(){
-		$iid=$this->get_args('invoiceKey')?$this->get_args('invoiceKey'):"";
-		$status=$this->get_args('status')&&is_numeric($this->get_args('status'))?$this->get_args('status'):0;
-		$opinion=$this->get_args('opinion')?$this->get_args('opinion'):"";
-		$iid=$this->authcode($iid);
-		if (!is_numeric($iid))
-			die('illegal request');
+	
+	/**
+	 * 对发票进行审批,其中操作有终止,退回,同意动作。操作成功并记录下操作日志
+	 *
+	 * @since 1.0.0
+	 *       
+	 * @var integer iid 开票ID 已加密
+	 * @var integer status 发票审批状态
+	 * @var integer opintion 审批发票的意见
+	 * @return string 如操作成功返回审批首页
+	 */
+	function invoiceApprovalDo() {
+		$iid = $this->get_args ( 'invoiceKey' ) ? $this->get_args ( 'invoiceKey' ) : "";
+		$status = $this->get_args ( 'status' ) && is_numeric ( $this->get_args ( 'status' ) ) ? $this->get_args ( 'status' ) : 0;
+		$opinion = $this->get_args ( 'opinion' ) ? $this->get_args ( 'opinion' ) : "";
+		$iid = $this->authcode ( $iid );
+		if (! is_numeric ( $iid ))
+			die ( 'illegal request' );
+		
+		if (! empty ( $iid ) && ! empty ( $status ) && ! empty ( $opinion )) {
+			if (! ($status == 2 || $status == 3 || $status == 4))
+				die ( 'illegal request' );
+			Doo::loadModel ( 'invoice' );
+			$invoice = new invoice ();
+			Doo::loadModel ( 'invoiceOperationLog' );
+			$invoiceOperationLog = new invoiceOperationLog ();
 			
-		if (!empty($iid)&&!empty($status)&&!empty($opinion)){
-			if (!($status==2||$status==3||$status==4))
-				die('illegal request');
-			Doo::loadModel('invoice');
-			$invoice=new invoice();
-
-			$invoiceDetail=$invoice->getOne(array('where'=>'status=1 and iid='.$iid.' and pendingApprovals='.$this->staff[0]['sid'],'asArray'=>true));
-			if (empty($invoiceDetail))
-				die('illegal request');
-
-			$processApprovals=json_decode($invoiceDetail['processApprovals'],true);
-			$invoiceManage=json_decode($invoiceDetail['invoiceManage'],true);
-
-			if ($status==3){
-				$invoice->status=$status;
-				//操作日志
-			}else{
-				if(empty($processApprovals)){//记录下一个IDKEY
-					$processApprovals=array($this->staff[0]['sid']=>array('date'=>date("Y-m-d H:i:s"),'opinion'=>$opinion,'status'=>$status));
-					if ($status!=4&&isset($invoiceManage[1]))
-						$invoice->pendingApprovals=$invoiceManage[1][0];
-					$invoice->processApprovals=json_encode($processApprovals);
-				}else{
-					$processApprovals[$this->staff[0]['sid']]=array('date'=>date("Y-m-d H:i:s"),'opinion'=>$opinion,'status'=>$status);
+			$invoiceDetail = $invoice->getOne ( array (
+					'where' => 'status=1 and iid=' . $iid . ' and pendingApprovals=' . $this->staff [0] ['sid'],
+					'asArray' => true 
+			) );
+			if (empty ( $invoiceDetail ))
+				die ( 'illegal request' );
+			
+			$processApprovals = json_decode ( $invoiceDetail ['processApprovals'], true );
+			$invoiceManage = json_decode ( $invoiceDetail ['invoiceManage'], true );
+			
+			if ($status == 3) {
+				$invoice->status = $status;
+				$item = array (
+						'operation' => "退回" 
+				);
+			} else {
+				if (empty ( $processApprovals )) {
+					$processApprovals = array (
+							$this->staff [0] ['sid'] => array (
+									'date' => date ( "Y-m-d H:i:s" ),
+									'opinion' => $opinion,
+									'status' => $status 
+							) 
+					);
+					if ($status != 4 && isset ( $invoiceManage [1] ))
+						$invoice->pendingApprovals = $invoiceManage [1] [0];
+					$invoice->processApprovals = json_encode ( $processApprovals );
+				} else {
+					$processApprovals [$this->staff [0] ['sid']] = array (
+							'date' => date ( "Y-m-d H:i:s" ),
+							'opinion' => $opinion,
+							'status' => $status 
+					);
 					
-					$pendingApprovals=0;
-					foreach ($invoiceManage as $key=>$value){
-						if ($value[0]==$this->staff[0]['sid']){
-							if (isset($invoiceManage[$key+1]))
-								$pendingApprovals=$invoiceManage[$key+1][0];
+					$pendingApprovals = 0;
+					foreach ( $invoiceManage as $key => $value ) {
+						if ($value [0] == $this->staff [0] ['sid']) {
+							if (isset ( $invoiceManage [$key + 1] ))
+								$pendingApprovals = $invoiceManage [$key + 1] [0];
 							break;
 						}
 					}
 					
-					if($status!=4&&!empty($pendingApprovals))
-						$invoice->pendingApprovals=$pendingApprovals;
-					$invoice->processApprovals=json_encode($processApprovals);
+					if ($status != 4 && ! empty ( $pendingApprovals ))
+						$invoice->pendingApprovals = $pendingApprovals;
+					$invoice->processApprovals = json_encode ( $processApprovals );
 				}
 				
-				if(count($processApprovals)==count($invoiceManage)&&$status!=4){
-					$invoice->status=$status;
-					$invoice->pendingApprovals=0;
-				}elseif ($status==4)
-					$invoice->status=$status;
+				$item = array (
+						'operation' => "同意" 
+				);
+				if (count ( $processApprovals ) == count ( $invoiceManage ) && $status != 4) {
+					$invoice->status = $status;
+					$invoice->pendingApprovals = 0;
+				} elseif ($status == 4) {
+					$invoice->status = $status;
+					$item = array (
+							'operation' => "终止" 
+					);
+				}
 			}
-			$invoice->updateTime=date("Y-m-d H:i:s");
-			$invoice->update(array('where'=>'iid='.$iid));//print_r($processApprovals);
+			$invoice->updateTime = date ( "Y-m-d H:i:s" );
+			$invoice->update ( array (
+					'where' => 'iid=' . $iid 
+			) );
+			
+			$item += array (
+					'date' => date ( "Y-m-d H:i:s" ),
+					'img' => $this->staff [0] ['avatar'],
+					'username' => $this->staff [0] ['username'],
+					'uid' => $this->staff [0] ['sid'],
+					'status' => $status,
+					'iid' => $iid 
+			);
+			$invoiceOperationLog->setInvoiceOperationLog ( $item );
 			
 			return '/invoiceApproval';
 		}
+		die ( 'illegal request' );
 	}
-
-	private function getExeCount(){
-		Doo::loadModel('receipt');
-		$receipt=new receipt();
-		$receiptList=$receipt->find(array('where'=>'(executeCopy like \'%["'.$this->staff[0]['sid'].'%\' and executeStaff NOT LIKE \'%'.$this->staff[0]['sid'].'%\' ) and (status=1 or status=6)','desc'=>'rid','asArray'=>true));
-
-		return count($receiptList);
+	private function getExeCount() {
+		Doo::loadModel ( 'receipt' );
+		$receipt = new receipt ();
+		$receiptList = $receipt->find ( array (
+				'where' => '(executeCopy like \'%["' . $this->staff [0] ['sid'] . '%\' and executeStaff NOT LIKE \'%' . $this->staff [0] ['sid'] . '%\' ) and (status=1 or status=6)',
+				'desc' => 'rid',
+				'asArray' => true 
+		) );
+		
+		return count ( $receiptList );
 	}
-
-	private function getReceiptCount(){
-
-		$status=2;
-		$year=date('Y');
-
-		Doo::loadModel('receipt');
-		$receipt=new receipt();
-		Doo::loadModel('verify');
-
-		$dateCondition=" and Year(date) =".$year;
-
-		$approvalCondition=' and nowStaff like "%'.$this->staff[0]['sid'].'%" ';
-		$receiptList=$receipt->find(array('where'=>' status='.$status.$dateCondition.$approvalCondition,'desc'=>'rid','asArray'=>true));
-
-		return count($receiptList);
+	private function getReceiptCount() {
+		$status = 2;
+		$year = date ( 'Y' );
+		
+		Doo::loadModel ( 'receipt' );
+		$receipt = new receipt ();
+		Doo::loadModel ( 'verify' );
+		
+		$dateCondition = " and Year(date) =" . $year;
+		
+		$approvalCondition = ' and nowStaff like "%' . $this->staff [0] ['sid'] . '%" ';
+		$receiptList = $receipt->find ( array (
+				'where' => ' status=' . $status . $dateCondition . $approvalCondition,
+				'desc' => 'rid',
+				'asArray' => true 
+		) );
+		
+		return count ( $receiptList );
 	}
-
 	function _GetFileEXT($filename) {
 		$pics = explode ( '.', $filename );
 		$num = count ( $pics );
 		return $pics [$num - 1];
 	}
-
+	
 	/**
 	 * 获取get或者POST值
-	 * @param string $name 属性名称
+	 *
+	 * @param string $name
+	 *        	属性名称
 	 * @return fixed 值
 	 */
 	function get_args($name) {
@@ -348,7 +452,6 @@ class InvoiceController extends DooController {
 				return $_GET [$name];
 			else
 				return addslashes ( $_GET [$name] );
-
 		} elseif (isset ( $_POST [$name] )) {
 			if (is_array ( $_POST [$name] ))
 				return $_POST [$name];
@@ -357,71 +460,71 @@ class InvoiceController extends DooController {
 		} else
 			return false;
 	}
-
-
-/**
- * 加密或解密指定字符串
- * @param string $string 要加密或解密的字符串
- * @param string $operation 当取值为'DECODE'时表示解密,否则为加密
- * @param string $key 加解密的key
- * @param $expiry 超时值
- * */
-function authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) {
-	$ckey_length = 4;
-	if (! $key) {
-		$key = $this->INVOICEKEY;
-	}
-	$key = md5 ( $key );
-	$keya = md5 ( substr ( $key, 0, 16 ) );
-	$keyb = md5 ( substr ( $key, 16, 16 ) );
-	$keyc = $ckey_length ? ($operation == 'DECODE' ? substr ( $string, 0, $ckey_length ) : substr ( md5 ( microtime () ), - $ckey_length )) : '';
-
-	$cryptkey = $keya . md5 ( $keya . $keyc );
-	$key_length = strlen ( $cryptkey );
-
-	$string = $operation == 'DECODE' ? base64_decode ( substr ( $string, $ckey_length ) ) : sprintf ( '%010d', $expiry ? $expiry + time () : 0 ) . substr ( md5 ( $string . $keyb ), 0, 16 ) . $string;
-	$string_length = strlen ( $string );
-
-	$result = '';
-	$box = range ( 0, 255 );
-
-	$rndkey = array ();
-	for($i = 0; $i <= 255; $i ++) {
-		$rndkey [$i] = ord ( $cryptkey [$i % $key_length] );
-	}
-
-	for($j = $i = 0; $i < 256; $i ++) {
-		$j = ($j + $box [$i] + $rndkey [$i]) % 256;
-		$tmp = $box [$i];
-		$box [$i] = $box [$j];
-		$box [$j] = $tmp;
-	}
-
-	for($a = $j = $i = 0; $i < $string_length; $i ++) {
-		$a = ($a + 1) % 256;
-		$j = ($j + $box [$a]) % 256;
-		$tmp = $box [$a];
-		$box [$a] = $box [$j];
-		$box [$j] = $tmp;
-		$result .= chr ( ord ( $string [$i] ) ^ ($box [($box [$a] + $box [$j]) % 256]) );
-	}
-
-	if ($operation == 'DECODE') {
-		if ((substr ( $result, 0, 10 ) == 0 || substr ( $result, 0, 10 ) - time () > 0) && substr ( $result, 10, 16 ) == substr ( md5 ( substr ( $result, 26 ) . $keyb ), 0, 16 )) {
-			return substr ( $result, 26 );
+	
+	/**
+	 * 加密或解密指定字符串
+	 *
+	 * @param string $string
+	 *        	要加密或解密的字符串
+	 * @param string $operation
+	 *        	当取值为'DECODE'时表示解密,否则为加密
+	 * @param string $key
+	 *        	加解密的key
+	 * @param $expiry 超时值        	
+	 *
+	 */
+	function authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) {
+		$ckey_length = 4;
+		if (! $key) {
+			$key = $this->INVOICEKEY;
+		}
+		$key = md5 ( $key );
+		$keya = md5 ( substr ( $key, 0, 16 ) );
+		$keyb = md5 ( substr ( $key, 16, 16 ) );
+		$keyc = $ckey_length ? ($operation == 'DECODE' ? substr ( $string, 0, $ckey_length ) : substr ( md5 ( microtime () ), - $ckey_length )) : '';
+		
+		$cryptkey = $keya . md5 ( $keya . $keyc );
+		$key_length = strlen ( $cryptkey );
+		
+		$string = $operation == 'DECODE' ? base64_decode ( substr ( $string, $ckey_length ) ) : sprintf ( '%010d', $expiry ? $expiry + time () : 0 ) . substr ( md5 ( $string . $keyb ), 0, 16 ) . $string;
+		$string_length = strlen ( $string );
+		
+		$result = '';
+		$box = range ( 0, 255 );
+		
+		$rndkey = array ();
+		for($i = 0; $i <= 255; $i ++) {
+			$rndkey [$i] = ord ( $cryptkey [$i % $key_length] );
+		}
+		
+		for($j = $i = 0; $i < 256; $i ++) {
+			$j = ($j + $box [$i] + $rndkey [$i]) % 256;
+			$tmp = $box [$i];
+			$box [$i] = $box [$j];
+			$box [$j] = $tmp;
+		}
+		
+		for($a = $j = $i = 0; $i < $string_length; $i ++) {
+			$a = ($a + 1) % 256;
+			$j = ($j + $box [$a]) % 256;
+			$tmp = $box [$a];
+			$box [$a] = $box [$j];
+			$box [$j] = $tmp;
+			$result .= chr ( ord ( $string [$i] ) ^ ($box [($box [$a] + $box [$j]) % 256]) );
+		}
+		
+		if ($operation == 'DECODE') {
+			if ((substr ( $result, 0, 10 ) == 0 || substr ( $result, 0, 10 ) - time () > 0) && substr ( $result, 10, 16 ) == substr ( md5 ( substr ( $result, 26 ) . $keyb ), 0, 16 )) {
+				return substr ( $result, 26 );
+			} else {
+				return '';
+			}
 		} else {
-			return '';
+			return $keyc . str_replace ( '=', '', base64_encode ( $result ) );
 		}
-	} else {
-		return $keyc . str_replace ( '=', '', base64_encode ( $result ) );
 	}
 }
-
-
-
-}
-
-class ReceiptController{
+class ReceiptController {
 	public static $NEW = 0;
 	public static $NEW2 = 0;
 }

+ 105 - 0
protected/model/invoiceOperationLog.php

@@ -0,0 +1,105 @@
+<?php
+Doo::loadCore ( 'db/DooModel' );
+
+/**
+ * 开票操作日志 业务逻辑
+ *
+ * @author CP.
+ * @version 1.0
+ * @namespace invoice
+ * @package invoiceModel
+ */
+class invoiceOperationLog extends DooModel {
+	
+	/**
+	 *
+	 * @var integer $lid 操作日志ID
+	 *     
+	 */
+	public $lid;
+	/**
+	 *
+	 * @var string $username 操作员相关:名称,头像
+	 * @var string $img 操作员相关:名称,头像
+	 */
+	public $username, $img;
+	/**
+	 *
+	 * @var integer $uid 用户ID
+	 */
+	public $uid;
+	/**
+	 * 操作时间
+	 *
+	 * @var datetime
+	 */
+	public $date;
+	/**
+	 * 操作动作
+	 *
+	 * @var string
+	 */
+	public $operation;
+	
+	/**
+	 * 开票ID
+	 *
+	 * @var integer
+	 */
+	public $iid;
+	/**
+	 * 发票操作时的状态
+	 *
+	 * @var integer
+	 */
+	public $status;
+	/**
+	 * 表名
+	 *
+	 * @var string
+	 */
+	public $_table = 'CLD_invoiceOperationLog';
+	/**
+	 * 表主键
+	 *
+	 * @var string
+	 */
+	public $_primarykey = 'lid';
+	/**
+	 * 表字段
+	 *
+	 * @var array
+	 */
+	public $_fields = array (
+			'lid',
+			'username',
+			'uid',
+			'date',
+			'operation',
+			'img',
+			'iid',
+			'status' 
+	);
+	public function __construct() {
+		parent::setupModel ( __CLASS__ );
+	}
+	/**
+	 * 添加相关开票操作日志
+	 *
+	 * @param array $item 要记录的相关发票操作数据        	
+	 *
+	 * @return integer|0 返回操作ID
+	 */
+	public function setInvoiceOperationLog($item = array()) {
+		$lid = 0;
+		if (is_array ( $item ) && ! empty ( $item )) {
+			foreach ( $item as $key => $value ) {
+				$this->$key = $value;
+			}
+			$lid = $this->insert ();
+		}
+		return $lid;
+	}
+}
+
+?>

+ 1 - 1
protected/view/admin/hisImplement.html

@@ -68,7 +68,7 @@
 	  		<div class="saeaList">
 				<div class="entry">
 					<table class="table table-bordered table-condensed">
-						<thead><tr><th width="100" class="taC">费用类型</th><th width="100" class="taC">费用金额金额</th><th width="120" class="taC">费用所在办事处</th><th width="120" class="taC">费用单号</th><th class="taC">费用说明</th><th width="100" class="taC">状态</th><th width="80" class="taC">操作</th></tr></thead>
+						<thead><tr><th width="54" >上报人</th><th width="100" class="taC">费用类型</th><th width="100" class="taC">费用金额金额</th><th width="120" class="taC">费用所在办事处</th><th width="120" class="taC">费用单号</th><th class="taC">费用说明</th><th width="100" class="taC">状态</th><th width="80" class="taC">操作</th></tr></thead>
 						<tbody>
 						<!-- loop receiptList -->
 						<tr>

+ 0 - 128
protected/viewc/admin/admin_EdiUser.php

@@ -1,128 +0,0 @@
-<?php include Doo::conf()->SITE_PATH .  Doo::conf()->PROTECTED_FOLDER . "viewc//admin/header.php"; ?>
-<body>
-	<div class="mainLayout">
-		<div class="mainMenu">
-			<div class="menuItem">
-				<a href="/" class="mLogo">CLD</a>
-				<ul>
-					<?php include Doo::conf()->SITE_PATH .  Doo::conf()->PROTECTED_FOLDER . "viewc//admin/menu.php"; ?>
-				</ul>
-			</div>
-		</div>
-		<div class="warpContent">
-			<div class="subMenu fL">
-				<div class="menuItem">
-					<ul>
-						<?php include Doo::conf()->SITE_PATH .  Doo::conf()->PROTECTED_FOLDER . "viewc//admin/admin_menu.php"; ?>
-					</ul>
-				</div>
-			</div>
-			<div class="adminContent autoHeight">
-			    <form name="myinfo" action="/adminDoEdiUser" method="post">
-		            <legend>个人信息</legend>
-		            
-		            <div class="control-group">
-		              <label for="inputEmail" class="control-label">帐号</label>
-		              <div class="controls">
-		                <input type="text" name="username" value="<?php echo $data['staffInfo']['0']['username']; ?>"> <a href="/admin/reset/pw/<?php echo $data['staffInfo']['0']['sid']; ?>">重置密码</a>&nbsp;新密码:<?php echo $data['newPw']; ?>
-		              </div>
-		            </div>
-		            
-		            <div class="control-group">
-		              <label for="inputEmail" class="control-label">办事处</label>
-		              <div class="controls">
-		                <select name="cid">
-		                	<?php foreach($data['category'] as $k1=>$v1): ?>
-		                	<option <?php if( $data['staffInfo']['0']['cid']==$v1['cid'] ): ?> selected <?php endif; ?> value="<?php echo $v1['cid']; ?>"><?php echo $v1['title']; ?></option>
-		                	<?php endforeach; ?>
-		                </select>
-		              </div>
-		            </div>
-					<div class="control-group">
-						<label for="inputEmail" class="control-label">入职时间</label>
-						<div class="controls">
-							<input type="date" name="hiredate" value="<?php echo $data['staffInfo']['0']['hiredate']; ?>">
-						</div>
-					</div>
-					<div class="control-group">
-						<label for="inputEmail" class="control-label">员工性质</label>
-						<div class="controls">
-							<select name="nature">
-								<option value="2" <?php if( $data['staffInfo']['0']['nature'] == 2 ): ?> selected <?php endif; ?>>实习生</option>
-								<option value="1" <?php if( $data['staffInfo']['0']['nature'] == 1 ): ?> selected <?php endif; ?>>正式员工</option>
-							</select>
-							<p>调整员工性质,会清空假期数据,请谨慎操作</p>
-						</div>
-					</div>
-		            <div class="control-group">
-		              <label for="inputEmail" class="control-label">性别</label>
-		              <div class="controls">
-		              	<select name="gender">
-		              		<option <?php if( $data['staffInfo']['0']['gender']=='男' ): ?> selected <?php endif; ?> value="男">男</option>
-		              		<option <?php if( $data['staffInfo']['0']['gender']=='女' ): ?> selected <?php endif; ?> value="女">女</option>
-		              	</select>
-		                
-		                <input type="hidden" name="sid" value="<?php echo $data['staffInfo']['0']['sid']; ?>">
-		              </div>
-		            </div>
-		            
-				    <div class="control-group">
-		              <label for="inputEmail" class="control-label">手机</label>
-		              <div class="controls">
-		                <input type="text" name="telephone" value="<?php echo $data['staffInfo']['0']['telephone']; ?>">
-		              </div>
-		            </div>
-				    <div class="control-group">
-		              <label for="inputEmail" class="control-label">电话</label>
-		              <div class="controls">
-		                <input type="text" name="phone" value="<?php echo $data['staffInfo']['0']['phone']; ?>">
-		              </div>
-		            </div>
-				    <div class="control-group">
-		              <label for="inputEmail" class="control-label">邮箱</label>
-		              <div class="controls">
-		                <input type="text" name="email" value="<?php echo $data['staffInfo']['0']['email']; ?>">
-		              </div>
-		            </div>
-				    <div class="control-group">
-		              <label for="inputEmail" class="control-label">QQ</label>
-		              <div class="controls">
-		                <input type="text" name="qq" value="<?php echo $data['staffInfo']['0']['qq']; ?>">
-		              </div>
-		            </div>
-		            
-		            <div class="control-group">
-		              <div class="controls">
-				   		 <button type="submit" class="button">确认修改</button>
-				   		 <span><?php echo $data['msg']; ?></span>
-		              </div>
-		            </div>
-		            
-			    </form>
-			    <form name="myinfo" action="/adminDoAddCategory" method="post">
-			    <legend>添加办事处信息</legend>
-			    已加入:<?php echo $data['staffInfo']['0']['category']; ?>,<?php echo $data['staffInfo']['0']['othercategory']; ?>
-		            <div class="control-group">
-		              <label for="inputEmail" class="control-label">办事处</label>
-		              <div class="controls">
-		                <select name="cid">
-		                	<?php foreach($data['category'] as $k1=>$v1): ?>
-		                	<option <?php if( $data['staffInfo']['0']['cid']==$v1['cid'] ): ?> selected <?php endif; ?> value="<?php echo $v1['cid']; ?>"><?php echo $v1['title']; ?></option>
-		                	<?php endforeach; ?>
-		                </select>
-		                <input type="hidden" name="sid" value="<?php echo $data['staffInfo']['0']['sid']; ?>">
-		              </div>
-		            </div>
-		            
-		            <div class="control-group">
-		              <div class="controls">
-				   		 <button type="submit" class="button">确认添加</button>
-				   		 <span><?php echo $data['msg']; ?></span>
-		              </div>
-		            </div>
-			    </form>
-			</div>
-		</div>
-	</div>
-<script type="text/javascript">autoFlashHeight();</script>	
-</body>

+ 0 - 192
protected/viewc/admin/admin_myinfo.php

@@ -1,192 +0,0 @@
-
-<?php include Doo::conf()->SITE_PATH .  Doo::conf()->PROTECTED_FOLDER . "viewc//admin/header.php"; ?>
-<script type="text/javascript"
-	src="<?php echo  WEB_SITE_GLOBAL  ?>/js/swfobject.js"></script>
-<script type="text/javascript"
-	src="<?php echo  WEB_SITE_GLOBAL  ?>/js/fullAvatarEditor.js"></script>
-<body>
-<div class="mainLayout">
-<div class="mainMenu">
-<div class="menuItem"><a href="/" class="mLogo">CLD</a>
-<ul>
-	<?php include Doo::conf()->SITE_PATH .  Doo::conf()->PROTECTED_FOLDER . "viewc//admin/menuReceipt.php"; ?>
-</ul>
-</div>
-</div>
-<div class="warpContent">
-<div class="subMenu fL">
-<div class="menuItem">
-<ul>
-	<?php include Doo::conf()->SITE_PATH .  Doo::conf()->PROTECTED_FOLDER . "viewc//admin/admin_menu.php"; ?>
-</ul>
-</div>
-</div>
-<div class="adminContent autoHeight">
-<form name="myinfo" action="/updateMyinfo" method="post"><legend>个人信息</legend>
-<div class="control-group"><label for="inputEmail"
-	class="control-label">头像</label>
-<div class="controls"><img src="<?php echo $data['staff']['0']['avatar']; ?>_2.jpg" />
-<div>
-
-<div>
-<p id="swfContainer">本组件需要安装Flash Player后才可使用,请从<a
-	href="http://www.adobe.com/go/getflashplayer">这里</a>下载安装。</p>
-</div>
-
-</div>
-<script type="text/javascript">
-	swfobject.addDomLoadEvent(function() {
-		var swf = new fullAvatarEditor("swfContainer", {
-			id : 'swf',
-			upload_url : 'avatar',
-			avatar_sizes : "100*100|48*48|32*32",
-			avatar_sizes_desc : "100*100像素|48*48像素|32*32像素",
-			checkbox_visible : false,
-			src_upload : 2
-		}, function(msg) {
-			switch (msg.code) {
-			//case 1 : alert("页面成功加载了组件!");break;
-			//case 2 : alert("已成功加载默认指定的图片到编辑面板。");break;
-			case 3:
-				if (msg.type == 0) {
-					console.log("摄像头已准备就绪且用户已允许使用。");
-				} else if (msg.type == 1) {
-					console.log("摄像头已准备就绪但用户未允许使用!");
-				} else {
-					console.log("摄像头被占用!");
-				}
-				break;
-			case 5:
-				if (msg.type == 0) {
-					if (msg.content.sourceUrl) {
-
-						//alert("头像已成功保存至服务器,url为:\n" + msg.content.sourceUrl);
-					}
-					location.reload();
-					console.log("头像已成功保存至服务器");
-				}
-				break;
-			}
-		});
-		document.getElementById("upload").onclick = function() {
-			swf.call("upload");
-		};
-	});
-</script></div>
-</div>
-<div class="control-group"><label for="inputEmail"
-	class="control-label">手机</label>
-<div class="controls"><input type="text" name="telephone"
-	value="<?php echo $data['staff']['0']['telephone']; ?>"></div>
-</div>
-<div class="control-group"><label for="inputEmail"
-	class="control-label">电话</label>
-<div class="controls"><input type="text" name="phone"
-	value="<?php echo $data['staff']['0']['phone']; ?>"></div>
-</div>
-
-<div class="control-group"><label for="inputEmail"
-	class="control-label">职位</label>
-<div class="controls"><input type="text" name="position"
-	value="<?php echo $data['staff']['0']['position']; ?>"></div>
-</div>
-
-<div class="control-group"><label for="inputEmail"
-	class="control-label">性别</label>
-<div class="controls">
-男<input type="radio" name="gender" <?php if( $data['staff']['0']['gender']=='男' ): ?> checked <?php endif; ?>  value="男">女<input type="radio" <?php if( $data['staff']['0']['gender']=='女' ): ?> checked <?php endif; ?> name="gender"  value="女">
-</div>
-</div>
-
-<div class="control-group"><label for="inputEmail"
-	class="control-label">生日</label>
-	
-<div class="controls">年<select name="year">
-	<?php echo $data['yearHtml']; ?>
-</select> 月<select name="month">
-	<option value="01" <?php if( $data['month']=='01' ): ?> selected <?php endif; ?>>01</option>
-	<option value="02" <?php if( $data['month']=='02' ): ?> selected <?php endif; ?>>02</option>
-	<option value="03" <?php if( $data['month']=='03' ): ?> selected <?php endif; ?>>03</option>
-	<option value="04" <?php if( $data['month']=='04' ): ?> selected <?php endif; ?>>04</option>
-	<option value="05" <?php if( $data['month']=='05' ): ?> selected <?php endif; ?>>05</option>
-	<option value="06" <?php if( $data['month']=='06' ): ?> selected <?php endif; ?>>06</option>
-	<option value="07" <?php if( $data['month']=='07' ): ?> selected <?php endif; ?>>07</option>
-	<option value="08" <?php if( $data['month']=='08' ): ?> selected <?php endif; ?>>08</option>
-	<option value="09" <?php if( $data['month']=='09' ): ?> selected <?php endif; ?>>09</option>
-	<option value="10" <?php if( $data['month']==10 ): ?> selected <?php endif; ?>>10</option>
-	<option value="11" <?php if( $data['month']==11 ): ?> selected <?php endif; ?>>11</option>
-	<option value="12" <?php if( $data['month']==12 ): ?> selected <?php endif; ?>>12</option>
-</select>日 <select  name="day">
-	
-	<option value="01" <?php if( $data['day']=='01' ): ?> selected <?php endif; ?>>01</option>
-	<option value="02" <?php if( $data['day']=='02' ): ?> selected <?php endif; ?>>02</option>
-	<option value="03" <?php if( $data['day']=='03' ): ?> selected <?php endif; ?>>03</option>
-	<option value="04" <?php if( $data['day']=='04' ): ?> selected <?php endif; ?>>04</option>
-	<option value="05" <?php if( $data['day']=='05' ): ?> selected <?php endif; ?>>05</option>
-	<option value="06" <?php if( $data['day']=='06' ): ?> selected <?php endif; ?>>06</option>
-	<option value="07" <?php if( $data['day']=='07' ): ?> selected <?php endif; ?>>07</option>
-	<option value="08" <?php if( $data['day']=='08' ): ?> selected <?php endif; ?>>08</option>
-	<option value="09" <?php if( $data['day']=='09' ): ?> selected <?php endif; ?>>09</option>
-	<option value="10" <?php if( $data['day']==10 ): ?> selected <?php endif; ?>>10</option>
-	<option value="11" <?php if( $data['day']==11 ): ?> selected <?php endif; ?>>11</option>
-	<option value="12" <?php if( $data['day']==12 ): ?> selected <?php endif; ?>>12</option>
-	<option value="13" <?php if( $data['day']==13 ): ?> selected <?php endif; ?>>13</option>
-	<option value="14" <?php if( $data['day']==14 ): ?> selected <?php endif; ?>>14</option>
-	<option value="15" <?php if( $data['day']==15 ): ?> selected <?php endif; ?>>15</option>
-	<option value="16" <?php if( $data['day']==16 ): ?> selected <?php endif; ?>>16</option>
-	<option value="17" <?php if( $data['day']==17 ): ?> selected <?php endif; ?>>17</option>
-	<option value="18" <?php if( $data['day']==18 ): ?> selected <?php endif; ?>>18</option>
-	<option value="19" <?php if( $data['day']==19 ): ?> selected <?php endif; ?>>19</option>
-	<option value="20" <?php if( $data['day']==20 ): ?> selected <?php endif; ?>>20</option>
-	<option value="21" <?php if( $data['day']==21 ): ?> selected <?php endif; ?>>21</option>
-	<option value="22" <?php if( $data['day']==22 ): ?> selected <?php endif; ?>>22</option>
-	<option value="23" <?php if( $data['day']==23 ): ?> selected <?php endif; ?>>23</option>
-	<option value="24" <?php if( $data['day']==24 ): ?> selected <?php endif; ?>>24</option>
-	<option value="25" <?php if( $data['day']==25 ): ?> selected <?php endif; ?>>25</option>
-	<option value="26" <?php if( $data['day']==26 ): ?> selected <?php endif; ?>>26</option>
-	<option value="27" <?php if( $data['day']==27 ): ?> selected <?php endif; ?>>27</option>
-	<option value="28" <?php if( $data['day']==28 ): ?> selected <?php endif; ?>>28</option>
-	<option value="29" <?php if( $data['day']==29 ): ?> selected <?php endif; ?>>29</option>
-	<option value="30" <?php if( $data['day']==30 ): ?> selected <?php endif; ?>>30</option>
-	<option value="31" <?php if( $data['day']==31 ): ?> selected <?php endif; ?>>31</option>
-</select></div>
-</div>
-<div class="control-group"><label for="inputEmail"
-	class="control-label">邮箱</label>
-<div class="controls"><input type="text" name="email"
-	value="<?php echo $data['staff']['0']['email']; ?>"></div>
-</div>
-<div class="control-group"><label for="inputEmail"
-	class="control-label">QQ</label>
-<div class="controls"><input type="text" name="qq"
-	value="<?php echo $data['staff']['0']['qq']; ?>"></div>
-</div>
-<legend>修改密码</legend>
-<div class="control-group"><label for="inputEmail"
-	class="control-label">旧密码</label>
-<div class="controls"><input type="password" name="oldpassword">
-</div>
-</div>
-<div class="control-group"><label for="inputEmail"
-	class="control-label">新密码</label>
-<div class="controls"><input type="password" name="newpassword">
-</div>
-</div>
-<div class="control-group"><label for="inputEmail"
-	class="control-label">确认新密码</label>
-<div class="controls"><input type="password" name="rnewpassword">
-</div>
-</div>
-<div class="control-group">
-<div class="controls">
-<button type="submit" class="button">确认修改</button>
-<span><?php echo $data['msg']; ?></span></div>
-</div>
-</form>
-</div>
-</div>
-</div>
-<script type="text/javascript">
-	autoFlashHeight();
-</script>
-</body>

+ 0 - 69
protected/viewc/admin/admin_product.php

@@ -1,69 +0,0 @@
-<?php include Doo::conf()->SITE_PATH .  Doo::conf()->PROTECTED_FOLDER . "viewc//admin/header.php"; ?>
-<body>
-	<div class="mainLayout">
-		<div class="mainMenu">
-			<div class="menuItem">
-				<a href="#" class="mLogo">CLD</a>
-				<ul>
-					<?php include Doo::conf()->SITE_PATH .  Doo::conf()->PROTECTED_FOLDER . "viewc//admin/menu.php"; ?>
-				</ul>
-			</div>
-		</div>
-		<div class="warpContent">
-			<div class="subMenu fL">
-				<div class="menuItem">
-					<ul>
-						<?php include Doo::conf()->SITE_PATH .  Doo::conf()->PROTECTED_FOLDER . "viewc//admin/admin_menu.php"; ?>
-					</ul>
-				</div>
-			</div>
-			<div class="adminContent autoHeight">
-			    <form name="userinfo" action="/addproduct" method="post">
-		            <legend>添加产品</legend>
-					    <div class="control-group">
-			              <label class="control-label">产品名称</label>
-			              <div class="controls">
-			                <input type="text" name="title">
-			              </div>
-			            </div>
-			            <div class="control-group">
-			              <div class="controls">
-					    	<input type="submit" class="button">
-			              </div>
-			            </div>
-			    </form>
-			    <table class="table table-striped">
-              <thead>
-                <tr>
-                  <th>#</th>
-                  <th>产品名称</th>
-                  <th>锁数量</th>
-                  <th>操作</th>
-                </tr>
-              </thead>
-              <tbody>
-              <?php foreach($data['product'] as $k1=>$v1): ?>
-                <tr>
-                  <td><?php echo $v1['pid']; ?></td>
-                  <td><?php echo $v1['title']; ?></td>
-                  <td><?php echo $v1['count']; ?></td>
-                  <td><a href="/adminEdiProduct/<?php echo $v1['pid']; ?>">编辑</a>/<a href="javascript: linkok('/adminDeleteProduct/<?php echo $v1['pid']; ?>')">删除</a></td>
-                </tr>
-                <?php endforeach; ?>
-              </tbody>
-            </table>
-			</div>
-		</div>
-	</div>
-	<script language="javascript">
-    <!--
-    function linkok(url){
-    question = confirm("你确认要删除吗?");
-    if (question){
-    window.location.href = url;
-    }
-    }
-    //-->
-    </script>
-<script type="text/javascript">autoFlashHeight();</script>	
-</body>

+ 0 - 102
protected/viewc/admin/admin_user.php

@@ -1,102 +0,0 @@
-<?php include Doo::conf()->SITE_PATH .  Doo::conf()->PROTECTED_FOLDER . "viewc//admin/header.php"; ?>
-<body>
-	<div class="mainLayout">
-		<div class="mainMenu">
-			<div class="menuItem">
-				<a href="#" class="mLogo">CLD</a>
-				<ul>
-					<?php include Doo::conf()->SITE_PATH .  Doo::conf()->PROTECTED_FOLDER . "viewc//admin/menu.php"; ?>
-				</ul>
-			</div>
-		</div>
-		<div class="warpContent">
-			<div class="subMenu fL">
-				<div class="menuItem">
-					<ul>
-						<?php include Doo::conf()->SITE_PATH .  Doo::conf()->PROTECTED_FOLDER . "viewc//admin/admin_menu.php"; ?>
-					</ul>
-				</div>
-			</div>
-			<div class="adminContent autoHeight">
-			    <form name="userinfo" action="/adduser" method="post">
-		            <legend>添加新员工</legend>
-				    <div class="control-group">
-		              <label class="control-label">员工名称</label>
-		              <div class="controls">
-		                <input type="text" name="username">
-		              </div>
-		            </div>
-				    <div class="control-group">
-		              <label class="control-label">密码</label>
-		              <div class="controls">
-		                <input type="password" name="password"  value="">
-		              </div>
-		            </div>
-				    <div class="control-group">
-		              <label class="control-label">所在办事处</label>
-		              <div class="controls">
-		                <select name="cid">
-		                <?php foreach($data['category'] as $k1=>$v1): ?>
-		                <option value="<?php echo $v1['cid']; ?>"><?php echo $v1['title']; ?></option>
-		                <?php endforeach; ?>
-		                </select>
-		              </div>
-		            </div>
-					<div class="control-group">
-						<label class="control-label">入职时间</label>
-						<div class="controls">
-							<input type="date" name="hiredate">
-						</div>
-					</div>
-					<div class="control-group">
-						<label class="control-label">员工性质</label>
-						<div class="controls">
-							<select name="nature">
-								<option value="1" selected>正式员工</option>
-								<option value="2">实习生</option>
-							</select>
-						</div>
-					</div>
-				    <input type="submit" class="button" value="添加新员工"></input>
-			    </form>
-			    <table class="table table-striped">
-              <thead>
-                <tr>
-                  <th>#</th>
-                  <th>员工名称</th>
-                  <th>所在办事处</th>
-                  <th>手机</th>
-                  <th>APP登录</th>
-				  <th>入职时间</th>
-                  <th>操作</th>
-                </tr>
-              </thead>
-              <tbody>
-              <?php foreach($data['stafflist'] as $k1=>$v1): ?>
-                <tr>
-                  <td><?php echo $v1['sid']; ?></td>
-                  <td><?php echo $v1['username']; ?><?php if( $v1['nature'] == 2 ): ?>(实习)<?php endif; ?></td>
-                  <td><?php echo $v1['category']; ?>,<?php echo $v1['othercategory']; ?></td>
-                  <td><?php echo $v1['telephone']; ?></td>
-                  <td><?php echo $v1['appDate']; ?></td>
-                  <td><?php echo $v1['hiredate']; ?></td>
-                  <td><a href="/edi/user/<?php echo $v1['sid']; ?>">编辑</a>/<a href="javascript:linkok('/delete/user/<?php echo $v1['sid']; ?>')">删除</a></td>
-                </tr>
-                <?php endforeach; ?>
-              </tbody>
-            </table>
-			</div>
-		</div>
-	</div>
-	<script language="javascript">
-    <!--
-    function linkok(url){
-    question = confirm("你确认要删除吗?");
-    if (question){
-    window.location.href = url;
-    }
-    }
-    //-->
-    </script>
-<script type="text/javascript">autoFlashHeight();</script>	
-</body>