Esempio n. 1
0
def payoff():
    form = PayoffDebt()
    if form.validate_on_submit():
        db_api = DBHelper()
        db_api.payoff_debt(form.debtor.data, form.creditor.data,
                           form.price.data, form.description.data)
    return render_template('payoff.html', form=form)
Esempio n. 2
0
def add():
    form = AddItem()
    if form.validate_on_submit():
        db_api = DBHelper()
        db_api.add_new_item(form.buyer.data, form.others.data, form.price.data,
                            form.description.data)

    return render_template('add.html', form=form)
Esempio n. 3
0
def payoff_list():
    db_api = DBHelper()
    persons = db_api.return_persons()
    fullname_list = []
    for person in persons:
        _id, fullname = person[0], " ".join(person[1:])
        fullname_list.append((_id, fullname))
    fullname_list = dict(fullname_list)
    results = db_api.payoff_list()
    output = []
    for result in results:
        result = replacement(result, fullname_list)
        result.pop()
        output.append(result)
    return render_template('payofflist.html', output=output)
Esempio n. 4
0
class AddItem(FlaskForm):
    db_api = DBHelper()
    persons = db_api.return_persons()

    fullname_list = []
    for person in persons:
        _id, fullname = person[0], " ".join(person[1:])
        fullname_list.append((_id, fullname))
    buyer = SelectField('Buyer', choices=fullname_list, \
            validators=[DataRequired()], coerce=int)
    price = IntegerField('Price', validators=[DataRequired()])
    description = TextField('Description')
    others = SelectMultipleField('Contributers',
                                 choices=fullname_list,
                                 coerce=int,
                                 validators=[DataRequired()])
    submit = SubmitField('Submit')
Esempio n. 5
0
class PayoffDebt(FlaskForm):
    db_api = DBHelper()
    persons = db_api.return_persons()
    fullname_list = []
    for person in persons:
        _id, fullname = person[0], " ".join(person[1:])
        fullname_list.append((_id, fullname))

    debtor = SelectField('Debtor', choices=fullname_list, \
            validators=[DataRequired()], coerce=int)

    price = IntegerField('Price', validators=[DataRequired()])

    description = TextField('Description')

    creditor = SelectField('Creditor', choices=fullname_list, \
            validators=[DataRequired()], coerce=int)
    submit = SubmitField('Submit')
Esempio n. 6
0
def index():
    # Calculate the money
    db_api = DBHelper()
    results = db_api.sum_for_all()
    return render_template('index.html', results=results)