Subversion Repositories artstore

Rev

Blame | Last modification | View Log | RSS feed

<?php
/***************************************************************************
 *   Copyright (C) 2014 by Computerhaus GmbH                               *
 *   m@kom.at                                                              *
 *                                                                         *
 *   COPYRIGHT (C) 2014      by COMPUTERHAUS EDV-HANDELS GMBH. ALL RIGHTS  *
 *   RESERVED. NO PART OF THIS PRGORAM OR PUBLICATION MAY BE REPRODUCED,   *
 *   TRANSLATED, TRANSCRIBED, STORED IN A RETRIEVAL SYSTEM, OR TRANSLATED  *
 *   INTO ANY LANGUAGE OR COMPUTER LANGUAGE IN ANY FORM OR BY ANY MEANS,   *
 *   ELECTRONIC, MECHANICAL, MAGNETIC, OPTICAL, CHEMICAL, MANUAL, OR       *
 *   OTHERWISE, WITHOUT THE PRIOR WRITTEN PERMISSION OF:                   *
 *                                                                         *
 *                 COMPUTERHAUS EDV-HANDELS GES.M.B.H                      *
 *                                                                         *
 *               WIENERSTRASSE 26 - 8605 KAPFENBERG - AUSTRIA              *
 *                                                                         *
 ***************************************************************************/

spl_autoload_register(null, false );
spl_autoload_extensions( '.php, .class.php' );

date_default_timezone_set('Europe/Vienna');

$css_version = '20150218001';

require_once 'includes/configuration.php';

function classesLoader($class) {
        $filename = strtolower($class) . '.php';
        $file = DIR_WS_INCLUDES . $filename;
        if( !file_exists($file) )
                return false;
        include $file;
}

spl_autoload_register('classesLoader');

$is_mobile = false;
$user_agent = $_SERVER['HTTP_USER_AGENT'];
if ( ( strpos ( strtolower($user_agent), 'iemobile' ) !== false ) || ( strpos ( strtolower($user_agent), 'windows phone' ) !== false ) ) {
        $is_mobile = true;
//      $use_zoom = "2";
//      
//      $style_zoom = <<<EOD
//      <style>
//          body {
//              zoom: $use_zoom;
//              -moz-transform: scale($use_zoom);
//              -moz-transform-origin: 0 0;
//              -o-transform: scale($use_zoom);
//              -o-transform-origin: 0 0;
//              -webkit-transform: scale($use_zoom);
//              -webkit-transform-origin: 0 0;
//              transform: scale($use_zoom);
//              transform-origin: 0 0;
//          }
//      </style>
// EOD;
//      echo $style_zoom;
}

$db = new Database;

$show_onfail = ' alert ( "Fehler bei der &Uuml;bertragung!" );';

echo '<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">' . "\n";
echo '<html dir="LTR" lang="de">' . "\n";
echo '<head>' . "\n";
echo '<meta HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">' . "\n";
echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">' . "\n";
echo '<meta name="MobileOptimized" content="480">' . "\n";
// echo '<meta name="viewport" content="width=320">' . "\n";
echo '<meta name="viewport" content="width=device-width">' . "\n";
echo '<title>ARTSTORE</title>' . "\n";
echo '<base href="' . HTTP_SERVER . '">' . "\n";
echo '<link rel="stylesheet" type="text/css" href="' . DIR_WS_STYLES . 'styles.css?v=' . $css_version . '">' . "\n";



echo '<script type="text/javascript" src="' . DIR_WS_JS . 'jquery-1.11.0.min.js"></script>' . "\n";

echo '<script type="text/javascript">';
echo '  $(document).ready( function() {';
echo '    $.ajaxSetup ({';
echo '      cache: false';
echo '    });';
echo '    var cur_store_type = "";';
echo '    var cur_additional_type = "";';
echo '    var cur_colli_uuid = "";';
echo '    var cur_sector_uuid = "";';
echo '    var cur_objinfo_uuid = "";';

echo '    start();';

echo '    function focus_input ( field ) {';
echo '      $(field).val("");';
echo '      $(field).focus();';
echo '    }';

echo '    function set_store_type ( type ) {';
echo '      cur_store_type = type;';
echo '      $("#store_type_section").hide();';
echo '      $("#reset_section").show();';
echo '      $("#colli_section").show();';
echo '      $("#summary_section").show();';
echo '      focus_input("#colli_uuid_field");';
echo '      update_summary("store");';
echo '    }';

echo '    function set_colli_uuid ( colli_uuid ) {';
echo '      cur_colli_uuid = colli_uuid;';
echo '      $("#colli_section").hide();';
echo '      $("#store_section").show();';
echo '      focus_input("#sector_uuid_field");';
echo '      update_summary("store");';
echo '    }';

echo '    function set_sector_uuid ( sector_uuid ) {';
echo '      cur_sector_uuid = sector_uuid;';
echo '      show_submit();';
echo '      $("#store_section").hide();';
echo '      $("#submit_section").show();';
echo '      update_summary("store");';
echo '    }';

echo '    function set_additional_type ( type ) {';
echo '      cur_additional_type = type;';
echo '      $("#store_type_section").hide();';
echo '      $("#additional_objinfo_section").show();';
echo '      $("#reset_section").show();';
echo '      $("#summary_section").show();';
echo '      focus_input("#objinfo_uuid_field");';
echo '      update_summary("objinfo");';
echo '    }';

echo '    function set_objinfo_uuid ( objinfo_uuid ) {';
echo '      cur_objinfo_uuid = objinfo_uuid;';
echo '      $("#additional_objinfo_section").hide();';
echo '      $("#additional_objinfo_show_section").show();';
echo '      $("#reset_section").show();';
// echo '      $("#additional_objinfo_show_section").show();';
echo '      update_summary("objinfo");';
echo '    }';

echo '    function check_colli_uuid ( colli_uuid ) {';
echo '      $.getJSON("' . HTTP_BACKEND . '", { action: "check_colli_uuid", colli_uuid: colli_uuid, store_type: cur_store_type } )';
echo '        .done( function ( data ) { ';
echo '          var items = [];';
echo '          var error = true;';
echo '          var error_text = "";';
echo '          $.each( data, function( key, val ) {';
echo '            if ( ( key == "success" ) && ( val ) ) {';
echo '              set_colli_uuid( colli_uuid );';
echo '              error = false;';
echo '            } else if ( key == "error_text" ) {';
echo '              error_text = val;';
echo '            }';
echo '          });';
echo '          if ( error ) {';
echo '            show_error_box(error_text);';
echo '          }';
echo '        });';
echo '    }';

echo '    function check_sector_uuid ( sector_uuid ) {';
echo '      $.getJSON("' . HTTP_BACKEND . '", { action: "check_sector_uuid", sector_uuid: sector_uuid } )';
echo '        .done( function ( data ) { ';
echo '          var items = [];';
echo '          var error = true;';
echo '          var error_text = "";';
echo '          $.each( data, function( key, val ) {';
echo '            if ( ( key == "success" ) && ( val ) ) {';
echo '              set_sector_uuid( sector_uuid );';
echo '              error = false;';
echo '            } else if ( key == "error_text" ) {';
echo '              error_text = val;';
echo '            }';
echo '          });';
echo '          if ( error ) {';
echo '            show_error_box(error_text);';
echo '          }';
echo '        });';
echo '    }';

echo '    function check_objinfo_uuid ( objinfo_uuid ) {';
echo '      $.getJSON("' . HTTP_BACKEND . '", { action: "check_objinfo_uuid", objinfo_uuid: objinfo_uuid } )';
echo '        .done( function ( data ) { ';
echo '          var items = [];';
echo '          var error = true;';
echo '          var error_text = "";';
echo '          $.each( data, function( key, val ) {';
echo '            if ( ( key == "success" ) && ( val ) ) {';
echo '              set_objinfo_uuid( objinfo_uuid );';
echo '              error = false;';
echo '            } else if ( key == "error_text" ) {';
echo '              error_text = val;';
echo '            }';
echo '          });';
echo '          if ( error ) {';
echo '            show_error_box(error_text);';
echo '          }';
echo '        });';
echo '    }';

echo '    function reset_ids () {';
echo '      cur_store_type = "";';
echo '      cur_additional_type = "";';
echo '      cur_colli_uuid = "";';
echo '      cur_sector_uuid = "";';
echo '      cur_objinfo_uuid = "";';
echo '      start();';
echo '    }';

echo '    function show_error_box (use_text) {';
echo '      var text = ( ( use_text !== "" ) ? use_text : "Fehlerhafte Eingabe" );';
echo '      $(".error_box").html(text).fadeIn();';
echo '      setTimeout(function() {';
echo '        reset_error_box();';
echo '      }, 5000 );';
echo '    }';
echo '    function reset_error_box () {';
echo '      $(".error_box").fadeOut("slow");';
echo '    }';

echo '    function start () {';
echo '      $("#store_type_section").show();';
// echo '      $("#reset_section").show();';
echo '      $("#reset_section").hide();';
echo '      $("#colli_section").hide();';
echo '      $("#store_section").hide();';
echo '      $("#submit_section").hide();';
echo '      $("#success_section").hide();';
echo '      $("#summary_section").hide();';
echo '      $("#additional_objinfo_section").hide();';
echo '      $("#additional_objinfo_show_section").hide();';
echo '      $(".error_box").hide();';
echo '      reset_error_box();';
echo '    }';

echo '    function show_submit () {';
echo '      $.getJSON("' . HTTP_BACKEND . '", { action: "show_result", store_type: cur_store_type, colli_uuid: cur_colli_uuid, sector_uuid: cur_sector_uuid } )';
echo '        .done( function ( data ) { ';
echo '          var items = [];';
echo '          var success = false;';
echo '          var text = "";';
echo '          $.each( data, function( key, val ) {';
echo '            if ( ( key == "success" ) && ( val ) ) {';
echo '              success = true;';
echo '            }';
echo '            else if ( key == "text" ) {';
echo '              text = val;';
echo '            }';
echo '          });';
echo '          if ( success ) {';
echo '            $("#show_result").html(text);';
echo '          }';
echo '        });';
echo '    }';

echo '    function submit () {';
echo '      $.getJSON("' . HTTP_BACKEND . '", { action: "submit", store_type: cur_store_type, colli_uuid: cur_colli_uuid, sector_uuid: cur_sector_uuid } )';
echo '        .done( function ( data ) { ';
echo '          var items = [];';
echo '          var success = true;';
echo '          var text = "";';
echo '          $.each( data, function( key, val ) {';
echo '            if ( ( key == "success" ) && ( val ) ) {';
echo '              success = true;';
echo '            }';
echo '            else if ( key == "text" ) {';
echo '              text = val;';
echo '            }';
echo '          });';
echo '          if ( success ) {';
echo '            $("#show_result_done").html(text);';
echo '            window.location = "' . HTTP_SERVER . '";';
echo '          }';
echo '        });';
echo '      $("#submit_section").hide();';
echo '      $("#reset_section").hide();';
echo '      $("#success_section").show();';
echo '    }';

echo '    function update_summary ( summary_type ) {';
echo '      var use_action = "summary";';
echo '      if ( summary_type && summary_type == "objinfo" ) {';
echo '        use_action = "summary_objinfo";';
echo '      }';
echo '      $.getJSON("' . HTTP_BACKEND . '", { action: use_action, store_type: cur_store_type, additional_type: cur_additional_type, colli_uuid: cur_colli_uuid, sector_uuid: cur_sector_uuid, objinfo_uuid: cur_objinfo_uuid } )';
echo '        .done( function ( data ) { ';
echo '          var items = [];';
echo '          var success = false;';
echo '          var text = "";';
echo '          $.each( data, function( key, val ) {';
echo '            if ( ( key == "success" ) && ( val ) ) {';
echo '              success = true;';
echo '            }';
echo '            else if ( key == "text" ) {';
echo '              text = val;';
echo '            }';
echo '          });';
echo '          if ( success ) {';
echo '            $("#show_summary").html(text);';
echo '          }';
echo '        });';
echo '    }';

echo '    $(document).on( "click", ".store_type_item", function() {';
echo '      set_store_type ( $(this).attr("id") );';
echo '    });';
echo '    $(document).on( "touchend", ".store_type_item", function() {';
echo '      set_store_type ( $(this).attr("id") );';
echo '    });';

echo '    $(document).on( "click", ".additional_item", function() {';
echo '      set_additional_type ( $(this).attr("id") );';
echo '    });';
echo '    $(document).on( "touchend", ".additional_item", function() {';
echo '      set_additional_type ( $(this).attr("id") );';
echo '    });';

echo '    $(document).on( "click", "#colli_update", function() {';
echo '      check_colli_uuid ( $("#colli_uuid_field").val() );';
echo '    });';
echo '    $(document).on( "touchend", "#colli_update", function() {';
echo '      check_colli_uuid ( $("#colli_uuid_field").val() );';
echo '    });';

echo '    $(document).on( "click", "#store_update", function() {';
echo '      check_sector_uuid ( $("#sector_uuid_field").val() );';
echo '    });';
echo '    $(document).on( "touchend", "#store_update", function() {';
echo '      check_sector_uuid ( $("#sector_uuid_field").val() );';
echo '    });';

echo '    $(document).on( "click", "#objinfo_update", function() {';
echo '      check_objinfo_uuid ( $("#objinfo_uuid_field").val() );';
echo '    });';
echo '    $(document).on( "touchend", "#objinfo_update", function() {';
echo '      check_objinfo_uuid ( $("#objinfo_uuid_field").val() );';
echo '    });';

echo '    $(":input").keypress(function (e) {';
echo '      if (e.which==13) {'; // enter key pressed
// echo '        if ( $(this).attr("id") == "colli_uuid_field" ) {';
// echo '          check_colli_uuid ( $("#colli_uuid_field").val() );';
// echo '        } else';
echo '        if ( $(this).attr("id") == "sector_uuid_field" ) {';
echo '          check_sector_uuid ( $("#sector_uuid_field").val() );';
echo '        }';
echo '        else if ( $(this).attr("id") == "objinfo_uuid_field" ) {';
echo '          check_objinfo_uuid ( $("#objinfo_uuid_field").val() );';
echo '        }';
echo '      }';
echo '    });';

echo '    $(document).on( "click", ".submit_now", function() {';
echo '      submit ();';
echo '    });';
echo '    $(document).on( "touchend", ".submit_now", function() {';
echo '      submit ();';
echo '    });';

echo '    $(document).on( "click", ".reset_item", function() {';
echo '      reset_ids();';
echo '    });';
echo '    $(document).on( "touchend", ".reset_item", function() {';
echo '      reset_ids();';
echo '    });';

echo '    $(document).on( "click", ".reset_item_success", function() {';
echo '      window.location = "' . HTTP_SERVER . '";';
echo '    });';
echo '    $(document).on( "touchend", ".reset_item_success", function() {';
echo '      window.location = "' . HTTP_SERVER . '";';
echo '    });';

echo '  });';

echo '</script>';

echo '<table border="0" cellspacing="0" cellpadding="0" width="100%">' . "\n";
// echo '<tr>';
// echo '<td class="left_logo" width="100px"><img src="' . HTTP_SERVER . '/images/hsart_logo.png"></td>';
// echo '<tr><td class="left_logo" align="center"><img src="' . HTTP_SERVER . '/images/hsart_logo.png"></td></tr>';

echo '<tr>';

echo '<td align="center"><table border="0" cellspacing="5" cellpadding="0" width="100%">' . "\n";
// echo '<tr><td class="header">ARTSTORE</td></tr>';
echo '<tr><td><table width="60%"><tr>';
echo '<td class="header"><img src="' . HTTP_SERVER . '/images/hsart_logo.png"></td>';
echo '<td class="show_date">' . date("d.m.Y, H:i", strtotime("now")) . '</td>';
echo '</tr></table></td></tr>';
echo '<tr><td class="error_box"></td></tr>';

// select store type

        echo '<tr id="store_type_section"><td class="store_type_section"><table border="0" cellspacing="10" cellpadding="10" width="100%">' . "\n";
        
        echo '<tr><td class="item_header">Vorgang ausw&auml;hlen:</td></tr>';

        foreach ( Core::get_store_types() AS $cur_store_type ) {
                echo '<tr><td class="clickbtn store_type_item" id="store_type_' . $cur_store_type['id'] . '">' . $cur_store_type['name'] . '</td></tr>';
        }
        
        echo '<tr>';
        foreach ( Core::get_additional_selection() AS $cur_add_sel ) {
                echo '<td class="clickbtn additional_item" id="additional_type_' . $cur_add_sel['id'] . '">' . $cur_add_sel['name'] . '</td>';
        }
        echo '</tr>';

        echo '</table></td></tr>' . "\n";
        
// select colli id

        echo '<tr id="colli_section"><td class="colli_section"><table border="0" cellspacing="10" cellpadding="10" width="100%">' . "\n";

        echo '<tr><td class="item_header">Paket scannen:</td></tr>';
//      echo '<tr><td class="colli_item"><input type="text" size="30" value="" id="colli_uuid_field" autocomplete="off"></td></tr>';
        echo '<tr><td class="colli_item"><textarea name="colli_uuid_field" cols="50" rows="10" value="" id="colli_uuid_field"></textarea></td></tr>';
        echo '<tr><td class="clickbtn colli_item" id="colli_update">&Uuml;bernehmen</td></tr>';

        echo '</table></td></tr>' . "\n";
        
// select store id

        echo '<tr id="store_section"><td class="store_section"><table border="0" cellspacing="10" cellpadding="10" width="100%">' . "\n";

        echo '<tr><td class="item_header">Lagerplatz scannen:</td></tr>';
        echo '<tr><td class="store_item"><input type="text" size="30" value="" id="sector_uuid_field" autocomplete="off"></td></tr>';
        echo '<tr><td class="clickbtn store_item" id="store_update">&Uuml;bernehmen</td></tr>';

        echo '</table></td></tr>' . "\n";
        
// select object info

        echo '<tr id="additional_objinfo_section"><td class="additional_objinfo_section"><table border="0" cellspacing="10" cellpadding="10" width="100%">' . "\n";

        echo '<tr><td class="item_header">Objekt scannen:</td></tr>';
        echo '<tr><td class="store_item"><input type="text" size="30" value="" id="objinfo_uuid_field" autocomplete="off"></td></tr>';
        echo '<tr><td class="clickbtn store_item" id="objinfo_update">&Uuml;bernehmen</td></tr>';

        echo '</table></td></tr>' . "\n";
        
        
// show object info

        echo '<tr id="additional_objinfo_show_section"><td class="additional_objinfo_show_section"><table border="0" cellspacing="10" cellpadding="10" width="100%">' . "\n";

        echo '<tr><td class="item_header">Objekt Info:</td></tr>';
//      echo '<tr><td class="store_item"><input type="text" size="30" value="" id="objinfo_uuid_field" autocomplete="off"></td></tr>';
//      echo '<tr><td class="clickbtn store_item" id="objinfo_update">&Uuml;bernehmen</td></tr>';

        echo '</table></td></tr>' . "\n";
        
// submit result

        echo '<tr id="submit_section"><td class="submit_section"><table border="0" cellspacing="10" cellpadding="10" width="100%">' . "\n";

        echo '<tr><td class="item_header_submit">Vorgang abschlie&szlig;en:</td></tr>';
        echo '<tr><td class="success_item" id="show_result">Bitte warten...</td></tr>';
//      echo '<tr><td class="success_item" id="use_store_type"></td></tr>';
//      echo '<tr><td class="success_item" id="use_colli_uuid"></td></tr>';
//      echo '<tr><td class="success_item" id="use_sector_uuid"></td></tr>';
        echo '<tr><td class="clickbtn submit_now">&Uuml;bernehmen</td></tr>';

        echo '</table></td></tr>' . "\n";
        
// success

        echo '<tr id="success_section"><td class="success_section"><table border="0" cellspacing="10" cellpadding="10" width="100%">' . "\n";

        echo '<tr><td class="item_header_success">Vorgang abgeschlossen:</td></tr>';
        echo '<tr><td class="success_item" id="show_result_done">Bitte warten...</td></tr>';
        echo '<tr><td class="clickbtn reset_item_success">zur&uuml;ck zum Start</td></tr>';

        echo '</table></td></tr>' . "\n";
        
// cancel and reset

        echo '<tr id="reset_section"><td class="reset_section"><table border="0" cellspacing="10" cellpadding="10" width="100%">' . "\n";
        echo '<tr><td class="clickbtn reset_item">Abbrechen</td></tr>';
        echo '</table></td></tr>' . "\n";
        
// summary

        echo '<tr id="summary_section"><td class="summary_section"><table border="0" cellspacing="10" cellpadding="10" width="100%">' . "\n";
        echo '<tr><td class="item_header_summary">Aktuelle Auswahl:</td></tr>';
        echo '<tr><td class="summary_item" id="show_summary"></td></tr>';
        echo '</table></td></tr>' . "\n";

echo '</table>' . "\n";
echo '</td></tr>' . "\n";

echo '<tr><td class="footer">' . ( ( $is_mobile ) ? 'MOBILE':'' ) . '</td></tr>';

echo '</table>' . "\n";
///Letze Buchungen 04/2017
?>
<table>
<?php
require_once('Connections/artstore.php');
                          ///Nachsehen, wo Objekt im Lager zu finden ist.....

                                        //$myid = $row_colli['colli_uuid'];
                                        mysql_select_db($database_artstore, $artstore);
                                        $query_location = sprintf("SELECT * from store INNER JOIN sector ON (store.sector_id = sector.sector_id) INNER JOIN colli ON (store.colli_id = colli.colli_id) ORDER BY store_id DESC LIMIT 0,100");
                                        $location = mysql_query($query_location, $artstore) or die(mysql_error());
                                        $row_location = mysql_fetch_assoc($location);
                                        $totalRows_location = mysql_num_rows($location);
                                        //echo $totalRows_location." Lagerbewegungen<BR/>";
                                        if ($totalRows_location > 0){
                                                do{
                                        ?>
      <tr>
        <td class="lagerstatus<?php echo $row_location["store_type"]*2;?>"><?php echo $row_location["store_type"];?></td>
        <td class="lagerstatus<?php echo $row_location["store_type"]*2;?>"><?php echo $row_location["sector_uuid"];?></td>
        <td class="lagerstatus<?php echo $row_location["store_type"]*2;?>"><?php echo $row_location["sector_text1"];?></td>
        <td class="lagerstatus<?php echo $row_location["store_type"]*2;?>"><?php echo $row_location["sector_text2"];?></td>
        <td class="lagerstatus<?php echo $row_location["store_type"]*2;?>"><?php echo $row_location["sector_text3"];?></td>
        <td class="lagerstatus<?php echo $row_location["store_type"]*2;?>"><?php echo $row_location["colli_uuid"];?></td>
        <td class="lagerstatus<?php echo $row_location["store_type"]*2;?>"><?php echo $row_location["store_timestamp"];?></td>
      </tr>
      <?php
                        } while ($row_location = mysql_fetch_assoc($location));
                                        }                                                       
                                else{
                                        echo "Keine Store-Info";
                                }
?>
 </table>
<?php
////
echo '</body>' . "\n";
echo '</html>' . "\n";
?>