def create_refund_bill(user_id, amount, debtor_id): bill.create_bill(user_id) bill.put_data( user_id, 'description', user.get_user_fullname(debtor_id) + '-->' + user.get_user_fullname(user_id)) bill.put_data(user_id, 'amount', amount) bill.insert_payment(user_id)
def get_debts(user_id): debts = db.select_user_debts(user_id) msg = '' for d in debts: msg = msg + 'Имя:' + user.get_user_fullname(d[0]) + '\n' \ 'Сумма:' + str(d[1]) + '\n\n' return msg
def get_r_users_keyboard(users_id): markup = telebot.types.InlineKeyboardMarkup() for _id in users_id: btn = telebot.types.InlineKeyboardButton( text=user.get_user_fullname(_id), callback_data='r_' + str(_id)) markup.row(btn) return markup
def get_debtors(user_id): debtor_list = db.select_debtors(user_id) msg = '' for debtor in debtor_list: msg = msg + 'Должник:' + user.get_user_fullname(debtor[0]) + '\n' \ 'Сумма:' + str(debtor[1]) + '\n\n' return msg
def get_group_info(user_id): group_id = user.get_current_group(user_id) data = groups_dict[group_id] msg = 'Группа:' + group_id + '\n' \ 'Пароль:' + data['password'] + '\n' \ 'Участники: \n' for member in data['members']: msg = msg + user.get_user_fullname(member) + '\n' return msg
def get_bills_msg(user_id): group_id = user.get_current_group(user_id) bills = db.select_bills(group_id) msg = "" for b in bills: msg = msg + 'Оплатил:' + user.get_user_fullname(b[0]) + '\n' \ 'Описание:' + b[1] + '\n' \ 'Сумма:' + str(b[2]) + '\n' \ 'Дата:' + str(b[3]) + '\n\n' return msg
def get_users_keyboard(user_id): markup = telebot.types.InlineKeyboardMarkup() group_id = user.get_current_group(user_id) users_id = group.get_members_by_group_id(group_id) for _id in users_id: if not _id == user_id: btn = telebot.types.InlineKeyboardButton( text=user.get_user_fullname(_id), callback_data='u_' + str(_id)) markup.row(btn) return markup
def send_approve_refund(user_id, debtor_id, amount): msg = user.get_user_fullname( user_id) + 'подтвердил возврат средств на сумму ' + str(amount) alert_bot.send_message(debtor_id, msg)
def send_debt_msg(user_id, debtor_id, description, amount): msg = 'Привет!\n' + \ user.get_user_fullname(user_id) + ' заплатил за тебя:\n' + \ 'Оплачено:' + description + '\n' + \ 'Сумма:' + str(amount) alert_bot.send_message(debtor_id, msg)