465 lines
13 KiB
PHP
465 lines
13 KiB
PHP
<html>
|
|
<head>
|
|
<script src="/js/jquery-1.12.4.js"></script>
|
|
<script src="/js/dbsachen.js"></script>
|
|
<script src="/js/converter2.js"></script>
|
|
|
|
<link rel=stylesheet href="conv.css">
|
|
</head>
|
|
|
|
<body>
|
|
|
|
|
|
<button id="btnToArray">to Array</button><button id="btnConvert">convert Array</button><button id="btnCSV">to CSV</button><br />
|
|
<div id="tblDiv">
|
|
<table id="data">
|
|
<thead><tr>
|
|
<th>TXLCode</th>
|
|
<th>OL1</th>
|
|
<th>OL2</th>
|
|
<th>OW1</th>
|
|
<th>OW2</th>
|
|
<th>R11</th>
|
|
<th>R12</th>
|
|
<th>R13</th>
|
|
<th>R21</th>
|
|
<th>R22</th>
|
|
<th>R23</th>
|
|
<th>R31</th>
|
|
<th>R32</th>
|
|
<th>R33</th>
|
|
<th>R41</th>
|
|
<th>R42</th>
|
|
<th>R43</th>
|
|
<th>LW</th>
|
|
<th>CW</th>
|
|
<th>MessDate</th>
|
|
<th>RauDate</th>
|
|
<th>InfoMessComm</th>
|
|
<th>InfoRauComm</th>
|
|
<th>Lieferbox</th>
|
|
</tr></thead>
|
|
|
|
<?php
|
|
|
|
$db = mysqli_connect("localhost", "txl", "trixell", "newtxl");
|
|
if(!$db) {
|
|
echo "Unable to connect to MySQL: " . mysqli_error($db);
|
|
return;
|
|
} else {
|
|
//echo "Connected ...";
|
|
}
|
|
|
|
|
|
// $sql = "SELECT 3040_messdaten.ID, 3040_messdaten.TXLCode, 3040_messdaten.comment as messComm, 3040_rauheiten.comment as rauComm FROM 3040_messdaten, 3040_rauheiten WHERE 3040_messdaten.TXLCode = 3040_rauheiten.TXLCode";
|
|
// $sql = "SELECT `3040_messdaten`.`TXLCode` AS `TXLCode`,`3040_messdaten`.`ol1` AS `OL1`, `3040_messdaten`.`ol2` AS `OL2`, `3040_messdaten`.`ow1` AS `OW1`, `3040_messdaten`.`ow2` AS `OW2`, `3040_messdaten`.`r11` AS `R11`, `3040_messdaten`.`r12` AS `R12`, `3040_messdaten`.`r13` AS `R13`, `3040_messdaten`.`r21` AS `R21`, `3040_messdaten`.`r22` AS `R22`, `3040_messdaten`.`r23` AS `R23`, `3040_messdaten`.`r31` AS `R31`, `3040_messdaten`.`r32` AS `R32`, `3040_messdaten`.`r33` AS `R33`, `3040_messdaten`.`r41` AS `R41`, `3040_messdaten`.`r42` AS `R42`, `3040_messdaten`.`r43` AS `R43`, `3040_rauheiten`.`lw` AS `LW`, `3040_rauheiten`.`cw` AS `CW`, `3040_messdaten`.`comment` AS `MessComm`, `3040_rauheiten`.`comment` AS `RauComm`, `3040_info`.`Messdatum` AS InfoMessComm, `3040_info`.`Rauheitsdatum` AS InfoRauComm, `3040_info`.`Lieferbox` AS Lieferbox FROM 3040_messdaten, 3040_rauheiten, 3040_info WHERE 3040_messdaten.TXLCode = 3040_rauheiten.TXLCode AND 3040_messdaten.TXLCode = 3040_info.TXLCode";
|
|
$sql3040 = "
|
|
SELECT
|
|
`3040_messdaten`.`TXLCode` AS `TXLCode`,
|
|
`3040_messdaten`.`ol1` AS `OL1`,
|
|
`3040_messdaten`.`ol2` AS `OL2`,
|
|
`3040_messdaten`.`ow1` AS `OW1`,
|
|
`3040_messdaten`.`ow2` AS `OW2`,
|
|
`3040_messdaten`.`r11` AS `R11`,
|
|
`3040_messdaten`.`r12` AS `R12`,
|
|
`3040_messdaten`.`r13` AS `R13`,
|
|
`3040_messdaten`.`r21` AS `R21`,
|
|
`3040_messdaten`.`r22` AS `R22`,
|
|
`3040_messdaten`.`r23` AS `R23`,
|
|
`3040_messdaten`.`r31` AS `R31`,
|
|
`3040_messdaten`.`r32` AS `R32`,
|
|
`3040_messdaten`.`r33` AS `R33`,
|
|
`3040_messdaten`.`r41` AS `R41`,
|
|
`3040_messdaten`.`r42` AS `R42`,
|
|
`3040_messdaten`.`r43` AS `R43`,
|
|
`3040_rauheiten`.`lw` AS `LW`,
|
|
`3040_rauheiten`.`cw` AS `CW`,
|
|
`3040_messdaten`.`comment` AS `MessComm`,
|
|
`3040_rauheiten`.`comment` AS `RauComm`,
|
|
`3040_info`.`Messdatum` AS InfoMessComm,
|
|
`3040_info`.`Rauheitsdatum` AS InfoRauComm,
|
|
`3040_info`.`Lieferbox` AS Lieferbox
|
|
FROM
|
|
3040_messdaten, 3040_rauheiten, 3040_info
|
|
WHERE
|
|
3040_messdaten.TXLCode = 3040_rauheiten.TXLCode AND 3040_messdaten.TXLCode = 3040_info.TXLCode AND 3040_messdaten.TXLCode = 3040_info.TXLCode;
|
|
";
|
|
|
|
$sql3030 = "
|
|
SELECT
|
|
`3030_messdaten`.`TXLCode` AS `TXLCode`,
|
|
`3030_messdaten`.`ol1` AS `OL1`,
|
|
`3030_messdaten`.`ol2` AS `OL2`,
|
|
`3030_messdaten`.`ow1` AS `OW1`,
|
|
`3030_messdaten`.`ow2` AS `OW2`,
|
|
`3030_messdaten`.`r11` AS `R11`,
|
|
`3030_messdaten`.`r12` AS `R12`,
|
|
`3030_messdaten`.`r13` AS `R13`,
|
|
`3030_messdaten`.`r21` AS `R21`,
|
|
`3030_messdaten`.`r22` AS `R22`,
|
|
`3030_messdaten`.`r23` AS `R23`,
|
|
`3030_messdaten`.`r31` AS `R31`,
|
|
`3030_messdaten`.`r32` AS `R32`,
|
|
`3030_messdaten`.`r33` AS `R33`,
|
|
`3030_messdaten`.`r41` AS `R41`,
|
|
`3030_messdaten`.`r42` AS `R42`,
|
|
`3030_messdaten`.`r43` AS `R43`,
|
|
`3030_rauheiten`.`lw` AS `LW`,
|
|
`3030_rauheiten`.`cw` AS `CW`,
|
|
`3030_messdaten`.`comment` AS `MessComm`,
|
|
`3030_rauheiten`.`comment` AS `RauComm`,
|
|
`3030_info`.`Messdatum` AS InfoMessComm,
|
|
`3030_info`.`Rauheitsdatum` AS InfoRauComm,
|
|
`3030_info`.`Lieferbox` AS Lieferbox
|
|
FROM
|
|
3030_messdaten, 3030_rauheiten, 3030_info
|
|
WHERE
|
|
3030_messdaten.TXLCode = 3030_rauheiten.TXLCode AND 3030_messdaten.TXLCode = 3030_info.TXLCode AND 3030_messdaten.TXLCode = 3030_info.TXLCode;
|
|
";
|
|
|
|
$sql2121 = "
|
|
SELECT
|
|
`2121_messdaten`.`TXLCode` AS `TXLCode`,
|
|
`2121_messdaten`.`ol` AS `OL1`,
|
|
`2121_messdaten`.`ow` AS `OW2`,
|
|
`2121_messdaten`.`r11` AS `R11`,
|
|
`2121_messdaten`.`r12` AS `R12`,
|
|
`2121_messdaten`.`r21` AS `R21`,
|
|
`2121_messdaten`.`r22` AS `R22`,
|
|
`2121_messdaten`.`r31` AS `R31`,
|
|
`2121_messdaten`.`r32` AS `R32`,
|
|
`2121_messdaten`.`r41` AS `R41`,
|
|
`2121_messdaten`.`r42` AS `R42`,
|
|
`2121_rauheiten`.`lw` AS `LW`,
|
|
`2121_rauheiten`.`cw` AS `CW`,
|
|
`2121_messdaten`.`comment` AS `MessComm`,
|
|
`2121_rauheiten`.`comment` AS `RauComm`,
|
|
`2121_info`.`Messdatum` AS InfoMessComm,
|
|
`2121_info`.`Rauheitsdatum` AS InfoRauComm,
|
|
`2121_info`.`Lieferbox` AS Lieferbox
|
|
FROM
|
|
2121_messdaten, 2121_rauheiten, 2121_info WHERE 2121_messdaten.TXLCode = 2121_rauheiten.TXLCode AND 2121_messdaten.TXLCode = 2121_info.TXLCode;
|
|
";
|
|
$sql2121C = "
|
|
SELECT
|
|
`2121C_messdaten`.`TXLCode` AS `TXLCode`,
|
|
`2121C_messdaten`.`ol` AS `OL1`,
|
|
`2121C_messdaten`.`ow` AS `OW2`,
|
|
`2121C_messdaten`.`r11` AS `R11`,
|
|
`2121C_messdaten`.`r12` AS `R12`,
|
|
`2121C_messdaten`.`r21` AS `R21`,
|
|
`2121C_messdaten`.`r22` AS `R22`,
|
|
`2121C_messdaten`.`r31` AS `R31`,
|
|
`2121C_messdaten`.`r32` AS `R32`,
|
|
`2121C_messdaten`.`r41` AS `R41`,
|
|
`2121C_messdaten`.`r42` AS `R42`,
|
|
`2121C_rauheiten`.`lw` AS `LW`,
|
|
`2121C_rauheiten`.`cw` AS `CW`,
|
|
`2121C_messdaten`.`comment` AS `MessComm`,
|
|
`2121C_rauheiten`.`comment` AS `RauComm`,
|
|
`2121C_info`.`Messdatum` AS InfoMessComm,
|
|
`2121C_info`.`Rauheitsdatum` AS InfoRauComm,
|
|
`2121C_info`.`Lieferbox` AS Lieferbox
|
|
FROM
|
|
2121C_messdaten, 2121C_rauheiten, 2121C_info WHERE 2121C_messdaten.TXLCode = 2121C_rauheiten.TXLCode AND 2121C_messdaten.TXLCode = 2121C_info.TXLCode;
|
|
";
|
|
|
|
|
|
$result3040 = $db->query($sql3040);
|
|
$result3030 = $db->query($sql3030);
|
|
$result2121 = $db->query($sql2121);
|
|
$result2121C = $db->query($sql2121C);
|
|
|
|
$results3040 = array();
|
|
$results3030 = array();
|
|
$results2121 = array();
|
|
$results2121C = array();
|
|
|
|
$row3040Cnt = 0;
|
|
$row3030Cnt = 0;
|
|
$row2121Cnt = 0;
|
|
$row2121CCnt = 0;
|
|
|
|
if ($result3040->num_rows > 0) {
|
|
while($row = $result3040->fetch_row()) {
|
|
$results3040[$row3040Cnt] = $row;
|
|
$row3040Cnt++;
|
|
}
|
|
} else {
|
|
echo mysqli_error($db);
|
|
$db->close();
|
|
//echo '{ "nu":"ll" }';
|
|
return;
|
|
}
|
|
|
|
if ( $result3030->num_rows > 0) {
|
|
while($row = $result3030->fetch_row()) {
|
|
$results3030[$row3030Cnt] = $row; $row3030Cnt++;
|
|
}
|
|
} else {
|
|
echo mysqli_error($db); $db->close(); return;
|
|
}
|
|
|
|
if ( $result2121->num_rows > 0) {
|
|
while($row = $result2121->fetch_row()) {
|
|
$results2121[$row2121Cnt] = $row;
|
|
$row2121Cnt++;
|
|
}
|
|
} else {
|
|
echo mysqli_error($db); $db->close(); return;
|
|
}
|
|
|
|
if ( $result2121C->num_rows > 0) {
|
|
while($row = $result2121C->fetch_row()) {
|
|
$results2121C[$row2121CCnt] = $row;
|
|
$row2121CCnt++;
|
|
}
|
|
} else {
|
|
echo mysqli_error($db); $db->close(); return;
|
|
}
|
|
|
|
$db->close();
|
|
|
|
|
|
//echo json_encode($results);
|
|
|
|
foreach($results3040 as $result) {
|
|
$txlcode = $result[0];
|
|
$OL1 = $result[1];
|
|
$OL2 = $result[2];
|
|
$OW1 = $result[3];
|
|
$OW2 = $result[4];
|
|
$R11 = $result[5];
|
|
$R12 = $result[6];
|
|
$R13 = $result[7];
|
|
$R21 = $result[8];
|
|
$R22 = $result[9];
|
|
$R23 = $result[10];
|
|
$R31 = $result[11];
|
|
$R32 = $result[12];
|
|
$R33 = $result[13];
|
|
$R41 = $result[14];
|
|
$R42 = $result[15];
|
|
$R43 = $result[16];
|
|
$LW = $result[17];
|
|
$CW = $result[18];
|
|
$MessComm = $result[19];
|
|
$RauComm = $result[20];
|
|
$InfoMessComm = $result[21];
|
|
$InfoRauComm = $result[22];
|
|
$Lieferbox = $result[23];
|
|
|
|
echo "
|
|
<tr>
|
|
<td> $txlcode </td>
|
|
<td> $OL1 </td>
|
|
<td> $OL2 </td>
|
|
<td> $OW1 </td>
|
|
<td> $OW2 </td>
|
|
<td> $R11 </td>
|
|
<td> $R12 </td>
|
|
<td> $R13 </td>
|
|
<td> $R21 </td>
|
|
<td> $R22 </td>
|
|
<td> $R23 </td>
|
|
<td> $R31 </td>
|
|
<td> $R32 </td>
|
|
<td> $R33 </td>
|
|
<td> $R41 </td>
|
|
<td> $R42 </td>
|
|
<td> $R43 </td>
|
|
<td> $LW </td>
|
|
<td> $CW </td>
|
|
<td> $MessComm </td>
|
|
<td> $RauComm </td>
|
|
<td> $InfoMessComm </td>
|
|
<td> $InfoRauComm </td>
|
|
<td> $Lieferbox </td>
|
|
</tr>";
|
|
}
|
|
|
|
foreach($results3030 as $result) {
|
|
$txlcode = $result[0];
|
|
$OL1 = $result[1]; $OL2 = $result[2];
|
|
$OW1 = $result[3]; $OW2 = $result[4];
|
|
$R11 = $result[5]; $R12 = $result[6]; $R13 = $result[7];
|
|
$R21 = $result[8]; $R22 = $result[9]; $R23 = $result[10];
|
|
$R31 = $result[11]; $R32 = $result[12]; $R33 = $result[13];
|
|
$R41 = $result[14]; $R42 = $result[15]; $R43 = $result[16];
|
|
$LW = $result[17]; $CW = $result[18];
|
|
$MessComm = $result[19]; $RauComm = $result[20];
|
|
$InfoMessComm = $result[21]; $InfoRauComm = $result[22];
|
|
$Lieferbox = $result[23];
|
|
|
|
echo "
|
|
<tr>
|
|
<td> $txlcode </td>
|
|
<td> $OL1 </td>
|
|
<td> $OL2 </td>
|
|
<td> $OW1 </td>
|
|
<td> $OW2 </td>
|
|
<td> $R11 </td>
|
|
<td> $R12 </td>
|
|
<td> $R13 </td>
|
|
<td> $R21 </td>
|
|
<td> $R22 </td>
|
|
<td> $R23 </td>
|
|
<td> $R31 </td>
|
|
<td> $R32 </td>
|
|
<td> $R33 </td>
|
|
<td> $R41 </td>
|
|
<td> $R42 </td>
|
|
<td> $R43 </td>
|
|
<td> $LW </td>
|
|
<td> $CW </td>
|
|
<td> $MessComm </td>
|
|
<td> $RauComm </td>
|
|
<td> $InfoMessComm </td>
|
|
<td> $InfoRauComm </td>
|
|
<td> $Lieferbox </td>
|
|
</tr>";
|
|
}
|
|
|
|
foreach($results2121 as $result) {
|
|
$txlcode = $result[0];
|
|
$OL1 = $result[1]; $OL2 = "0";
|
|
$OW1 = $result[2]; $OW2 = "0";
|
|
$R11 = $result[3]; $R12 = $result[4]; $R13 = "0";
|
|
$R21 = $result[5]; $R22 = $result[6]; $R23 = "0";
|
|
$R31 = $result[7]; $R32 = $result[8]; $R33 = "0";
|
|
$R41 = $result[9]; $R42 = $result[10]; $R43 = "0";
|
|
$LW = $result[11]; $CW = $result[12];
|
|
$MessComm = $result[13]; $RauComm = $result[14];
|
|
$InfoMessComm = $result[15]; $InfoRauComm = $result[16];
|
|
$Lieferbox = $result[17];
|
|
|
|
echo "
|
|
<tr>
|
|
<td> $txlcode </td>
|
|
<td> $OL1 </td>
|
|
<td> $OL2 </td>
|
|
<td> $OW1 </td>
|
|
<td> $OW2 </td>
|
|
<td> $R11 </td>
|
|
<td> $R12 </td>
|
|
<td> $R13 </td>
|
|
<td> $R21 </td>
|
|
<td> $R22 </td>
|
|
<td> $R23 </td>
|
|
<td> $R31 </td>
|
|
<td> $R32 </td>
|
|
<td> $R33 </td>
|
|
<td> $R41 </td>
|
|
<td> $R42 </td>
|
|
<td> $R43 </td>
|
|
<td> $LW </td>
|
|
<td> $CW </td>
|
|
<td> $MessComm </td>
|
|
<td> $RauComm </td>
|
|
<td> $InfoMessComm </td>
|
|
<td> $InfoRauComm </td>
|
|
<td> $Lieferbox </td>
|
|
</tr>";
|
|
}
|
|
foreach($results2121C as $result) {
|
|
$txlcode = $result[0];
|
|
$OL1 = $result[1]; $OL2 = "0";
|
|
$OW1 = $result[2]; $OW2 = "0";
|
|
$R11 = $result[3]; $R12 = $result[4]; $R13 = "0";
|
|
$R21 = $result[5]; $R22 = $result[6]; $R23 = "0";
|
|
$R31 = $result[7]; $R32 = $result[8]; $R33 = "0";
|
|
$R41 = $result[9]; $R42 = $result[10]; $R43 = "0";
|
|
$LW = $result[11]; $CW = $result[12];
|
|
$MessComm = $result[13]; $RauComm = $result[14];
|
|
$InfoMessComm = $result[15]; $InfoRauComm = $result[16];
|
|
$Lieferbox = $result[17];
|
|
|
|
echo "
|
|
<tr>
|
|
<td> $txlcode </td>
|
|
<td> $OL1 </td>
|
|
<td> $OL2 </td>
|
|
<td> $OW1 </td>
|
|
<td> $OW2 </td>
|
|
<td> $R11 </td>
|
|
<td> $R12 </td>
|
|
<td> $R13 </td>
|
|
<td> $R21 </td>
|
|
<td> $R22 </td>
|
|
<td> $R23 </td>
|
|
<td> $R31 </td>
|
|
<td> $R32 </td>
|
|
<td> $R33 </td>
|
|
<td> $R41 </td>
|
|
<td> $R42 </td>
|
|
<td> $R43 </td>
|
|
<td> $LW </td>
|
|
<td> $CW </td>
|
|
<td> $MessComm </td>
|
|
<td> $RauComm </td>
|
|
<td> $InfoMessComm </td>
|
|
<td> $InfoRauComm </td>
|
|
<td> $Lieferbox </td>
|
|
</tr>";
|
|
}
|
|
|
|
|
|
function getNewDateTimeString($type, $str){
|
|
$messDateTimeArr = array();
|
|
|
|
if ($type == 1) {
|
|
// Z:KundenTrixellProjekte3040MessdatenMessdaten nach dem Schneidenimportedold2newTrixell3040_Messwerteerfassung_ab20131104.xls importiert am 08.04.2014 09:39:44
|
|
// Z:KundenTrixellProjekte3040MessdatenMessdaten nach dem Schneidenimportedold2newTrixell3040_Messwerteerfassung_bis20130516.xls importiert am 08.04.2014 09:40:38
|
|
$messDateTimeArr = explode(" am ", $str);
|
|
$messDateTimeArr = explode(" ", $messDateTimeArr[1]);
|
|
}
|
|
|
|
if ($type == 2) {
|
|
// Vorabeintrag Messmaske3040 27.05.2014 08:45:47
|
|
$messDateTimeArr = explode("3040 ", $str);
|
|
$messDateTimeArr = explode(" ", $messDateTimeArr[1]);
|
|
}
|
|
|
|
if ($type == 2.1) {
|
|
// Vorabeintrag Messmaske3040 27.05.2014 08:45:47
|
|
$messDateTimeArr = explode("2121 ", $str);
|
|
$messDateTimeArr = explode(" ", $messDateTimeArr[1]);
|
|
}
|
|
if ($type == 2.2) {
|
|
// Vorabeintrag Messmaske3040 27.05.2014 08:45:47
|
|
$messDateTimeArr = explode("2121C ", $str);
|
|
$messDateTimeArr = explode(" ", $messDateTimeArr[1]);
|
|
}
|
|
|
|
if ($type == 3) {
|
|
// TME2: 21.01.2016 06:47:10
|
|
$messDateTimeArr = explode("2: ", $str);
|
|
$messDateTimeArr = explode(" ", $messDateTimeArr[1]);
|
|
}
|
|
|
|
if ($type == 4) {
|
|
// Z:\Kunden\Trixell\Projekte\3040\Messdaten\Messdaten nach dem Schneiden\Trixell3040_Messwerteerfassung_ab20140211_2.xls importiert am 05.06.2014 14:14:20 / Hand-Import am 05.06.2014 OBK
|
|
$messDateTimeArr = explode(" am ", $str);
|
|
$messDateTimeArr = explode(" / ", $messDateTimeArr[1]);
|
|
$messDateTimeArr = explode(" ", $messDateTimeArr[0]);
|
|
}
|
|
|
|
if ($type == 5) {
|
|
return "1979-04-18 20:16:00";
|
|
}
|
|
|
|
$messDate = $messDateTimeArr[0];
|
|
$messTime = $messDateTimeArr[1];
|
|
$messDateArr = explode(".", $messDate);
|
|
$messDate = $messDateArr[2] ."-". $messDateArr[1] ."-". $messDateArr[0];
|
|
return $messDate ." ". $messTime;
|
|
|
|
}
|
|
|
|
?>
|
|
</table>
|
|
</div>
|
|
<div id="jsonDiv"></div>
|
|
</body>
|
|
</html>
|