示例#1
0
def product_edit(product_id):
    if request.method == 'GET' and session['usertype'] == 1:
        obj = forms.Product()
        data = obj.Product_select(product_id, '')
        obj2 = forms.Provider()
        data2 = obj2.Provider_name_select()
        data2 = functions.group(data2, 2)
        data = [[data], [data2]]
        data.append(obj.Product_provider_id(product_id))
        return render_template('product_Edit.html', data=data)

    if request.method == 'POST' and session['usertype'] == 1:
        if (request.form['submit_button'] == 'Submit'):
            product_name = request.form.get('product_name')
            product_brand = request.form.get('product_brand')
            product_sellprice = request.form.get('product_sellprice')
            provider_id = request.form.get('provider_id')
            product_weight = request.form.get('product_weight')
            obj = forms.Product()
            obj.Product_edit(product_id, product_name, product_brand,
                             product_sellprice, provider_id, product_weight)
            return redirect(url_for('product_list'))
        elif (request.form['submit_button'] == 'Homepage'):
            return redirect(url_for('home_page'))

    else:
        return redirect(url_for('home_page', error='You are not Authorized'))
示例#2
0
def supply_add():
    if request.method == 'GET' and session['usertype'] == 1:
        obj = forms.Provider()
        data = obj.Provider_name_select()
        data = functions.group(data, 2)
        obj2 = forms.Product()
        data2 = obj2.Product_name_select()
        data = [[data], [data2]]
        return render_template('supply_add.html', data=data)
    if request.method == 'POST' and session['usertype'] == 1:
        if (request.form['submit_button'] == 'Submit'):
            provider_id = request.form.get('provider_id')
            supply_price = request.form.get('supply_price')
            supply_quantity = request.form.get('supply_quantity')
            supply_time = datetime.now().strftime("%d/%m/%Y - %H:%M")
            product_id = request.form.get('product_id')
            obj = forms.Supply()
            obj.Supply_add(provider_id, supply_price, supply_quantity,
                           supply_time, product_id)
            obj2 = forms.Stock()
            obj2.update_quantity(supply_quantity,
                                 obj2.get_ID(product_id)[0][0])
            obj3 = forms.Finance()
            obj3.weBoughtSmth(obj.get_supplyID())
            return redirect(url_for('supply_add'))
        elif (request.form['submit_button'] == 'Homepage'):
            return redirect(url_for('home_page'))

    else:
        return redirect(url_for('home_page', error='You are not Authorized'))
示例#3
0
def product_add():
    if request.method == 'GET' and session['usertype'] == 1:
        obj = forms.Provider()
        data = obj.Provider_name_select()
        data = functions.group(data, 2)
        return render_template('product_add.html', data=data)
    if request.method == 'POST' and session['usertype'] == 1:
        if (request.form['submit_button'] == 'Submit'):
            product_name = request.form.get('product_name')
            product_brand = request.form.get('product_brand')
            product_sellprice = request.form.get('product_sellprice')
            provider_id = request.form.get('provider_id')
            product_weight = request.form.get('product_weight')
            obj = forms.Product()
            obj.Product_add(product_name, product_brand, product_sellprice,
                            provider_id, product_weight)
            product_id = obj.Product_select('', product_name)[0][0]
            obj2 = forms.Stock()
            obj2.add_to_stock(product_id)
            return redirect(url_for('product_add'))
        elif (request.form['submit_button'] == 'Homepage'):
            return redirect(url_for('home_page'))

    else:
        return redirect(url_for('home_page', error='You are not Authorized'))
示例#4
0
def supply_list():
    if request.method == 'GET' and session['usertype'] == 1:
        obj = forms.Provider()
        data = obj.Provider_name_select()
        data = functions.group(data, 2)
        obj2 = forms.Product()
        data2 = obj2.Product_name_select()
        data2 = functions.group(data2, 3)
        data = [[data], [data2]]
        return render_template('supply_list.html', data=data)
    elif request.method == 'POST' and session['usertype'] == 1:
        if (request.form['submit_button'] == 'Delete Selected'):
            option = request.form['options']
            obj = forms.Supply()
            obj.Supply_delete(option)
            return redirect(url_for('supply_list'))
        elif (request.form['submit_button'] == 'Edit Selected'):
            option = request.form['options']
            return redirect(url_for('supply_edit', supply_id=option))
        elif (request.form['submit_button'] == 'Submit'):
            supply_id = request.form.get('supply_id')
            product_id = request.form.get('product_id')
            provider_id = request.form.get('provider_id')
            obj = forms.Provider()
            data = obj.Provider_name_select()
            data = functions.group(data, 2)
            obj2 = forms.Product()
            data2 = obj2.Product_name_select()
            data2 = functions.group(data2, 3)
            obj3 = forms.Supply()
            data3 = obj3.Supply_select(supply_id, product_id, provider_id)
            if (type(data3) is not list or not data3):
                data = [[data], [data2]]
            else:
                data = [[data], [data2], [data3]]
            return render_template('supply_list.html', data=data)
        elif (request.form['submit_button'] == 'Homepage'):
            return redirect(url_for('home_page'))
    else:
        return redirect(url_for('home_page', error='You are not Authorized'))
示例#5
0
#hits = np.array([1,3,5,7])
#hits = np.array([0,1,2,3,4,5,6,7])
#hits = np.array([])
#hits = np.array([2, 0, 6, 4, 3, 5, 1])

print(hits)

rhythm = []
for i in range(beats * sub):
    if i in hits:
        rhythm.append('1')
    else:
        rhythm.append('0')
print(rhythm)

rhythm = func.group(rhythm)
print(rhythm)

#Generate xml

out = ''

out += '''<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 3.1 Partwise//EN" "http://www.musicxml.org/dtds/partwise.dtd">
<score-partwise version="3.1">
  <identification>
    <encoding>
      <software>MuseScore 3.2.3</software>
      <encoding-date>2019-07-28</encoding-date>
      <supports element="accidental" type="yes"/>
      <supports element="beam" type="yes"/>