You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

cash-flow-statement-pdf.blade.php 9.4KB

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