def SecondaryUnits(): data = EnterpriseAPI.GetSecondaryUnits() if request.method == 'POST': if request.form['submit'] == 'Submit': try: EnterpriseAPI.CreateSecondaryUnit( session['username'], session['password'], request.form['secuntname'], request.form['secuntcode'], request.form['unit'], request.form['secuntmeasure']) flash('Secondary unit created successfully...', category='success') return redirect(url_for('invoices.SecondaryUnits')) except Exception as e: flash(str(e), category='fail') return redirect(url_for('invoices.SecondaryUnits')) return render_template('invoices/Secondary_units.html', username=session['username'], role=session['role'], data=data)
def EditSecondaryUnit(code): data = EnterpriseAPI.GetSecondaryUnits() data1 = EnterpriseAPI.GrabSecondaryUnit(code) wh = EnterpriseAPI.GetWareHouses() if request.method == 'POST': if request.form['submit'] == 'Submit': try: EnterpriseAPI.UpdateSecondaryUnit( session['username'], session['password'], request.form['secuntname'], code, request.form['unit'], request.form['secuntmeasure']) flash('Secondary Unit updated successfully...', category='success') return redirect(url_for('logistics.SecondaryUnits')) except Exception as e: flash(str(e), category='fail') return redirect(url_for('logistics.SecondaryUnits')) return render_template('logistics/Edit_secondary_unit.html', username=session['username'], role=session['role'], data=data, data1=data1, wh=wh)