diff --git a/.gitignore b/.gitignore index cd420b7..3eab82b 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,7 @@ instance venv/ -__pychache__/ +__pychache__/* 123 @@ -12,3 +12,6 @@ project.db c*.txt + +migrations/__pycache__/* +migrations/versions/__pycache__/* \ No newline at end of file diff --git a/app.py b/app.py index 75793c3..e51a222 100644 --- a/app.py +++ b/app.py @@ -114,20 +114,26 @@ def addoborudtodb(): @app.route('/all') def alloborud(): + return render_template('all.html') - result = db.session.query(Oboruds).order_by(Oboruds.invNumber).all() - res = [] +@app.route('/getall') +def getall(): + oboruds = Oboruds.query.all() + oboruds_json = [{ + 'id': oborud.id, + 'invNumber': oborud.invNumber, + 'nazvanie': oborud.nazvanie, + 'raspologenie': oborud.raspologenie, + 'numberved': oborud.numberved, + 'balancenumber': oborud.balancenumber, + 'kolichestvo': oborud.kolichestvo, + 'balancenumber': oborud.balancenumber, + 'aud_id': oborud.aud_id + } for oborud in oboruds] - for ob in result: - if ob.aud_id is not None: - aud = db.session.query(Auditory).filter_by(id=ob.aud_id).first() - res.append([ob.invNumber, ob.nazvanie, aud.audnazvanie]) - else: - res.append([ob.invNumber, ob.nazvanie]) - - return render_template('all.html', res=res) + return jsonify(oboruds_json) @app.route('/updateduplicate', methods=['GET', 'POST']) def updateduplicate(): diff --git a/migrations/__pycache__/env.cpython-312.pyc b/migrations/__pycache__/env.cpython-312.pyc deleted file mode 100644 index d40e79f..0000000 Binary files a/migrations/__pycache__/env.cpython-312.pyc and /dev/null differ diff --git a/migrations/versions/885bdd7b5161_.py b/migrations/versions/885bdd7b5161_.py new file mode 100644 index 0000000..c1ac071 --- /dev/null +++ b/migrations/versions/885bdd7b5161_.py @@ -0,0 +1,32 @@ +"""empty message + +Revision ID: 885bdd7b5161 +Revises: be7c94c549e5 +Create Date: 2024-04-02 23:03:59.401369 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '885bdd7b5161' +down_revision = 'be7c94c549e5' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('oboruds', schema=None) as batch_op: + batch_op.add_column(sa.Column('kolichestvo', sa.Integer(), nullable=True)) + + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('oboruds', schema=None) as batch_op: + batch_op.drop_column('kolichestvo') + + # ### end Alembic commands ### diff --git a/migrations/versions/__pycache__/256c3a3e91a2_.cpython-39.pyc b/migrations/versions/__pycache__/256c3a3e91a2_.cpython-39.pyc deleted file mode 100644 index dd2185c..0000000 Binary files a/migrations/versions/__pycache__/256c3a3e91a2_.cpython-39.pyc and /dev/null differ diff --git a/migrations/versions/__pycache__/4f95d12a8352_.cpython-39.pyc b/migrations/versions/__pycache__/4f95d12a8352_.cpython-39.pyc deleted file mode 100644 index a0cc0e0..0000000 Binary files a/migrations/versions/__pycache__/4f95d12a8352_.cpython-39.pyc and /dev/null differ diff --git a/migrations/versions/__pycache__/50f85881169e_.cpython-39.pyc b/migrations/versions/__pycache__/50f85881169e_.cpython-39.pyc deleted file mode 100644 index 413660a..0000000 Binary files a/migrations/versions/__pycache__/50f85881169e_.cpython-39.pyc and /dev/null differ diff --git a/migrations/versions/__pycache__/873defe09f22_.cpython-39.pyc b/migrations/versions/__pycache__/873defe09f22_.cpython-39.pyc deleted file mode 100644 index 1eeb670..0000000 Binary files a/migrations/versions/__pycache__/873defe09f22_.cpython-39.pyc and /dev/null differ diff --git a/migrations/versions/__pycache__/885bdd7b5161_.cpython-312.pyc b/migrations/versions/__pycache__/885bdd7b5161_.cpython-312.pyc new file mode 100644 index 0000000..74241f9 Binary files /dev/null and b/migrations/versions/__pycache__/885bdd7b5161_.cpython-312.pyc differ diff --git a/migrations/versions/__pycache__/b24baa0d98e6_.cpython-39.pyc b/migrations/versions/__pycache__/b24baa0d98e6_.cpython-39.pyc deleted file mode 100644 index 3081f0b..0000000 Binary files a/migrations/versions/__pycache__/b24baa0d98e6_.cpython-39.pyc and /dev/null differ diff --git a/migrations/versions/__pycache__/b2a61aef79e9_.cpython-39.pyc b/migrations/versions/__pycache__/b2a61aef79e9_.cpython-39.pyc deleted file mode 100644 index bc82748..0000000 Binary files a/migrations/versions/__pycache__/b2a61aef79e9_.cpython-39.pyc and /dev/null differ diff --git a/migrations/versions/__pycache__/ec6bbcd361bd_.cpython-39.pyc b/migrations/versions/__pycache__/ec6bbcd361bd_.cpython-39.pyc deleted file mode 100644 index 8d1bb28..0000000 Binary files a/migrations/versions/__pycache__/ec6bbcd361bd_.cpython-39.pyc and /dev/null differ diff --git a/models.py b/models.py index df3623a..26fa7d0 100644 --- a/models.py +++ b/models.py @@ -18,13 +18,21 @@ class Oboruds(db.Model): nazvanie=db.Column(db.String(500)) raspologenie = db.Column(db.String(200)) numberved = db.Column(db.String(100)) +<<<<<<< HEAD buhnumberpp = db.Column(db.String(100)) kolichestvo = db.Column(db.Integer) balancenumber = db.Column(db.String(30)) +======= + numberppasu = db.Column(db.String(100)) + kolichestvo = db.Column(db.Integer) + +>>>>>>> dev aud_id = db.Column(db.Integer, db.ForeignKey(Auditory.id)) + + class Zametki(db.Model): id = db.Column(db.Integer, primary_key=True, autoincrement=True) txtzam=db.Column(db.String(10000)) diff --git a/static/css/index.css b/static/css/index.css index 6bc3fb1..72385ec 100644 --- a/static/css/index.css +++ b/static/css/index.css @@ -100,6 +100,15 @@ nav{ margin-left: 20px; } +.datatable{ + background-color: whitesmoke; +} + + + + + + @media print { *{ diff --git a/static/js/allmatc.js b/static/js/allmatc.js new file mode 100644 index 0000000..c9e2668 --- /dev/null +++ b/static/js/allmatc.js @@ -0,0 +1,35 @@ +function getAllData(){ + $.ajax({ + + url: "/getall", + type: "get", + contentType: 'application/json', + dataType: 'json', + + success: function(response){ + console.log(response) + let data = response; + $('#datatable tbody').empty(); + $.each(response, function(index, item) { + $('#datatable tbody').append( + '' + + '' + item.invNumber + '' + + '' + item.nazvanie + '' + + '' + item.raspologenie + '' + + '' + item.numberved + '' + + '' + item.buhnumberpp + '' + + '' + item.kolichestvo + '' + + '' + item.balancenumber + '' + + '' + ); + }) + }, + + + }) +} + +$(document).ready(function(){ + + getAllData() +}) \ No newline at end of file diff --git a/static/js/allmatcen.js b/static/js/allmatcen.js new file mode 100644 index 0000000..0d39b48 --- /dev/null +++ b/static/js/allmatcen.js @@ -0,0 +1,35 @@ +function getData(){ + + const audid = document.getElementById('auditory') + $.ajax({ + + url: "/getall", + type: "get", + contentType: 'application/json', + dataType: 'json', + + success: function(response){ + + var data = response; + const table = document.getElementById('datatable') + table.innerHTML = '' + var headTable = ' Номер в Инв. вед Инв. номерНазваниеАудитория Расположение Проверено ' + table.innerHTML += headTable + var tr ="" + + + data.forEach(element => { + tr += '' + tr += '' + element.num_ved + '' + tr += '' + element.inv_number + '' + tr += '' + element.oboruds_id + '' + tr += '' + element.auditory_name + '' + tr += '' +element.raspolog + '' + tr += '' + '\n' + '' + + tr += '' + }); + table.innerHTML += tr + } + }) +} \ No newline at end of file diff --git a/templates/all.html b/templates/all.html index 97281a9..591890a 100644 --- a/templates/all.html +++ b/templates/all.html @@ -3,38 +3,34 @@ {% block content %} +
+
+

Все мат. ценности

+ +
+
+ +
+ +
-
-
- -
-

Все мат. ценности

- - - - - - - - - - - {% for item in res: %} - - - - - - - - {% endfor %} - -
Инв. номерНазваниеАудитория
{{ item[0] }} {{ item[1] }} - {{ item[2] }} -
-
-
+
+ + + + + + + + + + + + +
№ п/п№ п/п ведИнв. номерНазваниеКол-воСчётАудитория
+
+ {% endblock %} \ No newline at end of file diff --git a/templates/js.html b/templates/js.html index a9092d2..f8d9f27 100644 --- a/templates/js.html +++ b/templates/js.html @@ -9,4 +9,4 @@ - \ No newline at end of file +