This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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+ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'] |