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
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"}
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
}
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() {
pdf.SetFont("dejavu", "B", 7.5)
pdf.SetFillColor(149, 113, 22)
@@ -301,12 +339,7 @@ func drawCustomerBalancePDF(
pdf.SetFont("dejavu", "", 7.2)
pdf.SetTextColor(20, 20, 20)
for _, s := range summaries {
if needPage(6.2) {
header()
drawSummaryHeader()
}
drawSummaryRow := func(s balanceSummaryPDF) {
row := []string{
s.AnaCariKodu,
s.AnaCariAdi,
@@ -320,30 +353,46 @@ func drawCustomerBalancePDF(
formatMoneyPDF(s.USDBakiye13),
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()
x := marginL
for i, v := range row {
pdf.Rect(x, y, summaryW[i], 6.2, "")
pdf.Rect(x, y, summaryW[i], rowH, "")
align := "L"
if i >= 7 {
align = "R"
}
pdf.SetXY(x+1, y+1)
pdf.CellFormat(summaryW[i]-2, 4.2, v, "", 0, align, false, 0, "")
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, "")
}
x += summaryW[i]
}
pdf.SetY(y + 6.2)
pdf.SetY(y + rowH)
}
if !detailed {
for _, s := range summaries {
drawSummaryRow(s)
}
return
}
pdf.Ln(1.8)
for _, s := range summaries {
drawSummaryRow(s)
pdf.Ln(1.2)
rows := detailsByMaster[s.AnaCariKodu]
if len(rows) == 0 {
pdf.Ln(1.0)
continue
}

View File

@@ -1,6 +1,6 @@
<template>
<q-page v-if="canReadFinance" class="q-px-md q-pb-md q-pt-xs page-col statement-page">
<div class="filter-sticky compact-filter q-pa-sm q-mb-xs">
<q-page v-if="canReadFinance" class="q-px-md q-pb-md page-col statement-page">
<div class="local-filter-bar compact-filter q-pa-sm q-mb-xs">
<div class="row q-col-gutter-sm items-end">
<div class="col-12 col-md-5">
<q-select
@@ -55,23 +55,6 @@
<div class="table-scroll">
<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
flat
color="secondary"
@@ -96,6 +79,16 @@
:loading="agingStore.loading"
: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">
<q-tr :props="props" class="header-row">
<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;
flex-direction: column;
overflow: hidden;
margin-top: 0 !important;
padding-top: 56px !important;
}
.table-scroll {
@@ -456,6 +451,14 @@ async function downloadAgingPDF () {
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 {
border: 1px solid rgba(0, 0, 0, 0.12);
border-radius: 8px;

View File

@@ -1,87 +1,75 @@
<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="filter-sticky">
<q-select
v-model="selectedCari"
:options="filteredOptions"
label="Cari kod / isim"
filled
clearable
use-input
input-debounce="300"
@filter="filterCari"
emit-value
map-options
:loading="accountStore.loading"
option-value="value"
option-label="label"
behavior="menu"
:keep-selected="true"
/>
</div>
<!-- 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
v-model="dateFrom"
label="Tarih aralığı - başlangıç"
filled clearable readonly
>
<template #append>
<q-icon name="event" class="cursor-pointer">
<q-popup-proxy cover transition-show="scale" transition-hide="scale">
<q-date
v-model="dateFrom"
mask="YYYY-MM-DD"
locale="tr-TR"
:options="isValidFromDate"
/>
</q-popup-proxy>
</q-icon>
</template>
</q-input>
</div>
<div class="col-12 col-sm-6">
<q-input
v-model="dateTo"
label="Tarih aralığı - bitiş"
filled clearable readonly
>
<template #append>
<q-icon name="event" class="cursor-pointer">
<q-popup-proxy cover transition-show="scale" transition-hide="scale">
<q-date
v-model="dateTo"
mask="YYYY-MM-DD"
locale="tr-TR"
:options="isValidToDate"
/>
</q-popup-proxy>
</q-icon>
</template>
</q-input>
</div>
</div>
<!-- Parasal İşlem Tipi -->
<div class="local-filter-bar compact-filter q-pa-sm q-mb-xs">
<div class="row q-col-gutter-sm items-end">
<div class="col-12 col-md-4">
<q-select
v-model="selectedCari"
:options="filteredOptions"
label="Cari kod / isim"
filled
dense
clearable
use-input
input-debounce="300"
@filter="filterCari"
emit-value
map-options
:loading="accountStore.loading"
option-value="value"
option-label="label"
behavior="menu"
:keep-selected="true"
/>
</div>
<div class="col-12 col-sm-6 col-md-2">
<q-input
v-model="dateFrom"
label="Tarih aralığı - başlangıç"
filled
dense
clearable
readonly
>
<template #append>
<q-icon name="event" class="cursor-pointer">
<q-popup-proxy cover transition-show="scale" transition-hide="scale">
<q-date
v-model="dateFrom"
mask="YYYY-MM-DD"
locale="tr-TR"
:options="isValidFromDate"
/>
</q-popup-proxy>
</q-icon>
</template>
</q-input>
</div>
<div class="col-12 col-sm-6 col-md-2">
<q-input
v-model="dateTo"
label="Tarih aralığı - bitiş"
filled
dense
clearable
readonly
>
<template #append>
<q-icon name="event" class="cursor-pointer">
<q-popup-proxy cover transition-show="scale" transition-hide="scale">
<q-date
v-model="dateTo"
mask="YYYY-MM-DD"
locale="tr-TR"
:options="isValidToDate"
/>
</q-popup-proxy>
</q-icon>
</template>
</q-input>
</div>
<div class="col-12 col-sm-6 col-md-2">
<q-select
v-model="selectedMonType"
:options="monetaryTypeOptions"
@@ -89,31 +77,16 @@
emit-value
map-options
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>
</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>
<!-- Tablo Alanı -->
@@ -478,8 +451,6 @@ function formatAmount(n) {
}).format(n)
}
const filtersOpen = ref(true)
/* Kolon gizle/göster */
const visibleColumns = ref([])
const showLeftCols = ref(true)
@@ -599,6 +570,22 @@ async function CurrheadDownload() {
display: flex;
flex-direction: column;
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 {