receipt.pdf.erb 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  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? %>
  14. <%= wicked_pdf_image_tag_for_public(pointsale.img_pointsale_url, :style => "margin-top:10px") %>
  15. <% elsif @pos_config.ticket_img? %>
  16. <%= wicked_pdf_image_tag_for_public(@pos_config.ticket_img_url, :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. <strong>Apertura de caja:</strong>&nbsp;&nbsp;
  23. <%= l(cash_out.open_cash_register.created_at, :format => '%d/%m/%y %I:%M %p') %><br>
  24. <strong>Corte de caja:</strong>&nbsp;&nbsp;
  25. <%= l(cash_out.created_at, :format => '%d/%m/%y %I:%M %p') %><br>
  26. <strong>Caja:</strong>&nbsp;&nbsp;
  27. <%= cash_out.open_cash_register.cash_register.name %><br>
  28. <strong>Realizó:</strong>&nbsp;&nbsp;
  29. <%= cash_out.user.first_name %><br>
  30. <strong>Recibió:</strong>&nbsp;&nbsp;
  31. <%= cash_out.received_by.first_name %><br>
  32. <strong>Articulos:</strong>&nbsp;&nbsp;
  33. <%= cash_out.open_cash_register.products.count %>
  34. <% if cash_out.observations.present? %>
  35. <br> <strong>Observaciones:</strong>&nbsp;&nbsp;
  36. <%= cash_out.observations %>
  37. <% end %>
  38. </div>
  39. <div style="border-bottom:1px solid black; margin-top:10px">
  40. <table cellspacing="0" width="100%">
  41. <thead>
  42. <tr>
  43. <th style="text-align:left">Fondo anterior</th>
  44. <th style="text-align:left">Efectivo en caja</th>
  45. <th style="text-align:left">Retiro</th>
  46. <th style="text-align:center">Fondo</th>
  47. </tr>
  48. </thead>
  49. <tbody>
  50. <tr>
  51. <td style="text-align:left">
  52. <%= number_to_currency(initial_cash, precision: 2) %>
  53. </td>
  54. <td style="text-align:left">
  55. <%= number_to_currency(cash_out.physical_cash, precision: 2) %>
  56. </td>
  57. <td style="text-align:left">
  58. <%= number_to_currency(cash_out.received_cash, precision: 2) %>
  59. </td>
  60. <td style="text-align:center">
  61. <%= number_to_currency(cash_out.cash_fund, precision: 2) %>
  62. </td>
  63. </tr>
  64. </tbody>
  65. </table>
  66. </div>
  67. <div style="border-bottom:1px solid black; margin-top:10px">
  68. <table cellspacing="0" width="100%">
  69. <thead>
  70. <tr>
  71. <th style="text-align:left"></th>
  72. <th style="text-align:center"></th>
  73. <th style="text-align:center"></th>
  74. </tr>
  75. </thead>
  76. <tbody>
  77. <tr>
  78. <td style="text-align:left"><strong>Ventas a contado</strong></td>
  79. <td style="text-align:center"><strong>Abonos a crédito</strong></td>
  80. <td style="text-align:center"><strong>Apartados</strong></td>
  81. </tr>
  82. <tr>
  83. <td style="text-align:left">
  84. <%= number_to_currency(sales_total, precision: 2) %>
  85. </td>
  86. <td style="text-align:center">
  87. <%= number_to_currency(credit_sales, precision: 2) %>
  88. </td>
  89. <td style="text-align:center">
  90. <%= number_to_currency(reserved_sales, precision: 2) %>
  91. </td>
  92. </tr>
  93. </tbody>
  94. </table>
  95. </div>
  96. <div style="border-bottom:1px solid black; margin-top:10px">
  97. <h4 style="margin-top:5px;margin-bottom:5px">RESUMEN</h4>
  98. <% cash_out.cash_out_details.each do | detail | %>
  99. <span style="text-decoration:underline;margin-bottom:5px"><%= detail.payment_method.method.upcase %></span>
  100. <table cellspacing="0" width="100%">
  101. <thead>
  102. <tr>
  103. <th style="text-align:left">Ingresos</th>
  104. <th style="text-align:center">Egresos</th>
  105. <th style="text-align:right">Total</th>
  106. </tr>
  107. </thead>
  108. <tbody>
  109. <tr>
  110. <td style="text-align:left">
  111. <%= number_to_currency(detail.incoming, precision: 2) %>
  112. </td>
  113. <td style="text-align:center">
  114. <%= number_to_currency(detail.outgoing, precision: 2) %>
  115. </td>
  116. <td style="text-align:right">
  117. <%= number_to_currency(detail.total, precision: 2) %>
  118. </td>
  119. </tr>
  120. </tbody>
  121. </table>
  122. <% end %>
  123. </div>
  124. <div class="products" style="border:0px">
  125. <h4 style="margin-top:5px;margin-bottom:5px">SALIDA DE MERCANCÍA</h4>
  126. <table cellspacing="0" id="products_table">
  127. <thead>
  128. <tr>
  129. <th></th>
  130. <th></th>
  131. <th></th>
  132. </tr>
  133. </thead>
  134. <tbody>
  135. <% @details.each_with_index do |detail, key| %>
  136. <% if @details[key -1].present?
  137. last_one_category = @details[key -1]['parent'].present? ? @details[key -1]['parent'] : @details[key -1]['category'] %>
  138. <% else
  139. last_one_category = ""
  140. %>
  141. <% end %>
  142. <% current_category = detail['parent'].present? ? detail['parent'] : detail['category']%>
  143. <% if last_one_category != current_category %>
  144. <tr style="margin-top:3px;margin-bottom:10px">
  145. <td colspan="3"> <strong> <%= current_category %> </strong> </td>
  146. </tr>
  147. <% end %>
  148. <tr>
  149. <td valign="bottom">
  150. <%= detail['quantity'] %>
  151. </td>
  152. <td style="text-align:center">
  153. <%= truncate(detail['product_name'], :length => 30, :separator => ' ', :omission => '') %> <br>
  154. <%= truncate(Product.find(detail['product_id']).display_attributes_receipt.downcase, :length => 30, :separator => ' ', :omission => '') %>
  155. </td>
  156. <td style="text-align:right" valign="center">
  157. <strong><%= number_to_currency(detail['total'], precision: 2) %></strong>
  158. </td>
  159. </tr>
  160. <tr style="<%= 'border-bottom:1px solid black;font-size:10px' if detail["discount"] == 0%>">
  161. <td> </td>
  162. <td style="text-align:center">
  163. Precio de venta unitario (<%= number_to_currency(detail["price_sale"], precision: 2) %>)
  164. </td>
  165. <td style="text-align:right">
  166. <%= number_to_currency(detail["total_without_discount"], precision: 2) %>
  167. </td>
  168. </tr>
  169. <% if detail["discount"] != 0 %>
  170. <tr style="border-bottom:1px solid black;font-size:10px">
  171. <td> </td>
  172. <td style="text-align:center">Descuento acumulado:</td>
  173. <td style="text-align:right">
  174. - <%= number_to_currency(detail["discount"], precision: 2) %>
  175. </td>
  176. </tr>
  177. <% end %>
  178. <% end %>
  179. </tbody>
  180. </table>
  181. </div>
  182. <!-- egresos -->
  183. <% if expenses.present? %>
  184. <div class="products" style="border-bottom:1px solid black">
  185. <h4 style="margin-top:5px;margin-bottom:5px">EGRESOS</h4>
  186. <table cellspacing="0" style="border-collapse:collapse">
  187. <thead>
  188. <tr>
  189. <td></td>
  190. <td></td>
  191. </tr>
  192. </thead>
  193. <tbody>
  194. <% expenses.each do |expense| %>
  195. <tr>
  196. <td style="text-align:left">
  197. <strong> <%= expense.expensesconcept.name %></strong> <br>
  198. <%= expense.observations %>
  199. </td>
  200. <td style="text-align:right">
  201. <%= number_to_currency(expense.quantity, precision: 2) %>
  202. </td>
  203. </tr>
  204. <% end %>
  205. </tbody>
  206. </table>
  207. </div>
  208. <% end %>
  209. <div style="margin-top:5px;">
  210. <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.
  211. </div>
  212. </div>