receipt.pdf.erb 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <style>
  2. #products_table {
  3. border-collapse: collapse;
  4. page-break-inside:auto;
  5. }
  6. #products_table tr {
  7. page-break-inside:avoid; page-break-after:auto;
  8. }
  9. </style>
  10. <div class='pdf-body'>
  11. <header class='document-header'>
  12. <h1 class='text-center'>
  13. <% if pointsale.img_pointsale.present? %>
  14. <%= wicked_pdf_image_tag_for_public(pointsale.img_pointsale(:medium), :style => "margin-top:10px") %>
  15. <% elsif @pos_config.ticket_img.present? %>
  16. <%= wicked_pdf_image_tag_for_public(@pos_config.ticket_img(:medium), :style => "margin-top:10px") %>
  17. <% end %>
  18. </h1>
  19. </header>
  20. <h3 class="text-center">Corte de caja <%= pointsale.name %></h3>
  21. <div class="resume" style="border-bottom:1px solid black;">
  22. <h4 style="margin-top:5px;margin-bottom:5px">RESUMEN</h4>
  23. <strong>Apertura de caja:</strong>&nbsp;&nbsp;
  24. <%= l(cash_out.open_cash_register.created_at, :format => '%d/%m/%y %I:%M %p') %><br>
  25. <strong>Corte de caja:</strong>&nbsp;&nbsp;
  26. <%= l(cash_out.created_at, :format => '%d/%m/%y %I:%M %p') %><br>
  27. <strong>Caja:</strong>&nbsp;&nbsp;
  28. <%= cash_out.open_cash_register.cash_register.name %><br>
  29. <strong>Realizó:</strong>&nbsp;&nbsp;
  30. <%= cash_out.user.first_name %><br>
  31. <strong>Recibió:</strong>&nbsp;&nbsp;
  32. <%= cash_out.received_by.first_name %><br>
  33. <strong>Articulos:</strong>&nbsp;&nbsp;
  34. <%= cash_out.open_cash_register.products.count %>
  35. <% if cash_out.observations.present? %>
  36. <br> <strong>Observaciones:</strong>&nbsp;&nbsp;
  37. <%= cash_out.observations %>
  38. <% end %>
  39. </div>
  40. <div style="border-bottom:1px solid black; margin-top:10px">
  41. <table cellspacing="0" width="100%">
  42. <thead>
  43. <tr>
  44. <th style="text-align:left">Fondo anterior</th>
  45. <th style="text-align:center">Efectivo en caja</th>
  46. <th style="text-align:center">Retiro</th>
  47. <th style="text-align:right">Fondo</th>
  48. </tr>
  49. </thead>
  50. <tbody>
  51. <tr>
  52. <td style="text-align:left">
  53. <%= number_to_currency(initial_cash, precision: 2) %>
  54. </td>
  55. <td style="text-align:center">
  56. <%= number_to_currency(cash_out.physical_cash, precision: 2) %>
  57. </td>
  58. <td style="text-align:center">
  59. <%= number_to_currency(cash_out.received_cash, precision: 2) %>
  60. </td>
  61. <td style="text-align:right">
  62. <%= number_to_currency(cash_out.cash_fund, precision: 2) %>
  63. </td>
  64. </tr>
  65. </tbody>
  66. </table>
  67. </div>
  68. <div style="border-bottom:1px solid black; margin-top:10px">
  69. <h4 style="margin-top:5px;margin-bottom:5px">RESUMEN</h4>
  70. <% cash_out.cash_out_details.each do | detail | %>
  71. <span style="text-decoration:underline;margin-bottom:5px"><%= detail.payment_method.method.upcase %></span>
  72. <table cellspacing="0" width="100%">
  73. <thead>
  74. <tr>
  75. <th style="text-align:left">Ingresos</th>
  76. <th style="text-align:center">Gastos</th>
  77. <th style="text-align:right">Total</th>
  78. </tr>
  79. </thead>
  80. <tbody>
  81. <tr>
  82. <td style="text-align:left">
  83. <%= number_to_currency(detail.incoming, precision: 2) %>
  84. </td>
  85. <td style="text-align:center">
  86. <%= number_to_currency(detail.outgoing, precision: 2) %>
  87. </td>
  88. <td style="text-align:right">
  89. <%= number_to_currency(detail.total, precision: 2) %>
  90. </td>
  91. </tr>
  92. </tbody>
  93. </table>
  94. <% end %>
  95. </div>
  96. <div class="products" style="border:0px">
  97. <h4 style="margin-top:5px;margin-bottom:5px">SALIDA DE MERCANCÍA</h4>
  98. <table cellspacing="0" id="products_table">
  99. <thead>
  100. <tr>
  101. <th></th>
  102. <th></th>
  103. <th></th>
  104. </tr>
  105. </thead>
  106. <tbody>
  107. <% @details.each_with_index do |detail, key| %>
  108. <% if @details[key -1].present?
  109. last_one_category = @details[key -1]['parent'].present? ? @details[key -1]['parent'] : @details[key -1]['category'] %>
  110. <% else
  111. last_one_category = ""
  112. %>
  113. <% end %>
  114. <% current_category = detail['parent'].present? ? detail['parent'] : detail['category']%>
  115. <% if last_one_category != current_category %>
  116. <tr style="margin-top:3px;margin-bottom:10px">
  117. <td colspan="3"> <strong> <%= current_category %> </strong> </td>
  118. </tr>
  119. <% end %>
  120. <tr>
  121. <td valign="bottom">
  122. <%= detail['quantity'] %>
  123. </td>
  124. <td style="text-align:center">
  125. <%= truncate(detail['product_name'], :length => 30, :separator => ' ', :omission => '') %> <br>
  126. <%= truncate(Product.find(detail['product_id']).display_attributes_receipt.downcase, :length => 30, :separator => ' ', :omission => '') %>
  127. </td>
  128. <td style="text-align:right" valign="center">
  129. <strong><%= number_to_currency(detail['total'], precision: 2) %></strong>
  130. </td>
  131. </tr>
  132. <tr style="<%= 'border-bottom:1px solid black;font-size:10px' if detail["discount"] == 0%>">
  133. <td> </td>
  134. <td style="text-align:center">
  135. Precio de venta unitario (<%= number_to_currency(detail["price_sale"], precision: 2) %>)
  136. </td>
  137. <td style="text-align:right">
  138. <%= number_to_currency(detail["total_without_discount"], precision: 2) %>
  139. </td>
  140. </tr>
  141. <% if detail["discount"] != 0 %>
  142. <tr style="border-bottom:1px solid black;font-size:10px">
  143. <td> </td>
  144. <td style="text-align:center">Descuento acumulado:</td>
  145. <td style="text-align:right">
  146. - <%= number_to_currency(detail["discount"], precision: 2) %>
  147. </td>
  148. </tr>
  149. <% end %>
  150. <% end %>
  151. </tbody>
  152. </table>
  153. </div>
  154. <!-- gastos -->
  155. <% if expenses.present? %>
  156. <div class="products" style="border-bottom:1px solid black">
  157. <h4 style="margin-top:5px;margin-bottom:5px">GASTOS</h4>
  158. <table cellspacing="0" style="border-collapse:collapse">
  159. <thead>
  160. <tr>
  161. <td></td>
  162. <td></td>
  163. </tr>
  164. </thead>
  165. <tbody>
  166. <% @expenses.each do |expense| %>
  167. <tr>
  168. <td style="text-align:left">
  169. <strong> <%= expense.expensesconcept.name %></strong> <br>
  170. <%= expense.observations %>
  171. </td>
  172. <td style="text-align:right">
  173. <%= number_to_currency(expense.quantity, precision: 2) %>
  174. </td>
  175. </tr>
  176. <% end %>
  177. </tbody>
  178. </table>
  179. </div>
  180. <% end %>
  181. <div style="margin-top:5px;">
  182. <span style="text-decoration:underline">Nota:</span> Los productos que se muestran en el listado de salidas de mercancía, son productos de <span style="font-style:italic;"> ventas, apartados y creditos </span> que fueron registrados durante este corte.
  183. </div>
  184. </div>