receipt.pdf.erb 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <div class='pdf-body'>
  2. <header class='document-header'>
  3. <h1 class='text-center'>
  4. <% pointsale = sale.get_pointsale %>
  5. <% if pointsale.img_pointsale? %>
  6. <%= wicked_pdf_image_tag_for_public(pointsale.img_pointsale_url, :style => "margin-top:10px") %>
  7. <% elsif @pos_config.ticket_img? %>
  8. <%= wicked_pdf_image_tag_for_public(@pos_config.ticket_img_url, :style => "margin-top:10px") %>
  9. <% end %>
  10. </h1>
  11. <p>
  12. <% if sale.get_pointsale.notes.blank? %>
  13. <%= simple_format(@pos_config.ticket_description, class: 'text-center') %>
  14. <% else %>
  15. <%= simple_format(sale.get_pointsale.notes, class: 'text-center') %>
  16. <% end %>
  17. </p>
  18. </header>
  19. <div class="resume">
  20. <%= l(sale.created_at, :format => '%d/%m/%y %I:%M %p') %> &nbsp; | &nbsp; <%= sale.sale_code %> &nbsp; | &nbsp; <%= sale.seller.name %>
  21. </div>
  22. <div style="margin-top:5px">
  23. <strong>VENTA AL CONTADO</strong><br>
  24. </div>
  25. <div class="products">
  26. <table cellspacing="0">
  27. <thead>
  28. <tr>
  29. <th style="text-align:left;font-weight:normal">Cantidad</th>
  30. <th style="text-align:center;font-weight:normal">Precio</th>
  31. <th style="text-align:center;font-weight:normal">Desc.</th>
  32. <th style="text-align:right;font-weight:normal">Importe</th>
  33. </tr>
  34. </thead>
  35. <tbody style="border-top:1px solid black">
  36. <% sale.sales_details.each_with_index do |detail, key| %>
  37. <tr>
  38. <td colspan="3">
  39. <%= truncate(detail.product.name, :length => 30, :separator => ' ', :omission => '') %> &nbsp; <%= truncate(detail.product.display_attributes_receipt, :length => 20, :separator => ' ', :omission => '') %>
  40. </td>
  41. </tr>
  42. <tr>
  43. <td>
  44. <%= detail.quantity.round %>
  45. </td>
  46. <td style="text-align:center">
  47. <%= number_to_currency(detail.unit_price, precision: 2) %>
  48. </td>
  49. <td style="text-align:center">
  50. <%= number_to_currency(detail.discount, precision: 2) %>
  51. </td>
  52. <td style="text-align:right">
  53. <%= number_to_currency(((detail.unit_price * detail.quantity) - detail.discount), precision: 2) %>
  54. </td>
  55. </tr>
  56. <% end %>
  57. </tbody>
  58. </table>
  59. </div>
  60. <div class="totals text-right">
  61. <% margin = 60 %>
  62. <table>
  63. <thead>
  64. <tr>
  65. <th></th>
  66. <th></th>
  67. <th></th>
  68. </tr>
  69. </thead>
  70. <tbody>
  71. <tr>
  72. <td width="30%">Subtotal</td>
  73. <td width="15%" class="text-right">$</td>
  74. <td width="40%"><%= number_to_currency(sale.amount - sale.discount, precision: 2, :unit => "") %></td>
  75. </tr>
  76. <% if sale.tax > 0 %>
  77. <% margin = margin += 20 %>
  78. <tr>
  79. <td width="30%">IVA</td>
  80. <td width="15%" class="text-right">$</td>
  81. <td width="40%"><%= number_to_currency(sale.tax, precision: 2, :unit => "") %></td>
  82. </tr>
  83. <% end %>
  84. <tr>
  85. <td width="30%" style="font-size:15px"><strong>Total</strong></td>
  86. <td width="15%" style="font-size:15px" class="text-right">$</td>
  87. <td width="40%" style="font-size:15px" ><strong><%= number_to_currency(sale.total, precision: 2, :unit => "") %></strong></td>
  88. </tr>
  89. </tbody>
  90. </table>
  91. </div>
  92. <div style="margin-top:<%=margin%>px; border-top:1px dotted black" class="totals text-right">
  93. <table cellspacing="0">
  94. <thead>
  95. <tr>
  96. <th></th>
  97. <th></th>
  98. <th></th>
  99. </tr>
  100. </thead>
  101. <tbody>
  102. <% marginFooter = 20 %>
  103. <% sale.cash_registers_moves.each do |move| %>
  104. <tr class="text-center" style="text-decoration:underline;">
  105. <td><%= move.payment_method.method %> </td>
  106. <td></td>
  107. <td></td>
  108. </tr>
  109. <% if move.payment_method.isCash? %>
  110. <% marginFooter += 80 %>
  111. <tr class="text-left">
  112. <td> </td>
  113. <td> Recibido: </td>
  114. <td> <%= number_to_currency(move.received, precision: 2) %></td>
  115. </tr>
  116. <tr class="text-left">
  117. <td> </td>
  118. <td><strong> Pagó: </strong></td>
  119. <td><strong> <%= number_to_currency(move.quantity, precision: 2) %></strong></td>
  120. </tr>
  121. <tr class="text-left">
  122. <td> </td>
  123. <td> Cambio: </td>
  124. <td> <%= number_to_currency(move.change, precision: 2) %></td>
  125. </tr>
  126. <% else %>
  127. <% marginFooter += 60 %>
  128. <tr class="text-left">
  129. <td> </td>
  130. <td><strong> Pagó: </strong></td>
  131. <td><strong> <%= number_to_currency(move.quantity, precision: 2) %></strong></td>
  132. </tr>
  133. <tr class="text-left">
  134. <td> </td>
  135. <td> tarjeta nº: </td>
  136. <td> <%= move.cardnumber %></td>
  137. </tr>
  138. <% end %>
  139. <% end %>
  140. </tbody>
  141. </table>
  142. </div>
  143. <div style="margin-top:<%=marginFooter%>px">
  144. <% if sale.get_pointsale.ticket_footer.blank? %>
  145. <%= simple_format(@pos_config.ticket_footer) %>
  146. <% else %>
  147. <%= simple_format(sale.get_pointsale.ticket_footer) %>
  148. <% end %>
  149. </div>
  150. </div>