Forráskód Böngészése

Fixes to ALV-laskenta and mixed content.

svalavuo 11 órája
szülő
commit
a492f4d560

+ 1 - 1
backend/.env.local

@@ -27,7 +27,7 @@ ALLOWED_FILE_TYPES=pdf,doc,docx,xls,xlsx,jpg,jpeg,png,gif
 UPLOADS_PATH=./uploads
 
 # Frontend Configuration
-VUE_APP_API_URL=http://localhost:8080
+VUE_APP_API_URL=/api
 
 # Optional: Redis Configuration
 REDIS_HOST=localhost

+ 21 - 2
backend/api/alv_laskenta.php

@@ -306,7 +306,7 @@ function generateMonthlyVATSummary($conn, $dateConditions) {
     $start = new DateTime($dateConditions['start_date']);
     $end = new DateTime($dateConditions['end_date']);
     $interval = new DateInterval('P1M');
-    $period = new DatePeriod($start, $interval, $end->modify('+1 month'));
+    $period = new DatePeriod($start, $interval, $end->modify('last day of this month'));
     
     foreach ($period as $month) {
         $monthStart = $month->format('Y-m-01');
@@ -332,9 +332,28 @@ function generateMonthlyVATSummary($conn, $dateConditions) {
         $vatBreakdown = calculateVATBreakdown($entries);
         $totals = calculateVATTotals($vatBreakdown);
         
+        // Finnish month names
+        $finnishMonths = [
+            'January' => 'Tammikuu',
+            'February' => 'Helmikuu',
+            'March' => 'Maaliskuu',
+            'April' => 'Huhtikuu',
+            'May' => 'Toukokuu',
+            'June' => 'Kesäkuu',
+            'July' => 'Heinäkuu',
+            'August' => 'Elokuu',
+            'September' => 'Syyskuu',
+            'October' => 'Lokakuu',
+            'November' => 'Marraskuu',
+            'December' => 'Joulukuu'
+        ];
+        
+        $englishMonthName = $month->format('F');
+        $finnishMonthName = $finnishMonths[$englishMonthName] ?? $englishMonthName;
+        
         $monthlySummary[] = [
             'month' => $month->format('Y-m'),
-            'month_name' => $month->format('F Y'),
+            'month_name' => $finnishMonthName . ' ' . $month->format('Y'),
             'payable' => $totals['payable_vat'] ?? 0,
             'deductible' => $totals['deductible_vat'] ?? 0,
             'net' => $totals['net_vat'] ?? 0,

+ 2 - 3
backend/models/Attachment.php

@@ -137,9 +137,8 @@ class Attachment {
             $this->mime_type = $file['type'];
 
             if ($this->create()) {
-                $baseUrl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]";
-                $apiPath = dirname($_SERVER['PHP_SELF']);
-                $fullUrl = $baseUrl . '/uploads/' . $uniqueFileName;
+                // Use relative URL to avoid mixed content warnings
+                $fullUrl = '/uploads/' . $uniqueFileName;
                 
                 return ['success' => true, 'url' => $fullUrl, 'id' => $this->conn->lastInsertId()];
             } else {

+ 5 - 0
frontend/nginx.conf

@@ -20,6 +20,11 @@ server {
         # Use resolver for Docker DNS
         resolver 127.0.0.11 valid=30s;
         set $backend_endpoint http://backend:80;
+        
+        # Use HTTPS for backend if frontend is HTTPS
+        if ($scheme = https) {
+            set $backend_endpoint http://backend:80;
+        }
         proxy_pass $backend_endpoint;
         proxy_set_header Host $host;
         proxy_set_header X-Real-IP $remote_addr;

+ 7 - 1
frontend/src/components/accounting/ALVLaskentaSection.vue

@@ -323,7 +323,13 @@ export default {
         case 'month':
           return `Kuukausi: ${this.formatMonth(this.selectedMonth)}`
         case 'quarter':
-          return `Neljännes: ${this.selectedYear}`
+          const quarterNames = {
+            1: 'Q1 (Tammi-Maaliskuu)',
+            2: 'Q2 (Huhti-Kesäkuu)', 
+            3: 'Q3 (Heinä-Syyskuu)',
+            4: 'Q4 (Loka-Joulukuu)'
+          }
+          return `Neljännes: ${quarterNames[this.selectedQuarter]} ${this.selectedYear}`
         case 'year':
           return `Vuosi: ${this.selectedYear}`
         default: