|
@@ -30,8 +30,6 @@ type ProductBillExcel struct {
|
|
|
}
|
|
|
|
|
|
func (b *ProductBillExcel) drawTitle() error {
|
|
|
- marginLeft := excelize.PageMarginLeft(0.25)
|
|
|
- b.Excel.SetPageMargins(b.SheetName, marginLeft)
|
|
|
b.Row++
|
|
|
startCell := fmt.Sprintf("A%d", b.Row)
|
|
|
err := b.Excel.MergeCell(b.SheetName, startCell, fmt.Sprintf("J%d", b.Row))
|
|
@@ -98,18 +96,18 @@ func (b *ProductBillExcel) drawSubTitles() error {
|
|
|
return nil
|
|
|
}
|
|
|
//第一行
|
|
|
- drawLeft(b.Row, "类别:"+b.Content.Type)
|
|
|
+ drawLeft(b.Row, "需求方(甲方):"+b.Title+"订单")
|
|
|
drawRight(b.Row, "单号:"+b.Content.SerialNumber)
|
|
|
b.Excel.SetRowHeight(b.SheetName, b.Row, 21)
|
|
|
|
|
|
//第二行
|
|
|
- drawLeft(b.Row+1, "供应商名称:"+b.Content.Supplier)
|
|
|
+ drawLeft(b.Row+1, "供应方(乙方):"+b.Content.Supplier)
|
|
|
timeformat := b.Content.CreateTime.Local().Format("2006年01月02号 15:04:05")
|
|
|
drawRight(b.Row+1, "下单时间:"+timeformat)
|
|
|
b.Excel.SetRowHeight(b.SheetName, b.Row+1, 21)
|
|
|
|
|
|
//第三行
|
|
|
- drawLeft(b.Row+2, "产品名称:"+b.Content.ProductName)
|
|
|
+ drawLeft(b.Row+2, "产品名称:"+b.Content.ProductName+" 类别:"+b.Content.Type)
|
|
|
status := ""
|
|
|
if b.Content.Status == "complete" {
|
|
|
status = "已完成"
|
|
@@ -228,7 +226,7 @@ func (b *ProductBillExcel) drawTableFooter() error {
|
|
|
sureCel := fmt.Sprintf("F%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)
|
|
|
|
|
@@ -251,6 +249,59 @@ func (b *ProductBillExcel) drawRemark() error {
|
|
|
b.Excel.MergeCell(b.SheetName, remarkContentScell, remarkContentEcell)
|
|
|
b.Excel.SetCellValue(b.SheetName, remarkContentScell, b.Content.Remark)
|
|
|
|
|
|
+ // 签字位置
|
|
|
+ b.Row++
|
|
|
+ styleLeft, err := b.Excel.NewStyle(&excelize.Style{
|
|
|
+ Alignment: &excelize.Alignment{Horizontal: "left", Vertical: "center"},
|
|
|
+ Font: &excelize.Font{Size: 11}})
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ 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))
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ err = b.Excel.SetCellStyle(b.SheetName, left1Cell, left1Cell, styleLeft)
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ b.Excel.SetCellValue(b.SheetName, left1Cell, value)
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+
|
|
|
+ var drawRight = func(rowIndex int, value string) error {
|
|
|
+ right1Cell := fmt.Sprintf("F%d", rowIndex)
|
|
|
+ err = b.Excel.MergeCell(b.SheetName, right1Cell, fmt.Sprintf("J%d", rowIndex))
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ err = b.Excel.SetCellStyle(b.SheetName, right1Cell, right1Cell, styleLeft)
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ b.Excel.SetCellValue(b.SheetName, right1Cell, value)
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+
|
|
|
+ //第一行
|
|
|
+ drawLeft(b.Row, "甲方:"+b.Title)
|
|
|
+ drawRight(b.Row, "乙方:"+b.Content.Supplier)
|
|
|
+ b.Excel.SetRowHeight(b.SheetName, b.Row, 21)
|
|
|
+
|
|
|
+ //第二行
|
|
|
+ drawLeft(b.Row+1, "联系人:")
|
|
|
+ timeformat := b.Content.CreateTime.Local().Format("2006年01月02号 15:04:05")
|
|
|
+ drawRight(b.Row+1, "联系人:")
|
|
|
+ b.Excel.SetRowHeight(b.SheetName, b.Row+1, 21)
|
|
|
+
|
|
|
+ //第三行
|
|
|
+ drawLeft(b.Row+2, "时间:"+timeformat)
|
|
|
+ drawRight(b.Row+2, "时间:"+timeformat)
|
|
|
+ b.Excel.SetRowHeight(b.SheetName, b.Row+2, 21)
|
|
|
+
|
|
|
return nil
|
|
|
|
|
|
}
|
|
@@ -342,7 +393,7 @@ func NewProductBill(f *excelize.File) *ProductBillExcel {
|
|
|
}
|
|
|
|
|
|
f.SetColWidth(b.SheetName, "A", "J", 11.5)
|
|
|
- f.SetPageMargins(b.SheetName, excelize.PageMarginTop(0), excelize.PageMarginLeft(0), excelize.PageMarginRight(0))
|
|
|
+ f.SetPageMargins(b.SheetName, excelize.PageMarginTop(1.5), excelize.PageMarginLeft(0.25), excelize.PageMarginRight(0))
|
|
|
return b
|
|
|
}
|
|
|
|