Esempio n. 1
0
 def getUserDetails(self):
     drawLines()
     print "Lets capture customer details"
     drawLines()
     self.name = getInput("Customer Name: ")
     self.number = getInput("Mobile Number: ")
     self.age = getInput("Age: ")
Esempio n. 2
0
 def getEmployeeDetails(self):
     self.getUserDetails()
     self.emp_code = getInput("Employee Code: ")
     emp_details = {
         "name" : self.name,
         "number": self.number,
         "emp_code": self.emp_code,
     }
     drawLines()
     return emp_details
Esempio n. 3
0
 def showRegisterCatalog(self, register):
     print "{:<15} {:<15} {:<15} {:<15}".format('Sl No', 'Item', 'Count',
                                                'Price')
     drawLines()
     for i, (key, value) in enumerate(
             self.store_inventory[register]["items"].iteritems()):
         print "{:<15} {:<15} {:<15} {:<15}".format(str(i + 1),
                                                    value['name'],
                                                    value['count'],
                                                    value['price'])
     drawLines()
Esempio n. 4
0
    def getCustomerDetails(self):
        self.getUserDetails()
        if int(self.age) >= 60:
            self.is_senior_citizen = 1

        cust_details = {
            "name": self.name,
            "number": self.number,
            "is_senior_citizen": self.is_senior_citizen
        }
        drawLines()
        return cust_details
Esempio n. 5
0
 def showClosingCatalogue(self):
     drawLines()
     printHeader('Catalog')
     drawLines()
     print "{:<15} {:<15} {:<15} {:<15}".format('Register', 'Item', 'Count',
                                                'Price')
     drawLines()
     for k, v in self.store_inventory.iteritems():
         for key, value in v["items"].iteritems():
             print "{:<15} {:<15} {:<15} {:<15}".format(
                 k, value['name'], value['count'], value['price'])
     drawLines()
Esempio n. 6
0
def start_transactions():
    drawLines()
    print "Start Billing"
    drawLines()
    ans = getInput("Are you a current employee (Y/N)?")
    if ans == "Y":
        emp = Employee()
        cust_details = emp.getEmployeeDetails()
    else:
        cust = Customer()
        cust_details = cust.getCustomerDetails()
    Transaction(cust_details)
    print "Completed Billing"
    drawLines()
    ans = getInput("Do you want to do more transactions (Y/N)?")
    if ans == "Y":
        start_transactions()
Esempio n. 7
0
        img = util.loadImg(index, FOLDER)
        if img is None:
            index += 1
            continue

        imgOrig = cv2.resize(img, (WIDTH, HEIGHT),
                             interpolation=cv2.INTER_LINEAR)
        img = util.image_to_feature_vector(imgOrig)

        #NN Prediction
        x0, y0, x1, y1 = util.predict(img, model)

        #Increase size of image
        imgOrig = cv2.resize(imgOrig, (640, 480),
                             interpolation=cv2.INTER_LINEAR)
        util.drawLines(imgOrig, (int(x0 * 2), int(x1 * 2)),
                       (int(y0 * 2), int(y1 * 2)))

        #Compute parameters
        theta = util.computeAngle(x0, y0, x1, y1) / MAX_ANGLE
        delta_x = (x0 - MAX_SHIFT) / MAX_SHIFT
        K = (theta + delta_x) / 2

        print('T :' + str(np.round(theta, 2)) + ' X :' +
              str(np.round(delta_x, 2)) + ' K :' + str(np.round(K, 2)))

        #Show image
        cv2.imshow('Image', imgOrig)
        k = cv2.waitKey(0) & 0xFF

        if k == ord('d'):
            break
Esempio n. 8
0
 def generateBill(self, cust_details, txn_id, total_billed_items):
     drawLines()
     print "Transaction Id: " + txn_id
     drawLines()
     print "Name: " + cust_details['name']
     print "Mobile Number: " + cust_details['number']
     if 'emp_code' in cust_details.keys():
         print "Employee Code: " + cust_details['emp_code']
     drawLines()
     print "{:<15} {:<15} {:<15} {:<15} {:<15} {:<15}".format(
         'Item', 'Units', 'Unit Price', 'Discount Percent', 'Total',
         'Discounted Price')
     drawLines()
     total = 0
     for item in total_billed_items:
         price = item['price']
         total_price = int(item['count']) * int(price)
         discounted_total = calculateDiscountedPrice(
             total_price, item['discount_percent'])
         total = total + discounted_total
         print "{:<15} {:<15} {:<15} {:<15} {:<15} {:<15}".format(
             item['item'], item['count'], price,
             str(item['discount_percent']) + "%", total_price,
             discounted_total)
     drawLines()
     if 'is_senior_citizen' in cust_details.keys(
     ) and cust_details['is_senior_citizen'] == 1:
         print "Total: " + str(total)
         print "Senior Citizen Discount: " + str(
             Discount.discount_details["senior_citizen_discount"]) + "%"
         total = calculateDiscountedPrice(
             total, Discount.discount_details["senior_citizen_discount"])
     if 'emp_code' in cust_details.keys():
         print "Total: " + str(total)
         print "Employee Discount: " + str(
             Discount.discount_details["employee_discount"]) + "%"
         total = calculateDiscountedPrice(
             total, Discount.discount_details["employee_discount"])
     print "Total to be paid: " + str(total)
     drawLines()