Browse Source

调整成品采购表格

animeic 2 years ago
parent
commit
95d4587da0
2 changed files with 30 additions and 18 deletions
  1. 22 15
      boxcost/api/bill-product-excel.go
  2. 8 3
      boxcost/api/report-product-excel.go

+ 22 - 15
boxcost/api/bill-product-excel.go

@@ -70,7 +70,7 @@ func (b *ProductBillExcel) drawSubTitles() error {
 	var drawLeft = func(rowIndex int, value string) error {
 		//左边1
 		left1Cell := fmt.Sprintf("A%d", rowIndex)
-		err = b.Excel.MergeCell(b.SheetName, left1Cell, fmt.Sprintf("E%d", rowIndex))
+		err = b.Excel.MergeCell(b.SheetName, left1Cell, fmt.Sprintf("F%d", rowIndex))
 		if err != nil {
 			return err
 		}
@@ -83,7 +83,7 @@ func (b *ProductBillExcel) drawSubTitles() error {
 	}
 
 	var drawRight = func(rowIndex int, value string) error {
-		right1Cell := fmt.Sprintf("F%d", rowIndex)
+		right1Cell := fmt.Sprintf("G%d", rowIndex)
 		err = b.Excel.MergeCell(b.SheetName, right1Cell, fmt.Sprintf("J%d", rowIndex))
 		if err != nil {
 			return err
@@ -202,7 +202,7 @@ func (b *ProductBillExcel) drawTableContent() error {
 }
 
 func (b *ProductBillExcel) drawTableFooter() error {
-	left1Cell := fmt.Sprintf("A%d", b.Row)
+	// left1Cell := fmt.Sprintf("A%d", b.Row)
 	border := []excelize.Border{
 		{Type: "top", Style: 1, Color: "000000"},
 		{Type: "left", Style: 1, Color: "000000"},
@@ -214,19 +214,22 @@ func (b *ProductBillExcel) drawTableFooter() error {
 		Border:    border,
 	})
 
-	b.Excel.SetCellStyle(b.SheetName, left1Cell, left1Cell, styleLeft)
-	b.Excel.SetCellValue(b.SheetName, left1Cell, "送货地址:")
+	// b.Excel.SetCellStyle(b.SheetName, left1Cell, left1Cell, styleLeft)
+	// b.Excel.SetCellValue(b.SheetName, left1Cell, "送货地址:")
 
-	addCel := fmt.Sprintf("B%d", b.Row)
+	addCel := fmt.Sprintf("A%d", b.Row)
 
-	b.Excel.MergeCell(b.SheetName, addCel, fmt.Sprintf("E%d", b.Row))
-	b.Excel.SetCellStyle(b.SheetName, addCel, fmt.Sprintf("E%d", b.Row), styleLeft)
-	b.Excel.SetCellValue(b.SheetName, addCel, b.Content.SendTo)
+	b.Excel.MergeCell(b.SheetName, addCel, fmt.Sprintf("G%d", b.Row))
+	b.Excel.SetCellStyle(b.SheetName, addCel, fmt.Sprintf("G%d", b.Row), styleLeft)
+	// b.Excel.MergeCell(b.SheetName, addCel, fmt.Sprintf("E%d", b.Row))
+	// b.Excel.SetCellStyle(b.SheetName, addCel, fmt.Sprintf("E%d", b.Row), styleLeft)
+	b.Excel.SetCellValue(b.SheetName, addCel, "送货地址:"+b.Content.SendTo)
 
-	sureCel := fmt.Sprintf("F%d", b.Row)
+	// sureCel := fmt.Sprintf("F%d", b.Row)
+	sureCel := fmt.Sprintf("H%d", b.Row)
 	b.Excel.MergeCell(b.SheetName, sureCel, fmt.Sprintf("J%d", b.Row))
 	b.Excel.SetCellStyle(b.SheetName, sureCel, fmt.Sprintf("J%d", b.Row), styleLeft)
-	b.Excel.SetCellValue(b.SheetName, sureCel, "收货人:")
+	b.Excel.SetCellValue(b.SheetName, sureCel, " 收货人:")
 
 	b.Excel.SetRowHeight(b.SheetName, b.Row, 30)
 
@@ -316,9 +319,9 @@ func (b *ProductBillExcel) drawTableSignature() error {
 
 	// 制单人
 	billUserCell := fmt.Sprintf("A%d", b.Row+1)
-	b.Excel.SetCellValue(b.SheetName, billUserCell, "制单人:")
-	billUservCell := fmt.Sprintf("B%d", b.Row+1)
-	b.Excel.SetCellValue(b.SheetName, billUservCell, b.Content.UserName)
+	b.Excel.SetCellValue(b.SheetName, billUserCell, "制单人:"+b.Content.UserName)
+	// billUservCell := fmt.Sprintf("B%d", b.Row+1)
+	// b.Excel.SetCellValue(b.SheetName, billUservCell, b.Content.UserName)
 
 	fontCell := fmt.Sprintf("F%d", b.Row)
 	imageCell1 := fmt.Sprintf("G%d", b.Row)
@@ -393,7 +396,11 @@ func NewProductBill(f *excelize.File) *ProductBillExcel {
 		Signatures:       make([]*model.Signature, 0),
 	}
 
-	f.SetColWidth(b.SheetName, "A", "J", 11.5)
+	// f.SetColWidth(b.SheetName, "A", "J", 11.5)
+	f.SetColWidth(b.SheetName, "A", "A", 17)
+	f.SetColWidth(b.SheetName, "B", "B", 12)
+	f.SetColWidth(b.SheetName, "C", "H", 10.5)
+	f.SetColWidth(b.SheetName, "I", "J", 12)
 	f.SetPageMargins(b.SheetName, excelize.PageMarginTop(1), excelize.PageMarginLeft(0.25), excelize.PageMarginRight(0))
 	return b
 }

+ 8 - 3
boxcost/api/report-product-excel.go

@@ -71,7 +71,7 @@ func (b *ReportProductExcel) drawSubTitles() error {
 	var drawLeft = func(rowIndex int, value string) error {
 		//左边1
 		left1Cell := fmt.Sprintf("A%d", rowIndex)
-		err = b.Excel.MergeCell(b.SheetName, left1Cell, fmt.Sprintf("E%d", rowIndex))
+		err = b.Excel.MergeCell(b.SheetName, left1Cell, fmt.Sprintf("F%d", rowIndex))
 		if err != nil {
 			return err
 		}
@@ -84,7 +84,7 @@ func (b *ReportProductExcel) drawSubTitles() error {
 	}
 
 	var drawRight = func(rowIndex int, value string) error {
-		right1Cell := fmt.Sprintf("F%d", rowIndex)
+		right1Cell := fmt.Sprintf("G%d", rowIndex)
 		err = b.Excel.MergeCell(b.SheetName, right1Cell, fmt.Sprintf("J%d", rowIndex))
 		if err != nil {
 			return err
@@ -310,7 +310,12 @@ func NewReportProductBill(f *excelize.File) *ReportProductExcel {
 		AlignCenterStyle: styleLeft,
 	}
 
-	f.SetColWidth(b.SheetName, "A", "J", 11.5)
+	// f.SetColWidth(b.SheetName, "A", "J", 11.5)
+
+	f.SetColWidth(b.SheetName, "A", "A", 17)
+	f.SetColWidth(b.SheetName, "B", "B", 12)
+	f.SetColWidth(b.SheetName, "C", "H", 10.5)
+	f.SetColWidth(b.SheetName, "I", "J", 12)
 	f.SetPageMargins(b.SheetName, excelize.PageMarginTop(1), excelize.PageMarginLeft(0.25), excelize.PageMarginRight(0))
 	return b
 }