Kaynağa Gözat

入账判定改为 收款金额大于等于为入账完成

caipin 7 yıl önce
ebeveyn
işleme
144fdad5dc

+ 12 - 0
global/js/invoice.js

@@ -90,6 +90,8 @@ $(function() {
 		 $('#iras').submit();
 	});
 	
+	/**
+	 * 废弃方法
 	$('button[node-irmMebSea]').click(function() {
 		 var month=$('select[node-irmChange]').val();
 		 var year=$('select[node-iryChange]').val();
@@ -101,6 +103,11 @@ $(function() {
 		 $('#iras').attr("action",action);
 		 $('#iras').submit();
 	});
+	*/
+	$('input[refreshData=time]').click(function() {
+		 $('#iras').submit();
+	});
+	
 	
 	$('button[node-iramMebSea]').click(function() {
 		
@@ -503,6 +510,11 @@ $(function() {
 		});
 	});
 	
+	$("a[node-unBundLing]").click(function() {
+		
+		var postData = $(this).attr("data-isKey");
+		$("input[id='unBundKey']").val(postData);
+	});
 	
 	$("a[node-irUpdate]").click(function() {
 		

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

@@ -51,6 +51,8 @@ $acl ['收款管理'] ['allow'] = array (
 				'ajaxGetInvoiceReceivablesByIrid',
 				'ajaxGetInvoiceReceivablesByTitle',
 				'invoiceBindReceivables',
+				'invoiceAS',
+				'invoiceUnBundLing',
 				'invoiceCompareClaimPrice'
 				
 		) 

+ 13 - 3
protected/config/routes.conf.php

@@ -470,9 +470,19 @@ $route['post']['/ajaxGetInvoiceReceivablesByStaff'] = array('InvoiceController',
 $route['get']['/invoiceReceivablesAS'] = array('InvoiceController', 'invoiceReceivablesAS');
 $route['get']['/invoiceReceivablesAS/:page'] = array('InvoiceController', 'invoiceReceivablesAS');
 $route['get']['/invoiceReceivablesAS/:page/:status'] = array('InvoiceController', 'invoiceReceivablesAS');
-$route['get']['/invoiceReceivablesAS/:page/:status/:year'] = array('InvoiceController', 'invoiceReceivablesAS');
-$route['get']['/invoiceReceivablesAS/:page/:status/:year/:month'] = array('InvoiceController', 'invoiceReceivablesAS');
-$route['get']['/invoiceReceivablesAS/:page/:status/:year/:month/:MebSea'] = array('InvoiceController', 'invoiceReceivablesAS');
+
+$route['get']['/invoiceAS'] = array('InvoiceController', 'invoiceAS');
+$route['get']['/invoiceAS/:page'] = array('InvoiceController', 'invoiceAS');
+$route['get']['/invoiceAS/:page/:status'] = array('InvoiceController', 'invoiceAS');
+
+$route['post']['/invoiceUnBundLing'] = array('InvoiceController', 'invoiceUnBundLing');
+
+
+
+// $route['get']['/invoiceReceivablesAS/:page/:status/:year'] = array('InvoiceController', 'invoiceReceivablesAS');
+// $route['get']['/invoiceReceivablesAS/:page/:status/:year/:month'] = array('InvoiceController', 'invoiceReceivablesAS');
+// $route['get']['/invoiceReceivablesAS/:page/:status/:year/:month/:MebSea'] = array('InvoiceController', 'invoiceReceivablesAS');
+
 //收款管理新加路由
 $route['post']['/invoiceCompareClaimPrice'] = array('InvoiceController', 'invoiceCompareClaimPrice');
 $route['post']['/ajaxGetInvoiceReceivablesByIrid'] = array('InvoiceController', 'ajaxGetInvoiceReceivablesByIrid');

Dosya farkı çok büyük olduğundan ihmal edildi
+ 309 - 120
protected/controller/InvoiceController.php


+ 3 - 4
protected/controller/MainController.php

@@ -4126,7 +4126,7 @@ class MainController extends DooController {
 
 					' . $u . '
 					
-	
+<!--
 <script type="text/javascript" src="' . WEB_SITE_GLOBAL . 'js/bootstrap.min.js"></script>
 <script type="text/javascript" src="' . WEB_SITE_GLOBAL . 'js/bootstrap-datetimepicker.js" charset="UTF-8"></script>
 <script type="text/javascript" src="' . WEB_SITE_GLOBAL . 'js/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
@@ -4145,10 +4145,9 @@ class MainController extends DooController {
     });
 	
 </script>
-
-
+-->
 					
-	  			<script type="text/javascript">autoFlashHeight();</script>	</div>' 
+	  	<script type="text/javascript">autoFlashHeight();</script>	</div>' 
 		);
 		echo json_encode ( $clientHtml );
 	}

+ 2 - 2
protected/model/invoice.php

@@ -469,8 +469,8 @@ class invoice extends DooModel {
 		if (!empty($invoiceTC))
 			$title=' and (invoiceTitle like "%'.$invoiceTC.'%" or invoiceCompany like "%'.$invoiceTC.'%" )';
 		
-		$list = $this->find ( array (//
-				'where' => "status=2 and printStatus=1 and untreadStatus=0 and irid='' and ( (doPost=1 and postStatus=1) or doPost=0 ) and isDelete=0 ".$title,
+		$list = $this->find ( array (//and irid=''
+				'where' => "status=2 and printStatus=1 and untreadStatus=0  and ( (doPost=1 and postStatus=1) or doPost=0 ) and isDelete=0 ".$title,
 				'desc' => 'iid',
 				'asArray' => TRUE 
 		));

+ 44 - 19
protected/model/invoiceReceivables.php

@@ -11,6 +11,8 @@ class invoiceReceivables extends DooModel {
 	private $INVOICEKEY = "APPROVAL";
 	public $irid;
 	public $bindStatus;
+	public $untreadStatus;
+	public $untreadStaff;
 	public $iid;
 	public $receivablesPrice;
 	public $receivablesSerial;
@@ -26,11 +28,15 @@ class invoiceReceivables extends DooModel {
 	public $date;
 	public $confirmTime;
 	public $bindDate;
+	public $unbundlingTime;
+	public $accountClerk;
 	public $_table = 'CLD_invoiceReceivables';
 	public $_primarykey = 'irid';
 	public $_fields = array (
 			'irid',
 			'bindStatus',
+			'untreadStatus',
+			'untreadStaff',
 			'iid',
 			'receivablesPrice',
 			'receivablesSerial',
@@ -45,15 +51,33 @@ class invoiceReceivables extends DooModel {
 			'source',
 			'date',
 			'confirmTime',
-			'bindDate' 
+			'bindDate',
+			'unbundlingTime',
+			'accountClerk' 
 	);
+	public function getSumOfReceivablesPrice($iridString = "") {
+		if (empty ( $iridString ))
+			return 0;
+		
+		$list = $this->getOne ( array (
+				'select'=>' sum(receivablesPrice) as receivablesPrice ',
+				'where' => " irid in ( " . $iridString . " )",
+				'groupby' => 'iid',
+				'asArray' => TRUE 
+		) );
+		
+		if (empty($list))
+			return 0;
+		return $list['receivablesPrice'];
+	}
+	
 	/**
 	 * 获取最新几条收款包括最新的一条操作日志
 	 * @param number $limit
 	 * @return unknown
 	 */
-	public function getInvoiceReceivablesByNew($limit = 4,$con="") {
-		if ( empty ( $con ))
+	public function getInvoiceReceivablesByNew($limit = 4, $con = "") {
+		if (empty ( $con ))
 			return array ();
 		$list = $this->find ( array (
 				'where' => $con,
@@ -67,7 +91,7 @@ class invoiceReceivables extends DooModel {
 		$invoice = new invoice ();
 		foreach ( $list as $key => $value ) {
 			$list [$key] ['invoiceROLog'] = $invoiceROLog->getInvoiceROLogByIrid ( $value ['irid'], 'desc' );
-			$list [$key] ['invoiceDetail'] =$invoice->getInvoiceByIid($value ['iid']);
+			$list [$key] ['invoiceDetail'] = $invoice->getInvoiceByIid ( $value ['iid'] );
 		}
 		return $list;
 	}
@@ -75,25 +99,24 @@ class invoiceReceivables extends DooModel {
 	/**
 	 * 获得最近录入发票,不包含已经绑定的
 	 */
-	public function getInvoiceReceivablesByInput(){
+	public function getInvoiceReceivablesByInput() {
 		$list = $this->find ( array (
 				'where' => "bindStatus=0",
 				'desc' => 'irid',
-				'asArray' => TRUE
+				'asArray' => TRUE 
 		) );
 		
-		foreach ($list as $key=>$value){
-			$list[$key]['receivablesCategory']=explode(':',$value['receivablesCategory']);
+		foreach ( $list as $key => $value ) {
+			$list [$key] ['receivablesCategory'] = explode ( ':', $value ['receivablesCategory'] );
 			
-			if ($value['receivablesStaff']!='PUBLIC')
-				$list[$key]['receivablesStaff']=explode('-',$value['receivablesStaff']);
+			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 ( $cid )) {
 			$list ['csClaim'] = $this->find ( array (
@@ -118,10 +141,10 @@ class invoiceReceivables extends DooModel {
 		
 		if (! empty ( $cid ) && ! empty ( $sid )) {
 			
-			$list ['arClaim'] = $this->find ( array (//and receivablesCategory like '" . $cid . ":%'
+			$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'] );
@@ -223,7 +246,7 @@ class invoiceReceivables extends DooModel {
 	public function getInvoiceReceivablesByIrid($irid = "", $con = "") {
 		Doo::loadClass ( 'XDeode' );
 		$XDeode = new XDeode ( 5 );
-		if (!is_numeric($irid))
+		if (! is_numeric ( $irid ))
 			$irid = $this->authcode ( $irid );
 		$detail = array ();
 		if (! empty ( $irid ) && is_numeric ( $irid ))
@@ -232,7 +255,7 @@ class invoiceReceivables extends DooModel {
 					'asArray' => TRUE 
 			) );
 		
-		if (empty($detail))
+		if (empty ( $detail ))
 			return $detail;
 		$detail ['cid'] = '';
 		$detail ['title'] = '';
@@ -327,14 +350,14 @@ class invoiceReceivables extends DooModel {
 		}
 		return $list;
 	}
-	function getReceivablesByUntreadStatusPage($limit = 0, $con = "", $desc = 'desc') {
+	function getReceivablesByUntreadStatusPage($limit = 0, $con = "", $desc = 'desc', $descField = 'irid') {
 		if (empty ( $limit ))
 			return array ();
 		
 		$list = $this->find ( array (
 				'where' => $con, // " bindStatus=1 and receivablesStaff like '" . $sid . "_%' ".$con,
 				'limit' => $limit,
-				$desc => 'irid',
+				$desc => $descField,
 				'asArray' => TRUE 
 		) );
 		Doo::loadClass ( 'XDeode' );
@@ -367,8 +390,10 @@ class invoiceReceivables extends DooModel {
 		return $list;
 	}
 	function delInvoiceReceivablesByIrid($irid = 0) {
-		if (!empty($irid)&&is_numeric($irid))
-			$this->delete(array('where'=>'irid='.$irid));
+		if (! empty ( $irid ) && is_numeric ( $irid ))
+			$this->delete ( array (
+					'where' => 'irid=' . $irid 
+			) );
 	}
 	
 	/**

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

@@ -31,7 +31,7 @@
 					<div class="saeaList">
 					
 						<div class="clearfix">
-							<legend><div class="fR"><a href="/invoiceReceivablesAS/1/Unclaimed/{{year}}/All/">查看所有</a></div>未入账发票</legend>
+							<legend><div class="fR"><a href="/invoiceAS">查看所有</a></div>未入账发票</legend>
 							<!-- if !empty({{invoiceUnAccount}}) -->
 							<div class="input-append">
 							<form action="/invoiceReceivables" id="ira" method="post">
@@ -64,7 +64,9 @@
 									<td>
 									<a href="#invdetail" node-invoice='INFO' data-isKey="{{invoiceUnAccount' value.iidKeyUrl}}" data-toggle="modal">{{invoiceUnAccount' value.invoiceSerial}}</a>
 									</td>
-									<td><a class="button btn-block" href="#recorded" node-invoiceReceivables='INFO' data-isKey="{{invoiceUnAccount' value.iidKeyUrl}}" data-toggle="modal">入账</a></td>
+									<td>
+									<a class="button btn-block" href="#recorded" node-invoiceReceivables='INFO' data-isKey="{{invoiceUnAccount' value.iidKeyUrl}}" data-toggle="modal">入账</a>
+									</td>
 									</tr>
 									<!-- endloop -->
 								</tbody>
@@ -79,7 +81,7 @@
 					
 					<div class="clearfix">
 					
-							<legend><div class="fR"><a href="/invoiceReceivablesAS/1/Unclaimed/{{year}}/All/">查看所有</a></div>最近认领&amp;录入</legend>
+							<legend><div class="fR"><a href="/invoiceReceivablesAS">查看所有</a></div>最近认领&amp;录入</legend>
 							<!-- if !empty({{receivablesInput}}) -->
 							<table class="table table-bordered table-condensed">
 								<tbody>
@@ -312,9 +314,7 @@
 				<!--搜索结果-->
 				<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>			

+ 113 - 18
protected/view/admin/invoiceReceivablesAS.html

@@ -4,6 +4,9 @@
 <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>
+<link href="<?= WEB_SITE_GLOBAL ?>css/datepicker.min.css" rel="stylesheet" type="text/css">
+<script src="<?= WEB_SITE_GLOBAL ?>js/datepicker.min.js"></script>
+<script src="<?= WEB_SITE_GLOBAL ?>js/datepicker.zh.js"></script>
 <body>
 	<div class="mainLayout">
 		<div class="mainMenu">
@@ -24,30 +27,35 @@
 			<div class="adminContent autoHeight">
 				<legend>
 					收款管理
+					<a href="/invoiceAS">发票管理</a>
 				</legend>
 				<div class="demandCate">
 				<form action="/invoiceReceivablesAS/1/{{status}}" id="iras" method="get">
 					<ul class="cateList">
 					<li>
-						<a <!-- if {{status}}=='All' --> class="now" <!-- endif --> href="/invoiceReceivablesAS/1/All/{{year}}/{{month}}/{{MebSea}}">所有</a>
-	  					<a <!-- if {{status}}=='Unclaimed' --> class="now" <!-- endif --> title="未认领" href="/invoiceReceivablesAS/1/Unclaimed/{{year}}/{{month}}/{{MebSea}}">未认领</a>
-	  					<a <!-- if {{status}}=='Credited' --> class="now" <!-- endif --> title="已入账" href="/invoiceReceivablesAS/1/Credited/{{year}}/{{month}}/{{MebSea}}" >已入账</a>
+						<a <!-- if {{status}}=='All' --> class="now" <!-- endif --> href="/invoiceReceivablesAS/1/All">所有</a>
+	  					<a <!-- if {{status}}=='Claim' --> class="now" <!-- endif --> title="未认领" href="/invoiceReceivablesAS/1/Claim">未认领</a>
+	  					<a <!-- if {{status}}=='Unclaimed' --> class="now" <!-- endif --> title="未入账" href="/invoiceReceivablesAS/1/Unclaimed" >未入账</a>
+	  					<a <!-- if {{status}}=='Credited' --> class="now" <!-- endif --> title="已入账" href="/invoiceReceivablesAS/1/Credited" >已入账</a>
 	  				</li>
 					
 					
-	  					<li><select node-iryChange >
-							<!-- include 'year' -->
-						</select>
+	  					<li>
+	  					<div class="search">
+	  					<input type="radio" <!-- if {{timeType}}=='BIND' --> checked <!-- endif --> refreshData=time name="timeType" value="BIND">按到帐时间
+	  					 <input type="radio" <!-- if {{timeType}}=='CREATE' --> checked <!-- endif --> refreshData=time name="timeType"  value="CREATE">按录入时间
+	  					<div class="input-append">
+	  					
+	  					<input class="datepicker-here span3" name="date" value="{{date}}" placeholder="按时间筛选" data-range="true" data-multiple-dates-separator=" : " data-language="zh" type="text">
+	  					<button class="btn btn-small" type="submit">查询</button>
+	  					</div>
+	  					</div>
 	  					
-						<select node-irmChange >
-	  					<option value="All">所有月份</option>
-	  					{{mothHtml}}
-	  					</select>
 	  					</li>
 	  					
 						<li><div class="search"><div class="input-append">
-									<input class="span3" data-irmMebSea placeholder="收款金额,收款信息" value="{{MebSeaEn}}" type="text">
-									<button class="btn btn-small" node-irmMebSea type="button">搜索</button>
+									<input class="span3" data-irmMebSea placeholder="收款金额,收款信息" name="MebSea" value="{{MebSeaEn}}" type="text">
+									<button class="btn btn-small" node-irmMebSea type="submit">搜索</button>
 								</div>
 							</div></li>
 					</ul>
@@ -61,6 +69,7 @@
 						<th>到帐银行/到帐时间</th>
 						<th>录入收款</th>
 						<th>收款认领</th>
+						<th>发票入账</th>
 						<th>开票流水号</th>
 						<th>操作</th>
 					</tr>
@@ -77,14 +86,26 @@
 						<!-- endif -->
 						</td>
 						<td>
+						<!-- if {{list' value.bindStatus}}==1 -->
+						{{list' value.accountClerk}}&nbsp;入账<br/>{{list' value.bindDate}}
+						<!-- elseif {{list' value.bindStatus}}==0&&{{list' value.untreadStatus}}==1 -->
+						{{list' value.untreadStaff}}&nbsp;退票<br/>{{list' value.unbundlingTime}}
+						<!-- endif -->
+						</td>
+						<td>
 						<a href="#invdetail" node-invoice='INFO' data-isKey="{{list' value.iidKeyK}}"  data-toggle="modal">{{list' value.irList.invoiceSerial}}</a>
 						</td>
 						<td>
 						<!-- if {{list' value.receivablesStaff}}=='PUBLIC' -->
-							<a href="#billeidt" data-isKey="{{list' value.iridKey}}" node-irUpdate  data-toggle="modal">修改</a> 
-							<a  href="#billdel" data-isKey="{{list' value.iridKey}}" node-irDelete data-toggle="modal">删除</a>
+							<!-- <a href="#billeidt" data-isKey="{{list' value.iridKey}}" node-irUpdate  data-toggle="modal">修改</a> 
+							<a  href="#billdel" data-isKey="{{list' value.iridKey}}" node-irDelete data-toggle="modal">删除</a>  -->
+						<!-- elseif {{list' value.bindStatus}}==0&&{{list' value.untreadStatus}}==1 -->	
+						<a  href="#search-invoice" bind-invoice='receivables' node-key="{{list' value.iridKey}}" data-toggle="modal">查询发票</a>
+							
 						<!-- elseif {{list' value.receivablesStaff}}!='PUBLIC'&&{{list' value.iid}}==0  -->
 							<a href="#receive" data-isKey="{{list' value.iridKey}}" node-alter data-toggle="modal">变更</a>
+						<!-- elseif {{list' value.bindStatus}}==1 -->
+						<a href="#Unbundling" data-isKey="{{list' value.iridKey}}" node-unBundLing data-toggle="modal">解绑</a>
 						<!-- endif -->
 						</td>
 						</tr>
@@ -137,6 +158,32 @@
 		<div id="nc"></div>
 	</div>
 
+
+
+
+<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">
+		<div class="modal-content">
+    <div class="modal-header">
+    <h3>收款与发票解绑</h3>
+    </div>
+    <div class="modal-body">
+			解绑后,发票与收款 可重新进行新的入账。
+    </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>
+			</div></div>
+</form>
+</div>
+
+
+
+
 	<!--弹出变更-->
 <div class="modal hide fade" id="receive">
 <form action="/invoiceReceivablesUpdateClaim" method="post" class="form-horizontal">
@@ -157,15 +204,16 @@
 					</select>
 				</div>
 			</div>
-			<div class="control-group">
+			<!-- 
+			<div class="control-group" style="display:none">
 				<label class="control-label"></label>
 				<div class="controls">
-					<select name="receivablesStaff" html-staff>
+					<select name="receivablesStaff-delete" html-staff>
 					
 					</select>
 				</div>
 			</div>
-		
+			 -->
     </div>
 	<div class="modal-footer">
 		<input type="submit" class="button" value="确定">
@@ -252,7 +300,54 @@
 </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>
+						
+				</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>