当前位置: 首页>>代码示例>>PHP>>正文


PHP convertCurrency函数代码示例

本文整理汇总了PHP中convertCurrency函数的典型用法代码示例。如果您正苦于以下问题:PHP convertCurrency函数的具体用法?PHP convertCurrency怎么用?PHP convertCurrency使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了convertCurrency函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: checkCbInvoiceID

# Get Returned Variables
$merchant_order_id = $_POST["merchant_order_id"];
$razorpay_payment_id = $_POST["razorpay_payment_id"];
# Checks invoice ID is a valid invoice number or ends processing
$merchant_order_id = checkCbInvoiceID($merchant_order_id, $GATEWAY["name"]);
# Checks transaction number isn't already in the database and ends processing if it does
checkCbTransID($razorpay_payment_id);
# Fetch invoice to get the amount
$result = mysql_fetch_assoc(select_query('tblinvoices', 'total', array("id" => $merchant_order_id)));
$amount = $result['total'];
# Check if amount is INR, convert if not.
$currency = getCurrency();
if ($currency['code'] !== 'INR') {
    $result = mysql_fetch_array(select_query("tblcurrencies", "id", array("code" => 'INR')));
    $inr_id = $result['id'];
    $converted_amount = convertCurrency($amount, $currency['id'], $inr_id);
} else {
    $converted_amount = $amount;
}
# Amount in Paisa
$converted_amount = 100 * $converted_amount;
$success = true;
$error = "";
try {
    $url = 'https://api.razorpay.com/v1/payments/' . $razorpay_payment_id . '/capture';
    $fields_string = "amount={$converted_amount}";
    //cURL Request
    $ch = curl_init();
    //set the url, number of POST vars, POST data
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_USERPWD, $key_id . ":" . $key_secret);
开发者ID:kdclabs,项目名称:razorpay-whmcs,代码行数:31,代码来源:razorpay.php

示例2: affiliateActivate

/**
 *
 * @ WHMCS FULL DECODED & NULLED
 *
 * @ Version  : 5.2.15
 * @ Author   : MTIMER
 * @ Release on : 2013-12-24
 * @ Website  : http://www.mtimer.cn
 *
 **/
function affiliateActivate($userid)
{
    global $CONFIG;
    $result = select_query("tblclients", "currency", array("id" => $userid));
    $data = mysql_fetch_array($result);
    $clientcurrency = $data['currency'];
    $bonusdeposit = convertCurrency($CONFIG['AffiliateBonusDeposit'], 1, $clientcurrency);
    $result = select_query("tblaffiliates", "id", array("clientid" => $userid));
    $data = mysql_fetch_array($result);
    $affiliateid = $data['id'];
    if (!$affiliateid) {
        $affiliateid = insert_query("tblaffiliates", array("date" => "now()", "clientid" => $userid, "balance" => $bonusdeposit));
    }
    logActivity("Activated Affiliate Account - Affiliate ID: " . $affiliateid . " - User ID: " . $userid, $userid);
    run_hook("AffiliateActivation", array("affid" => $affiliateid, "userid" => $userid));
}
开发者ID:billyprice1,项目名称:whmcs,代码行数:26,代码来源:affiliatefunctions.php

示例3: tcoconvertcurrency

/**
 *
 * @ WHMCS FULL DECODED & NULLED
 *
 * @ Version  : 5.2.15
 * @ Author   : MTIMER
 * @ Release on : 2013-12-24
 * @ Website  : http://www.mtimer.cn
 *
 **/
function tcoconvertcurrency($amount, $currency, $invoiceid)
{
    $result = select_query("tblcurrencies", "id", array("code" => $currency));
    $data = mysql_fetch_array($result);
    $currencyid = $data['id'];
    if (!$currencyid) {
        logTransaction($GATEWAY['name'], $_POST, "Unrecognised Currency");
        exit;
    }
    $result = select_query("tblinvoices", "userid,total", array("id" => $invoiceid));
    $data = mysql_fetch_array($result);
    $userid = $data['userid'];
    $total = $data['total'];
    $currency = getCurrency($userid);
    if ($currencyid != $currency['id']) {
        $amount = convertCurrency($amount, $currencyid, $currency['id']);
        if ($total < $amount + 1 && $amount - 1 < $total) {
            $amount = $total;
        }
    }
    return $amount;
}
开发者ID:billyprice1,项目名称:whmcs,代码行数:32,代码来源:tco.php

示例4: calculateAffiliateCommission

 function calculateAffiliateCommission($affid, $relid, $lastpaid = "")
 {
     global $CONFIG;
     static $AffCommAffiliatesData = array();
     $percentage = $fixedamount = "";
     $result = select_query("tblproducts", "tblproducts.affiliateonetime,tblproducts.affiliatepaytype,tblproducts.affiliatepayamount,tblhosting.amount,tblhosting.firstpaymentamount,tblhosting.billingcycle,tblhosting.userid,tblclients.currency", array("tblhosting.id" => $relid), "", "", "", "tblhosting ON tblhosting.packageid=tblproducts.id INNER JOIN tblclients ON tblclients.id=tblhosting.userid");
     $data = mysql_fetch_array($result);
     $userid = $data['userid'];
     $billingcycle = $data['billingcycle'];
     $affiliateonetime = $data['affiliateonetime'];
     $affiliatepaytype = $data['affiliatepaytype'];
     $affiliatepayamount = $data['affiliatepayamount'];
     $clientscurrency = $data['currency'];
     $amount = $lastpaid == "0000-00-00" || $billingcycle == "One Time" || $affiliateonetime ? $data['firstpaymentamount'] : $data['amount'];
     if ($affiliatepaytype == "none") {
         return "0.00";
     }
     if ($affiliatepaytype) {
         if ($affiliatepaytype == "percentage") {
             $percentage = $affiliatepayamount;
         } else {
             $fixedamount = $affiliatepayamount;
         }
     }
     if (isset($AffCommAffiliatesData[$affid])) {
         $data = $AffCommAffiliatesData[$affid];
     } else {
         $result = select_query("tblaffiliates", "clientid,paytype,payamount,(SELECT currency FROM tblclients WHERE id=clientid) AS currency", array("id" => $affid));
         $data = mysql_fetch_array($result);
         $AffCommAffiliatesData[$affid] = $data;
     }
     $affuserid = $data['clientid'];
     $paytype = $data['paytype'];
     $payamount = $data['payamount'];
     $affcurrency = $data['currency'];
     if ($paytype) {
         $percentage = $fixedamount = "";
         if ($paytype == "percentage") {
             $percentage = $payamount;
         } else {
             $fixedamount = $payamount;
         }
     }
     if (!$fixedamount && !$percentage) {
         $percentage = $CONFIG['AffiliateEarningPercent'];
     }
     $commission = $fixedamount ? convertCurrency($fixedamount, 1, $affcurrency) : convertCurrency($amount, $clientscurrency, $affcurrency) * ($percentage / 100);
     run_hook("CalcAffiliateCommission", array("affid" => $affid, "relid" => $relid, "amount" => $amount, "commission" => $commission));
     $commission = format_as_currency($commission);
     return $commission;
 }
开发者ID:billyprice1,项目名称:whmcs,代码行数:51,代码来源:functions.php

示例5: number_format

        $pdf->AddCol('item', '50%', 'Item', 'L');
        $pdf->AddCol('pr_qty', '15%', 'Quantity', 'R');
        $pdf->AddCol('pr_rate', '15%', 'Rate', 'R');
        $pdf->AddCol('amt', '15%', 'Amount', 'R');
        $pdf->Table($data, $prop);
        $_cMargin = $pdf->cMargin;
        $pdf->cMargin = $prop['padding'];
        $pdf->SetFont($prop['thfont'][0], $prop['thfont'][1], $prop['thfont'][2]);
        $width = $pdf->w - $pdf->lMargin - $pdf->rMargin;
        $cellSize = 0.01 * $width;
        $pdf->Cell($cellSize * 45, 6, 'Total', 0, 0, 'C', false);
        $pdf->Cell($cellSize * 20, 6, number_format($total['qty']), 0, 0, 'R', false);
        $pdf->Cell($cellSize * 15, 6, '', 0, 0, 'L', false);
        $pdf->Cell($cellSize * 20, 6, number_format($total['amt']), 0, 0, 'R', false);
        $pdf->Ln();
        $pdf->Cell($cellSize * 100, 5, convertCurrency($total['amt'], getCurrencySymbol($_SESSION['company_id'])) . " only", 0, 0, 'L');
        $pdf->Ln();
        $pdf->cMargin = $_cMargin;
    }
    $mysqli->close();
    $pdf->Output("purchase_return.pdf", "D");
} else {
    ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<link rel="shortcut icon" href="../images/logo_icon.gif">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link href="../stylesheets/style.css" rel="stylesheet" type="text/css" />
	<title><?php 
    echo $_SESSION['companyname'];
开发者ID:kashifnasim,项目名称:nexexcel,代码行数:31,代码来源:purchase_return.php

示例6: checkCbTransID

$md5_hash = $_REQUEST['md5_hash'];
checkCbTransID($transid);
$ourhash = md5($GATEWAY['md5hash'] . $GATEWAY['loginid'] . $transid . $amount);
if ($ourhash != $md5_hash) {
    logTransaction("Quantum Gateway", $_REQUEST, "MD5 Hash Failure");
    echo "Hash Failure. Please Contact Support.";
    exit;
}
$callbacksuccess = false;
$invoiceid = checkCbInvoiceID($invoiceid, "Quantum Gateway");
if ($GATEWAY['convertto']) {
    $result = select_query("tblinvoices", "userid,total", array("id" => $invoiceid));
    $data = mysql_fetch_array($result);
    $userid = $data['userid'];
    $total = $data['total'];
    $currency = getCurrency($userid);
    $amount = convertCurrency($amount, $GATEWAY['convertto'], $currency['id']);
    if ($total < $amount + 1 && $amount - 1 < $total) {
        $amount = $total;
    }
}
if ($transresult == "APPROVED") {
    addInvoicePayment($invoiceid, $transid, $amount, "", "quantumgateway", "on");
    logTransaction("Quantum Gateway", $_REQUEST, "Approved");
    sendMessage("Credit Card Payment Confirmation", $invoiceid);
    $callbacksuccess = true;
} else {
    logTransaction("Quantum Gateway", $_REQUEST, "Declined");
    sendMessage("Credit Card Payment Failed", $invoiceid);
}
callback3DSecureRedirect($invoiceid, $callbacksuccess);
开发者ID:billyprice1,项目名称:whmcs,代码行数:31,代码来源:quantumthreedsecure.php

示例7: select_query

    }
}
$result = select_query("tblcurrencies", "id", array("code" => $currency));
$data = mysql_fetch_array($result);
$currencyid = $data['id'];
if (!$currencyid) {
    logTransaction("Moneybookers", $_REQUEST, "Unrecognised Currency");
    exit;
}
if ($GATEWAY['convertto']) {
    $result = select_query("tblinvoices", "userid,total", array("id" => $invoiceid));
    $data = mysql_fetch_array($result);
    $userid = $data['userid'];
    $total = $data['total'];
    $currency = getCurrency($userid);
    $amount = convertCurrency($amount, $currencyid, $currency['id']);
    if ($total < $amount + 1 && $amount - 1 < $total) {
        $amount = $total;
    }
}
if ($_POST['status'] == "2") {
    $invoiceid = checkCbInvoiceID($invoiceid, "Moneybookers");
    if ($invoiceid) {
        addInvoicePayment($invoiceid, $transid, $amount, "", "moneybookers");
        logTransaction("Moneybookers", $_REQUEST, "Successful");
        return 1;
    }
    logTransaction("Moneybookers", $_REQUEST, "Error");
    return 1;
}
logTransaction("Moneybookers", $_REQUEST, "Unsuccessful");
开发者ID:billyprice1,项目名称:whmcs,代码行数:31,代码来源:moneybookers.php

示例8: session_start

<?php

session_start();
require_once '../includes/connecti.php';
require_once '../includes/funcs.inc.php';
if (isset($_GET['report']) && $_GET['report'] == 'true') {
    $MAX_LIMIT = 8;
    require_once '../includes/fpdf.php';
    $pdf = new FPDF('L', 'cm', array(7.7, 15.9));
    $pdf->SetAuthor("imranzahid+corpus@gmail.com");
    $pdf->SetSubject("Cheque");
    $pdf->SetTitle("Cheque");
    $pdf->SetCreator("Imran Zahid");
    $pdf->AddPage();
    $pdf->SetFont('Arial', '', 12);
    $amt = explode(' ', convertCurrency($_GET['amount']) . " Only.");
    $str1 = "";
    $sep = "";
    $w = 0;
    $counter = 0;
    do {
        $temp = $str1 . $sep . $amt[$counter];
        $w = $pdf->GetStringWidth($temp);
        if ($w < $MAX_LIMIT) {
            $str1 .= $sep . $amt[$counter];
            $sep = " ";
            $counter++;
        }
        if ($counter > count($amt)) {
            break;
        }
开发者ID:kashifnasim,项目名称:nexexcel,代码行数:31,代码来源:cheque.php

示例9: use_class

use_class('products_minierp');
$class_sp = new jng_sp();
$class_pm = new products_minierp();
//BEFORE DOING ANYTHING, FIRST WE NEED TO SET MATEXP AND COGS OF NEW ORDERS
$timestamp_new_orders_checker = strtotime('-2 days');
$jg_counter = 0;
$sp_counter = 0;
$q = "SELECT * FROM ((" . " SELECT" . "     0 AS jng_sp_id," . "     op.orders_products_id AS item_id," . "     o.date_purchased AS order_date," . "     op.products_id," . "     op.products_model AS products_code," . "     op.material_expenses AS item_matexp," . "     op.cogs AS item_cogs," . "     p.material_expenses" . " FROM orders o" . " INNER JOIN orders_products op ON op.orders_id = o.orders_id" . " LEFT JOIN products p ON p.products_id = op.products_id" . " WHERE (op.material_expenses = 0 OR op.cogs = 0)" . " AND op.orders_products_id > 0" . " AND p.material_expenses > 0" . ") UNION ALL (" . " SELECT" . "     jo.jng_sp_id," . "     joi.jng_sp_orders_items_id AS item_id," . "     jo.order_date," . "     joi.products_id," . "     joi.article_number AS products_code," . "     joi.material_expenses AS item_matexp," . "     joi.cogs AS item_cogs," . "     p.material_expenses" . " FROM jng_sp_orders jo" . " INNER JOIN jng_sp_orders_items joi ON joi.jng_sp_orders_id = jo.jng_sp_orders_id" . " LEFT JOIN products p ON p.products_id = joi.products_id" . " WHERE (joi.material_expenses = 0 OR joi.cogs = 0)" . " AND joi.jng_sp_orders_items_id > 0" . " )) temp_table" . " ORDER BY item_id";
//" LIMIT 10000";
$r = tep_db_query($q);
while ($row = tep_db_fetch_array($r)) {
    $order_date_timestamp = strtotime($row['order_date']);
    $p = new Product($row['products_id']);
    //By default we will always use the current material expense and cogs
    //it needs to be converted to local currency
    $matexp = convertCurrency($row['material_expenses'], CURRENCY_CODE_EURO, CURRENCY_DEFAULT);
    $cogs = $p->getProductCOGSValue();
    if ($order_date_timestamp < $timestamp_new_orders_checker) {
        $matexp = Product::getClosestMaterialExpensesOnSpecificDate($row['products_id'], $row['order_date'], $matexp);
        $cogs = Product::getClosestCOGSOnSpecificDate($row['products_id'], $row['order_date'], $cogs);
    }
    //echo $row['jng_sp_id'] . ' - ' . $row['item_id'] . ' - ' .
    //$row['products_code'] . ' - ' . $matexp;
    if ($matexp > 0 && $cogs > 0) {
        $sda = array();
        if ($row['item_matexp'] == 0) {
            $sda['material_expenses'] = $matexp;
        }
        if ($row['item_cogs'] == 0) {
            $sda['cogs'] = $cogs;
        }
开发者ID:blasiuscosa,项目名称:manobo-2008,代码行数:31,代码来源:daily-counter-cogs.php

示例10: header

         header('HTTP/1.1 400 Bad Request');
         exit('Your request could not be completed');
         break;
 }
 if ($gateway['instantpaid'] == on) {
     # The "Instant Activation" option is enabled, so we need to mark now
     # convert currency where necessary (GoCardless only handles GBP)
     $aCurrency = getCurrency($res['userid']);
     if ($gateway['convertto'] && $aCurrency['id'] != $gateway['convertto']) {
         # the users currency is not the same as the GoCardless currency, convert to the users currency
         $oBill->amount = convertCurrency($oBill->amount, $gateway['convertto'], $aCurrency['id']);
         $oBill->gocardless_fee = convertCurrency($oBill->gocardless_fee, $gateway['convertto'], $aCurrency['id']);
         # currency conversion on the setup fee bill
         if (isset($oSetupBill)) {
             $oSetupBill->amount = convertCurrency($oBill->amount, $gateway['convertto'], $aCurrency['id']);
             $oSetupBill->gocardless_fee = convertCurrency($oBill->gocardless_fee, $gateway['convertto'], $aCurrency['id']);
         }
     }
     # check if we are handling a preauth setup fee
     # if we are then we need to add it to the total bill
     if (isset($oSetupBill)) {
         addInvoicePayment($invoiceID, $oSetupBill->id, $oSetupBill->amount, $oSetupBill->gocardless_fees, $gateway['paymentmethod']);
         logTransaction($gateway['paymentmethod'], 'Setup fee of ' . $oSetupBill->amount . ' raised and logged for invoice ' . $invoiceID . ' with GoCardless ID ' . $oSetupBill->id, 'Successful');
     }
     # Log the payment for the amount of the main bill against the inovice
     addInvoicePayment($invoiceID, $oBill->id, $oBill->amount, $oBill->gocardless_fees, $gateway['paymentmethod']);
     logTransaction($gateway['paymentmethod'], 'Bill of ' . $oBill->amount . ' raised and logged for invoice ' . $invoiceID . ' with GoCardless ID ' . $oBill->id, 'Successful');
 } else {
     # Instant activation isn't enabled, so we will log in the Gateway Log but will not put anything on the invoice
     if (isset($oSetupBill)) {
         logTransaction($gateway['paymentmethod'], 'Setup fee bill ' . $oSetupBill->id . ' (' . $oSetupBill->amount . ') and bill ' . $oBill->id . ' (' . $oBill->amount . ') raised with GoCardless for invoice ' . $invoiceID . ', but not marked on invoice.', 'Pending');
开发者ID:siparker,项目名称:gocardless-whmcs,代码行数:31,代码来源:redirect.php

示例11: select_query

     case "Pagamento":
         break;
     case "Pagamento Online":
         $Taxa = $ProdValor * 2.9 / 100 + 0.4;
         break;
     case "Cartro de Crndito":
         $Taxa = $ProdValor * 6.4 / 100 + 0.4;
 }
 $result = select_query("tblinvoices", "userid,status", array("id" => $invoiceid));
 $payments = mysql_fetch_array($result);
 $userid = $payments['userid'];
 $status = $payments['status'];
 if ($GATEWAY['convertto']) {
     $currency = getCurrency($userid);
     $ProdValor = convertCurrency($ProdValor, $GATEWAY['convertto'], $currency['id']);
     $Taxa = convertCurrency($Taxa, $GATEWAY['convertto'], $currency['id']);
 }
 if ($GATEWAY['email'] != $VendedorEmail) {
     logTransaction("PagSeguro", $_REQUEST, "Invalid Vendor Email");
     return 1;
 }
 if ($StatusTransacao == "Aprovado") {
     if ($status == "Unpaid") {
         addInvoicePayment($invoiceid, $TransacaoID, $ProdValor, $Taxa, "pagseguro");
     }
     logTransaction("PagSeguro", $_REQUEST, "Incomplete");
     redirSystemURL("id=" . $invoiceid . "&paymentsuccess=true", "viewinvoice.php");
     return 1;
 }
 if ($StatusTransacao == "Completo") {
     $result = select_query("tblinvoices", "status", array("id" => $invoiceid));
开发者ID:billyprice1,项目名称:whmcs,代码行数:31,代码来源:pagseguro.php

示例12: addItem

 function addItem($elements_id, $supplier_code, $qty, $qty_unit, $unit_multiplier, $unit_price, $unit_price_currency, $username)
 {
     use_class('element');
     $e = new element($elements_id);
     if (is_null($this->orders_id) && !is_null($this->suppliers_id)) {
         $this->createNew($unit_price_currency, $username);
     }
     $unit_price_order_currency = $this->detail['currency'] == $unit_price_currency ? $unit_price : convertCurrency($unit_price, $unit_price_currency, $this->detail['currency']);
     $sda = array();
     $sda['elements_orders_id'] = $this->orders_id;
     $sda['elements_id'] = $elements_id;
     $sda['elements_weight'] = $e->detail['weight'];
     $sda['item_number'] = $supplier_code;
     $sda['quantity_request'] = $qty;
     $sda['quantity'] = '0';
     $sda['quantity_unit'] = $qty_unit;
     $sda['unit_multiplier'] = $unit_multiplier;
     $sda['unit_price'] = $unit_price;
     $sda['unit_price_currency'] = $unit_price_currency;
     $sda['unit_price_order_currency'] = $unit_price_order_currency;
     $sda['add_date'] = date('Y-m-d');
     $sda['add_by'] = $username;
     tep_db_perform('elements_orders_items', $sda);
     $this->loadItems();
 }
开发者ID:blasiuscosa,项目名称:manobo-2008,代码行数:25,代码来源:elements_order.php

示例13: getProducts

 public function getProducts($gid, $inclconfigops = false, $inclbundles = false)
 {
     global $currency;
     if (!$gid) {
         $result = select_query("tblproductgroups", "id", array("hidden" => ""), "order", "ASC");
         $data = mysql_fetch_array($result);
         $gid = $data[0];
     }
     $tmparray = array();
     $result = select_query("tblproducts", "", array("gid" => $gid, "hidden" => ""), "order` ASC,`name", "ASC");
     while ($data = mysql_fetch_array($result)) {
         $id = $data['id'];
         $type = $data['type'];
         $name = $data['name'];
         $description = $data['description'];
         $paytype = $data['paytype'];
         $freedomain = $data['freedomain'];
         $stockcontrol = $data['stockcontrol'];
         $qty = $data['qty'];
         $freedomainpaymentterms = $data['freedomainpaymentterms'];
         $sortorder = $data['order'];
         $freedomainpaymentterms = explode(",", $freedomainpaymentterms);
         $desc = $this->formatProductDescription($description);
         $product = array();
         $product['pid'] = $id;
         $product['type'] = $type;
         $product['name'] = $name;
         $product['description'] = $desc['original'];
         $product['features'] = $desc['features'];
         $product['featuresdesc'] = $desc['featuresdesc'];
         $product['paytype'] = $paytype;
         $product['pricing'] = getPricingInfo($id, $inclconfigops);
         $product['freedomain'] = $freedomain;
         $product['freedomainpaymentterms'] = $freedomainpaymentterms;
         if ($stockcontrol) {
             $product['qty'] = $qty;
         }
         $tmparray[$sortorder][] = $product;
     }
     if ($inclbundles) {
         $result = select_query("tblbundles", "", array("showgroup" => "1", "gid" => $gid));
         while ($data = mysql_fetch_array($result)) {
             $description = $data['description'];
             $desc = $this->formatProductDescription($description);
             $displayprice = $data['displayprice'];
             $displayprice = 0 < $displayprice ? formatCurrency(convertCurrency($displayprice, 1, $currency['id'])) : "";
             $tmparray[$data['sortorder']][] = array("bid" => $data['id'], "name" => $data['name'], "description" => $desc['original'], "features" => $desc['features'], "featuresdesc" => $desc['featuresdesc'], "displayprice" => $displayprice);
         }
     }
     ksort($tmparray);
     $productsarray = array();
     foreach ($tmparray as $sort => $items) {
         foreach ($items as $item) {
             $productsarray[] = $item;
         }
     }
     return $productsarray;
 }
开发者ID:billyprice1,项目名称:whmcs,代码行数:58,代码来源:class.orderform.php

示例14: logTransaction

     logTransaction($_GATEWAY['paymentmethod'], array_merge($transaction, $_POST), 'Callback - Failure 3 (Transaction not open)');
     header('HTTP/1.1 500 Transaction not open');
     exit;
 }
 // Get user and transaction currencies
 $userCurrency = getCurrency($transaction['userid']);
 $transactionCurrency = select_query('tblcurrencies', '', array('id' => $transaction['currencyid']));
 $transactionCurrency = mysql_fetch_assoc($transactionCurrency);
 // Check payment
 $mollie = new Mollie_API_Client();
 $mollie->setApiKey($_GATEWAY['key']);
 $payment = $mollie->payments->get($_POST['id']);
 if ($payment->isPaid()) {
     // Add conversion, when there is need to. WHMCS only supports currencies per user. WHY?!
     if ($transactionCurrency['id'] != $userCurrency['id']) {
         $transaction['amount'] = convertCurrency($transaction['amount'], $transaction['currencyid'], $userCurrency['id']);
     }
     // Check invoice
     $invoiceid = checkCbInvoiceID($transaction['invoiceid'], $_GATEWAY['paymentmethod']);
     checkCbTransID($transaction['paymentid']);
     // Add invoice
     addInvoicePayment($invoiceid, $transaction['paymentid'], $transaction['amount'], '', $_GATEWAY['paymentmethod']);
     update_query('gateway_mollie', array('status' => 'paid', 'updated' => date('Y-m-d H:i:s', time())), array('id' => $transaction['id']));
     logTransaction($_GATEWAY['paymentmethod'], array_merge($transaction, $_POST), 'Callback - Successful (Paid)');
     header('HTTP/1.1 200 OK');
     exit;
 } else {
     if ($payment->isOpen() == FALSE) {
         update_query('gateway_mollie', array('status' => 'closed', 'updated' => date('Y-m-d H:i:s', time())), array('id' => $transaction['id']));
         logTransaction($_GATEWAY['paymentmethod'], array_merge($transaction, $_POST), 'Callback - Successful (Closed)');
         header('HTTP/1.1 200 OK');
开发者ID:CloudOfTheBlue,项目名称:WHMCS-Mollie,代码行数:31,代码来源:callback.php

示例15: basename

             $newline = 0;
         }
         $pdf->Cell($cw, $line_height, $ctitle[$cwkey], 1, $newline, 'C', true);
     }
 }
 $counter++;
 $xpos = $margin_left + $cwidth[0];
 $img_file = basename(webImageSource($e_detail->image, '', '80', '80'));
 $img = $img_path . $img_file;
 if ($img != $img_path) {
     $test = getimagesize($img);
     if ($test[2] == 2) {
         $pdf->Image($img, $xpos + $img_boxpad, $ypos + $img_boxpad, $img_size, $img_size);
     }
 }
 $unit_price = convertCurrency($e['unit_price'], $e['unit_price_currency'], $currency);
 $qty_price = $e['quantity'] * $unit_price;
 $qty_weight = $e['quantity'] * $e['unit_multiplier'] * $e['elements_weight'];
 $total_price += $qty_price;
 $cellcontent = array();
 $cellcontent[] = $counter;
 $cellcontent[] = '';
 $cellcontent[] = $e['elements_id'];
 $cellcontent[] = $e['item_number'];
 $cellcontent[] = $e['quantity'] . ' ' . $e['quantity_unit'] . ($e['approved_by'] == '' ? ' *' : '');
 $cellcontent[] = displayCurrency($currency, $unit_price) . "\n(" . $e['elements_weight'] . ' gram)';
 $cellcontent[] = displayCurrency($currency, $qty_price) . "\n(" . $qty_weight . ' gram)';
 if ($eo->suppliers_id == '2') {
     $cellcontent[] = '';
     $cellcontent[] = '';
 }
开发者ID:blasiuscosa,项目名称:manobo-2008,代码行数:31,代码来源:elements-po.php


注:本文中的convertCurrency函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。