-
-
Save vvikramjhu/6215384 to your computer and use it in GitHub Desktop.
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
# Function to print the last order row of new Order | |
def printOrder(d): | |
key = d.keys()[-1] | |
lpr = subprocess.Popen("/usr/bin/lpr", stdin=subprocess.PIPE) | |
lpr.stdin.write("OrderNo"+ str(key)+"\n") | |
lpr.stdin.write("Name :"+ d[key]['name'] + "\n") | |
lpr.stdin.write("tel :"+ str(d[key]['telephone'])+"\n") | |
for y in d[key]['items']: | |
lpr.stdin.write(y['name'] + " " + y['size'] +" " + str(y['quantity']) + " " +str(y['price']) + "\n") | |
lpr.stdin.write("$ "+ str(d[key]['total']) + " discount" +" "+ str(d[key]['discount']) ) | |
lpr.stdin.write(d[key]['instruct']+"\n") | |
lpr.stdin.close() | |
lpr.wait() |
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
sample input : | |
http://imagebin.org/267314 | |
output: | |
http://imagebin.org/267317 |
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
key = d.keys()[-1] | |
with open('order', 'w') as f: | |
f.write("OrderNo"+ str(key)+"/n") | |
f.write("Name, tel"+ d[key]['name']+ str(d[key]['telephone'])+"/n") | |
for y in d[key]['items']: | |
f.write(y['name'] + y['size'] + str(y['quantity']) +str(y['price']) + "/n") | |
f.write(d[key]['instruct']+"/n") | |
f.write(str(d[key]['total']) + "discount" + str(d[key]['discount']) ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment