Invoice Entering Program in Python - Helpwalaa - Free IT Updates & Opportunities

New Updates

Invoice Entering Program in Python

#Invoice Entering Program

print("Invoice Program\n")


while True:
    file = input("Enter 0 to Quit. Enter S to Search The File. Press ENTER to Input new Entries *Case Sensitive*: " )
    if file == "0":
        print("Exiting Program...")
        break
    elif file=="S":
        keyword = input("Enter Invoice Number to Search For: ")
        look_in = "usb.txt"
        search_file = open(look_in,"r")
        with open(look_in, "r") as search_file:
            for line in search_file:
                if keyword in line:
                    print(line)

    else:

        Name = input("Enter Buyer Name: ")
        InNum = input("Enter Ebay Invoice Number: ")
        Quant = int(input("Enter Amount Bought: "))
        Price = Quant * 5
        with open("usb.txt", "at")as out_file:
            out_file.write(
                "Name: %s || Invoice Number: %s || Quantity: %s || Price:$ %s \n\n" % (Name, InNum, Quant, Price))
            out_file.close()
            print("File edits made")

Image result for invoice

Most Popular