function setProductDescription2($products_id, $focus = null)
{
    use_class('element');
    $q = tep_db_query("SELECT * FROM products_description2 WHERE products_id={$products_id}");
    $pd2 = tep_db_fetch_array($q);
    $elements_used = $this->retrieveElementsUsed($products_id);
    if (!is_null($focus) && !is_array($focus)) {
        $focus = explode(',', $focus);
    }
    $need_tobe_filled_c = is_null($focus) || in_array('c', $focus) && ($pd2['clasp_type'] == '' || $pd2['clasp_type'] == 0) ? true : false;
    $need_tobe_filled_s = is_null($focus) || in_array('s', $focus) && ($pd2['setting_type'] == '' || $pd2['setting_type'] == 0) ? true : false;
    if ($need_tobe_filled_c || $need_tobe_filled_s) {
        $sda = array();
        foreach ($elements_used as $eid) {
            $el = new element($eid);
            if ($need_tobe_filled_c && !isset($sda['clasp_type']) && $sda['clasp_type'] == '') {
                $sda['clasp_type'] = $el->attributes['clasp']['id'];
            }
            if ($need_tobe_filled_s && !isset($sda['setting_type']) && $sda['setting_type'] == '') {
                $sda['setting_type'] = $el->attributes['setting']['id'];
            }
        }
        if (count($sda) > 0) {
            if (tep_db_num_rows($q) > 0) {
                tep_db_perform('products_description2', $sda, 'update', "products_id={$products_id}");
            } else {
                $sda['products_id'] = $products_id;
                tep_db_perform('products_description2', $sda);
            }
        }
    }
}
function generateKeywords($product_id)
{
    use_class('styles');
    use_class('Product');
    use_class('ProductAttribute');
    $class_s = new styles();
    $keywords = array();
    $product = new Product($product_id);
    $language_id = 2;
    //Step 1 (Brand)
    if ($product->brand_id == 24) {
        $keywords = array(strtolower($product->brand_name), 'eli', 'silberschmuck', '925', 'junger', 'modischer', 'trendy', 'fashion');
    } elseif ($product->brand_id == 3) {
        $keywords = array(strtolower($product->brand_name), 'vergoldet', 'golden', 'gold', 'vermeil');
    } elseif ($product->brand_id == 7) {
        $keywords = array(strtolower($product->brand_name), 'perlenschmuck', 'brautschmuck', 'hochzeit');
    }
    //Step 2 (Symbol)
    $symbol = $class_s->getProductStyle($product_id);
    if ($symbol['Symbol'] > 0) {
        $style = new ProductAttribute($symbol['Symbol']);
        if ($symbol['Symbol'] != '') {
            array_push($keywords, strtolower($style->displayAttributeName($product_id, ProductAttribute::GROUP_ID_SYMBOL, $language_id)));
        }
    }
    //Step 3 (Basic)
    array_push($keywords, 'günstiger', 'frau', 'freundin', 'geschenk', 'juwelier');
    //Step 4 (Material)
    $materials = array();
    $q = "SELECT ptpm.products_materials_id AS id" . " , material_name AS name" . " FROM products_to_products_materials ptpm" . " INNER JOIN products_materials pm" . " ON pm.products_materials_id = ptpm.products_materials_id" . " WHERE ptpm.products_id = {$product_id}";
    $r = tep_db_query($q);
    while ($row = tep_db_fetch_array($r)) {
        $materials[$row['id']] = $row['name'];
    }
    foreach ($materials as $key => $value) {
        if ($key == 4 || $key == 2) {
            list($material_name2, $material_name1, $material_name3) = split(",", $value);
            array_push($keywords, strtolower($material_name2), 'glamourös', 'funkelnd', 'glitzernd', 'strass', 'festlich', 'elegant');
        } else {
            list($material_name2, $material_name1, $material_name3) = split(",", $value);
            array_push($keywords, strtolower($material_name2));
        }
    }
    //Step 5 (Color)
    $color = $product->getColors($language_id);
    array_push($keywords, strtolower($color));
    //Step 6 (Rest of the products)
    array_push($keywords, 'basic', 'klassik', 'klassisch', 'schlicht', 'elegant', 'zeitlos', 'sportlich', 'dezent', 'filigran', 'zart', 'schlicht');
    $final_k = implode(',', $keywords);
    //echo $pid." = ".$final_k;
    $sda = array();
    $sda['products_head_keywords_tag'] = $final_k;
    tep_db_perform('products_description', $sda, 'update', "products_id={$product_id} AND language_id={$language_id}");
}
 public function getMembersGroup()
 {
     use_class('minierp_users');
     $class_mu = new minierp_users();
     if (!is_null($this->id)) {
         $q = "SELECT * FROM minierp_groups_members WHERE minierp_groups_id={$this->id}";
         $r = tep_db_query($q);
         if (tep_db_num_rows($r) > 0) {
             while ($row = tep_db_fetch_array($r)) {
                 $users_id[] = $row['minierp_users_id'];
             }
             $users_ids = implode(",", $users_id);
             $members = $class_mu->retrieveList('id IN (' . $users_ids . ')');
             return $members;
         }
     }
     return false;
 }
 function setParams($products_id, $param_code)
 {
     use_class('products_minierp');
     $class_pm = new products_minierp();
     if ($param_code == 'M') {
         $param_id_arrays = $class_pm->loadProductMaterials($products_id);
         $field_name = 'material';
     } elseif ($param_code == 'C') {
         $param_id_arrays = $class_pm->loadColorPattern($products_id);
         $field_name = 'color';
     } else {
         $param_id_arrays = array();
         $field_name = '';
     }
     if ($field_name != '') {
         if (count($param_id_arrays) == 0) {
             $sda = array($field_name => '');
             tep_db_perform('jng_sp_catalog', $sda, 'update', "products_id = {$products_id}");
         } else {
             use_class('jng_sp_catalog');
             $class_jc = new jng_sp_catalog();
             $q = tep_db_query("SELECT jng_sp_catalog_id, jng_sp_id FROM jng_sp_catalog WHERE products_id = {$products_id}");
             $sp_list = array();
             while ($row = tep_db_fetch_array($q)) {
                 $sp_list[$row['jng_sp_catalog_id']] = $row['jng_sp_id'];
             }
             foreach ($sp_list as $catalog_id => $jng_sp_id) {
                 $sp_params_raw = $this->load($jng_sp_id, $param_code);
                 $sp_params = array();
                 foreach ($sp_params_raw as $spr) {
                     if (in_array($spr['param_id'], $param_id_arrays)) {
                         $sp_params[] = $spr['param_value'];
                     }
                 }
                 $sda = array($field_name => implode(', ', $sp_params));
                 $class_jc->updateField($catalog_id, $sda);
             }
         }
     }
 }
function loadProductRow($pid, $spid, $pos, $curgroup_id)
{
    global $class_jc, $header;
    use_class('Product');
    $product = new Product($pid);
    $sp_catalog = $class_jc->retrieveCatalog($spid, "jc.products_id = '{$pid}'");
    $cols = array();
    foreach ($header as $hk => $hv) {
        $value = '';
        switch ($hk) {
            case 'img':
                $value .= $product->displayImage(IMAGE_SIZE_THUMBNAIL_1, IMAGE_SIZE_THUMBNAIL_1);
                break;
            case 'name':
                $value .= '<strong>' . $product->brand_name . '</strong>';
                $value .= '<br /><a href="?open=product-detail&amp;products_id=' . $product->id . '" target="_blank">' . $product->id . ' / ' . $product->code . '</a>';
                break;
            case 'imgup':
                $img_reupload = $sp_catalog[0]['image_uploaded'] == '0' ? 'checked="checked" ' : '';
                $tooltip = $sp_catalog[0]['image_uploaded'] == '0' ? "Uncheck to exclude this product image when generate catalog" : "Check to include this product image when generate catalog";
                $value = '<input type="checkbox" name="imguploaded" value="0" title="' . $tooltip . '" ' . $img_reupload . '/>';
                break;
            case 'prcup':
                $price_reupload = $sp_catalog[0]['price_uploaded'] == '0' ? 'checked="checked" ' : '';
                $tooltip = $sp_catalog[0]['price_uploaded'] == '0' ? "Uncheck to exclude this product data when generate catalog" : "Check to include this product data when generate catalog";
                $value = '<input type="checkbox" name="priceuploaded" value="0" title="' . $tooltip . '" ' . $price_reupload . '/>';
                break;
        }
        if ($value == '') {
            $value = '&nbsp;';
        }
        $cols[$hk] = $value;
    }
    $productrow = '<tr id="temp-' . $pid . '">';
    foreach ($cols as $ck => $cv) {
        $productrow .= '<td class="' . $ck . '">' . $cv . '</td>';
    }
    $productrow .= '</tr>';
    return $productrow;
}
示例#6
0
<?php

ini_set('memory_limit', '256M');
set_time_limit(0);
$mt_start = microtime();
global $db;
require_once '../confy.php';
require_once '../functions.php';
require_once '../functions-2.php';
tep_db_connect();
use_class('logger');
$logger = new logger('cron', 'daily-counter');
use_class('jng_sp');
use_class('jng_sp_orders');
use_class('jng_sp_catalog');
$class_sp = new jng_sp();
$class_jo = new jng_sp_orders();
$class_jc = new jng_sp_catalog();
$sp_data = $class_sp->retrieveList();
//////////////////////////////
// SP PRODUCTS SOLD COUNTER //
//////////////////////////////
$logger->write('1 - Product Sold Counter');
//TODO: The calculation is still based on jng_sp_catalog, which means SP with no
//catalog (like buyvip/retails) will not be included in this calculation!
foreach ($sp_data as $sp_list) {
    $class_jo->productsSoldCounter($sp_list['jng_sp_id']);
}
unset($sp);
/* WE STOP CALCULATING VC USING OLD METHOD
 * NEW VC CALCULATION IS NOT IN ORDER BASED, BUT IN SP BASED
     if ($booked > 0) {
         $messagebox->add("<strong>Clear Bin Failed</strong><br />Clear Bin is not allowed if On Stock and Booked by Real Order &gt; 0");
     } else {
         $class_bin->removeProductFromBox($bins_id);
         if ($bin['p_stock'] > 0) {
             $class_pm->stockReduce($jng_warehouses_id, $products_id, $articles_id, $bin['p_stock'], "REDUCE by {$session_userinfo['username']}");
         }
         header("Location: ?open=products-stock-detail&binid={$bin['bins_id']}" . ($hidemenuscript != '' ? '&hidemenu=true' : ''));
         exit;
     }
 } elseif ($_POST['me_action'] == 'SETBIN') {
     $bins_id = tep_db_prepare_input($_POST['bins_id']);
     $bin = $class_bin->retrieveBinDetail($bins_id);
     $ean = tep_db_prepare_input($_POST['ean']);
     $qty = tep_db_prepare_input($_POST['qty']);
     use_class('products_ean');
     $class_ean = new products_ean();
     $article = $class_ean->getProductArticle($ean);
     if ($article['products_id'] == '0') {
         $messagebox->add("<strong>Manual Bin In Failed: UNKNOWN EAN</strong><br />Please check if correct EAN Label is used");
     } else {
         $segment = $class_bin->retrieveSegmentDetail($bin['bin_segments_id']);
         $jng_warehouses_id = $segment['warehouses_id'];
         $products_id = $article['products_id'];
         $articles_id = $article['products_articles_id'];
         $stock = $class_pm->stockRetrieveDetail($jng_warehouses_id, $products_id, $articles_id);
         $bin_current = $class_bin->getBinProductStock($stock['products_stock_id']);
         if (is_null($bin_current)) {
             $class_pm->stockAdd($jng_warehouses_id, $products_id, $articles_id, $qty, "MANUAL BIN-IN by {$session_userinfo['username']}");
             $class_bin->bookBinForProduct($bins_id, $stock['products_stock_id']);
             header("Location: ?open=products-stock-detail&id={$stock['products_stock_id']}" . ($hidemenuscript != '' ? '&hidemenu=true' : ''));
<?php

#########################################
#  Author  : D3W4 & SAHAT               #
#  Created : May 8, 2012 8:46:25 PM    #
#########################################
use_class('notifications');
$notifications = new notifications();
if (isset($_GET['sender']) && $_GET['sender'] != '') {
    $sender = tep_db_prepare_input($_GET['sender']);
    $filter = "AND posted_by = '{$sender}'";
}
if (isset($_POST['me_action'])) {
    if ($_POST['me_action'] == 'DELETENOTIFICATIONS') {
        $ids = $_POST['ids'];
        list($notifications_id, $not_class) = split('-', $ids);
        $notifications->delete($notifications_id);
        $result = array();
        $result['notifications_id'] = $notifications_id;
        $result['not_class'] = $not_class;
        ajaxReturn($result);
        exit;
    } elseif ($_POST['me_action'] == 'CLOSEFEEDBACK') {
        $ids = $_POST['ids'];
        list($notifications_id, $not_class) = split('-', $ids);
        $notifications->closeOpenFeedback($notifications_id);
        $result = array();
        $result['ids'] = $ids;
        $result['notifications_id'] = $notifications_id;
        ajaxReturn($result);
        exit;
示例#9
0
 * @created Sep 24, 2013 3:09:23 PM
 */
set_time_limit(0);
global $db;
require_once '../confy.php';
require_once '../functions.php';
require_once '../functions-2.php';
tep_db_connect();
use_class('logger');
$logger = new logger('cron', 'depot-refill');
//$logger->write('SIMULATION');
//Include Required Classes (and create object when necessary)
use_class('Product');
use_class('products_minierp');
use_class('depot_orders');
use_class('styles');
$class_pm = new products_minierp();
$class_do = new depot_orders();
$class_s = new styles();
$whid = WAREHOUSE_ID_FOR_HANDLING_ORDERS;
$segment_id = SEGMENT_ID_DEFAULT;
//Grab all data that can be retrieved collectively for the whole products
//stock from below function already exclude active booking
$products_stock = $class_pm->stockRetrieveAll($whid, '', true);
//Grab all required Settings
Product::loadDIOHsettings();
//For now we can not run auto cancel in Manobo Local due to the
//sync issues of Depot Orders with Manobo Central
if (!SERVER_IS_LOCAL) {
    //query all auto refill orders currently open
    //and can still be canceled(grouped by article)
$cellsize = 48;
$cellsize_half = $cellsize / 2;
$cellsizecollweek = $cellsize + $margin;
$cell_height_col = 55;
$cell_height = 5;
$pdf->setXY($margin, $ypos);
$pdf->setFont('Arial', 'B', '14');
$pdf->cell(240, 5, 'SALES REPORT WEEKLY PRODUCT KW ' . date('W') . ' (' . date('d.m.Y', strtotime($filter_date)) . ')', 0, 0, 'C');
$pdf->setFont('Arial', '', '10');
$ypos += 10;
$pdf->setXY($cellstart, $ypos);
$firstorder = true;
$no = 1;
$catids = load_config('products-categories-sorting');
if (SERVER_IS_LOCAL) {
    use_class('CategoryTop');
    //load all categories which not sorted
    while ($ct = CategoryTop::getOneByOneAsObject()) {
        if ($ct->getCategoriesTotalCount() > 0) {
            while ($cat = $ct->getCategoriesOneByOneAsObject()) {
                if (!in_array($cat->id, $catids)) {
                    $catids[] = $cat->id;
                }
            }
        }
    }
}
foreach ($catids as $catid) {
    $header = true;
    if (is_array($products[$catid])) {
        foreach ($products[$catid] as $pid => $p) {
<?php

/**
 * Description of top-level-analysis
 *
 * @author IT TEAM BONOFACTUM
 * @created May 9, 2013
 */
use_class('Product');
use_class('products_brand');
$class_pb = new products_brand();
define('REPORT_TABLE_TYPE_CATEGORY', 'Product Category');
define('REPORT_TABLE_TYPE_PRICEGROUP', 'Price Group');
define('REPORT_TABLE_TYPE_BRAND', 'Product Brand');
function buildQueryPriceGroup($alias_key, $begin, $end)
{
    //return " WHEN rc.price >= $begin AND rc.price <= $end THEN '$alias_key'";
    return " WHEN rc.price_before_return >= {$begin} AND rc.price_before_return <= {$end} THEN '{$alias_key}'";
}
function queryData($table_type, $sp, $start_date, $end_date)
{
    global $product_categories_name, $class_pb;
    switch ($table_type) {
        case REPORT_TABLE_TYPE_CATEGORY:
            $join_column_alias = $product_categories_name;
            $join_column = 'ptc.categories_id';
            $join_table = ' LEFT JOIN products_to_categories ptc' . ' ON ptc.products_id = rc.products_id';
            $group_column = 'categories_id';
            break;
        case REPORT_TABLE_TYPE_PRICEGROUP:
            $bgst = Product::getOldProductFunction()->retrieveBestGoodSettings();
/**
 * Description of dailycounterbookkeeping
 *
 * @author IT TEAM BONOFACTUM
 * @created Mar 12, 2014 12:27:59 PM
 */
set_time_limit(0);
ini_set('memory_limit', '512M');
global $db;
require_once '../confy.php';
require_once '../functions.php';
require_once '../functions-2.php';
tep_db_connect();
use_class('logger');
$logger = new logger('cron', 'daily-counter-bookkeeping');
use_class('ReportBookkeeping');
if (isset($_GET['period_start']) && isset($_GET['period_end'])) {
    //WHEN CALLED MANUALLY WITH SPECIFIC PERIOD
    //ONLY DISPLAY RESULT FROM REQUESTED DATA WITHOUT SAVING
    $calc_period_start = isset($_GET['period_start']) ? $_GET['period_start'] : date('Ym');
    $calc_period_end = isset($_GET['period_end']) ? $_GET['period_end'] : date('Ym');
    $year_start = substr($calc_period_start, 0, 4);
    $month_start = substr($calc_period_start, 4, 2);
    $year_end = substr($calc_period_end, 0, 4);
    $month_end = substr($calc_period_end, 4, 2);
    if ($year_end < $year_start || $year_end == $year_start && $month_end < $month_start) {
        die('Period end > Period start!');
    } else {
        for ($y = $year_start; $y <= $year_end; $y++) {
            $m_start = $y == $year_start ? intval($month_start) : 1;
            $m_end = $y == $year_end ? intval($month_end) : 12;
<?php

use_class('production_instruction_manual');
$session_page = 'production-instruction-manual';
if (!isset($_SESSION[$session_page]['picatid']) || $_SESSION[$session_page]['picatid'] == '') {
    $PICAT = 0;
} else {
    $PICAT = $_SESSION[$session_page]['picatid'];
}
$reloadlist = isset($_GET['reloadlist']) && $_GET['reloadlist'] == 'true' ? true : false;
if (isset($_POST['me_action'])) {
    if ($_POST['me_action'] == 'LOADPI') {
        $PICAT = tep_db_prepare_input($_POST['catid']);
        $_SESSION[$session_page]['picatid'] = $PICAT;
        $stab = array();
        $s = array();
        $pi = production_instruction_manual::retrieveList($PICAT);
        if (count($pi) == 0) {
            $pi_table = '<h3 class="red">No Production Instruction is found on database for this category </h3>';
            $action_buttons = '';
        } else {
            $s['qty'] = '<input id="pi-checkall" type="checkbox" />';
            $s['id'] = 'ID';
            $s['active'] = 'Active';
            $s['name'] = 'Name';
            $s['desc'] = 'Description';
            $stab[] = $s;
            foreach ($pi as $row) {
                $s = array();
                $s['qty'] = '<input type="checkbox" name="piids[]" value="' . $row['production_instruction_id'] . '" />';
                $s['id'] = $row['production_instruction_id'];
示例#14
0
<?php

global $db;
require_once '../confy.php';
require_once '../functions.php';
require_once '../functions-2.php';
tep_db_connect();
use_class('PHPExcel/PHPExcel');
use_class('Product');
use_class('depot_orders');
use_class('products_minierp');
use_class('elements_suppliers');
$class_do = new depot_orders();
$class_pm = new products_minierp();
$order_date = $_GET['date'];
$order_date_ts = strtotime($order_date);
$supplier_id = $_GET['supplier_id'];
$supplier = new elements_suppliers($supplier_id);
$filename = date('Ymd', $order_date_ts) . '-OutsourcingPO-' . $supplier->getCleanName() . '-' . time() . '.xls';
$order_date_nice = date('d.m.Y', $order_date_ts);
$po_number_sample = date('ymd', $order_date_ts) . '/' . $supplier->id . '/001';
$date_filter_start = $order_date . ' 00:00:00';
$date_filter_end = $order_date . ' 23:59:59';
$jng_company_name = utf8_encode(JNG_ADDRESS_NAME . ' - ' . JNG_COMPANY_SUFFIX);
$jng_address = utf8_encode(JNG_ADDRESS_STREET);
$jng_shipto_recepient = utf8_encode('Ms. Julia Schüssel');
$orders_items = array();
if (isset($_GET['type']) && $_GET['type'] == 'non-refill') {
    $trans_type = depot_orders::TRANS_TYPE_NON_REFILL;
    $trans_id = depot_orders::NONREFILL_OUTSOURCED_ID;
} else {
$content .= '<div id="showopt" class="bold">';
$content .= '<div id="showmore">&raquo; Show <span class="show">' . $show_amount . '</span> more out of <span class="more"></span></div>';
$content .= '<div id="showall">&raquo; Show ALL (<span class="more"></span>)</div>';
$content .= '</div>';
// #showopt
$content .= '<div style="display:none;">';
$content .= '<div id="printstocklist" style="width:500px;height:400px;padding:10px;">';
$content .= '<div id="errornotype" class="ui-corner-all" style="position:absolute;top:35px;left:200px;border:2px solid #f00;padding:10px 20px;color:#f00;display:none;">&laquo; Please Select a Type</div>';
$content .= '<table border="0" cellpadding="0" cellspacing="0">';
$content .= '<tr><td colspan="2"><h3>Stock List Type:</h3></td></tr>';
$content .= '<tr><td><input id="rad-slt-1" type="radio" name="type" value="FULL" /></td><td><label for="rad-slt-1">Full Stock Info</label></td></tr>';
$content .= '<tr><td><input id="rad-slt-2" type="radio" name="type" value="BLANK" /></td><td><label for="rad-slt-2">Blank / No Stock Info</label></td></tr>';
$content .= '<tr><td colspan="2">&nbsp;</td></tr>';
$content .= '<tr><td colspan="2"><h3>Filter by Category:</h3></td></tr>';
$content .= '<tr><td><input id="rad-cat-0" type="radio" name="catid" value="0" /></td><td><label for="rad-cat-0">Show All Elements</label></td></tr>';
use_class('elements_attributes');
$class_ea = new elements_attributes();
$categories = $class_ea->retrieveListData('cat');
foreach ($categories as $cat) {
    $catid = $cat['element_category_id'];
    $checked = $cat['element_category_id'] == '3' ? ' checked="checked"' : '';
    $content .= '<tr><td><input id="rad-cat-' . $catid . '" type="radio" name="catid" value="' . $catid . '"' . $checked . '/></td><td><label for="rad-cat-' . $catid . '">' . $cat['name'] . '</label></td></tr>';
}
$content .= '</table>';
$content .= '<div class="buttons"><input id="printstocklist-action" type="button" value="PRINT" /></div>';
$content .= '</div>';
// #printstocklist
$content .= '</div>';
// #printstocklist hider container
$content .= '<a id="pritnstocklistlinker" class="view_inline" href="#printstocklist"></a>';
$javascript = '
示例#16
0
    foreach ($splist as $sp) {
        $sp_prefix[$sp['jng_sp_id']] = $sp['package_prefix'];
    }
    use_class("jng_sp_packages");
    $class_jp = new jng_sp_packages();
    use_class("jng_sp_orders");
    $class_jo = new jng_sp_orders();
    $package_id = tep_db_prepare_input($_GET['id']);
    $orders_array = $class_jp->getOrders($package_id);
    $items_array = $class_jp->getItems($package_id);
} elseif (isset($_GET['pid']) && $_GET['pid'] != '') {
    $type = 'jng';
    //JNG PACKAGES
    use_class("minierp_packages");
    $class_mp = new minierp_packages();
    use_class("orders");
    $class_o = new orders();
    $package_id = tep_db_prepare_input($_GET['pid']);
    $orders_array = $class_mp->getOrders($package_id);
    $items_array = $class_mp->getProducts($package_id);
} else {
    exit;
}
class PDF extends FPDF
{
    var $left_margin;
    var $page_width;
    var $label_width;
    var $label_height;
    var $label_per_width;
    var $label_per_height;
<?php

/**
 * Description of elementforecasting
 *
 * @author IT TEAM BONOFACTUM
 * @created Oct 4, 2013 4:40:39 PM
 */
use_class('element');
use_class('elements_preorder');
use_class('elements_order');
use_class('forecasting');
element::loadDIOHsettings();
$forecasting_conf = load_config('forecasting');
$elements_id = tep_db_prepare_input($_GET['id']);
$year = date('Y');
$kw_now = date('W');
$log_base_data = element::DIOH_BASENUMBER_COLUMN_NAME;
$log_base_info = element::DIOH_BASENUMBER_DESCRIPTION;
$e = new element($elements_id);
$monthly_usage = intval($e->log[$log_base_data]);
$daily_usage = round($monthly_usage / 30, 1);
$last_week_usage = $daily_usage * 7;
$last_week_usage = $last_week_usage > 0 && $last_week_usage < 1 ? 1 : round($last_week_usage, 0);
$fc = new forecasting($year, $forecasting_conf['elements-sourcing-projection']);
$weekly_usage = $e->retrieveWeeklyUsage($year);
$box_style = 'height:100px;padding:5px;';
$content .= '<div class="float-box w450 ui-corner-all" style="' . $box_style . 'margin-right:20px;">';
$content .= '<h3>Chart Legend</h3>';
$content .= '<div><table border="0" cellspacing="0" cellpadding="0">';
$content .= '<tr style="background:#efccef;"><td class="w080">Purple Block</td><td>=</td><td>Current Calendar Week</td></tr>';
<?php

use_class('jng_sp');
$class_sp = new jng_sp();
use_class('jng_sp_orders');
$class_jo = new jng_sp_orders();
//AJAX LOAD
if (isset($_POST['me_action']) && $_POST['me_action'] == 'LOADANALYSIS') {
    ini_set('memory_limit', '128M');
    $period1 = tep_db_prepare_input($_POST['period1']);
    $period2 = tep_db_prepare_input($_POST['period2']);
    $min_sold_per_month = intval($_POST['min_sold']);
    if ($min_sold_per_month == 0) {
        $min_sold_per_month = 2;
    }
    $abctype = tep_db_prepare_input($_POST['abctype']);
    $p1 = explode('.', $period1);
    $date1 = date('Y-m-d', strtotime($p1[2] . '-' . $p1[1] . '-' . $p1[0]));
    $p2 = explode('.', $period2);
    $date2 = date('Y-m-d', strtotime($p2[2] . '-' . $p2[1] . '-' . $p2[0]));
    $q = "SELECT COUNT(DISTINCT joi.jng_sp_orders_id) AS orders";
    $q .= ", SUM(joi.order_quantity) AS order_quantity, SUM(joi.return_quantity) AS return_quantity";
    $q .= ", SUM(joi.order_quantity*joi.price) AS price, SUM(joi.order_quantity*joi.vc_value) AS vc_value";
    $q .= ", p.products_id, p.products_model, p.products_image";
    $q .= " FROM jng_sp_orders jo";
    $q .= " INNER JOIN jng_sp_orders_items joi ON joi.jng_sp_orders_id=jo.jng_sp_orders_id AND joi.status NOT IN (10,12)";
    $q .= " LEFT JOIN products p ON p.products_id=joi.products_id";
    $q .= " WHERE DATE(jo.order_date)>=DATE('{$date1}') AND DATE(jo.order_date)<=DATE('{$date2}')";
    $q .= " GROUP BY joi.products_id";
    $r = tep_db_query($q);
    $orders = array();
<?php

global $db;
require_once '../confy.php';
require_once '../functions.php';
require_once '../functions-2.php';
tep_db_connect();
$type = tep_db_prepare_input($_GET['type']);
$items = explode(',', tep_db_prepare_input($_GET['items']));
if (count($items) > 0) {
    use_class('payone');
    $class_payone = new payone();
    $return_ids = array();
    foreach ($items as $item_id) {
        if (strtoupper($type) == 'J') {
            $dbq = tep_db_query("SELECT products_quantity AS quantity FROM orders_products WHERE orders_products_id = '{$item_id}'");
        } elseif (strtoupper($type) == 'S') {
            $dbq = tep_db_query("SELECT order_quantity AS quantity FROM jng_sp_orders_items WHERE jng_sp_orders_items_id = '{$item_id}'");
        }
        $item = tep_db_fetch_array($dbq);
        $return_ids[] = $class_payone->createReturnContainer('NULL', $item['quantity'], $item_id);
    }
    echo "Return created > (" . implode(',', $return_ids) . ")";
}
示例#20
0
 function analysis_overview($period, $price_type)
 {
     use_class('jng_warehouses');
     $class_jw = new jng_warehouses();
     $q = "SELECT jw.name, jw.warehouse_code, jw.warehouse_type";
     $q .= ", IF(jw.warehouse_type='E', SUM(mse.stock_open), SUM(msp.stock_open)) AS stock_open";
     $q .= ", IF(jw.warehouse_type='E', SUM(mse.stock_close), SUM(msp.stock_close)) AS stock_close";
     /*
     if($price_type=='mat_exp') {
     	$q .= ", IF(jw.warehouse_type='E', SUM(mse.mat_exp_open), SUM(msp.mat_exp_open)) AS stock_value_open";
     	$q .= ", IF(jw.warehouse_type='E', SUM(mse.mat_exp_close), SUM(msp.mat_exp_close)) AS stock_value_close";
     } else {
     	$q .= ", IF(jw.warehouse_type='E', 0, SUM(msp.purchase_price_open)) AS stock_value_open";
     	$q .= ", IF(jw.warehouse_type='E', 0, SUM(msp.purchase_price_close)) AS stock_value_close";
     }
     */
     if ($price_type == 'mat_exp') {
         $q .= ", IF(jw.warehouse_type='E', SUM(mse.stock_open*mse.mat_exp_open), SUM(msp.stock_open*msp.mat_exp_open)) AS stock_value_open";
         $q .= ", IF(jw.warehouse_type='E', SUM(mse.stock_close*mse.mat_exp_close), SUM(msp.stock_close*msp.mat_exp_close)) AS stock_value_close";
     } else {
         $q .= ", IF(jw.warehouse_type='E', 0, SUM(msp.stock_open*msp.purchase_price_open)) AS stock_value_open";
         $q .= ", IF(jw.warehouse_type='E', 0, SUM(msp.stock_close*msp.purchase_price_close)) AS stock_value_close";
     }
     $q .= " FROM jng_warehouses jw";
     $q .= " LEFT JOIN minierp_stock_elements mse ON mse.jng_warehouses_id=jw.jng_warehouses_id AND mse.stock_period='{$period}'";
     $q .= " LEFT JOIN minierp_stock_products msp ON msp.jng_warehouses_id=jw.jng_warehouses_id AND msp.stock_period='{$period}'";
     $q .= " GROUP BY jw.jng_warehouses_id";
     $q .= " ORDER BY jw.jng_warehouses_id";
     $r = tep_db_query($q);
     $stocks = array();
     $s = array();
     $s['name'] = 'Warehouse Name';
     $s['long_id'] = 'Code';
     $s['status'] = 'Type';
     $s['price'] = 'Inventory<br />BoP Value';
     $s['price2'] = 'Inventory<br />EoP Value';
     $s['price3'] = 'Inventory<br />Ave.Value';
     $stocks[] = $s;
     while ($row = tep_db_fetch_array($r)) {
         $bop = $row['stock_value_open'];
         $eop = $row['stock_value_close'];
         $avg = ($bop + $eop) / 2;
         $s['name'] = $row['name'];
         $s['long_id'] = $row['warehouse_code'];
         $s['status'] = $class_jw->typeName($row['warehouse_type']);
         if ($row['warehouse_type'] == 'E' && $price_type != 'mat_exp') {
             $s['price'] = '-';
             $s['price2'] = '-';
             $s['price3'] = '-';
         } else {
             $s['price'] = number_format($bop, 2);
             $s['price2'] = number_format($eop, 2);
             $s['price3'] = number_format($avg, 2);
         }
         $stocks[] = $s;
     }
     $result = tep_draw_table('', $stocks);
     return $result;
 }
<?php

global $db;
require_once '../confy.php';
require_once '../functions.php';
require_once '../functions-2.php';
require_once DIR_WS_FUNCTIONS . 'html_output.php';
tep_db_connect();
use_class('logger');
$logger = new logger('cron', 'reprint-hh-picklist');
$RUN_UPDATE_QUERY = true;
$max_total_orders_allowed = 10;
// check total products on orders_products
$r_op = tep_db_query("SELECT * FROM orders_products WHERE status=8 AND print_count>0");
$num_op = tep_db_num_rows($r_op);
$arr_op = array();
while ($op = tep_db_fetch_array($r_op)) {
    $arr_op[] = $op['orders_products_id'];
}
// check total products on jng_sp_orders_items
$r_jo = tep_db_query("SELECT * FROM jng_sp_orders_items WHERE status=8 AND print_count>0");
$num_jo = tep_db_num_rows($r_jo);
$arr_jo = array();
while ($jo = tep_db_fetch_array($r_jo)) {
    $arr_jo[] = $jo['jng_sp_orders_items_id'];
}
// total products from both table
$num_total = $num_op + $num_jo;
if ($RUN_UPDATE_QUERY) {
    $logger->write("Running in UPDATE mode (orders will be updated for auto reprint)");
    if ($num_total == 0) {
$content .= '<div id="products-add-elements-tabs">';
$content .= '<ul>';
$content .= '<li><a href="#area-direct-input">Input Directly</a></li>';
$content .= '<li><a href="#area-search">Search Elements</a></li>';
$content .= '<li><a href="#area-copy">Copy from Existing Products</a></li>';
$content .= '</ul>';
$content .= '<div id="area-direct-input">';
$content .= '<div id="di-msg" style="margin:5px 0 10px 0;display:none;" class="bold"></div>';
$content .= '<table border="0" cellpadding="0" cellspacing="0" class="form">';
$content .= '<tr><td>Element ID</td><td>&nbsp;</td><td><input type="text" id="di-elid" onfocus="$(this).select();" /><span class="red" style="margin-left:10px;">use comma "," separated for multi ID\'s</span></td></tr>';
$content .= '<tr><td>Qty</td><td>&nbsp;</td><td><input type="text" id="di-elqty" value="1" style="width:30px;text-align:center;" maxlength="3" onfocus="$(this).select();" /></td></tr>';
$content .= '<tr><td colspan="2">&nbsp;</td>';
if ($is_accessed_from_design_mgmt) {
    use_class('design');
    use_class('design_draft');
    use_class('element');
    $designs_id = isset($_GET['designs_id']) && $_GET['designs_id'] != '' ? $_GET['designs_id'] : '';
    $draft = new design_draft(null, $_GET['pid']);
    $new_elements = $draft->retrieveElements();
    if (count($new_elements) > 0) {
        $content .= '<tr><td>New Elements</td><td>&nbsp;</td><td>';
        foreach ($new_elements as $ne) {
            $element = new element($ne['elements_id']);
            $content .= '<span id="' . $ne['elements_id'] . '" style="float:left;text-align:center;margin-right:5px;">' . webImageWithDetailLink($element->image, IMAGE_SIZE_THUMBNAIL_1, IMAGE_SIZE_THUMBNAIL_1, $ne['elements_id'] . ' : ' . $ne['elements_name'], 'img-border') . '<br/>' . $ne['elements_id'] . '&nbsp;<a class="pointer ne-add-el" title="Add this element to product">[+]</a></span>';
        }
        $content .= '</td></tr>';
    }
}
$content .= '<tr><td colspan="2"><input type="button" class="button blue" id="btn-di-add-el" value="Add Element" /></td></tr>';
$content .= '</table>';
$content .= '</div>';
示例#23
0
<?php

use_class('bins');
$class_bin = new bins();
$result = array();
$segments_list = $class_bin->retrieveSegmentList("status='1'", "name");
foreach ($segments_list as $key => $row) {
    $result[] = $row['bin_segments_id'] . ',' . $row['name'];
}
<?php

#########################################
#  Author  : D3W4 & SAHAT               #
#  Created : Jan 3, 2012 10:59:04 PM    #
#########################################
use_class('products_minierp');
$class_pm = new products_minierp();
$products_id = tep_db_prepare_input($_GET['products_id']);
$designs_id = tep_db_prepare_input($_GET['designs_id']);
$accessed = strpos($_SERVER['HTTP_REFERER'], 'designs-manage') !== false || !empty($designs_id) ? CONST_ACCESS_DESIGNS_MANAGEMENT : '';
if (isset($_POST['me_action'])) {
    if ($_POST['me_action'] == 'PRODUCTELUSED') {
        $result = $class_pm->templateElementsUsed('?open=designs-products-elements-used&amp;products_id=' . $_POST['products_id'] . '&amp;hidemenu=true&amp;designs_id=' . $designs_id);
        echo $result;
        exit;
    } elseif ($_POST['me_action'] == 'ELEMENTSUSEDADD') {
        $class_pm->templateAddElementsUsed();
    } elseif ($_POST['me_action'] == 'ELEMENTSUSEDUPDATE') {
        $class_pm->templateUpdateElementsUsed();
    } elseif ($_POST['me_action'] == 'ELEMENTSUSEDOVR') {
        $class_pm->templateOverrideElementsUsed();
    }
}
$content = '<div id="area-el-used"></div>';
$title = "Product {$products_id} - Manage Elements Used";
$javascript = '
            var accessed = "' . $accessed . '";
            var designs_id = "' . $designs_id . '";
            document.reloadFocusedTab = function(){
                if(accessed != "undefined" && accessed == "' . CONST_ACCESS_DESIGNS_MANAGEMENT . '") window.parent.document.reloadFocusedTab(' . $designs_id . ');
示例#25
0
<?php

/**
 * Provide data for Chart Sales Summary "Last 60 Days Sales Chart" on Dashboard
 * @author IT TEAM BONOFACTUM
 * @created Nov 18, 2013 10:53:01 PM 
 */
require_once 'confy_open.php';
use_class('php-ofc-library/open-flash-chart');
use_class('jng_sp');
$class_sp = new jng_sp();
$period = array();
$bar_values = array();
$format_date = 'd M';
$days = isset($_GET['d']) ? tep_db_prepare_input($_GET['d']) : 60;
$y_points = 10;
for ($p = $days; $p >= 0; $p--) {
    $format = date($format_date, strtotime("-{$p} days"));
    $period[] = $format;
    $bar_values[$format] = 0;
}
$q = " SELECT * FROM";
$q .= " (SELECT o.date_purchased AS order_date, op.products_quantity AS products";
$q .= " FROM orders o";
$q .= " LEFT JOIN orders_products op ON op.orders_id=o.orders_id";
$q .= " WHERE o.date_purchased>=DATE_SUB(CURRENT_DATE(), INTERVAL {$days} DAY)";
$q .= " AND o.orders_status<=10";
$q .= " UNION ALL";
$sp_active = $class_sp->retrieveList();
//Products sold on sp's
$q .= " SELECT jo.order_date, joi.order_quantity AS products";
 /**
  * Handle POST/GET Action that related to products_articles
  */
 function processAction()
 {
     if (isset($_POST['me_action']) && $_POST['me_action'] == 'PRODUCTSARTICLES') {
         switch ($_POST['act']) {
             case 'ADDEANTOPRODUCT':
                 $products_id = tep_db_prepare_input($_POST['products_id']);
                 use_class('products_ean');
                 $class_ean = new products_ean();
                 $result = $class_ean->attachToProduct($products_id);
                 break;
             case 'ADDEANTOARTICLE':
                 $article_id = tep_db_prepare_input($_POST['article_id']);
                 use_class('products_ean');
                 $class_ean = new products_ean();
                 $ean_no = $class_ean->attactToArticle($article_id);
                 $result = "{$article_id},{$ean_no}";
                 break;
             case 'ADD':
                 $products_id = tep_db_prepare_input($_POST['products_id']);
                 $price = tep_db_prepare_input($_POST['new_price']);
                 $price_old = tep_db_prepare_input($_POST['new_price_old']);
                 $length = tep_db_prepare_input($_POST['new_length']);
                 $options = array();
                 $options['length'] = $length;
                 $prepared = true;
                 $products_articles_id = $this->add($products_id, $price, $price_old, $options, $prepared);
                 if ($products_articles_id == 0) {
                     $result .= '0';
                 } else {
                     //$result = '<tr><td>Other Length <sup class="red">new</sup></td><td>'.$length.'cm = '.$price.' EUR</td>';
                     $result .= '<tr>';
                     $result .= '<td class="green">New</td>';
                     $result .= '<td class="notice">Unset</td>';
                     $result .= '<td>' . $length . '</td>';
                     //$result .= '<td>'.$price.'</td>';
                     //$result .= '<td>'.$price_old.'</td>';
                     $result .= '<td colspan="2"><a href="">Refresh Page</a> for action links</td>';
                     $result .= '</tr>';
                 }
                 break;
             case 'UPDATE':
                 $options = array();
                 $options['length'] = $_POST['new_length'];
                 $result = $this->update($_POST['products_articles_id'], $_POST['new_price'], $_POST['new_price_old'], $options);
                 break;
             case 'REMOVE':
                 $result = $this->remove($_POST['products_articles_id']);
                 break;
             case 'ARTICLEACTIVATION':
                 $paid = tep_db_prepare_input($_POST['paid']);
                 $status = tep_db_prepare_input($_POST['status']);
                 $this->setActiveStatus($paid, $status);
                 $result = array();
                 $result['paid'] = $paid;
                 $result['status'] = $status;
                 $result['success'] = '1';
                 ajaxReturn($result);
                 exit;
                 break;
         }
         echo utf8_encode($result);
         exit;
     }
 }
<?php

/**
 * Generate list of elements needed for amazon vendor xmas order
 *
 * @author IT TEAM BONOFACTUM
 * @created Aug 21, 2013 4:33:03 PM
 */
global $db;
require_once '../confy.php';
require_once '../functions.php';
require_once '../functions-2.php';
require_once DIR_WS_FUNCTIONS . 'html_output.php';
tep_db_connect();
use_class('elements_attributes');
use_class('elements_order');
$class_ea = new elements_attributes();
$ecats = array();
$all_period = array();
function runElementQuery($outsourced_flag)
{
    global $class_ea, $ecats, $all_period;
    if (isset($_GET['shipwin_month'])) {
        $month = str_pad(tep_db_prepare_input($_GET['shipwin_month']), 2, '0', STR_PAD_LEFT);
        $year = date('Y');
        $shipwin_start = $year . "-{$month}-01";
        $eom_date = date('t', strtotime($shipwin_start));
        $shipwin_end = date('Y') . "-{$month}-{$eom_date}";
        $shipwin_filter = "AND joi.shipping_window_open BETWEEN '{$shipwin_start}' AND '{$shipwin_end}'";
    } else {
        $shipwin_filter = "";
}
foreach($items_jg as $i) {
    $articles_id = $i['products_id'].'-'.$i['products_articles_id'];
    if(!isset($items_array[$articles_id])) {
        $desc = $class_pm->retrieveCategoryName($i['categories_id'], '1');
        $items_array[$articles_id]['desc'] = $desc;
        $items_array[$articles_id]['code'] = $i['products_model'];
        $items_array[$articles_id]['pri'] = 0;
        $items_array[$articles_id]['qty'] = 0;
    }
    $items_array[$articles_id]['qty'] += $i['products_quantity'];
    $items_array[$articles_id]['pri'] += $i['products_quantity'] * (calculateCurrency($i['material_expenses'], 'USD')/4);
}
*/
use_class("sendback");
use_class("products_minierp");
$class_sendback = new sendback();
$class_pm = new products_minierp();
$items = $class_sendback->retrieveList('16');
$items_array = array();
foreach ($items as $i) {
    $articles_id = $i['products_id'] . '-' . $i['products_articles_id'];
    if (!isset($items_array[$articles_id])) {
        $desc = $class_pm->retrieveCategoryName($i['categories_id'], '1');
        $items_array[$articles_id]['desc'] = $desc;
        $items_array[$articles_id]['code'] = $i['products_model'];
        $items_array[$articles_id]['pri'] = 0;
        $items_array[$articles_id]['qty'] = 0;
    }
    $qty = $i['type'] == 'R' ? $i['quantity_stock'] : $i['quantity_actual'];
    $items_array[$articles_id]['qty'] += $qty;
示例#29
0
/**
 * Get SP data which using amazon logistic
 * @return Array Array of SP data
 */
function getSalesPartnerUseAmazonLogistic()
{
    use_class('jng_sp');
    $class_sp = new jng_sp();
    $sps = $class_sp->retrieveList("use_amvd_logistic=1");
    return $sps;
}
<?php

/**
 * Automatically order depot refill for products offered (active) in Zalando
 *
 * @author IT TEAM BONOFACTUM
 * @created Jul 19, 2013 4:54:57 PM
 */
global $db;
require_once '../confy.php';
require_once '../functions.php';
require_once '../functions-2.php';
tep_db_connect();
use_class('depot_orders');
$class_do = new depot_orders();
$class_do->queryZalandoNeedRefill(true);
echo 'Done!';
tep_db_close();