PageRenderTime 40ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/app/CoreFacturalo/Templates/pdf/blank/sale_note_a4.blade.php

https://gitlab.com/laher01/factu40
PHP | 300 lines | 283 code | 16 blank | 1 comment | 6 complexity | 85cbfbed7dbe1b093479f03f0788f50d MD5 | raw file
  1. @php
  2. $establishment = $document->establishment;
  3. $customer = $document->customer;
  4. //$path_style = app_path('CoreFacturalo'.DIRECTORY_SEPARATOR.'Templates'.DIRECTORY_SEPARATOR.'pdf'.DIRECTORY_SEPARATOR.'style.css');
  5. $left = ($document->series) ? $document->series : $document->prefix;
  6. $tittle = $left.'-'.str_pad($document->number, 8, '0', STR_PAD_LEFT);
  7. $payments = $document->payments;
  8. $accounts = \App\Models\Tenant\BankAccount::all();
  9. @endphp
  10. <html>
  11. <head>
  12. {{--<title>{{ $tittle }}</title>--}}
  13. {{--<link href="{{ $path_style }}" rel="stylesheet" />--}}
  14. </head>
  15. <body>
  16. <table class="full-width">
  17. <tr>
  18. @if($company->logo)
  19. <td width="20%">
  20. <div class="company_logo_box">
  21. <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;">
  22. </div>
  23. </td>
  24. @else
  25. <td width="20%">
  26. </td>
  27. @endif
  28. <td width="50%" class="pl-3">
  29. <div class="text-left">
  30. <h4 class="">{{ $company->name }}</h4>
  31. <h5>{{ 'RUC '.$company->number }}</h5>
  32. <h6 style="text-transform: uppercase;">
  33. {{ ($establishment->address !== '-')? $establishment->address : '' }}
  34. {{ ($establishment->district_id !== '-')? ', '.$establishment->district->description : '' }}
  35. {{ ($establishment->province_id !== '-')? ', '.$establishment->province->description : '' }}
  36. {{ ($establishment->department_id !== '-')? '- '.$establishment->department->description : '' }}
  37. </h6>
  38. <h6>{{ ($establishment->email !== '-')? $establishment->email : '' }}</h6>
  39. <h6>{{ ($establishment->telephone !== '-')? $establishment->telephone : '' }}</h6>
  40. </div>
  41. </td>
  42. <td width="30%" class="border-box py-4 px-2 text-center">
  43. <h5 class="text-center">NOTA DE VENTA</h5>
  44. <h3 class="text-center">{{ $tittle }}</h3>
  45. </td>
  46. </tr>
  47. </table>
  48. <table class="full-width mt-5">
  49. <tr>
  50. <td width="15%">Cliente:</td>
  51. <td width="45%">{{ $customer->name }}</td>
  52. <td width="25%">Fecha de emisión:</td>
  53. <td width="15%">{{ $document->date_of_issue->format('Y-m-d') }}</td>
  54. </tr>
  55. <tr>
  56. <td>{{ $customer->identity_document_type->description }}:</td>
  57. <td>{{ $customer->number }}</td>
  58. </tr>
  59. @if ($customer->address !== '')
  60. <tr>
  61. <td class="align-top">Dirección:</td>
  62. <td colspan="3">
  63. {{ strtoupper($customer->address) }}
  64. {{ ($customer->district_id !== '-')? ', '.strtoupper($customer->district->description) : '' }}
  65. {{ ($customer->province_id !== '-')? ', '.strtoupper($customer->province->description) : '' }}
  66. {{ ($customer->department_id !== '-')? '- '.strtoupper($customer->department->description) : '' }}
  67. </td>
  68. </tr>
  69. @endif
  70. @if ($document->plate_number !== null)
  71. <tr>
  72. <td width="15%">N° Placa:</td>
  73. <td width="85%">{{ $document->plate_number }}</td>
  74. </tr>
  75. @endif
  76. @if ($document->total_canceled)
  77. <tr>
  78. <td class="align-top">Estado:</td>
  79. <td colspan="3">CANCELADO</td>
  80. </tr>
  81. @else
  82. <tr>
  83. <td class="align-top">Estado:</td>
  84. <td colspan="3">PENDIENTE DE PAGO</td>
  85. </tr>
  86. @endif
  87. @if ($document->observation)
  88. <tr>
  89. <td class="align-top">Observación:</td>
  90. <td colspan="3">{{ $document->observation }}</td>
  91. </tr>
  92. @endif
  93. </table>
  94. @if ($document->guides)
  95. <br/>
  96. {{--<strong>Guías:</strong>--}}
  97. <table>
  98. @foreach($document->guides as $guide)
  99. <tr>
  100. @if(isset($guide->document_type_description))
  101. <td>{{ $guide->document_type_description }}</td>
  102. @else
  103. <td>{{ $guide->document_type_id }}</td>
  104. @endif
  105. <td>:</td>
  106. <td>{{ $guide->number }}</td>
  107. </tr>
  108. @endforeach
  109. </table>
  110. @endif
  111. <table class="full-width mt-10 mb-10">
  112. <thead class="">
  113. <tr class="bg-grey">
  114. <th class="border-top-bottom text-center py-2" width="8%">CANT.</th>
  115. <th class="border-top-bottom text-center py-2" width="8%">UNIDAD</th>
  116. <th class="border-top-bottom text-left py-2">DESCRIPCIÓN</th>
  117. <th class="border-top-bottom text-center py-2" width="8%">LOTE</th>
  118. <th class="border-top-bottom text-center py-2" width="8%">SERIE</th>
  119. <th class="border-top-bottom text-right py-2" width="12%">P.UNIT</th>
  120. <th class="border-top-bottom text-right py-2" width="8%">DTO.</th>
  121. <th class="border-top-bottom text-right py-2" width="12%">TOTAL</th>
  122. </tr>
  123. </thead>
  124. <tbody>
  125. @foreach($document->items as $row)
  126. <tr>
  127. <td class="text-center align-top">
  128. @if(((int)$row->quantity != $row->quantity))
  129. {{ $row->quantity }}
  130. @else
  131. {{ number_format($row->quantity, 0) }}
  132. @endif
  133. </td>
  134. <td class="text-center align-top">{{ $row->item->unit_type_id }}</td>
  135. <td class="text-left">
  136. {!!$row->item->description!!} @if (!empty($row->item->presentation)) {!!$row->item->presentation->description!!} @endif
  137. @if($row->attributes)
  138. @foreach($row->attributes as $attr)
  139. <br/><span style="font-size: 9px">{!! $attr->description !!} : {{ $attr->value }}</span>
  140. @endforeach
  141. @endif
  142. @if($row->discounts)
  143. @foreach($row->discounts as $dtos)
  144. <br/><span style="font-size: 9px">{{ $dtos->factor * 100 }}% {{$dtos->description }}</span>
  145. @endforeach
  146. @endif
  147. @if($row->item->is_set == 1)
  148. <br>
  149. @inject('itemSet', 'App\Services\ItemSetService')
  150. @foreach ($itemSet->getItemsSet($row->item_id) as $item)
  151. {{$item}}<br>
  152. @endforeach
  153. @endif
  154. </td>
  155. <td class="text-center align-top">
  156. @inject('itemLotGroup', 'App\Services\ItemLotsGroupService')
  157. @php
  158. $lot_code = isset($row->item->lots_group) ? collect($row->item->lots_group)->first(function($row){ return $row->checked == true;}):null;
  159. @endphp
  160. {{
  161. $itemLotGroup->getLote($lot_code ? $lot_code->id : null)
  162. }}
  163. </td>
  164. <td class="text-center align-top">
  165. @isset($row->item->lots)
  166. @foreach($row->item->lots as $lot)
  167. @if( isset($lot->has_sale) && $lot->has_sale)
  168. <span style="font-size: 9px">{{ $lot->series }}</span><br>
  169. @endif
  170. @endforeach
  171. @endisset
  172. </td>
  173. <td class="text-right align-top">{{ number_format($row->unit_price, 2) }}</td>
  174. <td class="text-right align-top">
  175. @if($row->discounts)
  176. @php
  177. $total_discount_line = 0;
  178. foreach ($row->discounts as $disto) {
  179. $total_discount_line = $total_discount_line + $disto->amount;
  180. }
  181. @endphp
  182. {{ number_format($total_discount_line, 2) }}
  183. @else
  184. 0
  185. @endif
  186. </td>
  187. <td class="text-right align-top">{{ number_format($row->total, 2) }}</td>
  188. </tr>
  189. <tr>
  190. <td colspan="8" class="border-bottom"></td>
  191. </tr>
  192. @endforeach
  193. @if($document->total_exportation > 0)
  194. <tr>
  195. <td colspan="7" class="text-right font-bold">OP. EXPORTACIÓN: {{ $document->currency_type->symbol }}</td>
  196. <td class="text-right font-bold">{{ number_format($document->total_exportation, 2) }}</td>
  197. </tr>
  198. @endif
  199. @if($document->total_free > 0)
  200. <tr>
  201. <td colspan="7" class="text-right font-bold">OP. GRATUITAS: {{ $document->currency_type->symbol }}</td>
  202. <td class="text-right font-bold">{{ number_format($document->total_free, 2) }}</td>
  203. </tr>
  204. @endif
  205. @if($document->total_unaffected > 0)
  206. <tr>
  207. <td colspan="7" class="text-right font-bold">OP. INAFECTAS: {{ $document->currency_type->symbol }}</td>
  208. <td class="text-right font-bold">{{ number_format($document->total_unaffected, 2) }}</td>
  209. </tr>
  210. @endif
  211. @if($document->total_exonerated > 0)
  212. <tr>
  213. <td colspan="7" class="text-right font-bold">OP. EXONERADAS: {{ $document->currency_type->symbol }}</td>
  214. <td class="text-right font-bold">{{ number_format($document->total_exonerated, 2) }}</td>
  215. </tr>
  216. @endif
  217. @if($document->total_taxed > 0)
  218. <tr>
  219. <td colspan="7" class="text-right font-bold">OP. GRAVADAS: {{ $document->currency_type->symbol }}</td>
  220. <td class="text-right font-bold">{{ number_format($document->total_taxed, 2) }}</td>
  221. </tr>
  222. @endif
  223. @if($document->total_discount > 0)
  224. <tr>
  225. <td colspan="7" class="text-right font-bold">{{(($document->total_prepayment > 0) ? 'ANTICIPO':'DESCUENTO TOTAL')}}: {{ $document->currency_type->symbol }}</td>
  226. <td class="text-right font-bold">{{ number_format($document->total_discount, 2) }}</td>
  227. </tr>
  228. @endif
  229. {{--<tr>
  230. <td colspan="7" class="text-right font-bold">IGV: {{ $document->currency_type->symbol }}</td>
  231. <td class="text-right font-bold">{{ number_format($document->total_igv, 2) }}</td>
  232. </tr>--}}
  233. <tr>
  234. <td colspan="7" class="text-right font-bold">TOTAL A PAGAR: {{ $document->currency_type->symbol }}</td>
  235. <td class="text-right font-bold">{{ number_format($document->total, 2) }}</td>
  236. </tr>
  237. </tbody>
  238. </table>
  239. <table class="full-width">
  240. <tr>
  241. <td width="65%" style="text-align: top; vertical-align: top;">
  242. <br>
  243. @foreach($accounts as $account)
  244. <p>
  245. <span class="font-bold">{{$account->bank->description}}</span> {{$account->currency_type->description}}
  246. <span class="font-bold">N°:</span> {{$account->number}}
  247. @if($account->cci)
  248. - <span class="font-bold">CCI:</span> {{$account->cci}}
  249. @endif
  250. </p>
  251. @endforeach
  252. </td>
  253. </tr>
  254. </table>
  255. <br>
  256. @if($document->payment_method_type_id && $payments->count() == 0)
  257. <table class="full-width">
  258. <tr>
  259. <td>
  260. <strong>PAGO: </strong>{{ $document->payment_method_type->description }}
  261. </td>
  262. </tr>
  263. </table>
  264. @endif
  265. @if($payments->count())
  266. <table class="full-width">
  267. <tr>
  268. <td>
  269. <strong>PAGOS:</strong> </td></tr>
  270. @php
  271. $payment = 0;
  272. @endphp
  273. @foreach($payments as $row)
  274. <tr><td>- {{ $row->date_of_payment->format('d/m/Y') }} - {{ $row->payment_method_type->description }} - {{ $row->reference ? $row->reference.' - ':'' }} {{ $document->currency_type->symbol }} {{ $row->payment }}</td></tr>
  275. @php
  276. $payment += (float) $row->payment;
  277. @endphp
  278. @endforeach
  279. <tr><td><strong>SALDO:</strong> {{ $document->currency_type->symbol }} {{ number_format($document->total - $payment, 2) }}</td>
  280. </tr>
  281. </table>
  282. @endif
  283. </body>
  284. </html>