Skip to content

Instantly share code, notes, and snippets.

View dcaliri's full-sized avatar

Diego Caliri dcaliri

  • Eventioz
  • Mendoza, Argentina
View GitHub Profile
@dcaliri
dcaliri / bill.html
Last active August 28, 2024 15:59 — forked from AfipSDK/bill.html
Factura de ejemplo
<!DOCTYPE html>
<html>
<head>
<title>Factura</title>
<style type="text/css">
*{
box-sizing: border-box;
-webkit-user-select: none; /* Chrome, Opera, Safari */
-moz-user-select: none; /* Firefox 2+ */
-ms-user-select: none; /* IE 10+ */
@dcaliri
dcaliri / gist.rb
Last active August 29, 2015 13:55
class Bill
def assign_rps_number_and_serial(save_it = nil)
rps = Bill.order(:rps_serial, :rps_number).where('rps_number IS NOT NULL').select(:rps_number, :rps_serial).last
number = rps.try(:rps_number) || 1
serial = rps.try(:rps_serial) || 'A'
self.rps_number, self.rps_serial = if number < 999999999999
[number + 1, serial]
else
[1, serial + 'A']