Example #1
0
 /**
  * Shortcode callback function to output a currency symbol.
  *
  * @uses get_currency()
  *
  * @since 1.4.0
  *
  * @param  array  $atts	Shortcode attributes.
  * @return string HTML entity of the symbol of the specified currency code.
  */
 public function currency_symbol_shortcode($atts)
 {
     $args = shortcode_atts(array('currency' => ''), $atts);
     // get currency data
     $currency_data = get_currency(strtoupper($args['currency']));
     $symbol = $currency_data['symbol'];
     return '<span class"currency currency-symbol">' . $symbol . '</span>';
 }
 public function getById($rest, $id)
 {
     $curr = get_currency($id);
     if (!$curr) {
         $curr = array();
     }
     api_success_response(json_encode($curr));
 }
function currencyFrom($value, $sourceCurrencyId, $format = true, $round = false)
{
    $value = myCurrency::convertFromTo($value, $sourceCurrencyId, get_currency());
    if ($round) {
        $value = round($value);
    }
    if ($format) {
        $value = currency_apply_format($value);
    }
    return $value;
}
Example #4
0
function print_price_listing()
{
    global $path_to_root, $pic_height, $pic_width;
    $currency = $_POST['PARAM_0'];
    $category = $_POST['PARAM_1'];
    $salestype = $_POST['PARAM_2'];
    $pictures = $_POST['PARAM_3'];
    $showGP = $_POST['PARAM_4'];
    $comments = $_POST['PARAM_5'];
    $orientation = $_POST['PARAM_6'];
    $destination = $_POST['PARAM_7'];
    if ($destination) {
        include_once $path_to_root . "/reporting/includes/excel_report.inc";
    } else {
        include_once $path_to_root . "/reporting/includes/pdf_report.inc";
    }
    $orientation = $orientation ? 'L' : 'P';
    $dec = user_price_dec();
    $home_curr = get_company_pref('curr_default');
    if ($currency == ALL_TEXT) {
        $currency = $home_curr;
    }
    $curr = get_currency($currency);
    $curr_sel = $currency . " - " . $curr['currency'];
    if ($category == ALL_NUMERIC) {
        $category = 0;
    }
    if ($salestype == ALL_NUMERIC) {
        $salestype = 0;
    }
    if ($category == 0) {
        $cat = _('All');
    } else {
        $cat = get_category_name($category);
    }
    if ($salestype == 0) {
        $stype = _('All');
    } else {
        $stype = get_sales_type_name($salestype);
    }
    if ($showGP == 0) {
        $GP = _('No');
    } else {
        $GP = _('Yes');
    }
    $cols = array(0, 100, 360, 385, 450, 515);
    $headers = array(_('Category/Items'), _('Description'), _('UOM'), _('Price'), _('GP %'));
    $aligns = array('left', 'left', 'left', 'right', 'right');
    $params = array(0 => $comments, 1 => array('text' => _('Currency'), 'from' => $curr_sel, 'to' => ''), 2 => array('text' => _('Category'), 'from' => $cat, 'to' => ''), 3 => array('text' => _('Sales Type'), 'from' => $stype, 'to' => ''), 4 => array('text' => _('Show GP %'), 'from' => $GP, 'to' => ''));
    if ($pictures) {
        $user_comp = user_company();
    } else {
        $user_comp = "";
    }
    $rep = new FrontReport(_('Price Listing'), "PriceListing", user_pagesize(), 9, $orientation);
    if ($orientation == 'L') {
        recalculate_cols($cols);
    }
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->NewPage();
    $result = fetch_items($category);
    $catgor = '';
    $_POST['sales_type_id'] = $salestype;
    while ($myrow = db_fetch($result)) {
        if ($catgor != $myrow['description']) {
            $rep->Line($rep->row - $rep->lineHeight);
            $rep->NewLine(2);
            $rep->fontSize += 2;
            $rep->TextCol(0, 3, $myrow['category_id'] . " - " . $myrow['description']);
            $catgor = $myrow['description'];
            $rep->fontSize -= 2;
            $rep->NewLine();
        }
        $rep->NewLine();
        $rep->TextCol(0, 1, $myrow['stock_id']);
        $rep->TextCol(1, 2, $myrow['name']);
        $rep->TextCol(2, 3, $myrow['units']);
        $price = get_price($myrow['stock_id'], $currency, $salestype);
        $rep->AmountCol(3, 4, $price, $dec);
        if ($showGP) {
            $price2 = get_price($myrow['stock_id'], $home_curr, $salestype);
            if ($price2 != 0.0) {
                $disp = ($price2 - $myrow['Standardcost']) * 100 / $price2;
            } else {
                $disp = 0.0;
            }
            $rep->TextCol(4, 5, number_format2($disp, user_percent_dec()) . " %");
        }
        if ($pictures) {
            $image = company_path() . "/images/" . item_img_name($myrow['stock_id']) . ".jpg";
            if (file_exists($image)) {
                $rep->NewLine();
                if ($rep->row - $pic_height < $rep->bottomMargin) {
                    $rep->NewPage();
                }
                $rep->AddImage($image, $rep->cols[1], $rep->row - $pic_height, 0, $pic_height);
                $rep->row -= $pic_height;
                $rep->NewLine();
            }
        } else {
            $rep->NewLine(0, 1);
        }
    }
    $rep->Line($rep->row - 4);
    $result = get_kits($category);
    $catgor = '';
    while ($myrow = db_fetch($result)) {
        if ($catgor != $myrow['cat_name']) {
            if ($catgor == '') {
                $rep->NewLine(2);
                $rep->fontSize += 2;
                $rep->TextCol(0, 3, _("Sales Kits"));
                $rep->fontSize -= 2;
            }
            $rep->Line($rep->row - $rep->lineHeight);
            $rep->NewLine(2);
            $rep->fontSize += 2;
            $rep->TextCol(0, 3, $myrow['cat_id'] . " - " . $myrow['cat_name']);
            $catgor = $myrow['cat_name'];
            $rep->fontSize -= 2;
            $rep->NewLine();
        }
        $rep->NewLine();
        $rep->TextCol(0, 1, $myrow['kit_code']);
        $rep->TextCol(1, 3, $myrow['kit_name']);
        $price = get_kit_price($myrow['kit_code'], $currency, $salestype);
        $rep->AmountCol(3, 4, $price, $dec);
        $rep->NewLine(0, 1);
    }
    $rep->Line($rep->row - 4);
    $rep->NewLine();
    $rep->End();
}
 $FinanceName = "";
 $resultList = mysqli_query($connect, $queryFinancelist);
 while ($returnList = $resultList->fetch_assoc()) {
     $FinanceName .= $returnList['name'] . ",";
 }
 //이름이 없는경우 삭제해준다.
 //echo $returnList['name'];
 //$FinanceName = $returnList['name'];
 $BASE_URL = "http://query.yahooapis.com/v1/public/yql";
 $yql_query = "select * from csv where url='http://download.finance.yahoo.com/d/quotes.csv?s=";
 $yql_query .= $FinanceName;
 $yql_query .= "&f=sl1d1t1c1ohgv&e=.csv' and columns='symbol,price,date,time,change,col1,high,low,col2'";
 $yql_query_url = $BASE_URL . "?q=" . urlencode($yql_query) . "&format=xml";
 //환율
 //echo $yql_query_url."\n";
 $Currency = get_currency('USD', 'KRW');
 // $BASE_URL = "http://query.yahooapis.com/v1/public/yql";
 // $yql_query = "select * from csv where url='http://download.finance.yahoo.com/d/quotes.csv?s=005930.KS,YHOO,GOOG,IBM&f=sl1d1t1c1ohgv&e=.csv' and columns='symbol,price,date,time,change,col1,high,low,col2'";
 // $yql_query_url = $BASE_URL . "?q=" . urlencode($yql_query) . "&format=xml";
 // //환율
 //$currency_url = "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.xchange%20where%20pair%20in%20(%22USDKRW%22)&format=xml&env=store://datatables.org/alltableswithkeys&callback=";
 // Make call with cURL
 //환율
 //echo $Currency."\n";
 $response = file_get_contents($yql_query_url);
 $object = simplexml_load_string($response);
 $results = $object->results;
 $row = $results->row;
 $SymbolAndOpen = "";
 foreach ($row as $value) {
     $symbol = $value->symbol;
email_row_ex(_("Email Address:"), 'email', 25, 55);
email_row_ex(_("BCC Address for all outgoing mails:"), 'bcc_email', 25, 55);
text_row_ex(_("Official Company Number:"), 'coy_no', 25);
text_row_ex(_("GSTNo:"), 'gst_no', 25);
currencies_list_row(_("Home Currency:"), 'curr_default', $_POST['curr_default']);
fiscalyears_list_row(_("Fiscal Year:"), 'f_year', $_POST['f_year']);
text_row_ex(_("Tax Periods:"), 'tax_prd', 10, 10, '', null, null, _('Months.'));
text_row_ex(_("Tax Last Period:"), 'tax_last', 10, 10, '', null, null, _('Months back.'));
table_section(2);
label_row(_("Company Logo:"), $_POST['coy_logo']);
file_row(_("New Company Logo (.jpg)") . ":", 'pic', 'pic');
check_row(_("Delete Company Logo:"), 'del_coy_logo', $_POST['del_coy_logo']);
number_list_row(_("Use Dimensions:"), 'use_dimension', null, 0, 2);
sales_types_list_row(_("Base for auto price calculations:"), 'base_sales', $_POST['base_sales'], false, _('No base price list'));
text_row_ex(_("Add Price from Std Cost:"), 'add_pct', 10, 10, '', null, null, "%");
$curr = get_currency($_POST['curr_default']);
text_row_ex(_("Round to nearest:"), 'round_to', 10, 10, '', null, null, $curr['hundreds_name']);
label_row("", "&nbsp;");
check_row(_("Search Item List"), 'no_item_list', null);
check_row(_("Search Customer List"), 'no_customer_list', null);
check_row(_("Search Supplier List"), 'no_supplier_list', null);
label_row("", "&nbsp;");
check_row(_("Automatic Revaluation Currency Accounts"), 'auto_curr_reval', $_POST['auto_curr_reval']);
check_row(_("Time Zone on Reports"), 'time_zone', $_POST['time_zone']);
text_row_ex(_("Login Timeout:"), 'login_tout', 10, 10, '', null, null, _('seconds'));
label_row(_("Version Id"), $_POST['version_id']);
end_outer_table(1);
hidden('coy_logo', $_POST['coy_logo']);
submit_center('update', _("Update"), true, '', 'default');
end_form(2);
//-------------------------------------------------------------------------------------------------
Example #7
0
function user_login($login, $password, $user_id, $remember_me, $redirect_page, $make_redirects, &$errors)
{
    global $db, $table_prefix, $settings;
    global $site_id, $multisites_version;
    $is_errors = false;
    $secure_sessions = get_setting_value($settings, "secure_sessions", 0);
    $password_encrypt = get_setting_value($settings, "password_encrypt", 0);
    if ($password_encrypt == 1) {
        $password_match = md5($password);
    } else {
        $password_match = $password;
    }
    // prepare site urls
    $site_url = get_setting_value($settings, "site_url", "");
    $secure_url = get_setting_value($settings, "secure_url", "");
    $sql = " SELECT u.user_id, u.layout_id, u.user_type_id, u.is_approved, ";
    $sql .= " u.login, u.nickname, u.name, u.first_name, u.last_name, u.email, u.total_points, u.credit_balance, ";
    $sql .= " u.discount_type AS user_discount_type, u.discount_amount AS user_discount_amount, ";
    $sql .= " ut.discount_type AS group_discount_type, ut.discount_amount AS group_discount_amount, ";
    $sql .= " u.reward_type AS user_reward_type, u.reward_amount AS user_reward_amount, ";
    $sql .= " ut.reward_type AS group_reward_type, ut.reward_amount AS group_reward_amount, ";
    $sql .= " u.credit_reward_type AS user_credit_reward_type, u.credit_reward_amount AS user_credit_reward_amount, ";
    $sql .= " ut.credit_reward_type AS group_credit_reward_type, ut.credit_reward_amount AS group_credit_reward_amount, ";
    $sql .= " u.registration_last_step, u.registration_total_steps, ";
    $sql .= " ut.is_subscription, u.expiry_date, u.is_sms_allowed, ";
    $sql .= " u.tax_free AS user_tax_free, ut.tax_free AS group_tax_free, ";
    $sql .= " u.order_min_goods_cost AS user_min_goods, u.order_max_goods_cost AS user_max_goods, ";
    $sql .= " ut.order_min_goods_cost AS group_min_goods, ut.order_max_goods_cost AS group_max_goods, ";
    $sql .= " ut.price_type, c.currency_code, u.subscription_id ";
    $sql .= " FROM (((" . $table_prefix . "users u ";
    $sql .= " LEFT JOIN " . $table_prefix . "user_types ut ON u.user_type_id=ut.type_id) ";
    $sql .= " LEFT JOIN " . $table_prefix . "countries c ON u.country_id=c.country_id) ";
    if ($multisites_version) {
        if (isset($site_id)) {
            $sql .= " LEFT JOIN " . $table_prefix . "user_types_sites AS uts ON uts.type_id=ut.type_id)";
            $sql .= " WHERE (ut.sites_all=1 OR uts.site_id=" . $db->tosql($site_id, INTEGER, true, false) . ") AND ";
        } else {
            $sql .= ") WHERE ut.sites_all=1 AND ";
        }
    } else {
        $sql .= ") WHERE ";
    }
    if ($user_id) {
        $sql .= " u.user_id=" . $db->tosql($user_id, INTEGER);
    } else {
        $sql .= " u.login="******" AND u.password="******"user_id");
        //Customization by Vital - wishlist sync
        if ($user_id) {
            sync_wishlist($user_id);
        }
        //END Customization - wishlist sync
        $layout_id = $db->f("layout_id");
        $is_approved = $db->f("is_approved");
        $is_sms_allowed = $db->f("is_sms_allowed");
        $total_points = $db->f("total_points");
        $credit_balance = $db->f("credit_balance");
        $user_tax_free = $db->f("user_tax_free");
        $group_tax_free = $db->f("group_tax_free");
        $tax_free = $user_tax_free || $group_tax_free;
        $order_min_goods_cost = $db->f("user_min_goods");
        if (!strlen($order_min_goods_cost)) {
            $order_min_goods_cost = $db->f("group_min_goods");
        }
        $order_max_goods_cost = $db->f("user_max_goods");
        if (!strlen($order_max_goods_cost)) {
            $order_max_goods_cost = $db->f("group_max_goods");
        }
        // check account expiration date
        $expiry_date = $db->f("expiry_date", DATETIME);
        if (is_array($expiry_date)) {
            $expiry_date_ts = mktime(0, 0, 0, $expiry_date[MONTH], $expiry_date[DAY] + 1, $expiry_date[YEAR]);
        } else {
            $expiry_date_ts = $current_ts;
        }
        $user_type_id = $db->f("user_type_id");
        $is_subscription = $db->f("is_subscription");
        $registration_last_step = $db->f("registration_last_step");
        $registration_total_steps = $db->f("registration_total_steps");
        if ($registration_last_step < $registration_total_steps) {
            // if registration process wasn't finished
            set_session("session_new_user", "registration");
            set_session("session_new_user_id", $user_id);
            set_session("session_new_user_type_id", $user_type_id);
            // check secure option
            $secure_user_profile = get_setting_value($settings, "secure_user_profile", 0);
            if ($secure_user_profile || $secure_sessions) {
                $user_profile_url = $secure_url . get_custom_friendly_url("user_profile.php");
            } else {
                $user_profile_url = $site_url . get_custom_friendly_url("user_profile.php");
            }
            if ($secure_sessions) {
                session_set_cookie_params(0, "/", "", true);
                session_regenerate_id();
            }
            header("Location: " . $user_profile_url);
            exit;
        } elseif ($current_ts > $expiry_date_ts && $is_subscription) {
            // if user have to pay for subscription
            set_session("session_new_user", "expired");
            set_session("session_new_user_id", $user_id);
            set_session("session_new_user_type_id", $user_type_id);
            // add some data into session for expired user as well
            $user_info = array("tax_free" => $tax_free, "is_sms_allowed" => $is_sms_allowed, "total_points" => $total_points, "credit_balance" => $credit_balance, "order_min_goods_cost" => $order_min_goods_cost, "order_max_goods_cost" => $order_max_goods_cost);
            set_session("session_user_info", $user_info);
            include_once "./includes/shopping_cart.php";
            add_subscription($user_type_id, "", $subscription_name);
            // check secure option
            $secure_order_profile = get_setting_value($settings, "secure_order_profile", 0);
            if ($secure_order_profile || $secure_sessions) {
                $order_info_url = $secure_url . get_custom_friendly_url("order_info.php");
            } else {
                $order_info_url = $site_url . get_custom_friendly_url("order_info.php");
            }
            if ($secure_sessions) {
                session_set_cookie_params(0, "/", "", true);
                session_regenerate_id();
            }
            header("Location: " . $order_info_url);
            exit;
        } elseif ($current_ts <= $expiry_date_ts && $is_approved) {
            $login = $db->f("login");
            $nickname = $db->f("nickname");
            if (!strlen($nickname)) {
                $nickname = $login;
            }
            $email = $db->f("email");
            $currency_code = $db->f("currency_code");
            $user_discount_type = $db->f("user_discount_type");
            $user_discount_amount = $db->f("user_discount_amount");
            $group_discount_type = $db->f("group_discount_type");
            $group_discount_amount = $db->f("group_discount_amount");
            $user_reward_type = $db->f("user_reward_type");
            $user_reward_amount = $db->f("user_reward_amount");
            $group_reward_type = $db->f("group_reward_type");
            $group_reward_amount = $db->f("group_reward_amount");
            $user_credit_reward_type = $db->f("user_credit_reward_type");
            $user_credit_reward_amount = $db->f("user_credit_reward_amount");
            $group_credit_reward_type = $db->f("group_credit_reward_type");
            $group_credit_reward_amount = $db->f("group_credit_reward_amount");
            $price_type = $db->f("price_type");
            $subscription_id = $db->f("subscription_id");
            set_session("session_new_user", "");
            set_session("session_new_user_id", "");
            set_session("session_new_user_type_id", "");
            set_session("session_user_id", $user_id);
            set_session("session_user_type_id", $user_type_id);
            set_session("session_user_login", $login);
            set_session("session_subscription_id", $subscription_id);
            if (strlen($db->f("name"))) {
                $user_name = $db->f("name");
            } elseif (strlen($db->f("first_name")) || strlen($db->f("last_name"))) {
                $user_name = $db->f("first_name") . " " . $db->f("last_name");
            } else {
                $user_name = $login;
            }
            set_session("session_user_name", $user_name);
            set_session("session_user_email", $email);
            $discount_type = "";
            $discount_amount = "";
            if ($user_discount_type > 0) {
                $discount_type = $user_discount_type;
                $discount_amount = $user_discount_amount;
            } elseif ($group_discount_type) {
                $discount_type = $group_discount_type;
                $discount_amount = $group_discount_amount;
            }
            set_session("session_discount_type", $discount_type);
            set_session("session_discount_amount", $discount_amount);
            set_session("session_price_type", $price_type);
            $reward_type = "";
            $reward_amount = "";
            if ($user_reward_type > 0) {
                $reward_type = $user_reward_type;
                $reward_amount = $user_reward_amount;
            } elseif ($group_reward_type) {
                $reward_type = $group_reward_type;
                $reward_amount = $group_reward_amount;
            }
            $credit_reward_type = "";
            $credit_reward_amount = "";
            if ($user_credit_reward_type > 0) {
                $credit_reward_type = $user_credit_reward_type;
                $credit_reward_amount = $user_credit_reward_amount;
            } elseif ($group_credit_reward_type) {
                $credit_reward_type = $group_credit_reward_type;
                $credit_reward_amount = $group_credit_reward_amount;
            }
            // check for subscriptions
            $subscriptions_ids = "";
            $check_date_ts = mktime(0, 0, 0, $current_date[MONTH], $current_date[DAY], $current_date[YEAR]);
            $sql = " SELECT subscription_id ";
            $sql .= " FROM " . $table_prefix . "orders_items ";
            $sql .= " WHERE user_id=" . $db->tosql($user_id, INTEGER);
            $sql .= " AND is_subscription=1 ";
            $sql .= " AND subscription_expiry_date>=" . $db->tosql($check_date_ts, DATETIME);
            $db->query($sql);
            while ($db->next_record()) {
                if ($subscriptions_ids) {
                    $subscriptions_ids .= ",";
                }
                $subscriptions_ids .= $db->f("subscription_id");
            }
            set_session("session_subscriptions_ids", $subscriptions_ids);
            $user_info = array("user_id" => $user_id, "user_type_id" => $user_type_id, "layout_id" => $layout_id, "login" => $login, "nickname" => $nickname, "name" => $user_name, "subscriptions_ids" => $subscriptions_ids, "email" => $email, "discount_type" => $discount_type, "discount_amount" => $discount_amount, "price_type" => $price_type, "tax_free" => $tax_free, "is_sms_allowed" => $is_sms_allowed, "reward_type" => $reward_type, "reward_amount" => $reward_amount, "credit_reward_type" => $credit_reward_type, "credit_reward_amount" => $credit_reward_amount, "total_points" => $total_points, "credit_balance" => $credit_balance, "order_min_goods_cost" => $order_min_goods_cost, "order_max_goods_cost" => $order_max_goods_cost);
            set_session("session_user_info", $user_info);
            if ($remember_me && $login && $password) {
                setcookie("cookie_user_login", $login, va_timestamp() + 3600 * 24 * 366);
                setcookie("cookie_user_password", $password, va_timestamp() + 3600 * 24 * 366);
            }
            // get currency if available
            if ($currency_code) {
                get_currency($currency_code);
            }
            // update shopping cart if it's available
            $shopping_cart = get_session("shopping_cart");
            if (is_array($shopping_cart) && sizeof($shopping_cart) > 0) {
                include_once "./includes/shopping_cart.php";
                recalculate_shopping_cart();
                // check if any coupons can be added or removed
                check_coupons();
            }
            // check if need to regenerate session id for secure session
            if ($secure_sessions) {
                session_set_cookie_params(0, "/", "", true);
                session_regenerate_id();
            }
            // update last visit time
            $sql = " UPDATE " . $table_prefix . "users SET last_visit_date=" . $db->tosql(va_time(), DATETIME);
            $sql .= ", last_visit_ip=" . $db->tosql(get_ip(), TEXT);
            $sql .= ", last_visit_page=" . $db->tosql(get_request_uri(), TEXT);
            $sql .= ", last_logged_date=" . $db->tosql(va_time(), DATETIME);
            $sql .= ", last_logged_ip=" . $db->tosql(get_ip(), TEXT);
            $sql .= " WHERE user_id=" . $db->tosql($user_id, INTEGER);
            $db->query($sql);
            if ($make_redirects && $redirect_page) {
                // convert redirect page to the full url
                $ssl = get_param("ssl");
                if ($ssl) {
                    $page_site_url = $secure_url;
                } else {
                    $page_site_url = $site_url;
                }
                $return_page = get_request_uri();
                if (!preg_match("/^https?:\\/\\//i", $redirect_page) && preg_match("/^https?:\\/\\/[^\\/]+(\\/.*)\$/i", $page_site_url, $matches)) {
                    $page_path_regexp = prepare_regexp($matches[1]);
                    if (preg_match("/^" . $page_path_regexp . "/i", $redirect_page)) {
                        $redirect_page = $page_site_url . preg_replace("/^" . $page_path_regexp . "/i", "", $redirect_page);
                    }
                }
                header("Location: " . $redirect_page);
                exit;
            }
        } elseif ($current_ts > $expiry_date_ts) {
            $is_errors = true;
            $errors .= ACCOUNT_EXPIRED_MSG . "<br>";
        } else {
            $is_errors = true;
            $errors .= ACCOUNT_APPROVE_ERROR . "<br>";
        }
    } else {
        $is_errors = true;
        if ($user_id) {
            $errors .= NO_RECORDS_MSG . "<br>";
        } else {
            $errors .= LOGIN_PASSWORD_ERROR . "<br>";
        }
    }
    if ($is_errors) {
        setcookie("cookie_user_login");
        setcookie("cookie_user_password");
    }
    return !$is_errors;
}
Example #8
0
<?php

userLoginCheck();
if (!tep_session_is_registered('payee_account') && tep_not_null($payee_account)) {
    tep_redirect(get_href_link(PAGE_TRANSFER));
}
//bof: get currencies
$currency = get_currency($checkout_currency);
$balance = get_currency_value_format($checkout_amount, $currency);
$transfer_info['fees_text'] = get_currency_value_format($fees, $currency);
$smarty->assign('amount', $balance);
$smarty->assign('fees_text', $fees_text);
$smarty->assign('success_url', $success_url);
$smarty->assign('fail_url', $fail_url);
$smarty->assign('cancel_url', $cancel_url);
$smarty->assign('status_url', $status_url);
$smarty->assign('extra_fields', $extra_fields);
$smarty->assign('to_acount', $payee_account);
//eof: get currencies
$sql_user = "******" . _TABLE_USERS . " WHERE account_number='" . $payee_account . "'";
$user_query = db_query($sql_user);
if (db_num_rows($user_query) == 0) {
    tep_redirect(get_href_link(PAGE_TRANSFER));
}
$user_to_info = db_fetch_array($user_query);
$smarty->assign('user_to_info', $user_to_info);
$stepValue = 'confirm';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $master_key = db_prepare_input($_POST['master_key']);
    $memo = db_prepare_input($_POST['transaction_memo']);
    $sql_check = "SELECT account_name, firstname, lastname FROM " . _TABLE_USERS . " WHERE user_id='" . $login_userid . "' and account_number='" . $login_account_number . "' and master_key='" . $master_key . "'";
Example #9
0
     } else {
         $object->addSoftkey('9', Aastra_get_label('Back', $language), $XML_SERVER . '&action=favorites&selection=' . $selection);
         $object->addSoftkey('10', Aastra_get_label('Exit', $language), 'SoftKey:Exit');
     }
     break;
     # Display result
 # Display result
 case 'display':
 case 'displayfav':
     # Retrieve quote
     if ($action == 'display') {
         $array[0] = $data['last'];
     } else {
         $array[0] = $data['favorites'][$selection];
     }
     $return = get_currency($array);
     # Return OK
     if ($return[0]) {
         # Create the object
         $object = new AastraIPPhoneFormattedTextScreen();
         # Display results
         if ($nb_softkeys == 6) {
             # Regular phone
             if ($action == 'display') {
                 $object->addLine($data['last']['source'] . ' to ' . $data['last']['target'], NULL, 'center');
             } else {
                 $object->addLine($data['favorites'][$selection]['source'] . ' to ' . $data['favorites'][$selection]['target'], NULL, 'center');
             }
             $object->setScrollStart(Aastra_size_formattedtextscreen() - 1);
             $nb_carac = Aastra_size_display_line();
             $object->addLine('');
        }
    }
}
$cmp = 100;
if ($cmp) {
    ?>
							<div class="cmp_div">
								<a id="tool_tip_design" class="tooltip_product_cmp" title="<?php 
    _e('Current Market Price. But we can give you more lower price if CIQ( Current Interest Quantity )  is higher', TEXTDOMAIN);
    ?>
" >
									<span style="font-weight:bold;">
									<div style="text-align:center;">
										<input class="btn btn-default button button-medium exclusive"  type="button" name="add_to_cart_interest" value="<?php 
    _e('CMP: ', TEXTDOMAIN);
    echo $cmp . "&nbsp;" . get_currency();
    ?>
" >
									</div>
								</a>
							</div>
							<?php 
}
?>
						<!--<div class="clear"> </div>-->
						<?php 
if (sizeof($product_interest_validation_errors->get_error_messages()) <= 0 && empty($product_interest_id)) {
    $today_date = date('Y-m-d');
    if (!$my_interest_meta_data[0]->asa_price_is_reasonable) {
        $interest_start_date_deafult = date('Y-m-d', strtotime($today_date . ' + 14 days'));
    }
Example #11
0
<?php

defined('CAFE') or die(header('Location: /'));
check_error();
// Добавление валюты
if ($_POST['add']) {
    $data = array('title' => $_POST['title'], 'code' => $_POST['code'], 'currency' => $_POST['currency'], 'period' => $_POST['period'], 'cur_date' => $date, 'nominal' => $nominal, 'rate' => $rate);
    $add_currency = $db->query("INSERT INTO " . DB_PREFIX . "_currency SET ?u", $data);
    if ($add_currency) {
        $message = 'Валюта добавлена';
    } else {
        $error = 'Возникла ошибка при добавлении валюты';
    }
}
// удаление валюты
if ($_GET['action'] == 'delete' && empty($error)) {
    terminator();
}
if ($_GET['action'] == 'add') {
    $tpl = "currency_add_tpl.php";
}
if ($_GET['action'] == 'list') {
    if ($_GET['id']) {
        get_currency($_GET['id']);
    }
    $limit = '10';
    $currency_list = get_currency_list($limit);
    $tpl = "currency_list_tpl.php";
}
include "currency_main_tpl.php";
        /** Author: ABU TAHER, Logic-coder IT
         * send_email_to_interest_confirmed
         * Param $email_data, $interest_confirmed_details
         * return Success/Failure Message
         */
        public function send_email_to_interest_confirmed($email_data, $interest_confirmed_details, $deal_selection)
        {
            global $wpdb, $current_user;
            $current_user = wp_get_current_user();
            $dear_text = "";
            $interest_start_date = "";
            $interest_end_date = "";
            $group_price_list_text = "";
            $same_price_to_all = 0;
            $add_date = date("Y-m-d");
            $payment_email_sent = 0;
            $payment_confirmation_link_expire = "";
            $payment_confirmation_link_expire_text = "";
            $group_price_list_matched = "";
            $update_interest_data = "";
            $update_format_array = "";
            //$time_now =
            if ($email_data['payment_within']) {
                $time_now = date("Y-m-d H:i");
                $payment_within = $email_data['payment_within'] / 24;
                $payment_confirmation_link_expire = date('Y-m-d H:i', strtotime($time_now . ' + ' . $payment_within . 'days'));
                $expire_date_time_separation = explode(" ", $payment_confirmation_link_expire);
                $expire_date = explode("-", $expire_date_time_separation[0]);
                $expire_time = explode(":", $expire_date_time_separation[1]);
                $payment_confirmation_link_expire_text = mktime($expire_time[0], $expire_time[1], 0, $expire_date[1], $expire_date[2], $expire_date[0]);
            }
            if ($interest_confirmed_details) {
                $count_interest_confirmed = $this->count_interest_confirmed($interest_confirmed_details[0]['product_id'], $interest_confirmed_details[0]['group_id']);
                //echo $count_interest_confirmed[0]->total_qty; exit;
                //////////////////////////////////////////////////////
                $product_meta_values = get_post_meta($interest_confirmed_details[0]['product_id'], '', '');
                $minimum_target_sells = $product_meta_values['minimum_target_sells'][0];
                if ($count_interest_confirmed[0]['total_qty'] < $minimum_target_sells) {
                    $group_price_list_matched = $this->get_minimum_price_list($interest_confirmed_details[0]['group_id']);
                } else {
                    $group_price_list_matched = $this->get_group_price_list_matched($interest_confirmed_details[0]['group_id'], $count_interest_confirmed[0]['total_qty']);
                }
                /////////////////////////////////////////////////////
                if ($group_price_list_matched) {
                    foreach ($group_price_list_matched as $group_price_data) {
                        $group_price_list_text .= '<tr>
						<td><span>' . $group_price_data["no_of_sells"] . '</span></td>
						<td><span>' . $group_price_data["bestbuy_bestsell_price"] . '&nbsp;' . get_currency() . '</span></td>
						<td><span>' . $group_price_data["shipping_price"] . '&nbsp;' . get_currency() . '</span></td>
						</tr>' . "\n\n";
                    }
                }
                foreach ($interest_confirmed_details as $individual_data) {
                    /******************************************/
                    $user_info = get_userdata($individual_data['user_id']);
                    $user_meta_info = get_user_meta($individual_data['user_id'], '', '');
                    //return (print_r( $user_meta_info )); exit;
                    if ($user_meta_info['first_name'][0]) {
                        $dear_text = $user_meta_info['first_name'][0];
                    } else {
                        $dear_text = $user_info->display_name;
                    }
                    if ($individual_data['interest_start_date']) {
                        $interest_start_date = date("Y-m-d", $individual_data['interest_start_date']);
                        $interest_end_date = date("Y-m-d", $individual_data['interest_end_date']);
                    } else {
                        $interest_start_date = __("As soon as price is reasonable");
                    }
                    //////////////////////////////////////////////
                    $subject = "!NMID: " . $email_data["email_subject"] . " CaseNo(" . $interest_confirmed_details[0]['group_id'] . "_" . $individual_data['product_interest_id'] . ")\n\n";
                    $message = "<html><body>" . "\n";
                    $message .= "<table cellpadding='0' cellspacing='0' bgcolor=#319d00 width='100%' style='margin:0 auto'><tr style='font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 11px; color: rgb(255,255,255); line-height: 140%;'><td width='23'></td><td><span>!NMID: A Business Aggregator</span></td></tr></table>" . "\n\n";
                    $message .= "<p>Dear Customer &nbsp;" . $dear_text . ",</p>" . "\n";
                    $message .= "<p>" . $email_data["email_message_to_interest_grp"] . "</p>" . "\n";
                    if ($deal_selection === 'want_to_deal') {
                        if ($individual_data['same_price_to_all'] || !intval($individual_data['interest_unit_price'])) {
                            //$same_price_to_all = 1;
                            $message .= "<p>A Price List is following for your interest:</p>" . "\n";
                            $message .= "<table cellpadding='5' cellspacing='2' bgcolor=#ffffff width='100%' style='margin:0 auto'><tr style='font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 11px; color: 333333; line-height: 140%;'>\n\t\t\t\t\t\t<td><span style='font-weight:bold;'>No Of Sells</span></td>\n\t\t\t\t\t\t<td><span style='font-weight:bold;'>Unit Price</span></td>\n\t\t\t\t\t\t<td><span style='font-weight:bold;'>Shipping Price</span></td>\n\t\t\t\t\t\t</tr>" . "\n\n";
                            $message .= $group_price_list_text . "</table>" . "\n\n";
                        } else {
                            $message .= "<p>The Unit Price For Your Interest Is:" . get_currency() . " : " . $individual_data['interest_unit_price'] . "</p>";
                            $message .= "<p>Shipping Price:" . get_currency() . " : " . $individual_data['interest_shipping_price'] . "</p>\n";
                        }
                    }
                    $message .= "<p>Your Interest Details:</p>" . "\n";
                    $message .= "<p><b>Product Name: </b><a href=" . get_site_url() . "/my-interest-list/?action=edit&product_interest_id=" . $individual_data['product_interest_id'] . "&product_name=" . $individual_data['post_name'] . " >" . $individual_data['product_name'] . "</a></p>\n";
                    $message .= "<p><b>Qty: </b>" . $individual_data['interest_qty'] . "</p>\n";
                    $message .= "<p><b>Interest Start Date: </b>" . $interest_start_date . "</p>\n";
                    $message .= "<p><b>Interest End Date: </b>" . $interest_end_date . "</p>\n";
                    if ($deal_selection == "want_to_deal") {
                        if ($email_data['payment_within']) {
                            $message .= "<p>You Have&nbsp;" . $email_data['payment_within'] . "Hours For Payment to confirm that you are still want to purchase this product for the above Details</p>\n";
                        }
                        $message .= "<p>For Payment Please click on This Link: <a href=" . get_site_url() . "/my-interest-list/?action=interest_confirmed&product_interest_id=" . $individual_data['product_interest_id'] . " >Yes</a>\n\t\t\t\t\t</p>\n";
                    }
                    $message .= "<table cellpadding='0' cellspacing='0' bgcolor=#319d00 width='100%' style='margin:0 auto'><tr style='font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 11px; color: rgb(255,255,255); line-height: 140%;'><td width='23'></td><td><span>!NMID: A Business Aggregator</span></td></tr></table>" . "\n\n";
                    $message .= "</body></html>\n";
                    $uid = md5(uniqid(time()));
                    $header = "From: !NMID <" . $current_user->user_email . ">\r\n";
                    $header .= "Reply-To:" . $current_user->user_email . "\r\n";
                    $header .= "MIME-Version: 1.0\r\n";
                    $header .= "Content-Type: multipart/mixed; boundary=\"" . $uid . "\"\r\n\r\n";
                    $header .= "This is a multi-part message in MIME format.\r\n";
                    $header .= "--" . $uid . "\r\n";
                    $header .= "Content-type:text/html; charset=iso-8859-1\r\n";
                    $header .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
                    //$header .= $message."\r\n\r\n";
                    $header .= "--" . $uid . "\r\n";
                    //$header .= "Content-Type: application/octet-stream; name=\"".$attachment_name."\"\r\n"; // use different content types here
                    $header .= "Content-Transfer-Encoding: base64\r\n";
                    //$header .= "Content-Disposition: attachment; filename=\"".$attachment_name."\"\r\n\r\n";
                    //$header .= $attachedfile."\r\n\r\n";
                    //echo $message;
                    $header .= "--" . $uid . "--";
                    $attachments = "";
                    $messages = "";
                    $email_to = $user_info->user_email;
                    $update_format_array = array('%s', "%s", "%s");
                    //if( mail( $email_to , $subject,"",$header) )	{
                    if (wp_mail($email_to, $subject, $message, $header, '')) {
                        //$case_data['product_interest_id'] = $individual_data->product_interest_id;
                        $update_case_data['payment_subject'] = $subject;
                        $update_case_data['payment_message'] = $header;
                        $update_case_data['payment_within'] = $email_data['payment_within'];
                        $where = array("product_interest_id" => $individual_data['product_interest_id']);
                        $where_format = array();
                        $wpdb->update("{$wpdb->prefix}interest_group_case", $update_case_data, $where, $update_format_array = null, $where_format = null);
                        //print_r( $case_data ); exit;
                        //$succes_case_insert = insert_interest_case( $case_data , $format_array );
                        if (!$email_sent) {
                            $update_group_data = array("payment_email_sent" => 1);
                            $where = array("group_id" => $interest_confirmed_details[0]['group_id']);
                            $update_format_array = array('%d');
                            $where_format = array();
                            $wpdb->update("{$wpdb->prefix}interest_group", $update_group_data, $where, $update_format_array = null, $where_format = null);
                            $email_sent = 1;
                        }
                        if ($deal_selection == "want_to_deal") {
                            $update_interest_data = array("interest_campaign_closed" => 0, "payment_confirmation_link_expire" => $payment_confirmation_link_expire_text);
                            $update_format_array = array('%d', '%s');
                        } elseif ($deal_selection == "dealings_fail") {
                            $update_interest_data = array("interest_confirmed" => 0, "interest_campaign_closed" => 2, "interest_confirmation_link_expire" => 0);
                            $update_format_array = array('%d', '%d', '%s');
                        }
                        $where = array("product_interest_id" => $individual_data['product_interest_id']);
                        $where_format = array();
                        $wpdb->update("{$wpdb->prefix}product_interest", $update_interest_data, $where, $update_format_array = null, $where_format = null);
                    }
                    /******************************************/
                }
            }
            if ($email_sent) {
                return True;
            }
        }
Example #13
0
function display_currency_edit($selected_id)
{
    global $table_style2;
    start_form();
    start_table($table_style2);
    if ($selected_id != "") {
        //editing an existing currency
        $myrow = get_currency($selected_id);
        $_POST['Abbreviation'] = $myrow["curr_abrev"];
        $_POST['Symbol'] = $myrow["curr_symbol"];
        $_POST['CurrencyName'] = $myrow["currency"];
        $_POST['country'] = $myrow["country"];
        $_POST['hundreds_name'] = $myrow["hundreds_name"];
        hidden('selected_id', $selected_id);
        hidden('Abbreviation', $_POST['Abbreviation']);
        label_row(tr("Currency Abbreviation:"), $_POST['Abbreviation']);
    } else {
        text_row_ex(tr("Currency Abbreviation:"), 'Abbreviation', 4, 3);
    }
    text_row_ex(tr("Currency Symbol:"), 'Symbol', 10);
    text_row_ex(tr("Currency Name:"), 'CurrencyName', 20);
    text_row_ex(tr("Hundredths Name:"), 'hundreds_name', 15);
    text_row_ex(tr("Country:"), 'country', 40);
    end_table(1);
    submit_add_or_update_center($selected_id == "");
    end_form();
}
Example #14
0
     }
     $sql = "SELECT id from " . TB_PREF . "item_codes WHERE item_code='{$code}' AND stock_id = '{$id}'";
     $result = db_query($sql, "item code could not be retrieved");
     $row = db_fetch_row($result);
     if (!$row) {
         add_item_code($code, $id, $description, $cat, 1);
     } else {
         update_item_code($row[0], $code, $id, $description, $cat, 1);
     }
 }
 if ($type == 'ITEM' || $type == 'KIT' || $type == 'PRICE') {
     if (isset($price) && $price != "") {
         if ($currency == "") {
             $currency = get_company_pref("curr_default");
         } else {
             $row = get_currency($currency);
             if (!$row) {
                 add_currency($currency, "", "", "", "");
             }
         }
         $sql = "SELECT * FROM " . TB_PREF . "prices\tWHERE stock_id='{$code}' AND sales_type_id={$_POST['sales_type_id']} AND\n\t\t\t\t\tcurr_abrev='{$currency}'";
         $result = db_query($sql, "price could not be retrieved");
         $row = db_fetch_row($result);
         if (!$row) {
             add_item_price($code, $_POST['sales_type_id'], $currency, $price);
         } else {
             update_item_price($row[0], $_POST['sales_type_id'], $currency, $price);
         }
         $pr++;
     }
 }
Example #15
0
// get order profile settings
$sql = "SELECT setting_name,setting_value FROM " . $table_prefix . "global_settings ";
$sql .= "WHERE setting_type='order_info'";
if (isset($site_id)) {
    $sql .= " AND (site_id=1 OR site_id=" . $db->tosql($site_id, INTEGER, true, false) . ")";
    $sql .= " ORDER BY site_id ASC ";
} else {
    $sql .= " AND site_id=1 ";
}
$db->query($sql);
while ($db->next_record()) {
    $order_info[$db->f("setting_name")] = $db->f("setting_value");
}
$eol = get_eol();
$sess_currency = get_currency();
$currency = get_currency($sess_currency["code"]);
$shipping_block = get_setting_value($order_info, "shipping_block", 0);
$default_currency_code = get_db_value("SELECT currency_code FROM " . $table_prefix . "currencies WHERE is_default=1");
$user_info = get_session("session_user_info");
$user_tax_free = get_setting_value($user_info, "tax_free", 0);
$points_balance = get_setting_value($user_info, "total_points", 0);
$order_min_goods_cost = get_setting_value($user_info, "order_min_goods_cost", "");
$order_max_goods_cost = get_setting_value($user_info, "order_max_goods_cost", "");
$order_min_weight = "";
$order_max_weight = "";
// check if credit system active
$credit_system = get_setting_value($settings, "credit_system", 0);
$credits_balance_order_profile = get_setting_value($settings, "credits_balance_order_profile", 0);
$credit_balance = 0;
$credit_amount = 0;
if ($credit_system && $user_id) {
Example #16
0
function display_currency_edit($selected_id)
{
    global $Mode;
    start_table(TABLESTYLE2);
    if ($selected_id != '') {
        if ($Mode == 'Edit') {
            //editing an existing currency
            $myrow = get_currency($selected_id);
            $_POST['Abbreviation'] = $myrow["curr_abrev"];
            $_POST['Symbol'] = $myrow["curr_symbol"];
            $_POST['CurrencyName'] = $myrow["currency"];
            $_POST['country'] = $myrow["country"];
            $_POST['hundreds_name'] = $myrow["hundreds_name"];
            $_POST['auto_update'] = $myrow["auto_update"];
        }
        hidden('Abbreviation');
        hidden('selected_id', $selected_id);
        label_row(_("Currency Abbreviation:"), $_POST['Abbreviation']);
    } else {
        $_POST['auto_update'] = 1;
        text_row_ex(_("Currency Abbreviation:"), 'Abbreviation', 4, 3);
    }
    text_row_ex(_("Currency Symbol:"), 'Symbol', 10);
    text_row_ex(_("Currency Name:"), 'CurrencyName', 20);
    text_row_ex(_("Hundredths Name:"), 'hundreds_name', 15);
    text_row_ex(_("Country:"), 'country', 40);
    check_row(_("Automatic exchange rate update:"), 'auto_update', get_post('auto_update'));
    end_table(1);
    submit_add_or_update_center($selected_id == '', '', 'both');
}
Example #17
0
<?php

$sql_history = "SELECT * FROM " . _TABLE_TRANSACTIONS_HISTOTY . " WHERE transaction_status='completed'";
$history_query = db_query($sql_history);
while ($history = db_fetch_array($history_query)) {
    $history_id = $history['history_id'];
    $currency = get_currency($history['transaction_currency']);
    $balance = get_currency_value_format($history['amount'], $currency);
    $transfer_info['fees_text'] = get_currency_value_format($history['fee'], $currency);
    $sql_check = "SELECT account_name, firstname, lastname FROM " . _TABLE_USERS . " WHERE user_id='" . $history['from_userid'] . "'";
    $user_check = db_query($sql_check);
    $user_transfer = db_fetch_array($user_check);
    $smarty->assign('user_transfer', $user_transfer);
    $sql_user = "******" . _TABLE_USERS . " WHERE user_id='" . $history['to_userid'] . "'";
    $user_query = db_query($sql_user);
    if (db_num_rows($user_query) > 0) {
        if (!empty($history['status_url'])) {
            $dataPost = array('payee_account' => $history['to_account'], 'payer_account' => $history['from_account'], 'checkout_amount' => $history['amount'], 'checkout_currency' => $history['transaction_currency'], 'batch_number' => $history['batch_number'], 'transaction_status' => $history['transaction_status'], 'transaction_currency' => $history['transaction_currency']);
            $extra_fields = unserialize($history['extra_fields']);
            $dataPost = array_merge($extra_fields, $dataPost);
            if ($history['status_method'] == 'GET') {
                $results = curl_get($history['status_url'], $dataPost);
            } else {
                $results = curl_post($history['status_url'], $dataPost);
            }
            if ($results) {
                $sql_delete = "DELETE  FROM " . _TABLE_TRANSACTIONS_HISTOTY . " WHERE history_id='" . $history_id . "'";
                db_query($sql_delete);
            } else {
                if (strtotime($history['transaction_time']) < strtotime("-2 day")) {
                    $sql_delete = "DELETE  FROM " . _TABLE_TRANSACTIONS_HISTOTY . " WHERE history_id='" . $history_id . "'";
Example #18
0
    function bestbuy_bestsell_payment_success_paypal()
    {
        if (!session_id()) {
            session_start();
        }
        // Paypal Configuration
        $paypal_option_settings = get_option('paypal_option_settings');
        $current_user_id = get_current_user_id();
        $all_meta_for_user = get_user_meta($current_user_id);
        //print_r( $paypal_option_settings ); exit;
        if ($paypal_option_settings['paypal_sandbox'] === 'yes') {
            $PayPalMode = 'sandbox';
            $PayPalApiUsername = '******';
            //PayPal API Username
            $PayPalApiPassword = '******';
            //Paypal API password
            $PayPalApiSignature = 'A-IzJhZZjhg29XQ2qnhapuwxIDzyAZQ92FRP5dqBzVesOkzbdUONzmOU';
            //Paypal API Signature
        } else {
            $PayPalMode = 'live';
            // sandbox or live
            $PayPalApiUsername = $paypal_option_settings['paypal_payment_api_user_name'];
            //PayPal API Username
            $PayPalApiPassword = $paypal_option_settings['paypal_payment_api_password'];
            //Paypal API password
            $PayPalApiSignature = $paypal_option_settings['paypal_payment_api_signature'];
            //Paypal API Signature
        }
        $PayPalCurrencyCode = get_currency();
        //Paypal Currency Code
        $PayPalReturnURL = get_site_url() . '/index.php/payment-success';
        //Point to process.php page
        $PayPalCancelURL = get_site_url();
        //Cancel URL if user clicks cancel
        // Process Paypal Payment
        $paypalmode = $PayPalMode == 'sandbox' ? '.sandbox' : '';
        //Paypal redirects back to this page using ReturnURL, We should receive TOKEN and Payer ID
        if (isset($_GET["token"]) && isset($_GET["PayerID"])) {
            //we will be using these two variables to execute the "DoExpressCheckoutPayment"
            //Note: we haven't received any payment yet.
            $token = $_GET["token"];
            $payer_id = $_GET["PayerID"];
            $PayPalCurrencyCode = get_currency();
            //get session variables
            $product_interest_id = $_SESSION['product_interest_id'];
            //Item Name
            $ItemName = $_SESSION['ItemName'];
            //Item Name
            $ItemPrice = $_SESSION['ItemPrice'];
            //Item Price
            $ItemNumber = $_SESSION['ItemNumber'];
            //Item Number
            $ItemDesc = $_SESSION['ItemDesc'];
            //Item Number
            $ItemQty = $_SESSION['ItemQty'];
            // Item Quantity
            $ItemTotalPrice = $_SESSION['ItemTotalPrice'];
            //(Item Price x Quantity = Total) Get total amount of product;
            $TotalTaxAmount = $_SESSION['TotalTaxAmount'];
            //Sum of tax for all items in this order.
            $HandalingCost = $_SESSION['HandalingCost'];
            //Handling cost for this order.
            $InsuranceCost = $_SESSION['InsuranceCost'];
            //shipping insurance cost for this order.
            $ShippinDiscount = $_SESSION['ShippinDiscount'];
            //Shipping discount for this order. Specify this as negative number.
            $ShippinCost = $_SESSION['ShippinCost'];
            //Although you may change the value later, try to pass in a shipping amount that is reasonably accurate.
            $GrandTotal = $_SESSION['GrandTotal'];
            $padata = '&TOKEN=' . urlencode($token) . '&PAYERID=' . urlencode($payer_id) . '&PAYMENTREQUEST_0_PAYMENTACTION=' . urlencode("SALE") . '&L_PAYMENTREQUEST_0_NAME0=' . urlencode($ItemName) . '&L_PAYMENTREQUEST_0_NUMBER0=' . urlencode($ItemNumber) . '&L_PAYMENTREQUEST_0_DESC0=' . urlencode($ItemDesc) . '&L_PAYMENTREQUEST_0_AMT0=' . urlencode($ItemPrice) . '&L_PAYMENTREQUEST_0_QTY0=' . urlencode($ItemQty) . '&PAYMENTREQUEST_0_ITEMAMT=' . urlencode($ItemTotalPrice) . '&PAYMENTREQUEST_0_TAXAMT=' . urlencode($TotalTaxAmount) . '&PAYMENTREQUEST_0_SHIPPINGAMT=' . urlencode($ShippinCost) . '&PAYMENTREQUEST_0_HANDLINGAMT=' . urlencode($HandalingCost) . '&PAYMENTREQUEST_0_SHIPDISCAMT=' . urlencode($ShippinDiscount) . '&PAYMENTREQUEST_0_INSURANCEAMT=' . urlencode($InsuranceCost) . '&PAYMENTREQUEST_0_AMT=' . urlencode($GrandTotal) . '&PAYMENTREQUEST_0_CURRENCYCODE=' . urlencode($PayPalCurrencyCode);
            //We need to execute the "DoExpressCheckoutPayment" at this point to Receive payment from user.
            $paypal = new Bestbuybestsell_Paypal();
            $httpParsedResponseAr = $paypal->PPHttpPost('DoExpressCheckoutPayment', $padata, $PayPalApiUsername, $PayPalApiPassword, $PayPalApiSignature, $PayPalMode);
            //Check if everything went ok..
            if ("SUCCESS" == strtoupper($httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($httpParsedResponseAr["ACK"])) {
                //echo 'Your Transaction ID : '.urldecode($httpParsedResponseAr["PAYMENTINFO_0_TRANSACTIONID"]);
                /*
                    //Sometimes Payment are kept pending even when transaction is complete.
                    //hence we need to notify user about it and ask him manually approve the transiction
                */
                $payment_success_data['interest_campaign_closed'] = '1';
                $payment_success_data['interest_paid_by'] = 'paypal_express_checkout';
                if ('Completed' == $httpParsedResponseAr["PAYMENTINFO_0_PAYMENTSTATUS"]) {
                    $payment_success_data['interest_paid'] = '1';
                    ?>
                <div style='color:green'>
                    <?php 
                    _e("Payment Received! Your product will be sent to you very soon!", TEXTDOMAIN);
                    ?>
                </div>
                <?php 
                } elseif ('Pending' == $httpParsedResponseAr["PAYMENTINFO_0_PAYMENTSTATUS"]) {
                    ?>
                    <div style='color:red'>
                        <?php 
                    _e('Transaction Complete, but payment is still pending! You need to manually authorize this payment in your');
                    ?>
                        <a target="_new" href="http://www.paypal.com"><?php 
                    _e('Paypal Account');
                    ?>
 </a>
                    </div>
                <?php 
                }
                // we can retrive transection details using either GetTransactionDetails or GetExpressCheckoutDetails
                // GetTransactionDetails requires a Transaction ID, and GetExpressCheckoutDetails requires Token returned by SetExpressCheckOut
                $padata = '&TOKEN=' . urlencode($token);
                $paypal = new Bestbuybestsell_Paypal();
                $httpParsedResponseAr = $paypal->PPHttpPost('GetExpressCheckoutDetails', $padata, $PayPalApiUsername, $PayPalApiPassword, $PayPalApiSignature, $PayPalMode);
                if ("SUCCESS" == strtoupper($httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($httpParsedResponseAr["ACK"])) {
                    $payment_success_data['interest_paid_transaction_id'] = $httpParsedResponseAr['PAYMENTREQUEST_0_TRANSACTIONID'];
                    #### SAVE BUYER INFORMATION IN DATABASE ###
                    //see (http://www.sanwebe.com/2013/03/basic-php-mysqli-usage) for mysqli usage
                    //$buyerName = $httpParsedResponseAr["FIRSTNAME"].' '.$httpParsedResponseAr["LASTNAME"];
                    //$buyerEmail = $httpParsedResponseAr["EMAIL"];
                    //print_r($httpParsedResponseAr);
                    do_action('payment_success_data_insert', $payment_success_data, $product_interest_id);
                    ?>
                <div class="payment_success_shipping_address">
                    <h3><?php 
                    _e('Ship To');
                    ?>
:</h3>
                <?php 
                    echo $all_meta_for_user['delivery_first_name'][0] . " " . $all_meta_for_user['delivery_last_name'][0];
                    echo "<br/>C/O: " . $all_meta_for_user['delivery_care_of'][0];
                    echo "<br/>" . $all_meta_for_user['delivery_street_house_number'][0];
                    echo "<br/>" . $all_meta_for_user['delivery_zip_code'][0] . " " . $all_meta_for_user['delivery_place'][0];
                    echo "<br/>" . $all_meta_for_user['delivery_country'][0];
                    ?>
                </div>
                <?php 
                } else {
                    ?>
                <div style='color:red'><b>
                    <?php 
                    _e('GetTransactionDetails failed') . ':</b>' . urldecode($httpParsedResponseAr["L_LONGMESSAGE0"]);
                    ?>
                </div>
                <?php 
                    echo '<pre>';
                    //print_r($httpParsedResponseAr);
                    echo '</pre>';
                }
            } else {
                ?>
                <div style='color:red'><b>
                        <?php 
                _e('Error') . ':</b>' . urldecode($httpParsedResponseAr["L_LONGMESSAGE0"]);
                ?>
                </div>
                <?php 
                echo '<pre>';
                //print_r($httpParsedResponseAr);
                echo '</pre>';
            }
            // End Payment Process
        }
    }
Example #19
0
<?php

include 'includes/page_init.php';
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
    $data_result = array('status' => 'error', 'error_code' => 'ERR_017', 'error_title' => $__ERROR_CODE['ERR_017']);
    echo json_encode($data_result);
    exit;
}
$amount = $_POST['amount'];
$balance_currency = $_POST['balance_currency'];
//dv tien
//bof: get currencies
$currency = get_currency($balance_currency);
if (!$currency) {
    $data_result = array('status' => 'error', 'error_code' => 'ERR_014', 'error_title' => $__ERROR_CODE['ERR_014']);
    echo json_encode($data_result);
    exit;
}
$fees = $amount * TRANSFER_FEES / 100;
$batch_number = tep_create_random_value(11, 'digits');
$amount_text = get_currency_value_format($amount, $currency);
$fees_text = get_currency_value_format($fees, $currency);
if (!is_numeric($amount) && !is_float($amount) || $amount < 0) {
    $data_result = array('status' => 'error', 'error_code' => 'ERR_013', 'error_title' => $__ERROR_CODE['ERR_013']);
    echo json_encode($data_result);
    exit;
}
//get User from
$from_acount_number = $_POST['acount_number'];
$master_key = $_POST['master_key'];
$pin = $_POST['pin'];
Example #20
0
 /**
  * Format value.
  *
  * This filter is applied to the $value after it is loaded from the db and before it is returned to the template.
  *
  * @since 1.1.3
  *
  * @param  mixed $value the Value which was loaded from the database.
  * @param  mixed $post_id   The $post_id from which the value was loaded.
  * @param  array $field the Field array holding all the field options.
  *
  * @return 	bool|array	currency data
  */
 function format_value($value, $post_id, $field)
 {
     $currency = '';
     if ($value == 'null' || $value == '' || $value == false) {
         $currency = false;
     } else {
         if (is_array($value)) {
             foreach ($value as $code) {
                 $currency[$code] = get_currency($code);
             }
         } else {
             $currency[$value] = get_currency($value);
         }
     }
     return $currency;
 }
Example #21
0
    ?>
</td>
	<td><?php 
    echo date('d.m.Y <br> H:i', $value['date_order_create']);
    ?>
</td>
	<td><?php 
    echo get_status($value['status']);
    ?>
</td>
	<td><?php 
    echo get_qty($cart);
    ?>
</td>
	<td><?php 
    echo get_sum($cart) . ' ' . get_currency($cart);
    ?>
</td>
	<td><?php 
    if ($value['status'] == 1) {
        //echo "<a href='".base_url()."template/pay/robokassa/demo2.php'>Оплатить</a>";
        echo pay($value['id'], get_sum($cart));
    }
    ?>
</td>
	</tr>
<?php 
}
?>
</table>
<style>
Example #22
0
/**
 * Format currency.
 * Formats an amount in one specified currency according to currency data.
 *
 * @since 1.1.0
 *
 * @param 	int|float	$amount				the amount to format
 * @param	string 		$currency_code		the currency
 * @param	bool		$currency_symbol	true outputs the currency symbol, false does not (default true)
 *
 * @return	string	returns a string with formatted currency number and currency symbol
 */
function format_currency($amount, $currency_code, $currency_symbol = true)
{
    if (!$amount || !$currency_code or is_nan($amount)) {
        return '';
    }
    $currency = get_currency(strtoupper($currency_code));
    if (is_null($currency)) {
        return '';
    }
    if (!$currency) {
        $symbol = $currency_symbol == true ? strtoupper($currency_code) : '';
        $result = $amount . ' ' . $symbol;
    } else {
        $formatted = number_format($amount, $currency['decimals'], $currency['decimals_sep'], $currency['thousands_sep']);
        if ($currency_symbol == false) {
            $result = $formatted;
        } else {
            $result = $currency['position'] == 'before' ? $currency['symbol'] . ' ' . $formatted : $formatted . ' ' . $currency['symbol'];
        }
    }
    return html_entity_decode($result);
}
 function queryFilterBetween(&$layout_def)
 {
     $global_currency_obj = get_currency();
     return $this->_get_column_select($layout_def) . " > " . $GLOBALS['db']->quote(round($global_currency_obj->convertToDollar($layout_def['input_name0']))) . " AND " . $this->_get_column_select($layout_def) . " < " . $GLOBALS['db']->quote(round($global_currency_obj->convertToDollar($layout_def['input_name1']))) . "\n";
 }
						<input type="submit" id="sublogout" class="button" name="out" value="Выйти"  >
						</form></li>
						<?
						}
						else
						{
						?>
		 
						<li ><a href="index.php?view=enter">Войти</a></li>
						<li><a href="index.php?view=registration">Зарегистрироватся</a></li>
		   				<?}?>
				</ul>
				<form action="index.php?view=change_currency" method="post" id="curr">
								<select name="curr" onchange="document.getElementById('curr').submit()">
									<? 
										$currency=get_currency();
										echo $currency;
										
										foreach ($currency as $item):?>
										
										<option name="<?php 
echo $item['name'];
?>
" 
											<?if ($_SESSION['currency']==$item) echo " selected" //) ?>
										>
										<?php 
echo $item['name'];
?>
</option>
										<?