animeic 2 ani în urmă
părinte
comite
b001a121a2
1 a modificat fișierele cu 12 adăugiri și 3 ștergeri
  1. 12 3
      boxcost/api/plan-cost-excel.go

+ 12 - 3
boxcost/api/plan-cost-excel.go

@@ -348,7 +348,9 @@ func (b *PlanCostExcel) drawAllContent() error {
 
 					row++
 					if len(mat.Crafts) > 0 {
-						// 工序
+						// ??? 多个工序 合并预算价格
+						craftStartRow := row
+						craftEndRow := row
 						for _, craft := range mat.Crafts {
 							craftSupplierName := ""
 							if craft.Supplier.SupplierInfo != nil { // 外箱材料报错
@@ -374,16 +376,23 @@ func (b *PlanCostExcel) drawAllContent() error {
 							// 实际金额
 							confirmCraftPrice := craft.Supplier.OrderPrice * float64(craft.ConfirmCount)
 
-							totalOrderRealPrice += craft.Supplier.OrderRealPrice
 							totalConfirmRealPrice += confirmCraftPrice
 							confirmCraftRealPrice := fmt.Sprintf("%.2f", confirmCraftPrice)
 							b.FormatToEmpty(&confirmCraftRealPrice)
 
 							b.drawRow(row, "", "", craft.CraftInfo.Name, craftSupplierName, craft.CraftInfo.Norm, carftHeigth, carftWidth, craft.CraftInfo.Unit, carftOrderCount, confirmCraftCount, carftOrderPrice, carftOrderRealPrice, confirmCraftRealPrice)
-
 							row++
+							craftEndRow = row
+						}
+						// 多个工序 合并预算价格
+						if len(mat.Crafts) > 1 {
+							b.Excel.MergeCell(b.SheetName, fmt.Sprintf("L%d", craftStartRow), fmt.Sprintf("L%d", craftEndRow))
+							b.Excel.SetCellValue(b.SheetName, fmt.Sprintf("L%d", craftStartRow), mat.Crafts[0].Supplier.OrderRealPrice)
 
 						}
+						// 只加一次合并的预算金额
+						totalOrderRealPrice += mat.Crafts[0].Supplier.OrderRealPrice
+
 					}
 				}
 				endRow := row - 1