function search_show($VAR) { $type = "search"; $this->method["{$type}"] = explode(",", $this->method["{$type}"]); $db = new CORE_database(); $db->search_show($VAR, $this, $type); }
function search_show($VAR) { $this->construct(); $type = "search"; $this->method["{$type}"] = split(",", $this->method["{$type}"]); $db = new CORE_database(); $db->search_show($VAR, $this, $type); }
function user_search_show($VAR) { # Lock the user only for his billing_records: if (!SESS_LOGGED) { return false; } $this->construct(); $type = "search"; $this->method["{$type}"] = explode(",", $this->method["{$type}"]); $db = new CORE_database(); $db->search_show($VAR, $this, $type); }
function search_show($VAR) { $this->static_page_category_construct(); $type = "search"; $this->method["{$type}"] = explode(",", $this->method["{$type}"]); $db = new CORE_database(); $db->search_show($VAR, $this, $type); }
function search_show($VAR) { if (SESS_LOGGED) { include_once PATH_MODULES . "voip/voip.inc.php"; $db =& DB(); $v = new voip(); $fdids = $v->get_fax_dids(SESS_ACCOUNT); #echo "<pre>".print_r($fdids,true)."</pre>"; if (is_array($fdids)) { foreach ($fdids as $did) { $sql = "UPDATE " . AGILE_DB_PREFIX . "voip_fax SET \n\t\t\t\t\t\taccount_id\t\t= " . $db->qstr(SESS_ACCOUNT) . ", \n\t\t\t\t\t\tsite_id\t\t\t= " . $db->qstr(DEFAULT_SITE) . " \n\t\t\t\t\t\tWHERE dst = " . $db->qstr($did); $db->Execute($sql); #echo "did=$did ".$sql."<br>"; } } unset($db); } $type = "search"; $this->method["{$type}"] = split(",", $this->method["{$type}"]); $db = new CORE_database(); $db->search_show($VAR, $this, $type); }
function search_show($VAR) { $this->discount_construct(); $type = "search"; $this->method["{$type}"] = split(",", $this->method["{$type}"]); $dbc = new CORE_database(); $smart = $dbc->search_show($VAR, $this, $type); $db =& DB(); for ($i = 0; $i < count($smart); $i++) { $smart[$i]['savings'] = 0; $smart[$i]['orders'] = 0; $smart[$i]['revenue'] = 0; $rs = $db->Execute($sql = sqlSelect($db, array("invoice", "invoice_item_discount"), "SUM(A.total_amt) as sum", "B.invoice_id=A.id AND A.billing_status=1 AND B.discount=::{$smart[$i]['name']}::", "", "", "DISTINCT")); if ($rs && $rs->RecordCount()) { $smart[$i]['revenue'] = $rs->fields['sum']; } $rs = $db->Execute(sqlSelect($db, 'invoice_item_discount', 'invoice_id,amount', "discount=::{$smart[$i]['name']}::")); if ($rs && $rs->RecordCount() > 0) { while (!$rs->EOF) { $smart[$i]['savings'] += $rs->fields['amount']; if (empty($invoices[$rs->fields['invoice_id']])) { $smart[$i]['orders']++; $invoices[$rs->fields['invoice_id']] = true; } $rs->MoveNext(); } } } global $smarty; $smarty->clear_assign('discount'); $smarty->assign('discount', $smart); }
function search_show($VAR) { $type = "search"; $this->method["{$type}"] = explode(",", $this->method["{$type}"]); $db = new CORE_database(); $smart = $db->search_show($VAR, $this, $type); for ($i = 0; $i < count($smart); $i++) { # Get the stats for each advertisement: $budget = $smart[$i]['budget']; # Invoices referred $inv = $this->referred_invoices($smart[$i]['id']); $smart[$i]['invoices_referred'] = $inv[0]; $smart[$i]['invoices_revenue'] = $inv[1]; @($smart[$i]['invoice_avg'] = $inv[1] / $inv[0]); # total impressions & clicks: $impressions_total = 0; $clicks_total = 0; for ($ii = 1; $ii <= 12; $ii++) { $impressions_total += $smart[$i]["served" . $ii]; $clicks_total += $smart[$i]["clicked" . $ii]; if (empty($smart[$i]["served" . $ii]) && empty($smart[$i]["served" . $ii]) && empty($smart[$i]["served" . $ii])) { $smart[$i]["show" . $ii] = false; } else { $smart[$i]["show" . $ii] = true; } } $smart[$i]['impressions_total'] = $impressions_total; $smart[$i]['clicks_total'] = $clicks_total; # Impr. percentage, Clicks percentage, CTR $ctr_count = 0; $ctr_amt = 0; for ($ii = 1; $ii <= 12; $ii++) { # CTR if ($smart[$i]["show" . $ii]) { $ctr = $smart[$i]["clicked" . $ii] / $smart[$i]["served" . $ii] * 100; if ($ctr < 0) { $smart[$i]['ctr' . $ii] = round($ctr) . '%'; } else { $smart[$i]['ctr' . $ii] = round($ctr, 1) . '%'; } $ctr_count++; $ctr_amt += $ctr; } else { $smart[$i]['ctr' . $ii] = "0%"; $ctr_count++; } } # CTR Avg: if ($ctr_count > 0) { $smart[$i]['ctr_avg'] = round($ctr_amt / $ctr_count, 2) . '%'; } else { $smart[$i]['ctr_avg'] = "0%"; } # CPC Avg: if ($clicks_total > 0) { $cpc_avg = $budget / $clicks_total; if ($cpc_avg < 0.1) { $smart[$i]['cpc_avg'] = round($cpc_avg, 3); } else { $smart[$i]['cpc_avg'] = round($cpc_avg, 2); } } else { $smart[$i]['cpc_avg'] = 0; } # CPI Avg: if ($impressions_total > 0) { $cpi_avg = $budget / $impressions_total; if ($cpi_avg < 0.1) { $smart[$i]['cpi_avg'] = round($cpi_avg, 3); } else { $smart[$i]['cpi_avg'] = round($cpi_avg, 2); } } else { $smart[$i]['cpi_avg'] = 0; } # Cost per Conversion: if ($inv[0] > 0 && $budget > 0) { $smart[$i]['conversion_cost'] = round($budget / $inv[0], 2); } else { $smart[$i]['conversion_cost'] = 0; } # ROI if ($inv[0] > 0 && $budget > 0) { $smart[$i]['roi'] = round($inv[1] / $budget * 100) . '%'; } else { $smart[$i]['roi'] = '---'; } } global $smarty; $smarty->assign('campaign', $smart); }
/** USER SEARCH SHOW */ function user_search_show($VAR) { if (!SESS_LOGGED) { return false; } $this->invoice_construct(); $type = "search"; $this->method["{$type}"] = explode(",", $this->method["{$type}"]); $db = new CORE_database(); $db->search_show($VAR, $this, $type); }