caipin 5 yıl önce
ebeveyn
işleme
6ea66a1469

+ 55 - 1
protected/class/receipt.func.php

@@ -1,6 +1,60 @@
 <?php
 
-
+/*
+ * 办事处汇总明细
+ */
+function _getReceiptSummaryHtml($cglist,$aiAllList,$dataSummary){
+	$summaryDateHtml='';
+	foreach ($cglist as $cgk=>$value){
+		//办事处每月数据展示
+		for($month=1;$month<=12;$month++){
+			$summaryDateHtml.='<tr>';
+			$summaryDateHtml.='<th>'.$value['title'].$month.'月合计</th>
+										<td class="taR"></td>
+										<td class="taR"></td>
+										<td class="taR"></td>
+										<td class="taR"></td>
+										<td class="taR"></td>
+										<td class="taR colGreen"></td>';
+			
+			$itemHtml='';
+			if(isset($dataSummary[$value['cid']])){
+				foreach ($aiAllList as $aiak=>$aiav){//总项目
+					
+					$tempHtml='';$tempPrice=0;
+					foreach ($aiav as $k=>$v){//项目细则
+						$falg=true;
+						foreach ($dataSummary[$value['cid']][$month][$aiak] as $dsk=>$dsv){//数据实体
+							if($dsv['item']==$v['name']){
+								$tempHtml.='<td class="taR">'.$dsv['price'].'</td>';
+								$tempPrice+=$dsv['price'];
+								$falg=false;
+								break;
+							}
+						}
+						if($falg){
+							$tempHtml.='<td class="taR"></td>';
+						}
+					}
+					
+					$itemHtml.='<td class="taR colRed">'.$tempPrice.'</td>';//每个月份 项目金额合计
+					$itemHtml.=$tempHtml;//每个月份项目细则金额
+				}
+			}else{
+				foreach ($aiAllList as $aiak=>$aiav){
+					$itemHtml.='<td class="taR colRed"></td>';
+					foreach ($aiav as $k=>$v){
+						$itemHtml.='<td class="taR"></td>';
+					}
+				}
+			}
+			
+			$summaryDateHtml.=$itemHtml;
+			$summaryDateHtml.='</tr>';
+		}
+	}
+	return $summaryDateHtml;
+}
 
 
 /**

+ 5 - 52
protected/controller/ReceiptExtendController.php

@@ -2696,60 +2696,13 @@ class ReceiptExtendController extends DooController {
     		//print_r($dataSummary);die;
     		
     		Doo::loadClass ( 'receipt.func' );
-    		
     		//构建数据html
-    		$summaryDateHtml='';
     		$cglist=$category->getCategoryInCid($cidIn);
-    		foreach ($cglist as $cgk=>$value){
-    			//办事处每月数据展示
-    			for($month=1;$month<=12;$month++){
-    				$summaryDateHtml.='<tr>';
-    				$summaryDateHtml.='<th>'.$value['title'].$month.'月合计</th>
-										<td class="taR"></td>
-										<td class="taR"></td>
-										<td class="taR"></td>
-										<td class="taR"></td>
-										<td class="taR"></td>
-										<td class="taR colGreen"></td>';
-    				
-    				$itemHtml='';
-    				if(isset($dataSummary[$value['cid']])){
-    					foreach ($aiAllList as $aiak=>$aiav){//总项目
-    						
-    						
-    						$tempHtml='';
-    						foreach ($aiav as $k=>$v){//项目细则
-    							$falg=true;
-    							foreach ($dataSummary[$value['cid']][$month][$aiak] as $dsk=>$dsv){//数据实体
-    								if($dsv['item']==$v['name']){
-    									$tempHtml.='<td class="taR">'.$dsv['price'].'</td>';
-    									$falg=false;
-    									break;
-    								}
-    							}
-    							if($falg){
-    								$tempHtml.='<td class="taR"></td>';
-    							}
-    						}
-    						
-    						$itemHtml.='<td class="taR colRed"></td>';//每个月份 项目金额合计
-    						$itemHtml.=$tempHtml;//每个月份项目细则金额
-    						
-    					}
-    				}else{
-    					foreach ($aiAllList as $aiak=>$aiav){
-    						$itemHtml.='<td class="taR colRed"></td>';
-    						foreach ($aiav as $k=>$v){
-    							$itemHtml.='<td class="taR"></td>';
-    						}
-    					}
-    				}
-    				
-    				$summaryDateHtml.=$itemHtml;
-    				$summaryDateHtml.='</tr>';
-    			}
-    			
-    		}
+    		$summaryDateHtml=_getReceiptSummaryHtml($cglist,$aiAllList,$dataSummary);
+    		
+    		
+    		
+    		
     		
     		//构建栏目展示Html
     		foreach ($aiAllList as $key=>$value){