Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -710,12 +710,28 @@ func drawOrderHeader(pdf *gofpdf.Fpdf, h *OrderHeader, showDesc bool) float64 {
|
||||
pageW, _ := pdf.GetPageSize()
|
||||
marginL := 10.0
|
||||
y := 8.0
|
||||
shorten := func(s string, max int) string {
|
||||
r := []rune(strings.TrimSpace(s))
|
||||
if len(r) <= max {
|
||||
return string(r)
|
||||
}
|
||||
if max < 3 {
|
||||
return string(r[:max])
|
||||
}
|
||||
return string(r[:max-3]) + "..."
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------
|
||||
1) LOGO
|
||||
---------------------------------------------------- */
|
||||
if logoPath, err := resolvePdfImagePath("Baggi-Tekstil-A.s-Logolu.jpeg"); err == nil {
|
||||
pdf.ImageOptions(logoPath, marginL, y, 32, 0, false, gofpdf.ImageOptions{}, 0, "")
|
||||
} else {
|
||||
pdf.SetFont("dejavu", "B", 12)
|
||||
pdf.SetTextColor(149, 113, 22)
|
||||
pdf.SetXY(marginL, y+6)
|
||||
pdf.CellFormat(32, 6, "BAGGI", "", 0, "L", false, 0, "")
|
||||
pdf.SetTextColor(0, 0, 0)
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------
|
||||
@@ -737,19 +753,19 @@ func drawOrderHeader(pdf *gofpdf.Fpdf, h *OrderHeader, showDesc bool) float64 {
|
||||
3) SAĞ TARAF BİLGİ KUTUSU
|
||||
---------------------------------------------------- */
|
||||
boxW := 78.0
|
||||
boxH := 30.0
|
||||
boxX := pageW - marginL - boxW
|
||||
boxY := y - 2
|
||||
|
||||
pdf.SetDrawColor(180, 180, 180)
|
||||
pdf.Rect(boxX, boxY, boxW, boxH, "")
|
||||
|
||||
pdf.SetFont("dejavu", "B", 9)
|
||||
pdf.SetTextColor(149, 113, 22)
|
||||
rep := strings.TrimSpace(h.CustomerRep)
|
||||
if rep == "" {
|
||||
rep = strings.TrimSpace(h.CreatedUser)
|
||||
}
|
||||
desc := strings.TrimSpace(h.Description)
|
||||
if desc == "" {
|
||||
desc = strings.TrimSpace(h.InternalDesc)
|
||||
}
|
||||
|
||||
info := []string{
|
||||
"Formun Basılma Tarihi: " + time.Now().Format("02.01.2006"),
|
||||
@@ -759,12 +775,24 @@ func drawOrderHeader(pdf *gofpdf.Fpdf, h *OrderHeader, showDesc bool) float64 {
|
||||
"Cari Kod: " + h.CurrAccCode,
|
||||
"Müşteri: " + h.CurrAccName,
|
||||
}
|
||||
if desc != "" {
|
||||
info = append(info, "Sipariş Açıklaması: "+shorten(desc, 52))
|
||||
}
|
||||
|
||||
lineH := 4.5
|
||||
boxH := float64(len(info))*lineH + 3
|
||||
if boxH < 30 {
|
||||
boxH = 30
|
||||
}
|
||||
|
||||
pdf.SetDrawColor(180, 180, 180)
|
||||
pdf.Rect(boxX, boxY, boxW, boxH, "")
|
||||
|
||||
iy := boxY + 3
|
||||
for _, line := range info {
|
||||
pdf.SetXY(boxX+3, iy)
|
||||
pdf.CellFormat(boxW-6, 4.5, line, "", 0, "L", false, 0, "")
|
||||
iy += 4.5
|
||||
pdf.CellFormat(boxW-6, lineH, line, "", 0, "L", false, 0, "")
|
||||
iy += lineH
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------
|
||||
@@ -780,10 +808,6 @@ func drawOrderHeader(pdf *gofpdf.Fpdf, h *OrderHeader, showDesc bool) float64 {
|
||||
/* ----------------------------------------------------
|
||||
5) AÇIKLAMA (Varsa)
|
||||
---------------------------------------------------- */
|
||||
desc := strings.TrimSpace(h.Description)
|
||||
if desc == "" {
|
||||
desc = strings.TrimSpace(h.InternalDesc)
|
||||
}
|
||||
if showDesc && desc != "" {
|
||||
text := desc
|
||||
|
||||
|
||||
Reference in New Issue
Block a user