receipt_credit.pdf.erb 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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 class="resume">
  23. <!-- si es de vale o credito nadamas-->
  24. <% if sale.credit_note.present? %>
  25. <strong>VENTA A CRÉDITO / VALE</strong><br>
  26. Folio vale: <strong><%= sale.credit_note %></strong><br>
  27. <% else %>
  28. <strong>VENTA A CRÉDITO</strong><br>
  29. <% end %>
  30. Cliente: <strong> <%= sale.customer.nick_name %> </strong>
  31. </div>
  32. <div class="products">
  33. <table cellspacing="0">
  34. <thead>
  35. <tr>
  36. <th style="text-align:left;font-weight:normal">Cantidad</th>
  37. <th style="text-align:center;font-weight:normal">Precio</th>
  38. <th style="text-align:center;font-weight:normal">Desc.</th>
  39. <th style="text-align:right;font-weight:normal">Importe</th>
  40. </tr>
  41. </thead>
  42. <tbody style="border-top:1px solid black">
  43. <% sale.sales_details.each_with_index do |detail, key| %>
  44. <tr>
  45. <td colspan="3">
  46. <%= truncate(detail.product.name, :length => 30, :separator => ' ', :omission => '') %> &nbsp; <%= truncate(detail.product.display_attributes_receipt, :length => 20, :separator => ' ', :omission => '') %>
  47. </td>
  48. </tr>
  49. <tr>
  50. <td>
  51. <%= detail.quantity.round %>
  52. </td>
  53. <td style="text-align:center">
  54. <%= number_to_currency(detail.unit_price, precision: 2) %>
  55. </td>
  56. <td style="text-align:center">
  57. <%= number_to_currency(detail.discount, precision: 2) %>
  58. </td>
  59. <td style="text-align:right">
  60. <%= number_to_currency(((detail.unit_price * detail.quantity) - detail.discount), precision: 2) %>
  61. </td>
  62. </tr>
  63. <% end %>
  64. </tbody>
  65. </table>
  66. </div>
  67. <div style="margin-top:0px;text-align:right">
  68. <% margin = 55 %>
  69. <table style="float:right;width:50%">
  70. <thead>
  71. <tr>
  72. <th></th>
  73. <th></th>
  74. <th></th>
  75. </tr>
  76. </thead>
  77. <tbody>
  78. <tr>
  79. <td width="30%">Subtotal</td>
  80. <td width="15%" class="text-right">$</td>
  81. <td width="40%"><%= number_to_currency(sale.amount, precision: 2, :unit => "") %></td>
  82. </tr>
  83. <% if sale.discount > 0 %>
  84. <% margin = margin += 20 %>
  85. <tr>
  86. <td width="30%">Descuento</td>
  87. <td width="15%" class="text-right">$</td>
  88. <td width="40%"><%= number_to_currency(sale.discount, precision: 2, :unit => "") %></td>
  89. </tr>
  90. <% end %>
  91. <% if sale.tax > 0 %>
  92. <% margin = margin += 20 %>
  93. <tr>
  94. <td width="30%">IVA</td>
  95. <td width="15%" class="text-right">$</td>
  96. <td width="40%"><%= number_to_currency(sale.tax, precision: 2, :unit => "") %></td>
  97. </tr>
  98. <% end %>
  99. <tr>
  100. <td width="30%"><strong>Total</strong></td>
  101. <td width="15%" class="text-right"><strong>$</strong></td>
  102. <td width="40%"><strong><%= number_to_currency(sale.total, precision: 2, :unit => "") %></strong></td>
  103. </tr>
  104. </tbody>
  105. </table>
  106. </div>
  107. <div style="margin-top:<%=margin%>px;border-top: 1px dotted black">
  108. <div style="float:left;width:50%;margin-top:7px">
  109. <span>Vencimiento</span></br>
  110. <span><%= l(sale.created_at + sale.customer.time_limit.days, :format => '%d/%m/%y') %></span>
  111. </div>
  112. <table style="float:right;width:50%" class="text-right">
  113. <thead>
  114. <tr>
  115. <th></th>
  116. <th></th>
  117. <th></th>
  118. </tr>
  119. </thead>
  120. <tbody>
  121. <tr>
  122. <td width="30%">Adeudo anterior</td>
  123. <td width="15%" class="text-right">$</td>
  124. <td width="40%" class="text-right">
  125. <%= number_to_currency(debt - sale.total, precision: 2, :unit => "") %>
  126. </td>
  127. </tr>
  128. <tr>
  129. <td width="30%"><strong>Adeudo actual</strong></td>
  130. <td width="15%" class="text-right"><strong>$</strong></td>
  131. <td width="40%" class="text-right">
  132. <strong><%= number_to_currency(debt, precision: 2, :unit => "") %></strong>
  133. </td>
  134. </tr>
  135. </tbody>
  136. </table>
  137. </div>
  138. <div style="margin-top:70px">
  139. <% if sale.get_pointsale.ticket_footer.blank? %>
  140. <%= simple_format(@pos_config.ticket_footer) %>
  141. <% else %>
  142. <%= simple_format(sale.get_pointsale.ticket_footer) %>
  143. <% end %>
  144. </div>
  145. </div>