cqp 2 hafta önce
ebeveyn
işleme
97efa68e45

+ 2 - 2
app/Exports/ResearchExpenseSummarySheetExport.php

@@ -94,10 +94,10 @@ class ResearchExpenseSummarySheetExport implements WithEvents, WithTitle
                     $sheet->setCellValue("{$col_8_4}{$currentRow}", "={$col_8_3}{$currentRow}*0.8");
 
                     // ⭐【核心修改】只改 E 列的公式逻辑
-                    // 严格按照:IF((前n项小计+其他合计7.1)*0.1 < 其他合计7.1, (前n项小计+其他合计7.1)*0.1 + 前n项小计, 其他合计7.1 + 前n项小计) + 委托境内8.2 + 委托境外8.4
+                    // 严格按照:IF((前n项小计+其他合计7.1)*0.1 < 其他合计7.1, (前n项小计+其他合计7.1)*0.1 + 前n项小计, 其他合计7.1 + 前n项小计)
                     $sheet->setCellValue(
                         "{$col_E}{$currentRow}",
-                        "=IF(({$col_6}{$currentRow}+{$col_7_1}{$currentRow})*0.1 < {$col_7_1}{$currentRow}, ({$col_6}{$currentRow}+{$col_7_1}{$currentRow})*0.1 + {$col_6}{$currentRow}, {$col_7_1}{$currentRow} + {$col_6}{$currentRow}) + {$col_8_2}{$currentRow} + {$col_8_4}{$currentRow}"
+                        "=IF(({$col_6}{$currentRow}+{$col_7_1}{$currentRow})*0.1 < {$col_7_1}{$currentRow}, ({$col_6}{$currentRow}+{$col_7_1}{$currentRow})*0.1 + {$col_6}{$currentRow}, {$col_7_1}{$currentRow} + {$col_6}{$currentRow})"
                     );
 
                     // 严格清洗类型字符串进行归集

+ 9 - 5
app/Service/ExportFileService.php

@@ -881,7 +881,11 @@ class ExportFileService extends Service
         $feeTypes = $result['fee_type_list'] ?? [];
 
         // 2. 构造动态表头名称
-        $dynamicHeaderTitles = array_column($feeTypes, 'title');
+        $dynamicHeaderTitles = [];
+        foreach ($feeTypes as $value){
+            if(! $value['is_after']) $dynamicHeaderTitles[] = $value['title'];
+        }
+//        $dynamicHeaderTitles = array_column($feeTypes, 'title');
         $dynamicHeaders = array_merge(['人员人工费用', '折旧费用'], $dynamicHeaderTitles);
 
         $items = [];
@@ -903,16 +907,16 @@ class ExportFileService extends Service
             foreach ($feeTypes as $type) {
                 $feeData = $currentProjectFees->get($type['id']);
                 $amount = (float)($feeData['total_amount'] ?? 0);
+                // 2. 累加委托费用 (8.1 和 8.3)
+                $val8_1 += (float)($feeData['entrust1_amount'] ?? 0);
+                $val8_3 += (float)($feeData['entrust2_amount'] ?? 0);
+                if($feeData['is_other']) continue;
 
                 // 填充到动态科目列
                 $rowValues[] = $amount;
 
                 // 1. 累加其他相关费用合计 (7.1)
 //                if(! empty($feeData['is_other']) && $feeData['is_other'] == Fee::IS_OTHER_ONE) $val7_1 += $amount;
-
-                // 2. 累加委托费用 (8.1 和 8.3)
-                $val8_1 += (float)($feeData['entrust1_amount'] ?? 0);
-                $val8_3 += (float)($feeData['entrust2_amount'] ?? 0);
             }
 
             $items[] = [