فهرست منبع

费用结算审批

caipin 6 سال پیش
والد
کامیت
2383cb2e41

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 4 - 2
global/js/index.js


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

@@ -453,6 +453,16 @@ $acl ['RECEIPTS'] ['allow'] = array (
 				'receiptTrainApprovalDo',
 		)
 );
+$acl ['RECEIPTSEXTEND'] ['allow'] = array (
+		'ReceiptExtendController' => array (
+				'receiptTrain',
+				'receiptTrainLoan',
+				'receiptTrainInvoice',
+				'receiptTrainItem',
+				'receiptTrainLecturer',
+				'receiptWasteBook',
+		)
+);
 $acl ['RECEIPTSAJAX'] ['allow'] = array (
 		'ReceiptAjaxController' => array (
 				'ajaxGetReceiptTrainLoan',
@@ -505,6 +515,7 @@ $acl ['HR'] ['allow'] = array (
 				'reentryApprovalsAdd',
 				'employeeReentryApply',
 				'employeeReentryApprovals',
+				'employeRegularApprovalsAdd',
 				
 		)
 );

+ 9 - 0
protected/config/routes.conf.php

@@ -256,6 +256,15 @@ $route['*']['/receiptTrainLecturerAddDo'] = array('ReceiptController', 'receiptT
 $route['*']['/receiptTrainLecturerDelDo'] = array('ReceiptController', 'receiptTrainLecturerDelDo');
 $route['*']['/receiptTrainApprovalDo'] = array('ReceiptController', 'receiptTrainApprovalDo');
 
+$route['*']['/receiptTrain/:ridKey'] = array('ReceiptExtendController', 'receiptTrain','extension'=>'.html');
+$route['*']['/receiptTrain/:showType/:ridKey'] = array('ReceiptExtendController', 'receiptTrain','extension'=>'.html');
+$route['*']['/receiptTrainLoan/:showType/:ridKey'] = array('ReceiptExtendController', 'receiptTrainLoan','extension'=>'.html');
+$route['*']['/receiptTrainInvoice/:showType/:ridKey'] = array('ReceiptExtendController', 'receiptTrainInvoice','extension'=>'.html');
+$route['*']['/receiptTrainItem/:showType/:ridKey'] = array('ReceiptExtendController', 'receiptTrainItem','extension'=>'.html');
+$route['*']['/receiptTrainLecturer/:showType/:ridKey'] = array('ReceiptExtendController', 'receiptTrainLecturer','extension'=>'.html');
+
+$route['*']['/receiptWasteBook'] = array('ReceiptExtendController', 'receiptWasteBook');
+
 
 //邮件群发
 $route['*']['/eMailTask'] = array('MainController', 'eMailTask');

+ 6 - 2
protected/controller/HumanResourceController.php

@@ -23,6 +23,7 @@ class HumanResourceController extends DooController {
 			$flag = false;
 		} else {
 			if (in_array ( $accessModular, $detail ['cldAccessArray'] )) {
+				
 				if (Doo::acl ()->isAllowed ( $accessModular, $resource, $action )) {
 					$flag = true;
 				} else {
@@ -33,6 +34,9 @@ class HumanResourceController extends DooController {
 			}
 		}
 		
+		
+		
+		
 		// 个别审批人临时访问首页权限
 		if (! $flag) {
 			$list = $staff->getApprovalData ( $detail ['sid'] );
@@ -45,13 +49,13 @@ class HumanResourceController extends DooController {
 			if ($isVisit > 0) { // 未做强制不能访问
 				
 				if ($action == 'hrEmployee' || $action == 'position' || $action == 'employeeApprovals') {
-					die ( 'illegal request' );
+					die ( 'illegal request1' );
 				}
 				
 				$this->data ['exempt'] = true;
 				return '';
 			} else
-				die ( 'illegal request' );
+				die ( 'illegal request2' );
 		}
 	}
 	function __construct() {

+ 8 - 4
protected/controller/InvoiceController.php

@@ -927,7 +927,10 @@ class InvoiceController extends DooController {
 			$con = ' ( b.status=1 and b.untreadStatus!=2 ) and ';
 		elseif ($trainStatus == "TICKET")
 			$con = ' (b.printStatus=1 and b.status=2 and b.untreadStatus!=2) and ';
-		
+		elseif($trainStatus == "TICKETING"){
+			$con = ' (b.status=2 and b.untreadStatus=1) and ';
+		}
+			
 		$detail = $invoiceTraining->getInvoiceTrainingByItid ( $itid );
 		$isList = $invoiceStore->getinvoiceStoreByItid ( $itid, $con );
 		// print_r($isList);
@@ -1084,6 +1087,7 @@ class InvoiceController extends DooController {
 			
 			$userName = $this->staff [0] ['username'];
 			$sDetail = $staff->getStaffByName ( $userName );
+			
 			// die('sdd');
 			// 可以优化
 			foreach ( $exlArray as $key => $value ) {
@@ -1119,8 +1123,8 @@ class InvoiceController extends DooController {
 				
 				$invoice->ipSource = 1;
 				
-				$invoice->printStatus = 1;
-				$invoice->status = 2;
+				$invoice->printStatus = 0;
+				$invoice->status = 0;
 				$invoice->postStatus = 1;
 				$invoice->untreadStatus = 0;
 				// $invoice->invoiceSerial = "#F" . date ( "Ymd" ) . mt_rand ( 1000, 9999 );
@@ -2790,7 +2794,7 @@ class InvoiceController extends DooController {
 		Doo::loadModel ( 'invoice' );
 		$invoice = new invoice ();
 		
-		$untreadInvoice = $invoice->getInvoiceByUntreadStatus ( 1 );
+		$untreadInvoice = $invoice->getInvoiceByUntreadStatus ( 1 ,0,50);
 		$establishedInvoice = $invoice->getInvoiceByUntreadStatus ( 2 );
 		
 		foreach ( $establishedInvoice as $key => $value ) {

+ 14 - 6
protected/controller/MainController.php

@@ -1448,7 +1448,8 @@ class MainController extends DooController {
 		return "/receive";
 	}
 	function addClient() {
-		$this->get_args ( 'clientname' ) ? $this->get_args ( 'clientname' ) : "";
+		
+		$companyKey =$this->get_args ( 'companyKey' ) ? $this->get_args ( 'companyKey' ) : "";
 		
 		$clientname = $this->get_args ( 'clientname' ) ? $this->get_args ( 'clientname' ) : "";
 		$gender = $this->get_args ( 'gender' ) ? $this->get_args ( 'gender' ) : "";
@@ -1480,7 +1481,7 @@ class MainController extends DooController {
 		
 		$clientname = trim ( $clientname );
 		
-		$companyname = trim ( $companyname );
+		//$companyname = trim ( $companyname );
 		
 		if (empty ( $companyname ))
 			return "/contacts";
@@ -1513,8 +1514,12 @@ class MainController extends DooController {
 			Doo::loadModel ( 'district' );
 			$district = new district ();
 			
+			//修改
+			Doo::loadClass ( 'XDeode' );
+			$XDeode = new XDeode ( 5 );
+			$comId = $XDeode->decode ( $companyKey );
 			$companyInfo = $company->getOne ( array (
-					'where' => "companyname = '" . $companyname . "'",
+					'where' => "cid = '" . $comId . "'",
 					"asArray" => true 
 			) );
 			
@@ -3534,15 +3539,16 @@ class MainController extends DooController {
 		
 		if (! empty ( $cid )) {
 			Doo::loadModel ( 'company' );
-			
 			$company = new company ();
-			
 			Doo::loadModel ( 'client' );
 			Doo::loadModel ( 'district' );
-			
 			$district = new district ();
 			$client = new client ();
 			
+			Doo::loadClass ( 'XDeode' );
+			$XDeode = new XDeode ( 5 );
+			
+			
 			$districtInfo = $district->get_lv ( 1 );
 			
 			$companyInfo = $client->getClientByCompanyId ( $cid );
@@ -3554,6 +3560,8 @@ class MainController extends DooController {
 					'asArray' => TRUE 
 			) );
 			
+			$companyInfo ['companyKey'] = $XDeode->encode( $cInfo['cid'] );
+			
 			$companyInfo ['address'] = $cInfo ['address'];
 			
 			$companyInfo ['ride'] = $cInfo ['ride'];

+ 37 - 13
protected/controller/ReceiptController.php

@@ -2234,10 +2234,17 @@ class ReceiptController extends DooController {
 		// 收入合计
 		Doo::loadModel ( 'invoiceTraining' );
 		$invoiceTraining = new invoiceTraining ();
+		$invoiceTrainingDetail=array('invoiceArriveAmount'=>0,'RIAmount'=>0,'invoiceTotalAmount'=>0);
+		if ($receiptDetail ['invoiceTrainId']!=0){
 		$invoiceTrainingDetail = $invoiceTraining->getInvoiceTrainingByItid ( $receiptDetail ['invoiceTrainId'] );
+		}
 		// print_r($invoiceTrainingDetail);
+		$invoiceArriveAmount=$RIAmount=0;
+		if(!empty($invoiceTrainingDetail)){
+			$invoiceArriveAmount=$invoiceTrainingDetail ['invoiceArriveAmount'];
+			$RIAmount=$invoiceTrainingDetail ['RIAmount'];
+		}
 		$data ['invoiceTrainingDetail'] = $invoiceTrainingDetail;
-		
 		// 支出项目
 		Doo::loadModel ( 'accountItem' );
 		$accountItem = new accountItem ();
@@ -2251,33 +2258,43 @@ class ReceiptController extends DooController {
 		$RItemList = $RItem->getRItemByRid ( $rid );
 		$RILecturerList = $RILecturer->getRILecturerByRid ( $rid );
 		// 支出项金额详情
-		$aiData = $accountItem->getTrainingDetail ( $RItemList, $RILecturerList, $invoiceTrainingDetail ['invoiceArriveAmount'] );
+		$aiData = $accountItem->getTrainingDetail ( $RItemList, $RILecturerList, $invoiceArriveAmount );
 		//print_r($aiData);
 		
 		// 利润
-		$data ['profit'] = $invoiceTrainingDetail ['invoiceArriveAmount'] - $aiData ['total'];
+		$data ['profit'] = $invoiceArriveAmount - $aiData ['total'];
 		$data ['companyProfit'] = $data ['profit'] * 0.6;
 		$data ['categoryProfit'] = $data ['profit'] * 0.4;
 		// print_r($aiData['dataList']);
 		$data ['categoryActualExpenditure'] = $aiData ['total'] - $aiData ['categoryActualExpenditure'];
 		// 备用金
+		$sum=0;$data ['receiptLoanDetail']=array('sum'=>0);
+		if (!empty($receiptDetail ['trainLoanRid'])){
 		$data ['receiptLoanDetail'] = $receipt->getReceiptByRid ( $receiptDetail ['trainLoanRid'] );
-		$data ['payment'] = $data ['receiptLoanDetail'] ['sum'] + $invoiceTrainingDetail ['RIAmount'] - $data ['categoryActualExpenditure'];
+		$sum=$data ['receiptLoanDetail'] ['sum'];
+		}
+		$data ['payment'] = $sum + $RIAmount - $data ['categoryActualExpenditure'];
 		
 		$data ['total'] = $aiData ['total'];
 		$data ['aiCount'] = count ( $aiData ['dataList'] ) + 5;
 		$data ['aiList'] = $aiData ['dataList'];
 		
 		// 占比计算
-		$data ['totalProportion'] = number_format ( $aiData ['total'] / $invoiceTrainingDetail ['invoiceArriveAmount'], 2, '.', '' ) * 100;
-		$data ['profitProportion'] = number_format ( $data ['profit'] / $invoiceTrainingDetail ['invoiceArriveAmount'], 2, '.', '' ) * 100;
-		$data ['sumProportion'] = number_format ( $data ['receiptLoanDetail'] ['sum'] / $invoiceTrainingDetail ['invoiceArriveAmount'], 2, '.', '' ) * 100;
-		$data ['invoiceTotalAmountProportion'] = number_format ( $data ['invoiceTrainingDetail'] ['invoiceTotalAmount'] / $invoiceTrainingDetail ['invoiceArriveAmount'], 2, '.', '' ) * 100;
-		$data ['RIAmountProportion'] = number_format ( $data ['invoiceTrainingDetail'] ['RIAmount'] / $invoiceTrainingDetail ['invoiceArriveAmount'], 2, '.', '' ) * 100;
-		$data ['companyProfitProportion'] = number_format ( $data ['companyProfit'] / $invoiceTrainingDetail ['invoiceArriveAmount'], 2, '.', '' ) * 100;
-		$data ['categoryProportion'] = number_format ( $data ['categoryProfit'] / $invoiceTrainingDetail ['invoiceArriveAmount'], 2, '.', '' ) * 100;
-		$data ['categoryActualExpenditureProportion'] = number_format ( $data ['categoryActualExpenditure'] / $invoiceTrainingDetail ['invoiceArriveAmount'], 2, '.', '' ) * 100;
-		$data ['paymentProportion'] = number_format ( $data ['payment'] / $invoiceTrainingDetail ['invoiceArriveAmount'], 2, '.', '' ) * 100;
+		if($invoiceArriveAmount!=0){
+			$data ['totalProportion'] = number_format ( $aiData ['total'] / $invoiceArriveAmount, 2, '.', '' ) * 100;
+			$data ['profitProportion'] = number_format ( $data ['profit'] / $invoiceArriveAmount, 2, '.', '' ) * 100;
+			$data ['sumProportion'] = number_format ( $sum / $invoiceArriveAmount, 2, '.', '' ) * 100;
+			$data ['invoiceTotalAmountProportion'] = number_format ( $data ['invoiceTrainingDetail'] ['invoiceTotalAmount'] / $invoiceArriveAmount, 2, '.', '' ) * 100;
+			$data ['RIAmountProportion'] = number_format ( $data ['invoiceTrainingDetail'] ['RIAmount'] / $invoiceArriveAmount, 2, '.', '' ) * 100;
+			$data ['companyProfitProportion'] = number_format ( $data ['companyProfit'] / $invoiceArriveAmount, 2, '.', '' ) * 100;
+			$data ['categoryProportion'] = number_format ( $data ['categoryProfit'] / $invoiceArriveAmount, 2, '.', '' ) * 100;
+			$data ['categoryActualExpenditureProportion'] = number_format ( $data ['categoryActualExpenditure'] / $invoiceArriveAmount, 2, '.', '' ) * 100;
+			$data ['paymentProportion'] = number_format ( $data ['payment'] / $invoiceArriveAmount, 2, '.', '' ) * 100;
+		}else{
+			$data ['totalProportion'] =$data ['profitProportion'] = $data ['sumProportion'] = $data ['invoiceTotalAmountProportion'] = $data ['RIAmountProportion'] 
+			= $data ['companyProfitProportion'] = $data ['categoryActualExpenditureProportion'] = $data ['paymentProportion']=$data ['categoryProportion'] = 0;
+		}
+		
 		
 		// 审批组
 		Doo::loadModel ( 'verify' );
@@ -3940,11 +3957,18 @@ class ReceiptController extends DooController {
 		// echo 'status!=5 ' . $dateCondition . $cateCondition . $staffCondition . $approvalCondition . ' and verify in (' . $vid . ')';
 		// print_r($receiptList);
 		
+		Doo::loadClass ( 'XDeode' );
+		$XDeode = new XDeode ( 7 );
+		
+		
+		
 		$Locate = 0;
 		
 		$reportList = $reportCateList = array ();
 		foreach ( $receiptList as $key => $value ) {
 			
+			$receiptList [$key] ['ridKey'] = $XDeode->encode( $value['rid'] );
+			
 			$receiptList [$key] ['Locate'] = $Locate;
 			$Locate ++;
 			$receiptList [$key] ['reviseDetail'] = array ();

+ 5 - 4
protected/model/invoice.php

@@ -469,8 +469,9 @@ class invoice extends DooModel {
 	function sumOfinvoiceTrain($itidSql) {
 		$sql = 'select sum(b.invoicePrice) as invoicePrice ,b.trainId as trainId
 				from CLD_invoiceStore as a left join  ' . $this->_table . '  as b on (a.iid=b.iid)
-				where b.trainId in (' . $itidSql . ') and b.status=2 and b.printStatus=1 and (b.untreadStatus =0 or b.untreadStatus=3)
+				where b.trainId in (' . $itidSql . ') and b.status=2 and b.printStatus=1 and (b.untreadStatus =0 or b.untreadStatus=3) and b.isDelete=0
 				GROUP BY b.trainId';
+		
 		$query = Doo::db ()->query ( $sql );
 		return $result = $query->fetchAll ();
 	}
@@ -493,7 +494,7 @@ class invoice extends DooModel {
 		if (empty ( $itid ))
 			return 0;
 		$sql = 'select count(*) as count from CLD_invoiceStore as a left join ' . $this->_table . ' as b on (a.iid=b.iid)
-				where  a.trainId= ' . $itid . ' and b.untreadStatus!=2 and b.isDelete=0';
+				where  a.trainId= ' . $itid . ' and (b.untreadStatus is null or b.untreadStatus!=2) and (b.isDelete is null or b.isDelete=0 )';
 		
 		//echo $sql;
 		$query = Doo::db ()->query ( $sql );
@@ -775,13 +776,13 @@ class invoice extends DooModel {
 	 * @param number $untreadStatus 退票状态
 	 * @param number $iid 发票ID
 	 */
-	public function getInvoiceByUntreadStatus($untreadStatus = 1, $iid = 0) {
+	public function getInvoiceByUntreadStatus($untreadStatus = 1, $iid = 0,$limit=10) {
 		Doo::loadClass ( 'XDeode' );
 		$XDeode = new XDeode ( 5 );
 		if (empty ( $iid )) {
 			$list = $this->find ( array ( // printStatus=1 and
 					'where' => " untreadStatus=" . $untreadStatus . " and status=2 ",
-					'limit' => 10,
+					'limit' => $limit,
 					'asArray' => TRUE 
 			) );
 			

+ 1 - 1
protected/model/invoiceStore.php

@@ -270,7 +270,7 @@ class invoiceStore extends DooModel {
 					,a.mailItems,a.recipientsAddress,a.recipients,a.recipientsPhone,a.remark,a.remark,a.remark,a.remark,a.userName
 					,b.invoiceSerial,b.printTime,b.invoiceNo,b.status,b.printStatus,b.untreadStatus,b.irid';
 			
-			$sql = "select " . $field . " from " . $this->_table . " as a left join CLD_invoice as b on (a.iid=b.iid  )  where ".$con."  a.trainId=" . $itid.' order by a.isid desc ';
+			$sql = "select " . $field . " from " . $this->_table . " as a left join CLD_invoice as b on (a.iid=b.iid  )  where ".$con."  a.trainId=" . $itid.'   and ( b.isDelete is null or b.isDelete=0 )  order by a.isid desc ';
 			//echo $sql;
 			
 			

+ 1 - 1
protected/model/invoiceTraining.php

@@ -331,7 +331,7 @@ class invoiceTraining extends DooModel {
 			) );
 		}
 		$detail ['trainingKey'] = '';
-		
+		$detail ['RIAmount']=$detail ['invoiceArriveAmount']=$detail ['invoiceTotalAmount']=0;
 		if (! empty ( $detail )) {
 			Doo::loadModel ( 'L_category' );
 			$lCategory = new L_category ();

+ 8 - 4
protected/view/admin/approvalExpenses.html

@@ -41,7 +41,7 @@
 	  					
 	  					</li>
 	  					
-	  					<!-- if {{status}}=='pendApproval'  -->
+	  					<!-- if {{status}}=='pendApproval'|| {{status}}=='ongoing'  -->
 	  					
 	  					<li>
 	  					
@@ -58,7 +58,7 @@
 	  					
 	  					<!-- endif -->
 	  					
-	  					<!-- if {{status}}=='done' || {{status}}=='termination'|| {{status}}=='finish'|| {{status}}=='ongoing' --> 
+	  					<!-- if {{status}}=='done' || {{status}}=='termination'|| {{status}}=='finish' --> 
 	  					<li style="display:none" >
 	  					<input type="month" name="date" id="date" style="width:120px" onChange="receiptDate();" value="">
 	  					</li>
@@ -108,7 +108,9 @@
 	  							借款
 	  							<!-- elseif {{receiptDetail' value.Rtype}}==2 --> 
 	  							对公汇款
-	  							 <!-- else --> 
+	  							<!-- elseif {{receiptDetail' value.Rtype}}==3 --> 
+	  							培训班结算
+	  							<!-- elseif {{receiptDetail' value.Rtype}}==0 --> 
 	  							 报销单 
 	  							 <!-- endif --> 
 	  							 </td>
@@ -154,7 +156,9 @@
 	  									
 	  								<!-- elseif {{receiptDetail' value.Rtype}}==2 --> 
 	  									<a class="button" target="_blank" href="/remitApproval/{{receiptDetail' value.rid}}">去审批</a>
-	  								<!-- else -->
+	  								<!-- elseif {{receiptDetail' value.Rtype}}==3 --> 
+	  <a class="button" target="_blank" href="/receiptTrain/approval/{{receiptDetail' value.ridKey}}.html">去审批</a>
+	  								<!-- elseif {{receiptDetail' value.Rtype}}==0 -->
 	  									<a class="button" target="_blank" href="/receiptburEdi/{{receiptDetail' value.rid}}">去审批</a>
 	  								<!-- endif -->
 	  							<!-- else --> 

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

@@ -97,6 +97,8 @@ table.DTFC_Cloned thead,table.DTFC_Cloned tfoot{background-color:white}div.DTFC_
 							<option <!-- if {{trainStatus}}=='SUBED' --> selected <!-- endif --> value="SUBED" >待提交 </option><!--该状态为还没提交审批的发票-->
 							<option <!-- if {{trainStatus}}=='APPROVAL' --> selected <!-- endif --> value="APPROVAL">审批中  </option>
 							<option <!-- if {{trainStatus}}=='TICKET' --> selected <!-- endif --> value="TICKET">出票中 </option>
+							<option <!-- if {{trainStatus}}=='TICKETING' --> selected <!-- endif --> value="TICKETING">退票中 </option>
+							
 							
 						</select>
 						</li>

+ 1 - 0
protected/view/contacts_client.html

@@ -277,6 +277,7 @@
 				</div>
 				<div  style="display:none;" id="addClient">
 					<form name="adcl" id="adcl" action="/addClient" method="post" >
+						
 						<div class="contactInfo">
 				  			<div class="contactPanel">
 				  				<div class="bsAlert bsInfo"><b>添加新客户</b>前,可先搜索是否有其他同事已经添加了该客户。</div>