Created
November 27, 2019 13:18
-
-
Save rick-77-2006/861028ee5c6388ae16953f08f3e7733e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
session_start(); | |
// $a = "Сессия пришла из index_avto.php"; | |
// регистрируем переменную с открытой сессией | |
// важно: названия переменных | |
// передаются функции session_register() | |
// без знака $ | |
// session_register("a"); | |
?> | |
<?php | |
// Include ("to_new_year.php"); | |
include ("Menu.php"); | |
include ("Shapka.php"); | |
?> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Путевой лист Авто + AJAX</title> | |
<!-- <link rel="stylesheet" href="/scripts/bootstrap.min.css"> --> | |
<script src="/scripts/jquery.min.js"></script> | |
<script src="/scripts/scripts.js"></script> | |
</head> | |
<body> | |
<div style="margin: auto;width: 60%;"> | |
<div class="alert alert-success alert-dismissible" id="success" style="display:none;"> | |
<!-- <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a> --> | |
</div> | |
<form id="InputForm" name="form1" method="post"> | |
<div class="form-group"> | |
<label>Дата выезда:</label> | |
<input type="datetime-local" class="form-control" id="data_doc" placeholder="Дата/выезд ТС" name="data_doc" required> | |
<label><b>Номер документа:</b></label> | |
<output id="counter" name="counter"> 000001 </output> | |
</div> | |
<!-- ========================================== выпадающее меню с ТС начало --> | |
<?php | |
require_once ('List_Nazva_TC.php'); | |
?> | |
<!-- ========================================== выпадающее меню с ТС конец --> | |
<!-- ========================================== выпадающее меню с Район начало --> | |
<?php | |
require_once ('rayon.php'); | |
?> | |
<!-- ========================================== выпадающее меню сРайон конец --> | |
<fieldset> <legend><b> Данные по горючему </b> </legend> | |
<div class="form-group"> | |
<label>Остаток горючего:</label> | |
<input type="number" class="form-control" id="ostatok_topliva_nd" placeholder="Остаток горючего на начало дня" name="ostatok_topliva_nd" min = 0 oninput="validity.valid||(value='');" required> | |
</div> | |
<div class="form-group"> | |
<label>Остаток горючего ВСЕГО:</label> | |
<input type="number" class="form-control" id="vsego_liters" placeholder="Остаток горючего ВСЕГО" name="vsego_liters" min = 0 oninput="validity.valid||(value='');" required> | |
</div> | |
<div class="form-group"> | |
<label>Горючее по талону <br> к выдаче:</label> | |
<input type="number" class="form-control" id="liters" placeholder="Выдано горючего" name="liters" min = 0 oninput="validity.valid||(value='');" required> | |
</div> | |
<!-- ========================================== выпадающее меню с темпер. конец --> | |
<?php | |
require_once('temperatura.php'); | |
?> | |
<!-- ========================================== выпадающее меню с темпер. конец --> | |
</fieldset> | |
<?php | |
require_once('Voditel.php'); | |
?> | |
<fieldset> <legend><b> Данные Спидометра </b> </legend> | |
<div class="form-group"> | |
<label>Спидометр выезд:</label> | |
<input type="number" class="form-control" id="speedometr_vyezd" placeholder="Показания спидометра при выезде" name="speedometr_vyezd" min = 0 oninput="validity.valid||(value='');" required> | |
</div> | |
<div class="form-group" > | |
<label>Спидометр возврат:</label> | |
<input type="number" class="form-control" id="speedometr_vozvrat" placeholder="Показания спидометра при возвращении" name="speedometr_vozvrat" min = 0 oninput="validity.valid||(value='');" required> | |
</div> | |
<div class="form-group" > | |
<label>Пробег:</label> | |
<input type="number" class="form-control" readonly id="probeg" placeholder="Пробег" name="probeg" style="background: yellow" min = "0" value = "0" size = "9"> Км. | |
</div> | |
</fieldset> | |
<b> | |
<span>Задание:</span> | |
<br> | |
<textarea id="zadanie" name="zadanie" style="width:50%; height:50px;"v-model="zadanie" placeholder="введите задание"></textarea> | |
<br> | |
<span>Вид работ:</span> | |
<br> | |
<textarea id="vid_rabot" name="vid_rabot" style="width:50%; height:50px;" v-model="vid_rabot" placeholder="введите вид работ"></textarea> | |
<br> | |
<span>Данные чека:</span> | |
<br> | |
<textarea id="check" name="check" style="width:50%; height:50px;" v-model="check" placeholder="введите данные чека"></textarea> | |
</br> | |
<table border="0"> | |
<tr> | |
<td height="0" width="800"></td> | |
</tr> | |
</table> | |
<hr> | |
</b> | |
<!-- Запрет ввода отрицательнго числа min = 0 oninput="validity.valid||(value='');" --> | |
<input type="button" name="insert" class="btn btn-primary" value="ЗАПИСАТЬ" id="butsave"> | |
</form> | |
</div> | |
<!-- Проверка на отрицательное число НАЧАЛО--> | |
<script> | |
function proverka(){ | |
return $('#probeg').val() < 0; | |
} | |
</script> | |
<!-- Проверка на отрицательное число КОНЕЦ--> | |
<!-- Расчёт пробега по спидометру НАЧАЛО--> | |
<script type="text/javascript"> | |
var input = document.getElementsByTagName('input'), array = ['load', 'keyup'], i = array.length; | |
while(i--) | |
{ | |
window['on'+array[i]] = function() | |
{ | |
function $(i) | |
{ | |
return ~~input[i].value; | |
} | |
var res = $(5) - $(4); | |
document.getElementById('probeg').value = res; | |
} | |
} | |
</script> | |
<!-- Расчёт пробега по спидометру КОНЕЦ--> | |
<!-- Запись данных в MySQL через Jqery НАЧАЛО--> | |
<script> | |
$(document).ready(function() { | |
$('#butsave').on('click', function() { | |
if(proverka()){ | |
alert('Пробег НЕ может быть отрицательным !!!'); | |
return; | |
} | |
// $("#butsave").attr("disabled", "disabled"); | |
//var s = $('form').serialize(); | |
var data_doc = $('#data_doc').val(); | |
var nazva_TC = $('#nazva_TC').val(); | |
var marka_TC = $('#marka_TC').val(); | |
var liters = $('#liters').val(); | |
var speedometr_vyezd = $('#speedometr_vyezd').val(); | |
var speedometr_vozvrat = $('#speedometr_vozvrat').val(); | |
var probeg = $('#probeg').val(); | |
var zadanie = $('#zadanie').val(); | |
var vid_rabot = $('#vid_rabot').val(); | |
var check = $('#check').val(); | |
if(data_doc!="" && nazva_TC!="" && marka_TC!="" && speedometr_vyezd!="" && speedometr_vozvrat!="" && probeg!=""&& liters!=""){ | |
$.ajax({ | |
url: "insert.php", | |
type: "POST", | |
data: { | |
data_doc: data_doc, | |
nazva_TC: nazva_TC, | |
marka_TC: marka_TC, | |
speedometr_vyezd: speedometr_vyezd, | |
speedometr_vozvrat: speedometr_vozvrat, | |
probeg: probeg, | |
liters: liters, | |
zadanie: zadanie, | |
vid_rabot: vid_rabot, | |
check: check | |
}, | |
cache: false, | |
success: function(dataResult){ | |
var dataResult = JSON.parse(dataResult); | |
if(dataResult.statusCode==200){ | |
//$("#butsave").removeAttr("disabled"); | |
alert("Данные по номеру " + nazva_TC + " добавлены в базу !"); | |
alert("Введите новое авто !"); | |
$('#InputForm').find('input:text').val(''); | |
$("#success").show(); | |
// $('#success').html('Данные добавлены в базу !'); | |
} | |
else if(dataResult.statusCode==201){ | |
alert("Чёт не то в запросе, проверь !"); | |
} | |
} | |
}); | |
} | |
else{ | |
alert('НЕ заполнены все поля !'); | |
} | |
}); | |
}); | |
</script> | |
<!-- Запись данных в MySQL через Jqery КОНЕЦ--> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
session_start(); | |
?> | |
<?php | |
include 'database.php'; | |
$data_doc = $_POST['data_doc']; | |
//$nazva_TC = $_POST['nazva_TC']; | |
$nazva_TC = $row['nazva_TC']; | |
$marka_TC = $_POST['marka_TC']; | |
//$nazva_TC = ".$_REQUEST['idNazva_TC']."; | |
$speedometr_vyezd = $_POST['speedometr_vyezd']; | |
$speedometr_vozvrat = $_POST['speedometr_vozvrat']; | |
$probeg = $_POST['probeg']; | |
$liters = $_POST['liters']; | |
$zadanie = $_POST['zadanie']; | |
$vid_rabot = $_POST['vid_rabot']; | |
$check = $_POST['check']; | |
$sql = "INSERT INTO `pl_copy` (`data_doc`, `nazva_TC`, `marka_TC`, `speedometr_vyezd`, `speedometr_vozvrat`, `probeg`, `liters`, `zadanie`, `vid_rabot`, `check`) | |
VALUES | |
('$data_doc', '$nazva_TC', '$marka_TC', '$speedometr_vyezd', '$speedometr_vozvrat', '$probeg', '$liters', '$zadanie', '$vid_rabot', '$check')"; | |
if (mysqli_query($conn, $sql)) { | |
echo json_encode(array("statusCode"=>200)); | |
} | |
else { | |
echo json_encode(array("statusCode"=>201)); | |
} | |
mysqli_close($conn); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
session_start(); | |
?> | |
<?php | |
include 'database.php'; | |
//$query = "select `id`,`nazva_TC` from `tc_basa`"; | |
$query = "select * from `tc_basa`"; | |
$result = mysql_query($query) or die(mysql_error()); | |
?> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content = "text/html; Charset=UTF-8"> | |
<script type="text/javascript" src = "http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> | |
</head> | |
<body> | |
<form id="Form_Nazva_TC"> | |
<b> | |
Выберите ТС:<br/> | |
</b> | |
<select id="idNazva_TC" title="Номер ТС"> | |
<?php | |
include 'database.php'; | |
//отображаем nazva_TC | |
while ($row = mysql_fetch_array($result)) | |
{ | |
print '<option value="'.$row['nazva_TC'].'">'; | |
print $row['nazva_TC']; | |
echo('</option>'); | |
} | |
?> | |
</select> | |
</form> | |
<div id="content_Nazva_TC"></div> | |
<script> | |
$(document).ready(function(){ | |
$('#idNazva_TC').change(function(){ | |
$.ajax({ | |
type: "POST", | |
url: "show_Nazva_TC.php", | |
data: "idNazva_TC="+$("#idNazva_TC").val(), | |
success: function(html){ | |
$("#content_Nazva_TC").html(html); | |
} | |
}); | |
return false; | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include 'database.php'; | |
//$query = "select `id`,`name_rayon_new_rus` from `rayon`"; | |
$query = "select * from `rayon`"; | |
$result = mysql_query($query) or die(mysql_error()); | |
?> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content = "text/html; Charset=UTF-8"> | |
<script type="text/javascript" src = "http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> | |
</head> | |
<body> | |
<form id="Form_name_rayon_new_rus"> | |
Район выполныемых работ: | |
<select id="id_name_rayon_new_rus" title="Район работ"> | |
<?php | |
include 'database.php'; | |
//отображаем name_rayon_new_rus | |
while ($row = mysql_fetch_array($result)) | |
{ | |
print '<option value="'.$row['name_rayon_new_rus'].'">'; | |
print $row['name_rayon_new_rus']; | |
echo("</option>"); | |
} | |
?> | |
</select> | |
</form> | |
<div id="content_name_rayon_new_rus"></div> | |
<script> | |
$(document).ready(function(){ | |
$('#id_name_rayon_new_rus').change(function(){ | |
$.ajax({ | |
type: "POST", | |
url: "show_rayon.php", | |
data: "id_name_rayon_new_rus="+$("#id_name_rayon_new_rus").val(), | |
success: function(html){ | |
$("#content_name_rayon_new_rus").html(html); | |
} | |
}); | |
return false; | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
session_start(); | |
?> | |
<?php | |
include 'database.php'; | |
//запрос на содержимое поля | |
$query = "SELECT * from `tc_basa` where `nazva_TC` = '".$_REQUEST['idNazva_TC']."' "; | |
$result = mysql_query($query) or die(mysql_error()); | |
// выводим поле по запросу | |
while ($row = mysql_fetch_array($result)) | |
{ | |
print "Марка авто : "; print $row['marka_TC']."<br>"; | |
print "Тип двигателя : "; print $row['tip_dvig']."<br>"; | |
//print "Остаток топлива : "; print $row['speedometr_vozvrat']."<br>"; | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include 'database.php'; | |
//запрос на содержимое поля | |
$query = "SELECT `id`, `temp`, `temp_koef` from `temp_base_avto` where `temp` = '".$_REQUEST['id_temp_base_avto']."'"; | |
$result = mysql_query($query) or die(mysql_error()); | |
// выводим поле по запросу | |
while ($row = mysql_fetch_array($result)) | |
{ | |
print "Коэффециент = "; print $row['temp_koef']."<br>"; | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include 'database.php'; | |
//запрос на содержимое поля | |
$query = "SELECT * from `spr_rab` where `Column3` = '".$_REQUEST['idVoditel']."'"; | |
$result = mysql_query($query) or die(mysql_error()); | |
// выводим поле по запросу | |
while ($row = mysql_fetch_array($result)) | |
{ | |
print "Выбран водитель : "; | |
print $row['Column3']."<br>"; | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include 'database.php'; | |
$query = "select `id`,`temp` from `temp_base_avto`"; | |
$result = mysql_query($query) or die(mysql_error()); | |
?> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content = "text/html; Charset=UTF-8"> | |
<script type="text/javascript" src = "http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> | |
</head> | |
<body> | |
<form id="Form_temp"> | |
Темп. окр. среды: | |
<select id="id_temp_base_avto" title="Температура ок. среды"> | |
<?php | |
include 'database.php'; | |
//отображаем temp | |
while ($row = mysql_fetch_array($result)) | |
{ | |
print '<option value="'.$row['temp'].'">'; | |
print $row['temp']; | |
echo("</option>"); | |
} | |
?> | |
</select> | |
</form> | |
<div id="content_temp"></div> | |
<script> | |
$(document).ready(function(){ | |
$('#id_temp_base_avto').change(function(){ | |
$.ajax({ | |
type: "POST", | |
url: "show_temp.php", | |
data: "id_temp_base_avto="+$("#id_temp_base_avto").val(), | |
success: function(html){ | |
$("#content_temp").html(html); | |
} | |
}); | |
return false; | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include 'database.php'; | |
$query = "select * from `spr_rab` where Column6 = 'Водій автотранспортних засобів' "; | |
$result = mysql_query($query) or die(mysql_error()); | |
?> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content = "text/html; Charset=UTF-8"> | |
<script type="text/javascript" src = "http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> | |
</head> | |
<body> | |
<form id="Form_Voditel"> | |
<b> | |
Выберите водителя:<br/> | |
</b> | |
<select id="idVoditel" title="Водитель" placeholder = "Выберите водителя"> | |
<?php | |
include 'database.php'; | |
//отображаем Column3 | |
while ($row = mysql_fetch_array($result)) | |
{ | |
print '<option value="'.$row['Column3'].'">'; | |
print $row['Column3']; | |
echo("</option>"); | |
} | |
?> | |
</select> | |
</form> | |
<div id="content_Voditel"></div> | |
<br> | |
<script> | |
$(document).ready(function(){ | |
$('#idVoditel').change(function(){ | |
$.ajax({ | |
type: "POST", | |
url: "show_Voditel.php", | |
data: "idVoditel="+$("#idVoditel").val(), | |
success: function(html){ | |
$("#content_Voditel").html(html); | |
} | |
}); | |
return false; | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment