|
@@ -27,7 +27,7 @@ func (b *PlanCostExcel) drawTitle() error {
|
|
|
|
|
|
b.Row++
|
|
|
startCell := fmt.Sprintf("A%d", b.Row)
|
|
|
- err := b.Excel.MergeCell(b.SheetName, startCell, fmt.Sprintf("M%d", b.Row))
|
|
|
+ err := b.Excel.MergeCell(b.SheetName, startCell, fmt.Sprintf("N%d", b.Row))
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|
|
@@ -130,18 +130,19 @@ func (b *PlanCostExcel) drawTableTitle() error {
|
|
|
drawCol("A", "产品部件名称")
|
|
|
drawCol2("B", "C", "类型/项目", "类型", "项目")
|
|
|
drawCol("D", "供应商名称")
|
|
|
- drawCol3("E", "F", "G", "规格", "厚度(纸克)", "长", "宽")
|
|
|
- drawCol("H", "单位")
|
|
|
- drawCol("I", "下单数量")
|
|
|
- drawCol("J", "实际数量")
|
|
|
- drawCol("K", "单价")
|
|
|
- drawCol("L", "预算金额")
|
|
|
- drawCol("M", "实际金额")
|
|
|
+ drawCol("E", "(单价1")
|
|
|
+ drawCol3("F", "G", "H", "规格", "厚度(纸克)", "长", "宽")
|
|
|
+ drawCol("I", "单位")
|
|
|
+ drawCol("J", "下单数量")
|
|
|
+ drawCol("K", "实际数量")
|
|
|
+ drawCol("L", "单价")
|
|
|
+ drawCol("M", "预算金额")
|
|
|
+ drawCol("N", "实际金额")
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
func (b *PlanCostExcel) drawRow(rowIndex int, values ...string) {
|
|
|
- charas := []string{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M"}
|
|
|
+ charas := []string{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N"}
|
|
|
for i, c := range charas {
|
|
|
v := ""
|
|
|
if i < len(values) {
|
|
@@ -208,8 +209,9 @@ func (b *PlanCostExcel) drawSupplierContent() error {
|
|
|
perRealPrice += stage.OrderPrice * float64(stage.ConfirmCount)
|
|
|
realPrice := fmt.Sprintf("%.3f", stage.OrderPrice*float64(stage.ConfirmCount))
|
|
|
b.FormatToEmpty(&realPrice)
|
|
|
+ unit := stage.Unit
|
|
|
if stage.Unit == "吨" || stage.Unit == "平方米" {
|
|
|
- stage.Unit = "张"
|
|
|
+ unit = "张"
|
|
|
}
|
|
|
|
|
|
|
|
@@ -226,7 +228,7 @@ func (b *PlanCostExcel) drawSupplierContent() error {
|
|
|
if stage.Type == 3 {
|
|
|
stageType = "成品采购"
|
|
|
}
|
|
|
- b.drawRow(b.Row, "", stageType, stage.Name, "", stage.Norm, matHeigth, matWidth, stage.Unit, orderCount, realCount, price, budgetPrice, realPrice)
|
|
|
+ b.drawRow(b.Row, "", stageType, stage.Name, "", fmt.Sprintf("%.3f元/%s", stage.Price, stage.Unit), stage.Norm, matHeigth, matWidth, unit, orderCount, realCount, price, budgetPrice, realPrice)
|
|
|
cates[stage.SupplierInfo.Name] = append(cates[stage.SupplierInfo.Name], b.Row)
|
|
|
b.Row++
|
|
|
}
|
|
@@ -267,24 +269,24 @@ func (b *PlanCostExcel) drawSupplierContent() error {
|
|
|
|
|
|
|
|
|
startACell := fmt.Sprintf("%s%d", "A", b.Row)
|
|
|
- endKCell := fmt.Sprintf("%s%d", "K", b.Row)
|
|
|
- LCell := fmt.Sprintf("%s%d", "L", b.Row)
|
|
|
+ endLCell := fmt.Sprintf("%s%d", "L", b.Row)
|
|
|
MCell := fmt.Sprintf("%s%d", "M", b.Row)
|
|
|
- b.Excel.MergeCell(b.SheetName, startACell, endKCell)
|
|
|
- b.Excel.SetCellStyle(b.SheetName, startACell, endKCell, b.AlignCenterStyle)
|
|
|
+ NCell := fmt.Sprintf("%s%d", "N", b.Row)
|
|
|
+ b.Excel.MergeCell(b.SheetName, startACell, endLCell)
|
|
|
+ b.Excel.SetCellStyle(b.SheetName, startACell, endLCell, b.AlignCenterStyle)
|
|
|
b.Excel.SetCellValue(b.SheetName, startACell, fmt.Sprintf("【%s】生产计划汇总金额", supplier))
|
|
|
|
|
|
|
|
|
- b.Excel.SetCellStyle(b.SheetName, LCell, LCell, b.AlignCenterStyle)
|
|
|
+ b.Excel.SetCellStyle(b.SheetName, MCell, MCell, b.AlignCenterStyle)
|
|
|
planOrderRealPrice := fmt.Sprintf("%.3f", totalBudgetPrice)
|
|
|
b.FormatToEmpty(&planOrderRealPrice)
|
|
|
- b.Excel.SetCellValue(b.SheetName, LCell, planOrderRealPrice)
|
|
|
+ b.Excel.SetCellValue(b.SheetName, MCell, planOrderRealPrice)
|
|
|
|
|
|
|
|
|
- b.Excel.SetCellStyle(b.SheetName, MCell, MCell, b.AlignCenterStyle)
|
|
|
+ b.Excel.SetCellStyle(b.SheetName, NCell, NCell, b.AlignCenterStyle)
|
|
|
planRealPrice := fmt.Sprintf("%.3f", totalRealPrice)
|
|
|
b.FormatToEmpty(&planRealPrice)
|
|
|
- b.Excel.SetCellValue(b.SheetName, MCell, planRealPrice)
|
|
|
+ b.Excel.SetCellValue(b.SheetName, NCell, planRealPrice)
|
|
|
|
|
|
return nil
|
|
|
}
|
|
@@ -327,9 +329,11 @@ func (b *PlanCostExcel) drawAllContent() error {
|
|
|
perRealPrice += stage.OrderPrice * float64(stage.ConfirmCount)
|
|
|
realPrice := fmt.Sprintf("%.3f", stage.OrderPrice*float64(stage.ConfirmCount))
|
|
|
b.FormatToEmpty(&realPrice)
|
|
|
+ unit := stage.Unit
|
|
|
if stage.Unit == "吨" || stage.Unit == "平方米" {
|
|
|
- stage.Unit = "张"
|
|
|
+ unit = "张"
|
|
|
}
|
|
|
+
|
|
|
supplierName := ""
|
|
|
if stage.SupplierInfo != nil {
|
|
|
supplierName = stage.SupplierInfo.Name
|
|
@@ -347,7 +351,7 @@ func (b *PlanCostExcel) drawAllContent() error {
|
|
|
if stage.Type == 3 {
|
|
|
stageType = "成品采购"
|
|
|
}
|
|
|
- b.drawRow(b.Row, "", stageType, stage.Name, supplierName, stage.Norm, matHeigth, matWidth, stage.Unit, orderCount, realCount, price, budgetPrice, realPrice)
|
|
|
+ b.drawRow(b.Row, "", stageType, stage.Name, supplierName, fmt.Sprintf("%.3f元/%s", stage.Price, stage.Unit), stage.Norm, matHeigth, matWidth, unit, orderCount, realCount, price, budgetPrice, realPrice)
|
|
|
if stage.SupplierInfo != nil {
|
|
|
cates[stage.SupplierInfo.Name] = append(cates[stage.SupplierInfo.Name], b.Row)
|
|
|
|
|
@@ -383,24 +387,24 @@ func (b *PlanCostExcel) drawAllContent() error {
|
|
|
}
|
|
|
}
|
|
|
startACell := fmt.Sprintf("%s%d", "A", b.Row)
|
|
|
- endKCell := fmt.Sprintf("%s%d", "K", b.Row)
|
|
|
- LCell := fmt.Sprintf("%s%d", "L", b.Row)
|
|
|
+ endLCell := fmt.Sprintf("%s%d", "L", b.Row)
|
|
|
MCell := fmt.Sprintf("%s%d", "M", b.Row)
|
|
|
- b.Excel.MergeCell(b.SheetName, startACell, endKCell)
|
|
|
- b.Excel.SetCellStyle(b.SheetName, startACell, endKCell, b.AlignCenterStyle)
|
|
|
+ NCell := fmt.Sprintf("%s%d", "N", b.Row)
|
|
|
+ b.Excel.MergeCell(b.SheetName, startACell, endLCell)
|
|
|
+ b.Excel.SetCellStyle(b.SheetName, startACell, endLCell, b.AlignCenterStyle)
|
|
|
b.Excel.SetCellValue(b.SheetName, startACell, "生产计划汇总金额")
|
|
|
|
|
|
|
|
|
- b.Excel.SetCellStyle(b.SheetName, LCell, LCell, b.AlignCenterStyle)
|
|
|
+ b.Excel.SetCellStyle(b.SheetName, MCell, MCell, b.AlignCenterStyle)
|
|
|
planOrderRealPrice := fmt.Sprintf("%.3f", totalBudgetPrice)
|
|
|
b.FormatToEmpty(&planOrderRealPrice)
|
|
|
- b.Excel.SetCellValue(b.SheetName, LCell, planOrderRealPrice)
|
|
|
+ b.Excel.SetCellValue(b.SheetName, MCell, planOrderRealPrice)
|
|
|
|
|
|
|
|
|
- b.Excel.SetCellStyle(b.SheetName, MCell, MCell, b.AlignCenterStyle)
|
|
|
+ b.Excel.SetCellStyle(b.SheetName, NCell, NCell, b.AlignCenterStyle)
|
|
|
planRealPrice := fmt.Sprintf("%.3f", totalRealPrice)
|
|
|
b.FormatToEmpty(&planRealPrice)
|
|
|
- b.Excel.SetCellValue(b.SheetName, MCell, planRealPrice)
|
|
|
+ b.Excel.SetCellValue(b.SheetName, NCell, planRealPrice)
|
|
|
|
|
|
return nil
|
|
|
}
|
|
@@ -442,8 +446,9 @@ func NewPlanCostExcel(f *excelize.File) *PlanCostExcel {
|
|
|
f.SetColWidth(b.SheetName, "A", "B", 12)
|
|
|
f.SetColWidth(b.SheetName, "C", "C", 16)
|
|
|
f.SetColWidth(b.SheetName, "D", "D", 25)
|
|
|
- f.SetColWidth(b.SheetName, "E", "E", 16)
|
|
|
- f.SetColWidth(b.SheetName, "F", "M", 10)
|
|
|
+ f.SetColWidth(b.SheetName, "E", "E", 15)
|
|
|
+ f.SetColWidth(b.SheetName, "F", "F", 16)
|
|
|
+ f.SetColWidth(b.SheetName, "F", "N", 12)
|
|
|
f.SetPageMargins(b.SheetName, excelize.PageMarginTop(0), excelize.PageMarginLeft(0), excelize.PageMarginRight(0))
|
|
|
return b
|
|
|
}
|