|
@@ -26,7 +26,7 @@ type PlanCostExcel struct {
|
|
|
func (b *PlanCostExcel) drawTitle() error {
|
|
|
tileIndex := b.Offset + 1
|
|
|
startCell := fmt.Sprintf("A%d", tileIndex)
|
|
|
- err := b.Excel.MergeCell(b.SheetName, startCell, fmt.Sprintf("L%d", tileIndex))
|
|
|
+ err := b.Excel.MergeCell(b.SheetName, startCell, fmt.Sprintf("M%d", tileIndex))
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|
|
@@ -144,9 +144,6 @@ func (b *PlanCostExcel) drawTableTitle() error {
|
|
|
drawCol("K", "单价")
|
|
|
drawCol("L", "预算金额")
|
|
|
drawCol("M", "实际金额")
|
|
|
- drawCol("N", "预算汇总")
|
|
|
- drawCol("O", "实际汇总")
|
|
|
-
|
|
|
return nil
|
|
|
}
|
|
|
|
|
@@ -196,7 +193,7 @@ func (b *PlanCostExcel) drawSupplierContent() error {
|
|
|
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, "", "")
|
|
|
+ b.drawRow(row, "", mat.MatInfo.Name, "", supplierName, mat.MatInfo.Norm, matHeigth, matWidth, mat.MatInfo.Unit, orderCount, confirmCount, orderPrice, orderRealPrice, confirmRealPrice)
|
|
|
row++
|
|
|
}
|
|
|
|
|
@@ -235,7 +232,7 @@ func (b *PlanCostExcel) drawSupplierContent() error {
|
|
|
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, "", "")
|
|
|
+ b.drawRow(row, "", "", craft.CraftInfo.Name, craftSupplierName, craft.CraftInfo.Norm, carftHeigth, carftWidth, craft.CraftInfo.Unit, carftOrderCount, confirmCraftCount, carftOrderPrice, carftOrderRealPrice, confirmCraftRealPrice)
|
|
|
row++
|
|
|
|
|
|
}
|
|
@@ -260,28 +257,28 @@ func (b *PlanCostExcel) drawSupplierContent() error {
|
|
|
fmt.Println("startACell:", startACell)
|
|
|
fmt.Println("endACell:", endACell)
|
|
|
fmt.Println("compName:", comp.Name)
|
|
|
- // 供应商组件预算汇总
|
|
|
- startLCell := fmt.Sprintf("%s%d", "N", startRow)
|
|
|
- endLCell := fmt.Sprintf("%s%d", "N", endRow)
|
|
|
- b.Excel.MergeCell(b.SheetName, startLCell, endLCell)
|
|
|
- err = b.Excel.SetCellStyle(b.SheetName, startLCell, endLCell, b.AlignCenterStyle)
|
|
|
- if err != nil {
|
|
|
- return err
|
|
|
- }
|
|
|
- compTotalPrice := fmt.Sprintf("%.2f", totalOrderRealPrice)
|
|
|
- b.FormatToEmpty(&compTotalPrice)
|
|
|
- b.Excel.SetCellValue(b.SheetName, startLCell, compTotalPrice)
|
|
|
- // 供应商组件实际汇总
|
|
|
- startOCell := fmt.Sprintf("%s%d", "O", startRow)
|
|
|
- endOCell := fmt.Sprintf("%s%d", "O", endRow)
|
|
|
- b.Excel.MergeCell(b.SheetName, startOCell, endOCell)
|
|
|
- err = b.Excel.SetCellStyle(b.SheetName, startOCell, endOCell, b.AlignCenterStyle)
|
|
|
- if err != nil {
|
|
|
- return err
|
|
|
- }
|
|
|
- compConfirmTotalPrice := fmt.Sprintf("%.2f", totalConfirmRealPrice)
|
|
|
- b.FormatToEmpty(&compConfirmTotalPrice)
|
|
|
- b.Excel.SetCellValue(b.SheetName, startLCell, compConfirmTotalPrice)
|
|
|
+ // // 供应商组件预算汇总
|
|
|
+ // startLCell := fmt.Sprintf("%s%d", "N", startRow)
|
|
|
+ // endLCell := fmt.Sprintf("%s%d", "N", endRow)
|
|
|
+ // b.Excel.MergeCell(b.SheetName, startLCell, endLCell)
|
|
|
+ // err = b.Excel.SetCellStyle(b.SheetName, startLCell, endLCell, b.AlignCenterStyle)
|
|
|
+ // if err != nil {
|
|
|
+ // return err
|
|
|
+ // }
|
|
|
+ // compTotalPrice := fmt.Sprintf("%.2f", totalOrderRealPrice)
|
|
|
+ // b.FormatToEmpty(&compTotalPrice)
|
|
|
+ // b.Excel.SetCellValue(b.SheetName, startLCell, compTotalPrice)
|
|
|
+ // // 供应商组件实际汇总
|
|
|
+ // startOCell := fmt.Sprintf("%s%d", "O", startRow)
|
|
|
+ // endOCell := fmt.Sprintf("%s%d", "O", endRow)
|
|
|
+ // b.Excel.MergeCell(b.SheetName, startOCell, endOCell)
|
|
|
+ // err = b.Excel.SetCellStyle(b.SheetName, startOCell, endOCell, b.AlignCenterStyle)
|
|
|
+ // if err != nil {
|
|
|
+ // return err
|
|
|
+ // }
|
|
|
+ // compConfirmTotalPrice := fmt.Sprintf("%.2f", totalConfirmRealPrice)
|
|
|
+ // b.FormatToEmpty(&compConfirmTotalPrice)
|
|
|
+ // b.Excel.SetCellValue(b.SheetName, startLCell, compConfirmTotalPrice)
|
|
|
|
|
|
}
|
|
|
|
|
@@ -289,26 +286,27 @@ func (b *PlanCostExcel) drawSupplierContent() error {
|
|
|
totalPlanPrice += totalOrderRealPrice
|
|
|
confirmTotalPlanPrice += totalConfirmRealPrice
|
|
|
}
|
|
|
+
|
|
|
// 生产汇总金额
|
|
|
startACell := fmt.Sprintf("%s%d", "A", row)
|
|
|
- endMCell := fmt.Sprintf("%s%d", "M", row)
|
|
|
- NCell := fmt.Sprintf("%s%d", "N", row)
|
|
|
- OCell := fmt.Sprintf("%s%d", "O", row)
|
|
|
- b.Excel.MergeCell(b.SheetName, startACell, endMCell)
|
|
|
- b.Excel.SetCellStyle(b.SheetName, startACell, endMCell, b.AlignCenterStyle)
|
|
|
+ endKCell := fmt.Sprintf("%s%d", "K", row)
|
|
|
+ LCell := fmt.Sprintf("%s%d", "L", row)
|
|
|
+ MCell := fmt.Sprintf("%s%d", "M", row)
|
|
|
+ b.Excel.MergeCell(b.SheetName, startACell, endKCell)
|
|
|
+ b.Excel.SetCellStyle(b.SheetName, startACell, endKCell, b.AlignCenterStyle)
|
|
|
b.Excel.SetCellValue(b.SheetName, startACell, "生产计划汇总金额")
|
|
|
|
|
|
// 生产预算汇总
|
|
|
- b.Excel.SetCellStyle(b.SheetName, NCell, NCell, b.AlignCenterStyle)
|
|
|
+ b.Excel.SetCellStyle(b.SheetName, LCell, LCell, b.AlignCenterStyle)
|
|
|
planTotalPrice := fmt.Sprintf("%.2f", totalPlanPrice)
|
|
|
b.FormatToEmpty(&planTotalPrice)
|
|
|
- b.Excel.SetCellValue(b.SheetName, NCell, planTotalPrice)
|
|
|
+ b.Excel.SetCellValue(b.SheetName, LCell, planTotalPrice)
|
|
|
|
|
|
// 生产实际汇总
|
|
|
- b.Excel.SetCellStyle(b.SheetName, OCell, OCell, b.AlignCenterStyle)
|
|
|
+ b.Excel.SetCellStyle(b.SheetName, MCell, MCell, b.AlignCenterStyle)
|
|
|
planConfirmTotalPrice := fmt.Sprintf("%.2f", confirmTotalPlanPrice)
|
|
|
b.FormatToEmpty(&planConfirmTotalPrice)
|
|
|
- b.Excel.SetCellValue(b.SheetName, OCell, planConfirmTotalPrice)
|
|
|
+ b.Excel.SetCellValue(b.SheetName, MCell, planConfirmTotalPrice)
|
|
|
|
|
|
}
|
|
|
|
|
@@ -316,7 +314,7 @@ func (b *PlanCostExcel) drawSupplierContent() error {
|
|
|
}
|
|
|
|
|
|
func (b *PlanCostExcel) drawRow(rowIndex int, values ...string) {
|
|
|
- charas := []string{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O"}
|
|
|
+ charas := []string{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M"}
|
|
|
for i, c := range charas {
|
|
|
v := ""
|
|
|
if i < len(values) {
|
|
@@ -374,7 +372,7 @@ func (b *PlanCostExcel) drawAllContent() error {
|
|
|
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, "", "")
|
|
|
+ b.drawRow(row, "", mat.MatInfo.Name, "", supplierName, mat.MatInfo.Norm, matHeigth, matWidth, mat.MatInfo.Unit, orderCount, confirmCount, orderPrice, orderRealPrice, confirmRealPrice)
|
|
|
|
|
|
row++
|
|
|
if len(mat.Crafts) > 0 {
|
|
@@ -413,7 +411,7 @@ func (b *PlanCostExcel) drawAllContent() error {
|
|
|
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, "", "")
|
|
|
+ b.drawRow(row, "", "", craft.CraftInfo.Name, craftSupplierName, craft.CraftInfo.Norm, carftHeigth, carftWidth, craft.CraftInfo.Unit, carftOrderCount, confirmCraftCount, carftOrderPrice, carftOrderRealPrice, confirmCraftRealPrice)
|
|
|
|
|
|
row++
|
|
|
|
|
@@ -430,41 +428,41 @@ func (b *PlanCostExcel) drawAllContent() error {
|
|
|
return err
|
|
|
}
|
|
|
b.Excel.SetCellValue(b.SheetName, startACell, comp.Name)
|
|
|
- // 组件汇总金额
|
|
|
- startLCell := fmt.Sprintf("%s%d", "L", startRow)
|
|
|
- endLCell := fmt.Sprintf("%s%d", "L", endRow)
|
|
|
- b.Excel.MergeCell(b.SheetName, startLCell, endLCell)
|
|
|
- err = b.Excel.SetCellStyle(b.SheetName, startLCell, endLCell, b.AlignCenterStyle)
|
|
|
- if err != nil {
|
|
|
- return err
|
|
|
- }
|
|
|
- compTotalPrice := fmt.Sprintf("%.2f", comp.TotalPrice)
|
|
|
- b.FormatToEmpty(&compTotalPrice)
|
|
|
- b.Excel.SetCellValue(b.SheetName, startLCell, compTotalPrice)
|
|
|
- confirmTotalPlanPrice += totalConfirmRealPrice
|
|
|
+ // // 组件汇总金额
|
|
|
+ // startLCell := fmt.Sprintf("%s%d", "L", startRow)
|
|
|
+ // endLCell := fmt.Sprintf("%s%d", "L", endRow)
|
|
|
+ // b.Excel.MergeCell(b.SheetName, startLCell, endLCell)
|
|
|
+ // err = b.Excel.SetCellStyle(b.SheetName, startLCell, endLCell, b.AlignCenterStyle)
|
|
|
+ // if err != nil {
|
|
|
+ // return err
|
|
|
+ // }
|
|
|
+ // compTotalPrice := fmt.Sprintf("%.2f", comp.TotalPrice)
|
|
|
+ // b.FormatToEmpty(&compTotalPrice)
|
|
|
+ // b.Excel.SetCellValue(b.SheetName, startLCell, compTotalPrice)
|
|
|
+ // confirmTotalPlanPrice += totalConfirmRealPrice
|
|
|
|
|
|
}
|
|
|
}
|
|
|
// 生产汇总金额
|
|
|
startACell := fmt.Sprintf("%s%d", "A", row)
|
|
|
- endMCell := fmt.Sprintf("%s%d", "M", row)
|
|
|
- NCell := fmt.Sprintf("%s%d", "L", row)
|
|
|
- OCell := fmt.Sprintf("%s%d", "O", row)
|
|
|
- b.Excel.MergeCell(b.SheetName, startACell, endMCell)
|
|
|
- b.Excel.SetCellStyle(b.SheetName, startACell, endMCell, b.AlignCenterStyle)
|
|
|
+ endKCell := fmt.Sprintf("%s%d", "K", row)
|
|
|
+ LCell := fmt.Sprintf("%s%d", "L", row)
|
|
|
+ MCell := fmt.Sprintf("%s%d", "M", row)
|
|
|
+ b.Excel.MergeCell(b.SheetName, startACell, endKCell)
|
|
|
+ b.Excel.SetCellStyle(b.SheetName, startACell, endKCell, b.AlignCenterStyle)
|
|
|
b.Excel.SetCellValue(b.SheetName, startACell, "生产计划汇总金额")
|
|
|
|
|
|
// 生产预算汇总
|
|
|
- b.Excel.SetCellStyle(b.SheetName, NCell, NCell, b.AlignCenterStyle)
|
|
|
+ b.Excel.SetCellStyle(b.SheetName, LCell, LCell, b.AlignCenterStyle)
|
|
|
planTotalPrice := fmt.Sprintf("%.2f", b.Content.TotalPrice)
|
|
|
b.FormatToEmpty(&planTotalPrice)
|
|
|
- b.Excel.SetCellValue(b.SheetName, NCell, planTotalPrice)
|
|
|
+ b.Excel.SetCellValue(b.SheetName, LCell, planTotalPrice)
|
|
|
|
|
|
// 生产实际汇总
|
|
|
- b.Excel.SetCellStyle(b.SheetName, OCell, OCell, b.AlignCenterStyle)
|
|
|
+ b.Excel.SetCellStyle(b.SheetName, MCell, MCell, b.AlignCenterStyle)
|
|
|
planConfirmTotalPrice := fmt.Sprintf("%.2f", confirmTotalPlanPrice)
|
|
|
b.FormatToEmpty(&planConfirmTotalPrice)
|
|
|
- b.Excel.SetCellValue(b.SheetName, OCell, planConfirmTotalPrice)
|
|
|
+ b.Excel.SetCellValue(b.SheetName, MCell, planConfirmTotalPrice)
|
|
|
}
|
|
|
|
|
|
return nil
|
|
@@ -505,7 +503,7 @@ func NewPlanCostExcel(f *excelize.File) *PlanCostExcel {
|
|
|
}
|
|
|
|
|
|
f.SetColWidth(b.SheetName, "A", "D", 12)
|
|
|
- f.SetColWidth(b.SheetName, "E", "O", 10)
|
|
|
+ f.SetColWidth(b.SheetName, "E", "M", 10)
|
|
|
f.SetPageMargins(b.SheetName, excelize.PageMarginTop(0), excelize.PageMarginLeft(0), excelize.PageMarginRight(0))
|
|
|
return b
|
|
|
}
|