Andrew Wallo 1 年之前
父節點
當前提交
1f53d5607e

+ 1
- 0
app/DTO/ReportDTO.php 查看文件

11
         public array $categories,
11
         public array $categories,
12
         public ?AccountBalanceDTO $overallTotal = null,
12
         public ?AccountBalanceDTO $overallTotal = null,
13
         public array $fields = [],
13
         public array $fields = [],
14
+        public ?string $reportType = null,
14
     ) {}
15
     ) {}
15
 }
16
 }

+ 2
- 2
app/Filament/Company/Pages/Reports/TrialBalance.php 查看文件

90
 
90
 
91
     public function exportCSV(): StreamedResponse
91
     public function exportCSV(): StreamedResponse
92
     {
92
     {
93
-        return $this->exportService->exportToCsv($this->company, $this->report, $this->getFilterState('startDate'), $this->getFilterState('endDate'));
93
+        return $this->exportService->exportToCsv($this->company, $this->report, endDate: $this->getFilterState('asOfDate'));
94
     }
94
     }
95
 
95
 
96
     public function exportPDF(): StreamedResponse
96
     public function exportPDF(): StreamedResponse
97
     {
97
     {
98
-        return $this->exportService->exportToPdf($this->company, $this->report, $this->getFilterState('startDate'), $this->getFilterState('endDate'));
98
+        return $this->exportService->exportToPdf($this->company, $this->report, endDate: $this->getFilterState('asOfDate'));
99
     }
99
     }
100
 }
100
 }

+ 30
- 13
app/Services/ExportService.php 查看文件

12
 
12
 
13
 class ExportService
13
 class ExportService
14
 {
14
 {
15
-    public function exportToCsv(Company $company, ExportableReport $report, string $startDate, string $endDate): StreamedResponse
15
+    public function exportToCsv(Company $company, ExportableReport $report, ?string $startDate = null, ?string $endDate = null): StreamedResponse
16
     {
16
     {
17
-        $formattedStartDate = Carbon::parse($startDate)->toDateString();
18
-        $formattedEndDate = Carbon::parse($endDate)->toDateString();
17
+        if ($startDate && $endDate) {
18
+            $formattedStartDate = Carbon::parse($startDate)->toDateString();
19
+            $formattedEndDate = Carbon::parse($endDate)->toDateString();
20
+            $dateLabel = $formattedStartDate . ' to ' . $formattedEndDate;
21
+        } else {
22
+            $formattedAsOfDate = Carbon::parse($endDate)->toDateString();
23
+            $dateLabel = $formattedAsOfDate;
24
+        }
19
 
25
 
20
         $timestamp = Carbon::now()->format('Y-m-d_H-i-s');
26
         $timestamp = Carbon::now()->format('Y-m-d_H-i-s');
21
 
27
 
22
-        $filename = $company->name . ' ' . $report->getTitle() . ' ' . $formattedStartDate . ' to ' . $formattedEndDate . ' ' . $timestamp . '.csv';
28
+        $filename = $company->name . ' ' . $report->getTitle() . ' ' . $dateLabel . ' ' . $timestamp . '.csv';
23
 
29
 
24
         $headers = [
30
         $headers = [
25
             'Content-Type' => 'text/csv',
31
             'Content-Type' => 'text/csv',
29
         $callback = function () use ($startDate, $endDate, $report, $company) {
35
         $callback = function () use ($startDate, $endDate, $report, $company) {
30
             $file = fopen('php://output', 'wb');
36
             $file = fopen('php://output', 'wb');
31
 
37
 
32
-            $defaultStartDateFormat = Carbon::parse($startDate)->toDefaultDateFormat();
33
-            $defaultEndDateFormat = Carbon::parse($endDate)->toDefaultDateFormat();
38
+            if ($startDate && $endDate) {
39
+                $defaultStartDateFormat = Carbon::parse($startDate)->toDefaultDateFormat();
40
+                $defaultEndDateFormat = Carbon::parse($endDate)->toDefaultDateFormat();
41
+                $dateLabel = 'Date Range: ' . $defaultStartDateFormat . ' to ' . $defaultEndDateFormat;
42
+            } else {
43
+                $dateLabel = 'As of ' . Carbon::parse($endDate)->toDefaultDateFormat();
44
+            }
34
 
45
 
35
             fputcsv($file, [$report->getTitle()]);
46
             fputcsv($file, [$report->getTitle()]);
36
             fputcsv($file, [$company->name]);
47
             fputcsv($file, [$company->name]);
37
-            fputcsv($file, ['Date Range: ' . $defaultStartDateFormat . ' to ' . $defaultEndDateFormat]);
48
+            fputcsv($file, [$dateLabel]);
38
             fputcsv($file, []);
49
             fputcsv($file, []);
39
 
50
 
40
             fputcsv($file, $report->getHeaders());
51
             fputcsv($file, $report->getHeaders());
92
         return response()->streamDownload($callback, $filename, $headers);
103
         return response()->streamDownload($callback, $filename, $headers);
93
     }
104
     }
94
 
105
 
95
-    public function exportToPdf(Company $company, ExportableReport $report, string $startDate, string $endDate): StreamedResponse
106
+    public function exportToPdf(Company $company, ExportableReport $report, ?string $startDate = null, ?string $endDate = null): StreamedResponse
96
     {
107
     {
97
-        $formattedStartDate = Carbon::parse($startDate)->toDateString();
98
-        $formattedEndDate = Carbon::parse($endDate)->toDateString();
108
+        if ($startDate && $endDate) {
109
+            $formattedStartDate = Carbon::parse($startDate)->toDateString();
110
+            $formattedEndDate = Carbon::parse($endDate)->toDateString();
111
+            $dateLabel = $formattedStartDate . ' to ' . $formattedEndDate;
112
+        } else {
113
+            $formattedAsOfDate = Carbon::parse($endDate)->toDateString();
114
+            $dateLabel = $formattedAsOfDate;
115
+        }
99
 
116
 
100
         $timestamp = Carbon::now()->format('Y-m-d_H-i-s');
117
         $timestamp = Carbon::now()->format('Y-m-d_H-i-s');
101
 
118
 
102
-        $filename = $company->name . ' ' . $report->getTitle() . ' ' . $formattedStartDate . ' to ' . $formattedEndDate . ' ' . $timestamp . '.pdf';
119
+        $filename = $company->name . ' ' . $report->getTitle() . ' ' . $dateLabel . ' ' . $timestamp . '.pdf';
103
 
120
 
104
         $pdf = SnappyPdf::loadView($report->getPdfView(), [
121
         $pdf = SnappyPdf::loadView($report->getPdfView(), [
105
             'company' => $company,
122
             'company' => $company,
106
             'report' => $report,
123
             'report' => $report,
107
-            'startDate' => Carbon::parse($startDate)->toDefaultDateFormat(),
108
-            'endDate' => Carbon::parse($endDate)->toDefaultDateFormat(),
124
+            'startDate' => $startDate ? Carbon::parse($startDate)->toDefaultDateFormat() : null,
125
+            'endDate' => $endDate ? Carbon::parse($endDate)->toDefaultDateFormat() : null,
109
         ]);
126
         ]);
110
 
127
 
111
         return response()->streamDownload(function () use ($pdf) {
128
         return response()->streamDownload(function () use ($pdf) {

+ 1
- 1
app/Services/ReportService.php 查看文件

312
 
312
 
313
         $formattedReportTotalBalances = $this->formatBalances($reportTotalBalances);
313
         $formattedReportTotalBalances = $this->formatBalances($reportTotalBalances);
314
 
314
 
315
-        return new ReportDTO($accountCategories, $formattedReportTotalBalances, $columns);
315
+        return new ReportDTO($accountCategories, $formattedReportTotalBalances, $columns, $trialBalanceType);
316
     }
316
     }
317
 
317
 
318
     public function getRetainedEarningsBalances(string $startDate, string $endDate): AccountBalanceDTO
318
     public function getRetainedEarningsBalances(string $startDate, string $endDate): AccountBalanceDTO

+ 4
- 1
app/Transformers/TrialBalanceReportTransformer.php 查看文件

10
 {
10
 {
11
     public function getTitle(): string
11
     public function getTitle(): string
12
     {
12
     {
13
-        return 'Trial Balance';
13
+        return match ($this->report->reportType) {
14
+            'postClosing' => 'Post-Closing Trial Balance',
15
+            default => 'Standard Trial Balance',
16
+        };
14
     }
17
     }
15
 
18
 
16
     public function getHeaders(): array
19
     public function getHeaders(): array

+ 24
- 24
composer.lock 查看文件

497
         },
497
         },
498
         {
498
         {
499
             "name": "aws/aws-sdk-php",
499
             "name": "aws/aws-sdk-php",
500
-            "version": "3.322.7",
500
+            "version": "3.322.8",
501
             "source": {
501
             "source": {
502
                 "type": "git",
502
                 "type": "git",
503
                 "url": "https://github.com/aws/aws-sdk-php.git",
503
                 "url": "https://github.com/aws/aws-sdk-php.git",
504
-                "reference": "ea3563a7f10fa562796f712fa306c1dca41a45d7"
504
+                "reference": "fb5099160e49b676277ae787ff721628e5e4dd5a"
505
             },
505
             },
506
             "dist": {
506
             "dist": {
507
                 "type": "zip",
507
                 "type": "zip",
508
-                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/ea3563a7f10fa562796f712fa306c1dca41a45d7",
509
-                "reference": "ea3563a7f10fa562796f712fa306c1dca41a45d7",
508
+                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/fb5099160e49b676277ae787ff721628e5e4dd5a",
509
+                "reference": "fb5099160e49b676277ae787ff721628e5e4dd5a",
510
                 "shasum": ""
510
                 "shasum": ""
511
             },
511
             },
512
             "require": {
512
             "require": {
589
             "support": {
589
             "support": {
590
                 "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
590
                 "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
591
                 "issues": "https://github.com/aws/aws-sdk-php/issues",
591
                 "issues": "https://github.com/aws/aws-sdk-php/issues",
592
-                "source": "https://github.com/aws/aws-sdk-php/tree/3.322.7"
592
+                "source": "https://github.com/aws/aws-sdk-php/tree/3.322.8"
593
             },
593
             },
594
-            "time": "2024-09-27T18:34:08+00:00"
594
+            "time": "2024-09-30T19:09:25+00:00"
595
         },
595
         },
596
         {
596
         {
597
             "name": "aws/aws-sdk-php-laravel",
597
             "name": "aws/aws-sdk-php-laravel",
3709
         },
3709
         },
3710
         {
3710
         {
3711
             "name": "league/flysystem",
3711
             "name": "league/flysystem",
3712
-            "version": "3.28.0",
3712
+            "version": "3.29.0",
3713
             "source": {
3713
             "source": {
3714
                 "type": "git",
3714
                 "type": "git",
3715
                 "url": "https://github.com/thephpleague/flysystem.git",
3715
                 "url": "https://github.com/thephpleague/flysystem.git",
3716
-                "reference": "e611adab2b1ae2e3072fa72d62c62f52c2bf1f0c"
3716
+                "reference": "0adc0d9a51852e170e0028a60bd271726626d3f0"
3717
             },
3717
             },
3718
             "dist": {
3718
             "dist": {
3719
                 "type": "zip",
3719
                 "type": "zip",
3720
-                "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/e611adab2b1ae2e3072fa72d62c62f52c2bf1f0c",
3721
-                "reference": "e611adab2b1ae2e3072fa72d62c62f52c2bf1f0c",
3720
+                "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/0adc0d9a51852e170e0028a60bd271726626d3f0",
3721
+                "reference": "0adc0d9a51852e170e0028a60bd271726626d3f0",
3722
                 "shasum": ""
3722
                 "shasum": ""
3723
             },
3723
             },
3724
             "require": {
3724
             "require": {
3786
             ],
3786
             ],
3787
             "support": {
3787
             "support": {
3788
                 "issues": "https://github.com/thephpleague/flysystem/issues",
3788
                 "issues": "https://github.com/thephpleague/flysystem/issues",
3789
-                "source": "https://github.com/thephpleague/flysystem/tree/3.28.0"
3789
+                "source": "https://github.com/thephpleague/flysystem/tree/3.29.0"
3790
             },
3790
             },
3791
-            "time": "2024-05-22T10:09:12+00:00"
3791
+            "time": "2024-09-29T11:59:11+00:00"
3792
         },
3792
         },
3793
         {
3793
         {
3794
             "name": "league/flysystem-local",
3794
             "name": "league/flysystem-local",
3795
-            "version": "3.28.0",
3795
+            "version": "3.29.0",
3796
             "source": {
3796
             "source": {
3797
                 "type": "git",
3797
                 "type": "git",
3798
                 "url": "https://github.com/thephpleague/flysystem-local.git",
3798
                 "url": "https://github.com/thephpleague/flysystem-local.git",
3799
-                "reference": "13f22ea8be526ea58c2ddff9e158ef7c296e4f40"
3799
+                "reference": "e0e8d52ce4b2ed154148453d321e97c8e931bd27"
3800
             },
3800
             },
3801
             "dist": {
3801
             "dist": {
3802
                 "type": "zip",
3802
                 "type": "zip",
3803
-                "url": "https://api.github.com/repos/thephpleague/flysystem-local/zipball/13f22ea8be526ea58c2ddff9e158ef7c296e4f40",
3804
-                "reference": "13f22ea8be526ea58c2ddff9e158ef7c296e4f40",
3803
+                "url": "https://api.github.com/repos/thephpleague/flysystem-local/zipball/e0e8d52ce4b2ed154148453d321e97c8e931bd27",
3804
+                "reference": "e0e8d52ce4b2ed154148453d321e97c8e931bd27",
3805
                 "shasum": ""
3805
                 "shasum": ""
3806
             },
3806
             },
3807
             "require": {
3807
             "require": {
3835
                 "local"
3835
                 "local"
3836
             ],
3836
             ],
3837
             "support": {
3837
             "support": {
3838
-                "source": "https://github.com/thephpleague/flysystem-local/tree/3.28.0"
3838
+                "source": "https://github.com/thephpleague/flysystem-local/tree/3.29.0"
3839
             },
3839
             },
3840
-            "time": "2024-05-06T20:05:52+00:00"
3840
+            "time": "2024-08-09T21:24:39+00:00"
3841
         },
3841
         },
3842
         {
3842
         {
3843
             "name": "league/mime-type-detection",
3843
             "name": "league/mime-type-detection",
4834
         },
4834
         },
4835
         {
4835
         {
4836
             "name": "nikic/php-parser",
4836
             "name": "nikic/php-parser",
4837
-            "version": "v5.2.0",
4837
+            "version": "v5.3.0",
4838
             "source": {
4838
             "source": {
4839
                 "type": "git",
4839
                 "type": "git",
4840
                 "url": "https://github.com/nikic/PHP-Parser.git",
4840
                 "url": "https://github.com/nikic/PHP-Parser.git",
4841
-                "reference": "23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb"
4841
+                "reference": "3abf7425cd284141dc5d8d14a9ee444de3345d1a"
4842
             },
4842
             },
4843
             "dist": {
4843
             "dist": {
4844
                 "type": "zip",
4844
                 "type": "zip",
4845
-                "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb",
4846
-                "reference": "23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb",
4845
+                "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/3abf7425cd284141dc5d8d14a9ee444de3345d1a",
4846
+                "reference": "3abf7425cd284141dc5d8d14a9ee444de3345d1a",
4847
                 "shasum": ""
4847
                 "shasum": ""
4848
             },
4848
             },
4849
             "require": {
4849
             "require": {
4886
             ],
4886
             ],
4887
             "support": {
4887
             "support": {
4888
                 "issues": "https://github.com/nikic/PHP-Parser/issues",
4888
                 "issues": "https://github.com/nikic/PHP-Parser/issues",
4889
-                "source": "https://github.com/nikic/PHP-Parser/tree/v5.2.0"
4889
+                "source": "https://github.com/nikic/PHP-Parser/tree/v5.3.0"
4890
             },
4890
             },
4891
-            "time": "2024-09-15T16:40:33+00:00"
4891
+            "time": "2024-09-29T13:56:26+00:00"
4892
         },
4892
         },
4893
         {
4893
         {
4894
             "name": "nunomaduro/termwind",
4894
             "name": "nunomaduro/termwind",

+ 3
- 3
package-lock.json 查看文件

1159
             "license": "MIT"
1159
             "license": "MIT"
1160
         },
1160
         },
1161
         "node_modules/electron-to-chromium": {
1161
         "node_modules/electron-to-chromium": {
1162
-            "version": "1.5.29",
1163
-            "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.29.tgz",
1164
-            "integrity": "sha512-PF8n2AlIhCKXQ+gTpiJi0VhcHDb69kYX4MtCiivctc2QD3XuNZ/XIOlbGzt7WAjjEev0TtaH6Cu3arZExm5DOw==",
1162
+            "version": "1.5.30",
1163
+            "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.30.tgz",
1164
+            "integrity": "sha512-sXI35EBN4lYxzc/pIGorlymYNzDBOqkSlVRe6MkgBsW/hW1tpC/HDJ2fjG7XnjakzfLEuvdmux0Mjs6jHq4UOA==",
1165
             "dev": true,
1165
             "dev": true,
1166
             "license": "ISC"
1166
             "license": "ISC"
1167
         },
1167
         },

+ 19
- 8
resources/js/TopNavigation.js 查看文件

1
 document.addEventListener('DOMContentLoaded', () => {
1
 document.addEventListener('DOMContentLoaded', () => {
2
     handleTopbarAndSidebarHover();
2
     handleTopbarAndSidebarHover();
3
-
4
     handleScroll();
3
     handleScroll();
5
 });
4
 });
6
 
5
 
10
 
9
 
11
     const addHoveredClass = () => {
10
     const addHoveredClass = () => {
12
         topbarNav.classList.add('topbar-hovered');
11
         topbarNav.classList.add('topbar-hovered');
13
-        sidebarHeader.classList.add('topbar-hovered');
12
+        if (sidebarHeader) {
13
+            sidebarHeader.classList.add('topbar-hovered');
14
+        }
14
     };
15
     };
15
 
16
 
16
     const removeHoveredClass = () => {
17
     const removeHoveredClass = () => {
17
         topbarNav.classList.remove('topbar-hovered');
18
         topbarNav.classList.remove('topbar-hovered');
18
-        sidebarHeader.classList.remove('topbar-hovered');
19
+        if (sidebarHeader) {
20
+            sidebarHeader.classList.remove('topbar-hovered');
21
+        }
19
     };
22
     };
20
 
23
 
21
     topbarNav.addEventListener('mouseenter', addHoveredClass);
24
     topbarNav.addEventListener('mouseenter', addHoveredClass);
22
-    sidebarHeader.addEventListener('mouseenter', addHoveredClass);
23
     topbarNav.addEventListener('mouseleave', removeHoveredClass);
25
     topbarNav.addEventListener('mouseleave', removeHoveredClass);
24
-    sidebarHeader.addEventListener('mouseleave', removeHoveredClass);
26
+
27
+    if (sidebarHeader) {
28
+        sidebarHeader.addEventListener('mouseenter', addHoveredClass);
29
+        sidebarHeader.addEventListener('mouseleave', removeHoveredClass);
30
+    }
25
 };
31
 };
26
 
32
 
27
 const handleScroll = () => {
33
 const handleScroll = () => {
31
     window.addEventListener('scroll', () => {
37
     window.addEventListener('scroll', () => {
32
         if (window.scrollY > 0) {
38
         if (window.scrollY > 0) {
33
             topbarNav.classList.add('topbar-scrolled');
39
             topbarNav.classList.add('topbar-scrolled');
34
-            sidebarHeader.classList.add('topbar-scrolled');
40
+            if (sidebarHeader) {
41
+                sidebarHeader.classList.add('topbar-scrolled');
42
+            }
35
         } else {
43
         } else {
36
             topbarNav.classList.remove('topbar-scrolled');
44
             topbarNav.classList.remove('topbar-scrolled');
37
-            sidebarHeader.classList.remove('topbar-scrolled');
45
+            if (sidebarHeader) {
46
+                sidebarHeader.classList.remove('topbar-scrolled');
47
+            }
38
         }
48
         }
39
     });
49
     });
40
-}
50
+};
51
+
41
 
52
 

+ 5
- 1
resources/views/components/company/reports/report-pdf.blade.php 查看文件

93
 <div class="header">
93
 <div class="header">
94
     <div class="title">{{ $report->getTitle() }}</div>
94
     <div class="title">{{ $report->getTitle() }}</div>
95
     <div class="company-name">{{ $company->name }}</div>
95
     <div class="company-name">{{ $company->name }}</div>
96
-    <div class="date-range">Date Range: {{ $startDate }} to {{ $endDate }}</div>
96
+    @if($startDate && $endDate)
97
+        <div class="date-range">Date Range: {{ $startDate }} to {{ $endDate }}</div>
98
+    @else
99
+        <div class="date-range">As of {{ $endDate }}</div>
100
+    @endif
97
 </div>
101
 </div>
98
 <table class="table-class">
102
 <table class="table-class">
99
     <thead class="table-head">
103
     <thead class="table-head">

Loading…
取消
儲存