Пример #1
0
def newdonation():
    #customer facing, must be logged in user
    if checkSession() == False:  #check to make sure user is logged in
        return redirect('login')

    if request.form.get('transactionAmount') is None:
        t = transactionList()
        t.set('transactionDate', '')
        t.set('transactionType', '')
        t.set('transactionAmount', '')
        t.set('userID', '')
        t.add()
        return render_template('transaction/newdonation.html',
                               title='New Donation',
                               transaction=t.data[0])
    else:
        t = transactionList()
        t.set('transactionID', request.form.get('transactionID'))
        t.set('transactionType', request.form.get('transactionType'))
        t.set('transactionAmount', request.form.get('transactionAmount'))
        t.set('userID', session['user']['userID'])
        t.add()

        if t.verifyNew():
            t.insert()
            #print(t.data)
            return render_template('transaction/saveddonation.html',
                                   title='Donation Successful',
                                   transaction=t.data[0])
        else:
            return render_template('transaction/newdonation.html',
                                   title='Donation Unsuccessful',
                                   transaction=t.data[0],
                                   msg=t.errorList)
Пример #2
0
def newtransaction():
    if checkSession() == False:
        return redirect('login')
    AllPatients = patientList()
    AllPatients.getAll()
    #print(AllPatients.data)
    AllProviders = providerList()
    AllProviders.getAll()
    #print(AllProviders.data)
    AllAdmins = adminList()
    AllAdmins.getAll()
    #print(AllAdmins.data)
    if request.form.get('TransactionID') is None:
        t = transactionList()
        t.set('TransactionID', '')
        t.set('Date', '')
        t.set('Amount', '')
        t.set('Status', '')
        t.set('Insurance', '')
        t.set('Notes', '')
        t.set('AdminID', '')
        t.set('PatientID', '')
        t.set('PCPID', '')
        t.add()
        return render_template('transaction/newtransaction.html',
                               title='New Transaction',
                               transaction=t.data[0],
                               pl=AllPatients.data,
                               prl=AllProviders.data,
                               al=AllAdmins.data)
    else:
        t = transactionList()
        t.set('TransactionID', request.form.get('TransactionID'))
        t.set('Date', request.form.get('Date'))
        t.set('Amount', request.form.get('Amount'))
        t.set('Status', request.form.get('Status'))
        t.set('Insurance', request.form.get('Insurance'))
        t.set('Notes', request.form.get('Notes'))
        t.set('AdminID', request.form.get('AdminID'))
        t.set('PatientID', request.form.get('PatientID'))
        t.set('PCPID', request.form.get('PCPID'))
        t.add()
        if t.verifyNew():
            t.insert()
            print(t.data)
            return render_template('transaction/savedtransaction.html',
                                   title='Transaction Saved',
                                   transaction=t.data[0],
                                   pl=AllPatients.data,
                                   prl=AllProviders.data,
                                   al=AllAdmins.data)
        else:
            return render_template('Transaction/newtransaction.html',
                                   title='Transaction Not Saved',
                                   transaction=t.data[0],
                                   msg=t.errorList,
                                   pl=AllPatients.data,
                                   prl=AllProviders.data,
                                   al=AllAdmins.data)
Пример #3
0
def newadoptiontransaction():
    if checkSession() == False:  #check to make sure user is logged in
        return redirect('login')
    print(request.args.getlist('param'))

    a = animalList()
    animalID = ''
    animalID = request.args.get('animalID')
    a.getById(animalID)

    if len(a.data) <= 0:
        return render_template('error.html', msg='Animal not found.')

    adoptionFee = 0
    if a.data[0]['animalType'] == 'Dog':
        adoptionFee = 150
    elif a.data[0]['animalType'] == 'Cat':
        adoptionFee = 50

    if request.form.get('transactionType') is None:
        t = transactionList()
        t.set('transactionDate', '')
        t.set('transactionType', '')
        t.set('transactionAmount', '')
        t.set('userID', '')
        t.add()
        return render_template('transaction/newadoptiontransaction.html',
                               title='New Adoption Transaction',
                               transaction=t.data[0],
                               animal=a.data[0],
                               fee=adoptionFee)
    else:
        t = transactionList()
        t.set('transactionID', request.form.get('transactionID'))
        t.set('transactionType', request.form.get('transactionType'))
        t.set('transactionAmount', request.form.get('transactionAmount'))
        t.set('userID', session['user']['userID'])
        t.add()

        if t.verifyNew():
            t.insert()
            #print(t.data)
            return render_template('event/adoptionevent.html',
                                   title='Adoption Transaction Saved',
                                   transaction=t.data[0],
                                   animal=a.data[0],
                                   fee=adoptionFee)
        else:
            return render_template('transaction/newadoptiontransaction.html',
                                   title='Adoption Transaction Not Saved',
                                   transaction=t.data[0],
                                   msg=t.errorList,
                                   animal=a.data[0],
                                   fee=adoptionFee)
Пример #4
0
def adoptionevent():
    if checkSession() == False:  #check to make sure user is logged in
        return redirect('login')

    an = animalList()
    animalID = ''
    animalID = request.args.get('animalID')
    an.getById(animalID)
    #print('a.data before :', an.data[0])
    #print('USER:'******'user']['userID'])
    if session['user']['userID'] <= 0:
        return redirect('login')
    an.data[0]['animalStatus'] = 'Adopted'
    an.data[0]['userID'] = session['user']['userID']
    an.add()
    #print('an.data[0][animalStatus]', an.data[0]['animalStatus'])
    '''
    a.set('animalStatus','Adopted')
    a.set('userID',session['user']['userID'])
    a.add()
    '''
    #print('a.data after :', an.data[0])
    an.update()

    if len(an.data) <= 0:
        return render_template('error.html', msg='Animal not found.')

    t = transactionList()
    transactionID = ''
    transactionID = request.args.get('transactionID')
    t.getById(transactionID)

    if len(t.data) <= 0:
        return render_template('error.html', msg='Transaction not found.')

    e = eventList()
    e.set('eventType', 'Adoption')
    e.set('eventCompletedDate', 'n/a')
    e.set('eventName', 'Adoption of ' + an.data[0]['animalName'])
    e.set('eventResult', 'n/a')
    e.set('animalID', an.data[0]['animalID'])
    e.set('userID', session['user']['userID'])
    e.set('transactionID', transactionID)

    e.add()
    if e.verifyNew():
        e.insert()
        print(e.data)
        return render_template('event/adoptionsuccessful.html',
                               title='event Saved',
                               event=e.data[0])
    else:
        return render_template('event/adoptionevent.html',
                               title='event Not Saved',
                               event=e.data[0],
                               msg=e.errorList)
Пример #5
0
def transactions():
    if checkSession() == False:
        return redirect('login')
    t = transactionList()
    t.getAll()

    print(t.data)
    #return ''
    return render_template('transaction/transactions.html',
                           title='Transaction List',
                           transactions=t.data)
Пример #6
0
def newtransaction():
    if checkSession() == False:  #check to make sure user is logged in
        return redirect('login')
    elif session['user']['userType'] == 'customer':
        return redirect('login')

    u = userList()
    u.getAll()

    if request.form.get('transactionType') is None:
        t = transactionList()
        t.set('transactionDate', '')
        t.set('transactionType', '')
        t.set('transactionAmount', '')
        t.set('userID', '')
        t.add()
        return render_template('transaction/newtransaction.html',
                               title='New Transaction',
                               transaction=t.data[0],
                               users=u.data)
    else:
        t = transactionList()
        t.set('transactionID', request.form.get('transactionID'))
        t.set('transactionDate', request.form.get('transactionDate'))
        t.set('transactionType', request.form.get('transactionType'))
        t.set('transactionAmount', request.form.get('transactionAmount'))
        t.set('userID', request.form.get('userID'))
        t.add()

        if t.verifyNew():
            t.insert()
            #print(t.data)
            return render_template('transaction/savedtransaction.html',
                                   title='Transaction Saved',
                                   transaction=t.data[0])
        else:
            return render_template('transaction/newtransaction.html',
                                   title='Transaction Not Saved',
                                   transaction=t.data[0],
                                   msg=t.errorList,
                                   users=u.data)
Пример #7
0
def transactions():
    if checkSession() == False:  #check to make sure user is logged in
        return redirect('login')
    elif session['user']['userType'] == 'customer':
        return redirect('login')

    t = transactionList()
    t.getAll()

    #print(t.data)
    return render_template('transaction/transactions.html',
                           title='Transaction List',
                           transactions=t.data)
Пример #8
0
def transaction():
    if checkSession() == False:
        return redirect('login')
    t = transactionList()
    if request.args.get(t.pk) is None:
        return render_template('error.html', msg='No transaction id given.')

    t.getById(request.args.get(t.pk))
    if len(t.data) <= 0:
        return render_template('error.html', msg='Transaction not found.')

    print(t.data)
    return render_template('transaction/transaction.html',
                           title='Transaction ',
                           transaction=t.data[0])
Пример #9
0
def savedonation():
    #customer facing
    t = transactionList()
    t.set('transactionID', request.form.get('transactionID'))
    t.set('transactionType', request.form.get('transactionType'))
    t.set('transactionAmount', request.form.get('transactionAmount'))
    t.set('userID', session['user']['userID'])
    t.add()

    if t.verifyNew():
        t.update()
        print("after update", t.data)
        return render_template('transaction/saveddonation.html',
                               title='Donation successful',
                               transaction=t.data[0])
    else:
        return render_template('transaction/newdonation.html',
                               title='Donation unsuccessful',
                               transaction=t.data[0],
                               msg=t.errorList)
Пример #10
0
def transaction():
    if checkSession() == False:  #check to make sure user is logged in
        return redirect('login')
    elif session['user']['userType'] == 'customer':
        return redirect('login')

    u = userList()
    u.getAll()

    t = transactionList()
    if request.args.get(t.pk) is None:
        return render_template('error.html', msg='No transaction id given.')

    t.getById(request.args.get(t.pk))
    if len(t.data) <= 0:
        return render_template('error.html', msg='Transaction not found.')

    #print(t.data)
    return render_template('transaction/transaction.html',
                           title='Transaction Details',
                           transaction=t.data[0],
                           users=u.data)
Пример #11
0
def savetransaction():
    if checkSession() == False:
        return redirect('login')
    t = transactionList()
    t.set('TransactionID', request.form.get('TransactionID'))
    t.set('Date', request.form.get('Date'))
    t.set('Amount', request.form.get('Amount'))
    t.set('Status', request.form.get('Status'))
    t.set('Insurance', request.form.get('Insurance'))
    t.set('Notes', request.form.get('Notes'))
    t.set('AdminID', request.form.get('AdminID'))
    t.set('PatientID', request.form.get('PatientID'))
    t.set('PCPID', request.form.get('PCPID'))
    t.add()
    t.update()
    #print(e.data)
    #return ''
    return render_template('transaction/savedtransaction.html',
                           title='Transaction Saved',
                           transaction=t.data[0],
                           pl=AllPatients.data,
                           prl=AllProviders.data,
                           al=AllAdmins.data)
Пример #12
0
def savetransaction():
    if checkSession() == False:  #check to make sure user is logged in
        return redirect('login')
    elif session['user']['userType'] == 'customer':
        return redirect('login')

    t = transactionList()
    t.set('transactionID', request.form.get('transactionID'))
    t.set('transactionType', request.form.get('transactionType'))
    t.set('transactionAmount', request.form.get('transactionAmount'))
    t.set('userID', session['user']['userID'])
    t.add()

    if t.verifyNew():
        t.update()
        print("after update", t.data)
        return render_template('transaction/savedtransaction.html',
                               title='Transaction Saved',
                               transaction=t.data[0])
    else:
        return render_template('transaction/newtransaction.html',
                               title='Transaction Not Saved',
                               transaction=t.data[0],
                               msg=t.errorList)
Пример #13
0
def newappointment():
    #customer facing
    if checkSession() == False:  #check to make sure user is logged in
        return redirect('login')

    userID = session['user']['userID']
    animals = animalList()
    animals.getByField('userID', str(userID))

    if request.form.get('eventType') is None:
        t = transactionList()
        t.set('transactionType', '')
        t.set('transactionAmount', '')
        t.set('userID', '')
        t.add()

        e = eventList()
        e.set('eventType', '')
        e.set('eventScheduleDate', '')
        e.set('eventCompletedDate', '')
        e.set('eventName', '')
        e.set('eventResult', '')
        e.set('animalID', '')
        e.set('userID', '')
        e.set('transactionID', '')
        e.add()

        allAnimals = animalList()
        allAnimals.getAll()
        return render_template('event/newappointment.html',
                               title='New Event',
                               event=e.data[0],
                               animals=animals.data,
                               user=session['user']['userFName'])
    else:
        t = transactionList()
        t.set('transactionType', request.form.get('eventType'))
        t.set('transactionAmount', 0)
        t.set('userID', session['user']['userID'])
        t.add()

        e = eventList()
        e.set('eventID', request.form.get('eventID'))
        e.set('eventType', request.form.get('eventType'))
        e.set('eventCompletedDate', request.form.get('eventCompletedDate'))
        e.set('eventName', request.form.get('eventName'))
        e.set('eventResult', request.form.get('eventResult'))
        e.set('animalID', request.form.get('animalID'))
        e.set('userID', session['user']['userID'])
        #e.set('transactionID',request.form.get('transactionID'))

        e.add()
        if e.verifyNew():
            t.verifyNew()
            t.insert()

            e.set('transactionID', t.data[0]['transactionID'])
            e.add()
            e.insert()

            #print('eventdata:',e.data)
            #print('transactiondata:',t.data)
            return render_template('event/savedappointment.html',
                                   title='event Saved',
                                   event=e.data[0])
        else:
            return render_template('event/newappointment.html',
                                   title='event Not Saved',
                                   event=e.data[0],
                                   msg=e.errorList,
                                   user=session['user']['userFName'],
                                   animals=animals.data)