|
@@ -29,22 +29,27 @@ func (b *ProduceBillExcel) drawTitle() error {
|
|
|
b.Row++
|
|
|
//是打印
|
|
|
startCell := fmt.Sprintf("A%d", b.Row)
|
|
|
- marginLeft := excelize.PageMarginLeft(0.18)
|
|
|
- endCell := fmt.Sprintf("J%d", b.Row)
|
|
|
+ marginLeft := excelize.PageMarginLeft(0.13)
|
|
|
+ endCell := fmt.Sprintf("K%d", b.Row)
|
|
|
if b.Content.IsPrint {
|
|
|
b.Excel.SetColWidth(b.SheetName, "A", "A", 16)
|
|
|
b.Excel.SetColWidth(b.SheetName, "B", "C", 14)
|
|
|
- b.Excel.SetColWidth(b.SheetName, "C", "H", 10)
|
|
|
- b.Excel.SetColWidth(b.SheetName, "I", "I", 12)
|
|
|
- b.Excel.SetColWidth(b.SheetName, "J", "J", 14)
|
|
|
+ b.Excel.SetColWidth(b.SheetName, "D", "E", 9)
|
|
|
+ b.Excel.SetColWidth(b.SheetName, "F", "F", 8)
|
|
|
+ b.Excel.SetColWidth(b.SheetName, "G", "G", 4.5)
|
|
|
+ b.Excel.SetColWidth(b.SheetName, "H", "I", 9)
|
|
|
+ b.Excel.SetColWidth(b.SheetName, "J", "J", 10)
|
|
|
+ b.Excel.SetColWidth(b.SheetName, "K", "K", 14)
|
|
|
|
|
|
} else {
|
|
|
// 不是打印
|
|
|
endCell = fmt.Sprintf("G%d", b.Row)
|
|
|
marginLeft = excelize.PageMarginLeft(0.6)
|
|
|
- b.Excel.SetColWidth(b.SheetName, "A", "B", 20)
|
|
|
- b.Excel.SetColWidth(b.SheetName, "C", "F", 12)
|
|
|
- b.Excel.SetColWidth(b.SheetName, "G", "G", 20)
|
|
|
+ b.Excel.SetColWidth(b.SheetName, "A", "B", 17)
|
|
|
+ b.Excel.SetColWidth(b.SheetName, "C", "C", 12)
|
|
|
+ b.Excel.SetColWidth(b.SheetName, "D", "D", 6)
|
|
|
+ b.Excel.SetColWidth(b.SheetName, "E", "G", 12)
|
|
|
+ b.Excel.SetColWidth(b.SheetName, "H", "H", 20)
|
|
|
// 是覆膜
|
|
|
if b.Content.IsLam {
|
|
|
endCell = fmt.Sprintf("I%d", b.Row)
|
|
@@ -100,7 +105,7 @@ func (b *ProduceBillExcel) drawSubTitles() error {
|
|
|
drawLeft := func(rowIndex int, value string) error {
|
|
|
//左边1
|
|
|
left1Cell := fmt.Sprintf("A%d", rowIndex)
|
|
|
- err = b.Excel.MergeCell(b.SheetName, left1Cell, fmt.Sprintf("G%d", rowIndex))
|
|
|
+ err = b.Excel.MergeCell(b.SheetName, left1Cell, fmt.Sprintf("H%d", rowIndex))
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|
|
@@ -113,8 +118,8 @@ func (b *ProduceBillExcel) drawSubTitles() error {
|
|
|
}
|
|
|
|
|
|
drawRight := func(rowIndex int, value string) error {
|
|
|
- right1Cell := fmt.Sprintf("H%d", rowIndex)
|
|
|
- err = b.Excel.MergeCell(b.SheetName, right1Cell, fmt.Sprintf("J%d", rowIndex))
|
|
|
+ right1Cell := fmt.Sprintf("I%d", rowIndex)
|
|
|
+ err = b.Excel.MergeCell(b.SheetName, right1Cell, fmt.Sprintf("K%d", rowIndex))
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|
|
@@ -130,7 +135,7 @@ func (b *ProduceBillExcel) drawSubTitles() error {
|
|
|
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
|
|
|
}
|
|
@@ -143,8 +148,8 @@ func (b *ProduceBillExcel) drawSubTitles() error {
|
|
|
}
|
|
|
|
|
|
drawRight = func(rowIndex int, value string) error {
|
|
|
- right1Cell := fmt.Sprintf("F%d", rowIndex)
|
|
|
- err = b.Excel.MergeCell(b.SheetName, right1Cell, fmt.Sprintf("G%d", rowIndex))
|
|
|
+ right1Cell := fmt.Sprintf("G%d", rowIndex)
|
|
|
+ err = b.Excel.MergeCell(b.SheetName, right1Cell, fmt.Sprintf("H%d", rowIndex))
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|
|
@@ -232,18 +237,18 @@ func (b *ProduceBillExcel) drawTableTitle() error {
|
|
|
return b.Excel.SetCellValue(b.SheetName, left1Cell, value)
|
|
|
}
|
|
|
|
|
|
- var drawCol2 = func(prefix string, value1 string, value2 string) error {
|
|
|
+ // var drawCol2 = func(prefix string, value1 string, value2 string) error {
|
|
|
|
|
|
- left1Cell := fmt.Sprintf("%s%d", prefix, b.Row)
|
|
|
- left2Cell := fmt.Sprintf("%s%d", prefix, b.Row+1)
|
|
|
- err := b.Excel.SetCellStyle(b.SheetName, left1Cell, left2Cell, b.AlignCenterStyle)
|
|
|
- if err != nil {
|
|
|
- return err
|
|
|
- }
|
|
|
- b.Excel.SetCellValue(b.SheetName, left1Cell, value1)
|
|
|
- b.Excel.SetCellValue(b.SheetName, left2Cell, value2)
|
|
|
- return nil
|
|
|
- }
|
|
|
+ // left1Cell := fmt.Sprintf("%s%d", prefix, b.Row)
|
|
|
+ // left2Cell := fmt.Sprintf("%s%d", prefix, b.Row+1)
|
|
|
+ // err := b.Excel.SetCellStyle(b.SheetName, left1Cell, left2Cell, b.AlignCenterStyle)
|
|
|
+ // if err != nil {
|
|
|
+ // return err
|
|
|
+ // }
|
|
|
+ // b.Excel.SetCellValue(b.SheetName, left1Cell, value1)
|
|
|
+ // b.Excel.SetCellValue(b.SheetName, left2Cell, value2)
|
|
|
+ // return nil
|
|
|
+ // }
|
|
|
|
|
|
var drawCol3 = func(prefix1 string, prefix2 string, value1 string, value2 string, value3 string) error {
|
|
|
left1Cell := fmt.Sprintf("%s%d", prefix1, b.Row)
|
|
@@ -280,10 +285,11 @@ func (b *ProduceBillExcel) drawTableTitle() error {
|
|
|
drawCol("D", "来纸尺寸")
|
|
|
drawCol("E", "印刷尺寸")
|
|
|
drawCol("F", "下单数量")
|
|
|
- drawCol2("G", "单价", unit)
|
|
|
- drawCol("H", "预算金额")
|
|
|
- drawCol("I", "交货时间")
|
|
|
- drawCol("J", "备注")
|
|
|
+ drawCol("G", "单位")
|
|
|
+ drawCol("H", "单价")
|
|
|
+ drawCol("I", "预算金额")
|
|
|
+ drawCol("J", "交货时间")
|
|
|
+ drawCol("K", "备注")
|
|
|
|
|
|
} else {
|
|
|
if b.Content.IsLam {
|
|
@@ -301,10 +307,11 @@ func (b *ProduceBillExcel) drawTableTitle() error {
|
|
|
drawCol("A", "加工项目")
|
|
|
drawCol("B", "规格")
|
|
|
drawCol("C", "下单数量")
|
|
|
- drawCol2("D", "单价", unit)
|
|
|
- drawCol("E", "预算金额")
|
|
|
- drawCol("F", "交货时间")
|
|
|
- drawCol("G", "备注")
|
|
|
+ drawCol("D", "单位")
|
|
|
+ drawCol("E", "单价")
|
|
|
+ drawCol("F", "预算金额")
|
|
|
+ drawCol("G", "交货时间")
|
|
|
+ drawCol("H", "备注")
|
|
|
|
|
|
}
|
|
|
|
|
@@ -316,11 +323,9 @@ func (b *ProduceBillExcel) drawTableTitle() error {
|
|
|
func (b *ProduceBillExcel) drawTableContent() error {
|
|
|
b.Row += 2
|
|
|
var DrawRow = func(rowIndex int, values ...string) {
|
|
|
- // if b.IsPdf == "true" {
|
|
|
- charas := []string{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J"}
|
|
|
- // !isPrint
|
|
|
+ charas := []string{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K"}
|
|
|
if !b.Content.IsPrint {
|
|
|
- charas = []string{"A", "B", "C", "D", "E", "F", "G"}
|
|
|
+ charas = []string{"A", "B", "C", "D", "E", "F", "G", "H"}
|
|
|
if b.Content.IsLam {
|
|
|
charas = []string{"A", "B", "C", "D", "E", "F", "G", "H", "I"}
|
|
|
}
|
|
@@ -361,17 +366,13 @@ func (b *ProduceBillExcel) drawTableContent() error {
|
|
|
deliveryTime := produce.DeliveryTime.Local().Format("2006-01-02")
|
|
|
|
|
|
if b.Content.IsPrint {
|
|
|
- DrawRow(b.Row, produce.Name, produce.Norm, produce.Paper, produce.PaperSize, produce.PrintSize, fmt.Sprintf("%d", produce.OrderCount), priceStr, budgetAmount, deliveryTime, produce.Remark)
|
|
|
-
|
|
|
+ DrawRow(b.Row, produce.Name, produce.Norm, produce.Paper, produce.PaperSize, produce.PrintSize, fmt.Sprintf("%d", produce.OrderCount), produce.Unit, priceStr, budgetAmount, deliveryTime, produce.Remark)
|
|
|
} else {
|
|
|
// 覆膜
|
|
|
if b.Content.IsLam {
|
|
|
DrawRow(b.Row, produce.Name, produce.Norm, produce.PrintSize, fmt.Sprintf("%d", produce.OrderCount), priceStr, fmt.Sprintf("%.3f", produce.Price2), budgetAmount, deliveryTime, produce.Remark)
|
|
|
-
|
|
|
} else {
|
|
|
-
|
|
|
- DrawRow(b.Row, produce.Name, produce.Norm, fmt.Sprintf("%d", produce.OrderCount), priceStr, budgetAmount, deliveryTime, produce.Remark)
|
|
|
-
|
|
|
+ DrawRow(b.Row, produce.Name, produce.Norm, fmt.Sprintf("%d", produce.OrderCount), produce.Unit, priceStr, budgetAmount, deliveryTime, produce.Remark)
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -397,14 +398,13 @@ func (b *ProduceBillExcel) drawTableFooter() error {
|
|
|
|
|
|
sendToStartCell := fmt.Sprintf("A%d", b.Row)
|
|
|
|
|
|
- sendToEndCell := fmt.Sprintf("E%d", b.Row)
|
|
|
- supplierStartCell := fmt.Sprintf("F%d", b.Row)
|
|
|
- supplierEndCell := fmt.Sprintf("J%d", b.Row)
|
|
|
- // !isPrint
|
|
|
+ sendToEndCell := fmt.Sprintf("H%d", b.Row)
|
|
|
+ supplierStartCell := fmt.Sprintf("I%d", b.Row)
|
|
|
+ supplierEndCell := fmt.Sprintf("K%d", b.Row)
|
|
|
if !b.Content.IsPrint {
|
|
|
- sendToEndCell = fmt.Sprintf("D%d", b.Row)
|
|
|
- supplierStartCell = fmt.Sprintf("E%d", b.Row)
|
|
|
- supplierEndCell = fmt.Sprintf("G%d", b.Row)
|
|
|
+ sendToEndCell = fmt.Sprintf("E%d", b.Row)
|
|
|
+ supplierStartCell = fmt.Sprintf("F%d", b.Row)
|
|
|
+ supplierEndCell = fmt.Sprintf("H%d", b.Row)
|
|
|
|
|
|
if b.Content.IsLam {
|
|
|
sendToEndCell = fmt.Sprintf("F%d", b.Row)
|
|
@@ -441,15 +441,15 @@ func (b *ProduceBillExcel) drawTableSignature() error {
|
|
|
|
|
|
fontNum := "F"
|
|
|
image1s := "G"
|
|
|
- image2s := "I"
|
|
|
- image1e := "H"
|
|
|
- image2e := "J"
|
|
|
+ image2s := "J"
|
|
|
+ image1e := "I"
|
|
|
+ image2e := "K"
|
|
|
if !b.Content.IsPrint {
|
|
|
- fontNum = "D"
|
|
|
- image1s = "E"
|
|
|
- image2s = "G"
|
|
|
- image1e = "F"
|
|
|
- image2e = "G"
|
|
|
+ fontNum = "E"
|
|
|
+ image1s = "F"
|
|
|
+ image2s = "H"
|
|
|
+ image1e = "G"
|
|
|
+ image2e = "H"
|
|
|
if b.Content.IsLam {
|
|
|
fontNum = "E"
|
|
|
image1s = "F"
|