|
@@ -155,12 +155,15 @@ func (b *PlanCostExcel) drawSupplierContent() error {
|
|
|
}
|
|
|
row := b.Offset + 4
|
|
|
comps := b.Content.Pack.Components
|
|
|
- var totalPlanPrice float32 = 0.00
|
|
|
- var confirmTotalPlanPrice float64 = 0.00
|
|
|
+ // 预算金额汇总
|
|
|
+ var totalOrderRealPrice float64 = 0.00
|
|
|
+ // 实际金额汇总
|
|
|
+ var totalRealPrice float64 = 0.00
|
|
|
if len(comps) > 0 {
|
|
|
for _, comp := range comps {
|
|
|
- var totalOrderRealPrice float32 = 0.00
|
|
|
- var totalConfirmRealPrice float64 = 0.00
|
|
|
+ var perOrderRealPrice float64 = 0.00
|
|
|
+ var perRealPrice float64 = 0.00
|
|
|
+
|
|
|
if len(comp.Mats) > 0 {
|
|
|
startRow := 0
|
|
|
for _, mat := range comp.Mats {
|
|
@@ -172,7 +175,10 @@ func (b *PlanCostExcel) drawSupplierContent() error {
|
|
|
|
|
|
}
|
|
|
|
|
|
- supplierName := mat.Supplier.SupplierInfo.Name
|
|
|
+ supplierName := ""
|
|
|
+ if mat.Supplier.SupplierInfo != nil {
|
|
|
+ supplierName = mat.Supplier.SupplierInfo.Name
|
|
|
+ }
|
|
|
matHeigth := fmt.Sprintf("%d", mat.BatchSizeHeight)
|
|
|
b.FormatToEmpty(&matHeigth)
|
|
|
matWidth := fmt.Sprintf("%d", mat.BatchSizeWidth)
|
|
@@ -186,21 +192,25 @@ func (b *PlanCostExcel) drawSupplierContent() error {
|
|
|
// 单价
|
|
|
orderPrice := fmt.Sprintf("%.2f", mat.Supplier.OrderPrice)
|
|
|
b.FormatToEmpty(&orderPrice)
|
|
|
- totalOrderRealPrice += mat.Supplier.OrderRealPrice
|
|
|
+ // 预算金额
|
|
|
orderRealPrice := fmt.Sprintf("%.2f", mat.Supplier.OrderRealPrice)
|
|
|
+ perRealPrice += mat.Supplier.OrderRealPrice
|
|
|
b.FormatToEmpty(&orderRealPrice)
|
|
|
// 实际金额
|
|
|
- confirmPrice := mat.Supplier.OrderPrice * float64(mat.ConfirmCount)
|
|
|
- totalConfirmRealPrice += confirmPrice
|
|
|
- confirmRealPrice := fmt.Sprintf("%.2f", confirmPrice)
|
|
|
- b.FormatToEmpty(&confirmRealPrice)
|
|
|
- b.drawRow(row, "", mat.MatInfo.Name, "", supplierName, mat.MatInfo.Norm, matHeigth, matWidth, mat.MatInfo.Unit, orderCount, confirmCount, orderPrice, orderRealPrice, confirmRealPrice)
|
|
|
+ perRealPrice += mat.RealPrice
|
|
|
+ realPrice := fmt.Sprintf("%.2f", mat.RealPrice)
|
|
|
+ b.FormatToEmpty(&realPrice)
|
|
|
+ b.drawRow(row, "", mat.MatInfo.Name, "", supplierName, mat.MatInfo.Norm, matHeigth, matWidth, mat.MatInfo.Unit, orderCount, confirmCount, orderPrice, orderRealPrice, realPrice)
|
|
|
+
|
|
|
row++
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if len(mat.Crafts) > 0 {
|
|
|
+ // 实际数量、预算数量
|
|
|
+ mergeStartRow := row
|
|
|
+ mergeEndRow := row
|
|
|
for _, craft := range mat.Crafts {
|
|
|
if craft.Supplier.SupplierInfo != nil { // 外箱材料报错
|
|
|
// 工序
|
|
@@ -209,38 +219,48 @@ func (b *PlanCostExcel) drawSupplierContent() error {
|
|
|
startRow = row
|
|
|
|
|
|
}
|
|
|
- craftSupplierName := craft.Supplier.SupplierInfo.Name
|
|
|
- carftOrderCount := fmt.Sprintf("%d", int(craft.Supplier.OrderCount))
|
|
|
- b.FormatToEmpty(&carftOrderCount)
|
|
|
+
|
|
|
+ supplierName := ""
|
|
|
+ if craft.Supplier.SupplierInfo != nil {
|
|
|
+ supplierName = craft.Supplier.SupplierInfo.Name
|
|
|
+ }
|
|
|
+
|
|
|
+ orderCount := fmt.Sprintf("%d", int(craft.Supplier.OrderCount))
|
|
|
+ b.FormatToEmpty(&orderCount)
|
|
|
carftHeigth := fmt.Sprintf("%d", craft.BatchSizeHeight)
|
|
|
b.FormatToEmpty(&carftHeigth)
|
|
|
carftWidth := fmt.Sprintf("%d", craft.BatchSizeWidth)
|
|
|
b.FormatToEmpty(&carftWidth)
|
|
|
|
|
|
// 实际数量
|
|
|
- confirmCraftCount := fmt.Sprintf("%d", craft.ConfirmCount)
|
|
|
- b.FormatToEmpty(&confirmCraftCount)
|
|
|
-
|
|
|
- carftOrderPrice := fmt.Sprintf("%.2f", craft.Supplier.OrderPrice)
|
|
|
- b.FormatToEmpty(&carftOrderPrice)
|
|
|
- totalOrderRealPrice += craft.Supplier.OrderRealPrice
|
|
|
- carftOrderRealPrice := fmt.Sprintf("%.2f", craft.Supplier.OrderRealPrice)
|
|
|
- b.FormatToEmpty(&carftOrderRealPrice)
|
|
|
-
|
|
|
- // 实际金额
|
|
|
- confirmCraftPrice := craft.Supplier.OrderPrice * float64(craft.ConfirmCount)
|
|
|
- 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)
|
|
|
+ confirmCount := fmt.Sprintf("%d", craft.ConfirmCount)
|
|
|
+ b.FormatToEmpty(&confirmCount)
|
|
|
+ price := fmt.Sprintf("%.2f", craft.Supplier.OrderPrice)
|
|
|
+ b.FormatToEmpty(&price)
|
|
|
+
|
|
|
+ // 预算金额
|
|
|
+ budgetAmount := ""
|
|
|
+ b.FormatToEmpty(&budgetAmount)
|
|
|
+
|
|
|
+ // 实际金额 在外层合并单元格
|
|
|
+ realAmount := ""
|
|
|
+ b.drawRow(row, "", "", craft.CraftInfo.Name, supplierName, craft.CraftInfo.Norm, carftHeigth, carftWidth, craft.CraftInfo.Unit, orderCount, confirmCount, price, budgetAmount, realAmount)
|
|
|
row++
|
|
|
+ mergeEndRow = row
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ // 多个工序 合并预算价格、实际价格
|
|
|
+ b.Excel.MergeCell(b.SheetName, fmt.Sprintf("L%d", mergeStartRow), fmt.Sprintf("L%d", mergeEndRow))
|
|
|
+ b.Excel.SetCellValue(b.SheetName, fmt.Sprintf("L%d", mergeEndRow), mat.Crafts[0].Supplier.OrderRealPrice)
|
|
|
+ b.Excel.MergeCell(b.SheetName, fmt.Sprintf("M%d", mergeStartRow), fmt.Sprintf("M%d", mergeEndRow))
|
|
|
+ b.Excel.SetCellValue(b.SheetName, fmt.Sprintf("M%d", mergeEndRow), mat.Crafts[0].RealPrice)
|
|
|
+ perRealPrice += mat.Crafts[0].RealPrice
|
|
|
+ perOrderRealPrice += mat.Crafts[0].Supplier.OrderRealPrice
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
if startRow != 0 {
|
|
@@ -259,8 +279,84 @@ func (b *PlanCostExcel) drawSupplierContent() error {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- totalPlanPrice += totalOrderRealPrice
|
|
|
- confirmTotalPlanPrice += totalConfirmRealPrice
|
|
|
+ // 预算
|
|
|
+ totalOrderRealPrice += perOrderRealPrice
|
|
|
+ // 预算
|
|
|
+ totalRealPrice += perRealPrice
|
|
|
+ }
|
|
|
+
|
|
|
+ // 工序数据
|
|
|
+ if b.Content.Process != nil {
|
|
|
+ // 生产汇总金额
|
|
|
+ startACell := fmt.Sprintf("%s%d", "A", row)
|
|
|
+ endMCell := fmt.Sprintf("%s%d", "K", row)
|
|
|
+ b.Excel.MergeCell(b.SheetName, startACell, endMCell)
|
|
|
+ b.Excel.SetCellStyle(b.SheetName, startACell, endMCell, b.AlignCenterStyle)
|
|
|
+ b.Excel.SetCellValue(b.SheetName, startACell, "额外工序")
|
|
|
+ row++
|
|
|
+ // 工序 外箱 手工费 表头
|
|
|
+ var drawCol = func(startCell, endCell string, value string) error {
|
|
|
+ left1Cell := fmt.Sprintf("%s%d", startCell, row)
|
|
|
+ left2Cell := fmt.Sprintf("%s%d", endCell, row+1)
|
|
|
+
|
|
|
+ err := b.Excel.MergeCell(b.SheetName, left1Cell, left2Cell)
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ err = b.Excel.SetCellStyle(b.SheetName, left1Cell, left2Cell, b.AlignCenterStyle)
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+
|
|
|
+ return b.Excel.SetCellValue(b.SheetName, left1Cell, value)
|
|
|
+ }
|
|
|
+
|
|
|
+ drawCol("B", "C", "材料/工序")
|
|
|
+ drawCol("D", "D", "供应商名称")
|
|
|
+ drawCol("E", "G", "规格")
|
|
|
+ drawCol("H", "H", "单位")
|
|
|
+ drawCol("I", "I", "下单数量")
|
|
|
+ drawCol("J", "J", "实际数量")
|
|
|
+ drawCol("K", "K", "单价")
|
|
|
+ drawCol("L", "L", "预算金额")
|
|
|
+ drawCol("M", "M", "实际金额")
|
|
|
+ row++
|
|
|
+
|
|
|
+ var DrawRow = func(rowIndex int, values ...string) {
|
|
|
+ charas := []string{"B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M"}
|
|
|
+ for i, c := range charas {
|
|
|
+ v := ""
|
|
|
+ if i < len(values) {
|
|
|
+ v = values[i]
|
|
|
+ }
|
|
|
+ b.Excel.SetCellValue(b.SheetName, fmt.Sprintf("%s%d", c, rowIndex), v)
|
|
|
+ val2Cel := fmt.Sprintf("%s%d", c, rowIndex)
|
|
|
+ b.Excel.SetCellStyle(b.SheetName, val2Cel, val2Cel, b.AlignCenterStyle)
|
|
|
+ b.Excel.SetRowHeight(b.SheetName, rowIndex, 21)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if len(b.Content.Process) > 0 {
|
|
|
+ for _, ps := range b.Content.Process {
|
|
|
+ if supplierId == ps.Supplier.SupplierInfo.Id {
|
|
|
+ orderCount := fmt.Sprintf("%.2f", ps.Supplier.OrderCount)
|
|
|
+ confirmCount := fmt.Sprintf("%d", ps.ConfirmCount)
|
|
|
+ price := fmt.Sprintf("%.2f", ps.Supplier.OrderPrice)
|
|
|
+ b.FormatToEmpty(&price)
|
|
|
+ totalOrderRealPrice += ps.Supplier.OrderRealPrice
|
|
|
+ totalRealPrice += ps.RealPrice
|
|
|
+ orderRealPrice := fmt.Sprintf("%.2f", ps.Supplier.OrderRealPrice)
|
|
|
+ b.FormatToEmpty(&orderRealPrice)
|
|
|
+ realPrice := fmt.Sprintf("%.2f", ps.RealPrice)
|
|
|
+ DrawRow(row, ps.ProcessInfo.Name, ps.Supplier.SupplierInfo.Name, ps.ProcessInfo.Norm, ps.ProcessInfo.Unit, orderCount, confirmCount, price, orderRealPrice, realPrice)
|
|
|
+ row++
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
// 生产汇总金额
|
|
@@ -274,15 +370,15 @@ func (b *PlanCostExcel) drawSupplierContent() error {
|
|
|
|
|
|
// 生产预算汇总
|
|
|
b.Excel.SetCellStyle(b.SheetName, LCell, LCell, b.AlignCenterStyle)
|
|
|
- planTotalPrice := fmt.Sprintf("%.2f", totalPlanPrice)
|
|
|
- b.FormatToEmpty(&planTotalPrice)
|
|
|
- b.Excel.SetCellValue(b.SheetName, LCell, planTotalPrice)
|
|
|
+ planOrderRealPrice := fmt.Sprintf("%.2f", totalOrderRealPrice)
|
|
|
+ b.FormatToEmpty(&planOrderRealPrice)
|
|
|
+ b.Excel.SetCellValue(b.SheetName, LCell, planOrderRealPrice)
|
|
|
|
|
|
// 生产实际汇总
|
|
|
b.Excel.SetCellStyle(b.SheetName, MCell, MCell, b.AlignCenterStyle)
|
|
|
- planConfirmTotalPrice := fmt.Sprintf("%.2f", confirmTotalPlanPrice)
|
|
|
- b.FormatToEmpty(&planConfirmTotalPrice)
|
|
|
- b.Excel.SetCellValue(b.SheetName, MCell, planConfirmTotalPrice)
|
|
|
+ planRealPrice := fmt.Sprintf("%.2f", totalRealPrice)
|
|
|
+ b.FormatToEmpty(&planRealPrice)
|
|
|
+ b.Excel.SetCellValue(b.SheetName, MCell, planRealPrice)
|
|
|
|
|
|
}
|
|
|
|
|
@@ -309,12 +405,14 @@ func (b *PlanCostExcel) drawRow(rowIndex int, values ...string) {
|
|
|
func (b *PlanCostExcel) drawAllContent() error {
|
|
|
row := b.Offset + 4
|
|
|
comps := b.Content.Pack.Components
|
|
|
- var totalPlanPrice float32 = 0.00
|
|
|
- var confirmTotalPlanPrice float64 = 0.00
|
|
|
+ // 预算金额汇总
|
|
|
+ var totalOrderRealPrice float64 = 0.00
|
|
|
+ // 实际金额汇总
|
|
|
+ var totalRealPrice float64 = 0.00
|
|
|
if len(comps) > 0 {
|
|
|
for _, comp := range comps {
|
|
|
- var totalConfirmRealPrice float64 = 0.00
|
|
|
- var totalOrderRealPrice float32 = 0.00
|
|
|
+ var perOrderRealPrice float64 = 0.00
|
|
|
+ var perRealPrice float64 = 0.00
|
|
|
if len(comp.Mats) > 0 {
|
|
|
startRow := row
|
|
|
for _, mat := range comp.Mats {
|
|
@@ -336,63 +434,57 @@ func (b *PlanCostExcel) drawAllContent() error {
|
|
|
// 单价
|
|
|
orderPrice := fmt.Sprintf("%.2f", mat.Supplier.OrderPrice)
|
|
|
b.FormatToEmpty(&orderPrice)
|
|
|
+ // 预算金额
|
|
|
orderRealPrice := fmt.Sprintf("%.2f", mat.Supplier.OrderRealPrice)
|
|
|
- totalOrderRealPrice += mat.Supplier.OrderRealPrice
|
|
|
+ perRealPrice += mat.Supplier.OrderRealPrice
|
|
|
b.FormatToEmpty(&orderRealPrice)
|
|
|
// 实际金额
|
|
|
- confirmPrice := mat.Supplier.OrderPrice * float64(mat.ConfirmCount)
|
|
|
- totalConfirmRealPrice += confirmPrice
|
|
|
- confirmRealPrice := fmt.Sprintf("%.2f", confirmPrice)
|
|
|
- b.FormatToEmpty(&confirmRealPrice)
|
|
|
- b.drawRow(row, "", mat.MatInfo.Name, "", supplierName, mat.MatInfo.Norm, matHeigth, matWidth, mat.MatInfo.Unit, orderCount, confirmCount, orderPrice, orderRealPrice, confirmRealPrice)
|
|
|
+ perRealPrice += mat.RealPrice
|
|
|
+ realPrice := fmt.Sprintf("%.2f", mat.RealPrice)
|
|
|
+ b.FormatToEmpty(&realPrice)
|
|
|
+ b.drawRow(row, "", mat.MatInfo.Name, "", supplierName, mat.MatInfo.Norm, matHeigth, matWidth, mat.MatInfo.Unit, orderCount, confirmCount, orderPrice, orderRealPrice, realPrice)
|
|
|
|
|
|
row++
|
|
|
if len(mat.Crafts) > 0 {
|
|
|
- // ??? 多个工序 合并预算价格
|
|
|
- craftStartRow := row
|
|
|
- craftEndRow := row
|
|
|
+ // 实际数量、预算数量
|
|
|
+ mergeStartRow := row
|
|
|
+ mergeEndRow := row
|
|
|
for _, craft := range mat.Crafts {
|
|
|
- craftSupplierName := ""
|
|
|
- if craft.Supplier.SupplierInfo != nil { // 外箱材料报错
|
|
|
- craftSupplierName = craft.Supplier.SupplierInfo.Name
|
|
|
-
|
|
|
+ supplierName := ""
|
|
|
+ if craft.Supplier.SupplierInfo != nil {
|
|
|
+ supplierName = craft.Supplier.SupplierInfo.Name
|
|
|
}
|
|
|
- carftOrderCount := fmt.Sprintf("%d", int(craft.Supplier.OrderCount))
|
|
|
- b.FormatToEmpty(&carftOrderCount)
|
|
|
+
|
|
|
+ orderCount := fmt.Sprintf("%d", int(craft.Supplier.OrderCount))
|
|
|
+ b.FormatToEmpty(&orderCount)
|
|
|
carftHeigth := fmt.Sprintf("%d", craft.BatchSizeHeight)
|
|
|
b.FormatToEmpty(&carftHeigth)
|
|
|
carftWidth := fmt.Sprintf("%d", craft.BatchSizeWidth)
|
|
|
b.FormatToEmpty(&carftWidth)
|
|
|
|
|
|
// 实际数量
|
|
|
- confirmCraftCount := fmt.Sprintf("%d", craft.ConfirmCount)
|
|
|
- b.FormatToEmpty(&confirmCraftCount)
|
|
|
-
|
|
|
- carftOrderPrice := fmt.Sprintf("%.2f", craft.Supplier.OrderPrice)
|
|
|
- b.FormatToEmpty(&carftOrderPrice)
|
|
|
- carftOrderRealPrice := fmt.Sprintf("%.2f", craft.Supplier.OrderRealPrice)
|
|
|
- b.FormatToEmpty(&carftOrderRealPrice)
|
|
|
-
|
|
|
- // 实际金额
|
|
|
- confirmCraftPrice := craft.Supplier.OrderPrice * float64(craft.ConfirmCount)
|
|
|
+ confirmCount := fmt.Sprintf("%d", craft.ConfirmCount)
|
|
|
+ b.FormatToEmpty(&confirmCount)
|
|
|
+ price := fmt.Sprintf("%.2f", craft.Supplier.OrderPrice)
|
|
|
+ b.FormatToEmpty(&price)
|
|
|
|
|
|
- totalConfirmRealPrice += confirmCraftPrice
|
|
|
- confirmCraftRealPrice := fmt.Sprintf("%.2f", confirmCraftPrice)
|
|
|
- b.FormatToEmpty(&confirmCraftRealPrice)
|
|
|
+ // 预算金额
|
|
|
+ budgetAmount := ""
|
|
|
+ b.FormatToEmpty(&budgetAmount)
|
|
|
|
|
|
- b.drawRow(row, "", "", craft.CraftInfo.Name, craftSupplierName, craft.CraftInfo.Norm, carftHeigth, carftWidth, craft.CraftInfo.Unit, carftOrderCount, confirmCraftCount, carftOrderPrice, carftOrderRealPrice, confirmCraftRealPrice)
|
|
|
+ // 实际金额 在外层合并单元格
|
|
|
+ realAmount := ""
|
|
|
+ b.drawRow(row, "", "", craft.CraftInfo.Name, supplierName, craft.CraftInfo.Norm, carftHeigth, carftWidth, craft.CraftInfo.Unit, orderCount, confirmCount, price, budgetAmount, realAmount)
|
|
|
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)
|
|
|
-
|
|
|
+ mergeEndRow = row
|
|
|
}
|
|
|
- // 只加一次合并的预算金额
|
|
|
- totalOrderRealPrice += mat.Crafts[0].Supplier.OrderRealPrice
|
|
|
-
|
|
|
+ // 多个工序 合并预算价格、实际价格
|
|
|
+ b.Excel.MergeCell(b.SheetName, fmt.Sprintf("L%d", mergeStartRow), fmt.Sprintf("L%d", mergeEndRow))
|
|
|
+ b.Excel.SetCellValue(b.SheetName, fmt.Sprintf("L%d", mergeEndRow), mat.Crafts[0].Supplier.OrderRealPrice)
|
|
|
+ b.Excel.MergeCell(b.SheetName, fmt.Sprintf("M%d", mergeStartRow), fmt.Sprintf("M%d", mergeEndRow))
|
|
|
+ b.Excel.SetCellValue(b.SheetName, fmt.Sprintf("M%d", mergeEndRow), mat.Crafts[0].RealPrice)
|
|
|
+ perRealPrice += mat.Crafts[0].RealPrice
|
|
|
+ perOrderRealPrice += mat.Crafts[0].Supplier.OrderRealPrice
|
|
|
}
|
|
|
}
|
|
|
endRow := row - 1
|
|
@@ -407,22 +499,21 @@ func (b *PlanCostExcel) drawAllContent() error {
|
|
|
b.Excel.SetCellValue(b.SheetName, startACell, comp.Name)
|
|
|
}
|
|
|
|
|
|
- // 实际
|
|
|
- confirmTotalPlanPrice += totalConfirmRealPrice
|
|
|
-
|
|
|
// 预算
|
|
|
- totalPlanPrice += totalOrderRealPrice
|
|
|
+ totalOrderRealPrice += perOrderRealPrice
|
|
|
+ // 预算
|
|
|
+ totalRealPrice += perRealPrice
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // ??? 工序数据
|
|
|
+ // 工序数据
|
|
|
if b.Content.Process != nil {
|
|
|
// 生产汇总金额
|
|
|
startACell := fmt.Sprintf("%s%d", "A", row)
|
|
|
endMCell := fmt.Sprintf("%s%d", "K", row)
|
|
|
b.Excel.MergeCell(b.SheetName, startACell, endMCell)
|
|
|
b.Excel.SetCellStyle(b.SheetName, startACell, endMCell, b.AlignCenterStyle)
|
|
|
- b.Excel.SetCellValue(b.SheetName, startACell, "其他")
|
|
|
+ b.Excel.SetCellValue(b.SheetName, startACell, "额外工序")
|
|
|
row++
|
|
|
// 工序 外箱 手工费 表头
|
|
|
var drawCol = func(startCell, endCell string, value string) error {
|
|
@@ -466,23 +557,22 @@ func (b *PlanCostExcel) drawAllContent() error {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- ps := b.Content.Process
|
|
|
- count := fmt.Sprintf("%.2f", ps.Supplier.OrderCount)
|
|
|
- confirmCount := fmt.Sprintf("%d", ps.ConfirmCount)
|
|
|
- price := fmt.Sprintf("%.2f", ps.Supplier.OrderPrice)
|
|
|
- b.FormatToEmpty(&price)
|
|
|
- // budgetAmountf := ps.Supplier.OrderPrice * float64(ps.Supplier.OrderCount)
|
|
|
- budgetAmount := fmt.Sprintf("%.2f", ps.Supplier.OrderRealPrice)
|
|
|
- b.FormatToEmpty(&budgetAmount)
|
|
|
- // realAmountf := ps.Price * float64(ps.ConfirmCount)
|
|
|
- realAmountf := ps.Supplier.OrderPrice * float64(ps.ConfirmCount)
|
|
|
- realAmount := fmt.Sprintf("%.2f", realAmountf)
|
|
|
- b.FormatToEmpty(&realAmount)
|
|
|
- confirmTotalPlanPrice += realAmountf
|
|
|
- totalPlanPrice += float32(ps.Supplier.OrderRealPrice)
|
|
|
-
|
|
|
- DrawRow(row, ps.ProcessInfo.Name, ps.Supplier.SupplierInfo.Name, ps.ProcessInfo.Norm, ps.ProcessInfo.Unit, count, confirmCount, price, budgetAmount, realAmount)
|
|
|
- row++
|
|
|
+ if len(b.Content.Process) > 0 {
|
|
|
+ for _, ps := range b.Content.Process {
|
|
|
+ orderCount := fmt.Sprintf("%.2f", ps.Supplier.OrderCount)
|
|
|
+ confirmCount := fmt.Sprintf("%d", ps.ConfirmCount)
|
|
|
+ price := fmt.Sprintf("%.2f", ps.Supplier.OrderPrice)
|
|
|
+ b.FormatToEmpty(&price)
|
|
|
+ totalOrderRealPrice += ps.Supplier.OrderRealPrice
|
|
|
+ totalRealPrice += ps.RealPrice
|
|
|
+ orderRealPrice := fmt.Sprintf("%.2f", ps.Supplier.OrderRealPrice)
|
|
|
+ b.FormatToEmpty(&orderRealPrice)
|
|
|
+ realPrice := fmt.Sprintf("%.2f", ps.RealPrice)
|
|
|
+ DrawRow(row, ps.ProcessInfo.Name, ps.Supplier.SupplierInfo.Name, ps.ProcessInfo.Norm, ps.ProcessInfo.Unit, orderCount, confirmCount, price, orderRealPrice, realPrice)
|
|
|
+ row++
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
// 生产汇总金额
|
|
@@ -496,16 +586,15 @@ func (b *PlanCostExcel) drawAllContent() error {
|
|
|
|
|
|
// 生产预算汇总
|
|
|
b.Excel.SetCellStyle(b.SheetName, LCell, LCell, b.AlignCenterStyle)
|
|
|
- // planTotalPrice := fmt.Sprintf("%.2f", b.Content.TotalPrice) //
|
|
|
- planTotalPrice := fmt.Sprintf("%.2f", totalPlanPrice)
|
|
|
- b.FormatToEmpty(&planTotalPrice)
|
|
|
- b.Excel.SetCellValue(b.SheetName, LCell, planTotalPrice)
|
|
|
+ planOrderRealPrice := fmt.Sprintf("%.2f", totalOrderRealPrice)
|
|
|
+ b.FormatToEmpty(&planOrderRealPrice)
|
|
|
+ b.Excel.SetCellValue(b.SheetName, LCell, planOrderRealPrice)
|
|
|
|
|
|
// 生产实际汇总
|
|
|
b.Excel.SetCellStyle(b.SheetName, MCell, MCell, b.AlignCenterStyle)
|
|
|
- planConfirmTotalPrice := fmt.Sprintf("%.2f", confirmTotalPlanPrice)
|
|
|
- b.FormatToEmpty(&planConfirmTotalPrice)
|
|
|
- b.Excel.SetCellValue(b.SheetName, MCell, planConfirmTotalPrice)
|
|
|
+ planRealPrice := fmt.Sprintf("%.2f", totalRealPrice)
|
|
|
+ b.FormatToEmpty(&planRealPrice)
|
|
|
+ b.Excel.SetCellValue(b.SheetName, MCell, planRealPrice)
|
|
|
|
|
|
return nil
|
|
|
}
|
|
@@ -513,11 +602,12 @@ func (b *PlanCostExcel) drawAllContent() error {
|
|
|
func (b *PlanCostExcel) Draws() {
|
|
|
b.drawTitle()
|
|
|
b.drawTableTitle()
|
|
|
- if b.Content.SupplierId != "" {
|
|
|
- b.drawSupplierContent()
|
|
|
- } else {
|
|
|
- b.drawAllContent()
|
|
|
- }
|
|
|
+ // if b.Content.SupplierId != "" {
|
|
|
+ // b.drawSupplierContent()
|
|
|
+ // } else {
|
|
|
+ // b.drawAllContent()
|
|
|
+ // }
|
|
|
+ b.drawAllContent()
|
|
|
|
|
|
}
|
|
|
|