PageRenderTime 27ms CodeModel.GetById 13ms RepoModel.GetById 1ms app.codeStats 0ms

/app/CoreFacturalo/Templates/pdf/top_placa/invoice_a4.blade.php

https://gitlab.com/laher01/factu40
PHP | 338 lines | 327 code | 10 blank | 1 comment | 6 complexity | 4a0a605a1d344b4a5acaa4dcec471d19 MD5 | raw file
  1. @php
  2. $establishment = $document->establishment;
  3. $customer = $document->customer;
  4. $invoice = $document->invoice;
  5. $document_base = ($document->note) ? $document->note : null;
  6. //$path_style = app_path('CoreFacturalo'.DIRECTORY_SEPARATOR.'Templates'.DIRECTORY_SEPARATOR.'pdf'.DIRECTORY_SEPARATOR.'style.css');
  7. $document_number = $document->series.'-'.str_pad($document->number, 8, '0', STR_PAD_LEFT);
  8. $accounts = \App\Models\Tenant\BankAccount::all();
  9. if($document_base) {
  10. $affected_document_number = $document_base->affected_document->series.'-'.str_pad($document_base->affected_document->number, 8, '0', STR_PAD_LEFT);
  11. } else {
  12. $affected_document_number = null;
  13. }
  14. @endphp
  15. <html>
  16. <head>
  17. {{--<title>{{ $document_number }}</title>--}}
  18. {{--<link href="{{ $path_style }}" rel="stylesheet" />--}}
  19. </head>
  20. <body>
  21. <table class="full-width">
  22. <tr>
  23. @if($company->logo)
  24. <td width="20%">
  25. <div class="company_logo_box">
  26. <img src="data:{{mime_content_type(public_path("storage/uploads/logos/{$company->logo}"))}};base64, {{base64_encode(file_get_contents(public_path("storage/uploads/logos/{$company->logo}")))}}" alt="{{$company->name}}" class="company_logo" style="max-width: 150px;">
  27. </div>
  28. </td>
  29. @else
  30. <td width="20%">
  31. {{--<img src="{{ asset('logo/logo.jpg') }}" class="company_logo" style="max-width: 150px">--}}
  32. </td>
  33. @endif
  34. <td width="50%" class="pl-3">
  35. <div class="text-left">
  36. <h4 class="">{{ $company->name }}</h4>
  37. <h5>{{ 'RUC '.$company->number }}</h5>
  38. <h6 style="text-transform: uppercase;">
  39. {{ ($establishment->address !== '-')? $establishment->address : '' }}
  40. {{ ($establishment->district_id !== '-')? ', '.$establishment->district->description : '' }}
  41. {{ ($establishment->province_id !== '-')? ', '.$establishment->province->description : '' }}
  42. {{ ($establishment->department_id !== '-')? '- '.$establishment->department->description : '' }}
  43. </h6>
  44. <h6>{{ ($establishment->email !== '-')? $establishment->email : '' }}</h6>
  45. <h6>{{ ($establishment->telephone !== '-')? $establishment->telephone : '' }}</h6>
  46. </div>
  47. </td>
  48. <td width="30%" class="border-box py-4 px-2 text-center">
  49. <h5 class="text-center">{{ $document->document_type->description }}</h5>
  50. <h3 class="text-center">{{ $document_number }}</h3>
  51. </td>
  52. </tr>
  53. </table>
  54. <table class="full-width mt-5">
  55. <tr>
  56. <td width="120px">FECHA DE EMISIÓN</td>
  57. <td width="8px">:</td>
  58. <td>{{$document->date_of_issue->format('Y-m-d')}}</td>
  59. </tr>
  60. @if($invoice)
  61. <tr>
  62. <td>FECHA DE VENCIMIENTO</td>
  63. <td width="8px">:</td>
  64. <td>{{$invoice->date_of_due->format('Y-m-d')}}</td>
  65. </tr>
  66. @endif
  67. <tr>
  68. <td>CLIENTE</td>
  69. <td>:</td>
  70. <td>{{ $customer->name }}</td>
  71. </tr>
  72. <tr>
  73. <td>{{ $customer->identity_document_type->description }}</td>
  74. <td>:</td>
  75. <td>{{$customer->number}}</td>
  76. </tr>
  77. <tr>
  78. <td class="align-top">DIRECCIÓN</td>
  79. <td>:</td>
  80. <td>
  81. {{ $customer->address }}
  82. </td>
  83. </tr>
  84. </table>
  85. {{--<table class="full-width mt-3">--}}
  86. {{--@if ($document->purchase_order)--}}
  87. {{--<tr>--}}
  88. {{--<td width="25%">Orden de Compra: </td>--}}
  89. {{--<td>:</td>--}}
  90. {{--<td class="text-left">{{ $document->purchase_order }}</td>--}}
  91. {{--</tr>--}}
  92. {{--@endif--}}
  93. {{--@if ($document->quotation_id)--}}
  94. {{--<tr>--}}
  95. {{--<td width="15%">Cotización:</td>--}}
  96. {{--<td class="text-left" width="85%">{{ $document->quotation->identifier }}</td>--}}
  97. {{--</tr>--}}
  98. {{--@endif--}}
  99. {{--</table>--}}
  100. @if ($document->guides)
  101. <br/>
  102. {{--<strong>Guías:</strong>--}}
  103. <table>
  104. @foreach($document->guides as $guide)
  105. <tr>
  106. @if(isset($guide->document_type_description))
  107. <td>{{ $guide->document_type_description }}</td>
  108. @else
  109. <td>{{ $guide->document_type_id }}</td>
  110. @endif
  111. <td>:</td>
  112. <td>{{ $guide->number }}</td>
  113. </tr>
  114. @endforeach
  115. </table>
  116. @endif
  117. <table class="full-width mt-3">
  118. {{-- @if ($document->purchase_order)
  119. <tr>
  120. <td width="120px">ORDEN DE COMPRA</td>
  121. <td width="8px">:</td>
  122. <td>{{ $document->purchase_order }}</td>
  123. </tr>
  124. @endif --}}
  125. <tr>
  126. <td width="120px">PLACAS</td>
  127. <td>:</td>
  128. <td>
  129. @foreach($document->items as $row)
  130. @if($row->attributes)
  131. @foreach($row->attributes as $attr)
  132. @if($attr->description == "Número de Placa")
  133. {{ $attr->value }} -
  134. @endif
  135. @endforeach
  136. @endif
  137. @endforeach
  138. </td>
  139. </tr>
  140. @if ($document->quotation_id)
  141. <tr>
  142. <td>COTIZACIÓN</td>
  143. <td>:</td>
  144. <td>{{ $document->quotation->identifier }}</td>
  145. </tr>
  146. @endif
  147. @if(!is_null($document_base))
  148. <tr>
  149. <td width="120px">DOC. AFECTADO</td>
  150. <td width="8px">:</td>
  151. <td>{{ $affected_document_number }}</td>
  152. </tr>
  153. <tr>
  154. <td>TIPO DE NOTA</td>
  155. <td>:</td>
  156. <td>{{ ($document_base->note_type === 'credit')?$document_base->note_credit_type->description:$document_base->note_debit_type->description}}</td>
  157. </tr>
  158. <tr>
  159. <td>DESCRIPCIÓN</td>
  160. <td>:</td>
  161. <td>{{ $document_base->note_description }}</td>
  162. </tr>
  163. @endif
  164. </table>
  165. {{--<table class="full-width mt-3">--}}
  166. {{--<tr>--}}
  167. {{--<td width="25%">Documento Afectado:</td>--}}
  168. {{--<td width="20%">{{ $document_base->affected_document->series }}-{{ $document_base->affected_document->number }}</td>--}}
  169. {{--<td width="15%">Tipo de nota:</td>--}}
  170. {{--<td width="40%">{{ ($document_base->note_type === 'credit')?$document_base->note_credit_type->description:$document_base->note_debit_type->description}}</td>--}}
  171. {{--</tr>--}}
  172. {{--<tr>--}}
  173. {{--<td class="align-top">Descripción:</td>--}}
  174. {{--<td class="text-left" colspan="3">{{ $document_base->note_description }}</td>--}}
  175. {{--</tr>--}}
  176. {{--</table>--}}
  177. <table class="full-width mt-10 mb-10">
  178. <thead class="">
  179. <tr class="bg-grey">
  180. <th class="border-top-bottom text-center py-2" width="8%">CANT.</th>
  181. <th class="border-top-bottom text-center py-2" width="8%">UNIDAD</th>
  182. <th class="border-top-bottom text-left py-2">DESCRIPCIÓN</th>
  183. <th class="border-top-bottom text-right py-2" width="12%">P.UNIT</th>
  184. <th class="border-top-bottom text-right py-2" width="8%">DTO.</th>
  185. <th class="border-top-bottom text-right py-2" width="12%">TOTAL</th>
  186. </tr>
  187. </thead>
  188. <tbody>
  189. @foreach($document->items as $row)
  190. <tr>
  191. <td class="text-center align-top">
  192. @if(((int)$row->quantity != $row->quantity))
  193. {{ $row->quantity }}
  194. @else
  195. {{ number_format($row->quantity, 0) }}
  196. @endif
  197. </td>
  198. <td class="text-center align-top">{{ $row->item->unit_type_id }}</td>
  199. <td class="text-left align-top">
  200. {!!$row->item->description!!} @if (!empty($row->item->presentation)) {!!$row->item->presentation->description!!} @endif
  201. @if($row->attributes)
  202. @foreach($row->attributes as $attr)
  203. @if($attr->description != 'Número de Placa')
  204. <br/><span style="font-size: 9px">{!! $attr->description !!} : {{ $attr->value }}</span>
  205. @endif
  206. @endforeach
  207. @endif
  208. @if($row->discounts)
  209. @foreach($row->discounts as $dtos)
  210. <br/><span style="font-size: 9px">{{ $dtos->factor * 100 }}% {{$dtos->description }}</span>
  211. @endforeach
  212. @endif
  213. </td>
  214. <td class="text-right align-top">{{ number_format($row->unit_price, 2) }}</td>
  215. <td class="text-right align-top">
  216. @if($row->discounts)
  217. @php
  218. $total_discount_line = 0;
  219. foreach ($row->discounts as $disto) {
  220. $total_discount_line = $total_discount_line + $disto->amount;
  221. }
  222. @endphp
  223. {{ number_format($total_discount_line, 2) }}
  224. @else
  225. 0
  226. @endif
  227. </td>
  228. <td class="text-right align-top">{{ number_format($row->total, 2) }}</td>
  229. </tr>
  230. <tr>
  231. <td colspan="6" class="border-bottom"></td>
  232. </tr>
  233. @endforeach
  234. @if($document->total_exportation > 0)
  235. <tr>
  236. <td colspan="5" class="text-right font-bold">OP. EXPORTACIÓN: {{ $document->currency_type->symbol }}</td>
  237. <td class="text-right font-bold">{{ number_format($document->total_exportation, 2) }}</td>
  238. </tr>
  239. @endif
  240. @if($document->total_free > 0)
  241. <tr>
  242. <td colspan="5" class="text-right font-bold">OP. GRATUITAS: {{ $document->currency_type->symbol }}</td>
  243. <td class="text-right font-bold">{{ number_format($document->total_free, 2) }}</td>
  244. </tr>
  245. @endif
  246. @if($document->total_unaffected > 0)
  247. <tr>
  248. <td colspan="5" class="text-right font-bold">OP. INAFECTAS: {{ $document->currency_type->symbol }}</td>
  249. <td class="text-right font-bold">{{ number_format($document->total_unaffected, 2) }}</td>
  250. </tr>
  251. @endif
  252. @if($document->total_exonerated > 0)
  253. <tr>
  254. <td colspan="5" class="text-right font-bold">OP. EXONERADAS: {{ $document->currency_type->symbol }}</td>
  255. <td class="text-right font-bold">{{ number_format($document->total_exonerated, 2) }}</td>
  256. </tr>
  257. @endif
  258. @if($document->total_taxed > 0)
  259. <tr>
  260. <td colspan="5" class="text-right font-bold">OP. GRAVADAS: {{ $document->currency_type->symbol }}</td>
  261. <td class="text-right font-bold">{{ number_format($document->total_taxed, 2) }}</td>
  262. </tr>
  263. @endif
  264. @if($document->total_discount > 0)
  265. <tr>
  266. <td colspan="5" class="text-right font-bold">{{(($document->total_prepayment > 0) ? 'ANTICIPO':'DESCUENTO TOTAL')}}: {{ $document->currency_type->symbol }}</td>
  267. <td class="text-right font-bold">{{ number_format($document->total_discount, 2) }}</td>
  268. </tr>
  269. @endif
  270. @if($document->total_plastic_bag_taxes > 0)
  271. <tr>
  272. <td colspan="5" class="text-right font-bold">ICBPER: {{ $document->currency_type->symbol }}</td>
  273. <td class="text-right font-bold">{{ number_format($document->total_plastic_bag_taxes, 2) }}</td>
  274. </tr>
  275. @endif
  276. <tr>
  277. <td colspan="5" class="text-right font-bold">IGV: {{ $document->currency_type->symbol }}</td>
  278. <td class="text-right font-bold">{{ number_format($document->total_igv, 2) }}</td>
  279. </tr>
  280. <tr>
  281. <td colspan="5" class="text-right font-bold">TOTAL A PAGAR: {{ $document->currency_type->symbol }}</td>
  282. <td class="text-right font-bold">{{ number_format($document->total, 2) }}</td>
  283. </tr>
  284. </tbody>
  285. </table>
  286. <table class="full-width">
  287. <tr>
  288. <td width="65%" style="text-align: top; vertical-align: top;">
  289. @foreach(array_reverse( (array) $document->legends) as $row)
  290. @if ($row->code == "1000")
  291. <p style="text-transform: uppercase;">Son: <span class="font-bold">{{ $row->value }} {{ $document->currency_type->description }}</span></p>
  292. @if (count((array) $document->legends)>1)
  293. <p><span class="font-bold">Leyendas</span></p>
  294. @endif
  295. @else
  296. <p> {{$row->code}}: {{ $row->value }} </p>
  297. @endif
  298. @endforeach
  299. <br/>
  300. @foreach($document->additional_information as $information)
  301. @if ($information)
  302. @if ($loop->first)
  303. <strong>Información adicional</strong>
  304. @endif
  305. <p>{{ $information }}</p>
  306. @endif
  307. @endforeach
  308. <br>
  309. @if(in_array($document->document_type->id,['01','03']))
  310. @foreach($accounts as $account)
  311. <p>
  312. <span class="font-bold">{{$account->bank->description}}</span> {{$account->currency_type->description}}
  313. <span class="font-bold">N°:</span> {{$account->number}}
  314. @if($account->cci)
  315. <span class="font-bold">CCI:</span> {{$account->cci}}
  316. @endif
  317. </p>
  318. @endforeach
  319. @endif
  320. </td>
  321. <td width="35%" class="text-right">
  322. <img src="data:image/png;base64, {{ $document->qr }}" style="margin-right: -10px;" />
  323. <p style="font-size: 9px">Código Hash: {{ $document->hash }}</p>
  324. </td>
  325. </tr>
  326. </table>
  327. </body>
  328. </html>