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] {
pdf.CellFormat(summaryW[i]-2, 4.2, v, "", 0, align, false, 0, "") 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, "")
}
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,87 +1,75 @@
<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">
<q-select <div class="col-12 col-md-4">
v-model="selectedCari" <q-select
:options="filteredOptions" v-model="selectedCari"
label="Cari kod / isim" :options="filteredOptions"
filled label="Cari kod / isim"
clearable filled
use-input dense
input-debounce="300" clearable
@filter="filterCari" use-input
emit-value input-debounce="300"
map-options @filter="filterCari"
:loading="accountStore.loading" emit-value
option-value="value" map-options
option-label="label" :loading="accountStore.loading"
behavior="menu" option-value="value"
:keep-selected="true" option-label="label"
/> behavior="menu"
</div> :keep-selected="true"
/>
<!-- Filtre Alanı --> </div>
<div class="filter-collapsible"> <div class="col-12 col-sm-6 col-md-2">
<div class="row items-center justify-between q-pa-sm bg-grey-2"> <q-input
<div class="text-subtitle1">Filtreler</div> v-model="dateFrom"
<q-btn label="Tarih aralığı - başlangıç"
dense flat round filled
:icon="filtersOpen ? 'expand_less' : 'expand_more'" dense
@click="filtersOpen = !filtersOpen" clearable
/> readonly
</div> >
<template #append>
<q-slide-transition> <q-icon name="event" class="cursor-pointer">
<div v-show="filtersOpen" class="q-pa-md bg-grey-1"> <q-popup-proxy cover transition-show="scale" transition-hide="scale">
<q-date
<!-- Tarih Aralığı --> v-model="dateFrom"
<div class="row q-col-gutter-sm q-mb-md"> mask="YYYY-MM-DD"
<div class="col-12 col-sm-6"> locale="tr-TR"
<q-input :options="isValidFromDate"
v-model="dateFrom" />
label="Tarih aralığı - başlangıç" </q-popup-proxy>
filled clearable readonly </q-icon>
> </template>
<template #append> </q-input>
<q-icon name="event" class="cursor-pointer"> </div>
<q-popup-proxy cover transition-show="scale" transition-hide="scale"> <div class="col-12 col-sm-6 col-md-2">
<q-date <q-input
v-model="dateFrom" v-model="dateTo"
mask="YYYY-MM-DD" label="Tarih aralığı - bitiş"
locale="tr-TR" filled
:options="isValidFromDate" dense
/> clearable
</q-popup-proxy> readonly
</q-icon> >
</template> <template #append>
</q-input> <q-icon name="event" class="cursor-pointer">
</div> <q-popup-proxy cover transition-show="scale" transition-hide="scale">
<q-date
<div class="col-12 col-sm-6"> v-model="dateTo"
<q-input mask="YYYY-MM-DD"
v-model="dateTo" locale="tr-TR"
label="Tarih aralığı - bitiş" :options="isValidToDate"
filled clearable readonly />
> </q-popup-proxy>
<template #append> </q-icon>
<q-icon name="event" class="cursor-pointer"> </template>
<q-popup-proxy cover transition-show="scale" transition-hide="scale"> </q-input>
<q-date </div>
v-model="dateTo" <div class="col-12 col-sm-6 col-md-2">
mask="YYYY-MM-DD"
locale="tr-TR"
:options="isValidToDate"
/>
</q-popup-proxy>
</q-icon>
</template>
</q-input>
</div>
</div>
<!-- Parasal İşlem Tipi -->
<q-select <q-select
v-model="selectedMonType" v-model="selectedMonType"
:options="monetaryTypeOptions" :options="monetaryTypeOptions"
@@ -89,31 +77,16 @@
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 class="col-auto">
<q-btn
flat
color="grey-8"
icon="restart_alt"
label="Sıfırla"
@click="resetFilters"
/>
</div>
</div>
</div> </div>
</q-slide-transition> <div class="col-auto">
<q-btn color="primary" icon="filter_alt" label="Filtrele" @click="onFilterClick" />
</div>
<div class="col-auto">
<q-btn flat color="grey-8" icon="restart_alt" label="Sıfırla" @click="resetFilters" />
</div>
</div>
</div> </div>
<!-- Tablo Alanı --> <!-- Tablo Alanı -->
@@ -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 {