|
@@ -15,7 +15,6 @@ import (
|
|
|
"fmt"
|
|
|
"github.com/boombuler/barcode"
|
|
|
"github.com/boombuler/barcode/code128"
|
|
|
- "github.com/jung-kurt/gofpdf"
|
|
|
"github.com/ser163/png2j"
|
|
|
"github.com/signintech/gopdf"
|
|
|
"github.com/xuri/excelize/v2"
|
|
@@ -547,232 +546,6 @@ func (c StockTemplateController) StockTemplateInventoryExcel(reqData dto.StockTe
|
|
|
// 返回生成的 Excel 文件
|
|
|
c.Ctx.Output.Download("ofile/" + filename)
|
|
|
}
|
|
|
-func (c StockTemplateController) StockTemplateInventoryPdf1(reqData dto.StockTemplateInventoryExcelReq) {
|
|
|
- s := services.StockTemplate{}
|
|
|
- deptId := beegouser.GetDeptId(c.Ctx)
|
|
|
- models.InitBasicData(deptId)
|
|
|
- medicineInfo, err := s.GetMedicineInfo(deptId, map[string]interface{}{
|
|
|
- "product_id": reqData.ProductID,
|
|
|
- "enterprise_id": reqData.EnterpriseID,
|
|
|
- "spec_id": reqData.SpecId,
|
|
|
- "batch_number": reqData.BatchNumber,
|
|
|
- })
|
|
|
- if err != nil {
|
|
|
- c.Error(global.BadRequest, err, "药品信息不存在")
|
|
|
- return
|
|
|
- }
|
|
|
- var productName, specName, unitName, dosageFormName string
|
|
|
-
|
|
|
- if id, ok := medicineInfo[models.FieldProductID]; ok {
|
|
|
- productName = models.Read_Product_Get(utils.ToInt(id))
|
|
|
- }
|
|
|
- if id, ok := medicineInfo[models.FieldSpecID]; ok {
|
|
|
- specName = models.Read_Spec_Get(utils.ToInt(id))
|
|
|
- }
|
|
|
- if id, ok := medicineInfo[models.FieldUnitID]; ok {
|
|
|
- unitName = models.Read_Unit_Get(utils.ToInt(id))
|
|
|
- }
|
|
|
- if id, ok := medicineInfo[models.FieldDosageFormID]; ok {
|
|
|
- dosageFormName = models.Read_DosageForm_Get(utils.ToInt(id))
|
|
|
- }
|
|
|
-
|
|
|
- list, err := s.StockTemplateInventoryExcel(&reqData, deptId)
|
|
|
- if err != nil {
|
|
|
- c.Error(500, err, err.Error())
|
|
|
- return
|
|
|
- }
|
|
|
- cols := []float64{20, 24, 20, 18, 20, 12, 22, 20, 12, 22, 20, 12, 22, 20, 15}
|
|
|
-
|
|
|
- rows := [][]string{}
|
|
|
- for _, row := range list {
|
|
|
- temp := []string{}
|
|
|
- temp = append(temp, fmt.Sprintf("%v", row["date"]))
|
|
|
-
|
|
|
- if utils.ToInt(row["stock_in_id"]) > 0 {
|
|
|
- temp = append(temp, fmt.Sprintf("%s", row["forwarding_unit"]))
|
|
|
- } else if utils.ToInt(row["stock_out_id"]) > 0 {
|
|
|
- temp = append(temp, fmt.Sprintf("%s", row["receiving_unit"]))
|
|
|
- }
|
|
|
- temp = append(temp, fmt.Sprintf("%s", row[models.FieldEnterpriseName]))
|
|
|
- if row[models.FieldApprovalNumber] == nil {
|
|
|
- temp = append(temp, "")
|
|
|
- } else {
|
|
|
- temp = append(temp, fmt.Sprintf("%s", row[models.FieldApprovalNumber]))
|
|
|
- }
|
|
|
- if row[models.FieldQualificationNumber] == nil {
|
|
|
- temp = append(temp, "")
|
|
|
- } else {
|
|
|
- temp = append(temp, fmt.Sprintf("%s", row[models.FieldQualificationNumber]))
|
|
|
- }
|
|
|
-
|
|
|
- if utils.ToInt(row["stock_in_id"]) > 0 {
|
|
|
- temp = append(temp, fmt.Sprintf("%d", row["total_in"]))
|
|
|
- temp = append(temp, fmt.Sprintf("%s", row[models.FieldBatchNumber]))
|
|
|
- temp = append(temp, fmt.Sprintf("%s", utils.ToDate(row[models.FieldExpiryDate])))
|
|
|
- } else {
|
|
|
- temp = append(temp, "")
|
|
|
- temp = append(temp, "")
|
|
|
- temp = append(temp, "")
|
|
|
- }
|
|
|
-
|
|
|
- if utils.ToInt(row["stock_out_id"]) > 0 {
|
|
|
- temp = append(temp, fmt.Sprintf("%d", row["total_out"]))
|
|
|
- temp = append(temp, fmt.Sprintf("%s", row[models.FieldBatchNumber]))
|
|
|
- temp = append(temp, fmt.Sprintf("%s", utils.ToDate(row[models.FieldExpiryDate])))
|
|
|
- } else {
|
|
|
- temp = append(temp, "")
|
|
|
- temp = append(temp, "")
|
|
|
- temp = append(temp, "")
|
|
|
- }
|
|
|
-
|
|
|
- temp = append(temp, fmt.Sprintf("%d", row["balance"]))
|
|
|
- temp = append(temp, fmt.Sprintf("%s", row[models.FieldBatchNumber]))
|
|
|
- temp = append(temp, fmt.Sprintf("%s", utils.ToDate(row[models.FieldExpiryDate])))
|
|
|
- temp = append(temp, fmt.Sprintf("%s", row["operator"]))
|
|
|
- rows = append(rows, temp)
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- pdf := gofpdf.New("L", "mm", "A4", "")
|
|
|
-
|
|
|
- pdf.AddPage()
|
|
|
- pdf.AddUTF8Font("simsun", "", "static/fonts/MiSans-Medium.ttf")
|
|
|
- pdf.SetFont("simsun", "", 20)
|
|
|
- pdf.SetMargins(10, 10, 10)
|
|
|
- pdf.SetAutoPageBreak(false, 0)
|
|
|
- pagew, pageh := pdf.GetPageSize()
|
|
|
- _, _, _, mbottom := pdf.GetMargins()
|
|
|
- titleStr := "收发登记表"
|
|
|
-
|
|
|
- titleWd := pdf.GetStringWidth(titleStr)
|
|
|
- titleX := (pagew - titleWd) / 2
|
|
|
- pdf.Text(titleX, 20, titleStr)
|
|
|
-
|
|
|
- titleX = pagew / 3 * 2
|
|
|
- pdf.SetFont("simsun", "", 10)
|
|
|
- pdf.Text(titleX, 25, fmt.Sprintf("制品名称:%s 编号", productName))
|
|
|
- pdf.Text(titleX, 30, fmt.Sprintf("剂型:%s 规格:%s 单位:%s", dosageFormName, specName, unitName))
|
|
|
-
|
|
|
- h := 16.0
|
|
|
- curx, y := pdf.GetXY()
|
|
|
- pdf.SetXY(curx, 35)
|
|
|
- pdf.CellFormat(cols[0], h, "日期", "1", 0, "CM", false, 0, "")
|
|
|
- pdf.CellFormat(cols[1], h, "购货/发货单位", "1", 0, "CM", false, 0, "")
|
|
|
- pdf.CellFormat(cols[2], h, "生产企业", "1", 0, "CM", false, 0, "")
|
|
|
- pdf.CellFormat(cols[3], h, "批准文号", "1", 0, "CM", false, 0, "")
|
|
|
- curx, y = pdf.GetXY()
|
|
|
- width := cols[4]
|
|
|
- pdf.MultiCell(width, h/2, "批签发合格\n证编号", "1", "CM", false)
|
|
|
-
|
|
|
- // ------收入
|
|
|
- curx += width
|
|
|
- pdf.SetXY(curx, y)
|
|
|
- width = cols[5] + cols[6] + cols[7]
|
|
|
- pdf.CellFormat(width, h/2, "收入", "1", 0, "CM", false, 0, "")
|
|
|
-
|
|
|
- width = cols[5]
|
|
|
- pdf.SetXY(curx, y+h/2)
|
|
|
- pdf.CellFormat(width, h/2, "数量", "1", 0, "CM", false, 0, "")
|
|
|
-
|
|
|
- curx += width
|
|
|
- pdf.SetXY(curx, y+h/2)
|
|
|
- width = cols[6]
|
|
|
- pdf.CellFormat(width, h/2, "批号", "1", 0, "CM", false, 0, "")
|
|
|
-
|
|
|
- curx += width
|
|
|
- pdf.SetXY(curx, y+h/2)
|
|
|
- width = cols[7]
|
|
|
- pdf.CellFormat(width, h/2, "失效日期", "1", 0, "CM", false, 0, "")
|
|
|
-
|
|
|
- // ------支出
|
|
|
- curx += width
|
|
|
- pdf.SetXY(curx, y)
|
|
|
- width = cols[8] + cols[9] + cols[10]
|
|
|
- pdf.CellFormat(width, h/2, "支出", "1", 0, "CM", false, 0, "")
|
|
|
-
|
|
|
- width = cols[8]
|
|
|
- pdf.SetXY(curx, y+h/2)
|
|
|
- pdf.CellFormat(width, h/2, "数量", "1", 0, "CM", false, 0, "")
|
|
|
-
|
|
|
- curx += width
|
|
|
- pdf.SetXY(curx, y+h/2)
|
|
|
- width = cols[9]
|
|
|
- pdf.CellFormat(width, h/2, "批号", "1", 0, "CM", false, 0, "")
|
|
|
-
|
|
|
- curx += width
|
|
|
- pdf.SetXY(curx, y+h/2)
|
|
|
- width = cols[10]
|
|
|
- pdf.CellFormat(width, h/2, "失效日期", "1", 0, "CM", false, 0, "")
|
|
|
-
|
|
|
- // ------结余
|
|
|
- curx += width
|
|
|
- pdf.SetXY(curx, y)
|
|
|
- width = cols[11] + cols[12] + cols[13]
|
|
|
- pdf.CellFormat(width, h/2, "结余", "1", 0, "CM", false, 0, "")
|
|
|
-
|
|
|
- width = cols[11]
|
|
|
- pdf.SetXY(curx, y+h/2)
|
|
|
- pdf.CellFormat(width, h/2, "数量", "1", 0, "CM", false, 0, "")
|
|
|
-
|
|
|
- curx += width
|
|
|
- pdf.SetXY(curx, y+h/2)
|
|
|
- width = cols[12]
|
|
|
- pdf.CellFormat(width, h/2, "批号", "1", 0, "CM", false, 0, "")
|
|
|
-
|
|
|
- curx += width
|
|
|
- pdf.SetXY(curx, y+h/2)
|
|
|
- width = cols[13]
|
|
|
- pdf.CellFormat(width, h/2, "失效日期", "1", 0, "CM", false, 0, "")
|
|
|
-
|
|
|
- curx += width
|
|
|
- width = cols[14]
|
|
|
- pdf.SetXY(curx, y)
|
|
|
- pdf.MultiCell(width, h/2, "经办人\n签字", "1", "CM", false)
|
|
|
-
|
|
|
- pdf.SetFont("simsun", "", 9)
|
|
|
- marginCell := 4. // margin of top/bottom of cell
|
|
|
-
|
|
|
- for _, row := range rows {
|
|
|
- curx, y = pdf.GetXY()
|
|
|
- x := curx
|
|
|
-
|
|
|
- height := 0.
|
|
|
- _, lineHt := pdf.GetFontSize()
|
|
|
-
|
|
|
- for i, txt := range row {
|
|
|
- lines := pdf.SplitLines([]byte(txt), cols[i])
|
|
|
- h := float64(len(lines))*lineHt + marginCell*float64(len(lines))
|
|
|
- if h > height {
|
|
|
- height = h
|
|
|
- }
|
|
|
- }
|
|
|
- // add a new page if the height of the row doesn't fit on the page
|
|
|
- if pdf.GetY()+height > pageh-mbottom {
|
|
|
- pdf.AddPage()
|
|
|
- y = pdf.GetY()
|
|
|
- }
|
|
|
- for i, txt := range row {
|
|
|
- width = cols[i]
|
|
|
- pdf.Rect(x, y, width, height, "")
|
|
|
- pdf.MultiCell(width, lineHt+marginCell, txt, "", "CM", false)
|
|
|
- x += width
|
|
|
- pdf.SetXY(x, y)
|
|
|
- }
|
|
|
- pdf.SetXY(curx, y+height)
|
|
|
- }
|
|
|
-
|
|
|
- filename := "收发登记表" + time.Now().Format("20060102150405") + ".pdf"
|
|
|
- // 保存文件
|
|
|
- if err := pdf.OutputFileAndClose("ofile/" + filename); err != nil {
|
|
|
- fmt.Println(err)
|
|
|
- }
|
|
|
- defer func() {
|
|
|
- os.Remove("ofile/" + filename)
|
|
|
- }()
|
|
|
-
|
|
|
- // 返回生成的 Excel 文件
|
|
|
- c.Ctx.Output.Download("ofile/" + filename)
|
|
|
-}
|
|
|
func (c StockTemplateController) StockTemplateInventoryPdf(reqData dto.StockTemplateInventoryExcelReq) {
|
|
|
s := services.StockTemplate{}
|
|
|
deptId := beegouser.GetDeptId(c.Ctx)
|
|
@@ -1914,283 +1687,6 @@ func (c StockTemplateController) TransportRecordWord(reqData models.TransportRec
|
|
|
c.Ctx.Output.Download("ofile/" + filename)
|
|
|
}
|
|
|
|
|
|
-func (c StockTemplateController) TransportRecordPdf1(reqData models.TransportRecord) {
|
|
|
- s := services.StockTemplate{}
|
|
|
- deptId := beegouser.GetDeptId(c.Ctx)
|
|
|
-
|
|
|
- list, err := s.StockTemplateTransportRecordWord(&reqData, deptId)
|
|
|
- if err != nil {
|
|
|
- c.Error(500, err, err.Error())
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- cols := []float64{30, 22, 22, 27, 31, 22, 21, 11, 11}
|
|
|
-
|
|
|
- header := []string{"品种", "生产企业", "批准文号", "批签发合格编号", "规格(剂/支或粒)", "批号", "失效日期", "数量", "单位"}
|
|
|
- rows := [][]string{}
|
|
|
- for _, row := range list {
|
|
|
- temp := []string{}
|
|
|
- temp = append(temp, fmt.Sprintf("%s", row[models.FieldProductName]))
|
|
|
- temp = append(temp, fmt.Sprintf("%s", row[models.FieldEnterpriseName]))
|
|
|
- temp = append(temp, fmt.Sprintf("%s", row[models.FieldApprovalNumber]))
|
|
|
- if row[models.FieldQualificationNumber] == nil {
|
|
|
- temp = append(temp, "")
|
|
|
- } else {
|
|
|
- temp = append(temp, fmt.Sprintf("%s", row[models.FieldQualificationNumber]))
|
|
|
- }
|
|
|
-
|
|
|
- temp = append(temp, fmt.Sprintf("%s", row[models.FieldSpecName]))
|
|
|
- temp = append(temp, fmt.Sprintf("%s", row[models.FieldBatchNumber]))
|
|
|
- temp = append(temp, fmt.Sprintf("%s", utils.ToDate(row[models.FieldExpiryDate])))
|
|
|
- temp = append(temp, fmt.Sprintf("%d", utils.ToInt(row["quantity"])))
|
|
|
- temp = append(temp, fmt.Sprintf("%s", row[models.FieldUnitName]))
|
|
|
- rows = append(rows, temp)
|
|
|
- }
|
|
|
- if len(list) < 11 {
|
|
|
- for i := 0; i < 11-len(list); i++ {
|
|
|
- rows = append(rows, []string{"", "", "", "", "", "", "", "", ""})
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- pdf := gofpdf.New("P", "mm", "A4", "")
|
|
|
-
|
|
|
- pdf.AddPage()
|
|
|
- pdf.AddUTF8Font("simsun", "", "static/fonts/MiSans-Medium.ttf")
|
|
|
- pdf.SetFont("simsun", "", 22)
|
|
|
- pdf.SetMargins(2, 5, 5)
|
|
|
- pdf.SetAutoPageBreak(true, 0)
|
|
|
- pagew, pageh := pdf.GetPageSize()
|
|
|
- _, _, _, mbottom := pdf.GetMargins()
|
|
|
-
|
|
|
- titleStr := "表3-4 运输记录表"
|
|
|
- titleWd := pdf.GetStringWidth(titleStr)
|
|
|
- titleX := (pagew - titleWd) / 2
|
|
|
- pdf.Text(titleX, 15, titleStr)
|
|
|
-
|
|
|
- pdf.SetFont("simsun", "", 16)
|
|
|
- titleStr = "(各级通用)"
|
|
|
- titleWd = pdf.GetStringWidth(titleStr)
|
|
|
- titleX = (pagew - titleWd) / 2
|
|
|
- pdf.Text(titleX, 25, titleStr)
|
|
|
-
|
|
|
- pdf.SetFont("simsun", "", 10)
|
|
|
- curx, y := pdf.GetXY()
|
|
|
- y = 25
|
|
|
- y += 8
|
|
|
- pdf.Text(curx, y, "运输工具: □冷藏车 □运输车 □普通车辆 □无 □其他")
|
|
|
- y += 8
|
|
|
- pdf.Text(curx, y, "冷藏工具: □冷藏车 □车载冷藏箱 □冷藏箱或冷藏包 □其他")
|
|
|
- y += 8
|
|
|
- pdf.Text(curx, y, "配送方式: □本级配送(车牌号:_______) □下级自运(车牌号:_______)")
|
|
|
-
|
|
|
- y += 10
|
|
|
- pdf.Text(curx, y, "运输情况:")
|
|
|
- y += 3
|
|
|
- pdf.SetXY(curx, y)
|
|
|
- h := 10.0
|
|
|
- for i := 0; i < len(header); i++ {
|
|
|
- pdf.CellFormat(cols[i], h, header[i], "1", 0, "CM", false, 0, "")
|
|
|
- }
|
|
|
- pdf.Ln(-1)
|
|
|
- pdf.SetFont("simsun", "", 9)
|
|
|
- marginCell := 4. // margin of top/bottom of cell
|
|
|
- y = pdf.GetY()
|
|
|
- pdf.SetXY(curx, y)
|
|
|
- //for _, row := range rows {
|
|
|
- // curx, y = pdf.GetXY()
|
|
|
- // if y > pageh-mbottom-marginCell {
|
|
|
- // pdf.AddPage()
|
|
|
- // y = pdf.GetY()
|
|
|
- // }
|
|
|
- // x := curx
|
|
|
- //
|
|
|
- // height := 0.
|
|
|
- // _, lineHt := pdf.GetFontSize()
|
|
|
- //
|
|
|
- // for i, txt := range row {
|
|
|
- // lines := pdf.SplitLines([]byte(txt), cols[i])
|
|
|
- // h = float64(len(lines))*lineHt + marginCell*float64(len(lines))
|
|
|
- // if h > height {
|
|
|
- // height = h
|
|
|
- // }
|
|
|
- // }
|
|
|
- // //// add a new page if the height of the row doesn't fit on the page
|
|
|
- // //if pdf.GetY()+height > pageh-mbottom {
|
|
|
- // // pdf.AddPage()
|
|
|
- // // y = pdf.GetY()
|
|
|
- // //}
|
|
|
- // for i, txt := range row {
|
|
|
- // width := cols[i]
|
|
|
- // if len(txt) == 0 {
|
|
|
- // height = lineHt + marginCell
|
|
|
- // }
|
|
|
- // pdf.Rect(x, y, width, height, "")
|
|
|
- // pdf.MultiCell(width, lineHt+marginCell, txt, "", "CM", false)
|
|
|
- // x += width
|
|
|
- // pdf.SetXY(x, y)
|
|
|
- // }
|
|
|
- //
|
|
|
- // pdf.SetXY(curx, y+height)
|
|
|
- //}
|
|
|
-
|
|
|
- for _, row := range rows {
|
|
|
- curx, y = pdf.GetXY()
|
|
|
- x := curx
|
|
|
-
|
|
|
- height := 0.
|
|
|
- _, lineHt := pdf.GetFontSize()
|
|
|
-
|
|
|
- for i, txt := range row {
|
|
|
- lines := pdf.SplitLines([]byte(txt), cols[i])
|
|
|
- h = float64(len(lines))*lineHt + marginCell*float64(len(lines))
|
|
|
- if h > height {
|
|
|
- height = h
|
|
|
- }
|
|
|
- }
|
|
|
- // add a new page if the height of the row doesn't fit on the page
|
|
|
- if pdf.GetY()+height > pageh-mbottom {
|
|
|
- pdf.AddPage()
|
|
|
- y = pdf.GetY()
|
|
|
- }
|
|
|
- for i, txt := range row {
|
|
|
- width := cols[i]
|
|
|
- pdf.Rect(x, y, width, height, "")
|
|
|
-
|
|
|
- pdf.MultiCell(width, lineHt+marginCell, txt, "", "C", false)
|
|
|
- x += width
|
|
|
- pdf.SetXY(x, y)
|
|
|
- }
|
|
|
- pdf.SetXY(curx, y+height)
|
|
|
- }
|
|
|
-
|
|
|
- y += 20
|
|
|
- pdf.Text(curx, y, "运输温度记录:")
|
|
|
- y += 3
|
|
|
- pdf.SetXY(curx, y)
|
|
|
- header2 := []string{"", "日期/时间", "储存温度", "冰排状态", "环境温度"}
|
|
|
- cols2 := []float64{20, 77, 34, 34, 30}
|
|
|
- h = 10.0
|
|
|
- for i := 0; i < len(header2); i++ {
|
|
|
- pdf.CellFormat(cols2[i], h, header2[i], "1", 0, "CM", false, 0, "")
|
|
|
- }
|
|
|
- pdf.Ln(-1)
|
|
|
- y = pdf.GetY()
|
|
|
- pdf.SetXY(curx, y)
|
|
|
-
|
|
|
- row2 := [][]string{
|
|
|
- {"启运", "______年___月___日___时___分", "________℃", "", "________℃"},
|
|
|
- {"途中", "______年___月___日___时___分", "________℃", "————", "________℃"},
|
|
|
- {"到达", "______年___月___日___时___分", "________℃", "", "________℃"},
|
|
|
- }
|
|
|
-
|
|
|
- for j, row := range row2 {
|
|
|
- curx, y = pdf.GetXY()
|
|
|
- x := curx
|
|
|
- _, lineHt := pdf.GetFontSize()
|
|
|
- height := lineHt * 3
|
|
|
- if j == 1 {
|
|
|
- height = lineHt * 5
|
|
|
- }
|
|
|
-
|
|
|
- // add a new page if the height of the row doesn't fit on the page
|
|
|
- if pdf.GetY()+height > pageh-mbottom {
|
|
|
- pdf.AddPage()
|
|
|
- y = pdf.GetY()
|
|
|
- }
|
|
|
- for i, txt := range row {
|
|
|
- width := cols2[i]
|
|
|
- txtWd := pdf.GetStringWidth(txt)
|
|
|
-
|
|
|
- txtX := x + (width-txtWd)/2
|
|
|
-
|
|
|
- if j == 1 {
|
|
|
- if i == 1 || i == 2 || i == 4 {
|
|
|
- txtY := y + height/5*2
|
|
|
- pdf.Text(txtX, txtY, txt)
|
|
|
- txtY = y + height/5*4
|
|
|
- pdf.Text(txtX, txtY, txt)
|
|
|
- } else {
|
|
|
- txtY := y + height/5*3
|
|
|
- pdf.Text(txtX, txtY, txt)
|
|
|
- }
|
|
|
- } else {
|
|
|
- txtY := y + height/3*2
|
|
|
- pdf.Text(txtX, txtY, txt)
|
|
|
- }
|
|
|
-
|
|
|
- pdf.Rect(x, y, width, height, "")
|
|
|
-
|
|
|
- x += width
|
|
|
- pdf.SetXY(x, y)
|
|
|
- }
|
|
|
- pdf.SetXY(curx, y+height)
|
|
|
- }
|
|
|
- curx, y = pdf.GetXY()
|
|
|
- y += 3
|
|
|
- pdf.SetXY(curx, y)
|
|
|
- pdf.CellFormat(0, 10, "启运至到达行驶里程数:_________千米", "", 0, "", false, 0, "")
|
|
|
-
|
|
|
- y = pdf.GetY()
|
|
|
- y += 8
|
|
|
- pdf.SetXY(curx, y)
|
|
|
- txtWd := pdf.GetStringWidth("发货单位:")
|
|
|
- pdf.CellFormat(txtWd, 10, "发货单位:", "", 0, "", false, 0, "")
|
|
|
- pdf.SetFont("simsun", "U", 9)
|
|
|
- pdf.SetUnderlineThickness(2)
|
|
|
- txtWd = pdf.GetStringWidth(beegouser.GetDeptName(c.Ctx))
|
|
|
- pdf.CellFormat(txtWd, 10, beegouser.GetDeptName(c.Ctx), "", 0, "", false, 0, "")
|
|
|
-
|
|
|
- pdf.SetXY(120, y)
|
|
|
- pdf.SetFont("simsun", "", 9)
|
|
|
- pdf.CellFormat(0, 10, "发货人签名:___________________________", "", 0, "", false, 0, "")
|
|
|
-
|
|
|
- y = pdf.GetY()
|
|
|
- y += 8
|
|
|
- pdf.SetXY(curx, y)
|
|
|
- txtWd = pdf.GetStringWidth("收货单位:")
|
|
|
- pdf.CellFormat(txtWd, 10, "收货单位:", "", 0, "", false, 0, "")
|
|
|
- pdf.SetFont("simsun", "U", 9)
|
|
|
- pdf.SetUnderlineThickness(2)
|
|
|
- txtWd = pdf.GetStringWidth(reqData.ReceivingUnit)
|
|
|
- pdf.CellFormat(txtWd, 10, reqData.ReceivingUnit, "", 0, "", false, 0, "")
|
|
|
-
|
|
|
- pdf.SetXY(120, y)
|
|
|
- pdf.SetFont("simsun", "", 9)
|
|
|
- pdf.CellFormat(0, 10, "收货人签名:___________________________", "", 0, "", false, 0, "")
|
|
|
-
|
|
|
- y = pdf.GetY()
|
|
|
- y += 10
|
|
|
- pdf.SetXY(curx, y)
|
|
|
- txt := "填表说明:本表供疫苗配送企业、疾病预防控制机构、接种单位疫苗运输时填写;出入库单号为单位编码+年月日+2位流水号;运输超过6小时需记录途中温度,间隔不超过6小时;使用无自动温度显示的冰排保冷设备时,只在启运和达到时填写冰排状态(冻结、冰水混合物、完全融化)。"
|
|
|
- pdf.MultiCell(0, 5, txt, "", "", false)
|
|
|
- pdf.Ln(-1)
|
|
|
-
|
|
|
- pdf.SetFooterFunc(func() {
|
|
|
- // Position at 1.5 cm from bottom
|
|
|
- pdf.SetY(-15)
|
|
|
- // Arial italic 8
|
|
|
- pdf.SetFont("simsun", "", 8)
|
|
|
- // Text color in gray
|
|
|
- //pdf.SetTextColor(128, 128, 128)
|
|
|
- // Page number
|
|
|
- pdf.CellFormat(0, 10, fmt.Sprintf("第 %d 页 / 共 %d 页", pdf.PageNo(), pdf.PageCount()),
|
|
|
- "", 0, "C", false, 0, "")
|
|
|
- })
|
|
|
- filename := "运输记录表" + time.Now().Format("20060102150405") + ".pdf"
|
|
|
- // 保存文件
|
|
|
- if err = pdf.OutputFileAndClose("ofile/" + filename); err != nil {
|
|
|
- fmt.Println(err)
|
|
|
- }
|
|
|
- defer func() {
|
|
|
- os.Remove("ofile/" + filename)
|
|
|
- //os.Remove(imgPath)
|
|
|
- }()
|
|
|
-
|
|
|
- // 返回生成的 Excel 文件
|
|
|
- c.Ctx.Output.Download("ofile/" + filename)
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
func getImageBytes(filePath string) []byte {
|
|
|
b, err := os.ReadFile(filePath)
|
|
|
if err != nil {
|