function drawProductPriceTable(Product $product, $message = '')
{
    global $class_sp;
    //$supported_sp = array('2', '5', '7', '8');
    //$sp_filer = 'jng_sp_id IN ('.implode(',', $supported_sp).') AND ';
    $show_jng = !SERVER_IS_LOCAL;
    $sp_b2c = $class_sp->retrieveList('use_amvd_logistic = 0');
    $sp_b2b = $class_sp->retrieveList('use_amvd_logistic = 1');
    $total_sp_b2c = count($sp_b2c);
    if ($show_jng) {
        $total_sp_b2c += 1;
    }
    $total_sp_b2b = count($sp_b2b);
    $result = '<div id="price-pid-' . $product->id . '" class="product" ' . 'style="clear:left;float:left;margin-bottom:20px;">' . '<div class="draw-table">' . '<table border="0" cellpadding="0" cellspacing="0">' . '<tr>' . '<th rowspan="2">Product</th>' . '<th colspan="2">Info</th>' . '<th colspan="' . $total_sp_b2c . '">B2C</th>';
    foreach ($sp_b2b as $sp) {
        if ($product->isAddedToSalesPartner($sp['jng_sp_id'])) {
            $btn_addto_catalog = '';
        } else {
            $btn_addto_catalog = '<div style="float:right;"><input ' . 'type="button" class="addtocat" value="add" /></div>';
        }
        $result .= '<th colspan="2">B2B - ' . $sp['package_prefix'] . '</th>';
        /*
        $result .= '<th colspan="2"><div>B2B - ' . 
            $sp['package_prefix'].'</div>' . $btn_addto_catalog . '</th>';
        */
    }
    $result .= $b2b . '</tr>' . '<tr>' . '<th>Name</th>' . '<th class="bold">DEFAULT</th>';
    if ($show_jng) {
        $result .= '<th>JG.DE</th>';
    }
    foreach ($sp_b2c as $sp) {
        $result .= '<th>' . $sp['package_prefix'] . '</th>';
    }
    foreach ($sp_b2b as $sp) {
        $result .= '<th>No Discount</th>';
        $result .= '<th>Discount</th>';
    }
    $jng_id = '0';
    $cogs = $product->getProductCOGSValue();
    $price_uvp = $product->getPriceUVP();
    $price_uvp_text = displayCurrency(CURRENCY_DEFAULT, $price_uvp, false, 2);
    $price_default = $product->getPriceDefault();
    $price_default_text = displayCurrency(CURRENCY_DEFAULT, $price_default, false, 2);
    $price_jng = $product->getPriceSelling($jng_id);
    $price_options = array('Show Discount', 'Hide Discount');
    //, 'No Discount');
    $price_options_combo = '<select name="price_option" style="display:none;">' . '%s</select><span class="notice price_option_none" style="display:none;">' . 'No Discount</span>';
    $price_option_jng = loadComboListFromArray($price_options, null, $product->isPriceSellingUsingDiscount($jng_id) ? 0 : 1, false);
    $sp_type_default = '<input type="hidden" name="sp_type" value="DEF" />';
    $sp_type_b2c = '<input type="hidden" name="sp_type" value="B2C" />';
    $sp_type_b2b_nodisc = '<input type="hidden" name="sp_type" value="B2B-ND" />';
    $sp_type_b2b_disc = '<input type="hidden" name="sp_type" value="B2B-D" />';
    $sp_id_jng = '<input type="hidden" name="sp_id" value="0" />';
    if (SERVER_IS_LOCAL) {
        $class_add = ' readonly';
        $editable = ' readonly="readonly"';
    } else {
        $class_add = '';
        $editable = '';
    }
    $result .= '</tr>' . '<tr class="o">' . '<td class="w200 tac"><div>' . $product->displayImage(IMAGE_SIZE_THUMBNAIL_2, IMAGE_SIZE_THUMBNAIL_2_PORTRAIT) . '</div>' . '<div>' . $product->displayIDAndCode() . '</div>' . '</td>' . '<td class="w150">' . '<div class="cr cr-status">Status</div>' . '<div class="cr cr-uvp">UVP</div>' . '<div class="cr cr-sp">Selling Price</div>' . '<div class="cr cr-factor">Factor</div>' . '<div class="cr cr-disc">Discount</div>' . '<div class="cr cr-option">Price Option</div>' . '<div class="cr cr-preview">Price Preview</div>' . '<div class="cr cr-cogs">COGS</div>' . '<div class="cr cr-profit">Profit</div>' . '<div class="cr cr-margin">Margin</div>' . '<div class="cr cr-premium">Premium</div>' . '</td>' . '<td class="w100 tac">' . '<input type="hidden" name="cogs" value="' . $cogs . '" />' . '<div class="cr cr-status notice">-</div>' . '<div class="cr cr-uvp"><input type="text" name="price-uvp-default" class="w080 tac' . $class_add . '" value="' . $price_uvp . '"' . $editable . ' /></div>' . '<div class="cr cr-sp"><input type="text" name="price-default" class="w080 tac' . $class_add . '" value="' . $price_default . '"' . $editable . ' />' . $sp_type_default . '</div>' . '<div class="cr cr-factor notice">-</div>' . '<div class="cr cr-disc">&nbsp;</div>' . '<div class="cr cr-option notice">-</div>' . '<div class="cr cr-preview">&nbsp;</div>' . '<div class="cr cr-cogs">' . $cogs . '</div>' . '<div class="cr cr-profit">&nbsp;</div>' . '<div class="cr cr-margin">&nbsp;</div>' . '<div class="cr cr-premium">&nbsp;</div>' . '</td>';
    if ($show_jng) {
        //COLUMN J&G
        $result .= '<td class="w100 tac">' . '<div class="cr cr-status">' . $product->displayActiveStatusIcon($jng_id) . '</div>' . '<div class="cr cr-uvp"><input type="text" name="price-uvp" class="w080 tac b2c readonly" value="' . $price_uvp . '" readonly="readonly" />' . $sp_type_b2c . $sp_id_jng . '</div>' . '<div class="cr cr-sp"><input type="text" name="price-selling" class="w080 tac b2c" value="' . $price_jng . '" />' . $sp_type_b2c . $sp_id_jng . '</div>' . '<div class="cr cr-factor notice">-</div>' . '<div class="cr cr-disc">&nbsp;</div>' . '<div class="cr cr-option">' . sprintf($price_options_combo, $price_option_jng) . $sp_id_jng . '</div>' . '<div class="cr cr-preview">&nbsp;</div>' . '<div class="cr cr-cogs notice">' . $cogs . '</div>' . '<div class="cr cr-profit">&nbsp;</div>' . '<div class="cr cr-margin">&nbsp;</div>' . '<div class="cr cr-premium">&nbsp;</div>' . '</td>';
    }
    //COLUMN PER SP (B2C)
    foreach ($sp_b2c as $sp) {
        $result .= '<td class="w100 tac">';
        $result .= '<div class="cr cr-status">' . $product->displayActiveStatusIcon($sp['jng_sp_id']) . '</div>';
        if ($product->isAddedToSalesPartner($sp['jng_sp_id'])) {
            $sp_id = '<input type="hidden" name="sp_id" value="' . $sp['jng_sp_id'] . '" />';
            $price_selling_old = $product->getPriceSellingOld($sp['jng_sp_id']);
            $price_selling = $product->getPriceSelling($sp['jng_sp_id']);
            $price_option_sp = loadComboListFromArray($price_options, null, $product->isPriceSellingUsingDiscount($sp['jng_sp_id']) ? 0 : 1, false);
            if (SERVER_IS_LOCAL) {
                $price_uvp_sp = $price_selling_old > 0 ? $price_selling_old : $price_selling;
                $sp_uvp_class = '';
                $sp_uvp_dis = '';
            } else {
                $price_uvp_sp = $price_uvp;
                $sp_uvp_class = ' readonly';
                $sp_uvp_dis = ' readonly="readonly"';
            }
            $result .= '<div class="cr cr-uvp">' . '<input type="text" name="price-uvp" class="w080 tac b2c' . $sp_uvp_class . '"' . ' value="' . $price_uvp_sp . '" ' . $sp_uvp_dis . ' />' . $sp_id . '</div>';
            $result .= '<div class="cr cr-sp"><input type="text" name="price-selling" class="w080 tac b2c" value="' . $price_selling . '" />' . $sp_type_b2c . $sp_id . '</div>' . '<div class="cr cr-factor notice">-</div>' . '<div class="cr cr-disc">&nbsp;</div>' . '<div class="cr cr-option">' . sprintf($price_options_combo, $price_option_sp) . $sp_id . '</div>' . '<div class="cr cr-preview">&nbsp;</div>' . '<div class="cr cr-cogs notice">' . $cogs . '</div>' . '<div class="cr cr-profit">&nbsp;</div>' . '<div class="cr cr-margin">&nbsp;</div>' . '<div class="cr cr-premium">&nbsp;</div>';
        } else {
            //                $result .= '<span class="red">Not<br />added<br />yet to' .
            //                    '<br />catalog</span><br /><br /><input type="button" ' .
            //                    'value="Add Now" title="Click here to add product now '.
            //                    'to this Sales Partner Catalog" />';
            $result .= '<div class="cr cr-uvp notice">-</div>' . '<div class="cr cr-sp notice">-</div>' . '<div class="cr cr-factor notice">-</div>' . '<div class="cr cr-disc notice">-</div>' . '<div class="cr cr-option notice">-</div>' . '<div class="cr cr-preview notice">Not Added to Catalog</div>' . '<div class="cr cr-cogs notice">-</div>' . '<div class="cr cr-profit notice">-</div>' . '<div class="cr cr-margin notice">-</div>' . '<div class="cr cr-premium notice">-</div>';
        }
        $result .= '</td>';
    }
    //2 COLUMNS PER SP (B2B)
    foreach ($sp_b2b as $sp) {
        $status = $product->displayActiveStatusIcon($sp['jng_sp_id']);
        $status_nodisc = '&nbsp;';
        $status_disc = '&nbsp;';
        $sp_id = '<input type="hidden" name="sp_id" value="' . $sp['jng_sp_id'] . '" />';
        $b2b_disc_status_checked = '';
        $b2b_disc_disabled = '';
        $default_discount = 0.5;
        $selling_price_notsaved_title = '';
        $selling_price_notsaved_class = '';
        if ($product->isAddedToSalesPartner($sp['jng_sp_id'])) {
            $price_selling = $product->getPriceSelling($sp['jng_sp_id']);
            $price_selling_old = $product->getPriceSellingOld($sp['jng_sp_id']);
            if ($price_selling_old == 0) {
                $status_nodisc = $status;
                $price_selling_old = $price_selling;
                $price_selling = round((1 - $default_discount) * $price_selling_old, 2);
            } else {
                $status_disc = $status;
                $b2b_disc_status_checked = ' checked="checked"';
            }
        } else {
            $status_nodisc = $status;
            $status_disc = $status;
            $price_selling_old = $product->getPriceSellingDefaultB2B($price_uvp, $sp['jng_sp_id']);
            $price_selling = round((1 - $default_discount) * $price_selling_old, 2);
            $b2b_disc_disabled = ' disabled="disabled"';
            $selling_price_notsaved_title = ' title="Value is for simulation only and can not be saved because this product is not added to SP catalog"';
            $selling_price_notsaved_class = ' notice';
        }
        $b2b_ds_cb_id = 'po-' . $product->id . '-' . $sp['jng_sp_id'];
        $b2b_disc_status = '<input id="' . $b2b_ds_cb_id . '" type="checkbox" name="price_option"' . $b2b_disc_status_checked . $b2b_disc_disabled . ' /> <label for="' . $b2b_ds_cb_id . '">Active</label>';
        $price_selling_id = 'ps-' . $product->id . '-' . $sp['jng_sp_id'];
        $result .= '<td class="w100 tac">' . '<div class="cr cr-status">' . $status_nodisc . '</div>' . '<div class="cr cr-uvp">' . '<input type="text" name="price-uvp" class="w080 tac b2c readonly"' . ' value="' . $price_uvp . '" readonly="readonly" />' . $sp_id . '</div>' . '<div class="cr cr-sp"><input id="' . $price_selling_id . '-old" type="text" name="price-selling" class="w080 tac b2b-nd' . $selling_price_notsaved_class . '"' . $selling_price_notsaved_title . ' value="' . $price_selling_old . '" />' . $sp_type_b2b_nodisc . $sp_id . '</div>' . '<div class="cr cr-factor">&nbsp;</div>' . '<div class="cr cr-disc notice">-</div>' . '<div class="cr cr-option notice">-</div>' . '<div class="cr cr-preview">&nbsp;</div>' . '<div class="cr cr-cogs notice">' . $cogs . '</div>' . '<div class="cr cr-profit">&nbsp;</div>' . '<div class="cr cr-margin">&nbsp;</div>' . '<div class="cr cr-premium">&nbsp;</div>' . '</td>' . '<td class="w100 tac">' . '<div class="cr cr-status">' . $status_disc . '</div>' . '<div class="cr cr-uvp">' . '<input type="text" name="price-uvp" class="w080 tac b2c readonly"' . ' value="' . $price_uvp . '" readonly="readonly" />' . $sp_id . '</div>' . '<div class="cr cr-sp"><input id="' . $price_selling_id . '" type="text" name="price-selling" class="w080 tac b2b-d' . $selling_price_notsaved_class . '"' . $selling_price_notsaved_title . ' value="' . $price_selling . '" />' . $sp_type_b2b_disc . $sp_id . '</div>' . '<div class="cr cr-factor">&nbsp;</div>' . '<div class="cr cr-disc">&nbsp;</div>' . '<div class="cr cr-option">' . $b2b_disc_status . $sp_id . '</div>' . '<div class="cr cr-preview">&nbsp;</div>' . '<div class="cr cr-cogs notice">' . $cogs . '</div>' . '<div class="cr cr-profit">&nbsp;</div>' . '<div class="cr cr-margin">&nbsp;</div>' . '<div class="cr cr-premium">&nbsp;</div>' . '</td>';
    }
    $result .= '</tr></table></div>';
    $message_block = '';
    $button_style = '';
    if ($message != '') {
        $button_style = ' style="display:none;"';
        $message_block .= '<h3 class="green">' . $message . '</h3>';
    }
    $result .= '<div class="tar" style="margin-top:5px;"><input type="button"' . ' class="w400 button" name="save-price" value="Save Product Price" ' . $button_style . '/>' . $message_block . '</div>' . '</div>';
    return $result;
}