$class_es->addStockByPieces($whid_elements, $e_id, $order_qty, 'ADD-EL ' . $order_type . '-' . $oiid);
                 $elements_stock[$stock_id] += $order_qty;
             }
         }
     } elseif ($oi['stock_status'] == 'P') {
         //ADD BACK FG STOCK AUTOMATICALLY
         $stock_id = $oi['products_id'] . $oi['products_articles_id'];
         $order_qty = $oi['order_quantity'];
         $class_pm->stockAdd($whid_prod, $oi['products_id'], $oi['products_articles_id'], $order_qty, 'ADD-FG ' . $order_type . '-' . $oiid);
         $products_stock_bali[$stock_id] += $order_qty;
     }
 }
 $oi_trans = null;
 //PRODUCT IS ALREADY MOVED TO IN HH TAB (MMO) - Retrieve MMO details as $oi_trans
 if ($oi['status'] == $new_status) {
     $oi_trans = $class_do->retrieveDetailTransmigran($order_type, $oiid);
 }
 //CANCEL MMO IF NOT YET IN PRODUCTION
 if (!is_null($oi_trans) && $oi_trans['status'] < 4) {
     $class_do->doCancelOrders($oi_trans['depot_orders_id'], $oi_trans['status'], 'auto-set');
 }
 //REQUEST DEPOT REFILL IF ORDER WAS NOT YET IN PRODUCTION
 if (is_null($oi_trans) && $oi['status'] < 4 || !is_null($oi_trans) && $oi_trans['status'] < 4) {
     $refill_type = depot_orders::AUTO_REFILL_ID_DSO;
     $refill_qty_request = $order_qty;
 }
 //Orders with DS Prioritized should keep their "mode"
 if ($oi['ds_prioritized'] == '1') {
     if ($oi['mode'] == modeKey('MMO')) {
         $items_mmo[] = $oiid;
     } elseif ($oi['mode'] == modeKey('MTO')) {
Exemplo n.º 2
0
function retrieveProductionHistory($type, $oiid, $filter = '')
{
    $query = "SELECT * FROM production_status_history WHERE type = '{$type}' AND orders_items_id={$oiid}";
    if ($filter != '') {
        $query .= " AND {$filter}";
    }
    $query .= " ORDER BY status_date ASC";
    $ph_query = tep_db_query($query);
    $ph = array();
    if (tep_db_num_rows($ph_query) > 0) {
        while ($row = tep_db_fetch_array($ph_query)) {
            $ph[] = $row;
        }
    } elseif ($type != 'DP') {
        //CEK DEPOT ORDERS
        use_class('depot_orders');
        $class_do = new depot_orders();
        $do = $class_do->retrieveDetailTransmigran($type, $oiid);
        if (!is_null($do)) {
            $ph = retrieveProductionHistory('DP', $do['depot_orders_id'], $filter);
        }
    }
    return $ph;
}
Exemplo n.º 3
0
                $htp['status'] = 'Production: ' . statusNameProduction($hp['status']);
                $htp['login'] = $hp['update_by'];
                $htable[] = $htp;
                unset($history_prod[$hpk]);
            }
        }
    }
}
$content .= '<div style="float:left;">';
$content .= webImage($product['p']['products_image'], '80', '80', $item['products_id'], 'img-padding img-border');
$content .= '</div>';
$content .= '<div style="padding:3px 0 20px 100px;">';
$content .= '<h2 style="margin:0;">Order ' . $order['orders_no'] . '</h2>';
$content .= '<h2 style="margin:0;">Product ' . $item['order_item_count'] . '/' . $item['order_item_total'] . '</h2>';
$content .= '<h2 style="margin:0;">' . $item['products_model'] . '</h2>';
$content .= '<h2 style="margin:0">' . $item['products_name'] . '</h2>';
$content .= '</div>';
$content .= tep_draw_table('', $htable);
//DEPOT ORDER EXISTS
use_class('depot_orders');
$class_do = new depot_orders();
$do = $class_do->retrieveDetailTransmigran('JG', $opid);
if (!is_null($do)) {
    $content .= '<div style="margin-top:30px;">';
    $content .= '<h2>Depot Order ' . $do['depot_orders_id'] . '</h2>';
    $_GET['id'] = $do['depot_orders_id'];
    include 'depot-order.php';
    $content .= '</div>';
}
$title = 'Status History of JG-' . $opid;
//$title = 'Status History of '.$product['products_model'].' ('.$product['products_name'].')';
Exemplo n.º 4
0
     $errinfo = 'Barcode must have prefix: <strong>"JG-"</strong>, <strong>"SP-"</strong> or <strong>"DP-"</strong><br />';
     //$errinfo .= 'Please switch to <strong>Sales Partner</strong> or <strong>Julie &amp; Grace</strong> for no prefix barcode';
     $result .= printPackageTip('E', $box_date, $errinfo);
 } else {
     //Barcode valid
     //Set type and id for the process
     $type = $id_split[0];
     $id = $id_split[1];
     if ($type == 'SP') {
         $item = $class_jo->retrieveItemDetail($id);
     } elseif ($type == 'JG') {
         $item = $class_o->retrieveProductDetail($id);
     }
     //Check if order is already transfered as depot order
     //and make sure the transfered order is not canceled
     $item_do = $class_do->retrieveDetailTransmigran($type, $id);
     if (!is_null($item_do) && !statusIsCancelled($item_do['status'])) {
         //if yes, handle order as depot
         $type = 'DP';
         $id = $item_do['depot_orders_id'];
     } else {
         //if no, check if need to transfer it as depot order
         $status_create_do = array('8', '9', '10', '11', '12', '20');
         if (in_array($item['status'], $status_create_do)) {
             //yes, we need to transfer it
             //check if transfer is still possible
             if (realOrderIsPossibleToTransferred($type, $id)) {
                 //yes, then let's transfer it
                 if (is_null($item_do)) {
                     $item_do = $class_do->transferFromRealOrder(SEGMENT_ID_HAMBURG, $type, $id);
                 }
Exemplo n.º 5
0
                $htable[] = $htp;
                unset($history_prod[$hpk]);
            }
        }
    }
}
//$content .= '<h2>Order '.$order['order_id'].' &sdot; '.$item['order_item_count'].'/'.$item['order_item_total'].' &sdot; '.$item['article_number'].' &sdot; '.$item['billing_text'].'</h2>';
//$content .= '<h2 style="margin:0;">Order '.$order['order_id'].' &sdot; '.$item['order_item_count'].'/'.$item['order_item_total'].' &sdot; '.$item['article_number'].'</h2>';
$content .= '<div style="float:left;">';
$content .= webImage($product['p']['products_image'], '80', '80', $item['products_id'], 'img-padding img-border');
$content .= '</div>';
$content .= '<div style="padding:3px 0 20px 100px;">';
$content .= '<h2 style="margin:0;">Order ' . $order['order_id'] . '</h2>';
$content .= '<h2 style="margin:0;">Product ' . $item['order_item_count'] . '/' . $item['order_item_total'] . '</h2>';
$content .= '<h2 style="margin:0;">' . $item['article_number'] . '</h2>';
$content .= '<h2 style="margin:0">' . $item['billing_text'] . '</h2>';
$content .= '</div>';
$content .= tep_draw_table('', $htable);
//DEPOT ORDER EXISTS
use_class('depot_orders');
$class_do = new depot_orders();
$do = $class_do->retrieveDetailTransmigran('SP', $oi_id);
if (!is_null($do)) {
    $content .= '<div style="margin-top:30px;">';
    $content .= '<h2>Depot Order ' . $do['depot_orders_id'] . '</h2>';
    $_GET['id'] = $do['depot_orders_id'];
    include 'depot-order.php';
    $content .= '</div>';
}
$title = 'Status History of SP-' . $oi_id;
//$title = 'Status History of '.$item['article_number'].' ('.$item['billing_text'].')';
Exemplo n.º 6
0
 $expected_delivery_date = 0;
 $worst_status = 12;
 $worst_status_date = time();
 foreach ($order_products_data as $row) {
     $edd_timestamp = strtotime($row['expected_delivery_date']);
     if ($edd_timestamp > $expected_delivery_date) {
         $expected_delivery_date = $edd_timestamp;
     }
     if ($row['status'] <= $worst_status) {
         $worst_status = $row['status'];
         $ws_timestamp = strtotime($row['status_date']);
         if ($ws_timestamp > $worst_status_date) {
             $worst_status_date = $ws_timestamp;
         }
     }
     $do = $class_do->retrieveDetailTransmigran('JG', $row['orders_products_id']);
     if ($row['status'] == 8) {
         if (!is_null($do) && $do['status'] <= $worst_status) {
             $worst_status = $do['status'];
             $ws_timestamp = strtotime($do['status_date']);
             if ($ws_timestamp > $worst_status_date) {
                 $worst_status_date = $ws_timestamp;
             }
         }
     }
     $product_configurator = $row['visible_status'] != '';
     $p_qty_pri = $row['products_quantity'] * $row['final_price'];
     if (strpos($row['products_model'], 'GIFT') === false || substr($row['products_model'], 0, 6) == 'GIFT-P') {
         $gvonly = false;
         $act_pe_image = '';
         $act_pe_text = '';
     if ($i['status'] > 8) {
         $total_products_sent++;
     }
 }
 $product = $class_pm->retrieveDetail($i['products_id'], 'p,pnc');
 $article = $i['products_articles_id'] > 0 ? $class_pa->retrieveDetail($i['products_articles_id']) : null;
 $ordered_qty = intval($i[$items_colname_qty]);
 if ($i['status'] == 8) {
     if ($i['stock_status'] == 'D') {
         $total_products_depot_ready++;
         if ($i['print_count'] == '1') {
             $total_products_depot_ready_printed++;
         }
     }
     if ($i['mode'] == modeKey('MMO')) {
         $do = $class_do->retrieveDetailTransmigran($source, $i[$items_colname_id]);
         if ($i['stock_status'] != 'D' || $i['stock_status'] == 'D' && $do['status'] == 8) {
             $i['status'] = $do['status'];
             $i['status_date'] = $do['status_date'];
         }
     }
 }
 if ($i['status'] <= $worst_status) {
     $worst_status = $i['status'];
     $ws_timestamp = strtotime($i['status_date']);
     if ($ws_timestamp > $worst_status_date) {
         $worst_status_date = $ws_timestamp;
     }
 }
 foreach ($header as $hkey => $h) {
     $value = '';
Exemplo n.º 8
0
 function doCancelOrders($opid, $old_status, $username, $cancel_by = 'J', $cancel_depot = true)
 {
     $item = $this->retrieveProductDetail($opid);
     $new_status = '10';
     if (count($item) > 0 && $item['status'] == $old_status) {
         //RESET STATUS
         $this->updateProductStatus($opid, $new_status, $username, $cancel_by);
         $this->updateProductStockStatus($opid, '0');
         $this->updateOrderItemMode($oid, '0');
         $this->recalcProductsCounter($item['orders_id']);
         cancelOrderStockHandler('JG', $opid, $item['stock_status'], $item['status'], $item['print_count'], $item['print_confirmed'], $item['products_id'], $item['products_articles_id'], $item['products_quantity']);
         if ($cancel_depot) {
             //RESET DEPOT ORDERS IF ALREADY CREATED FOR THIS ORDER
             use_class('depot_orders');
             $class_do = new depot_orders();
             $do = $class_do->retrieveDetailTransmigran('JG', $opid);
             if (!is_null($do) && $do['status'] < 4 && $do['status'] != 12) {
                 $class_do->doCancelOrders($do['depot_orders_id'], $do['status'], $username);
             }
         }
         //SEND EMAIL TO ADMIN
         $arr_status = $this->productStatusNameShort();
         $o = $this->retrieveDetail($item['orders_id']);
         $is_sp = false;
         $email_data = array();
         $email_data = $item;
         $email_data['orders_date'] = $o['date_purchased'];
         $email_data['customers_name'] = $o['customers_name'];
         $email_data['status'] = $arr_status[$email_data['status']];
         $languages[2]['path'] = 'german';
         include DIR_WS_EMAILS . $languages[2]['path'] . '/cancel-order-notification.php';
         $from_email_name = FROM_EMAIL_NAME;
         $from_email_address = FROM_EMAIL_ADDRESS;
         $to_name = EMAIL_NAME_ADMIN1;
         $to_email_address = EMAIL_ADDRESS_ADMIN1;
         tep_mail($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address);
     } else {
         $new_status = $item['status'];
     }
     return $new_status;
 }
Exemplo n.º 9
0
 function doCancelOrders($oid, $old_status, $username, $cancel_by = 'J', $cancel_depot = true)
 {
     global $session_userinfo;
     $item = $this->retrieveItemDetail($oid);
     $new_status = '10';
     if (count($item) > 0 && $item['status'] == $old_status) {
         //RESET STATUS
         $this->updateItemStatus($oid, $new_status, $username, $cancel_by);
         $this->updateItemStockStatus($oid, '0');
         $this->updateOrderItemMode($oid, '0');
         $this->recalculateOrderItemCount($item['jng_sp_orders_id']);
         cancelOrderStockHandler('SP', $oid, $item['stock_status'], $item['status'], $item['print_count'], $item['print_confirmed'], $item['products_id'], $item['products_articles_id'], $item['order_quantity'], $item['is_promotion_order']);
         if ($cancel_depot) {
             //RESET DEPOT ORDERS IF ALREADY CREATED FOR THIS ORDER
             use_class('depot_orders');
             $class_do = new depot_orders();
             $do = $class_do->retrieveDetailTransmigran('SP', $oid);
             if (!is_null($do) && $do['status'] < 4 && $do['status'] != 12) {
                 $class_do->doCancelOrders($do['depot_orders_id'], $do['status'], $username);
             }
         }
         use_class("jng_sp");
         $class_sp = new jng_sp();
         $arr_status = $this->statusNameShort();
         $o = $this->retrieveDetail($item['jng_sp_orders_id']);
         $sp = $class_sp->retrieveDetail($o['jng_sp_id']);
         $is_sp = true;
         if ($sp['jng_sp_id'] == 5) {
             //SEND EMAIL TO J&G EMAIL SERVICE
             $email_data = array();
             $email_data = $item;
             $email_data['orders_date'] = $o['order_date'];
             $email_data['customers_name'] = $o['customer_billing_firstname'] . ' ' . $o['customer_billing_lastname'];
             $email_data['status'] = $arr_status[$email_data['status']];
             $email_data['orders_id'] = $o['order_id'];
             $email_data['sp_code'] = $sp['package_prefix'];
             $languages[2]['path'] = 'german';
             include DIR_FS_MINIERP . DIR_WS_EMAILS . $languages[2]['path'] . '/cancel-order-notification.php';
             $from_email_name = FROM_EMAIL_NAME;
             $from_email_address = FROM_EMAIL_ADDRESS;
             $to_name = EMAIL_NAME_SERVICE;
             $to_email_address = EMAIL_ADDRESS_SERVICE;
             $email_subject = 'Cancelled Amazon Orders';
             tep_mail($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address);
         }
         //SEND EMAIL TO ADMIN
         $email_data = array();
         $email_data = $item;
         $email_data['orders_date'] = $o['order_date'];
         $email_data['customers_name'] = $o['customer_billing_firstname'] . ' ' . $o['customer_billing_lastname'];
         $email_data['status'] = $arr_status[$email_data['status']];
         $email_data['orders_id'] = $item['jng_sp_orders_id'];
         $email_data['sp_code'] = $sp['package_prefix'];
         $languages[2]['path'] = 'german';
         include DIR_FS_MINIERP . DIR_WS_EMAILS . $languages[2]['path'] . '/cancel-order-notification.php';
         $from_email_name = FROM_EMAIL_NAME;
         $from_email_address = FROM_EMAIL_ADDRESS;
         $to_name = EMAIL_NAME_ADMIN1;
         $to_email_address = EMAIL_ADDRESS_ADMIN1;
         tep_mail($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address);
     } else {
         $new_status = $item['status'];
     }
     return $new_status;
 }