receipt.blade.php 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title></title>
  5. <style>
  6. body {
  7. font-family: Helvetica, Arial, sans-serif;
  8. font-size:14px;
  9. }
  10. footer {
  11. position: fixed;
  12. bottom: -20px;
  13. left: 0px;
  14. right: 0px;
  15. height: 50px;
  16. }
  17. .logo {
  18. max-width: 200px;
  19. max-height: 100px;
  20. object-fit: contain;
  21. }
  22. </style>
  23. </head>
  24. <body>
  25. @php
  26. $azienda = App\Models\Azienda::first();
  27. $logoService = app(App\Services\LogoUploadServices::class);
  28. $logoUrl = $azienda ? $logoService->getLogoUrl($azienda) : null;
  29. @endphp
  30. {{-- Display logo from database/Wasabi instead of env --}}
  31. @if($logoUrl)
  32. <img src="{{ $logoUrl }}" class="logo" alt="Logo">
  33. @elseif($azienda && $azienda->logo)
  34. {{-- Fallback if URL generation fails --}}
  35. <div style="width: 200px; height: 100px; border: 1px dashed #ccc; display: flex; align-items: center; justify-content: center;">
  36. <small>Logo non disponibile</small>
  37. </div>
  38. @endif
  39. <br><br><br>
  40. <div align="right"><b>RICEVUTA DI PAGAMENTO N. {{$receipt->number . "/" . $receipt->year}} del {{date("d/m/Y", strtotime($receipt->created_at))}}</b></div><br><br>
  41. @if($receipt->status == 99)
  42. <div align="right"><b style="color:red">ANNULLATA</b></div><br><br>
  43. @endif
  44. <br>
  45. @if($azienda)
  46. @if($azienda->ragione_sociale)
  47. {{$azienda->ragione_sociale}}
  48. @elseif($azienda->nome_associazione)
  49. {{$azienda->nome_associazione}}
  50. @endif
  51. <br><br>
  52. <b>Indirizzo</b>:
  53. @php
  54. $addressParts = array_filter([
  55. $azienda->sede_legale_indirizzo,
  56. $azienda->sede_legale_cap,
  57. $azienda->sede_legale_comune,
  58. $azienda->sede_legale_provincia ? '(' . $azienda->sede_legale_provincia . ')' : null
  59. ]);
  60. @endphp
  61. {{ implode(' ', $addressParts) }}
  62. <br><br>
  63. @if($azienda->codice_fiscale)
  64. <b>C.F.</b>: {{$azienda->codice_fiscale}}<br><br>
  65. @endif
  66. @if($azienda->partita_iva)
  67. <b>P.IVA</b>: {{$azienda->partita_iva}}<br><br>
  68. @endif
  69. @if($azienda->email)
  70. <b>Email</b>: {{$azienda->email}}<br><br>
  71. @endif
  72. @if($azienda->pec)
  73. <b>PEC</b>: {{$azienda->pec}}<br><br>
  74. @endif
  75. @else
  76. <div style="color: red; font-weight: bold;">
  77. ATTENZIONE: Configurare i dati aziendali nel sistema
  78. </div><br><br>
  79. @endif
  80. <hr><br>
  81. <b>Intestata a</b><br><br>
  82. @if(!$receipt->member->isAdult())
  83. <b>Genitore</b>: {{$receipt->parent}}<br><br>
  84. @endif
  85. @if($receipt->member->last_name != '')
  86. <b>Cognome</b>: {{$receipt->member->last_name}}<br><br>
  87. @endif
  88. @if($receipt->member->first_name != '')
  89. <b>Nome</b>: {{$receipt->member->first_name}}<br><br>
  90. @endif
  91. @if(@$receipt->member->birth_city->name != '' || @$receipt->member->birth_province->name != '' || @$receipt->member->birth_date != '')
  92. <b>Nato/a a</b>:
  93. @if(@$receipt->member->birth_city->name != '')
  94. {{@$receipt->member->birth_city->name}}
  95. @endif
  96. @if(@$receipt->member->birth_province->name != '')
  97. ({{@$receipt->member->birth_province->name}})
  98. @endif
  99. @if(@$receipt->member->birth_date != '')
  100. il {{$receipt->member->birth_date ? date("d/m/Y", strtotime($receipt->member->birth_date)) : ""}}
  101. @endif
  102. <br><br>
  103. @endif
  104. @if($receipt->member->address != '' || @$receipt->member->city->name != '' || @$receipt->member->province->name != '')
  105. <b>Residente in</b>:
  106. @if($receipt->member->address != '')
  107. {{$receipt->member->address}}
  108. @endif
  109. @if(@$receipt->member->city->name != '')
  110. {{@$receipt->member->city->name}}
  111. @endif
  112. @if(@$receipt->member->province->name != '')
  113. ({{@$receipt->member->province->name}})
  114. @endif
  115. <br><br>
  116. @endif
  117. @if($receipt->member->fiscal_code != '')
  118. <b>Codice Fiscale</b>: {{$receipt->member->fiscal_code}}<br><br>
  119. @endif
  120. <hr><br>
  121. @php
  122. $total = 0;
  123. $totalSconto = 0;
  124. $totalPrediscount = 0;
  125. $hasDiscount = false;
  126. @endphp
  127. @foreach($receipt->rows as $row)
  128. <b>Causale</b>: {{@$row->causal->getTree()}}<br><br>
  129. @if ($row->course)
  130. <b>Corso</b>: {{$row->course->getDetailsName()}}<br><br>
  131. @endif
  132. @if ($row->note != '')
  133. <b>Dettaglio causale</b>: {{$row->note}}<br><br>
  134. @endif
  135. @if($row->sconto > 0)
  136. @php $hasDiscount = true; @endphp
  137. <b>Importo</b>: {{formatPrice($row->prediscount_amount)}}<br><br>
  138. <b>Sconto</b>: {{formatPrice($row->sconto)}}<br><br>
  139. @endif
  140. <b>{{$row->sconto > 0 ? 'Importo finale' : 'Importo'}}</b>: {{formatPrice($row->amount)}}<br><br>
  141. <hr><br>
  142. @php
  143. $totalSconto += $row->sconto;
  144. $totalPrediscount += $row->prediscount_amount;
  145. $total += $row->amount;
  146. @endphp
  147. @endforeach
  148. <br><br>
  149. @if($hasDiscount)
  150. <b>Totale</b>: {{formatPrice($totalPrediscount)}}<br><br>
  151. <b>Sconto totale</b>: {{formatPrice($totalSconto)}}<br><br>
  152. @endif
  153. <b>Totale</b>: {{formatPrice($total)}}<br><br>
  154. <footer>
  155. <small>
  156. @if($azienda)
  157. @php
  158. $locationParts = array_filter([
  159. $azienda->sede_legale_comune,
  160. $azienda->sede_legale_provincia ? '(' . $azienda->sede_legale_provincia . ')' : null
  161. ]);
  162. $location = implode(' ', $locationParts);
  163. @endphp
  164. {{ $location ?: 'Sede legale' }} li {{date("d/m/Y", strtotime($receipt->created_at))}}
  165. @else
  166. {{date("d/m/Y", strtotime($receipt->created_at))}}
  167. @endif
  168. </small>
  169. </footer>
  170. </body>
  171. </html>