async def to_assortment_save(msg: types.Message, state: FSMContext): await state.update_data(amount=msg.text) t_data = await state.get_data() amount = t_data['amount'] result = texts.form_result('В резерв', amount, True, place='') excel_book.add_to_unlisted(result) # запись result = texts.form_result('Приход', amount) excel_book.add_to_reserve(result) # запись await state.finish() await msg.answer('Готово', reply_markup=texts.main_kb)
async def save_place(msg: types.Message, state: FSMContext): await state.update_data(place=msg.text) t_data = await state.get_data() amount, place, term = t_data['amount'], t_data['place'], t_data['term'] result = texts.form_result('Закупка', amount, place=place, term=term) excel_book.add_to_unlisted(result) # запись await state.finish() await msg.answer('Готово', reply_markup=texts.main_kb)
async def inv_reserve(msg: types.Message, state: FSMContext): a1, a2, a3, a4 = [int(i) for i in msg.text.split()] b1, b2, b3, b4 = excel_book.get_reserve() diff_amount = [str(i) for i in (a1 - b1, a2 - b2, a3 - b3, a4 - b4)] diff_amount = ' '.join(diff_amount) result = texts.form_result('Коррекция', diff_amount) excel_book.add_to_reserve(result) # запись await state.finish() await msg.answer('Готово', reply_markup=texts.main_kb)