Merge remote-tracking branch 'origin/master'

This commit is contained in:
M_Kececi
2026-03-03 01:11:19 +03:00
parent a4f4c2457f
commit ecf3a8bd07
4 changed files with 177 additions and 138 deletions

View File

@@ -226,7 +226,7 @@ func drawCustomerBalancePDF(
tableW := pageW - marginL - marginR tableW := pageW - marginL - marginR
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"}
summaryW := normalizeWidths([]float64{20, 43, 18, 18, 16, 27, 27, 15, 15, 15, 15}, tableW) summaryW := normalizeWidths([]float64{20, 52, 16, 20, 14, 24, 24, 14, 14, 14, 14}, tableW)
detailCols := []string{"Cari Kod", "Cari Detay", "Sirket", "Muhasebe", "Doviz", "1_2 Pr.Br", "1_3 Pr.Br", "1_2 USD", "1_2 TRY", "1_3 USD", "1_3 TRY"} detailCols := []string{"Cari Kod", "Cari Detay", "Sirket", "Muhasebe", "Doviz", "1_2 Pr.Br", "1_3 Pr.Br", "1_2 USD", "1_2 TRY", "1_3 USD", "1_3 TRY"}
detailW := normalizeWidths([]float64{26, 46, 10, 20, 10, 24, 24, 15, 15, 15, 15}, tableW) detailW := normalizeWidths([]float64{26, 46, 10, 20, 10, 24, 24, 15, 15, 15, 15}, tableW)
@@ -265,6 +265,44 @@ func drawCustomerBalancePDF(
return pdf.GetY()+needH+marginB > 210.0 return pdf.GetY()+needH+marginB > 210.0
} }
wrappedLines := func(text string, w float64) [][]byte {
t := strings.TrimSpace(text)
if t == "" {
t = "-"
}
return pdf.SplitLines([]byte(t), w)
}
calcWrappedRowHeight := func(row []string, widths []float64, wrapIdx map[int]bool, lineH float64, minH float64) float64 {
maxLines := 1
for i, v := range row {
if !wrapIdx[i] {
continue
}
ln := len(wrappedLines(v, widths[i]-2))
if ln > maxLines {
maxLines = ln
}
}
h := float64(maxLines)*lineH + 1.2
if h < minH {
return minH
}
return h
}
drawWrapped := func(text string, x, y, w, rowH, lineH float64, align string) {
lines := wrappedLines(text, w-2)
total := float64(len(lines)) * lineH
startY := y + (rowH-total)/2
cy := startY
for _, ln := range lines {
pdf.SetXY(x+1, cy)
pdf.CellFormat(w-2, lineH, string(ln), "", 0, align, false, 0, "")
cy += lineH
}
}
drawSummaryHeader := func() { drawSummaryHeader := func() {
pdf.SetFont("dejavu", "B", 7.5) pdf.SetFont("dejavu", "B", 7.5)
pdf.SetFillColor(149, 113, 22) pdf.SetFillColor(149, 113, 22)
@@ -301,12 +339,7 @@ func drawCustomerBalancePDF(
pdf.SetFont("dejavu", "", 7.2) pdf.SetFont("dejavu", "", 7.2)
pdf.SetTextColor(20, 20, 20) pdf.SetTextColor(20, 20, 20)
for _, s := range summaries { drawSummaryRow := func(s balanceSummaryPDF) {
if needPage(6.2) {
header()
drawSummaryHeader()
}
row := []string{ row := []string{
s.AnaCariKodu, s.AnaCariKodu,
s.AnaCariAdi, s.AnaCariAdi,
@@ -320,30 +353,46 @@ func drawCustomerBalancePDF(
formatMoneyPDF(s.USDBakiye13), formatMoneyPDF(s.USDBakiye13),
formatMoneyPDF(s.TLBakiye13), formatMoneyPDF(s.TLBakiye13),
} }
wrapCols := map[int]bool{1: true, 3: true}
rowH := calcWrappedRowHeight(row, summaryW, wrapCols, 3.2, 6.2)
if needPage(rowH) {
header()
drawSummaryHeader()
}
y := pdf.GetY() y := pdf.GetY()
x := marginL x := marginL
for i, v := range row { for i, v := range row {
pdf.Rect(x, y, summaryW[i], 6.2, "") pdf.Rect(x, y, summaryW[i], rowH, "")
align := "L" align := "L"
if i >= 7 { if i >= 7 {
align = "R" align = "R"
} }
pdf.SetXY(x+1, y+1) if wrapCols[i] {
drawWrapped(v, x, y, summaryW[i], rowH, 3.2, "L")
} else {
pdf.SetXY(x+1, y+(rowH-4.2)/2)
pdf.CellFormat(summaryW[i]-2, 4.2, v, "", 0, align, false, 0, "") pdf.CellFormat(summaryW[i]-2, 4.2, v, "", 0, align, false, 0, "")
}
x += summaryW[i] x += summaryW[i]
} }
pdf.SetY(y + 6.2) pdf.SetY(y + rowH)
} }
if !detailed { if !detailed {
for _, s := range summaries {
drawSummaryRow(s)
}
return return
} }
pdf.Ln(1.8)
for _, s := range summaries { for _, s := range summaries {
drawSummaryRow(s)
pdf.Ln(1.2)
rows := detailsByMaster[s.AnaCariKodu] rows := detailsByMaster[s.AnaCariKodu]
if len(rows) == 0 { if len(rows) == 0 {
pdf.Ln(1.0)
continue continue
} }

View File

@@ -1,6 +1,6 @@
<template> <template>
<q-page v-if="canReadFinance" class="q-px-md q-pb-md q-pt-xs page-col statement-page"> <q-page v-if="canReadFinance" class="q-px-md q-pb-md page-col statement-page">
<div class="filter-sticky compact-filter q-pa-sm q-mb-xs"> <div class="local-filter-bar compact-filter q-pa-sm q-mb-xs">
<div class="row q-col-gutter-sm items-end"> <div class="row q-col-gutter-sm items-end">
<div class="col-12 col-md-5"> <div class="col-12 col-md-5">
<q-select <q-select
@@ -55,23 +55,6 @@
<div class="table-scroll"> <div class="table-scroll">
<div class="sticky-bar row justify-end items-center q-pa-sm bg-grey-1"> <div class="sticky-bar row justify-end items-center q-pa-sm bg-grey-1">
<q-btn-dropdown
v-if="canExportFinance"
flat
color="red"
icon="picture_as_pdf"
label="Yazdır"
class="q-mr-sm"
>
<q-list style="min-width: 220px">
<q-item clickable v-close-popup @click="downloadAgingPDF">
<q-item-section class="text-primary">
Detaylı Yaşlandırma Ekstresi Yazdır
</q-item-section>
</q-item>
</q-list>
</q-btn-dropdown>
<q-btn <q-btn
flat flat
color="secondary" color="secondary"
@@ -96,6 +79,16 @@
:loading="agingStore.loading" :loading="agingStore.loading"
:table-style="{ tableLayout: 'fixed', width: '100%' }" :table-style="{ tableLayout: 'fixed', width: '100%' }"
> >
<template #top-right>
<q-btn
color="red"
text-color="white"
icon="picture_as_pdf"
label="Detaylı PDF Yazdır"
@click="downloadAgingPDF"
/>
</template>
<template #header="props"> <template #header="props">
<q-tr :props="props" class="header-row"> <q-tr :props="props" class="header-row">
<q-th v-for="col in props.cols" :key="col.name" :props="props">{{ col.label }}</q-th> <q-th v-for="col in props.cols" :key="col.name" :props="props">{{ col.label }}</q-th>
@@ -446,6 +439,8 @@ async function downloadAgingPDF () {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
overflow: hidden; overflow: hidden;
margin-top: 0 !important;
padding-top: 56px !important;
} }
.table-scroll { .table-scroll {
@@ -456,6 +451,14 @@ async function downloadAgingPDF () {
flex-direction: column; flex-direction: column;
} }
.statement-page .local-filter-bar {
position: sticky !important;
top: 0 !important;
z-index: 980 !important;
margin-top: 0 !important;
padding-top: 0 !important;
}
.compact-filter { .compact-filter {
border: 1px solid rgba(0, 0, 0, 0.12); border: 1px solid rgba(0, 0, 0, 0.12);
border-radius: 8px; border-radius: 8px;

View File

@@ -1,13 +1,15 @@
<template> <template>
<q-page v-if="canReadFinance" class="q-pa-md page-col statement-page"> <q-page v-if="canReadFinance" class="q-px-md q-pb-md page-col statement-page">
<!-- Cari Kod / İsim (sabit) --> <div class="local-filter-bar compact-filter q-pa-sm q-mb-xs">
<div class="filter-sticky"> <div class="row q-col-gutter-sm items-end">
<div class="col-12 col-md-4">
<q-select <q-select
v-model="selectedCari" v-model="selectedCari"
:options="filteredOptions" :options="filteredOptions"
label="Cari kod / isim" label="Cari kod / isim"
filled filled
dense
clearable clearable
use-input use-input
input-debounce="300" input-debounce="300"
@@ -21,28 +23,14 @@
:keep-selected="true" :keep-selected="true"
/> />
</div> </div>
<div class="col-12 col-sm-6 col-md-2">
<!-- Filtre Alanı -->
<div class="filter-collapsible">
<div class="row items-center justify-between q-pa-sm bg-grey-2">
<div class="text-subtitle1">Filtreler</div>
<q-btn
dense flat round
:icon="filtersOpen ? 'expand_less' : 'expand_more'"
@click="filtersOpen = !filtersOpen"
/>
</div>
<q-slide-transition>
<div v-show="filtersOpen" class="q-pa-md bg-grey-1">
<!-- Tarih Aralığı -->
<div class="row q-col-gutter-sm q-mb-md">
<div class="col-12 col-sm-6">
<q-input <q-input
v-model="dateFrom" v-model="dateFrom"
label="Tarih aralığı - başlangıç" label="Tarih aralığı - başlangıç"
filled clearable readonly filled
dense
clearable
readonly
> >
<template #append> <template #append>
<q-icon name="event" class="cursor-pointer"> <q-icon name="event" class="cursor-pointer">
@@ -58,12 +46,14 @@
</template> </template>
</q-input> </q-input>
</div> </div>
<div class="col-12 col-sm-6 col-md-2">
<div class="col-12 col-sm-6">
<q-input <q-input
v-model="dateTo" v-model="dateTo"
label="Tarih aralığı - bitiş" label="Tarih aralığı - bitiş"
filled clearable readonly filled
dense
clearable
readonly
> >
<template #append> <template #append>
<q-icon name="event" class="cursor-pointer"> <q-icon name="event" class="cursor-pointer">
@@ -79,9 +69,7 @@
</template> </template>
</q-input> </q-input>
</div> </div>
</div> <div class="col-12 col-sm-6 col-md-2">
<!-- Parasal İşlem Tipi -->
<q-select <q-select
v-model="selectedMonType" v-model="selectedMonType"
:options="monetaryTypeOptions" :options="monetaryTypeOptions"
@@ -89,32 +77,17 @@
emit-value emit-value
map-options map-options
filled filled
class="q-mb-md" dense
/>
<!-- Filtre / Sıfırla Butonları -->
<div class="row q-col-gutter-md items-center">
<div class="col-auto">
<q-btn
color="primary"
icon="filter_alt"
label="Filtrele"
@click="onFilterClick"
/> />
</div> </div>
<div class="col-auto"> <div class="col-auto">
<q-btn <q-btn color="primary" icon="filter_alt" label="Filtrele" @click="onFilterClick" />
flat </div>
color="grey-8" <div class="col-auto">
icon="restart_alt" <q-btn flat color="grey-8" icon="restart_alt" label="Sıfırla" @click="resetFilters" />
label="Sıfırla"
@click="resetFilters"
/>
</div> </div>
</div> </div>
</div> </div>
</q-slide-transition>
</div>
<!-- Tablo Alanı --> <!-- Tablo Alanı -->
<div class="table-scroll"> <div class="table-scroll">
@@ -478,8 +451,6 @@ function formatAmount(n) {
}).format(n) }).format(n)
} }
const filtersOpen = ref(true)
/* Kolon gizle/göster */ /* Kolon gizle/göster */
const visibleColumns = ref([]) const visibleColumns = ref([])
const showLeftCols = ref(true) const showLeftCols = ref(true)
@@ -599,6 +570,22 @@ async function CurrheadDownload() {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
overflow: hidden; overflow: hidden;
margin-top: 0 !important;
padding-top: 56px !important;
}
.statement-page .local-filter-bar {
position: sticky !important;
top: 0 !important;
z-index: 980 !important;
margin-top: 0 !important;
padding-top: 0 !important;
}
.compact-filter {
border: 1px solid rgba(0, 0, 0, 0.12);
border-radius: 8px;
background: #fafafa;
} }
.table-scroll { .table-scroll {