$total_orders = count($orders); $total_orders_created = 0; $total_orders_exists = 0; $total_orders_auto_cancel = 0; $total_rows_manual_cancel = 0; $lastOrderCount = null; if ($total_orders > 0) { $total_files_processedok++; $amazon_lastname = $amazon_id == $amazon_sample_id ? $amazon_sample_lastname : $amazon_refill_lastname; $import_date = date('Y-m-d H:i:s'); $ean_detail_info = $amazon_id == $amazon_sample_id ? null : $class_jo->getAMVD_AutoCancelSupportingData($po_pid_collection, $sp_specsets); $line_counter = $items_starting_rows_in_excel; foreach ($orders as $o) { $line_counter++; $logger->write(date("H:i:s") . " Processing Line {$line_counter} PO={$o['order_id']} / EAN={$o['products_ean']} / Qty={$o['order_quantity']}"); $auto_cancel_rule = $amazon_id == $amazon_sample_id ? false : $class_jo->checkAMVD_AutoCancelRule($o['products_ean'], $ean_detail_info, $sp_specsets); if ($o['order_quantity'] > 0 && !$auto_cancel_rule) { $dateonly = date('Y-m-d', $o['order_date']); if (!in_array($o['customer_shipping_id'], $amazon_shipment_id)) { if (!in_array($o['order_id'], $new_shipping_id_orders)) { $subjet = 'AM.VD New Shipping ID'; $message = 'We have received a new Shipping ID from AM.VD: ' . $o['customer_shipping_id'] . ' - Please check and update this PO#: ' . $o['order_id']; tep_mail(EMAIL_NAME_DEBUGR, EMAIL_ADDRESS_DEBUGR, $subjet, $message, FROM_EMAIL_NAME, FROM_EMAIL_ADDRESS, false); $new_shipping_id_orders[] = $o['order_id']; } } $logger->write("Auto cancel rule passed, looping quantity to create order"); for ($qty = 1; $qty <= $o['order_quantity']; $qty++) { if (!isset($daily_counter[$dateonly])) { $daily_counter[$dateonly] = $class_jo->nextDailyCounter($jng_sp_id, $dateonly); } else {
} break; case 'ACK_STATE': if (is_null($i)) { if ($jng_sp_id == '5') { //AM.VD Auto Cancelation Rule $ean_pinfo = $class_ean->getProductArticle($ean); $po_pid_collection = array(); $po_pid_collection[$ean] = $ean_pinfo['products_id']; if (isset($ean_detail_info_collections[$ean])) { $ean_detail_info = $ean_detail_info_collections[$ean]; } else { $ean_detail_info = $class_jo->getAMVD_AutoCancelSupportingData($po_pid_collection); $ean_detail_info_collections[$ean] = $ean_detail_info; } $as_key = $class_jo->checkAMVD_AutoCancelRule($ean, $ean_detail_info, $sp_specsets) ? 'CP' : 'CO'; } else { $as_key = 'CO'; } } else { $as_key = $i['order_quantity'] == 0 ? 'CO' : 'AC'; } $data = $cell->firstChild; $data->removeChild($data->firstChild); $data->appendChild(new DOMText(utf8_encode($ack_state[$as_key]))); break; case 'PREV_ERROR': case 'VEN_CODE': case 'FC': case 'CONDITION': case 'PO_DATE':
$eans[] = '4050878310202'; $eans[] = '4050878435202'; $eans[] = '4050878001780'; $eans[] = '4050878302702'; $eans[] = '4050878395483'; $eans[] = '4050878221843'; $eans[] = '4050878446529'; $eans[] = '4050878438951'; $eans[] = '4050878101862'; $eans[] = '4050878282493'; $eans[] = '4050878332631'; $eans[] = '4050878292652'; $eans[] = '4050878436681'; $eans[] = '4050878446871'; $po_pid_collection = array(); foreach ($eans as $ean) { $p = $class_ean->getProductArticle($ean); $po_pid_collection[$ean] = $p['products_id']; } $ean_detail_info = $class_jo->getAMVD_AutoCancelSupportingData($po_pid_collection, $sp_specsets); echo "<pre>"; //var_dump($ean_detail_info); echo "EAN,PID,CANCEL - Article Sold : Product Sold\n"; foreach ($po_pid_collection as $ean => $pid) { $result = $class_jo->checkAMVD_AutoCancelRule($ean, $ean_detail_info, $sp_specsets); echo "{$ean},{$pid},"; echo $result ? '1' : '0'; echo " - " . $ean_detail_info[$ean]['total_sold'] . " : " . $ean_detail_info[$ean]['total_sold_products']; echo "\n"; } echo "<pre>";