#format return label >> date;number;orderseq;nametag;kunde;auftragsnr;lieferscheinnr;qty;artikel
             $label_date = $day . ". " . $month;
             $label_order_seq = $order_item_count . "/" . $order_item_total;
             $label_cust_name = $orders["delivery_name"];
             $label_numtag = "JG";
             $label_auftragsnr = $order_no == '' ? "-" : $order_no;
             $label_lieferscheinnr = '';
             $return_label = $label_date . ";" . $daily_count . ";" . $label_order_seq . ";" . $label_numtag . ";" . $label_cust_name;
             $return_label .= ";" . $label_auftragsnr . ";" . $label_lieferscheinnr . ";" . $order_qty . ";" . $article_number;
             echo $return_label;
             break;
     }
     break;
 case 'sp':
     use_class('jng_sp_orders');
     $o_jngspo = new jng_sp_orders();
     $oi = $o_jngspo->retrieveItemDetail($reqid);
     #header("Content-Type: text/plain; charset=utf-8");
     switch ($barcodetype) {
         case 'code39':
             use_class('jng_sp');
             $o_jngsp = new jng_sp();
             #table jng_sp_orders_items
             $oi_o_id = $oi["jng_sp_orders_id"];
             $oi_order_qty = $oi["order_qty"];
             $oi_article_number = $oi["article_number"];
             $oi_order_item_count = $oi["order_item_count"];
             $oi_order_item_total = $oi["order_item_total"];
             #table jng_sp_orders
             $o = $o_jngspo->retrieveDetail($oi_o_id);
             $o_order_no = $o["order_id"];
<?php

ini_set('memory_limit', '128M');
set_time_limit(0);
global $db;
require_once '../confy.php';
require_once '../functions.php';
require_once '../functions-2.php';
require_once DIR_WS_FUNCTIONS . 'html_output.php';
tep_db_connect();
$jng_sp_id = '5';
//NEW PROCESS WITH NEW CALC METHOD
use_class('jng_sp_orders');
$class_jo = new jng_sp_orders();
$orders_query = tep_db_query("SELECT jng_sp_orders_id FROM jng_sp_orders WHERE jng_sp_id={$jng_sp_id}");
$orders_count = 0;
while ($row = tep_db_fetch_array($orders_query)) {
    $orders_count++;
    $dataArray = $class_jo->calculateAnalysisData($row['jng_sp_orders_id']);
    $class_jo->saveAnalysisData($dataArray);
}
echo "{$orders_count} Order(s) are Processed";
echo '<br />';
//OLD PROCESS WITH OLD CALC METHOD
use_class('jng_sp_catalog');
$class_jc = new jng_sp_catalog();
$joi = array();
$joi_query = "SELECT joi.*";
$joi_query .= " FROM jng_sp_orders jo";
$joi_query .= " INNER JOIN jng_sp_orders_items joi ON joi.jng_sp_orders_id=jo.jng_sp_orders_id";
$joi_query .= " WHERE jo.jng_sp_id={$jng_sp_id}";
ini_set('memory_limit', '256M');
set_time_limit(0);
$mt_start = microtime();
global $db;
require_once '../confy.php';
require_once '../functions.php';
require_once '../functions-2.php';
tep_db_connect();
use_class('logger');
$logger = new logger('cron', 'daily-counter');
use_class('jng_sp');
use_class('jng_sp_orders');
use_class('jng_sp_catalog');
$class_sp = new jng_sp();
$class_jo = new jng_sp_orders();
$class_jc = new jng_sp_catalog();
$sp_data = $class_sp->retrieveList();
//////////////////////////////
// SP PRODUCTS SOLD COUNTER //
//////////////////////////////
$logger->write('1 - Product Sold Counter');
//TODO: The calculation is still based on jng_sp_catalog, which means SP with no
//catalog (like buyvip/retails) will not be included in this calculation!
foreach ($sp_data as $sp_list) {
    $class_jo->productsSoldCounter($sp_list['jng_sp_id']);
}
unset($sp);
/* WE STOP CALCULATING VC USING OLD METHOD
 * NEW VC CALCULATION IS NOT IN ORDER BASED, BUT IN SP BASED
///////////////////////
Beispiel #4
0
    			$("td.date").attr("title", "Click to filter by this date");
    			$("td.date").click(function() {
    				var date = $(this).find("input[name=date]:hidden").val();
    				$("input[name=begin_text]").val(date);
    				$("input[name=end_text]").val(date);
    				com_filter.submit();
    			});
    		});
    	';
    */
} else {
    use_class('jng_sp');
    use_class('jng_sp_orders');
    use_class('orders');
    $class_sp = new jng_sp();
    $class_jo = new jng_sp_orders();
    $class_o = new orders();
    $class_do = new depot_orders();
    //use_class('minierp_todos');
    //$class_td = new minierp_todos();
    //AJAX LOADING
    if (isset($_GET['week-sum']) && $_GET['week-sum'] != '') {
        $weekly_days = 7;
        $weekly_sum = array();
        $periods = array();
        $result = '';
        //QUERY WEEKLY SUMMARY
        $weekly_sum_date = array();
        if ($_GET['week-sum'] == 'JNGAK') {
            $statusName = $class_o->productStatusName();
            $statusGet = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 11);
         //			}
         $log_total_ged = $class_ml->retrieveContentsTotal($logistic_id, 'GED');
         $log_total_dhl = $class_ml->retrieveContentsTotal($logistic_id, 'DHL', $use_cogs);
     }
     $result .= '<input type="hidden" id="log_value_ged_hidden" value="' . displayCurrency('EUR', $log_total_ged) . '" />';
     $result .= '<input type="hidden" id="log_value_dhl_hidden" value="' . displayCurrency('EUR', $log_total_dhl) . '" />';
     echo utf8_encode($result);
 } elseif ($_POST['me_action'] == 'SETSENT') {
     $logistic_id = tep_db_prepare_input($_POST['logistic_id']);
     $packages = $class_ml->retrievePackages($logistic_id, true);
     foreach ($packages as $type => $pack) {
         if ($type == 'P') {
             use_class('jng_sp_packages');
             $class_jp = new jng_sp_packages();
             use_class('jng_sp_orders');
             $class_jo = new jng_sp_orders();
             foreach ($pack as $p) {
                 $items = $class_jp->sendPackage($p['packages_id']);
                 foreach ($items as $items_id) {
                     $class_jo->updateItemStatus($items_id, '7', $session_userinfo['username']);
                 }
             }
         } elseif ($type == 'J') {
             use_class('minierp_packages');
             $class_mp = new minierp_packages();
             use_class('orders');
             $class_o = new orders();
             foreach ($pack as $p) {
                 $items = $class_mp->sendPackage($p['packages_id']);
                 foreach ($items as $items_id) {
                     $class_o->updateProductStatus($items_id, '7', $session_userinfo['username']);
$item_id = tep_db_prepare_input($_POST['item_id']);
$status_current = tep_db_prepare_input($_POST['status_current']);
$status_new = tep_db_prepare_input($_POST['status_new']);
$user_name = tep_db_prepare_input($_POST['user_name']);
$at_machine = tep_db_prepare_input($_POST['at_machine']);
//$order_type = tep_db_prepare_input($_GET['order_type']);
//$item_id = tep_db_prepare_input($_GET['item_id']);
//$status_current = tep_db_prepare_input($_GET['status_current']);
//$status_new = tep_db_prepare_input($_GET['status_new']);
//$user_name = tep_db_prepare_input($_GET['user_name']);
//$at_machine = tep_db_prepare_input($_GET['at_machine']);
use_class('depot_orders');
use_class('jng_sp_orders');
use_class('orders');
$class_do = new depot_orders();
$class_jo = new jng_sp_orders();
$class_o = new orders();
$status_name = statusNameShort();
$order_types = array('SP', 'JG', 'DP');
function oiErrorStatus($item_status)
{
    //STATUS MISMATCH HANDLER
    global $order_type, $item_id, $status_current, $status_new, $user_name, $class_do, $class_jo, $class_o, $status_name;
    $result = '';
    $add_info = '';
    if ($item_status == 'OUTSOURCING-2-PRODUCTION') {
        $result = 'ERROR: Outsourcing Orders, can not set to Production!';
    } else {
        //error when set to production
        if ($item_status == 4 || $status_current == 3 && $status_new == 4 || !is_numeric($status_new)) {
            //get additional information to be displayed on MC error message
$logger = new logger('cron', 'tradebyte-orders-downloader');
use_class('Order');
use_class('tradebyte');
use_class('xml_tools');
use_class('products_ean');
use_class('jng_sp');
use_class('jng_sp_download');
use_class('jng_sp_orders');
use_class('jng_sp_customers');
use_class('logger');
$tb = new tradebyte();
$xmlt = new xml_tools();
$class_ean = new products_ean();
$class_sp = new jng_sp();
$class_jd = new jng_sp_download();
$class_jo = new jng_sp_orders();
$class_jcust = new jng_sp_customers();
$zade_prepayment_need_refreshed = false;
function logThis($logdata)
{
    global $logger;
    $logger->write($logdata);
    echo "{$logdata}<br />\n";
}
/////////////////////////////
// STEP 1: DOWNLOAD ORDERS //
/////////////////////////////
logThis('STEP 1: DOWNLOAD ORDERS');
//$tb->connect('NONSSL');
//$files = $tb->downloadFromDir(SP_TRADEBYTE_FTP_OUT_PATH, SP_TRADEBYTE_DOWNLOAD_ORDERS_PATH);
$tb->connect();
 $refill_requirement = $backlog < $backlog_limit_refill;
 $duration_hold_not_zalando_orders = intval($open_orders_config['stock-delay-non-zalando']);
 //in minutes
 $duration_hold_not_zalando_orders = $duration_hold_not_zalando_orders * 60;
 //change to seconds
 use_class('orders');
 use_class('depot_orders');
 use_class('jng_sp_orders');
 use_class('products_minierp');
 use_class('elements_stock');
 use_class('products_ean');
 use_class('element');
 use_class('stock_booking');
 $class_o = new orders();
 $class_do = new depot_orders();
 $class_jo = new jng_sp_orders();
 $class_pm = new products_minierp();
 $class_es = new elements_stock();
 $class_ean = new products_ean();
 $elements_collection = array();
 $temp_order_date = array();
 $temp_jng_sp_id = array();
 $temp_import_timestamp = array();
 $otto_prepayment = strtoupper(PAYMENT_METHOD_PREPAYMENT);
 $oi_status_to_reset_stock_status = array('1', '2');
 //CLEAR IDLE BINS
 use_class('bins');
 $class_bin = new bins();
 $class_bin->clearIdleBins();
 //INIT FULL ORDERS VARIABLE
 $orders = array();
function getOrderDetail($barcode = '', $idcode_ret = '')
{
    //die("$barcode | $idcode_ret");
    $result = array();
    $result['status'] = 'MCORDERNOTFOUND';
    use_class('jng_sp');
    use_class('jng_sp_orders');
    if ($barcode != '') {
        list($type, $order_product_id) = split('-', strtoupper($barcode));
        //GET order_id
        $order_id = '';
        if ($type == 'SP' || $type == 'JR') {
            $status = 'MCSCANPRODUCT';
            use_class('jng_sp_customers');
            $class_sp = new jng_sp();
            $class_jo = new jng_sp_orders();
            $class_jc = new jng_sp_customers();
            $item = $class_jo->retrieveItemDetail($order_product_id);
            $order_id = $item['jng_sp_orders_id'];
            $order = $class_jo->retrieveDetail($order_id);
            if (count($order) > 0) {
                $sp = $class_sp->retrieveDetail($order['jng_sp_id']);
                $customer = $class_jc->retrieveDetail(null, $order['jng_sp_id'], $order['customer_billing_id']);
                $customer_name = $order['customer_billing_firstname'] . ' ' . $order['customer_billing_lastname'];
                $customers_street_address = $order['customer_billing_address'] . ' ' . $order['customer_billing_address2'];
                $order_type = $sp['name'] . ' Order ' . $order['order_id'];
                $result = setOrderResult($status, 'S', $order_id, $order_type, $customer['jng_sp_customers_id'], $customer_name, $order['customer_billing_email'], $order['customer_billing_phone'], $customers_street_address, $order['customer_billing_postcode'], $order['customer_billing_city'], $order['customer_billing_country']);
            }
        } elseif ($type == 'JG') {
            $status = 'MCSCANPRODUCT';
            use_class('orders');
            $class_o = new orders();
            $item = $class_o->retrieveProductDetail($order_product_id);
            $order_id = $item['orders_id'];
            $order = $class_o->retrieveDetail($order_id);
            if (count($order) > 0) {
                $order_type = 'J&G Order ' . $order['orders_no'];
                $result = setOrderResult($status, 'J', $order_id, $order_type, $order['customers_id'], $order['customers_name'], $order['customers_email_address'], $order['customers_telephone'], $order['customers_street_address'], $order['customers_postcode'], $order['customers_city'], $order['customers_country']);
            }
        }
    } elseif ($idcode_ret != '') {
        //1 idcode_ret utk 1 order
        $qsp = "SELECT j.name AS sp_name, jo.* FROM jng_sp_orders jo INNER JOIN jng_sp j ON j.jng_sp_id = jo.jng_sp_id";
        $qsp .= " WHERE idcode_ret = '{$idcode_ret}' ORDER BY jo.order_date DESC LIMIT 1";
        $rsp = tep_db_query($qsp);
        $dsp = tep_db_num_rows($rsp) > 0 ? tep_db_fetch_array($rsp) : null;
        if (is_null($dsp)) {
            /* 12.05.2015: 
             * If not found, try to search using order number.
             * So far at this time, returns from LZ.ID, ZR.ID, ZR.BR used order number barcode
             */
            $qsp = "SELECT j.name AS sp_name, jo.* FROM jng_sp_orders jo INNER JOIN jng_sp j ON j.jng_sp_id = jo.jng_sp_id";
            $qsp .= " WHERE jo.order_id = '{$idcode_ret}' ORDER BY jo.order_date DESC LIMIT 1";
            $rsp = tep_db_query($qsp);
            $dsp = tep_db_num_rows($rsp) > 0 ? tep_db_fetch_array($rsp) : null;
        }
        $qjg = "SELECT * FROM orders WHERE idcode_ret='{$idcode_ret}' ORDER BY date_purchased DESC  LIMIT 1";
        $rjg = tep_db_query($qjg);
        $djg = tep_db_num_rows($rjg) > 0 ? tep_db_fetch_array($rjg) : null;
        if (!is_null($dsp) || !is_null($djg)) {
            $status = 'MCSCANPRODUCT';
            if (!is_null($dsp) && !is_null($djg)) {
                $dsp_time = strtotime($dsp['order_date']);
                $djg_time = strtotime($djg['date_purchased']);
                $use_data = $dsp_time >= $djg_time ? 'sp' : 'jg';
            } else {
                $use_data = !is_null($dsp) ? 'sp' : 'jg';
            }
            if ($use_data == 'sp') {
                $order_id = $dsp['jng_sp_orders_id'];
                use_class('jng_sp_customers');
                $class_jc = new jng_sp_customers();
                $customer = $class_jc->retrieveDetail(null, $dsp['jng_sp_id'], $dsp['customer_billing_id']);
                $customer_name = $dsp['customer_billing_firstname'] . ' ' . $dsp['customer_billing_lastname'];
                $customers_street_address = $dsp['customer_billing_address'] . ' ' . $dsp['customer_billing_address2'];
                $order_type = $dsp['sp_name'] . ' Order ' . $dsp['order_id'];
                $result = setOrderResult($status, 'S', $order_id, $order_type, $customer['jng_sp_customers_id'], $customer_name, $dsp['customer_billing_email'], $dsp['customer_billing_phone'], $customers_street_address, $dsp['customer_billing_postcode'], $dsp['customer_billing_city'], $dsp['customer_billing_country']);
            } else {
                $order_id = $djg['orders_id'];
                $order_type = 'J&G Order ' . $djg['orders_no'];
                $result = setOrderResult($status, 'J', $order_id, $order_type, $djg['customers_id'], $djg['customers_name'], $djg['customers_email_address'], $djg['customers_telephone'], $djg['customers_street_address'], $djg['customers_postcode'], $djg['customers_city'], $djg['customers_country']);
            }
        }
    }
    return $result;
}
        }
    }
} elseif (isset($_GET['opid']) && $_GET['opid'] != '') {
    if ($method == '') {
        use_class('jng_sp_orders');
        use_class('orders');
        use_class('depot_orders');
        use_class('production_instruction_pdf');
        $class_pi = new production_instruction_pdf();
        $opids = explode(',', $_GET['opid']);
        foreach ($opids as $opid) {
            $type = strtoupper($type);
            $orders = array();
            $orders_id = '';
            if ($type == 'SP') {
                $class_jo = new jng_sp_orders();
                $orders = $class_jo->retrieveItemDetail($opid);
                $orders_id = $orders['jng_sp_orders_id'];
            } elseif ($type == 'JG') {
                $class_o = new orders();
                $orders = $class_o->retrieveProductDetail($opid);
                $orders_id = $orders['orders_id'];
            } elseif ($type == 'DP') {
                $class_do = new depot_orders();
                $orders_id = $opid;
            }
            $class_pi->addOrder($type, $orders_id);
        }
        $class_pi->createPDF(false, $output_type);
    } else {
        use_class('production_instruction');
Beispiel #11
0
<?php

//AJAX ACTION
use_class('orders');
use_class('depot_orders');
use_class('jng_sp');
use_class('jng_sp_orders');
use_class('jng_sp_packages');
use_class('minierp_packages');
use_class('products_ean');
use_class('bins');
$class_o = new orders();
$class_do = new depot_orders();
$class_sp = new jng_sp();
$class_jo = new jng_sp_orders();
$class_jp = new jng_sp_packages();
$class_mp = new minierp_packages();
$class_ean = new products_ean();
$class_bins = new bins();
$item_status = statusName();
define('EAN_MISMATCH_ERROR', 'EANMISMATCH');
$waiting_box_name = 'Waiting Box';
$packing_box_name = 'Packing Box';
$finish_box_name = 'Finish Box';
$order_show_sp_info = array('9');
//am.fr
function printPackageTip($type, $no, $info = '', $spname = '', $spclass = '')
{
    global $waiting_box_name, $packing_box_name;
    if ($type == EAN_MISMATCH_ERROR) {
        $result = '<div class="package-tip red-bright">';
<?php

//PRINT INVOICE OF DELIVERY DOCUMENTS FOR ORDERS IN AN AM.VD & BuyVIP PACKAGE
global $db;
require_once '../confy.php';
require_once '../functions.php';
require_once '../functions-2.php';
tep_db_connect();
define('FPDF_IMGPATH', DIR_WS_IMAGES . 'pdf/');
define('FPDF_FONTPATH', FPDF_IMGPATH . 'fonts/');
require_once DIR_WS_CLASSES . 'fpdf.php';
use_class('jng_sp');
$class_sp = new jng_sp();
use_class('jng_sp_orders');
$class_jo = new jng_sp_orders();
use_class('products_ean');
$class_ean = new products_ean();
use_class('bins');
$class_bin = new bins();
$ean_collection = array();
$orders = array();
$orders_barcode = array();
$inhh_status = '8';
$oi_printed_sp = array();
$total_products_picked = 0;
$bin_location_qty_collection = array();
$jng_sp_id = '5';
//9 for am.fr
if (isset($_GET['spid'])) {
    $jng_sp_id = tep_db_prepare_input($_GET['spid']);
}
Beispiel #13
0
 function createReturnContainerSP($return_id, $return_qty, $joi_id)
 {
     use_class('Order');
     use_class('jng_sp_orders');
     use_class('jng_sp_customers');
     use_class('payone_invoice');
     $class_jcust = new jng_sp_customers();
     $class_jo = new jng_sp_orders();
     $item = $class_jo->retrieveItemDetail($joi_id);
     $oid = $item['jng_sp_orders_id'];
     $order_obj = new Order(Order::ORDER_TYPE_SALES_PARTNER, $oid);
     $order = $class_jo->retrieveDetail($oid);
     if ($order_obj->isPaymentHandledByPayone()) {
         $invoice = new payone_invoice('invoice_order_type', 'S', "invoice_order_id={$oid}");
         //ONLY QUEING JUST FOR TRANSACTION THAT HAVE payone_txid (FIRST GET FROM SUBMITTING INVOICE)
         if ($invoice->detail['payone_txid'] != '') {
             $payone_txid = $invoice->detail['payone_txid'];
             $payment_method = $order_obj->getPaymentMethodRaw();
             $customer = $class_jcust->retrieveDetail(null, $order_obj->sales_partner_id, $order_obj->customer_id);
             $customer_bankdata = $class_jcust->getBankAccountData($customer['jng_sp_customers_id']);
             $data_por = array();
             $data_por['return_id'] = $return_id;
             $data_por['jng_sp_orders_items_id'] = $joi_id;
             $data_por['jng_sp_customers_id'] = $customer['jng_sp_customers_id'];
             $data_por['amount'] = round($return_qty * ($item['price'] * 100));
             $data_por['txid'] = $payone_txid;
             $data_por['invoice_id'] = $invoice->detail['invoice_id'];
             $data_por['invoice_no'] = $invoice->detail['invoice_no'];
             $data_por['id'] = $item['article_number'];
             $data_por['pr'] = round($item['price'] * 100);
             $data_por['no'] = $return_qty;
             $data_por['de'] = strlen($item['billing_text']) > 32 ? substr($item['billing_text'], 0, 32) : $item['billing_text'];
             $data_por['va'] = 0;
             $data_por['payment_method'] = $payment_method;
             $data_por['currency'] = 'EUR';
             if (!is_null($customer_bankdata)) {
                 $data_por['bankcode'] = $customer_bankdata['bank_code'];
                 $data_por['bankcountry'] = $customer_bankdata['bank_country'];
                 $data_por['bankaccount'] = $customer_bankdata['bank_account_number'];
                 $data_por['bankaccountholder'] = $customer_bankdata['bank_account_holder'];
             }
             $this->payoneReturnItemContainer($data_por);
             $items_total = $order_obj->getTotalItemsNotCanceledQuantity();
             $returns_total = $order_obj->getTotalItemsReturnedQuantity();
             if ($items_total == $returns_total) {
                 $amount_paid = $invoice->detail['invoice_amount_paid'];
                 $shipping_cost = $order_obj->getCostShipping();
                 $cod_cost = $order_obj->getCostCOD();
                 $total_costs = $shipping_cost + $cod_cost;
                 if ($shipping_cost > 0) {
                     //if((($amount_paid*1)==0)||(($amount_paid<>$shipping_cost)&&($amount_paid<>$total_costs))){
                     if ($amount_paid * 1 == 0 || $amount_paid > $total_costs) {
                         //HANDLE DOUBLE OR MORE SHIPING RETURN CONTAINER
                         $q_check = "SELECT * FROM payone_orders_return WHERE txid = '{$payone_txid}' AND id = 'Shipping'";
                         $dbc = tep_db_query($q_check);
                         if (tep_db_num_rows($dbc) == 0) {
                             $amount = round($shipping_cost * 100);
                             $data_por = array();
                             $data_por['return_id'] = 0;
                             $data_por['jng_sp_orders_items_id'] = 0;
                             $data_por['jng_sp_customers_id'] = $customer['jng_sp_customers_id'];
                             $data_por['amount'] = $amount;
                             $data_por['txid'] = $payone_txid;
                             $data_por['invoice_id'] = $invoice->detail['invoice_id'];
                             $data_por['invoice_no'] = $invoice->detail['invoice_no'];
                             $data_por['id'] = 'Shipping';
                             $data_por['pr'] = $amount;
                             $data_por['no'] = 1;
                             $data_por['de'] = 'Verpackung & Versand';
                             $data_por['va'] = 0;
                             $data_por['payment_method'] = $payment_method;
                             $data_por['currency'] = 'EUR';
                             $this->payoneReturnItemContainer($data_por);
                         }
                     }
                 }
                 if ($cod_cost > 0) {
                     //if((($amount_paid==0*1))||(($amount_paid<>$cod_cost)&&($amount_paid<>$total_costs))){
                     if ($amount_paid * 1 == 0 || $amount_paid > $total_costs) {
                         $amount = round($cod_cost * 100);
                         $data_por = array();
                         $data_por['return_id'] = 0;
                         $data_por['jng_sp_orders_items_id'] = 0;
                         $data_por['jng_sp_customers_id'] = $customer['jng_sp_customers_id'];
                         $data_por['amount'] = $amount;
                         $data_por['txid'] = $payone_txid;
                         $data_por['invoice_id'] = $invoice->detail['invoice_id'];
                         $data_por['invoice_no'] = $invoice->detail['invoice_no'];
                         $data_por['id'] = 'COD';
                         $data_por['pr'] = $amount;
                         $data_por['no'] = 1;
                         $data_por['de'] = 'Nachnahmegebühren';
                         $data_por['va'] = 0;
                         $data_por['payment_method'] = $payment_method;
                         $data_por['currency'] = 'EUR';
                         $this->payoneReturnItemContainer($data_por);
                     }
                 }
             }
         } else {
             //ORDER NOT SUBMITTED YET TO PAYONE, SO NO TXID CREATED YET. JUST NEED TO EXCLUDE ITEM FROM payone_invoice TABLE COLUMN 'invoice_order_items_id'
             $oids_arr = explode(',', $invoice->detail['invoice_order_items_id']);
             if (is_array($oids_arr)) {
                 $new_amount = $invoice->detail['invoice_amount'] - $return_qty * $item['price'];
                 foreach ($oids_arr as $key => $value) {
                     if ($value == $joi_id) {
                         unset($oids_arr[$key]);
                     }
                 }
                 $oids = implode(',', $oids_arr);
                 if (count($oids_arr) == 0) {
                     //ALL PRODUCTS RETURNED
                     $new_amount = 0;
                     $invoice->updateCompleteStatus('3');
                     //INVOICE CANCELLED
                 }
                 tep_db_perform('payone_invoice', array('invoice_amount' => $new_amount, 'invoice_order_items_id' => $oids), 'update', "invoice_id = '" . $invoice->detail['invoice_id'] . "'");
             }
         }
     }
 }
tep_db_connect();
use_class('logger');
$logger = new logger('cron', 'sp-2-orders-confirmer');
$timestamp = date('Y-m-d H:i:s');
$RUNTIME = array('10', '40');
//Cron will be processed only on minute $RUNTIME
//10 and 40 because we download new orders every 00 and 30
//so in minutes 10 and 40 we will confirm the orders
if (in_array(date('i'), $RUNTIME)) {
    use_class('jng_sp');
    use_class('jng_sp_upload');
    use_class('jng_sp_orders');
    use_class('products_ean');
    $class_sp = new jng_sp();
    $class_ju = new jng_sp_upload();
    $class_jo = new jng_sp_orders();
    $class_ean = new products_ean();
    $jng_sp_active = $class_sp->retrieveList("active_status=1");
    $logger->write("Task 1 (CHECK UNCONFIRMED ORDERS) - Start");
    foreach ($jng_sp_active as $temp_sp) {
        $jng_sp_id = $temp_sp['jng_sp_id'];
        $jng_sp_name = $temp_sp['name'];
        $orders = $class_jo->getUnconfirmedOrders($jng_sp_id);
        if (count($orders) == 0) {
            $logger->write("There is no new order to confirm");
        } else {
            switch ($jng_sp_id) {
                case '2':
                    $need_jms_upload = false;
                    $orders_confirmed = 0;
                    //1 XML FILE PER ORDER
<?php

use_class('jng_sp');
$class_sp = new jng_sp();
$all_sp = $class_sp->retrieveList();
use_class('jng_sp_download');
$class_jd = new jng_sp_download();
use_class('jng_sp_orders');
$class_jo = new jng_sp_orders();
use_class('jng_sp_customers');
$class_jcust = new jng_sp_customers();
use_class('jng_sp_orders_xml');
$total_orders_created = 0;
$daily_counter = array();
foreach ($all_sp as $sp_detail) {
    //initial setting
    $files_imported = 0;
    $orders_created = 0;
    $products_created = 0;
    $jng_sp_id = $sp_detail["jng_sp_id"];
    $jng_sp_name = $sp_detail["name"];
    $process_status = array('1' => 'D', '2' => 'R', '3' => 'R', '4' => 'R', '5' => 'R');
    $xmlwithgpg = array('1');
    if (array_key_exists($jng_sp_id, $process_status)) {
        $sp_detail = $class_sp->retrieveDetail($jng_sp_id);
        $jng_sp_id_with_no_external_xml_class = array('2', '4', '5');
        if (!in_array($jng_sp_id, $jng_sp_id_with_no_external_xml_class)) {
            use_class('jng_sp_orders_xml_' . $jng_sp_id);
        }
        switch ($jng_sp_id) {
            case '1':
Beispiel #16
0
 $is_prioritized = $r['priority'] == 1 || checkCustomerIsVIP($type, $oid) || in_array($sp_id, $sp_using_red_paper) || in_array($brand_id, $brand_using_red_paper);
 $key = "{$type}|{$oiid}";
 $ok_print = false;
 if ($type == 'SP' || $type == 'JG') {
     /*Disabled this, since all orders that goes to ready will directly printed
       //ignore printing pdf for this order if there item that still on cancel request. 
       $ok_print = (!orderItemHaveStatus($oid, 10, $type));
        */
     $ok_print = true;
 } elseif ($type == 'DP') {
     use_class('depot_orders');
     $class_do = new depot_orders();
     $do = $class_do->retrieveDetail($oid);
     if ($do['trans_type'] == 'SP') {
         use_class('jng_sp_orders');
         $class_jo = new jng_sp_orders();
         $oiid = $do['trans_id'];
         $i = $class_jo->retrieveItemDetail($oiid);
         $oid = $i['jng_sp_orders_id'];
         $o = $class_jo->retrieveDetail($oid);
         $sp_id = "{$o['jng_sp_id']}";
     } elseif ($do['trans_type'] == 'JG') {
         $sp_id = '0';
     }
     $is_prioritized = $do['trans_type'] == 'AR' && $do['trans_id'] == depot_orders::AUTO_REFILL_ID_ZALANDO || $is_prioritized || in_array($sp_id, $sp_using_red_paper);
     $ok_print = true;
 }
 if ($ok_print) {
     if ($is_prioritized && !(isset($queue_r[$pid]) && in_array($key, $queue_r[$pid]))) {
         $queue_r[$pid][] = $key;
     } else {
 * This module used to send message (confirmer of orders) to tradebyte
 * @author IT TEAM BONOFACTUM
 * @created Jun 10, 2013 10:00:44 AM 
 */
global $db;
require_once '../confy.php';
require_once '../functions.php';
require_once '../functions-2.php';
tep_db_connect();
use_class('logger');
$logger = new logger('cron', 'tradebyte-message-sender');
use_class('jng_sp');
use_class('jng_sp_orders');
use_class('tradebyte');
use_class('xml_tools');
$class_jo = new jng_sp_orders();
$class_sp = new jng_sp();
$message_id_counter = 0;
$message_id_prefix = date('ymdHis');
function constructMessage(&$xmlt, $msg_data, $type, $xml_messages_list)
{
    global $message_id_prefix, $message_id_counter;
    $message_id_counter++;
    $timestamp = time();
    $date_created = tradebyte::getDateFormat($timestamp);
    $xml_message = $xmlt->drawTag($xml_messages_list, 'MESSAGE');
    $xmlt->drawTag($xml_message, 'MESSAGE_ID', $message_id_prefix . $message_id_counter);
    $xmlt->drawTag($xml_message, 'MESSAGE_TYPE', tradebyte::getMessageType($type));
    $xmlt->drawTag($xml_message, 'TB_ORDER_ID', $msg_data['tb_order_id']);
    $xmlt->drawTag($xml_message, 'TB_ORDER_ITEM_ID', $msg_data['tb_order_item_id']);
    $xmlt->drawTag($xml_message, 'SKU', $msg_data['sku']);
global $db;
require_once '../confy.php';
require_once '../functions.php';
require_once '../functions-2.php';
tep_db_connect();
use_class('payone/financegateConnect');
use_class('jng_sp');
use_class('jng_sp_orders');
use_class('orders');
use_class('jng_sp_customers');
use_class('payone');
use_class('payone_invoice');
use_class('payone_logger');
use_class('minierp_customers');
$class_sp = new jng_sp();
$class_jo = new jng_sp_orders();
$class_o = new orders();
$class_jcust = new jng_sp_customers();
$class_cust = new minierp_customers();
$class_payone = new payone();
$payi = new payone_invoice();
$pi_gift_create = array();
$cut_off_orders_id = 20363;
$pi_gift_counter = 0;
$process_method = 'authorization';
$sets_of_invoice = $class_payone->retrieveList("invoice_complete_status = 'R' AND invoice_id = 139163");
//$sets_of_invoice =  $class_payone->retrieveList("invoice_id = 48");
//echo "<pre>";var_dump($sets_of_invoice);die();
$counter = 0;
if (count($sets_of_invoice) > 0) {
    $success = array();
<?php

use_class('payone/financegateConnect');
use_class('jng_sp');
use_class('jng_sp_orders');
use_class('jng_sp_customers');
use_class('payone');
use_class('payone_invoice');
use_class('payone_logger');
$class_sp = new jng_sp();
$class_jo = new jng_sp_orders();
$class_jcust = new jng_sp_customers();
$class_payone = new payone();
//SP SETTING
salesPartnerCombo();
//AJAX ACTION
if (isset($_POST['me_action'])) {
    if ($_POST['me_action'] == 'LOADUNSUBMITTEDORDERS') {
        $orders = $class_payone->newSPorders($jng_sp_id);
        $result = $class_payone->drawListTable($orders);
    } elseif ($_POST['me_action'] == 'AUTHORIZATION') {
        $process_method = 'authorization';
        $order_id = tep_db_prepare_input($_POST['orders_id']);
        $order = $class_jo->retrieveDetail($order_id);
        $items = $class_jo->retrieveItems($order_id);
        $cust = $class_jcust->retrieveDetail(null, $order['jng_sp_id'], $order['customer_billing_id']);
        foreach ($items as $key => $i) {
            if ($class_jo->statusIsCancelled($i['status'])) {
                unset($items[$key]);
            }
        }
<?php

global $db;
require_once '../confy.php';
require_once '../functions.php';
require_once '../functions-2.php';
tep_db_connect();
use_class('orders');
$class_o = new orders();
use_class('jng_sp_orders');
$class_jo = new jng_sp_orders();
$REQUIRED_STATUS = '7';
$UPDATED_STATUS = '9';
$username = tep_db_prepare_input($_POST['user']);
$reference = explode('|', $_POST['reference']);
$date = explode('|', $_POST['date']);
$cancel = explode('|', $_POST['cancel']);
$idcs = explode('|', $_POST['idcode_ship']);
$idcr = explode('|', $_POST['idcode_ret']);
$update_counter = array();
foreach ($reference as $i => $ref) {
    $shipment_id = $ref;
    $shipment_date = $date[$i];
    $cancel_status = $cancel[$i];
    $idcode_ship = $idcs[$i];
    $idcode_ret = $idcr[$i];
    if ($shipment_id != '') {
        if (substr($ref, 0, 2) == 'JG') {
            $order_id = substr($ref, 2);
            $idcounter = 'JG' . $order_id;
            $items = $class_o->retrieveProducts($order_id);
$eanlist[]='4050878314194';
$eanlist[]='4050878342357';
$eanlist[]='4050878126858';
$eanlist[]='4050878373382';
$eanlist[]='4050878456580';
$eanlist[]='4050878469740';
$eanlist[]='4050878047429';
$eanlist[]='4050878145514';
*/
$sp_specsets = load_config('sp-specific-settings');
use_class('products_ean');
use_class('products_minierp');
use_class('jng_sp_orders');
$class_pe = new products_ean();
$class_pm = new products_minierp();
$class_jo = new jng_sp_orders();
$ean_pid = array();
$orders = array();
$products = array();
foreach ($eanlist as $ean) {
    $p_info = $class_pe->getProductArticle($ean);
    $pid = $p_info['products_id'];
    $ean_pid[$ean] = $pid;
    if (!isset($products[$pid])) {
        $pdata = $class_pm->retrieveDetail($pid, 'sp');
        $products[$pid] = $pdata['sp']['5'];
    }
}
$ean_detail_info = $class_jo->getAMVD_AutoCancelSupportingData($ean_pid);
echo "<table id='ean_table' border='1'>";
echo "<tr>";
global $db;
require_once '../confy.php';
require_once '../functions.php';
require_once '../functions-2.php';
require_once '../functions-xml.php';
tep_db_connect();
use_class('jng_sp');
use_class('jng_sp_download');
use_class('jng_sp_orders');
use_class('jng_sp_customers');
use_class('products_ean');
use_class('jng_sp_orders_xml');
use_class('jng_sp_orders_xml_3');
$class_sp = new jng_sp();
$class_jd = new jng_sp_download();
$class_jo = new jng_sp_orders();
$class_jcust = new jng_sp_customers();
$class_ean = new products_ean();
$jng_sp_id = '3';
$sp_detail = $class_sp->retrieveDetail($jng_sp_id);
$download_status_to_generate = 'R';
$timestamp = date('d.m.Y H:i:s');
$cron_result = array();
$cron_result[] = '>> ' . $timestamp;
/////////////////////////////
// STEP 1: DOWNLOAD ORDERS //
/////////////////////////////
$cron_result[] = 'STEP 1: DOWNLOAD ORDERS';
//initialize ftp settings and paths
$ftp_server = SP_NECKERMANNAT_FTP_HOST;
$ftp_user_name = SP_NECKERMANNAT_FTP_USER;
Beispiel #23
0
//PRINT INVOICE OF DELIVERY DOCUMENTS FOR ORDERS IN AN SP PACKAGE
global $db;
require_once '../confy.php';
require_once '../functions.php';
require_once '../functions-2.php';
tep_db_connect();
define('FPDF_IMGPATH', DIR_WS_IMAGES . 'pdf/');
define('FPDF_FONTPATH', FPDF_IMGPATH . 'fonts/');
require_once DIR_WS_CLASSES . 'fpdf.php';
use_class('jng_sp');
use_class('jng_sp_orders');
use_class('orders');
use_class('products_ean');
use_class('bins');
$class_sp = new jng_sp();
$class_jo = new jng_sp_orders();
$class_o = new orders();
$class_ean = new products_ean();
$class_bin = new bins();
$PRINT_RETAILS = isset($_GET['type']) && $_GET['type'] == 'retails';
$ean_collection = array();
$orders = array();
$orders_barcode = array();
$inhh_status = '8';
$oi_printed_sp = array();
$oi_printed_jg = array();
$total_products_picked = 0;
$bin_location_qty_collection = array();
//GET FLAG INCLUDE REPACKAGE
$ir = tep_db_prepare_input($_GET['ir']);
$need_repackage = $ir == 1 ? true : false;
<?php

use_class('jng_sp');
use_class('jng_sp_orders');
use_class('payone');
$class_sp = new jng_sp();
$class_jo = new jng_sp_orders();
$default_comment = 'Comment...';
//SP SETTING
salesPartnerCombo();
if (isset($_POST['me_action']) && $_POST['me_action'] != '') {
    if ($_POST['me_action'] == 'SEARCHORDERS') {
        $search_field = tep_db_prepare_input($_POST['search_field']);
        $search_keywords = tep_db_prepare_input(utf8_decode($_POST['search_keywords']));
        $orders = $class_jo->searchOrders($search_field, $search_keywords, "joi.status IN (9,11)");
        $itemStatus = $class_jo->statusName();
        $result = '';
        if (count($orders) == 0) {
            $result .= '<h3>No result is found, please check your search field/keywords</h3>';
        } else {
            $orders_result = array();
            $o = array();
            $o['c'] = 'Order Info';
            $o['a'] = 'Article No';
            $o['r'] = 'Return Info';
            $o['t'] = 'Action';
            $orders_result[] = $o;
            foreach ($orders as $row) {
                $returnable = $row['order_quantity'];
                $return_data = $class_jo->retrieveReturnItem($row['jng_sp_orders_items_id']);
                if (!is_null($return_data)) {
define('FPDF_FONTPATH', FPDF_IMGPATH . 'fonts/');
require_once DIR_WS_CLASSES . 'fpdf.php';
if (isset($_GET['id']) && $_GET['id'] != '') {
    $type = 'sp';
    //SP PACKAGES
    use_class("jng_sp");
    $class_sp = new jng_sp();
    $splist = $class_sp->retrieveList();
    $sp_prefix = array();
    foreach ($splist as $sp) {
        $sp_prefix[$sp['jng_sp_id']] = $sp['package_prefix'];
    }
    use_class("jng_sp_packages");
    $class_jp = new jng_sp_packages();
    use_class("jng_sp_orders");
    $class_jo = new jng_sp_orders();
    $package_id = tep_db_prepare_input($_GET['id']);
    $orders_array = $class_jp->getOrders($package_id);
    $items_array = $class_jp->getItems($package_id);
} elseif (isset($_GET['pid']) && $_GET['pid'] != '') {
    $type = 'jng';
    //JNG PACKAGES
    use_class("minierp_packages");
    $class_mp = new minierp_packages();
    use_class("orders");
    $class_o = new orders();
    $package_id = tep_db_prepare_input($_GET['pid']);
    $orders_array = $class_mp->getOrders($package_id);
    $items_array = $class_mp->getProducts($package_id);
} else {
    exit;
#  Created : Jul 2, 2010 5:34:28 PM                             #
#  Purpose : send email reminder to customer to pay the order   #
#################################################################
global $db;
require_once '../confy.php';
require_once '../functions.php';
require_once '../functions-2.php';
tep_db_connect();
use_class('logger');
$logger = new logger('cron', 'email-vorkasse-reminder');
use_class('Order');
use_class('orders');
use_class('jng_sp_orders');
use_class('payone_invoice');
$class_o = new orders();
$class_jo = new jng_sp_orders();
$sp_need_reminder = array('2');
$tolerance_before_really_cancelling_orders = '7 days';
$languages[2]['path'] = 'german';
function sendUnderpaidReminder($order, $open_amount, $language)
{
    global $class_o, $class_jo;
    $status = '1';
    $order_id = $order['orders_id'];
    $order_no = $order['orders_no'];
    $to_name = $order['customers_name'];
    $to_email_address = $order['customers_email_address'];
    $order_currency = $order['currency'];
    $from_email_name = FROM_EMAIL_NAME;
    $from_email_address = FROM_EMAIL_ADDRESS;
    include DIR_FS_MINIERP . DIR_WS_EMAILS . $language . '/vorkasse-orders-reminder-underpaid.php';
<?php

use_class('jng_sp_orders');
$class_jo = new jng_sp_orders();
//AJAX POST
if (isset($_POST['me_action']) && $_POST['me_action'] == 'UPDATERETURN') {
    $return_id = tep_db_prepare_input($_POST['return_id']);
    $sda_return = array();
    $sda_return['return_reason'] = tep_db_prepare_input($_POST['return_reason']);
    $sda_return['return_quantity'] = tep_db_prepare_input($_POST['return_qty']);
    $sda_return['return_comment_customer'] = tep_db_prepare_input(utf8_decode($_POST['comment_c']));
    $sda_return['return_comment_jng'] = tep_db_prepare_input(utf8_decode($_POST['comment_j']));
    $sda_return['shipping_paid'] = tep_db_prepare_input($_POST['shipping_paid']);
    $class_jo->returnItemUpdate($return_id, $sda_return);
    echo '<div class="green">Return detail is successfully saved</div>';
    exit;
}
//START TEMPLATE
$return_id = isset($_GET['id']) ? tep_db_prepare_input($_GET['id']) : '';
if ($return_id == '') {
    exit;
}
$return = $class_jo->retrieveReturnDetail($return_id);
$item = $class_jo->retrieveItemDetail($return['jng_sp_orders_items_id']);
$order = $class_jo->retrieveDetail($item['jng_sp_orders_id']);
$pimg = webImageSource($item['products_image'], '500');
if ($pimg != '') {
    $pimg = webImage($item['products_image'], '120', '120', '', 'img-border img-padding');
}
$content .= '<div style="float:left;">' . $pimg . '</div>';
$content .= '<div style="margin-left:150px;">';
//DOWNLOAD NEW ORDERS & INVOICES FROM NECKERMANN
$mt_start = microtime();
global $db;
require_once '../confy.php';
require_once '../functions.php';
require_once '../functions-2.php';
require_once '../functions-xml.php';
tep_db_connect();
use_class('jng_sp');
use_class('jng_sp_download');
use_class('jng_sp_orders');
use_class('jng_sp_customers');
$class_sp = new jng_sp();
$class_jd = new jng_sp_download();
$class_jo = new jng_sp_orders();
$class_jcust = new jng_sp_customers();
$jng_sp_id = '1';
$sp_detail = $class_sp->retrieveDetail($jng_sp_id);
$download_status_to_decrypt = 'R';
$download_status_to_generate = 'D';
$timestamp = date('d.m.Y H:i:s');
$cron_result = array();
$cron_result[] = '>> ' . $timestamp;
/////////////////////////////
// STEP 1: DOWNLOAD ORDERS //
/////////////////////////////
$cron_result[] = 'STEP 1: DOWNLOAD ORDERS';
//initialize ftp settings and paths
$ftp_server = SP_NECKERMANN_FTP_HOST;
$ftp_user_name = SP_NECKERMANN_FTP_USER;
Beispiel #29
0
/**
 * Get vip status of customer from an order
 * @param String $type
 * @param Int $orders_id
 * @return Boolean
 */
function checkCustomerIsVIP($type, $orders_id)
{
    $type = strtoupper($type);
    $is_vip = false;
    if ($type == 'SP') {
        use_class('jng_sp_orders');
        use_class('jng_sp_customers');
        use_class('jng_sp_customers_special');
        $class_jo = new jng_sp_orders();
        $class_jc = new jng_sp_customers();
        $class_jcs = new jng_sp_customers_special();
        $o = $class_jo->retrieveDetail($orders_id);
        //GET CUSTOMER DETAIL VIP OR NOT
        $cust_data = $class_jc->retrieveDetail(null, $o['jng_sp_id'], $o['customer_billing_id']);
        if (is_array($cust_data) && $cust_data['jng_sp_customers_id'] > 0) {
            $cust_detail = $class_jcs->getCustomerDetail($cust_data['jng_sp_customers_id']);
        }
        $is_vip = $cust_detail['list_type'] == 'V';
    } elseif ($type == 'JG') {
        use_class('orders');
        use_class('customers_special_list');
        $class_o = new orders();
        $class_csl = new customers_special_list();
        $o = $class_o->retrieveDetail($orders_id);
        //GET CUSTOMER DETAIL VIP OR NOT
        $cust_detail = $class_csl->getCustomerDetail($o['customers_id']);
        $is_vip = $cust_detail['list_type'] == 'V';
    } elseif ($type == 'DP') {
        use_class('depot_orders');
        $class_do = new depot_orders();
        $do = $class_do->retrieveDetail($orders_id);
        if ($do['trans_type'] == 'SP' || $do['trans_type'] == 'JG') {
            if ($do['trans_type'] == 'SP') {
                use_class('jng_sp_orders');
                $class_jo = new jng_sp_orders();
                $it = $class_jo->retrieveItemDetail($do['trans_id']);
                $orders_id = $it['jng_sp_orders_id'];
            } elseif ($do['trans_type'] == 'JG') {
                use_class('orders');
                $class_o = new orders();
                $it = $class_o->retrieveProductDetail($do['trans_id']);
                $orders_id = $it['orders_id'];
            }
            $is_vip = checkCustomerIsVIP($do['trans_type'], $orders_id);
        }
    }
    return $is_vip;
}
<?php

#########################################
#  Author  : D3W4 & SAHAT               #
#  Created : Jul 22, 2010 2:38:00 PM    #
#########################################
global $db;
require_once '../confy.php';
require_once '../functions.php';
require_once '../functions-2.php';
tep_db_connect();
use_class("jng_sp_orders");
use_class("orders");
$class_jo = new jng_sp_orders();
$class_o = new orders();
$orders_id = tep_db_prepare_input($_GET['id']);
$mode = strtolower(tep_db_prepare_input($_GET['m']));
if ($orders_id != '') {
    if ($mode == 'sp') {
        $class_jo->recalculateOrderItemCount($orders_id);
    } else {
        $class_o->recalcProductsCounter($orders_id);
    }
    if ($mode != 'sp') {
        $mode = 'J&G';
    }
    echo "Successfully recalc {$mode} with orders_id {$orders_id}";
}