all done
This commit is contained in:
68
app.py
68
app.py
@@ -119,23 +119,32 @@ def alloborud():
|
|||||||
|
|
||||||
@app.route('/getall')
|
@app.route('/getall')
|
||||||
def getall():
|
def getall():
|
||||||
oborud = db.session.query(Auditory, Oboruds).filter(
|
oborud = db.session.query(Oboruds).order_by(Oboruds.invNumber).all()
|
||||||
Oboruds.aud_id==Auditory.id
|
|
||||||
).order_by(Oboruds.invNumber).all()
|
|
||||||
|
|
||||||
results = []
|
results = []
|
||||||
for auditory, oboruds in oborud :
|
for oboruds in oborud :
|
||||||
results.append({
|
if oboruds.aud_id is None:
|
||||||
'invNumber': oboruds.invNumber,
|
results.append({
|
||||||
'nazvanie': oboruds.nazvanie,
|
'invNumber': oboruds.invNumber,
|
||||||
'raspologenie': oboruds.raspologenie,
|
'nazvanie': oboruds.nazvanie,
|
||||||
'balancenumber': oboruds.balancenumber,
|
'raspologenie': oboruds.raspologenie,
|
||||||
'kolichestvo': oboruds.kolichestvo,
|
'balancenumber': oboruds.balancenumber,
|
||||||
'numberppasu': oboruds.numberppasu,
|
'kolichestvo': oboruds.kolichestvo,
|
||||||
'numberved': oboruds.numberved,
|
'numberppasu': oboruds.numberppasu,
|
||||||
'aud': auditory.audnazvanie
|
'numberved': oboruds.numberved,
|
||||||
|
'aud': "" })
|
||||||
})
|
else:
|
||||||
|
aud = db.session.query(Auditory).filter_by(id=oboruds.aud_id).first()
|
||||||
|
results.append({
|
||||||
|
'invNumber': oboruds.invNumber,
|
||||||
|
'nazvanie': oboruds.nazvanie,
|
||||||
|
'raspologenie': oboruds.raspologenie,
|
||||||
|
'balancenumber': oboruds.balancenumber,
|
||||||
|
'kolichestvo': oboruds.kolichestvo,
|
||||||
|
'numberppasu': oboruds.numberppasu,
|
||||||
|
'numberved': oboruds.numberved,
|
||||||
|
'aud': aud.audnazvanie })
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return jsonify(results)
|
return jsonify(results)
|
||||||
@@ -196,7 +205,7 @@ def addraspved():
|
|||||||
query_string = request.data.decode()
|
query_string = request.data.decode()
|
||||||
|
|
||||||
un_query_string = unquote(unquote(query_string)).split(',')
|
un_query_string = unquote(unquote(query_string)).split(',')
|
||||||
|
|
||||||
|
|
||||||
ob = db.session.query(Oboruds).filter_by(invNumber=un_query_string[0]).first()
|
ob = db.session.query(Oboruds).filter_by(invNumber=un_query_string[0]).first()
|
||||||
|
|
||||||
@@ -211,7 +220,32 @@ def addraspved():
|
|||||||
|
|
||||||
|
|
||||||
return jsonify({'success': True}, 200, {'ContentType': 'application/json'})
|
return jsonify({'success': True}, 200, {'ContentType': 'application/json'})
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/addoborudasu', methods=['GET', 'POST'])
|
||||||
|
def addoborud():
|
||||||
|
if request.method == 'POST':
|
||||||
|
|
||||||
|
query_string = request.data.decode()
|
||||||
|
|
||||||
|
un_query_string = unquote(unquote(query_string)).split(',')
|
||||||
|
print(un_query_string)
|
||||||
|
|
||||||
|
|
||||||
|
db.session.add(
|
||||||
|
Oboruds(invNumber=un_query_string[0],
|
||||||
|
nazvanie=un_query_string[5],
|
||||||
|
raspologenie= un_query_string[4],
|
||||||
|
numberved=un_query_string[1],
|
||||||
|
kolichestvo=un_query_string[2],
|
||||||
|
balancenumber=un_query_string[3]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
db.session.commit()
|
||||||
|
|
||||||
|
|
||||||
|
return jsonify({'success': True}, 200, {'ContentType': 'application/json'})
|
||||||
|
|
||||||
# ==================================================================================
|
# ==================================================================================
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,18 @@
|
|||||||
|
function clearTable() {
|
||||||
|
var table = document.getElementById("alldatatable");
|
||||||
|
var rowCount = table.rows.length;
|
||||||
|
|
||||||
|
// Iterate through each row and remove it
|
||||||
|
for (var i = rowCount - 1; i > 0; i--) {
|
||||||
|
table.deleteRow(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function getAllData(){
|
function getAllData(){
|
||||||
|
console.log('12321321')
|
||||||
|
///clearTable();
|
||||||
|
|
||||||
let tableBody = document.getElementById('alldatatable').getElementsByTagName("tbody")[0];
|
let tableBody = document.getElementById('alldatatable').getElementsByTagName("tbody")[0];
|
||||||
i = 0;
|
i = 0;
|
||||||
$.getJSON("/getall", function(data) {
|
$.getJSON("/getall", function(data) {
|
||||||
@@ -82,7 +95,7 @@ $( document ).ready(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$('#modalclose').click(function(){
|
$('#modalclose').click(function(){
|
||||||
|
|
||||||
|
|
||||||
let vednumber = document.getElementById('modal_vednumber')
|
let vednumber = document.getElementById('modal_vednumber')
|
||||||
@@ -112,6 +125,7 @@ $('#modalsavetodb').click(function(){
|
|||||||
let balancenumber = document.getElementById('modal_balance')
|
let balancenumber = document.getElementById('modal_balance')
|
||||||
let matcen = document.getElementById('modal_matcenn')
|
let matcen = document.getElementById('modal_matcenn')
|
||||||
let rasp = document.getElementById('modal_rapolog')
|
let rasp = document.getElementById('modal_rapolog')
|
||||||
|
let nazv = document.getElementById('modal_nazvanie')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -124,6 +138,7 @@ $('#modalsavetodb').click(function(){
|
|||||||
changeddata[3] = balancenumber.value;
|
changeddata[3] = balancenumber.value;
|
||||||
changeddata[4] = rasp.value;
|
changeddata[4] = rasp.value;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let sendData = changeddata.join(',')
|
let sendData = changeddata.join(',')
|
||||||
console.log(sendData)
|
console.log(sendData)
|
||||||
@@ -138,19 +153,103 @@ $('#modalsavetodb').click(function(){
|
|||||||
|
|
||||||
success: function(){
|
success: function(){
|
||||||
$('#getmodal').modal('hide')
|
$('#getmodal').modal('hide')
|
||||||
|
|
||||||
getAllData()
|
getAllData();
|
||||||
|
|
||||||
vednumber.value = '';
|
vednumber.value = '';
|
||||||
kolvo.value = '';
|
kolvo.value = '';
|
||||||
balancenumber.value = '';
|
balancenumber.value = '';
|
||||||
matcen.value = '';
|
matcen.value = '';
|
||||||
rasp.value = '';
|
rasp.value = '';
|
||||||
changeddata = []
|
changeddata = [];
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
$('#addoborud').click(function(){
|
||||||
|
|
||||||
|
$('#addmodal').modal('show');
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
$('#modal2savetodb').click(function(){
|
||||||
|
|
||||||
|
let invnom = document.getElementById('modal2_invnom')
|
||||||
|
let vednumber = document.getElementById('modal2_vednumber')
|
||||||
|
let kolvo = document.getElementById('modal2_kolvo')
|
||||||
|
let balancenumber = document.getElementById('modal2_balance')
|
||||||
|
let matcen = document.getElementById('modal2_matcenn')
|
||||||
|
let rasp = document.getElementById('modal2_rapolog')
|
||||||
|
let nazv = document.getElementById('modal2_nazvanie')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
let changeddata = new Array()
|
||||||
|
|
||||||
|
changeddata[0] = invnom.value;
|
||||||
|
changeddata[1] = vednumber.value;
|
||||||
|
changeddata[2] = kolvo.value;
|
||||||
|
changeddata[3] = balancenumber.value;
|
||||||
|
changeddata[4] = rasp.value;
|
||||||
|
changeddata[5] = nazv.value;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
let sendData = changeddata.join(',')
|
||||||
|
console.log(sendData)
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
|
||||||
|
url: "/addoborudasu",
|
||||||
|
type: "POST",
|
||||||
|
contentType: "application/json;charset=utf-8",
|
||||||
|
dataType: "json",
|
||||||
|
data: sendData,
|
||||||
|
|
||||||
|
success: function(){
|
||||||
|
vednumber.value = '';
|
||||||
|
invnom.value= '';
|
||||||
|
nazvanie.value='';
|
||||||
|
kolvo.value = '';
|
||||||
|
balancenumber.value = '';
|
||||||
|
matcen.value = '';
|
||||||
|
rasp.value = '';
|
||||||
|
$('#addmodal').modal('hide')
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
$('#modal2close').click(function(){
|
||||||
|
|
||||||
|
|
||||||
|
let vednumber = document.getElementById('modal2_vednumber')
|
||||||
|
let invnomer = document.getElementById('modal2_invnom')
|
||||||
|
let nazvanie = document.getElementById('modal2_nazvanie')
|
||||||
|
let kolvo = document.getElementById('modal2_kolvo')
|
||||||
|
let balancenumber = document.getElementById('modal2_balance')
|
||||||
|
let matcen = document.getElementById('modal2_matcenn')
|
||||||
|
let rasp = document.getElementById('modal2_rapolog')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
vednumber.value = '';
|
||||||
|
invnomer.value= '';
|
||||||
|
nazvanie.value='';
|
||||||
|
kolvo.value = '';
|
||||||
|
balancenumber.value = '';
|
||||||
|
matcen.value = '';
|
||||||
|
rasp.value = '';
|
||||||
|
|
||||||
|
$('#addmodal').modal('hide')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} )
|
||||||
@@ -44,15 +44,78 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Modal2 -->
|
||||||
|
<div class="modal fade" id="addmodal" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-body" id="textarea">
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<a id="modal_invnom"> </a><a id="modal2_matcenn"></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
№ из ведомости
|
||||||
|
<input type="text" class="form-control" id ='modal2_vednumber' placeholder="Номер из ведомости">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
Инвентарный номер
|
||||||
|
<input type="text" class="form-control" id ='modal2_invnom' placeholder="Инвентарный номер">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
Название
|
||||||
|
<input type="text" class="form-control" id ='modal2_nazvanie' placeholder="Название">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
Количество
|
||||||
|
<input type="text" class="form-control" id ='modal2_kolvo' placeholder="Количество">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
Балансовый счёт
|
||||||
|
<input type="text" class="form-control" id ='modal2_balance' placeholder="Балансовый счёт">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
Расположение
|
||||||
|
<input type="text" class="form-control" id ='modal2_rapolog' placeholder="Введите расположение">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="modal2close">Закрыть</button>
|
||||||
|
<button type="button" class="btn btn-primary" id="modal2savetodb" >Сохранить изменения</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="row col-12">
|
<div class="row col-12">
|
||||||
<div class=" card col-11">
|
<div class=" card col-11">
|
||||||
<h3 id ='123' class=" no-print"> Все мат. ценности </h3>
|
<h3 id ='123' class=" no-print"> Все мат. ценности </h3>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="row col-12">
|
</div>
|
||||||
<button class="button" id="printallbutton"> Печать </button>
|
|
||||||
</div>
|
<div class="row col-12">
|
||||||
|
<button class="button" id="printallbutton"> Печать </button>
|
||||||
|
</div>
|
||||||
|
<div class="row col-12">
|
||||||
|
<button class="button" id="addoborud"> Добавить </button>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -72,13 +135,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tr>
|
<tr>
|
||||||
<td>1</td>
|
|
||||||
<td>2</td>
|
|
||||||
<td>3</td>
|
|
||||||
<td>4</td>
|
|
||||||
<td>5</td>
|
|
||||||
<td>6</td>
|
|
||||||
<td>7</td>
|
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
Reference in New Issue
Block a user