diff --git a/ui/src/pages/ProductionProductCostingHasCost.vue b/ui/src/pages/ProductionProductCostingHasCost.vue
index b33c7eb..6fdaeb8 100644
--- a/ui/src/pages/ProductionProductCostingHasCost.vue
+++ b/ui/src/pages/ProductionProductCostingHasCost.vue
@@ -40,6 +40,14 @@
:loading="loading"
@click="fetchRows"
/>
+
@@ -374,6 +382,38 @@ function clearFilters () {
fetchRows()
}
+function escapeExcelCsvCell (value) {
+ let text = String(value ?? '')
+ // Prevent spreadsheet applications from evaluating data as a formula.
+ if (/^[=+\-@]/.test(text)) text = `'${text}`
+ return `"${text.replace(/"/g, '""')}"`
+}
+
+function exportVisibleRows () {
+ const visibleRows = Array.isArray(rows.value) ? rows.value : []
+ if (visibleRows.length === 0) return
+
+ const exportColumns = columns.filter(col => col.name !== 'open')
+ const csvLines = [
+ exportColumns.map(col => escapeExcelCsvCell(col.label)).join(';'),
+ ...visibleRows.map(row => exportColumns.map(col => {
+ const rawValue = typeof col.field === 'function' ? col.field(row) : row?.[col.field]
+ const displayValue = typeof col.format === 'function' ? col.format(rawValue, row) : rawValue
+ return escapeExcelCsvCell(displayValue)
+ }).join(';'))
+ ]
+
+ const blob = new Blob([`\uFEFF${csvLines.join('\r\n')}`], { type: 'text/csv;charset=utf-8;' })
+ const url = URL.createObjectURL(blob)
+ const link = document.createElement('a')
+ link.href = url
+ link.download = `mevcut_maliyetli_urunler_${new Date().toISOString().slice(0, 10)}.csv`
+ document.body.appendChild(link)
+ link.click()
+ link.remove()
+ URL.revokeObjectURL(url)
+}
+
function openRow (row) {
const urunKodu = String(row?.UrunKodu || '').trim()
if (!urunKodu) return
diff --git a/ui/src/pages/ProductionProductCostingNoCost.vue b/ui/src/pages/ProductionProductCostingNoCost.vue
index be3ae5e..7bdc7fe 100644
--- a/ui/src/pages/ProductionProductCostingNoCost.vue
+++ b/ui/src/pages/ProductionProductCostingNoCost.vue
@@ -49,6 +49,14 @@
:loading="loading"
@click="fetchRows"
/>
+
Maliyeti Girilmemis Satir Sayisi: {{ missingCostRowCount }}
@@ -461,6 +469,41 @@ function clearFilters () {
fetchRows()
}
+function escapeExcelCsvCell (value) {
+ let text = String(value ?? '')
+ // Prevent spreadsheet applications from evaluating data as a formula.
+ if (/^[=+\-@]/.test(text)) text = `'${text}`
+ return `"${text.replace(/"/g, '""')}"`
+}
+
+function exportVisibleRows () {
+ const visibleRows = Array.isArray(rows.value) ? rows.value : []
+ if (visibleRows.length === 0) {
+ $q.notify({ type: 'warning', message: 'Excel aktarimi icin ekranda satir bulunamadi.', position: 'top-right' })
+ return
+ }
+
+ const exportColumns = columns.filter(col => col.name !== 'open')
+ const csvLines = [
+ exportColumns.map(col => escapeExcelCsvCell(col.label)).join(';'),
+ ...visibleRows.map(row => exportColumns.map(col => {
+ const rawValue = typeof col.field === 'function' ? col.field(row) : row?.[col.field]
+ const displayValue = typeof col.format === 'function' ? col.format(rawValue, row) : rawValue
+ return escapeExcelCsvCell(displayValue)
+ }).join(';'))
+ ]
+
+ const blob = new Blob([`\uFEFF${csvLines.join('\r\n')}`], { type: 'text/csv;charset=utf-8;' })
+ const url = URL.createObjectURL(blob)
+ const link = document.createElement('a')
+ link.href = url
+ link.download = `maliyeti_olmayan_urunler_${new Date().toISOString().slice(0, 10)}.csv`
+ document.body.appendChild(link)
+ link.click()
+ link.remove()
+ URL.revokeObjectURL(url)
+}
+
function openRow (row) {
const productCode = String(row?.sMModelKodu || '').trim()
const recipeCode = String(row?.sKodu || '').trim()