Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Categories = {{"property","construction","service","product"},{0.05,0.02,0.05,0.03}}
- local function Clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- local function TextField()
- local input
- local TX, TY = term.getCursorPos()
- TY = TY - 1
- while true do
- term.setCursorPos(TX,TY)
- term.clearLine()
- term.write()
- local e, a, b, c = os.pullEvent("key")
- if a == keys.enter then break elseif e == "key" then input = read(C) end
- end
- return input
- end
- local function OptionListSide(Y,Options)
- local n = 1
- while true do
- term.setCursorPos(1,Y)
- term.clearLine()
- term.write(Options[n])
- local a, b = os.pullEvent("key")
- if b == keys.a and n > 1 then n = n - 1 end
- if b == keys.d and n < #Options then n = n + 1 end
- if b == keys.enter then break end
- end
- return n
- end
- local function Menu()
- Clear()
- print("==Contract Recorder==")
- print("1. Enter Company Name")
- local C1 = TextField()
- print("2. Enter Customer name/ Company")
- local C2 = TextField()
- print("3. Enter Amount")
- local Amount = tonumber(TextField())
- print("4. select Category")
- local Opt = OptionListSide(9,Categories[1])
- local Tax = Categories[2][Opt]
- print("processing, please wait")
- print("Subtotal: "..Amount)
- print("Tax ("..Tax.."): "..(Amount*Tax))
- print("total: "..(Amount+(Amount*Tax)))
- print("creating file")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement