Преглед на файлове

开票收款 入账 相关功能移植到收款录入下

caipin преди 7 години
родител
ревизия
e465697c52

+ 73 - 0
global/js/invoice.js

@@ -82,6 +82,79 @@ $(function() {
 		$("input[name='untreadIidKey']").val($(this).attr("diss-data"));
 	});
 	
+	$('a[bind-receivables="true"]').click(function() {
+		console.log('ddd');
+	});
+	
+	$("button[invoice-search='title']").click(function() {
+		var title=$("input[name='searchTitle']").val();
+		
+		if(title==''){
+			alert('请填写开票单位');
+			return '';
+		}
+		$("div[node-invoiceHtml='true']").html('');
+		var url = "/ajaxGetInvoiceReceivablesByTitle";
+		$.ajax({
+			url : url,
+			type : "post",
+			cache : false,
+			dataType : "json",
+			data : {
+				title : title
+			},
+			global : true,
+			success : function(data) {
+				if (data.status == 1) {
+					$("div[node-invoiceHtml='true']").html(data.invoiceHtml);
+				} 
+			},
+			error : function(err) {
+			}
+		});
+		
+	});
+	
+	//
+	$("a[bind-invoice='receivables']").click(function() {
+		var key = $(this).attr("node-key");
+		$("input[name='key']").val('');
+		$("div[node-receivablesHtml='true']").html('');
+		$("div[node-invoiceHtml='true']").html('');
+		$("blockquote[node-search='invoice']").hide();
+		var url = "/ajaxGetInvoiceReceivablesByIrid";
+		$.ajax({
+			url : url,
+			type : "post",
+			cache : false,
+			dataType : "json",
+			data : {
+				irid : key
+			},
+			global : true,
+			success : function(data) {
+				if (data.status == 1) {
+					$("div[node-receivablesHtml='true']").html(data.receivablesHtml);
+					$("div[node-invoiceHtml='true']").html(data.invoiceHtml);
+					$("input[name='key']").val(data.irkey);
+					if(data.isInvoice)
+						$("blockquote[node-search='invoice']").show();
+					else
+						$("blockquote[node-search='invoice']").hide();
+				} else{
+					$("input[name='key']").val('');
+					$("div[node-receivablesHtml='true']").html('');
+					$("div[node-invoiceHtml='true']").html('');
+					$("blockquote[node-search='invoice']").hide();
+				}
+			},
+			error : function(err) {
+			}
+		});
+		
+	});
+		
+		
 	$("a[node-post='express']").click(function() {
 		var postData = $(this).attr("post-data");
 		$("input[name='iidKey']").val(postData);

+ 7 - 8
global/js/invoice.validator.js

@@ -118,13 +118,12 @@ $(function () {
 	    }
 	});
 	
-//	$("form[name='invoiceReceivablesUpdateClaim']").validator({
-//	    timely: 3,
-//	    focusCleanup: true,
-//	    fields: {
-//			receivablesCategory: 'required '
-//			,receivablesStaff: 'required '
-//	    }
-//	});
+	$("form[name='receivablesAscription']").validator({
+	    timely: 3,
+	    focusCleanup: true,
+	    fields: {
+	    	recepitTitleMark: 'required '
+	    }
+	});
 	
 })

+ 10 - 23
global/js/receipt.js

@@ -166,37 +166,24 @@ $(function() {
 			},
 			global: true,
 			success: function(data){
-				
 				if(data.status==0){
 					alert('参数错误');
 				}
-				
 				var count=data.receipt.length;
-				
 				if(count!=0){
-					
 					if(data.receipt.Rtype==1){
 						window.location.href="/expensesEdi/"+data.receipt.rid; 
 					}else if(data.receipt.Rtype==0){
 						window.location.href="/receiptburEdi/"+data.receipt.rid; 
 					}else if(data.receipt.Rtype==2){
 						window.location.href="/remitApproval/"+data.receipt.rid; 
-						
 					}
-					
-					
 				}else
 					alert('没有需要审批的费用');
-				
-				
-				console.log(data);
-				
 			},
 			error:function(err){
 			}
 			});
-		
-		
 	});
 	
 	
@@ -313,16 +300,6 @@ $(function() {
 		$("#RS").html("¥"+RS.toFixed(2));
 	});
 	
-	
-	
-	$("input[id^='RG_']").click(function() {
-		
-		
-	
-	});
-	
-	
-	
 	$("a[id^='getStaffInfo']").click(function(){
 		
 		var username=$(this).attr('data');
@@ -486,6 +463,16 @@ $(function() {
 	});
 	
 	
+	$("form[name='recepitAdd']").validator({
+		timely: 3,
+	    focusCleanup: true,
+	    theme:"yellow_top",
+	    fields: {
+	        'verify': 'required; ',
+	        'explanation':'required; '
+	    }
+	});
+	
 
 })
 

+ 14 - 0
global/js/user.validator.js

@@ -0,0 +1,14 @@
+$(function() {
+
+	$("form[name='myinfo']").validator({
+		timely : 3,
+		focusCleanup : true,
+		theme : "yellow_top",
+		fields : {
+			'oldpassword' : 'password; ',
+			'newpassword' : 'password; ',
+			'rnewpassword' : 'password; '
+		}
+	});
+
+})

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

@@ -8,7 +8,8 @@ $acl ['ordinary'] ['allow'] = array (
 				'invoiceReceivablesClaim',
 				
 				'invoiceReceivablesAscription',
-				'invoiceBindReceivables',
+				//发票绑定收款操作
+				//'invoiceBindReceivables',
 				'invoiceDroppedDo',
 				'invoiceEdit',
 				'invoiceEditDo',
@@ -44,7 +45,11 @@ $acl ['收款管理'] ['allow'] = array (
 				'ajaxGetStaffByCategory',
 				'ajaxGetInvoiceReceivablesByStaff',
 				//新加入账相关权限
+				'ajaxGetInvoiceReceivablesByIrid',
+				'ajaxGetInvoiceReceivablesByTitle',
+				'invoiceBindReceivables',
 				'invoiceCompareClaimPrice'
+				
 		) 
 );
 $acl ['发票审批'] ['allow'] = array (

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

@@ -465,8 +465,8 @@ $route['get']['/invoiceReceivablesAS/:page/:status/:year/:month'] = array('Invoi
 $route['get']['/invoiceReceivablesAS/:page/:status/:year/:month/:MebSea'] = array('InvoiceController', 'invoiceReceivablesAS');
 //收款管理新加路由
 $route['post']['/invoiceCompareClaimPrice'] = array('InvoiceController', 'invoiceCompareClaimPrice');
-
-
+$route['post']['/ajaxGetInvoiceReceivablesByIrid'] = array('InvoiceController', 'ajaxGetInvoiceReceivablesByIrid');
+$route['post']['/ajaxGetInvoiceReceivablesByTitle'] = array('InvoiceController', 'ajaxGetInvoiceReceivablesByTitle');
 
 
 //公司汇总查阅

+ 175 - 7
protected/controller/InvoiceController.php

@@ -992,6 +992,7 @@ class InvoiceController extends DooController {
 					'iid' => $iid,
 					'printStatus' => 1,
 					'updateTime' => date ( "Y-m-d H:i:s" ),
+					'printer'=> $this->staff [0] ['username'],
 					'printTime' => date ( "Y-m-d H:i:s" ),
 					'invoiceNo' => $invoiceNo 
 			);
@@ -1184,6 +1185,11 @@ class InvoiceController extends DooController {
 			$invoiceUnAccount [$key] ['lastApprover'] = $lastApprover;
 		}
 		
+		$receivablesInput=$invoiceReceivables->getInvoiceReceivablesByInput();
+		
+		//print_r($receivablesInput);
+		
+		$this->data ['receivablesInput'] = $receivablesInput;
 		$this->data ['year'] = date ( 'Y' );
 		$this->data ['invoiceUnAccount'] = $invoiceUnAccount;
 		$this->data ['receivablesList'] = $receivablesList;
@@ -1227,8 +1233,12 @@ class InvoiceController extends DooController {
 			$invoiceDetail = $invoice->getInvoiceByIid ( $iidKey );
 			$receivablesSerial="#SK" . date ( "Ymd" ) . mt_rand ( 1000, 9999 );
 			
-			// 收款录入
+			// 收款录入 并绑定发票
+			Doo::db ()->beginTransaction ();
 			$item = array (
+					'bindStatus' => 1,
+					'iid' => $invoiceDetail ['iid'],
+					'bindDate' => date ( "Y-m-d H:i:s" ),
 					'receivablesPrice' => $receivablesPrice,
 					'receivablesMessage' => $receivablesMessage,
 					'receivablesSerial' => $receivablesSerial,
@@ -1298,6 +1308,8 @@ class InvoiceController extends DooController {
 					'iid' => $detail ['iid'] 
 			);
 			$invoiceOperationLog->setInvoiceOperationLog ( $item );
+			Doo::db ()->commit ();
+			
 		}
 		
 		return '/invoiceReceivables';
@@ -1343,7 +1355,8 @@ class InvoiceController extends DooController {
 			);
 			if ($receivablesCategory != 'PUBLIC' && $receivablesStaff != 'PUBLIC') {
 				$item += array (
-						'confirmTime' => date ( "Y-m-d H:i:s" ) 
+						'confirmTime' => date ( "Y-m-d H:i:s" ),
+						'inputType' => 1
 				);
 			}
 			
@@ -1407,7 +1420,7 @@ class InvoiceController extends DooController {
 		Doo::loadModel ( 'invoiceReceivables' );
 		$invoiceReceivables = new invoiceReceivables ();
 		
-		$receivablesList = $invoiceReceivables->getInvoiceReceivablesByClaim ( $this->staff [0] ['cid'] );
+		$receivablesList = $invoiceReceivables->getInvoiceReceivablesByClaim ( $this->staff [0] ['cid'],$this->staff [0] ['sid'] );
 		
 		$this->data ['receivablesList'] = $receivablesList;
 		
@@ -1530,6 +1543,8 @@ class InvoiceController extends DooController {
 	 */
 	function invoiceReceivablesAscription() {
 		$irid = $this->get_args ( 'key' ) ? $this->get_args ( 'key' ) : "";
+		$recepitTitleMark = $this->get_args ( 'recepitTitleMark' ) ? $this->get_args ( 'recepitTitleMark' ) : "";
+		
 		Doo::loadModel ( 'invoiceReceivables' );
 		$invoiceReceivables = new invoiceReceivables ();
 		Doo::loadModel ( 'invoiceROLog' );
@@ -1539,12 +1554,13 @@ class InvoiceController extends DooController {
 		
 		$detail = $invoiceReceivables->getInvoiceReceivablesByIrid ( $irid );
 		
-		if (! empty ( $detail ) && $detail ['receivablesStaff'] == 'PUBLIC') {
+		if (! empty ( $detail ) && $detail ['receivablesStaff'] == 'PUBLIC'&&!empty($recepitTitleMark)) {
 			$item = array (
 					'irid' => $detail ['irid'],
 					'receivablesCategory' => $this->staff [0] ['cid'] . ":" . $this->staff [0] ['category'],
 					'receivablesStaff' => $this->staff [0] ['sid'] . "-" . $this->staff [0] ['username'],
 					'confirmTime' => date ( "Y-m-d H:i:s" ),
+					'recepitTitleMark' => $recepitTitleMark,
 					'source' => 1 
 			);
 			$invoiceReceivables->setInvoiceReceivablesByCondition ( $item );
@@ -1624,7 +1640,9 @@ class InvoiceController extends DooController {
 		
 		if (empty ( $detail ) && empty ( $detailM ))
 			die ( 'illegal request' );
-			
+		if(!empty($detail['irid']))	
+			die ( 'illegal request' );
+		
 			// if ($detailM ['receivablesPrice'] >= $detail ['invoicePrice']) {
 			// $price = $detailM ['receivablesPrice'] - $detail ['invoicePrice'];
 			// die ( '<p>收款金额超出开票金额 ¥' . $price . '元,请谨慎操作</p><a href="/invoiceMyReceivables">返回</a>' );
@@ -1662,7 +1680,7 @@ class InvoiceController extends DooController {
 		);
 		$invoiceOperationLog->setInvoiceOperationLog ( $item );
 		
-		return "/invoiceMyReceivables";
+		return "/invoiceReceivables";
 	}
 	
 	/**
@@ -2058,7 +2076,7 @@ class InvoiceController extends DooController {
 		$sid = $XDeode->decode ( $_COOKIE ["staff"] );
 		$MebSea = isset ( $this->params ['MebSea'] ) ? urldecode ( $this->params ['MebSea'] ) : '';
 		
-		$page_size = 1;
+		$page_size = 18;
 		$page = isset ( $this->params ['page'] ) && is_numeric ( $this->params ['page'] ) ? $this->params ['page'] : 1;
 		$date = isset ( $this->params ['date'] ) ? $this->params ['date'] : 'MONTHO';
 		
@@ -3226,6 +3244,156 @@ class InvoiceController extends DooController {
 				'detail' => $detail 
 		) );
 	}
+	
+	function ajaxGetInvoiceReceivablesByIrid(){
+		$irid = $this->get_args ( 'irid' ) ? $this->get_args ( 'irid' ) : "";
+		
+		if (empty ( $irid )) {
+			echo json_encode ( array (
+					'status' => 2,
+					'msg' => 'illegal request'
+			) );
+			die ();
+		}
+		
+		Doo::loadModel ( 'invoiceReceivables' );
+		$invoiceReceivables = new invoiceReceivables ();
+		Doo::loadModel ( 'invoice' );
+		$invoice = new invoice ();
+		
+		$detail=$invoiceReceivables->getInvoiceReceivablesByIrid($irid);
+		$invoiceDetail=$invoice->getInvoiceByTitle($detail['recepitTitleMark'],'EXACTLY'," and status=2 and printStatus=1 and irid='' ");//
+		
+		$receivablesHtml='<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></tr>
+					<tr>
+						<td><b>¥'.$detail['receivablesPrice'].'</b></td>
+						<td>'.$detail['receivablesMessage'].'</td>
+						<td>'.$detail['receivablesBank'].'<br>'.$detail['receivablesDate'].'</td>
+						<td>'.$detail['title'].'-'.$detail['username'].'<br>'.$detail['confirmTime'].'</td>
+						<td>'.$detail['recepitTitleMark'].'</td>
+					</tr></tbody></table>';
+		
+		
+		$isInvoice=false;$invoiceHtml='';
+		if(empty($invoiceDetail)){
+			$isInvoice=true;
+		}else{
+			$invoiceHtml='<table class="table table-bordered table-condensed">
+			<thead><tr><th>开票单位(抬头)</th><th>开票金额</th><th>提交开票</th><th>出票</th><th>开票流水号</th><th width="80">入账</th></tr></thead><tbody><tr>';
+			if (! empty ( $invoiceDetail ['invoiceType'] )) {
+				$invoiceHtml .= '<td>' . $invoiceDetail ['invoiceCompany'] . '</td>';
+			} else {
+				$invoiceHtml .= '<td>' . $invoiceDetail ['invoiceTitle'] . '</td>';
+			}
+			
+			if (! empty ( $invoiceDetail ['invoiceType'] )) {
+				$invoiceHtml .= '<td>' . $invoiceDetail ['invoicePrice'] . '专</td>';
+			} else {
+				$invoiceHtml .= '<td>' . $invoiceDetail ['invoicePrice'] . '</td>';
+			}
+			
+			$invoiceHtml.='
+					<td>' . $invoiceDetail ['categoryName'].$invoiceDetail ['userName'] . ' ' . $invoiceDetail ['date']. '</td>
+					<td>' . $invoiceDetail ['printer']. ' ' . $invoiceDetail ['printTime']. '</td>
+					<td>' . $invoiceDetail ['invoiceSerial']. '</td><td><a class="button btn-block" bind-receivables="ir'.$invoiceDetail ['iidKeyXD'].'" data-ikey="'.$invoiceDetail ['iidKey'].'" href="javascript:void(0)">入账</a></td>
+					</tr>
+					';
+			$invoiceHtml.='</tbody></table>
+					
+					
+					<script>
+					$(\'a[bind-receivables="ir' . $invoiceDetail ['iidKeyXD'] . '"]\').click(function() {
+							$("input[name=\'invoiceKey\']").val("'.$invoiceDetail ['iidKey'].'");
+							var invoiceKey=$("input[name=\'invoiceKey\']").val();
+							if(invoiceKey==""){
+								alert("入账错误,请重新刷新页面");
+								return false;
+							}
+							if(window.confirm("确定入账吗?")){
+				                $("#IBR").submit();
+				              }else{
+				                 return false;
+				             }
+					});
+					</script>
+					
+					
+					';
+		}
+		
+		echo json_encode ( array (
+				'status' => 1,
+				'irkey'=>$detail['iridEn'],
+				'receivablesHtml' => $receivablesHtml,
+				'isInvoice'=>$isInvoice,
+				'invoiceHtml' => $invoiceHtml
+		) );
+	}
+	
+	function ajaxGetInvoiceReceivablesByTitle(){
+		$title = $this->get_args ( 'title' ) ? $this->get_args ( 'title' ) : "";
+		
+		if (empty ( $title )) {
+			echo json_encode ( array (
+					'status' => 2,
+					'msg' => 'illegal request'
+			) );
+			die ();
+		}
+		
+		Doo::loadModel ( 'invoice' );
+		$invoice = new invoice ();
+		
+		$invoiceDetail=$invoice->getInvoiceByTitle($title,'EXACTLY'," and status=2 and printStatus=1 and irid='' ");
+		
+		$invoiceHtml='';
+		if(!empty($invoiceDetail)){
+			$invoiceHtml='<table class="table table-bordered table-condensed">
+			<thead><tr><th>开票单位(抬头)</th><th>开票金额</th><th>提交开票</th><th>出票</th><th>开票流水号</th><th width="80">入账</th></tr></thead><tbody><tr>';
+			if (! empty ( $invoiceDetail ['invoiceType'] )) {
+				$invoiceHtml .= '<td>' . $invoiceDetail ['invoiceCompany'] . '</td>';
+			} else {
+				$invoiceHtml .= '<td>' . $invoiceDetail ['invoiceTitle'] . '</td>';
+			}
+				
+			if (! empty ( $invoiceDetail ['invoiceType'] )) {
+				$invoiceHtml .= '<td>' . $invoiceDetail ['invoicePrice'] . '专</td>';
+			} else {
+				$invoiceHtml .= '<td>' . $invoiceDetail ['invoicePrice'] . '</td>';
+			}
+				
+			$invoiceHtml.='
+					<td>' . $invoiceDetail ['categoryName'].$invoiceDetail ['userName'] . ' ' . $invoiceDetail ['date']. '</td>
+					<td>' . $invoiceDetail ['printer']. ' ' . $invoiceDetail ['printTime']. '</td>
+					<td>' . $invoiceDetail ['invoiceSerial']. '</td><td><a class="button btn-block" bind-receivables="ir'.$invoiceDetail ['iidKeyXD'].'" data-ikey="'.$invoiceDetail ['iidKey'].'" href="#">入账</a></td>
+					</tr>
+					';
+			$invoiceHtml.='</tbody></table>
+					
+					<script>
+					$(\'a[bind-receivables="ir' . $invoiceDetail ['iidKeyXD'] . '"]\').click(function() {
+							$("input[name=\'invoiceKey\']").val("'.$invoiceDetail ['iidKey'].'");
+							var invoiceKey=$("input[name=\'invoiceKey\']").val();
+							if(invoiceKey==""){
+								alert("入账错误,请重新刷新页面");
+								return false;
+							}
+							if(window.confirm("确定入账吗?")){
+				                $("#IBR").submit();
+				              }else{
+				                 return false;
+				             }
+					});
+					</script>
+					';
+		}
+		
+		echo json_encode ( array (
+				'status' => 1,
+				'invoiceHtml' => $invoiceHtml
+		) );
+	}
+	
 	function _GetFileEXT($filename) {
 		$pics = explode ( '.', $filename );
 		$num = count ( $pics );

+ 11 - 17
protected/controller/ReceiptController.php

@@ -346,8 +346,10 @@ class ReceiptController extends DooController {
 				$receiptDetail->status = 4;
 				$receiptDetail->insert ();
 			}
-		}
-		return "/saeaBorad";
+			return "/saeaBorad";
+		}else 
+			die ( 'illegal request' );
+		
 	}
 	function remitEdit() {
 		$rid = isset ( $this->params ['rid'] ) && is_numeric ( $this->params ['rid'] ) ? $this->params ['rid'] : 0;
@@ -916,9 +918,6 @@ class ReceiptController extends DooController {
 					'asArray' => true 
 			) );
 			
-			// $receiptDetail=$receipt->getOne(array('where'=>'staff='.$this->staff[0]['sid'].' and status=4','asArray'=>true));
-			// if(!empty($receiptDetail))
-			// return "/referReceipt/".$receiptDetail['rid'];
 			
 			$aItem = $accountItem->find ( array (
 					'asArray' => true 
@@ -977,14 +976,9 @@ class ReceiptController extends DooController {
 			$receipt->receiptOrder = $loanReceipt->receiptOrder;
 			$receipt->explanation = $explanation;
 			$rid = $receipt->insert ();
-			
-			// 执行数据备份
-			// $executeCopy->rid=$rid;
-			// $executeCopy->staff=$executeDetail['staff'];
-			// $executeCopy->eid=$executeDetail['eid'];
-			// $ecid=$executeCopy->insert();
-		}
-		return "/saeaBorad";
+			return "/saeaBorad";
+		}else 
+			die ( 'illegal request' );
 	}
 	function saeaLoanEdi() {
 		$rid = isset ( $this->params ['rid'] ) ? $this->params ['rid'] : 0;
@@ -5872,10 +5866,10 @@ class ReceiptController extends DooController {
 				$receiptDetail->status = 4;
 				$receiptDetail->insert ();
 			}
-			
-			// return "/referReceipt/".$rid;
-		}
-		return "/saeaBorad";
+			return "/saeaBorad";
+		}else 
+			die ( 'illegal request' );
+		
 	}
 	function referReceipt() {
 		// $rid=isset($this->params['rid'])&&is_numeric($this->params['rid'])?$this->params['rid']:0;

+ 42 - 1
protected/model/invoice.php

@@ -9,6 +9,9 @@ Doo::loadCore ( 'db/DooModel' );
  */
 class invoice extends DooModel {
 	private $INVOICEKEY = "APPROVAL";
+	private $FUZZY='FUZZY';
+	private $EXACTLY="EXACTLY";
+	
 	/**
 	 *
 	 * @var integer $iid 发票ID
@@ -70,6 +73,7 @@ class invoice extends DooModel {
 	 *
 	 * @var string $userName 提交人名字
 	 */
+	public $printer;
 	public $userName;
 	/**
 	 *
@@ -226,6 +230,7 @@ class invoice extends DooModel {
 			'poster',
 			'sid',
 			'userName',
+			'printer',
 			'date',
 			'isDelete',
 			'updateTime',
@@ -271,6 +276,40 @@ class invoice extends DooModel {
 		$Detail ['category'] = $lCategory->getCategory ();
 		return $Detail;
 	}
+	
+	/**
+	 * 根据标题或者开票单位获得相关信息 - 准确查询
+	 * @param string $title 查询条件
+	 * @param string $query 默认模糊查询
+	 */
+	public function getInvoiceByTitle($title="",$query="FUZZY",$cond=''){
+		$detail=array();
+		if (!empty($title)){
+			$condition = array (
+					'asArray' => TRUE
+			);
+			
+			if ($query==$this->FUZZY)
+				$condition += array (
+						'where' => " (invoiceTitle like '%" . $title . "%' or invoiceCompany '%" . $title . "%')  ".$cond,
+				);
+			else
+				$condition += array (
+						'where' => "(invoiceTitle = '" . $title . "' or invoiceCompany= '" . $title . "') " .$cond,
+				);
+				
+			$detail = $this->getOne ( $condition );
+			if (!empty($detail)){
+				Doo::loadClass ( 'XDeode' );
+				$XDeode = new XDeode ( 5 );
+				$detail ['iidKey'] = $this->authcode ( $detail ['iid'], '' );
+				$detail ['iidKeyXD'] = $XDeode->encode ( $detail ['iid'] );
+			}
+		}
+		
+		return $detail;
+	}
+	
 	public function getInvoiceByIsid($iid = "", $sid = 0) {
 		if (empty ( $iid ) || empty ( $sid ))
 			return array ();
@@ -289,6 +328,8 @@ class invoice extends DooModel {
 		return $detail;
 	}
 	
+	
+	
 	/**
 	 * 获取单个可以打印的发票数据
 	 * @param number $iid 发票id
@@ -420,7 +461,7 @@ class invoice extends DooModel {
 		if (!empty($invoiceTC))
 			$title=' and (invoiceTitle like "%'.$invoiceTC.'%" or invoiceCompany like "%'.$invoiceTC.'%" )';
 		
-		$list = $this->find ( array (
+		$list = $this->find ( array (//
 				'where' => "status=2 and printStatus=1 and untreadStatus=0 and irid=''  and isDelete=0 ".$title,
 				'desc' => 'iid',
 				'asArray' => TRUE 

+ 34 - 7
protected/model/invoiceReceivables.php

@@ -19,7 +19,9 @@ class invoiceReceivables extends DooModel {
 	public $receivablesDate;
 	public $receivablesCategory;
 	public $receivablesStaff;
+	public $recepitTitleMark;
 	public $inputStaff;
+	public $inputType;
 	public $source;
 	public $date;
 	public $confirmTime;
@@ -37,7 +39,9 @@ class invoiceReceivables extends DooModel {
 			'receivablesDate',
 			'receivablesCategory',
 			'receivablesStaff',
+			'recepitTitleMark',
 			'inputStaff',
+			'inputType',
 			'source',
 			'date',
 			'confirmTime',
@@ -61,8 +65,31 @@ class invoiceReceivables extends DooModel {
 		}
 		return $list;
 	}
+	
+	/**
+	 * 获得最近录入发票,不包含已经绑定的
+	 */
+	public function getInvoiceReceivablesByInput(){
+		$list = $this->find ( array (
+				'where' => "bindStatus=0",
+				'desc' => 'irid',
+				'asArray' => TRUE
+		) );
+		
+		foreach ($list as $key=>$value){
+			$list[$key]['receivablesCategory']=explode(':',$value['receivablesCategory']);
+			
+			if ($value['receivablesStaff']!='PUBLIC')
+				$list[$key]['receivablesStaff']=explode('-',$value['receivablesStaff']);
+			
+			$list [$key] ['iridKey'] = $this->authcode ( $value ['irid'], '' );
+		}
+		
+		return $list;
+	}
+	
 	public function getInvoiceReceivablesByClaim($cid = 0, $sid = 0) {
-		if (empty ( $sid )) {
+		if (! empty ( $cid )) {
 			$list ['csClaim'] = $this->find ( array (
 					'where' => "receivablesCategory='public' and receivablesStaff='public'  and bindStatus=0",
 					'desc' => 'irid',
@@ -81,19 +108,20 @@ class invoiceReceivables extends DooModel {
 			foreach ( $list ['sClaim'] as $key => $value ) {
 				$list ['sClaim'] [$key] ['iidKey'] = $this->authcode ( $value ['irid'], '' );
 			}
+		}
+		
+		if (! empty ( $cid ) && ! empty ( $sid )) {
 			
-			$list ['arClaim'] = $this->find ( array (
-					'where' => "receivablesCategory!='public' and receivablesStaff!='public' and receivablesCategory like '" . $cid . ":%' and receivablesStaff  like '" . $sid . "-%' and bindStatus=0",
+			$list ['arClaim'] = $this->find ( array (//and receivablesCategory like '" . $cid . ":%'
+					'where' => "receivablesCategory!='public' and receivablesStaff!='public'  and receivablesStaff  like '" . $sid . "-%' and bindStatus=0",
 					'desc' => 'irid',
-					'asArray' => TRUE 
+					'asArray' => TRUE
 			) );
 			foreach ( $list ['arClaim'] as $key => $value ) {
 				$staff = explode ( "-", $value ['receivablesStaff'] );
 				$list ['arClaim'] [$key] ['sid'] = $staff [0];
 				$list ['arClaim'] [$key] ['username'] = $staff [1];
 			}
-		}
-		if (! empty ( $cid ) && ! empty ( $sid )) {
 			
 			$list ['myClaim'] = $this->find ( array (
 					'where' => " receivablesStaff like '" . $sid . "-%' and receivablesCategory like '" . $cid . ":%' and bindStatus=0",
@@ -124,7 +152,6 @@ class invoiceReceivables extends DooModel {
 				$list ['bindClaim'] [$key] ['iridKeyUrl'] = $XDeode->encode ( $value ['irid'] );
 			}
 		}
-		
 		return $list;
 	}
 	

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

@@ -24,7 +24,7 @@
 				<legend>填写申请开票</legend>
 				<div class="borad-news">
 					<div class="saeaList">
-						<form action="/invoiceAddDo" method="post" id="invoice">
+						<form action="/invoiceAddDo"  method="post" id="invoice">
 						<table class="table table-bordered table-condensed">
 								<tbody>
 								<tr>

+ 79 - 44
protected/view/admin/invoiceReceivables.html

@@ -77,42 +77,36 @@
 							<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="80">绑定发票</th></tr>
+								
+								<!-- loop receivablesInput -->
 								<tr>
-									<td><b>¥3000.00</b></td>
-									<td>张宇</td>
-									<td>广发银行珠海分行柠溪支行<br>2016-03-03</td>
-									<td>张少珊 2016-03-03<br>公共待认领款项</td>
-									<td>总部-陈特<br>2016-03-03</td>
-									<td>珠海XXX公司</td>
-									<td><a class="button btn-block" href="#search-invoice" data-toggle="modal">查询发票</a></td>
-								</tr>
-								<tr>
-									<td><b>¥3000.00</b></td>
-									<td>张宇</td>
-									<td>广发银行珠海分行柠溪支行<br>2016-03-03</td>
-									<td>张少珊 2016-03-03<br>公共待认领款项</td>
-									<td>广东办-刘飞<br>2016-03-0</td>
-									<td>珠海XXX公司</td>
-									<td><a class="button btn-block" href="#search-invoice" data-toggle="modal">查询发票</a></td>
-								</tr>
-								<tr>
-									<td><b>¥3000.00</b></td>
-									<td>张宇</td>
-									<td>广发银行珠海分行柠溪支行<br>2016-03-03</td>
-									<td>张少珊 2016-03-03<br>公共待认领款项</td>
-									<td> </td>
-									<td> </td>
-									<td></td>
-								</tr>
-								<tr>
-									<td><b>¥3000.00</b></td>
-									<td>张宇</td>
-									<td>广发银行珠海分行柠溪支行<br>2016-03-03</td>
-									<td>张少珊 2016-03-03<br>办事处待认领款项</td>
-									<td>广东办-刘飞<br>2016-03-03</td>
-									<td>珠海XXX公司</td>
-									<td><a class="button btn-block" href="#search-invoice" data-toggle="modal">查询发票</a></td>
+									<td><b>¥{{receivablesInput' value.receivablesPrice}}</b></td>
+									<td>{{receivablesInput' value.receivablesMessage}}</td>
+									<td>{{receivablesInput' value.receivablesBank}}<br>{{receivablesInput' value.receivablesDate}}</td>
+									<td>{{receivablesInput' value.inputStaff}} {{receivablesInput' value.date}}<br>
+									<!-- if {{receivablesInput' value.inputType}}==1  -->
+										办事处待认领款项
+									<!-- else -->
+										公共待认领款项
+									<!-- endif -->
+									</td>
+									<td>
+									<!-- if {{receivablesInput' value.receivablesStaff}}!='PUBLIC'  -->
+									{{receivablesInput' value.receivablesCategory.1}}-{{receivablesInput' value.receivablesStaff.1}}<br>
+									{{receivablesInput' value.confirmTime}}
+									<!-- endif -->
+									</td>
+									<td>
+									{{receivablesInput' value.recepitTitleMark}}
+									</td>
+									<td>
+									<!-- if {{receivablesInput' value.bindStatus}}==0&&{{receivablesInput' value.receivablesStaff}}!='PUBLIC'  -->
+									<a class="button btn-block" href="#search-invoice" bind-invoice='receivables' node-key="{{receivablesInput' value.iridKey}}" data-toggle="modal">查询发票</a>
+									<!-- endif -->
+									</td>
 								</tr>
+								<!-- endloop -->
+								
 								</tbody>
 							</table>
 							<blockquote><p class="colGray">暂时没有已认领的收款</p></blockquote>
@@ -153,9 +147,7 @@
 		<div id="nc"></div>
 	</div>
 	<!--弹出发票详情-->
-	
-	
-	
+
 	<div class="modal hide fade" id="recorded">
 	<div class="modal-dialog modal-lg">
 		<div class="modal-content">
@@ -191,21 +183,14 @@
 					</tbody>
 				</table>
 				
-				
 				<div id="irtc"></div>
-				
-				
-				
-				
 			</div>
 			<div class="modal-footer">
 				<input type="submit" class="button"  value="确认入账">
 				
 				<a href="#" class="button btn-gray" data-dismiss="modal" aria-hidden="true">关闭</a>
 			</div>
-			
 		</form>
-			
 		</div>
 	</div>
 </div>
@@ -276,6 +261,56 @@
 			</div></div>
 			</form>
 	</div>
+	
+	<!--弹出(查询发票)-->
+<div class="modal hide fade" id="search-invoice">
+<form action="/invoiceBindReceivables" id="IBR" method="post">
+		<input type="hidden" name="key" value="">
+		<input type="hidden" name="invoiceKey" value="">
+	<div class="modal-dialog modal-lg">
+		<div class="modal-content">
+			<div class="modal-header">
+				<h3>查询发票</h3>
+			</div>
+			
+			<div class="modal-body saeaList"  >
+				<div node-receivablesHtml='true'>
+					
+				</div>
+				
+				
+				
+				<!--没找到对应开票-->
+				<blockquote node-search='invoice' style="display:none">
+					<p>暂时没有查询到“珠海XXXX公司”的未入账发票</p>
+					<p><div class="input-append">
+							<input class="datepicker-here span4" name='searchTitle' placeholder="你可以按关键词模糊搜索" data-range="true" data-multiple-dates-separator=" - " data-language="zh" type="text">
+							<button class="btn btn-small" invoice-search='title' type="button">查询</button>
+					</div></p>
+				</blockquote>
+				
+				<div node-invoiceHtml='true'>
+				<!--搜索结果-->
+				<table class="table table-bordered table-condensed">
+					<thead><tr><th>开票单位(抬头)</th><th>开票金额</th><th>提交开票</th><th>出票</th><th>开票流水号</th><th width="80">入账</th></tr></thead>
+						<tbody >
+							<tr><td>珠海XXXX公司</td><td>¥3000.00专</td><td>广东办刘飞 2016-03-03 12:20:20</td><td>黄爱玲 2016-03-03 12:20:20</td><td><a href="#invdetail" data-toggle="modal">#F20160316001</a></td><td><a class="button btn-block" href="#">入账</a></td></tr>
+						</tbody>
+				</table>	
+						
+				</div>			
+						
+						
+							
+			</div>
+			
+			<div class="modal-footer">
+				<a href="#" class="button btn-gray" data-dismiss="modal" aria-hidden="true">关闭</a>
+			</div>
+		</div>
+	</div>
+</div>
+	
 	<!--弹出内容-->
 <script type="text/javascript">autoFlashHeight();</script>	
 </body>

+ 9 - 1
protected/view/admin/invoiceReceivablesClaim.html

@@ -1,4 +1,8 @@
 <!-- include 'header' -->
+<link rel=stylesheet href="<?= WEB_SITE_GLOBAL ?>css/jquery.validator.css">
+<script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>js/jquery.validator.min.js"></script>
+<script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>js/zh-CN.js"></script>
+<script src="<?= WEB_SITE_GLOBAL ?>js/invoice.validator.js"></script>
 <script src="<?= WEB_SITE_GLOBAL ?>js/invoice.js"></script>
 <body>
 	<div class="mainLayout">
@@ -98,7 +102,7 @@
 
 	<!--弹出(录入收款)-->
 <div class="modal hide fade" id="receive">
-<form action="/invoiceReceivablesAscription" method="post" >
+<form action="/invoiceReceivablesAscription" name="receivablesAscription" method="post" >
 	<input type="hidden" name="key" value="">
 	<div class="modal-dialog ">
 		<div class="modal-content">
@@ -121,6 +125,10 @@
 						<th class="taC">收款银行</th><td node-bank ></td>
 						<th class="taC">银行到帐</th><td node-date ></td>
 					</tr>
+					<tr>
+						<th class="taC"><span class="colRed">*</span>单位名称</th>
+						<td colspan="3"><input type="text" name="recepitTitleMark" placeholder="输入开票单位名称"></td>
+					</tr>
 					</tbody></table>
 			</div>
 	<div class="modal-footer">

+ 5 - 1
protected/view/admin/remitAdd.html

@@ -1,4 +1,7 @@
  <!-- include 'header' -->
+  <link rel=stylesheet href="<?= WEB_SITE_GLOBAL ?>css/jquery.validator.css"> 
+<script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>js/jquery.validator.min.js"></script>
+<script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>js/zh-CN.js"></script>
  <script src="<?= WEB_SITE_GLOBAL ?>js/receipt.js"></script>
 
 <script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>js/swfuplad2/swfupload.js"></script>
@@ -80,7 +83,7 @@
 	  				<input type="hidden" id="travelR" value="0" />
 	  				<input type="hidden" id="trainR" value="0" />
 	  				<input type="hidden" id="otherR" value="0" />
-	  				<form action="/remitAddDo" method="post">
+	  				<form action="/remitAddDo" name="recepitAdd" method="post">
 	  					<table class="table table-bordered table-condensed table-hover">
 	  					<tbody>
 	  					   
@@ -103,6 +106,7 @@
 								<th>选择审批组</th>
 								<td class="taR">
 								<select name="verify">
+								<option  value="" >请选择审批组</option>
 								<!-- loop veList -->
 								<option value="{{veList' value.vid}}" >{{veList' value.description}}(
 								{{veList' value.staff}}

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

@@ -1,5 +1,7 @@
 <!-- include 'header' -->
-
+<link rel=stylesheet href="<?= WEB_SITE_GLOBAL ?>css/jquery.validator.css"> 
+<script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>js/jquery.validator.min.js"></script>
+<script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>js/zh-CN.js"></script>
  <script src="<?= WEB_SITE_GLOBAL ?>js/receipt.js"></script>
 
 <body>
@@ -21,7 +23,7 @@
 			<div class="adminContent autoHeight" style="height: 821px;">
 				<legend><div class="fR"></div>申请借款</legend>
 	  		<div class="saeaList">
-	  		<form action="/saeaLoanAddDo" method="post">
+	  		<form action="/saeaLoanAddDo" name="recepitAdd" method="post">
 	  			<div class="entry loan-list">
 	  				<div class="seTable">
 	  					<table class="table table-bordered table-condensed table-hover">
@@ -34,7 +36,8 @@
 							<tr>
 								<th>选择审批组</th>
 								<td class="taR">
-								<select name="verify">
+								<select name="verify" id="verify">
+								<option  value="" >请选择审批组</option>
 								<!-- loop veList -->
 								<option value="{{veList' value.vid}}" >{{veList' value.description}}(
 								{{veList' value.staff}}
@@ -50,6 +53,7 @@
 								<th>选择办事处</th>
 								<td class="taR">
 								<select name="cid" class="span2">
+								
 								<!-- loop category -->
 								<option <!-- if {{category' value.cid}} == {{staff.0.cid}}  --> selected <!-- endif -->  value="{{category' value.cid}}" >{{category' value.title}}</option>
 								<!-- endloop -->

+ 5 - 1
protected/view/admin/saea_create.html

@@ -1,4 +1,7 @@
  <!-- include 'header' -->
+ <link rel=stylesheet href="<?= WEB_SITE_GLOBAL ?>css/jquery.validator.css"> 
+<script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>js/jquery.validator.min.js"></script>
+<script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>js/zh-CN.js"></script>
  <script src="<?= WEB_SITE_GLOBAL ?>js/receipt.js"></script>
 
 <script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>js/swfuplad2/swfupload.js"></script>
@@ -80,7 +83,7 @@
 	  				<input type="hidden" id="travelR" value="0" />
 	  				<input type="hidden" id="trainR" value="0" />
 	  				<input type="hidden" id="otherR" value="0" />
-	  				<form action="/addReceipt" method="post">
+	  				<form action="/addReceipt" name="recepitAdd" method="post">
 	  					<table class="table table-bordered table-condensed table-hover">
 	  					<tbody>
 	  					   
@@ -135,6 +138,7 @@
 								<th>选择审批组</th>
 								<td class="taR">
 								<select name="verify">
+								<option  value="" >请选择审批组</option>
 								<!-- loop veList -->
 								<option value="{{veList' value.vid}}" >{{veList' value.description}}(
 								{{veList' value.staff}}