use_class('products_ean');
use_class('bins');
$class_sp = new jng_sp();
$class_jo = new jng_sp_orders();
$class_ean = new products_ean();
$class_bin = new bins();
$ean_collection = array();
$orders = array();
$orders_barcode = array();
$jng_sp_id = tep_db_prepare_input($_GET['spid']);
$date_filter = tep_db_prepare_input($_GET['datefilter']);
if ($jng_sp_id == '' || $date_filter == '') {
    exit;
}
$sp_detail = $class_sp->retrieveDetail($jng_sp_id);
$amvdsl = loadAMVDsendList($jng_sp_id, $date_filter);
$orders = $amvdsl['orders'];
$orders_data = $amvdsl['orders_data'];
$orders_products = $amvdsl['orders_products'];
class PDF extends PDF_Draw
{
    var $header_date;
    var $printed_po;
    var $current_page;
    //Page header
    function Header()
    {
    }
    //Page footer
    function Footer()
    {
        $content .= '<div class="box ui-corner-all w500">';
        $content .= '<input type="button" id="sscc-print-slip" class="button" value="Download Packing Slip" title="Click here to download packing slip in pdf format" />';
        $content .= '</div>';
        //.box
    } else {
        $content .= '<h3 class="red">Tab Content Not Found</h3>';
    }
    echo utf8_encode($content);
    exit;
}
if (isset($_GET['modext'])) {
    if ($_GET['modext'] == 'raweanlist') {
        $spid = tep_db_prepare_input($_GET['spid']);
        $datefilter = tep_db_prepare_input($_GET['datefilter']);
        $datefilter_sql = generateMysqlDateFromGerman($datefilter);
        $amvdsl = loadAMVDsendList($spid, $datefilter_sql);
        $table = array();
        $row = array();
        $row['date'] = 'Date of delivery';
        $row['oid'] = 'PO Number';
        $row['ean'] = 'EAN';
        $row['asin'] = 'ASIN';
        $row['name'] = 'Title';
        $row['qty'] = 'Quantity';
        $row['cost'] = 'Cost / Product';
        $row['total'] = 'Total Cost';
        $table[] = $row;
        foreach ($amvdsl['orders'] as $oid) {
            foreach ($amvdsl['orders_products'][$oid] as $ean => $op) {
                $row = array();
                $row['date'] = $datefilter;