$(ui.panel).find(".kpi-infobox .ui-icon").click(function() { if($(this).hasClass("ui-icon-minus")) { $(".kpi-infobox .ibox").fadeOut(fadeSpeed); $(this).removeClass("ui-icon-minus"); $(this).addClass("ui-icon-info"); } else { $(".kpi-infobox .ibox").fadeIn(fadeSpeed); $(this).removeClass("ui-icon-info"); $(this).addClass("ui-icon-minus"); } }); applyFancyBox(ui.panel); Manobo.attachBehaviors(ui.panel); if(ui.index==0) { //MANOBO WALL ' . wall::drawWallJSaction() . ' var total_nots_nfb = parseInt($("#nots-nfb").text()); manoboWallNeedFeedbackBanner(total_nots_nfb); $("#mw-nots-nfb").click(openSubMenuNotifications); $("#recent-bought").html(img_ajax_load_1); getNewProduct(); } else if(ui.index==2) { $("#btn-show-kpi-graph").click(function(){ window.open("?open=kpi-designs&hidemenu=true&fs=true", "", "location=1"); }); //KPI DESIGNS datafilekpidesign = "charts/kpi-designs.php?date_id="+$("#kpidesign").val(); loadKPIGraph(datafilekpidesign, "kpi-design-content", "600", "400"); kpi_graph_now_loaded = "kpi-design-content"; } else if(ui.index==3) { //KPI DEPOT
//last month $date_start = date('Y-m-01', strtotime('last month')); $date_end = date('Y-m-t', strtotime('last month')); $daily_data = ReportCOGS::retrieveSummary($jng_sp_id, $date_start, $date_end); $sales_lm = displayCurrency(CURRENCY_DEFAULT, $daily_data['total_price'], false); $grossprofit_lm = number_format($daily_data['average_gross_profit_percent'] * 100, 1) . ' %'; //bestseller $q = "SELECT COUNT(products_id) AS total FROM products WHERE active_status=1 AND stars=3"; $r = tep_db_query($q); $row = tep_db_fetch_array($r); $total_bestseller = $row['total']; //Draw content $wall = new wall('0'); $content .= '<div id="dashboard">' . '<div id="db-block-left" style="position:absolute;">' . '<div id="db-block-sales" style="margin-bottom:40px">' . '<h2>Sales Summary (' . CURRENCY_DEFAULT . ')</h2>' . '<ul class="table-list">' . '<li><span class="label">Yesterday</span><span class="value">' . $sales_ld . '</span></li>' . '<li><span class="label">Last Week</span><span class="value">' . $sales_lw . '</span></li>' . '<li><span class="label">Last Month</span><span class="value">' . $sales_lm . '</span></li>' . '</ul>' . '</div>' . '<div id="db-block-grossprofit" style="margin-bottom:40px">' . '<h2>Gross Profit Margin</h2>' . '<ul class="table-list">' . '<li><span class="label">Yesterday</span><span class="value">' . $grossprofit_ld . '</span></li>' . '<li><span class="label">Last Week</span><span class="value">' . $grossprofit_lw . '</span></li>' . '<li><span class="label">Last Month</span><span class="value">' . $grossprofit_lm . '</span></li>' . '</ul>' . '</div>' . '<div id="db-block-bestseller" style="margin-bottom:40px">' . '<h2>Bestseller Management</h2>' . '<ul class="table-list">' . '<li><span class="value" style="">' . $total_bestseller . '</span><span class="label">Total 3 stars products</span></li>' . '<li><span class="value" title="coming soon!">NA</span><span class="label">Bestseller not on stock</span></li>' . '</ul>' . '</div>' . '</div>' . '<div id="db-block-middle" style="position:absolute;left:320px;margin-bottom:20px;">' . '<h1>News</h1>' . $wall->draw(2, 'width:500px;margin-bottom:20px;', true, 'Share something new...') . '</div>' . '<div id="db-block-right" class="w500" style="position:absolute;left:870px;">' . '<h2>Recent Orders</h2>' . '<div id="recent-bought"></div>' . '</div>' . '</div>'; #dashboard $javascript = wall::drawWallJSaction() . ' var recent_bought_firstload = true; function compareProduct(xmlResult, txtStatus) { if(txtStatus=="success") { recent_bought_firstload = false; var container_is_empty = ($("#recent-bought").find("div:eq(0)").attr("id")==undefined); var products_id = $("products_id", xmlResult).text(); if(products_id=="none") { if(container_is_empty) $("#recent-bought").html("<div id=\'rb-empty\' class=\'notice\'>No Recent Orders found</div>"); } else { products_id = products_id.split(","); $("#rb-empty").remove(); if(container_is_empty) { $("#recent-bought").find("img").remove(); for(x in products_id) $("#recent-bought").prepend($("img-"+products_id[x], xmlResult).text()); } else {