Пример #1
0
def try_total_order_cust(cust_num):
    total = get_total_orders_for_customer(cust_num)
    #print("Total orders for customer {} is {:.2f}".format(cust_num, total))
    return total
Пример #2
0
import db_access_web
import db_utility

fmt = "{0:^10} {1:<35} {2:>15} {3:>15} {4:>20} {5:>20} "
cust_num = "CustNum"
cust_name = "Customer Name"
pay = "Payments"
ord = "Orders"
lim = "Credit Limit"
avail = "Available Credit"

print(fmt.format(cust_num, cust_name, pay, ord, lim, avail))

cust = db_access_web.get_all_customers()

for row in cust:
    cust_number = row["customerNumber"]
    customer_name = row["customerName"]
    credit_limit = float(row["creditLimit"])

    total_payments = float(db_utility.get_total_payments_for_customer(cust_number))
    total_orders = float(db_utility.get_total_orders_for_customer(cust_number))

    available_credit = credit_limit + total_payments - total_orders

    if available_credit < 0:
        print(fmt.format(cust_number, customer_name, total_payments, total_orders, credit_limit, available_credit))
Пример #3
0
         'status': 3, 'comments': 5, 'customerNumber': 6}

order_details = {'orderNumber': 0, 'productCode': 1, 'quantityOrdered': 2,
                 'priceEach': 3, 'orderLineNumber': 4}

customer_info = db_access.get_all_customers()

while customer_info[row] is not None:
    for row in range(len(customer_info)):
            customer_number = row[0].format(row)
            customer_name = row[1].format(row)
            credit_limit = row[12].format(row)

            total_payments = db_utility.get_total_payments_for_customer(customer_number)

            total_orders = db_utility.get_total_orders_for_customer(customer_number)

            avail_credit = credit_limit + total_payments - total_orders

fmt = "{0:<10} {1:<20} {2:<10} {3:<10} {4:<20} {5:<20} "
cust_num = "CustNum"
cust_name = "Customer Name"
pay = "Payments"
ord = "Orders"
lim = "Credit Limit"
avail = "Available Credit"
print(fmt.format(cust_num, cust_name, pay, ord, lim, avail))

for row in customer_info:
    print(fmt.format(customer_number, customer_name, total_payments,
          total_orders, credit_limit, avail_credit))