|
@@ -20,7 +20,7 @@ type PlanSummaryExcel struct {
|
|
func (b *PlanSummaryExcel) drawTitle() error {
|
|
func (b *PlanSummaryExcel) drawTitle() error {
|
|
b.Row++
|
|
b.Row++
|
|
startCell := fmt.Sprintf("A%d", b.Row)
|
|
startCell := fmt.Sprintf("A%d", b.Row)
|
|
- err := b.Excel.MergeCell(b.SheetName, startCell, fmt.Sprintf("S%d", b.Row))
|
|
|
|
|
|
+ err := b.Excel.MergeCell(b.SheetName, startCell, fmt.Sprintf("T%d", b.Row))
|
|
if err != nil {
|
|
if err != nil {
|
|
return err
|
|
return err
|
|
}
|
|
}
|
|
@@ -131,11 +131,12 @@ func (b *PlanSummaryExcel) drawTableTitle() error {
|
|
drawCol("Q", "预算金额")
|
|
drawCol("Q", "预算金额")
|
|
drawCol("R", "实际金额")
|
|
drawCol("R", "实际金额")
|
|
drawCol("S", "备注")
|
|
drawCol("S", "备注")
|
|
|
|
+ drawCol("T", "送货地址")
|
|
return nil
|
|
return nil
|
|
}
|
|
}
|
|
|
|
|
|
func (b *PlanSummaryExcel) drawRow(rowIndex int, values ...string) {
|
|
func (b *PlanSummaryExcel) drawRow(rowIndex int, values ...string) {
|
|
- charas := []string{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S"}
|
|
|
|
|
|
+ charas := []string{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T"}
|
|
for i, c := range charas {
|
|
for i, c := range charas {
|
|
v := ""
|
|
v := ""
|
|
if i < len(values) {
|
|
if i < len(values) {
|
|
@@ -253,12 +254,12 @@ func (b *PlanSummaryExcel) drawAllContent() error {
|
|
}
|
|
}
|
|
// 订单存在时,订单号和下单时间// 合并相同的订单,记录row方便合并
|
|
// 订单存在时,订单号和下单时间// 合并相同的订单,记录row方便合并
|
|
if len(stage.BillId) == 24 {
|
|
if len(stage.BillId) == 24 {
|
|
- billFlag := fmt.Sprintf("%s_%s", splan.SerialNumber[stage.BillId], splan.CreateTimes[stage.BillId].Local().Format("2006-01-02"))
|
|
|
|
|
|
+ billFlag := fmt.Sprintf("%s_%s_%s", splan.SerialNumber[stage.BillId], splan.CreateTimes[stage.BillId].Local().Format("2006-01-02"), splan.SendTo[stage.BillId])
|
|
cates[billFlag] = append(cates[billFlag], b.Row)
|
|
cates[billFlag] = append(cates[billFlag], b.Row)
|
|
}
|
|
}
|
|
|
|
|
|
b.drawRow(b.Row, "", "", "", "", stageType, stage.Name, orderCount, realCount, stageStatus, supplierName, fmt.Sprintf("%.3f元/%s", stage.Price, stage.Unit), stage.Norm,
|
|
b.drawRow(b.Row, "", "", "", "", stageType, stage.Name, orderCount, realCount, stageStatus, supplierName, fmt.Sprintf("%.3f元/%s", stage.Price, stage.Unit), stage.Norm,
|
|
- matHeigth, matWidth, unit, price, budgetPrice, realPrice, stage.Remark)
|
|
|
|
|
|
+ matHeigth, matWidth, unit, price, budgetPrice, realPrice, stage.Remark, "")
|
|
// if stage.SupplierInfo != nil {
|
|
// if stage.SupplierInfo != nil {
|
|
// cates[stage.SupplierInfo.Name] = append(cates[stage.SupplierInfo.Name], b.Row)
|
|
// cates[stage.SupplierInfo.Name] = append(cates[stage.SupplierInfo.Name], b.Row)
|
|
|
|
|
|
@@ -268,13 +269,16 @@ func (b *PlanSummaryExcel) drawAllContent() error {
|
|
for billFlag, cate := range cates {
|
|
for billFlag, cate := range cates {
|
|
billInfo := strings.Split(billFlag, "_")
|
|
billInfo := strings.Split(billFlag, "_")
|
|
|
|
|
|
- if len(billInfo) == 2 {
|
|
|
|
|
|
+ if len(billInfo) == 3 {
|
|
mergeStartRow := cate[0]
|
|
mergeStartRow := cate[0]
|
|
mergeEndRow := cate[len(cate)-1]
|
|
mergeEndRow := cate[len(cate)-1]
|
|
b.Excel.MergeCell(b.SheetName, fmt.Sprintf("C%d", mergeStartRow), fmt.Sprintf("C%d", mergeEndRow))
|
|
b.Excel.MergeCell(b.SheetName, fmt.Sprintf("C%d", mergeStartRow), fmt.Sprintf("C%d", mergeEndRow))
|
|
b.Excel.SetCellValue(b.SheetName, fmt.Sprintf("C%d", mergeEndRow), billInfo[0])
|
|
b.Excel.SetCellValue(b.SheetName, fmt.Sprintf("C%d", mergeEndRow), billInfo[0])
|
|
b.Excel.MergeCell(b.SheetName, fmt.Sprintf("D%d", mergeStartRow), fmt.Sprintf("D%d", mergeEndRow))
|
|
b.Excel.MergeCell(b.SheetName, fmt.Sprintf("D%d", mergeStartRow), fmt.Sprintf("D%d", mergeEndRow))
|
|
b.Excel.SetCellValue(b.SheetName, fmt.Sprintf("D%d", mergeEndRow), billInfo[1])
|
|
b.Excel.SetCellValue(b.SheetName, fmt.Sprintf("D%d", mergeEndRow), billInfo[1])
|
|
|
|
+
|
|
|
|
+ b.Excel.MergeCell(b.SheetName, fmt.Sprintf("T%d", mergeStartRow), fmt.Sprintf("T%d", mergeEndRow))
|
|
|
|
+ b.Excel.SetCellValue(b.SheetName, fmt.Sprintf("T%d", mergeEndRow), billInfo[2])
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
@@ -459,12 +463,12 @@ func (b *PlanSummaryExcel) drawSupplierContent() error {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if len(stage.BillId) == 24 {
|
|
if len(stage.BillId) == 24 {
|
|
- billFlag := fmt.Sprintf("%s_%s", splan.SerialNumber[stage.BillId], splan.CreateTimes[stage.BillId].Local().Format("2006-01-02"))
|
|
|
|
|
|
+ billFlag := fmt.Sprintf("%s_%s_%s", splan.SerialNumber[stage.BillId], splan.CreateTimes[stage.BillId].Local().Format("2006-01-02"), splan.SendTo[stage.BillId])
|
|
cates[billFlag] = append(cates[billFlag], b.Row)
|
|
cates[billFlag] = append(cates[billFlag], b.Row)
|
|
}
|
|
}
|
|
|
|
|
|
b.drawRow(b.Row, "", "", "", "", stageType, stage.Name, orderCount, realCount, stageStatus, supplierName, fmt.Sprintf("%.3f元/%s", stage.Price, stage.Unit),
|
|
b.drawRow(b.Row, "", "", "", "", stageType, stage.Name, orderCount, realCount, stageStatus, supplierName, fmt.Sprintf("%.3f元/%s", stage.Price, stage.Unit),
|
|
- stage.Norm, matHeigth, matWidth, unit, price, budgetPrice, realPrice, stage.Remark)
|
|
|
|
|
|
+ stage.Norm, matHeigth, matWidth, unit, price, budgetPrice, realPrice, stage.Remark, "")
|
|
// if stage.SupplierInfo != nil {
|
|
// if stage.SupplierInfo != nil {
|
|
// cates[stage.SupplierInfo.Name] = append(cates[stage.SupplierInfo.Name], b.Row)
|
|
// cates[stage.SupplierInfo.Name] = append(cates[stage.SupplierInfo.Name], b.Row)
|
|
|
|
|
|
@@ -477,13 +481,16 @@ func (b *PlanSummaryExcel) drawSupplierContent() error {
|
|
|
|
|
|
for billFlag, cate := range cates {
|
|
for billFlag, cate := range cates {
|
|
billInfo := strings.Split(billFlag, "_")
|
|
billInfo := strings.Split(billFlag, "_")
|
|
- if len(billInfo) == 2 {
|
|
|
|
|
|
+ if len(billInfo) == 3 {
|
|
mergeStartRow := cate[0]
|
|
mergeStartRow := cate[0]
|
|
mergeEndRow := cate[len(cate)-1]
|
|
mergeEndRow := cate[len(cate)-1]
|
|
b.Excel.MergeCell(b.SheetName, fmt.Sprintf("C%d", mergeStartRow), fmt.Sprintf("C%d", mergeEndRow))
|
|
b.Excel.MergeCell(b.SheetName, fmt.Sprintf("C%d", mergeStartRow), fmt.Sprintf("C%d", mergeEndRow))
|
|
b.Excel.SetCellValue(b.SheetName, fmt.Sprintf("C%d", mergeEndRow), billInfo[0])
|
|
b.Excel.SetCellValue(b.SheetName, fmt.Sprintf("C%d", mergeEndRow), billInfo[0])
|
|
b.Excel.MergeCell(b.SheetName, fmt.Sprintf("D%d", mergeStartRow), fmt.Sprintf("D%d", mergeEndRow))
|
|
b.Excel.MergeCell(b.SheetName, fmt.Sprintf("D%d", mergeStartRow), fmt.Sprintf("D%d", mergeEndRow))
|
|
b.Excel.SetCellValue(b.SheetName, fmt.Sprintf("D%d", mergeEndRow), billInfo[1])
|
|
b.Excel.SetCellValue(b.SheetName, fmt.Sprintf("D%d", mergeEndRow), billInfo[1])
|
|
|
|
+
|
|
|
|
+ b.Excel.MergeCell(b.SheetName, fmt.Sprintf("T%d", mergeStartRow), fmt.Sprintf("T%d", mergeEndRow))
|
|
|
|
+ b.Excel.SetCellValue(b.SheetName, fmt.Sprintf("T%d", mergeEndRow), billInfo[2])
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -566,7 +573,7 @@ func (b *PlanSummaryExcel) drawSupplierContent() error {
|
|
if err != nil {
|
|
if err != nil {
|
|
return err
|
|
return err
|
|
}
|
|
}
|
|
- err = b.Excel.SetCellStyle(b.SheetName, "A1", "G1", style)
|
|
|
|
|
|
+ err = b.Excel.SetCellStyle(b.SheetName, "A1", "T1", style)
|
|
if err != nil {
|
|
if err != nil {
|
|
return err
|
|
return err
|
|
}
|
|
}
|
|
@@ -618,6 +625,7 @@ func NewPlanSummaryExcel(f *excelize.File) *PlanSummaryExcel {
|
|
f.SetColWidth(b.SheetName, "M", "P", 12)
|
|
f.SetColWidth(b.SheetName, "M", "P", 12)
|
|
f.SetColWidth(b.SheetName, "Q", "R", 16)
|
|
f.SetColWidth(b.SheetName, "Q", "R", 16)
|
|
f.SetColWidth(b.SheetName, "S", "S", 20)
|
|
f.SetColWidth(b.SheetName, "S", "S", 20)
|
|
|
|
+ f.SetColWidth(b.SheetName, "T", "T", 40)
|
|
f.SetPageMargins(b.SheetName, excelize.PageMarginTop(0), excelize.PageMarginLeft(0), excelize.PageMarginRight(0))
|
|
f.SetPageMargins(b.SheetName, excelize.PageMarginTop(0), excelize.PageMarginLeft(0), excelize.PageMarginRight(0))
|
|
return b
|
|
return b
|
|
}
|
|
}
|