コード例 #1
0
def avail_loan(id):
    try:
        acc_no = int(input("\nEnter Your Savings Account No : "))
    except:
        print("Invalid Account No")
        return
    account = database.get_all_info_account(acc_no,id,"loan")
    if account is not None:
        max_loan = 2*account.get_balance()
        msg = "\nEnter loan amount (Max Amount : Rs "+ str(max_loan) + " ) (in multiples of 1000) : "
        try:
            loan_amt = int(input(msg))
        except:
            print("Invalid Amount")
            return
        if loan_amt <= max_loan and loan_amt > 0 and loan_amt % 1000 == 0 :
            try:
                loan_term = int(input("\nEnter repayment term (in months) : "))
            except:
                print("Invalid repayment term")
                return
            if loan_term > 0:
                database.get_loan_customer(account.get_account_no(),loan_amt,loan_term)
                res = db_admin.get_loan_report(id)
                print("Account No \t\t\t\t Amount \t\t\t\t Repay Term")
                for i in range(0,len(res)):
                    print(res[i][0],"   \t\t\t\t\t   ",res[i][1],"   \t\t\t\t   ",res[i][2])
            else:
                print("Sorry ! Invalid Loan Term")

        else:
            print("Sorry ! Invalid Loan Amount")

    else:
        print("Sorry! Account No Doesn't match")
コード例 #2
0
def print_loan_report():
    try:
        cus_id = int(input("\nEnter customer ID : "))
    except:
        print("Invalid ID")
        return
    if db_admin.check_customer_exists(cus_id) is True:
        res = db_admin.get_loan_report(cus_id)
        if len(res) == 0:
            print("Not Availed")
        else:
            print("Account No \t\t\t\t Amount \t\t\t\t Repayment Term")
            for i in range(0,len(res)):
                print(res[i][0],"   \t\t\t\t\t   ",res[i][1],"   \t\t\t\t   ",res[i][2])
    else:
        print("Customer Doesn't exist")