$result['status'] = 'UPDATED'; $class_o->updateProductStatus($item_id, $status_new, $user_name); if ($status_current == '4' && $status_new == '5' && $item['prod_status'] != '') { tep_db_perform('orders_products', array('prod_status' => ''), 'update', "orders_products_id='{$item_id}'"); } if ($status_current == '4' && $status_new == '5' && $at_machine > 0) { //IF PRODUCT IS FINISH, ALSO SET ANTITARNISH USAGE FOR NON OXIDIZED PRODUCTS $silver_usage = $class_o->calcSilverUsage($item_id); antitarnishUsageAdd($at_machine, $silver_usage); } } } } } elseif ($order_type == 'DP') { //Handle Depot Orders $item = $class_do->retrieveDetail($item_id); $sub_status_different = "{$item['status']}-{$item['prod_status']}" != $status_new; $is_outsourced = $class_do->isOutsourceOrder($item['trans_type'], $item['trans_id']); if (isset($item['status'])) { //Allow Products in Outsourcing to be set as Finish also using MC if ($item['status'] == '22' && $status_current == '4') { $status_current = '22'; } //Validate current status if ($item['status'] != $status_current && $sub_status_different) { //Handle invalid current status //ex 1: when trying to move from "ready" to "production", but current status is not "ready" //ex 2: when trynig to move from "production" to "finish", but current status is not "finish" $oiErrorStatus = oiErrorStatus($item['status']); if ($oiErrorStatus == 'MOVEDTODEPOT') { $result['status'] = 'UPDATED';
/** * 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; }
$_SESSION['vars']['date_range_end'] = $date_range_end; if (isset($_GET['change_filter']) && $_GET['change_filter'] == 'true') { exit; } $statusNameShow = array(1, 2, 3, 4, 5, 6, 7, 22); function oiErrorStatus($items_id, $item_status, $status_name) { $result = "<strong>DP-{$items_id}</strong> Status is now <strong>" . $status_name[$item_status] . '</strong>'; return $result; } //SUBMIT ACTION if (isset($_POST['me_action'])) { if ($_POST['me_action'] == 'CHECKOISTATUS') { $items_id = tep_db_prepare_input($_POST['oi_id']); $status_tab = tep_db_prepare_input($_POST['status_tab']); $item = $class_do->retrieveDetail($items_id); if (count($item) == 0) { $result = "<br /><strong>DP-{$items_id}</strong> is not found"; } else { $result = '<br />' . oiErrorStatus($items_id, $item['status'], $class_do->statusName()); } echo utf8_encode($result); exit; } elseif ($_POST['me_action'] == 'UPDATEOISTATUS') { $items_id = tep_db_prepare_input($_POST['oi_id']); $old_status = tep_db_prepare_input($_POST['old_status']); $new_status = tep_db_prepare_input($_POST['new_status']); $item = $class_do->retrieveDetail($items_id); if ($item['status'] == $old_status) { $status_to_alert_success = array('3', '4'); if ($new_status == 10) {
$oid = $r['orders_id']; $oiid = $r['items_id']; $sp_id = $r['sp_id']; $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) {
function retrieveData($barcode_type, $barcode_id) { use_class('jng_sp'); use_class('orders'); use_class('jng_sp_orders'); use_class('depot_orders'); use_class('products_ean'); use_class('products_minierp'); $class_sp = new jng_sp(); $class_orders = new orders(); $class_jo = new jng_sp_orders(); $class_do = new depot_orders(); $class_pean = new products_ean(); $class_pm = new products_minierp(); $result = ''; //list($partner_type,$order_product_id) = split("-",$barcode_id); //$partner_type = strtolower($partner_type); $tmp_bcid = explode('-', $barcode_id); $partner_type = strtolower($tmp_bcid[0]); $order_product_id = $tmp_bcid[1]; if (is_numeric($partner_type)) { $order_product_id = $partner_type; $partner_type = 'sp'; } //all id without prefix JG or SP indicates as SP if (!empty($order_product_id) && $order_product_id != '') { $partners_need_ean13 = array('3'); #switch partner prefix switch ($partner_type) { case 'jg': $products = $class_orders->retrieveProductDetail($order_product_id); #header("Content-Type: text/plain; charset=utf-8"); switch ($barcode_type) { case 'code39': if (count($products) > 0) { #table orders,products,dll. $order_id = $products["orders_id"]; $article_number = $products["products_model"]; $order_item_count = $products["order_item_count"]; $order_item_total = $products["order_item_total"]; $order_qty = $products["products_quantity"]; #table orders $orders = $class_orders->retrieveDetail($order_id); $order_no = $orders["orders_no"]; $order_date = strtotime($orders["date_purchased"]); $day = date("d", $order_date); $month = date("M", $order_date); $daily_count = $orders["daily_count"]; #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"]; $qcountry = "SELECT countries_iso_code_2 FROM countries WHERE countries_name = '{$orders['delivery_country']}'"; $dbqcountry = tep_db_query($qcountry); $rescountry = tep_db_fetch_array($dbqcountry); $label_suffix = $rescountry['countries_iso_code_2'] != '' ? ".{$rescountry['countries_iso_code_2']}" : ""; $label_numtag = "JG" . $label_suffix; $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 . ";" . $order_product_id . ";" . $partner_type; $result = $return_label; } else { $result = "no data"; } break; case 'ean13': if (count($products) > 0) { $result = $this->getEANReturnResult($partner_type, $products); } else { $result = "no data"; } break; } break; case 'sp': $oi = $class_jo->retrieveItemDetail($order_product_id); $order_id = $oi["jng_sp_orders_id"]; $o = $class_jo->retrieveDetail($order_id); $sp_id = $o["jng_sp_id"]; #header("Content-Type: text/plain; charset=utf-8"); switch ($barcode_type) { case 'code39': if (count($oi) > 0) { #table jng_sp_orders_items // $order_qty = $oi["order_quantity"] * 1; $article_number = $oi["article_number"]; $order_item_count = $oi["order_item_count"]; $order_item_total = $oi["order_item_total"]; $order_qty = intval($oi["order_quantity"]); #table jng_sp_orders $order_no = $o["order_id"]; $class_ordersrder_date = strtotime($o["order_date"]); $day = date("d", $class_ordersrder_date); $month = date("M", $class_ordersrder_date); $daily_count = $o["daily_count"]; $shipment_id = $o["shipment_id"]; $cust_fname = $o["customer_shipping_firstname"]; $cust_lname = $o["customer_shipping_lastname"]; #table jng_sp $jngsp = $class_sp->retrieveDetail($sp_id); $prefix_num = $jngsp["package_prefix"]; #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 = $cust_fname . " " . $cust_lname; $label_numtag = $prefix_num == '' ? "-" : $prefix_num; $label_auftragsnr = $order_no == '' ? "-" : $order_no; $label_lieferscheinnr = $shipment_id; $return_label = $label_date . ";" . $daily_count . ";" . $label_order_seq . ";" . $label_numtag . ";" . $label_cust_name; $return_label .= ";" . $label_auftragsnr . ";" . $label_lieferscheinnr . ";" . $order_qty . ";" . $article_number . ";" . $order_product_id . ";" . $partner_type; if (in_array($sp_id, $partners_need_ean13)) { if (count($oi) > 0) { $cats = $class_jo->getCategories($order_id); $oi_product_id = $oi["products_id"]; $oi_product_article_id = $oi["products_articles_id"]; $ean = $oi_product_article_id != '' ? $class_pean->getEAN($oi_product_id, $oi_product_article_id) : $class_pean->getEAN($oi_product_id); if ($ean != '') { $label_material = "925er SILBER"; $return_label .= ";" . $ean . ";" . strtoupper($cats['categories_name']) . ";" . $label_material . ";" . $oi['price'] . " EUR;{$order_qty};{$o['jng_sp_id']}"; } } } $result = $return_label; } else { $result = "no data"; } break; case 'ean13': if (count($oi) > 0) { $result = $this->getEANReturnResult($partner_type, $oi, $sp_id); } else { $result = "no data"; } break; } break; case 'dp': //ONLY PRODUCT LABEL / ean13 $do = $class_do->retrieveDetail($order_product_id); switch ($barcode_type) { case 'code39': $article_number = $do["products_ean"]; $order_item_count = '1'; $order_item_total = '1'; $order_qty = intval($do["quantity"]); $daily_count = $order_qty . 'x'; #format return label >> date;number;orderseq;nametag;kunde;auftragsnr;lieferscheinnr;qty;artikel $label_date = "Quantity: "; $label_order_seq = "{$order_item_count}/{$order_item_total}"; $label_cust_name = 'Outsourcing'; $label_numtag = '-'; $label_auftragsnr = '-'; $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 . ";" . $order_product_id . ";" . $partner_type; $result = $return_label; break; case 'ean13': default: if (count($do) > 0) { $do['products_articles_id'] = $do['articles_id']; $result = $this->getEANReturnResult($partner_type, $do); } else { $result = "no data"; } } break; } } else { $result = "no data"; } return $result; }
require_once '../functions-2.php'; tep_db_connect(); if (isset($_POST['barcode_id'])) { use_class('depot_orders'); $class_do = new depot_orders(); use_class('jng_sp_orders'); $class_jo = new jng_sp_orders(); use_class('orders'); $class_o = new orders(); $barcode_id = tep_db_prepare_input($_POST['barcode_id']); $b_array = split('-', $barcode_id); $b_prefix = $b_array[0]; $b_itemid = $b_array[1]; if ($b_prefix == 'DP') { $result = 'DEPOT ORDERS'; $item = $class_do->retrieveDetail($b_itemid); if ($item['trans_type'] == 'SP') { $item_trans = $class_jo->retrieveItemDetail($item['trans_id']); } elseif ($item['trans_type'] == 'JG') { $item_trans = $class_o->retrieveProductDetail($item['trans_id']); } if (count($item_trans) > 0 && $item_trans['status'] == '8' && $item_trans['stock_status'] != 'D') { $result = 'Missing MO'; } } else { $result = 'DP-XXXX BARCODE ONLY'; } echo 'Barcode: ' . $barcode_id . '<br />'; echo '<strong>' . $result . '</strong>'; echo '<br /><br />'; }
if ($newstatus == '1' || $newstatus == '10') { $subject = 'MISSING PRODUCT!'; $message = 'A Product from Depot Order has been reported missing (sent to HH but never receive): '; $message .= '<a href="http://manobo.de/?open=depot-order&id=' . $order_id . '">DP-' . $order_id . '</a>'; } elseif ($newstatus == '8') { $subject = 'MANUAL SET STATUS!'; $message = 'A Product from Depot Order has been set manually as received in HH by ' . $session_userinfo['username'] . ': '; $message .= '<a href="http://manobo.de/?open=depot-order&id=' . $order_id . '">DP-' . $order_id . '</a>'; } if ($subject != '' && $message != '') { tep_mail(EMAIL_NAME_DEBUGR, EMAIL_ADDRESS_DEBUGR, $subject, $message, FROM_EMAIL_NAME, FROM_EMAIL_ADDRESS, false); } unset($class_do->items[$order_id]); } } $do = $class_do->retrieveDetail($order_id); $do_timestamp = strtotime($do['order_date']); $product = $class_pm->retrieveDetail($do['products_id']); $article = $do['articles_id'] == 0 ? null : $class_pa->retrieveDetail($do['articles_id']); $length = $article == null ? $product['pnc']['products_length'] : $article['length']; $length_text = $length == 0 ? '' : '<tr><td>Product Length</td><td>' . textLength($length) . '</td></tr>'; $group_name = $do['group_name']; if (count($do) == 0) { $content .= '<h3 class="red">Depot Order ' . $order_id . ' is not found in Database'; } else { $statusName = statusNameShort(); $bih_start_date = $do['order_date']; $bih_end_date = null; if ($do['trans_type'] == 'SP') { use_class('jng_sp_orders'); $class_jo = new jng_sp_orders();