receipt_reserve.pdf.erb 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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>APARTADO</strong><br>
  24. Cliente: <strong> <%= sale.customer.nick_name %> </strong>
  25. </div>
  26. <div class="products">
  27. <table cellspacing="0">
  28. <thead>
  29. <tr>
  30. <th style="text-align:left;font-weight:normal">Cantidad</th>
  31. <th style="text-align:center;font-weight:normal">Precio</th>
  32. <th style="text-align:center;font-weight:normal">Desc.</th>
  33. <th style="text-align:right;font-weight:normal">Importe</th>
  34. </tr>
  35. </thead>
  36. <tbody style="border-top:1px solid black">
  37. <% sale.sales_details.each_with_index do |detail, key| %>
  38. <tr>
  39. <td colspan="3">
  40. <%= truncate(detail.product.name, :length => 30, :separator => ' ', :omission => '') %> &nbsp; <%= truncate(detail.product.display_attributes_receipt, :length => 20, :separator => ' ', :omission => '') %>
  41. </td>
  42. </tr>
  43. <tr>
  44. <td> <%= detail.quantity.round %> </td>
  45. <td style="text-align:center"> <%= number_to_currency(detail.unit_price, precision: 2) %> </td>
  46. <td style="text-align:center"> <%= number_to_currency(detail.discount, precision: 2) %> </td>
  47. <td style="text-align:right">
  48. <%= number_to_currency(((detail.unit_price * detail.quantity) - detail.discount), precision: 2) %>
  49. </td>
  50. </tr>
  51. <% end %>
  52. </tbody>
  53. </table>
  54. </div>
  55. <div style="margin-top:0px;text-align:right">
  56. <% margin = 55 %>
  57. <table style="float:right;width:50%">
  58. <thead>
  59. <tr>
  60. <th></th>
  61. <th></th>
  62. <th></th>
  63. </tr>
  64. </thead>
  65. <tbody>
  66. <tr>
  67. <td width="30%">Subtotal</td>
  68. <td width="15%" class="text-right">$</td>
  69. <td width="40%"><%= number_to_currency(sale.amount, precision: 2, :unit => "") %></td>
  70. </tr>
  71. <% if sale.discount > 0 %>
  72. <% margin = margin += 20 %>
  73. <tr>
  74. <td width="30%">Descuento</td>
  75. <td width="15%" class="text-right">$</td>
  76. <td width="40%"><%= number_to_currency(sale.discount, precision: 2, :unit => "") %></td>
  77. </tr>
  78. <% end %>
  79. <% if sale.tax > 0 %>
  80. <% margin = margin += 20 %>
  81. <tr>
  82. <td width="30%">IVA</td>
  83. <td width="15%" class="text-right">$</td>
  84. <td width="40%"><%= number_to_currency(sale.tax, precision: 2, :unit => "") %></td>
  85. </tr>
  86. <% end %>
  87. <tr>
  88. <td width="30%"><strong>Total</strong></td>
  89. <td width="15%" class="text-right"><strong>$</strong></td>
  90. <td width="40%"><strong><%= number_to_currency(sale.total, precision: 2, :unit => "") %></strong></td>
  91. </tr>
  92. </tbody>
  93. </table>
  94. </div>
  95. <div style="margin-top:<%=margin%>px;border-top: 1px dotted black">
  96. <div style="float:left;width:50%;margin-top:7px">
  97. <span>Vencimiento</span></br>
  98. <span><%= l(sale.expiration_date, :format => '%d/%m/%y') %></span>
  99. </div>
  100. <table style="float:right;width:50%" class="text-right">
  101. <thead>
  102. <tr>
  103. <th></th>
  104. <th></th>
  105. <th></th>
  106. </tr>
  107. </thead>
  108. <tbody>
  109. <tr>
  110. <td width="30%">Anticipo</td>
  111. <td width="15%" class="text-right">$</td>
  112. <td width="40%" class="text-right"><%= number_to_currency(debt, precision: 2, :unit => "") %></td>
  113. </tr>
  114. <tr>
  115. <td width="30%"><strong>Resta</strong></td>
  116. <td width="15%" class="text-right"><strong>$</strong></td>
  117. <td width="40%" class="text-right"><strong><%= number_to_currency(sale.reserve_debt, precision: 2, :unit => "") %></strong></td>
  118. </tr>
  119. </tbody>
  120. </table>
  121. </div>
  122. <div style="margin-top:70px; border-top:1px dotted black" class="totals text-right">
  123. <table cellspacing="0">
  124. <thead>
  125. <tr>
  126. <th></th>
  127. <th></th>
  128. <th></th>
  129. </tr>
  130. </thead>
  131. <tbody>
  132. <% marginFooter = 20 %>
  133. <% sale.cash_registers_moves.each do |move| %>
  134. <tr class="text-center" style="text-decoration:underline;">
  135. <td><%= move.payment_method.method %> </td>
  136. <td></td>
  137. <td></td>
  138. </tr>
  139. <% if move.payment_method.isCash? %>
  140. <% marginFooter += 80 %>
  141. <tr class="text-left">
  142. <td> </td>
  143. <td> Recibido: </td>
  144. <td> <%= number_to_currency(move.received, precision: 2) %></td>
  145. </tr>
  146. <tr class="text-left">
  147. <td> </td>
  148. <td><strong> Pagó: </strong></td>
  149. <td><strong> <%= number_to_currency(move.quantity, precision: 2) %></strong></td>
  150. </tr>
  151. <tr class="text-left">
  152. <td> </td>
  153. <td> Cambio: </td>
  154. <td> <%= number_to_currency(move.change, precision: 2) %></td>
  155. </tr>
  156. <% else %>
  157. <% marginFooter += 60 %>
  158. <tr class="text-left">
  159. <td> </td>
  160. <td><strong> Pagó: </strong></td>
  161. <td><strong> <%= number_to_currency(move.quantity, precision: 2) %></strong></td>
  162. </tr>
  163. <tr class="text-left">
  164. <td> </td>
  165. <td> tarjeta nº: </td>
  166. <td> <%= move.cardnumber %></td>
  167. </tr>
  168. <% end %>
  169. <% end %>
  170. </tbody>
  171. </table>
  172. </div>
  173. <div style="margin-top:<%=marginFooter%>px">
  174. <% if sale.get_pointsale.ticket_footer.blank? %>
  175. <%= simple_format(@pos_config.ticket_footer) %>
  176. <% else %>
  177. <%= simple_format(sale.get_pointsale.ticket_footer) %>
  178. <% end %>
  179. </div>
  180. </div>