diff --git a/svc/routes/customer_balance_pdf.go b/svc/routes/customer_balance_pdf.go index 8309b4d..62a8268 100644 --- a/svc/routes/customer_balance_pdf.go +++ b/svc/routes/customer_balance_pdf.go @@ -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"} summaryWeights := []float64{18, 42, 16, 16, 14, 24, 24, 14, 14, 14, 14} if includeVadeColumns { - // Aging raporu (A4 dikey) için kolonlar sıkıştırılır. 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) @@ -325,7 +324,8 @@ func drawCustomerBalancePDF( } drawSummaryHeader := func() { - pdf.SetFont("dejavu", "B", 7.5) + headerFont := 7.5 + pdf.SetFont("dejavu", "B", headerFont) pdf.SetFillColor(149, 113, 22) pdf.SetTextColor(255, 255, 255) y := pdf.GetY() @@ -363,7 +363,8 @@ func drawCustomerBalancePDF( header() drawSummaryHeader() - pdf.SetFont("dejavu", "", 7.2) + bodyFont := 7.2 + pdf.SetFont("dejavu", "", bodyFont) pdf.SetTextColor(20, 20, 20) totalUSD12, totalTRY12 := 0.0, 0.0 @@ -412,7 +413,7 @@ func drawCustomerBalancePDF( 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) { header() drawSummaryHeader() @@ -442,7 +443,7 @@ func drawCustomerBalancePDF( totalX += summaryW[i] } pdf.SetY(totalY + totalH) - pdf.SetFont("dejavu", "", 7.2) + pdf.SetFont("dejavu", "", bodyFont) pdf.SetTextColor(20, 20, 20) for _, s := range summaries { @@ -463,11 +464,11 @@ func drawCustomerBalancePDF( 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) { header() drawSummaryHeader() - pdf.SetFont("dejavu", "", 7.2) + pdf.SetFont("dejavu", "", bodyFont) pdf.SetTextColor(20, 20, 20) } @@ -486,9 +487,11 @@ func drawCustomerBalancePDF( align = "C" } 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 { - 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] } @@ -733,7 +736,8 @@ func drawPDFCellWrapped(pdf *gofpdf.Fpdf, value string, x, y, w, h float64, alig for _, ln := range lines { 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 } } @@ -804,7 +808,8 @@ func drawPDFCellWrappedCapped(pdf *gofpdf.Fpdf, value string, x, y, w, h float64 for _, ln := range lines { 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 } } diff --git a/svc/routes/statement_aging_pdf.go b/svc/routes/statement_aging_pdf.go index 440de93..2640dd5 100644 --- a/svc/routes/statement_aging_pdf.go +++ b/svc/routes/statement_aging_pdf.go @@ -74,7 +74,7 @@ func ExportStatementAgingPDFHandler(_ *sql.DB) http.HandlerFunc { rows = filterCustomerBalanceRowsForPDF(rows, excludeZero12, excludeZero13) summaries, detailsByMaster := buildCustomerBalancePDFData(rows) - pdf := gofpdf.New("P", "mm", "A4", "") + pdf := gofpdf.New("L", "mm", "A4", "") pdf.SetMargins(8, 8, 8) pdf.SetAutoPageBreak(false, 12) if err := registerDejavuFonts(pdf, "dejavu"); err != nil { @@ -92,7 +92,7 @@ func ExportStatementAgingPDFHandler(_ *sql.DB) http.HandlerFunc { summaries, detailsByMaster, ); err != nil { - pdf = gofpdf.New("P", "mm", "A4", "") + pdf = gofpdf.New("L", "mm", "A4", "") pdf.SetMargins(8, 8, 8) pdf.SetAutoPageBreak(true, 12) if ferr := registerDejavuFonts(pdf, "dejavu"); ferr != nil { diff --git a/ui/src/pages/AgingCustomerBalancelist.go.vue b/ui/src/pages/AgingCustomerBalancelist.go.vue index 61ad6c7..6c27407 100644 --- a/ui/src/pages/AgingCustomerBalancelist.go.vue +++ b/ui/src/pages/AgingCustomerBalancelist.go.vue @@ -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) } } -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(() => ([ { name: 'expand', label: '', field: 'expand', align: 'center', sortable: false }, diff --git a/ui/src/pages/CustomerBalanceList.vue b/ui/src/pages/CustomerBalanceList.vue index 8bf2873..f253c8c 100644 --- a/ui/src/pages/CustomerBalanceList.vue +++ b/ui/src/pages/CustomerBalanceList.vue @@ -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) } } -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(() => ([ { name: 'expand', label: '', field: 'expand', align: 'center', sortable: false },