コード例 #1
0
ファイル: functions.py プロジェクト: 0--key/lib
def getPO_Data(iID):
    """Retrieve purchase order data accordingly its ID"""
    poData = {}
    db = MySQLdb.connect(passwd=db_password, db=db_name, user='******')
    MySQL_c = db.cursor()
    MySQL_c.execute("""SELECT author_id, supplier_id, sent, s_author_id
    FROM invoices WHERE id=%s""", (iID,))
    author_id, supplier_id, sent, s_author_id = MySQL_c.fetchone()
    db.commit()
    db.close()
    poData['buyer'] = session['username']
    poData['email'] = users.get(session['username']).get('email')
    poData['phoneNo'] = users.get(session['username']).get('phoneNo')
    poData['No'] = int(iID) * 3 + 140121  # PO No obfuscator
    return poData
コード例 #2
0
def getPO_Data(iID):
    """Retrieve purchase order data accordingly its ID"""
    poData = {}
    db = MySQLdb.connect(passwd=db_password, db=db_name, user='******')
    MySQL_c = db.cursor()
    MySQL_c.execute(
        """SELECT author_id, supplier_id, sent, s_author_id
    FROM invoices WHERE id=%s""", (iID, ))
    author_id, supplier_id, sent, s_author_id = MySQL_c.fetchone()
    db.commit()
    db.close()
    poData['buyer'] = session['username']
    poData['email'] = users.get(session['username']).get('email')
    poData['phoneNo'] = users.get(session['username']).get('phoneNo')
    poData['No'] = int(iID) * 3 + 140121  # PO No obfuscator
    return poData
コード例 #3
0
def index():
    """Composes operator dashboard"""
    if 'username' in session:
        user = session['username']
        logo = users.get(user).get('img')
    else:
        return redirect(url_for('login'))
    if 'active_tab' not in session:  # active tab defining
        session['active_tab'] = 'orders'  # <-- initial value
    o_dataset, pii_data = fetch_pending_orders_data()  # compose
    otl = checkOTLock()
    agg_products = fetch_products_data(pii_data)  # tabs
    supp_tab_data = fetch_suppliers_data()
    p_invoices_tab_data = fetch_invoices_data('pending')
    sent_PO_tab_data = fetch_invoices_data('sent')
    heldP_tab_data = fetch_held_products()
    a_tab = setActiveTab(session['active_tab'])
    return render_template('index.htm',
                           user=user,
                           logo=logo,
                           orders=o_dataset,
                           o_t_lock=otl,
                           orders_agg=agg_products,
                           agg_products_qty=len(agg_products),
                           active=a_tab,
                           supp_data=supp_tab_data,
                           pItab=p_invoices_tab_data,
                           sItab=sent_PO_tab_data,
                           hTd=heldP_tab_data)
コード例 #4
0
ファイル: dispatcher.py プロジェクト: 0--key/lib
def login():
    """A primitive authentication feature"""
    if request.method == 'POST':
        input_username = request.form['username']
        input_password = request.form['password']
        if (input_username in users and
            users.get(input_username).get('password') == input_password):
            session['username'] = input_username
            session['userID'] = get_user_id(input_username)
            return redirect(url_for('index'))
    return render_template('login.htm')
コード例 #5
0
def login():
    """A primitive authentication feature"""
    if request.method == 'POST':
        input_username = request.form['username']
        input_password = request.form['password']
        if (input_username in users and
                users.get(input_username).get('password') == input_password):
            session['username'] = input_username
            session['userID'] = get_user_id(input_username)
            return redirect(url_for('index'))
    return render_template('login.htm')
コード例 #6
0
ファイル: dispatcher.py プロジェクト: 0--key/lib
def index():
    """Composes operator dashboard"""
    if 'username' in session:
        user = session['username']
        logo = users.get(user).get('img')
    else:
        return redirect(url_for('login'))
    if 'active_tab' not in session:  # active tab defining
        session['active_tab'] = 'orders'  # <-- initial value
    o_dataset, pii_data = fetch_pending_orders_data()  # compose
    otl = checkOTLock()
    agg_products = fetch_products_data(pii_data)  # tabs
    supp_tab_data = fetch_suppliers_data()
    p_invoices_tab_data = fetch_invoices_data('pending')
    sent_PO_tab_data = fetch_invoices_data('sent')
    heldP_tab_data = fetch_held_products()
    a_tab = setActiveTab(session['active_tab'])
    return render_template(
        'index.htm', user=user, logo=logo, orders=o_dataset, o_t_lock=otl,
        orders_agg=agg_products, agg_products_qty=len(agg_products),
        active=a_tab, supp_data=supp_tab_data, pItab=p_invoices_tab_data,
        sItab = sent_PO_tab_data, hTd = heldP_tab_data
        )