Commit 08d45e6d authored by oxinabox's avatar oxinabox

=Made refund script

parents
#!/usr/bin/env python
import subprocess as sp
while True:
username=None
while(not(username)):
username = raw_input("Username: ")
try:
sp.check_call(["dispense","acct", username])
#sp.check_call(["id", username])
sp.check_call(["finger", username])
except sp.CalledProcessError:
username = None
continue #Restart the loop
amount=None
int_amount = None
while(not amount):
try:
int_amount = int(raw_input("Amount (in cents): "))
amount = "+"+str(int_amount)
except ValueError:
print "Please enter a number."
amount = None
continue
print "Adding: $%2.2f" % (int_amount/100.0)
reason = raw_input('Reason/Bag Number (Enter just a digit, to say "money in safe. Bag number <input>"): ')
if reason.isdigit():
reason = "Money in safe. Bag number " + reason
elif len(reason)==0:
reason = "Money in safe."
cmd =" ".join(['dispense acct ',username, amount,' "' + reason+'"'])
print "Will call: " + cmd
confirm = raw_input("Correct (Y/N): ").lower()
if confirm and confirm[0]=='n':
#Restart
continue
else:
break
#subprocess call hastes me for not useing speratre args
sp.call(["dispense", "acct", username, amount, reason])
print "Thankyou please remember to do what ever crazy plan the treasurer wants done with the safe today."
#!/usr/bin/env python
import subprocess as sp
sp.call(['tail', '-n3', "/home/other/coke/cokelog"])
username=None
while(not(username)):
username = raw_input("Username: ")
try:
sp.check_call(["dispense","acct", username])
#sp.check_call(["id", username])
sp.check_call(["finger", username])
except sp.CalledProcessError:
username = None
continue #Restart the loop
item_id=None
while(not(item_id)):
item_id = raw_input("item_id (Usually of the form <item>:<slot> eg coke:6 or snack:33): ")
amount=None
while(True):
raw_amount = raw_input("Amount (in cents): (Leave blank for default): ")
if len(raw_amount)==0:
amount=""
print "Refunding at default value"
break
else:
try:
int_amount = int(raw_amount) #Throw the exception
amount = str(int_amount)
except ValueError:
print "Please enter a number."
continue
print "Refunding: $%2.2f" % (int_amount/100.0)
break
cmd =" ".join(['dispense refund ',username, item_id, amount ])
print "Will call: " + cmd
command_args = ["dispense","refund", username, item_id]
if amount:
command_args.add(amount)
sp.check_call(command_args)
print("Done. Please Don't Make Mistakes Again.")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment