Selaa lähdekoodia

内训更新上传

caipin 5 vuotta sitten
vanhempi
commit
d36af9e596

+ 34 - 34
global/js/index.js

@@ -1452,40 +1452,40 @@ function getLongleLog(lid) {
 	
 }
 
-function getClientInfo(client){
-
-	//var client=$(this).attr('data');
-	
-	var url="/getClientInfo";
-	
-	$.ajax({
-		url:url,
-		type: "post",
-		cache: false,
-		dataType: "json",
-		data: {
-			client:client
-		},
-		global: true,
-		success: function(data){
-			
-			if(data.success){
-				alert('请重新登录');
-			}
-			
-			$('#clientInfo').html(data.html);
-			$('#clientInfo').show();
-			$('#staffInfo').hide();
-			$('#longleLog').hide();
-			$('#addClient').hide();
-			$('#changeCompany').hide();
-			autoFlashHeight();
-		},
-		error:function(err){
-		}
-		});
-	
-}
+// function getClientInfo(client){
+//
+// 	//var client=$(this).attr('data');
+//
+// 	var url="/getClientInfo";
+//
+// 	$.ajax({
+// 		url:url,
+// 		type: "post",
+// 		cache: false,
+// 		dataType: "json",
+// 		data: {
+// 			client:client
+// 		},
+// 		global: true,
+// 		success: function(data){
+//
+// 			if(data.success){
+// 				alert('请重新登录');
+// 			}
+//
+// 			$('#clientInfo').html(data.html);
+// 			$('#clientInfo').show();
+// 			$('#staffInfo').hide();
+// 			$('#longleLog').hide();
+// 			$('#addClient').hide();
+// 			$('#changeCompany').hide();
+// 			autoFlashHeight();
+// 		},
+// 		error:function(err){
+// 		}
+// 		});
+//
+// }
 
 function aServiceLog(a,b,c){
 	

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

@@ -487,6 +487,7 @@ $acl ['RECEIPTSEXTEND'] ['allow'] = array (
 				'receiptTrainAssistDelDo',
 				'exportReceiptTrainExcel',
 				'receiptTrainItemEdiDo',
+                'receiptTrainRevenue',
 		)
 );
 $acl ['RECEIPTSAJAX'] ['allow'] = array (

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

@@ -284,17 +284,14 @@ $route['*']['/receiptTrainImplement/:ridKey'] = array('ReceiptExtendController',
 $route['*']['/receiptTrainImplementDo'] = array('ReceiptExtendController', 'receiptTrainImplementDo');
 $route['*']['/receiptTrainImplementWateDo'] = array('ReceiptExtendController', 'receiptTrainImplementWateDo');
 
-
-
 $route['*']['/ajaxSetRceiptAmountByRid'] = array('ReceiptAjaxController', 'ajaxSetRceiptAmountByRid');
 $route['*']['/ajaxGetReceiptDetailByJson'] = array('ReceiptAjaxController', 'ajaxGetReceiptDetailByJson');
 
 $route['*']['/receiptWasteBook'] = array('ReceiptExtendController', 'receiptWasteBook');
-
 $route['*']['/receiptWasteBookAddDo'] = array('ReceiptExtendController', 'receiptWasteBookAddDo');
-
 $route['*']['/exportReceiptTrainExcel'] = array('ReceiptExtendController', 'exportReceiptTrainExcel');
 
+$route['*']['/receiptTrainRevenue'] = array('ReceiptExtendController', 'receiptTrainRevenue');
 
 
 

+ 7 - 16
protected/controller/MainController.php

@@ -4560,8 +4560,6 @@ class MainController extends DooController {
 					    <h3><span class="fR"><a>' . $staffInfo ['category'] . ' ' . $staffInfo ['username'] . '</a></span>' . $clientInfo ['clientname'] . '</h3>
 					    </div>
 
-
-
 					    <div class="modal-body">
 	    <div class="modalClientTable">
 			<table width="100%">
@@ -4582,20 +4580,13 @@ class MainController extends DooController {
 			<div class="modal-footer">
 	    <a href="javascript:void(0)" onclick="closeClick()" class="button btn-gray" data-dismiss="modal" aria-hidden="true">关闭</a>
 	</div>
-
-</div></div>
-
-
-
-
-
-		  			' 
+</div></div>'
 		);
 		echo json_encode ( $clientHtml );
 	}
 	function ajaxGetClientInfo() {
 		$clientname = $this->get_args ( 'client' )&&is_numeric($this->get_args ( 'client' )) ? $this->get_args ( 'client' ) : "";
-		
+
 		if ($clientname == "") {
 			echo json_encode ( array (
 					"success" => false 
@@ -5575,7 +5566,7 @@ class MainController extends DooController {
 							<li class="item iconBorrow">借出<' . $value ['category'] . '<a  href="javascript:void(0);" onclick="getStaffInfo(\'' . $value ['operator'] . '\')" >' . $value ['operator'] . '</a></li>
 
 							<li class="item">' . $value ['product'] . '</li>
-							<li class="item"><a href="javascript:void(0);" onclick="getClientInfo(\'' . $value ['clientid'] . "," . $value ['client'] . '\')"  >' . $value ['client'] . '</a></li>
+							<li class="item"><a href="javascript:void(0);" onclick="getClientInfo(\'' . $value ['clientid'] .'\')"  >' . $value ['client'] . '</a></li>
 						</ul>';
 				// 销售
 			} elseif ($value ['status'] == 4) {
@@ -5584,7 +5575,7 @@ class MainController extends DooController {
 							<li class="item iconSell">销售<' . $value ['category'] . '<a  href="javascript:void(0);" onclick="getStaffInfo(\'' . $value ['operator'] . '\')" >' . $value ['operator'] . '</a></li>
 
 							<li class="item">' . $value ['product'] . '</li>
-							<li class="item"><a href="javascript:void(0);" onclick="getClientInfo(\'' . $value ['clientid'] . "," . $value ['client'] . '\')" >' . $value ['client'] . '</a></li>
+							<li class="item"><a href="javascript:void(0);" onclick="getClientInfo(\'' . $value ['clientid'] .  '\')" >' . $value ['client'] . '</a></li>
 						</ul>';
 				// 升级
 			} elseif ($value ['status'] == 5) {
@@ -5593,7 +5584,7 @@ class MainController extends DooController {
 							<li class="item iconUpdate">升级<' . $value ['category'] . '<a  href="javascript:void(0);" onclick="getStaffInfo(\'' . $value ['operator'] . '\')" >' . $value ['operator'] . '</a></li>
 
 							<li class="item">' . $value ['product'] . '</li>
-							<li class="item"><a href="javascript:void(0);" onclick="getClientInfo(\'' . $value ['clientid'] . "," . $value ['client'] . '\')" >' . $value ['client'] . '</a></li>
+							<li class="item"><a href="javascript:void(0);" onclick="getClientInfo(\'' . $value ['clientid'] .  '\')" >' . $value ['client'] . '</a></li>
 						</ul>';
 				// 更换
 			} elseif ($value ['status'] == 6) {
@@ -5602,7 +5593,7 @@ class MainController extends DooController {
 							<li class="item iconReplace">更换<' . $value ['category'] . '<a  href="javascript:void(0);"  onclick="getStaffInfo(\'' . $value ['operator'] . '\')">' . $value ['operator'] . '</a></li>
 
 							<li class="item"><a href="javascript:void(0);" onclick="getLockByName(\'' . $value ['new_key_num'] . '\')">' . $value ['new_key_num'] . '</a>
-							<li class="item"><a href="javascript:void(0);" onclick="getClientInfo(\'' . $value ['clientid'] . "," . $value ['client'] . '\')" >' . $value ['client'] . '</a></li>
+							<li class="item"><a href="javascript:void(0);" onclick="getClientInfo(\'' . $value ['clientid'] .  '\')" >' . $value ['client'] . '</a></li>
 						</ul>';
 				// 回收
 			} elseif ($value ['status'] == 7) {
@@ -5623,7 +5614,7 @@ class MainController extends DooController {
 				$html .= '<ul class="flowList">
 							<li class="item iconGif">赠送 &lt; ' . $value ['category'] . '<a  href="javascript:void(0);" onclick="getStaffInfo(\'' . $value ['operator'] . '\')">' . $value ['operator'] . '</a></li>
 
-							<li class="item"><a href="javascript:void(0);" onclick="getClientInfo(\'' . $value ['clientid'] . "," . $value ['client'] . '\')" >' . $value ['client'] . '</a></li>
+							<li class="item"><a href="javascript:void(0);" onclick="getClientInfo(\'' . $value ['clientid'] .  '\')" >' . $value ['client'] . '</a></li>
 						</ul>';
 			}
 			$html .= '</div>';

+ 18 - 0
protected/model/invoice.php

@@ -260,6 +260,24 @@ class invoice extends DooModel {
 			'settlementType',
 			'accountingTime'
 	);
+
+    /**
+     * 获得培训班结算金额总和
+     * @param iids $
+     * @return int
+     */
+	function getInvoicePriceByIids($iids=''){
+        if (empty($iids)){
+            return 0;
+        }
+        $sum = $this->getOne ( array (
+            'select' => 'sum(invoicePrice) as price',
+            'where' => " iid in (" .$iids.")",
+            'asArray' => TRUE
+        ) );
+        return $sum['price'];
+    }
+
 	/**
 	 * 根据发票ID获取一条发票数据
 	 * @param number $iid 发票ID

+ 85 - 1
protected/model/receipt.php

@@ -37,6 +37,8 @@ class receipt extends DooModel {
 	public $trainId;
 	public $trainLoanRid;
 	public $invoiceTrainId;
+	public $paidStatus;
+
 	public $_table = 'CLD_receipt';
 	public $_primarykey = 'rid';
 	public $_fields = array (
@@ -75,8 +77,90 @@ class receipt extends DooModel {
 			'remittanceBankType',
 			'trainId',
 			'trainLoanRid',
-			'invoiceTrainId' 
+			'invoiceTrainId' ,
+            'paidStatus'
 	);
+
+    /**
+     * 获得培训班结算未收款
+     */
+	function getReceiptTrainByPaid($un=0,$limit=5){
+        $sql = "select b.* ,a.invoiceTrainId,a.rid
+                from " . $this->_table . " as a left JOIN CLD_receiptTraining as b on (a.trainId=b.rtid) 
+                where a.status not in (3,4,5) and a.Rtype=3 and a.trainId!=0 and invoiceTrainId!=0 and paidStatus=".$un."  limit ".$limit;
+
+       $query = Doo::db ()->query ( $sql );
+       $result = $query->fetchAll ();
+
+        Doo::loadModel ( 'invoiceTraining' );
+        $invoiceTraining = new invoiceTraining ();
+        Doo::loadClass ( 'XDeode' );
+        $XDeode = new XDeode ( 7 );
+
+        Doo::loadModel ( 'RItem' );
+        $RItem = new RItem ();
+        Doo::loadModel ( 'RILecturer' );
+        $RILecturer = new RILecturer ();
+        Doo::loadModel ( 'accountItem' );
+        $accountItem = new accountItem ();
+
+       foreach ($result as $key=>$value){
+           $result[$key]['ridKey']= $XDeode->encode ( $value ['rid'] );
+           $result[$key]['iTrain']=$invoiceTraining->getInvoiceTrainingByItid ( $value ['invoiceTrainId'] );
+           $result[$key]['iTrain']['receivablesAmount']=sprintf ( "%.2f",$result[$key]['iTrain']['invoiceTotalAmount']-$result[$key]['iTrain']['invoiceArriveAmount']);
+           $RItemList = $RItem->getRItemByRid ( $value ['rid'] );
+           $RILecturerList = $RILecturer->getRILecturerByRid ( $value ['rid'] );
+           // 支出项金额详情
+           $expendList= $accountItem->getTrainingDetail ( $RItemList, $RILecturerList );
+           $result[$key]['iTrain']['expendAmount']=sprintf ( "%.2f",$expendList['total']);
+           $result[$key]['iTrain']['profit']= sprintf ( "%.2f",$result[$key]['iTrain']['invoiceTotalAmount']-$expendList['total']);
+
+       }
+       return $result;
+    }
+
+    /**
+     * 获得培训班 年营收图表
+     */
+    function getReceiptTrainByYearChart($year=''){
+        if(empty($year)){
+            $year=date("Y");
+        }
+
+        $sql = "select GROUP_CONCAT(rid) as rid,GROUP_CONCAT(invoiceTrainId) as invoiceTrainId,date_format(date,\"%m\") as month
+                from " . $this->_table . " 
+                where status not in (3,4,5) and Rtype=3 and trainId!=0 and invoiceTrainId!=0  and Year(date) =".$year."
+                GROUP BY Month(date)";
+//and paidStatus=1
+        $query = Doo::db ()->query ( $sql );
+        $result = $query->fetchAll ();
+
+        Doo::loadModel ( 'RItem' );
+        $RItem = new RItem ();
+        Doo::loadModel ( 'RILecturer' );
+        $RILecturer = new RILecturer ();
+        Doo::loadModel ( 'accountItem' );
+        $accountItem = new accountItem ();
+        Doo::loadModel ( 'invoice' );
+        $invoice = new invoice ();
+
+        $MonthPriceList=array();
+        foreach ($result as $key=>$value){
+            //获得支出金额总和
+            $RIprice=$RItem->getRItemPriceByRids($value['rid']);
+            //收款金额总和
+            $ITprice=$invoice->getInvoicePriceByIids($value['invoiceTrainId']);
+
+            $MonthPriceList[$value['month']]=array(
+                'RIprice'=>$RIprice,
+                'ITprice'=>$ITprice
+            );
+        }
+
+
+        return $MonthPriceList;
+    }
+
 	function receiptByYear($dateCondition, $sid) {
 		$sql = "select sum(sum) as sum from " . $this->_table . " where staff= '" . $sid . "' " . $dateCondition . " and status=2 ";
 		// echo '<div style="display:none">'.$sql.'</div>';

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1 - 1
protected/view/lock_look.html


+ 38 - 20
protected/view/receipt/receiptTrainRevenue.html

@@ -1,5 +1,7 @@
 <!-- include '../header' -->
 <script src="<?= receipt ?>"></script>
+<script src="<?= WEB_SITE_GLOBAL ?>js/echarts.common.min.js"> </script>
+
 <body>
 	<div class="mainLayout">
 		<div class="mainMenu">
@@ -39,15 +41,24 @@
 									<legend>收款未完成</legend>
 									<table class="table table-bordered table-condensed">
 										<tbody>
-										<tr><th class="taC">培训班名称</th><th class="taC">开班时间</th><th class="taC">完成结算</th><th class="taC">开票金额</th><th class="taC">收款金额</th><th class="taC">应收款总额</th></tr>
 										<tr>
-											<th><a href="saea-train-detail.html">XXX培训班</a></th>
-											<td class="taC">2019-05-01</td>
-											<td class="taC">2019-05-16</td>
-											<td class="taR">¥300000.00</td>
-											<td class="taR">¥270000.00</td>
-											<td class="taR colRed">¥30000.00</td>
+											<th class="taC">培训班名称</th>
+											<th class="taC">开班时间</th>
+											<th class="taC">完成结算</th>
+											<th class="taC">开票金额</th>
+											<th class="taC">实际收款金额</th>
+											<th class="taC">应收款总额</th>
 										</tr>
+										<!-- loop unpaid -->
+										<tr>
+											<th><a href="/receiptTrain/approval/{{unpaid' value.ridKey}}.html">{{unpaid' value.trainName}}</a></th>
+											<td class="taC">{{unpaid' value.trainStartDate}}</td>
+											<td class="taC">{{unpaid' value.trainEndDate}}</td>
+											<td class="taR">¥{{unpaid' value.iTrain.invoiceTotalAmount}}</td>
+											<td class="taR">¥{{unpaid' value.iTrain.invoiceArriveAmount}}</td>
+											<td class="taR colRed">¥{{unpaid' value.iTrain.receivablesAmount}}</td>
+										</tr>
+										<!-- endloop -->
 										</tbody>
 									</table>
 								</div>
@@ -55,15 +66,24 @@
 									<legend><div class="fR"><a href="saea-train-all.html">所有培训班</a></div>最近收款完成</legend>
 									<table class="table table-bordered table-condensed">
 										<tbody>
-										<tr><th class="taC">培训班名称</th><th class="taC">开班时间</th><th class="taC">完成结算</th><th class="taC">收入</th><th class="taC">支出</th><th class="taC">利润</th></tr>
 										<tr>
-											<th><a href="saea-train-detail.html">XXX培训班</a></th>
-											<td class="taC">2019-05-01</td>
-											<td class="taC">2019-05-16</td>
-											<td class="taR">¥300000.00</td>
-											<td class="taR">¥70000.00</td>
-											<td class="taR">¥130000.00</td>
+											<th class="taC">培训班名称</th>
+											<th class="taC">开班时间</th>
+											<th class="taC">完成结算</th>
+											<th class="taC">收入</th>
+											<th class="taC">支出</th>
+											<th class="taC">利润</th>
+										</tr>
+										<!-- loop paid -->
+										<tr>
+											<th><a href="/receiptTrain/approval/{{unpaid' value.ridKey}}.html">{{unpaid' value.trainName}}</a></th>
+											<td class="taC">{{unpaid' value.trainStartDate}}</td>
+											<td class="taC">{{unpaid' value.trainEndDate}}</td>
+											<td class="taR">¥{{unpaid' value.iTrain.invoiceTotalAmount}}</td>
+											<td class="taR">¥{{unpaid' value.iTrain.expendAmount}}</td>
+											<td class="taR">¥{{unpaid' value.iTrain.profit}}</td>
 										</tr>
+										<!-- endloop -->
 										</tbody>
 									</table>
 								</div>
@@ -101,9 +121,7 @@
 	        xAxis: [{
 	            type: 'category',
 	            boundaryGap: true,
-	            data: [
-	                '2017-02', '2017-03', '2017-04', '2017-05', '2017-06', '2017-07', '2017-08', '2017-09', '2017-10'
-	            ]
+	            data: {{month}}
 	        }],
 	        yAxis: [{
 	            type: 'value',
@@ -125,7 +143,7 @@
 	                        }
 	                    }
 	                },
-	                data: [30, 40, 30, 40, 50, 60, 40, 55, 40]
+	                data: {{pay}}
 	            },
 	            {
 	                name: '收入',
@@ -140,7 +158,7 @@
 	                        }
 	                    }
 	                },
-	                data: [10, 20, 20, 10, 10, 10, 10, 5, 15]
+	                data: {{income}}
 	            },
 	            {
 	                name: '利润',
@@ -155,7 +173,7 @@
 	                        }
 	                    }
 	                },
-	                data: [20, 20, 10, 30, 40, 50, 30, 50, 25]
+	                data: {{profit}}
 	            }
 	        ]
 	    };