Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -64,33 +64,13 @@
|
||||
:label="filtersCollapsed ? 'Filtreleri Genişlet' : 'Filtreleri Daralt'"
|
||||
@click="toggleFiltersCollapsed"
|
||||
/>
|
||||
<q-btn-dropdown
|
||||
<q-btn
|
||||
v-if="canExportFinance"
|
||||
flat
|
||||
color="red"
|
||||
icon="picture_as_pdf"
|
||||
label="Yazdır"
|
||||
>
|
||||
<q-list style="min-width: 240px">
|
||||
<q-item clickable v-close-popup @click="downloadAgingBalancePDF(true)">
|
||||
<q-item-section class="text-primary">
|
||||
Detaylı Cari Yaşlandırmalı Bakiye Listesi Yazdır
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-item clickable v-close-popup @click="downloadAgingBalancePDF(false)">
|
||||
<q-item-section class="text-secondary">
|
||||
Detaysız Cari Yaşlandırmalı Bakiye Listesi Yazdır
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-btn-dropdown>
|
||||
<q-btn
|
||||
v-if="canExportFinance"
|
||||
flat
|
||||
color="green-8"
|
||||
icon="table_view"
|
||||
label="Excel"
|
||||
@click="downloadAgingBalanceExcel"
|
||||
label="PDF Yazdır"
|
||||
@click="downloadAgingScreenPDF"
|
||||
/>
|
||||
<q-btn
|
||||
flat
|
||||
@@ -155,6 +135,7 @@
|
||||
<div class="cgh-cell cgh-num">Toplam USD</div>
|
||||
<div class="cgh-cell cgh-num">Normal</div>
|
||||
<div class="cgh-cell cgh-num">Açık Kalem</div>
|
||||
<div class="cgh-cell cgh-num">Kur</div>
|
||||
<div class="cgh-cell cgh-center">Ort. Gün</div>
|
||||
<div class="cgh-cell cgh-center">Ort. Gün (DocDate)</div>
|
||||
</div>
|
||||
@@ -180,6 +161,7 @@
|
||||
<div class="cgh-cell cgh-num">{{ formatAmount(currRow.toplam_usd) }}</div>
|
||||
<div class="cgh-cell cgh-num">{{ formatAmount(currRow.normal_tutar) }}</div>
|
||||
<div class="cgh-cell cgh-num">{{ formatAmount(currRow.acik_kalem_tutar) }}</div>
|
||||
<div class="cgh-cell cgh-num">{{ formatAmount(currRow.kur) }}</div>
|
||||
<div class="cgh-cell cgh-center">{{ formatAmount(currRow.ortalama_gun, 0) }}</div>
|
||||
<div class="cgh-cell cgh-center">{{ formatAmount(currRow.ortalama_gun_docdate, 0) }}</div>
|
||||
</div>
|
||||
@@ -204,6 +186,9 @@
|
||||
<template #body-cell-usd_tutar="d">
|
||||
<q-td :props="d" class="text-right">{{ formatAmount(d.row.usd_tutar) }}</q-td>
|
||||
</template>
|
||||
<template #body-cell-currency_try_rate="d">
|
||||
<q-td :props="d" class="text-right">{{ formatAmount(d.row.currency_try_rate) }}</q-td>
|
||||
</template>
|
||||
<template #body-cell-gun_sayisi="d">
|
||||
<q-td :props="d" class="text-center">{{ formatAmount(d.row.gun_sayisi, 0) }}</q-td>
|
||||
</template>
|
||||
@@ -267,7 +252,8 @@ const masterColumns = [
|
||||
{ name: 'normal_usd', label: 'Normal USD', field: 'normal_usd', align: 'right', sortable: true },
|
||||
{ name: 'acik_kalem_usd', label: 'Açık Kalem USD', field: 'acik_kalem_usd', align: 'right', sortable: true },
|
||||
{ name: 'ortalama_gun', label: 'Ort. Gün', field: 'ortalama_gun', align: 'center', sortable: true },
|
||||
{ name: 'ortalama_gun_docdate', label: 'Ort. Gün (DocDate)', field: 'ortalama_gun_docdate', align: 'center', sortable: true }
|
||||
{ name: 'ortalama_gun_docdate', label: 'Ort. Gün (DocDate)', field: 'ortalama_gun_docdate', align: 'center', sortable: true },
|
||||
{ name: 'kur', label: 'Kur', field: 'kur', align: 'right', sortable: true }
|
||||
]
|
||||
|
||||
const detailColumns = [
|
||||
@@ -280,13 +266,14 @@ const detailColumns = [
|
||||
{ name: 'odeme_doc_date', label: 'Ödeme DocDate', field: 'odeme_doc_date', align: 'left' },
|
||||
{ name: 'eslesen_tutar', label: 'Eşleşen Tutar', field: 'eslesen_tutar', align: 'right' },
|
||||
{ name: 'usd_tutar', label: 'USD Tutar', field: 'usd_tutar', align: 'right' },
|
||||
{ name: 'currency_try_rate', label: 'Kur', field: 'currency_try_rate', align: 'right' },
|
||||
{ name: 'gun_sayisi', label: 'Gün', field: 'gun_sayisi', align: 'center' },
|
||||
{ name: 'gun_sayisi_docdate', label: 'Gün (DocDate)', field: 'gun_sayisi_docdate', align: 'center' },
|
||||
{ name: 'aciklama', label: 'Açıklama', field: 'aciklama', align: 'left' },
|
||||
{ name: 'doc_currency_code', label: 'Döviz', field: 'doc_currency_code', align: 'left' }
|
||||
]
|
||||
|
||||
const masterNumericCols = ['satir_sayisi', 'toplam_usd', 'normal_usd', 'acik_kalem_usd', 'ortalama_gun', 'ortalama_gun_docdate']
|
||||
const masterNumericCols = ['satir_sayisi', 'toplam_usd', 'normal_usd', 'acik_kalem_usd', 'ortalama_gun', 'ortalama_gun_docdate', 'kur']
|
||||
const masterCenteredCols = ['ortalama_gun', 'ortalama_gun_docdate']
|
||||
|
||||
function normalizeText(str) {
|
||||
@@ -401,20 +388,19 @@ function toggleFiltersCollapsed() {
|
||||
filtersCollapsed.value = !filtersCollapsed.value
|
||||
}
|
||||
|
||||
function buildExportParams(detailed = false) {
|
||||
function buildExportParams() {
|
||||
return {
|
||||
accountcode: String(selectedCari.value || '').trim(),
|
||||
cari_search: String(selectedCari.value || '').trim(),
|
||||
enddate: dateTo.value,
|
||||
selected_date: dateTo.value,
|
||||
parislemler: selectedMonType.value,
|
||||
detailed: detailed ? '1' : '0',
|
||||
exclude_zero_12: '0',
|
||||
exclude_zero_13: '0'
|
||||
}
|
||||
}
|
||||
|
||||
async function downloadAgingBalancePDF(detailed) {
|
||||
async function downloadAgingScreenPDF() {
|
||||
if (!canExportFinance.value) {
|
||||
$q.notify({ type: 'negative', message: 'PDF export yetkiniz yok', position: 'top-right' })
|
||||
return
|
||||
@@ -425,7 +411,7 @@ async function downloadAgingBalancePDF(detailed) {
|
||||
}
|
||||
|
||||
try {
|
||||
const blob = await download('/finance/account-aging-statement/export-pdf', buildExportParams(detailed))
|
||||
const blob = await download('/finance/account-aging-statement/export-screen-pdf', buildExportParams())
|
||||
const pdfUrl = window.URL.createObjectURL(new Blob([blob], { type: 'application/pdf' }))
|
||||
window.open(pdfUrl, '_blank')
|
||||
} catch (err) {
|
||||
@@ -438,37 +424,6 @@ async function downloadAgingBalancePDF(detailed) {
|
||||
}
|
||||
}
|
||||
|
||||
async function downloadAgingBalanceExcel() {
|
||||
if (!canExportFinance.value) {
|
||||
$q.notify({ type: 'negative', message: 'Excel export yetkiniz yok', position: 'top-right' })
|
||||
return
|
||||
}
|
||||
if (!selectedCari.value || !dateTo.value) {
|
||||
$q.notify({ type: 'warning', message: 'Önce cari ve son tarih seçiniz.', position: 'top-right' })
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const file = await download('/finance/account-aging-statement/export-excel', buildExportParams(false))
|
||||
const blob = new Blob([file], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' })
|
||||
const url = window.URL.createObjectURL(blob)
|
||||
const a = document.createElement('a')
|
||||
a.href = url
|
||||
a.download = 'cari_yaslandirmali_bakiye_listesi.xlsx'
|
||||
document.body.appendChild(a)
|
||||
a.click()
|
||||
a.remove()
|
||||
window.URL.revokeObjectURL(url)
|
||||
} catch (err) {
|
||||
const detail = await extractApiErrorDetail(err?.original || err)
|
||||
$q.notify({
|
||||
type: 'negative',
|
||||
message: detail || 'Excel oluşturulamadı',
|
||||
position: 'top-right'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function formatAmount(value, fraction = 2) {
|
||||
const n = Number(value || 0)
|
||||
return new Intl.NumberFormat('tr-TR', {
|
||||
@@ -586,7 +541,7 @@ function formatAmount(value, fraction = 2) {
|
||||
top: 36px;
|
||||
z-index: 26;
|
||||
display: grid;
|
||||
grid-template-columns: 48px 100px 80px 1.2fr 1.2fr 1.1fr 1.1fr 110px 140px;
|
||||
grid-template-columns: 48px 100px 80px 1.2fr 1.2fr 1.1fr 1.1fr 100px 110px 140px;
|
||||
align-items: center;
|
||||
gap: 0;
|
||||
background: var(--q-secondary);
|
||||
@@ -601,7 +556,7 @@ function formatAmount(value, fraction = 2) {
|
||||
top: 72px;
|
||||
z-index: 24;
|
||||
display: grid;
|
||||
grid-template-columns: 48px 100px 80px 1.2fr 1.2fr 1.1fr 1.1fr 110px 140px;
|
||||
grid-template-columns: 48px 100px 80px 1.2fr 1.2fr 1.1fr 1.1fr 100px 110px 140px;
|
||||
align-items: center;
|
||||
gap: 0;
|
||||
background: #4c5f7a;
|
||||
@@ -686,7 +641,7 @@ function formatAmount(value, fraction = 2) {
|
||||
}
|
||||
|
||||
.currency-group-header {
|
||||
grid-template-columns: 44px 90px 70px 1.1fr 1.1fr 1fr 1fr 90px 120px;
|
||||
grid-template-columns: 44px 90px 70px 1.1fr 1.1fr 1fr 1fr 84px 90px 120px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -61,9 +61,11 @@ export const useStatementAgingStore = defineStore('statementAging', {
|
||||
cari8: masterKey,
|
||||
cari_detay: String(row?.cari_detay || '').trim(),
|
||||
satir_sayisi: 0,
|
||||
toplam_tutar: 0,
|
||||
toplam_usd: 0,
|
||||
normal_usd: 0,
|
||||
acik_kalem_usd: 0,
|
||||
kur: 0,
|
||||
weighted_gun_sum: 0,
|
||||
weighted_gun_doc_sum: 0,
|
||||
weighted_base: 0,
|
||||
@@ -84,6 +86,7 @@ export const useStatementAgingStore = defineStore('statementAging', {
|
||||
toplam_usd: 0,
|
||||
normal_tutar: 0,
|
||||
acik_kalem_tutar: 0,
|
||||
kur: 0,
|
||||
weighted_gun_sum: 0,
|
||||
weighted_gun_doc_sum: 0,
|
||||
weighted_base: 0,
|
||||
@@ -96,6 +99,7 @@ export const useStatementAgingStore = defineStore('statementAging', {
|
||||
const c = currencyMap[currencyKey]
|
||||
|
||||
m.satir_sayisi += 1
|
||||
m.toplam_tutar += tutar
|
||||
m.toplam_usd += usd
|
||||
if (aciklama === 'ACIKKALEM') {
|
||||
m.acik_kalem_usd += usd
|
||||
@@ -129,6 +133,7 @@ export const useStatementAgingStore = defineStore('statementAging', {
|
||||
this.masterRows = Object.values(masterMap)
|
||||
.map((m) => ({
|
||||
...m,
|
||||
kur: Math.abs(m.toplam_usd) > 0 ? (m.toplam_tutar / m.toplam_usd) : 0,
|
||||
ortalama_gun: m.weighted_base > 0 ? (m.weighted_gun_sum / m.weighted_base) : 0,
|
||||
ortalama_gun_docdate: m.weighted_base > 0 ? (m.weighted_gun_doc_sum / m.weighted_base) : 0
|
||||
}))
|
||||
@@ -138,6 +143,7 @@ export const useStatementAgingStore = defineStore('statementAging', {
|
||||
for (const c of Object.values(currencyMap)) {
|
||||
const row = {
|
||||
...c,
|
||||
kur: Math.abs(c.toplam_usd) > 0 ? (c.toplam_tutar / c.toplam_usd) : 0,
|
||||
ortalama_gun: c.weighted_base > 0 ? (c.weighted_gun_sum / c.weighted_base) : 0,
|
||||
ortalama_gun_docdate: c.weighted_base > 0 ? (c.weighted_gun_doc_sum / c.weighted_base) : 0
|
||||
}
|
||||
@@ -187,6 +193,7 @@ function normalizeRowKeys(row) {
|
||||
usd_tutar: Number(row.UsdTutar ?? row.usd_tutar ?? 0),
|
||||
gun_sayisi: Number(row.GunSayisi ?? row.gun_sayisi ?? 0),
|
||||
gun_sayisi_docdate: Number(row.GunSayisi_DocDate ?? row.gun_sayisi_docdate ?? 0),
|
||||
currency_try_rate: Number(row.CurrencyTryRate ?? row.currency_try_rate ?? 0),
|
||||
aciklama: row.Aciklama ?? row.aciklama ?? null,
|
||||
doc_currency_code: row.DocCurrencyCode ?? row.doc_currency_code ?? null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user