PageRenderTime 58ms CodeModel.GetById 28ms RepoModel.GetById 0ms app.codeStats 0ms

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

https://gitlab.com/laher01/factu40
PHP | 333 lines | 322 code | 10 blank | 1 comment | 5 complexity | b1dd3f99065e3e1b9f21a181d976010f 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. @if ($customer->address !== '')
  78. <tr>
  79. <td class="align-top">DIRECCIÓN:</td>
  80. <td>:</td>
  81. <td style="text-transform: uppercase;">
  82. {{ $customer->address }}
  83. {{ ($customer->district_id !== '-')? ', '.$customer->district->description : '' }}
  84. {{ ($customer->province_id !== '-')? ', '.$customer->province->description : '' }}
  85. {{ ($customer->department_id !== '-')? '- '.$customer->department->description : '' }}
  86. </td>
  87. </tr>
  88. @endif
  89. </table>
  90. {{--<table class="full-width mt-3">--}}
  91. {{--@if ($document->purchase_order)--}}
  92. {{--<tr>--}}
  93. {{--<td width="25%">Orden de Compra: </td>--}}
  94. {{--<td>:</td>--}}
  95. {{--<td class="text-left">{{ $document->purchase_order }}</td>--}}
  96. {{--</tr>--}}
  97. {{--@endif--}}
  98. {{--@if ($document->quotation_id)--}}
  99. {{--<tr>--}}
  100. {{--<td width="15%">Cotización:</td>--}}
  101. {{--<td class="text-left" width="85%">{{ $document->quotation->identifier }}</td>--}}
  102. {{--</tr>--}}
  103. {{--@endif--}}
  104. {{--</table>--}}
  105. @if ($document->guides)
  106. <br/>
  107. {{--<strong>Guías:</strong>--}}
  108. <table>
  109. @foreach($document->guides as $guide)
  110. <tr>
  111. @if(isset($guide->document_type_description))
  112. <td>{{ $guide->document_type_description }}</td>
  113. @else
  114. <td>{{ $guide->document_type_id }}</td>
  115. @endif
  116. <td>:</td>
  117. <td>{{ $guide->number }}</td>
  118. </tr>
  119. @endforeach
  120. </table>
  121. @endif
  122. <table class="full-width mt-3">
  123. @if ($document->purchase_order)
  124. <tr>
  125. <td>ORDEN DE COMPRA</td>
  126. <td>:</td>
  127. <td>{{ $document->purchase_order }}</td>
  128. </tr>
  129. @endif
  130. @if ($document->quotation_id)
  131. <tr>
  132. <td>COTIZACIÓN</td>
  133. <td>:</td>
  134. <td>{{ $document->quotation->identifier }}</td>
  135. </tr>
  136. @endif
  137. @if(!is_null($document_base))
  138. <tr>
  139. <td width="120px">DOC. AFECTADO</td>
  140. <td width="8px">:</td>
  141. <td>{{ $affected_document_number }}</td>
  142. </tr>
  143. <tr>
  144. <td>TIPO DE NOTA</td>
  145. <td>:</td>
  146. <td>{{ ($document_base->note_type === 'credit')?$document_base->note_credit_type->description:$document_base->note_debit_type->description}}</td>
  147. </tr>
  148. <tr>
  149. <td>DESCRIPCIÓN</td>
  150. <td>:</td>
  151. <td>{{ $document_base->note_description }}</td>
  152. </tr>
  153. @endif
  154. </table>
  155. {{--<table class="full-width mt-3">--}}
  156. {{--<tr>--}}
  157. {{--<td width="25%">Documento Afectado:</td>--}}
  158. {{--<td width="20%">{{ $document_base->affected_document->series }}-{{ $document_base->affected_document->number }}</td>--}}
  159. {{--<td width="15%">Tipo de nota:</td>--}}
  160. {{--<td width="40%">{{ ($document_base->note_type === 'credit')?$document_base->note_credit_type->description:$document_base->note_debit_type->description}}</td>--}}
  161. {{--</tr>--}}
  162. {{--<tr>--}}
  163. {{--<td class="align-top">Descripción:</td>--}}
  164. {{--<td class="text-left" colspan="3">{{ $document_base->note_description }}</td>--}}
  165. {{--</tr>--}}
  166. {{--</table>--}}
  167. <table class="full-width mt-10 mb-10">
  168. <thead class="">
  169. <tr class="bg-grey">
  170. <th class="border-top-bottom text-center py-2" width="8%">CANT.</th>
  171. <th class="border-top-bottom text-center py-2" width="8%">UNIDAD</th>
  172. <th class="border-top-bottom text-left py-2">DESCRIPCIÓN</th>
  173. <th class="border-top-bottom text-right py-2" width="12%">V.UNIT</th>
  174. <th class="border-top-bottom text-right py-2" width="8%">DTO.</th>
  175. <th class="border-top-bottom text-right py-2" width="12%">TOTAL</th>
  176. </tr>
  177. </thead>
  178. <tbody>
  179. @foreach($document->items as $row)
  180. <tr>
  181. <td class="text-center align-top">
  182. @if(((int)$row->quantity != $row->quantity))
  183. {{ $row->quantity }}
  184. @else
  185. {{ number_format($row->quantity, 0) }}
  186. @endif
  187. </td>
  188. <td class="text-center align-top">{{ $row->item->unit_type_id }}</td>
  189. <td class="text-left align-top">
  190. {!!$row->item->description!!} @if (!empty($row->item->presentation)) {!!$row->item->presentation->description!!} @endif
  191. @if($row->attributes)
  192. @foreach($row->attributes as $attr)
  193. <br/><span style="font-size: 9px">{!! $attr->description !!} : {{ $attr->value }}</span>
  194. @endforeach
  195. @endif
  196. @if($row->discounts)
  197. @foreach($row->discounts as $dtos)
  198. <br/><span style="font-size: 9px">{{ $dtos->factor * 100 }}% {{$dtos->description }}</span>
  199. @endforeach
  200. @endif
  201. @if($row->item->is_set == 1)
  202. <br>
  203. @inject('itemSet', 'App\Services\ItemSetService')
  204. @foreach ($itemSet->getItemsSet($row->item_id) as $item)
  205. {{$item}}<br>
  206. @endforeach
  207. @endif
  208. </td>
  209. <td class="text-right align-top">{{ number_format($row->unit_value, 4) }}</td>
  210. <td class="text-right align-top">
  211. @if($row->discounts)
  212. @php
  213. $total_discount_line = 0;
  214. foreach ($row->discounts as $disto) {
  215. $total_discount_line = $total_discount_line + $disto->amount;
  216. }
  217. @endphp
  218. {{ number_format($total_discount_line, 2) }}
  219. @else
  220. 0
  221. @endif
  222. </td>
  223. <td class="text-right align-top">{{ number_format($row->total_value, 2) }}</td>
  224. </tr>
  225. <tr>
  226. <td colspan="6" class="border-bottom"></td>
  227. </tr>
  228. @endforeach
  229. @if($document->total_exportation > 0)
  230. <tr>
  231. <td colspan="5" class="text-right font-bold">OP. EXPORTACIÓN: {{ $document->currency_type->symbol }}</td>
  232. <td class="text-right font-bold">{{ number_format($document->total_exportation, 2) }}</td>
  233. </tr>
  234. @endif
  235. @if($document->total_free > 0)
  236. <tr>
  237. <td colspan="5" class="text-right font-bold">OP. GRATUITAS: {{ $document->currency_type->symbol }}</td>
  238. <td class="text-right font-bold">{{ number_format($document->total_free, 2) }}</td>
  239. </tr>
  240. @endif
  241. @if($document->total_unaffected > 0)
  242. <tr>
  243. <td colspan="5" class="text-right font-bold">OP. INAFECTAS: {{ $document->currency_type->symbol }}</td>
  244. <td class="text-right font-bold">{{ number_format($document->total_unaffected, 2) }}</td>
  245. </tr>
  246. @endif
  247. @if($document->total_exonerated > 0)
  248. <tr>
  249. <td colspan="5" class="text-right font-bold">OP. EXONERADAS: {{ $document->currency_type->symbol }}</td>
  250. <td class="text-right font-bold">{{ number_format($document->total_exonerated, 2) }}</td>
  251. </tr>
  252. @endif
  253. @if($document->total_taxed > 0)
  254. <tr>
  255. <td colspan="5" class="text-right font-bold">OP. GRAVADAS: {{ $document->currency_type->symbol }}</td>
  256. <td class="text-right font-bold">{{ number_format($document->total_taxed, 2) }}</td>
  257. </tr>
  258. @endif
  259. @if($document->total_discount > 0)
  260. <tr>
  261. <td colspan="5" class="text-right font-bold">DESCUENTO TOTAL: {{ $document->currency_type->symbol }}</td>
  262. <td class="text-right font-bold">{{ number_format($document->total_discount, 2) }}</td>
  263. </tr>
  264. @endif
  265. @if($document->total_plastic_bag_taxes > 0)
  266. <tr>
  267. <td colspan="5" class="text-right font-bold">ICBPER: {{ $document->currency_type->symbol }}</td>
  268. <td class="text-right font-bold">{{ number_format($document->total_plastic_bag_taxes, 2) }}</td>
  269. </tr>
  270. @endif
  271. <tr>
  272. <td colspan="5" class="text-right font-bold">IGV: {{ $document->currency_type->symbol }}</td>
  273. <td class="text-right font-bold">{{ number_format($document->total_igv, 2) }}</td>
  274. </tr>
  275. <tr>
  276. <td colspan="5" class="text-right font-bold">TOTAL A PAGAR: {{ $document->currency_type->symbol }}</td>
  277. <td class="text-right font-bold">{{ number_format($document->total, 2) }}</td>
  278. </tr>
  279. </tbody>
  280. </table>
  281. <table class="full-width">
  282. <tr>
  283. <td width="65%" style="text-align: top; vertical-align: top;">
  284. @foreach(array_reverse( (array) $document->legends) as $row)
  285. @if ($row->code == "1000")
  286. <p style="text-transform: uppercase;">Son: <span class="font-bold">{{ $row->value }} {{ $document->currency_type->description }}</span></p>
  287. @if (count((array) $document->legends)>1)
  288. <p><span class="font-bold">Leyendas</span></p>
  289. @endif
  290. @else
  291. <p> {{$row->code}}: {{ $row->value }} </p>
  292. @endif
  293. @endforeach
  294. <br/>
  295. @foreach($document->additional_information as $information)
  296. @if ($information)
  297. @if ($loop->first)
  298. <strong>Información adicional</strong>
  299. @endif
  300. <p>{{ $information }}</p>
  301. @endif
  302. @endforeach
  303. <br>
  304. @if(in_array($document->document_type->id,['01','03']))
  305. @foreach($accounts as $account)
  306. <p>
  307. <span class="font-bold">{{$account->bank->description}}</span> {{$account->currency_type->description}}
  308. <span class="font-bold">N°:</span> {{$account->number}}
  309. @if($account->cci)
  310. <span class="font-bold">CCI:</span> {{$account->cci}}
  311. @endif
  312. </p>
  313. @endforeach
  314. @endif
  315. </td>
  316. <td width="35%" class="text-right">
  317. <img src="data:image/png;base64, {{ $document->qr }}" style="margin-right: -10px;" />
  318. <p style="font-size: 9px">Código Hash: {{ $document->hash }}</p>
  319. </td>
  320. </tr>
  321. </table>
  322. </body>
  323. </html>