浏览代码

开票个模块的提醒功能

caipin 8 年之前
父节点
当前提交
3a84006422

+ 2 - 0
index.php

@@ -34,4 +34,6 @@ Doo::app()->run();
 //Doo::logger()->endDbProfile('doowebsite');
 //Doo::logger()->rotateFile(20);
 //Doo::logger()->writeDbProfiles();
+
+
 ?>

+ 296 - 220
protected/controller/InvoiceController.php

@@ -9,6 +9,8 @@
  */
 class InvoiceController extends DooController {
 	public $staff;
+	public $NEW;
+	public $data;
 	private $INVOICEKEY = "APPROVAL";
 	private $INVOICECOLLECTPATH = "protected/cache/invoiceCollect/";
 	
@@ -16,57 +18,59 @@ class InvoiceController extends DooController {
 		Doo::loadModel ( "invoiceManage" );
 		$invoiceManage = new invoiceManage ();
 		header ( 'Content-Type:text/html;charset=utf-8' );
-		$moldList=$invoiceManage->getInvoiceByStaff($_COOKIE ["staff"]);
-		//print_r($moldList);
-		
-		if (empty($moldList))
-			$uGroups='ordinary';
-		else{
-			$flag=false;
-			array_push($moldList, array('mold'=>'ordinary'));
-			foreach ($moldList as $value){
-				//echo $value['mold'];
-				//echo $action;
+		$moldList = $invoiceManage->getInvoiceByStaff ( $_COOKIE ["staff"] );
+		// print_r($moldList);
+		
+		if (empty ( $moldList )) {
+			$flag = false;
+			$uGroups = 'ordinary';
+			if (Doo::acl ()->isAllowed ( $uGroups, $resource, $action )) {
+				$flag = true;
+			}
+		} else {
+			$flag = false;
+			array_push ( $moldList, array (
+					'mold' => 'ordinary' 
+			) );
+			foreach ( $moldList as $value ) {
+				// echo $value['mold'];
+				// echo $action;
 				
-				if (Doo::acl()->isAllowed($value['mold'], $resource, $action)){
-					$flag=true;
+				if (Doo::acl ()->isAllowed ( $value ['mold'], $resource, $action )) {
+					$flag = true;
 					break;
 				}
 			}
 		}
 		/*
-		Doo::acl()->isAllowed($uGroups['groups'], $resource, $action);
-		*/	
-		//var_dump($flag) ;
-		if (!$flag)
-			die('illegal request');
-		
-		
+		 * Doo::acl()->isAllowed($uGroups['groups'], $resource, $action);
+		 */
+		// var_dump($flag) ;
+		if (! $flag)
+			die ( 'illegal request' );
 	}
 	
+	
+	
 	function __construct() {
 		if (isset ( $_COOKIE ["staff"] )) {
 			if (! empty ( $_COOKIE ["staff"] )) {
 				Doo::loadModel ( 'staff' );
 				$staff = new staff ();
 				
-				
 				// $invoiceManage
 				
+				// $uname = $this->auth->getUname();
+				// if ($uname) {
+				// $uGroups = $this->users->getUidByname($this->auth->getUname());
+				// } else {
+				// $uGroups['groups'] = 'anonymous';
+				// }
+				// $falg = Doo::acl()->isAllowed($uGroups['groups'], $resource, $action);
+				// if (!$falg)
+				// return Doo::conf()->APP_URL;
 				
-				
-// 				$uname = $this->auth->getUname();
-// 				if ($uname) {
-// 					$uGroups = $this->users->getUidByname($this->auth->getUname());
-// 				} else {
-// 					$uGroups['groups'] = 'anonymous';
-// 				}
-// 				$falg = Doo::acl()->isAllowed($uGroups['groups'], $resource, $action);
-// 				if (!$falg)
-// 					return Doo::conf()->APP_URL;
-				
-				
-				
+				$this->data['new']=$this->isInvoiceNew();
 				
 				$this->staff = $staff->getUserByIdList ( $_COOKIE ["staff"] );
 				return "/";
@@ -82,7 +86,6 @@ class InvoiceController extends DooController {
 			@header ( "Location: /login" );
 		}
 	}
-	
 	function invoice() {
 		Doo::loadModel ( 'invoice' );
 		$invoice = new invoice ();
@@ -102,27 +105,27 @@ class InvoiceController extends DooController {
 		$tmp_forwardmonth = mktime ( 0, 0, 0, $tmp_mon - 1, 1, $tmp_year );
 		$fm_forward_month = date ( "m", $tmp_forwardmonth );
 		$path = SITE_PATH . $this->INVOICECOLLECTPATH . "invoiceCollect_" . $year . "_" . $fm_forward_month . ".htm";
-		$htm=$this->showCache($path);
+		$htm = $this->showCache ( $path );
 		
 		$expressList = $express->getExpressByAll ();
 		$invoiceList = $invoice->getMyInvoice ( $_COOKIE ["staff"] );
 		
 		$list = $invoiceReceivables->getInvoiceReceivablesByClaim ( $this->staff [0] ['cid'], $this->staff [0] ['sid'] );
 		
-		 //print_r($invoiceList);
+		// print_r($invoiceList);
 		
-		$data ['isMonth'] = $isMonth;
-		$data ['htm'] = $htm;
+		$this->data ['isMonth'] = $isMonth;
+		$this->data ['htm'] = $htm;
 		
-		$data ['expressList'] = $expressList;
-		$data ['invoiceList'] = $invoiceList;
+		$this->data ['expressList'] = $expressList;
+		$this->data ['invoiceList'] = $invoiceList;
 		
-		$data ['receivablesList'] = $list;
+		$this->data ['receivablesList'] = $list;
 		
-		$data ['memu'] = "invoice";
-		$data ['staff'] = $this->staff;
-		$data ['receiptMemu'] = 'invoice';
-		$this->render ( "/admin/invoice", $data );
+		$this->data ['memu'] = "invoice";
+		$this->data ['staff'] = $this->staff;
+		$this->data ['receiptMemu'] = 'invoice';
+		$this->render ( "/admin/invoice", $this->data );
 	}
 	function invoiceAdd() {
 		Doo::loadModel ( 'L_category' );
@@ -132,12 +135,12 @@ class InvoiceController extends DooController {
 				'asArray' => true 
 		) );
 		
-		$data ['category'] = $category;
+		$this->data ['category'] = $category;
 		
-		$data ['memu'] = "invoice";
-		$data ['staff'] = $this->staff;
-		$data ['receiptMemu'] = 'invoice';
-		$this->render ( "/admin/invoiceAdd", $data );
+		$this->data ['memu'] = "invoice";
+		$this->data ['staff'] = $this->staff;
+		$this->data ['receiptMemu'] = 'invoice';
+		$this->render ( "/admin/invoiceAdd", $this->data );
 	}
 	
 	/**
@@ -310,12 +313,12 @@ class InvoiceController extends DooController {
 		$invoiceDetail = $invoice->getInvoiceByIid ( $iid );
 		$operation = $invoiceOperationLog->getInvoiceOperationByDropped ( $iid );
 		
-		$data ['operation'] = $operation;
-		$data ['invoiceDetail'] = $invoiceDetail;
-		$data ['memu'] = "invoice";
-		$data ['staff'] = $this->staff;
-		$data ['receiptMemu'] = 'invoice';
-		$this->render ( "/admin/invoiceEdit", $data );
+		$this->data ['operation'] = $operation;
+		$this->data ['invoiceDetail'] = $invoiceDetail;
+		$this->data ['memu'] = "invoice";
+		$this->data ['staff'] = $this->staff;
+		$this->data ['receiptMemu'] = 'invoice';
+		$this->render ( "/admin/invoiceEdit", $this->data );
 	}
 	/**
 	 * 重新编辑退回的发票
@@ -477,11 +480,11 @@ class InvoiceController extends DooController {
 		if (! empty ( $iid ) && ! is_numeric ( $iid ))
 			die ( 'illegal request' );
 		
-		$lt=$invoiceReceivables->getInvoiceReceivablesByIid($iid);
-			
-		if (empty($lt)){
+		$lt = $invoiceReceivables->getInvoiceReceivablesByIid ( $iid );
+		
+		if (! empty ( $lt )) {
 			header ( 'Content-Type:text/html;charset=utf-8' );
-			die('该发票有收款绑定,请先移除!');
+			die ( '该发票有收款绑定,请先移除!' );
 		}
 		
 		$item = array (
@@ -582,16 +585,16 @@ class InvoiceController extends DooController {
 			$invoiceList [$key] ['lastApprover'] = $lastApprover;
 		}
 		
-		$ilist=$invoice->getInvoiceByProcessStatus();
+		$ilist = $invoice->getInvoiceByProcessStatus ();
 		
-		//print_r($ilist);
+		// print_r($ilist);
 		
-		$data ['invoiceList'] = $invoiceList;
-		$data ['ilist'] = $ilist;
-		$data ['memu'] = "invoice";
-		$data ['staff'] = $this->staff;
-		$data ['receiptMemu'] = 'invoiceApproval';
-		$this->render ( "/admin/invoiceApproval", $data );
+		$this->data ['invoiceList'] = $invoiceList;
+		$this->data ['ilist'] = $ilist;
+		$this->data ['memu'] = "invoice";
+		$this->data ['staff'] = $this->staff;
+		$this->data ['receiptMemu'] = 'invoiceApproval';
+		$this->render ( "/admin/invoiceApproval", $this->data );
 	}
 	function invoiceDetail() {
 		Doo::loadClass ( 'XDeode' );
@@ -613,13 +616,13 @@ class InvoiceController extends DooController {
 		) );
 		$invoiceOperationLogList = $invoiceOperationLog->getInvoiceOperationLogByIid ( $iid );
 		
-		$data ['invoiceDetail'] = $invoiceDetail;
-		$data ['invoiceOperationLogList'] = $invoiceOperationLogList;
-		$data ['INVOICEKEY'] = $invoice->authcode ( $invoiceDetail ['iid'], '' );
-		$data ['memu'] = "invoice";
-		$data ['staff'] = $this->staff;
-		$data ['receiptMemu'] = 'invoiceApproval';
-		$this->render ( "/admin/invoiceApprovalDetail", $data );
+		$this->data ['invoiceDetail'] = $invoiceDetail;
+		$this->data ['invoiceOperationLogList'] = $invoiceOperationLogList;
+		$this->data ['INVOICEKEY'] = $invoice->authcode ( $invoiceDetail ['iid'], '' );
+		$this->data ['memu'] = "invoice";
+		$this->data ['staff'] = $this->staff;
+		$this->data ['receiptMemu'] = 'invoiceApproval';
+		$this->render ( "/admin/invoiceApprovalDetail", $this->data );
 	}
 	
 	/**
@@ -781,13 +784,13 @@ class InvoiceController extends DooController {
 			$printed [$key] ['lastApprover'] = $lastApprover;
 		}
 		
-		$data ['printed'] = $printed;
-		$data ['toPrint'] = $toPrint;
+		$this->data ['printed'] = $printed;
+		$this->data ['toPrint'] = $toPrint;
 		
-		$data ['memu'] = "invoice";
-		$data ['staff'] = $this->staff;
-		$data ['receiptMemu'] = 'invoicePrint';
-		$this->render ( "/admin/invoicePrint", $data );
+		$this->data ['memu'] = "invoice";
+		$this->data ['staff'] = $this->staff;
+		$this->data ['receiptMemu'] = 'invoicePrint';
+		$this->render ( "/admin/invoicePrint", $this->data );
 	}
 	/**
 	 * 展示发票打印的详情页面
@@ -814,13 +817,13 @@ class InvoiceController extends DooController {
 		
 		$invoiceOperationLogList = $invoiceOperationLog->getInvoiceOperationLogByIid ( $iid );
 		
-		$data ['invoiceDetail'] = $invoiceDetail;
-		$data ['invoiceOperationLogList'] = $invoiceOperationLogList;
-		$data ['INVOICEKEY'] = $invoice->authcode ( $invoiceDetail ['iid'], '' );
-		$data ['memu'] = "invoice";
-		$data ['staff'] = $this->staff;
-		$data ['receiptMemu'] = 'invoicePrint';
-		$this->render ( "/admin/invoicePrintDetail", $data );
+		$this->data ['invoiceDetail'] = $invoiceDetail;
+		$this->data ['invoiceOperationLogList'] = $invoiceOperationLogList;
+		$this->data ['INVOICEKEY'] = $invoice->authcode ( $invoiceDetail ['iid'], '' );
+		$this->data ['memu'] = "invoice";
+		$this->data ['staff'] = $this->staff;
+		$this->data ['receiptMemu'] = 'invoicePrint';
+		$this->render ( "/admin/invoicePrintDetail", $this->data );
 	}
 	/**
 	 * 填写票号并完成打印
@@ -879,13 +882,13 @@ class InvoiceController extends DooController {
 		$invoicePosted = $invoice->getPostByInvoice ( 1 );
 		$expressList = $express->getExpressByAll ();
 		
-		$data ['expressList'] = $expressList;
-		$data ['invoicePost'] = $invoicePost;
-		$data ['invoicePosted'] = $invoicePosted;
-		$data ['memu'] = "invoice";
-		$data ['staff'] = $this->staff;
-		$data ['receiptMemu'] = 'invoicePost';
-		$this->render ( "/admin/invoicePost", $data );
+		$this->data ['expressList'] = $expressList;
+		$this->data ['invoicePost'] = $invoicePost;
+		$this->data ['invoicePosted'] = $invoicePosted;
+		$this->data ['memu'] = "invoice";
+		$this->data ['staff'] = $this->staff;
+		$this->data ['receiptMemu'] = 'invoicePost';
+		$this->render ( "/admin/invoicePost", $this->data );
 	}
 	/**
 	 * 添加发票邮寄信息
@@ -925,13 +928,13 @@ class InvoiceController extends DooController {
 		$untreadInvoice = $invoice->getInvoiceByUntreadStatus ( 1 );
 		$establishedInvoice = $invoice->getInvoiceByUntreadStatus ( 2 );
 		
-		$data ['untreadInvoice'] = $untreadInvoice;
-		$data ['establishedInvoice'] = $establishedInvoice;
+		$this->data ['untreadInvoice'] = $untreadInvoice;
+		$this->data ['establishedInvoice'] = $establishedInvoice;
 		
-		$data ['memu'] = "invoice";
-		$data ['staff'] = $this->staff;
-		$data ['receiptMemu'] = 'invoiceUntread';
-		$this->render ( "/admin/invoiceUntread", $data );
+		$this->data ['memu'] = "invoice";
+		$this->data ['staff'] = $this->staff;
+		$this->data ['receiptMemu'] = 'invoiceUntread';
+		$this->render ( "/admin/invoiceUntread", $this->data );
 	}
 	
 	/**
@@ -984,14 +987,14 @@ class InvoiceController extends DooController {
 		$receivablesList = $invoiceReceivables->getInvoiceReceivablesByNew ();
 		// print_r($receivablesList);
 		
-		$data ['receivablesList'] = $receivablesList;
-		$data ['staffList'] = $staffList;
-		$data ['category'] = $category;
+		$this->data ['receivablesList'] = $receivablesList;
+		$this->data ['staffList'] = $staffList;
+		$this->data ['category'] = $category;
 		
-		$data ['memu'] = "invoice";
-		$data ['staff'] = $this->staff;
-		$data ['receiptMemu'] = 'invoiceReceivables';
-		$this->render ( "/admin/invoiceReceivables", $data );
+		$this->data ['memu'] = "invoice";
+		$this->data ['staff'] = $this->staff;
+		$this->data ['receiptMemu'] = 'invoiceReceivables';
+		$this->render ( "/admin/invoiceReceivables", $this->data );
 	}
 	
 	/**
@@ -1041,9 +1044,8 @@ class InvoiceController extends DooController {
 				$receivablesStaff = explode ( '-', $receivablesStaff );
 				$item = array (
 						'operation' => $this->staff [0] ['username'] . " 转入 " . $receivablesStaff [1],
-						'bindDate'=>date ( "Y-m-d H:i:s" )
+						'bindDate' => date ( "Y-m-d H:i:s" ) 
 				);
-				
 			}
 			$item += array (
 					'date' => date ( "Y-m-d" ),
@@ -1090,12 +1092,12 @@ class InvoiceController extends DooController {
 		
 		$receivablesList = $invoiceReceivables->getInvoiceReceivablesByClaim ( $this->staff [0] ['cid'] );
 		
-		$data ['receivablesList'] = $receivablesList;
+		$this->data ['receivablesList'] = $receivablesList;
 		
-		$data ['memu'] = "invoice";
-		$data ['staff'] = $this->staff;
-		$data ['receiptMemu'] = 'invoiceReceivablesClaim';
-		$this->render ( "/admin/invoiceReceivablesClaim", $data );
+		$this->data ['memu'] = "invoice";
+		$this->data ['staff'] = $this->staff;
+		$this->data ['receiptMemu'] = 'invoiceReceivablesClaim';
+		$this->render ( "/admin/invoiceReceivablesClaim", $this->data );
 	}
 	
 	/**
@@ -1161,19 +1163,18 @@ class InvoiceController extends DooController {
 		$tmp_forwardmonth = mktime ( 0, 0, 0, $tmp_mon - 1, 1, $tmp_year );
 		$fm_forward_month = date ( "m", $tmp_forwardmonth );
 		$path = SITE_PATH . $this->INVOICECOLLECTPATH . "invoiceCollect_" . $year . "_" . $fm_forward_month . ".htm";
-		$htm=$this->showCache($path);
-		
+		$htm = $this->showCache ( $path );
 		
 		$list = $invoiceReceivables->getInvoiceReceivablesByClaim ( $this->staff [0] ['cid'], $this->staff [0] ['sid'] );
 		
-		$data ['isMonth'] = $isMonth;
-		$data ['htm'] = $htm;
-		$data ['list'] = $list;
+		$this->data ['isMonth'] = $isMonth;
+		$this->data ['htm'] = $htm;
+		$this->data ['list'] = $list;
 		
-		$data ['memu'] = "invoice";
-		$data ['staff'] = $this->staff;
-		$data ['receiptMemu'] = 'invoiceMyReceivables';
-		$this->render ( "/admin/invoiceMyReceivables", $data );
+		$this->data ['memu'] = "invoice";
+		$this->data ['staff'] = $this->staff;
+		$this->data ['receiptMemu'] = 'invoiceMyReceivables';
+		$this->render ( "/admin/invoiceMyReceivables", $this->data );
 	}
 	
 	/**
@@ -1198,11 +1199,11 @@ class InvoiceController extends DooController {
 		
 		if (empty ( $detail ) && empty ( $detailM ))
 			die ( 'illegal request' );
-		
-// 		if ($detailM ['receivablesPrice'] >= $detail ['invoicePrice']) {
-// 			$price = $detailM ['receivablesPrice'] - $detail ['invoicePrice'];
-// 			die ( '<p>收款金额超出开票金额 ¥' . $price . '元,请谨慎操作</p><a href="/invoiceMyReceivables">返回</a>' );
-// 		}
+			
+			// if ($detailM ['receivablesPrice'] >= $detail ['invoicePrice']) {
+			// $price = $detailM ['receivablesPrice'] - $detail ['invoicePrice'];
+			// die ( '<p>收款金额超出开票金额 ¥' . $price . '元,请谨慎操作</p><a href="/invoiceMyReceivables">返回</a>' );
+			// }
 		
 		$item = array (
 				'irid' => $detailM ['irid'],
@@ -1375,15 +1376,15 @@ class InvoiceController extends DooController {
 				';
 		$html .= '</tr>';
 		
-		$data ['html'] = $html;
-		$data ['LcategoryList'] = $LcategoryList;
-		$data ['isList'] = $isList;
+		$this->data ['html'] = $html;
+		$this->data ['LcategoryList'] = $LcategoryList;
+		$this->data ['isList'] = $isList;
 		
-		$data ['year'] = $year;
-		$data ['memu'] = "invoice";
-		$data ['staff'] = $this->staff;
-		$data ['receiptMemu'] = 'invoiceAggregate';
-		$this->render ( "/admin/invoiceAggregate", $data );
+		$this->data ['year'] = $year;
+		$this->data ['memu'] = "invoice";
+		$this->data ['staff'] = $this->staff;
+		$this->data ['receiptMemu'] = 'invoiceAggregate';
+		$this->render ( "/admin/invoiceAggregate", $this->data );
 	}
 	function invoiceAggregateStaff() {
 		$year = $this->get_args ( 'year' ) ? $this->get_args ( 'year' ) : date ( "Y" );
@@ -1505,13 +1506,13 @@ class InvoiceController extends DooController {
 				';
 		$html .= '</tr>';
 		
-		$data ['html'] = $html;
-		$data ['isList'] = $toteList;
-		$data ['year'] = $year;
-		$data ['memu'] = "invoice";
-		$data ['staff'] = $this->staff;
-		$data ['receiptMemu'] = 'invoiceAggregate';
-		$this->render ( "/admin/invoiceAggregateStaff", $data );
+		$this->data ['html'] = $html;
+		$this->data ['isList'] = $toteList;
+		$this->data ['year'] = $year;
+		$this->data ['memu'] = "invoice";
+		$this->data ['staff'] = $this->staff;
+		$this->data ['receiptMemu'] = 'invoiceAggregate';
+		$this->render ( "/admin/invoiceAggregateStaff", $this->data );
 	}
 	function invoiceAggregateCategory() {
 		Doo::loadClass ( 'XDeode' );
@@ -1610,25 +1611,33 @@ class InvoiceController extends DooController {
 		$htmlC .= '</tr>';
 		$html .= $htmlA . $htmlB . $htmlC;
 		
-		$data ['html'] = $html;
+		$this->data ['html'] = $html;
 		
-		$data ['cidKey'] = $cidKey;
-		$data ['slist'] = $list;
-		$data ['isList'] = $toteList;
-		$data ['year'] = $year;
-		$data ['memu'] = "invoice";
-		$data ['staff'] = $this->staff;
-		$data ['receiptMemu'] = 'invoiceAggregate';
-		$this->render ( "/admin/invoiceAggregateCategory", $data );
+		$this->data ['cidKey'] = $cidKey;
+		$this->data ['slist'] = $list;
+		$this->data ['isList'] = $toteList;
+		$this->data ['year'] = $year;
+		$this->data ['memu'] = "invoice";
+		$this->data ['staff'] = $this->staff;
+		$this->data ['receiptMemu'] = 'invoiceAggregate';
+		$this->render ( "/admin/invoiceAggregateCategory", $this->data );
 	}
-	
-	function invoiceAchieve(){
+	function invoiceAchieve() {
+		Doo::loadModel ( 'invoice' );
+		$invoice = new invoice ();
+		
+		$page_size=12;
+		$page = isset($this->params ['page'])&&is_numeric ( $this->params ['page'] ) ? $this->params ['page'] : 1;
 		
+		$pageinfo['page']=array('previous'=>'');
+		//$pageinfo=$this->get_page("CLD_receipt", $dateCondition.$cateCondition.$staffCondition.' and verify in ('.$vid.') and status!=5', $page, $page_size, "approvalExpenses","","");
 		
-		$data ['memu'] = "invoice";
-		$data ['staff'] = $this->staff;
-		$data ['receiptMemu'] = 'invoiceAggregate';
-		$this->render ( "/admin/invoiceAchieve", $data );
+		$invoice->getInvoiceByUntreadStatusPage();
+		
+		$this->data ['memu'] = "invoice";
+		$this->data ['staff'] = $this->staff;
+		$this->data ['receiptMemu'] = 'invoice';
+		$this->render ( "/admin/invoiceAchieve", $this->data );
 	}
 	
 	/**
@@ -2193,125 +2202,121 @@ class InvoiceController extends DooController {
 		$type = $this->get_args ( 'type' ) ? $this->get_args ( 'type' ) : "";
 		$serial = $this->get_args ( 'serial' ) ? $this->get_args ( 'serial' ) : "";
 		
-		if (empty($serial)){
+		if (empty ( $serial )) {
 			echo json_encode ( array (
 					'status' => 2,
-					'msg' => 'illegal request'
+					'msg' => 'illegal request' 
 			) );
-			die();
+			die ();
 		}
-			
-		if ($type=='INVOICE'){
+		
+		if ($type == 'INVOICE') {
 			Doo::loadModel ( 'invoice' );
 			$invoice = new invoice ();
 			
-			$detail=$invoice->getInvoiceByIsid($serial,$this->staff[0]['sid']);
-			if (empty($detail))
-				$html='';
-			else{
-				$html='
+			$detail = $invoice->getInvoiceByIsid ( $serial, $this->staff [0] ['sid'] );
+			if (empty ( $detail ))
+				$html = '';
+			else {
+				$html = '
 						<div class="modal-dialog modal-lg">
 				<div class="modal-content"><div class="modal-header"><h3>发票单详情</h3></div>
 				<div class="modal-body saeaList"><table class="table table-bordered table-condensed"><tbody>
 						<tr>
-							<th class="taC" width="150">开票流水号</th><td>'.$detail['invoiceSerial'].'</td>
-							<th class="taC" width="150">提交时间</th><td>'.$detail['date'].'</td>
+							<th class="taC" width="150">开票流水号</th><td>' . $detail ['invoiceSerial'] . '</td>
+							<th class="taC" width="150">提交时间</th><td>' . $detail ['date'] . '</td>
 						</tr>
 						<tr>
-							<th class="taC" width="150">所在办事处</th><td>'.$detail['categoryName'].'('.$detail['userName'].')</td>
-							<th class="taC" width="150">备注</th><td>'.$detail['remark'].'</td>
+							<th class="taC" width="150">所在办事处</th><td>' . $detail ['categoryName'] . '(' . $detail ['userName'] . ')</td>
+							<th class="taC" width="150">备注</th><td>' . $detail ['remark'] . '</td>
 						</tr>
 						<tr>
-							<th class="taC">开票金额</th><td><b class="colOrange" style="font-size:18px">¥'.$detail['invoicePrice'].'</b></td>
-							<th class="taC">开票内容</th><td>'.$detail['invoiceElement'].'</td>
+							<th class="taC">开票金额</th><td><b class="colOrange" style="font-size:18px">¥' . $detail ['invoicePrice'] . '</b></td>
+							<th class="taC">开票内容</th><td>' . $detail ['invoiceElement'] . '</td>
 						</tr></tbody></table>';
 				
-					if ($detail['invoiceType']==0)
-						$html.='<table class="table table-bordered table-condensed"><tbody><tr><th colspan="4" class="taC">增值税普通发票</th></tr><tr>
-							<th class="taC" width="150">发票抬头</th><td colspan="3">'.$detail['invoiceTitle'].'</td></tr></tbody></table>';
-					else
-						$html.='<table class="table table-bordered table-condensed"><tbody><tr><th colspan="4" class="taC">增值税专用发票</th></tr><tr>
-							<th class="taC" width="150">单位名称</th><td>'.$detail['invoiceCompany'].'</td>
-							<th class="taC" width="150">纳税人识别码</th><td>'.$detail['TIN'].'</td></tr><tr>
-							<th class="taC">注册地址</th><td>'.$detail['address'].'</td>
-							<th class="taC">注册电话</th><td>'.$detail['phone'].'</td>
+				if ($detail ['invoiceType'] == 0)
+					$html .= '<table class="table table-bordered table-condensed"><tbody><tr><th colspan="4" class="taC">增值税普通发票</th></tr><tr>
+							<th class="taC" width="150">发票抬头</th><td colspan="3">' . $detail ['invoiceTitle'] . '</td></tr></tbody></table>';
+				else
+					$html .= '<table class="table table-bordered table-condensed"><tbody><tr><th colspan="4" class="taC">增值税专用发票</th></tr><tr>
+							<th class="taC" width="150">单位名称</th><td>' . $detail ['invoiceCompany'] . '</td>
+							<th class="taC" width="150">纳税人识别码</th><td>' . $detail ['TIN'] . '</td></tr><tr>
+							<th class="taC">注册地址</th><td>' . $detail ['address'] . '</td>
+							<th class="taC">注册电话</th><td>' . $detail ['phone'] . '</td>
 						</tr><tr>
-							<th class="taC">开户银行</th><td>'.$detail['bankAccount'].'</td>
-							<th class="taC">银行账户</th><td>'.$detail['bank'].'</td>
+							<th class="taC">开户银行</th><td>' . $detail ['bankAccount'] . '</td>
+							<th class="taC">银行账户</th><td>' . $detail ['bank'] . '</td>
 						</tr></tbody></table>';
-					if ($detail['doPost']==1)
-						$html.='<table class="table table-bordered table-condensed"><tbody><tr><th colspan="4" class="taC">邮寄信息</th></tr><tr>
-							<th class="taC" width="150">收件人</th><td>'.$detail['recipients'].'</td>
-							<th class="taC" width="150">收件人手机/电话</th><td>'.$detail['recipientsPhone'].'</td>
+				if ($detail ['doPost'] == 1)
+					$html .= '<table class="table table-bordered table-condensed"><tbody><tr><th colspan="4" class="taC">邮寄信息</th></tr><tr>
+							<th class="taC" width="150">收件人</th><td>' . $detail ['recipients'] . '</td>
+							<th class="taC" width="150">收件人手机/电话</th><td>' . $detail ['recipientsPhone'] . '</td>
 						</tr><tr>
-							<th class="taC" width="150">收件地址</th><td colspan="3">'.$detail['recipientsAddress'].'</td>
+							<th class="taC" width="150">收件地址</th><td colspan="3">' . $detail ['recipientsAddress'] . '</td>
 						</tr><tr>
-							<th class="taC" width="150">邮寄物品</th><td colspan="3">'.$detail['mailItems'].'</td>
+							<th class="taC" width="150">邮寄物品</th><td colspan="3">' . $detail ['mailItems'] . '</td>
 						</tr></tbody></table>';
-							
-				$html.='</div><div class="modal-footer"><a href="#" class="button btn-gray" data-dismiss="modal" aria-hidden="true">关闭</a></div></div></div>';
 				
+				$html .= '</div><div class="modal-footer"><a href="#" class="button btn-gray" data-dismiss="modal" aria-hidden="true">关闭</a></div></div></div>';
 			}
 			echo json_encode ( array (
 					'status' => 1,
-					'html' => $html
+					'html' => $html 
 			) );
-			die();
-		}elseif ($type=='RECEIVABLES'){
+			die ();
+		} elseif ($type == 'RECEIVABLES') {
 			Doo::loadModel ( 'invoiceReceivables' );
 			$invoiceReceivables = new invoiceReceivables ();
 			
-			$detail=$invoiceReceivables->getInvoiceReceivablesByIrsid($serial,$this->staff[0]['sid']);
-			if (empty($detail))
-				$html='';
-			else{
-				$html='<div class="modal-dialog modal-lg"><div class="modal-content"><div class="modal-header"><h3>收款单详情</h3></div><div class="modal-body saeaList"><table class="table table-bordered table-condensed">
+			$detail = $invoiceReceivables->getInvoiceReceivablesByIrsid ( $serial, $this->staff [0] ['sid'] );
+			if (empty ( $detail ))
+				$html = '';
+			else {
+				$html = '<div class="modal-dialog modal-lg"><div class="modal-content"><div class="modal-header"><h3>收款单详情</h3></div><div class="modal-body saeaList"><table class="table table-bordered table-condensed">
 						<tbody><tr>
-							<th class="taC">收款流水号</th><td>'.$detail['receivablesSerial'].'</td>
-							<th class="taC">录入收款</th><td>'.$detail['inputStaff'].' '.$detail['date'].'</td>
+							<th class="taC">收款流水号</th><td>' . $detail ['receivablesSerial'] . '</td>
+							<th class="taC">录入收款</th><td>' . $detail ['inputStaff'] . ' ' . $detail ['date'] . '</td>
 						</tr><tr>
-							<th class="taC">收款金额</th><td><b>¥'.$detail['receivablesPrice'].'</b></td>
-							<th class="taC">收款信息</th><td>'.$detail['receivablesMessage'].'</td>
+							<th class="taC">收款金额</th><td><b>¥' . $detail ['receivablesPrice'] . '</b></td>
+							<th class="taC">收款信息</th><td>' . $detail ['receivablesMessage'] . '</td>
 						</tr>
 						<tr>
-							<th class="taC">收款银行</th><td>'.$detail['receivablesBank'].'</td>
-							<th class="taC">银行到帐</th><td>'.$detail['receivablesDate'].'</td>
+							<th class="taC">收款银行</th><td>' . $detail ['receivablesBank'] . '</td>
+							<th class="taC">银行到帐</th><td>' . $detail ['receivablesDate'] . '</td>
 						</tr>
 						<tr>
-							<th class="taC">认领收款</th><td colspan="3">'.$detail['inputStaff'].' 转入 '.$detail['username'].' '.$detail['bindDate'].'</td>
+							<th class="taC">认领收款</th><td colspan="3">' . $detail ['inputStaff'] . ' 转入 ' . $detail ['username'] . ' ' . $detail ['bindDate'] . '</td>
 						</tr>
 						</tbody></table></div><div class="modal-footer"><a href="#" class="button btn-gray" data-dismiss="modal" aria-hidden="true">关闭</a></div></div></div>';
 			}
 			echo json_encode ( array (
 					'status' => 1,
-					'html' => $html
+					'html' => $html 
 			) );
-			die();
+			die ();
 		}
-		
 	}
 	function _GetFileEXT($filename) {
 		$pics = explode ( '.', $filename );
 		$num = count ( $pics );
 		return $pics [$num - 1];
 	}
-	
 	function showCache($path = "") {
 		if (file_exists ( $path )) {
-			$htm=file_get_contents($path);
-		}else{
+			$htm = file_get_contents ( $path );
+		} else {
 			Doo::loadModel ( 'invoiceStatistics' );
 			$invoiceStatistics = new invoiceStatistics ();
-				
+			
 			$isBriefly = $invoiceStatistics->getBrieflyStatistics ();
 			$htm = '<tr><th class="taC">' . $isBriefly ['statisticsMonth'] [0] ['month'] . '月累计开票</th>
 				<td>¥' . $isBriefly ['statisticsMonth'] [0] ['invoicePrice'] . '</td>
 				<th class="taC">' . $isBriefly ['statisticsMonth'] [0] ['month'] . '月累计入账</th>
 				<td>¥' . $isBriefly ['statisticsMonth'] [0] ['accountPrice'] . '</td></tr>';
 			/*
-				'<tr><th class="taC">今年累计开票</th><td>¥' . $isBriefly ['statisticsYear'] [0] ['invoicePrice'] . '</td>
-				<th class="taC">今年累计入账</th><td>¥' . $isBriefly ['statisticsYear'] [0] ['accountPrice'] . '</td></tr>';
-				*/
+			 * '<tr><th class="taC">今年累计开票</th><td>¥' . $isBriefly ['statisticsYear'] [0] ['invoicePrice'] . '</td> <th class="taC">今年累计入账</th><td>¥' . $isBriefly ['statisticsYear'] [0] ['accountPrice'] . '</td></tr>';
+			 */
 			file_put_contents ( $path, $htm, FILE_APPEND );
 		}
 		return $htm;
@@ -2337,6 +2342,77 @@ class InvoiceController extends DooController {
 		} else
 			return false;
 	}
+	function isInvoiceNew($type = "GLOBAL") {
+		Doo::loadModel ( 'invoice' );
+		$invoice = new invoice ();
+		Doo::loadModel ( 'invoiceReceivables' );
+		$invoiceReceivables = new invoiceReceivables ();
+		Doo::loadModel ( 'staff' );
+		$staff = new staff ();
+		
+		$st = $staff->getUserByIdList ( $_COOKIE ["staff"] );
+		
+		// 我的发票待处理
+		$pendingInvoice = $invoice->getOne ( array (
+					'where' => "(status=3 or status=4 or (status=2 and printStatus=1 and untreadStatus=0 ) or (status=2 and printStatus=1 and untreadStatus=2 )  )  and isDelete=0 and sid=" . $_COOKIE ["staff"],
+					'desc' => 'iid',
+					'asArray' => TRUE 
+			) );
+		// 我的收款待入账
+		$myClaim = $invoiceReceivables->getOne ( array (
+				'where' => " receivablesStaff like '" . $_COOKIE ["staff"] . "-%' and receivablesCategory like '" . $st [0] ['cid'] . ":%' and bindStatus=0",
+				'desc' => 'irid',
+				'asArray' => TRUE 
+		) );
+		// 发票审批
+		$approval = $invoice->getOne ( array (
+				'where' => 'status=1 and pendingApprovals=' . $_COOKIE ["staff"],
+				'desc' => 'iid',
+				'asArray' => true 
+		) );
+		// 发票邮寄
+		$post = $invoice->getOne ( array (
+				'where' => "postStatus=0 and doPost=1 and status=2",
+				'asArray' => TRUE 
+		) );
+		// 发票打印
+		$print = $invoice->getOne ( array (
+				'where' => "status=2 and printStatus=0 and moldManage like '%[\"" . $_COOKIE ["staff"] . "\",%'",
+				'desc' => 'iid',
+				'asArray' => TRUE 
+		) );
+		// 发票退票
+		$untread = $invoice->getOne ( array (
+				'where' => " printStatus=1 and untreadStatus=1 and status=2 ",
+				'asArray' => TRUE 
+		) );
+		
+		$new = array (
+				'GLOBAL' => FALSE,
+				'pendingInvoice' => FALSE,
+				'myClaim' => FALSE,
+				'approval' => FALSE,
+				'post' => FALSE,
+				'print' => FALSE,
+				'untread' => FALSE 
+		);
+		
+		if (! empty ( $pendingInvoice ) || ! empty ( $myClaim ) || ! empty ( $approval ) || ! empty ( $post ) || ! empty ( $print ) || ! empty ( $untread ))
+			$new ['GLOBAL'] = TRUE;
+		if (! empty ( $pendingInvoice ))
+			$new ['pendingInvoice'] = TRUE;
+		if (! empty ( $myClaim ))
+			$new ['myClaim'] = TRUE;
+		if (! empty ( $approval ))
+			$new ['approval'] = TRUE;
+		if (! empty ( $post ))
+			$new ['post'] = TRUE;
+		if (! empty ( $print ))
+			$new ['print'] = TRUE;
+		if (! empty ( $untread ))
+			$new ['untread'] = TRUE;
+		return $new ;
+	}
 }
 
 ?>

+ 5 - 0
protected/model/invoice.php

@@ -513,6 +513,11 @@ class invoice extends DooModel {
 		}
 		return $list;
 	}
+	
+	function getInvoiceByUntreadStatusPage(){
+		
+	}
+	
 	/**
 	 * 加密或解密指定字符串
 	 *

+ 1 - 1
protected/model/invoiceReceivables.php

@@ -108,7 +108,7 @@ class invoiceReceivables extends DooModel {
 			}
 			
 			$list ['bindClaim'] = $this->find ( array (
-					'where' => " bindStatus=1 ",
+					'where' => " bindStatus=1 and receivablesStaff  like '".$sid."-%' ",
 					'desc' => 'irid',
 					'limit' => 3,
 					'asArray' => TRUE 

+ 67 - 0
protected/plugin/TemplateTag.php

@@ -4,6 +4,7 @@
 // You can move this to common.conf.php $config['TEMPLATE_GLOBAL_TAGS'] = array('isset', 'empty');
 // Every public static methods in TemplateTag class (or tag classes from modules) are available in templates without the need to define in TEMPLATE_GLOBAL_TAGS
 Doo::conf ()->TEMPLATE_GLOBAL_TAGS = array (
+		'isInvoiceNew',
 		'upper',
 		'tofloat',
 		'sample_with_args',
@@ -18,6 +19,72 @@ Doo::conf ()->TEMPLATE_GLOBAL_TAGS = array (
 		'getGlobals' ,
 		'isInvoiceMoldShow'
 );
+
+function isInvoiceNew($type="GLOBAL"){
+	
+	Doo::loadModel ( 'invoice' );
+	$invoice = new invoice ();
+	Doo::loadModel ( 'invoiceReceivables' );
+	$invoiceReceivables = new invoiceReceivables ();
+	Doo::loadModel ( 'staff' );
+	$staff = new staff ();
+	
+	$st = $staff->getUserByIdList ( $_COOKIE ["staff"] );
+	
+	//我的发票待处理
+	$pendingInvoice  = $invoice->getOne ( array (
+					'where' => "(status=3 or status=4 or (status=2 and printStatus=1 and untreadStatus=0 ) or (status=2 and printStatus=1 and untreadStatus=2 )  )  and isDelete=0 and sid=" . $_COOKIE ["staff"],
+					'desc' => 'iid',
+					'asArray' => TRUE 
+			) );
+	//我的收款待入账
+	$myClaim = $invoiceReceivables->getOne ( array (
+			'where' => " receivablesStaff like '" . $_COOKIE ["staff"] . "-%' and receivablesCategory like '" . $st[0]['cid'] . ":%' and bindStatus=0",
+			'desc' => 'irid',
+			'asArray' => TRUE
+	) );
+	//发票审批
+	$approval=$invoice->getOne ( array (
+			'where' => 'status=1 and pendingApprovals=' . $_COOKIE ["staff"],
+			'desc' => 'iid',
+			'asArray' => true
+	) );
+	//发票邮寄
+	$post = $invoice->getOne ( array (
+			'where' => "postStatus=0 and doPost=1 and status=2",
+			'asArray' => TRUE
+	) );
+	//发票打印
+	$print = $invoice->getOne ( array (
+			'where' => "status=2 and printStatus=0 and moldManage like '%[\"" . $_COOKIE ["staff"] . "\",%'",
+			'desc' => 'iid',
+			'asArray' => TRUE
+	) );
+	//发票退票
+	$untread = $invoice->getOne ( array (
+			'where' => " printStatus=1 and untreadStatus=1 and status=2 ",
+			'asArray' => TRUE
+	) );
+	
+	$new=array('GLOBAL'=>FALSE,'pendingInvoice'=>FALSE,'myClaim'=>FALSE,'approval'=>FALSE,'post'=>FALSE,'print'=>FALSE,'untread'=>FALSE);
+	
+	if (!empty($pendingInvoice)||!empty($myClaim)||!empty($approval)||!empty($post)||!empty($print)||!empty($untread))
+		$new['GLOBAL']=TRUE;
+	if (!empty($pendingInvoice))
+		$new['pendingInvoice']=TRUE;
+	if (!empty($myClaim))
+		$new['myClaim']=TRUE;
+	if (!empty($approval))
+		$new['approval']=TRUE;
+	if (!empty($post))
+		$new['post']=TRUE;
+	if (!empty($print))
+		$new['print']=TRUE;
+	if (!empty($untread))
+		$new['untread']=TRUE;
+	return $new[$type];
+}
+
 /**
  * 判断发票的审批权限
  * @param number $sid 用户ID

+ 6 - 6
protected/view/admin/invoiceMenu.html

@@ -1,10 +1,10 @@
 <ul>
 	<li class="invoiceTitle">发票申请</li>
-	<li class="news"><a href="/invoice"
+	<li <!-- if {{new.pendingInvoice}} --> class="news" <!-- endif --> ><a href="/invoice"
 			<!-- if {{receiptMemu}}=="invoice" --> class="selected" <!-- endif -->
 			>我的发票
 	</a></li>
-	<li class="news"><a <!-- if {{receiptMemu}}=="invoiceMyReceivables" --> class="selected" <!-- endif --> href="/invoiceMyReceivables">我的收款</a></li>
+	<li  <!-- if {{new.myClaim}} --> class="news" <!-- endif --> ><a <!-- if {{receiptMemu}}=="invoiceMyReceivables" --> class="selected" <!-- endif --> href="/invoiceMyReceivables">我的收款</a></li>
 	<li><a <!-- if {{receiptMemu}}=="invoiceReceivablesClaim" --> class="selected" <!-- endif --> href="/invoiceReceivablesClaim">收款认领</a></li>
 
 
@@ -13,24 +13,24 @@
 	<li class="topLine"><a <!-- if {{receiptMemu}}=="invoiceReceivables" --> class="selected" <!-- endif --> href="/invoiceReceivables">收款录入</a></li>
 <!-- endif -->
 	<!-- if isInvoiceMoldShow({{staff.0.sid}},'发票审批') -->
-	<li><a
+	<li <!-- if {{new.approval}} --> class="news" <!-- endif --> ><a
 			<!-- if {{receiptMemu}}=="invoiceApproval" --> class="selected" <!-- endif -->
 			href="/invoiceApproval">发票审批
 	</a></li>
 	<!-- endif -->
 	
 	<!-- if isInvoiceMoldShow({{staff.0.sid}},'发票打印') -->
-	<li class="news"><a
+	<li <!-- if {{new.print}} --> class="news" <!-- endif --> ><a
 			<!-- if {{receiptMemu}}=="invoicePrint" --> class="selected" <!-- endif -->
 			href="/invoicePrint">发票打印
 	</a></li>
 	<!-- endif -->
 	<!-- if isInvoiceMoldShow({{staff.0.sid}},'发票邮寄') -->
-	<li class="news"><a <!-- if {{receiptMemu}}=="invoicePost" --> class="selected" <!-- endif --> href="/invoicePost">发票邮寄
+	<li <!-- if {{new.post}} --> class="news" <!-- endif --> ><a <!-- if {{receiptMemu}}=="invoicePost" --> class="selected" <!-- endif --> href="/invoicePost">发票邮寄
 	</a></li>
 <!-- endif -->
 <!-- if isInvoiceMoldShow({{staff.0.sid}},'发票退票') -->
-	<li><a <!-- if {{receiptMemu}}=="invoiceUntread" --> class="selected" <!-- endif --> href="/invoiceUntread">发票退票</a></li>
+	<li <!-- if {{new.untread}} --> class="news" <!-- endif --> ><a <!-- if {{receiptMemu}}=="invoiceUntread" --> class="selected" <!-- endif --> href="/invoiceUntread">发票退票</a></li>
 <!-- endif -->	
 
 <!-- if isInvoiceMoldShow({{staff.0.sid}},'公司汇总查阅') -->

+ 3 - 0
protected/view/admin/menuReceipt.html

@@ -7,6 +7,9 @@
 <li class="hide"><a href="#">D</a></li> 
 
 <li data-placement="right" class="topLine <!-- if  getGlobals('NEW2') !=0 ||  getGlobals('NEW') !=0 --> news <!-- endif --> " data-toggle="ctooltip" data-original-title="费用管理" ><a href="/saeaBorad" class="icon- <!-- if {{memu}}=="receipt" --> selected <!-- endif -->" >U</a></li>  
+ 
+<li data-placement="right" data-toggle="ctooltip" <!-- if isInvoiceNew() --> class="news" <!-- endif --> data-original-title="发票申请"><a href="/invoice" class="icon- <!-- if {{memu}}=="invoice" --> selected <!-- endif -->">D</a></li>
+ 
  <li data-placement="right" data-toggle="ctooltip" data-original-title="邮件推广">  
 <a href="/eMailTask" class="icon- <!-- if {{memu}}=="eMailTask" --> selected <!-- endif -->">Z</a></li>
 <li data-placement="right" data-toggle="ctooltip" data-original-title="假期管理">

+ 5 - 1
protected/view/menu.html

@@ -1,3 +1,5 @@
+
+
 <li><!-- if getGlobals('NEW2') != 0  || getGlobals('NEW') != 0 --> <!-- endif --> </li>
 <li data-placement="right" data-toggle="ctooltip" data-original-title="信息中心" class="topLine"><a href="/" class="icon- <!-- if {{memu}}=="index" --> selected <!-- endif --> ">B</a></li>
 <li data-placement="right" data-toggle="ctooltip" data-original-title="通讯录"><a href="/contacts" class="icon- <!-- if {{memu}}=="contacts" --> selected <!-- endif -->">A</a></li>
@@ -7,7 +9,9 @@
 <li class="hide"><a href="#">E</a></li>
 <li class="hide"><a href="#">D</a></li> 
  
-<li  data-placement="right" data-toggle="ctooltip" class="topLine <!-- if  getGlobals('NEW') != 0 || getGlobals('NEW2') != 0 --> news <!-- endif -->" data-original-title="费用管理"   ><a href="/saeaBorad" class="icon- <!-- if {{memu}}=="receipt" --> selected <!-- endif -->" >U   </a></li>  
+<li  data-placement="right" data-toggle="ctooltip" class="topLine <!-- if   getGlobals('NEW') != 0 || getGlobals('NEW2') != 0  --> news <!-- endif -->" data-original-title="费用管理"  ><a href="/saeaBorad" class="icon- <!-- if {{memu}}=="receipt" --> selected <!-- endif -->" >U   </a></li>  
+
+<li data-placement="right" data-toggle="ctooltip" <!-- if isInvoiceNew() --> class="news" <!-- endif --> data-original-title="发票申请"><a href="/invoice" class="icon- <!-- if {{memu}}=="invoice" --> selected <!-- endif -->">D</a></li>
 
 <li data-placement="right" data-toggle="ctooltip" data-original-title="邮件推广">  
 <a href="/eMailTask" class="icon- <!-- if {{memu}}=="eMailTask" --> selected <!-- endif -->">Z</a></li>