} $dlength = tep_db_query($qlength); $rlength = tep_db_fetch_array($dlength); $return_code_ypos++; $n++; $pdf->setX($cellstart); $pdf->setFont('Arial', '', $fontsize_sml); $pdf->Cell($cell1size, $cell_height, $n, 1, 0, 'C'); $pdf->Cell($cell2size, $cell_height, $item['products_model'], 1); $category = $class_o->getCategories($item['orders_products_id']); use_class('products_brand'); $class_pb = new products_brand(); $product_brand = $class_pb->retrieveDetail($item['products_brand_id']); $product_name = $class_pm->displayProductName($item['products_id'], 60); $pdf->Cell($cell3size, $cell_height, html_entity_decode($product_name), 1); $grosse = $rlength['length'] > 0 ? textLength($rlength['length']) : ''; $pdf->Cell($cell4size, $cell_height, $grosse, 1, 0, 'C'); $pdf->Cell($cell5size, $cell_height, '', 1); $pdf->Cell($cell6size, $cell_height, '', 1, 1); $ypos += $cell_height; } $ypos += 8; /* $pdf->setXY($cellstart, $ypos); $pdf->Cell(10, 10, 'Pos.', 1, 0, 'C'); $pdf->MultiCell(30, 5, 'Rücksendegrund'."\n".'(2-stellig)', 1, 'C'); $n = 0; foreach($items as $item){ $n++; $pdf->setX($cellstart);
function drawArticleLine($pid, $aid, $active, $ean, $length, $item_id = null, $last_update = null, $stock = null, $reported = '0', $booked = '0', $preproduce = '0', $ondemand = '0', $realtotal = null, $realondemand = null, $locked = false) { global $class_pm, $tabindex; if (!isset($tabindex)) { $tabindex = 1; } $disabled = $locked ? ' disabled="disabled"' : ''; $inactive = $active == '1' ? '' : ' notice" title="Inactive Article'; $result = array(); $result['ao'] = '<div id="' . $pid . '-' . $aid . '-' . $ean . '" class="article aid' . $inactive . '">' . 'EAN ' . $ean . ($length > 0 ? ' ⋅ ' . textLength($length) : '') . '</div>'; $stock_current = $class_pm->stockRetrieve(WAREHOUSE_ID_PRODUCTS_HAMBURG, $pid, $aid); if (!is_null($item_id)) { $result['as'] = '<div class="article"><span id="stsaved-' . $pid . '-' . $aid . '" title="Saved on ' . date('d.m', strtotime($last_update)) . '">' . $stock . '</span> (<span id="st-' . $pid . '-' . $aid . '">' . $stock_current . '</span>)</div>'; $result['aa'] = '<div class="article"><input id="upd-' . $pid . '-' . $aid . '" type="button" value="update" disabled="disabled" /><input type="hidden" name="item_id" value="' . $item_id . '" /></div>'; } else { $result['as'] = '<div id="st-' . $pid . '-' . $aid . '" class="article">' . $stock_current . '</div>'; } $result['ar'] = '<div class="article"><input id="re-' . $pid . '-' . $aid . '" type="text" tabindex="' . $tabindex . '" class="re number tgcalc" name="qty_reported" value="' . $reported . '" ' . $disabled . '/><div>'; $tabindex++; $result['ab'] = '<div class="article"><input id="bo-' . $pid . '-' . $aid . '" type="text" tabindex="' . $tabindex . '" class="bo number tgcalc" name="qty_booked" value="' . $booked . '" ' . $disabled . '/><div>'; $tabindex++; $result['ap'] = '<div class="article"><input id="pp-' . $pid . '-' . $aid . '" type="text" tabindex="' . $tabindex . '" class="pp number tgcalc" name="qty_preproduce" value="' . $preproduce . '" ' . $disabled . '/><div>'; $tabindex++; $result['ad'] = '<div class="article"><input id="od-' . $pid . '-' . $aid . '" type="text" tabindex="' . $tabindex . '" class="od number tgcalc" name="qty_ondemand" value="' . $ondemand . '" ' . $disabled . '/><div>'; $tabindex++; $result['rt'] = is_null($realtotal) ? '' : '<div class="article rto">' . $realtotal . '</div>'; $result['rd'] = is_null($realondemand) ? '' : '<div class="article rod">' . $realondemand . '</div>'; return $result; }
function getANR($pcode, $length) { $a_nr = $pcode; if ($length > 0) { $a_nr .= '_' . textLength($length, false); } return $a_nr; }
$pr_style = $catalog['status_price'] == '0' ? 'style="background:#fcc"' : ''; $discstyle = $product_disc < 0 ? 'style="color:#f00;"' : ''; if (!$have_articles) { $data_length = $product_length == 0 ? '-' : textLength($product_length); $data_price_old = '<input type="text" name="price_old" value="' . $catalog['price_old'] . '" />'; $data_price = '<input type="text" name="price" value="' . $catalog['price'] . '" ' . $pr_style . ' />'; $data_disc = '<div ' . $discstyle . '>' . ($product_disc == '' ? ' ' : $product_disc) . '</div>'; } else { $data_length = '<input type="text" class="bold" name="def-len" value="' . textLength($product_length) . '" disabled="disabled" />'; $data_price_old = '<input type="text" class="bold" name="price_old" value="' . $catalog['price_old'] . '" />'; $data_price = '<input type="text" class="bold" name="price" value="' . $catalog['price'] . '" ' . $pr_style . ' />'; $data_disc = '<input type="text" class="bold" name="def-disc" value="' . ($product_disc == '' ? '-' : $product_disc) . '" ' . $discstyle . ' disabled="disabled" />'; foreach ($articles as $a) { $product_disc = $a['price_old'] > 0 ? number_format(($a['price_old'] - $a['price']) / $a['price_old'] * 100, 1) . '%' : ''; $discstyle = $product_disc < 0 ? 'style="color:#f00;"' : ''; $data_length .= '<input type="text" value="' . textLength($a['length']) . '" disabled="disabled" />'; $data_price_old .= '<input type="text" name="pa-price_old-' . $a['products_articles_id'] . '" value="' . $a['price_old'] . '" />'; $data_price .= '<input type="text" name="pa-price-' . $a['products_articles_id'] . '" value="' . $a['price'] . '" />'; $data_disc .= '<input type="text" name="pa-disc-' . $a['products_articles_id'] . '" value="' . ($product_disc == '' ? '-' : $product_disc) . '" ' . $discstyle . ' disabled="disabled" />'; } } $t1 = array(); if ($product_length > 0) { $t1['len'] = $data_length; } $t1['po'] = $data_price_old; $t1['pr'] = $data_price; $t1['d'] = $data_disc; $t1['pn'] = number_format($product_netprice, 2); $t1['me'] = number_format($product['p']['material_expenses'], 2); $t1['pf'] = number_format($product_profit, 2);
/** * Construct xml content * @global products_minierp $class_pm * @global jng_sp_catalog $class_jc * @global int $lid * @param object $xmlt * @param array $p_data * @param int $article_counter * @param string $xml_articledata * @param array $article_data */ function constructXMLArticle(&$xmlt, $p_data, $article_counter, $xml_articledata, $article_data = null) { global $class_pm, $class_jc, $lid, $catalogs, $images_uploaded; $pid = $p_data['p']['products_id']; $is_article = is_array($article_data) && isset($article_data['products_articles_id']); if ($is_article) { $aid = $article_data['products_articles_id']; $a_ean = $article_data['products_ean']; $a_length = $article_data['length']; } else { $aid = '0'; $a_ean = $p_data['p']['products_ean']; $a_length = $p_data['pnc']['products_length']; } $article_order_min = 1; $article_order_max = 8; //ARTICLE $xml_article = $xmlt->drawTag($xml_articledata, 'ARTICLE'); if ($p_data['p']['active_status'] == '0' || $article_data['active_status']) { //Set inactive if either product / article is killed $a_active = '0'; } else { //Otherwise use catalog active status //First set default active status is 0 $a_active = '0'; //Then, set as active if activated in at least 1 channel foreach ($catalogs[$pid] as $tb_channel => $cat) { if ($cat['active_status'] == '1') { $a_active = '1'; break; } } } //ARTICLE NUMBERS, 2 OPTIONS: //$a_nr = "P$pid"."A$aid"; $a_nr = $p_data['p']['products_model']; if ($a_length > 0) { $a_nr .= '_' . intval($a_length < 10 ? $a_length * 10 : $a_length); } $xmlt->drawTag($xml_article, 'A_NR', $a_nr); $xmlt->drawTag($xml_article, 'A_ACTIVE', $a_active); $xmlt->drawTag($xml_article, 'A_EAN', $a_ean); $xmlt->drawTag($xml_article, 'A_PROD_NR', $a_nr); $xmlt->drawTag($xml_article, 'A_SORT', $article_counter); $have_variant = $a_length > 0 || $p_data['colors_total'] > 0; if ($have_variant) { //A_VARIANTDATA $xml_avariantdata = $xmlt->drawTag($xml_article, 'A_VARIANTDATA'); //VARIANT LENGTH if ($a_length > 0) { //A_VARIANT (LENGTH) //$length_key = ($p_data['categories_id'] == 29) ? 'Größe' : 'Länge'; //test to decide based on length inst $length_key = $a_length < 10 ? 'Größe' : 'Länge'; $xml_avariant = $xmlt->drawTag($xml_avariantdata, 'A_VARIANT', '', array('identifier' => 'name', 'key' => $length_key)); $xmlt->drawTag($xml_avariant, 'VALUE', textLength($a_length), array('xml:lang' => 'x-default')); } //VARIANT COLOR if (count($p_data['colors']) > 0) { $xml_avariant = $xmlt->drawTag($xml_avariantdata, 'A_VARIANT', '', array('identifier' => 'name', 'key' => 'Farbe')); $xmlt->drawTag($xml_avariant, 'VALUE', implode(' ', $p_data['colors']), array('xml:lang' => 'x-default')); } } //A_TAGS (Attributes) //A_PRICEDATA $xml_apricedata = $xmlt->drawTag($xml_article, 'A_PRICEDATA'); foreach ($catalogs[$pid] as $tb_channel => $cat) { //A_PRICE ${"xml_aprice_" . $a_nr} = $xmlt->drawTag($xml_apricedata, 'A_PRICE', '', array('channel' => $tb_channel)); //A_VK $xmlt->drawTag(${"xml_aprice_" . $a_nr}, 'A_VK', $cat['price']); if ($cat['price_old'] > 0) { //A_VK_OLD $xmlt->drawTag(${"xml_aprice_" . $a_nr}, 'A_VK_OLD', $cat['price_old']); } } //Only generate images and include in XML if needed $upload_image = false; foreach ($catalogs[$pid] as $tb_channel => $cat) { if ($cat['image_uploaded'] == '0') { $upload_image = true; if (!in_array($pid, $images_uploaded)) { $images_uploaded[] = $pid; } break; } } if ($upload_image) { //A_MEDIADATA $xml_amediadata = $xmlt->drawTag($xml_article, 'A_MEDIADATA'); $media_sort = 0; $images_path = DIR_WS_IMAGES; $product_folder = 'products_photos/'; $tb_temp_folder = 'tb_temp/'; $today_tb_image_folder = date('Ymd') . '/'; //CREATE tb_temp FOLDER IF NOT EXIST $tb_temp_path = $images_path . $product_folder . $tb_temp_folder; if (!is_dir($tb_temp_path)) { mkdir($tb_temp_path, 0750); } //CREATE TODAY IMAGE FOLDER IF NOT EXIST $today_tb_image_path = $tb_temp_path . $today_tb_image_folder; if (!is_dir($today_tb_image_path)) { mkdir($today_tb_image_path, 0750); } //URL TODAY IMAGE "BASE FOLDER" THAT WILL USED AS TB IMAGE URL REFERENCE $tb_image_url_reference = JNGWEBADDRESS . 'images/' . $product_folder . $tb_temp_folder . $today_tb_image_folder; $unixtimestamp = time(); /* //DEFAULT IMAGES GROUP (MAIN IMAGE 1 + PEI) $products_images = array(); $idef_img_sort = 0; $products_images[] = $p_data['p']['products_image']; foreach ($p_data['pei'] as $extra_image) { $products_images[] = $extra_image; } foreach ($products_images as $key => $product_image) { $media_sort++; $idef_img_sort++; //COPYING IMAGES TO TB TEMP FOLDER $img_location = DIR_WS_IMAGES.$product_image; $new_filename = "$pid-IDEF-$unixtimestamp-$idef_img_sort.jpg"; $new_location = $today_tb_image_path . $new_filename; copy($img_location, $new_location); $url_image = $tb_image_url_reference.$new_filename; $xmlt->drawTag( $xml_amediadata, 'A_MEDIA', $url_image, array('type' => 'IMAGE-DEFAULT','sort' => $media_sort)); } */ //AMAZON IMAGES GROUP, NOW USED AS DEFAULT //(MAIN IMAGE 2 IF EXIST, IF NOT USE MAIN IMAGE 1 INSTEAD + PEI) //TODO: After we clear our pci table we can switch back and // use above DEFAULT IMAGES GROUP and remove this group $products_images = array(); $amvd_img_sort = 0; if ($p_data['pci']['products_clear_image'] != '') { $products_images[] = $p_data['pci']['products_clear_image']; } else { $products_images[] = $p_data['p']['products_image']; } foreach ($p_data['pei'] as $extra_image) { $products_images[] = $extra_image; } foreach ($products_images as $key => $product_image) { $media_sort++; $amvd_img_sort++; //COPYING IMAGES TO TB TEMP FOLDER $img_location = DIR_WS_IMAGES . $product_image; $new_filename = "{$pid}-AMVD-{$unixtimestamp}-{$amvd_img_sort}.jpg"; $new_location = $today_tb_image_path . $new_filename; copy($img_location, $new_location); $url_image = $tb_image_url_reference . $new_filename; $xmlt->drawTag($xml_amediadata, 'A_MEDIA', $url_image, array('type' => 'IMAGE-DEFAULT', 'sort' => $media_sort)); //array('type' => 'IMAGE-AMAZON','sort' => $media_sort)); } //ZALANDO IMAGES GROUP (MAIN IMAGE 3 + PEI) //USE ALTERNATE MAIN IMAGE WHEN POSSIBLE //Only included if products are added to to zalando catalog if (isset($catalogs[$pid]['zade'])) { $pei_temp = $p_data['pei']; $products_images = array(); $zade_img_sort = 0; if (!is_null($p_data['pei_main'])) { $products_images[] = $pei_temp[$p_data['pei_main']]; unset($pei_temp[$p_data['pei_main']]); } $products_images[] = $p_data['p']['products_pure_image']; foreach ($pei_temp as $extra_image) { $products_images[] = $extra_image; } foreach ($products_images as $key => $product_image) { $media_sort++; $zade_img_sort++; //COPYING IMAGES TO TB TEMP FOLDER $img_location = DIR_WS_IMAGES . $product_image; $new_filename = "{$pid}-ZADE-{$unixtimestamp}-{$zade_img_sort}.jpg"; $new_location = $today_tb_image_path . $new_filename; copy($img_location, $new_location); $url_image = $tb_image_url_reference . $new_filename; $xmlt->drawTag($xml_amediadata, 'A_MEDIA', $url_image, array('type' => 'IMAGE-ZALANDO', 'sort' => $media_sort)); } } } //A_STOCK //We currently report real stock to be used by all channels //the name storage-zade is only because zade is our 1st channel //and we weren't sure if we have one or multiple storage $hh_stock = $class_pm->stockRetrieve(WAREHOUSE_ID_PRODUCTS_HAMBURG, $pid, $aid, true); $xmlt->drawTag($xml_article, 'A_STOCK', $hh_stock, array('identifier' => 'key', 'key' => 'storage-zade')); //A_ORDER_MIN $xmlt->drawTag($xml_article, 'A_ORDER_MIN', $article_order_min); //A_ORDER_MAX $xmlt->drawTag($xml_article, 'A_ORDER_MAX', $article_order_max); }
$content .= '<div class="notice smallText">' . $forecasting_conf['promotion-orders-desc'] . '</div>'; $content .= '<div style="margin-top:5px;"><table border="0" cellspacing="0" cellpadding="0">'; $content .= '<tr><td>L30D Daily average</td><td>=</td><td>' . $daily_sold . '</td></tr>'; $content .= '<tr><td>L30D Weekly average</td><td>=</td><td>' . $last_week_sold . '</td></tr>'; $content .= '<tr><td>Today</td><td>=</td><td class="w080">KW ' . $kw_now . '</td></tr>'; $content .= '<tr><td colspan="3" class="bold">Graph is using product level forecasting (not article level)</td></tr>'; $content .= '</table></div>'; $content .= '</div>'; $content .= '<div style="clear:both;padding-top:20px;">'; $content .= '<h2>Depot Refill using Forecast'; if ($articles_id != '*' && count($p->articles) > 0) { $content .= ' <span id="txt-show-all-articles" class="pointer blue smallText">«show all articles»</span>'; } $content .= '</h2>'; foreach ($p->articles as $aid => $a) { $a_title = $a['length'] > 0 ? textLength($a['length']) : '<span class="notice">No Length</span>'; $daily_sold = $p->log_articles[$aid][Product::FORECAST_DAILY_COLUMN_NAME]; $stock_target = $p->getDIOHstockTarget($aid); $stock_available = $p->retrieveStockQuantity($aid); $stock_available_dioh = $p->displayDIOH($aid, $stock_available); $refill_ordered = $p->retrieveRefillQuantity($aid); $missing_qty = $stock_target - ($stock_available + $refill_ordered); if ($missing_qty < 0) { $missing_qty = 0; } $show_box = $articles_id == '*' || $articles_id == $aid ? '' : 'display:none;'; $content .= '<div class="float-box w300 ui-corner-all" style="padding:5px;margin:0 10px 10px 0;' . $show_box . '"><table border="0" cellspacing="0" cellpadding="0">'; $content .= '<tr><td colspan="3" class="bold">EAN ' . $a['products_ean'] . ' - ' . $a_title . '</td></tr>'; $content .= '<tr><td>Daily Average <span class="red" title="' . $forecasting_conf['promotion-orders-desc'] . '">(!)</span></td><td>=</td><td>' . $daily_sold . '</td></tr>'; $content .= '<tr><td title="Stock Target based on DIOH Target Settings">Stock Target (' . Product::$diohStopLevel[$p->stars] . ' days)</td><td>=</td><td>' . $stock_target . '</td></tr>'; $content .= '<tr><td>Stock Available</td><td>=</td><td>' . $stock_available . ' <span class="notice">(' . $stock_available_dioh . ')</span></td></tr>';
function printQualityControl($product) { $length = $product['final_length']; $materials = $product['elements']['materials']; $product_qty = $product['qty']; $products_id = $product['id']; $product_text = ''; foreach ($product['options'] as $key => $value) { if ($value == 'Text') { $product_text = $product['options_values'][$key]; } } $cpid_bd = 1; $tot_beads = 0; $cpid_cp = 2; $tot_chainpearls = 0; $cpid_cl = 3; $clasps = array(); $cpid_pn = array(4, 8); $tot_pendants = 0; $cpid_sp = 5; $tot_spacers = 0; $tot_weight = 0; $custom = array(); foreach ($materials as $m) { $id = $m['elements_id']; $qty = $m['quantity']; $cpid = $this->elements[$id]['cpid']; $weight = $this->elements[$id]['weight']; if ($cpid == $cpid_bd) { $tot_beads += $qty; } elseif ($cpid == $cpid_cp) { $tot_chainpearls += $qty; } elseif ($cpid == $cpid_cl) { $clasps[] = $id; } elseif (in_array($cpid, $cpid_pn)) { $tot_pendants += $qty; } elseif ($cpid == $cpid_sp) { $tot_spacers += $qty; } $tot_weight += $weight; if (isset($m['custom'])) { $custom[] = nl2br(implode("\n\n", $m['custom'])); } } $result = array(); $result[] = '<div class="table-head"><h2>Quality Control</h2></div>'; $result[] = '<div>'; $result[] = '<table class="qc" border="0" cellpadding="0" cellspacing="0">'; $result[] = '<tr>'; $result[] = '<th class="col_no">No</th>'; $result[] = '<th class="col_len">Total Length</th>'; $result[] = '<th class="col_gp">Finishing</th>'; $result[] = '<th class="col_qc">Overall Quality</th>'; $result[] = '<th class="col_by">QC By</th>'; $result[] = '</tr>'; for ($p = 1; $p <= $product_qty; $p++) { if (count($custom) > 0) { $custom_text = implode('<br /><br />', $custom); } elseif ($product_text != '') { $custom_text = $product_text; } else { $custom_text = '-'; } $finishing = array(); if (in_array($products_id, $this->gold_plated)) { $finishing[] = 'Goldplating'; } $result[] = '<tr>'; $result[] = '<td class="col_no">' . $p . '</td>'; $result[] = '<td>' . ($length > 0 ? '~ ' . textLength($length) : ' ') . '</td>'; $result[] = '<td>' . (count($finishing) > 0 ? implode(', ', $finishing) : ' ') . '</td>'; $result[] = '<td>Check</td>'; $result[] = '<td> </td>'; $result[] = '</tr>'; } $result[] = '</table>'; $result[] = '</div>'; $result[] = '<div> </div>'; $result_text = implode("\n", $result); return $result_text; }
$q_min_sold = tep_db_query("SELECT {$bg_settings['log_column']} AS actual_sold FROM products_log WHERE products_id = {$product_id}"); $r_min_sold = tep_db_fetch_array($q_min_sold); $bg_status = 'bad'; if ($r_min_sold['actual_sold'] >= $bg_settings['min_sold_good']) { $bg_status = 'good'; } if ($r_min_sold['actual_sold'] >= $bg_settings['min_sold_best']) { $bg_status = 'best'; } $qa = "SELECT p.products_id, 0 AS products_articles_id, pnc.products_length AS length FROM products p LEFT JOIN products_non_configurator pnc ON pnc.products_id = p.products_id"; $qa .= " WHERE p.products_id = {$product_id}"; $qa .= " UNION ALL"; $qa .= " SELECT products_id, products_articles_id, length FROM products_articles WHERE products_id = {$product_id}"; $pa = tep_db_query($qa); if (tep_db_num_rows($pa) > 0) { $result .= '<table border="0" cellpadding="0" cellspacing="0">'; $result .= '<tr><td colspan="2"><span class="' . $bg_status . '">' . strtoupper($bg_status) . ' SELLING PRODUCT'; $result .= $bg_status == 'bad' ? '<br/>Please Put In Bin' : '<br/>Please QC, if bad please repair it first before send back to HH'; $result .= '</span></td></tr>'; $result .= '</table>'; $result .= '<table border="0" cellpadding="0" cellspacing="0">'; $result .= '<tr><td colspan="2"> </td></tr>'; $result .= '<tr><td colspan="2"><h3>Length(s) of Product ' . $product_id . ' / ' . $product_model . '</h3></td></tr>'; while ($r = tep_db_fetch_array($pa)) { $result .= '<tr><td>' . textLength($r['length']) . '</td><td><input type="button" id="' . $product_id . '-' . $r['products_articles_id'] . '-' . $bctype . '" class="print-label" value="Print Label" /><span class="msg"></span></td></tr>'; } $result .= '</table>'; } else { $result = "Product {$product_id} Not Found!"; } echo $result;
$result .= '<th>Price</th>'; $result .= '<th>Qty</th>'; $result .= '<th>Status</th>'; $result .= '<th>Status Since</th>'; $result .= '</tr>'; $result .= '</thead>'; $prev_oid = ''; $rowclass = 'e'; $rowcount = 0; $result .= '<tbody>'; while ($row = tep_db_fetch_array($r)) { $rowcount++; $status_summary[$row['status']] += $row['quantity']; if ($rowcount <= $limitrows) { $type = $class_do->translateOrderSource($row['trans_type'], $row['trans_id'], true, null, $row['products_id']); $length = textLength($row['article_length'] > 0 ? $row['article_length'] : $row['products_length'], false); $row['article_number'] = $row['products_model'] . ($length > 0 ? '_' . $length : ''); $article = '<div><a href="?open=product-detail&products_id=' . $row['products_id'] . '" target="_blank" title="View Product Detail">' . $row['article_number'] . '</a></div>'; $pimg = webImageSource($row['products_image'], '500'); if ($pimg != '') { $thumb = '<div class="thumb" style="display:none;"><a href="' . $pimg . '" class="view_image" title="View Image of ' . $row['article_number'] . '">' . webImage($row['products_image'], '80', '80', '', 'img-border img-padding') . '</a></div>'; $article = $thumb . $article; } $status_date_ts = strtotime($row['status_date'] == '' ? $row['order_date'] : $row['status_date']); $status_date = date('d-M-y', $status_date_ts); if ($status_date_ts < $statusdaymrk) { $status_date = '<span class="bold red">' . $status_date . '</span>'; } if ($row['depot_orders_id'] != $prev_oid) { $rowclass = $rowclass == 'o' ? 'e' : 'o'; }
function checkProductOnBag($sp_type, $order_id, $ean_code, $list_return_need_refresh = false) { global $class_jo; global $class_o; use_class('payone'); use_class('products_minierp'); use_class('products_ean'); $class_payone = new payone(); $class_pm = new products_minierp(); $class_pean = new products_ean(); $status = 'RETURNNOTALLOWED'; $result = array(); $is_best_product = false; $articles = $class_pean->getProductArticle($ean_code); $length = textLength($articles['length']); //Default value of image additional info (this info will displayed on product image of Mod03ProductBagCheckView.mxml $image_additional_info_text = ''; //Notes: below style is adjusted with flex Property Styles, please match it with it if need to add more styles $image_additional_info_style[] = 'color:#000000'; $image_additional_info_style[] = 'fontSize:25'; $image_additional_info_style[] = 'textAlign:right'; //start, end, left, right, center, justify //Return could be created at least 1 day after it is sent $qty = 0; $qtyr = 0; $latest_shipping = date('Y-m-d 23:59:59', strtotime('yesterday')); if (strtolower($sp_type) == 's') { $qc = "SELECT joi.jng_sp_orders_items_id, joi.products_id" . ", joi.order_quantity, MAX(joish.status_date) AS sent_date" . " FROM jng_sp_orders_items joi" . " INNER JOIN jng_sp_orders_items_status_history joish" . " ON joish.jng_sp_orders_items_id = joi.jng_sp_orders_items_id" . " AND joish.status = 9" . " WHERE joi.jng_sp_orders_id = '{$order_id}'" . " AND joi.products_ean = '{$ean_code}' AND joi.status NOT IN (10,12)" . " GROUP BY jng_sp_orders_items_id" . " HAVING sent_date <= '{$latest_shipping}'"; $c = tep_db_query($qc); //We need to handle if 1 article is bought multiple times as diff item while ($rc = tep_db_fetch_array($c)) { $item_id = $rc['jng_sp_orders_items_id']; $qty = intval($rc['order_quantity']); $products_id = $rc['products_id']; $qc2 = "SELECT SUM(return_quantity) AS return_quantity" . " FROM jng_sp_orders_items_return" . " WHERE jng_sp_orders_items_id = '{$item_id}'"; $c2 = tep_db_query($qc2); $r2 = tep_db_fetch_array($c2); $qtyr = intval($r2['return_quantity']); if ($qty > $qtyr) { break; } } } elseif (strtolower($sp_type) == 'j') { $products_id = $articles['products_id']; $products_articles_id = $articles['products_articles_id']; $qc = "SELECT op.orders_products_id, op.products_id" . ", op.products_quantity, MAX(opsh.status_date) AS sent_date" . " FROM orders_products op" . " INNER JOIN orders_products_status_history opsh" . " ON opsh.orders_products_id = op.orders_products_id" . " AND opsh.status = 9" . " WHERE op.orders_id = '{$order_id}'" . " AND op.products_id = '{$products_id}'" . " AND op.products_articles_id = '{$products_articles_id}'" . " AND op.status NOT IN (10,12)" . " GROUP BY orders_products_id" . " HAVING sent_date <= '{$latest_shipping}'"; $c = tep_db_query($qc); //We need to handle if 1 article is bought multiple times as diff item while ($rc = tep_db_fetch_array($c)) { $item_id = $rc['orders_products_id']; $qty = intval($rc['products_quantity']); $products_id = $rc['products_id']; $qc2 = "SELECT SUM(return_qty) AS return_quantity" . " FROM orders_products_return" . " WHERE orders_products_id = '{$item_id}'"; $c2 = tep_db_query($qc2); $r2 = tep_db_fetch_array($c2); $qtyr = intval($r2['return_quantity']); if ($qty > $qtyr) { break; } } } if ($qty > $qtyr) { $status = 'MCCHECKPRODUCTONBAG'; //Return reasons $return_reasons[] = 'Goldplating'; $return_reasons[] = 'Stone missing'; $return_reasons[] = 'Silver not polished'; $return_reasons[] = 'Scratches'; $return_reasons[] = 'Knot in chain'; $return_reasons[] = 'Soldering point visible'; $return_reasons[] = 'Broken'; $return_reasons[] = 'Out of shape'; $return_reasons[] = 'Tarnishing'; $return_reasons[] = 'Too big'; $return_reasons[] = 'Too large'; $return_reasons[] = 'Different from image'; $return_reasons[] = 'Change mind'; $return_reasons[] = 'Double order'; $return_reasons[] = 'Quality'; $return_reasons[] = 'Goldplated peeled off'; $return_reasons[] = 'Wrong color'; $return_reasons[] = 'Wrong product'; $return_reasons[] = 'Bad setting'; sort($return_reasons); //Note: DO NOT change Others, since this value used on some logic on MC codes $return_reasons = array_merge(array('Others'), $return_reasons); $result['return_reason_list'] = $return_reasons; //Show Swarovski Elements text when product contain material swarovski "4" if ($class_pm->productContainMaterials($products_id, 4)) { $image_additional_info_text = 'Swarovski Elements'; } } if ($products_id != '' && $products_id != 0) { /*DEACTIVATE CHECKING, SINCE ALL RETURNED PRODUCTS ARE KEPT ON HH DEPOT $is_best_product = $class_pm->isBestProduct($products_id); */ $is_best_product = true; $result['product_id'] = $products_id; $qp = "SELECT p.*, pd.products_name FROM products p INNER JOIN products_description pd ON p.products_id = pd.products_id\n WHERE p.products_id = {$products_id} AND pd.language_id = 2"; $dbqp = tep_db_query($qp); $rp = tep_db_fetch_array($dbqp); $result['is_best_product'] = $is_best_product; $result['product_code'] = $rp['products_model']; $result['product_name'] = $rp['products_name']; $result['product_length'] = $length; $result['product_image'] = webImageSource($rp['products_image'], '350'); //'http://www.julie-grace.de/images/imagecache/500x500_03601033.jpg'; $result['product_image_80'] = webImageSource($rp['products_image'], '80'); //'http://www.julie-grace.de/images/imagecache/500x500_03601033.jpg'; } $result['ean_code'] = $ean_code; $result['list_return_need_refresh'] = $list_return_need_refresh; $result['order_product_id'] = $item_id; $result['status'] = $status; $result['image_additional_info_text'] = $image_additional_info_text; $result['image_additional_info_style'] = $image_additional_info_style; return $result; }
$matexp_tot = $stock_on_total * $matexp; if ($row['bin_code'] != '') { $total_bins++; } else { $total_bins_unknown++; } $total_qty_stock += $stock_available; $total_qty_booked_m += $stock_on_and_bookedmanually; $total_qty_booked_r += $stock_on_and_bookedbyrealorder; $total_qty_total += $stock_on_total; $total_matexp_tot += $matexp_tot; $st = array(); $st['bin'] = $class_bins->getCleanBinCode($row['bin_code']); $st['cat'] = $row['categories_name']; $st['ean'] = $row['products_ean']; $st['idl'] = $row['products_id'] . ($row['length'] > 0 ? ' (' . textLength($row['length'], false) . ')' : ''); $st['mxs'] = displayCurrency('EUR', $matexp); $st['mxt'] = displayCurrency('EUR', $matexp_tot); $st['qty'] = number_format($stock_available); $st['bok 1'] = number_format($stock_on_and_bookedmanually); $st['bok 2'] = number_format($stock_on_and_bookedbyrealorder); $st['tot'] = number_format($stock_on_total); $st['act'] = ' '; $stocks_table[] = $st; } $total_products = count($products); $total_articles = count($articles); $title = 'Stock List of ' . $segment['name']; if ($rack_id != '') { $title .= ' - Rack ' . $rack_no; }
$value = ''; switch ($hkey) { case 'id': //Nr. $value = $i['order_item_count'] == '0' ? ' ' : $i['order_item_count']; break; case 'image': //Product $value = '<div>'; $value .= '<a href="?open=product-detail&products_id=' . $i['products_id'] . '" target="_blank" title="View/Manage Product Detail">' . $product['p']['products_model'] . '</a>'; $length = ''; if (!is_null($article)) { $length = textLength($article['length']); } else { if ($product['pnc']['products_length'] > 0) { $length = textLength($product['pnc']['products_length']); } } if ($length != '') { $value .= '-' . str_replace(' ', '', $length); } $value .= '</div>'; $value .= '<div class="thumb smallText" style="display:none;">EAN ' . $i['products_ean'] . '</div>'; $img_zoom = webImageSource($product['p']['products_image'], '500'); if ($img_zoom != '') { $thumb = '<div class="thumb" style="display:none;"><a href="' . $img_zoom . '" class="view_image">' . webImage($product['p']['products_image'], '80', '80', '', 'img-border img-padding') . '</a></div>'; $value = $thumb . $value; } break; case 'source': //EAN
$op_total_product = 0; $op_total_price = 0; $ret_count = 0; foreach ($returns as $row) { $ret_count++; $p_qty_pri = $row['return_qty'] * $row['final_price']; $op_total_product += $row['return_qty']; $op_total_price += $p_qty_pri; $product_configurator = $row['visible_status'] != ''; $ret_link = '<a href="?open=order-return&id=' . $row['orders_products_return_id'] . '&hidemenu=true" class="view_webpage" title="View Return Detail">More Info</a>'; $op_returned['sort'] = $ret_count; $op_returned['date'] = date('d.m.Y', strtotime($row['return_date'])); $promod = '<a href="?open=product-detail&products_id=' . $row['products_id'] . '" title="Manage Product Detail">'; $promod .= $row['products_model']; if ($row['products_length'] > 0) { $promod .= '_' . textLength($row['products_length'], false); } $promod .= '</a>'; $pimg = webImageSource($row['products_image'], '500'); if ($pimg != '') { $thumb = '<div class="thumb" style="display:none;"><a href="' . $pimg . '" class="view_image">' . webImage($row['products_image'], '80', '80', '', 'img-border img-padding') . '</a></div>'; $promod = $thumb . $promod; } $op_returned['model'] = $promod; //$op_returned['name'] = $row['products_name']; /* //PRODUCT ATTRIBUTES $op_id_temp = $row['orders_products_id']; $pa_query = tep_db_query("SELECT products_options, products_options_values FROM orders_products_attributes WHERE orders_products_id=$op_id_temp"); if(tep_db_num_rows($pa_query)>0) { $op_returned['name'] .= ' <small>';
function drawOrderDisplay($order_type, $order_id, $displaypart = 'ALL', $excludecurrentorderinhistory = true) { //$displaypart = 'ALL' / 'NEW' / 'HISTORY' global $class_do, $class_pm, $class_pa, $class_mc, $class_jo, $class_jc, $class_o, $sp_list; //ORDERED PRODUCTS DISPLAY SETTING $col_limit = 5; //max no of columns $row_limit = 5; //max no of rows $border = '1'; //border width $imgsize = '80'; //image size $padding = '5'; //box padding $margin = '10'; //box margin $po_limit = $col_limit * $row_limit; //max no of products - auto calc $powidth = ceil($col_limit * ($imgsize + 2 * ($border + $padding) + $margin) / 10) * 10; $total_price = 0; if ($order_type == 'SP') { use_class('jng_sp_customers_special'); $csl = new jng_sp_customers_special(); $order = $class_jo->retrieveDetail($order_id); $order_source = $sp_list[$order['jng_sp_id']]['name']; $order_products = $class_jo->retrieveItems($order_id); $customer = $class_jc->retrieveDetail(null, $order['jng_sp_id'], $order['customer_billing_id']); $list_type = $csl->getListType($customer['jng_sp_customers_id']); $cust_crown = $csl->getTypeSymbol($list_type, $customer['jng_sp_customers_id']); $customer_name = $cust_crown . $order['customer_billing_firstname'] . ' ' . $order['customer_billing_lastname']; $customer_address = $order['customer_billing_address']; if ($order['customer_billing_address2'] != '') { $customer_address .= ', ' . $order['customer_billing_address2']; } $customer_address .= ', ' . $order['customer_billing_postcode']; $customer_address .= ' ' . $order['customer_billing_city']; $customer_address .= ', ' . $order['customer_billing_country']; $products_ordered = $class_jc->retrieveOrdersItems($customer['jng_sp_customers_id']); $colname_order_id = 'jng_sp_orders_id'; $colname_items_id = 'jng_sp_orders_items_id'; $colname_order_date = 'order_date'; $colname_order_qty = 'order_quantity'; $colname_return_qty = 'return_quantity'; $colname_products_id = 'products_id'; $colname_products_code = 'article_number'; $colname_articles_id = 'products_articles_id'; $colname_custom_text1 = null; $colname_custom_text2 = null; $colname_custom_image = null; $order_history_display = null; $total_price = getTotalOrderAmount('S', $order_id); } elseif ($order_type == 'JG') { use_class('customers_special_list'); $csl = new customers_special_list(); $order = $class_o->retrieveDetail($order_id); $order_source = 'JULIE&GRACE'; $total_price = getTotalOrderAmount('J', $order_id, $order['currency']); $order_products = $class_o->retrieveProducts($order_id); //$customer = $class_mc->retrieveDetail($order['customers_id']); $list_type = $csl->getListType($order['customers_id']); $cust_crown = $csl->getTypeSymbol($list_type, $order['customers_id']); $customer_name = $cust_crown . $order['customers_name']; $customer_address = ''; if ($order['customers_company'] != '') { $customer_address .= $order['customers_company'] . ', '; } $customer_address .= $order['customers_street_address']; $customer_address .= ', ' . $order['customers_postcode']; $customer_address .= ' ' . $order['customers_city']; $customer_address .= ', ' . $order['customers_country']; $products_ordered = $class_mc->retrieveOrdersProducts($order['customers_id'], 'op.status>0'); $colname_order_id = 'orders_id'; $colname_items_id = 'orders_products_id'; $colname_order_date = 'date_purchased'; $colname_order_qty = 'products_quantity'; $colname_return_qty = 'return_quantity'; $colname_products_id = 'products_id'; $colname_products_code = 'products_model'; $colname_articles_id = 'products_articles_id'; $colname_custom_text1 = 'customers_text_line1'; $colname_custom_text2 = 'customers_text_line2'; $colname_custom_image = 'customers_image'; $order_history_display = null; } elseif ($order_type == 'DP') { $order = $class_do->retrieveDetail($order_id); $product_detail = $class_pm->retrieveDetail($order['products_id'], 'p'); $order['products_image'] = $product_detail['p']['products_image']; $order['products_model'] = $product_detail['p']['products_model']; $order['order_item_count'] = '1'; $order['order_item_total'] = '1'; $order_products = array(); $order_products[] = $order; $colname_order_id = 'depot_orders_id'; $colname_items_id = 'depot_orders_id'; $colname_order_date = 'order_date'; $colname_order_qty = 'quantity'; $colname_return_qty = ''; $colname_products_id = 'products_id'; $colname_products_code = 'products_model'; $colname_articles_id = 'articles_id'; $colname_custom_text1 = null; $colname_custom_text2 = null; $colname_custom_image = null; if ($order['trans_type'] == 'SP' || $order['trans_type'] == 'JG') { if ($order['trans_type'] == 'SP') { $item = $class_jo->retrieveItemDetail($order['trans_id']); //if ($item['jng_sp_id'] != '2') { //echo "<pre>"; //var_dump($item); //die("ttt"); if ($item['stock_status'] == '0') { $order_history_display = drawOrderDisplay($order['trans_type'], $item['jng_sp_orders_id'], 'HISTORY', false); } $total_price = getTotalOrderAmount('S', $item['jng_sp_orders_id']); //} } else { //die("test"); $item = $class_o->retrieveProductDetail($order['trans_id']); $total_price = getTotalOrderAmount('J', $item['orders_id']); if ($item['stock_status'] == '0') { $order_history_display = drawOrderDisplay($order['trans_type'], $item['orders_id'], 'HISTORY', false); } } } } $result = ''; if ($displaypart == 'ALL' || $displaypart == 'NEW') { //NEW ORDER $result .= '<h2 style="position:fixed;top:0;left:0;line-height:20px;width:480px;padding:5px 10px;background:#ccc;border-right:1px inset #666;">New ' . $order_type . ' Order ' . $order_id . ' (' . $total_price . ')</h2>'; //$result .= '<div style="position:fixed;top:30;bottom:0;left:0;width:480px;padding:10px;background:#efefef;border-right:1px inset #666;overflow:auto;">'; $result .= '<div id="box-order-items" style="position:fixed;top:30;bottom:0;height:93%;left:0;width:480px;padding:10px;background:#efefef;border-right:1px inset #666;overflow:auto;">'; $neworder = array(); $no = array(); $no['l'] = 'No'; $no['d'] = 'Image'; $no['t2'] = 'Info'; $no['q'] = 'Order<br/>Qty.'; $no['r'] = 'Stock Status<br /> and Actions'; $neworder[] = $no; foreach ($order_products as $op) { if ($op[$colname_articles_id] > 0) { $article = $class_pa->retrieveDetail($op[$colname_articles_id]); $prolength = $article['length']; } else { $product_detail = $class_pm->retrieveDetail($op[$colname_products_id], 'pnc'); $prolength = $product_detail['pnc']['products_length']; } $customize_info = ''; if (!is_null($colname_custom_text1) && !is_null($colname_custom_text2)) { if ($op[$colname_custom_text1] != '' || $op[$colname_custom_text2] != '') { $customize_info .= '<div style="margin-top:10px;">'; if ($op[$colname_custom_text1] != '') { $customize_info .= $op[$colname_custom_text1]; } if ($op[$colname_custom_text2] != '') { $customize_info .= '<br />' . $op[$colname_custom_text2]; } $customize_info .= '</div>'; } } if (!is_null($colname_custom_image) && $op[$colname_custom_image] != '') { $customize_info .= webImage($op[$colname_custom_image], '80', '80', 'Custom Image'); } $length_text = $prolength > 0 ? 'Length: ' . textLength($prolength) : '<span class="notice">No Length</span>'; //$tooltip_data = getTooltipThumbData($op[$colname_products_id], $op[$colname_articles_id], 0); $pdata = $class_pm->retrieveDetail($op[$colname_products_id], 'pl,sp'); $tooltip_text = '<table class="tiny" border="0" cellpadding="0" cellspacing="0" align="center">'; $tooltip_text .= '<tr><td width="80" title="Sold Last 30 Days">Sold L30D</td><td>' . intval($pdata['pl']['sold_monthly_1']) . ' products</td></tr>'; $tooltip_text .= '<tr><td>Total sold</td><td>' . intval($pdata['sp']['0']['total_sold']) . ' products</td></tr>'; $tooltip_text .= '<tr><td>Return Rate</td><td>' . number_format($pdata['sp']['0']['returned_rate'], 1) . '%</td></tr>'; $tooltip_text .= '<tr><td>Product Age</td><td>' . $pdata['sp']['0']['active_age'] . ' days</td></tr>'; $tooltip_text .= '</table>'; $info = array(); //var_dump($order_type); $info[] = $order_type . '-' . $op[$colname_items_id]; $info[] = $op['products_ean']; $info[] = $op[$colname_products_id] . ' / ' . $op[$colname_products_code]; $info[] = $length_text; $info[] = ' '; $info[] = '<strong>All SP Summary</strong>'; $info[] = $tooltip_text; $action_hidden = '<input type="hidden" id="' . $order_type . '-' . $op[$colname_items_id] . '" name="oiid" value="' . $op[$colname_items_id] . '" />'; $action_hidden .= '<input type="hidden" name="type" value="' . $order_type . '" />'; $action = array(); $action[] = stockStatusDisplay($op['stock_status'], $op['status'], $op[$colname_products_id], $op[$colname_articles_id], $op[$colname_order_qty], null); $action[] = ' '; if ($op['stock_status'] == 'S') { $action[] = '<input type="button" name="2" value="» Sourcing" class="bl green" />'; } elseif ($op['stock_status'] == 'R' || $op['stock_status'] == 'P' || $op['stock_status'] == 'W') { $action[] = '<input type="button" name="3" value="» Ready" class="bl green" />'; //$action[] = '<input type="button" name="test" value="» Sourcing" class="bl red" />'; } $action[] = '<input type="button" name="10" value="× Cancel" class="bl red" />'; $no = array(); $no['l'] = $op['order_item_count'] . '/' . $op['order_item_total']; $no['d'] = webImage($op['products_image'], '80', '80', 'Product Image') . $customize_info; $no['t2'] = implode('<br />', $info); if (isset($op['order_quantity'])) { $order_quantity = $op['order_quantity']; } elseif (isset($op['products_quantity'])) { $order_quantity = $op['products_quantity']; } else { $order_quantity = $op['quantity']; } $no['q'] = $order_quantity; $no['r'] = $action_hidden . implode('<br />', $action); $neworder[] = $no; } $result .= tep_draw_table('spo', $neworder); $result .= '<div class="buttons"><input type="button" name="nextorder" value="Next Order" class="button" /></div>'; $result .= '</div>'; //NEW ORDER - CLOSER } if (!is_null($order_history_display)) { $result .= $order_history_display; } elseif ($displaypart == 'ALL' || $displaypart == 'HISTORY') { $result .= '<div style="margin-left:510px;color:#666;" >'; //HISTORICAL INFO if ($order_type == 'DP') { $result .= '<h2>DEPOT ' . ($order['trans_type'] == 'AR' ? 'REFILL' : 'MANUAL ORDER') . '</h2>'; } else { //var_dump($order_type); $result .= '<h2>Customer Detail</h2>'; // $result .= '<table border="0" cellpadding="0" cellspacing="0">'; // $result .= '<tr><td width="150">Customer From</td><td>'.$order_source.'</td></tr>'; // $result .= '<tr><td>Customer Name</td><td>'.$customer_name.'</td></tr>'; // $result .= '<tr><td>Customer Address</td><td>'.$customer_address.'</td></tr>'; // $result .= '<tr><td></td><td></td></tr>'; // $result .= '</table>'; $result .= '<div class="bold">' . $order_source . '</div>'; $result .= '<div>' . $customer_name . '</div>'; $result .= '<div>' . $customer_address . '</div>'; $result .= '<div> </div>'; $orders_collection = array(); $products_ordered_total = 0; $products_returned_total = 0; $products_canceled_total = 0; $products_inprocess_total = 0; foreach ($products_ordered as $pok => $pov) { if ($excludecurrentorderinhistory && $pov[$colname_order_id] == $order[$colname_order_id]) { unset($products_ordered[$pok]); } else { if (!in_array($pov[$colname_order_id], $orders_collection)) { $orders_collection[] = $pov[$colname_order_id]; } $products_ordered_total += $pov[$colname_order_qty]; $products_returned_total += $pov[$colname_return_qty]; if (statusIsCancelled($pov['status'])) { $products_canceled_total += $pov[$colname_order_qty]; } if ($pov['status'] < 9) { $products_inprocess_total += $pov[$colname_order_qty]; } } } $result .= '<h2>Customer Historical Info</h2>'; if ($products_ordered_total > 0) { $products_success_total = $products_ordered_total - ($products_inprocess_total + $products_canceled_total); $return_rate = $products_returned_total == 0 ? 0 : $products_returned_total / $products_success_total * 100; $process_class = $products_inprocess_total > 0 ? 'red' : 'green'; $success_class = $products_success_total > 0 ? 'green' : 'red'; $return_class = $products_returned_total > 0 ? 'red' : 'green'; $return_rate_class = $return_rate <= 10 ? 'green' : 'red'; $prevtext = $excludecurrentorderinhistory ? 'Previous' : ''; $result .= '<h3>» Customer ' . $prevtext . ' Orders Total = ' . count($orders_collection) . '</h3>'; $result .= '<h3>» Ordered Products Total = ' . $products_ordered_total . '</h3>'; $result .= '<h3>» Ordered Products Canceled = ' . $products_canceled_total . '</h3>'; $result .= '<h3 class="' . $process_class . '">» Ordered Products in Progress = ' . $products_inprocess_total . '</h3>'; $result .= '<h3 class="' . $success_class . '">» Ordered Products Received = ' . $products_success_total . '</h3>'; $result .= '<h3 class="' . $return_class . '">» Ordered Products Returns = ' . $products_returned_total . '</h3>'; $result .= '<h3 class="' . $return_rate_class . '">» Customer Return Rate = ' . number_format($return_rate, 1) . '%</h3>'; $result .= '<h3>» Recent Ordered Products List (Showing Max ' . $po_limit . ' Products): ' . '</h3>'; $result .= '<div style="width:' . $powidth . 'px;">'; $pocount = 0; foreach ($products_ordered as $po) { $pocount++; if ($pocount <= $po_limit) { if ($po[$colname_articles_id] > 0) { $article = $class_pa->retrieveDetail($po[$colname_articles_id]); $prolength = $article['length']; } else { $product_detail = $class_pm->retrieveDetail($po[$colname_products_id], 'pnc'); $prolength = $product_detail['pnc']['products_length']; } $length_text = $prolength > 0 ? textLength($prolength) : '<span class="notice">No Length</span>'; $status = $po['status'] == '8' ? modeName($po['mode']) : statusNameShort($po['status'], true); $status_class = $po['status'] < 9 ? 'red' : 'notice'; $qty_class = statusIsCancelled($po['status']) > 0 ? 'notice' : 'green'; $result .= '<div style="float:left;border:' . $border . 'px solid #ccc;text-align:center;margin:0 ' . $margin . 'px ' . $margin . 'px 0;padding:' . $padding . 'px;">'; $result .= webImage($po['products_image'], $imgsize, $imgsize); $result .= '<br />'; $result .= $length_text; $result .= '<br />'; $result .= '<span title="Order Date">' . date('d.m.Y', strtotime($po[$colname_order_date])) . '</span>'; $result .= '<br />'; $result .= '<span class="' . $status_class . '" title="Current Status">' . $status . '</span>'; $result .= '<br />'; $result .= '<strong class="' . $qty_class . '" title="Order Quantity">+' . intval($po[$colname_order_qty]) . '</strong>'; $result .= ' '; $returns = intval($po[$colname_return_qty]); $retclas = $returns > 0 ? 'red' : 'notice'; $result .= '<strong class="' . $retclas . '" title="Return Quantity">-' . $returns . '</strong>'; $result .= '</div>'; } } $result .= '</div>'; $result .= '<div style="clear:both;"> </div>'; } else { $result .= '<h3>» No Order Historical info, a New Customer</h3>'; } } $result .= '</div>'; //HISTORICAL INFO - CLOSER } return $result; }
$pdf->Cell($col_subcol_width[2], $lineheight, 'Bild', 1, 0, 'C', true); $pdf->Cell($col_subcol_width[3], $lineheight, 'Größe', 1, 0, 'C', true); $pdf->Cell($col_subcol_width[4], $lineheight, 'Produktkategorie', 1, 0, 'C', true); $pdf->Cell($col_subcol_width[5], $lineheight, 'Article', 1, 0, 'C', true); $pdf->Cell($col_subcol_width[6], $lineheight, 'EAN', 1, 0, 'C', true); $pdf->Cell($col_subcol_width[7], $lineheight, 'Preis', 1, 0, 'C', true); $pdf->Cell($col_subcol_width[8], $lineheight, 'Menge', 1, 0, 'C', true); $pdf->ypos += $lineheight; $item_counter = 0; foreach ($items as $item) { $product = $class_pm->retrieveDetail($item['products_id'], 'p,pd,pnc,cat'); if ($item['products_articles_id'] == 0) { $size = $product['pnc']['products_length'] > 0 ? textLength($product['pnc']['products_length']) : '-'; } else { $article = $class_pa->retrieveDetail($item['products_articles_id']); $size = textLength($article['length']); } // echo '<pre>'; // var_dump($product); // echo '</pre>'; $item_counter++; $img_pdf = ''; $img_path = DIR_WS_IMAGES . 'imagecache/'; $img_file = basename(webImageSource($product['p']['products_image'], IMAGE_SIZE_THUMBNAIL_2, IMAGE_SIZE_THUMBNAIL_2)); $img = $img_path . $img_file; if ($img != $img_path) { $test = getimagesize($img); if ($test[2] == 2) { $img_pdf = $img; } }
function getDetailData($products_id, $type) { global $class_pm, $class_pa, $class_pb, $class_sp, $target_group, $colpats, $class_s; $result = array(); $detail_is_complete = false; $r_dt = ''; switch ($type) { case 'checkname': //NAME $r_nm = '<span class="red">Name not yet set</span>'; $nm = $class_pm->retrieveName($products_id, '2'); if ($nm != 'None') { $r_nm = "<span class=\"green\">{$nm}</span>"; } $r_dt .= "» {$r_nm}<br />"; //COLORS $colors = $class_pm->loadColorPatternNames($products_id, LANGUAGEID); $total_colors = count($colors); $colors_has_neon = false; if ($total_colors == 0) { $r_dt .= '» <span class="red">Color not yet set</span>'; } else { $r_cp = ''; foreach ($colors as $cpid => $cpname) { if ($cpid == '22') { $colors_has_neon = true; } $cp_img = webImageSource('color-pattern-' . $cpid . '.png'); $r_cp .= '<img src="' . $cp_img . '" width="20" height="20" title="' . $cpname . '" /> '; } $r_dt .= "» {$r_cp}"; if ($total_colors == 1 && !$colors_has_neon || $total_colors == 2 && $colors_has_neon) { $detail_is_complete = true; } else { $r_dt .= '<br /><strong class="red">Only 1 color / 2 colors with Neon is allowed!</strong>'; } } //$nm!='None' break; case 'setprofin': //optional step, auto set detail directly as complete $detail_is_complete = true; $styles = $class_s->getProductStyles($products_id); foreach ($styles as $groups => $styles_data) { if ($groups == ProductAttribute::GROUP_ID_PRODUCT_FINISHING) { $product_finishing = $styles_data; break; } } $total_profin = count($product_finishing); if ($total_profin == 0) { $r_profin = '» <span class="notice">' . 'No Product Finishing attached</span>'; } else { $r_profin = '» <span class="green">' . implode(', ', $product_finishing) . '</span>'; } $r_dt .= $r_profin; break; case 'setsubcat': $styles = $class_s->getProductStyles($products_id); $subcat = array(); //S now substracted as S1, S2, etc. so we couldn't use this anymore //foreach($styles['S'] as $sbk=>$sbv) $subcat[] = $sbv; foreach ($styles as $groups => $styles_data) { if ($groups[0] == ProductAttribute::GROUP_ID_SUB_CATEGORY) { foreach ($styles_data as $styles_id => $styles_name) { $subcat[] = $styles_name; } } } $total_subcat = count($subcat); $r_subcat = ''; if ($total_subcat == 0) { $r_subcat .= '» <span class="red">Sub Category not yet set</span>'; } elseif ($total_subcat > 1) { $r_subcat .= '» ' . implode('<br />» ', $subcat); $r_subcat .= '<br /><strong class="red">Only 1 Sub Category is allowed!</strong>'; } else { $r_subcat .= '» <span class="green">' . $subcat[0] . '</span>'; $detail_is_complete = true; } $r_dt .= $r_subcat; break; case 'setbrand': $product = $class_pm->retrieveDetail($products_id, 'p'); $r_br = '<span class="red">not yet set</span>'; if ($product['p']['products_brand_id'] != '' && $product['p']['products_brand_id'] != '0') { $brand = $class_pb->retrieveDetail($product['p']['products_brand_id']); $r_br = "<span class=\"green\">" . $brand['brand_name'] . "</span>"; $detail_is_complete = true; } $r_dt .= "» {$r_br}"; break; case 'setlength': $ln = ''; $r_ln = '<span class="red">not yet set</span>'; $product = $class_pm->retrieveDetail($products_id, 'p,pd,pnc'); $articles = $class_pa->retrieveList($products_id); if ($product['pnc']['products_length'] != '') { $ln = '<strong>' . textLength($product['pnc']['products_length']) . '</strong> (default)'; } if (isset($articles) && is_array($articles) && count($articles) > 0) { foreach ($articles as $a) { if ($ln != '') { $ln .= ', '; } //$ln .= number_format($a['length'], 1).' cm'; $ln .= textLength($a['length']); } } if ($ln != '') { $detail_is_complete = true; $r_ln = "<span class=\"green\">{$ln}</span>"; } $r_dt .= "» {$r_ln}"; break; case 'addelements': $r_el = '» <span class="red">not yet set</span>'; $el_used = $class_pm->retrieveElementsUsage($products_id); if (count($el_used) > 0) { $detail_is_complete = true; $r_el = "<span class=\"green\">"; $r_el .= '<table border="0" cellpadding="0" cellspacing="0" class="form">'; $els = array(); use_class('element'); foreach ($el_used as $el_id => $el_data) { $r_el .= "<tr>"; $e = new element($el_id); $el_image = webImageWithDetailLink($e->image, IMAGE_SIZE_THUMBNAIL_1, IMAGE_SIZE_THUMBNAIL_1, 'Element ' . $e->id, 'img-border'); $r_el .= '<td class="green" title="quantity"><strong>' . $el_data['quantity'] . 'x</strong></td>'; $r_el .= '<td class="green">' . $el_image . '</td>'; $r_el .= '<td class="green"><a class="green" href="?open=element&id=' . $el_id . '&hidemenu=true">' . $el_id . '</a></td>'; $r_el .= '<td class="green">' . $e->detail['name'] . '</td>'; $finishing = array(); if ($el_data['finishing_goldplate'] == '1') { $finishing[] = 'Yellow Goldplate'; } if ($el_data['finishing_hammer'] == '1') { $finishing[] = 'Hammer'; } if ($el_data['finishing_brush'] == '1') { $finishing[] = 'Brush'; } if ($el_data['finishing_oxid'] == '1') { $finishing[] = 'Oxid'; } if ($el_data['finishing_rosegoldplate'] == '1') { $finishing[] = 'Rose Goldplate'; } if (count($finishing) > 0) { $r_el .= '<td class="green" title="finishing">(' . implode(',', $finishing) . ')</td>'; } $r_el .= "</tr>"; } $r_el .= "</table>"; $r_el .= "</span>"; } $r_dt .= "{$r_el}"; break; case 'manpi': $r_mp = ''; //optional step, auto set detail directly as complete $detail_is_complete = true; $dbqmp = tep_db_query("SELECT * FROM products_non_configurator pnc WHERE pnc.products_id={$products_id}"); if (tep_db_num_rows($dbqmp) > 0) { $mpi = tep_db_fetch_array($dbqmp); // TODO: remove this after freetext switch to attach // $manpi = $mpi['products_instruction']; // if($manpi!='') $r_mp = "» <span class=\"green\">".substr($manpi, 0, 20)." ...</span>"; // End todo if (!empty($mpi['production_instruction_id'])) { $piids = explode(",", $mpi['production_instruction_id']); foreach ($piids as $piid) { $class_pim = new production_instruction_manual($piid); $r_mp .= "» <span class=\"green\">" . $class_pim->cat_name . " - " . $class_pim->name . "</span><br />"; } } } $r_dt .= $r_mp; break; case 'prolinks': $r_pr = ''; //optional step, auto set detail directly as complete $detail_is_complete = true; $dbqpl = tep_db_query("SELECT * FROM products_linking WHERE products_id={$products_id}"); if (tep_db_num_rows($dbqpl) > 0) { $r_pr = "<span class=\"green\">"; $pltype = array(); $plds = array(); while ($r = tep_db_fetch_array($dbqpl)) { $plds[$r['type']][] = $r['links_id']; } foreach (array_keys($plds) as $type) { foreach ($plds[$type] as $plid) { $plinks = $class_pm->retrieveDetail($plid, 'p'); $pl_image = webImage($plinks['p']['products_image'], IMAGE_SIZE_THUMBNAIL_1, IMAGE_SIZE_THUMBNAIL_1, 'Product ' . $plid); $r_pr .= $pl_image . ' '; } } $r_pr .= "</span>"; } $r_dt .= $r_pr; break; case 'setnavs': $detail_is_complete = true; $dbq = tep_db_query("SELECT jng_sp_id, navigation, navigation2, navigation3 FROM jng_sp_catalog WHERE products_id={$products_id} ORDER BY jng_sp_id"); if (tep_db_num_rows($dbq) > 0) { $navlist = array(); while ($r = tep_db_fetch_array($dbq)) { $sp = $class_sp->retrieveDetail($r['jng_sp_id']); if ($sp['active_status'] == '1') { if ($r['jng_sp_id'] == '1') { if ($r['navigation2'] != '' && $r['navigation'] != '' && $r['navigation3'] != '' && $r['navigation3'] != '0') { $navlist[] = '» <span class="green"><strong>' . $sp['package_prefix'] . '</strong> [ all sets - Please Recheck ]</span>'; } else { $navlist[] = '» <span class="red"><strong>' . $sp['package_prefix'] . '</strong> [ not yet set or incomplete ]</span>'; $detail_is_complete = false; } } elseif ($r['jng_sp_id'] == '2') { if ($r['navigation'] != '' && $r['navigation3'] != '' && $r['navigation3'] != '0') { $navlist[] = '» <span class="green"><strong>' . $sp['package_prefix'] . '</strong> [ all sets - Please Recheck ]</span>'; } else { $navlist[] = '» <span class="red"><strong>' . $sp['package_prefix'] . '</strong> [ not yet set or incomplete ]</span>'; $detail_is_complete = false; } } elseif ($r['jng_sp_id'] == '3') { if ($r['navigation'] != '') { $navlist[] = '» <span class="green"><strong>' . $sp['package_prefix'] . '</strong> [ all sets - Please Recheck ]</span>'; } else { $navlist[] = '» <span class="red"><strong>' . $sp['package_prefix'] . '</strong> [ not yet set or incomplete ]</span>'; $detail_is_complete = false; } } } } } $r_dt = implode('<br />', $navlist); break; case 'setdesc2': $min_value_needed = 3; $p = $class_pm->retrieveDetail($products_id, 'p,pd2'); $pd2data = $class_pm->description2_label($p['pd2']); $total_pd2 = count($pd2data); // if($total_pd2>=$min_value_needed) $detail_is_complete = true; if ($p['p']['improved_content'] == '1') { $detail_is_complete = true; } // if($total_pd2 == 0) { if ($p['p']['improved_content'] == '0') { // $r_dt = '» <span class="red">No data has been set (min. '.$min_value_needed.')</span>'; $r_dt = '» <span class="red">Content Improved needs to be checked</span>'; } // else { // $r_dt = ''; // $r_dt_array = array(); // foreach($pd2data as $label=>$value) { // $data = $label.': '.$value; // if($detail_is_complete) $data = '<span class="green">'.$data.'</span>'; // $r_dt_array[] = '» '.$data; // } // $r_dt .= implode('<br />', $r_dt_array); //// if(!$detail_is_complete) $r_dt .= '<br /><strong class="red">Minimum '.$min_value_needed.' data must be set!</strong>'; // if(!$detail_is_complete) $r_dt .= '<br /><strong class="red">Content Improved needs to be checked</strong>'; // } break; case 'setfamily': $p = $class_pm->retrieveDetail($products_id, 'p'); if (is_null($p['p']['family_id'])) { $r_dt = '» <span class="red">Family Unset</span>'; } else { $detail_is_complete = true; $r_dt = '» <span class="green">Family ' . $p['p']['family_id'] . '</span>'; } break; } $result['view'] = utf8_encode('<div style="margin-left:10px;">' . $r_dt . '</div>'); $result['iscomplete'] = $detail_is_complete ? '1' : '0'; return $result; }
$content .= '<th>' . $v . '</th>'; } $content .= '</tr></thead>'; $content .= '<tbody id="table-loader">'; $items_as_products = array(); $products = array(); $articles = array(); foreach ($booking->items as $psid => $qty) { $stock = $class_pm->stockRetrieveDetailByPSID($psid); $items_as_products[$stock['products_id']][$stock['articles_id']] = $stock; $products[$stock['products_id']] = $class_pm->retrieveDetail($stock['products_id'], 'p,pnc'); if ($stock['articles_id'] > 0) { $article = $class_pa->retrieveDetail($stock['articles_id']); $articles[$stock['products_id']][$stock['articles_id']] = textLength($article['length']); } else { $articles[$stock['products_id']][$stock['articles_id']] = textLength($products[$stock['products_id']]['pnc']['products_length']); } } $counter = 0; foreach ($items_as_products as $pid => $adata) { $counter++; $product = $products[$pid]; $alist = $articles[$pid]; $content .= '<tr class="' . ($counter % 2 == 0 ? 'e' : 'o') . '">'; foreach ($product_table_header as $k => $v) { switch ($v) { case $hn_product: $value = webImage($product['p']['products_image'], IMAGE_SIZE_THUMBNAIL_1, IMAGE_SIZE_THUMBNAIL_1, 'Product ' . $pid); $value .= '<br />' . $pid; break; case $hn_article:
if (!empty($product_data['p']['products_id']) && !is_null($product_data['p']['products_id'])) { $elements_used = $class_pm->retrieveElementsUsage($product_input); foreach ($elements_used as $element) { $element_stock_query = "SELECT es.stock"; $element_stock_query .= " FROM elements_stock es"; $element_stock_query .= " WHERE es.jng_warehouses_id={$jng_warehouses_id}"; $element_stock_query .= " AND es.elements_id=" . $element['elements_id']; $element_stock_result = tep_db_query($element_stock_query); if (tep_db_num_rows($element_stock_result) > 0) { $element_stock = tep_db_fetch_array($element_stock_result); $el_stock = $element_stock[stock]; } $elements_datas[] = $element['elements_id'] . "-" . $element['quantity'] . "-" . $el_stock; } $result['products_id'] = $product_data['p']['products_id']; $result['products_length'] = $product_data['pnc']['products_length'] > 0 ? textLength($product_data['pnc']['products_length']) : "-"; $result['products_ean'] = $product_data['p']['products_ean']; $result['products_quantity'] = $product_data['p']['products_quantity'] > 0 ? $product_data['p']['products_quantity'] : 1; $result['products_articles_id'] = '0'; $result['elements_datas'] = implode(",", $elements_datas); } } } else { $result['error_message'] = "Can not find Product ID <strong>{$products_id}</strong> in database."; } } ajaxReturn($result); exit; } elseif ($_POST['me_action'] == 'GETIMAGE') { $result = false; $id = tep_db_prepare_input($_POST['id']);
$result['status'] = 'MOREFOUND'; } } } if (!$cancel && $pid != 0) { $p = $class_pm->retrieveDetail($pid, 'p,pnc'); $pa = $class_pa->retrieveList($pid); $products_image = webImageSource($p['p']['products_image'], '150', '150'); $products_options = array(); $default_length = $p['pnc']['products_length'] > 0 ? textLength($p['pnc']['products_length']) : '-'; // $products_options[] = $p['p']['products_ean'].','.$default_length; $products_options[] = '0;' . $p['p']['products_ean'] . ',' . $default_length; if ($default_length != '-') { // foreach($pa as $a) $products_options[] = $a['products_ean'].','.textLength($a['length']); foreach ($pa as $a) { $products_options[] = $a['products_articles_id'] . ';' . $a['products_ean'] . ',' . textLength($a['length']); } } $bestgood_status = $class_pm->retrieveBestGoodStatus($pid); $result['status'] = 'FOUND'; $result['products_id'] = $pid; $result['products_code'] = $p['p']['products_model']; $result['products_image'] = $products_image; $result['products_option'] = $aid; $result['products_options'] = implode('|', $products_options); $result['bestgood_status'] = $bestgood_status; $result['scanned_ean'] = $ean; $result['orders_qty'] = $qty; $result['sp_id'] = $spid; $result['use_am_logistic'] = in_array($spid, array_keys(getSalesPartnerUseAmazonLogistic())); $result['ean_printed'] = $ean_printed;
$ajaxResult = array(); $ajaxResult['period'] = 'p-' . $period; $ajaxResult['period_text'] = $sp_detail['package_prefix'] . '<br />' . substr($period_start_raw, 0, 5) . ' - ' . substr($period_end_raw, 0, 5); if ($level == 'p') { $cogs_result = ReportCOGS::retrieveSummaryByProducts($products, $spid, $period_start, $period_end); foreach ($products as $pid) { $ajaxResult['row-' . $pid] = intval($cogs_result[$pid]['total_quantity']); } } else { $cogs_result = ReportCOGS::retrieveSummaryByArticles($products, $spid, $period_start, $period_end); $palist = $class_pa->retrieveAllArticlesByProducts($products); foreach ($palist as $pid => $pdata) { $row_content = '<table align="center" border="0"' . ' cellpadding="0" cellspacing="0">'; foreach ($pdata as $aid => $adata) { if ($level == 'l') { $left = $adata['length'] == 0 ? '<span class="notice">None</span>' : textLength($adata['length']); } else { $left = $adata['ean']; } $row_content .= '<tr><td>' . $left . '</td><td>=</td><td>' . intval($cogs_result[$adata['ean']]['total_quantity']) . '</td></tr>'; } $row_content .= '</table>'; $ajaxResult['row-' . $pid] = $row_content; } } ajaxReturn($ajaxResult); exit; } } if (!isset($jng_sp_id) || $jng_sp_id == '') { $jng_sp_id = '2';
function drawProductInfo($pid, $aid) { global $product_categories_name, $class_pm, $class_pa; $product = $class_pm->retrieveDetail($pid, 'p,pnc,cat'); $result = '<div style="float:left;">'; $result .= '<div>' . webImageWithDetailLinkStars($product['p']['products_image'], IMAGE_SIZE_THUMBNAIL_1, IMAGE_SIZE_THUMBNAIL_1, 'Product ' . $product['p']['products_id'], '', '', IMAGE_SIZE_BIG_1, IMAGE_SIZE_BIG_1, $product['p']['stars']) . '</div>'; $result .= '</div>'; $result .= '<div style="margin-left:' . (intval(IMAGE_SIZE_THUMBNAIL_1) + 20) . 'px;">'; $result .= '<h2>' . $product_categories_name[$product['categories_id']] . '</h2>'; $result .= '<h3>' . $product['p']['products_id'] . ' / ' . $product['p']['products_model'] . '</h3>'; if (is_array($aid)) { $a_option = array(); $a_option[$product['p']['products_ean']] = textLength($product['pnc']['products_length']); foreach ($aid as $a) { $a_option[$a['products_ean']] = textLength($a['length']); } $result .= '<select id="choose-article" class="input"><option value="X">please select a length...</option>' . loadComboListFromArray($a_option) . '</select>'; } else { $article = $aid > 0 ? $class_pa->retrieveDetail($aid) : null; $ean = is_null($article) ? $product['p']['products_ean'] : $article['products_ean']; $length = is_null($article) ? $product['pnc']['products_length'] : $article['length']; $length_text = $length > 0 ? textLength($length) : ''; if ($length_text != '') { $result .= '<h3>Length ' . $length_text . '</h3>'; } $result .= '<h3>EAN ' . $ean . '</h3>'; } $result .= '</div>'; return $result; }
function drawTableAction($products_id, $default_length = '', $default_price = '', $default_ean = '') { if ($default_length == '' || $default_price == '') { $default = $this->getDefault($products_id); $default_price = number_format($default['products_price'], 2); $default_length = $default['products_length']; $default_ean = $default['products_ean']; } $default_length_text = textLength($default_length); if ($default_ean == '') { $default_ean .= '<input id="ean_to_product" type="button" value="Attach EAN No" />'; $default_ean .= '<img src="images/ajax-load-3.gif" id="pa-defean-process" style="display:none;" />'; } $style_length = 'style="width:50px;"'; $style_price = 'style="width:60px;"'; $sizes = getLength2Sizes(); array_shift($sizes); $use_size = array_key_exists(strval($default_length), $sizes); if ($use_size) { $size_options = loadComboListFromArray($sizes, null, null, false); $new_length = '<select id="new_length">' . $size_options . '</select>'; } else { $new_length = '<input type="text" id="new_length" value="" ' . $style_length . ' />'; } $result = ''; $totalcols = 5; $rowsep = '<tr><td colspan="' . $totalcols . '"> </td></tr>'; $result .= '<div class="form"><table class="nltable" border="0" cellpadding="0" cellspacing="0">'; $result .= '<tr><td colspan="' . $totalcols . '">'; $result .= '<div class="red">* Changes will affect all sales partner</div>'; $result .= '<div class="red"> </div>'; $result .= '</td></tr>'; $tctemp = $totalcols - 2; $result .= '<tr><td colspan="2" class="bold">Default Length/Size</td><td colspan="' . $tctemp . '" class="bold"><span id="pa-deflength">' . $default_length_text . '</span></td></tr>'; //$result .= '<tr><td colspan="2" class="bold">Default Price</td><td colspan="'.$tctemp.'" class="bold"><span id="pa-defprice">'.$default_price.'</span> EUR</td></tr>'; $result .= '<tr><td colspan="2" class="bold">EAN No</td><td colspan="' . $tctemp . '" class="bold"><span id="pa-defean">' . $default_ean . '</span></td></tr>'; $result .= $rowsep; if ($default_length == 0) { $result .= '<tr><td colspan="' . $totalcols . '" class="bold red">Adding article is not available for this product.</td></tr>'; } else { $result .= '<tr><td colspan="4" class="bold">Add New Length/Size:</td></tr>'; $result .= '<tr>'; $result .= '<td>' . $new_length . '</td>'; //$result .= '<td><input type="text" id="new_length_price" value="" '.$style_price.' /></td>'; //$result .= '<td><input type="text" id="new_length_price_old" value="" '.$style_price.' /></td>'; $result .= '<td><input type="button" id="new_length_add" value="Add" /></td>'; $result .= '<td> </td>'; $result .= '</tr>'; $result .= $rowsep; $result .= '<tr><td colspan="' . $totalcols . '" class="bold">Additional Length/Size</td></tr>'; //$result .= '<tr><td>No</td><td>EAN</td><td>Length <small>(cm)</small> </td><td>Price <small>(EUR)</small> </td><td>Old Price <small>(EUR)</small> </td><td>Action</td><td>isActive</td></tr>'; $result .= '<tr><td class="w040">No</td><td class="w150">EAN</td><td class="w080">Length/Size</td><td class="w200">Action</td><td class="w080">isActive</td></tr>'; $products_articles = $this->retrieveList($products_id); if (count($products_articles) > 0) { $article_counter = 0; foreach ($products_articles as $pa) { $article_counter++; $el_id = 'extra-length-' . $pa['products_articles_id']; $class_with_id = 'class="extra-length-' . $pa['products_articles_id'] . '"'; if ($pa['products_ean'] != '') { $ean_no = $pa['products_ean']; $length_readonly = 'readonly="readonly"'; $action = '<div class="notice">Not Editable</div>'; } else { $ean_no = '<span class="notice">Unset</span>'; $length_readonly = ''; $action = '<span class="update-extra-length blue" id="upd-' . $pa['products_articles_id'] . '">Update</span>'; $action .= '<span class="sep"> • </span><span class="remove-extra-length red" id="del-' . $pa['products_articles_id'] . '">Remove</span>'; $action .= '<span class="sep"> • </span><span class="extra-length-ean red" id="ean-' . $pa['products_articles_id'] . '">Attach EAN</span>'; } $result .= '<tr id="' . $el_id . '">'; $result .= '<td>' . $article_counter . ' » </td>'; $result .= '<td id="pa-ean-' . $pa['products_articles_id'] . '">' . $ean_no . '</td>'; $result .= '<td><input type="hidden" id="pa-length-' . $pa['products_articles_id'] . '" value="' . $pa['length'] . '" />' . textLength($pa['length']) . '</td>'; //$result .= '<td><input type="text" id="pa-price-'.$pa['products_articles_id'].'" value="'.$pa['price'].'" '.$style_price.' /></td>'; //$result .= '<td><input type="text" id="pa-price-old-'.$pa['products_articles_id'].'" value="'.$pa['price_old'].'" '.$style_price.' /></td>'; $result .= '<td id="pa-act-' . $pa['products_articles_id'] . '">'; $result .= '<div>' . $action . '</div>'; $result .= '<div style="display:none;"><img src="/images/ajax-load-3.gif" /></div>'; $result .= '</td>'; $check = $pa['active_status'] == '0' ? ' disabled="disabled"' : ' checked="checked"'; $result .= '<td class="tac"><input type="checkbox" id="cb-pa-active-' . $pa['products_articles_id'] . '" name="pa-active-status" value="' . $pa['products_articles_id'] . '"' . $check . ' /></td>'; $result .= '</tr>'; } } } $result .= '</table></div>'; return $result; }
function constructPIContent($pdf, $output, $order, $ignoreStockStatusDepot, $print_per_orders) { /* NOTES!!!!!!!!!!!!!!!! * if $print_per_orders == false, $order should contain "collections of orders" * elseif $print_per_orders == true, $order should contain "one order only" */ use_class('Product'); use_class('ProductAttribute'); global $class_pm, $class_pb, $product_categories_name, $DIAMOND_BRAND_IDS; if ($print_per_orders) { $orders[] = $order; } else { $orders = $order; } //echo "<pre>";var_dump($orders);die(); $margin = 5; $fontsize_big = '9'; $fontsize_med = '8'; $fontsize_sml = '7'; $fontsize_tny = '5'; $barcode_width = 32; $barcode_pos = 210 - $margin - $barcode_width - 1; $element_name_max_chars = 30; if ($output == 'F') { //PRODUCE PDF FILE PER ITEM (MULTI PDF FILE PER ORDER) $pdf = new PDF('P', 'mm', 'A4'); $pdf->setTitle('Production Instruction'); $pdf->SetAuthor('JULIE GRACE / Bonofactum'); $pdf->SetCreator('k-Auto Generated PDF'); $pdf->SetDisplayMode('real'); $pdf->SetAutoPageBreak(false); $pdf->AliasNbPages(); $pdf->SetFillColor(191, 191, 191); } //start looping orders foreach ($orders as $order) { $o = $order['detail']; $is_ottob2b = $o['jng_sp_id'] == '11' || strpos(strtolower($o['customer']), 'otto b2b') !== false; foreach ($order['items'] as $oiid => $i) { if ($i['status'] < 8) { $this->pi_printed[strtolower($o['type'])][] = $oiid; } $obj_product = new Product($i['products_id']); $is_gold_product = $obj_product->metal_stamp_code > 0 && $obj_product->metal_stamp_code != 925; $pdf->pi_number = $o['id']; if ($this->duplex_printing && isset($item_page_count) && $item_page_count % 2 != 0) { $pdf->AddPage(); } $pdf->AddPage(); $item_page_count = 1; $product_key = $i['products_id'] . '-' . $i['articles_id']; $product_qty = intval($i['quantity']); $p = $this->products[$product_key]; $is_elli_premium = $p['p']['products_brand_id'] == '29'; $is_diamore = in_array($p['p']['products_brand_id'], $DIAMOND_BRAND_IDS); $is_pearl = $p['p']['products_brand_id'] == '7'; $ean = $this->products_ean[$product_key]; $product_complexity = strtoupper(productComplexityName($p['p']['complexity'])); $order_type_code = ''; if (strtoupper($o['type']) == 'DP') { $order_type_code = strtoupper($o['type']); $otc_width = 12; } else { $order_type_code = $o['customer_type']; $otc_width = 20; } $pdf->OrderBarcode($o['type'], $oiid, $barcode_pos, $margin, $barcode_width); $pdf->setFont('Arial', 'B', '12'); $YPOS = $margin; $lineheight = 4; //ORDER TYPE CODE (JG,SP,DP) $pdf->SetXY($barcode_pos - $otc_width, 10); $pdf->Cell(100, $lineheight, $order_type_code); //PROCESS DATE $pdf->setFont('Arial', 'B', $fontsize_big); $process_date = date('d M Y', strtotime($i['prod_target_in'])); $pdf->SetXY($barcode_pos, 22); $pdf->Cell($barcode_width, $lineheight, $process_date, 0, 2, 'R'); //PRODUCT COMPLEXITY $pdf->setFont('Arial', 'B', '12'); $pdf->SetXY($barcode_pos, 22 + $lineheight + 5); $pdf->Cell($barcode_width, $lineheight, $product_complexity, 0, 2, 'R'); //PAGE HEADER $margin_orderinfo = $margin + 50; $pdf->SetXY($margin_orderinfo, $YPOS); $pdf->Cell(100, $lineheight, 'Production Instruction ' . $o['id'] . ' (' . $i['counter'] . ') - print ' . ($i['print_count'] + 1)); $YPOS += $lineheight + 1; //ORDER INFORMATION $lineheight = 3.5; $orderilbl = array(); $orderinfo = array(); $orderilbl[] = 'Ship To (Country)'; $orderinfo[] = ': ' . trim($o['shipto_name']) . ($o['shipto_address'] != '' ? ' (' . $o['shipto_address'] . ')' : ''); //Show shipping window date only for order which using amazon logistic if (in_array($o['jng_sp_id'], array_keys(getSalesPartnerUseAmazonLogistic())) && isset($i['shipping_window_open'])) { $orderilbl[] = 'Shipping Window Date'; $orderinfo[] = ': ' . date('d. M Y', strtotime($i['shipping_window_open'])); } /* Moved to below barcode $orderilbl[] = 'Process Date'; $orderinfo[] = ': '.date('d. M Y', strtotime($i['prod_target_in'])); */ $orderilbl[] = 'Customer Name'; $vip_status = $o['customer_is_vip'] ? ' ( VIP )' : ''; if ($is_ottob2b) { $orderinfo[] = ': OTTO B2B'; } else { $orderinfo[] = ': ' . $o['customer'] . $vip_status; } //$orderilbl[] = 'Order Source / Customer Name'; //$orderinfo[] = ': '.$o['customer_type'].' / '.$o['customer']; //$orderilbl[] = 'Product Qty x EAN (ID / Code)'; //$orderinfo[] = ': '.intval($i['quantity']).' x '.$ean.' ('.$p['p']['products_id'].' / '.$p['p']['products_model'].')'; $orderilbl[] = 'Product Qty x EAN'; $orderinfo[] = ': ' . $product_qty . ' x ' . $ean; $pdf->setFont('Arial', '', $fontsize_med); $pdf->setXY($margin_orderinfo, $YPOS); $pdf->MultiCell(50, $lineheight, implode("\n", $orderilbl)); $pdf->setXY($margin_orderinfo + 30, $YPOS); $pdf->MultiCell(100, $lineheight, implode("\n", $orderinfo)); $maxline = count($orderilbl); $YPOS += $maxline * $lineheight + 10; //STOCK PREPARATION $pdf->setFont('Arial', 'B', $fontsize_big); if ($i['stock_status'] == 'D' && !$ignoreStockStatusDepot) { //USE DEPOT STOCK $lineheight = 6; $pdf->SetXY($margin + 1, $YPOS); $pdf->Cell(100, $lineheight, 'Depot Stock', 1, 0, 'C', true); $YPOS += $lineheight + 3; } elseif ($i['stock_status'] == 'P') { //USE FINISH GOOD STOCK $lineheight = 6; $pdf->SetXY($margin + 1, $YPOS); $pdf->Cell(100, $lineheight, 'Finish Good', 1, 0, 'C', true); $YPOS += $lineheight + 3; } else { //USE ELEMENTS STOCK $lineheight = 4; $pdf->SetXY($margin, $YPOS); $pdf->Cell(100, $lineheight, 'Elements Preparation'); $YPOS += $lineheight + 1; $pue_total = count($p['elements']); $pue_rows = ceil($pue_total / 2); $max_rows_el_per_page_1 = 12; //MAX ROWS ELEMENT ON PAGE 1 $max_rows_el_per_page_n = 14; //MAX ROWS ELEMENT ON NEXT PAGE $max_rows_el_per_page = $max_rows_el_per_page_1; $pue_counter = 0; $pue_number = 0; $rowpos = $YPOS; $colpos = $margin + 1; $colheight = 20; $col_subcol_width = array(); $col_subcol_width[1] = 6; // $col_subcol_width[2] = $colheight; $col_subcol_width[2] = 20; $col_subcol_width[3] = 10; $col_subcol_width[4] = 51; $col_subcol_width[5] = 10; $col_subcol_imgepos = $col_subcol_width[1]; $col_subcol_infopos = $col_subcol_width[1] + $col_subcol_width[2] + $col_subcol_width[3]; $colwidth = array_sum($col_subcol_width); $print_header_el = false; foreach ($p['elements'] as $element) { if ($pue_counter == 0 || $print_header_el) { $lineheight = 5; $pdf->setXY($colpos, $rowpos); $pdf->setFont('Arial', 'B', $fontsize_med); $pdf->Cell($col_subcol_width[1], $lineheight, 'No', 1, 0, 'C', true); $pdf->Cell($col_subcol_width[2], $lineheight, 'Image', 1, 0, 'C', true); $pdf->Cell($col_subcol_width[3], $lineheight, 'ID', 1, 0, 'C', true); $pdf->Cell($col_subcol_width[4], $lineheight, 'Info', 1, 0, 'C', true); $pdf->Cell($col_subcol_width[5], $lineheight, 'Qty', 1, 0, 'C', true); $rowpos += $lineheight; } $pue_counter++; $pue_number++; $e = $this->elements[$element['elements_id']]; $element_image = $this->getImageForPDF($e->image, '80', '80'); $element_info = array(); $element_info['n'] = substr($e->detail['name'], 0, $element_name_max_chars) . (strlen($e->detail['name']) > $element_name_max_chars ? '...' : ''); //var_dump($e->attributes); exit; $element_info['c'] = $e->attributes['color']['name']; //$element_info['s'] = $e->attributes['size']['name']; $material_name = array(); $material_name = explode(',', $e->attributes['material']['name']); $element_info['m'] = count($material_name) > 1 ? $material_name[1] : $material_name[0]; $element_info['sh'] = ''; if (!eregi('other', $e->attributes['size']['name'])) { $element_info['sh'] = $e->attributes['size']['name']; } if (!eregi('other', $e->attributes['shape']['name'])) { if ($element_info['sh'] != '') { $element_info['sh'] .= '.'; } $element_info['sh'] .= $e->attributes['shape']['name']; } //$element_info['h'] = $e->attributes['shape']['name']; if ($this->products[$product_key]['elements'][$element['elements_id']]['finishing_hammer'] == '1') { $element_info['f'][] = 'Hammered'; } if ($this->products[$product_key]['elements'][$element['elements_id']]['finishing_brush'] == '1') { $element_info['f'][] = 'Brushed'; } if ($this->products[$product_key]['elements'][$element['elements_id']]['finishing_oxid'] == '1') { $element_info['f'][] = 'Oxidized/No Antitarnish'; } if ($this->products[$product_key]['elements'][$element['elements_id']]['finishing_goldplate'] == '1') { $element_info['f'][] = 'Yellow Goldplated'; } if ($this->products[$product_key]['elements'][$element['elements_id']]['finishing_rosegoldplate'] == '1') { $element_info['f'][] = 'Rose Goldplate'; } $element_info['f'] = count($element_info['f']) > 0 ? implode(',', $element_info['f']) : ''; if ($element_image != '') { $pdf->Image($element_image, $colpos + $col_subcol_imgepos, $rowpos, $col_subcol_width[2]); } $pdf->setXY($colpos, $rowpos); $pdf->setFont('Arial', '', $fontsize_med); $pdf->Cell($col_subcol_width[1], $colheight, $pue_number, 1, 0, 'C', true); $pdf->Cell($col_subcol_width[2], $colheight, '', 1, 0, 'C'); $pdf->Cell($col_subcol_width[3], $colheight, $element['elements_id'], 1, 0, 'C'); $pdf->Cell($col_subcol_width[4], $colheight, '', 1, 0, 'C'); $pdf->Cell($col_subcol_width[5], 10, $product_qty * $element['quantity'], 1, 0, 'C'); $pdf->setXY($colpos + $col_subcol_width[1] + $col_subcol_width[2] + $col_subcol_width[3] + $col_subcol_width[4], $rowpos + 10); $pdf->SetTextColor(209, 209, 209); $pdf->setFont('Arial', 'B', $fontsize_big + 2); $pdf->Cell($col_subcol_width[5], 10, 'QC', 1, 0, 'C'); $pdf->SetTextColor(0, 0, 0); $pdf->setFont('Arial', '', $fontsize_med); //$pdf->setXY($colpos + $col_subcol_infopos, $rowpos); //$pdf->MultiCell($col_subcol_width[4], 4, implode("\n", $element_info), 0, 'C'); $rowpos_incol = $rowpos + 1; //TODO: make column table could wrapped for text and have flexible height, for example please find this reference : http://www.fpdf.de/downloads/addons/3/ $ei_labels = array('s' => 'Size: ', 'm' => 'Material: ', 'h' => 'Shape: '); foreach ($element_info as $key => $ei) { if ($ei != '') { if ($key == 'c') { $pdf->setFont('Arial', 'B', $fontsize_big + 2); $lineheight = 4; } elseif ($key == 'f') { $pdf->setFont('Arial', 'B', $fontsize_big); $lineheight = 4; } else { $pdf->setFont('Arial', '', $fontsize_med); $lineheight = 3.5; } if (array_key_exists($key, $ei_labels)) { $ei = $ei_labels[$key] . $ei; } $pdf->setXY($colpos + $col_subcol_infopos, $rowpos_incol); $pdf->Cell($col_subcol_width[4], $lineheight, $ei, 0, 0, 'C'); $rowpos_incol += $lineheight; } } if ($pue_rows > $max_rows_el_per_page) { //IF ELEMENT USED MORE THAN MAX ROWS ELEMENT COULD FIT PER PAGE $n_rows = $max_rows_el_per_page; } else { $n_rows = $pue_rows; } if ($pue_counter == $n_rows) { $colpos = $margin + $colwidth + 5; $rowpos = $YPOS; $print_header_el = true; } else { $print_header_el = false; $rowpos += $colheight; if ($pue_counter % $max_rows_el_per_page == 0 && $pue_counter / $max_rows_el_per_page > 1) { //IF ELEMENT USED REACH THE END OF PAGE AND THERE STILL ELEMENT NEED TO BE PRINTED $pdf->AddPage(); if ($pdf->PageNo() > 1) { $max_rows_el_per_page = $max_rows_el_per_page_n; } //SET MARGIN TO THE VERY TOP OF PAGE $colpos = $margin + 1; $rowpos = $margin; $YPOS = $rowpos; $pue_rows = ceil(($pue_total - $pue_number) / 2); //RECALCULATE THE REST OF ELEMENTS THAT COULD DIVIDED INTO 2 COLUMNS $pue_counter = 0; } } } $YPOS += 5 + 3 + $pue_rows * $colheight; } //PRODUCT INFORMATION if ($pue_rows > 9) { $pdf->AddPage(); $item_page_count++; $YPOS = $margin; } $lineheight = 4; $imgbig_width = 60; $imgsml_width = 25; $rowpos = $YPOS; $colpos = $margin + 1; $pdf->SetXY($margin, $YPOS); $pdf->setFont('Arial', 'B', $fontsize_big); $pdf->Cell(100, $lineheight, 'Product Information'); $YPOS += $lineheight + 1; $rowpos = $YPOS; $imgbig = $this->getImageForPDF($p['p']['products_image'], '', '212'); //if($imgbig!='') $pdf->Image($imgbig, $colpos, $rowpos, $imgbig_width); if ($imgbig != '') { $colposmainimage = $colpos; $image_metadata = getimagesize($imgbig); //MAKE IMAGE CENTERED WHEN SIZE IS PORTRAIT if ($image_metadata[0] == 147) { $colposmainimage = $colpos + 9; } $pdf->Image($imgbig, $colposmainimage, $rowpos, 0, $imgbig_width); } $pdf->Rect($colpos, $rowpos, $imgbig_width, $imgbig_width); $rowpos_main_image = $YPOS + $imgbig_width + 2; $rowpos = $YPOS; $img_h_resized = 0; //SHOW LOGO DIAMORE AND ELLI PREMIUM FOR NON OTTO B2B ORDERS if ($i['products_id'] > 0 && ($is_diamore || $is_elli_premium)) { $pb = $class_pb->retrieveDetail($p['p']['products_brand_id']); $img_path = DIR_WS_IMAGES . $pb['brand_image']; $imgsize = getimagesize($img_path); $img_w = $imgsize[0]; $img_h = $imgsize[1]; $h_ratio = $img_h / $img_w; $img_w_resized = 50; $img_h_resized = $img_w_resized * $h_ratio; $pdf->Image($img_path, 150, $YPOS, $img_w_resized, $img_h_resized); } /*USE IMAGE DIAMOND if($class_pm->productContainMaterials($i['products_id'], 52)) { $img_path = FPDF_IMGPATH.'diamond.jpg'; $imgsize = getimagesize($img_path); $img_w = $imgsize[0]; $img_h = $imgsize[1]; $h_ratio = $img_h/$img_w; $img_w_resized = 40; $img_h_resized = $img_w_resized * $h_ratio; $pdf->Image($img_path,165,$YPOS,$img_w_resized,$img_h_resized); } */ if ($is_gold_product) { $lineheight = 6; $leftpos = 150; $rowpos = $YPOS + $img_h_resized + 2; $pdf->SetFontSize($fontsize_big + 5); $pdf->SetXY($leftpos, $rowpos); $pdf->Cell(50, $lineheight, 'G O L D', 0, 2, 'C'); } //SPECIAL TREATMENT $product_finishing_array_st = ProductAttribute::getOldStylesFunction()->retrieveList(ProductAttribute::GROUP_ID_PRODUCT_FINISHING); $finishing_product_st = ProductAttribute::displayAttributeName($i['products_id'], ProductAttribute::GROUP_ID_PRODUCT_FINISHING, '2'); //echo "<pre>";var_dump($finishing_product_st);die(); if (empty($finishing_product_st)) { unset($finishing_product_st); } if ($finishing_product_st == NULL) { $isset_product_finishing = false; } else { $isset_product_finishing = true; } if (!$is_diamore && !$is_elli_premium) { if ($isset_product_finishing) { $rowpos = $YPOS + $img_h_resized; $lineheight = 6; $leftpos = 150; //special treament $pdf->SetFontSize($fontsize_big + 3); $pdf->SetXY($leftpos, $rowpos); $pdf->Cell(50, $lineheight, 'SPECIAL TREATMENT', 0, 2, 'C'); if ($i['products_id'] > 0 && ($is_gold_product || $is_pearl)) { if ($is_gold_product) { //gold $rowpos = $rowpos + 7; $pdf->SetFontSize($fontsize_big + 1); $pdf->SetXY($leftpos, $rowpos); $pdf->Cell(50, $lineheight, 'G O L D', 0, 2, 'C'); } /* if ($is_elli_premium) { $products_used_materials = $class_pm->retrieveProductMaterialsUsed($i['products_id']); if (in_array(52, $products_used_materials)) { $rowpos = $rowpos + 5; $pdf->SetFontSize($fontsize_big+1); $pdf->SetXY($leftpos, $rowpos); $pdf->Cell(50, $lineheight, 'D I A M O N D', 0, 2, 'C'); } if (in_array(5, $products_used_materials)) { $rowpos = $rowpos + 5; $pdf->SetFontSize($fontsize_big+1); $pdf->SetXY($leftpos, $rowpos); $pdf->Cell(50, $lineheight, 'P E A R L', 0, 2, 'C'); } } if ($is_diamore) { //diamore $rowpos = $rowpos + 5; $pdf->SetFontSize($fontsize_big+1); $pdf->SetXY($leftpos, $rowpos); $pdf->Cell(50, $lineheight, 'D I A M O N D', 0, 2, 'C'); } * */ if ($is_pearl) { //pearl $rowpos = $rowpos + 5; $pdf->SetFontSize($fontsize_big + 1); $pdf->SetXY($leftpos, $rowpos); $pdf->Cell(50, $lineheight, 'P E A R L', 0, 2, 'C'); } } //$pdf->Rect(150, 120, $img_w_resized, 30); } } $leftpos = $colpos + $imgbig_width + 2; $rowpos = $YPOS; $lineheight = 4; $linesep = 1; $pilbl = array(); $pinfo = array(); $pilbl[] = 'Product Category'; $pinfo[] = ': ' . $product_categories_name[$p['categories_id']]; $pilbl[] = 'Product ID'; $pinfo[] = ': ' . $i['products_id']; $pilbl[] = 'Product Code'; $pinfo[] = ': ' . $p['p']['products_model']; /* HIDE PRICE (REQUESTED BY CANTY & WAYAN TO PREVENT SMITH SPOTTED THE PRICE) $pilbl[] = 'Product Price'; $pinfo[] = ': '.displayCurrency('EUR', $p['p']['products_price']); */ if ($p['length'] > 0) { $pilbl[] = 'Product Length'; $pinfo[] = ': ' . textLength($p['length']); } $pilbl[] = 'Product Quantity'; $pinfo[] = ': ' . $product_qty; $lbl_width = 30; $pdf->SetXY($leftpos, $rowpos); $pdf->setFont('Arial', 'B', $fontsize_big); $pdf->MultiCell($lbl_width, $lineheight + $linesep, implode("\n", $pilbl), 0, 'L'); $pdf->SetXY($leftpos + $lbl_width, $rowpos); $pdf->MultiCell($lbl_width, $lineheight + $linesep, implode("\n", $pinfo), 0, 'L'); $rowpos += count($pilbl) * ($lineheight + $linesep) + 2 * $linesep; // $pdf->SetXY($leftpos, $rowpos); // $pdf->setFont('Arial','B',$fontsize_med); // $prodinfo = 'Product ID: '.$p['p']['products_id']; // $pdf->Cell(100, $lineheight, $prodinfo); // $rowpos += $lineheight + $linesep; // $pdf->SetXY($leftpos, $rowpos); // $pdf->setFont('Arial','B',$fontsize_med); // $prodinfo = 'Product Code: '.$p['p']['products_model']; // $pdf->Cell(100, $lineheight, $prodinfo); // $rowpos += $lineheight + $linesep; // if($p['length']>0) { // $pdf->SetXY($leftpos, $rowpos); // $pdf->setFont('Arial','B',$fontsize_med); // $prodinfo = 'Product Length: '.textLength($p['length']); // $pdf->Cell(100, $lineheight, $prodinfo); // $rowpos += $lineheight + $linesep; // } $pdf->SetXY($leftpos, $rowpos); $pdf->setFont('Arial', 'B', $fontsize_big); $pdf->Cell(100, $lineheight, 'Product Name:'); $rowpos += $lineheight; $pdf->SetXY($leftpos, $rowpos); $pdf->setFont('Arial', '', $fontsize_big); $pdf->Cell(100, $lineheight, $p['pd'][2]['products_name']); $rowpos += $lineheight + 2 * $linesep; if ($p['pnc']['production_instruction_id'] != '') { $rowpos += $lineheight; $piids = explode(",", $p['pnc']['production_instruction_id']); $pdf->SetXY($leftpos, $rowpos); $pdf->setFont('Arial', 'B', $fontsize_big); $pdf->Cell(100, $lineheight, 'Production Instruction:'); $pdf->setFont('Arial', ''); $pims = array(); //MERGE ALL MANUAL PI THAT ATTACHED TO PRODUCT foreach ($piids as $piid) { $pim = new production_instruction_manual($piid); $pi_temp = "\n" . $pim->cat_name . ' - ' . $pim->name; if (trim($pim->description) != '') { $pi_temp .= "\n" . $pim->description; } $pims[] = $pi_temp; } //EXPLODE EACH MANUAL PI WITH LINE FEED $pi_manual = implode("\n", $pims); $rowpos += $lineheight; $pdf->SetXY($leftpos, $rowpos); $pdf->MultiCell(0, $lineheight, trim($pi_manual), 0, 'L'); $manpi_rows = explode("\n", trim($pi_manual)); // $rowpos += $lineheight * 3; } else { if ($p['pnc']['products_instruction'] != '') { $pdf->SetXY($leftpos, $rowpos); $pdf->setFont('Arial', 'B', $fontsize_big); $pdf->Cell(100, $lineheight, 'Production Instruction:'); $pdf->setFont('Arial', ''); $rowpos += $lineheight; $pdf->SetXY($leftpos, $rowpos); $pdf->MultiCell(0, $lineheight, $p['pnc']['products_instruction'], 0, 'L'); $manpi_rows = explode("\n", $p['pnc']['products_instruction']); //$rowpos += ceil(($lineheight-1)*count($manpi_rows)); } } $rowpos_manpi = $pdf->GetY(); $rowpos = $rowpos_manpi + 5; $leftpos = $colpos + $imgbig_width + 2; $rowpos_addimage = 0; $nei = 0; if (strtoupper($o['type']) == 'JG' && $i['custom_img'] != '') { //$imgcus_width = 37; //150px $imgcus_width = $imgsml_width; //100px $imgcus = $this->getImageForPDF($i['custom_img'], '100', '100'); if ($imgcus != '') { $pdf->Image($imgcus, $leftpos, $rowpos, $imgcus_width); $pdf->Rect($leftpos, $rowpos, $imgcus_width, $imgcus_width); } $leftpos += $imgcus_width + 2; // } elseif((count($p['pei'])>0 && ($p['categories_id']==2||$p['categories_id']==3||$p['categories_id']==30)) || (count($p['pei'])>1 && $p['categories_id']==9)) { //Show Extra Images only for NL,BL,SETS OR CH that have 2 extra images (only show 1st extra_images) } elseif (count($p['pei']) > 0) { // show extra images for all categories since tends now extra images is used for explain detailly of a product $rowpos = $YPOS + $imgbig_width + 2; $pdf->SetXY($margin, $rowpos); $pdf->setFont('Arial', 'B', $fontsize_big); $pdf->Cell(100, $lineheight, 'Additional Images'); $rowpos += $lineheight + 1; foreach ($p['pei'] as $pei) { $nei++; // if($p['categories_id']==9 && $nei>1) continue; //display only 1st extra image for CH $reset_leftpos = true; if ($is_diamore) { //IF DIAMORE PRODUCTS $print_image = false; if (($p['categories_id'] == 2 || $p['categories_id'] == 30) && in_array($nei, array(1, 3))) { $print_image = true; } if ($p['categories_id'] == 4 && in_array($nei, array(2, 3))) { $print_image = true; } if (($p['categories_id'] == 29 || $p['categories_id'] == 3) && in_array($nei, array(1, 2))) { $print_image = true; } if (($p['categories_id'] == 9 || $p['categories_id'] == 28) && in_array($nei, array(1))) { $print_image = true; } if ($print_image) { $leftpos = $colpos; if ($rowpos > 214) { $pdf->show_footer_page_info = true; $pdf->AddPage(); $YPOS = $margin + 5; $rowpos = $YPOS; $rowpos_manpi = $YPOS; } $imgsml = $this->getImageForPDF($pei, '212', '212'); if ($imgsml != '') { $pdf->Image($imgsml, $leftpos, $rowpos, $imgbig_width); $pdf->Rect($leftpos, $rowpos, $imgbig_width, $imgbig_width); $rowpos += $imgbig_width + 2; } } } else { //IF NOT DIAMORE PRODUCTS $check_nei = $nei % 2; if ($check_nei == 1) { if ($nei != 1) { $reset_leftpos = false; //print additional image using 2 columns when manual pi is exceeded bottom of main image if ($nei > 2 && $rowpos_manpi > $rowpos_main_image) { $rowpos += $imgsml_width + 2; $reset_leftpos = true; } } } else { $reset_leftpos = false; } if ($reset_leftpos) { $leftpos = $colpos; } else { $leftpos += $imgsml_width + 2; } $imgsml = $this->getImageForPDF($pei, '100', '100'); if ($imgsml != '') { $pdf->Image($imgsml, $leftpos, $rowpos, $imgsml_width); $pdf->Rect($leftpos, $rowpos, $imgsml_width, $imgsml_width); //$rowpos += $imgsml_width + 2; } } } if ($is_diamore) { //IF DIAMORE PRODUCTS $rowpos_addimage = $rowpos + 2; } else { $rowpos_addimage = $rowpos + $imgsml_width + 2; $leftpos += $imgsml_width + 2; } } //CUSTOMIZE PRODUCTS & PRINTED GIFT VOUCHER FROM JULIE & GRACE if (strtoupper($o['type']) == 'JG') { if (strpos($p['p']['products_model'], 'GIFT-P') !== false) { $gift_amount = substr($p['p']['products_model'], 7); $cgq_query = "SELECT c.coupon_code, c.coupon_amount, c.coupon_expire_date FROM coupon_gv_queue cgq"; $cgq_query .= " LEFT JOIN coupons c ON c.coupon_id=cgq.coupon_id"; $cgq_query .= " WHERE cgq.order_id={$o['id']} AND cgq.amount={$gift_amount}"; $cgq_result = tep_db_query($cgq_query); $vouchers = array(); while ($row = tep_db_fetch_array($cgq_result)) { $vouchers[] = $row; } $vcounter = 0; foreach ($vouchers as $v) { $vcounter++; $pdf->SetXY($leftpos, $rowpos); $pdf->setFont('Arial', 'B', $fontsize_med); $pdf->Cell(100, $lineheight, 'Voucher ' . $vcounter . ':'); $rowpos += $lineheight; $vilbl = array(); $vinfo = array(); $vilbl[] = '- Code'; $vinfo[] = ': ' . $v['coupon_code']; $vilbl[] = '- Amount'; $vinfo[] = ': ' . number_format($v['coupon_amount'], 0) . ' EUR'; $vilbl[] = '- Expired Date'; $vinfo[] = ': ' . date('d. M Y', strtotime($v['coupon_expire_date'])); $pdf->setFont('Arial', '', $fontsize_med); $pdf->SetXY($leftpos, $rowpos); $pdf->MultiCell($lbl_width, $lineheight, implode("\n", $vilbl)); $pdf->SetXY($leftpos + $lbl_width, $rowpos); $pdf->MultiCell(100, $lineheight, implode("\n", $vinfo)); $rowpos += count($vilbl) * $lineheight + 2 * $linesep; } } if ($i['custom_text'] != '') { $pdf->SetXY($leftpos, $rowpos); $pdf->setFont('Arial', 'B', $fontsize_big); $pdf->Cell(100, $lineheight, 'Custom Text:'); $rowpos += $lineheight; $pdf->SetXY($leftpos, $rowpos); $pdf->setFont('Arial', '', 12); $pdf->MultiCell(0, 4, $i['custom_text']); $rowpos += 2 * $lineheight + 2 * $linesep; } if ($i['custom_img'] != '') { $pdf->SetXY($leftpos, $rowpos); $pdf->setFont('Arial', 'B', $fontsize_big); $pdf->Cell(100, $lineheight, 'Custom Image:'); $rowpos += $lineheight; $pdf->SetXY($leftpos, $rowpos); $pdf->setFont('Arial', '', $fontsize_big); $pdf->Cell(0, $lineheight, basename($i['custom_img'])); $rowpos += $lineheight + 2 * $linesep; } if ($i['custom_imgcm'] != '') { $pdf->SetXY($leftpos, $rowpos); $pdf->setFont('Arial', 'B', $fontsize_big); $pdf->Cell(100, $lineheight, 'Custom Image Comment:'); $rowpos += $lineheight; $pdf->SetXY($leftpos, $rowpos); $pdf->setFont('Arial', '', $fontsize_big); $pdf->MultiCell(0, $lineheight, basename($i['custom_imgcm']), 0, 'L'); } } else { if ($p['article']['text'] != '') { $pdf->SetXY($leftpos, $rowpos); $pdf->setFont('Arial', 'B', $fontsize_big); $pdf->Cell(100, $lineheight, 'Custom Text:'); $rowpos += $lineheight; $pdf->SetXY($leftpos, $rowpos); $pdf->setFont('Arial', '', 12); $pdf->MultiCell(0, 4, $p['article']['text']); $rowpos += 2 * $lineheight + 2 * $linesep; } } //$YPOS += (($rowpos>($YPOS+$imgbig_width)) ? $rowpos : $imgbig_width) + 10; //CHANGE THIS TO BELOW //if($rowpos>($YPOS+$imgbig_width)) $YPOS = $rowpos + 5; //else $YPOS += $imgbig_width + 10; if (in_array($p['p']['products_brand_id'], $DIAMOND_BRAND_IDS)) { if ($rowpos_manpi > $rowpos_addimage) { $YPOS = $rowpos_manpi + 5; } elseif ($rowpos_addimage > $rowpos_manpi) { $YPOS = $rowpos_addimage + 15; } //if manual pi printed smaller than displayed additional images if ($rowpos_main_image > $rowpos_manpi && $nei == 0) { $YPOS = $rowpos_main_image + 5; } //if manual pi printed smaller than displayed main images and theres no additional images printed if ($rowpos_manpi == $rowpos_addimage) { $YPOS = $rowpos_manpi; } //if manual pi printed and additional images were the same row height } else { if ($rowpos_manpi > $rowpos_addimage) { $YPOS = $rowpos_manpi + 5; } elseif ($rowpos_addimage > $rowpos_manpi) { $YPOS = $rowpos_addimage + 5; } //if manual pi printed smaller than displayed additional images if ($rowpos_main_image > $rowpos_manpi && $nei == 0) { $YPOS = $rowpos_main_image + 5; } //if manual pi printed smaller than displayed main images and theres no additional images printed if ($rowpos_manpi == $rowpos_addimage) { $YPOS = $rowpos_manpi; } //if manual pi printed and additional images were the same row height } //PRODUCTION if ($YPOS > 240) { $pdf->show_footer_page_info = true; $pdf->AddPage(); $YPOS = $margin + 5; } $lineheight = 5; $pdf->SetXY($margin, $YPOS); $pdf->setFont('Arial', 'B', $fontsize_big); $pdf->Cell(100, $lineheight, 'Production'); $YPOS += $lineheight + 1; //IF NEED NEW QC COLUMN, ONLY NEED TO ADD BELOW ARRAY $col = array(); $col[1] = 'Workshop'; $col[2] = 'Beading'; $col[3] = 'Enamel'; $col[4] = 'Ferido'; $col[5] = 'Packing'; $leftpos = $margin + 1; $pdf->setXY($leftpos, $YPOS); $qc_table_max_width = 198; $colwidth = number_format($qc_table_max_width / count($col), 1); //$colwidth = 39.6; foreach ($col as $cval) { $pdf->Cell($colwidth, $lineheight, $cval, 1, 0, 'C', true); } $YPOS += $lineheight; $leftpos = $margin + 1; $pdf->setFont('Arial', 'B', $fontsize_big + 5); $pdf->SetTextColor(209, 209, 209); $pdf->setXY($leftpos, $YPOS); for ($x = 1; $x <= count($col); $x++) { $pdf->Cell($colwidth, 15, 'QC', 1, 0, 'C'); } //PRODUCT FINISHING //echo "<pre>";var_dump($finishing);die(); $finishing = array(); /* UPDATE: NOW WE USE PRODUCTS FINISHING IN PRODUCT ATTRIBUTES TO FLAG WHETHER THE PRODUCTS NEEDS RHODIUM OR MICRON */ /* RHODIUM RULES Rule1: OttoB2B, Elli Premium which Silver "without plated" and whitegold product Rule2: Diamore */ /* $rhodium_rule1 = ( ($is_ottob2b || $is_elli_premium) && ($obj_product->metal_stamp_code == Product::METAL_STAMP_CODE_925 || $obj_product->metal_stamp_info == Product::METAL_STAMP_INFO_WHITEGOLD) ); $rhodium_rule2 = $is_diamore; */ //$rhodium_and_micron_rule = in_array_r($finishing_product, $product_finishing_array); //if ($rhodium_rule1 || $rhodium_rule2) { //if ($rhodium_and_micron_rule) { //$finishing[] = 'Rhodium'; //} $is_partial_plated = $p['p']['is_partial_plated'] == '1'; $is_goldplated = false; foreach ($p['finishing'] as $ftext => $fval) { if ($fval) { $is_goldplated = $fval == 'Goldplated' || $fval == 'Rose Goldplate'; if ($is_partial_plated) { if ($fval == 'Goldplated' || $fval == 'Rose Goldplate') { continue; } } //OttoB2B and Elli Premium goldplated products need to be added with 1.5 micron /* if (($is_ottob2b || $is_elli_premium) && ($fval == 'Goldplated' || $fval == 'Rose Goldplate')) { $ftext .= ' 1.5 micron'; } */ $finishing[] = $ftext; } } if ($is_partial_plated) { //OttoB2B and Elli Premium goldplated products need to be added with 1.5 micron //if (($is_ottob2b || $is_elli_premium) //$finishing_micron_key = array_search('micron', $finishing); //if ($finishing_micron_key !== false //&& ($fval == 'Goldplated' || $fval == 'Rose Goldplate')) { //$finishing[] = 'Partial Plated 1.5 micron'; //} else { $finishing[] = 'Partial Plated'; //} } $product_finishing_array = ProductAttribute::getOldStylesFunction()->retrieveList(ProductAttribute::GROUP_ID_PRODUCT_FINISHING); $finishing_product = ProductAttribute::displayAttributeName($i['products_id'], ProductAttribute::GROUP_ID_PRODUCT_FINISHING, '2'); if (!empty($finishing_product)) { $finishing[] = $finishing_product; } /* if ($is_goldplated || $is_partial_plated) { //If using plating, removed finishing Rhodium since it will antitarnished as standard for plated products $finishing_rhodium_key = array_search('Rhodium', $finishing); if ($finishing_rhodium_key !== false) { unset($finishing[$finishing_rhodium_key]); } } */ //echo "<pre>";var_dump($finishing);die(); if (count($finishing) > 0) { if ($YPOS > 250) { $pdf->show_footer_page_info = true; $pdf->AddPage(); $YPOS = $margin + 5; } $finishing = implode(', ', $finishing); $pdf->SetTextColor(0, 0, 0); $YPOS += $lineheight + 15; $lineheight = 4; $pdf->SetXY($margin, $YPOS); $pdf->setFont('Arial', 'B', $fontsize_big); $pdf->Cell(100, $lineheight, 'Product Finishing'); $YPOS += $lineheight + 1; $lineheight = 15; $colwidth = array(); $colwidth[1] = 178; $colwidth[2] = 20; $leftpos = $margin + 1; $pdf->setXY($leftpos, $YPOS); $pdf->setFont('Arial', 'B', $fontsize_big + 5); $pdf->Cell($colwidth[1], $lineheight, $finishing, 1, 2, 'C'); $leftpos += $colwidth[1]; $pdf->setXY($leftpos, $YPOS); $pdf->SetTextColor(209, 209, 209); $pdf->Cell($colwidth[2], $lineheight, 'QC', 1, 2, 'C'); } $pdf->SetTextColor(0, 0, 0); //PRODUCT GOLD WEIGHT CHECK (PGWC) if ($is_gold_product) { if ($YPOS > 220) { $pdf->show_footer_page_info = true; $pdf->AddPage(); $YPOS = $margin + 5; } $YPOS += $lineheight + 15; $lineheight = 5; $pdf->SetXY($margin, $YPOS); $pdf->setFont('Arial', 'B', $fontsize_big); $pdf->Cell(100, $lineheight, 'Product Gold Weight Check'); $YPOS += $lineheight + 1; $gold_weight_check_process = array(); $gold_weight_check_process["Safe-WH"] = 'Safe to WH'; $gold_weight_check_process["WH-QC"] = 'WH to QC'; $gold_weight_check_process["QC-GS"] = 'QC to Goldsmith'; $gold_weight_check_process["GS-QC"] = 'Goldsmith to QC'; $leftpos = $margin + 1; $pdf->SetXY($leftpos, $YPOS); $gwc_table_max_width = $qc_table_max_width; $n_col_weight_check = 8; $colwidth = number_format($gwc_table_max_width / $n_col_weight_check, 1); foreach ($gold_weight_check_process as $key => $val) { if ($key == "QC-GS" || $key == "GS-QC") { $pdf->Cell($colwidth * 3, $lineheight, $val, 1, 0, 'C', true); } else { $pdf->Cell($colwidth, $lineheight, $val, 1, 0, 'C', true); } } //Draw PGWC Total Weight Box $YPOS += $lineheight; $leftpos = $margin + 1; $pdf->setFont('Arial', 'B', $fontsize_sml); $pdf->SetTextColor(209, 209, 209); $pdf->SetXY($leftpos, $YPOS); $gw_colheight_big = 10; $gw_colheight_sml = number_format($gw_colheight_big / 2, 1); for ($x = 1; $x <= $n_col_weight_check; $x++) { if ($x == 1) { $pdf->Cell($colwidth, $gw_colheight_sml, 'GW:', 1, 2, 'L'); $pdf->SetX($leftpos); $pdf->Cell($colwidth, $gw_colheight_sml, 'NW:', 1, 0, 'L'); } else { if ($x == 2) { $pdf->SetXY($leftpos + $colwidth, $YPOS); } $box_start = $x == $n_col_weight_check ? 2 : 0; $pdf->Cell($colwidth, $gw_colheight_sml, "Total Weight", 'LR', $box_start, 'C'); } } $pdf->SetX($leftpos + $colwidth); for ($x = 2; $x <= $n_col_weight_check; $x++) { $box_start = $x == $n_col_weight_check ? 2 : 0; $pdf->Cell($colwidth, $gw_colheight_sml, '', 'LR', $box_start, 'C'); } //Draw PGWC Total Signature Box $colwidth_signature = number_format($colwidth / 2, 1); $pdf->SetX($leftpos); $pdf->SetFontSize($fontsize_med); foreach ($gold_weight_check_process as $key => $val) { if ($key == "QC-GS" || $key == "GS-QC") { $loop = 3; } else { $loop = 1; } list($lsign, $rsign) = explode("-", $key); for ($x = 1; $x <= $loop; $x++) { $pdf->Cell($colwidth_signature, $gw_colheight_big, $lsign, 1, 0, 'C'); $pdf->Cell($colwidth_signature, $gw_colheight_big, $rsign, 1, 0, 'C'); } } $YPOS += $lineheight - 2 + $gw_colheight_big * 2; $pdf->setFont('Arial', '', $fontsize_sml); $pdf->Text($leftpos, $YPOS, 'GW: Total Weight of Gold Elements'); $YPOS += $lineheight - 2; $pdf->Text($leftpos, $YPOS, 'NW: Total Weight of Non-Gold Elements'); //Draw PGWC Dust Box if ($YPOS > 250) { $pdf->show_footer_page_info = true; $pdf->AddPage(); $YPOS = $margin + 5; } $YPOS += $lineheight; $pdf->SetXY($leftpos, $YPOS); $pdf->setFont('Arial', 'B', $fontsize_big); $pdf->SetTextColor(0, 0, 0); $pdf->Cell($colwidth, $lineheight, 'Dust', 1, 2, 'C', true); $pdf->SetFontSize($fontsize_sml); $pdf->SetTextColor(209, 209, 209); $pdf->Cell($colwidth, $gw_colheight_sml, 'Total Weight', 'LR', 2, 'C'); $pdf->Cell($colwidth, $gw_colheight_sml, '', 'LR', 2, 'C'); $pdf->Cell($colwidth_signature, $gw_colheight_big, 'QC', 1, 0, 'C'); $pdf->Cell($colwidth_signature, $gw_colheight_big, 'GS', 1, 0, 'C'); } $pdf->SetTextColor(0, 0, 0); //ENGRAVING ORDER SLIP global $ENGRAVED_PRODUCTS; if (strtoupper($o['type']) == 'JG' && in_array($i['products_id'], $ENGRAVED_PRODUCTS)) { if ($this->duplex_printing && $item_page_count % 2 != 0) { $pdf->AddPage(); $item_page_count++; } $pdf->AddPage(); $item_page_count++; $lineheight = 4; $midpage = 148.5; $rowpos = $margin + 10; //repeat 2 times for ($s = 1; $s <= 2; $s++) { if ($s == 2) { $rowpos = $midpage + 10; $slipinfo = 'Face2Face'; } else { $slipinfo = 'Bonofactum'; } $colpos = $margin + 1; $pdf->OrderBarcode($o['type'], $oiid, $barcode_pos, $rowpos, $barcode_width); $pdf->SetXY($margin, $rowpos); $pdf->setFont('Arial', 'B', '12'); $pdf->Cell(100, $lineheight, 'Engraving Order Slip (' . $slipinfo . ')'); $rowpos += $lineheight + 5; $rowpos_fixed = $rowpos; if ($imgbig != '') { $pdf->Image($imgbig, $colpos, $rowpos, $imgbig_width); } $pdf->Rect($colpos, $rowpos, $imgbig_width, $imgbig_width); $colpos += $imgbig_width + 5; $es_ilbl_width = 30; $es_ilbl = array(); $es_info = array(); $es_ilbl[] = 'Order By'; $es_info[] = ': Bonofactum'; $es_ilbl[] = 'Order Date'; $es_info[] = ': ' . date('d. M Y'); $es_ilbl[] = 'Order Quantity'; $es_info[] = ': ' . $product_qty; $pdf->setFont('Arial', 'B', $fontsize_med); $pdf->SetXY($colpos, $rowpos); $pdf->MultiCell($es_ilbl_width, $lineheight, implode("\n", $es_ilbl)); $pdf->SetXY($colpos + $es_ilbl_width, $rowpos); $pdf->MultiCell($es_ilbl_width * 2, $lineheight, implode("\n", $es_info)); $rowpos += (count($es_ilbl) + 1) * $lineheight + 1; $pdf->SetXY($colpos, $rowpos); $pdf->Cell(100, $lineheight, 'Custom Text'); $rowpos += $lineheight + 1; $pdf->SetDrawColor(128, 128, 128); $pdf->Rect($colpos + 1, $rowpos, 132, 30); $pdf->SetDrawColor(0, 0, 0); if ($i['custom_text'] != '') { $pdf->SetXY($colpos + 3, $rowpos + 3); $pdf->setFont('Arial', 'B', '12'); $pdf->MultiCell(100, $lineheight, $i['custom_text']); } $rowpos = $rowpos_fixed + $imgbig_width + 5; if ($i['custom_img'] != '') { $leftpos = $margin + 1; if ($imgcus != '') { $pdf->Image($imgcus, $leftpos, $rowpos, $imgcus_width); $pdf->Rect($leftpos, $rowpos, $imgcus_width, $imgcus_width); } $leftpos += $imgcus_width + 2; $pdf->setXY($leftpos, $rowpos); $pdf->setFont('Arial', 'B', $fontsize_med); $pdf->Cell(100, $lineheight, 'Custom Image:'); $rowpos += $lineheight; $pdf->setXY($leftpos, $rowpos); $pdf->setFont('Arial', '', $fontsize_med); $pdf->Cell(100, $lineheight, basename($i['custom_img'])); $rowpos += $lineheight + 1; $pdf->setXY($leftpos, $rowpos); $pdf->setFont('Arial', 'B', $fontsize_med); $pdf->Cell(100, $lineheight, 'Graving Request:'); $rowpos += $lineheight; $engraving_options_pos = $leftpos + $lineheight + 1; $engraving_options = array(); $engraving_options[] = 'Full (gravir penuh)'; $engraving_options[] = 'Centered (gravir tengah, atas dan bawah kosong)'; $engraving_options[] = 'Bottom (gravir bawah penuh, atas kosong)'; $pdf->setXY($engraving_options_pos, $rowpos); $pdf->setFont('Arial', '', $fontsize_med); $pdf->MultiCell(100, $lineheight, implode("\n", $engraving_options)); $cb_sep = 0.5; $cbsize = $lineheight - $cb_sep; $leftpos += 1; $pdf->SetDrawColor(128, 128, 128); foreach ($engraving_options as $eo) { $pdf->Rect($leftpos, $rowpos, $cbsize, $cbsize); $rowpos += $lineheight; } $pdf->SetDrawColor(0, 0, 0); } } $pdf->Line($margin, $midpage, 210 - $margin, $midpage); } if ($i['print_count'] == '0' || $i['print_count'] == '') { $this->qty_total_first_printed++; } } //end looping items } //end looping orders if ($output == 'F') { $filename = $this->filename != '' ? $this->filename : DIR_FS_MINIERP . DIR_WS_GATEWAY . "ready_orders/" . strtoupper($o['type']) . '/' . strtoupper($o['type']) . '-' . $oiid; // $priority_rule_1 = in_array($o['jng_sp_id'], $sp_using_red_paper); // $priority_rule_2 = $o['customer_is_vip']; $priority_rule_1 = $o['priority'] == '1'; // if($priority_rule_1 || $priority_rule_2 || $priority_rule_3) $filename .= '-RED'; if ($priority_rule_1 && $this->filename == '') { $filename .= '-RED'; } $pdf->Output($filename . '.pdf', $output); } }
$stock_target[$a_counter] = '<b>-</b>'; $qty_ordered[$a_counter] = '<b>' . intval($p['qty_order']) . '</b>'; $qty_missing[$a_counter] = '<b>-</b>'; $levelling_target[$a_counter] = '<b>-</b>'; $levelling_orders[$a_counter] = '<b>-</b>'; $levelling_orders_ptb[$a_counter] = '<b>-</b>'; $levelling_orders_os[$a_counter] = '<b>-</b>'; $total_target[$a_counter] = '<b>-</b>'; $total_qty_missing[$a_counter] = '<b>-</b>'; $levelling_orders_today[$a_counter] = '<b>-</b>'; $order_qty[$a_counter] = '<b>-</b>'; } foreach ($p['articles'] as $aid => $a) { $a_counter++; $fc_base_daily = $obj_product->getForecastDailyBaseValue($aid); $size[$a_counter] = $a['article_length'] > 0 ? textLength($a['article_length']) : 'None'; $ean[$a_counter] = $a['article_ean']; $sold_last_month_nopromo[$a_counter] = intval($a['article_fc_base_monthly']); $sold_last_month[$a_counter] = intval($a['article_sold_monthly_1']); $stock[$a_counter] = intval($a['article_stock']); $stock_target[$a_counter] = $obj_product->getDIOHstockTarget($aid); $qty_ordered[$a_counter] = intval($a['article_orders_qty']); $qty_missing[$a_counter] = $stock_target[$a_counter] - ($stock[$a_counter] + $qty_ordered[$a_counter]); if ($qty_missing[$a_counter] < 0) { $qty_missing[$a_counter] = 0; } $levelling_target[$a_counter] = $fc->calcLevellingTarget($fc_base_daily, $current_month); $count_levelling_orders = $class_do->countOrdersLevellingDetailsByArticle($pid, $aid); $count_levelling_orders_today = $class_do->countOrdersLevellingByArticleAndDate($pid, $aid, 'today'); $levelling_orders[$a_counter] = $count_levelling_orders['total']; $levelling_orders_ptb[$a_counter] = $count_levelling_orders['internal'];
*/ $content .= '</table></div>'; $content .= '</div>'; $content .= '<div>'; $content .= '<h3><a href="#">Product Description</a></h3>'; $content .= '<div><table class="form" border="0" cellpadding="0" cellspacing="0">'; $content .= '<tr>'; $content .= '<td width="150">Name</td><td>'; $content .= $product_name == '' ? $unset : $product_name; $content .= '</td></tr>'; $content .= '<tr><td style="vertical-align:top;">Description</td><td>'; $content .= $product_desc == '' ? $unset : $product_desc; $content .= '</td></tr>'; //PRODUCT LENGTH SHOULD NOT BE EDITABLE $content .= '<tr><td>Length</td><td>'; $content .= textLength($product_length); $content .= '</td></tr>'; $content .= '<tr><td>Color</td><td>'; $content .= $product_color == '' ? $unset : $product_color; $content .= '</td></tr>'; $content .= '<tr><td>Material</td><td>'; $content .= $product_material == '' ? $unset : $product_material; $content .= '</td></tr>'; $content .= '<tr><td style="vertical-align:top;">Search Keywords</td><td>'; $content .= $product_keywords == '' ? $unset : $product_keywords; $content .= '</td></tr>'; $content .= '</table></div>'; $content .= '</div>'; $content .= '<div>'; $content .= '<h3><a href="#">Product Price</a></h3>'; $content .= '<div><table class="form" border="0" cellpadding="0" cellspacing="0">';
$ajaxResult = array(); $ajaxResult['result'] = $post_result; ajaxReturn($ajaxResult); exit; } } if (isset($_GET) && count($_GET) > 0) { $ean_no = $_GET['ean']; $pa = $class_pean->getProductArticle($ean_no); $products_id = $pa['products_id']; if ($products_id != '') { $qp = "SELECT p.*, pd.products_name FROM products p INNER JOIN products_description pd ON p.products_id = pd.products_id\n WHERE p.products_id = {$products_id} AND pd.language_id = 2"; $dbqp = tep_db_query($qp); $rp = tep_db_fetch_array($dbqp); $p_img = webImage($rp['products_image'], '350', '350', 'Products ' . $ean_no, 'ui-corner-all'); $p_length = $pa['length'] > 0 ? ' / ' . textLength($pa['length']) : ''; $is_best_product = $class_pm->isBestProduct($pa['products_id']); if ($is_best_product) { $used_form = '<table style="width:100%;position:absolute;top:0;left:0;" border="0" cellpadding="0" cellspacing="0">'; $used_form .= '<tr><td align="center" colspan="2">' . $p_img . '</td></tr>'; $used_form .= '<tr><td align="center" colspan="2" style="font-size:16px;font-weight:bold;">' . $rp['products_model'] . $p_length . '</td></tr>'; $used_form .= '<tr><td align="center" colspan="2" style="padding:9px;"><span class="bold" style="vertical-align:middle;font-size:34px;">Please Do Product Quality Check</span></td></tr>'; $used_form .= '<tr>'; $used_form .= '<input type="hidden" id="hid-ids" value="' . $pa['products_id'] . '-' . $pa['products_articles_id'] . '"/>'; $used_form .= '<td align="center"><input type="button" style="font-size:15px;" class="qcok green button" value="QC OK"/></td>'; $used_form .= '<td align="center"><input type="button" style="font-size:15px;" class="qcbad red button" value="QC BAD"/></td>'; $used_form .= '</tr>'; $used_form .= '</table>'; } else { $used_form .= '<table style="background:#ff0000;width:100%;height:100%;position:absolute;top:0;left:0;" border="0" cellpadding="0" cellspacing="0">'; $used_form .= '<tr><td align="center">' . $p_img . '</td></tr>';
$qty_ordered[$a_counter] = '<span class="notice">' . $qty_ordered[$a_counter] . '</span>'; $nonrefill_orders[$a_counter] = '<span class="notice">' . $nonrefill_orders[$a_counter] . '</span>'; $nonrefill_orders_today[$a_counter] = '<span class="notice">' . $nonrefill_orders_today[$a_counter] . '</span>'; $button_disabled = ' disabled="disabled"'; } else { if ($nonrefill_orders_today[$a_counter] > 0) { $nonrefill_orders_today[$a_counter] = '<span class="green">' . $nonrefill_orders_today[$a_counter] . '</span>'; } $button_disabled = ''; } $qty_form = '<span>'; $qty_form .= '<input type="button" name="os-create" value="Form" title="Open form to create new order"' . $button_disabled . ' />'; $qty_form .= '<input type="hidden" name="pid" value="' . $pid . '" />'; $qty_form .= '<input type="hidden" name="aid" value="' . $aid . '" />'; $qty_form .= '<input type="hidden" name="ean" value="' . $a['article_ean'] . '" />'; $qty_form .= '<input type="hidden" name="length" value="' . ($a['article_length'] > 0 ? textLength($a['article_length']) : '-') . '" />'; $qty_form .= '</span>'; $order_qty[$a_counter] = $qty_form; } //$asep => Article SEParator $asep = '<br />'; $image = webImage($p['image'], '80', '80'); $imagesource = webImageSource($p['image'], '500', '500'); if ($imagesource != '') { $image = '<a href="' . $imagesource . '" class="view_image">' . $image . '</a>'; } $info = '<a href="?open=product-detail&products_id=' . $pid . '" target="_blank">' . $pid . ' / ' . $p['code'] . '</a>'; $info .= '<br />' . $p['name']; $table .= '<tr class="' . $trclass . '">'; $table .= '<td>' . $counter . '</td>'; $table .= '<td>' . $image . '</td>';
$contents_table = array(); $ct = array(); $ct['d'] = 'Date'; $ct['o'] = 'Order ID'; $ct['e'] = 'Order Source'; $ct['a'] = 'Article No'; $ct['a2'] = 'EAN'; $ct['q'] = 'Quantity'; $ct['d2'] = 'Time Added'; $contents_table[] = $ct; $counter_orders = 0; $counter_products = 0; foreach ($contents as $do) { $counter_orders++; $counter_products += $do['quantity']; $pcode = $do['products_model'] . ($do['length'] > 0 ? '_' . textLength($do['length'], false) : ''); $product = ''; $pimg = webImageSource($do['products_image'], '500'); if ($pimg != '') { $thumb = '<div class="thumb" style="display:none;"><a href="' . $pimg . '" class="view_image" title="' . $pcode . '">' . webImage($do['products_image'], '80', '80', '', 'img-border img-padding') . '</a></div>'; $product .= $thumb; } $product .= '<a href="?open=product-detail&products_id=' . $do['products_id'] . '" target="_blank">' . $pcode . '</a>'; $ct = array(); $ct['d'] = date('d-M-y', strtotime($do['order_date'])); $ct['o'] = '<a href="?open=depot-order&id=' . $do['depot_orders_id'] . '" class="view_webpage">DP-' . $do['depot_orders_id'] . '</a>'; $ct['e'] = $class_do->translateOrderSource($do['trans_type'], $do['trans_id'], true); $ct['a'] = $product; $ct['a2'] = $do['products_ean']; $ct['q'] = $do['quantity']; $ct['d2'] = date('H:i:s', strtotime($do['date_added']));
$content .= '<br /><a href="?open=product-detail&products_id=' . $pid . '">' . $pid . '</a>'; $content .= '</td>'; $col_ean = ''; $col_stock = ''; $col_booked_query = ''; $col_booked_cache = ''; $cache_status = true; foreach ($articles as $aid => $row) { if ($aid == '0') { $ean = $pdata['p']['products_ean']; $length = $pdata['pnc']['products_length']; } else { $ean = $adata[$aid]['products_ean']; $length = $adata[$aid]['length']; } $col_ean .= '<div>' . $ean . ($length == 0 ? '' : ' ⋅ ' . textLength($length)) . '</div>'; $col_stock .= '<div>' . $row['stock'] . '</div>'; $col_booked_query .= '<div>' . $row['active_booked_query'] . '</div>'; $col_booked_cache .= '<div>' . $row['active_booked_cache'] . '</div>'; if ($row['active_booked_query'] != $row['active_booked_cache']) { $cache_status = false; } } $content .= '<td class="name tal">' . $col_ean . '</td>'; $content .= '<td>' . $col_stock . '</td>'; $content .= '<td>' . $col_booked_query . '</td>'; $content .= '<td>' . $col_booked_cache . '</td>'; $content .= '<td><img src="images/icon-' . ($cache_status ? 'tick' : 'delete') . '.png" /></td>'; $content .= '</tr>'; } $content .= '</tbody>';
function scanEANReceived($package_id, $ean_no, $type = '') { global $class_sendback; global $class_pean; $product_in_package = $class_sendback->getProductOnSentPackage($package_id, $ean_no, $type); $post_result = ''; if (count($product_in_package) > 0) { $product_in_package = $product_in_package[0]; $pa = $class_pean->getProductArticle($ean_no); $p_length = $pa['length'] > 0 ? '<br/>Length : ' . textLength($pa['length']) : ''; $products_id = $pa['products_id']; $p_img = ''; if ($products_id != '') { $qp = "SELECT p.*, pd.products_name FROM products p INNER JOIN products_description pd ON p.products_id = pd.products_id\n WHERE p.products_id = {$products_id} AND pd.language_id = 2"; $dbqp = tep_db_query($qp); $rp = tep_db_fetch_array($dbqp); $p_img = webImage($rp['products_image'], '350', '350', 'Products ' . $ean_no, 'ui-corner-all'); } $post_result .= '<input type="hidden" name="hid-ids" value="' . $products_id . ';' . $product_in_package['sendback_id'] . ';' . $product_in_package['quantity_sent'] . ';' . $product_in_package['quantity_received'] . ';' . $product_in_package['type'] . '" />'; $post_result .= '<table border="0" cellpadding="0" cellspacing="0" style="background:#E4E3E0;">'; $post_result .= '<tr><td rowspan="3" align="center">' . $p_img . '</td><td align="center" colspan="2" style="vertical-align:middle"><h1>Does Bag Contain This Product ?<br/><br/>Code : ' . $rp['products_model'] . $p_length . '</h1></td></tr>'; $post_result .= '<tr>'; $post_result .= '<td align="center" style="vertical-align:middle"><input type="button" style="width:120px;height:70px;font-size:20px;" class="bagcheck green bold" value="YES"/></td>'; $post_result .= '<td align="center" style="vertical-align:middle"><input type="button" style="width:120px;height:70px;font-size:20px;" class="bagcheck red bold" value="NO"/></td>'; $post_result .= '</tr>'; $post_result .= '</table>'; } else { $post_result = '<div>'; $post_result .= '<h2 class="red">Product with EAN ' . $ean_no . ' is not exists in package data ! </h2>'; $post_result .= '<input type="button" style="height:70px;font-size:20px;" class="rcv-dif-prod bold" value="Received This EAN"/>'; $post_result .= '<input type="button" style="width:120px;height:70px;font-size:20px;margin-left:20px;" class="done bold" value="DONE"/>'; $post_result .= '</div>'; } return $post_result; }