Subversion-Projekte lars-tiefland.content-management

Revision

Blame | Letzte Änderung | Log anzeigen | RSS feed

<?php

    /**
     * @package   Kein Projekt geladen
     * @author    Webagentur Niewerth <tiefland@weban.de>
     * @copyright 2012 Webagentur Niewerth
     * @license   propietary http://www.weban.de
     * @version   $Rev: 956 $
     * @filesource
     * 
     */

    /**
     * 
     * @package   Kein Projekt geladen
     * @author    Webagentur Niewerth <tiefland@weban.de>
     * @copyright 2012 Webagentur Niewerth
     */

    // SVN: $Id: getBestellungen.php 956 2012-02-23 08:20:36Z tiefland $

    // deutsche Umgebung
    setlocale( LC_ALL, "de_DE" );
    // Connect-Datei einbinden
    define( "modul_name", "Warenwirtschaft" );
    define( "tool_name", "bestellung" );
    require_once "../Online-Shop/connect2.php";
    $GLOBALS["web_rechte"] = $web_rechte;

    $Bestellungen = getBestellungen( $_SESSION["best_manu.php"]['kunden_id'] );
    require_once "Weban_Smarty.class.php";

    $GLOBALS["ui"] = new Weban_Smarty();
    $GLOBALS["ui"]->assign( "site", $site );
    $GLOBALS["ui"]->compile_dir = $_SERVER["DOCUMENT_ROOT"] . "/templates_c";
    $GLOBALS["ui"]->compile_id = "Warenwirtschaft|best_manu";
    $GLOBALS["ui"]->use_sub_dirs = true;
    $GLOBALS["ui"]->compile_check = true;
    $GLOBALS["ui"]->assign( "bestellungen", $Bestellungen );

    $GLOBALS["ui"]->display("best_manu_bestellungen.tpl");
    function getBestellungen( $login_id )
    {
        $table = "Bestellung b";
        $p_table = "bestellung_paketnummern";
        $sql = "SELECT
                b.ID,
        ";
        if ( isset( $GLOBALS["web_rechte"]["Warenwirtschaft"]["bezahlstatus"]["bezahlstatus"] ) )
        {
            $sql .= "
                    b.bezahlt,
                ";
        }
        if ( isset( $GLOBALS["web_rechte"]["Warenwirtschaft"]["bestellung"]["waehrung"] ) )
        {
            $sql .= "
                    c.locale,
                ";
        }
        $sql .= "
                b.shops_ID,
                b.erstellt_am,
                b.gesamtsumme_buffer
            FROM
        ";
        if ( isset( $GLOBALS["web_rechte"]["Warenwirtschaft"]["bestellung"]["waehrung"] ) )
        {
            $sql .= "
                    currencies c,
                ";
        }
        $sql .= "
                $table
            WHERE
                login=" . $login_id . "
        ";
        if ( isset( $GLOBALS["web_rechte"]["Warenwirtschaft"]["bestellung"]["waehrung"] ) )
        {
            $sql .= "
                    AND
                        c.id=b.currency
                ";
        }
        $sql .= "
            ORDER BY
                erstellt_am DESC
        ";
        $res = mysql_query( $sql );
        if ( $GLOBALS["web_rechte"]["Warenwirtschaft"]["bestellung"]["tracking"] )
        {
            list( $beschreibung, $link ) = explode( ";", $GLOBALS["web_rechte"]["Warenwirtschaft"]["bestellung"]["tracking"] );
        }
        while ( $row = mysql_fetch_assoc( $res ) )
        {
            $sql_p = "SELECT
                    *
                FROM
                    $p_table
                WHERE
                    Bestellung=" . $row["ID"] . "
            ";

            $res_p = mysql_query( $sql_p );
            while ( $row_p = mysql_fetch_assoc( $res_p ) )
            {
                $row["tracking"][] = $link . $row_p["paketnummer"];
                $row["versanddatum"][] = $row_p["datum"];
            }
            $rows[] = $row;
        }
        return $rows;
    }
?>