소스 검색

信息中心优化

caipin 7 년 전
부모
커밋
b50fbb100a

+ 1 - 0
global/css/global.css

@@ -1870,6 +1870,7 @@ a.new-ribbon:before{
 .adminContent{
   margin:0 0 0 160px;
   overflow-y:auto;
+
   padding:0 15px 0 0
 }
 .borad-menu{

+ 5 - 33
global/js/invoice.js

@@ -168,9 +168,9 @@ $(function() {
 	});
 	
 	
-	$('a[bind-receivables="true"]').click(function() {
-		console.log('ddd');
-	});
+//	$('a[bind-receivables="true"]').click(function() {
+//		console.log('ddd');
+//	});
 	
 	$("button[invoice-search='title']").click(function() {
 		var title=$("input[name='searchTitle']").val();
@@ -774,37 +774,9 @@ $(function() {
 	
 	
 	
-	$("a[node-store=batchDel]").click(function() {
-		
-		var id_array=new Array();  
-		$('input[name="isBox"]:checked').each(function(){  
-		    id_array.push($(this).val());//向数组中添加元素  
-		});  
-		var idstr=id_array.join(',');//将数组元素连接起来以构建一个字符串  
-		$("input[id=batchStoreKey]").val(idstr);
-		
-	});
 	
-	$("a[node-store=batchMail]").click(function() {
-		
-		var id_array=new Array();  
-		$('input[name="isBox"]:checked').each(function(){  
-		    id_array.push($(this).val());
-		});  
-		var idstr=id_array.join(',');
-		$("input[id=BatchMailStoreKey]").val(idstr);
-		
-	});
-	$("a[node-store=batchApproval]").click(function() {
-		
-		var id_array=new Array();  
-		$('input[name="isBox"]:checked').each(function(){  
-		    id_array.push($(this).val());
-		});  
-		var idstr=id_array.join(',');
-		$("input[id=appBatchStoreKey]").val(idstr);
-		
-	});
+	
+	
 	
 	
 		

+ 1 - 1
global/js/invoice.validator.js

@@ -57,7 +57,7 @@ $(function () {
 		    ,invoiceElement: 'required; '
 		    ,invoiceType: 'required'
 			,recipients: 'required(isMail); '
-			,recipientsPhone: 'required(isMail);digits(isMail); '
+			,recipientsPhone: 'required(isMail); '//digits(isMail);
 			,recipientsAddress: 'required(isMail); '
 	    }
 	});

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

@@ -45,6 +45,7 @@ $acl ['ordinary'] ['allow'] = array (
 				'invoiceTrainingAdd',
 				'invoiceTrainingDetail',
 				'invoiceTrainingUpload',
+				'invoiceTrainingDelDo',
 				'invoiceStoreImport',
 				'invoiceStoreEdit',
 				'invoiceStoreEditDo',

+ 4 - 2
protected/config/routes.conf.php

@@ -1,7 +1,7 @@
 <?php
 
 
-$route['*']['/emailtext'] = array('ErrorController', 'index');
+$route['*']['/emailtext'] = array('ErrorController', 'emailtext');
 
 $route['*']['/statistics'] = array('MainController', 'keyStatistics');
 
@@ -221,7 +221,7 @@ $route['*']['/saeaCreate'] = array('ReceiptController', 'saeaCreate');
 $route['*']['/addReceipt'] = array('ReceiptController', 'addReceipt');
 $route['*']['/referReceipt/:rid'] = array('ReceiptController', 'referReceipt');
 $route['*']['/referReceipt'] = array('ReceiptController', 'referReceipt');
-$route['*']['/editReceipt/:rid'] = array('ReceiptController', 'editReceipt');
+$route['*']['/editReceipt/:rid'] = array('ReceiptController', 'editReceipt','extension'=>'.html');
 $route['*']['/updateReceipt'] = array('ReceiptController', 'updateReceipt');
 $route['*']['/approvedReceipt/:rid'] = array('ReceiptController', 'approvedReceipt');
 $route['*']['/approval'] = array('ReceiptController', 'approval');
@@ -394,6 +394,8 @@ $route['get']['/invoiceReceivablesAchieve/:page/:date/:MebSea'] = array('Invoice
 $route['*']['/invoiceTraining'] = array('InvoiceController', 'invoiceTraining');
 $route['post']['/invoiceTrainingAdd'] = array('InvoiceController', 'invoiceTrainingAdd');
 $route['*']['/invoiceTrainingDetail/:trainingKey'] = array('InvoiceController', 'invoiceTrainingDetail','extension'=>'.html');
+$route['post']['/invoiceTrainingDelDo'] = array('InvoiceController', 'invoiceTrainingDelDo');
+
 $route['*']['/invoiceTrainingUpload'] = array('InvoiceController', 'invoiceTrainingUpload');
 $route['*']['/invoiceStoreImport'] = array('InvoiceController', 'invoiceStoreImport');
 $route['*']['/invoiceStoreEdit/:storeKey'] = array('InvoiceController', 'invoiceStoreEdit','extension'=>'.html');

+ 10 - 2
protected/controller/ErrorController.php

@@ -9,8 +9,16 @@ class ErrorController extends DooController{
 
 	
 	function emailtext(){
-		$trainStatus = $this->get_args ( 'substitution_vars' ) ? $this->get_args ( 'substitution_vars' ) : "";
-		file_put_contents(DOO::conf ()->SITE_PATH . "upload/invoice/email.json", $trainStatus.PHP_EOL,FILE_APPEND);
+		
+		$redis = new Redis();
+		$redis->connect('120.27.200.79', '6379');
+		
+		$redis->set('name','leesin');
+		echo $redis->get('name');
+		die;
+		
+// 		$trainStatus = $this->get_args ( 'substitution_vars' ) ? $this->get_args ( 'substitution_vars' ) : "";
+// 		file_put_contents(DOO::conf ()->SITE_PATH . "upload/invoice/email.json", $trainStatus.PHP_EOL,FILE_APPEND);
 	}
 	
     public function index(){

+ 148 - 54
protected/controller/InvoiceController.php

@@ -784,11 +784,11 @@ class InvoiceController extends DooController {
 		foreach ( $isList as $key => $value ) {
 			$irDetail = array ();
 			if ($value ['apStatus'] == 1) {
-				array_push ( $irDetail, '<input disabled type="checkbox">' );
-				array_push ( $irDetail, '' );
+				//array_push ( $irDetail, '' );
+				array_push ( $irDetail, '<input class="hide" disabled type="checkbox"  >' );
 			} else {
-				array_push ( $irDetail, '<input type="checkbox" name="isBox" value="' . $value ['storeKey'] . '" >' );
-				array_push ( $irDetail, '<a href="/invoiceStoreEdit/' . $value ['storeKey'] . '.html">编辑</a> 
+				
+				array_push ( $irDetail, '<input type="checkbox"  class="hide" id="' . $value ['storeKey'] . '"  name="isBox" value="' . $value ['storeKey'] . '" > <a href="/invoiceStoreEdit/' . $value ['storeKey'] . '.html">编辑</a> 
 						<a href="#confirm" onclick="invoiceStoreApproval(\'' . $value ['storeKey'] . '\')" data-toggle="modal">提交审批</a> 
 						<a href="#del" node-iStore="del" data-key="' . $value ['storeKey'] . '" onclick="invoiceStoreDel(\'' . $value ['storeKey'] . '\')" data-toggle="modal" class="colRed">移除</a>' );
 			}
@@ -799,6 +799,13 @@ class InvoiceController extends DooController {
 			else
 				array_push ( $irDetail, $value ['invoiceTitle'] );
 			array_push ( $irDetail, $value ['TIN'] );
+			
+			if (empty ( $value ['mailItems'])&&$value ['apStatus'] != 1){
+				array_push ( $irDetail, '<a href="#confirm-erro" onclick="invoiceStoreMail(\'' . $value ['storeKey'] . '\')" data-toggle="modal">设置邮寄物品</a>' );
+			}else
+				array_push ( $irDetail, $value ['mailItems'] );
+			array_push ( $irDetail, $value ['recipientsAddress'] . $value ['recipients'] . $value ['recipientsPhone'] );
+			
 			array_push ( $irDetail, $value ['address'] . $value ['phone'] );
 			array_push ( $irDetail, $value ['bank'] . $value ['bankAccount'] );
 			array_push ( $irDetail, $value ['invoiceElement'] );
@@ -810,11 +817,7 @@ class InvoiceController extends DooController {
 			else
 				array_push ( $irDetail, '¥' . $value ['invoicePrice'] );
 			array_push ( $irDetail, $value ['remark'] );
-			if (empty ( $value ['mailItems'] ))
-				array_push ( $irDetail, '<a href="#confirm-erro" onclick="invoiceStoreMail(\'' . $value ['storeKey'] . '\')" data-toggle="modal">设置邮寄物品</a>' );
-			else
-				array_push ( $irDetail, $value ['mailItems'] );
-			array_push ( $irDetail, $value ['recipientsAddress'] . $value ['recipients'] . $value ['recipientsPhone'] );
+			
 			
 			if ($value ['status'] == 1)
 				array_push ( $irDetail, '审批中' );
@@ -928,8 +931,9 @@ class InvoiceController extends DooController {
 			
 			$exlArray = $this->_format_excel_to_array ( DOO::conf ()->SITE_PATH . "upload/invoiceTraining/" . $path, 'invoiceTrain' );
 			
-			$userName=$this->staff [0] ['userName'];
+			$userName=$this->staff [0] ['username'];
 			$sDetail = $staff->getStaffByName ( $userName );
+			
 			// 可以优化
 			foreach ( $exlArray as $key => $value ) {
 				// 开票
@@ -938,7 +942,7 @@ class InvoiceController extends DooController {
 				$invoice->trainId = $itid;
 				
 				$invoice->invoiceType = 0;
-				if ($value ['invoiceType'] == '专')
+				if ($value ['invoiceType'] == '专'||$value ['invoiceType'] == '专票')
 					$invoice->invoiceType = 1;
 				
 				$invoice->invoiceQuantity = $value ['invoiceQuantity'];
@@ -947,7 +951,7 @@ class InvoiceController extends DooController {
 				$invoice->invoicePrice = $value ['invoiceQuantity'] * $value ['invoiceUnitPrice'];
 				
 				$invoice->invoiceTitle = $value ['invoiceTitle'];
-				if ($value ['invoiceType'] == '专')
+				if ($value ['invoiceType'] == '专'||$value ['invoiceType'] == '专票')
 					$invoice->invoiceCompany = $value ['invoiceTitle'];
 				
 				$invoice->userName =$userName;
@@ -2067,6 +2071,7 @@ class InvoiceController extends DooController {
 				if (count ( $processApprovals ) == count ( $invoiceManage ) && $status != 4) {
 					$invoice->status = $status;
 					$invoice->pendingApprovals = 0;
+					$invoice->approvalTime=date ( "Y-m-d H:i:s" );
 				} elseif ($status == 4) {
 					$invoice->status = $status;
 					$item = array (
@@ -2240,7 +2245,7 @@ class InvoiceController extends DooController {
 		
 		$pageinfo = $this->get_page ( "CLD_invoice", $sql, $page, $page_size, $action, $get, "" );
 		$limit = $pageinfo ['lower'] . ',' . $page_size;
-		$list = $invoice->getInvoiceByUntreadStatusPage ( $limit, $sql );
+		$list = $invoice->getInvoiceByUntreadStatusPage ( $limit, $sql,'desc',5 );
 		
 		$this->data ['MebSeaEn'] = $MebSea;
 		$this->data ['MebSea'] = urlencode ( $MebSea );
@@ -2729,7 +2734,6 @@ class InvoiceController extends DooController {
 		
 		// 获取未入账发票
 		$invoiceUnAccount = $invoice->getInvoiceByUnAccount ( $invoiceTC );
-		
 		$invoiceExistAccount = $invoice->getInvoiceByUnAccount ( '', true );
 		
 		foreach ( $invoiceUnAccount as $key => $value ) {
@@ -2761,7 +2765,11 @@ class InvoiceController extends DooController {
 		
 		$receivablesInput = $invoiceReceivables->getInvoiceReceivablesByInput ();
 		
-		// print_r($receivablesList);
+		$halfList=$invoiceReceivables->getInvoiceReceivablesByHalf();
+		$this->data ['halfList'] = $halfList;
+		$this->data ['halfCount'] = count ( $halfList );
+		
+		//print_r($receivablesList);
 		$this->data ['receivablesDate'] = date ( "Y-m-d" );
 		$this->data ['ieaCount'] = count ( $invoiceExistAccount );
 		$this->data ['invoiceExistAccount'] = $invoiceExistAccount;
@@ -3218,10 +3226,13 @@ class InvoiceController extends DooController {
 		
 		$list = $invoiceReceivables->getInvoiceReceivablesByClaim ( $this->staff [0] ['cid'], $this->staff [0] ['sid'] );
 		
+		
+		
 		$this->data ['isMonth'] = $isMonth;
 		$this->data ['htm'] = $htm;
 		$this->data ['list'] = $list;
 		
+		
 		$this->data ['memu'] = "invoice";
 		$this->data ['staff'] = $this->staff;
 		$this->data ['receiptMemu'] = 'invoiceMyReceivables';
@@ -3253,17 +3264,39 @@ class InvoiceController extends DooController {
 		if ($detail ['untreadStatus'] == 3)
 			die ( 'illegal request' );
 			
-			// if ($detailM ['receivablesPrice'] >= $detail ['invoicePrice']) {
-			// $price = $detailM ['receivablesPrice'] - $detail ['invoicePrice'];
-			// die ( '<p>收款金额超出开票金额 ¥' . $price . '元,请谨慎操作</p><a href="/invoiceMyReceivables">返回</a>' );
-			// }
+		//修改 绑定状态改为 金额	
 		$invoiceReceivables = new invoiceReceivables ();
-		$item = array (
+		
+		$invoicePrice=$detail['invoicePrice']+$detailM['bindPrice'];
+		if ($detailM['receivablesPrice']>$invoicePrice){
+			$item=array(
+					'bindPrice'=>$invoicePrice
+			);
+		}elseif ($detailM['receivablesPrice']<=$invoicePrice){
+			$item=array(
+					'bindPrice'=>$invoicePrice,
+					'bindStatus'=>1,
+					'bindDate' => date ( "Y-m-d H:i:s" )
+			);
+		}else{
+			die ( 'illegal request' );
+		}
+		
+		if($detailM['iid']==0){
+			$item+=array(
+					'iid'=>$detail ['iid']
+			);
+		}else{
+			$iidExtend=explode(',', $detailM ['iidExtend']);
+			array_push($iidExtend, $detail ['iid']);
+			$item+=array(
+					'iidExtend'=>implode(',', $iidExtend)
+			);
+		}
+			
+		$item += array (
 				'irid' => $detailM ['irid'],
-				'bindStatus' => 1,
-				'iid' => $detail ['iid'],
-				'accountClerk' => $this->staff [0] ['username'],
-				'bindDate' => date ( "Y-m-d H:i:s" ) 
+				'accountClerk' => $this->staff [0] ['username']
 		);
 		$invoiceReceivables->setInvoiceReceivablesByCondition ( $item );
 		
@@ -3306,11 +3339,6 @@ class InvoiceController extends DooController {
 		Doo::loadModel ( 'invoiceStatistics' );
 		$invoiceStatistics = new invoiceStatistics ();
 		
-		// $list = $invoiceReceivables->getInvoiceReceivablesInIridString ( $iridString );
-		// $accountPrice = 0;
-		// foreach ( $list as $key => $value ) {
-		// $accountPrice += $value ['receivablesPrice'];
-		// }
 		$item = array (
 				'date' => $detailM ['receivablesDate'],
 				'priceClass' => 3,
@@ -4005,7 +4033,7 @@ class InvoiceController extends DooController {
 		$MebSea = $this->get_args ( 'MebSea' ) ? $this->get_args ( 'MebSea' ) : "";
 		$timeType = $this->get_args ( 'timeType' ) ? $this->get_args ( 'timeType' ) : "CREATE";
 		
-		$page_size = 6;
+		$page_size = 10;
 		$page = isset ( $this->params ['page'] ) && is_numeric ( $this->params ['page'] ) ? $this->params ['page'] : 1;
 		$status = isset ( $this->params ['status'] ) ? $this->params ['status'] : 'All';
 		
@@ -4021,9 +4049,9 @@ class InvoiceController extends DooController {
 				$D2 = $dateArr [0]; // ." 23:59:59 ";//date ( "Y-m-d" );
 		}
 		
-		$descField = 'receivablesDate';
+		$descField = 'a.receivablesDate';
 		if ($timeType == 'CREATE')
-			$descField = 'date';
+			$descField = 'a.date';
 		
 		$con = '1';
 		if (! empty ( $D1 ) && ! empty ( $D2 ))
@@ -4031,24 +4059,41 @@ class InvoiceController extends DooController {
 			
 			// echo $con;
 		if ($status == 'Unclaimed')
-			$con .= ' and bindStatus=0';
+			$con .= ' and a.bindStatus=0';
 		elseif ($status == 'Credited')
-			$con .= ' and bindStatus=1';
+			$con .= ' and a.bindStatus=1';
 		elseif ($status == 'Claim')
-			$con .= ' and bindStatus=0 and receivablesStaff="PUBLIC"';
+			$con .= ' and a.bindStatus=0 and a.receivablesStaff="PUBLIC"';
 		
 		$get = "/" . $status . "?date=" . urlencode ( $date ) . "&MebSea=" . urlencode ( $MebSea );
 		
 		if (! empty ( $MebSea )) {
-			$con .= ' and ( receivablesMessage like "%' . $MebSea . '%"  or receivablesPrice like "%' . $MebSea . '%" )';
+			$con .= ' and ( a.receivablesMessage like "%' . $MebSea . '%"  or a.receivablesPrice like "%' . $MebSea . '%" )';
 		}
 		$pageinfo ['page'] = array (
 				'previous' => '' 
 		);
-		$pageinfo = $this->get_page ( "CLD_invoiceReceivables", $con, $page, $page_size, "invoiceReceivablesAS", $get, "" );
+		
+		
+		$sql = 'select count(*) as count
+				from CLD_invoiceReceivables as a left join CLD_invoice as b on
+				find_in_set(b.iid,a.iidExtend) or a.iid=b.iid
+				where ' . $con . ' group by a.irid
+				';
+		
+		$pageinfo =$this->getPageBySql($sql, $page, $page_size, "invoiceReceivablesAS", $get, "");
+		
+		//print_r($pageinfo);
+		
+		//$pageinfo = $this->get_page ( "CLD_invoiceReceivables", $con, $page, $page_size, "invoiceReceivablesAS", $get, "" );
 		$limit = $pageinfo ['lower'] . ',' . $page_size;
 		
-		$list = $invoiceReceivables->getReceivablesByUntreadStatusPage ( $limit, $con, 'desc', $descField );
+		
+		
+		
+		
+		
+		$list = $invoiceReceivables->getInvoiceReceivablesByConditionPage ( $limit, $con, 'desc', $descField );
 		// print_r($list);
 		
 		$this->data ['timeType'] = $timeType;
@@ -4383,20 +4428,6 @@ class InvoiceController extends DooController {
 				<div class="modal-content"><div class="modal-header"><h3>发票单详情</h3></div>
 				<div class="modal-body saeaList">
 					
-					
-					
-					<table class="table table-bordered table-condensed" style="margin:15px 0;">
-						<tbody>
-								
-							<tr>
-								<th class="taC" >发票号</th><td><span class="colRed">*</span>No.<input name="invoiceNo" id="invoiceNo" value="" type="text" placeholder="输入发票号" aria-required="true" aria-invalid="true" class="n-invalid">
-								<span class="red" id="p-msg"></span>
-								</td>
-							</tr>
-						</tbody>
-					</table>
-					
-					
 					<table class="table table-bordered table-condensed"><tbody>
 						<tr>
 							<th class="taC" width="150">开票流水号</th><td>' . $detail ['invoiceSerial'] . '</td>
@@ -4455,7 +4486,7 @@ class InvoiceController extends DooController {
 							<th class="taC" width="150">邮寄物品</th><td colspan="3">' . $detail ['mailItems'] . '</td>
 						</tr></tbody></table>';
 			if (! empty ( $invoiceOperationLogList )) {
-				$html .= '<table class="table table-bordered table-condensed"><tbody><tr><th width="60%" class="taC">审批流程</th></tr><tr><td>';
+				$html .= '<table class="table table-bordered table-condensed"><tbody><tr><th width="60%" class="taC">审批流程</th><th class="taC">发票打印</th></tr><tr><td>';
 				foreach ( $invoiceOperationLogList as $key => $value ) {
 					if ($value ['status'] == 1 || $value ['status'] == 2 || $value ['status'] == 3 || $value ['status'] == 4) {
 						$html .= '<blockquote><p><span class="colGray">' . $value ['date'] . '</span>&nbsp;
@@ -4472,7 +4503,15 @@ class InvoiceController extends DooController {
 						$html .= $value ['operation'] . '</p></blockquote>';
 					}
 				}
-				$html .= '</td></tr></tbody></table>';
+				$html .= '</td>
+						
+						<td><span class="colRed">*</span>No.<input name="invoiceNo" id="invoiceNo" value="" type="text" placeholder="输入发票号" aria-required="true" aria-invalid="true" class="n-invalid">
+								<span class="red" id="p-msg"></span>
+								</td>
+						
+						
+						</tr></tbody></table>';
+				
 			}
 			$html .= '</div><div class="modal-footer"><button type="submit" class="button btn-green"  data-toggle="modal">完成打印</button><a href="#" class="button btn-gray" data-dismiss="modal" aria-hidden="true">关闭</a></div>
 					</div></div></form>
@@ -5658,6 +5697,61 @@ class InvoiceController extends DooController {
 		$result = $query->fetch ();
 		return $result ['count'];
 	}
+	
+	
+	/**
+	 * 获得分页数据
+	 * @param unknown_type $table
+	 * @param unknown_type $condition
+	 * @param unknown_type $on_page
+	 * @param unknown_type $page_size
+	 */
+	function getPageBySql($sql= "", $on_page = 1, $page_size = 20, $action = "", $get = "", $other = "page") {
+		$page_c = "";
+		$page ['previous'] = $this->get_previous ( $on_page );
+		$page ['on_page'] = $on_page;
+		$total_count = $this->getTableCountBySql ( $sql );
+		$total = intval ( $total_count / $page_size );
+	
+		$page ['total_page'] = ($total_count % $page_size) == 0 ? $total : $total + 1;
+		$page ['total_data'] = $total_count;
+		$page ['next'] = $on_page == $page ['total_page'] ? $page ['total_page'] : $on_page + 1;
+	
+		$i = 1;
+		$page_max = 1;
+		$page_width = 3;
+	
+		if ($on_page >= $page_width) {
+			$page_max = intval ( $on_page / $page_width ) + 1;
+			$i = intval ( $on_page / $page_width ) * $page_width - 1;
+		}
+	
+		for(; $i <= $page ['total_page']; $i ++) {
+			if ($i == $on_page)
+				$page_c .= '<li class="active"><a href="javascript:void(0)">' . $i . '</a></li>';
+				else
+					$page_c .= '<li><a href="/' . $action . '/' . $i . $get . '">' . $i . '</a></li>';
+						
+					if ($i == ($page_width * $page_max))
+						break;
+		}
+	
+		$page ['page'] = $page_c;
+		$page ['lower'] = (-- $on_page) * $page_size;
+		return $page;
+	}
+	
+	/**
+	 * 获得总页数 sql
+	 * @param string $type
+	 * @return boolean[]
+	 */
+	public function getTableCountBySql($sql=""){
+		$query = Doo::db ()->query ( $sql );
+		$result = $query->fetch ();
+		return $result ['count'];
+	}	
+	
 	function isInvoiceNew($type = "GLOBAL") {
 		Doo::loadModel ( 'invoice' );
 		$invoice = new invoice ();

+ 233 - 151
protected/controller/MainController.php

@@ -169,6 +169,12 @@ class MainController extends DooController {
 		
 		return "/";
 	}
+	
+	function test(){
+		//实例化redis
+		
+	}
+	
 	function index2() {
 		// include Doo::conf()->BASE_PATH.'diagnostic/debug.php';
 		$cid = $this->get_args ( 'cid' ) ? $this->get_args ( 'cid' ) : 0;
@@ -218,9 +224,6 @@ class MainController extends DooController {
 		}
 		
 		
-		
-		
-		
 		//有待优化
 		Doo::loadModel ( 'department' );
 		$department = new department ();
@@ -478,6 +481,8 @@ class MainController extends DooController {
 		Doo::loadModel ( 'department' );
 		$department = new department ();
 		
+		$redis = new Redis();
+		$redis->connect('127.0.0.1', '6379');//120.27.200.79
 		
 		$staffCondition = "";
 		$categorylist2 = array ();
@@ -559,25 +564,37 @@ class MainController extends DooController {
 		) );
 		
 		$max = array ();
-		$kkk = array ();
-		
-		foreach ( $staffList as $key => $value ) {
-			$staffList [$key] ['count'] = $client_staff->count ( array (
-					'where' => 'sid=' . $value ['sid'],
-					'asArray' => true 
-			) );
-			
-			array_push ( $max, $staffList [$key] ['count'] . ':' . $value ['username'] );
-			if ($this->staff [0] ['cid'] == 12)
-				array_push ( $kkk, $staffList [$key] ['count'] );
-			if ($this->staff [0] ['cid'] == $value ['cid'] && $this->staff [0] ['cid'] != 12) {
-				array_push ( $kkk, $staffList [$key] ['count'] );
+		$sum=0;
+		//客户总数
+		$redisKey=date('Y-m-d').'_logStatisticsCSum';
+		$redisValue = $redis->lrange($redisKey, 0, -1);
+		if (empty($redisValue)){
+			$kkk = array ();
+			foreach ( $staffList as $key => $value ) {
+				$staffList [$key] ['count'] = $client_staff->count ( array (
+						'where' => 'sid=' . $value ['sid'],
+						'asArray' => true 
+				) );
+				
+				array_push ( $max, $staffList [$key] ['count'] . ':' . $value ['username'] );
+				if ($this->staff [0] ['cid'] == 12)
+					array_push ( $kkk, $staffList [$key] ['count'] );
+				if ($this->staff [0] ['cid'] == $value ['cid'] && $this->staff [0] ['cid'] != 12) {
+					array_push ( $kkk, $staffList [$key] ['count'] );
+				}
 			}
+			foreach ( $kkk as $key => $value ) {
+				$sum += $value;
+			}
+			
+			$sortMaxStr=json_encode ( $max );
+			$redis->lpush($redisKey, $sum);
+			$redis->lpush($redisKey, $sortMaxStr);
+		}else{
+			$sum=$redisValue[1];
+			$max=json_decode($redisValue[0],true);
 		}
-		$sum = 0;
-		foreach ( $kkk as $key => $value ) {
-			$sum += $value;
-		}
+		
 		
 		rsort ( $max, SORT_NUMERIC );
 		foreach ( $max as $key => $value ) {
@@ -592,30 +609,43 @@ class MainController extends DooController {
 		$lcategoryList = $lcategory->find ( array (
 				'asArray' => true 
 		) );
+		
+		
 		$useL = array ();
 		$Rsum = $Ssum = 0;
-		foreach ( $lcategoryList as $key => $value ) {
-			$longleR = $longle->count ( array (
-					'where' => 'cid=' . $value ['cid'],
-					'asArray' => true 
-			) );
-			$longleS = $longle->count ( array (
-					'where' => 'cid=' . $value ['cid'] . ' and status!=1 and status!=2',
-					'asArray' => true 
-			) );
-			$Rsum += $longleR;
-			$Ssum += $longleS;
-			if (! empty ( $longleS ))
-				array_push ( $useL, round ( ($longleS / $longleR) * 100 ) . '% :' . $value ['title'] );
-			else
-				array_push ( $useL, '0% :' . $value ['title'] );
-		}
-		
-		// Doo::db()->commit();
-		rsort ( $useL, SORT_NUMERIC ); // $sum=0;
+		$redisKey=date('Y-m-d').'_logStatisticsLongle';
+		$redisValue = $redis->lrange($redisKey, 0, -1);
+		if (empty($redisValue)){
+			foreach ( $lcategoryList as $key => $value ) {
+				$longleR = $longle->count ( array (
+						'where' => 'cid=' . $value ['cid'],
+						'asArray' => true 
+				) );
+				$longleS = $longle->count ( array (
+						'where' => 'cid=' . $value ['cid'] . ' and status!=1 and status!=2',
+						'asArray' => true 
+				) );
+				$Rsum += $longleR;
+				$Ssum += $longleS;
+				if (! empty ( $longleS ))
+					array_push ( $useL, round ( ($longleS / $longleR) * 100 ) . '% :' . $value ['title'] );
+				else
+					array_push ( $useL, '0% :' . $value ['title'] );
+			}
+			$useLStr=json_encode ( $useL );
+			$redis->lpush($redisKey, $Rsum);
+			$redis->lpush($redisKey, $Ssum);
+			$redis->lpush($redisKey, $useLStr);
+		}else{
+			$useL=$redisValue[0];
+			$useL=json_decode($useL,true);
+			$Ssum=$redisValue[1];
+			$Rsum=$redisValue[2];
+		}
+		
+		rsort ( $useL, SORT_NUMERIC ); 
 		foreach ( $useL as $key => $value ) {
 			$useL [$key] = explode ( ":", $value );
-			// $sum+=$max[$key][0];
 		}
 		
 		$useL2 = $useL;
@@ -625,161 +655,213 @@ class MainController extends DooController {
 		
 		// statistics
 		
+		//30天操作日志数 
 		$categoryCondition = " and cid=" . $this->staff [0] ['cid'];
-		$sidCondition = "";
+		$redisCid=$this->staff [0] ['cid'];
+		$sidCondition=$redisSid = "";
 		if (! empty ( $cid )){
 			$categoryCondition = " and cid=" . $cid;
-// 			if (!empty($did))
-// 				$categoryCondition .= " and departmentID=" . $did;
+			$redisCid=$cid;
 		}
-		if (! empty ( $sid ))
+		if (! empty ( $sid )){
+			$redisSid=$sid;
 			$sidCondition = " and sid=" . $sid;
+		}
 		if ($this->staff [0] ['cid'] == 12 && empty ( $cid )) {
 			$categoryCondition = "";
+			$redisCid='';
 		}
-		//echo $categoryCondition;
-		// Year(updatetime)=".date('Y')." and Month(updatetime)=".date('m')." date_format(updatetime,"%m-%d")
 		
-		$actionLogClient = $action_log->find ( array (
-				'select' => 'date_format(updatetime,"%m-%d") as updatetime,COUNT(*) as count',
-				'where' => " date_sub(curdate(), INTERVAL 30 DAY) <= date(updatetime) and status=1" . $categoryCondition . $sidCondition,
-				'groupby' => 'date_format(updatetime,"%m-%d")',
-				'asArray' => true 
-		) );
+		$redisKey=date('Y-m-d').'SL_'.$redisCid.'_'.$redisSid;
+		$redisValue=$redis->get($redisKey);
+		if (empty($redisValue)){
+			$actionLogLongle = $action_log->find ( array (
+					'select' => 'date_format(updatetime,"%m-%d") as updatetime,COUNT(*) as count',
+					'where' => " date_sub(curdate(), INTERVAL 30 DAY) <= date(updatetime) and status=3" . $categoryCondition . $sidCondition,
+					'groupby' => 'date_format(updatetime,"%m-%d")',
+					'asArray' => true 
+			) );
 		
-		$actionLogLongle = $action_log->find ( array (
-				'select' => 'date_format(updatetime,"%m-%d") as updatetime,COUNT(*) as count',
-				'where' => " date_sub(curdate(), INTERVAL 30 DAY) <= date(updatetime) and status=3" . $categoryCondition . $sidCondition,
-				'groupby' => 'date_format(updatetime,"%m-%d")',
-				'asArray' => true 
-		) );
+			$statisticsLongle = array ();
+			for($d = 0; $d <= 29; $d ++) {
+				$MD = date ( "m-d", strtotime ( "-" . $d . " day" ) );
+				$falgLongle = true;
+				
+				foreach ( $actionLogLongle as $value ) {
+					if ($value ['updatetime'] == $MD) {
+						array_push ( $statisticsLongle, $value ['count'] );
+						$falgLongle = false;
+						break;
+					}
+				}
+				if ($falgLongle)
+					array_push ( $statisticsLongle, 0 );
+			}
+			$statisticsLongle = array_reverse ( $statisticsLongle );
+			$jsl=json_encode ( $statisticsLongle );
+			$redis->set($redisKey,$jsl);
+			$data ['statisticsLongle'] = $jsl;
+		}else{
+			$data ['statisticsLongle'] = $redisValue;
+		}
+			
+		//添加客户 数30天 
+		$redisKey=date('Y-m-d').'SC_'.$redisCid.'_'.$redisSid;
+		$redisValue=$redis->get($redisKey);
+		if (empty($redisValue)){
+			$actionLogClient = $action_log->find ( array (
+					'select' => 'date_format(updatetime,"%m-%d") as updatetime,COUNT(*) as count',
+					'where' => " date_sub(curdate(), INTERVAL 30 DAY) <= date(updatetime) and status=1" . $categoryCondition . $sidCondition,
+					'groupby' => 'date_format(updatetime,"%m-%d")',
+					'asArray' => true
+			) );
 		
-		// $actionLogClient=array();
-		// $actionLogLongle=array();
+			$statisticsClient = array ();
+			for($d = 0; $d <= 29; $d ++) {
+				$MD = date ( "m-d", strtotime ( "-" . $d . " day" ) );
+				$falgClient  = true;
+				
+				foreach ( $actionLogClient as $value ) {
+					if ($value ['updatetime'] == $MD) {
+						array_push ( $statisticsClient, $value ['count'] );
+						$falgClient = false;
+						break;
+					}
+				}
+				if ($falgClient)
+					array_push ( $statisticsClient, 0 );
+							
+			}
+			$statisticsClient = array_reverse ( $statisticsClient );
+			$jsc=json_encode ( $statisticsClient );
+			$redis->set($redisKey,$jsc);
+			$data ['statisticsClient'] = $jsc;
+		}else{
+			$data ['statisticsClient'] = $redisValue;
+		}
 		
 		$statisticsDay = array ();
-		$statisticsClient = $statisticsLongle = array ();
-		
 		for($d = 0; $d <= 29; $d ++) {
 			$MD = date ( "m-d", strtotime ( "-" . $d . " day" ) );
-			$falgClient = $falgLongle = true;
 			array_push ( $statisticsDay, $MD );
-			foreach ( $actionLogClient as $value ) {
-				if ($value ['updatetime'] == $MD) {
-					array_push ( $statisticsClient, $value ['count'] );
-					$falgClient = false;
-					break;
-				}
-			}
-			if ($falgClient)
-				array_push ( $statisticsClient, 0 );
-			
-			foreach ( $actionLogLongle as $value ) {
-				if ($value ['updatetime'] == $MD) {
-					array_push ( $statisticsLongle, $value ['count'] );
-					$falgLongle = false;
-					break;
-				}
-			}
-			if ($falgLongle)
-				array_push ( $statisticsLongle, 0 );
 		}
-		// print_r($actionLogLongle);
-		$statisticsClient = array_reverse ( $statisticsClient );
-		$statisticsLongle = array_reverse ( $statisticsLongle );
 		$statisticsDay = array_reverse ( $statisticsDay );
 		
-		// / Year(updatetime)=".date('Y')." and Month(updatetime)=".date('m')." and
-		$categoryList = $lcategory->find ( array (
-				'asArray' => true 
-		) );
-		$CategoryClient = $action_log->find ( array (
-				'select' => 'cid,COUNT(*) as count,city',
-				'where' => " date_sub(curdate(), INTERVAL 30 DAY) <= date(updatetime) and status=1" . $categoryCondition . $sidCondition,
-				'groupby' => 'cid',
-				'asArray' => true 
-		) );
 		
-		// or status=2
-		$CategoryCompany = $action_log->find ( array (
-				'select' => 'cid, COUNT(*) as count,company,districtid',
-				'where' => " date_sub(curdate(), INTERVAL 30 DAY) <= date(updatetime) and (status=1 )" . $categoryCondition . $sidCondition,
-				'groupby' => 'cid,districtid,company',
-				'asArray' => true 
-		) );
 		
-		$natureList = $action_log->find ( array (
-				'select' => 'cid, COUNT(*) as count,nature',
-				'where' => " date_sub(curdate(), INTERVAL 30 DAY) <= date(updatetime) and status=1 and nature !=''" . $categoryCondition . $sidCondition,
-				'groupby' => 'nature',
+		
+		
+		
+		// / Year(updatetime)=".date('Y')." and Month(updatetime)=".date('m')." and
+		$categoryList = $lcategory->find ( array (
 				'asArray' => true 
 		) );
 		
-		$statisticsCategory = array ();
-		$statisticsCompany = array ();
-		foreach ( $categoryList as $value ) {
-			$falgClient = $falgLongle = true;
-			foreach ( $CategoryClient as $v ) {
-				if ($value ['cid'] == $v ['cid'] && $v ['cid'] != 12) {
+		//最近30天区域分布图
+		$redisKey=date('Y-m-d').'SCCT_'.$redisCid.'_'.$redisSid;
+		$redisValue=$redis->lrange($redisKey, 0, -1);
+		if (empty($redisValue)){
+			$CategoryClient = $action_log->find ( array (
+					'select' => 'cid,COUNT(*) as count,city',
+					'where' => " date_sub(curdate(), INTERVAL 30 DAY) <= date(updatetime) and status=1" . $categoryCondition . $sidCondition,
+					'groupby' => 'cid',
+					'asArray' => true 
+			) );
+			$CategoryCompany = $action_log->find ( array (
+					'select' => 'cid, COUNT(*) as count,company,districtid',
+					'where' => " date_sub(curdate(), INTERVAL 30 DAY) <= date(updatetime) and (status=1 )" . $categoryCondition . $sidCondition,
+					'groupby' => 'cid,districtid,company',
+					'asArray' => true 
+			) );
+			$statisticsCategory = array ();
+			$statisticsCompany = array ();
+			foreach ( $categoryList as $value ) {
+				$falgClient = $falgLongle = true;
+				foreach ( $CategoryClient as $v ) {
+					if ($value ['cid'] == $v ['cid'] && $v ['cid'] != 12) {
+						array_push ( $statisticsCategory, array (
+								'value' => $v ['count'],
+								'name' => str_replace ( "办", "省", $value ['title'] ) 
+						) );
+						$falgClient = false;
+						break;
+					}
+				}
+				if ($falgClient) {
+					
 					array_push ( $statisticsCategory, array (
-							'value' => $v ['count'],
+							'value' => 0,
 							'name' => str_replace ( "办", "省", $value ['title'] ) 
 					) );
-					$falgClient = false;
-					break;
 				}
-			}
-			if ($falgClient) {
 				
-				array_push ( $statisticsCategory, array (
-						'value' => 0,
+				// company statistics
+				$i = 0;
+				foreach ( $CategoryCompany as $v ) {
+					if ($value ['cid'] == $v ['cid'] && $v ['cid'] != 12) {
+						$i ++;
+					}
+				}
+				array_push ( $statisticsCompany, array (
+						'value' => $i,
 						'name' => str_replace ( "办", "省", $value ['title'] ) 
 				) );
 			}
 			
-			// company statistics
-			$i = 0;
-			foreach ( $CategoryCompany as $v ) {
-				if ($value ['cid'] == $v ['cid'] && $v ['cid'] != 12) {
-					$i ++;
-				}
-			}
-			array_push ( $statisticsCompany, array (
-					'value' => $i,
-					'name' => str_replace ( "办", "省", $value ['title'] ) 
-			) );
+			$scctA=json_encode ( $statisticsCompany );
+			$scctB=json_encode ( $statisticsCategory );
+			$redis->lpush($redisKey, $scctA);
+			$redis->lpush($redisKey, $scctB);
+			$data ['statisticsCompany'] = $scctA;
+			$data ['statisticsCategory'] = $scctB;
+		}else{
+			$data ['statisticsCompany'] = $redisValue[1];
+			$data ['statisticsCategory'] = $redisValue[0];
 		}
+		
+		
+		
 		// print_r($CategoryClient);
-		$statisticsNature = array ();
-		foreach ( $this->nature as $value ) {
-			$flagNature = true;
-			foreach ( $natureList as $v ) {
-				if ($value == $v ['nature']) {
+		
+		$redisKey=date('Y-m-d').'SN_'.$redisCid.'_'.$redisSid;
+		$redisValue=$redis->get($redisKey);
+		if (empty($redisValue)){
+			$natureList = $action_log->find ( array (
+					'select' => 'cid, COUNT(*) as count,nature',
+					'where' => " date_sub(curdate(), INTERVAL 30 DAY) <= date(updatetime) and status=1 and nature !=''" . $categoryCondition . $sidCondition,
+					'groupby' => 'nature',
+					'asArray' => true
+			) );
+			$statisticsNature = array ();
+			foreach ( $this->nature as $value ) {
+				$flagNature = true;
+				foreach ( $natureList as $v ) {
+					if ($value == $v ['nature']) {
+						array_push ( $statisticsNature, array (
+								'value' => $v ['count'],
+								'name' => $value 
+						) );
+						$flagNature = false;
+						break;
+					}
+				}
+				if ($flagNature)
 					array_push ( $statisticsNature, array (
-							'value' => $v ['count'],
+							'value' => 0,
 							'name' => $value 
 					) );
-					$flagNature = false;
-					break;
-				}
 			}
-			if ($flagNature)
-				array_push ( $statisticsNature, array (
-						'value' => 0,
-						'name' => $value 
-				) );
+			
+			$jsn=json_encode ( $statisticsNature );
+			$redis->set($redisKey,$jsn);
+			$data ['statisticsNature'] = $jsn;
+		}else{
+			$data ['statisticsNature'] = $redisValue;
 		}
 		
-		// print_r($max2);//die;
-		$data ['statisticsNature'] = json_encode ( $statisticsNature );
-		$data ['statisticsCompany'] = json_encode ( $statisticsCompany );
-		$data ['statisticsCategory'] = json_encode ( $statisticsCategory );
 		
 		$data ['statisticsDay'] = json_encode ( $statisticsDay );
-		$data ['statisticsClient'] = json_encode ( $statisticsClient );
-		$data ['statisticsLongle'] = json_encode ( $statisticsLongle );
 		$data ['categorylist2'] = $categorylist2;
-		
 		$data ['Ssum'] = round ( ($Ssum / $Rsum) * 100 ) . '%';
 		$data ['Rsum'] = $Rsum;
 		$data ['useL2'] = $useL2;

+ 5 - 2
protected/controller/MobileController.php

@@ -1061,13 +1061,16 @@ class MobileController extends DooController {
 			
 		}elseif($status==4){
 			
+			//$sellClient = 
+			
 			$product=isset($_POST['sellProduct'])?$_POST['sellProduct']:"";
-			$client=isset($_POST['sellClient'])?$_POST['sellClient']:"";
+			$client=$this->get_args ( 'sellClient' ) ? $this->get_args ( 'sellClient' ) : "";//isset($_POST['sellClient'])?$_POST['sellClient']:"";
 			$client=explode('-', $client);
+			
 			$clientname=$clientobj->getClientByName2($client[0],$client[1]);
 			
 			if(empty($clientname)){
-				echo json_encode(array('status'=>2,'msg'=>''));die;
+				echo json_encode(array('status'=>2,'msg'=>'not found client'));die;
 			}
 			if($client[0]!=""){
 				$longle->client=$client[0];

+ 17 - 3
protected/controller/ReceiptController.php

@@ -137,6 +137,9 @@ class ReceiptController extends DooController {
 		
 		Doo::loadModel ( "receiptLog" );
 		$receiptLog = new receiptLog ();
+		Doo::loadClass ( 'XDeode' );
+		$XDeode = new XDeode ( 7 );
+		
 		
 		$receiptLogList = $receiptLog->getReceiptLogByUid ( $this->staff [0] ['sid'] );
 		
@@ -146,7 +149,10 @@ class ReceiptController extends DooController {
 				'asArray' => true 
 		) );
 		
+		
+		
 		foreach ( $receiptDetail as $key => $value ) {
+			$receiptDetail [$key]['ridKey']=$XDeode->encode ( $value['rid'] );
 			$receiptDetail [$key] ['accountItem'] = json_decode ( $value ['accountItem'], true );
 			
 			$veList = $verify->getOne ( array (
@@ -5946,8 +5952,16 @@ class ReceiptController extends DooController {
 	}
 	function editReceipt() {
 		// edit status 4
-		$rid = isset ( $this->params ['rid'] ) && is_numeric ( $this->params ['rid'] ) ? $this->params ['rid'] : 0;
-		// echo $rid;
+		$rid = isset ( $this->params ['rid'] )  ? $this->params ['rid'] : '';
+		
+		Doo::loadClass ( 'XDeode' );
+		$XDeode = new XDeode ( 7 );
+		$rid = $XDeode->decode ( $rid );
+		
+		if (empty ( $rid ))
+			die ( 'illegal request' );
+		
+		// echo $rid.'sd';
 		Doo::loadModel ( 'accountItem' );
 		Doo::loadModel ( 'verify' );
 		Doo::loadModel ( 'receipt' );
@@ -5964,7 +5978,7 @@ class ReceiptController extends DooController {
 				'asArray' => true 
 		) );
 		if (empty ( $receiptDetail ))
-			return "/saeaCreate";
+			die ( 'illegal request' );
 		
 		$acItem = $accountItem->find ( array (
 				'asArray' => true 

+ 5 - 1
protected/model/invoice.php

@@ -181,6 +181,7 @@ class invoice extends DooModel {
 	 */
 	public $date;
 	public $isDelete;
+	public $approvalTime;
 	/**
 	 *
 	 * @var date $updateTime 更新时间
@@ -246,6 +247,7 @@ class invoice extends DooModel {
 			'printer',
 			'date',
 			'isDelete',
+			'approvalTime',
 			'updateTime',
 			'printTime',
 			'postTime',
@@ -737,7 +739,7 @@ class invoice extends DooModel {
 		$list = $this->find ( array (
 				'where' => $con,
 				'limit' => $limit,
-				$desc => 'iid',
+				$desc => 'approvalTime',
 				'asArray' => TRUE 
 		) );
 		Doo::loadClass ( 'XDeode' );
@@ -768,6 +770,8 @@ class invoice extends DooModel {
 				$list [$key] ['operationLog'] = $invoiceOperationLog->getInvoiceOperationByStatus ( $value ['iid'], $olStatus );
 			
 			$list [$key] ['OperationLog'] = $invoiceOperationLog->getInvoiceOperationByStatus ( $value ['iid'], 6 );
+			$list [$key] ['OL'] = $invoiceOperationLog->getInvoiceOperationInStatus($value ['iid'], '2,3,4');
+			
 			//print_r($list [$key] ['OperationLog']);
 			$list [$key] ['sumPrice'] = 0;
 			if (! empty ( $list [$key] ['irList'] ))

+ 9 - 0
protected/model/invoiceOperationLog.php

@@ -138,6 +138,15 @@ class invoiceOperationLog extends DooModel {
 		return $list;
 	}
 	
+	public function getInvoiceOperationInStatus($iid = 0, $status = '0'){
+		$list = $this->getOne ( array (
+				'where' => 'iid=' . $iid . ' and status in(' . $status.')',
+				'desc' => 'lid',
+				'asArray' => true
+		) );
+		return $list;
+	}
+	
 	/**
 	 * 根据状态和发票ID获得一条最新的操作日志
 	 * @param number $iid

+ 90 - 11
protected/model/invoiceReceivables.php

@@ -14,6 +14,8 @@ class invoiceReceivables extends DooModel {
 	public $untreadStatus;
 	public $untreadStaff;
 	public $iid;
+	public $iidExtend;
+	public $bindPrice;
 	public $receivablesPrice;
 	public $receivablesSerial;
 	public $receivablesMessage;
@@ -39,6 +41,8 @@ class invoiceReceivables extends DooModel {
 			'untreadStatus',
 			'untreadStaff',
 			'iid',
+			'iidExtend',
+			'bindPrice',
 			'receivablesPrice',
 			'receivablesSerial',
 			'receivablesMessage',
@@ -54,8 +58,8 @@ class invoiceReceivables extends DooModel {
 			'confirmTime',
 			'bindDate',
 			'unbundlingTime',
-			'accountClerk' ,
-			'sourcePrice'
+			'accountClerk',
+			'sourcePrice' 
 	);
 	public function getSumOfReceivablesPrice($iridString = "") {
 		if (empty ( $iridString ))
@@ -67,8 +71,8 @@ class invoiceReceivables extends DooModel {
 				'groupby' => 'iid',
 				'asArray' => TRUE 
 		) );
-		//echo " irid in ( " . $iridString . " )";
-		//echo $list ['receivablesPrice'].'sdsdf';
+		// echo " irid in ( " . $iridString . " )";
+		// echo $list ['receivablesPrice'].'sdsdf';
 		if (empty ( $list ))
 			return 0;
 		return $list ['receivablesPrice'];
@@ -120,6 +124,39 @@ class invoiceReceivables extends DooModel {
 		
 		return $list;
 	}
+	
+	/**
+	 * 获得部分入账的收款
+	 */
+	function getInvoiceReceivablesByHalf() {
+		$sql = 'select group_concat(b.invoiceSerial) as invoiceSerial ,group_concat(b.iid) as invoiceId ,a.*
+				from ' . $this->_table . ' as a left join CLD_invoice as b on
+				find_in_set(b.iid,a.iidExtend) or a.iid=b.iid 
+				where a.bindStatus=0 and a.iid!=0 
+				';
+		$query = Doo::db ()->query ( $sql );
+		$list = $query->fetchAll ();
+		
+		if ($list [0] ['irid'] == NULL) {
+			return array ();
+		}
+		
+		Doo::loadClass ( 'XDeode' );
+		$XDeode = new XDeode ( 5 );
+		
+		foreach ( $list as $key => $value ) {
+			$list [$key] ['uPrice'] = $value ['receivablesPrice'] - $value ['bindPrice'];
+			$invoiceSerial = explode ( ',', $value ['invoiceSerial'] );
+			$invoiceId = explode ( ",", $value ['invoiceId'] );
+			foreach ( $invoiceId as $k => $v ) {
+				$invoiceId [$k] = $XDeode->encode ( $v );
+			}
+			$list [$key] ['invoiceList'] = array_combine ( $invoiceId, $invoiceSerial );
+			
+			$list [$key] ['iridAuthKey'] = $this->authcode ( $value ['irid'], '' );
+		}
+		return $list;
+	}
 	public function getInvoiceReceivablesByClaim($cid = 0, $sid = 0) {
 		if (! empty ( $cid )) {
 			$list ['csClaim'] = $this->find ( array (
@@ -177,7 +214,7 @@ class invoiceReceivables extends DooModel {
 			$invoice = new invoice ();
 			Doo::loadClass ( 'XDeode' );
 			$XDeode = new XDeode ( 5 );
-			//print_r($list ['bindClaim']);
+			// print_r($list ['bindClaim']);
 			foreach ( $list ['bindClaim'] as $key => $value ) {
 				$id = $invoice->getInvoiceByIid ( $value ['iid'] );
 				$id ['iidKeyUrl'] = $XDeode->encode ( $value ['iid'] );
@@ -293,12 +330,12 @@ class invoiceReceivables extends DooModel {
 						'where' => " irid=" . $irid . " and receivablesStaff like '" . $sid . "_%'",
 						'asArray' => TRUE 
 				) );
-			else 
+			else
 				$detail = $this->getOne ( array (
-						'where' => " irid=" . $irid ,
-						'asArray' => TRUE
+						'where' => " irid=" . $irid,
+						'asArray' => TRUE 
 				) );
-				
+			
 			$detail ['sid'] = '';
 			$detail ['username'] = '';
 			if (! empty ( $detail ['receivablesStaff'] )) {
@@ -361,6 +398,49 @@ class invoiceReceivables extends DooModel {
 		}
 		return $list;
 	}
+	
+	function getInvoiceReceivablesByConditionPage($limit = 0, $con = "", $desc = 'desc', $descField = 'irid') {
+		if (empty ( $limit ))
+			return array ();
+		
+		$sql = 'select group_concat(b.invoiceSerial) as invoiceSerial ,group_concat(b.iid) as invoiceId ,a.*,b.invoicePrice
+				from ' . $this->_table . ' as a left join CLD_invoice as b on
+				   find_in_set(b.iid,a.iidExtend) or a.iid=b.iid 
+				where ' . $con . ' group by a.irid ORDER BY  ' . $descField . ' '.$desc.' limit ' . $limit . '
+				';
+
+		$query = Doo::db ()->query ( $sql );
+		$list = $query->fetchAll ();
+		
+		Doo::loadClass ( 'XDeode' );
+		$XDeode = new XDeode ( 5 );
+		Doo::loadModel ( 'invoiceROLog' );
+		$invoiceROLog = new invoiceROLog ();
+		
+		foreach ( $list as $key => $value ) {
+			
+			$invoiceSerial = explode ( ',', $value ['invoiceSerial'] );
+			$invoiceId = explode ( ",", $value ['invoiceId'] );
+			if (empty($invoiceSerial[0]))
+				$list [$key] ['invoiceList'] =array();
+			else{
+				foreach ( $invoiceId as $k => $v ) {
+					if (!empty($v))
+						$invoiceId [$k] = $XDeode->encode ( $v );
+				}
+				$list [$key] ['invoiceList'] = array_combine ( $invoiceId, $invoiceSerial );
+			}
+			
+			$list [$key] ['iridKeyK'] = $XDeode->encode ( $value ['irid'] );
+			$list [$key] ['iridKey'] = $this->authcode ( $value ['irid'], '' );
+
+			$list [$key] ['irolg'] = $invoiceROLog->getInvoiceROLogByIrid ( $value ['irid'], 'desc' );
+		}
+		//print_r($list);
+		
+		return $list;
+	}
+	
 	function getReceivablesByUntreadStatusPage($limit = 0, $con = "", $desc = 'desc', $descField = 'irid') {
 		if (empty ( $limit ))
 			return array ();
@@ -375,8 +455,7 @@ 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'] );

+ 11 - 1
protected/model/invoiceTraining.php

@@ -80,12 +80,14 @@ class invoiceTraining extends DooModel {
 		if (!empty($itid))
 			$itidCondition=' and a.trainId in ('.$itid.') ';
 		$sql = 'select sum(b.receivablesPrice) as receivablesPrice ,a.trainId,count(*) as count
-				from CLD_invoice as a left join CLD_invoiceReceivables as b on find_in_set(a.irid,b.irid)
+				from CLD_invoice as a left join CLD_invoiceReceivables as b on find_in_set(b.irid,a.irid)
 				where  a.status=2 and a.printStatus=1 and (a.untreadStatus =0 or a.untreadStatus=3) and a.irid!="" '.$itidCondition.'
 				GROUP BY a.status';
 		$query = Doo::db ()->query ( $sql );
 		$result = $query->fetchAll ();
 		
+		
+		
 		if (! empty ( $result )) {
 			$detail += array (
 					'receivablesPrice' => $result [0] ['receivablesPrice'] 
@@ -259,6 +261,14 @@ class invoiceTraining extends DooModel {
 			$this->delete ( array (
 					'where' => 'itid=' . $itid 
 			) );
+		//删除培训班下的发票
+		Doo::loadModel ( 'invoiceStore' );
+		$invoiceStore = new invoiceStore ();
+		
+		$invoiceStore->delete(array (
+				'where' => 'trainId=' . $itid
+		));
+		
 	}
 }
 

+ 4 - 4
protected/view/admin/invoiceApprovalAchieve.html

@@ -61,14 +61,14 @@
 							
 							<td>{{list' value.categoryName}}{{list' value.userName}} {{list' value.date}}</td>
 							<td>
-							  <!-- if {{ilist' value.operationLog.status}}==2 -->
+							  <!-- if {{ilist' value.OL.status}}==2 -->
                                     <span class="colGreen">同意</span> 
-                                   <!-- elseif {{ilist' value.operationLog.status}}==3 -->
+                                   <!-- elseif {{ilist' value.OL.status}}==3 -->
                                    <span class="colOrange">退回</span>
-                                   <!-- elseif {{ilist' value.operationLog.status}}==4 -->
+                                   <!-- elseif {{ilist' value.OL.status}}==4 -->
                                    <span class="colRed">终止</span>
                                    <!-- endif -->
-                                    	{{ilist' value.operationLog.username}} {{ilist' value.operationLog.date}}
+                                    	{{ilist' value.OL.username}} {{ilist' value.OL.date}}
 							</td>
 							
 						</tr>

+ 13 - 7
protected/view/admin/invoiceMenu.html

@@ -8,9 +8,6 @@
 培训班发票</a></li>
 <li><a <!-- if {{receiptMemu}}=="invoiceMyReceivables" --> class="selected" <!-- endif --> href="/invoiceMyReceivables">
 我的收款</a></li>
-
-
-
 	<li><a <!-- if {{receiptMemu}}=="invoiceReceivablesClaim" --> class="selected" <!-- endif --> href="/invoiceReceivablesClaim">收款认领</a></li>
 
 
@@ -58,7 +55,7 @@
 				<table class="table table-bordered table-condensed">
 					<tbody>
 					<tr>
-						<th class="taC" width="100">如何申请开票</th>
+						<th class="taC" width="120">如何申请开票</th>
 						<td class="taC"><a target="_Blank" href="http://cld.smartcost.com.cn/global/handbook/如何申请开票使用教程.pdf">在线查阅《如何申请开票使用手册》</a></td>
 					</tr>
 					</tbody>
@@ -66,7 +63,7 @@
 				<table class="table table-bordered table-condensed">
 					<tbody>
 					<tr>
-						<th class="taC" width="100">开票进度跟踪</th>
+						<th class="taC" width="120">开票进度跟踪</th>
 						<td class="taC"><a target="_Blank" href="http://cld.smartcost.com.cn/global/handbook/开票进度跟踪使用教程.pdf">在线查阅《开票进度跟踪使用手册》</a></td>
 					</tr>
 					</tbody>
@@ -74,7 +71,7 @@
 				<table class="table table-bordered table-condensed">
 					<tbody>
 					<tr>
-						<th class="taC" width="100">如何申请退票</th>
+						<th class="taC" width="120">如何申请退票</th>
 						<td class="taC"><a target="_Blank" href="http://cld.smartcost.com.cn/global/handbook/如何申请退票使用教程.pdf">在线查阅《如何申请退票使用手册》</a></td>
 					</tr>
 					</tbody>
@@ -82,11 +79,20 @@
 				<table class="table table-bordered table-condensed">
 					<tbody>
 					<tr>
-						<th class="taC" width="100">收款跟踪</th>
+						<th class="taC" width="120">收款跟踪</th>
 						<td class="taC"><a target="_Blank" href="http://cld.smartcost.com.cn/global/handbook/收款跟踪使用教程.pdf">在线查阅《收款跟踪使用手册》</a></td>
 					</tr>
 					</tbody>
 				</table>
+				<table class="table table-bordered table-condensed">
+					<tbody>
+					<tr>
+						<th class="taC" width="120">如何申请培训班开票</th>
+						<td class="taC"><a target="_Blank" href="http://cld.smartcost.com.cn/global/handbook/如何申请培训班开票使用教程.pdf">在线查阅《如何申请培训班开票使用手册》</a>&nbsp;
+						<a target="_Blank" href="http://cld.smartcost.com.cn/upload/invoiceTraining/%E5%9F%B9%E8%AE%AD%E7%8F%AD%E6%A8%A1%E6%9D%BF.xlsx">培训班Excel模版下载</a></td>
+					</tr>
+					</tbody>
+				</table>
 		    </div>
 			<div class="modal-footer">
 			    <a href="#" class="button btn-gray" data-dismiss="modal" aria-hidden="true">关闭</a>

+ 7 - 3
protected/view/admin/invoicePrintStayAchieve.html

@@ -60,7 +60,7 @@
 				<div class="saeaList">
 					<table class="table table-hover">
 						<tbody>
-						<tr class="thead"><th>开票流水号</th><th>开票单位(抬头)</th> <th>纳税人识别码</th> <th>注册地址`电话</th><th>开户银行`账号</th> <th>数量</th><th>单价</th> <th>开票金额</th><th>提交开票</th><th>发票号</th><th>打印发票</th></tr>
+						<tr class="thead"><th>开票流水号</th><th>开票单位(抬头)</th> <th>纳税人识别码</th> <th>注册地址`电话</th><th>开户银行`账号</th> <th>备注</th><th>开票内容</th> <th>数量</th><th>单价</th> <th>开票金额</th><th>提交开票</th><th>发票号</th><th>打印发票</th></tr>
 						
 						<!-- loop list -->
 						<tr>
@@ -75,6 +75,10 @@
 	                          <td>{{list' value.address}} {{list' value.phone}}</td>             
 	                           <td>{{list' value.bank}} {{list' value.bankAccount}}</td>                      
 	                                
+	                                 <td>{{list' value.remark}}</td>    
+	                         <td>{{list' value.invoiceElement}}</td>  
+	                                
+	                                
 	                         <td>{{list' value.invoiceQuantity}}</td>    
 	                         <td>{{list' value.invoiceUnitPrice}}</td>           
 	                                    
@@ -94,9 +98,9 @@
 							</td>
 							<td>
 							<!-- if {{list' value.printStatus}}==0 -->
-							<a class="button btn-block" node-invoice='PRINT' data-isKey="{{pendingInvoice' value.iidKeyK}}" href="#printInvice" data-toggle="modal">打印发票</a>
+							<a  node-invoice='PRINT' data-isKey="{{pendingInvoice' value.iidKeyK}}" href="#printInvice" data-toggle="modal">打印发票</a>
 							<!-- else -->
-							{{invoiceList' value.lastApprover.username}}&nbsp;{{invoiceList' value.printTime}}
+							{{invoiceList' value.operationLog.username}}&nbsp;{{invoiceList' value.printTime}}
 							<!-- endif -->
 							</td>
 						</tr>

+ 31 - 0
protected/view/admin/invoiceReceivables.html

@@ -205,6 +205,37 @@
 						</div>
 						
 						
+						<div class="clearfix">
+							<legend><div class="fR"><a href="/invoiceReceivablesAS">查看所有</a></div>部分入账收款({{halfCount}})</legend>
+							<!-- if !empty({{halfList}}) -->
+							<table class="table table-bordered table-condensed">
+									<tbody>
+									<tr><th class="taC" width="70">收款金额</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="120">绑定发票</th></tr>
+									<!-- loop halfList -->
+									<tr>
+										<td><b>¥{{halfList' value.receivablesPrice}}</b></td>
+										<td>{{halfList' value.receivablesMessage}}</td>
+										<td>{{halfList' value.receivablesBank}}<br>{{halfList' value.receivablesDate}}</td>
+										<td><b>¥{{halfList' value.bindPrice}}</b></td>
+										<td><b>¥{{halfList' value.uPrice}}</b></td>
+										<td>
+										<!-- loop halfList' value.invoiceList -->
+										<a href="#invdetail" node-invoice='INFO' data-isKey="{{halfList' value' key}}" data-toggle="modal">{{halfList' value' value}}</a>&nbsp;
+										<!-- endloop -->
+										</td>
+										<td>
+										<a class="button btn-block" href="#search-invoice" bind-invoice='receivables' node-key="{{halfList' value.iridAuthKey}}" data-toggle="modal">查询发票</a>
+										
+									</tr>
+									<!-- endloop -->
+									</tbody>
+								</table>
+								<!-- else -->
+							<blockquote><p class="colGray">暂时没有部分入账收款</p></blockquote>
+							<!-- endif -->
+						</div>
+						
+						
 					</div>
 				</div>
 			</div>

+ 14 - 2
protected/view/admin/invoiceReceivablesAS.html

@@ -93,7 +93,11 @@
 						<!-- endif -->
 						</td>
 						<td>
-						<a href="#invdetail" node-invoice='INFO' data-isKey="{{list' value.iidKeyK}}"  data-toggle="modal">{{list' value.irList.invoiceSerial}}</a>
+						<!-- loop list' value.invoiceList -->
+							<a href="#invdetail" node-invoice='INFO' data-isKey="{{halfList' value' key}}" data-toggle="modal">{{halfList' value' value}}</a>&nbsp;
+						<!-- endloop -->
+						
+						
 						</td>
 						<td>
 						<!-- if {{list' value.receivablesStaff}}=='PUBLIC'&&{{list' value.iid}}==0 -->
@@ -163,6 +167,8 @@
 
 
 <div class="modal hide fade" id="Unbundling" >
+
+
 <form action="/invoiceUnBundLing" method="post" class="form-horizontal">
 <input type="hidden" name="unBundKey" id="unBundKey" value >
 	<div class="modal-dialog">
@@ -171,7 +177,13 @@
     <h3>收款与发票解绑</h3>
     </div>
     <div class="modal-body">
-			解绑后,发票与收款 可重新进行新的入账。
+		<p>解绑后,发票与收款 可重新进行新的入账。</p>
+			<table class="table table-bordered">
+			<tbody>
+				<tr><td>#F20160316001</td><td>¥1000.00</td><td>珠海纵横公司</td><td>纵横公路工程造价管理系统V9.0</td><td><input type="radio"></td></tr>
+				<tr><td>#F20160316003</td><td>¥1000.00</td><td>珠海纵横公司</td><td>纵横公路工程造价管理系统V9.0</td><td><input type="radio"></td></tr>
+			</tbody>
+			</table>
     </div>
 	<div class="modal-footer">
 	<input type="submit" class="button" value="确认解绑">

+ 92 - 60
protected/view/admin/invoiceTrainingDetail.html

@@ -9,8 +9,16 @@
 <link rel=stylesheet href="<?= WEB_SITE_GLOBAL ?>js/DataTables/jquery.dataTables.css"> 
 <script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>js/DataTables/jquery.dataTables.min.js"></script>
 
+<script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>js/dataTables.fixedColumns.min.js"></script>
 
 
+<style type="text/css"> 
+ div.dataTables_wrapper {
+        width: 100%;
+    }
+table.DTFC_Cloned thead,table.DTFC_Cloned tfoot{background-color:white}div.DTFC_Blocker{background-color:white}div.DTFC_LeftWrapper table.dataTable,div.DTFC_RightWrapper table.dataTable{margin-bottom:0;z-index:2}div.DTFC_LeftWrapper table.dataTable.no-footer,div.DTFC_RightWrapper table.dataTable.no-footer{border-bottom:none}
+</style> 
+
 <script type="text/javascript">
 		var swfu;
 
@@ -102,14 +110,18 @@
 	  			</form>
 	  		</div>
 				<div class="saeaList">
-					<table class="table table-hover" id="table_id_example">
+					<table id="example" class="stripe row-border order-column" cellspacing="0" width="2400" >
 						<thead>
-							<tr class="thead">
-							<th width="25"></th>
-							<th>操作</th>
+							<tr >
+							
+							<th width="64">操作</th>
 							<th>开票流水号</th>
 							<th>开票单位(抬头)</th>
 							<th>纳税人识别码</th>
+							
+							<th>邮寄物品</th>
+							<th>邮寄地址</th>
+							
 							<th>注册地址、电话</th>
 							<th>开户银行及账号</th>
 							<th>开票内容</th>
@@ -117,8 +129,7 @@
 							<th>单价</th>
 							<th>总额</th>
 							<th>发票备注</th>
-							<th>邮寄物品</th>
-							<th>邮寄地址</th>
+							
 							
 							
 							<th>状态</th>
@@ -128,54 +139,9 @@
 							</tr>
 						</thead>
 						<tbody>
-							<!--处理中/已完成发票/退票-->
-						
-							<!--还未设置邮寄物品的发票-->
-						<tr class="warning">
-							<td><input type="checkbox" disabled></td>
-							<td><a href="invoice-batch-edit.html">编辑</a> <a href="#confirm-erro" data-toggle="modal">提交审批</a> <a href="#del" data-toggle="modal" class="colRed">移除</a></td>
-							<td></td>
-							<td>珠海XXXX公司</td>
-							<td>1212123123123</td>
-							<td>广东省珠海市香洲区银桦路8号24D0756-34324</td>
-							<td>广发银行234324234</td>
-							<td>纵横公路工程造价管理系统V9.0</td>
-							<td>1</td>
-							<td>¥9800.00</td>
-							<td><b>¥9800.00</b><sup>专</sup></td>
-							<td></td>
-							<td><a href="#">设置邮寄物品</a></td>
-							<td>珠海市银桦路8号深发展大厦24D 陈特 12345677898</td>
-							<td>已出票</td>
-							<td>NO.12123</td>
-							<td>2016-03-03<br>11:30:03</td>
-							<td></td>
-						</tr>
-							<!--待提交审批的发票-->
-						<tr>
-							<td><input type="checkbox"></td>
-							<td><a href="invoice-batch-edit.html">编辑</a> <a href="#confirm" data-toggle="modal">提交审批</a> <a href="#del" data-toggle="modal" class="colRed">移除</a></td>
-							<td></td>
-							<td>珠海XXXX公司</td>
-							<td>1212123123123</td>
-							<td>广东省珠海市香洲区银桦路8号24D0756-34324</td>
-							<td>广发银行234324234</td>
-							<td>纵横公路工程造价管理系统V9.0</td>
-							<td>1</td>
-							<td>¥9800.00</td>
-							<td><b>¥9800.00</b><sup>专</sup></td>
-							<td></td>
-							<td>发票、软件锁*1</td>
-							<td>珠海市银桦路8号深发展大厦24D 陈特 12345677898</td>
-							<td>已出票</td>
-							<td>NO.12123</td>
-							<td>2016-03-03<br>11:30:03</td>
-							<td></td>
-						</tr>
-						</tbody>
-						<tfoot>
 							
-						</tfoot>
+						</tbody>
+						
 					</table>
 				</div>
 				<!--翻页-->
@@ -481,7 +447,7 @@
 					</div>
 					<div class="modal-body saeaList">
 						<table class="table table-bordered table-condensed">
-							<tr><th class="taC" width="150">Excel模板</th><td><a href="#">下载</a></td></tr>
+							<tr><th class="taC" width="150">Excel模板</th><td><a href="/upload/invoiceTraining/培训班模板.xlsx">下载</a></td></tr>
 							<tr><th class="taC" width="150">选择Excel文件</th>
 							<td>
 						<div class="controls">
@@ -511,13 +477,14 @@
 			</form>
 			</div>
 					<!--导入-->
-<script type="text/javascript">autoFlashHeight();
+<script type="text/javascript">//autoFlashHeight();
 $(document).ready( function () {
 	
 	var data = {{trainlistJson}}
 	
 	
-    $('#table_id_example').DataTable({
+	var table =$('#example').DataTable({
+		data:data,
     	language: {
     		"sProcessing": "处理中...",
     		"sLengthMenu": "显示 _MENU_ 项结果",
@@ -532,11 +499,76 @@ $(document).ready( function () {
     	        },
     		 "sInfo": "显示第 _START_ 至 _END_ 项结果,共 _TOTAL_ 项",
     	},
-    	//serverSide: true,
     	
-    data:data	
-    }
-    );
+    	
+    	
+    	
+    	
+    	scrollY:        "700px",
+        scrollX:        true,
+        scrollCollapse: true,
+        paging:         true,
+    	
+//     	fixedColumns:   {
+//             leftColumns: 3
+//         }
+    	
+    	
+    });
+	
+	 $('#example tbody').on( 'click', 'tr', function () {
+	
+		var input=$(this).children("td:eq(0)").find("input");
+		var inputDis=input.attr('disabled');
+		
+		if(inputDis!='disabled'){
+			var id=input.val();
+			
+			if($("#"+id).prop("checked")){
+			    $("#"+id).prop("checked",false);
+			  }else{
+			    $("#"+id).prop("checked",true);
+			  }
+			
+			$(this).toggleClass('selected');
+		}
+
+	    } );
+	
+	 $("a[node-store=batchDel]").click(function() {
+			
+			var id_array=new Array();  
+			$('input[name="isBox"]:checked').each(function(){  
+			
+			    id_array.push($(this).val());//向数组中添加元素  
+			});  
+			var idstr=id_array.join(',');//将数组元素连接起来以构建一个字符串  
+			$("input[id=batchStoreKey]").val(idstr);
+			
+		});
+	 
+	 $("a[node-store=batchMail]").click(function() {
+			
+			var id_array=new Array();  
+			$('input[name="isBox"]:checked').each(function(){  
+			    id_array.push($(this).val());
+			});  
+			var idstr=id_array.join(',');
+			$("input[id=BatchMailStoreKey]").val(idstr);
+			
+		});
+		$("a[node-store=batchApproval]").click(function() {
+			
+			var id_array=new Array();  
+			$('input[name="isBox"]:checked').each(function(){  
+			    id_array.push($(this).val());
+			});  
+			var idstr=id_array.join(',');
+			$("input[id=appBatchStoreKey]").val(idstr);
+			
+		});
+	 
+	
 } );
 
 </script>

+ 4 - 4
protected/view/admin/saeaBorad.html

@@ -65,17 +65,17 @@
 										<a class="button btn-block" href="/saeaLoanReceiptAdd/{{receiptDetail' value.rid}}">填写费用报销</a>
 										<!-- elseif  ({{receiptDetail' value.status}}==4 or {{receiptDetail' value.status}}==5) and {{receiptDetail' value.Rtype}}==1 and {{receiptDetail' value.isBK}}==0 -->
 										
-										<a class="button btn-gray  btn-inline" href="/saeaLoanEdi/{{receiptDetail' value.rid}}">返回编辑</a>
+										<a class="button btn-gray  btn-inline" href="/saeaLoanEdi/{{receiptDetail' value.ridKey}}.html">返回编辑</a>
 										<a class="button btn-inline" href="/confirmation/{{receiptDetail' value.rid}}">提交审批</a>
 										
 										<!-- elseif  ({{receiptDetail' value.status}}==4 or {{receiptDetail' value.status}}==5) and {{receiptDetail' value.Rtype}}==0 -->
-										<a class="button btn-gray  btn-inline" href="/editReceipt/{{receiptDetail' value.rid}}">返回编辑</a><a
+										<a class="button btn-gray  btn-inline" href="/editReceipt/{{receiptDetail' value.ridKey}}.html">返回编辑</a><a
 										 class="button btn-inline" href="/approvedReceipt/{{receiptDetail' value.rid}}">提交审批</a>
 										 <!-- elseif  ({{receiptDetail' value.status}}==4 or {{receiptDetail' value.status}}==5) and {{receiptDetail' value.Rtype}}==2 -->
-										<a class="button btn-gray  btn-inline" href="/remitEdit/{{receiptDetail' value.rid}}">返回编辑</a><a
+										<a class="button btn-gray  btn-inline" href="/remitEdit/{{receiptDetail' value.ridKey}}.html">返回编辑</a><a
 										 class="button btn-inline" href="/approvedReceipt/{{receiptDetail' value.rid}}">提交审批</a>
 										 <!-- elseif  ({{receiptDetail' value.status}}==4 or {{receiptDetail' value.status}}==7) and {{receiptDetail' value.Rtype}}==1 and {{receiptDetail' value.isBK}}==1 -->
-										 <a class="button btn-gray  btn-inline" href="/saeaLoanReceiptEdi/{{receiptDetail' value.rid}}">返回编辑</a><a
+										 <a class="button btn-gray  btn-inline" href="/saeaLoanReceiptEdi/{{receiptDetail' value.ridKey}}.html">返回编辑</a><a
 										 class="button btn-inline" href="/approvedReceipt/{{receiptDetail' value.rid}}">提交审批</a>
 										<!-- endif -->
 										</div>

+ 2 - 0
protected/view/admin/saea_create.html

@@ -194,6 +194,8 @@
 	  				</tbody>
 	  							</table>		
 	  						</td></tr>
+	  						
+	  						
 	  						</tbody>
 	  					</table>
 	  					<table class="table">

+ 86 - 1
protected/view/admin/saea_edit.html

@@ -1,12 +1,66 @@
  <!-- include 'header' -->
  <script src="<?= WEB_SITE_GLOBAL ?>js/receipt.js"></script>
+ 
+ 
+ 
+ <script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>js/swfuplad2/swfupload.js"></script>
+<script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>js/swfuplad2/swfupload.queue.js"></script>
+<script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>js/swfuplad2/fileprogress.js"></script>
+<script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>js/swfuplad2/handlers.js"></script>
+
+<script type="text/javascript">
+		var swfu;
+
+		window.onload = function() {
+			var settings = {
+				flash_url : "<?= WEB_SITE_GLOBAL ?>js/swfuplad2/swfupload.swf",
+				upload_url: "/swfupload",	// Relative to the SWF file
+				
+				file_size_limit : "8 MB",
+				file_types : "*.jpg;*.png;*.doc;*.docx;*.els;*.elsx;",
+				file_types_description : "*.jpg;*.png;*.doc;*.docx;*.els;*.elsx",
+				file_upload_limit : 8,
+				file_queue_limit : 2,
+				custom_settings : {
+					progressTarget : "fsUploadProgress",
+					cancelButtonId : "btnCancel"
+				},
+				debug: true,
+
+				// Button settings
+				button_image_url: "<?= WEB_SITE_GLOBAL ?>js/swfuplad2/TestImageNoText_65x29.png",	// Relative to the Flash file
+				button_width: "65",
+				button_height: "29",
+				button_placeholder_id: "spanButtonPlaceHolder",
+				button_text: '<span class="theFont">浏览</span>',
+				button_text_style: ".theFont { font-size: 16; }",
+				button_text_left_padding: 12,
+				button_text_top_padding: 3,
+
+				// The event handler functions are defined in handlers.js
+				file_queued_handler : fileQueued,
+				file_queue_error_handler : fileQueueError,
+				file_dialog_complete_handler : fileDialogComplete,
+				upload_start_handler : uploadStart,
+				upload_progress_handler : uploadProgress,
+				upload_error_handler : uploadError,
+				upload_success_handler : uploadSuccess,
+				upload_complete_handler : uploadComplete,
+				queue_complete_handler : queueComplete	// Queue plugin event
+			};
+
+			swfu = new SWFUpload(settings);
+	     };
+	</script>
+ 
+ 
 <body>
 	<div class="mainLayout">
 		<div class="mainMenu">
 			<div class="menuItem">
 				<a href="#" class="mLogo">CLD</a>
 				<ul>
-					<!-- include 'menu' -->
+					<!-- include 'menuReceipt' -->
 				</ul>
 			</div>
 		</div>
@@ -113,6 +167,37 @@
 	  						</th></tr>
 	  						
 	  						
+	  						<tr><th colspan="2" class="taC">附件</th></tr>
+	  						<tr><td colspan="2">
+	  							
+	  							<!--已上传文件-->
+	  							<table class="table" >
+	  								<thead>
+	  								<tr>
+	  								<th>
+	  									<span id="spanButtonPlaceHolder"></span>
+										<span>支持jpg、png、doc、docx、els、elsx;最大8M文件。</span>
+										<input id="btnCancel" type="button" value="取消所有上传" style="display:none"  onclick="swfu.cancelQueue();" disabled="disabled" style="margin-left: 2px; font-size: 8pt; height: 29px;" />
+									
+										<input type="hidden" id="enclosurName" name="enclosurName" value="">
+	  								
+	  								</th>
+	  								<th colspan="2">
+	  								<span class="fieldset flash" id="fsUploadProgress"></span>
+									<span id="divStatus">0 个文件已上传</span>
+									
+										
+	  								</th></tr>
+	  								<tr><th>文件名</th><th>大小</th><th>操作</th></tr></thead>
+	  								<tbody id="KT">
+	  							<!--已上传文件-->
+	  								
+	  				</tbody>
+	  							</table>		
+	  						</td></tr>
+	  						
+	  						
+	  						
 	  						</tbody>
 	  					</table>
 	  					<table class="table">