275 lines
No EOL
16 KiB
PHP
275 lines
No EOL
16 KiB
PHP
<?php
|
|
header("Content-Type: text/html; charset=utf-8");
|
|
|
|
error_reporting(E_ALL);
|
|
ini_set('display_errors', 1);
|
|
|
|
$kw_aktuell = (int)date('W');
|
|
$a_jahr = (int)date('Y');
|
|
require('lib/config.php');
|
|
session_name(CONFIG_SESSION);
|
|
session_start(); require('lib/mysql.class.php');
|
|
$GLOBALS['mysql'] = new mysql(CONFIG_MYSQL_HOST,CONFIG_MYSQL_USER,CONFIG_MYSQL_PW,CONFIG_MYSQL_DB);
|
|
// $GLOBALS['mysql']->mysql_query("SET NAMES 'utf8'");
|
|
// $GLOBALS['mysql']->mysql_query("SET CHARACTER SET 'utf8'");
|
|
date_default_timezone_set('Europe/London');
|
|
print_r($_POST);
|
|
$dateityp = GetImageSize($_FILES['datei']['tmp_name']);
|
|
//echo $_FILES['datei']['name'];
|
|
//echo $_FILES['datei']['tmp_name'];
|
|
//echo $_FILES['datei']['size'];
|
|
//echo $_FILES['datei']['type'];
|
|
|
|
if($_FILES['datei']['type'] == 'application/vnd.ms-excel') {
|
|
move_uploaded_file($_FILES['datei']['tmp_name'], $_FILES['datei']['name']);
|
|
$ok=1; $dat=substr($_FILES['datei']['name'], 0,6);
|
|
|
|
//------------------------------------------------------------------------------------------------------------------------------- GEWICHTE
|
|
if ($dat=='Gewich') {
|
|
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
|
require_once dirname(__FILE__) . '/lib/PHPExcel.php';
|
|
$objPHPExcel = PHPExcel_IOFactory::load($_FILES['datei']['name']);
|
|
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
|
|
$auslese = $sheetData;
|
|
foreach ($sheetData as $index => $rowa) {
|
|
$auslese_tour = $GLOBALS['mysql']->query_single("SELECT * FROM touren WHERE tour2='".$rowa['A']."' AND tour2!=''");
|
|
if($auslese_tour['num_rows'] > 0) {
|
|
if($auslese_tour['typ'] == 7) { $wtyp=7; break; } //-------- Rundschau
|
|
if($auslese_tour['typ'] == 8) { $wtyp=8; break; } //-------- saso
|
|
if($auslese_tour['typ'] ==11) { $wtyp=11; } //-------- Werbung
|
|
// break;
|
|
}
|
|
}
|
|
//---------------------------- end gewicht lesen und speichern
|
|
$lasttour=0; $key=0; $tmp_data=''; $ltour=0;
|
|
foreach ($sheetData as $index => $row) {
|
|
// if($ltour==1) { $lasttour=0; $ltour==0; }
|
|
if($row['A']!='Tour' || $row['A']!='Created by Online2PDF.com') {
|
|
if($row['A']!='') {
|
|
$row_tour = $GLOBALS['mysql']->query_single("SELECT * FROM touren WHERE typ='".$wtyp."' AND tour2='".$row['A']."'");
|
|
if(isset($row_tour['id'])) {
|
|
$lasttour=$row_tour['id'];
|
|
if(isset($row['Z'])) { $alg=$row['Z']; }
|
|
elseif(isset($row['Y'])) { $alg=$row['Y']; }
|
|
elseif(isset($row['X'])) { $alg=$row['X']; }
|
|
elseif(isset($row['W'])) { $alg=$row['W']; }
|
|
elseif(isset($row['V'])) { $alg=$row['V']; }
|
|
elseif(isset($row['U'])) { $alg=$row['U']; }
|
|
elseif(isset($row['T'])) { $alg=$row['T']; }
|
|
elseif(isset($row['S'])) { $alg=$row['S']; }
|
|
elseif(isset($row['R'])) { $alg=$row['R']; }
|
|
elseif(isset($row['Q'])) { $alg=$row['Q']; }
|
|
elseif(isset($row['P'])) { $alg=$row['P']; }
|
|
elseif(isset($row['O'])) { $alg=$row['O']; }
|
|
elseif(isset($row['N'])) { $alg=$row['N']; }
|
|
elseif(isset($row['M'])) { $alg=$row['M']; }
|
|
elseif(isset($row['L'])) { $alg=$row['L']; }
|
|
elseif(isset($row['K'])) { $alg=$row['K']; }
|
|
} else { $lasttour=0 ; }
|
|
} elseif($lasttour>0) { // wichtig für den ersten Datensatz
|
|
if(isset($row['Z'])) { $alg=$row['Z']; }
|
|
elseif(isset($row['Y'])) { $alg=$row['Y']; }
|
|
elseif(isset($row['X'])) { $alg=$row['X']; }
|
|
elseif(isset($row['W'])) { $alg=$row['W']; }
|
|
elseif(isset($row['V'])) { $alg=$row['V']; }
|
|
elseif(isset($row['U'])) { $alg=$row['U']; }
|
|
elseif(isset($row['T'])) { $alg=$row['T']; }
|
|
elseif(isset($row['S'])) { $alg=$row['S']; }
|
|
elseif(isset($row['R'])) { $alg=$row['R']; }
|
|
elseif(isset($row['Q'])) { $alg=$row['Q']; }
|
|
elseif(isset($row['P'])) { $alg=$row['P']; }
|
|
elseif(isset($row['O'])) { $alg=$row['O']; }
|
|
elseif(isset($row['N'])) { $alg=$row['N']; }
|
|
elseif(isset($row['M'])) { $alg=$row['M']; }
|
|
elseif(isset($row['L'])) { $alg=$row['L']; }
|
|
elseif(isset($row['K'])) { $alg=$row['K']; }
|
|
// $ltour=1;
|
|
}
|
|
if(isset($alg)) {
|
|
$x=strlen($alg); $tmpdata=""; $wert=1; //echo $row['A']."-".$tmp_data."*";
|
|
echo $x."~";
|
|
if($x==7) { $tmpdata = substr($alg,1,3); if(substr($alg,5,1)>4) { $tmpdata++; }}
|
|
// if($x==7 && $wtyp == 7) { $tmpdata = substr($alg,0,3); if(substr($alg,4,1)>4) { $tmpdata++; }}
|
|
if($x==8) { $tmpdata = substr($alg,0,1).substr($alg,2,3); if(substr($alg,7,1)>4) { $tmpdata++; }}
|
|
if($x>10 || $wtyp == 8) { $tmpdata = substr($alg,-8,1).substr($alg,-6,3); if(substr($alg-2,1)>4) { $tmpdata++; }}
|
|
// $tmp=substr($tmpdata,-4,1); if ($tmp=".") { $gewicht=substr($tmpdata,-5,1).substr($tmpdata,-3,3); } else { $gewicht=$tmpdata; }
|
|
echo $tmpdata."-";
|
|
$GLOBALS['mysql']->insert("UPDATE tourenliste SET gewicht='".$tmpdata."' WHERE kw='".$kw_aktuell."' AND jahr='".$a_jahr."' AND tour='".$lasttour."'");
|
|
|
|
|
|
$auslese_test = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste_all WHERE kw='".$kw_aktuell."' AND jahr='".$a_jahr."' AND tour='".$lasttour."'");
|
|
if($auslese_test['num_rows'] != 0) {
|
|
$GLOBALS['mysql']->insert("UPDATE tourenliste_all SET gewicht='".$tmpdata."' WHERE kw='".$kw_aktuell."' AND jahr='".$a_jahr."' AND tour='".$lasttour."'");
|
|
} else {
|
|
$auslese_data = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE kw='".$kw_aktuell."' AND jahr='".$a_jahr."' AND tour='".$lasttour."'");
|
|
if(isset($auslese_data['tour'])) {
|
|
$GLOBALS['mysql']->insert("INSERT INTO tourenliste_all (tag,monat,jahr,kw,gewicht4,exemplare,zeit,tour,gewicht)
|
|
VALUES(
|
|
'".$auslese_data['tag']."',
|
|
'".$auslese_data['monat']."',
|
|
'".$auslese_data['jahr']."',
|
|
'".$auslese_data['kw']."',
|
|
'".$auslese_data['gewicht4']."',
|
|
'".$auslese_data['exemplare']."',
|
|
'".$auslese_data['zeit']."',
|
|
'".$auslese_data['tour']."',
|
|
'".$tmpdata."')
|
|
");
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if ($wtyp== 7) { header('Location: https://edv.jb-transport.de/index.php?s=irundschau&info=1'); }
|
|
if ($wtyp== 8) { header('Location: https://edv.jb-transport.de/index.php?s=psaso&info=1'); }
|
|
if ($wtyp==11) { header('Location: https://edv.jb-transport.de/index.php?s=iwerbung&info=1'); }
|
|
}
|
|
|
|
/*
|
|
$key=0; $wtyp=0; $lasttyp=0; $lasttour=0; $tmp_data=''; $wert=0;
|
|
foreach ($sheetData as $index => $row) {
|
|
$row_tour = $GLOBALS['mysql']->query_single("SELECT * FROM touren WHERE tour2='".$row['A']."' AND tour2!=''");
|
|
if($row_tour['num_rows'] > 0) {
|
|
if($row_tour['typ'] == 7) { if($row['X']=='') { $tmp_data=$row['V']; }else{ $tmp_data=$row['X']; } $wtyp=7; } //-------- Rundschau
|
|
if($row_tour['typ'] == 8) { $tmp_data=$row['S']; $wtyp=8; } //-------- saso
|
|
if($row_tour['typ'] ==11) { $tmp_data=$row['X']; $wtyp=11; } //-------- Werbung
|
|
$lasttour=$row_tour['id']; $lasttyp=$row_tour['typ'];
|
|
|
|
$x=strlen($tmp_data); $tmpdata =""; $wert=1; //echo $row['A']."-".$tmp_data."*";
|
|
if($x==7) { $tmpdata = substr($tmp_data,1,3); if(substr($tmp_data,5,1)>4) { $tmpdata++; }}
|
|
if($x==7 && $lasttyp == 7) { $tmpdata = substr($tmp_data,0,3); if(substr($tmp_data,4,1)>4) { $tmpdata++; }}
|
|
if($x==8) { $tmpdata = substr($tmp_data,0,1).substr($tmp_data,2,3); if(substr($tmp_data,7,1)>4) { $tmpdata++; }}
|
|
if($x>10 || $lasttyp == 8) { $tmpdata = substr($tmp_data,-8,1).substr($tmp_data,-6,3); if(substr($tmp_data,-2,1)>4) { $tmpdata++; }}
|
|
// $tmp=substr($tmpdata,-4,1); if ($tmp=".") { $gewicht=substr($tmpdata,-5,1).substr($tmpdata,-3,3); } else { $gewicht=$tmpdata; }
|
|
$gewicht=$tmpdata; echo "-".$tmpdata."-";
|
|
$GLOBALS['mysql']->insert("UPDATE tourenliste SET gewicht='".$gewicht."' WHERE kw='".$kw_aktuell."' AND jahr='".$a_jahr."' AND tour='".$row_tour['id']."'");
|
|
//-----------------------------
|
|
} else {
|
|
if($wert==1 || $lasttyp!=7) {
|
|
if($lasttyp!=8) {
|
|
if($lasttyp == 7) { if($row['X']=='') { $tmp_data=$row['V']; }else{ $tmp_data=$row['X']; } $wtyp=7; } //-------- Rundschau
|
|
if($lasttyp == 8) { $tmp_data=$row['S']; $wtyp=8; } //-------- saso
|
|
if($lasttyp ==11) { $tmp_data=$row['X']; $wtyp=11; } //-------- Werbung
|
|
if($row['A']=='' && $tmp_data!='') {
|
|
$x=strlen($tmp_data); $tmpdata =""; $wert=0; //echo $tmp_data."++";
|
|
if($x==7 && $lasttyp == 7) { $tmpdata = substr($tmp_data,0,3); if(substr($tmp_data,4,1)>4) { $tmpdata++; }}
|
|
if($x==7) { $tmpdata = substr($tmp_data,1,3); if(substr($tmp_data,5,1)>4) { $tmpdata++; }}
|
|
if($x==8) { $tmpdata = substr($tmp_data,0,1).substr($tmp_data,2,3); if(substr($tmp_data,6,1)>4) { $tmpdata++; }}
|
|
// $tmp=substr($tmpdata,-4,1); if ($tmp=".") { $gewicht=substr($tmpdata,-5,1).substr($tmpdata,-3,3); } else { $gewicht=$tmpdata; }
|
|
$gewicht=$tmpdata; echo "*".$tmpdata."*";
|
|
$GLOBALS['mysql']->insert("UPDATE tourenliste SET gewicht='".$gewicht."' WHERE kw='".$kw_aktuell."' AND jahr='".$a_jahr."' AND tour='".$row_tour['id']."'");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//-----------------------------
|
|
$key++;
|
|
}
|
|
if ($wtyp== 7) { header('Location: http://edv.jb-transport.de/index.php?s=irundschau'); }
|
|
if ($wtyp== 8) { header('Location: http://edv.jb-transport.de/index.php?s=psaso'); }
|
|
if ($wtyp==11) { header('Location: http://edv.jb-transport.de/index.php?s=iwerbung'); }
|
|
}
|
|
*/
|
|
//-----------------------------------------------------------
|
|
//------------------------------------------------- Sachsen Sonntag
|
|
if ($dat=='Sachse') {
|
|
$jahrtest=substr($_FILES['datei']['name'], -14,4);
|
|
if ($jahrtest==date("Y") OR $jahrtest==date("Y")+1) {
|
|
$jahr=substr($_FILES['datei']['name'], -14,4); $monat=substr($_FILES['datei']['name'], -9,2); $tag=substr($_FILES['datei']['name'], -6,2); // datum aus File auslesen !
|
|
} else {
|
|
$jahr=substr($_FILES['datei']['name'], -15,4); $monat=substr($_FILES['datei']['name'], -10,2); $tag=substr($_FILES['datei']['name'], -7,2); // datum aus File auslesen !
|
|
}
|
|
// ini_set('include_path', '/lib');
|
|
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
|
require_once dirname(__FILE__) . '/lib/PHPExcel.php';
|
|
$objPHPExcel = PHPExcel_IOFactory::load($_FILES['datei']['name']);
|
|
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
|
|
$key=0;
|
|
foreach ($sheetData as $index => $row) {
|
|
$data=substr($row['A'], 0,4);
|
|
if($data=="City") { $data2 =substr($row['A'], 16,2); echo "City"; }
|
|
if($data=="Born") { $data3 =substr($row['A'], 16,2); }
|
|
if($data=="Oste") { $data4 =substr($row['A'], 16,2); }
|
|
if($data=="Deli") { $data5 =substr($row['A'], 16,2); }
|
|
if($data=="Eile") { $data6 =substr($row['A'], 16,2); }
|
|
if($data=="Grim") { $data7 =substr($row['A'], 16,2); }
|
|
if($data=="Wurz") { $data8 =substr($row['A'], 16,2); echo "WUR"; }
|
|
if($data=="Döbe") { $data9 =substr($row['A'], 16,2); }
|
|
|
|
$row_tour = $GLOBALS['mysql']->query_single("SELECT * FROM touren WHERE tour3='".$row['C']."' AND aktiv>0");
|
|
if($row_tour['num_rows'] > 0) {
|
|
if($row_tour['utyp']==1){ $GLOBALS['mysql']->insert("UPDATE tourenliste SET Norm='".$data2."' WHERE kw='".$kw_aktuell."' AND jahr='".$jahr."'"); }
|
|
if($row_tour['utyp']==2){ $GLOBALS['mysql']->insert("UPDATE tourenliste SET Norm='".$data3."' WHERE kw='".$kw_aktuell."' AND jahr='".$jahr."'"); }
|
|
if($row_tour['utyp']==3){ $GLOBALS['mysql']->insert("UPDATE tourenliste SET Norm='".$data4."' WHERE kw='".$kw_aktuell."' AND jahr='".$jahr."'"); }
|
|
if($row_tour['utyp']==4){ $GLOBALS['mysql']->insert("UPDATE tourenliste SET Norm='".$data5."' WHERE kw='".$kw_aktuell."' AND jahr='".$jahr."'"); }
|
|
if($row_tour['utyp']==5){ $GLOBALS['mysql']->insert("UPDATE tourenliste SET Norm='".$data6."' WHERE kw='".$kw_aktuell."' AND jahr='".$jahr."'"); }
|
|
if($row_tour['utyp']==6){ $GLOBALS['mysql']->insert("UPDATE tourenliste SET Norm='".$data7."' WHERE kw='".$kw_aktuell."' AND jahr='".$jahr."'"); }
|
|
if($row_tour['utyp']==7){ $GLOBALS['mysql']->insert("UPDATE tourenliste SET Norm='".$data8."' WHERE kw='".$kw_aktuell."' AND jahr='".$jahr."'"); }
|
|
if($row_tour['utyp']==8){ $GLOBALS['mysql']->insert("UPDATE tourenliste SET Norm='".$data9."' WHERE kw='".$kw_aktuell."' AND jahr='".$jahr."'"); }
|
|
//---------------------------------------------- saso spalen
|
|
$tmp=substr($row['D'],-4,1); $exemplare=0;
|
|
if ($tmp=".") {
|
|
$x=strlen($row['D']);
|
|
if($x==5) { $exemplare=substr($row['D'],-5,1).substr($row['D'],-3,3); }
|
|
if($x==6) { $exemplare=substr($row['D'],-6,2).substr($row['D'],-3,3); }
|
|
} else { $exemplare=$row['D']; }
|
|
$GLOBALS['mysql']->insert("UPDATE tourenliste SET exemplare='".$exemplare."' WHERE tag='".$tag."' AND monat='".$monat."' AND jahr='".$jahr."' AND tour='".$row_tour['id']."'");
|
|
// $tmp=substr($row['F'],-4,1); if ($tmp=".") { $gewicht=substr($row['F'],-5,1).substr($row['F'],-3,3); } else { $exemplare=$row['F']; }
|
|
$gewicht=substr($row['F'],-5,1).substr($row['F'],-3,3);
|
|
$GLOBALS['mysql']->insert("UPDATE tourenliste SET gewicht4='".$gewicht."' WHERE tag='".$tag."' AND monat='".$monat."' AND jahr='".$jahr."' AND tour='".$row_tour['id']."'");
|
|
|
|
$test=$gewicht/100; $test=$gewicht+$test; // pauschal aufrechnen
|
|
|
|
$GLOBALS['mysql']->insert("UPDATE tourenliste SET gewicht='".$test."' WHERE tag='".$tag."' AND monat='".$monat."' AND jahr='".$jahr."' AND tour='".$row_tour['id']."'");
|
|
$GLOBALS['mysql']->insert("UPDATE tourenliste SET zeit='".$row['H']."' WHERE tag='".$tag."' AND monat='".$monat."' AND jahr='".$jahr."' AND tour='".$row_tour['id']."'");
|
|
}
|
|
//------------------------------------------------------------------------------------
|
|
$tmp=substr($row['D'],-4,1); $exemplare=0;
|
|
if ($tmp=".") {
|
|
$x=strlen($row['D']);
|
|
if($x==5) { $exemplare=substr($row['D'],-5,1).substr($row['D'],-3,3); }
|
|
if($x==6) { $exemplare=substr($row['D'],-6,2).substr($row['D'],-3,3); }
|
|
} else { $exemplare=$row['D']; }
|
|
$gewicht=substr($row['F'],-5,1).substr($row['F'],-3,3);
|
|
//----------------------
|
|
$auslese_test = $GLOBALS['mysql']->query_single("SELECT * FROM tliste WHERE kw='".$kw_aktuell."' AND jahr='".$jahr."' AND tour='".$row['C']."'");
|
|
if($auslese_test['num_rows'] != 0 AND $gewicht !=0) { $tmp=8;
|
|
$GLOBALS['mysql']->insert("UPDATE tliste SET gewicht='".$gewicht."' WHERE kw='".$kw_aktuell."' AND jahr='".$jahr."' AND tour='".$row['C']."'");
|
|
$GLOBALS['mysql']->insert("UPDATE tliste SET exemplare='".$row['D']."' WHERE kw='".$kw_aktuell."' AND jahr='".$jahr."' AND tour='".$row['C']."'");
|
|
$GLOBALS['mysql']->insert("UPDATE tliste SET zeit='".$row['H']."' WHERE kw='".$kw_aktuell."' AND jahr='".$jahr."' AND tour='".$row['C']."'");
|
|
$GLOBALS['mysql']->insert("UPDATE tliste SET gewicht2='".$row['G']."' WHERE kw='".$kw_aktuell."' AND jahr='".$jahr."' AND tour='".$row['C']."'");
|
|
$GLOBALS['mysql']->insert("UPDATE tliste SET pakete='".$row['E']."' WHERE kw='".$kw_aktuell."' AND jahr='".$jahr."' AND tour='".$row['C']."'");
|
|
$GLOBALS['mysql']->insert("UPDATE tliste SET typ=8 WHERE kw='".$kw_aktuell."' AND jahr='".$jahr."' AND tour='".$row['C']."'");
|
|
// $GLOBALS['mysql']->insert("UPDATE tliste SET rampe='".$tmpdata."' WHERE kw='".$kw_aktuell."' AND jahr='".$jahr."' AND tour='".$row['C']."'");
|
|
} else {
|
|
if (isset($row['C'])) {
|
|
$typ=8;
|
|
$GLOBALS['mysql']->insert("INSERT INTO tliste (tag,monat,jahr,kw,gewicht2,exemplare,zeit,tour,typ,gewicht)
|
|
VALUES(
|
|
'".$tag."',
|
|
'".$monat."',
|
|
'".$jahr."',
|
|
'".$kw_aktuell."',
|
|
'".$row['G']."',
|
|
'".$exemplare."',
|
|
'".$row['H']."',
|
|
'".$row['C']."',
|
|
'".$typ ."',
|
|
'".$gewicht."')
|
|
");
|
|
}
|
|
//------------------------------------------------------------------------------------
|
|
}
|
|
unset ($row['C']);
|
|
$key++;
|
|
} header('Location: http://edv.jb-transport.de/index.php?s=isaso');
|
|
}
|
|
}
|
|
|
|
//------------------------------------------------------------
|
|
// echo "<pre>"; print_r($row['A']); echo "</pre>";
|
|
//------------------------------------------------------------
|
|
|
|
|
|
?>
|