From 3a3e62a37580e601edd118d6638c9aec557d7b51 Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 1 Apr 2024 22:43:02 +0300 Subject: [PATCH 1/4] 111 --- models.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/models.py b/models.py index 24c2840..26c783c 100644 --- a/models.py +++ b/models.py @@ -23,6 +23,8 @@ class Oboruds(db.Model): + + class Zametki(db.Model): id = db.Column(db.Integer, primary_key=True, autoincrement=True) txtzam=db.Column(db.String(10000)) From 34ea9725603396b04a9bef572b26e7d369a27a07 Mon Sep 17 00:00:00 2001 From: Alex Danamir Date: Tue, 2 Apr 2024 22:50:36 +0300 Subject: [PATCH 2/4] add new fictures --- .gitignore | 2 ++ app.py | 26 +++++++++++++-------- static/css/index.css | 9 ++++++++ static/js/allmatc.js | 35 ++++++++++++++++++++++++++++ templates/all.html | 55 ++++++++++++++++++++------------------------ templates/js.html | 3 ++- 6 files changed, 89 insertions(+), 41 deletions(-) create mode 100644 static/js/allmatc.js diff --git a/.gitignore b/.gitignore index cd420b7..d42868d 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,5 @@ project.db c*.txt +__pycache__/app.cpython-312.pyc +__pycache__/models.cpython-312.pyc diff --git a/app.py b/app.py index 75793c3..4571ff5 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, + 'buhnumberpp': oborud.buhnumberpp, + '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/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/templates/all.html b/templates/all.html index 97281a9..05ac334 100644 --- a/templates/all.html +++ b/templates/all.html @@ -3,37 +3,32 @@ {% block content %} +
+
+

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

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

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

- - - - - - - - - - - {% for item in res: %} - - - - - - - - {% endfor %} - -
Инв. номерНазваниеАудитория
{{ item[0] }} {{ item[1] }} - {{ item[2] }} -
-
-
+
+ + + + + + + + + + + + +
№ п/п№ п/п ведИнв. номерНазваниеКол-воСчётАудитория
+
diff --git a/templates/js.html b/templates/js.html index a9092d2..672e2f6 100644 --- a/templates/js.html +++ b/templates/js.html @@ -9,4 +9,5 @@ - \ No newline at end of file + + \ No newline at end of file From f1c755c6ec4f447766353734bc5ae7519dee4c83 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 2 Apr 2024 22:59:04 +0300 Subject: [PATCH 3/4] 123 --- migrations/__pycache__/env.cpython-312.pyc | Bin 4531 -> 4531 bytes .../__pycache__/256c3a3e91a2_.cpython-312.pyc | Bin 1319 -> 1319 bytes .../__pycache__/4f95d12a8352_.cpython-312.pyc | Bin 1317 -> 1317 bytes .../__pycache__/50f85881169e_.cpython-312.pyc | Bin 687 -> 687 bytes .../__pycache__/873defe09f22_.cpython-312.pyc | Bin 1324 -> 1324 bytes .../__pycache__/8e838956713f_.cpython-312.pyc | Bin 1321 -> 1321 bytes .../__pycache__/b24baa0d98e6_.cpython-312.pyc | Bin 717 -> 717 bytes .../__pycache__/b2a61aef79e9_.cpython-312.pyc | Bin 687 -> 687 bytes .../__pycache__/be7c94c549e5_.cpython-312.pyc | Bin 1579 -> 1579 bytes .../__pycache__/ec6bbcd361bd_.cpython-312.pyc | Bin 2058 -> 2058 bytes 10 files changed, 0 insertions(+), 0 deletions(-) diff --git a/migrations/__pycache__/env.cpython-312.pyc b/migrations/__pycache__/env.cpython-312.pyc index d40e79f400bb16ed92d574bacba9859fc929731d..a104e78ffe25b27c534ddc5db40d1bfc95d24f79 100644 GIT binary patch delta 34 ocmdn2yjhv&G%qg~0}!;@a;0tL`M|{JJozt^IAhjkQRaDk0HIk4SO5S3 delta 34 ocmdn2yjhv&G%qg~0}wb?|4iM;^MQ%cW%6GpamMt`qRjL70J1^~J^%m! diff --git a/migrations/versions/__pycache__/256c3a3e91a2_.cpython-312.pyc b/migrations/versions/__pycache__/256c3a3e91a2_.cpython-312.pyc index 77081c020d0561fcf0bae39f174e7f1634cd7da5..18d473e1fed18d96004f4f585f27582d26036d8f 100644 GIT binary patch delta 51 zcmZ3^wVaFRG%qg~0}!;@a;0tLxy>l)Y!wqwl%HOdn46oKmmU*PS(1^T2NcQL#H7v) E0DBJ)^#A|> delta 51 zcmZ3^wVaFRG%qg~0}wb?|4iM;bDL4p#VRJCC_lX@F*i3eFFhupvLquv4FKkvD;f(PeTTlQ?7g<~F9qOaQ9&3A6wJ diff --git a/migrations/versions/__pycache__/b24baa0d98e6_.cpython-312.pyc b/migrations/versions/__pycache__/b24baa0d98e6_.cpython-312.pyc index 69a74a07e7bccc54efa3b14042dc9461a8150d5f..1306f5587c6510426acad2285fdb589000eecdfa 100644 GIT binary patch delta 52 zcmX@hdX|;vG%qg~0}!;@a;0tLF=v!?wu%WT%1 Date: Tue, 2 Apr 2024 23:04:45 +0300 Subject: [PATCH 4/4] add to model --- app.py | 2 +- migrations/versions/885bdd7b5161_.py | 32 ++++++++++++++++ .../__pycache__/885bdd7b5161_.cpython-312.pyc | Bin 0 -> 1301 bytes models.py | 1 + static/js/allmatcen.js | 35 ++++++++++++++++++ 5 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 migrations/versions/885bdd7b5161_.py create mode 100644 migrations/versions/__pycache__/885bdd7b5161_.cpython-312.pyc create mode 100644 static/js/allmatcen.js diff --git a/app.py b/app.py index 4571ff5..e51a222 100644 --- a/app.py +++ b/app.py @@ -126,7 +126,7 @@ def getall(): 'nazvanie': oborud.nazvanie, 'raspologenie': oborud.raspologenie, 'numberved': oborud.numberved, - 'buhnumberpp': oborud.buhnumberpp, + 'balancenumber': oborud.balancenumber, 'kolichestvo': oborud.kolichestvo, 'balancenumber': oborud.balancenumber, 'aud_id': oborud.aud_id 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__/885bdd7b5161_.cpython-312.pyc b/migrations/versions/__pycache__/885bdd7b5161_.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a89cef4af541ea0e579efe931c78a6fa72bbc2f2 GIT binary patch literal 1301 zcmb_c&1)M+6ra&byQ`HH?8M+uIb}n05mk(BS^f~AklGht9LLVZi^8(nnb>mnL!DXK zRY-~t{U72&A-M(zn&3iv&8<)f7z{R(V{*yOjtK#u`ewBvO6VzMcK5e$-h1=*ef-#e z3k3tg`h(=}OeqMxmYd#6CBo?p2oDiK79yCWJnW~e6qd5$DOQ@KtqjRnDp4#A9-XMa zA}dQYK%=9S^n2^nZ$%x`r<^-$)G(ImW|KF=z+9NGnKLuh1|idp>iE=n*Ft&CY|v?U zcG9g*&eEze$EXuga~_~(PK-@VULAvb!knno#wxYy?C9j!cx7tVFy6|9OIW1B)}qMw zM;7`1h;C9?{L%rTa&-C<;30}|tOeNU)!$RV8)`;RQ@e?!iXNc*Xd~0-kcg4i({0H3 zpDm*F+2j6y>ad$^N&0DKSLOz5H^~e79$&p2FzTT1&^Y3F3udy4FkBtQ+qHB~vc)fcnY;l>Yd3Iy2R$pS_8gqQV8LZWpI?;L#dhz!kA1(a0@Yw%z`7i6awO9XV{$S+hfxi4f zk&Yi?_mddUcn(7D)UFqm7sbr=E7~ViQNb2dBS_6N=iID zmIqnn2n$=uyx1UUx-((2Ya&a+t)Sbd^X{DUdY@39xZ41rusNZP1T~ZnRC(rRD13T;-oDe!o{sW>Q6S6;U z8_WrSf51uVabXbJq59zz{%TaNBsNDtHB-4k) { + 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