Explorar o código

办事处汇总相关

caipin %!s(int64=7) %!d(string=hai) anos
pai
achega
0ee303da54

+ 30 - 11
global/js/admin.js

@@ -51,28 +51,47 @@ function tabC(a,b){
 
 $(function() {
 
-	
-	
-	$("a[id^='execute_']").click(function(){
+	$("select[node='category']").change(function(){
 		
+		var cidKey=$(this).val();
+		var categoryStaff = JSON.stringify(invoiceStaff);
+		categoryStaff=JSON.parse(categoryStaff);
 		
-		var mold=$(this).attr('data');
-		
-		$("#mold").val(mold);
-		
+		var html='';
+		for (var i=0;i<categoryStaff[cidKey].length;i++){
+			html+='<option value="'+categoryStaff[cidKey][i][0]+'" >'+categoryStaff[cidKey][i][1]+'</option>';
+		}
+		$("select[node-category='staff']").html(html);
 		
 	});
 	
-$("a[id^='invoiceManage_']").click(function(){
+	$("a[node-iacd]").click(function(){
+		var cidKey=$(this).attr('data-cidKey');
+		$("#cidKey").val(cidKey);
 		
+		$("select[node='category']").val(cidKey); 
 		
-		var mold=$(this).attr('data');
-		
-		$("#mold").val(mold);
+		var categoryStaff = JSON.stringify(invoiceStaff);
+		categoryStaff=JSON.parse(categoryStaff);
 		
+		var html='';
+		for (var i=0;i<categoryStaff[cidKey].length;i++){
+			html+='<option value="'+categoryStaff[cidKey][i][0]+'" >'+categoryStaff[cidKey][i][1]+'</option>';
+		}
+		$("select[node-category='staff']").html(html);
 		
 	});
 	
+	$("a[id^='execute_']").click(function(){
+		var mold=$(this).attr('data');
+		$("#mold").val(mold);
+	});
+	
+	$("a[id^='invoiceManage_']").click(function(){
+		var mold=$(this).attr('data');
+		$("#mold").val(mold);
+	});
+	
 	
 	$("input[id^='verify_']").click(function(){
 		

+ 6 - 0
global/js/email.js

@@ -15,6 +15,12 @@ function tabC(a,b){
 
 $(function() {
 
+	
+	$("a[node-mail]").click(function(){
+		$(this).attr('disabled',"true");
+	});
+	
+	
 	$("#natureNULL").click(function(){
 		
 		 if($("#natureNULL").attr("checked")=='checked'){

+ 4 - 1
global/js/invoice.js

@@ -73,7 +73,10 @@ else
 
 
 
-
+function submitForm(){
+	var form = document.getElementById("iacd");
+    form.submit();
+}
 
 
 

+ 6 - 1
protected/config/acl.conf.php

@@ -57,6 +57,12 @@ $acl ['ordinary'] ['allow'] = array (
 				'invoiceStoreBatchApproval',
 				'ajaxGetMailItemByIstore',
 				'invoiceExpress',
+				
+				
+				
+				//办事处汇总查询权限--现加入普通权限中->另外在做权限判定
+				'invoiceAggregateCategoryDetail',
+				
 				'testSend'
 		) 
 );
@@ -126,7 +132,6 @@ $acl ['公司汇总查阅'] ['allow'] = array (
 				'invoiceAggregate',
 				'invoiceAggregateStaff',
 				'invoiceAggregateCategory'
-
 		)
 );
 

+ 6 - 0
protected/config/routes.conf.php

@@ -368,6 +368,9 @@ $route['*']['/error'] = array('ErrorController', 'index');
 $route['*']['/adminInvoice'] = array('AdminController', 'adminInvoice');
 $route['*']['/addInvoiceManage'] = array('AdminController', 'addInvoiceManage');
 $route['*']['/delInvoiceManage/:uid/:iid'] = array('AdminController', 'delInvoiceManage');
+$route['*']['/adminInvoiceCategory'] = array('AdminController', 'adminInvoiceCategory');
+$route['post']['/addInvoiceCategoryManage'] = array('AdminController', 'addInvoiceCategoryManage');
+$route['get']['/delInvoiceCategoryManage/:sidKey/:icidKey'] = array('AdminController', 'delInvoiceCategoryManage');
 
 //普通
 $route['*']['/invoice'] = array('InvoiceController', 'invoice');
@@ -540,6 +543,9 @@ $route['*']['/invoiceAggregate'] = array('InvoiceController', 'invoiceAggregate'
 $route['*']['/invoiceAggregateStaff'] = array('InvoiceController', 'invoiceAggregateStaff');
 $route['*']['/invoiceAggregateCategory/:cid'] = array('InvoiceController', 'invoiceAggregateCategory');
 
+//办事处汇总
+$route['*']['/invoiceAggregateCategoryDetail'] = array('InvoiceController', 'invoiceAggregateCategoryDetail');
+
 
 
 //数据导入

+ 476 - 283
protected/controller/AdminController.php

@@ -76,11 +76,8 @@ class AdminController extends DooController {
 		}
 	}
 	function adlogin() {
-		
-		
-		
-		$passwork = $this->get_args('passwork') ? $this->get_args('passwork') : "";
-		$uid = $this->get_args('user') ? $this->get_args('user') : ""; 
+		$passwork = $this->get_args ( 'passwork' ) ? $this->get_args ( 'passwork' ) : "";
+		$uid = $this->get_args ( 'user' ) ? $this->get_args ( 'user' ) : "";
 		
 		Doo::loadModel ( 'staff' );
 		$staff = new staff ();
@@ -95,7 +92,7 @@ class AdminController extends DooController {
 			
 			if (! empty ( $userinfo )) {
 				if ($userinfo ['username'] == $uid && $userinfo ['passwork'] == md5 ( $passwork )) {
-					setcookie ( "adStaff", $XDeode->encode ($userinfo ['sid']), time () + 36000, "/" );
+					setcookie ( "adStaff", $XDeode->encode ( $userinfo ['sid'] ), time () + 36000, "/" );
 					return "/adminoffice";
 				}
 			}
@@ -250,14 +247,14 @@ class AdminController extends DooController {
 			
 			$holidaystaff = new HStaff ();
 			$holidaystaff->uid = $id;
-
-			$holidaystaff->insert();
-
-			$staffmsg = $staff->getUserById($id);
-			$this->updateAnnualLeave($staffmsg[0]);
-
-			for ($i=1;$i<=7;$i++){
-
+			
+			$holidaystaff->insert ();
+			
+			$staffmsg = $staff->getUserById ( $id );
+			$this->updateAnnualLeave ( $staffmsg [0] );
+			
+			for($i = 1; $i <= 7; $i ++) {
+				
 				$tag = new tag ();
 				$tag->name = "个人标签";
 				$tag->sid = $id;
@@ -424,11 +421,11 @@ class AdminController extends DooController {
 			$staff = new staff ();
 			$staff->sid = $sid;
 			$staff->delete ();
-
-			Doo::loadModel ('holidaystaff');
-			$hstaff = new HStaff();
+			
+			Doo::loadModel ( 'holidaystaff' );
+			$hstaff = new HStaff ();
 			$hstaff->uid = $sid;
-			$hstaff->delete();
+			$hstaff->delete ();
 		}
 		return "/adminuser";
 	}
@@ -979,7 +976,164 @@ class AdminController extends DooController {
 		return "/adminInvoice";
 	}
 	
+	/**
+	 * 开票办事处权限设置
+	 */
+	function adminInvoiceCategory() {
+		Doo::loadClass ( 'XDeode' );
+		$XDeode = new XDeode ( 5 );
+		Doo::loadModel ( 'staff' );
+		$staff = new staff ();
+		Doo::loadModel ( "invoiceCategoryManage" );
+		$invoiceCategoryManage = new invoiceCategoryManage ();
+		Doo::loadModel ( 'L_category' );
+		$category = new L_category ();
+		
+		$categoryList = $category->getCategory ();
+		$managelist = $invoiceCategoryManage->find ( array (
+				'asArray' => true 
+		) );
+		$staffList=$staff->getStaff();
+		
+		$invoiceStaff=array();
+		foreach ( $categoryList as $key => $value ) {
+			$invoiceStaff[$value['cidKey']]=array();
+			$categoryList[$key]['html']='';
+			foreach ($staffList as $k=>$v){
+				$ul=array();
+				if($value['cid']==$v['cid']){
+					array_push($ul, $v['sidKey']);
+					array_push($ul, $v['username']);
+					array_push($invoiceStaff[$value['cidKey']], $ul);
+				}
+			}
+			
+			foreach ($managelist as $e=>$a){
+				if ($value['cid']==$a['cid']){
+					$name = json_decode ( $a ['staff'] );
+					$staffString = "";
+					foreach ( $name as $y => $l ) {
+						$sidKey=$XDeode->encode ( $l [0] );
+						$icidKey=$XDeode->encode ( $a ['icid'] );
+						$staffString .= $l[1].'<a href="javascript:if(window.confirm(\'确认删除?\'))window.location=\'/delInvoiceCategoryManage/' . $sidKey . '/' . $icidKey . '\'"  role="button" title="删除" class="icon-">k</a>&nbsp;';
+					}
+					$categoryList[$key]['html']=$staffString;
+					break;
+				}
+			}
+		}
+		
+		//print_r($invoiceStaff);
+		
+		$data ['categoryList'] = $categoryList;
+		$data['invoiceStaff']=json_encode($invoiceStaff);
+
+		$data ['memu'] = "invoice";
+		$data ['staff'] = $this->staff;
+		$this->render ( "/admin/adminInvoiceCategory", $data );
+	}
 	
+	/**
+	 * 添加办事处查看权限
+	 */
+	function addInvoiceCategoryManage(){
+		$cidKey = $this->get_args ( 'cidKey' ) ? $this->get_args ( 'cidKey' ) : "";
+		$sidKey = $this->get_args ( 'sidKey' ) ? $this->get_args ( 'sidKey' ) : "";
+		
+		if(!empty($cidKey)&&!empty($sidKey)){
+			Doo::loadModel ( "invoiceCategoryManage" );
+			$invoiceCategoryManage = new invoiceCategoryManage ();
+			Doo::loadClass ( 'XDeode' );
+			$XDeode = new XDeode ( 5 );
+			Doo::loadModel ( 'staff' );
+			$staff = new staff ();
+			
+			$cid=$XDeode->decode($cidKey);
+			$sid=$XDeode->decode($sidKey);
+			if (!is_numeric($cid)||!is_numeric($sid))
+				die ( 'illegal request' );
+			
+			$icm=$invoiceCategoryManage->getOne(array (
+					'where' => 'cid ='.$cid,
+					'asArray' => true
+			) );
+			$staffDetail=$staff->getStaffBySid($sid);
+			
+			if (empty ( $icm )) {
+				$invoiceCategoryManage = new invoiceCategoryManage ();
+				$list = array ();
+				
+				$info=array($staffDetail['sid'],$staffDetail['username']);
+				array_push ( $list, $info );
+				
+				$invoiceCategoryManage->cid=$cid;
+				$invoiceCategoryManage->staff=json_encode ( $list );
+				
+				$invoiceCategoryManage->insert ();
+			}else{
+				$invoiceCategoryManage = new invoiceCategoryManage ();
+				$list = json_decode ( $icm ['staff'], true );
+				
+				$flag=true;
+				foreach ( $list as $key => $value ) {
+					if ($value [0] == $sid) {
+						$flag=false;
+						break;
+					}
+				}
+				if ($flag){
+					$info=array($staffDetail['sid'],$staffDetail['username']);
+					array_push ( $list, $info );
+				}
+				$invoiceCategoryManage->staff = json_encode ( $list );
+				$invoiceCategoryManage->update ( array (
+						'where' => 'icid = ' . $icm ['icid']
+				) );
+			}
+			return '/adminInvoiceCategory';
+		}
+		die ( 'illegal request' );
+	}
+	
+	/**
+	 * 去除查看办事处汇总人员
+	 */
+	function delInvoiceCategoryManage(){
+		
+		$sidKey = isset ( $this->params ['sidKey'] ) ? $this->params ['sidKey'] : '';
+		$icidKey = isset ( $this->params ['icidKey'] ) ? $this->params ['icidKey'] : '';
+		
+		Doo::loadClass ( 'XDeode' );
+		$XDeode = new XDeode ( 5 );
+		
+		$icid=$XDeode->decode($icidKey);
+		$sid=$XDeode->decode($sidKey);
+		if (!is_numeric($icid)||!is_numeric($sid))
+			die ( 'illegal request' );
+		
+		Doo::loadModel ( "invoiceCategoryManage" );
+		$invoiceCategoryManage = new invoiceCategoryManage ();
+		
+		$icmDetail=$invoiceCategoryManage->getInvoiceCMByIcid($icid);
+		if (empty ( $icmDetail ))
+			die ( 'illegal request' );
+		
+		$list = json_decode ( $icmDetail ['staff'], true );
+		
+		foreach ( $list as $k => $v ) {
+			if ($v [0] == $sid) {
+				unset ( $list [$k] );
+				break;
+			}
+		}
+		$invoiceCategoryManage = new invoiceCategoryManage ();
+		$invoiceCategoryManage->staff = json_encode ( $list );
+		$invoiceCategoryManage->update ( array (
+				'where' => 'icid = ' . $icmDetail ['icid']
+		) );
+		
+		return '/adminInvoiceCategory';
+	}
 	
 	function ajaxRoleStaff() {
 		$name = $this->get_args ( 'name' ) ? $this->get_args ( 'name' ) : "";
@@ -1355,40 +1509,50 @@ class AdminController extends DooController {
 		
 		return $result ['count'];
 	}
-
-	public function holidayGroup(){
-		Doo::loadModel('staff');
-		Doo::loadModel("holidayacman");
-		Doo::loadModel('L_category');
-		$L_category = new L_category();
-		$acman=new HACMan();
-		$staff=new staff();
-
-		$data['staffList']=$staff->find(array('select'=>'username,sid,wxid', 'where' => 'cid!=1','asArray'=>true));
-		$acmanlist=$acman->find(array('where' => 'type=0', 'desc' => 'id','asArray'=>true));
-		if(!empty($acmanlist)){
-			foreach($acmanlist as $k => $v){
-				$acmanlist[$k]['name'] = implode('->', explode(' ', $v['name']));
-				$category = explode(',',$v['category']);
-				$categoryname = array();
-				if(!empty($category)){
-					foreach($category as $key => $value){
-						$name = $L_category->getOne(array('where' => 'cid="'.$value.'"', 'asArray' => TRUE));
-						array_push($categoryname,$name['title']);
+	public function holidayGroup() {
+		Doo::loadModel ( 'staff' );
+		Doo::loadModel ( "holidayacman" );
+		Doo::loadModel ( 'L_category' );
+		$L_category = new L_category ();
+		$acman = new HACMan ();
+		$staff = new staff ();
+		
+		$data ['staffList'] = $staff->find ( array (
+				'select' => 'username,sid,wxid',
+				'where' => 'cid!=1',
+				'asArray' => true 
+		) );
+		$acmanlist = $acman->find ( array (
+				'where' => 'type=0',
+				'desc' => 'id',
+				'asArray' => true 
+		) );
+		if (! empty ( $acmanlist )) {
+			foreach ( $acmanlist as $k => $v ) {
+				$acmanlist [$k] ['name'] = implode ( '->', explode ( ' ', $v ['name'] ) );
+				$category = explode ( ',', $v ['category'] );
+				$categoryname = array ();
+				if (! empty ( $category )) {
+					foreach ( $category as $key => $value ) {
+						$name = $L_category->getOne ( array (
+								'where' => 'cid="' . $value . '"',
+								'asArray' => TRUE 
+						) );
+						array_push ( $categoryname, $name ['title'] );
 					}
 				}
-				$acmanlist[$k]['categoryname'] = implode(',',$categoryname);
+				$acmanlist [$k] ['categoryname'] = implode ( ',', $categoryname );
 			}
 		}
-
-		//获取办事处列表
-
-		$data['category']=$L_category->getCategory();
-		$data['acmanlist'] = $acmanlist;
-		$data['staff']=$this->staff;
-		$data['memu'] = 'holiday';
-		$data['noindexjs'] = 'noindexjs';
-		$this->render( "/admin/admin_holidayGroup", $data );
+		
+		// 获取办事处列表
+		
+		$data ['category'] = $L_category->getCategory ();
+		$data ['acmanlist'] = $acmanlist;
+		$data ['staff'] = $this->staff;
+		$data ['memu'] = 'holiday';
+		$data ['noindexjs'] = 'noindexjs';
+		$this->render ( "/admin/admin_holidayGroup", $data );
 	}
 	public function addHolidayApprover() {
 		if (! isset ( $_POST ['title'] ) || empty ( $_POST ['title'] )) {
@@ -1398,333 +1562,362 @@ class AdminController extends DooController {
 			exit ( '请选择成员' );
 		}
 		
-		
-		
 		$idname = $name = $pinyinname = array ();
-		$stafflist = explode(',',$_POST['staff']);
+		$stafflist = explode ( ',', $_POST ['staff'] );
 		foreach ( $stafflist as $k => $v ) {
 			$msg = explode ( ':', $v );
 			array_push ( $idname, $msg [0] );
 			array_push ( $name, $msg [1] );
 			array_push ( $pinyinname, $msg [2] );
 		}
-
-		Doo::loadModel("holidayacman");
-		$acman=new HACMan();
-		$acman->typename = $_POST['title'];
-		$acman->idname = implode(',', $idname);
-		$acman->name = implode(' ', $name);
-		$acman->pinyinname = implode('|', $pinyinname);
+		
+		Doo::loadModel ( "holidayacman" );
+		$acman = new HACMan ();
+		$acman->typename = $_POST ['title'];
+		$acman->idname = implode ( ',', $idname );
+		$acman->name = implode ( ' ', $name );
+		$acman->pinyinname = implode ( '|', $pinyinname );
 		$acman->type = 0;
-		$result = $acman->insert();
-		if($result){
-			$acman2=new HACMan();
+		$result = $acman->insert ();
+		if ($result) {
+			$acman2 = new HACMan ();
 			$acman2->type = $result;
-			$acman2->insert();
-
-			Doo::loadModel('holidaystaff');
-			foreach($idname as $ik => $iv){
-				$hstaff = new HStaff();
+			$acman2->insert ();
+			
+			Doo::loadModel ( 'holidaystaff' );
+			foreach ( $idname as $ik => $iv ) {
+				$hstaff = new HStaff ();
 				$hstaff->uid = $iv;
 				$hstaff->isadmin = 1;
-				$hstaff->update();
+				$hstaff->update ();
 			}
 		}
 		return '/holidaygroup';
 	}
-
-	public function setHolidaySee(){
-		if(!isset($_POST['groupid']) || empty($_POST['groupid']) || !is_numeric($_POST['groupid'])){
-			exit('审批组id出错');
-		}
-		$category = !empty($_POST['category']) ? implode(',', $_POST['category']) : '';
-		Doo::loadModel('holidayacman');
-		$acman = new HACMan();
-		$acman->id = $_POST['groupid'];
+	public function setHolidaySee() {
+		if (! isset ( $_POST ['groupid'] ) || empty ( $_POST ['groupid'] ) || ! is_numeric ( $_POST ['groupid'] )) {
+			exit ( '审批组id出错' );
+		}
+		$category = ! empty ( $_POST ['category'] ) ? implode ( ',', $_POST ['category'] ) : '';
+		Doo::loadModel ( 'holidayacman' );
+		$acman = new HACMan ();
+		$acman->id = $_POST ['groupid'];
 		$acman->category = $category;
-		$acman->update();
-
+		$acman->update ();
+		
 		return '/holidaygroup';
 	}
-
-	public function delHolidayGroup(){
-		if(!isset($_POST['approvalid']) || empty($_POST['approvalid']) || !is_numeric($_POST['approvalid'])){
-			exit('审批组id出错');
-		}
-		Doo::loadModel('holidayacman');
-		$acman = new HACMan();
-		$idname = $acman->getOne(array('where' => 'id='.$_POST['approvalid'], 'asArray' => TRUE));
-		$idname = explode(',', $idname['idname']);
-
-		$acman->id = $_POST['approvalid'];
-		$acman->delete();
-
-//		$acman2 = new HACMan();
-//		$acman2->type = $_POST['approvalid'];
-//		$acman2->delete();
-
-		//删除管理员资格
-		$acman3 = new HACMan();
-		foreach($idname as $k => $v){
+	public function delHolidayGroup() {
+		if (! isset ( $_POST ['approvalid'] ) || empty ( $_POST ['approvalid'] ) || ! is_numeric ( $_POST ['approvalid'] )) {
+			exit ( '审批组id出错' );
+		}
+		Doo::loadModel ( 'holidayacman' );
+		$acman = new HACMan ();
+		$idname = $acman->getOne ( array (
+				'where' => 'id=' . $_POST ['approvalid'],
+				'asArray' => TRUE 
+		) );
+		$idname = explode ( ',', $idname ['idname'] );
+		
+		$acman->id = $_POST ['approvalid'];
+		$acman->delete ();
+		
+		// $acman2 = new HACMan();
+		// $acman2->type = $_POST['approvalid'];
+		// $acman2->delete();
+		
+		// 删除管理员资格
+		$acman3 = new HACMan ();
+		foreach ( $idname as $k => $v ) {
 			$same = 0;
-			$approverlist = $acman3->find(array('where' => 'idname like "%'.$v.'%" and type=0', 'asArray' => TRUE));
-			if(!empty($approverlist)){
-				foreach($approverlist as $ak => $av){
-					$aidname = explode(',', $av['idname']);
-					foreach($aidname as $ik => $iv){
-						if($iv == $v){
+			$approverlist = $acman3->find ( array (
+					'where' => 'idname like "%' . $v . '%" and type=0',
+					'asArray' => TRUE 
+			) );
+			if (! empty ( $approverlist )) {
+				foreach ( $approverlist as $ak => $av ) {
+					$aidname = explode ( ',', $av ['idname'] );
+					foreach ( $aidname as $ik => $iv ) {
+						if ($iv == $v) {
 							$same = 1;
 							break;
 						}
 					}
 				}
 			}
-			if($same == 0){
-				Doo::loadModel('holidaystaff');
-				$hstaff = new HStaff();
+			if ($same == 0) {
+				Doo::loadModel ( 'holidaystaff' );
+				$hstaff = new HStaff ();
 				$hstaff->uid = $v;
 				$hstaff->isadmin = 0;
-				$hstaff->update();
+				$hstaff->update ();
 			}
 		}
-
+		
 		return '/holidaygroup';
 	}
-
-	public function holidayCSGroup(){
-		Doo::loadModel('staff');
-		Doo::loadModel('holidayacman');
-		$acman = new HACMan();
-		$staff = new staff();
-
-		$approverlist = $acman->find(array('where' => 'type=0', 'desc' => 'id', 'asArray' => TRUE));
-		if(!empty($approverlist)){
-			foreach($approverlist as $k => $v){
-				$csman = $acman->getOne(array('where' => 'type='.$v['id'], 'asArray' => TRUE));
-				if(!empty($csman['name'])){
-					$idname = explode(',',$csman['idname']);
-					$name = explode(' ',$csman['name']);
-					$pinyinname = explode('|',$csman['pinyinname']);
-					$csmsg = array();
-					foreach($idname as $ik => $iv){
-						$csmsg[$ik]['csidname'] = $iv;
-						$csmsg[$ik]['csname'] = $name[$ik];
-						$csmsg[$ik]['cspinyinname'] = $pinyinname[$ik];
+	public function holidayCSGroup() {
+		Doo::loadModel ( 'staff' );
+		Doo::loadModel ( 'holidayacman' );
+		$acman = new HACMan ();
+		$staff = new staff ();
+		
+		$approverlist = $acman->find ( array (
+				'where' => 'type=0',
+				'desc' => 'id',
+				'asArray' => TRUE 
+		) );
+		if (! empty ( $approverlist )) {
+			foreach ( $approverlist as $k => $v ) {
+				$csman = $acman->getOne ( array (
+						'where' => 'type=' . $v ['id'],
+						'asArray' => TRUE 
+				) );
+				if (! empty ( $csman ['name'] )) {
+					$idname = explode ( ',', $csman ['idname'] );
+					$name = explode ( ' ', $csman ['name'] );
+					$pinyinname = explode ( '|', $csman ['pinyinname'] );
+					$csmsg = array ();
+					foreach ( $idname as $ik => $iv ) {
+						$csmsg [$ik] ['csidname'] = $iv;
+						$csmsg [$ik] ['csname'] = $name [$ik];
+						$csmsg [$ik] ['cspinyinname'] = $pinyinname [$ik];
 					}
-					$approverlist[$k]['csmsg'] = $csmsg;
+					$approverlist [$k] ['csmsg'] = $csmsg;
 				}
 			}
-			$data['approverlist'] = $approverlist;
+			$data ['approverlist'] = $approverlist;
 		}
-
-		//获取总部人员列表
-		$zongbu = $staff->getStaffByCid(12);
-		$data['zongbu'] = $zongbu;
-
-		//获取办事处列表
-		Doo::loadModel('L_category');
-		$L_category = new L_category();
-		$data['category']=$L_category->getCategory();
-
-
-		$data['memu'] = 'holiday';
-		$data['noindexjs'] = 'noindexjs';
-		$this->render( "/admin/admin_holidayGroup_cc", $data );
+		
+		// 获取总部人员列表
+		$zongbu = $staff->getStaffByCid ( 12 );
+		$data ['zongbu'] = $zongbu;
+		
+		// 获取办事处列表
+		Doo::loadModel ( 'L_category' );
+		$L_category = new L_category ();
+		$data ['category'] = $L_category->getCategory ();
+		
+		$data ['memu'] = 'holiday';
+		$data ['noindexjs'] = 'noindexjs';
+		$this->render ( "/admin/admin_holidayGroup_cc", $data );
 	}
-
-	public function getStaffCategory(){
-		if(isset($_POST['cid']) && is_numeric($_POST['cid'])){
-			Doo::loadModel('staff');
-			$staff = new staff();
-			$stafflist = $staff->getStaffByCid($_POST['cid']);
-			exit(json_encode(array('code' => 200, 'stafflist' => $stafflist)));
-		}
-		exit(json_encode(array('code' => 400)));
+	public function getStaffCategory() {
+		if (isset ( $_POST ['cid'] ) && is_numeric ( $_POST ['cid'] )) {
+			Doo::loadModel ( 'staff' );
+			$staff = new staff ();
+			$stafflist = $staff->getStaffByCid ( $_POST ['cid'] );
+			exit ( json_encode ( array (
+					'code' => 200,
+					'stafflist' => $stafflist 
+			) ) );
+		}
+		exit ( json_encode ( array (
+				'code' => 400 
+		) ) );
 	}
-
-	public function addHolidayCS(){
-		if(!isset($_POST['approvalid']) || empty($_POST['approvalid']) || !is_numeric($_POST['approvalid'])){
-			exit('审批组出错');
+	public function addHolidayCS() {
+		if (! isset ( $_POST ['approvalid'] ) || empty ( $_POST ['approvalid'] ) || ! is_numeric ( $_POST ['approvalid'] )) {
+			exit ( '审批组出错' );
 		}
-		if(!isset($_POST['cidstaff']) || empty($_POST['cidstaff'])){
-			exit('抄送人出错');
+		if (! isset ( $_POST ['cidstaff'] ) || empty ( $_POST ['cidstaff'] )) {
+			exit ( '抄送人出错' );
 		}
-		$cidstaff = explode(':',$_POST['cidstaff']);
-
-		Doo::loadModel('holidayacman');
-		$acman = new HACMan();
-		$csmsg = $acman->getOne(array('where' => 'type='.$_POST['approvalid'], 'asArray' => TRUE));
-		$csidmsg = !empty($csmsg['idname']) ? $csmsg['idname'].','.$cidstaff[0] : $cidstaff[0];
-		$csnamemsg = !empty($csmsg['name']) ? $csmsg['name'].' '.$cidstaff[1] : $cidstaff[1];
-		$cspinyinnamemsg = !empty($csmsg['pinyinname']) ? $csmsg['pinyinname'].'|'.$cidstaff[2] : $cidstaff[2];
-
-		$acman->id = $csmsg['id'];
+		$cidstaff = explode ( ':', $_POST ['cidstaff'] );
+		
+		Doo::loadModel ( 'holidayacman' );
+		$acman = new HACMan ();
+		$csmsg = $acman->getOne ( array (
+				'where' => 'type=' . $_POST ['approvalid'],
+				'asArray' => TRUE 
+		) );
+		$csidmsg = ! empty ( $csmsg ['idname'] ) ? $csmsg ['idname'] . ',' . $cidstaff [0] : $cidstaff [0];
+		$csnamemsg = ! empty ( $csmsg ['name'] ) ? $csmsg ['name'] . ' ' . $cidstaff [1] : $cidstaff [1];
+		$cspinyinnamemsg = ! empty ( $csmsg ['pinyinname'] ) ? $csmsg ['pinyinname'] . '|' . $cidstaff [2] : $cidstaff [2];
+		
+		$acman->id = $csmsg ['id'];
 		$acman->idname = $csidmsg;
 		$acman->name = $csnamemsg;
 		$acman->pinyinname = $cspinyinnamemsg;
-		$acman->update();
-
-		Doo::loadModel('holidaystaff');
-		$hstaff = new HStaff();
-		$hstaffmsg = $hstaff->getOne(array('where' => 'uid=?','param' => array($cidstaff[0]), 'asArray' => TRUE));
-		if(!empty($hstaffmsg) && $hstaffmsg['iscc'] == 0){
-			$hstaff->uid = $cidstaff[0];
+		$acman->update ();
+		
+		Doo::loadModel ( 'holidaystaff' );
+		$hstaff = new HStaff ();
+		$hstaffmsg = $hstaff->getOne ( array (
+				'where' => 'uid=?',
+				'param' => array (
+						$cidstaff [0] 
+				),
+				'asArray' => TRUE 
+		) );
+		if (! empty ( $hstaffmsg ) && $hstaffmsg ['iscc'] == 0) {
+			$hstaff->uid = $cidstaff [0];
 			$hstaff->iscc = 1;
-			$hstaff->update();
+			$hstaff->update ();
 		}
 		return '/hcsgroup';
 	}
-
-	public function delHolidayCS(){
-		if(!isset($_POST['approvalid']) || empty($_POST['approvalid']) || !is_numeric($_POST['approvalid'])){
-			exit('审批id出错');
+	public function delHolidayCS() {
+		if (! isset ( $_POST ['approvalid'] ) || empty ( $_POST ['approvalid'] ) || ! is_numeric ( $_POST ['approvalid'] )) {
+			exit ( '审批id出错' );
 		}
-		if(!isset($_POST['cidstaff']) || empty($_POST['cidstaff'])){
-			exit('抄送信息出错');
+		if (! isset ( $_POST ['cidstaff'] ) || empty ( $_POST ['cidstaff'] )) {
+			exit ( '抄送信息出错' );
 		}
-		$cidstaff = explode(':',$_POST['cidstaff']);
-
-		Doo::loadModel('holidayacman');
-		$acman = new HACMan();
-		$csmsg = $acman->getOne(array('where' => 'type='.$_POST['approvalid'], 'asArray' => TRUE));
-		if(!empty($csmsg['idname'])){
-			$idnamearr = explode(',', $csmsg['idname']);
-			foreach($idnamearr as $ik => $iv){
-				if($iv == $cidstaff[0]){
-					unset($idnamearr[$ik]);
+		$cidstaff = explode ( ':', $_POST ['cidstaff'] );
+		
+		Doo::loadModel ( 'holidayacman' );
+		$acman = new HACMan ();
+		$csmsg = $acman->getOne ( array (
+				'where' => 'type=' . $_POST ['approvalid'],
+				'asArray' => TRUE 
+		) );
+		if (! empty ( $csmsg ['idname'] )) {
+			$idnamearr = explode ( ',', $csmsg ['idname'] );
+			foreach ( $idnamearr as $ik => $iv ) {
+				if ($iv == $cidstaff [0]) {
+					unset ( $idnamearr [$ik] );
 					break;
 				}
 			}
-			$csidmsg = implode(',',$idnamearr);
+			$csidmsg = implode ( ',', $idnamearr );
 		}
-		if(!empty($csmsg['name'])){
-			$namearr = explode(' ', $csmsg['name']);
-			foreach($namearr as $nk => $nv){
-				if($nv == $cidstaff[1]){
-					unset($namearr[$nk]);
+		if (! empty ( $csmsg ['name'] )) {
+			$namearr = explode ( ' ', $csmsg ['name'] );
+			foreach ( $namearr as $nk => $nv ) {
+				if ($nv == $cidstaff [1]) {
+					unset ( $namearr [$nk] );
 					break;
 				}
 			}
-			$csnamemsg = implode(' ',$namearr);
+			$csnamemsg = implode ( ' ', $namearr );
 		}
-		if(!empty($csmsg['pinyinname'])){
-			$pinyinnamearr = explode('|', $csmsg['pinyinname']);
-			foreach($pinyinnamearr as $pk => $pv){
-				if($pv == $cidstaff[2]){
-					unset($pinyinnamearr[$pk]);
+		if (! empty ( $csmsg ['pinyinname'] )) {
+			$pinyinnamearr = explode ( '|', $csmsg ['pinyinname'] );
+			foreach ( $pinyinnamearr as $pk => $pv ) {
+				if ($pv == $cidstaff [2]) {
+					unset ( $pinyinnamearr [$pk] );
 					break;
 				}
 			}
-			$cspinyinnamemsg = implode('|',$pinyinnamearr);
+			$cspinyinnamemsg = implode ( '|', $pinyinnamearr );
 		}
-
-		$acman->id = $csmsg['id'];
-		if(isset($csidmsg)){
+		
+		$acman->id = $csmsg ['id'];
+		if (isset ( $csidmsg )) {
 			$acman->idname = $csidmsg;
 		}
-		if(isset($csnamemsg)){
+		if (isset ( $csnamemsg )) {
 			$acman->name = $csnamemsg;
 		}
-		if(isset($cspinyinnamemsg)){
+		if (isset ( $cspinyinnamemsg )) {
 			$acman->pinyinname = $cspinyinnamemsg;
 		}
-		$acman->update();
-
-		//删除抄送员资格
-		$acman3 = new HACMan();
+		$acman->update ();
+		
+		// 删除抄送员资格
+		$acman3 = new HACMan ();
 		$same = 0;
-		$approverlist = $acman3->find(array('where' => 'idname like "%'.$cidstaff[0].'%" and type!=0', 'asArray' => TRUE));
-		if(!empty($approverlist)){
-			foreach($approverlist as $ak => $av){
-				$aidname = explode(',', $av['idname']);
-				foreach($aidname as $ik => $iv){
-					if($iv == $cidstaff[0]){
+		$approverlist = $acman3->find ( array (
+				'where' => 'idname like "%' . $cidstaff [0] . '%" and type!=0',
+				'asArray' => TRUE 
+		) );
+		if (! empty ( $approverlist )) {
+			foreach ( $approverlist as $ak => $av ) {
+				$aidname = explode ( ',', $av ['idname'] );
+				foreach ( $aidname as $ik => $iv ) {
+					if ($iv == $cidstaff [0]) {
 						$same = 1;
 						break;
 					}
 				}
 			}
 		}
-		if($same == 0){
-			Doo::loadModel('holidaystaff');
-			$hstaff = new HStaff();
-			$hstaff->uid = $cidstaff[0];
+		if ($same == 0) {
+			Doo::loadModel ( 'holidaystaff' );
+			$hstaff = new HStaff ();
+			$hstaff->uid = $cidstaff [0];
 			$hstaff->iscc = 0;
-			$hstaff->update();
+			$hstaff->update ();
 		}
-
+		
 		return '/hcsgroup';
 	}
-
-	public function HolidayAdmin(){
-		Doo::loadModel('staff');
-		$staff=new staff();
-		$staffList=$staff->find(array('select'=>'username,sid', 'where' => 'cid!=1','asArray'=>true));
-
-		Doo::loadModel('holidayadmin');
-		$admin = new HAdmin();
-		$adminList = $admin->find(array('asArray' => TRUE));
-
-		if(!empty($adminList)){
-			foreach($adminList as $k => $v){
-				foreach($staffList as $sk => $sv){
-					if($sv['sid'] == $v['uid']){
-						array_splice($staffList, $sk,1);
+	public function HolidayAdmin() {
+		Doo::loadModel ( 'staff' );
+		$staff = new staff ();
+		$staffList = $staff->find ( array (
+				'select' => 'username,sid',
+				'where' => 'cid!=1',
+				'asArray' => true 
+		) );
+		
+		Doo::loadModel ( 'holidayadmin' );
+		$admin = new HAdmin ();
+		$adminList = $admin->find ( array (
+				'asArray' => TRUE 
+		) );
+		
+		if (! empty ( $adminList )) {
+			foreach ( $adminList as $k => $v ) {
+				foreach ( $staffList as $sk => $sv ) {
+					if ($sv ['sid'] == $v ['uid']) {
+						array_splice ( $staffList, $sk, 1 );
 						break;
 					}
 				}
 			}
 		}
-
-		$data['staffList'] = $staffList;
-		$data['adminList'] = $adminList;
-		$data['memu'] = 'holiday';
-		$data['noindexjs'] = 'noindexjs';
-		$this->render( "/admin/admin_holidayuser", $data );
+		
+		$data ['staffList'] = $staffList;
+		$data ['adminList'] = $adminList;
+		$data ['memu'] = 'holiday';
+		$data ['noindexjs'] = 'noindexjs';
+		$this->render ( "/admin/admin_holidayuser", $data );
 	}
-
-	public function addHolidayAdmin(){
-		if(!isset($_POST['staff']) || empty($_POST['staff'])){
-			exit('请选择管理人');
+	public function addHolidayAdmin() {
+		if (! isset ( $_POST ['staff'] ) || empty ( $_POST ['staff'] )) {
+			exit ( '请选择管理人' );
 		}
-
-		Doo::loadModel('holidayadmin');
-		foreach($_POST['staff'] as $k => $v){
-			$staffmsg = explode(':',$v);
-			$admin = new HAdmin();
-			$admin->uid = $staffmsg[0];
-			$admin->username = $staffmsg[1];
-			$admin->insert();
+		
+		Doo::loadModel ( 'holidayadmin' );
+		foreach ( $_POST ['staff'] as $k => $v ) {
+			$staffmsg = explode ( ':', $v );
+			$admin = new HAdmin ();
+			$admin->uid = $staffmsg [0];
+			$admin->username = $staffmsg [1];
+			$admin->insert ();
 		}
 		return '/holidayadmin';
 	}
-
-	public function delHolidayAdmin(){
-		if(!isset($_POST['cidstaff']) || empty($_POST['cidstaff'])){
-			exit('请选择管理人删除');
+	public function delHolidayAdmin() {
+		if (! isset ( $_POST ['cidstaff'] ) || empty ( $_POST ['cidstaff'] )) {
+			exit ( '请选择管理人删除' );
 		}
-
-		Doo::loadModel('holidayadmin');
-		$admin = new HAdmin();
-		$admin->id = $_POST['cidstaff'];
-		$admin->delete();
-
+		
+		Doo::loadModel ( 'holidayadmin' );
+		$admin = new HAdmin ();
+		$admin->id = $_POST ['cidstaff'];
+		$admin->delete ();
+		
 		return '/holidayadmin';
 	}
-
-
-	//检查年假是否过期并更新年假
-	private function updateAnnualLeave($staff){
-		Doo::loadModel('holidaystaff');
-		$hstaff = new HStaff();
-		$hstaffmsg = $hstaff->getOne(array('where' => 'uid='.$staff['sid'],'asArray' => TRUE));
-		$hiredate = $staff['hiredate'];
-		$hadyear = intval((time()-strtotime($hiredate))/(86400*365));
-		if($hadyear != $hstaffmsg['hadyear']){
-			$hstaff->uid = $staff['sid'];
+	
+	// 检查年假是否过期并更新年假
+	private function updateAnnualLeave($staff) {
+		Doo::loadModel ( 'holidaystaff' );
+		$hstaff = new HStaff ();
+		$hstaffmsg = $hstaff->getOne ( array (
+				'where' => 'uid=' . $staff ['sid'],
+				'asArray' => TRUE 
+		) );
+		$hiredate = $staff ['hiredate'];
+		$hadyear = intval ( (time () - strtotime ( $hiredate )) / (86400 * 365) );
+		if ($hadyear != $hstaffmsg ['hadyear']) {
+			$hstaff->uid = $staff ['sid'];
 			$hstaff->hadyear = $hadyear;
 			$hstaff->yearnum = $hadyear == 0 ? 0 : (($hadyear < 10 && $hadyear >= 1) ? 5 : (($hadyear >= 10 && $hadyear < 20) ? 10 : 15));
-			$hstaff->update();
+			$hstaff->update ();
 		}
 	}
 }

+ 238 - 27
protected/controller/InvoiceController.php

@@ -65,6 +65,16 @@ class InvoiceController extends DooController {
 		 * Doo::acl()->isAllowed($uGroups['groups'], $resource, $action);
 		 */
 		// var_dump($flag) ;
+		//单独判断办事处汇总的访问权限   invoiceAggregateCategoryDetail
+		if ($action=='invoiceAggregateCategoryDetail'){
+			Doo::loadModel ( "invoiceCategoryManage" );
+			$invoiceCategoryManage = new invoiceCategoryManage ();
+			
+			$icm=$invoiceCategoryManage->getInvoiceCMByStaff($sid);
+			if (empty($icm))
+				die ( 'illegal request' );
+		}
+		
 		if (! $flag)
 			die ( 'illegal request' );
 	}
@@ -858,6 +868,9 @@ class InvoiceController extends DooController {
 	 * @return string
 	 */
 	function invoiceTrainingUpload() {
+		
+		
+		
 		$POST_MAX_SIZE = ini_get ( 'post_max_size' );
 		$unit = strtoupper ( substr ( $POST_MAX_SIZE, - 1 ) );
 		$multiplier = ($unit == 'M' ? 1048576 : ($unit == 'K' ? 1024 : ($unit == 'G' ? 1073741824 : 1)));
@@ -915,6 +928,7 @@ class InvoiceController extends DooController {
 	 * 导入发票临时仓库
 	 */
 	function invoiceStoreImport() {
+		//include Doo::conf ()->BASE_PATH . 'diagnostic/debug.php';
 		$trainingKey = $this->get_args ( 'trainingKey' ) ? $this->get_args ( 'trainingKey' ) : "";
 		$path = $this->get_args ( 'trainName' ) ? $this->get_args ( 'trainName' ) : "";
 		
@@ -928,11 +942,11 @@ class InvoiceController extends DooController {
 			$XDeode = new XDeode ( 5 );
 			$itid = $XDeode->decode ( $trainingKey );
 			
-			$exlArray = $this->_format_excel_to_array ( DOO::conf ()->SITE_PATH . "upload/invoiceTraining/" . $path, 'invoiceTrain' );
+			$exlArray = $this->formatExcelToArrayTrain ( DOO::conf ()->SITE_PATH . "upload/invoiceTraining/" . $path );
 			
 			$userName = $this->staff [0] ['username'];
 			$sDetail = $staff->getStaffByName ( $userName );
-			
+			//die('sdd');
 			// 可以优化
 			foreach ( $exlArray as $key => $value ) {
 				// 开票
@@ -961,9 +975,9 @@ class InvoiceController extends DooController {
 				
 				$invoice->invoiceElement = $value ['invoiceElement'];
 				$invoice->remark = $value ['remark'];
-				$invoice->date = $value ['date'];
+				//$invoice->date = $value ['date'];
 				
-				$invoice->printTime = $value ['date'];
+				//$invoice->printTime = $value ['date'];
 				
 				$invoice->ipSource = 1;
 				
@@ -3338,7 +3352,8 @@ class InvoiceController extends DooController {
 		
 		if ($detail ['invoicePrice'] <= $sum)
 			$item += array (
-					'untreadStatus' => 3 
+					'untreadStatus' => 3 ,
+					'bindTime'=>date ( "Y-m-d H:i:s" )
 			);
 			
 			// print_r($item);
@@ -3704,6 +3719,108 @@ class InvoiceController extends DooController {
 		$this->data ['receiptMemu'] = 'invoiceAggregate';
 		$this->render ( "/admin/invoiceAggregateCategory", $this->data );
 	}
+	
+	function invoiceAggregateCategoryDetail(){
+		
+		$cidKey = $this->get_args ( 'cidKey' ) ? $this->get_args ( 'cidKey' ) : '';
+		
+		Doo::loadClass ( 'XDeode' );
+		$XDeode = new XDeode ( 5 );
+		Doo::loadModel ( 'invoiceStatistics' );
+		$invoiceStatistics = new invoiceStatistics ();
+		Doo::loadModel('L_category');
+		$category=new L_category();
+		Doo::loadModel('invoice');
+		$invoice=new invoice();
+		Doo::loadModel ( 'staff' );
+		$staff = new staff ();
+		Doo::loadModel ( "invoiceCategoryManage" );
+		$invoiceCategoryManage = new invoiceCategoryManage ();
+		
+		$imcStaff=$invoiceCategoryManage->getInvoiceCMByStaff($this->staff[0]['sid']);
+		$cidList=array();
+		foreach ($imcStaff as $key=>$value){
+			array_push($cidList, $value['cid']);
+			if (empty($cidKey))
+				$cidKey=$XDeode->encode ( $value ['cid'] );
+		}
+		$categoryList =$category->getCategoryInCid(implode(',', $cidList));
+		
+		$cid = $XDeode->decode ( $cidKey );
+		
+		$redis = new Redis();
+		$redis->connect('127.0.0.1', '6379');
+		
+		$redisKey=date('Y-m-d').'_iacd_'.$cid;
+		$redisValue = $redis->lrange($redisKey, 0, -1);
+		
+		if (empty($redisValue)){
+			
+			$isMC=$invoiceStatistics->getInvoiceStatistiscsMothByCategory($cid);
+			$schedule=$invoice->getInvoiceScheduleByCid($cid);
+			
+			//获得办事处人员下的汇总
+			$slist=$staff->getStaffByCid($cid);
+			$ismsb=$invoiceStatistics->getISMSByCategory($cid);//当月汇总
+			$ISAS=$invoiceStatistics->getISASByCategory($cid);//全部汇总
+			$scheduleStaff=$invoice->getInvoiceScheduleByCidGroupSid($cid);//完成度
+			
+			foreach ($slist as $key=>$value){
+				$slist[$key]['invoicePrice']=0;
+				$slist[$key]['receivablesPrice']=0;
+				$slist[$key]['accountPrice']=0;
+				$slist[$key]['invoiceAllPrice']=0;
+				$slist[$key]['receivablesAllPrice']=0;
+				$slist[$key]['accountAllPrice']=0;
+				$slist[$key]['schedule']=0;
+				
+				foreach ($ismsb as $k=>$v){
+					if ($value['sid']==$v['staff']){
+						$slist[$key]['invoicePrice']=$v['invoicePrice'];
+						$slist[$key]['receivablesPrice']=$v['receivablesPrice'];
+						$slist[$key]['accountPrice']=$v['accountPrice'];
+					}
+				}
+				foreach ($ISAS as $e=>$a){
+					if ($value['sid']==$a['staff']){
+						$slist[$key]['invoiceAllPrice']=$a['invoicePrice'];
+						$slist[$key]['receivablesAllPrice']=$a['receivablesPrice'];
+						$slist[$key]['accountAllPrice']=$a['accountPrice'];
+					}
+				}
+				if (isset($scheduleStaff[$value['sid']]))
+					$slist[$key]['schedule']=$scheduleStaff[$value['sid']];
+			}
+			$this->data['cidKey']=$cidKey;
+			$schedule=(int)($schedule*100);
+			
+			$this->data['slist']=$slist;
+			$this->data['isMC']=$isMC;
+			$this->data['schedule']=$schedule;
+			
+			$slist=json_encode($slist);
+			$isMC=json_encode($isMC);
+			$schedule=json_encode($schedule);
+			$redis->lpush($redisKey, $slist);
+			$redis->lpush($redisKey, $isMC);
+			$redis->lpush($redisKey, $schedule);
+			
+		}else{
+			$this->data['cidKey']=$cidKey;
+			
+			$this->data['slist']=json_decode($redisValue[2],true);
+			$this->data['isMC']=json_decode($redisValue[1],true);
+			$this->data['schedule']=json_decode($redisValue[0],true);
+		}
+		
+		$this->data['categoryList']=$categoryList;
+		
+		$this->data ['memu'] = "invoice";
+		$this->data ['staff'] = $this->staff;
+		$this->data ['receiptMemu'] = 'invoiceAggregateCategoryDetail';
+		$this->render ( "/admin/invoiceAggregateCategoryDetail", $this->data );
+	}
+	
 	function invoiceAchieve() {
 		Doo::loadModel ( 'invoice' );
 		$invoice = new invoice ();
@@ -5055,35 +5172,40 @@ class InvoiceController extends DooController {
 		Doo::loadModel ( 'invoice' );
 		$invoice = new invoice ();
 		
-		$invoiceDetail = $invoice->getInvoiceByTitle ( $title, 'FUZZY', " and status=2 and printStatus=1 and untreadStatus=0 and irid='' " );
+		$invoiceDetail = $invoice->getInvoiceByTitle ( $title, 'FUZZY', " and status=2 and printStatus=1 and untreadStatus=0 and irid='' ",true );
 		
 		$invoiceHtml = '';
 		if (! empty ( $invoiceDetail )) {
 			$invoiceHtml = '<table class="table table-bordered table-condensed">
 			<thead><tr><th>开票单位(抬头)</th><th>开票金额</th><th>提交开票</th><th>出票</th><th>开票流水号</th><th width="80">入账</th></tr></thead><tbody><tr>';
-			if (! empty ( $invoiceDetail ['invoiceType'] )) {
-				$invoiceHtml .= '<td>' . $invoiceDetail ['invoiceCompany'] . '</td>';
-			} else {
-				$invoiceHtml .= '<td>' . $invoiceDetail ['invoiceTitle'] . '</td>';
-			}
-			
-			if (! empty ( $invoiceDetail ['invoiceType'] )) {
-				$invoiceHtml .= '<td>' . $invoiceDetail ['invoicePrice'] . '专</td>';
-			} else {
-				$invoiceHtml .= '<td>' . $invoiceDetail ['invoicePrice'] . '</td>';
-			}
+			foreach ($invoiceDetail as $key=>$value){
+				if (! empty ( $value ['invoiceType'] )) {
+					$invoiceHtml .= '<td>' . $value ['invoiceCompany'] . '</td>';
+				} else {
+					$invoiceHtml .= '<td>' . $value ['invoiceTitle'] . '</td>';
+				}
+				
+				if (! empty ( $value ['invoiceType'] )) {
+					$invoiceHtml .= '<td>' . $value ['invoicePrice'] . '专</td>';
+				} else {
+					$invoiceHtml .= '<td>' . $value ['invoicePrice'] . '</td>';
+				}
 			
-			$invoiceHtml .= '
-					<td>' . $invoiceDetail ['categoryName'] . $invoiceDetail ['userName'] . ' ' . $invoiceDetail ['date'] . '</td>
-					<td>' . $invoiceDetail ['printer'] . ' ' . $invoiceDetail ['printTime'] . '</td>
-					<td>' . $invoiceDetail ['invoiceSerial'] . '</td><td><a class="button btn-block" bind-receivables="ir' . $invoiceDetail ['iidKeyXD'] . '" data-ikey="' . $invoiceDetail ['iidKey'] . '" href="#">入账</a></td>
+				$invoiceHtml .= '
+					<td>' . $value ['categoryName'] . $value ['userName'] . ' ' . $value ['date'] . '</td>
+					<td>' . $value ['printer'] . ' ' . $value ['printTime'] . '</td>
+					<td>' . $value ['invoiceSerial'] . '</td><td><a class="button btn-block" bind-receivables="ir' . $value ['iidKeyXD'] . '" data-ikey="' . $value ['iidKey'] . '" href="#">入账</a></td>
 					</tr>
 					';
+			}
 			$invoiceHtml .= '</tbody></table>
 					
 					<script>
-					$(\'a[bind-receivables="ir' . $invoiceDetail ['iidKeyXD'] . '"]\').click(function() {
-							$("input[name=\'invoiceKey\']").val("' . $invoiceDetail ['iidKey'] . '");
+					$(\'a[bind-receivables^="ir"]\').click(function() {
+							
+							var data = $(this).attr("data-ikey");
+							
+							$("input[name=\'invoiceKey\']").val(data);
 							var invoiceKey=$("input[name=\'invoiceKey\']").val();
 							if(invoiceKey==""){
 								alert("入账错误,请重新刷新页面");
@@ -5340,7 +5462,7 @@ class InvoiceController extends DooController {
 	// 导入入账数据
 	function importInvoiceReceivablesDo() {
 		$path = $this->get_args ( 'path' ) ? $this->get_args ( 'path' ) : "";
-		include Doo::conf ()->BASE_PATH . 'diagnostic/debug.php';
+		//include Doo::conf ()->BASE_PATH . 'diagnostic/debug.php';
 		if ($path != "") {
 			Doo::loadModel ( 'invoiceReceivables' );
 			Doo::loadModel ( 'invoice' );
@@ -5415,6 +5537,92 @@ class InvoiceController extends DooController {
 		echo 'no file';
 	}
 	
+	
+	function formatExcelToArrayTrain($file_url = ""){
+		if (! file_exists ( $file_url )) {
+			return array ();
+		}
+		
+		//Doo::loadClass ( 'PHPExcel' );
+		Doo::loadClass ( 'PHPExcel1.7.9/PHPExcel' );
+		
+		
+		$PHPExcel = new PHPExcel ();
+		$PHPReader = new PHPExcel_Reader_Excel2007 ();
+		
+		if (! $PHPReader->canRead ( $file_url )) {
+			$PHPReader = new PHPExcel_Reader_Excel5 ();
+			if (! $PHPReader->canRead ( $file_url )) {
+		
+				echo 'no Excel';
+				return;
+			}
+		}
+		
+		$PHPExcel = $PHPReader->load ( $file_url );
+		/* * 读取excel文件中的第一个工作表 */
+		$currentSheet = $PHPExcel->getSheet ( 0 );
+		/* * 取得最大的列号 */
+		$allColumn = $currentSheet->getHighestColumn ();
+		/* * 取得一共有多少行 */
+		$allRow = $currentSheet->getHighestRow ();
+		$excel_array = array ();
+		//die($file_url);
+		$conk = 2;
+		
+		for($currentRow = $conk; $currentRow <= $allRow; $currentRow ++) {
+				
+			$excel_column = array ();
+			// 后期改进
+			if ($allColumn == 'AM')
+				$allColumn = 'Z';
+		
+				/* * 从第A列开始输出 */
+				for($currentColumn = 'A'; $currentColumn <= $allColumn; $currentColumn ++) {
+					$val = $currentSheet->getCellByColumnAndRow ( ord ( $currentColumn ) - 65, $currentRow )->getValue ();
+						if ($val instanceof PHPExcel_RichText)
+							$val = $val->__toString ();
+						/* * ord()将字符转为十进制数 iconv ( 'utf-8', 'gb2312', */
+						// $val = "'" . addslashes ( $val ) . "'";
+					
+							if ($currentColumn == 'A'){
+								$excel_column ['invoiceTitle'] = $val;
+							}elseif ($currentColumn == 'B')
+								$excel_column ['invoiceType'] = $val;
+							elseif ($currentColumn == 'C') {
+								$excel_column ['TIN'] = $val;
+							} elseif ($currentColumn == 'D') {
+								$excel_column ['address'] = $val;
+							} elseif ($currentColumn == 'E') {
+								$excel_column ['phone'] = $val;
+							} elseif ($currentColumn == 'F') {
+								$excel_column ['bank'] = $val;
+							} elseif ($currentColumn == 'G') {
+								$excel_column ['bankAccount'] = $val;
+							} elseif ($currentColumn == 'H') {
+								$excel_column ['invoiceElement'] = $val;
+							} elseif ($currentColumn == 'I') {
+								$excel_column ['invoiceQuantity'] = $val;
+							} elseif ($currentColumn == 'J') {
+								$excel_column ['invoiceUnitPrice'] = $val;
+							} elseif ($currentColumn == 'K') {
+								$excel_column ['remark'] = $val;
+							} elseif ($currentColumn == 'L') {
+								$excel_column ['recipientsAddress'] = $val;
+							} elseif ($currentColumn == 'M') {
+								$excel_column ['recipients'] = $val;
+							} elseif ($currentColumn == 'N') {
+								$excel_column ['recipientsPhone'] = $val;
+							}
+						
+				}
+				if (!empty($excel_column ['invoiceTitle'])&&!empty($excel_column ['invoiceQuantity'])&&!empty($excel_column ['invoiceUnitPrice']))
+					array_push ( $excel_array, $excel_column );
+		}
+		return $excel_array;
+	}
+	
+	
 	/**
 	 * 格式化excel文件为数组
 	 * @param unknown_type $file_url
@@ -5426,6 +5634,9 @@ class InvoiceController extends DooController {
 		}
 		
 		Doo::loadClass ( 'PHPExcel' );
+		//Doo::loadClass ( 'PHPExcel1.7.9/PHPExcel' );
+		
+		
 		$PHPExcel = new PHPExcel ();
 		$PHPReader = new PHPExcel_Reader_Excel2007 ();
 		
@@ -5446,7 +5657,7 @@ class InvoiceController extends DooController {
 		/* * 取得一共有多少行 */
 		$allRow = $currentSheet->getHighestRow ();
 		$excel_array = array ();
-		
+		//die($file_url);
 		$conk = 2;
 		
 		for($currentRow = $conk; $currentRow <= $allRow; $currentRow ++) {
@@ -5482,9 +5693,9 @@ class InvoiceController extends DooController {
 					}
 				} elseif ($sType == "invoiceTrain") {
 					
-					if ($currentColumn == 'A')
+					if ($currentColumn == 'A'){
 						$excel_column ['invoiceTitle'] = $val;
-					elseif ($currentColumn == 'B')
+					}elseif ($currentColumn == 'B')
 						$excel_column ['invoiceType'] = $val;
 					elseif ($currentColumn == 'C') {
 						$excel_column ['TIN'] = $val;

+ 25 - 12
protected/controller/MainController.php

@@ -6655,6 +6655,7 @@ class MainController extends DooController {
 		return "/eMailTask";
 	}
 	function eMailList() {
+		
 		Doo::loadModel ( 'eMailList' );
 		$eMailList = new eMailList ();
 		Doo::loadModel ( 'tag' );
@@ -6723,6 +6724,9 @@ class MainController extends DooController {
 			) );
 			if (! empty ( $isSend ))
 				die ( '这批邮件已经发送' );
+			
+			
+				
 			if ($send == 1)
 				$send = '';
 			
@@ -6731,9 +6735,29 @@ class MainController extends DooController {
 					'where' => 'elid =' . $elid . ' and status=0',
 					'asArray' => true 
 			) );
+			
+			
+			if ($send == "")
+				$send = 1;
+			$sql = "update `CLD_eMailList` set  send" . $send . "='1' where elid = '" . $elid . "'";
+			Doo::db ()->query ( $sql );
+				
+			$isSend = $eMList->getOne ( array (
+					'where' => 'elid =' . $elid . ' and status=0 and send1=1 and send2=1 and send3=1',
+					'asArray' => true
+			) );
+			if (! empty ( $isSend )) {
+				$sql = "update `CLD_eMailList` set  status='2' where elid = '" . $elid . "'";
+				Doo::db ()->query ( $sql );
+			}
+			
 			$toFormatMail = array ();
 			$sub = array ();
 			
+// 			file_put_contents("test.txt", "This is another something.<br/>", FILE_APPEND);
+			
+// 			sleep(4);
+// 			die;
 			$toMail = json_decode ( gzuncompress ( base64_decode ( $eMailList ['clientEmail'] ) ), true );
 			// $toMailCount=count($toMail);
 			
@@ -6793,20 +6817,9 @@ class MainController extends DooController {
 				 */
 			}
 			
-			if ($send == "")
-				$send = 1;
 			
-			$sql = "update `CLD_eMailList` set  send" . $send . "='1' where elid = '" . $elid . "'";
-			Doo::db ()->query ( $sql );
 			
-			$isSend = $eMList->getOne ( array (
-					'where' => 'elid =' . $elid . ' and status=0 and send1=1 and send2=1 and send3=1',
-					'asArray' => true 
-			) );
-			if (! empty ( $isSend )) {
-				$sql = "update `CLD_eMailList` set  status='2' where elid = '" . $elid . "'";
-				Doo::db ()->query ( $sql );
-			}
+			
 			
 			// die;
 			return '/eMailList';

+ 20 - 7
protected/model/L_category.php

@@ -19,6 +19,22 @@ class L_category extends DooModel {
 				'asArray' => TRUE 
 		) );
 	}
+	public function getCategoryInCid($cidString = '') {
+		Doo::loadClass ( 'XDeode' );
+		$XDeode = new XDeode ( 5 );
+		
+		if (empty ( $cidString ))
+			return array ();
+		
+		$list= $this->find ( array (
+				'where' => "cid in ( " .$cidString . ") ",
+				'asArray' => TRUE 
+		) );
+		foreach ( $list as $key => $value ) {
+			$list [$key] ['cidKey'] = $XDeode->encode ( $value ['cid'] );
+		}
+		return $list;
+	}
 	public function getCategoryById($cid = 0, $othercid = "") {
 		if (! empty ( $othercid ))
 			return $this->find ( array (
@@ -32,17 +48,16 @@ class L_category extends DooModel {
 			) );
 	}
 	public function getCategory() {
-		
 		Doo::loadClass ( 'XDeode' );
 		$XDeode = new XDeode ( 5 );
 		
-		$list=$this->find ( array (
+		$list = $this->find ( array (
 				'asc' => 'cid',
 				'asArray' => TRUE 
 		) );
 		
-		foreach ($list as $key=>$value){
-			$list[$key]['cidKey']=$XDeode->encode ( $value ['cid'] );
+		foreach ( $list as $key => $value ) {
+			$list [$key] ['cidKey'] = $XDeode->encode ( $value ['cid'] );
 		}
 		
 		return $list;
@@ -53,8 +68,6 @@ class L_category extends DooModel {
 				'asArray' => TRUE 
 		) );
 	}
-	
-	
 	public function getCategoryStaff() {
 		$list = $this->find ( array (
 				'asArray' => TRUE 
@@ -62,7 +75,7 @@ class L_category extends DooModel {
 		Doo::loadModel ( 'staff' );
 		$staff = new staff ();
 		foreach ( $list as $key => $value ) {
-			$list[$key]['staff']=$staff->getStaffByCid($value['cid']);
+			$list [$key] ['staff'] = $staff->getStaffByCid ( $value ['cid'] );
 		}
 		return $list;
 	}

+ 75 - 6
protected/model/invoice.php

@@ -318,8 +318,8 @@ class invoice extends DooModel {
 		$list = $this->find ( $condition );
 		Doo::loadClass ( 'XDeode' );
 		$XDeode = new XDeode ( 5 );
-		foreach ($list as $key=>$value){
-			$list [$key]['iidKey'] = $XDeode->encode ( $value ['iid'] );
+		foreach ( $list as $key => $value ) {
+			$list [$key] ['iidKey'] = $XDeode->encode ( $value ['iid'] );
 		}
 		return $list;
 	}
@@ -752,7 +752,7 @@ class invoice extends DooModel {
 		
 		foreach ( $list as $key => $value ) {
 			$list [$key] ['iidKeyK'] = $XDeode->encode ( $value ['iid'] );
-			$list [$key] ['operationLog'] = $invoiceOperationLog->getInvoiceOperationByStatus ( $value ['iid'], $value['status'] );
+			$list [$key] ['operationLog'] = $invoiceOperationLog->getInvoiceOperationByStatus ( $value ['iid'], $value ['status'] );
 		}
 		
 		return $list;
@@ -761,11 +761,11 @@ class invoice extends DooModel {
 		if (empty ( $limit ) || empty ( $con ))
 			return array ();
 		
-		$listCount=$this->count(array (
+		$listCount = $this->count ( array (
 				'where' => $con,
 				'asArray' => TRUE 
-		) )	;
-			
+		) );
+		
 		$list = $this->find ( array (
 				'where' => $con,
 				'limit' => $limit,
@@ -825,6 +825,75 @@ class invoice extends DooModel {
 		
 		return $list;
 	}
+	/**
+	 * 获得当前月份办事处入账完成度
+	 * @param number $cid
+	 */
+	function getInvoiceScheduleByCid($cid = 0, $month = true) {
+		if (empty ( $cid ))
+			return 0;
+		
+		if ($month === false)
+			$monthSql = "";
+		else {
+			$month = date ( "m" );
+			$monthSql = " and  Month(date)=" . $month;
+		}
+		
+		// 完成打印
+		$recordCount = $this->count ( array (
+				'where' => " status=2 and printStatus=1 and untreadStatus=3 " . $monthSql . " and cid =" . $cid,
+				'asArray' => TRUE 
+		) );
+		
+		// 当月创建的发票
+		$allCount = $this->count ( array (
+				'where' => " isDelete=0 " . $monthSql . " and cid =" . $cid,
+				'asArray' => TRUE 
+		) );
+		
+		if ($recordCount==0)
+			return 0;
+		return $recordCount / $allCount;
+	}
+	
+	/**
+	 * 或者办事处成员的完成度
+	 */
+	function getInvoiceScheduleByCidGroupSid($cid = 0) {
+		if (empty ( $cid ))
+			return array();
+			
+		//完成发票
+		$recordCount = $this->find ( array (
+				'select'=>'count(*) as count,sid',
+				'where' => " status=2 and printStatus=1 and untreadStatus=3  and cid =" . $cid,
+				'groupby'=>'sid',
+				'asArray' => TRUE 
+		) );
+		
+		//当月创建的发票
+		$allCount = $this->find ( array (
+				'select'=>'count(*) as count,sid',
+				'where' => " isDelete=0  and cid =" . $cid,
+				'groupby'=>'sid',
+				'asArray' => TRUE 
+		) );
+		
+		$list=array();
+		foreach ($recordCount as $key=>$value){
+			foreach ($allCount as $k=>$v){
+				if ($value['sid']==$v['sid']){
+					if ($value['count']==0)
+						$list[$value['sid']]=0;
+					else 
+						$list[$value['sid']]=(int)(($value['count'] / $v['count'])*100);
+				}
+			}
+		}
+		
+		return $list;
+	}
 	
 	/**
 	 * 加密或解密指定字符串

+ 65 - 0
protected/model/invoiceCategoryManage.php

@@ -0,0 +1,65 @@
+<?php
+Doo::loadCore ( 'db/DooModel' );
+/**
+ * 发票相关管理相关信息及其操作业务逻辑
+ * @author CP.
+ * @version 1.0
+ * @namespace invoice
+ * @package invoiceModel
+ */
+class invoiceCategoryManage extends DooModel {
+	/**
+	 *
+	 * @var integer $iid 管理组ID
+	 */
+	public $icid;
+	/**
+	 *
+	 * @var string $staff 管理组人员
+	 */
+	public $staff;
+	public $category;
+	public $cid;
+	
+	public $_table = 'CLD_invoiceCategoryManage';
+	public $_primarykey = 'icid';
+	public $_fields = array (
+			'icid',
+			'staff',
+			'category',
+			'cid'
+	);
+	
+	/**
+	 * 获得查看人员
+	 * @param number $icid
+	 */
+	public function getInvoiceCMByIcid($icid=0){
+		$lsit=array();
+		if (! empty ( $icid ))
+			$lsit = $this->getOne ( array (
+					'where' => 'icid='.$icid,
+					'asArray' => TRUE
+			) );
+		
+		return $lsit;
+	}
+	
+	/**
+	 * 是否有该用户在权限列表中
+	 * @param number $sid
+	 */
+	public function getInvoiceCMByStaff($sid = 0) {
+		$lsit=array();
+		if (! empty ( $sid ))
+			$lsit = $this->find ( array (
+					'select'=>'cid',
+					'where' => 'staff like "%[\"' . $sid . '\",%"',
+					'asArray' => TRUE
+			) );
+	
+			return $lsit;
+	}
+}
+
+// ?>

+ 2 - 1
protected/model/invoiceReceivables.php

@@ -457,7 +457,8 @@ class invoiceReceivables extends DooModel {
 		$XDeode = new XDeode ( 5 );
 		Doo::loadModel ( 'invoice' );
 		$invoice = new invoice ();
-		
+		Doo::loadModel ( 'invoiceROLog' );
+		$invoiceROLog = new invoiceROLog ();
 		
 		foreach ( $list as $key => $value ) {
 			$list [$key] ['iridKeyK'] = $XDeode->encode ( $value ['irid'] );

+ 58 - 5
protected/model/invoiceStatistics.php

@@ -45,16 +45,16 @@ class invoiceStatistics extends DooModel {
 	 * @param array $item 相关需要更新的字段信息
 	 * @return number 返回发票ID
 	 */
-	public function updateInvoiceStatisticsByIrid($item = array(), $irid = 0,$priceClass=0) {
+	public function updateInvoiceStatisticsByIrid($item = array(), $irid = 0, $priceClass = 0) {
 		if (is_numeric ( $irid ) && is_array ( $item ) && ! empty ( $item )) {
 			foreach ( $item as $key => $value ) {
 				$this->$key = $value;
 			}
-			$sql="";
-			if (!empty($priceClass))
-				$sql=" and priceClass=".$priceClass;
+			$sql = "";
+			if (! empty ( $priceClass ))
+				$sql = " and priceClass=" . $priceClass;
 			$lid = $this->update ( array (
-					'where' => 'irid=' . $irid .$sql
+					'where' => 'irid=' . $irid . $sql 
 			) );
 		}
 		return $lid;
@@ -265,6 +265,59 @@ class invoiceStatistics extends DooModel {
 		) );
 		return $list;
 	}
+	
+	/**
+	 * 获得办事处下成员本月的开票汇总
+	 * @param number $cid
+	 */
+	public function getISMSByCategory($cid = 0) {
+		if (empty($cid))
+			return array();
+		$month = date ( "m" );
+				
+		$sql = 'select sum(invoicePrice) as invoicePrice,sum(receivablesPrice) as receivablesPrice,sum(accountPrice) as accountPrice ,cid,staff,Month(date) as month
+				from ' . $this->_table . '
+				where Month(date)=' . $month.' and cid = '.$cid.'
+					GROUP BY staff';
+		$query = Doo::db ()->query ( $sql );
+		return $result = $query->fetchAll ();
+	}
+	
+	/**
+	 * 获得办事处成员全部个人汇总数据
+	 * @param unknown $cid
+	 */
+	public function getISASByCategory($cid){
+		if (empty($cid))
+			return array();
+		$month = date ( "m" );
+		
+		$sql = 'select sum(invoicePrice) as invoicePrice,sum(receivablesPrice) as receivablesPrice,sum(accountPrice) as accountPrice ,cid,staff,Month(date) as month
+				from ' . $this->_table . '
+				where cid = '.$cid.'
+					GROUP BY staff';
+		$query = Doo::db ()->query ( $sql );
+		return $result = $query->fetchAll ();
+	}
+	
+	
+	
+	/**
+	 * 获得某办事处本月汇总
+	 */
+	public function getInvoiceStatistiscsMothByCategory($cid = 0) {
+		if (empty($cid))
+			return array();
+		
+		$month = date ( "m" );
+			
+		$sql = 'select sum(invoicePrice) as invoicePrice,sum(receivablesPrice) as receivablesPrice,sum(accountPrice) as accountPrice ,cid,Month(date) as month
+				from ' . $this->_table . '
+				where Month(date)=' . $month.' and cid = '.$cid.'
+					GROUP BY cid';
+		$query = Doo::db ()->query ( $sql );
+		return $result = $query->fetch ();
+	}
 }
 
 ?>

+ 10 - 2
protected/model/staff.php

@@ -62,10 +62,18 @@ class staff extends DooModel {
 	}
 	
 	public function getStaff() {
-		return $this->find ( array (
+		Doo::loadClass ( 'XDeode' );
+		$XDeode = new XDeode ( 5 );
+		
+		$list=$this->find ( array (
 				'desc' => 'sid',
-				'asArray' => TRUE 
+				'asArray' => TRUE
 		) );
+		foreach ($list as $key=>$value){
+			$list[$key] ['sidKey'] = $XDeode->encode ( $value ['sid'] );
+		}
+		
+		return $list;
 	}
 	public function getStaffByCid($cid = 0) {
 		return $this->find ( array (

+ 17 - 1
protected/plugin/TemplateTag.php

@@ -19,7 +19,8 @@ Doo::conf ()->TEMPLATE_GLOBAL_TAGS = array (
 		'inarray',
 		'getGlobals',
 		'countArray',
-		'isInvoiceMoldShow'
+		'isInvoiceMoldShow',
+		'isInvoiceCategoryShow'
 );
 
 function countArray($list=array()){
@@ -158,6 +159,21 @@ function isInvoiceNew($type = "GLOBAL") {
 }
 
 /**
+ * 是否有查看汇总的权限
+ * @param unknown $sid
+ */
+function isInvoiceCategoryShow($sid){
+	Doo::loadModel ( "invoiceCategoryManage" );
+	$invoiceCategoryManage = new invoiceCategoryManage ();
+	
+	$icm=$invoiceCategoryManage->getInvoiceCMByStaff($sid);
+	if (!empty($icm))
+		return true;
+	else 
+		return false;
+}
+
+/**
  * 判断发票的审批权限
  * @param number $sid 用户ID
  * @param string $mold 项目类型

+ 2 - 1
protected/view/admin/adminInvoice.html

@@ -21,7 +21,8 @@
 			<div class="adminContent autoHeight">
 		    <div class="subNav">
 		    	<ul class="navTabs">
-					  <li class="active"><a href="admin-demand.html">员工权限</a></li>
+					  <li class="active"><a href="javascript:void(0)">员工权限</a></li>
+					  <li ><a href="/adminInvoiceCategory">办事处汇总权限</a></li>
 					</ul>
 				</div>
 				

+ 114 - 0
protected/view/admin/adminInvoiceCategory.html

@@ -0,0 +1,114 @@
+ <!-- include 'header' -->
+ <script type="text/javascript" >
+  var invoiceStaff={{invoiceStaff}};
+</script>
+ <script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>js/admin.js"></script>
+
+ 
+<body>
+	<div class="mainLayout">
+		<div class="mainMenu">
+			<div class="menuItem">
+				<a href="#" class="mLogo">CLD</a>
+				<ul>
+					<!-- include 'menu' -->
+				</ul>
+			</div>
+		</div>
+		<div class="warpContent">
+			<div class="subMenu fL">
+				<div class="menuItem">
+					<ul>
+						<!-- include 'admin_menu' -->
+					</ul>
+				</div>
+			</div>
+			<div class="adminContent autoHeight">
+				<div class="subNav">
+					<ul class="navTabs">
+						<li><a href="/adminInvoice">员工权限</a></li>
+						<li class="active"><a href="javascript:void(0)">办事处汇总权限</a></li>
+					</ul>
+				</div>
+					<form>
+					<legend>添加办事处汇总权限</legend>
+						<table class="table table-striped">
+              <thead>
+                <tr>
+                  <th>办事处名称</th>
+                  <th>可见</th>
+                  <th>操作</th>
+                </tr>
+              </thead>
+              <tbody>
+              <!-- loop categoryList -->
+                <tr>
+                  <td>{{categoryList' value.title}}</td>
+                  <td>
+                  {{categoryList' value.html}}
+                  </td>
+                  <td><a href="#add" node-iacd data-cidKey="{{categoryList' value.cidKey}}" data-toggle="modal">添加</a></td>
+                </tr>
+                <!-- endloop -->
+                
+              </tbody>
+          	</table>
+					</form>
+			</div>
+		</div>
+	</div>
+<!--弹出(添加可见人)-->
+<div class="modal hide fade" id="add">
+
+  <div class="modal-dialog">
+  <form action="/addInvoiceCategoryManage" id="iscs" method="post">
+  <input type="hidden" id="cidKey" name="cidKey" value="">
+    <div class="modal-content">
+    <div class="modal-header">
+    <h3>添加可见人</h3>
+    </div>
+    <div class="modal-body">
+    	<div class="control-group">
+    		<div class="controls">
+			    <select  style="width:190px" node='category'>
+			    	<!-- loop categoryList -->
+			    	<option value="{{categoryList' value.cidKey}}">{{categoryList' value.title}}</option>
+			    	<!-- endloop -->
+			    	
+			    </select>
+			    <select name="sidKey" node-category='staff' style="width:190px">
+			    </select>
+			</div>
+		</div>
+    </div>
+	<div class="modal-footer">
+	    <a href="#" class="button btn-gray" data-dismiss="modal" aria-hidden="true">关闭</a>
+	    <button type="submit" class="button" data-toggle="modal">确定</button>
+	    
+	</div>
+</div>
+</form>
+</div>
+</div>
+<!--弹出-->
+<!--弹出(删除可见人)-->
+<div class="modal hide fade" id="del">
+
+  <div class="modal-dialog">
+    <div class="modal-content">
+    <div class="modal-header">
+    <h3>确认删除</h3>
+    </div>
+    <div class="modal-body">
+    	<p>删除后,该用户将不能看到办事处汇总页</p>
+    </div>
+	<div class="modal-footer">
+	    <a href="#" class="button btn-gray" data-dismiss="modal" aria-hidden="true">关闭</a>
+	    <a href="#" class="button" data-dismiss="modal" aria-hidden="true">确定</a>
+	</div>
+</div>
+</div>
+</div>
+<!--弹出-->
+<script type="text/javascript">autoFlashHeight();</script>
+</body>

+ 76 - 0
protected/view/admin/invoiceAggregateCategoryDetail.html

@@ -0,0 +1,76 @@
+<!-- include 'header' -->
+<script src="<?= WEB_SITE_GLOBAL ?>js/invoice.js"></script>
+<body>
+	<div class="mainLayout">
+		<div class="mainMenu">
+			<div class="menuItem">
+				<a href="#" class="mLogo">CLD</a>
+				<ul>
+					<!-- include 'menuReceipt' -->
+				</ul>
+			</div>
+			
+		</div>
+		<div class="warpContent">
+			<div class="subMenu fL">
+				<div class="menuItem">
+					<!-- include 'invoiceMenu' -->
+				</div>
+			</div>
+			<div class="adminContent autoHeight">
+				<div class="saea-borad">
+				<form action="/invoiceAggregateCategoryDetail" id="iacd" method="get">
+					<div class="borad-menu">
+					
+						<select name="cidKey" onchange="submitForm();" style="padding:0 15px; font-size:16px; height:45px; line-height: 45px;">
+							<!-- loop categoryList -->
+							<option <!-- if {{categoryList' value.cidKey}}=={{cidKey}} --> selected <!-- endif --> value="{{categoryList' value.cidKey}}">{{categoryList' value.title}}</option>
+							<!-- endloop -->
+						</select>
+					
+					</div>
+					</form>
+					<div class="borad-news">
+						<div class="saeaList">
+							<div class="clearfix">
+								<table class="table table-bordered table-condensed">
+									<tbody>
+									<tr><th class="taC">本月累计金额</th><td>¥{{isMC.invoicePrice}}</td><th class="taC">本月收款金额</th><td>¥{{isMC.receivablesPrice}}</td></tr>
+									<tr><th class="taC">本月入账金额</th><td>¥{{isMC.accountPrice}}</td><th class="taC">本月入账完成度</th><td>{{schedule}}%</td></tr>
+									</tbody>
+								</table>
+							</div>
+							<div class="clearfix">
+								<legend>办事处汇总</legend>
+								<table class="table table-bordered table-condensed">
+									<tbody>
+									<tr><th class="taC" width="55">姓名</th><th class="taC">本月开票金额</th><th class="taC">本月收款金额</th><th class="taC">本月入账金额</th><th class="taC">累计开票金额合计</th><th class="taC">累计收款金额合计</th><th class="taC">累计入账金额合计</th><th class="taC" width="90">入账完成度</th></tr>
+									<!-- loop slist -->
+									<tr>
+										<td>{{slist' value.username}}</td>
+										<td><a href="javascript:void(0)">¥{{slist' value.invoicePrice}}</a></td>
+										<td><a href="javascript:void(0)">¥{{slist' value.receivablesPrice}}</a></td>
+										<td><a href="javascript:void(0)">¥{{slist' value.accountPrice}}</a></td>
+										<td>¥{{slist' value.invoiceAllPrice}}</td>
+										<td>¥{{slist' value.receivablesAllPrice}}</td>
+										<td>¥{{slist' value.accountAllPrice}}</td>
+										<td>{{slist' value.schedule}}%</td>
+									</tr>
+									<!-- endloop -->
+									
+									</tbody>
+								</table>
+								<blockquote><p class="colGray"></p></blockquote>
+							</div>
+						</div>
+					</div>
+				</div>
+			</div>
+		</div>
+	</div>
+	
+	
+	
+	
+<script type="text/javascript">autoFlashHeight();</script>
+</body>

+ 5 - 0
protected/view/admin/invoiceMenu.html

@@ -36,6 +36,11 @@
 	<li <!-- if {{new.untread}} --> class="news" <!-- endif --> ><a <!-- if {{receiptMemu}}=="invoiceUntread" --> class="selected" <!-- endif --> href="/invoiceUntread">发票退票</a></li>
 <!-- endif -->	
 
+
+<!-- if isInvoiceCategoryShow({{staff.0.sid}}) -->
+<li><a <!-- if {{receiptMemu}}=="invoiceAggregateCategoryDetail" --> class="selected" <!-- endif --> href="/invoiceAggregateCategoryDetail">办事处汇总</a></li>
+<!-- endif -->
+
 <!-- if isInvoiceMoldShow({{staff.0.sid}},'公司汇总查阅') -->
 	<li><a <!-- if {{receiptMemu}}=="invoiceAggregate" --> class="selected" <!-- endif --> href="/invoiceAggregate">公司汇总</a></li>
 	<!-- endif -->

+ 3 - 3
protected/view/mail_list.html

@@ -35,19 +35,19 @@
 								<!-- elseif {{mailList' value.status}}==0&&{{mailList' value.examine}}==2 -->
 								<p>
 									<!-- if {{mailList' value.send1}}==0 -->
-									<a href="/postEmail/{{mailList' value.elid}}/1" class="btn btn-mini btn-success">发送1</a>&nbsp;
+									<a href="/postEmail/{{mailList' value.elid}}/1" node-mail class="btn btn-mini btn-success">发送1</a>&nbsp;
 									<!-- else -->
 									<b class="icon- colGreen" href="#">j</b>
 									<!-- endif -->
 									
 									<!-- if {{mailList' value.send2}}==0 -->
-									<a href="/postEmail/{{mailList' value.elid}}/2" class="btn btn-mini btn-success">发送2</a>&nbsp;
+									<a href="/postEmail/{{mailList' value.elid}}/2" node-mail class="btn btn-mini btn-success">发送2</a>&nbsp;
 									<!-- else -->
 									<b class="icon- colGreen" href="#">j</b>
 									<!-- endif -->
 									
 									<!-- if {{mailList' value.send3}}==0 -->
-									<a href="/postEmail/{{mailList' value.elid}}/3" class="btn btn-mini btn-success">发送3</a>&nbsp;
+									<a href="/postEmail/{{mailList' value.elid}}/3" node-mail class="btn btn-mini btn-success">发送3</a>&nbsp;
 									<!-- else -->
 									<b class="icon- colGreen" href="#">j</b>
 									<!-- endif -->