Andrew Wallo 11 个月前
父节点
当前提交
4f9695c241

+ 5
- 0
app/Transformers/CashFlowStatementReportTransformer.php 查看文件

@@ -8,6 +8,11 @@ use App\DTO\ReportTypeDTO;
8 8
 
9 9
 class CashFlowStatementReportTransformer extends SummaryReportTransformer
10 10
 {
11
+    public function getPdfView(): string
12
+    {
13
+        return 'components.company.reports.cash-flow-statement-pdf';
14
+    }
15
+
11 16
     public function getTitle(): string
12 17
     {
13 18
         return 'Cash Flow Statement';

+ 307
- 0
resources/views/components/company/reports/cash-flow-statement-pdf.blade.php 查看文件

@@ -0,0 +1,307 @@
1
+<!DOCTYPE html>
2
+<html lang="en">
3
+<head>
4
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
+    <meta name="viewport" content="width=device-width, initial-scale=1">
6
+    <title>{{ $report->getTitle() }}</title>
7
+    <style>
8
+        .header {
9
+            color: #374151;
10
+            margin-bottom: 1rem;
11
+        }
12
+
13
+        .header > * + * {
14
+            margin-top: 0.5rem;
15
+        }
16
+
17
+        .table-head {
18
+            display: table-row-group;
19
+        }
20
+
21
+        .text-left {
22
+            text-align: left;
23
+        }
24
+
25
+        .text-right {
26
+            text-align: right;
27
+        }
28
+
29
+        .text-center {
30
+            text-align: center;
31
+        }
32
+
33
+        .table-class th,
34
+        .table-class td {
35
+            color: #374151;
36
+        }
37
+
38
+        .whitespace-normal {
39
+            white-space: normal;
40
+        }
41
+
42
+        .whitespace-nowrap {
43
+            white-space: nowrap;
44
+        }
45
+
46
+        .title {
47
+            font-size: 1.5rem;
48
+        }
49
+
50
+        .company-name {
51
+            font-size: 1.125rem;
52
+            font-weight: bold;
53
+        }
54
+
55
+        .date-range {
56
+            font-size: 0.875rem;
57
+        }
58
+
59
+        .table-class {
60
+            width: 100%;
61
+            border-collapse: collapse;
62
+        }
63
+
64
+        .table-class th,
65
+        .table-class td {
66
+            padding: 0.75rem;
67
+            font-size: 0.75rem;
68
+            line-height: 1rem;
69
+            border-bottom: 1px solid #d1d5db; /* Gray border for all rows */
70
+        }
71
+
72
+        .category-header-row > td,
73
+        .type-header-row > td {
74
+            background-color: #f3f4f6; /* Gray background for category names */
75
+            font-weight: bold;
76
+        }
77
+
78
+        .type-header-row > td,
79
+        .type-data-row > td,
80
+        .type-summary-row > td {
81
+            padding-left: 1.5rem; /* Indentation for type rows */
82
+        }
83
+
84
+        .table-body tr {
85
+            background-color: #ffffff; /* White background for other rows */
86
+        }
87
+
88
+        .spacer-row > td {
89
+            height: 0.75rem;
90
+        }
91
+
92
+        .bold {
93
+            font-weight: bold;
94
+        }
95
+
96
+        .category-summary-row > td,
97
+        .type-summary-row > td,
98
+        .table-footer-row > td {
99
+            font-weight: bold;
100
+            background-color: #ffffff; /* White background for footer */
101
+        }
102
+
103
+        .underline-thin::after {
104
+            content: '';
105
+            display: block;
106
+            position: absolute;
107
+            bottom: 0;
108
+            left: 0;
109
+            width: 100%;
110
+            height: 1px;
111
+            background-color: #374151; /* Adjust as needed */
112
+        }
113
+
114
+        .underline-bold::after {
115
+            content: '';
116
+            display: block;
117
+            position: absolute;
118
+            bottom: 0;
119
+            left: 0;
120
+            width: 100%;
121
+            height: 2px; /* Adjust as needed */
122
+            background-color: #374151; /* Adjust as needed */
123
+        }
124
+
125
+        /* Ensure td is relatively positioned to contain the absolute underline */
126
+        .cell {
127
+            position: relative;
128
+            padding-bottom: 5px; /* Adjust padding to add space for the underline */
129
+        }
130
+    </style>
131
+</head>
132
+<body>
133
+<div class="header">
134
+    <div class="title">{{ $report->getTitle() }}</div>
135
+    <div class="company-name">{{ $company->name }}</div>
136
+    @if($startDate && $endDate)
137
+        <div class="date-range">Date Range: {{ $startDate }} to {{ $endDate }}</div>
138
+    @else
139
+        <div class="date-range">As of {{ $endDate }}</div>
140
+    @endif
141
+</div>
142
+<table class="table-class">
143
+    <thead class="table-head">
144
+    <tr>
145
+        @foreach($report->getCashInflowAndOutflowHeaders() as $index => $header)
146
+            <th class="{{ $report->getAlignmentClass($index) }}">
147
+                {{ $header }}
148
+            </th>
149
+        @endforeach
150
+    </tr>
151
+    </thead>
152
+    @foreach($report->getCategories() as $category)
153
+        <tbody>
154
+        <tr class="category-header-row">
155
+            @foreach($category->header as $index => $header)
156
+                <td class="{{ $report->getAlignmentClass($index) }}">
157
+                    {{ $header }}
158
+                </td>
159
+            @endforeach
160
+        </tr>
161
+        @foreach($category->data as $account)
162
+            <tr>
163
+                @foreach($account as $index => $cell)
164
+                    <td class="{{ $report->getAlignmentClass($index) }} {{ $index === 1 ? 'whitespace-normal' : 'whitespace-nowrap' }}">
165
+                        @if(is_array($cell) && isset($cell['name']))
166
+                            {{ $cell['name'] }}
167
+                        @else
168
+                            {{ $cell }}
169
+                        @endif
170
+                    </td>
171
+                @endforeach
172
+            </tr>
173
+        @endforeach
174
+
175
+        <!-- Category Types -->
176
+        @foreach($category->types ?? [] as $type)
177
+            <!-- Type Header -->
178
+            <tr class="type-header-row">
179
+                @foreach($type->header as $index => $header)
180
+                    <td class="{{ $report->getAlignmentClass($index) }}">
181
+                        {{ $header }}
182
+                    </td>
183
+                @endforeach
184
+            </tr>
185
+
186
+            <!-- Type Data -->
187
+            @foreach($type->data as $typeRow)
188
+                <tr class="type-data-row">
189
+                    @foreach($typeRow as $index => $cell)
190
+                        <td class="{{ $report->getAlignmentClass($index) }} {{ $index === 'account_name' ? 'whitespace-normal' : 'whitespace-nowrap' }}">
191
+                            @if(is_array($cell) && isset($cell['name']))
192
+                                {{ $cell['name'] }}
193
+                            @else
194
+                                {{ $cell }}
195
+                            @endif
196
+                        </td>
197
+                    @endforeach
198
+                </tr>
199
+            @endforeach
200
+
201
+            <!-- Type Summary -->
202
+            <tr class="type-summary-row">
203
+                @foreach($type->summary as $index => $cell)
204
+                    <td class="{{ $report->getAlignmentClass($index) }}">
205
+                        {{ $cell }}
206
+                    </td>
207
+                @endforeach
208
+            </tr>
209
+        @endforeach
210
+
211
+        <tr class="category-summary-row">
212
+            @foreach($category->summary as $index => $cell)
213
+                <td
214
+                    @class([
215
+                        'cell',
216
+                        $report->getAlignmentClass($index),
217
+                        'underline-bold' => $loop->last,
218
+                    ])
219
+                >
220
+                    {{ $cell }}
221
+                </td>
222
+            @endforeach
223
+        </tr>
224
+
225
+        <tr class="spacer-row">
226
+            <td colspan="{{ count($report->getHeaders()) }}"></td>
227
+        </tr>
228
+        </tbody>
229
+    @endforeach
230
+    <tbody>
231
+    <tr class="table-footer-row">
232
+        @foreach ($report->getOverallTotals() as $index => $total)
233
+            <td class="{{ $report->getAlignmentClass($index) }}">
234
+                {{ $total }}
235
+            </td>
236
+        @endforeach
237
+    </tr>
238
+    </tbody>
239
+</table>
240
+
241
+<!-- Second Overview Table -->
242
+<table class="table-class mt-4 border-t">
243
+    <thead class="table-head">
244
+    <tr>
245
+        @foreach($report->getOverviewHeaders() as $index => $header)
246
+            <th class="{{ $report->getAlignmentClass($index) }}">
247
+                {{ $header }}
248
+            </th>
249
+        @endforeach
250
+    </tr>
251
+    </thead>
252
+    <!-- Overview Content -->
253
+    @foreach($report->getOverview() as $overviewCategory)
254
+        <tbody>
255
+        <tr class="category-header-row">
256
+            @foreach($overviewCategory->header as $index => $header)
257
+                <td class="{{ $report->getAlignmentClass($index) }}">
258
+                    {{ $header }}
259
+                </td>
260
+            @endforeach
261
+        </tr>
262
+        @foreach($overviewCategory->data as $overviewAccount)
263
+            <tr>
264
+                @foreach($overviewAccount as $index => $cell)
265
+                    <td class="{{ $report->getAlignmentClass($index) }} {{ $index === 'account_name' ? 'whitespace-normal' : 'whitespace-nowrap' }}">
266
+                        @if(is_array($cell) && isset($cell['name']))
267
+                            {{ $cell['name'] }}
268
+                        @else
269
+                            {{ $cell }}
270
+                        @endif
271
+                    </td>
272
+                @endforeach
273
+            </tr>
274
+        @endforeach
275
+        <!-- Summary Row -->
276
+        <tr class="category-summary-row">
277
+            @foreach($overviewCategory->summary as $index => $summaryCell)
278
+                <td class="{{ $report->getAlignmentClass($index) }}">
279
+                    {{ $summaryCell }}
280
+                </td>
281
+            @endforeach
282
+        </tr>
283
+       
284
+        @if($overviewCategory->header['account_name'] === 'Starting Balance')
285
+            @foreach($report->getOverviewAlignedWithColumns() as $summaryRow)
286
+                <tr>
287
+                    @foreach($summaryRow as $index => $summaryCell)
288
+                        <td
289
+                            @class([
290
+                                'cell',
291
+                                $report->getAlignmentClass($index),
292
+                                'bold' => $loop->parent->last,
293
+                                'underline-thin' => $loop->parent->remaining === 1 && $index === 'net_movement', // Thin underline
294
+                                'underline-bold' => $loop->parent->last && $index === 'net_movement', // Bold underline
295
+                            ])
296
+                        >
297
+                            {{ $summaryCell }}
298
+                        </td>
299
+                    @endforeach
300
+                </tr>
301
+            @endforeach
302
+        @endif
303
+        </tbody>
304
+    @endforeach
305
+</table>
306
+</body>
307
+</html>

正在加载...
取消
保存