Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -265,9 +265,8 @@ func drawCustomerBalancePDF(
|
|||||||
summaryCols := []string{"Ana Cari Kod", "Ana Cari Detay", "Piyasa", "Temsilci", "Risk", "1_2 Pr.Br", "1_3 Pr.Br", "1_2 USD", "1_2 TRY", "1_3 USD", "1_3 TRY"}
|
summaryCols := []string{"Ana Cari Kod", "Ana Cari Detay", "Piyasa", "Temsilci", "Risk", "1_2 Pr.Br", "1_3 Pr.Br", "1_2 USD", "1_2 TRY", "1_3 USD", "1_3 TRY"}
|
||||||
summaryWeights := []float64{18, 42, 16, 16, 14, 24, 24, 14, 14, 14, 14}
|
summaryWeights := []float64{18, 42, 16, 16, 14, 24, 24, 14, 14, 14, 14}
|
||||||
if includeVadeColumns {
|
if includeVadeColumns {
|
||||||
// Aging raporu (A4 dikey) için kolonlar sıkıştırılır.
|
|
||||||
summaryCols = append(summaryCols, "Vade Gun", "Belge Tarihi Gun")
|
summaryCols = append(summaryCols, "Vade Gun", "Belge Tarihi Gun")
|
||||||
summaryWeights = []float64{14, 28, 10, 10, 10, 13, 13, 9, 9, 9, 9, 8, 10}
|
summaryWeights = []float64{18, 38, 14, 14, 12, 20, 20, 12, 12, 12, 12, 10, 13}
|
||||||
}
|
}
|
||||||
summaryW := normalizeWidths(summaryWeights, tableW)
|
summaryW := normalizeWidths(summaryWeights, tableW)
|
||||||
|
|
||||||
@@ -325,7 +324,8 @@ func drawCustomerBalancePDF(
|
|||||||
}
|
}
|
||||||
|
|
||||||
drawSummaryHeader := func() {
|
drawSummaryHeader := func() {
|
||||||
pdf.SetFont("dejavu", "B", 7.5)
|
headerFont := 7.5
|
||||||
|
pdf.SetFont("dejavu", "B", headerFont)
|
||||||
pdf.SetFillColor(149, 113, 22)
|
pdf.SetFillColor(149, 113, 22)
|
||||||
pdf.SetTextColor(255, 255, 255)
|
pdf.SetTextColor(255, 255, 255)
|
||||||
y := pdf.GetY()
|
y := pdf.GetY()
|
||||||
@@ -363,7 +363,8 @@ func drawCustomerBalancePDF(
|
|||||||
header()
|
header()
|
||||||
drawSummaryHeader()
|
drawSummaryHeader()
|
||||||
|
|
||||||
pdf.SetFont("dejavu", "", 7.2)
|
bodyFont := 7.2
|
||||||
|
pdf.SetFont("dejavu", "", bodyFont)
|
||||||
pdf.SetTextColor(20, 20, 20)
|
pdf.SetTextColor(20, 20, 20)
|
||||||
|
|
||||||
totalUSD12, totalTRY12 := 0.0, 0.0
|
totalUSD12, totalTRY12 := 0.0, 0.0
|
||||||
@@ -412,7 +413,7 @@ func drawCustomerBalancePDF(
|
|||||||
totalsRow = append(totalsRow, formatDayUpPDF(totalVade), formatDayUpPDF(totalVadeBelge))
|
totalsRow = append(totalsRow, formatDayUpPDF(totalVade), formatDayUpPDF(totalVadeBelge))
|
||||||
}
|
}
|
||||||
|
|
||||||
totalH := calcPDFRowHeightCapped(pdf, totalsRow, summaryW, map[int]int{0: 1, 1: 1, 2: 1, 3: 1, 5: 2, 6: 2}, 6.2, 3.4)
|
totalH := calcPDFRowHeightCapped(pdf, totalsRow, summaryW, map[int]int{0: 1, 1: 1, 2: 1, 3: 1, 5: 2, 6: 2}, 6.0, 3.4)
|
||||||
if needPage(totalH) {
|
if needPage(totalH) {
|
||||||
header()
|
header()
|
||||||
drawSummaryHeader()
|
drawSummaryHeader()
|
||||||
@@ -442,7 +443,7 @@ func drawCustomerBalancePDF(
|
|||||||
totalX += summaryW[i]
|
totalX += summaryW[i]
|
||||||
}
|
}
|
||||||
pdf.SetY(totalY + totalH)
|
pdf.SetY(totalY + totalH)
|
||||||
pdf.SetFont("dejavu", "", 7.2)
|
pdf.SetFont("dejavu", "", bodyFont)
|
||||||
pdf.SetTextColor(20, 20, 20)
|
pdf.SetTextColor(20, 20, 20)
|
||||||
|
|
||||||
for _, s := range summaries {
|
for _, s := range summaries {
|
||||||
@@ -463,11 +464,11 @@ func drawCustomerBalancePDF(
|
|||||||
row = append(row, formatDayUpPDF(s.VadeGun), formatDayUpPDF(s.VadeBelge))
|
row = append(row, formatDayUpPDF(s.VadeGun), formatDayUpPDF(s.VadeBelge))
|
||||||
}
|
}
|
||||||
|
|
||||||
rowH := calcPDFRowHeightCapped(pdf, row, summaryW, map[int]int{0: 3, 1: 3, 2: 3, 3: 3}, 6.2, 3.6)
|
rowH := calcPDFRowHeightCapped(pdf, row, summaryW, map[int]int{0: 3, 1: 3, 2: 3, 3: 3, 4: 2, 5: 2, 6: 2}, 6.0, 3.4)
|
||||||
if needPage(rowH) {
|
if needPage(rowH) {
|
||||||
header()
|
header()
|
||||||
drawSummaryHeader()
|
drawSummaryHeader()
|
||||||
pdf.SetFont("dejavu", "", 7.2)
|
pdf.SetFont("dejavu", "", bodyFont)
|
||||||
pdf.SetTextColor(20, 20, 20)
|
pdf.SetTextColor(20, 20, 20)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -486,9 +487,11 @@ func drawCustomerBalancePDF(
|
|||||||
align = "C"
|
align = "C"
|
||||||
}
|
}
|
||||||
if i <= 3 {
|
if i <= 3 {
|
||||||
drawPDFCellWrappedCapped(pdf, v, x, y, summaryW[i], rowH, align, 3.6, 3)
|
drawPDFCellWrappedCapped(pdf, v, x, y, summaryW[i], rowH, align, 3.4, 3)
|
||||||
|
} else if i == 5 || i == 6 {
|
||||||
|
drawPDFCellWrappedCapped(pdf, v, x, y, summaryW[i], rowH, align, 3.4, 2)
|
||||||
} else {
|
} else {
|
||||||
drawPDFCellWrapped(pdf, v, x, y, summaryW[i], rowH, align, 3.6)
|
drawPDFCellWrapped(pdf, v, x, y, summaryW[i], rowH, align, 3.4)
|
||||||
}
|
}
|
||||||
x += summaryW[i]
|
x += summaryW[i]
|
||||||
}
|
}
|
||||||
@@ -733,7 +736,8 @@ func drawPDFCellWrapped(pdf *gofpdf.Fpdf, value string, x, y, w, h float64, alig
|
|||||||
|
|
||||||
for _, ln := range lines {
|
for _, ln := range lines {
|
||||||
pdf.SetXY(x+1, startY)
|
pdf.SetXY(x+1, startY)
|
||||||
pdf.CellFormat(w-2, lineH, string(ln), "", 0, align, false, 0, "")
|
fitted := fitTextWithSuffixPDF(pdf, string(ln), w-2, "...")
|
||||||
|
pdf.CellFormat(w-2, lineH, fitted, "", 0, align, false, 0, "")
|
||||||
startY += lineH
|
startY += lineH
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -804,7 +808,8 @@ func drawPDFCellWrappedCapped(pdf *gofpdf.Fpdf, value string, x, y, w, h float64
|
|||||||
|
|
||||||
for _, ln := range lines {
|
for _, ln := range lines {
|
||||||
pdf.SetXY(x+1, startY)
|
pdf.SetXY(x+1, startY)
|
||||||
pdf.CellFormat(w-2, lineH, string(ln), "", 0, align, false, 0, "")
|
fitted := fitTextWithSuffixPDF(pdf, string(ln), w-2, "...")
|
||||||
|
pdf.CellFormat(w-2, lineH, fitted, "", 0, align, false, 0, "")
|
||||||
startY += lineH
|
startY += lineH
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ func ExportStatementAgingPDFHandler(_ *sql.DB) http.HandlerFunc {
|
|||||||
rows = filterCustomerBalanceRowsForPDF(rows, excludeZero12, excludeZero13)
|
rows = filterCustomerBalanceRowsForPDF(rows, excludeZero12, excludeZero13)
|
||||||
summaries, detailsByMaster := buildCustomerBalancePDFData(rows)
|
summaries, detailsByMaster := buildCustomerBalancePDFData(rows)
|
||||||
|
|
||||||
pdf := gofpdf.New("P", "mm", "A4", "")
|
pdf := gofpdf.New("L", "mm", "A4", "")
|
||||||
pdf.SetMargins(8, 8, 8)
|
pdf.SetMargins(8, 8, 8)
|
||||||
pdf.SetAutoPageBreak(false, 12)
|
pdf.SetAutoPageBreak(false, 12)
|
||||||
if err := registerDejavuFonts(pdf, "dejavu"); err != nil {
|
if err := registerDejavuFonts(pdf, "dejavu"); err != nil {
|
||||||
@@ -92,7 +92,7 @@ func ExportStatementAgingPDFHandler(_ *sql.DB) http.HandlerFunc {
|
|||||||
summaries,
|
summaries,
|
||||||
detailsByMaster,
|
detailsByMaster,
|
||||||
); err != nil {
|
); err != nil {
|
||||||
pdf = gofpdf.New("P", "mm", "A4", "")
|
pdf = gofpdf.New("L", "mm", "A4", "")
|
||||||
pdf.SetMargins(8, 8, 8)
|
pdf.SetMargins(8, 8, 8)
|
||||||
pdf.SetAutoPageBreak(true, 12)
|
pdf.SetAutoPageBreak(true, 12)
|
||||||
if ferr := registerDejavuFonts(pdf, "dejavu"); ferr != nil {
|
if ferr := registerDejavuFonts(pdf, "dejavu"); ferr != nil {
|
||||||
|
|||||||
@@ -690,7 +690,25 @@ const metricDefs = {
|
|||||||
try_1_3: { name: 'tl_bakiye_1_3', label: '1_3 TRY_BAKIYE', field: 'tl_bakiye_1_3', align: 'center', sortable: true, sort: (a, b) => toNumericSortValue(a) - toNumericSortValue(b) }
|
try_1_3: { name: 'tl_bakiye_1_3', label: '1_3 TRY_BAKIYE', field: 'tl_bakiye_1_3', align: 'center', sortable: true, sort: (a, b) => toNumericSortValue(a) - toNumericSortValue(b) }
|
||||||
}
|
}
|
||||||
|
|
||||||
const selectedMetricKeys = computed(() => [...Object.keys(metricDefs)])
|
const selectedMetricKeys = computed(() => {
|
||||||
|
const selected = (store.filters.islemTipi || [])
|
||||||
|
.map(v => String(v).trim())
|
||||||
|
.filter(Boolean)
|
||||||
|
|
||||||
|
if (selected.length === 0) {
|
||||||
|
return [...Object.keys(metricDefs)]
|
||||||
|
}
|
||||||
|
|
||||||
|
const show12 = selected.includes('1_2')
|
||||||
|
const show13 = selected.includes('1_3')
|
||||||
|
|
||||||
|
return Object.keys(metricDefs).filter((key) => {
|
||||||
|
if (!show12 && !show13) return true
|
||||||
|
if (key.endsWith('_1_2')) return show12
|
||||||
|
if (key.endsWith('_1_3')) return show13
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
const summaryColumns = computed(() => ([
|
const summaryColumns = computed(() => ([
|
||||||
{ name: 'expand', label: '', field: 'expand', align: 'center', sortable: false },
|
{ name: 'expand', label: '', field: 'expand', align: 'center', sortable: false },
|
||||||
|
|||||||
@@ -592,7 +592,25 @@ const metricDefs = {
|
|||||||
try_1_3: { name: 'tl_bakiye_1_3', label: '1_3 TRY_BAKIYE', field: 'tl_bakiye_1_3', align: 'center', sortable: true, sort: (a, b) => toNumericSortValue(a) - toNumericSortValue(b) }
|
try_1_3: { name: 'tl_bakiye_1_3', label: '1_3 TRY_BAKIYE', field: 'tl_bakiye_1_3', align: 'center', sortable: true, sort: (a, b) => toNumericSortValue(a) - toNumericSortValue(b) }
|
||||||
}
|
}
|
||||||
|
|
||||||
const selectedMetricKeys = computed(() => Object.keys(metricDefs))
|
const selectedMetricKeys = computed(() => {
|
||||||
|
const selected = (store.filters.islemTipi || [])
|
||||||
|
.map(v => String(v).trim())
|
||||||
|
.filter(Boolean)
|
||||||
|
|
||||||
|
if (selected.length === 0) {
|
||||||
|
return Object.keys(metricDefs)
|
||||||
|
}
|
||||||
|
|
||||||
|
const show12 = selected.includes('1_2')
|
||||||
|
const show13 = selected.includes('1_3')
|
||||||
|
|
||||||
|
return Object.keys(metricDefs).filter((key) => {
|
||||||
|
if (!show12 && !show13) return true
|
||||||
|
if (key.endsWith('_1_2')) return show12
|
||||||
|
if (key.endsWith('_1_3')) return show13
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
const summaryColumns = computed(() => ([
|
const summaryColumns = computed(() => ([
|
||||||
{ name: 'expand', label: '', field: 'expand', align: 'center', sortable: false },
|
{ name: 'expand', label: '', field: 'expand', align: 'center', sortable: false },
|
||||||
|
|||||||
Reference in New Issue
Block a user