def Delete(Name, Table, Function, COM=None): DB_obj.delete(Name, Table) if COM == None: DB_obj.delete1(Name, 'compnies_stock') return redirect(url_for(Function)) else: return redirect(url_for(Function, company=COM))
def Login(self): try: if session['user']: return redirect(url_for('Home')) except: if request.method == 'POST': User = request.form.get('User') Password = request.form.get('Password') DB_obj.view(Log_handel.T_Name) for i in DB_obj.Data: if User == i[0] and Password == i[1]: if User == 'admin': session['user'] = '******' return redirect(url_for('Home')) else: session['user'] = '******' return redirect(url_for('Home')) return render_template('login_page.html')
def after_update(self, table, P_Name, company, after_update, sold): if request.method == 'POST': Name = request.form.get('Item_Name') Quantity = request.form.get('Total_items') Buy_Price = request.form.get('Price_Pi') Sell_Price = request.form.get('Sell') Company_Name = request.form.get('Comp') Available = request.form.get('Available') if int(Available) > int(after_update): Available_Updated = int(Available) - int(after_update) Q = int(Available_Updated) + int(Quantity) else: Available_Updated = int(after_update) - int(Available) Q = int(Quantity) - int(Available_Updated) Updated_total_price = Q * int(Buy_Price) Updated_profit = (Q * int(Sell_Price)) - Updated_total_price DB_obj.stock_update(table, P_Name, Name, Q, Buy_Price, Sell_Price, Company_Name, Available, Updated_total_price, Updated_profit) return redirect(url_for('t_stock_detail', company=company))
def logout(self): if 'user' in session: session.pop('user') return redirect('/login')
def deL_bill(self, Table, company, value): DB_obj.delete_bill(Table, 'Id', value) return redirect(url_for('bill', company=company))
def dues_update(self, company): if request.method == 'POST': Amount = request.form.get('Amount') DB_obj.pen_update(company, Amount) return redirect(url_for('bill', company=company))
def Order_Bill(self, Company_select, table, Bill, Reciever, Paid_amount, Customer, Pending, Time, Date, ALL_LIST): DB_obj.BiLL_detail(Company_select, table, Bill, Reciever, Paid_amount, Customer, Pending, Time, Date, ALL_LIST) return redirect(url_for('new_order'))