SHOW:
|
|
- or go back to the newest paste.
| 1 | - | printer = peripheral.wrap("right")
|
| 1 | + | function clear() |
| 2 | term.clear() | |
| 3 | term.setCursorPos(1,1) | |
| 4 | end | |
| 5 | - | print("Stampa bolletta eRGB")
|
| 5 | + | |
| 6 | clear() | |
| 7 | ||
| 8 | print(" eRGB")
| |
| 9 | print("")
| |
| 10 | print("Creazione bolletta elettronica")
| |
| 11 | print("")
| |
| 12 | print("Inserire cod.cliente")
| |
| 13 | local UICnumber = read() | |
| 14 | print("")
| |
| 15 | local phpdate = http.get("http://172.16.20.218/date.php")
| |
| 16 | local date = phpdate.readAll() | |
| 17 | phpdate.close() | |
| 18 | print("La data di oggi e'"..date.." ")
| |
| 19 | print("Premere ENTER per accettare, C per correggere")
| |
| 20 | local keys = read() | |
| 21 | if keys == "c" then | |
| 22 | - | print("Inserire lettura")
|
| 22 | + | |
| 23 | - | local energy = read() |
| 23 | + | |
| 24 | - | print("Inserire spesa fissa")
|
| 24 | + | |
| 25 | - | local tassa = read() |
| 25 | + | |
| 26 | - | parziale = math.floor(energy/1000000) |
| 26 | + | |
| 27 | - | totale = parziale+tassa |
| 27 | + | print("Inserire totale")
|
| 28 | local totale = read() | |
| 29 | print("Inserire segno")
| |
| 30 | local segno = read() | |
| 31 | - | term.setCursorPos(1, 1) |
| 31 | + | |
| 32 | - | printer.newPage() |
| 32 | + | local be = {}
|
| 33 | - | printer.setPageTitle("Bolletta eRGB")
|
| 33 | + | be.UICnumber = UICnumber |
| 34 | - | printer.write("Bolletta eRGB")
|
| 34 | + | be.date = date |
| 35 | - | printer.setCursorPos(1, 2) |
| 35 | + | be.totale = totale |
| 36 | - | printer.setCursorPos(1, 4) |
| 36 | + | be.segno = segno |
| 37 | - | printer.write("Bolletta del: ")
|
| 37 | + | |
| 38 | - | printer.setCursorPos(14, 4) |
| 38 | + | bedisco = textutils.serialize(be) |
| 39 | - | printer.write(date) |
| 39 | + | |
| 40 | - | printer.setCursorPos(1, 6) |
| 40 | + | clear() |
| 41 | - | printer.write("Codice cliente: ")
|
| 41 | + | print("Inserire disco")
|
| 42 | - | printer.setCursorPos(16, 6) |
| 42 | + | os.pullEvent("disk")
|
| 43 | - | printer.write(UICnumber) |
| 43 | + | disk.setLabel("bottom", "DBE")
|
| 44 | - | printer.setCursorPos(1, 7) |
| 44 | + | local handle = assert(fs.open("disk/be", "w"), "TOC ERROR")
|
| 45 | - | printer.write("Energia consumata:")
|
| 45 | + | handle.write(bedisco) |
| 46 | - | printer.setCursorPos(1, 8) |
| 46 | + | handle.close() |
| 47 | - | printer.write(energy) |
| 47 | + | clear() |
| 48 | - | printer.setCursorPos(1, 10) |
| 48 | + | print("Ritirare il disco")
|
| 49 | - | printer.write("Spese fisse:")
|
| 49 | + | disk.eject("bottom")
|
| 50 | - | printer.setCursorPos(1, 11) |
| 50 | + |