all done
This commit is contained in:
62
app.py
62
app.py
@@ -119,23 +119,32 @@ def alloborud():
|
||||
|
||||
@app.route('/getall')
|
||||
def getall():
|
||||
oborud = db.session.query(Auditory, Oboruds).filter(
|
||||
Oboruds.aud_id==Auditory.id
|
||||
).order_by(Oboruds.invNumber).all()
|
||||
oborud = db.session.query(Oboruds).order_by(Oboruds.invNumber).all()
|
||||
|
||||
results = []
|
||||
for auditory, oboruds in oborud :
|
||||
results.append({
|
||||
'invNumber': oboruds.invNumber,
|
||||
'nazvanie': oboruds.nazvanie,
|
||||
'raspologenie': oboruds.raspologenie,
|
||||
'balancenumber': oboruds.balancenumber,
|
||||
'kolichestvo': oboruds.kolichestvo,
|
||||
'numberppasu': oboruds.numberppasu,
|
||||
'numberved': oboruds.numberved,
|
||||
'aud': auditory.audnazvanie
|
||||
for oboruds in oborud :
|
||||
if oboruds.aud_id is None:
|
||||
results.append({
|
||||
'invNumber': oboruds.invNumber,
|
||||
'nazvanie': oboruds.nazvanie,
|
||||
'raspologenie': oboruds.raspologenie,
|
||||
'balancenumber': oboruds.balancenumber,
|
||||
'kolichestvo': oboruds.kolichestvo,
|
||||
'numberppasu': oboruds.numberppasu,
|
||||
'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)
|
||||
@@ -213,6 +222,31 @@ def addraspved():
|
||||
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(){
|
||||
console.log('12321321')
|
||||
///clearTable();
|
||||
|
||||
let tableBody = document.getElementById('alldatatable').getElementsByTagName("tbody")[0];
|
||||
i = 0;
|
||||
$.getJSON("/getall", function(data) {
|
||||
@@ -82,7 +95,7 @@ $( document ).ready(function() {
|
||||
});
|
||||
|
||||
|
||||
$('#modalclose').click(function(){
|
||||
$('#modalclose').click(function(){
|
||||
|
||||
|
||||
let vednumber = document.getElementById('modal_vednumber')
|
||||
@@ -112,6 +125,7 @@ $('#modalsavetodb').click(function(){
|
||||
let balancenumber = document.getElementById('modal_balance')
|
||||
let matcen = document.getElementById('modal_matcenn')
|
||||
let rasp = document.getElementById('modal_rapolog')
|
||||
let nazv = document.getElementById('modal_nazvanie')
|
||||
|
||||
|
||||
|
||||
@@ -125,6 +139,7 @@ $('#modalsavetodb').click(function(){
|
||||
changeddata[4] = rasp.value;
|
||||
|
||||
|
||||
|
||||
let sendData = changeddata.join(',')
|
||||
console.log(sendData)
|
||||
|
||||
@@ -139,18 +154,102 @@ $('#modalsavetodb').click(function(){
|
||||
success: function(){
|
||||
$('#getmodal').modal('hide')
|
||||
|
||||
getAllData()
|
||||
|
||||
getAllData();
|
||||
vednumber.value = '';
|
||||
kolvo.value = '';
|
||||
balancenumber.value = '';
|
||||
matcen.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')
|
||||
|
||||
|
||||
|
||||
} )
|
||||
@@ -45,14 +45,77 @@
|
||||
</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=" card col-11">
|
||||
<h3 id ='123' class=" no-print"> Все мат. ценности </h3>
|
||||
|
||||
</div>
|
||||
<div class="row col-12">
|
||||
<button class="button" id="printallbutton"> Печать </button>
|
||||
</div>
|
||||
</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 class="row">
|
||||
@@ -72,13 +135,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tr>
|
||||
<td>1</td>
|
||||
<td>2</td>
|
||||
<td>3</td>
|
||||
<td>4</td>
|
||||
<td>5</td>
|
||||
<td>6</td>
|
||||
<td>7</td>
|
||||
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user