function getSummary($summary_data)
{
    $result = array();
    $total_unpaid = 0;
    $total_unpaid = 0;
    $have_orders = false;
    if (count($summary_data) > 0) {
        $have_orders = true;
        $total_unpaid = 0;
        $total_unpaid_vorkasse = 0;
        foreach ($summary_data as $dt) {
            $payment_method = $dt['payment_method'];
            $saldo = $dt['amount_saldo'];
            $payment_method = strtoupper(trim($payment_method));
            $total_unpaid += $saldo;
            if ($payment_method == strtoupper(PAYMENT_METHOD_BANK_TRANSFER) || $payment_method == strtoupper(PAYMENT_METHOD_PREPAYMENT)) {
                $total_unpaid_vorkasse += $saldo;
            }
        }
    }
    $result['total_unpaid'] = displayCurrency(CURRENCY_CODE_EURO, $total_unpaid);
    $result['total_unpaid_vorkasse'] = displayCurrency(CURRENCY_CODE_EURO, $total_unpaid_vorkasse);
    $result['have_orders'] = $have_orders;
    return $result;
}
 function manageLogisticList($rowperpage, $page)
 {
     $result = '';
     $result .= '<div>';
     $result .= '<input type="button" id="newlogpack" value="Create New" title="Create New Logistic Package" />';
     $result .= '<a href="?open=packages-logistic-detail&hidemenu=true" class="view_webpage"></a>';
     $result .= '</div>';
     $result .= '<div>&nbsp;</div>';
     $count_logistic_query = tep_db_query("SELECT COUNT(logistic_id) AS total FROM minierp_logistic");
     $count_logistic = tep_db_fetch_array($count_logistic_query);
     $offset = ($page - 1) * $rowperpage;
     $paging_filter = "LIMIT {$rowperpage} OFFSET {$offset}";
     $lq = "SELECT ml.*, SUM(products_total_count) AS total_qty";
     $lq .= " FROM minierp_logistic ml";
     $lq .= " LEFT JOIN minierp_logistic_contents mlc ON mlc.logistic_id=ml.logistic_id";
     $lq .= " GROUP BY logistic_id";
     $lq .= " ORDER BY logistic_date DESC";
     $lq .= " {$paging_filter}";
     $logistic_query = tep_db_query($lq);
     $logistic = array();
     while ($row = tep_db_fetch_array($logistic_query)) {
         $logistic[] = $row;
     }
     if (count($logistic) > 0) {
         $pagelink = tep_paging($count_logistic['total'], $page, '?open=packages-logistic-list&amp;page=');
         $log_table = array();
         $lt = array();
         $lt['pac_code'] = 'Shipper Code';
         $lt['long_id'] = 'Invoice No';
         $lt['date'] = 'Sent Date';
         $lt['qty'] = 'Qty';
         $lt['countpro'] = 'Weight';
         $lt['price'] = 'Price';
         $lt['awb_no'] = 'AWB No';
         $log_table[] = $lt;
         foreach ($logistic as $l) {
             $log_date = strtotime($l['logistic_date']);
             $sent_date = $l['sent_date'] == '' ? '&nbsp;' : date('d-M-Y', strtotime($l['sent_date']));
             $lt = array();
             $lt['pac_code'] = '<a href="?open=packages-logistic-detail&amp;id=' . $l['logistic_id'] . '&hidemenu=true" class="view_webpage" title="View Logistic Detail">' . $l['logistic_code'] . '</a>';
             $lt['long_id'] = $l['ptb_no'] != '' ? date('ym', $log_date) . '-' . $l['ptb_no'] : '&nbsp;';
             $lt['date'] = date('j-M-y', $log_date);
             $lt['qty'] = $l['total_qty'];
             $lt['countpro'] = $l['logistic_weight'] . ' Kg';
             $lt['price'] = displayCurrency($l['currency'], $l['logistic_price']);
             $lt['awb_no'] = $this->awbCodeLink($l['awb_no']);
             $log_table[] = $lt;
         }
         $result .= tep_draw_table('packages', $log_table);
         $result .= $pagelink;
     } else {
         $result .= '<h3 class="red">No Logistic Packages is found in database</h3>';
     }
     return $result;
 }
function drawPLthumb($row, $hide = false)
{
    global $jng_sp_id;
    $link = '?' . (is_null($jng_sp_id) ? 'open=product-detail&amp;products_id=' : 'open=sp-product&amp;id=') . $row['products_id'];
    $l = '<div id="pid-' . $row['products_id'] . '" class="pro-thumb">';
    $l .= '<input type="hidden" name="products_id" value="' . $row['products_id'] . '" />';
    $l .= '<div><a href="' . $link . '" target="_blank" title="Manage product detail ID: ' . $row['products_id'] . '">' . webImage($row['products_image'], '120', '120') . '</a></div>';
    $l .= '<div>' . displayCurrency('EUR', $row['products_price']) . '</div>';
    $l .= '<div class="blue" title="Click to add this product">(+) Add</div>';
    $l .= '</div>';
    return $l;
}
function getTotalOrderAmount($type, $order_id, $currency = 'EUR')
{
    $type = strtoupper($type);
    if ($type == 'J') {
        global $class_o;
        $orders_total = $class_o->retrieveTotals($order_id);
        $total_price = $orders_total['ot_total']['value'];
    } elseif ($type == 'S') {
        $q_total_price = "SELECT jo.shipping_costs+jo.cod_costs+SUM(joi.order_quantity * joi.price) total_price FROM jng_sp_orders jo";
        $q_total_price .= " INNER JOIN jng_sp_orders_items joi ON joi.jng_sp_orders_id = jo.jng_sp_orders_id";
        $q_total_price .= " WHERE jo.jng_sp_orders_id = {$order_id}";
        $q_total_price .= " AND joi.status NOT IN (10, 12)";
        $dbq = tep_db_query($q_total_price);
        $rtp = tep_db_fetch_array($dbq);
        $total_price = $rtp['total_price'];
    }
    return displayCurrency($currency, $total_price);
}
function constructProductDetailInfo($pid, $p_data = array(), $is_reference_products = false, $use_link = false)
{
    global $class_pm;
    if (count($p_data) == 0) {
        $p_data = $class_pm->retrieveDetail($pid, 'p,pd');
    }
    $pinfo = array();
    if ($is_reference_products) {
        $ref_status = ' <small class="notice">(Reference Product)</small>';
    }
    $pid_and_code = $use_link ? "<a class=\"view_webpage\" href=\"?open=product-detail&hidemenu=true&products_id={$pid}#prodet-tab2\" target=\"_blank\">{$pid} / " . $p_data['p']['products_model'] . "</a>" : "{$pid} / " . $p_data['p']['products_model'];
    $pinfo[] = "<small class=\"notice\">Products Info:</small><br/>{$pid_and_code}{$ref_status}";
    $pinfo[] = '<br/><small class="notice">Products Name:</small><br/>' . $p_data['pd'][2]['products_name'];
    $pinfo[] = '<br/><small class="notice">Products Description:</small><br/>' . $p_data['pd'][2]['products_description'];
    $pinfo[] = '<br/><small class="notice">Products Brand:</small> ' . $p_data['p']['products_brand_name'];
    $pinfo[] = '<br/><small class="notice">Products Price:</small> ' . displayCurrency('EUR', $p_data['p']['products_price']);
    return $pinfo;
}
 function drawThumbs($links, $type, $addlink)
 {
     global $maxlinks;
     $results = '';
     if (is_array($links[$type]) && count($links[$type]) > 0) {
         foreach ($links[$type] as $l) {
             $results .= '<div id="pl-' . $l['products_linking_id'] . '" class="pro-thumb">';
             $results .= '<div>' . webImage($l['products_image'], '80', '80') . '</div>';
             $results .= '<div>' . displayCurrency('EUR', $l['products_price']) . '</div>';
             $results .= '<div class="red">(x) remove</div>';
             $results .= '</div>';
         }
     } else {
         $results .= '';
     }
     $visible = count($links[$type]) < $maxlinks[$type] ? '' : 'style="display:none;"';
     $addlink = sprintf($addlink, $visible, $type);
     $results .= $addlink;
     return $results;
 }
 $pdf->setFont('Arial', 'B', '10');
 //$pdf->Cell($cellsize, $cell_height, $no++ . ". " . (($header) ? $p['categories_name'] : ''));
 //wrap categories name to fit with box
 $pdf->MultiCell(40, 3, $no++ . ". " . ($header ? $p['categories_name'] : ''), 0, 'L');
 $header = false;
 $pdf->setFont('Arial', '', '10');
 $pdf->drawStar($p['stars'], $cellstart + 15, $ypos + 29);
 $pdf->setXY($firstbox_xpos, $ypos + 35);
 $link = 'http://' . $server . '/?open=product-detail&products_id=' . $p['products_id'];
 $pdf->SetFont('Arial', 'U');
 $pdf->SetTextColor(0, 0, 255);
 $pdf->Cell($firstbox_text_size, $cell_height, $pid . ' / ' . $p['products_model'], 0, 0, 'C', 0, $link);
 $pdf->SetFont('Arial', '');
 $pdf->SetTextColor(0, 0, 0);
 $pdf->setXY($firstbox_xpos, $ypos + 40);
 $pdf->Cell($firstbox_text_size, $cell_height, 'Price: ' . displayCurrency('EUR', $p['products_price'], false), 0, 0, 'C');
 //$pdf->Cell($cellsize, $cell_height, 'Price/Margin: '.displayCurrency('EUR', $p['products_price'], false).' / '.$p['fmargin']);
 $pdf->setXY($firstbox_xpos, $ypos + 45);
 $pdf->Cell($firstbox_text_size, $cell_height, 'Margin: ' . $p['fmargin'], 0, 0, 'C');
 //$pdf->Cell($cellsize, $cell_height, 'Total Sold L30D: '.$p['last_30_days']);
 //$pdf->Cell($cellsize, $cell_height, 'Total Sold L4W: '.$p['total_sold_L4W']);
 $pdf->setXY($firstbox_xpos, $ypos + 50);
 $pdf->setFont('Arial', 'B');
 //$pdf->Cell($cellsize, $cell_height, 'Total Sold L30D: '.$p['last_30_days']);
 //$pdf->Cell($cellsize, $cell_height, 'Total Sold L4W: '.$p['total_sold_L4W']);
 $pdf->Cell($firstbox_text_size, $cell_height, 'Sold L4W/L30D: ' . $p['total_sold_L4W'] . ' / ' . $p['last_30_days'], 0, 0, 'C');
 $pdf->SetFont('Arial', '');
 foreach ($p['weekly'] as $p_weekly) {
     $pdf->setXY($cellsizecollweek, $ypos);
     $pdf->Cell($cellsize, $cell_height_col, '', 1, 0);
     $pdf->setXY($cellsizecollweek + 2, $ypos + 3);
function formatTableRow($row_id, $sold = 'Sold<br />(pieces)', $net_sales = 'Net Sales<br />({CURRENCY})', $net_sales_ratio = 'Net Sales<br />Ratio (%)', $price_average = 'Average Price<br />({CURRENCY})', $margin_average = 'Average<br />Margin (%)', $profit = 'Profit<br />({CURRENCY})', $profit_ratio = 'Profit<br />Ratio (%)', $return_rate = 'Return<br />Rate (%)', $is_header = true)
{
    global $number_format;
    if (!$is_header) {
        //Check requested number format
        if ($number_format == 'EN' || $number_format == 'DE') {
            //If using flat (english/deutsch), for direct copy paste to excel
            $decimal_separator = $number_format == 'EN' ? '.' : ',';
            //Currency
            $net_sales = number_format($net_sales, 2, $decimal_separator, '');
            $price_average = number_format($price_average, 2, $decimal_separator, '');
            $profit = number_format($profit, 2, $decimal_separator, '');
            //% Percentage Fromat
            $net_sales_ratio = displayPercentage($net_sales_ratio, 1, $decimal_separator, false);
            $margin_average = displayPercentage($margin_average, 1, $decimal_separator, false);
            $profit_ratio = displayPercentage($profit_ratio, 1, $decimal_separator, false);
            $return_rate = displayPercentage($return_rate, 1, $decimal_separator, false);
            //Pieces
            $sold = strval(round($sold, 0));
        } else {
            //If using manobo default for nicer view
            //Currency Format
            $net_sales = displayCurrency(CURRENCY_DEFAULT, $net_sales, false);
            $price_average = displayCurrency(CURRENCY_DEFAULT, $price_average, false);
            $profit = displayCurrency(CURRENCY_DEFAULT, $profit, false);
            //% Percentage Fromat
            $net_sales_ratio = displayPercentage($net_sales_ratio);
            $margin_average = displayPercentage($margin_average);
            $profit_ratio = displayPercentage($profit_ratio);
            $return_rate = displayPercentage($return_rate);
            //Pieces
            $sold = strval(round($sold, 0));
        }
    }
    if ($row_id == '') {
        $row_id = '<span class="notice">N/A</span>';
    }
    $row = array();
    $row['w150 tac 1'] = $row_id;
    $row['w080 tac 4'] = $sold;
    $row['w150 tar 5'] = $net_sales;
    $row['w080 tar 6'] = $net_sales_ratio;
    $row['w100 tar 7'] = $price_average;
    $row['w080 tar 8'] = $margin_average;
    $row['w150 tar 9'] = $profit;
    $row['w080 tar 10'] = $profit_ratio;
    $row['w080 tar 12'] = $return_rate;
    if ($is_header) {
        foreach ($row as $col_key => $col_val) {
            $row[$col_key] = str_replace('{CURRENCY}', CURRENCY_DEFAULT, $col_val);
        }
    }
    return $row;
}
<?php

$cb_amount = displayCurrency('EUR', $cb_amount);
$email_subject = 'Wir haben Ihr Kundenkonto ausgeglichen';
$email_text_array = array();
$email_text_array[] = 'Guten Tag ' . $to_name . ',';
$email_text_array[] = 'wir haben soeben den offenen Betrag Ihrer Bestellung mit der Referenznummer ' . $order_id . ' angewiesen. Bitte beachten Sie, dass es je nach Kreditinstitut einige Tage in Anspruch nehmen kann bis der Betrag auf Ihrem Konto eingeht.';
$email_text_array[] = 'Wir freuen uns Sie bald wieder als Kunden begrüßen zu dürfen. Täglich stellen wir neue Produkte ein. Da ist sicher auch wieder etwas für Sie dabei. Besuchen Sie uns doch einfach mal wieder!';
$email_text_array[] = 'Bei Fragen, Anregungen oder Problemen schreiben Sie einfach an ' . EMAIL_ADDRESS_OTTODECUST . '.';
$email_text = '';
if (MAILTYPE == 'HTML') {
    foreach ($email_text_array as $eta) {
        $email_text .= '<p>' . $eta . '</p>';
    }
    $email_text .= '<p>' . nl2br(EMAIL_FOOTER_TEXT) . '</p>';
} else {
    foreach ($email_text_array as $eta) {
        $email_text .= $eta . "\n\n";
    }
    $email_text .= EMAIL_FOOTER_TEXT;
}
$row_template .= '</tr>';
$width = $sort_option == 'msws' ? '1030' : '975';
//$content .= '<div style="position:absolute;left:600px;top:85px;"><input type="button" id="print-stock" value="Print Stock List" /></div>';
$content .= '<div style="margin-bottom:10px;width:' . $width . 'px;"><form name="frm_sort" action="?open=elements-stock-list" method="post">';
$content .= '<div style="float:right;">';
$content .= '<table class="form" border="0" cellpadding="0" cellspacing="0" style="margin-bottom:10px;">';
$content .= '<tr><td width="150"><strong>Filter by Category</strong></td>';
$content .= '<td><select name="elcat-filter" class="input" onchange="frm_sort.submit();">';
$content .= '<option value="">Show All</option>';
$content .= loadComboList('element_category', 'element_category_id', 'name', $elcatfiltered);
$content .= '</select></td></tr>';
$content .= '</table>';
$content .= '<table border="0" cellpadding="0" cellspacing="0" style="background:#eee;">';
$content .= '<tr><td rowspan="2"><input type="button" id="print-stock" value="Print Stock List" /></td>';
$content .= '<td><h3>Average DIOH</h3></td><td><h3>: <span id="avg-dioh">' . $dioh_average . '</span></h3></td></tr>';
$content .= '<tr><td><h3>Total Stock Value</h3></td><td><h3>: <span id="total-price">' . displayCurrency('EUR', $total_total) . '</span></h3></td></tr>';
$content .= '</table></div>';
$content .= '<strong>Sort by </strong><select id="sort_option" name="sort_option" onchange="frm_sort.submit();">';
foreach ($sort_options as $value => $option) {
    $sel = $sort_option == $value ? 'selected="selected"' : '';
    $content .= '<option value="' . $value . '" ' . $sel . '>' . $option . '</option>';
}
$content .= '</select>';
$content .= '</form></div>';
$content .= '<div style="clear:both;">&nbsp;</div>';
$content .= tep_draw_table('proman sticky-tablehead', $table);
$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
         //						} else {
         //							$packcode = $p['package_code'];
         //						}
         //						$form .= '<div>'.$del.$id.' <a href="'.$packlink.'">'.$packcode.'</a></div>';
         //					}
         //				}
         //				$win_pack = new ui_window($title, $form);
         //				$win_pack->ui_setWindowWidth($left_window_size);
         //				$result .= '<div>&nbsp;</div>';
         //				$result .= $win_pack->ui_print();
         //			}
         $log_total_ged = $class_ml->retrieveContentsTotal($logistic_id, 'GED');
         $log_total_dhl = $class_ml->retrieveContentsTotal($logistic_id, 'DHL', $use_cogs);
     }
     $result .= '<input type="hidden" id="log_value_ged_hidden" value="' . displayCurrency('EUR', $log_total_ged) . '" />';
     $result .= '<input type="hidden" id="log_value_dhl_hidden" value="' . displayCurrency('EUR', $log_total_dhl) . '" />';
     echo utf8_encode($result);
 } elseif ($_POST['me_action'] == 'SETSENT') {
     $logistic_id = tep_db_prepare_input($_POST['logistic_id']);
     $packages = $class_ml->retrievePackages($logistic_id, true);
     foreach ($packages as $type => $pack) {
         if ($type == 'P') {
             use_class('jng_sp_packages');
             $class_jp = new jng_sp_packages();
             use_class('jng_sp_orders');
             $class_jo = new jng_sp_orders();
             foreach ($pack as $p) {
                 $items = $class_jp->sendPackage($p['packages_id']);
                 foreach ($items as $items_id) {
                     $class_jo->updateItemStatus($items_id, '7', $session_userinfo['username']);
                 }
Example #12
0
 function displayCellValue($value)
 {
     global $currency, $show_as_sales;
     return $show_as_sales ? displayCurrency($currency, $value) : strval(intval($value));
 }
$content .= '<table class="analysis" border="0" cellpadding="0" cellspacing="0">';
$content .= '<tr>';
$content .= '<th><sub>Price</sub>\\<sup>Ret.Rate</sup></th>';
foreach ($return_rate_collection as $rr) {
    $content .= '<th>' . $rr . '%</th>';
}
$content .= '</tr>';
foreach ($price_collection as $price) {
    $price_id = 'P' . str_replace('.', 'C', $price);
    if ($price_id == $default_price_id) {
        $classrow = 'class="bg-green"';
    } else {
        $classrow = isset($cat_data[$price_id]) ? 'class="e"' : '';
    }
    $content .= '<tr ' . $classrow . '>';
    $content .= '<td>' . displayCurrency('EUR', $price) . '</td>';
    foreach ($return_rate_collection as $rr) {
        $rr_id = 'R' . str_replace('.', 'C', $rr);
        //$div_point = $data_vc_piece[$default_price_id][$rr_id];
        $div_point = $data_vc_piece[$default_price_id][$default_rr_id];
        $rule1 = $price == $default_price && $rr == $default_return_rate;
        $rule2 = $price < $default_price;
        $rule3 = $div_point <= 0 || $data_vc_piece[$price_id][$rr_id] < 0;
        if ($rule1) {
            $sales_percent = 'CURRENT';
        } elseif ($rule3) {
            $sales_percent = '-';
        } else {
            $sales_percent = number_format($div_point / $data_vc_piece[$price_id][$rr_id] * 100, 1);
            $sales_percent .= '%';
        }
//$email_text_array[4]  = 'Bitte überweisen Sie den Betrag von '.displayCurrency('EUR', $total).' auf das folgende Konto:';
//$email_text_array[5]  = 'Kontoinhaber: '.MODULE_PAYMENT_TRANSFER_PAYTO."\n";
//$email_text_array[5] .= 'Kontonummer: '.MODULE_PAYMENT_TRANSFER_ACCOUNT."\n";
//$email_text_array[5] .= 'Kreditinstitut: '.MODULE_PAYMENT_TRANSFER_BANK."\n";
//$email_text_array[5] .= 'Bankleitzahl: '.MODULE_PAYMENT_TRANSFER_BRANCH."\n";
//$email_text_array[5] .= 'Verwendungszweck: '.$payone_txid."\n\n";
//$email_text_array[5] .= 'Nur für Auslandszahlungen: '.MODULE_PAYMENT_TRANSFER_INTERNATIONAL_CODE."\n";
//$email_text_array[5] .= 'IBAN-Nummer: '.MODULE_PAYMENT_TRANSFER_IBAN."\n";
//$email_text_array[6]  = 'Sollten Sie in den Betrag bereits in den letzten Tagen überwiesen haben, betrachten Sie bitte diese Email als gegenstandslos. Wenn wir bis zum '.tep_date_long($canceldue).' keine Zahlung von Ihnen erhalten, gehen wir davon aus, dass Sie an der Bestellung nicht mehr interessiert sind und stornieren diese.';
//$email_text = '';
$email_text_array = array();
$email_text_array[0] = 'Guten Tag ' . $to_name . ',';
$email_text_array[1] = 'vielen Dank für Ihre Bestellung ' . $order_no . ' vom ' . $order_date . ' bei JULIE & GRACE über ' . $otto_link . '.';
$email_text_array[2] = 'Sie haben bei der Bezahlweise „Vorkasse“ ausgewählt, aber leider konnten wir bis heute auf unserem Konto noch keinen Zahlungseingang von Ihnen feststellen.';
$email_text_array[3] = 'Bitte haben Sie Verständnis, dass wir mit der Bearbeitung Ihrer Bestellung erst nach Zahlungseingang beginnen.';
$email_text_array[4] = 'Bitte überweisen Sie den Betrag von ' . displayCurrency('EUR', $total) . ' auf das folgende Konto:';
$email_text_array[5] = 'Verwendungszweck: ' . $payone_txid . "\n\n";
$email_text_array[6] = nl2br(displayBankAccountInfo());
$email_text_array[7] = 'Sollten Sie in den Betrag bereits in den letzten Tagen überwiesen haben, betrachten Sie bitte diese Email als gegenstandslos. Wenn wir bis zum ' . tep_date_long($canceldue) . ' keine Zahlung von Ihnen erhalten, gehen wir davon aus, dass Sie an der Bestellung nicht mehr interessiert sind und stornieren diese.';
$email_text = '';
if (MAILTYPE == 'HTML') {
    foreach ($email_text_array as $eta) {
        $email_text .= '<p>' . nl2br($eta) . '</p>';
    }
    $email_text .= '<p>' . nl2br(EMAIL_FOOTER_TEXT_2) . '</p>';
} else {
    foreach ($email_text_array as $eta) {
        $email_text .= $eta . "\n\n";
    }
    $email_text .= EMAIL_FOOTER_TEXT_2;
}
Example #15
0
 /**
  * A static function to generate preview for displaying product price
  * @param Float $price_old Old price of product (if discounted)
  * @param Float $price Selling price of product
  * @return String
  */
 public static function generatePricePreview($price_old, $price)
 {
     if ($price_old > $price) {
         $preview = '<span class="notice deleted">' . displayCurrency(CURRENCY_DEFAULT, $price_old) . '</span><br />' . '<span class="red">' . displayCurrency(CURRENCY_DEFAULT, $price) . '</span>';
     } else {
         $preview = displayCurrency(CURRENCY_DEFAULT, $price);
     }
     return '<strong>' . $preview . '</strong>';
 }
$invoice_date_end = date('Y-m-d 23:59:59', strtotime(tep_db_prepare_input($_GET['ide'])));
$filter = "invoice_date >= '{$invoice_date_start}' AND invoice_date <= '{$invoice_date_end}'";
$payment_summary_data = payone::getPaymentSummaryData('A', $filter);
$content = 'Invoice Date from ' . date('d-m-Y', strtotime($invoice_date_start));
$content .= '&nbsp;&nbsp;to ' . date('d-m-Y', strtotime($invoice_date_end));
if (count($payment_summary_data) > 0) {
    $table = array();
    $th = array();
    $th['d'] = 'Invoice<br/>Date';
    $th['d2'] = 'Invoice<br/>Due Date';
    $th['c'] = 'Customer Name';
    $th['o'] = 'Payment<br/>Method';
    $th['id2'] = 'Order No';
    $th['id3'] = 'Payone<br/>txid';
    $th['p'] = 'Saldo<br/>(EUR)';
    $table[] = $th;
    foreach ($payment_summary_data as $dt) {
        $tr = array();
        $tr['d'] = date('d-m-Y', strtotime($dt['invoice_date']));
        $tr['d2'] = date('d-m-Y', strtotime($dt['invoice_due_date']));
        $tr['c'] = $dt['customers_name'];
        $tr['o'] = $dt['payment_method'];
        $order_link = '?open=customer-care-order-detail&amp;source=' . ($dt['invoice_order_type'] == 'S' ? 'SP' : 'JG') . '&amp;id=' . $dt['invoice_order_id'] . '&amp;hidemenu=true';
        $tr['id2'] = '<a title="click to view order detail" class="view_webpage" href="' . $order_link . '">' . $dt['order_no'] . '</a>';
        $tr['id3'] = $dt['payone_txid'];
        $tr['p'] = displayCurrency('EUR', $dt['amount_saldo'], false);
        $table[] = $tr;
    }
    $content .= tep_draw_table('spo', $table);
}
$title = 'Payment Overview Orders List';
 foreach ($orders as $oid => $o) {
     $ot = array();
     $ot['r'] = $o['suppliers_name'];
     $submit_date = date('d.m.Y', strtotime($o['date_submitted']));
     $ot['d'] = '<input type="text" id="podate-' . $oid . '" name="podate" value="' . $submit_date . '" class="date_picker" />';
     $ot['id1'] = $o['po_number'] . '<input type="hidden" name="oid" value="' . $oid . '" />';
     $ot['o'] = '<input type="text" id="suppid-' . $oid . '" name="suppid" value="' . $o['supplier_order_id'] . '" style="text-align:center;" />';
     //$ot['c'] = count($elements[$oid]).' Elements<br />('.array_sum($elements[$oid]).' Total Qty)';
     $total_ordered_qty = array_sum($elements[$oid]);
     $total_received_qty = array_sum($elements_received[$oid]);
     $total_void_qty = array_sum($elements_void[$oid]);
     $total_ordered_after_void = $total_ordered_qty - $total_void_qty;
     $ot['email'] = elementsSourcingOpenPOlinks($oid, $o['suppliers_id'], count($elements[$oid]), $total_ordered_qty, $total_received_qty, $total_void_qty, count($elements_confpri[$oid]), count($elements_confwax[$oid]), 'PRICEONLY');
     //$ot['email'] = '<div id="er-'.$oid.'" '.$e_class.' style="padding-right:15px;text-align:right;">'.$total_received.'/'.$total_ordered.$linksep.$wax.$linksep.$receive.$linksep.$confprice.'</div>';
     $ot['id2'] = $total_weight[$oid] . ' gram';
     $ot['id3'] = displayCurrency($o['currency'], $total_price[$oid]);
     if ($o['date_received'] != null) {
         $received_date = date('d.m.Y', strtotime($o['date_received']));
     } else {
         $received_date = '';
     }
     $ot['dr'] = $received_date;
     //$ot['t']  = '<input type="text" id="paypri-'.$oid.'" name="paypri" value="'.number_format($o['payment_price'],2,'.',' ').'" style="width:80px;text-align:right;" />';
     //$ot['t'] .= '<select id="paycur-'.$oid.'" name="paycur">'.loadComboListFromArray($currencies, null, $o['payment_currency'], false).'</select>';
     $added_class = '';
     if ($total_ordered_after_void > 0) {
         if ($o['payment_status'] == '1') {
             $paid_image = 'yes';
             $paid_image_title = 'Click to Set as Unpaid';
         } else {
             $paid_image = 'no';
        $email_text_array[4] .= $p['billing_text'];
        $email_text_array[4] .= ' (' . $p['article_number'] . ') = ';
        $value = $p['order_quantity'] * $p['price'];
        $total += $value;
        $tpp = displayCurrency('EUR', $value);
        $email_text_array[4] .= $tpp;
        $email_text_array[4] .= "\n";
    }
}
if (isset($order['shipping_costs']) && $order['shipping_costs'] > 0) {
    $total += $order['shipping_costs'];
    $email_text_array[4] .= 'Verpackung & Versand: ' . displayCurrency('EUR', $order['shipping_costs']) . "\n";
}
if (isset($order['cod_costs']) && $order['cod_costs'] > 0) {
    $total += $order['cod_costs'];
    $email_text_array[4] .= 'Nachnahmegebühren: ' . displayCurrency('EUR', $order['cod_costs']) . "\n";
}
$email_text_array[4] .= 'Gesamtsumme: ' . displayCurrency('EUR', $total);
$email_text_array[5] = 'Bei Fragen können Sie sich gerne an unseren Kundenservice wenden unter <a href="' . FROM_EMAIL_ADDRESS . '">' . FROM_EMAIL_ADDRESS . '</a>.';
$email_text = '';
if (MAILTYPE == 'HTML') {
    foreach ($email_text_array as $eta) {
        $email_text .= '<p>' . nl2br($eta) . '</p>';
    }
    $email_text .= '<p>' . nl2br(EMAIL_FOOTER_TEXT_3) . '</p>';
} else {
    foreach ($email_text_array as $eta) {
        $email_text .= $eta . "\n\n";
    }
    $email_text .= EMAIL_FOOTER_TEXT_3;
}
$content .= '<tr><th width="300" rowspan="2">&nbsp;</th><th colspan="2">Provisionssatz 1</th></tr>';
$content .= '<tr><th width="120">Wert in &#8364;</th><th width="120">Stück</th></tr>';
$content .= '<tr><td><strong>Übermittelte Warenkörbe</strong></td><td>' . displayCurrency($currency, $total_amount_price_net) . '</td><td>' . $total_amount_qty . '</td></tr>';
$content .= '<tr><td class="sub">(optional Bonitätsprüfung)</td><td>0</td><td>0</td></tr>';
$content .= '<tr><td class="sub">Kundenstorno</td><td>' . displayCurrency($currency, $total_cancel_price_net) . '</td><td>' . $total_cancel_qty . '</td></tr>';
$content .= '<tr><td class="sub">Lieferausfälle</td><td>' . displayCurrency($currency, 0) . '</td><td>0</td></tr>';
$content .= '<tr><td><strong>Bruttoumsatz / -absatz</strong></td><td>' . displayCurrency($currency, $total_after_cancellations_price_net) . '</td><td>' . $total_after_cancellations_qty . '</td></tr>';
$content .= '<tr><td class="sub">Retouren</td><td>' . displayCurrency($currency, $total_return_price_net) . '</td><td>' . $total_return_qty . '</td></tr>';
$content .= '<tr><td><strong>Provisionsfähiger Umsatz / Absatz</strong></td><td>' . displayCurrency($currency, $total_after_returns_price_net) . '</td><td>' . $total_after_returns_qty . '</td></tr>';
$content .= '<tr><td class="sub">Abgabe an Inkasso</td><td>0</td><td>0</td></tr>';
$content .= '<tr><td class="sub">Rückfluss aus Inkasso</td><td>0</td><td>0</td></tr>';
$content .= '<tr><td><strong>Nettoumsatz / -absatz</strong></td><td>' . displayCurrency($currency, $total_after_returns_price_net) . '</td><td>' . $total_after_returns_qty . '</td></tr>';
$content .= '<tr><td colspan="3">&nbsp;</td></tr>';
$content .= '<tr><td class="sub">Provsionssatz in %</td><td>' . strval($commission_excl_tax * 100) . '%</td><td>&nbsp;</td></tr>';
$content .= '<tr><td colspan="3">&nbsp;</td></tr>';
$content .= '<tr><td><strong>Zu zahlende Provision</strong></td><td>' . displayCurrency($currency, $commission_total_recalc_from_net) . '</td><td>&nbsp;</td></tr>';
$content .= '</table></div>';
$javascript = '
            $("#view-orders").click(function() {
                window.open(url + "&showdetailorders=true");
            });
            $("#dlcsv").click(function() {
                window.open(url + "&format=csv");
            });
            $("#format2012 td.sub").css("padding-left", "30px");
            $("#format2012 tr").find("td:eq(1), td:eq(2)").css("text-align", "right");
            $.each([6,8,11,15], function(index, value) {
                var tdget = (value<15) ? "gt(0)" : "eq(1)";
                $("#format2012 tr:eq(" + value.toString() + ")").find("td:"+tdget).css("background", "#ccc");
            });
            var copycb_lastclick = "";
        $xpos += $img_size + $spacing;
        $ypos += $text_middling;
        $data_array = array();
        $data_array[] = 'Code';
        $data_array[] = 'Qty';
        $data_array[] = 'Price';
        $data_array[] = 'J&G ID';
        $data = implode("\n", $data_array);
        $pdf->setXY($xpos, $ypos);
        $pdf->MultiCell($label_width, $line_height, $data);
        $xpos += $label_width;
        $qty = $elements_qty[$e['elements_id']];
        $data_array = array();
        $data_array[] = ': ' . $e['item_number'];
        $data_array[] = ': ' . $qty . ' piece(s)';
        $data_array[] = ': ' . displayCurrency($e['price_currency'], $e['elements_price']) . " / " . $e['price_quantity_type'];
        $data_array[] = ': ' . $e['elements_id'];
        //.' / '.$e['elements_code'];
        $data = implode("\n", $data_array);
        $pdf->setXY($xpos, $ypos);
        $pdf->MultiCell($value_width, $line_height, $data);
        $ypos += $img_size - $text_middling;
        $counter++;
    }
    $supsname = str_replace(' ', '', strtolower($suppliers[$sup_id]));
    $filename = $pdf_temp_path . 'JnG-SPL-' . $supsname . '-' . date('Ymd-Hi') . '.pdf';
    $pdf->Output($filename, 'F');
    $zipper->add_files($filename);
    $pdf_files[] = $filename;
}
$zipper->create_archive();
$header['sold'] = 'Products Sold';
$header['sold2'] = 'Elements Sold';
//AJAX ACTION
if (isset($_POST['me_action'])) {
    if ($_POST['me_action'] == 'LOADROW') {
        $id = tep_db_prepare_input($_POST['grabid']);
        $row_class = tep_db_prepare_input($_POST['row_class']);
        $detail = new element($id);
        if (is_null($detail->id)) {
            $row = 'FAILED';
        } else {
            $id = $detail->id;
            $img = webImage($detail->image, '80', '80', $id);
            $name = $detail->detail['name'];
            $info = $detail->detail['supplier'];
            $pri = displayCurrency('EUR', $detail->detail['price']);
            $sold = $detail->log['weekly_sold_products'];
            $sold2 = $detail->log['weekly_sold'];
            $row = '<tr id="id-' . $id . '" class="' . $row_class . '">';
            foreach ($header as $td => $h) {
                if ($td == 'id') {
                    $content = '<a href="?open=element&amp;id=' . $id . '&amp;hidemenu=true" class="view_webpage bold">' . $id . '</a>';
                } elseif ($td == 'img') {
                    $imgsrc = webImageSource($detail->image);
                    $content = $imgsrc == '' ? $img : '<a href="' . webImageSource($detail->image) . '" class="view_image">' . $img . '</a>';
                } elseif ($td == 'info') {
                    $supplier_code = '';
                    if ($info == '') {
                        $info = 'UNSET';
                    } else {
                        $dbsc = tep_db_query("SELECT item_number FROM elements_to_elements_suppliers WHERE elements_id = {$id} and is_default='1' AND item_number!=''");
Example #22
0
 function retrieveDetail($id)
 {
     $l = $this->retrieveDetailData($id);
     $request = unserialize($l['log_process_data_submit']);
     $response = strlen($l['log_process_data_result']) <= 4 ? $l['log_process_data_result'] : unserialize($l['log_process_data_result']);
     $txid = isset($request['txid']) && $request['txid'] != '' ? 'TXID ' . $request['txid'] : '<span class="notice">No TXID</span>';
     $log_time = date('d.m.y H:i:s', strtotime($l['log_process_time']));
     $log_process = '<span class="' . ($l['log_process'] == 'S' ? 'green">Submit' : 'blue">Receive') . '</span>';
     $mode = '<span class="' . (strtolower($request['mode']) == 'live' ? 'bold' : '') . '">' . $request['mode'] . '</span>';
     $status = $response == "TSOK" || $response['status'] == "TSOK" || $response['status'] == 'APPROVED' || $response['status'] == 'REDIRECT' ? '<span class="green">OK</span>' : '<span class="green">ERROR</span>';
     $result = '<h3 class="box ui-corner-all" style="margin-bottom:20px;">' . $txid . ' &sdot; ' . $log_time . ' &sdot; ' . $log_process . ' &sdot; ' . $l['log_process_method'] . ' &sdot; ' . $mode . ' &sdot; ' . $status . '</h3>';
     $logdata = '<div style="float:left;width:400px;border-right:4px solid #efefef;">';
     $logdata .= '<h3>Request</h3>';
     if (is_array($request)) {
         $logdata .= '<div><table border="0" cellpadding="0" cellspacing="0">';
         foreach ($request as $param => $value) {
             if ($param == 'txid' || $param == 'invoiceid') {
                 global $server;
                 use_class('payone_invoice');
                 if ($param == 'txid') {
                     $payi = new payone_invoice('payone_txid', $value);
                 } elseif ($param == 'invoiceid') {
                     $payi = new payone_invoice('invoice_no', $value);
                 }
                 $link_order = "{$server}/?open=customer-care-order-detail&amp;source=" . ($payi->detail['invoice_order_type'] == 'S' ? 'SP' : 'JG') . '&id=' . $payi->detail['invoice_order_id'];
                 $link_order = 'Click <a target="_blank" href="http://' . $link_order . '">here</a> to open Order Detail';
             }
             if (is_array($value)) {
                 foreach ($value as $vkey => $vval) {
                     $logdata .= '<tr><td>' . $param . '[' . $vkey . ']</td><td>' . $vval . '</td></tr>';
                 }
             } else {
                 $logdata .= '<tr><td>' . $param . '</td><td>' . $value . '</td></tr>';
             }
         }
         $logdata .= '</table></div>';
     } else {
         $logdata .= $request == '' ? '<em>BLANK</em>' : $request;
     }
     $logdata .= '</div>';
     $logdata .= '<div style="margin-left:420px;">';
     $logdata .= '<h3>Response</h3>';
     if (is_array($response)) {
         $logdata .= '<div><table border="0" cellpadding="0" cellspacing="0">';
         foreach ($response as $param => $value) {
             if (is_array($value)) {
                 foreach ($value as $vkey => $vval) {
                     $logdata .= '<tr><td>' . $param . '[' . $vkey . ']</td><td>' . $vval . '</td></tr>';
                 }
             } else {
                 $logdata .= '<tr><td>' . $param . '</td><td>' . $value . '</td></tr>';
             }
         }
         $logdata .= '</table></div>';
     } else {
         $logdata .= $response == '' ? '<em>BLANK</em>' : $response;
     }
     $logdata .= '</div>';
     if ($link_order != '') {
         $logdata = '<h3>' . $link_order . "</h3>" . $logdata;
     }
     $result .= $logdata;
     //Check unsent refund
     $payone_log_group = array('1', '39');
     global $session_userinfo;
     if (isset($payi->detail['invoice_id']) && $payi->detail['invoice_id'] != '' && in_array($session_userinfo['group'], $payone_log_group)) {
         $invoice_id = $payi->detail['invoice_id'];
         $result .= '<div style="clear:both;"></div><br/><br/>';
         $result .= '<div class="sop-box"><h3 class="red">Please more carefull to update below data, make sure all updates are correct based on problem analysis!<br/></h3>
             <br/><span>Please use also this <a target="_blank" href="https://docs.google.com/spreadsheet/ccc?key=0ArXESovGbTYcdF9RZ19xaUxFV2E2UjFNY2hzQzRsUVE&usp=drive_web#gid=0">Payone Error Guidance</a> for helping solving problems</span>
             </div><br/>';
         $result .= '<div class="float-left w400">';
         $result .= '<h3>Invoice Data</h3>';
         $result .= '<input type="hidden" id="invoice-id" value="' . $payi->detail['invoice_id'] . '"/>';
         $result .= '<table>';
         $result .= '<tr><td>Invoice Date</td><td>' . date('d-m-Y', strtotime($payi->detail['invoice_date'])) . '</td></tr>';
         $result .= '<tr><td>txid</td><td>' . payoneWebLink($payi->detail['payone_txid']) . '</td></tr>';
         $input_title = 'title="press enter to update this value"';
         $pi_input_text = array('Invoice Amount' => 'invoice_amount', 'Amount Paid' => 'invoice_amount_paid', 'Amount Cancelled' => 'invoice_amount_canceled', 'Amount Fines' => 'invoice_amount_fines', 'Amount Fines Cancelled' => 'invoice_amount_fines_canceled', 'Amount Refund' => 'invoice_amount_overpayment', 'Amount Refund Cancelled' => 'invoice_amount_overpayment_canceled', 'Payone Saldo' => 'payone_saldo', 'Sequence Number' => 'sequencenumber');
         foreach ($pi_input_text as $k => $v) {
             $result .= '<tr><td>' . $k . '</td><td><input name="' . $v . '" type="text" ' . $input_title . ' value="' . $payi->detail[$v] . '"/></td></tr>';
         }
         $status_desc = "<h3>Invoice Status</h3>";
         foreach (payone_invoice_status() as $ps => $pd) {
             $status_desc .= "{$ps}: {$pd}<br/>";
         }
         $result .= '<tr><td>Status<span class="ui-icon ui-icon-info help" style="float:right;" title="' . $status_desc . '"></span></td><td><input name="invoice_complete_status" type="text" ' . $input_title . ' value="' . $payi->detail['invoice_complete_status'] . '"/></td></tr>';
         $result .= '</table></div>';
         $dbq = tep_db_query("SELECT * FROM payone_orders_return WHERE invoice_id = {$invoice_id} AND status = 0");
         if (tep_db_num_rows($dbq) > 0) {
             $table = array();
             $t = array();
             $t['d'] = 'Created';
             $t['e'] = 'id';
             $t['sp'] = 'pr';
             $t['q'] = 'no';
             $t['id1'] = 'de';
             $t['s'] = 'va';
             $t['id2'] = 'Action';
             $table[] = $t;
             $btn_12 = '<input class="cancel" type="button" value="C12" title="Cancel this return value"/>';
             $btn_13 = '<input class="cancel" type="button" value="C13" title="Stop sending this return to payone becuase we have processed/will process it manually"/>';
             while ($r = tep_db_fetch_array($dbq)) {
                 $input_hid = '<input id="' . $r['pkey_id'] . '" type="hidden" value="' . $r['pkey_id'] . '"/>';
                 $t['d'] = date('d-m-Y H:i:s', strtotime($r['created_date']));
                 $t['e'] = $r['id'];
                 $t['sp'] = displayCurrency($r['currency'], $r['pr'] / 100);
                 $t['q'] = $r['no'];
                 $t['id1'] = $r['de'];
                 $t['s'] = $r['va'];
                 $t['id2'] = $input_hid . $btn_12 . $btn_13;
                 $table[] = $t;
             }
             $result .= '<div>';
             $result .= '<h3>Queued Refund</h3>';
             $result .= tep_draw_table('spo', $table);
             $result .= '</div>';
         }
     }
     return $result;
 }
        $pdf->SetXY($xpos, $ypos);
        $width = ${$col . '_width'};
        $pdf->MultiCell($width, $head_line_height, $header, 1, 'C');
        $xpos += $width;
    }
    $ypos += $head_line_height;
    $xpos = $pdf->left_margin;
    foreach ($columns as $col => $header) {
        $pdf->SetXY($xpos, $ypos);
        $width = ${$col . '_width'};
        $align = ${$col . '_align'};
        $pdf->MultiCell($width, $line_height, implode("\n", ${$col}[$p]), 1, $align);
        $xpos += $width;
    }
    if ($p == $page_counter) {
        $pdf->setFont('Arial', 'B', '10');
        $ypos += count($contents[$p]) * $line_height;
        $xpos = $pdf->left_margin;
        foreach ($columns as $col => $header) {
            $width = ${$col . '_width'};
            if ($col == 'value') {
                $pdf->SetXY($xpos, $ypos);
                $align = ${$col . '_align'};
                $pdf->MultiCell($width, $line_height, displayCurrency('USD', $value_total), 1, $align);
            }
            $xpos += $width;
        }
    }
}
$filename = date('ymd-hi') . '-Returns-Invoice-' . $package_id . '.pdf';
$pdf->Output($filename, 'D');
Example #24
0
}
$element_name = '<input type="text" class="input2 editable" id="elements_name" name="elements_name" value="' . $element->detail['name'] . '" />';
$element_description = '<input type="text" class="input2 editable" id="elements_description" name="elements_description" value="' . $element->detail['description'] . '" />';
$element_weight = '<input type="text" class="editable" id="elements_weight" name="elements_weight" value="' . $element->detail['weight'] . '" readonly="readonly" />';
$gold_carats = array('9' => '&nbsp;375&nbsp;<small class="notice">(9k)</small>', '14' => '&nbsp;585&nbsp;<small class="notice">(14k)</small>', '0' => '&nbsp;non-gold');
foreach ($gold_carats as $gck => $gcv) {
    $carat = $element->detail['weight_goldpure'] == '' || $element->detail['weight_goldpure'] == '0' ? '0' : element::getCaratFromWeight($element->detail['weight'], $element->detail['weight_goldpure']);
    if ($carat == 0) {
        $carat = element::getMaterialFromToCarat('', $element->attributes['material']['id']);
    }
    $selected = $carat == $gck ? 'checked="checked"' : '';
    $goldpure_carat .= '<div style="float:left;margin-right:10px;"><input type="radio" id="el_car_' . $gck . '" class="editable" name="elements_weight_goldpure" value="' . $gck . '" ' . $selected . ' disabled="disabled" />' . $gcv . '</div>';
}
$element_weight_goldpure .= '<input type="text" class="editable" id="weight_goldpure" name="weight_goldpure" value="' . $element->detail['weight_goldpure'] . '" readonly="readonly" />';
$element_suppliers = '<input type="text" id="elements_supplier" value="' . $element->detail['supplier'] . '" readonly="readonly" />';
$el_price = displayCurrency('EUR', $element->detail['price'], true, $element->detail['price'] < ELEMENTS_LOWER_PRICE ? 5 : 2);
$element_price = '<input type="text" id="elements_price" value="' . $el_price . '" readonly="readonly" />';
$element_wax_complexity = '<select id="wax_complexity" name="wax_complexity" disabled="disabled"><option value="">Please select complexity</option>' . loadComboListFromArray(getComplexity(), null, $element->wax_complexity, false) . '</select>';
if (is_null($element->id)) {
    $content .= '<h3 id="newinfo" class="red ui-corner-all" style="background:#ffeeee;padding:5px;margin-bottom:10px;">Specify a name to create New ID</h3>';
}
$content .= '<div id="element-detail">';
use_class('elements_stock');
$el_stock = new elements_stock();
$stock = $element->id > 0 ? $el_stock->retrieveOne(WAREHOUSE_ID_ELEMENTS, $element->id) : null;
$content .= '<div class="ui-corner-all ui-widget-content" style="width:220px;position:absolute;margin:-10px 0 0 650px;padding:5px 10px;">';
//$content .= '<div class="bold" style="margin:0 0 10px 3px;">Daily Log of Element</div>';
$content .= '<table class="form" style="width:100%;" border="0" cellpadding="0" cellspacing="0">';
if ($element->id > 0) {
    $content .= '<tr><td colspan="2" class="bold">Elements DIOH</td></tr>';
    $content .= '<tr><td colspan="2">&nbsp; &raquo; ' . $element->displayDIOH($stock['stock']) . '</td></tr>';
    $result .= '</tr>';
    $growth = 0;
    foreach ($products_vc_80 as $counter => $p) {
        $result .= '<tr>';
        $result .= '<td>' . ($counter + 1) . '</td>';
        $result .= '<td>' . $products_image[$p] . $products_link[$p] . '</td>';
        $result .= '<td style="text-align:right;">' . displayCurrency('EUR', $products_vc_filtered[$p]) . '</td>';
        $result .= '<td style="text-align:right;">' . number_format($products_vc_percent[$p], 2) . '%</td>';
        $growth += $products_vc_percent[$p];
        $result .= '<td style="text-align:right;">' . number_format($growth, 2) . '%</td>';
        $result .= '</tr>';
    }
    $result .= '<tr>';
    $result .= '<td>&nbsp;</td>';
    $result .= '<td style="border-top:1px solid #666;"><strong>Total</strong></td>';
    $result .= '<td style="text-align:right;border-top:1px solid #666;"><strong>' . displayCurrency('EUR', $products_vc_80_total) . '</strong></td>';
    $result .= '<td style="text-align:right;border-top:1px solid #666;""><strong>' . number_format(array_sum($products_vc_percent), 2) . '%</strong></td>';
    $result .= '<td>&nbsp;</td>';
    $result .= '</tr>';
    $result .= '</table></div>';
    echo utf8_encode($result);
    exit;
}
//START TEMPLATE
$def_period = strtotime("-1 month");
$datepick1 = '<input type="text" class="iwbutton date_picker" id="period-1" value="' . date('01.m.Y', $def_period) . '" />';
$datepick2 = '<input type="text" class="iwbutton date_picker" id="period-2" value="' . date('t.m.Y', $def_period) . '" />';
$minsold = '<input type="text" class="iwbutton" id="minsold" value="2" style="width:40px;" />';
$content = '<h2 style="float:left;margin-right:10px;">Period</h2>';
$content .= '<div id="period-picker">' . $datepick1 . ' to ' . $datepick2 . ' Min. Sold ' . $minsold . '</div>';
$content .= '<div style="margin:20px;text-align:center;">';
Example #26
0
 $content .= '<a href="?open=product-detail&amp;products_id=' . $product_id . '" title="View/Manage product detail and images">Click here to upload more images</a>';
 $content .= '</td></tr>';
 $content .= '</table></div>';
 $content .= '</div>';
 $content .= '<div>';
 $content .= '<h3><a href="#">Additional Length</a></h3>';
 $content .= $class_pa->drawTableAction($product_id, $product_length, $product_price, $product_ean);
 $content .= '</div>';
 $content .= '<div>';
 $content .= '<h3><a href="#">Sales Information</a></h3>';
 $content .= '<div><table class="form" border="0" cellpadding="0" cellspacing="0">';
 $content .= '<tr><td width="150">Age</td><td>' . $spinfo['active_age'] . ' day' . ($spinfo['active_age'] > 1 ? 's' : '') . '</td></tr>';
 $content .= '<tr><td>Total Sold</td><td>' . $spinfo['total_sold'] . ' Product' . ($spinfo['total_sold'] > 1 ? 's' : '') . '</td></tr>';
 $content .= '<tr><td>Total Returns</td><td>' . $spinfo['total_returned'] . ' Product' . ($spinfo['total_returned'] > 1 ? 's' : '') . '</td></tr>';
 $content .= '<tr><td>Returns in %</td><td>' . $spinfo['returned_rate'] . ' %</td></tr>';
 $content .= '<tr><td>Total Sales</td><td>' . displayCurrency('EUR', $spinfo['total_sales']) . '</td></tr>';
 $content .= '<tr><td>Qty. sold per Week</td><td>' . $spinfo['sales_weekly'] . '</td></tr>';
 $content .= '<tr><td>Qty. sold per Month</td><td>' . $spinfo['sales_monthly'] . '</td></tr>';
 $content .= '</table></div>';
 $content .= '</div>';
 $content .= '</div>';
 //CLOSE ACCORDION DIV
 $content .= '<div>&nbsp;</div>';
 $content .= '<div>';
 /*
 //STATUS CHECKING
 $status = array();
 $status['name'] = ($spinfo['status_name']=='1');
 $status['desc'] = ($spinfo['status_desc']=='1');
 $status['keywords'] = ($spinfo['status_keywords']=='1');
 $status['price'] = ($spinfo['status_price']=='1');
Example #27
0
$query .= " LEFT JOIN categories_description cd ON cd.categories_id=cat.categories_id AND cd.language_id='1'";
$query .= " WHERE p.products_id IN (" . $pids . ") ORDER BY cat.categories_id";
$result = tep_db_query($query);
while ($row = tep_db_fetch_array($result)) {
    $cat[$row['categories_name']][] = array("id" => $row['products_id'], "image" => $row['products_image'], "price" => $row['products_price'], "price_old" => $row['products_price_old'], "model" => $row['products_model'], "stars" => $row['stars']);
}
foreach ($cat as $key => $value) {
    echo '<div style="clear:both;"></div>';
    $total_prods = 0;
    $total_disc = 0;
    $content = '<div style="margin:0 auto 20px auto;">';
    foreach ($value as $list) {
        $content .= '<div id="' . $list['id'] . '" style="float:left; border:solid 1px #ccc; text-align:center; margin:5px; background:#fff; width:170; height:250;" class="ui-corner-all">';
        $images = webImage($list['image'], 150, 150);
        $price = displayCurrency('EUR', $list['price']);
        $price_old = displayCurrency('EUR', $list['price_old']);
        $stars = $class_pm->getDisplayStars($list['id'], $list['stars']);
        $total_prods++;
        $content .= '<div>' . $images . '</div>';
        $content .= '<div>' . $stars . '</div>';
        $content .= '<div>' . $list['id'] . " / " . $list['model'] . '</div>';
        if ($price_old > 0) {
            $total_disc++;
            $content .= '<div class="notice deleted">' . $price_old . '</div>';
            $content .= '<div class="red">' . $price . '</div>';
        } else {
            $content .= '<div>' . $price . '</div>';
        }
        $content .= '</div>';
    }
    $title = '<div style="margin:10px;"><h2>' . $key . ' - ' . $total_disc . ' / ' . $total_prods . ' products is discounted.</h2></div>';
 $t['c'] .= '<br /><a href="?open=order&amp;id=' . $row['orders_id'] . '" target="_blank" title="View Order Detail">' . $row['orders_no'] . '</a>';
 //$t['o'] = '<a href="?open=order&amp;id='.$row['orders_id'].'" target="_blank" title="View Order Detail">'.$row['orders_no'].'</a>';
 $bank_name = $row['banktransfer_bankname'];
 $max_bank_chars = 40;
 if (strlen($bank_name) > $max_bank_chars) {
     $bank_name = substr($bank_name, 0, $max_bank_chars - 3) . '...';
 }
 $bank_info = array();
 $bank_info[] = 'No: ' . $row['banktransfer_number'];
 $bank_info[] = '<strong>Owner: ' . $row['banktransfer_owner'] . '</strong>';
 $bank_info[] = 'Bank: ' . $bank_name;
 $t['i'] = implode('<br />', $bank_info);
 $t['p'] = displayCurrency($row['currency'], $row['total_value']);
 $t['p'] .= '<br /><span class="red">+' . displayCurrency($row['currency'], $row['additional_charge']) . '</span>';
 //$t['p1'] = displayCurrency($row['currency'], $row['additional_charge']);
 $t['p2'] = '<strong>' . displayCurrency($row['currency'], $row['repayment_amount']) . '</strong>';
 $payment_status = '<div class="';
 switch ($row['repayment_status']) {
     case 'P':
         $payment_status .= 'green">Paid';
         break;
     case 'N':
         $payment_status .= 'red">Unpaid';
         break;
     case 'X':
         $payment_status .= 'red bold">Not Paid';
         break;
 }
 $payment_status .= '</div>';
 $t['s'] = $payment_status;
 $table[] = $t;
Example #29
0
/**
 * This function is to calculate total price, average price of product category in collection.
 * @param string $products_id must be separated by ","
 * @return string Formatted Table.
 */
function drawOutlinePlan($products_id)
{
    if ($products_id == '') {
        return '<h3 class="red">No Products found to generate Outline Plan</h3>';
    }
    $query = "SELECT cd.categories_name, COUNT(p.products_id) as total_qty, p.products_price FROM products p";
    $query .= " LEFT JOIN products_to_categories ptc ON ptc.products_id=p.products_id";
    $query .= " LEFT JOIN categories_description cd ON cd.categories_id=ptc.categories_id AND cd.language_id='1'";
    $query .= " WHERE p.products_id IN ({$products_id})";
    $query .= " GROUP BY p.products_price, ptc.categories_id";
    $query .= " ORDER BY ptc.categories_id, p.products_price ASC";
    $query_result = tep_db_query($query);
    while ($row = tep_db_fetch_array($query_result)) {
        $cat[$row['categories_name']][] = array("price" => $row['products_price'], "total_qty" => $row['total_qty']);
    }
    $i = 0;
    foreach ($cat as $key => $value) {
        $i++;
        $draw .= '<div style="float:left;margin:7px;">';
        $draw .= '<table border="1" style="width:200px;">';
        $total_pieces = 0;
        $averages_price = 0;
        $total_price = 0;
        $draw .= '<tr>';
        $draw .= '<th style="font-weight:bold;">Price ' . $key . '</th>';
        $draw .= '<th style="font-weight:bold;">Pieces</th>';
        //$draw .= '<th style="font-weight:bold;">Total Price</th>';
        $draw .= '</tr>';
        foreach ($value as $list) {
            $total_pieces += $list['total_qty'];
            $total_pieces += $prod_count;
            $price = $list['price'] * $list['total_qty'];
            $total_price += $price;
            $draw .= '<tr>';
            $draw .= '<td>' . displayCurrency('EUR', $list['price']) . '</td>';
            $draw .= '<td>' . $list['total_qty'] . '</td>';
            //$draw .= '<td>'.displayCurrency('EUR', $price).'</td>';
            $draw .= '</tr>';
        }
        $draw .= '<tr>';
        $draw .= '<th style="font-weight:bold;">Total</th>';
        $draw .= '<td>' . $total_pieces . '</td>';
        $draw .= '</tr>';
        $draw .= '<tr>';
        $averages_price = $total_price / $total_pieces;
        $draw .= '<th style="font-weight:bold;">Average Price</th>';
        $draw .= '<td>' . displayCurrency('EUR', $averages_price) . '</td>';
        $draw .= '</tr>';
        $grand_total_pieces += $total_pieces;
        $grand_total_prices += $total_price;
        $draw .= '</table>';
        $draw .= '</div>';
        if ($i % 3 == 0) {
            $draw .= '<div style="clear:both;"></div>';
        }
    }
    $grand_average_prices = $grand_total_prices / $grand_total_pieces;
    $draw .= '<div style="clear:both;"></div>';
    $draw .= '<div style="float:left;margin:7px;">';
    $draw .= '<table border="1" style="width:200px;">';
    $draw .= '<tr>';
    $draw .= '<th style="font-weight:bold;">Product Category</th>';
    $draw .= '<th style="font-weight:bold;">No. Products</th>';
    $draw .= '</tr>';
    foreach ($cat as $key => $value) {
        $total_pieces = 0;
        $draw .= '<tr>';
        $draw .= '<td>' . $key . '</td>';
        foreach ($value as $list) {
            $total_pieces += $list['total_qty'];
        }
        $draw .= '<td>' . $total_pieces . '</td>';
        $draw .= '</tr>';
    }
    $draw .= '<tr>';
    $draw .= '<th style="font-weight:bold;">Total</th>';
    $draw .= '<td>' . $grand_total_pieces . '</td>';
    $draw .= '</th>';
    $draw .= '</table>';
    $draw .= '</div>';
    $draw .= '<div style="float:left;margin:7px;">';
    $draw .= '<table border="1">';
    $draw .= '<tr>';
    $draw .= '<th style="font-weight:bold;">TOTAL AVG PRICE</th>';
    $draw .= '<td>' . displayCurrency('EUR', $grand_average_prices) . '</td>';
    $draw .= '</tr>';
    $draw .= '</table>';
    $draw .= '</div>';
    $draw .= '<div style="clear:both;"></div>';
    return $draw;
}
 function postProcess($post_vars)
 {
     global $session_userinfo;
     $result = array();
     if ($post_vars['me_action'] == 'SEARCH') {
         $type = $post_vars['type'];
         $jng_sp_id = $post_vars['jng_sp_id'];
         //another strange case, in live datepicker filter is always given as \'datevalue\' instead of 'datevalue'
         //still cant find the root cause (and it's ok in local dev), so for quickwin workaround we simple replace
         //the \' value into ' with below update (sahat 11.02.2014)
         //$post_filters = explode("|", $post_vars['post_filters']);
         $post_filters = explode("|", str_replace('\\\'', "'", $post_vars['post_filters']));
         $filters = array();
         foreach ($post_filters as $f) {
             $f_temp = explode('-', $f);
             $field = $f_temp[0];
             unset($f_temp[0]);
             $value = implode('-', $f_temp);
             //explode to array for input on field $multivalue_fields which allowed multivalue separated by $multivalue_separator
             if (in_array($field, $this->multivalue_fields)) {
                 $mv_temp = explode(current($this->multivalue_separator), $value);
                 if (is_array($mv_temp) && $mv_temp > 0) {
                     foreach ($mv_temp as $mv) {
                         $mv = trim($mv);
                         if (!isset($filters[$field]) || !in_array($mv, $filters[$field])) {
                             $filters[$field][] = $mv;
                         }
                     }
                 } else {
                     $filters[$field][] = $value;
                 }
             } else {
                 $filters[$field][] = $value;
             }
         }
         $query = $this->constructQuery($jng_sp_id, $filters);
         $dbq = tep_db_query($query);
         $result = '';
         $total = 0;
         $elements_ids = '';
         //$display_spot = '';
         while ($r = tep_db_fetch_array($dbq)) {
             $total++;
             if ($total > 1) {
                 $elements_ids .= ',';
             }
             $elements_ids .= $r['elements_id'];
             //                $display_spot .= '<div id="'.$r['elements_id'].'" class="lists-elements"></div>';
         }
         $result['type'] = $type;
         $result['total'] = $total;
         $result['elements_ids'] = $elements_ids;
         //            $result['display_spot'] = $display_spot;
         ajaxReturn($result);
     } elseif ($post_vars['me_action'] == 'DISPLAY') {
         $type = $post_vars['type'];
         $elements_id = $post_vars['elements_id'];
         $query = "SELECT e.elements_id, e.elements_code, e.elements_name, e.elements_image, e.elements_price, e.add_date, IFNULL(e.elements_weight,'-') elements_weight, e.stars, e.elements_description";
         $query .= ", IFNULL(esup.suppliers_name,'-') suppliers_name";
         $query .= ", el.used_in_products, IFNULL(el.weekly_sold, '-') weekly_sold, IFNULL(el.weekly_sold_products, '-') weekly_sold_products, IFNULL(el.sold_monthly_1, '-') last_month_sold";
         $query .= ", (IFNULL(els.sold_{$this->last_year}_sp, 0) + IFNULL(els.sold_{$this->last_year}_jg, 0)) sold_{$this->last_year}";
         $query .= ", (IFNULL(els.sold_products_{$this->last_year}_sp, 0) + IFNULL(els.sold_products_{$this->last_year}_jg, 0)) sold_products_{$this->last_year}";
         $query .= ", ec.name AS cat_name, pm.material_name AS mat_name, cpd.name AS color_name, ei.name AS size_name, eh.name AS holesize_name";
         $query .= ", es.name AS shape_name, es.shape_image, eu.name AS surface_name, eu.surface_image, et.name AS cut_name, et.cuts_image AS cut_image";
         $query .= ", ehe.name AS height_name, ew.name AS width_name, eth.name AS thickness_name, est.stock";
         $query .= ", DATEDIFF(NOW(), e.add_date) AS elements_age";
         $query .= " FROM element e";
         $query .= " LEFT JOIN elements_log el ON el.elements_id=e.elements_id";
         $query .= " LEFT JOIN elements_log_static els ON els.elements_id=e.elements_id";
         $query .= " LEFT JOIN elements_to_elements_suppliers etes ON etes.elements_id = e.elements_id AND is_default = 1";
         $query .= " LEFT JOIN elements_suppliers esup ON esup.elements_suppliers_id = etes.elements_suppliers_id";
         $query .= " LEFT JOIN elements_stock est ON est.elements_id = e.elements_id AND est.jng_warehouses_id = " . WAREHOUSE_ID_ELEMENTS;
         $query .= " LEFT JOIN element_category ec ON ec.element_category_id=e.attribute_category_id";
         $query .= " LEFT JOIN products_materials pm ON pm.products_materials_id=e.attribute_material_id";
         $query .= " LEFT JOIN color_pattern cp ON cp.color_pattern_id=e.attribute_color_id";
         $query .= " LEFT JOIN color_pattern_description cpd ON cpd.color_pattern_id=e.attribute_color_id AND languages_id=1";
         $query .= " LEFT JOIN element_size ei ON ei.element_size_id=e.attribute_size_id";
         $query .= " LEFT JOIN element_holesize eh ON eh.element_holesize_id=e.attribute_holesize_id";
         $query .= " LEFT JOIN element_shape es ON es.element_shape_id=e.attribute_shape_id";
         $query .= " LEFT JOIN element_surface eu ON eu.element_surface_id=e.attribute_surface_id";
         $query .= " LEFT JOIN element_cut et ON et.element_cut_id=e.attribute_cut_id";
         $query .= " LEFT JOIN element_height ehe ON ehe.element_height_id=e.attribute_height_id";
         $query .= " LEFT JOIN element_width ew ON ew.element_width_id=e.attribute_width_id";
         $query .= " LEFT JOIN element_thickness eth ON eth.element_thickness_id=e.attribute_thickness_id";
         $query .= " WHERE e.elements_id = '{$elements_id}'";
         $dbq = tep_db_query($query);
         $res = tep_db_fetch_array($dbq);
         $elements_image = webImageWithDetailLink($res['elements_image'], IMAGE_SIZE_THUMBNAIL_1, IMAGE_SIZE_THUMBNAIL_1, 'Element ' . $res['elements_id'], 'img-border');
         $elements_created = date('d-M-Y', strtotime($res['add_date']));
         $elements_price = $res['elements_price'] < ELEMENTS_LOWER_PRICE ? displayCurrency('EUR', $res['elements_price'], true, 5) : displayCurrency('EUR', $res['elements_price']);
         $resultsdt = array();
         //0-4
         $resultsdt[] = $elements_id;
         $resultsdt[] = $elements_image;
         //$resultsdt[] = $res['elements_name'];
         $resultsdt[] = $res['elements_description'];
         $resultsdt[] = $elements_created;
         $resultsdt[] = $elements_price;
         //5-9
         $resultsdt[] = $res['suppliers_name'];
         $resultsdt[] = $res['weekly_sold'];
         $resultsdt[] = $res['weekly_sold_products'];
         $resultsdt[] = $res['sold_' . $this->last_year];
         $resultsdt[] = $res['sold_products_' . $this->last_year];
         //10-14'd
         $resultsdt[] = $res['elements_weight'];
         $resultsdt[] = $res['last_month_sold'];
         $resultsdt[] = $res['stock'];
         $resultsdt[] = drawStars($res['stars']);
         $resultsdt[] = $res['elements_age'];
         $result['type'] = $type;
         $result['result'] = implode($this->result_separator, $resultsdt);
         ajaxReturn($result);
     } elseif ($post_vars['me_action'] == 'KILLELEMENT') {
         use_class('element');
         $elid = tep_db_prepare_input($_POST['elid']);
         $element = new element($elid);
         $is_deleted = $element->delete($session_userinfo['username']);
         $result = array();
         $result['target_id'] = $elid;
         $result['is_deleted'] = $is_deleted;
         ajaxReturn($result);
     }
 }