Browse Source

refactor

3.x
Andrew Wallo 11 months ago
parent
commit
ff98db8dcc
22 changed files with 394 additions and 361 deletions
  1. 9
    9
      app/Filament/Company/Pages/Reports/AccountBalances.php
  2. 5
    5
      app/Filament/Company/Pages/Reports/AccountTransactions.php
  3. 3
    3
      app/Filament/Company/Pages/Reports/BalanceSheet.php
  4. 23
    0
      app/Filament/Company/Pages/Reports/BaseReportPage.php
  5. 3
    3
      app/Filament/Company/Pages/Reports/CashFlowStatement.php
  6. 3
    3
      app/Filament/Company/Pages/Reports/IncomeStatement.php
  7. 6
    6
      app/Filament/Company/Pages/Reports/TrialBalance.php
  8. 44
    0
      app/Services/ExportService.php
  9. 0
    31
      app/Transformers/BalanceSheetReportTransformer.php
  10. 0
    33
      app/Transformers/CashFlowStatementReportTransformer.php
  11. 0
    32
      app/Transformers/IncomeStatementReportTransformer.php
  12. 11
    11
      composer.lock
  13. 13
    13
      package-lock.json
  14. 53
    48
      resources/views/components/company/reports/account-transactions-report-pdf.blade.php
  15. 123
    96
      resources/views/components/company/reports/cash-flow-statement-pdf.blade.php
  16. 92
    61
      resources/views/components/company/reports/report-pdf.blade.php
  17. 1
    1
      resources/views/components/company/tables/reports/balance-sheet-summary.blade.php
  18. 1
    1
      resources/views/components/company/tables/reports/balance-sheet.blade.php
  19. 1
    1
      resources/views/components/company/tables/reports/cash-flow-statement-summary.blade.php
  20. 1
    2
      resources/views/components/company/tables/reports/cash-flow-statement.blade.php
  21. 1
    1
      resources/views/components/company/tables/reports/income-statement-summary.blade.php
  22. 1
    1
      resources/views/components/company/tables/reports/income-statement.blade.php

+ 9
- 9
app/Filament/Company/Pages/Reports/AccountBalances.php View File

38
     {
38
     {
39
         return [
39
         return [
40
             Column::make('account_code')
40
             Column::make('account_code')
41
-                ->label('Account Code')
42
-                ->toggleable()
43
-                ->alignment(Alignment::Center),
41
+                ->label('ACCOUNT CODE')
42
+                ->toggleable(isToggledHiddenByDefault: true)
43
+                ->alignment(Alignment::Left),
44
             Column::make('account_name')
44
             Column::make('account_name')
45
-                ->label('Account')
45
+                ->label('ACCOUNT')
46
                 ->alignment(Alignment::Left),
46
                 ->alignment(Alignment::Left),
47
             Column::make('starting_balance')
47
             Column::make('starting_balance')
48
-                ->label('Starting Balance')
48
+                ->label('STARTING BALANCE')
49
                 ->toggleable()
49
                 ->toggleable()
50
                 ->alignment(Alignment::Right),
50
                 ->alignment(Alignment::Right),
51
             Column::make('debit_balance')
51
             Column::make('debit_balance')
52
-                ->label('Debit')
52
+                ->label('DEBIT')
53
                 ->toggleable()
53
                 ->toggleable()
54
                 ->alignment(Alignment::Right),
54
                 ->alignment(Alignment::Right),
55
             Column::make('credit_balance')
55
             Column::make('credit_balance')
56
-                ->label('Credit')
56
+                ->label('CREDIT')
57
                 ->toggleable()
57
                 ->toggleable()
58
                 ->alignment(Alignment::Right),
58
                 ->alignment(Alignment::Right),
59
             Column::make('net_movement')
59
             Column::make('net_movement')
60
-                ->label('Net Movement')
60
+                ->label('NET MOVEMENT')
61
                 ->toggleable()
61
                 ->toggleable()
62
                 ->alignment(Alignment::Right),
62
                 ->alignment(Alignment::Right),
63
             Column::make('ending_balance')
63
             Column::make('ending_balance')
64
-                ->label('Ending Balance')
64
+                ->label('ENDING BALANCE')
65
                 ->toggleable()
65
                 ->toggleable()
66
                 ->alignment(Alignment::Right),
66
                 ->alignment(Alignment::Right),
67
         ];
67
         ];

+ 5
- 5
app/Filament/Company/Pages/Reports/AccountTransactions.php View File

60
     {
60
     {
61
         return [
61
         return [
62
             Column::make('date')
62
             Column::make('date')
63
-                ->label('Date')
63
+                ->label('DATE')
64
                 ->markAsDate()
64
                 ->markAsDate()
65
                 ->alignment(Alignment::Left),
65
                 ->alignment(Alignment::Left),
66
             Column::make('description')
66
             Column::make('description')
67
-                ->label('Description')
67
+                ->label('DESCRIPTION')
68
                 ->alignment(Alignment::Left),
68
                 ->alignment(Alignment::Left),
69
             Column::make('debit')
69
             Column::make('debit')
70
-                ->label('Debit')
70
+                ->label('DEBIT')
71
                 ->alignment(Alignment::Right),
71
                 ->alignment(Alignment::Right),
72
             Column::make('credit')
72
             Column::make('credit')
73
-                ->label('Credit')
73
+                ->label('CREDIT')
74
                 ->alignment(Alignment::Right),
74
                 ->alignment(Alignment::Right),
75
             Column::make('balance')
75
             Column::make('balance')
76
-                ->label('Running Balance')
76
+                ->label('RUNNING BALANCE')
77
                 ->alignment(Alignment::Right),
77
                 ->alignment(Alignment::Right),
78
         ];
78
         ];
79
     }
79
     }

+ 3
- 3
app/Filament/Company/Pages/Reports/BalanceSheet.php View File

37
     {
37
     {
38
         return [
38
         return [
39
             Column::make('account_code')
39
             Column::make('account_code')
40
-                ->label('Account Code')
40
+                ->label('ACCOUNT CODE')
41
                 ->toggleable(isToggledHiddenByDefault: true)
41
                 ->toggleable(isToggledHiddenByDefault: true)
42
                 ->alignment(Alignment::Left),
42
                 ->alignment(Alignment::Left),
43
             Column::make('account_name')
43
             Column::make('account_name')
44
-                ->label('Account')
44
+                ->label('ACCOUNTS')
45
                 ->alignment(Alignment::Left),
45
                 ->alignment(Alignment::Left),
46
             Column::make('ending_balance')
46
             Column::make('ending_balance')
47
-                ->label('Amount')
47
+                ->label($this->getDisplayAsOfDate())
48
                 ->alignment(Alignment::Right),
48
                 ->alignment(Alignment::Right),
49
         ];
49
         ];
50
     }
50
     }

+ 23
- 0
app/Filament/Company/Pages/Reports/BaseReportPage.php View File

169
         return Carbon::parse($this->getFilterState('asOfDate'))->endOfDay()->toDateTimeString();
169
         return Carbon::parse($this->getFilterState('asOfDate'))->endOfDay()->toDateTimeString();
170
     }
170
     }
171
 
171
 
172
+    public function getDisplayAsOfDate(): string
173
+    {
174
+        return Carbon::parse($this->getFilterState('asOfDate'))->toDefaultDateFormat();
175
+    }
176
+
177
+    public function getDisplayStartDate(): string
178
+    {
179
+        return Carbon::parse($this->getFilterState('startDate'))->toDefaultDateFormat();
180
+    }
181
+
182
+    public function getDisplayEndDate(): string
183
+    {
184
+        return Carbon::parse($this->getFilterState('endDate'))->toDefaultDateFormat();
185
+    }
186
+
187
+    public function getDisplayDateRange(): string
188
+    {
189
+        $startDate = Carbon::parse($this->getFilterState('startDate'));
190
+        $endDate = Carbon::parse($this->getFilterState('endDate'));
191
+
192
+        return $startDate->toDefaultDateFormat() . ' - ' . $endDate->toDefaultDateFormat();
193
+    }
194
+
172
     protected function getHeaderActions(): array
195
     protected function getHeaderActions(): array
173
     {
196
     {
174
         return [
197
         return [

+ 3
- 3
app/Filament/Company/Pages/Reports/CashFlowStatement.php View File

39
     {
39
     {
40
         return [
40
         return [
41
             Column::make('account_code')
41
             Column::make('account_code')
42
-                ->label('Account Code')
42
+                ->label('ACCOUNT CODE')
43
                 ->toggleable(isToggledHiddenByDefault: true)
43
                 ->toggleable(isToggledHiddenByDefault: true)
44
                 ->alignment(Alignment::Left),
44
                 ->alignment(Alignment::Left),
45
             Column::make('account_name')
45
             Column::make('account_name')
46
-                ->label('Account')
46
+                ->label('CASH INFLOWS AND OUTFLOWS')
47
                 ->alignment(Alignment::Left),
47
                 ->alignment(Alignment::Left),
48
             Column::make('net_movement')
48
             Column::make('net_movement')
49
-                ->label('Amount')
49
+                ->label($this->getDisplayDateRange())
50
                 ->alignment(Alignment::Right),
50
                 ->alignment(Alignment::Right),
51
         ];
51
         ];
52
     }
52
     }

+ 3
- 3
app/Filament/Company/Pages/Reports/IncomeStatement.php View File

39
     {
39
     {
40
         return [
40
         return [
41
             Column::make('account_code')
41
             Column::make('account_code')
42
-                ->label('Account Code')
42
+                ->label('ACCOUNT CODE')
43
                 ->toggleable(isToggledHiddenByDefault: true)
43
                 ->toggleable(isToggledHiddenByDefault: true)
44
                 ->alignment(Alignment::Left),
44
                 ->alignment(Alignment::Left),
45
             Column::make('account_name')
45
             Column::make('account_name')
46
-                ->label('Account')
46
+                ->label('ACCOUNTS')
47
                 ->alignment(Alignment::Left),
47
                 ->alignment(Alignment::Left),
48
             Column::make('net_movement')
48
             Column::make('net_movement')
49
-                ->label('Amount')
49
+                ->label($this->getDisplayDateRange())
50
                 ->alignment(Alignment::Right),
50
                 ->alignment(Alignment::Right),
51
         ];
51
         ];
52
     }
52
     }

+ 6
- 6
app/Filament/Company/Pages/Reports/TrialBalance.php View File

43
     {
43
     {
44
         return [
44
         return [
45
             Column::make('account_code')
45
             Column::make('account_code')
46
-                ->label('Account Code')
47
-                ->toggleable()
48
-                ->alignment(Alignment::Center),
46
+                ->label('ACCOUNT CODE')
47
+                ->toggleable(isToggledHiddenByDefault: true)
48
+                ->alignment(Alignment::Left),
49
             Column::make('account_name')
49
             Column::make('account_name')
50
-                ->label('Account')
50
+                ->label('ACCOUNTS')
51
                 ->alignment(Alignment::Left),
51
                 ->alignment(Alignment::Left),
52
             Column::make('debit_balance')
52
             Column::make('debit_balance')
53
-                ->label('Debit')
53
+                ->label('DEBIT')
54
                 ->alignment(Alignment::Right),
54
                 ->alignment(Alignment::Right),
55
             Column::make('credit_balance')
55
             Column::make('credit_balance')
56
-                ->label('Credit')
56
+                ->label('CREDIT')
57
                 ->alignment(Alignment::Right),
57
                 ->alignment(Alignment::Right),
58
         ];
58
         ];
59
     }
59
     }

+ 44
- 0
app/Services/ExportService.php View File

4
 
4
 
5
 use App\Contracts\ExportableReport;
5
 use App\Contracts\ExportableReport;
6
 use App\Models\Company;
6
 use App\Models\Company;
7
+use App\Transformers\CashFlowStatementReportTransformer;
7
 use Barryvdh\Snappy\Facades\SnappyPdf;
8
 use Barryvdh\Snappy\Facades\SnappyPdf;
8
 use Carbon\Exceptions\InvalidFormatException;
9
 use Carbon\Exceptions\InvalidFormatException;
9
 use Illuminate\Support\Carbon;
10
 use Illuminate\Support\Carbon;
72
                 $csv->insertOne([]);
73
                 $csv->insertOne([]);
73
             }
74
             }
74
 
75
 
76
+            if ($report->getTitle() === 'Cash Flow Statement') {
77
+                $this->writeOverviewTableToCsv($csv, $report);
78
+            }
79
+
75
             if (filled($report->getOverallTotals())) {
80
             if (filled($report->getOverallTotals())) {
76
                 $csv->insertOne($report->getOverallTotals());
81
                 $csv->insertOne($report->getOverallTotals());
77
             }
82
             }
80
         return response()->streamDownload($callback, $filename, $headers);
85
         return response()->streamDownload($callback, $filename, $headers);
81
     }
86
     }
82
 
87
 
88
+    /**
89
+     * @throws CannotInsertRecord
90
+     * @throws Exception
91
+     */
92
+    protected function writeOverviewTableToCsv(Writer $csv, ExportableReport $report): void
93
+    {
94
+        /** @var CashFlowStatementReportTransformer $report */
95
+        $headers = $report->getOverviewHeaders();
96
+
97
+        if (filled($headers)) {
98
+            $csv->insertOne($headers);
99
+        }
100
+
101
+        foreach ($report->getOverview() as $overviewCategory) {
102
+            if (filled($overviewCategory->header)) {
103
+                $this->writeDataRowsToCsv($csv, $overviewCategory->header, $overviewCategory->data, $report->getColumns());
104
+            }
105
+
106
+            if (filled($overviewCategory->summary)) {
107
+                $csv->insertOne($overviewCategory->summary);
108
+            }
109
+
110
+            if ($overviewCategory->header['account_name'] === 'Starting Balance') {
111
+                foreach ($report->getOverviewAlignedWithColumns() as $summaryRow) {
112
+                    $row = [];
113
+
114
+                    foreach ($report->getColumns() as $column) {
115
+                        $columnName = $column->getName();
116
+                        $row[] = $summaryRow[$columnName] ?? '';
117
+                    }
118
+
119
+                    if (array_filter($row)) {
120
+                        $csv->insertOne($row);
121
+                    }
122
+                }
123
+            }
124
+        }
125
+    }
126
+
83
     public function exportToPdf(Company $company, ExportableReport $report, ?string $startDate = null, ?string $endDate = null): StreamedResponse
127
     public function exportToPdf(Company $company, ExportableReport $report, ?string $startDate = null, ?string $endDate = null): StreamedResponse
84
     {
128
     {
85
         if ($startDate && $endDate) {
129
         if ($startDate && $endDate) {

+ 0
- 31
app/Transformers/BalanceSheetReportTransformer.php View File

244
         return [];
244
         return [];
245
     }
245
     }
246
 
246
 
247
-    public function getTitleHeaders(): array
248
-    {
249
-        return once(function (): array {
250
-            $headers = [];
251
-
252
-            $dateRange = $this->getEndDate() ? $this->getEndDate() : '';
253
-
254
-            foreach ($this->getColumns() as $column) {
255
-                $headers[$column->getName()] = match ($column->getName()) {
256
-                    'account_name' => 'ACCOUNTS',
257
-                    'ending_balance' => $dateRange,
258
-                    default => '',
259
-                };
260
-            }
261
-
262
-            return $headers;
263
-        });
264
-    }
265
-
266
-    public function getSummaryTitleHeaders(): array
267
-    {
268
-        return once(function (): array {
269
-            $headers = $this->getTitleHeaders();
270
-
271
-            // Remove the account_code key if it exists
272
-            unset($headers['account_code']);
273
-
274
-            return $headers;
275
-        });
276
-    }
277
-
278
     public function getSummary(): array
247
     public function getSummary(): array
279
     {
248
     {
280
         return [
249
         return [

+ 0
- 33
app/Transformers/CashFlowStatementReportTransformer.php View File

234
         }, $this->getOverviewAlignedWithColumns());
234
         }, $this->getOverviewAlignedWithColumns());
235
     }
235
     }
236
 
236
 
237
-    public function getCashInflowAndOutflowHeaders(): array
238
-    {
239
-        return once(function (): array {
240
-            $headers = [];
241
-
242
-            $dateRange = $this->getStartDate() && $this->getEndDate()
243
-                ? "{$this->getStartDate()} - {$this->getEndDate()}"
244
-                : '';
245
-
246
-            foreach ($this->getColumns() as $column) {
247
-                $headers[$column->getName()] = match ($column->getName()) {
248
-                    'account_name' => 'CASH INFLOWS AND OUTFLOWS',
249
-                    'net_movement' => $dateRange,
250
-                    default => '',
251
-                };
252
-            }
253
-
254
-            return $headers;
255
-        });
256
-    }
257
-
258
-    public function getSummaryCashInflowAndOutflowHeaders(): array
259
-    {
260
-        return once(function (): array {
261
-            $headers = $this->getCashInflowAndOutflowHeaders();
262
-
263
-            // Remove the account_code key if it exists
264
-            unset($headers['account_code']);
265
-
266
-            return $headers;
267
-        });
268
-    }
269
-
270
     public function getOverviewHeaders(): array
237
     public function getOverviewHeaders(): array
271
     {
238
     {
272
         return once(function (): array {
239
         return once(function (): array {

+ 0
- 32
app/Transformers/IncomeStatementReportTransformer.php View File

179
         return $totals;
179
         return $totals;
180
     }
180
     }
181
 
181
 
182
-    public function getTitleHeaders(): array
183
-    {
184
-        return once(function (): array {
185
-            $headers = [];
186
-
187
-            $dateRange = $this->getStartDate() && $this->getEndDate()
188
-                ? "{$this->getStartDate()} - {$this->getEndDate()}"
189
-                : '';
190
-
191
-            foreach ($this->getColumns() as $column) {
192
-                $headers[$column->getName()] = match ($column->getName()) {
193
-                    'account_name' => 'ACCOUNTS',
194
-                    'net_movement' => $dateRange,
195
-                    default => '',
196
-                };
197
-            }
198
-
199
-            return $headers;
200
-        });
201
-    }
202
-
203
-    public function getSummaryTitleHeaders(): array
204
-    {
205
-        return once(function (): array {
206
-            $headers = $this->getTitleHeaders();
207
-
208
-            unset($headers['account_code']);
209
-
210
-            return $headers;
211
-        });
212
-    }
213
-
214
     public function getSummary(): array
182
     public function getSummary(): array
215
     {
183
     {
216
         return [
184
         return [

+ 11
- 11
composer.lock View File

497
         },
497
         },
498
         {
498
         {
499
             "name": "aws/aws-sdk-php",
499
             "name": "aws/aws-sdk-php",
500
-            "version": "3.325.5",
500
+            "version": "3.325.6",
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": "195d003c902a741de53008c839cbcebddbe1f326"
504
+                "reference": "9e4be60c907ce5ef05ee36dafd42afd9944591c6"
505
             },
505
             },
506
             "dist": {
506
             "dist": {
507
                 "type": "zip",
507
                 "type": "zip",
508
-                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/195d003c902a741de53008c839cbcebddbe1f326",
509
-                "reference": "195d003c902a741de53008c839cbcebddbe1f326",
508
+                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/9e4be60c907ce5ef05ee36dafd42afd9944591c6",
509
+                "reference": "9e4be60c907ce5ef05ee36dafd42afd9944591c6",
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.325.5"
592
+                "source": "https://github.com/aws/aws-sdk-php/tree/3.325.6"
593
             },
593
             },
594
-            "time": "2024-11-08T19:12:57+00:00"
594
+            "time": "2024-11-11T19:05:26+00:00"
595
         },
595
         },
596
         {
596
         {
597
             "name": "aws/aws-sdk-php-laravel",
597
             "name": "aws/aws-sdk-php-laravel",
10783
         },
10783
         },
10784
         {
10784
         {
10785
             "name": "phpstan/phpstan",
10785
             "name": "phpstan/phpstan",
10786
-            "version": "1.12.9",
10786
+            "version": "1.12.10",
10787
             "source": {
10787
             "source": {
10788
                 "type": "git",
10788
                 "type": "git",
10789
                 "url": "https://github.com/phpstan/phpstan.git",
10789
                 "url": "https://github.com/phpstan/phpstan.git",
10790
-                "reference": "ceb937fb39a92deabc02d20709cf14b2c452502c"
10790
+                "reference": "fc463b5d0fe906dcf19689be692c65c50406a071"
10791
             },
10791
             },
10792
             "dist": {
10792
             "dist": {
10793
                 "type": "zip",
10793
                 "type": "zip",
10794
-                "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ceb937fb39a92deabc02d20709cf14b2c452502c",
10795
-                "reference": "ceb937fb39a92deabc02d20709cf14b2c452502c",
10794
+                "url": "https://api.github.com/repos/phpstan/phpstan/zipball/fc463b5d0fe906dcf19689be692c65c50406a071",
10795
+                "reference": "fc463b5d0fe906dcf19689be692c65c50406a071",
10796
                 "shasum": ""
10796
                 "shasum": ""
10797
             },
10797
             },
10798
             "require": {
10798
             "require": {
10837
                     "type": "github"
10837
                     "type": "github"
10838
                 }
10838
                 }
10839
             ],
10839
             ],
10840
-            "time": "2024-11-10T17:10:04+00:00"
10840
+            "time": "2024-11-11T15:37:09+00:00"
10841
         },
10841
         },
10842
         {
10842
         {
10843
             "name": "phpunit/php-code-coverage",
10843
             "name": "phpunit/php-code-coverage",

+ 13
- 13
package-lock.json View File

1026
             }
1026
             }
1027
         },
1027
         },
1028
         "node_modules/caniuse-lite": {
1028
         "node_modules/caniuse-lite": {
1029
-            "version": "1.0.30001679",
1030
-            "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001679.tgz",
1031
-            "integrity": "sha512-j2YqID/YwpLnKzCmBOS4tlZdWprXm3ZmQLBH9ZBXFOhoxLA46fwyBvx6toCBWBmnuwUY/qB3kEU6gFx8qgCroA==",
1029
+            "version": "1.0.30001680",
1030
+            "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001680.tgz",
1031
+            "integrity": "sha512-rPQy70G6AGUMnbwS1z6Xg+RkHYPAi18ihs47GH0jcxIG7wArmPgY3XbS2sRdBbxJljp3thdT8BIqv9ccCypiPA==",
1032
             "dev": true,
1032
             "dev": true,
1033
             "funding": [
1033
             "funding": [
1034
                 {
1034
                 {
1187
             "license": "MIT"
1187
             "license": "MIT"
1188
         },
1188
         },
1189
         "node_modules/electron-to-chromium": {
1189
         "node_modules/electron-to-chromium": {
1190
-            "version": "1.5.55",
1191
-            "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.55.tgz",
1192
-            "integrity": "sha512-6maZ2ASDOTBtjt9FhqYPRnbvKU5tjG0IN9SztUOWYw2AzNDNpKJYLJmlK0/En4Hs/aiWnB+JZ+gW19PIGszgKg==",
1190
+            "version": "1.5.56",
1191
+            "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.56.tgz",
1192
+            "integrity": "sha512-7lXb9dAvimCFdvUMTyucD4mnIndt/xhRKFAlky0CyFogdnNmdPQNoHI23msF/2V4mpTxMzgMdjK4+YRlFlRQZw==",
1193
             "dev": true,
1193
             "dev": true,
1194
             "license": "ISC"
1194
             "license": "ISC"
1195
         },
1195
         },
1854
             }
1854
             }
1855
         },
1855
         },
1856
         "node_modules/postcss": {
1856
         "node_modules/postcss": {
1857
-            "version": "8.4.47",
1858
-            "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.47.tgz",
1859
-            "integrity": "sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ==",
1857
+            "version": "8.4.49",
1858
+            "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.49.tgz",
1859
+            "integrity": "sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA==",
1860
             "dev": true,
1860
             "dev": true,
1861
             "funding": [
1861
             "funding": [
1862
                 {
1862
                 {
1875
             "license": "MIT",
1875
             "license": "MIT",
1876
             "dependencies": {
1876
             "dependencies": {
1877
                 "nanoid": "^3.3.7",
1877
                 "nanoid": "^3.3.7",
1878
-                "picocolors": "^1.1.0",
1878
+                "picocolors": "^1.1.1",
1879
                 "source-map-js": "^1.2.1"
1879
                 "source-map-js": "^1.2.1"
1880
             },
1880
             },
1881
             "engines": {
1881
             "engines": {
2580
             "license": "MIT"
2580
             "license": "MIT"
2581
         },
2581
         },
2582
         "node_modules/vite": {
2582
         "node_modules/vite": {
2583
-            "version": "5.4.10",
2584
-            "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.10.tgz",
2585
-            "integrity": "sha512-1hvaPshuPUtxeQ0hsVH3Mud0ZanOLwVTneA1EgbAM5LhaZEqyPWGRQ7BtaMvUrTDeEaC8pxtj6a6jku3x4z6SQ==",
2583
+            "version": "5.4.11",
2584
+            "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.11.tgz",
2585
+            "integrity": "sha512-c7jFQRklXua0mTzneGW9QVyxFjUgwcihC4bXEtujIo2ouWCe1Ajt/amn2PCxYnhYfd5k09JX3SB7OYWFKYqj8Q==",
2586
             "dev": true,
2586
             "dev": true,
2587
             "license": "MIT",
2587
             "license": "MIT",
2588
             "dependencies": {
2588
             "dependencies": {

+ 53
- 48
resources/views/components/company/reports/account-transactions-report-pdf.blade.php View File

5
     <meta name="viewport" content="width=device-width, initial-scale=1">
5
     <meta name="viewport" content="width=device-width, initial-scale=1">
6
     <title>{{ $report->getTitle() }}</title>
6
     <title>{{ $report->getTitle() }}</title>
7
     <style>
7
     <style>
8
-        .header {
9
-            color: #374151;
10
-            margin-bottom: 1rem;
8
+        .category-header-row > td {
9
+            background-color: #f3f4f6;
10
+            font-weight: bold;
11
         }
11
         }
12
 
12
 
13
-        .header > * + * {
14
-            margin-top: 0.5rem;
13
+        .category-summary-row > td,
14
+        .table-footer-row > td {
15
+            background-color: #ffffff;
16
+            font-weight: bold;
15
         }
17
         }
16
 
18
 
17
-        .table-head {
18
-            display: table-row-group;
19
+        .company-name {
20
+            font-size: 1.125rem;
21
+            font-weight: bold;
19
         }
22
         }
20
 
23
 
21
-        .text-left {
22
-            text-align: left;
24
+        .date-range {
25
+            font-size: 0.875rem;
23
         }
26
         }
24
 
27
 
25
-        .text-right {
26
-            text-align: right;
28
+        .header {
29
+            color: #374151;
30
+            margin-bottom: 1rem;
27
         }
31
         }
28
 
32
 
29
-        .text-center {
30
-            text-align: center;
33
+        .header div + div {
34
+            margin-top: 0.5rem;
31
         }
35
         }
32
 
36
 
33
-        .table-class th,
34
-        .table-class td {
35
-            color: #374151;
37
+        .spacer-row > td {
38
+            height: 0.75rem;
36
         }
39
         }
37
 
40
 
38
-        .whitespace-normal {
39
-            white-space: normal;
41
+        .table-body tr {
42
+            background-color: #ffffff;
40
         }
43
         }
41
 
44
 
42
-        .whitespace-nowrap {
43
-            white-space: nowrap;
45
+        .table-class {
46
+            border-collapse: collapse;
47
+            width: 100%;
44
         }
48
         }
45
 
49
 
46
-        .title {
47
-            font-size: 1.5rem;
50
+        .table-class td,
51
+        .table-class th {
52
+            border-bottom: 1px solid #d1d5db;
53
+            color: #374151;
54
+            font-size: 0.75rem;
55
+            line-height: 1rem;
56
+            padding: 0.75rem;
48
         }
57
         }
49
 
58
 
50
-        .company-name {
51
-            font-size: 1.125rem;
52
-            font-weight: bold;
59
+        .table-head {
60
+            display: table-row-group;
53
         }
61
         }
54
 
62
 
55
-        .date-range {
56
-            font-size: 0.875rem;
63
+        .text-center {
64
+            text-align: center;
57
         }
65
         }
58
 
66
 
59
-        .table-class {
60
-            width: 100%;
61
-            border-collapse: collapse;
67
+        .text-left {
68
+            text-align: left;
62
         }
69
         }
63
 
70
 
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 */
71
+        .text-right {
72
+            text-align: right;
70
         }
73
         }
71
 
74
 
72
-        .category-header-row > td {
73
-            background-color: #f3f4f6; /* Gray background for category names */
74
-            font-weight: bold;
75
+        .title {
76
+            font-size: 1.5rem;
75
         }
77
         }
76
 
78
 
77
-        .table-body tr {
78
-            background-color: #ffffff; /* White background for other rows */
79
+        .whitespace-normal {
80
+            white-space: normal;
79
         }
81
         }
80
 
82
 
81
-        .spacer-row > td {
82
-            height: 0.75rem;
83
+        .whitespace-nowrap {
84
+            white-space: nowrap;
83
         }
85
         }
84
 
86
 
85
-        .category-summary-row > td,
86
-        .table-footer-row > td {
87
-            font-weight: bold;
88
-            background-color: #ffffff; /* White background for footer */
87
+        table tfoot {
88
+            display: table-row-group;
89
         }
89
         }
90
     </style>
90
     </style>
91
 </head>
91
 </head>
128
                     'category-header-row' => $loop->first || $loop->last || $loop->remaining === 1,
128
                     'category-header-row' => $loop->first || $loop->last || $loop->remaining === 1,
129
                 ])>
129
                 ])>
130
                 @foreach($transaction as $cellIndex => $cell)
130
                 @foreach($transaction as $cellIndex => $cell)
131
-                    <td class="{{ $report->getAlignmentClass($cellIndex) }} {{ $cellIndex === 1 ? 'whitespace-normal' : 'whitespace-nowrap' }}">
131
+                    <td @class([
132
+                            $report->getAlignmentClass($cellIndex),
133
+                            'whitespace-normal' => $cellIndex === 'description',
134
+                            'whitespace-nowrap' => $cellIndex !== 'description',
135
+                        ])
136
+                    >
132
                         @if(is_array($cell) && isset($cell['description']))
137
                         @if(is_array($cell) && isset($cell['description']))
133
                             {{ $cell['description'] }}
138
                             {{ $cell['description'] }}
134
                         @else
139
                         @else

+ 123
- 96
resources/views/components/company/reports/cash-flow-statement-pdf.blade.php View File

5
     <meta name="viewport" content="width=device-width, initial-scale=1">
5
     <meta name="viewport" content="width=device-width, initial-scale=1">
6
     <title>{{ $report->getTitle() }}</title>
6
     <title>{{ $report->getTitle() }}</title>
7
     <style>
7
     <style>
8
-        .header {
9
-            color: #374151;
10
-            margin-bottom: 1rem;
8
+        .font-bold {
9
+            font-weight: bold;
11
         }
10
         }
12
 
11
 
13
-        .header > * + * {
14
-            margin-top: 0.5rem;
12
+        .category-header-row > td,
13
+        .type-header-row > td {
14
+            background-color: #f3f4f6;
15
+            font-weight: bold;
15
         }
16
         }
16
 
17
 
17
-        .table-head {
18
-            display: table-row-group;
18
+        .category-summary-row > td,
19
+        .table-footer-row > td,
20
+        .type-summary-row > td {
21
+            background-color: #ffffff;
22
+            font-weight: bold;
19
         }
23
         }
20
 
24
 
21
-        .text-left {
22
-            text-align: left;
25
+        .cell {
26
+            padding-bottom: 5px;
27
+            position: relative;
23
         }
28
         }
24
 
29
 
25
-        .text-right {
26
-            text-align: right;
30
+        .company-name {
31
+            font-size: 1.125rem;
32
+            font-weight: bold;
27
         }
33
         }
28
 
34
 
29
-        .text-center {
30
-            text-align: center;
35
+        .date-range {
36
+            font-size: 0.875rem;
31
         }
37
         }
32
 
38
 
33
-        .table-class th,
34
-        .table-class td {
39
+        .header {
35
             color: #374151;
40
             color: #374151;
41
+            margin-bottom: 1rem;
36
         }
42
         }
37
 
43
 
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;
44
+        .header div + div {
45
+            margin-top: 0.5rem;
48
         }
46
         }
49
 
47
 
50
-        .company-name {
51
-            font-size: 1.125rem;
52
-            font-weight: bold;
48
+        .spacer-row > td {
49
+            height: 0.75rem;
53
         }
50
         }
54
 
51
 
55
-        .date-range {
56
-            font-size: 0.875rem;
52
+        .table-body tr {
53
+            background-color: #ffffff;
57
         }
54
         }
58
 
55
 
59
         .table-class {
56
         .table-class {
60
-            width: 100%;
61
             border-collapse: collapse;
57
             border-collapse: collapse;
58
+            table-layout: fixed;
59
+            width: 100%;
62
         }
60
         }
63
 
61
 
64
-        .table-class th,
65
-        .table-class td {
66
-            padding: 0.75rem;
62
+        .table-class .type-row-indent {
63
+            padding-left: 1.5rem;
64
+        }
65
+
66
+        .table-class td,
67
+        .table-class th {
68
+            border-bottom: 1px solid #d1d5db;
69
+            color: #374151;
67
             font-size: 0.75rem;
70
             font-size: 0.75rem;
68
             line-height: 1rem;
71
             line-height: 1rem;
69
-            border-bottom: 1px solid #d1d5db; /* Gray border for all rows */
72
+            padding: 0.75rem;
70
         }
73
         }
71
 
74
 
72
-        .category-header-row > td,
73
-        .type-header-row > td {
74
-            background-color: #f3f4f6; /* Gray background for category names */
75
-            font-weight: bold;
75
+        .table-head {
76
+            display: table-row-group;
76
         }
77
         }
77
 
78
 
78
-        .type-header-row > td,
79
-        .type-data-row > td,
80
-        .type-summary-row > td {
81
-            padding-left: 1.5rem; /* Indentation for type rows */
79
+        .text-center {
80
+            text-align: center;
82
         }
81
         }
83
 
82
 
84
-        .table-body tr {
85
-            background-color: #ffffff; /* White background for other rows */
83
+        .text-left {
84
+            text-align: left;
86
         }
85
         }
87
 
86
 
88
-        .spacer-row > td {
89
-            height: 0.75rem;
87
+        .text-right {
88
+            text-align: right;
90
         }
89
         }
91
 
90
 
92
-        .bold {
93
-            font-weight: bold;
91
+        .title {
92
+            font-size: 1.5rem;
94
         }
93
         }
95
 
94
 
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 */
95
+        .table-class .underline-bold {
96
+            border-bottom: 2px solid #374151;
101
         }
97
         }
102
 
98
 
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 */
99
+        .table-class .underline-thin {
100
+            border-bottom: 1px solid #374151;
112
         }
101
         }
113
 
102
 
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 */
103
+        .whitespace-normal {
104
+            white-space: normal;
123
         }
105
         }
124
 
106
 
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 */
107
+        .whitespace-nowrap {
108
+            white-space: nowrap;
109
+        }
110
+
111
+        table tfoot {
112
+            display: table-row-group;
129
         }
113
         }
130
     </style>
114
     </style>
131
 </head>
115
 </head>
140
     @endif
124
     @endif
141
 </div>
125
 </div>
142
 <table class="table-class">
126
 <table class="table-class">
127
+    <colgroup>
128
+        @if(array_key_exists('account_code', $report->getHeaders()))
129
+            <col span="1" style="width: 20%;">
130
+            <col span="1" style="width: 55%;">
131
+            <col span="1" style="width: 25%;">
132
+        @else
133
+            <col span="1" style="width: 65%;">
134
+            <col span="1" style="width: 35%;">
135
+        @endif
136
+    </colgroup>
143
     <thead class="table-head">
137
     <thead class="table-head">
144
     <tr>
138
     <tr>
145
-        @foreach($report->getCashInflowAndOutflowHeaders() as $index => $header)
139
+        @foreach($report->getHeaders() as $index => $header)
146
             <th class="{{ $report->getAlignmentClass($index) }}">
140
             <th class="{{ $report->getAlignmentClass($index) }}">
147
                 {{ $header }}
141
                 {{ $header }}
148
             </th>
142
             </th>
161
         @foreach($category->data as $account)
155
         @foreach($category->data as $account)
162
             <tr>
156
             <tr>
163
                 @foreach($account as $index => $cell)
157
                 @foreach($account as $index => $cell)
164
-                    <td class="{{ $report->getAlignmentClass($index) }} {{ $index === 1 ? 'whitespace-normal' : 'whitespace-nowrap' }}">
158
+                    <td @class([
159
+                            $report->getAlignmentClass($index),
160
+                            'whitespace-normal' => $index === 'account_name',
161
+                            'whitespace-nowrap' => $index !== 'account_name',
162
+                        ])
163
+                    >
165
                         @if(is_array($cell) && isset($cell['name']))
164
                         @if(is_array($cell) && isset($cell['name']))
166
                             {{ $cell['name'] }}
165
                             {{ $cell['name'] }}
167
                         @else
166
                         @else
177
             <!-- Type Header -->
176
             <!-- Type Header -->
178
             <tr class="type-header-row">
177
             <tr class="type-header-row">
179
                 @foreach($type->header as $index => $header)
178
                 @foreach($type->header as $index => $header)
180
-                    <td class="{{ $report->getAlignmentClass($index) }}">
179
+                    <td @class([
180
+                            $report->getAlignmentClass($index),
181
+                            'type-row-indent' => $index === 'account_name',
182
+                        ])
183
+                    >
181
                         {{ $header }}
184
                         {{ $header }}
182
                     </td>
185
                     </td>
183
                 @endforeach
186
                 @endforeach
187
             @foreach($type->data as $typeRow)
190
             @foreach($type->data as $typeRow)
188
                 <tr class="type-data-row">
191
                 <tr class="type-data-row">
189
                     @foreach($typeRow as $index => $cell)
192
                     @foreach($typeRow as $index => $cell)
190
-                        <td class="{{ $report->getAlignmentClass($index) }} {{ $index === 'account_name' ? 'whitespace-normal' : 'whitespace-nowrap' }}">
193
+                        <td @class([
194
+                                $report->getAlignmentClass($index),
195
+                                'whitespace-normal type-row-indent' => $index === 'account_name',
196
+                                'whitespace-nowrap' => $index !== 'account_name',
197
+                            ])
198
+                        >
191
                             @if(is_array($cell) && isset($cell['name']))
199
                             @if(is_array($cell) && isset($cell['name']))
192
                                 {{ $cell['name'] }}
200
                                 {{ $cell['name'] }}
193
                             @else
201
                             @else
201
             <!-- Type Summary -->
209
             <!-- Type Summary -->
202
             <tr class="type-summary-row">
210
             <tr class="type-summary-row">
203
                 @foreach($type->summary as $index => $cell)
211
                 @foreach($type->summary as $index => $cell)
204
-                    <td class="{{ $report->getAlignmentClass($index) }}">
212
+                    <td @class([
213
+                            $report->getAlignmentClass($index),
214
+                            'type-row-indent' => $index === 'account_name',
215
+                        ])
216
+                    >
205
                         {{ $cell }}
217
                         {{ $cell }}
206
                     </td>
218
                     </td>
207
                 @endforeach
219
                 @endforeach
210
 
222
 
211
         <tr class="category-summary-row">
223
         <tr class="category-summary-row">
212
             @foreach($category->summary as $index => $cell)
224
             @foreach($category->summary as $index => $cell)
213
-                <td
214
-                    @class([
225
+                <td @class([
215
                         'cell',
226
                         'cell',
216
                         $report->getAlignmentClass($index),
227
                         $report->getAlignmentClass($index),
217
                         'underline-bold' => $loop->last,
228
                         'underline-bold' => $loop->last,
222
             @endforeach
233
             @endforeach
223
         </tr>
234
         </tr>
224
 
235
 
225
-        <tr class="spacer-row">
226
-            <td colspan="{{ count($report->getHeaders()) }}"></td>
227
-        </tr>
236
+        @unless($loop->last && empty($report->getOverallTotals()))
237
+            <tr class="spacer-row">
238
+                <td colspan="{{ count($report->getHeaders()) }}"></td>
239
+            </tr>
240
+        @endunless
228
         </tbody>
241
         </tbody>
229
     @endforeach
242
     @endforeach
230
-    <tbody>
243
+    <tfoot>
231
     <tr class="table-footer-row">
244
     <tr class="table-footer-row">
232
         @foreach ($report->getOverallTotals() as $index => $total)
245
         @foreach ($report->getOverallTotals() as $index => $total)
233
             <td class="{{ $report->getAlignmentClass($index) }}">
246
             <td class="{{ $report->getAlignmentClass($index) }}">
235
             </td>
248
             </td>
236
         @endforeach
249
         @endforeach
237
     </tr>
250
     </tr>
238
-    </tbody>
251
+    </tfoot>
239
 </table>
252
 </table>
240
 
253
 
241
 <!-- Second Overview Table -->
254
 <!-- Second Overview Table -->
242
-<table class="table-class mt-4 border-t">
255
+<table class="table-class">
256
+    <colgroup>
257
+        @if(array_key_exists('account_code', $report->getHeaders()))
258
+            <col span="1" style="width: 20%;">
259
+            <col span="1" style="width: 55%;">
260
+            <col span="1" style="width: 25%;">
261
+        @else
262
+            <col span="1" style="width: 65%;">
263
+            <col span="1" style="width: 35%;">
264
+        @endif
265
+    </colgroup>
243
     <thead class="table-head">
266
     <thead class="table-head">
244
     <tr>
267
     <tr>
245
         @foreach($report->getOverviewHeaders() as $index => $header)
268
         @foreach($report->getOverviewHeaders() as $index => $header)
262
         @foreach($overviewCategory->data as $overviewAccount)
285
         @foreach($overviewCategory->data as $overviewAccount)
263
             <tr>
286
             <tr>
264
                 @foreach($overviewAccount as $index => $cell)
287
                 @foreach($overviewAccount as $index => $cell)
265
-                    <td class="{{ $report->getAlignmentClass($index) }} {{ $index === 'account_name' ? 'whitespace-normal' : 'whitespace-nowrap' }}">
288
+                    <td @class([
289
+                            $report->getAlignmentClass($index),
290
+                            'whitespace-normal' => $index === 'account_name',
291
+                            'whitespace-nowrap' => $index !== 'account_name',
292
+                        ])
293
+                    >
266
                         @if(is_array($cell) && isset($cell['name']))
294
                         @if(is_array($cell) && isset($cell['name']))
267
                             {{ $cell['name'] }}
295
                             {{ $cell['name'] }}
268
                         @else
296
                         @else
280
                 </td>
308
                 </td>
281
             @endforeach
309
             @endforeach
282
         </tr>
310
         </tr>
283
-       
311
+
284
         @if($overviewCategory->header['account_name'] === 'Starting Balance')
312
         @if($overviewCategory->header['account_name'] === 'Starting Balance')
285
             @foreach($report->getOverviewAlignedWithColumns() as $summaryRow)
313
             @foreach($report->getOverviewAlignedWithColumns() as $summaryRow)
286
                 <tr>
314
                 <tr>
287
                     @foreach($summaryRow as $index => $summaryCell)
315
                     @foreach($summaryRow as $index => $summaryCell)
288
-                        <td
289
-                            @class([
316
+                        <td @class([
290
                                 'cell',
317
                                 'cell',
291
                                 $report->getAlignmentClass($index),
318
                                 $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
319
+                                'font-bold' => $loop->parent->last,
320
+                                'underline-thin' => $loop->parent->remaining === 1 && $index === 'net_movement',
321
+                                'underline-bold' => $loop->parent->last && $index === 'net_movement',
295
                             ])
322
                             ])
296
                         >
323
                         >
297
                             {{ $summaryCell }}
324
                             {{ $summaryCell }}

+ 92
- 61
resources/views/components/company/reports/report-pdf.blade.php View File

5
     <meta name="viewport" content="width=device-width, initial-scale=1">
5
     <meta name="viewport" content="width=device-width, initial-scale=1">
6
     <title>{{ $report->getTitle() }}</title>
6
     <title>{{ $report->getTitle() }}</title>
7
     <style>
7
     <style>
8
+        .font-bold {
9
+            font-weight: bold;
10
+        }
11
+
12
+        .category-header-row > td,
13
+        .type-header-row > td {
14
+            background-color: #f3f4f6;
15
+            font-weight: bold;
16
+        }
17
+
18
+        .category-summary-row > td,
19
+        .table-footer-row > td,
20
+        .type-summary-row > td {
21
+            background-color: #ffffff;
22
+            font-weight: bold;
23
+        }
24
+
25
+        .company-name {
26
+            font-size: 1.125rem;
27
+            font-weight: bold;
28
+        }
29
+
30
+        .date-range {
31
+            font-size: 0.875rem;
32
+        }
33
+
8
         .header {
34
         .header {
9
             color: #374151;
35
             color: #374151;
10
             margin-bottom: 1rem;
36
             margin-bottom: 1rem;
11
         }
37
         }
12
 
38
 
13
-        .header > * + * {
39
+        .header div + div {
14
             margin-top: 0.5rem;
40
             margin-top: 0.5rem;
15
         }
41
         }
16
 
42
 
17
-        .table-head {
18
-            display: table-row-group;
43
+        .spacer-row > td {
44
+            height: 0.75rem;
19
         }
45
         }
20
 
46
 
21
-        .text-left {
22
-            text-align: left;
47
+        .table-body tr {
48
+            background-color: #ffffff;
23
         }
49
         }
24
 
50
 
25
-        .text-right {
26
-            text-align: right;
51
+        .table-class {
52
+            border-collapse: collapse;
53
+            width: 100%;
27
         }
54
         }
28
 
55
 
29
-        .text-center {
30
-            text-align: center;
56
+        .table-class .type-row-indent {
57
+            padding-left: 1.5rem;
31
         }
58
         }
32
 
59
 
33
-        .table-class th,
34
-        .table-class td {
60
+        .table-class td,
61
+        .table-class th {
62
+            border-bottom: 1px solid #d1d5db;
35
             color: #374151;
63
             color: #374151;
64
+            font-size: 0.75rem;
65
+            line-height: 1rem;
66
+            padding: 0.75rem;
36
         }
67
         }
37
 
68
 
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;
69
+        .table-head {
70
+            display: table-row-group;
48
         }
71
         }
49
 
72
 
50
-        .company-name {
51
-            font-size: 1.125rem;
52
-            font-weight: bold;
73
+        .text-center {
74
+            text-align: center;
53
         }
75
         }
54
 
76
 
55
-        .date-range {
56
-            font-size: 0.875rem;
77
+        .text-left {
78
+            text-align: left;
57
         }
79
         }
58
 
80
 
59
-        .table-class {
60
-            width: 100%;
61
-            border-collapse: collapse;
81
+        .text-right {
82
+            text-align: right;
62
         }
83
         }
63
 
84
 
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 */
85
+        .title {
86
+            font-size: 1.5rem;
70
         }
87
         }
71
 
88
 
72
-        .category-header-row > td,
73
-        .type-header-row > td {
74
-            background-color: #f3f4f6; /* Gray background for category names */
75
-            font-weight: bold;
89
+        .table-class .underline-bold {
90
+            border-bottom: 2px solid #374151;
76
         }
91
         }
77
 
92
 
78
-        .type-header-row > td,
79
-        .type-data-row > td,
80
-        .type-summary-row > td {
81
-            padding-left: 1.5rem; /* Indentation for type rows */
93
+        .table-class .underline-thin {
94
+            border-bottom: 1px solid #374151;
82
         }
95
         }
83
 
96
 
84
-        .table-body tr {
85
-            background-color: #ffffff; /* White background for other rows */
97
+        .whitespace-normal {
98
+            white-space: normal;
86
         }
99
         }
87
 
100
 
88
-        .spacer-row > td {
89
-            height: 0.75rem;
101
+        .whitespace-nowrap {
102
+            white-space: nowrap;
90
         }
103
         }
91
 
104
 
92
-        .category-summary-row > td,
93
-        .type-summary-row > td,
94
-        .table-footer-row > td {
95
-            font-weight: bold;
96
-            background-color: #ffffff; /* White background for footer */
105
+        table tfoot {
106
+            display: table-row-group;
97
         }
107
         }
98
     </style>
108
     </style>
99
 </head>
109
 </head>
129
         @foreach($category->data as $account)
139
         @foreach($category->data as $account)
130
             <tr>
140
             <tr>
131
                 @foreach($account as $index => $cell)
141
                 @foreach($account as $index => $cell)
132
-                    <td class="{{ $report->getAlignmentClass($index) }} {{ $index === 1 ? 'whitespace-normal' : 'whitespace-nowrap' }}">
142
+                    <td @class([
143
+                            $report->getAlignmentClass($index),
144
+                            'whitespace-normal' => $index === 'account_name',
145
+                            'whitespace-nowrap' => $index !== 'account_name',
146
+                        ])
147
+                    >
133
                         @if(is_array($cell) && isset($cell['name']))
148
                         @if(is_array($cell) && isset($cell['name']))
134
                             {{ $cell['name'] }}
149
                             {{ $cell['name'] }}
135
                         @else
150
                         @else
145
             <!-- Type Header -->
160
             <!-- Type Header -->
146
             <tr class="type-header-row">
161
             <tr class="type-header-row">
147
                 @foreach($type->header as $index => $header)
162
                 @foreach($type->header as $index => $header)
148
-                    <td class="{{ $report->getAlignmentClass($index) }}">
163
+                    <td @class([
164
+                            $report->getAlignmentClass($index),
165
+                            'type-row-indent' => $index === 'account_name',
166
+                        ])
167
+                    >
149
                         {{ $header }}
168
                         {{ $header }}
150
                     </td>
169
                     </td>
151
                 @endforeach
170
                 @endforeach
155
             @foreach($type->data as $typeRow)
174
             @foreach($type->data as $typeRow)
156
                 <tr class="type-data-row">
175
                 <tr class="type-data-row">
157
                     @foreach($typeRow as $index => $cell)
176
                     @foreach($typeRow as $index => $cell)
158
-                        <td class="{{ $report->getAlignmentClass($index) }} {{ $index === 'account_name' ? 'whitespace-normal' : 'whitespace-nowrap' }}">
177
+                        <td @class([
178
+                                $report->getAlignmentClass($index),
179
+                                'whitespace-normal type-row-indent' => $index === 'account_name',
180
+                                'whitespace-nowrap' => $index !== 'account_name',
181
+                            ])
182
+                        >
159
                             @if(is_array($cell) && isset($cell['name']))
183
                             @if(is_array($cell) && isset($cell['name']))
160
                                 {{ $cell['name'] }}
184
                                 {{ $cell['name'] }}
161
                             @else
185
                             @else
169
             <!-- Type Summary -->
193
             <!-- Type Summary -->
170
             <tr class="type-summary-row">
194
             <tr class="type-summary-row">
171
                 @foreach($type->summary as $index => $cell)
195
                 @foreach($type->summary as $index => $cell)
172
-                    <td class="{{ $report->getAlignmentClass($index) }}">
196
+                    <td @class([
197
+                            $report->getAlignmentClass($index),
198
+                            'type-row-indent' => $index === 'account_name',
199
+                        ])
200
+                    >
173
                         {{ $cell }}
201
                         {{ $cell }}
174
                     </td>
202
                     </td>
175
                 @endforeach
203
                 @endforeach
183
                 </td>
211
                 </td>
184
             @endforeach
212
             @endforeach
185
         </tr>
213
         </tr>
186
-        <tr class="spacer-row">
187
-            <td colspan="{{ count($report->getHeaders()) }}"></td>
188
-        </tr>
214
+
215
+        @unless($loop->last && empty($report->getOverallTotals()))
216
+            <tr class="spacer-row">
217
+                <td colspan="{{ count($report->getHeaders()) }}"></td>
218
+            </tr>
219
+        @endunless
189
         </tbody>
220
         </tbody>
190
     @endforeach
221
     @endforeach
191
-    <tbody>
222
+    <tfoot>
192
     <tr class="table-footer-row">
223
     <tr class="table-footer-row">
193
         @foreach ($report->getOverallTotals() as $index => $total)
224
         @foreach ($report->getOverallTotals() as $index => $total)
194
             <td class="{{ $report->getAlignmentClass($index) }}">
225
             <td class="{{ $report->getAlignmentClass($index) }}">
196
             </td>
227
             </td>
197
         @endforeach
228
         @endforeach
198
     </tr>
229
     </tr>
199
-    </tbody>
230
+    </tfoot>
200
 </table>
231
 </table>
201
 </body>
232
 </body>
202
 </html>
233
 </html>

+ 1
- 1
resources/views/components/company/tables/reports/balance-sheet-summary.blade.php View File

3
         <col span="1" style="width: 65%;">
3
         <col span="1" style="width: 65%;">
4
         <col span="1" style="width: 35%;">
4
         <col span="1" style="width: 35%;">
5
     </colgroup>
5
     </colgroup>
6
-    <x-company.tables.header :headers="$report->getSummaryTitleHeaders()"
6
+    <x-company.tables.header :headers="$report->getSummaryHeaders()"
7
                              :alignment-class="[$report, 'getAlignmentClass']"/>
7
                              :alignment-class="[$report, 'getAlignmentClass']"/>
8
     @foreach($report->getSummaryCategories() as $accountCategory)
8
     @foreach($report->getSummaryCategories() as $accountCategory)
9
         <tbody class="divide-y divide-gray-200 whitespace-nowrap dark:divide-white/5">
9
         <tbody class="divide-y divide-gray-200 whitespace-nowrap dark:divide-white/5">

+ 1
- 1
resources/views/components/company/tables/reports/balance-sheet.blade.php View File

9
             <col span="1" style="width: 35%;">
9
             <col span="1" style="width: 35%;">
10
         @endif
10
         @endif
11
     </colgroup>
11
     </colgroup>
12
-    <x-company.tables.header :headers="$report->getTitleHeaders()" :alignment-class="[$report, 'getAlignmentClass']"/>
12
+    <x-company.tables.header :headers="$report->getHeaders()" :alignment-class="[$report, 'getAlignmentClass']"/>
13
     @foreach($report->getCategories() as $accountCategory)
13
     @foreach($report->getCategories() as $accountCategory)
14
         <tbody class="divide-y divide-gray-200 whitespace-nowrap dark:divide-white/5">
14
         <tbody class="divide-y divide-gray-200 whitespace-nowrap dark:divide-white/5">
15
         <x-company.tables.category-header :category-headers="$accountCategory->header"
15
         <x-company.tables.category-header :category-headers="$accountCategory->header"

+ 1
- 1
resources/views/components/company/tables/reports/cash-flow-statement-summary.blade.php View File

3
         <col span="1" style="width: 65%;">
3
         <col span="1" style="width: 65%;">
4
         <col span="1" style="width: 35%;">
4
         <col span="1" style="width: 35%;">
5
     </colgroup>
5
     </colgroup>
6
-    <x-company.tables.header :headers="$report->getSummaryCashInflowAndOutflowHeaders()"
6
+    <x-company.tables.header :headers="$report->getSummaryHeaders()"
7
                              :alignment-class="[$report, 'getAlignmentClass']"/>
7
                              :alignment-class="[$report, 'getAlignmentClass']"/>
8
     @foreach($report->getSummaryCategories() as $accountCategory)
8
     @foreach($report->getSummaryCategories() as $accountCategory)
9
         <tbody class="divide-y divide-gray-200 whitespace-nowrap dark:divide-white/5">
9
         <tbody class="divide-y divide-gray-200 whitespace-nowrap dark:divide-white/5">

+ 1
- 2
resources/views/components/company/tables/reports/cash-flow-statement.blade.php View File

9
             <col span="1" style="width: 35%;">
9
             <col span="1" style="width: 35%;">
10
         @endif
10
         @endif
11
     </colgroup>
11
     </colgroup>
12
-    <x-company.tables.header :headers="$report->getCashInflowAndOutflowHeaders()"
13
-                             :alignment-class="[$report, 'getAlignmentClass']"/>
12
+    <x-company.tables.header :headers="$report->getHeaders()" :alignment-class="[$report, 'getAlignmentClass']"/>
14
     @foreach($report->getCategories() as $accountCategory)
13
     @foreach($report->getCategories() as $accountCategory)
15
         <tbody class="divide-y divide-gray-200 whitespace-nowrap dark:divide-white/5">
14
         <tbody class="divide-y divide-gray-200 whitespace-nowrap dark:divide-white/5">
16
         <x-company.tables.category-header :category-headers="$accountCategory->header"
15
         <x-company.tables.category-header :category-headers="$accountCategory->header"

+ 1
- 1
resources/views/components/company/tables/reports/income-statement-summary.blade.php View File

3
         <col span="1" style="width: 65%;">
3
         <col span="1" style="width: 65%;">
4
         <col span="1" style="width: 35%;">
4
         <col span="1" style="width: 35%;">
5
     </colgroup>
5
     </colgroup>
6
-    <x-company.tables.header :headers="$report->getSummaryTitleHeaders()"
6
+    <x-company.tables.header :headers="$report->getSummaryHeaders()"
7
                              :alignment-class="[$report, 'getAlignmentClass']"/>
7
                              :alignment-class="[$report, 'getAlignmentClass']"/>
8
     @foreach($report->getSummaryCategories() as $accountCategory)
8
     @foreach($report->getSummaryCategories() as $accountCategory)
9
         <tbody class="divide-y divide-gray-200 whitespace-nowrap dark:divide-white/5">
9
         <tbody class="divide-y divide-gray-200 whitespace-nowrap dark:divide-white/5">

+ 1
- 1
resources/views/components/company/tables/reports/income-statement.blade.php View File

9
             <col span="1" style="width: 35%;">
9
             <col span="1" style="width: 35%;">
10
         @endif
10
         @endif
11
     </colgroup>
11
     </colgroup>
12
-    <x-company.tables.header :headers="$report->getTitleHeaders()" :alignment-class="[$report, 'getAlignmentClass']"/>
12
+    <x-company.tables.header :headers="$report->getHeaders()" :alignment-class="[$report, 'getAlignmentClass']"/>
13
     @foreach($report->getCategories() as $accountCategory)
13
     @foreach($report->getCategories() as $accountCategory)
14
         <tbody class="divide-y divide-gray-200 whitespace-nowrap dark:divide-white/5">
14
         <tbody class="divide-y divide-gray-200 whitespace-nowrap dark:divide-white/5">
15
         <x-company.tables.category-header :category-headers="$accountCategory->header"
15
         <x-company.tables.category-header :category-headers="$accountCategory->header"

Loading…
Cancel
Save