caipin %!s(int64=6) %!d(string=hai) anos
pai
achega
59cd2e80ac

+ 13 - 3
global/js/invoice.validator.js

@@ -14,6 +14,18 @@ function invoiceShow(){
     
 }
 
+function settlementTypeShow(){
+	var chkRadio = $('input:radio[name="settlementType"]:checked').val();
+    if (chkRadio == null) {
+        alert("没有选中项");
+        return false;
+    } else if(chkRadio=='TRAINING') {
+   	 $('#trainingSelect').show();
+    }else if(chkRadio=='SOFTWARE'){
+   	 $('#trainingSelect').hide();
+    }
+}
+
 function mailShow(){
 	var chkRadio = $('input:radio[name="doPost"]:checked').val();
     if (chkRadio == null) {
@@ -27,9 +39,7 @@ function mailShow(){
 }
 
 $(function () {
-	
-	
-	
+		
 	$('#invoiceReceivablesRefund').validator({
 	    timely: 3,
 	    focusCleanup: true,

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

@@ -268,7 +268,9 @@ $acl ['INVOICE'] ['allow'] = array (
 				'invoiceApprovalAchieve',
 				'ajaxGetinvoiceApprovalAchieve',
 				'ajaxGetInvoiceApprovalDetail',
-				'ajaxInvoicePushNotice'
+				'ajaxInvoicePushNotice',
+				'invoiceAddFill',
+				'ajaxGetInvoiceByNew'
 		)
 );
 //信息中心

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

@@ -329,6 +329,8 @@ $route['get']['/delInvoiceCompanyManage/:sidKey/:icidKey'] = array('AdminControl
 //普通
 $route['*']['/invoice'] = array('InvoiceController', 'invoice');
 $route['*']['/invoiceAdd'] = array('InvoiceController', 'invoiceAdd');
+$route['*']['/invoiceAdd'] = array('InvoiceController', 'invoiceAdd');
+$route['*']['/invoiceAdd/AUTOFILL'] = array('InvoiceController', 'invoiceAddFill');
 $route['*']['/invoiceAddDo'] = array('InvoiceController', 'invoiceAddDo');
 $route['post']['/invoiceDroppedDo'] = array('InvoiceController', 'invoiceDroppedDo');
 $route['*']['/invoiceEdit/:iid'] = array('InvoiceController', 'invoiceEdit','extension'=>'.html');
@@ -367,7 +369,7 @@ $route['post']['/invoiceStoreBatchDelete'] = array('InvoiceController', 'invoice
 $route['post']['/invoiceStoreBatchMailItemSet'] = array('InvoiceController', 'invoiceStoreBatchMailItemSet');
 $route['post']['/invoiceStoreBatchApproval'] = array('InvoiceController', 'invoiceStoreBatchApproval');
 
-
+$route['post']['/ajaxGetInvoiceByNew'] = array('InvoiceController', 'ajaxGetInvoiceByNew');
 $route['post']['/ajaxGetMailItemByIstore'] = array('InvoiceController', 'ajaxGetMailItemByIstore');
 
 

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 202 - 86
protected/controller/InvoiceController.php


+ 1 - 1
protected/controller/MainController.php

@@ -6321,7 +6321,7 @@ class MainController extends DooController {
 			$annexEXT = $this->_GetFileEXT ( $_FILES ["annex"] ["name"] );
 			$annexName = "";
 			if (isset ( $_FILES ['annex'] ['name'] )) {
-				if ((($annexEXT == "doc") || ($annexEXT == "xls") || ($annexEXT == "pdf") || ($annexEXT == "ppt") || ($annexEXT == "txt") || ($annexEXT == "smr") || ($annexEXT == "spu") || ($annexEXT == "zip") || ($annexEXT == "rar") || ($annexEXT == "jpg") || ($annexEXT == "png")) && ($_FILES ["annex"] ["size"] < 10485760)) {
+				if ((($annexEXT == "doc")|| ($annexEXT == "docx")  || ($annexEXT == "xls") || ($annexEXT == "pdf") || ($annexEXT == "ppt") || ($annexEXT == "txt") || ($annexEXT == "smr") || ($annexEXT == "spu") || ($annexEXT == "zip") || ($annexEXT == "rar") || ($annexEXT == "jpg") || ($annexEXT == "png")) && ($_FILES ["annex"] ["size"] < 10485760)) {
 					$path = DOO::conf ()->SITE_PATH . "upload/emailAnnex/";
 					if (! file_exists ( $path . $_FILES ["annex"] ["name"] )) {
 						$fileName = time () . "." . $annexEXT;

+ 75 - 47
protected/model/invoice.php

@@ -193,6 +193,9 @@ class invoice extends DooModel {
 	 */
 	public $printTime;
 	public $postTime;
+	public $settlementType;
+	
+	
 	public $_table = 'CLD_invoice';
 	public $_primarykey = 'iid';
 	public $_fields = array (
@@ -251,7 +254,8 @@ class invoice extends DooModel {
 			'updateTime',
 			'printTime',
 			'postTime',
-			'bindTime' 
+			'bindTime',
+			'settlementType' 
 	);
 	/**
 	 * 根据发票ID获取一条发票数据
@@ -403,11 +407,18 @@ class invoice extends DooModel {
 		
 		$detail ['expressCompany'] = '';
 		$detail ['expressCom'] = '';
+		$detail ['invoiceTraining'] = array ();
 		if (! empty ( $detail ['expressCompany'] )) {
 			$express = explode ( ":", $detail ['expressCompany'] );
 			$detail ['expressCompany'] = $express [0];
 			$detail ['expressCom'] = $express [1];
 		}
+		// 培训班
+		if ($detail ['settlementType'] == 1) {
+			Doo::loadModel ( 'invoiceTraining' );
+			$invoiceTraining = new invoiceTraining ();
+			$detail ['invoiceTraining'] = $invoiceTraining->getInvoiceTrainingByItid ( $detail ['trainId'] );
+		}
 		
 		$detail ['iidKeyXD'] = $this->authcode ( $detail ['iid'], '' );
 		
@@ -433,13 +444,12 @@ class invoice extends DooModel {
 		$query = Doo::db ()->query ( $sql );
 		return $result = $query->fetchAll ();
 	}
-	
-	function getInvoiceByTrainingCount($itid=0){
-		if (empty($itid))
+	function getInvoiceByTrainingCount($itid = 0) {
+		if (empty ( $itid ))
 			return 0;
 		$detail = $this->count ( array (
 				'where' => "trainId= '" . $itid . "' and untreadStatus!=2", // and sid=".$sid,
-				'asArray' => TRUE
+				'asArray' => TRUE 
 		) );
 		return $detail;
 	}
@@ -557,7 +567,7 @@ class invoice extends DooModel {
 			$list = $this->find ( array (
 					'where' => "status=2 and printStatus=" . $status . " and untreadStatus=0 and moldManage like '%[\"" . $sid . "\",%'",
 					'desc' => 'approvalTime',
-					'limit'=>10,
+					'limit' => 10,
 					'asArray' => TRUE 
 			) );
 		elseif (! empty ( $sid ) && ! empty ( $iid ))
@@ -672,7 +682,7 @@ class invoice extends DooModel {
 	 * @param integer $postStatus 0为获取需要邮寄的发票,1为获取已经邮寄的发票
 	 * @return array|array() 返回相关数据
 	 */
-	public function getPostByInvoice($postStatus = 0,$desc="desc") {
+	public function getPostByInvoice($postStatus = 0, $desc = "desc") {
 		Doo::loadClass ( 'XDeode' );
 		$XDeode = new XDeode ( 5 );
 		$list = $this->find ( array ( // and untreadStatus=0
@@ -706,7 +716,7 @@ class invoice extends DooModel {
 		if (empty ( $iid )) {
 			$list = $this->find ( array ( // printStatus=1 and
 					'where' => " untreadStatus=" . $untreadStatus . " and status=2 ",
-					'limit'=>10,
+					'limit' => 10,
 					'asArray' => TRUE 
 			) );
 			
@@ -785,7 +795,7 @@ class invoice extends DooModel {
 				'limit' => $limit,
 				$desc => 'approvalTime',
 				'asArray' => TRUE 
-		) );//echo $con;
+		) ); // echo $con;
 		Doo::loadClass ( 'XDeode' );
 		$XDeode = new XDeode ( 5 );
 		Doo::loadModel ( 'invoiceReceivables' );
@@ -820,9 +830,9 @@ class invoice extends DooModel {
 			$list [$key] ['sumPrice'] = 0;
 			if (! empty ( $list [$key] ['irList'] ))
 				$list [$key] ['sumPrice'] = $list [$key] ['irList'] [0] ['sumPrice'];
-				$list [$key] ['diffPrice'] = $list [$key]['invoicePrice'];
-				if(!empty($list [$key] ['irList'] [0] ['sumPrice']))
-					$list [$key] ['diffPrice'] = $list [$key]['invoicePrice']-$list [$key] ['irList'] [0] ['sumPrice'];
+			$list [$key] ['diffPrice'] = $list [$key] ['invoicePrice'];
+			if (! empty ( $list [$key] ['irList'] [0] ['sumPrice'] ))
+				$list [$key] ['diffPrice'] = $list [$key] ['invoicePrice'] - $list [$key] ['irList'] [0] ['sumPrice'];
 				// $list [$key] ['operationLog'] = $invoiceOperationLog->getInvoiceOperationLogByIid ( $value ['iid'], 'desc' );
 			$list [$key] ['lossDetail'] = array ();
 			if ($value ['lossIid'] != 0) {
@@ -847,38 +857,41 @@ class invoice extends DooModel {
 	 * 公司应收款汇总
 	 * @param unknown $con
 	 */
-	function getInvoiceCompanyStatistics($con=''){
-		if(empty($con))
-			return array();
+	function getInvoiceCompanyStatistics($con = '') {
+		if (empty ( $con ))
+			return array ();
 		$sql = 'select  invoicePrice,iid 
 				from ' . $this->_table . '
-						where '.$con.'
+						where ' . $con . '
 						 ';
 		
-		
 		$query = Doo::db ()->query ( $sql );
 		$result = $query->fetchAll ();
-		$iidlist=array();
-		$invoicePrice=0;
-		foreach ($result as $value){
-			array_push($iidlist, $value['iid']);
-			$invoicePrice+=$value['invoicePrice'];
+		$iidlist = array ();
+		$invoicePrice = 0;
+		foreach ( $result as $value ) {
+			array_push ( $iidlist, $value ['iid'] );
+			$invoicePrice += $value ['invoicePrice'];
 		}
-		$iidString=implode(',', $iidlist);
+		$iidString = implode ( ',', $iidlist );
 		
-		//获得已收款发票
-		if (!empty($iidString)){
-		$sql = 'select sum(receivablesPrice) as receivablesPrice 
+		// 获得已收款发票
+		if (! empty ( $iidString )) {
+			$sql = 'select sum(receivablesPrice) as receivablesPrice 
 				from CLD_invoiceReceivables 
 				where iid in (' . $iidString . ')  and bindStatus=1
 				GROUP BY bindStatus';
-		$query = Doo::db ()->query ( $sql );
-		$result = $query->fetch ();
-		}else{
-			$result['receivablesPrice']=0;
+			$query = Doo::db ()->query ( $sql );
+			$result = $query->fetch ();
+		} else {
+			$result ['receivablesPrice'] = 0;
 		}
 		
-		return array('invoicePrice'=>$invoicePrice,'receivablesPrice'=>$result['receivablesPrice'],'diffPrice'=>$invoicePrice-$result['receivablesPrice']);
+		return array (
+				'invoicePrice' => $invoicePrice,
+				'receivablesPrice' => $result ['receivablesPrice'],
+				'diffPrice' => $invoicePrice - $result ['receivablesPrice'] 
+		);
 	}
 	
 	/**
@@ -908,7 +921,7 @@ class invoice extends DooModel {
 				'asArray' => TRUE 
 		) );
 		
-		if ($recordCount==0)
+		if ($recordCount == 0)
 			return 0;
 		return $recordCount / $allCount;
 	}
@@ -918,32 +931,32 @@ class invoice extends DooModel {
 	 */
 	function getInvoiceScheduleByCidGroupSid($cid = 0) {
 		if (empty ( $cid ))
-			return array();
+			return array ();
 			
-		//完成发票
+			// 完成发票
 		$recordCount = $this->find ( array (
-				'select'=>'count(*) as count,sid',
+				'select' => 'count(*) as count,sid',
 				'where' => " status=2 and printStatus=1 and untreadStatus=3  and cid =" . $cid,
-				'groupby'=>'sid',
+				'groupby' => 'sid',
 				'asArray' => TRUE 
 		) );
 		
-		//当月创建的发票
+		// 当月创建的发票
 		$allCount = $this->find ( array (
-				'select'=>'count(*) as count,sid',
+				'select' => 'count(*) as count,sid',
 				'where' => " isDelete=0  and cid =" . $cid,
-				'groupby'=>'sid',
+				'groupby' => 'sid',
 				'asArray' => TRUE 
 		) );
 		
-		$list=array();
-		foreach ($recordCount as $key=>$value){
-			foreach ($allCount as $k=>$v){
-				if ($value['sid']==$v['sid']){
-					if ($value['count']==0)
-						$list[$value['sid']]=0;
-					else 
-						$list[$value['sid']]=(int)(($value['count'] / $v['count'])*100);
+		$list = array ();
+		foreach ( $recordCount as $key => $value ) {
+			foreach ( $allCount as $k => $v ) {
+				if ($value ['sid'] == $v ['sid']) {
+					if ($value ['count'] == 0)
+						$list [$value ['sid']] = 0;
+					else
+						$list [$value ['sid']] = ( int ) (($value ['count'] / $v ['count']) * 100);
 				}
 			}
 		}
@@ -952,6 +965,21 @@ class invoice extends DooModel {
 	}
 	
 	/**
+	 * 获得个人最新发票信息
+	 */
+	function getInvoiceByNew($sid = 0) {
+		if (empty ( $sid ))
+			return array ();
+		
+		$Detail = $this->getOne ( array (
+				'where' => "sid=" . $sid,
+				'desc' => 'iid',
+				'asArray' => TRUE 
+		) );
+		return $Detail;
+	}
+	
+	/**
 	 * 加密或解密指定字符串
 	 *
 	 * @param string $string 要加密或解密的字符串

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 15 - 2
protected/model/invoiceStore.php


+ 23 - 1
protected/model/invoiceTraining.php

@@ -235,7 +235,8 @@ class invoiceTraining extends DooModel {
 	function getInvoiceTrainingByItid($itid = 0) {
 		Doo::loadClass ( 'XDeode' );
 		$XDeode = new XDeode ( 5 );
-		$itid = $XDeode->decode ( $itid );
+		if (!is_numeric($itid))
+			$itid = $XDeode->decode ( $itid );
 		
 		$detail = array ();
 		if (! empty ( $itid ) && is_numeric ( $itid )) {
@@ -273,6 +274,27 @@ class invoiceTraining extends DooModel {
 	}
 	
 	/**
+	 * 获得未完成的培训班
+	 * @return string
+	 */
+	function getInvoiceTrainingByUnfinished(){
+		$condition = array (
+				'where' => "(status= 0 or status=1)",
+				'asArray' => true 
+		);
+		
+		$list = $this->find ( $condition );
+		
+		Doo::loadClass ( 'XDeode' );
+		$XDeode = new XDeode ( 5 );
+		foreach ( $list as $key => $value ) {
+			$list[$key] ['itidKey'] = $XDeode->encode ( $value ['itid'] );
+		}
+		
+		return $list;
+	}
+	
+	/**
 	 * 获得所有培训班
 	 */
 	function getInvoiceTrainingBySubmitStatus() {

+ 20 - 2
protected/view/admin/invoiceAdd.html

@@ -27,12 +27,14 @@
 						<form action="/invoiceAddDo"  method="post" id="invoice">
 						<table class="table table-bordered table-condensed">
 								<tbody>
+								<blockquote><p class=""><a href="/invoiceAdd/AUTOFILL" copy-invoice>加载上一张开票信息</a></p></blockquote>
+								
 								<tr>
 									<th class="taC" width="150">所在办事处</th>
 									<td>
 										<select name="cid">
-											<!-- loop category -->
-								<option <!-- if {{category' value.cid}} == {{staff.0.cid}}  --> selected <!-- endif -->  value="{{category' value.cid}}" >{{category' value.title}}</option>
+								<!-- loop category -->
+								<option <!-- if {{category' value.cid}} == {{staff.0.cid}}  --> selected <!-- endif --> value="{{category' value.cid}}" >{{category' value.title}}</option>
 								<!-- endloop -->
 										</select>
 									</td>
@@ -74,6 +76,22 @@
 									<label class="radio inline colRed"><input name="invoiceType" id="invoiceSpecial" onclick="invoiceShow()"  value="1" type="radio">增值税专用发票</label>
 									</td>
 								</tr>
+								
+								<tr>
+									<th class="taC"><span class="colRed">*</span>结算方式</th><td colspan="3">
+									<label class="radio inline"><input type="radio" checked onclick="settlementTypeShow()" name="settlementType" value="SOFTWARE" data-rule="checked">软件销售</label>
+									<label class="radio inline">		<input type="radio" onclick="settlementTypeShow()" name="settlementType" value="TRAINING">培训班</label>
+									<label class="radio inline" id='trainingSelect' style="display:none">
+									<select name='trainId'>
+									<!-- loop itList -->
+									<option value="{{itList' value.itidKey}}">{{itList' value.trainName}}</option>
+									<!-- endloop -->
+									</select>
+									</label>
+									<p class="colGray">结算方式影响您的工资提成,请正确选择!</p>
+									</td>
+								</tr>
+								
 								</tbody>
 							</table>
 						<table id="plainInvoice_box" class="table table-bordered table-condensed">

+ 12 - 1
protected/view/admin/invoiceApprovalDetail.html

@@ -48,8 +48,19 @@
 							</tr>
 							<tr>
 								<th class="taC">开票金额</th><td colspan="3"><b class="colOrange" style="font-size:18px">¥{{invoiceDetail.invoicePrice}}</b></td>
-								
 							</tr>
+							
+							<!-- if {{invoiceDetail.settlementType}}==1 -->
+							<tr>
+					<th class="taC" width="150">结算方式</th>
+						<td colspan="3">培训班(<a href="/invoiceTrainingDetail/{{invoiceDetail.invoiceTraining.trainingKey}}.html" target="_blank">{{invoiceDetail.invoiceTraining.trainName}}</a>)</td>
+					</tr>
+					<!-- else -->
+					<tr>
+						<th class="taC" width="150">结算方式</th><td colspan="3">软件销售</td>
+					</tr>
+					<!-- endif -->
+							
 							</tbody>
 						</table>
 						<!-- if {{invoiceDetail.invoiceType}}==0 -->

+ 11 - 1
protected/view/admin/invoicePrintDetail.html

@@ -46,8 +46,18 @@
 							</tr>
 							<tr>
 								<th class="taC">开票金额</th><td colspan="3"><b class="colOrange" style="font-size:18px">¥{{invoiceDetail.invoicePrice}}</b></td>
-								
 							</tr>
+							
+							<!-- if {{invoiceDetail.settlementType}}==1 -->
+							<tr>
+					<th class="taC" width="150">结算方式</th>
+						<td colspan="3">培训班(<a href="/invoiceTrainingDetail/{{invoiceDetail.invoiceTraining.trainingKey}}.html" target="_blank">{{invoiceDetail.invoiceTraining.trainName}}</a>)</td>
+					</tr>
+					<!-- else -->
+					<tr>
+						<th class="taC" width="150">结算方式</th><td colspan="3">软件销售</td>
+					</tr>
+					<!-- endif -->
 							</tbody>
 						</table>